PluginProbe
CSS & JavaScript Toolbox / 10
CSS & JavaScript Toolbox v10
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
css-javascript-toolbox / access.points / extensions.accesspoint.php

extensions.accesspoint.php in CSS & JavaScript Toolbox 10, at access.points/extensions.accesspoint.php

104 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 *
11 */
12 class CJTExtensionsAccessPoint extends CJTAccessPoint {
13
14 /**
15 *
16 */
17 const MENU_POSITION_INDEX = 2;
18
19 /**
20 *
21 */
22 const PLUGINS_PAGE_SEARCH_TERM = 'css-javascript-toolbox';
23
24 /**
25 * put your comment there...
26 *
27 */
28 public function __construct() {
29 // Initialize Access Point base!
30 parent::__construct();
31 // Set access point name!
32 $this->name = 'extensions';
33 }
34
35 /**
36 * put your comment there...
37 *
38 */
39 protected function doListen() {
40 // Only if permitted!
41 if ($this->hasAccess()) {
42 // Add menu pages.
43 add_action('admin_menu', array(&$this, 'menu'), 13);
44 }
45 }
46
47 /**
48 * put your comment there...
49 *
50 */
51 public function menu() {
52 // Extensions page.
53 // add_submenu_page(CJTPlugin::PLUGIN_REQUEST_ID, null, cssJSToolbox::getText('Extensions'), 'administrator', null);
54 // Hack Extensions menu item to point to Plugins page!
55 // $GLOBALS['submenu'][CJTPlugin::PLUGIN_REQUEST_ID][self::MENU_POSITION_INDEX][2] = admin_url('plugins.php?s=' . self::PLUGINS_PAGE_SEARCH_TERM);
56 // When plugins page loaded!
57
58 /**
59 * Need this to fix the menu issue with CJT PLUS 8.4 or lower.
60 *
61 */
62 if ( class_exists( 'CJTPlus' ) ) :
63 $reflector = new \ReflectionClass( 'CJTPlus' );
64 $CJTPlusVersion = get_plugin_data( str_replace( 'plus.class', 'plus', $reflector->getFileName() ) )['Version'];
65
66 if ( version_compare( $CJTPlusVersion, '8.4', '<=' ) ) {
67 global $menu, $submenu;
68
69 # Find CJT Menu and Sub Menu, ADD PLUS to the title
70 foreach( $menu as & $menuItem )
71 {
72
73 if ( $menuItem[ 2 ] == 'cjtoolbox' )
74 {
75 $submenu[ 'cjtoolbox' ][ 0 ] [ 0 ] = $menuItem[ 0 ];
76 $submenu[ 'cjtoolbox' ][ 0 ] [ 1 ] = 'administrator';
77 $submenu[ 'cjtoolbox' ][ 0 ] [ 2 ] = 'cjtoolbox';
78 }
79 }
80 }
81 endif;
82
83 add_action('load-plugins.php', array($this, 'route'), 10, 0);
84 }
85
86 /**
87 * put your comment there...
88 *
89 */
90 public function route($loadView = null, $request = array('view' => 'extensions/plugins-list')) {
91 // Set as connected object!
92 $this->connected();
93 // Load extensions view throughjt the default controller!
94 parent::route($loadView, $request)
95 // Set Action name!
96 ->setAction('extensions')
97 // Dispatch the call!
98 ->_doAction();
99 }
100
101 } // End class.
102
103 // Hookable!
104 CJTExtensionsAccessPoint::define('CJTExtensionsAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));