1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
<?php
namespace hji\geofarms\controllers;
use \hji\geofarms\GeoFarms;
use \hji\geofarms\models\TinyMCE as MCEModel;
require_once(GeoFarms::$models . '/TinyMCE.php');
class TinyMCE
{
private $model;
function __construct()
{
$this->model = new MCEModel();
add_action('admin_init', array($this, 'init'));
add_action('wp_ajax_hji_geo_farms_tinymce', array($this->model, 'loadWindow'));
}
function init()
{
if (!current_user_can('edit_posts') && !current_user_can('edit_pages'))
{
return;
}
if (get_user_option('rich_editing') == 'true')
{
add_filter('mce_external_plugins', array($this->model, 'registerPlugin'));
add_filter('hji_mce_buttons', array($this->model, 'registerButton'));
}
}
}