PluginProbe
CSS & JavaScript Toolbox / 9.4
CSS & JavaScript Toolbox v9.4
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 / views / extensions / plugins-list / view.php

view.php in CSS & JavaScript Toolbox 9.4, at views/extensions/plugins-list/view.php

155 lines 4.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 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 *
11 */
12 class CJTExtensionsPluginsListView extends CJTView {
13
14 /**
15 * put your comment there...
16 *
17 * @var mixed
18 */
19 protected $extensions;
20
21 /**
22 * put your comment there...
23 *
24 * @var mixed
25 */
26 protected $listTypeName;
27
28 /**
29 * put your comment there...
30 *
31 * @var mixed
32 */
33 protected $securityToken;
34
35 /**
36 * put your comment there...
37 *
38 * @param mixed $info
39 * @return CJTInstallerNoticeView
40 */
41 public function __construct($info) {
42 // CJTView class!
43 parent::__construct($info);
44 // Enqueue Styles & Scripts.
45 add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles'));
46 add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts'));
47 }
48
49 /**
50 * put your comment there...
51 *
52 * @param mixed $parent
53 */
54 public function activateExtensionsMenuItem($parent) {
55 // Hack Wordpress menu to select CSS & JavaScript root menu item
56 // and the Extensions child menu item!
57 // We just hack get_admin_page_parent() function!
58 $GLOBALS['typenow'] = CJTPlugin::PLUGIN_REQUEST_ID;
59 $GLOBALS['pagenow'] = CJTPlugin::PLUGIN_REQUEST_ID;
60 $GLOBALS['plugin_page'] = $GLOBALS['submenu'][CJTPlugin::PLUGIN_REQUEST_ID][CJTExtensionsAccessPoint::MENU_POSITION_INDEX][2];
61 // We use this filter as (ACTION) not change in the return value!
62 return $parent;
63 }
64
65 /**
66 * put your comment there...
67 *
68 * @param mixed $links
69 */
70 public function addExtensionActions($links, $file) {
71 $pluginsFilesMap =& $this->extensions->getFiles2ClassesMap();
72 $extensions =& $this->extensions->getExtensions();
73 // If its a CJT extension!
74 if (isset($pluginsFilesMap[$file])) {
75 // Get extension data!
76 $class = $pluginsFilesMap[$file];
77 $extension = $extensions[$class];
78 // We only work with extensions that required license key!
79 if ($extension['definition']['primary']['requiredLicense']) {
80 // Load license
81 $definition = new SimpleXMLElement($extension['definition']['raw']);
82 $component['pluginBase'] = $file;
83 // Get extension title
84 // Use first license type name for old extensions that doesnt
85 // provide title attribute
86 $defTitle = (string) $definition->license->attributes()->title;
87 $component['title'] = $defTitle ? $defTitle : ((string) $definition->license->name[0]);
88 // Get action Markup!
89 $links['license-key'] = $this->getTemplate('default_setup_action', array('component' => $component));
90 }
91 }
92 return $links;
93 }
94
95 /**
96 * put your comment there...
97 *
98 * @param mixed $tpl
99 */
100 public function display($tpl = null) {
101 // Get model object!
102 $model = $this->getModel('extensions');
103 // Some time we work as aspecific extensions page or geneal Wordpress plugins page!
104 $this->securityToken = cssJSToolbox::getSecurityToken();
105 $this->listTypeName = $model->getListTypeName();
106 $this->extensions = CJTPlugin::getInstance()->extensions();
107 if ($this->listTypeName == 'extensions') {
108 // Select Extensions menu item instead of Wordpress Plugins item!
109 add_filter('parent_file', array(&$this, 'activateExtensionsMenuItem'));
110 }
111 // Output internal HTML used by JS!
112 add_action('admin_footer', array(&$this, 'outputCommonMarkups'));
113 // Add SETUP Link inside the Plugins (only CJT extensions) row!
114 add_filter('plugin_action_links', array(&$this, 'addExtensionActions'), 10 , 2);
115
116 }
117
118 /**
119 * put your comment there...
120 *
121 */
122 public static function enqueueScripts() {
123 $listTypeName = CJTModel::getInstance('extensions')->getListTypeName();
124 // Use related scripts.
125 self::useScripts(__CLASS__,
126 'jquery',
127 'thickbox',
128 'framework:js:{CJT-}utilities',
129 'framework:js:ajax:{CJT-}cjt-server',
130 'views:extensions:plugins-list:public:js:{CJTExtensionsPluginsListView-}default',
131 "views:extensions:plugins-list:public:js:{CJTExtensionsPluginsListView-}{$listTypeName}"
132 );
133 }
134
135 /**
136 * put your comment there...
137 *
138 */
139 public static function enqueueStyles() {
140 $listTypeName = CJTModel::getInstance('extensions')->getListTypeName();
141 // Use related scripts.
142 self::useStyles(__CLASS__,
143 'thickbox',
144 "views:extensions:plugins-list:public:css:{CJTExtensionsPluginsListView-}{$listTypeName}"
145 );
146 }
147
148 /**
149 * put your comment there...
150 *
151 */
152 public function outputCommonMarkups() {
153 echo $this->getTemplate('default');
154 }
155 } // End class.