PluginProbe
CSS & JavaScript Toolbox / 6.1
CSS & JavaScript Toolbox v6.1
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 / controllers / tinymce-blocks.php

tinymce-blocks.php in CSS & JavaScript Toolbox 6.1, at controllers/tinymce-blocks.php

54 lines 1.2 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 // No direct access.
7 defined('ABSPATH') or die('Access denied');
8
9 // Import dependencies.
10 cssJSToolbox::import('framework:mvc:controller-ajax.inc.php');
11
12 /**
13 *
14 */
15 class CJTTinymceBlocksController extends CJTAjaxController {
16
17 /**
18 * put your comment there...
19 *
20 * @var mixed
21 */
22 protected $controllerInfo = array('model' => 'tinymce-blocks');
23
24 /**
25 * put your comment there...
26 *
27 */
28 public function __construct($hasView = null, $request = null) {
29 // Initialize parent!
30 parent::__construct($hasView, $request);
31 // Register actions!
32 $this->registryAction('getBlocksList');
33 // @TODO: $this->defaultCapability is risky if there is any admin actions added later, please remove!
34 $this->defaultCapability = array('edit_posts', 'edit_pages');
35 }
36
37 /**
38 * put your comment there...
39 *
40 */
41 public function getBlocksListAction() {
42 // Read all blocks!
43 $blocks = $this->model->getItems();
44 // retreive owener name!
45 foreach ($blocks as $id => $block) {
46 $user = get_userdata($block->owner);
47 $block->owner = !$user ? 'N/A' : $user->display_name;
48 $this->response['list'][$id] = $block;
49 }
50 $this->response['count'] = count($this->response['list']);
51 }
52
53 } // End class.
54