| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* |
| 8 |
*/ |
| 9 |
class CJTTinymceAccessPoint extends CJTAccessPoint { |
| 10 |
|
| 11 |
/** |
| 12 |
* put your comment there... |
| 13 |
* |
| 14 |
*/ |
| 15 |
public function __construct() { |
| 16 |
// initialize base! |
| 17 |
parent::__construct(); |
| 18 |
// Set name! |
| 19 |
$this->name = 'tinymce'; |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* put your comment there... |
| 24 |
* |
| 25 |
*/ |
| 26 |
protected function doListen() { |
| 27 |
// Only if installed! |
| 28 |
if (CJTPlugin::getInstance()->isInstalled()) { |
| 29 |
// Don't bother doing this stuff if the current user lacks permissions |
| 30 |
if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && (get_user_option('rich_editing') == 'true')) { |
| 31 |
add_filter('mce_external_plugins', array($this, 'registerButton')); |
| 32 |
} |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* put your comment there... |
| 38 |
* |
| 39 |
* @param mixed $plugins |
| 40 |
*/ |
| 41 |
public function registerButton($plugins) { |
| 42 |
// Load tinymce/shortcodes view through default controller! |
| 43 |
$this->controllerName = 'default'; |
| 44 |
$this->route(null, array('view' => 'tinymce/shortcodes')) |
| 45 |
// Display |
| 46 |
->setAction('display') |
| 47 |
->_doAction(); |
| 48 |
// Don't register anything, we just use this filter as Action. |
| 49 |
return $plugins; |
| 50 |
} |
| 51 |
|
| 52 |
} // End class |