1 | <?php |
||
5 | class Manager |
||
6 | { |
||
7 | /** |
||
8 | * @var Singleton The reference to *Singleton* instance of this class |
||
9 | */ |
||
10 | private static $instance; |
||
11 | |||
12 | /** |
||
13 | * Undocumented variable |
||
14 | * |
||
15 | * @var array The list of registered shortcodes |
||
16 | */ |
||
17 | private $shortcodes = array(); |
||
18 | |||
19 | /** |
||
20 | * Returns the *Singleton* instance of this class. |
||
21 | * |
||
22 | * @return Singleton The *Singleton* instance. |
||
23 | */ |
||
24 | public static function get_instance() |
||
32 | |||
33 | /** |
||
34 | * Register a shortcode |
||
35 | * |
||
36 | * @param [array] $args |
||
37 | * @return void |
||
38 | */ |
||
39 | public function register_shortcode( $args ) |
||
59 | |||
60 | /** |
||
61 | * Enqueue the shortcode script and print the JSON object |
||
62 | * |
||
63 | * @param [array] $plugins_array |
||
64 | * @return void |
||
65 | */ |
||
66 | public function enqueue_script($plugins_array) |
||
77 | |||
78 | /** |
||
79 | * Enqueue the popup stylesheet. This needs to be separated from the editor |
||
80 | * stylesheet since it is not part of the editor. |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | public function enqueue_popup_style() |
||
88 | |||
89 | /** |
||
90 | * Enqueue the editor stylesheet. |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function enqueue_editor_style() |
||
98 | |||
99 | private function decode_atts($atts) |
||
111 | |||
112 | private function decode_att($value) |
||
124 | |||
125 | private function decode_non_json_encodede_att($value) |
||
132 | |||
133 | /** |
||
134 | * Create a JSON object that will be printed in the admin section |
||
135 | * to be used by the TinyMCE plugin code. |
||
136 | */ |
||
137 | private function prepare_json_object() |
||
148 | |||
149 | /** |
||
150 | * Default shortcode arguments |
||
151 | */ |
||
152 | private function default_args() |
||
170 | |||
171 | /** |
||
172 | * Check if a shortcode with the given ID has already been registered |
||
173 | */ |
||
174 | private function shortcode_exists( $id ) |
||
178 | |||
179 | /** |
||
180 | * Validate that the provided arguments have the required arguments as |
||
181 | * specified in self::required_args() |
||
182 | */ |
||
183 | private function validate_args( $args ) |
||
193 | |||
194 | /** |
||
195 | * Prepare a shortcode configuration array based on the given arguments |
||
196 | * |
||
197 | * @param [array] $args |
||
198 | * @return array |
||
199 | */ |
||
200 | private function prepare_config( $args ) |
||
212 | |||
213 | /** |
||
214 | * Genereate a basic shortcode template based on the given set |
||
215 | * of shortcode fields. |
||
216 | * |
||
217 | * @param [string] $tag |
||
218 | * @param [array] $fields |
||
219 | * @return string |
||
220 | */ |
||
221 | private function generate_template($tag, $fields) |
||
246 | |||
247 | /** |
||
248 | * A list of required arguments |
||
249 | */ |
||
250 | private function required_args() |
||
254 | |||
255 | /** |
||
256 | * Private constructor to prevent instantiation |
||
257 | */ |
||
258 | private function __construct() |
||
265 | } |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: