| 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 = 'CJT-Extension'; |
| 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'), 12); |
| 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 |
add_action('load-plugins.php', array($this, 'route'), 10, 0); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* put your comment there... |
| 62 |
* |
| 63 |
*/ |
| 64 |
public function route($loadView = null, $request = array('view' => 'extensions/plugins-list')) { |
| 65 |
// Set as connected object! |
| 66 |
$this->connected(); |
| 67 |
// Load extensions view throughjt the default controller! |
| 68 |
parent::route($loadView, $request) |
| 69 |
// Set Action name! |
| 70 |
->setAction('extensions') |
| 71 |
// Dispatch the call! |
| 72 |
->_doAction(); |
| 73 |
} |
| 74 |
|
| 75 |
} // End class. |
| 76 |
|
| 77 |
// Hookable! |
| 78 |
CJTExtensionsAccessPoint::define('CJTExtensionsAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER)); |