PluginProbe
CSS & JavaScript Toolbox / 9.0
CSS & JavaScript Toolbox v9.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
css-javascript-toolbox / controllers / blocks-coupling.php

blocks-coupling.php in CSS & JavaScript Toolbox 9.0, at controllers/blocks-coupling.php

842 lines 21.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version $ Id; blocks-coupling.php 21-03-2012 03:22:10 Ahmed Said $
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 * Applying Code blocks for the curren request.
11 *
12 * This controller is always loaded.
13 *
14 * The class resposibility is to output the code blocks
15 * tha associated with current request.
16 *
17 * @author Ahmed Said
18 * @version 6
19 */
20 class CJTBlocksCouplingController extends CJTController {
21
22 /**
23 * put your comment there...
24 *
25 * @var mixed
26 */
27 protected $blocks = array(
28 'code' => array('header' => '', 'footer' => ''),
29 'scripts' => array('header' => array(), 'footer' => array()),
30 );
31
32 /**
33 * put your comment there...
34 *
35 * @var mixed
36 */
37 protected $controllerInfo = array('model' => 'coupling');
38
39 /**
40 * put your comment there...
41 *
42 * @var mixed
43 */
44 protected $filters = null;
45
46 /**
47 * put your comment there...
48 *
49 * @var mixed
50 */
51 protected static $instance = null;
52
53 /**
54 * put your comment there...
55 *
56 * @var mixed
57 */
58 private $onActionIds = array();
59
60 /**
61 * put your comment there...
62 *
63 * @var mixed
64 */
65 protected $onassigncouplingcallback = array('parameters' => array('callback'));
66
67 /**
68 * put your comment there...
69 *
70 * @var mixed
71 */
72 protected $onappendcode = array('parameters' => array('code'));
73
74 /**
75 * put your comment there...
76 *
77 * @var mixed
78 */
79 protected $onblockmatched = array('parameters' => array('block'));
80
81 /**
82 * put your comment there...
83 *
84 * @var mixed
85 */
86 protected $oncancelmatching = array('parameters' => array('matched'));
87
88 /**
89 * put your comment there...
90 *
91 * @var mixed
92 */
93 protected $ondefaultfilters = array('parameters' => array('filters'));
94
95 /**
96 * put your comment there...
97 *
98 * @var mixed
99 */
100 protected $ondo = array('parameters' => array('data', 'method', 'condition'));
101
102 /**
103 * put your comment there...
104 *
105 * @var mixed
106 */
107 protected $onblocksorder = array('parameters' => array('order'));
108
109 /**
110 * put your comment there...
111 *
112 * @var mixed
113 */
114 protected $onevalcodeblock = array( 'parameters' => array( 'keep', 'block' ) );
115
116 /**
117 * put your comment there...
118 *
119 * @var mixed
120 */
121 protected $ongetblocks = array('parameters' => array('blocks'));
122
123 /**
124 * put your comment there...
125 *
126 * @var mixed
127 */
128 protected $ongetcache = array('parameters' => array('cache'));
129
130 /**
131 * put your comment there...
132 *
133 * @var mixed
134 */
135 protected $ongetfilters = array('parameters' => array('filters'));
136
137 /**
138 * put your comment there...
139 *
140 * @var mixed
141 */
142 protected $onlinkedtemplates = array('parameters' => array('templates'));
143
144 /**
145 * put your comment there...
146 *
147 * @var mixed
148 */
149 protected $onlinkscripts = array('parameters' => array('templates'));
150
151 /**
152 * put your comment there...
153 *
154 * @var mixed
155 */
156 protected $onlinkstyles = array('parameters' => array('templates'));
157
158 /**
159 * put your comment there...
160 *
161 * @var mixed
162 */
163 protected $onlinktemplate = array('parameters' => array('template'));
164
165 /**
166 * put your comment there...
167 *
168 * @var mixed
169 */
170 protected $onmatchingurls = array('parameters' => array('urls'));
171
172 /**
173 * put your comment there...
174 *
175 * @var mixed
176 */
177 protected $onnoblocks = array('hookType' => CJTWordpressEvents::HOOK_ACTION);
178
179 /**
180 * put your comment there...
181 *
182 * @var mixed
183 */
184 protected $onoutput = array('parameters' => array('code', 'location'));
185
186 /**
187 * put your comment there...
188 *
189 * @var mixed
190 */
191 protected $onprocess = array('hookType' => CJTWordpressEvents::HOOK_ACTION);
192
193 /**
194 * put your comment there...
195 *
196 * @var mixed
197 */
198 protected $onprocessblock = array('parameters' => array('block'));
199
200 /**
201 * put your comment there...
202 *
203 * @var mixed
204 */
205 protected $onqueuecss = array('parameters' => array('style'));
206
207 /**
208 * put your comment there...
209 *
210 * @var mixed
211 */
212 protected $onqueuejavascript = array('parameters' => array('script'));
213
214 /**
215 * put your comment there...
216 *
217 * @var mixed
218 */
219 protected $onsetfilters = array('parameters' => array('filters'));
220
221 /**
222 * put your comment there...
223 *
224 * @var mixed
225 */
226 protected $templates = array();
227
228 /**
229 * Initialize controller object.
230 *
231 * @see CJTController for more details
232 * @return void
233 */
234 public function __construct() {
235 // Only one instance is allowed.
236 if (self::$instance) {
237 throw new Exception('Trying to instantiate multiple coupling instances!!');
238 }
239 // Hold the single instance we've!
240 self::$instance = $this;
241 $siteHook = cssJSToolbox::$config->core->siteHook;
242 // Initialize controller.
243 parent::__construct(false);
244 // Import related libraries
245 CJTModel::import('block');
246 // Not default action needed.
247 $this->defaultAction = null;
248 // Initialize controller.
249 $initCouplingCallback = $this->onassigncouplingcallback(array(&$this, 'initCoupling'));
250 add_action('admin_init', $initCouplingCallback);
251 add_action($siteHook->tag, $initCouplingCallback, $siteHook->priority);
252 // Add Shortcode callbacks.
253 add_shortcode('cjtoolbox', array(&$this, 'shortcode'));
254 }
255
256 /**
257 * put your comment there...
258 *
259 * @param mixed $id
260 */
261 public function addOnActionIds($id) {
262 // Add ID is not exists.
263 if (!in_array($id, $this->onActionIds)) {
264 $this->onActionIds[] = $id;
265 }
266 // Chaining.
267 return $this;
268 }
269
270 /**
271 * put your comment there...
272 *
273 */
274 public function getBlocks()
275 {
276 // Set request view filters used for querying database.
277 $this->setRequestFilters();
278
279 // Get blocks order. NOTE: This is all blocks order not only the queried/target blocks.
280 $blocksOrder = array();
281 $metaBoxesOrder = $this->onblocksorder( $this->model->getOrder() );
282
283 // Get ORDER-INDEX <TO> BLOCK-ID mapping.
284 preg_match_all( '/cjtoolbox-(\d+)/', $metaBoxesOrder[ 'normal' ], $blocksOrder, PREG_SET_ORDER );
285
286 /**
287 * append more to orders produced by CJTBlocksCouplingController::setRequestFilter().
288 * More to orders may allow other blocks to bein the output (e.g metaboxe blocks).
289 */
290 $blocksOrder = array_merge( $blocksOrder, $this->getFilters()->moreToOrder );
291
292 // Prepare request URL to match against Links & Expressions.
293 $linksRequestURL = self::getRequestURL();
294 $expressionsRequestURL = "{$linksRequestURL}?{$_SERVER['QUERY_STRING']}";
295
296 extract( $this->onmatchingurls( compact( 'linksRequestURL', 'expressionsRequestURL' ) ) );
297
298 // Get all blocks including (Links & Expressions Blocks).
299 $blocks = $this->ongetblocks(
300
301 $this->model->getPinsBlocks(
302
303 CJTBlockModel::PINS_LINK_EXPRESSION,
304
305 $this->getFilters()->pinPoint,
306
307 $this->getFilters()->customPins,
308
309 $this->getFilters()
310
311 )
312
313 );
314
315
316 if ( empty( $blocks ) )
317 {
318 $this->onnoblocks();
319
320 return false;
321
322 }
323
324 // Import related libraries.
325 cssJSToolbox::import( 'framework:php:evaluator:evaluator.inc.php' );
326
327 /**
328 * Iterator over all blocks by using they order.
329 * For each block get code and scripts.
330 */
331 $this->onprocess();
332
333 foreach ( $blocksOrder as $blockOrder )
334 {
335 $blockId = (int) $blockOrder[1];
336
337 // As mentioned above. Orders is for all blocks not just those queried from db.
338 if ( isset($blocks[ $blockId ] ) )
339 {
340
341 $block = $this->onprocessblock( $blocks[ $blockId ] );
342
343 /**
344 * Process Links & Expressions blocks.
345 * For better performace check only those with links and expressions flags.
346 */
347 if ( $block->blocksGroup & CJTBlockModel::PINS_LINK_EXPRESSION )
348 {
349 /**
350 * Initiliaze $matchedLink and $matchedExpression inside IF statment.
351 * Those variables need to refresh state at each block.
352 * If there is no link or expression flags, they will be FALSE.
353 * Otherwise they'll get the correct value inside each statement.
354 */
355 /// Check if there is a matched link.
356 if ( $matchedLink = ( $block->blocksGroup & CJTBlockModel::PINS_LINKS ) )
357 {
358 $links = explode( "\n", trim( $block->links ) );
359 $matchedLink = in_array( $linksRequestURL, $links );
360 }
361
362 /// Check if there is a matched expression.
363 if ( $matchedExpression = ( $block->blocksGroup & CJTBlockModel::PINS_EXPRESSIONS ) )
364 {
365 $expressions = explode("\n", $block->expressions);
366
367 foreach ( $expressions as $expression )
368 {
369 /// @TODO: Matches may be used later to evaulate variables inside code block.
370 if( $matchedExpression = @ preg_match( "/{$expression}/", $expressionsRequestURL ) )
371 {
372 break;
373 }
374
375 }
376
377 }
378
379 /**
380 * Exclude Links & Expressions Blocks that doesn't has a match.
381 * If there is no matched link or expression then exclude block.
382 */
383 if ( $this->oncancelmatching( ! ( $matchedExpression || $matchedLink ) ) )
384 {
385 continue;
386 }
387
388 }
389 // Allow extensions to control to prevent block from being in the output
390 if ( $block = $this->onblockmatched( $block ) )
391 {
392 // Retrieve block code-files.
393 $block->code = $this->model->getBlockCode( $block->id );
394
395 // Import Executable (PHP and HTML) templates.
396 $block->code = $block->code . $this->model->getExecTemplatesCode( $block->id );
397
398 // For every location store blocks code into single string
399
400 if ( ! $evaluatedCode = $this->onevalcodeblock( false, $block ) )
401 {
402 $evaluatedCode = CJTPHPCodeEvaluator::getInstance( $block )->exec()->getOutput();
403 }
404
405 /** @todo Include Debuging info only if we're in debuging mode! */
406 if ( 1 ) {
407 // CODE UPDATED BY RBJ -- START
408 if (trim($evaluatedCode) != ''):
409 global $post;
410 $checkMetaBlock = get_post_meta($post->ID, '__CJT-BLOCK-ID', true);
411
412 if (!empty($checkMetaBlock) && $checkMetaBlock == $blockId):
413 $evaluatedCode = "\n\n<!-- CJT Meta Block ({$blockId}) - {$block->name} - START -->\n{$evaluatedCode}\n<!-- CJT Meta Block ({$blockId}) - {$block->name} - END -->\n\n";
414 else:
415 $evaluatedCode = "\n\n<!-- CJT Global Block ({$blockId}) - {$block->name} - START -->\n{$evaluatedCode}\n<!-- CJT Global Block ({$blockId}) - {$block->name} - END -->\n\n";
416 endif;
417 endif;
418 // CODE UPDATED BY RBJ -- END
419 }
420
421 $this->blocks[ 'code' ][ $block->location ] .= $this->onappendcode( $evaluatedCode );
422
423 // Store all used Ids in the CORRECT ORDER.
424 $this->addOnActionIds( $blockId );
425 }
426
427 }
428
429 }
430
431 $templates = $this->onActionIds ?
432 $this->model->getLinkedTemplates( $this->onActionIds ) :
433 array();
434
435 // Classisfy as we process Scripts and Styles separatly (different hooks!).
436 foreach ( $this->onlinkedtemplates( $templates ) as $id => $template )
437 {
438 // Filer template!
439 extract( $this->onlinktemplate( compact( 'template', 'id' ) ) );
440
441 $this->templates[ $template->type ][ $id ] = $template;
442 }
443
444
445 return true;
446 }
447
448 /**
449 * put your comment there...
450 *
451 */
452 public function getCached() {
453 // Cache is not implemented yet might be supported by extenal Extensions!
454 return $this->ongetcache(false);
455 }
456
457 /**
458 * put your comment there...
459 *
460 */
461 public function getFilters() {
462 return $this->ongetfilters($this->filters);
463 }
464
465 /**
466 * put your comment there...
467 *
468 */
469 public function getOnActionIds() {
470 return $this->onActionIds;
471 }
472
473 /**
474 * put your comment there...
475 *
476 */
477 public static function getRequestURL() {
478 // URL Protocol.
479 $protocol = 'http' . ((isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) ? 's' : '') . '://';
480 // Host name & port.
481 $host = $_SERVER['HTTP_HOST'];
482 $port = ($_SERVER["SERVER_PORT"] != "80") ? ":{$_SERVER["SERVER_PORT"]}" : '';
483 // Request URI.
484 $requestURI = $_SERVER['REQUEST_URI'];
485 // Final URL.
486 $url = "{$protocol}{$host}{$port}{$requestURI}";
487 return $url;
488 }
489
490 /**
491 * put your comment there...
492 *
493 */
494 public function hasOnActionIds() {
495 return !empty($this->onActionIds);
496 }
497
498 /**
499 * put your comment there...
500 *
501 */
502 public function initCoupling() {
503 // For some reasons wp action is fired twice.
504 // The wrong call won't has $wp_query object set,
505 // but this is only valid at Front end.
506 if (!is_admin() && !$GLOBALS['wp_query']) {
507 return;
508 }
509 // Get current application hook prefix.
510 $actionsPrefix = is_admin() ? 'admin' : 'wp';
511 // Get cache or get blocks if not cached.
512 // If there is no cache or no blocks for output
513 // do nothing.
514 if ($this->getCached() || $this->getBlocks()) {
515 // Output blocks on various locations!
516 add_action("{$actionsPrefix}_head", array(&$this, 'outputBlocks'), 30);
517 add_action("{$actionsPrefix}_footer", array(&$this, 'outputBlocks'), 30);
518 // Links templates & styloes!
519 add_action("{$actionsPrefix}_enqueue_scripts", array(&$this, 'linkTemplates'), 30);
520 add_action("{$actionsPrefix}_print_styles", array(&$this, 'linkTemplates'), 30);
521 }
522 // Link style sheet in footer required custom implementation.
523 add_action("{$actionsPrefix}_print_footer_scripts", array(&$this, 'linkFooterStyleSheets'), 9);
524 // Make sure this is executed only once.
525 // Sometimes wp hook run on backend and sometimes its not.
526 // This method handle both front and backend requests.
527 // Simply remove all hooks to ensure its run only one time.
528 remove_action('wp', array(&$this, 'initCoupling'));
529 remove_action('admin_init', array(&$this, 'initCoupling'));
530 }
531
532 /**
533 * put your comment there...
534 *
535 */
536 public function linkFooterStyleSheets() {
537 // Initialize.
538 $styles = array();
539 // Get queued style sheets!
540 global $wp_styles;
541 $queuedStyles =& $wp_styles->queue;
542 // Process only 'cjt' templates,
543 foreach ($queuedStyles as $index => $styleName) {
544 if (strpos($styleName, 'cjt-css-template-') === 0) {
545 // Get style name src file, prepend to Wordpress absolute path.
546 $style = $wp_styles->registered[$styleName];
547 $styles[] = home_url($style->src);
548 // Stop Wordpress from output <link> tag outside head tag
549 // as it has no effect.
550 unset($queuedStyles[$index]);
551 }
552 }
553 // Enqueue Style Sheet loader javascript if there is any
554 // styles need to be loaded.
555 if (!empty($styles)) {
556 // jQuery is dpendency object required by the loader.
557 wp_enqueue_script('jquery');
558 // Enqueue footer style sheet loader.
559 wp_enqueue_script('cjt-coupling-footer-css-loader', cssJSToolbox::getURI('controllers:coupling:js:footer-stylesheet-loader.js'));
560 // Output JavaScript array to be filled with the styles!
561 $jsStyleSheetsList = json_encode($styles);
562 require cssJSToolbox::resolvePath('controllers:coupling:html:load-footer-style.html.php');
563 }
564 }
565
566 /**
567 * put your comment there...
568 *
569 */
570 public function linkTemplates() {
571 $currentFilter = current_filter();
572 // Derived template Type from Wordpress filter.
573 $filterFor = explode('_', $currentFilter); $filterFor = array_pop($filterFor);
574 $type = CJTCouplingModel::$templateTypes[$filterFor];
575 // Following vars are referenced based on the current type.
576 $templates = isset($this->templates[$type]) ? $this->templates[$type] : array();
577 // Filering!
578 $templates = $this->{"onlink{$filterFor}"}($templates);
579 /**
580 * @var WP_Dependencies
581 */
582 $queue = $this->model->getQueueObject($filterFor);
583 // Add templates to the queye.
584 foreach ($templates as $template) {
585 // Registery only if not yet registered.
586 $template = $this->{"onqueue{$type}"}($template);
587 if (!isset($queue->registered[$template->queueName])) {
588 $queue->add($template->queueName, "/{$template->file}", null, $template->version);
589 }
590 // Always make sure the template is queued.
591 $queue->enqueue($template->queueName);
592 }
593 }
594
595 /**
596 * put your comment there...
597 *
598 */
599 public function outputBlocks() {
600 // Derived location name from wordpress filter name.
601 $currentFilter = current_filter();
602 // Map "wp hook location" to "block hook location".
603 $locationsMap = array('head' => 'header', 'footer' => 'footer');
604 // This hook is used across both ends, front and back ends.
605 // Remove application prefix (wp_ or admin_).
606 // Remining is head or footer.
607 $location = str_replace(array('wp_', 'admin_'), '', $currentFilter);
608 // Map to block location.
609 $location = $locationsMap[$location];
610 echo $this->onoutput($this->blocks['code'][$location], $location);
611 }
612
613 /**
614 * put your comment there...
615 *
616 */
617 protected function setRequestFilters()
618 {
619 // Get request blocks.
620 $filters = $this->ondefaultfilters( ( object ) array
621 (
622
623 'pinPoint' => 0x00000000,
624
625 'customPins' => array(),
626
627 'moreToOrder' => array(),
628
629 'currentObject' => null,
630
631 'currentCustomPin' => 0,
632
633 'params' => array(),
634
635 ) );
636
637 if ( is_admin() )
638 {
639 // Include all backend blocks.
640 $filters->pinPoint |= CJTBlockModel::PINS_BACKEND;
641 }
642 else
643 {
644 $filters->pinPoint |= CJTBlockModel::PINS_FRONTEND;
645
646 // Pages.
647 if ( is_page() )
648 {
649 // Blocks with ALL PAGES selected.
650 $filters->pinPoint |= CJTBlockModel::PINS_PAGES_ALL_PAGES;
651
652 $filters->currentObject = $GLOBALS[ 'post' ];
653 $filters->currentCustomPin = CJTBlockModel::PINS_PAGES_CUSTOM_PAGE;
654
655 // Blocks with PAGE-ID selected.
656 $filters->customPins[ ] = array
657 (
658 'pin' => 'pages',
659
660 'pins' => array( $filters->currentObject->ID ),
661
662 'flag' => CJTBlockModel::PINS_PAGES_CUSTOM_PAGE,
663
664 );
665
666 // Blocks with FRONT-PAGE selected.
667 if ( is_front_page() )
668 {
669 $filters->pinPoint |= CJTBlockModel::PINS_PAGES_FRONT_PAGE;
670 }
671
672 /**
673 * In order for metabox block to get in the output we need
674 * to add metabox order for it.
675 * @see CJTBlocksCouplingController::getBlocks.
676 */
677 $metabox = CJTModel::create( 'metabox', array( $filters->currentObject->ID ) );
678
679 $filters->moreToOrder[ ][ 1 ] = $metabox->getMetaboxId();
680
681 } // End is_page()
682
683 else if ( is_attachment() )
684 {
685 $filters->pinPoint |= CJTBlockModel::PINS_ATTACHMENT;
686 }
687 // Posts.
688 else if ( is_single() )
689 {
690 // Blocks with ALL POSTS & ALL CATEGORIES selected.
691 $filters->pinPoint |= CJTBlockModel::PINS_POSTS_ALL_POSTS | CJTBlockModel::PINS_CATEGORIES_ALL_CATEGORIES;
692
693 $filters->currentObject = $GLOBALS[ 'post' ];
694 $filters->currentCustomPin = CJTBlockModel::PINS_POSTS_CUSTOM_POST;
695
696 // Blocks with POST-ID selected.
697
698 $filters->customPins[ ] = array
699 (
700
701 'pin' => 'posts',
702
703 'pins' => array( $filters->currentObject->ID ),
704
705 'flag' => CJTBlockModel::PINS_POSTS_CUSTOM_POST,
706
707 );
708
709 // Include POST PARENT CATRGORIES blocks.
710 $parentCategoriesIds = wp_get_post_categories( $filters->currentObject->ID, array( 'fields' => 'ids' ) );
711
712 /**
713 * Custom-Posts just added "ON THE RUN/FLY"
714 * Need simple fix by confirming that the post is belong to
715 * specific category or not.
716 * Custom posts NOW unlike Posts, it doesn't inherit parent
717 * taxonomis Code Blocks!!
718 */
719 if ( ! empty( $parentCategoriesIds ) )
720 {
721
722 $filters->params[ 'hasCategories' ] = true;
723 $filters->params[ 'parentCategories' ] = $parentCategoriesIds;
724
725 $filters->customPins[ ] = array
726 (
727
728 'pin' => 'categories',
729
730 'pins' => $parentCategoriesIds,
731
732 'flag' => CJTBlockModel::PINS_CATEGORIES_CUSTOM_CATEGORY,
733
734 );
735
736 }
737
738 /**
739 * In order for metabox block to get in the output we need
740 * to add metabox order for it.
741 * @see CJTBlocksCouplingController::getBlocks.
742 */
743 $metabox = CJTModel::create( 'metabox', array( $filters->currentObject->ID ) );
744
745 $filters->moreToOrder[][ 1 ] = $metabox->getMetaboxId();
746
747 /**
748 * @TODO check for recent posts Based on user configuration.
749 * Recent posts should be detcted by comparing
750 * user condifguration with post date.
751 */
752 if ( 0 ) {
753
754 }
755 } // End is_single()
756
757 // Categories.
758 else if( is_category() )
759 {
760 // Blocks with ALL CATEGORIES selected.
761 $filters->pinPoint |= CJTBlockModel::PINS_CATEGORIES_ALL_CATEGORIES;
762
763 $filters->currentObject = get_queried_object();
764 $filters->currentCustomPin = CJTBlockModel::PINS_CATEGORIES_CUSTOM_CATEGORY;
765
766 // Blocks with CATEGORY-ID selected.
767 $filters->customPins[] = array
768 (
769 'pin' => 'categories',
770
771 'pins' => array( $filters->currentObject->term_id ),
772
773 'flag' => CJTBlockModel::PINS_CATEGORIES_CUSTOM_CATEGORY,
774
775 );
776
777 } // End is_category()
778
779 // Blocks with BLOG-INDEX selected.
780 else if ( is_home() )
781 {
782 $filters->pinPoint |= CJTBlockModel::PINS_POSTS_BLOG_INDEX;
783 }
784 else if ( is_search() )
785 {
786 $filters->pinPoint |= CJTBlockModel::PINS_SEARCH;
787 }
788 else if ( is_tag() )
789 {
790 $filters->pinPoint |= CJTBlockModel::PINS_TAG;
791 }
792 else if ( is_author() )
793 {
794 $filters->pinPoint |= CJTBlockModel::PINS_AUTHOR;
795 }
796 else if ( is_archive() )
797 {
798 $filters->pinPoint |= CJTBlockModel::PINS_ARCHIVE;
799 }
800 else if ( is_404() )
801 {
802 $filters->pinPoint |= CJTBlockModel::PINS_404_ERROR;
803 }
804
805 }
806
807 $this->filters = $this->onsetfilters( $filters );
808
809 }
810
811 /**
812 * Wordpress do shortcode callback for
813 * CJT Shortcodes ([cjtoolbox ....])!
814 *
815 * This method role is to load the shortcode routines
816 * in order to handle the request.
817 *
818 * It doesn't do anything except deferring the shortcode
819 * codes from loaded until shortcode is really used!
820 *
821 * @param mixed $attributes
822 */
823 public function shortcode($attributes, $content) {
824 // Instantiate Shortcode handler class.
825 cssJSToolbox::import('controllers:coupling:shortcode:shortcode.php');
826 $shortcode = new CJT_Controllers_Coupling_Shortcode($attributes, $content);
827 // Return Shortcode replacement!
828 return ((string) $shortcode);
829 }
830
831 /**
832 * put your comment there...
833 *
834 */
835 public static function & theInstance() {
836 return self::$instance;
837 }
838
839 } // End class.
840
841 // Hookable!
842 CJTBlocksCouplingController::define('CJTBlocksCouplingController', array('hookType' => CJTWordpressEvents::HOOK_FILTER));