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 ) |
||
60 | |||
61 | /** |
||
62 | * Enqueue the shortcode script and print the JSON object |
||
63 | * |
||
64 | * @param [array] $plugins_array |
||
65 | * @return void |
||
66 | */ |
||
67 | public function enqueue_script($plugins_array) |
||
78 | |||
79 | /** |
||
80 | * Enqueue the necessary styles & scripts |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | public function enqueue_scripts() |
||
94 | |||
95 | /** |
||
96 | * Enqueue the editor stylesheet. |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | public function enqueue_editor_style() |
||
104 | |||
105 | public function decode_atts($atts) |
||
117 | |||
118 | private function decode_att($value) |
||
130 | |||
131 | private function decode_non_json_encodede_att($value) |
||
138 | |||
139 | /** |
||
140 | * Create a JSON object that will be printed in the admin section |
||
141 | * to be used by the TinyMCE plugin code. |
||
142 | */ |
||
143 | private function prepare_json_object() |
||
154 | |||
155 | /** |
||
156 | * Default shortcode arguments |
||
157 | */ |
||
158 | private function default_args() |
||
176 | |||
177 | /** |
||
178 | * Check if a shortcode with the given ID has already been registered |
||
179 | */ |
||
180 | private function shortcode_exists( $id ) |
||
184 | |||
185 | /** |
||
186 | * Validate that the provided arguments have the required arguments as |
||
187 | * specified in self::required_args() |
||
188 | */ |
||
189 | private function validate_args( $args ) |
||
199 | |||
200 | /** |
||
201 | * Prepare a shortcode configuration array based on the given arguments |
||
202 | * |
||
203 | * @param [array] $args |
||
204 | * @return array |
||
205 | */ |
||
206 | private function prepare_config( $args ) |
||
218 | |||
219 | /** |
||
220 | * Genereate a basic shortcode template based on the given set |
||
221 | * of shortcode fields. |
||
222 | * |
||
223 | * @param [string] $tag |
||
224 | * @param [array] $fields |
||
225 | * @return string |
||
226 | */ |
||
227 | private function generate_template($tag, $fields) |
||
252 | |||
253 | /** |
||
254 | * A list of required arguments |
||
255 | */ |
||
256 | private function required_args() |
||
260 | |||
261 | /** |
||
262 | * Private constructor to prevent instantiation |
||
263 | */ |
||
264 | private function __construct() |
||
271 | } |
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: