PluginProbe
CSS & JavaScript Toolbox / 12.0.4
CSS & JavaScript Toolbox v12.0.4
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | access.points/installer.accesspoint.php +45 -23 6.012.0.4 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
@@ -6,22 +6,22 @@
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
8 8
9 9 /**
10 -*
10 +*
11 11 */
12 12 class CJTInstallerAccessPoint extends CJTAccessPoint {
13 -
13 +
14 14 /**
15 15 * put your comment there...
16 - *
16 + *
17 17 * @var mixed
18 18 */
19 19 protected $stopNotices = false;
20 -
20 +
21 21 /**
22 22 * put your comment there...
23 - *
23 + *
24 24 */
25 25 public function __construct() {
26 26 // Initialize parent.
27 27 parent::__construct();
@@ -29,9 +29,9 @@
29 29 $this->name = 'installer';
30 30 }
31 31 /**
32 32 * put your comment there...
33 - *
33 + *
34 34 */
35 35 protected function doListen() {
36 36 // If not installed and not in manage page display admin notice!
37 37 if (!CJTPlugin::getInstance()->isInstalled() && $this->hasAccess()) {
@@ -36,13 +36,39 @@
36 36 // If not installed and not in manage page display admin notice!
37 37 if (!CJTPlugin::getInstance()->isInstalled() && $this->hasAccess()) {
38 38 add_action('admin_notices', array(&$this, 'notInstalledAdminNotice'));
39 39 }
40 +
41 + //if ( class_exists( 'CJTPlus' ) && $this->isOldCJTPlus()) add_action( 'admin_notices', [ $this, '_oldCJTPlusDetected' ] );
40 42 }
41 -
43 +
44 + protected function isOldCJTPlus()
45 + {
46 + if ( ! function_exists( 'get_plugin_data' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
47 +
48 + $reflector = new \ReflectionClass( 'CJTPlus' );
49 + $CJTPlusVersion = get_plugin_data( str_replace( 'plus.class', 'plus', $reflector->getFileName() ) )['Version'];
50 +
51 + if ( version_compare( $CJTPlusVersion, '8.4', '<=' ) ) return true;
52 + return false;
53 + }
54 +
55 + public function _oldCJTPlusDetected()
56 + {
57 + $class = 'notice notice-error';
58 + $message = __( 'You are currently using CJT PLUS version 8.4 or under. Unfortunately, this version is not optimized for the new Gutenberg Editor.
59 + <br>
60 + <br>
61 + Please make sure you have added your license key and update CJT PLUS with the latest version. If your license has expired, please click to: <a target="_blank" href="https://css-javascript-toolbox.com/pricing">purchase a new subscription</a>.
62 + <br>
63 + If you wish to continue using your current version, it may be best to roll back to: <a target="_blank" href="https://downloads.wordpress.org/plugin/css-javascript-toolbox.8.4.2.zip">CJT Free - version 8.4.2</a>' );
64 +
65 + printf( '<div class="%1$s"><p>%2$s</p></div>', esc_html( $class ), $message );
66 + }
67 +
42 68 /**
43 69 * put your comment there...
44 - *
70 + *
45 71 */
46 72 public function installationPage() {
47 73 if ($this->hasAccess()) {
48 74 // Set as connected object!
@@ -47,28 +73,24 @@
47 73 if ($this->hasAccess()) {
48 74 // Set as connected object!
49 75 $this->connected();
50 76 // Set controller internal parameters.
51 - $_REQUEST['view'] = 'installer/install';
52 - // create controller.
53 - return $this->route()
77 + return $this->route(null, array('view' => 'installer/install'))
54 78 // Set Action
55 79 ->setAction('install');
56 80 }
57 81 }
58 -
82 +
59 83 /**
60 84 * put your comment there...
61 - *
85 + *
62 86 */
63 87 public function notInstalledAdminNotice() {
64 - // Show Not installed admin notice only
88 + // Show Not installed admin notice only
65 89 // if there is no access point processed/connected the request
66 90 if (!$this->stopNotices) {
67 91 // Set MVC request parameters.
68 - $_REQUEST['view'] = 'installer/notice';
69 - // Instantiate installer cotroller and fire notice action!
70 - $this->route()
92 + $this->route(null , array('view' => 'installer/notice'))
71 93 // Set action name.
72 94 ->setAction('notInstalledNotice')
73 95 // Fire action!
74 96 ->_doAction();
@@ -73,18 +95,18 @@
73 95 // Fire action!
74 96 ->_doAction();
75 97 }
76 98 }
77 -
99 +
78 100 /**
79 101 * put your comment there...
80 - *
102 + *
81 103 */
82 104 public function stopNotices() {
83 105 // Do not show admin notcies!
84 - $this->stopNotices = true;
106 + $this->stopNotices = true;
85 107 }
86 -
108 +
87 109 } // End class.
88 110
89 111 // Hookable!
90 -CJTInstallerAccessPoint::define('CJTInstallerAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
112 +CJTInstallerAccessPoint::define('CJTInstallerAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));