@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * The main instance of the plugin. |
27 | 27 | */ |
28 | -if ( ! class_exists( 'Auto_Load_Next_Post' ) ) { |
|
28 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
29 | 29 | |
30 | 30 | class Auto_Load_Next_Post { |
31 | 31 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return Auto_Load_Next_Post Single instance. |
60 | 60 | */ |
61 | 61 | public static function instance() { |
62 | - if ( is_null( self::$_instance ) ) { |
|
62 | + if (is_null(self::$_instance)) { |
|
63 | 63 | self::$_instance = new self(); |
64 | 64 | } |
65 | 65 | return self::$_instance; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function __clone() { |
76 | 76 | // Cloning instances of the class is forbidden |
77 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
77 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), self::$version); |
|
78 | 78 | } // END __clone() |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | public function __wakeup() { |
88 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
88 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), self::$version); |
|
89 | 89 | } // END __wakeup() |
90 | 90 | |
91 | 91 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Auto Load Next Post is fully loaded. |
106 | 106 | */ |
107 | - do_action( 'auto_load_next_post_loaded' ); |
|
107 | + do_action('auto_load_next_post_loaded'); |
|
108 | 108 | } // END __construct() |
109 | 109 | |
110 | 110 | /** |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function init_hooks() { |
117 | 117 | // Load translation files. |
118 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
118 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
119 | 119 | |
120 | 120 | // Load Auto Load Next Post scripts on the frontend. |
121 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_enqueue_scripts' ) ); |
|
121 | + add_action('wp_enqueue_scripts', array($this, 'alnp_enqueue_scripts')); |
|
122 | 122 | } // END init_hooks() |
123 | 123 | |
124 | 124 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | $this->define('AUTO_LOAD_NEXT_POST_FILE', __FILE__); |
134 | 134 | $this->define('AUTO_LOAD_NEXT_POST_SLUG', 'auto-load-next-post'); |
135 | 135 | |
136 | - $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit( plugins_url( '/', __FILE__ ) ) ); |
|
137 | - $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
136 | + $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit(plugins_url('/', __FILE__))); |
|
137 | + $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
138 | 138 | $this->define('AUTO_LOAD_NEXT_POST_TEMPLATE_PATH', 'auto-load-next-post/'); |
139 | - $this->define('AUTO_LOAD_NEXT_POST_3RD_PARTY', AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/3rd-party/'); |
|
139 | + $this->define('AUTO_LOAD_NEXT_POST_3RD_PARTY', AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/3rd-party/'); |
|
140 | 140 | |
141 | 141 | $this->define('AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE', '4.4'); |
142 | 142 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @access private |
160 | 160 | * @since 1.4.3 |
161 | 161 | */ |
162 | - private function define( $name, $value ) { |
|
163 | - if ( ! defined( $name ) ) { |
|
164 | - define( $name, $value ); |
|
162 | + private function define($name, $value) { |
|
163 | + if ( ! defined($name)) { |
|
164 | + define($name, $value); |
|
165 | 165 | } |
166 | 166 | } // END define() |
167 | 167 | |
@@ -174,29 +174,29 @@ discard block |
||
174 | 174 | * @return void |
175 | 175 | */ |
176 | 176 | public function includes() { |
177 | - include_once( dirname( __FILE__ ) . '/includes/class-alnp-autoloader.php' ); // Autoloader. |
|
178 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-conditional-functions.php' ); // Conditional functions. |
|
179 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-formatting-functions.php' ); // Formatting functions. |
|
180 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-themes-supported.php' ); // Handles all supported themes out of the box. |
|
181 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php' ); // Contains core functions for the front/back end. |
|
177 | + include_once(dirname(__FILE__).'/includes/class-alnp-autoloader.php'); // Autoloader. |
|
178 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-conditional-functions.php'); // Conditional functions. |
|
179 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-formatting-functions.php'); // Formatting functions. |
|
180 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-themes-supported.php'); // Handles all supported themes out of the box. |
|
181 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
182 | 182 | |
183 | 183 | // Include theme support. |
184 | 184 | alnp_include_theme_support(); |
185 | 185 | |
186 | 186 | // 3rd Party support. |
187 | - include_once( dirname( __FILE__ ) . '/includes/3rd-party/3rd-party.php' ); |
|
187 | + include_once(dirname(__FILE__).'/includes/3rd-party/3rd-party.php'); |
|
188 | 188 | |
189 | 189 | // Customizer. |
190 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer.php' ); |
|
191 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer-scripts.php' ); |
|
190 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer.php'); |
|
191 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer-scripts.php'); |
|
192 | 192 | |
193 | 193 | // Include admin class to handle all back-end functions. |
194 | - if ( is_admin() ) { |
|
195 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-alnp-admin.php' ); // Admin section. |
|
194 | + if (is_admin()) { |
|
195 | + include_once(dirname(__FILE__).'/includes/admin/class-alnp-admin.php'); // Admin section. |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Install. |
199 | - require_once( dirname( __FILE__ ) . '/includes/class-alnp-install.php' ); |
|
199 | + require_once(dirname(__FILE__).'/includes/class-alnp-install.php'); |
|
200 | 200 | } // END includes() |
201 | 201 | |
202 | 202 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return void |
212 | 212 | */ |
213 | 213 | public function load_plugin_textdomain() { |
214 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
214 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
215 | 215 | } // END load_plugin_textdomain() |
216 | 216 | |
217 | 217 | /** |
@@ -223,33 +223,33 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function alnp_enqueue_scripts() { |
225 | 225 | // Load the Javascript if found as a singluar post and the user is not a bot. |
226 | - if ( !alnp_is_bot() && is_singular() && get_post_type() == 'post' ) { |
|
226 | + if ( ! alnp_is_bot() && is_singular() && get_post_type() == 'post') { |
|
227 | 227 | // This checks to see if the JavaScript should load in the footer or not. |
228 | 228 | $load_in_footer = alnp_load_js_in_footer(); |
229 | 229 | |
230 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
230 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
231 | 231 | |
232 | 232 | // Only load History.js when not in the customizer. |
233 | - if ( ! is_customize_preview() ) { |
|
234 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
233 | + if ( ! is_customize_preview()) { |
|
234 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
235 | 235 | } |
236 | 236 | |
237 | - $this->load_file( 'auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post' . AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
237 | + $this->load_file('auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post'.AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
238 | 238 | |
239 | 239 | // Variables for the JavaScript |
240 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
240 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
241 | 241 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
242 | - 'alnp_content_container' => get_option( 'auto_load_next_post_content_container' ), |
|
243 | - 'alnp_title_selector' => get_option( 'auto_load_next_post_title_selector' ), |
|
244 | - 'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ), |
|
245 | - 'alnp_comments_container' => get_option( 'auto_load_next_post_comments_container' ), |
|
246 | - 'alnp_remove_comments' => get_option( 'auto_load_next_post_remove_comments' ), |
|
247 | - 'alnp_google_analytics' => get_option( 'auto_load_next_post_google_analytics' ), |
|
248 | - 'alnp_event_on_load' => get_option( 'auto_load_next_post_on_load_event' ), |
|
249 | - 'alnp_event_on_entering' => get_option( 'auto_load_next_post_on_entering_event' ), |
|
242 | + 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
|
243 | + 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
|
244 | + 'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'), |
|
245 | + 'alnp_comments_container' => get_option('auto_load_next_post_comments_container'), |
|
246 | + 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
|
247 | + 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
|
248 | + 'alnp_event_on_load' => get_option('auto_load_next_post_on_load_event'), |
|
249 | + 'alnp_event_on_entering' => get_option('auto_load_next_post_on_entering_event'), |
|
250 | 250 | 'alnp_is_customizer' => $this->is_alnp_using_customizer(), |
251 | 251 | 'alnp_load_in_footer' => $load_in_footer |
252 | - ) ); |
|
252 | + )); |
|
253 | 253 | } // END if is_singular() && get_post_type() |
254 | 254 | } // END alnp_enqueue_scripts() |
255 | 255 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return string|false |
263 | 263 | */ |
264 | 264 | public static function is_alnp_using_customizer() { |
265 | - if ( is_customize_preview() ) { |
|
265 | + if (is_customize_preview()) { |
|
266 | 266 | return "yes"; |
267 | 267 | } |
268 | 268 | |
@@ -283,19 +283,19 @@ discard block |
||
283 | 283 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
284 | 284 | * @param bool $footer Optional, can set the JavaScript to load in the footer instead. |
285 | 285 | */ |
286 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) { |
|
287 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
288 | - |
|
289 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
290 | - if ( $is_script ) { |
|
291 | - if ( !wp_script_is( $name, 'registered' ) ) { |
|
292 | - wp_register_script( $name, $url, $support, $version, $footer ); |
|
293 | - wp_enqueue_script( $name ); |
|
286 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false) { |
|
287 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
288 | + |
|
289 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
290 | + if ($is_script) { |
|
291 | + if ( ! wp_script_is($name, 'registered')) { |
|
292 | + wp_register_script($name, $url, $support, $version, $footer); |
|
293 | + wp_enqueue_script($name); |
|
294 | 294 | } |
295 | 295 | } else { |
296 | - if ( !wp_style_is( $name, 'registered' ) ) { |
|
297 | - wp_register_style( $name, $url ); |
|
298 | - wp_enqueue_style( $name ); |
|
296 | + if ( ! wp_style_is($name, 'registered')) { |
|
297 | + wp_register_style($name, $url); |
|
298 | + wp_enqueue_style($name); |
|
299 | 299 | } |
300 | 300 | } // end if |
301 | 301 | } // end if |