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 / coupling / shortcode / shortcode.php

shortcode.php in CSS & JavaScript Toolbox 6.1, at controllers/coupling/shortcode/shortcode.php

76 lines 1.7 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 * This is the first class name build for using autoload!
13 * Autoload is not being supported yet however this is the first
14 * class on the plain!!!!
15 */
16 class CJT_Controllers_Coupling_Shortcode extends CJTHookableClass {
17
18 /**
19 * put your comment there...
20 *
21 * @var mixed
22 */
23 protected $attributes;
24
25 /**
26 * put your comment there...
27 *
28 * @var mixed
29 */
30 protected $content = null;
31
32 /**
33 * put your comment there...
34 *
35 * @param mixed $attributes
36 * @param mixed $content
37 * @return CJT_Controllers_Coupling_Shortcode
38 */
39 public function __construct($attributes, $content) {
40 // Hookable initialization!
41 parent::__construct();
42 // Initialize.
43 $this->attributes = $attributes;
44 $this->content = $content;
45 }
46
47 /**
48 * put your comment there...
49 *
50 */
51 public function __toString() {
52 // Initialize.
53 $attributes =& $this->attributes;
54 // Default Class.
55 if (!isset($attributes['class'])) {
56 $shortcodeClass = 'block';
57 }
58 // Get Shortcode class file, check existance!
59 $shortcodeClassFile = cssJSToolbox::resolvePath('controllers:coupling:shortcode:block:block.php');
60 if (!file_exists($shortcodeClassFile)) {
61 throw new Exception('Shortcode Type is not supported!! Only (block) type is currently available!!!');
62 }
63 // Import shortcodee handler file.
64 require_once $shortcodeClassFile;
65 // Import class.
66 $className = "CJT_Controllers_Coupling_Shortcode_{$shortcodeClass}";
67 // Load shortcode 'CLASS' handler.
68 $shortcode = new $className($this->attributes, $this->content);
69 // Return Shortcode replacements.
70 return ((string) $shortcode);
71 }
72
73 } // End class
74
75 // Hookable!
76 CJT_Controllers_Coupling_Shortcode::define('CJT_Controllers_Coupling_Shortcode');