PluginProbe
CSS & JavaScript Toolbox / 6.0
CSS & JavaScript Toolbox v6.0
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
← All changes | models/coupling.php +9 -142 116.0 View file →
@@ -32,15 +32,8 @@
32 32 * put your comment there...
33 33 *
34 34 * @var mixed
35 35 */
36 - protected $onquerylinkedtemplates = array('parameters' => array('query'));
37 -
38 - /**
39 - * put your comment there...
40 - *
41 - * @var mixed
42 - */
43 36 protected $onpinsblockfilters = array('parameters' => array(
44 37 'params' => array('linksExpressionFlag', 'pinPoint', 'customPins')
45 38 )
46 39 );
@@ -54,67 +47,13 @@
54 47
55 48 /**
56 49 * put your comment there...
57 50 *
58 - * @var mixed
59 51 */
60 - public static $templateTypes = array('scripts' => 'javascript', 'styles' => 'css');
61 -
62 - /**
63 - * put your comment there...
64 - *
65 - * @param mixed $id
66 - */
67 - public function getBlockCode($id) {
68 - // Initialize.
69 - $code = '';
70 - // Initialize.
71 - $tblCodeFiles = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
72 - // Query Block Code Files.
73 - $codeFiles = $tblCodeFiles->set('blockId', $id)
74 - ->fetchAll();
75 - // Merge all code files.
76 - foreach ($codeFiles as $codeFile) {
77 - // Wrap by Tag + Merge files.
78 - $code .= $codeFile['tag'] ? sprintf($codeFile['tag'], " {$codeFile['code']} ") : $codeFile['code'];
79 - }
80 - // Return final code text.
81 - return $code;
82 - }
83 -
84 - /**
85 - * put your comment there...
86 - *
87 - * @param mixed $blockId
88 - */
89 - public function getExecTemplatesCode($blockId) {
90 - // Initialize.
91 - $code = '';
92 - // Get all HTML and PHP templates linked to the block.
93 - $templates = $this->getLinkedTemplates($blockId, array('php', 'html'));
94 - if (!empty($templates)) {
95 - // Instantiate template model.
96 - $templateModel = CJTModel::getInstance('template');
97 - // Concat their codes.
98 - foreach ($templates as $template) {
99 - // Fetch template record with code loaded from file and decrypted if PHP!
100 - $templateModel->inputs['id'] = $template->id;
101 - $template = $templateModel->getItem();
102 - // Concat
103 - $code .= $template->code;
104 - }
105 - }
106 - return $code;
107 - }
108 -
109 - /**
110 - * put your comment there...
111 - *
112 - */
113 52 public function getOrder() {
114 53 return $this->ongetorder(get_option('meta-box-order_cjtoolbox'));
115 54 }
116 -
55 +
117 56 /**
118 57 * put your comment there...
119 58 *
120 59 * @param mixed $linksExpressionFlag
@@ -119,99 +58,27 @@
119 58 *
120 59 * @param mixed $linksExpressionFlag
121 60 * @param mixed $pinPoint
122 61 * @param mixed $customPins
123 - * @param mixed $hookParams
124 62 */
125 - public function getPinsBlocks( $linksExpressionFlag, $pinPoint, $customPins, $hookParams )
126 - {
63 + public function getPinsBlocks($linksExpressionFlag, $pinPoint, $customPins) {
127 64 // Extendable!
128 - extract( $this->onpinsblockfilters( compact( 'linksExpressionFlag', 'pinPoint', 'customPins' ) ) );
129 -
65 + extract($this->onpinsblockfilters(compact('linksExpressionFlag', 'pinPoint', 'customPins')));
130 66 // Import required libraries for CJTPinsBlockSQLView.
131 67 require_once CJTOOLBOX_TABLES_PATH . '/pins-blocks-view.php';
132 -
133 68 // Initialize new CJTPinsBlockSQLView view object.
134 - $dbDriver = new CJTMYSQLQueueDriver( $GLOBALS[ 'wpdb' ] );
135 - $view = new CJTPinsBlockSQLView( $dbDriver );
136 -
69 + $dbDriver = new CJTMYSQLQueueDriver($GLOBALS['wpdb']);
70 + $view = new CJTPinsBlockSQLView($dbDriver);
137 71 // Apply filter to view.
138 - $view->filters( $pinPoint, $customPins );
139 -
140 - # Allow Plugins/Extensions to change block core query
141 - do_action(
142 -
143 - CJTPluggableHelper::ACTION_BLOCK_QUERY_BLOCKS,
144 -
145 - $view,
146 -
147 - $hookParams
148 -
149 - );
150 -
72 + $view->filters($pinPoint, $customPins);
151 73 // retreiving blocks data associated with current request.
152 - $blocks = $this->onrequestblocks( $view->exec() );
153 -
154 - # Filter queue blocks
155 - $blocks = apply_filters( CJTPluggableHelper::FILTER_BLOCKS_COUPLING_MODEL_BLOCKS_QUEUE, $blocks, $hookParams );
156 -
74 + $blocks = $this->onrequestblocks($view->exec());
157 75 // Get links & expressions Blocks.
158 76 // NOTE: We need only blocks not presented in $blocks var -- exclude their id.
159 - $view->filters( $linksExpressionFlag, array(), 'active', array_keys( $blocks ) );
160 -
77 + $view->filters($linksExpressionFlag, array(), 'active', array_keys($blocks));
161 78 // We'll process all blocks inside single loop.
162 - $blocks = $blocks + $this->onexpressionsandlinkedblocks( $view->exec() );
163 -
79 + $blocks = $blocks + $this->onexpressionsandlinkedblocks($view->exec());
164 80 return $blocks;
165 - }
166 -
167 - /**
168 - * put your comment there...
169 - *
170 - * @param mixed $blocks
171 - * @param mixed $types
172 - */
173 - public function getLinkedTemplates($blocks, $types = array('javascript', 'css')) {
174 - // Accept single id too!
175 - $blocks = (array) $blocks;
176 - // Import dependencies!
177 - cssJSToolbox::import('framework:db:mysql:xtable.inc.php', 'tables:template-revision.php');
178 - // Initialize vars.
179 - $templates = array();
180 - $query['select'] = 'SELECT t.id, t.type, t.queueName, r.version, r.file, bt.blockId';
181 - $query['from'] = 'FROM #__cjtoolbox_block_templates bt LEFT JOIN #__cjtoolbox_templates t
182 - ON bt.templateId = t.id
183 - LEFT JOIN #__cjtoolbox_template_revisions r
184 - ON bt.templateId = r.templateId';
185 - // Filter by blocks ids and getting the last revision of the template!
186 - $query['where']['blocks'] = implode(',', $blocks);
187 - $query['where']['attributes'] = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
188 - // Filter by type.
189 - $query['where']['types'] = '"' . implode('","', $types) . '"';
190 - // Where clause.
191 - $query['where'] = "WHERE bt.blockId IN ({$query['where']['blocks']}) AND
192 - (r.attributes & {$query['where']['attributes']}) AND
193 - t.type IN ({$query['where']['types']})";
194 - // Filering!
195 - $query = $this->onquerylinkedtemplates($query);
196 - $query = "{$query['select']} {$query['from']} {$query['where']}";
197 - $templates = cssJSToolbox::getInstance()->getDBDriver()->select($query);
198 - return $templates;
199 - }
200 -
201 - /**
202 - * put your comment there...
203 - *
204 - * @param mixed $type
205 - */
206 - public function getQueueObject($type) {
207 - // Make sure Queue Object is ready/instantiated!
208 - $globalQueueObjectName = "wp_{$type}";
209 - if (!isset($GLOBALS[$globalQueueObjectName])) {
210 - $queueClass = 'WP_' . ucfirst($type);
211 - $GLOBALS[$globalQueueObjectName] = new $queueClass();
212 - }
213 - return $GLOBALS[$globalQueueObjectName];
214 81 }
215 82
216 83 } // End class.
217 84