Version Description
- June 3rd, 2016 =
- Refactored boot sequence to prevent errors prior to completing PHP & WordPress version checks.
- Fixed issue that lead to version number not getting updated unless an updater class existed.
- Fixed issue with settings tabs on PHP 5.4 or lower.
- Fixed issue that caused upgrade notice not to dismiss immediately when dismissed.
- Fixed
Cannot use object of type stdClass as array in ../wp-content/plugins/easing-slider/src/Foundation/Options/OptionArray.php on line 25
issue. - Fixed
Warning: is_readable() [function.is-readable]: open_basedir restriction in effect.
error. - Additional tweaks and enhancements under the hood.
Download this release
Release Info
Developer | MatthewRuddy |
Plugin | Easing Slider |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- bower.json +1 -1
- easing-slider.php +12 -46
- languages/easingslider.pot +12 -26
- package.json +1 -1
- readme.txt +12 -3
- src/Foundation/Admin/Panels/SettingsApiPanel.php +5 -2
- src/Foundation/Admin/Upgrades/Upgrade.php +65 -0
- src/Foundation/Admin/Upgrades/Upgrader.php +88 -41
- src/Foundation/Admin/Upgrades/Upgrades.php +0 -74
- src/Foundation/Contracts/Admin/Upgrades/Upgrade.php +35 -0
- src/Foundation/Contracts/Admin/Upgrades/Upgrader.php +1 -6
- src/Foundation/Contracts/Admin/Upgrades/Upgrades.php +0 -15
- src/Foundation/Options/OptionArray.php +19 -0
- src/Plugin/Admin/Admin.php +6 -6
- src/Plugin/Admin/Upgrades/UpgradeTo300.php +6 -17
- src/Plugin/Admin/Upgrades/Upgrader.php +5 -7
- src/Plugin/Admin/Upgrades/Upgrades.php +0 -25
- src/Plugin/Contracts/Options/UpgradeLicense.php +0 -0
- src/Plugin/Options/UpgradeLicense.php +0 -32
- src/Plugin/Plugin.php +1 -1
- src/Plugin/helpers.php +40 -18
- vendor/composer/autoload_namespaces.php +0 -1
bower.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"name": "Easing Slider",
|
3 |
-
"version": "3.0.
|
4 |
"homepage": "https://github.com/easingslider/easing-slider",
|
5 |
"authors": [
|
6 |
"MatthewRuddy <info@matthewruddy.com>"
|
1 |
{
|
2 |
"name": "Easing Slider",
|
3 |
+
"version": "3.0.2",
|
4 |
"homepage": "https://github.com/easingslider/easing-slider",
|
5 |
"authors": [
|
6 |
"MatthewRuddy <info@matthewruddy.com>"
|
easing-slider.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Easing Slider
|
4 |
* Plugin URI: http://easingslider.com/
|
5 |
* Description: A simple WordPress plugin for creating beautiful sliders.
|
6 |
-
* Version: 3.0.
|
7 |
* Author: Matthew Ruddy
|
8 |
* Author URI: http://matthewruddy.com
|
9 |
* License: GPL2
|
@@ -25,7 +25,7 @@ if ( ! defined('ABSPATH')) {
|
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
-
define('EASINGSLIDER_VERSION', '3.0.
|
29 |
define('EASINGSLIDER_NAME', 'Easing Slider');
|
30 |
define('EASINGSLIDER_API_URL', 'http://easingslider.com/');
|
31 |
define('EASINGSLIDER_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
@@ -39,11 +39,12 @@ define('EASINGSLIDER_TEMPLATES_DIR', EASINGSLIDER_PLUGIN_DIR .'templates/');
|
|
39 |
define('EASINGSLIDER_TEMPLATES_URL', EASINGSLIDER_PLUGIN_URL .'templates/');
|
40 |
|
41 |
/**
|
42 |
-
* Checks requirements to ensure we have the minimum PHP and WordPress versions required
|
|
|
43 |
*
|
44 |
* @return void
|
45 |
*/
|
46 |
-
function
|
47 |
{
|
48 |
global $wp_version;
|
49 |
|
@@ -55,60 +56,25 @@ function easingslider_check_requirements()
|
|
55 |
// Deactivate the plugin if using less than PHP 5.3.
|
56 |
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
57 |
deactivate_plugins(plugin_basename(EASINGSLIDER_PLUGIN_FILE));
|
58 |
-
wp_die(sprintf(__('Sorry, but your version of PHP (
|
59 |
exit();
|
60 |
}
|
61 |
|
62 |
// Deactivate the plugin if the WordPress version is below the minimum required.
|
63 |
if (version_compare($wp_version, '4.5', '<')) {
|
64 |
deactivate_plugins(plugin_basename(EASINGSLIDER_PLUGIN_FILE));
|
65 |
-
wp_die(sprintf(__('Sorry, but your version of WordPress, <strong>%s</strong>, is not supported by Easing Slider.
|
66 |
exit();
|
67 |
}
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Do the requirements check
|
72 |
-
*/
|
73 |
-
easingslider_check_requirements();
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
*/
|
78 |
-
require_once('vendor/autoload.php');
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
*
|
83 |
-
* Use this function like you would a global variable, except without needing
|
84 |
-
* to declare the global.
|
85 |
-
*
|
86 |
-
* Example: <?php $easing_slider = Easing_Slider(); ?>
|
87 |
-
*
|
88 |
-
* @return Easing_Slider
|
89 |
-
*/
|
90 |
-
function Easing_Slider()
|
91 |
-
{
|
92 |
-
return \EasingSlider\Plugin\Plugin::instance();
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
* Let's go!
|
97 |
*/
|
98 |
-
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Activator
|
102 |
-
*
|
103 |
-
* @return void
|
104 |
-
*/
|
105 |
-
function easingslider_activate()
|
106 |
-
{
|
107 |
-
$activator = Easing_Slider()->activator();
|
108 |
-
$activator->activate();
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Register activation hook
|
113 |
-
*/
|
114 |
-
register_activation_hook(__FILE__, 'easingslider_activate');
|
3 |
* Plugin Name: Easing Slider
|
4 |
* Plugin URI: http://easingslider.com/
|
5 |
* Description: A simple WordPress plugin for creating beautiful sliders.
|
6 |
+
* Version: 3.0.2
|
7 |
* Author: Matthew Ruddy
|
8 |
* Author URI: http://matthewruddy.com
|
9 |
* License: GPL2
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
+
define('EASINGSLIDER_VERSION', '3.0.2');
|
29 |
define('EASINGSLIDER_NAME', 'Easing Slider');
|
30 |
define('EASINGSLIDER_API_URL', 'http://easingslider.com/');
|
31 |
define('EASINGSLIDER_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
39 |
define('EASINGSLIDER_TEMPLATES_URL', EASINGSLIDER_PLUGIN_URL .'templates/');
|
40 |
|
41 |
/**
|
42 |
+
* Checks requirements to ensure we have the minimum PHP and WordPress versions required,
|
43 |
+
* and if we do, boots the plugin.
|
44 |
*
|
45 |
* @return void
|
46 |
*/
|
47 |
+
function easingslider_boot()
|
48 |
{
|
49 |
global $wp_version;
|
50 |
|
56 |
// Deactivate the plugin if using less than PHP 5.3.
|
57 |
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
58 |
deactivate_plugins(plugin_basename(EASINGSLIDER_PLUGIN_FILE));
|
59 |
+
wp_die(sprintf(__('Sorry, but your version of PHP (%s) is not supported by Easing Slider. PHP 5.3 or greater is required. We recommend contacting your hosting provider to have your PHP version upgraded. Easing Slider has been deactivated. <a href="%s">Return to the Dashboard.</a>', 'easingslider'), PHP_VERSION, admin_url()));
|
60 |
exit();
|
61 |
}
|
62 |
|
63 |
// Deactivate the plugin if the WordPress version is below the minimum required.
|
64 |
if (version_compare($wp_version, '4.5', '<')) {
|
65 |
deactivate_plugins(plugin_basename(EASINGSLIDER_PLUGIN_FILE));
|
66 |
+
wp_die(sprintf(__('Sorry, but your version of WordPress, <strong>%s</strong>, is not supported by Easing Slider. Easing Slider has been deactivated. <a href="%s">Return to the Dashboard.</a>', 'easingslider'), $wp_version, admin_url()));
|
67 |
exit();
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
+
// Everything is good to go, let's load our dependencies
|
71 |
+
require_once('vendor/autoload.php');
|
|
|
|
|
72 |
|
73 |
+
// Now let's boot the plugin
|
74 |
+
Easing_Slider();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
* Let's go!
|
79 |
*/
|
80 |
+
easingslider_boot();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/easingslider.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Easing Slider 3.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easing-slider\n"
|
7 |
-
"POT-Creation-Date: 2016-06-03
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -61,34 +61,20 @@ msgstr ""
|
|
61 |
msgid "An unknown error occurred. Please contact support."
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:
|
65 |
msgid "Settings updated."
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:
|
69 |
-
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:
|
70 |
-
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:
|
71 |
msgid "No options available."
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:
|
75 |
msgid "The callback function used for the <strong>%s</strong> setting is missing."
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: src/Plugin/Activation/Activator.php:57
|
79 |
-
msgid ""
|
80 |
-
"Sorry, but your version of PHP (v%s) is not supported. PHP v5.3.0 or "
|
81 |
-
"greater is required. The plugin has been deactivated. <a href=\"%s\">Return "
|
82 |
-
"to the Dashboard.</a>"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
#: src/Plugin/Activation/Activator.php:64
|
86 |
-
msgid ""
|
87 |
-
"Sorry, but your version of WordPress, <strong>%s</strong>, is not "
|
88 |
-
"supported. The plugin has been deactivated. <a href=\"%s\">Return to the "
|
89 |
-
"Dashboard.</a>"
|
90 |
-
msgstr ""
|
91 |
-
|
92 |
#: src/Plugin/Admin/Actions/Addons.php:102
|
93 |
msgid "Please enter a license key."
|
94 |
msgstr ""
|
@@ -445,28 +431,28 @@ msgstr ""
|
|
445 |
msgid " (ID #%s)"
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: src/Plugin/helpers.php:
|
449 |
msgid ""
|
450 |
"An upgrade to your license key is required to allow addon access when using "
|
451 |
"Easing Slider v3.0.0 or greater. <a href=\"%s\" target=\"_blank\">Click "
|
452 |
"here</a> to get your new license key for free."
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: src/Plugin/helpers.php:
|
456 |
msgid "Thanks for Upgrading!"
|
457 |
msgstr ""
|
458 |
|
459 |
-
#: src/Plugin/helpers.php:
|
460 |
msgid ""
|
461 |
"Thank you for upgrading to Easing Slider v3! So much has changed - please "
|
462 |
"check out the important update information below."
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: src/Plugin/helpers.php:
|
466 |
msgid "Important Addon & Licensing Changes"
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: src/Plugin/helpers.php:
|
470 |
msgid "Dismiss"
|
471 |
msgstr ""
|
472 |
|
2 |
# This file is distributed under the GPL2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Easing Slider 3.0.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easing-slider\n"
|
7 |
+
"POT-Creation-Date: 2016-06-03 20:36:11+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
61 |
msgid "An unknown error occurred. Please contact support."
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:169
|
65 |
msgid "Settings updated."
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:261
|
69 |
+
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:286
|
70 |
+
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:386
|
71 |
msgid "No options available."
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: src/Foundation/Admin/Panels/SettingsApiPanel.php:365
|
75 |
msgid "The callback function used for the <strong>%s</strong> setting is missing."
|
76 |
msgstr ""
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
#: src/Plugin/Admin/Actions/Addons.php:102
|
79 |
msgid "Please enter a license key."
|
80 |
msgstr ""
|
431 |
msgid " (ID #%s)"
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: src/Plugin/helpers.php:499
|
435 |
msgid ""
|
436 |
"An upgrade to your license key is required to allow addon access when using "
|
437 |
"Easing Slider v3.0.0 or greater. <a href=\"%s\" target=\"_blank\">Click "
|
438 |
"here</a> to get your new license key for free."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: src/Plugin/helpers.php:528
|
442 |
msgid "Thanks for Upgrading!"
|
443 |
msgstr ""
|
444 |
|
445 |
+
#: src/Plugin/helpers.php:529
|
446 |
msgid ""
|
447 |
"Thank you for upgrading to Easing Slider v3! So much has changed - please "
|
448 |
"check out the important update information below."
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: src/Plugin/helpers.php:533
|
452 |
msgid "Important Addon & Licensing Changes"
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: src/Plugin/helpers.php:537
|
456 |
msgid "Dismiss"
|
457 |
msgstr ""
|
458 |
|
package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"name": "easing-slider",
|
3 |
"title": "Easing Slider",
|
4 |
-
"version": "3.0.
|
5 |
"devDependencies": {
|
6 |
"grunt": "0.4.5",
|
7 |
"grunt-contrib-concat": "^0.5.1",
|
1 |
{
|
2 |
"name": "easing-slider",
|
3 |
"title": "Easing Slider",
|
4 |
+
"version": "3.0.2",
|
5 |
"devDependencies": {
|
6 |
"grunt": "0.4.5",
|
7 |
"grunt-contrib-concat": "^0.5.1",
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: MatthewRuddy
|
|
4 |
Tags: slider, wordpress slider, carousel, image slider, responsive slider, slide, slider, slideshow, wordpress slideshow, youtube slider, photo slider, banner rotator, best slider, content slider, fullwidth slider, gallery, hardware accelerate, mobile slider,post slider, swipe, touch slider, page slider, slider plugin, slider shortcode
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -89,11 +89,20 @@ This is easy. When editing a slider in the "All Sliders" admin area, simply clic
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
-
= 3.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
* Fixed bug that prevented lazy loading icon from showing when loading is in progress.
|
94 |
* Minimum requirement checks now occur before any PHP v5.3 namespaced code gets loaded, thus preventing fatal errors.
|
95 |
|
96 |
-
= 3.0.0 =
|
97 |
* A complete internal rebuild, now fully compatible with current versions of WordPress and those coming in the future. Marks the start of a new product direction for Easing Slider, and a renewed committment to continued development!
|
98 |
|
99 |
= 2.2.1.1 =
|
4 |
Tags: slider, wordpress slider, carousel, image slider, responsive slider, slide, slider, slideshow, wordpress slideshow, youtube slider, photo slider, banner rotator, best slider, content slider, fullwidth slider, gallery, hardware accelerate, mobile slider,post slider, swipe, touch slider, page slider, slider plugin, slider shortcode
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 3.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 3.0.2 - June 3rd, 2016 =
|
93 |
+
* Refactored boot sequence to prevent errors prior to completing PHP & WordPress version checks.
|
94 |
+
* Fixed issue that lead to version number not getting updated unless an updater class existed.
|
95 |
+
* Fixed issue with settings tabs on PHP 5.4 or lower.
|
96 |
+
* Fixed issue that caused upgrade notice not to dismiss immediately when dismissed.
|
97 |
+
* Fixed `Cannot use object of type stdClass as array in ../wp-content/plugins/easing-slider/src/Foundation/Options/OptionArray.php on line 25` issue.
|
98 |
+
* Fixed `Warning: is_readable() [function.is-readable]: open_basedir restriction in effect.` error.
|
99 |
+
* Additional tweaks and enhancements under the hood.
|
100 |
+
|
101 |
+
= 3.0.1 - June 3rd, 2016 =
|
102 |
* Fixed bug that prevented lazy loading icon from showing when loading is in progress.
|
103 |
* Minimum requirement checks now occur before any PHP v5.3 namespaced code gets loaded, thus preventing fatal errors.
|
104 |
|
105 |
+
= 3.0.0 - June 3rd, 2016 =
|
106 |
* A complete internal rebuild, now fully compatible with current versions of WordPress and those coming in the future. Marks the start of a new product direction for Easing Slider, and a renewed committment to continued development!
|
107 |
|
108 |
= 2.2.1.1 =
|
src/Foundation/Admin/Panels/SettingsApiPanel.php
CHANGED
@@ -155,9 +155,12 @@ abstract class SettingsApiPanel extends Panel implements PanelContract
|
|
155 |
// Parse referer
|
156 |
parse_str($_POST['_wp_http_referer'], $referrer);
|
157 |
|
158 |
-
// Get the settings
|
159 |
$settings = $this->getSections();
|
160 |
-
$
|
|
|
|
|
|
|
161 |
|
162 |
// Validate
|
163 |
$input = $this->validateInput($input);
|
155 |
// Parse referer
|
156 |
parse_str($_POST['_wp_http_referer'], $referrer);
|
157 |
|
158 |
+
// Get the settings sections and tabs
|
159 |
$settings = $this->getSections();
|
160 |
+
$tabs = $this->getTabs();
|
161 |
+
|
162 |
+
// Get the current tab
|
163 |
+
$tab = isset($referrer['tab']) ? $referrer['tab'] : current($tabs);
|
164 |
|
165 |
// Validate
|
166 |
$input = $this->validateInput($input);
|
src/Foundation/Admin/Upgrades/Upgrade.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace EasingSlider\Foundation\Admin\Upgrades;
|
4 |
+
|
5 |
+
use EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrade as UpgradeContract;
|
6 |
+
use EasingSlider\Foundation\Contracts\Options\Option;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Exit if accessed directly
|
10 |
+
*/
|
11 |
+
if ( ! defined('ABSPATH')) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
abstract class Upgrade implements UpgradeContract
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* The version we're upgrading from (or greater)
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $upgradeFrom;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The version we're upgrading too
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
protected $upgradeTo;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get the version we are upgrading too
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getVersion()
|
37 |
+
{
|
38 |
+
return $this->upgradeTo;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Checks if the provided version is eligible for an upgrade
|
43 |
+
*
|
44 |
+
* @param string $version
|
45 |
+
* @return boolean
|
46 |
+
*/
|
47 |
+
public function isEligible($version)
|
48 |
+
{
|
49 |
+
// Compare version against upgrade "to" and "from" values to ensure a strict bracket of eligible versions.
|
50 |
+
if (version_compare($version, $this->upgradeFrom, '>=')) {
|
51 |
+
if (version_compare($version, $this->upgradeTo, '<')) {
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Executes the upgrade
|
61 |
+
*
|
62 |
+
* @return void
|
63 |
+
*/
|
64 |
+
abstract public function upgrade();
|
65 |
+
}
|
src/Foundation/Admin/Upgrades/Upgrader.php
CHANGED
@@ -2,8 +2,9 @@
|
|
2 |
|
3 |
namespace EasingSlider\Foundation\Admin\Upgrades;
|
4 |
|
|
|
5 |
use EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader as UpgraderContract;
|
6 |
-
use EasingSlider\Foundation\Contracts\
|
7 |
|
8 |
/**
|
9 |
* Exit if accessed directly
|
@@ -15,93 +16,139 @@ if ( ! defined('ABSPATH')) {
|
|
15 |
abstract class Upgrader implements UpgraderContract
|
16 |
{
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
* @var
|
21 |
*/
|
22 |
-
protected $
|
23 |
|
24 |
/**
|
25 |
-
*
|
26 |
*
|
27 |
-
* @var
|
28 |
*/
|
29 |
-
protected $
|
30 |
|
31 |
/**
|
32 |
-
*
|
33 |
*
|
34 |
-
* @var
|
35 |
*/
|
36 |
-
protected $
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
*
|
41 |
-
* @
|
|
|
42 |
*/
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
/**
|
46 |
-
*
|
47 |
*
|
48 |
-
* @param \EasingSlider\Foundation\Contracts\Options\Option $version
|
49 |
* @return void
|
50 |
*/
|
51 |
-
|
52 |
{
|
53 |
-
$this
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
-
*
|
58 |
*
|
59 |
-
* @return
|
60 |
*/
|
61 |
-
protected function
|
62 |
{
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
// Compare version against upgrade "to" and "from" values to ensure a strict bracket of eligible versions.
|
67 |
-
if (version_compare($version, $this->upgradeFrom, '>=')) {
|
68 |
-
if (version_compare($version, $this->upgradeTo, '<')) {
|
69 |
-
return true;
|
70 |
-
}
|
71 |
-
}
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
-
*
|
78 |
*
|
|
|
79 |
* @return void
|
80 |
*/
|
81 |
-
protected function
|
82 |
{
|
83 |
-
$this->version->setValue($
|
84 |
$this->version->save();
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
*
|
|
|
90 |
* @return void
|
91 |
*/
|
92 |
-
|
93 |
{
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
$this->updateVersion();
|
98 |
}
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
-
*
|
103 |
*
|
104 |
* @return void
|
105 |
*/
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace EasingSlider\Foundation\Admin\Upgrades;
|
4 |
|
5 |
+
use EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrade;
|
6 |
use EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader as UpgraderContract;
|
7 |
+
use EasingSlider\Foundation\Contracts\Plugin;
|
8 |
|
9 |
/**
|
10 |
* Exit if accessed directly
|
16 |
abstract class Upgrader implements UpgraderContract
|
17 |
{
|
18 |
/**
|
19 |
+
* Upgrades
|
20 |
*
|
21 |
+
* @var array
|
22 |
*/
|
23 |
+
protected $upgrades = array();
|
24 |
|
25 |
/**
|
26 |
+
* Plugin
|
27 |
*
|
28 |
+
* @var \EasingSlider\Foundation\Contracts\Plugin
|
29 |
*/
|
30 |
+
protected $plugin;
|
31 |
|
32 |
/**
|
33 |
+
* Version
|
34 |
*
|
35 |
+
* @var \EasingSlider\Plugin\Contracts\Options\Version
|
36 |
*/
|
37 |
+
protected $version;
|
38 |
|
39 |
/**
|
40 |
+
* Constructor
|
41 |
*
|
42 |
+
* @param \EasingSlider\Foundation\Contracts\Plugin $plugin
|
43 |
+
* @return void
|
44 |
*/
|
45 |
+
public function __construct(Plugin $plugin)
|
46 |
+
{
|
47 |
+
$this->plugin = $plugin;
|
48 |
+
|
49 |
+
$this->version = $plugin->version();
|
50 |
+
|
51 |
+
$this->defineHooks();
|
52 |
+
|
53 |
+
$this->boot();
|
54 |
+
}
|
55 |
|
56 |
/**
|
57 |
+
* Define hooks
|
58 |
*
|
|
|
59 |
* @return void
|
60 |
*/
|
61 |
+
protected function defineHooks()
|
62 |
{
|
63 |
+
add_action('admin_init', array($this, 'doUpgrades'));
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* Gets the plugin version
|
68 |
*
|
69 |
+
* @return string
|
70 |
*/
|
71 |
+
protected function getVersion()
|
72 |
{
|
73 |
+
return $this->version->getValue();
|
74 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
/**
|
77 |
+
* Gets the current plugin version
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
protected function getCurrentVersion()
|
82 |
+
{
|
83 |
+
return EASINGSLIDER_VERSION;
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* Sets the plugin version
|
88 |
*
|
89 |
+
* @param string $version
|
90 |
* @return void
|
91 |
*/
|
92 |
+
protected function setVersion($version)
|
93 |
{
|
94 |
+
$this->version->setValue($version);
|
95 |
$this->version->save();
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
+
* Sets the current plugin version
|
100 |
+
*
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
protected function setCurrentVersion()
|
104 |
+
{
|
105 |
+
$version = $this->getVersion();
|
106 |
+
$currentVersion = $this->getCurrentVersion();
|
107 |
+
|
108 |
+
if ($currentVersion != $version) {
|
109 |
+
$this->setVersion($currentVersion);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Handles an upgrade
|
115 |
*
|
116 |
+
* @param \EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrade $upgrade
|
117 |
* @return void
|
118 |
*/
|
119 |
+
protected function handleUpgrade(Upgrade $upgrade)
|
120 |
{
|
121 |
+
$version = $this->getVersion();
|
122 |
+
|
123 |
+
if ($upgrade->isEligible($version)) {
|
124 |
+
|
125 |
+
// Do the upgrade
|
126 |
+
$upgrade->upgrade();
|
127 |
+
|
128 |
+
// Set the version
|
129 |
+
$this->setVersion($upgrade->getVersion());
|
130 |
|
|
|
131 |
}
|
132 |
}
|
133 |
|
134 |
/**
|
135 |
+
* Do upgrades
|
136 |
*
|
137 |
* @return void
|
138 |
*/
|
139 |
+
public function doUpgrades()
|
140 |
+
{
|
141 |
+
foreach ($this->upgrades as $upgrade) {
|
142 |
+
$this->handleUpgrade($upgrade);
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->setCurrentVersion();
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Boot
|
150 |
+
*
|
151 |
+
* @return void
|
152 |
+
*/
|
153 |
+
abstract protected function boot();
|
154 |
+
}
|
src/Foundation/Admin/Upgrades/Upgrades.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace EasingSlider\Foundation\Admin\Upgrades;
|
4 |
-
|
5 |
-
use EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrades as UpgradesContract;
|
6 |
-
use EasingSlider\Foundation\Contracts\Plugin;
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Exit if accessed directly
|
10 |
-
*/
|
11 |
-
if ( ! defined('ABSPATH')) {
|
12 |
-
exit;
|
13 |
-
}
|
14 |
-
|
15 |
-
abstract class Upgrades implements UpgradesContract
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* Upgrades
|
19 |
-
*
|
20 |
-
* @var array
|
21 |
-
*/
|
22 |
-
protected $upgrades = array();
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Plugin
|
26 |
-
*
|
27 |
-
* @var \EasingSlider\Foundation\Contracts\Plugin
|
28 |
-
*/
|
29 |
-
protected $plugin;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Constructor
|
33 |
-
*
|
34 |
-
* @param \EasingSlider\Foundation\Contracts\Plugin $plugin
|
35 |
-
* @return void
|
36 |
-
*/
|
37 |
-
public function __construct(Plugin $plugin)
|
38 |
-
{
|
39 |
-
$this->plugin = $plugin;
|
40 |
-
|
41 |
-
$this->defineHooks();
|
42 |
-
|
43 |
-
$this->boot();
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Define hooks
|
48 |
-
*
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
protected function defineHooks()
|
52 |
-
{
|
53 |
-
add_action('admin_init', array($this, 'doUpgrades'));
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Do upgrades
|
58 |
-
*
|
59 |
-
* @return void
|
60 |
-
*/
|
61 |
-
public function doUpgrades()
|
62 |
-
{
|
63 |
-
foreach ($this->upgraders as $upgrader) {
|
64 |
-
$upgrader->upgrade();
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Boot
|
70 |
-
*
|
71 |
-
* @return void
|
72 |
-
*/
|
73 |
-
abstract protected function boot();
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/Foundation/Contracts/Admin/Upgrades/Upgrade.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace EasingSlider\Foundation\Contracts\Admin\Upgrades;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Exit if accessed directly
|
7 |
+
*/
|
8 |
+
if ( ! defined('ABSPATH')) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
interface Upgrade
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Get the version we are upgrading too
|
16 |
+
*
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public function getVersion();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Checks if the provided version is eligible for an upgrade
|
23 |
+
*
|
24 |
+
* @param string $version
|
25 |
+
* @return boolean
|
26 |
+
*/
|
27 |
+
public function isEligible($version);
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Executes the upgrade
|
31 |
+
*
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
public function upgrade();
|
35 |
+
}
|
src/Foundation/Contracts/Admin/Upgrades/Upgrader.php
CHANGED
@@ -11,10 +11,5 @@ if ( ! defined('ABSPATH')) {
|
|
11 |
|
12 |
interface Upgrader
|
13 |
{
|
14 |
-
|
15 |
-
* Executes an upgrade
|
16 |
-
*
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
public function upgrade();
|
20 |
}
|
11 |
|
12 |
interface Upgrader
|
13 |
{
|
14 |
+
//
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
src/Foundation/Contracts/Admin/Upgrades/Upgrades.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace EasingSlider\Foundation\Contracts\Admin\Upgrades;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Exit if accessed directly
|
7 |
-
*/
|
8 |
-
if ( ! defined('ABSPATH')) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
interface Upgrades
|
13 |
-
{
|
14 |
-
//
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/Foundation/Options/OptionArray.php
CHANGED
@@ -14,6 +14,25 @@ if ( ! defined('ABSPATH')) {
|
|
14 |
|
15 |
abstract class OptionArray extends Option implements OptionArrayContract
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
* Checks if an offset exists
|
19 |
*
|
14 |
|
15 |
abstract class OptionArray extends Option implements OptionArrayContract
|
16 |
{
|
17 |
+
/**
|
18 |
+
* Value
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
public $value = array();
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Gets the option value
|
26 |
+
*
|
27 |
+
* @return mixed
|
28 |
+
*/
|
29 |
+
public function getValue()
|
30 |
+
{
|
31 |
+
$value = get_option($this->name, $this->getDefaults());
|
32 |
+
|
33 |
+
return array_merge($this->getDefaults(), (array) $value);
|
34 |
+
}
|
35 |
+
|
36 |
/**
|
37 |
* Checks if an offset exists
|
38 |
*
|
src/Plugin/Admin/Admin.php
CHANGED
@@ -71,11 +71,11 @@ class Admin extends BaseAdmin
|
|
71 |
protected $notices;
|
72 |
|
73 |
/**
|
74 |
-
*
|
75 |
*
|
76 |
-
* @var \EasingSlider\Foundation\Contracts\Admin\Upgrades\
|
77 |
*/
|
78 |
-
protected $
|
79 |
|
80 |
/**
|
81 |
* Aliases
|
@@ -92,7 +92,7 @@ class Admin extends BaseAdmin
|
|
92 |
'\EasingSlider\Foundation\Contracts\Admin\Menus\Menu' => '\EasingSlider\Plugin\Admin\Menus\Menu',
|
93 |
'\EasingSlider\Foundation\Contracts\Admin\Panels\Panels' => '\EasingSlider\Plugin\Admin\Panels\Panels',
|
94 |
'\EasingSlider\Foundation\Contracts\Admin\PluginUpdaters\PluginUpdater' => '\EasingSlider\Plugin\Admin\AddonUpdater',
|
95 |
-
'\EasingSlider\Foundation\Contracts\Admin\Upgrades\
|
96 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\License' => '\EasingSlider\Plugin\Admin\Validators\License',
|
97 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\Settings' => '\EasingSlider\Plugin\Admin\Validators\Settings',
|
98 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\Slider' => '\EasingSlider\Plugin\Admin\Validators\Slider'
|
@@ -111,7 +111,7 @@ class Admin extends BaseAdmin
|
|
111 |
'\EasingSlider\Foundation\Contracts\Admin\LicenseHandlers\LicenseHandler',
|
112 |
'\EasingSlider\Foundation\Contracts\Admin\Menus\Menu',
|
113 |
'\EasingSlider\Foundation\Contracts\Admin\Panels\Panels',
|
114 |
-
'\EasingSlider\Foundation\Contracts\Admin\Upgrades\
|
115 |
);
|
116 |
|
117 |
/**
|
@@ -128,6 +128,6 @@ class Admin extends BaseAdmin
|
|
128 |
$this->mediaButton = $this->plugin->make('\EasingSlider\Plugin\Admin\MediaButton');
|
129 |
$this->menu = $this->plugin->make('\EasingSlider\Foundation\Contracts\Admin\Menus\Menu');
|
130 |
$this->notices = $this->plugin->make('\EasingSlider\Foundation\Contracts\Admin\Notices\NoticeHandler');
|
131 |
-
$this->
|
132 |
}
|
133 |
}
|
71 |
protected $notices;
|
72 |
|
73 |
/**
|
74 |
+
* Upgrader
|
75 |
*
|
76 |
+
* @var \EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader
|
77 |
*/
|
78 |
+
protected $upgrader;
|
79 |
|
80 |
/**
|
81 |
* Aliases
|
92 |
'\EasingSlider\Foundation\Contracts\Admin\Menus\Menu' => '\EasingSlider\Plugin\Admin\Menus\Menu',
|
93 |
'\EasingSlider\Foundation\Contracts\Admin\Panels\Panels' => '\EasingSlider\Plugin\Admin\Panels\Panels',
|
94 |
'\EasingSlider\Foundation\Contracts\Admin\PluginUpdaters\PluginUpdater' => '\EasingSlider\Plugin\Admin\AddonUpdater',
|
95 |
+
'\EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader' => '\EasingSlider\Plugin\Admin\Upgrades\Upgrader',
|
96 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\License' => '\EasingSlider\Plugin\Admin\Validators\License',
|
97 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\Settings' => '\EasingSlider\Plugin\Admin\Validators\Settings',
|
98 |
'\EasingSlider\Plugin\Contracts\Admin\Validators\Slider' => '\EasingSlider\Plugin\Admin\Validators\Slider'
|
111 |
'\EasingSlider\Foundation\Contracts\Admin\LicenseHandlers\LicenseHandler',
|
112 |
'\EasingSlider\Foundation\Contracts\Admin\Menus\Menu',
|
113 |
'\EasingSlider\Foundation\Contracts\Admin\Panels\Panels',
|
114 |
+
'\EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader'
|
115 |
);
|
116 |
|
117 |
/**
|
128 |
$this->mediaButton = $this->plugin->make('\EasingSlider\Plugin\Admin\MediaButton');
|
129 |
$this->menu = $this->plugin->make('\EasingSlider\Foundation\Contracts\Admin\Menus\Menu');
|
130 |
$this->notices = $this->plugin->make('\EasingSlider\Foundation\Contracts\Admin\Notices\NoticeHandler');
|
131 |
+
$this->upgrader = $this->plugin->make('\EasingSlider\Foundation\Contracts\Admin\Upgrades\Upgrader');
|
132 |
}
|
133 |
}
|
src/Plugin/Admin/Upgrades/UpgradeTo300.php
CHANGED
@@ -4,10 +4,9 @@ namespace EasingSlider\Plugin\Admin\Upgrades;
|
|
4 |
|
5 |
use WP_Roles;
|
6 |
use WP_Query;
|
7 |
-
use EasingSlider\
|
8 |
use EasingSlider\Plugin\Contracts\Options\License;
|
9 |
use EasingSlider\Plugin\Contracts\Options\Settings;
|
10 |
-
use EasingSlider\Plugin\Contracts\Options\Version;
|
11 |
|
12 |
/**
|
13 |
* Exit if accessed directly
|
@@ -16,7 +15,7 @@ if ( ! defined('ABSPATH')) {
|
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
-
class UpgradeTo300 extends
|
20 |
{
|
21 |
/**
|
22 |
* Settings
|
@@ -46,27 +45,17 @@ class UpgradeTo300 extends Upgrader
|
|
46 |
*/
|
47 |
protected $upgradeTo = '3.0.0';
|
48 |
|
49 |
-
/**
|
50 |
-
* Operator for version comparison
|
51 |
-
*
|
52 |
-
* @var string
|
53 |
-
*/
|
54 |
-
protected $operator = '>=';
|
55 |
-
|
56 |
/**
|
57 |
* Constructor
|
58 |
*
|
59 |
-
* @param \EasingSlider\Plugin\Contracts\Options\Version $version
|
60 |
* @param \EasingSlider\Plugin\Contracts\Options\Settings $settings
|
61 |
* @param \EasingSlider\Plugin\Contracts\Options\License $license
|
62 |
* @return void
|
63 |
*/
|
64 |
-
public function __construct(
|
65 |
{
|
66 |
$this->settings = $settings;
|
67 |
$this->license = $license;
|
68 |
-
|
69 |
-
parent::__construct($version);
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -119,7 +108,7 @@ class UpgradeTo300 extends Upgrader
|
|
119 |
$settings['remove_data'] = $oldSettings['remove_data'];
|
120 |
|
121 |
// Set the new settings
|
122 |
-
$this->settings->
|
123 |
|
124 |
// Update the settings
|
125 |
$this->settings->save();
|
@@ -299,11 +288,11 @@ class UpgradeTo300 extends Upgrader
|
|
299 |
}
|
300 |
|
301 |
/**
|
302 |
-
*
|
303 |
*
|
304 |
* @return void
|
305 |
*/
|
306 |
-
|
307 |
{
|
308 |
$this->setupUpgradeNotice();
|
309 |
|
4 |
|
5 |
use WP_Roles;
|
6 |
use WP_Query;
|
7 |
+
use EasingSlider\Foundation\Admin\Upgrades\Upgrade;
|
8 |
use EasingSlider\Plugin\Contracts\Options\License;
|
9 |
use EasingSlider\Plugin\Contracts\Options\Settings;
|
|
|
10 |
|
11 |
/**
|
12 |
* Exit if accessed directly
|
15 |
exit;
|
16 |
}
|
17 |
|
18 |
+
class UpgradeTo300 extends Upgrade
|
19 |
{
|
20 |
/**
|
21 |
* Settings
|
45 |
*/
|
46 |
protected $upgradeTo = '3.0.0';
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
/**
|
49 |
* Constructor
|
50 |
*
|
|
|
51 |
* @param \EasingSlider\Plugin\Contracts\Options\Settings $settings
|
52 |
* @param \EasingSlider\Plugin\Contracts\Options\License $license
|
53 |
* @return void
|
54 |
*/
|
55 |
+
public function __construct(Settings $settings, License $license)
|
56 |
{
|
57 |
$this->settings = $settings;
|
58 |
$this->license = $license;
|
|
|
|
|
59 |
}
|
60 |
|
61 |
/**
|
108 |
$settings['remove_data'] = $oldSettings['remove_data'];
|
109 |
|
110 |
// Set the new settings
|
111 |
+
$this->settings->setValue($settings);
|
112 |
|
113 |
// Update the settings
|
114 |
$this->settings->save();
|
288 |
}
|
289 |
|
290 |
/**
|
291 |
+
* Executes the upgrade
|
292 |
*
|
293 |
* @return void
|
294 |
*/
|
295 |
+
public function upgrade()
|
296 |
{
|
297 |
$this->setupUpgradeNotice();
|
298 |
|
src/Plugin/Admin/Upgrades/Upgrader.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
namespace EasingSlider\Plugin\Admin\Upgrades;
|
4 |
|
5 |
use EasingSlider\Foundation\Admin\Upgrades\Upgrader as BaseUpgrader;
|
6 |
-
use EasingSlider\Plugin\Contracts\Options\Version;
|
7 |
|
8 |
/**
|
9 |
* Exit if accessed directly
|
@@ -12,16 +11,15 @@ if ( ! defined('ABSPATH')) {
|
|
12 |
exit;
|
13 |
}
|
14 |
|
15 |
-
|
16 |
{
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
* @param \EasingSlider\Plugin\Contracts\Options\Version $version
|
21 |
* @return void
|
22 |
*/
|
23 |
-
|
24 |
{
|
25 |
-
|
26 |
}
|
27 |
-
}
|
3 |
namespace EasingSlider\Plugin\Admin\Upgrades;
|
4 |
|
5 |
use EasingSlider\Foundation\Admin\Upgrades\Upgrader as BaseUpgrader;
|
|
|
6 |
|
7 |
/**
|
8 |
* Exit if accessed directly
|
11 |
exit;
|
12 |
}
|
13 |
|
14 |
+
class Upgrader extends BaseUpgrader
|
15 |
{
|
16 |
/**
|
17 |
+
* Boot
|
18 |
*
|
|
|
19 |
* @return void
|
20 |
*/
|
21 |
+
protected function boot()
|
22 |
{
|
23 |
+
$this->upgrades[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo300');
|
24 |
}
|
25 |
+
}
|
src/Plugin/Admin/Upgrades/Upgrades.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace EasingSlider\Plugin\Admin\Upgrades;
|
4 |
-
|
5 |
-
use EasingSlider\Foundation\Admin\Upgrades\Upgrades as BaseUpgrades;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Exit if accessed directly
|
9 |
-
*/
|
10 |
-
if ( ! defined('ABSPATH')) {
|
11 |
-
exit;
|
12 |
-
}
|
13 |
-
|
14 |
-
class Upgrades extends BaseUpgrades
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Boot
|
18 |
-
*
|
19 |
-
* @return void
|
20 |
-
*/
|
21 |
-
protected function boot()
|
22 |
-
{
|
23 |
-
$this->upgraders[] = $this->plugin->make('\EasingSlider\Plugin\Admin\Upgrades\UpgradeTo300');
|
24 |
-
}
|
25 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/Plugin/Contracts/Options/UpgradeLicense.php
DELETED
File without changes
|
src/Plugin/Options/UpgradeLicense.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace EasingSlider\Plugin\Options;
|
4 |
-
|
5 |
-
use EasingSlider\Foundation\Options\Option;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Exit if accessed directly
|
9 |
-
*/
|
10 |
-
if ( ! defined('ABSPATH')) {
|
11 |
-
exit;
|
12 |
-
}
|
13 |
-
|
14 |
-
class UpgradeLicense extends Option
|
15 |
-
{
|
16 |
-
/**
|
17 |
-
* Name
|
18 |
-
*
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
protected $name = 'easingslider_show_upgrade_license_notice';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Gets the default settings
|
25 |
-
*
|
26 |
-
* @return mixed
|
27 |
-
*/
|
28 |
-
public function getDefaults()
|
29 |
-
{
|
30 |
-
return true;
|
31 |
-
}
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/Plugin/Plugin.php
CHANGED
@@ -159,7 +159,7 @@ final class Plugin extends BasePlugin
|
|
159 |
protected function setl10n()
|
160 |
{
|
161 |
// Load plugin textdomain
|
162 |
-
load_plugin_textdomain('easingslider', false, plugin_basename(EASINGSLIDER_PLUGIN_FILE) . '/languages/');
|
163 |
}
|
164 |
|
165 |
/**
|
159 |
protected function setl10n()
|
160 |
{
|
161 |
// Load plugin textdomain
|
162 |
+
load_plugin_textdomain('easingslider', false, dirname(plugin_basename(EASINGSLIDER_PLUGIN_FILE)) . '/languages/');
|
163 |
}
|
164 |
|
165 |
/**
|
src/Plugin/helpers.php
CHANGED
@@ -11,6 +11,23 @@ if ( ! defined('ABSPATH')) {
|
|
11 |
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
if ( ! function_exists('easingslider')) {
|
15 |
/**
|
16 |
* Alias for displaying a slider shortcode
|
@@ -20,8 +37,24 @@ if ( ! function_exists('easingslider')) {
|
|
20 |
*/
|
21 |
function easingslider($id)
|
22 |
{
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
|
|
25 |
}
|
26 |
|
27 |
if ( ! function_exists('easingslider_get_template_part')) {
|
@@ -472,23 +505,6 @@ if ( ! function_exists('easingslider_admin_upgrade_license_response')) {
|
|
472 |
add_filter('easingslider_edd_license_handler_error_response', 'easingslider_admin_upgrade_license_response', 10, 2);
|
473 |
}
|
474 |
|
475 |
-
if ( ! function_exists('easingslider_admin_upgrade_info_notice')) {
|
476 |
-
/**
|
477 |
-
* Triggers a notice that is shown to users who have upgraded from v2.* to v3.0.0.
|
478 |
-
*
|
479 |
-
* @return void
|
480 |
-
*/
|
481 |
-
function easingslider_admin_upgrade_info_notice()
|
482 |
-
{
|
483 |
-
$hasUpgraded = get_option('easingslider_upgraded_from_v2', false);
|
484 |
-
|
485 |
-
if ($hasUpgraded) {
|
486 |
-
add_action('admin_notices', 'easingslider_admin_show_upgrade_info');
|
487 |
-
}
|
488 |
-
}
|
489 |
-
add_action('admin_init', 'easingslider_admin_upgrade_info_notice');
|
490 |
-
}
|
491 |
-
|
492 |
if ( ! function_exists('easingslider_admin_show_upgrade_info')) {
|
493 |
/**
|
494 |
* Shows a notice to users who have upgraded.
|
@@ -502,6 +518,11 @@ if ( ! function_exists('easingslider_admin_show_upgrade_info')) {
|
|
502 |
return;
|
503 |
}
|
504 |
|
|
|
|
|
|
|
|
|
|
|
505 |
?>
|
506 |
<div class="message updated upgrade-info">
|
507 |
<p class="upgrade-info-title"><?php _e('Thanks for Upgrading!', 'easingslider'); ?></p>
|
@@ -519,6 +540,7 @@ if ( ! function_exists('easingslider_admin_show_upgrade_info')) {
|
|
519 |
</div>
|
520 |
<?php
|
521 |
}
|
|
|
522 |
}
|
523 |
|
524 |
if ( ! function_exists('easingslider_admin_dismiss_upgrade_info')) {
|
11 |
exit;
|
12 |
}
|
13 |
|
14 |
+
if ( ! function_exists('Easing_Slider')) {
|
15 |
+
/**
|
16 |
+
* The main function responsible for returning the one true Easing_Slider instance to functions everywhere.
|
17 |
+
*
|
18 |
+
* Use this function like you would a global variable, except without needing
|
19 |
+
* to declare the global.
|
20 |
+
*
|
21 |
+
* Example: <?php $easing_slider = Easing_Slider(); ?>
|
22 |
+
*
|
23 |
+
* @return Easing_Slider
|
24 |
+
*/
|
25 |
+
function Easing_Slider()
|
26 |
+
{
|
27 |
+
return \EasingSlider\Plugin\Plugin::instance();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
if ( ! function_exists('easingslider')) {
|
32 |
/**
|
33 |
* Alias for displaying a slider shortcode
|
37 |
*/
|
38 |
function easingslider($id)
|
39 |
{
|
40 |
+
$shortcode = Easing_Slider()->shortcode();
|
41 |
+
|
42 |
+
return $shortcode->render(array('id' => $id));
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( ! function_exists('easingslider_activate')) {
|
47 |
+
/**
|
48 |
+
* Activator
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
function easingslider_activate()
|
53 |
+
{
|
54 |
+
$activator = Easing_Slider()->activator();
|
55 |
+
$activator->activate();
|
56 |
}
|
57 |
+
register_activation_hook(EASINGSLIDER_PLUGIN_FILE, 'easingslider_activate');
|
58 |
}
|
59 |
|
60 |
if ( ! function_exists('easingslider_get_template_part')) {
|
505 |
add_filter('easingslider_edd_license_handler_error_response', 'easingslider_admin_upgrade_license_response', 10, 2);
|
506 |
}
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
if ( ! function_exists('easingslider_admin_show_upgrade_info')) {
|
509 |
/**
|
510 |
* Shows a notice to users who have upgraded.
|
518 |
return;
|
519 |
}
|
520 |
|
521 |
+
// Bail if we've not upgraded from v2
|
522 |
+
if ( ! get_option('easingslider_upgraded_from_v2', false)) {
|
523 |
+
return;
|
524 |
+
}
|
525 |
+
|
526 |
?>
|
527 |
<div class="message updated upgrade-info">
|
528 |
<p class="upgrade-info-title"><?php _e('Thanks for Upgrading!', 'easingslider'); ?></p>
|
540 |
</div>
|
541 |
<?php
|
542 |
}
|
543 |
+
add_action('admin_notices', 'easingslider_admin_show_upgrade_info');
|
544 |
}
|
545 |
|
546 |
if ( ! function_exists('easingslider_admin_dismiss_upgrade_info')) {
|
vendor/composer/autoload_namespaces.php
CHANGED
@@ -6,5 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src'),
|
10 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
);
|