PluginProbe
CSS & JavaScript Toolbox / 6.0.6
CSS & JavaScript Toolbox v6.0.6
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 / framework / events / subjects / hook.subject.php

hook.subject.php in CSS & JavaScript Toolbox 6.0.6, at framework/events/subjects/hook.subject.php

98 lines 1.8 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 // Import dependencies.
10 require_once 'subject.subject.php';
11
12 /**
13 *
14 */
15 abstract class CJTEEWordpressHook extends CJTEESubject {
16
17 /**
18 * put your comment there...
19 *
20 * @var mixed
21 */
22 protected $hookName;
23
24 /**
25 * put your comment there...
26 *
27 * @var mixed
28 */
29 protected $instanceId;
30
31 /**
32 * put your comment there...
33 *
34 * @var mixed
35 */
36 protected static $instances = 0;
37
38 /**
39 * put your comment there...
40 *
41 */
42 public function __construct() {
43 $this->instanceId = ++self::$instances;
44 }
45
46 /**
47 * put your comment there...
48 *
49 * @param mixed $params
50 * @return mixed
51 */
52 public abstract function callIndirect($params);
53
54 /**
55 * put your comment there...
56 *
57 */
58 public function getHookName() {
59 return $this->hookName;
60 }
61
62 /**
63 * put your comment there...
64 *
65 */
66 public function getInstanceHookName() {
67 return "{$this->hookName}-{$this->instanceId}";
68 }
69
70 /**
71 * put your comment there...
72 *
73 * @param mixed $defintion
74 * @param mixed $includes
75 */
76 protected function init($name, $target, $defintion, $includes) {
77 // Initialize parent!
78 $return = parent::init($name, $target, $defintion, $includes);
79 $this->hookName = strtolower("{$this->definition['targetClass']}_{$name}");
80 // Register Wordpress Filter,
81 add_action($this->getHookName(), array(&$this, 'trigger'), 10, count($this->getDefinition('parameters')));
82 add_action($this->getInstanceHookName(), array(&$this, 'trigger'), 10, count($this->getDefinition('parameters')));
83 return $return;
84 }
85
86 /**
87 * put your comment there...
88 *
89 * @param mixed $params
90 */
91 public function prepareHookParameters($params) {
92 // Add tag as the first parameter!
93 array_unshift($params, $this->getInstanceHookName());
94 // Return!
95 return $params;
96 }
97
98 } // End class.