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 | private $shortcodes = array(); |
||
13 | |||
14 | /** |
||
15 | * Returns the *Singleton* instance of this class. |
||
16 | * |
||
17 | * @return Singleton The *Singleton* instance. |
||
18 | */ |
||
19 | public static function get_instance() |
||
27 | |||
28 | public function register_shortcode( $args ) |
||
37 | |||
38 | public function print_json_object($plugin_array) |
||
43 | |||
44 | public function enqueue_script($plugins_array) |
||
55 | |||
56 | public function enqueue_popup_style() |
||
60 | |||
61 | public function enqueue_editor_style() |
||
65 | |||
66 | /** |
||
67 | * Create a JSON object that will be printed in the admin section |
||
68 | * to be used by the TinyMCE plugin code. |
||
69 | */ |
||
70 | private function prepare_json_object() |
||
81 | |||
82 | /** |
||
83 | * Default shortcode arguments |
||
84 | */ |
||
85 | private function default_args() |
||
99 | |||
100 | /** |
||
101 | * Check if a shortcode with the given ID has already been registered |
||
102 | */ |
||
103 | private function shortcode_exists( $id ) |
||
107 | |||
108 | /** |
||
109 | * Validate that the provided arguments have the required arguments as |
||
110 | * specified in self::required_args() |
||
111 | */ |
||
112 | private function validate_args( $args ) |
||
122 | |||
123 | /** |
||
124 | * A list of required arguments |
||
125 | */ |
||
126 | private function required_args() |
||
130 | |||
131 | /** |
||
132 | * Private constructor to prevent instantiation |
||
133 | */ |
||
134 | private function __construct() |
||
141 | } |
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: