1 | <?php |
||
42 | final class Auto_Load_Next_Post { |
||
|
|||
43 | |||
44 | /** |
||
45 | * The single instance of the class |
||
46 | * |
||
47 | * @since 1.0.0 |
||
48 | * @access private |
||
49 | * @var Auto_Load_Next_Post |
||
50 | */ |
||
51 | private static $_instance = null; |
||
52 | |||
53 | /** |
||
54 | * Main Auto Load Next Post Instance |
||
55 | * |
||
56 | * Ensures only one instance of Auto Load Next Post is loaded or can be loaded. |
||
57 | * |
||
58 | * @since 1.0.0 |
||
59 | * @access public |
||
60 | * @static |
||
61 | * @see Auto_Load_Next_Post() |
||
62 | * @return Auto Load Next Post - Main instance. |
||
63 | */ |
||
64 | public static function instance() { |
||
73 | |||
74 | /** |
||
75 | * Throw error on object clone |
||
76 | * |
||
77 | * The whole idea of the singleton design pattern is that there is a single |
||
78 | * object therefore, we don't want the object to be cloned. |
||
79 | * |
||
80 | * @since 1.0.0 |
||
81 | * @access public |
||
82 | * @return void |
||
83 | */ |
||
84 | public function __clone() { |
||
88 | |||
89 | /** |
||
90 | * Disable unserializing of the class |
||
91 | * |
||
92 | * @since 1.0.0 |
||
93 | * @access public |
||
94 | * @return void |
||
95 | */ |
||
96 | public function __wakeup() { |
||
100 | |||
101 | /** |
||
102 | * Constructor |
||
103 | * |
||
104 | * @since 1.0.0 |
||
105 | * @access public |
||
106 | */ |
||
107 | public function __construct() { |
||
119 | |||
120 | /** |
||
121 | * Auto-load Auto Load Next Post classes on demand to reduce memory consumption. |
||
122 | * |
||
123 | * @since 1.0.0 |
||
124 | * @access public |
||
125 | * @param mixed $class |
||
126 | * @return void |
||
127 | */ |
||
128 | public function autoload($class) { |
||
143 | |||
144 | /** |
||
145 | * Setup Constants |
||
146 | * |
||
147 | * @since 1.4.3 |
||
148 | * @version 1.4.8 |
||
149 | * @access private |
||
150 | */ |
||
151 | private function setup_constants() { |
||
168 | |||
169 | /** |
||
170 | * Define constant if not already set. |
||
171 | * |
||
172 | * @param string $name |
||
173 | * @param string|bool $value |
||
174 | * @access private |
||
175 | * @since 1.4.3 |
||
176 | */ |
||
177 | private function define($name, $value) { |
||
182 | |||
183 | /** |
||
184 | * Include required core files used in admin and on the frontend. |
||
185 | * |
||
186 | * @since 1.0.0 |
||
187 | * @access public |
||
188 | * @return void |
||
189 | */ |
||
190 | public function includes() { |
||
197 | |||
198 | /** |
||
199 | * Runs when the plugin is initialized. |
||
200 | * |
||
201 | * @since 1.0.0 |
||
202 | * @access public |
||
203 | */ |
||
204 | public function init_auto_load_next_post() { |
||
210 | |||
211 | /** |
||
212 | * Load Localisation files. |
||
213 | * |
||
214 | * Note: the first-loaded translation file overrides any following ones if the same translation is present. |
||
215 | * |
||
216 | * Locales found in: |
||
217 | * - WP_LANG_DIR/auto-load-next-post/auto-load-next-post-LOCALE.mo |
||
218 | * - WP_LANG_DIR/plugins/auto-load-next-post-LOCALE.mo |
||
219 | * @since 1.0.0 |
||
220 | * @version 1.4.8 |
||
221 | */ |
||
222 | public function load_plugin_textdomain() { |
||
227 | |||
228 | /** |
||
229 | * Registers and enqueues stylesheets and javascripts for the front of the site. |
||
230 | * |
||
231 | * @since 1.3.2 |
||
232 | * @access public |
||
233 | */ |
||
234 | public function front_scripts_and_styles() { |
||
254 | |||
255 | /** |
||
256 | * Helper function for registering and enqueueing scripts and styles. |
||
257 | * |
||
258 | * @since 1.0.0 |
||
259 | * @access public |
||
260 | * @static |
||
261 | * @param string $name The ID to register with WordPress. |
||
262 | * @param string $file_path The path to the actual file. |
||
263 | * @param bool $is_script Optional, argument for if the incoming file_path is a JavaScript source file. |
||
264 | * @param array $support Optional, for requiring other javascripts for the source file you are calling. |
||
265 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
||
266 | * @global string $wp_version |
||
267 | */ |
||
268 | public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') { |
||
284 | |||
285 | } // END Auto_Load_Next_Post() |
||
286 | |||
315 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.