Completed
Branch master (50c9aa)
by
unknown
02:35
created
auto-load-next-post.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @version 1.5.0
29 29
  */
30
-if ( ! class_exists( 'Auto_Load_Next_Post' ) ) {
30
+if ( ! class_exists('Auto_Load_Next_Post')) {
31 31
 
32 32
 	class Auto_Load_Next_Post {
33 33
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		 * @return Auto_Load_Next_Post Single instance.
62 62
 		 */
63 63
 		public static function instance() {
64
-			if ( is_null( self::$_instance ) ) {
64
+			if (is_null(self::$_instance)) {
65 65
 				self::$_instance = new self();
66 66
 			}
67 67
 			return self::$_instance;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		 */
77 77
 		public function __clone() {
78 78
 			// Cloning instances of the class is forbidden
79
-			_doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), self::$version );
79
+			_doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), self::$version);
80 80
 		} // END __clone()
81 81
 
82 82
 		/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		 * @return void
88 88
 		 */
89 89
 		public function __wakeup() {
90
-			_doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), self::$version );
90
+			_doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), self::$version);
91 91
 		} // END __wakeup()
92 92
 
93 93
 		/**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			/**
107 107
 			 * Auto Load Next Post is fully loaded.
108 108
 			 */
109
-			do_action( 'auto_load_next_post_loaded' );
109
+			do_action('auto_load_next_post_loaded');
110 110
 		} // END __construct()
111 111
 
112 112
 		/**
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 		 */
118 118
 		public function init_hooks() {
119 119
 			// Load translation files.
120
-			add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
120
+			add_action('init', array($this, 'load_plugin_textdomain'));
121 121
 
122 122
 			// Load Auto Load Next Post scripts on the frontend.
123
-			add_action( 'wp_enqueue_scripts', array( $this, 'alnp_enqueue_scripts' ) );
123
+			add_action('wp_enqueue_scripts', array($this, 'alnp_enqueue_scripts'));
124 124
 		} // END init_hooks()
125 125
 
126 126
 		/**
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			$this->define('AUTO_LOAD_NEXT_POST_FILE', __FILE__);
136 136
 			$this->define('AUTO_LOAD_NEXT_POST_SLUG', 'auto-load-next-post');
137 137
 
138
-			$this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit( plugins_url('/', __FILE__) ) );
139
-			$this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
138
+			$this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit(plugins_url('/', __FILE__)));
139
+			$this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit(plugin_dir_path(__FILE__)));
140 140
 			$this->define('AUTO_LOAD_NEXT_POST_TEMPLATE_PATH', 'auto-load-next-post/');
141 141
 
142 142
 			$this->define('AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE', '4.4');
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 		 * @access private
157 157
 		 * @since  1.4.3
158 158
 		 */
159
-		private function define( $name, $value ) {
160
-			if ( ! defined( $name ) ) {
161
-				define( $name, $value );
159
+		private function define($name, $value) {
160
+			if ( ! defined($name)) {
161
+				define($name, $value);
162 162
 			}
163 163
 		} // END define()
164 164
 
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 		 * @return  void
176 176
 		 */
177 177
 		public function includes() {
178
-			include_once( dirname( __FILE__ ) . '/includes/class-alnp-autoloader.php' ); // Autoloader.
179
-			include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-conditional-functions.php' ); // Conditional functions.
180
-			include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-formatting-functions.php' ); // Formatting functions.
181
-			include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php' ); // Contains core functions for the front/back end.
178
+			include_once(dirname(__FILE__).'/includes/class-alnp-autoloader.php'); // Autoloader.
179
+			include_once(dirname(__FILE__).'/includes/auto-load-next-post-conditional-functions.php'); // Conditional functions.
180
+			include_once(dirname(__FILE__).'/includes/auto-load-next-post-formatting-functions.php'); // Formatting functions.
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
 			$this->alnp_include_theme_support();
185 185
 
186 186
 			// Customizer.
187
-			include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer.php' );
188
-			include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer-scripts.php' );
187
+			include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer.php');
188
+			include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer-scripts.php');
189 189
 
190 190
 			// Include admin class to handle all back-end functions.
191
-			if ( is_admin() ) {
192
-				include_once( dirname( __FILE__ ) . '/includes/admin/class-alnp-admin.php' ); // Admin section.
191
+			if (is_admin()) {
192
+				include_once(dirname(__FILE__).'/includes/admin/class-alnp-admin.php'); // Admin section.
193 193
 			}
194 194
 
195 195
 			// Install.
196
-			require_once( dirname( __FILE__ ) . '/includes/class-alnp-install.php' );
196
+			require_once(dirname(__FILE__).'/includes/class-alnp-install.php');
197 197
 		} // END includes()
198 198
 
199 199
 		/**
@@ -203,45 +203,45 @@  discard block
 block discarded – undo
203 203
 		 * @since  1.5.0
204 204
 		 */
205 205
 		public function alnp_include_theme_support() {
206
-			if ( is_alnp_active_theme( array( 'make', 'understrap', 'storefront', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentytwelve', 'twentyeleven', 'twentyten' ) ) ) {
206
+			if (is_alnp_active_theme(array('make', 'understrap', 'storefront', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentytwelve', 'twentyeleven', 'twentyten'))) {
207 207
 
208
-				switch ( get_template() ) {
208
+				switch (get_template()) {
209 209
 					case 'twentyten':
210
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-ten.php' );
210
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-ten.php');
211 211
 						break;
212 212
 					case 'twentyeleven':
213
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-eleven.php' );
213
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-eleven.php');
214 214
 						break;
215 215
 					case 'twentytwelve':
216
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-twelve.php' );
216
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-twelve.php');
217 217
 						break;
218 218
 					case 'twentythirteen':
219
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-thirteen.php' );
219
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-thirteen.php');
220 220
 						break;
221 221
 					case 'twentyfourteen':
222
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-fourteen.php' );
222
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-fourteen.php');
223 223
 						break;
224 224
 					case 'twentyfifteen':
225
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-fifteen.php' );
225
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-fifteen.php');
226 226
 						break;
227 227
 					case 'twentysixteen':
228
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-sixteen.php' );
228
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-sixteen.php');
229 229
 						break;
230 230
 					case 'twentyseventeen':
231
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-twenty-seventeen.php' );
231
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-twenty-seventeen.php');
232 232
 						break;
233 233
 					case 'storefront':
234
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-storefront.php' );
234
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-storefront.php');
235 235
 						break;
236 236
 					case 'understrap':
237
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-understrap.php' );
237
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-understrap.php');
238 238
 						break;
239 239
 					case 'make':
240
-						include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-make.php' );
240
+						include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-make.php');
241 241
 						break;
242 242
 				} // END switch()
243 243
 
244
-				include_once( dirname( __FILE__ ) . '/includes/theme-support/class-alnp-theme-support.php' );
244
+				include_once(dirname(__FILE__).'/includes/theme-support/class-alnp-theme-support.php');
245 245
 
246 246
 			}
247 247
 		} // END alnp_include_theme_support()
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		 * @return  void
263 263
 		 */
264 264
 		public function load_plugin_textdomain() {
265
-			load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
265
+			load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/');
266 266
 		} // END load_plugin_textdomain()
267 267
 
268 268
 		/**
@@ -274,32 +274,32 @@  discard block
 block discarded – undo
274 274
 		 */
275 275
 		public function alnp_enqueue_scripts() {
276 276
 			// Load the Javascript if found as a singluar post and the user is not a bot.
277
-			if ( !alnp_is_bot() && is_singular() && get_post_type() == 'post' ) {
277
+			if ( ! alnp_is_bot() && is_singular() && get_post_type() == 'post') {
278 278
 				// This helps the plugin decide to load the JavaScript in the footer or not.
279
-				$load_in_footer = get_option( 'auto_load_next_post_js_footer' );
279
+				$load_in_footer = get_option('auto_load_next_post_js_footer');
280 280
 
281
-				$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 );
281
+				$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);
282 282
 
283 283
 				// Only load History.js when not in the customizer.
284
-				if ( ! is_customize_preview() ) {
285
-					$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 );
284
+				if ( ! is_customize_preview()) {
285
+					$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);
286 286
 				}
287 287
 
288
-				$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 );
288
+				$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);
289 289
 
290 290
 				// Variables for the JavaScript
291
-				wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array(
291
+				wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array(
292 292
 					'alnp_version'              => AUTO_LOAD_NEXT_POST_VERSION,
293
-					'alnp_content_container'    => get_option( 'auto_load_next_post_content_container' ),
294
-					'alnp_title_selector'       => get_option( 'auto_load_next_post_title_selector' ),
295
-					'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ),
296
-					'alnp_comments_container'   => get_option( 'auto_load_next_post_comments_container' ),
297
-					'alnp_remove_comments'      => get_option( 'auto_load_next_post_remove_comments' ),
298
-					'alnp_google_analytics'     => get_option( 'auto_load_next_post_google_analytics' ),
299
-					'alnp_event_on_load'        => get_option( 'auto_load_next_post_on_load_event' ),
300
-					'alnp_event_on_entering'    => get_option( 'auto_load_next_post_on_entering_event' ),
293
+					'alnp_content_container'    => get_option('auto_load_next_post_content_container'),
294
+					'alnp_title_selector'       => get_option('auto_load_next_post_title_selector'),
295
+					'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'),
296
+					'alnp_comments_container'   => get_option('auto_load_next_post_comments_container'),
297
+					'alnp_remove_comments'      => get_option('auto_load_next_post_remove_comments'),
298
+					'alnp_google_analytics'     => get_option('auto_load_next_post_google_analytics'),
299
+					'alnp_event_on_load'        => get_option('auto_load_next_post_on_load_event'),
300
+					'alnp_event_on_entering'    => get_option('auto_load_next_post_on_entering_event'),
301 301
 					'alnp_is_customizer'        => $this->is_alnp_using_customizer(),
302
-				) );
302
+				));
303 303
 			} // END if is_singular() && get_post_type()
304 304
 		} // END alnp_enqueue_scripts()
305 305
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		 * @return string|boolean
317 317
 		 */
318 318
 		public static function is_alnp_using_customizer() {
319
-			if ( is_customize_preview() ) {
319
+			if (is_customize_preview()) {
320 320
 				return "yes";
321 321
 			}
322 322
 
@@ -338,21 +338,21 @@  discard block
 block discarded – undo
338 338
 		 * @param   bool    $footer Optional, can set the JavaScript to load in the footer instead.
339 339
 		 * @global  string  $wp_version
340 340
 		 */
341
-		public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) {
341
+		public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false) {
342 342
 			global $wp_version;
343 343
 
344
-			$url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file.
344
+			$url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file.
345 345
 
346
-			if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) {
347
-				if ( $is_script ) {
348
-					if ( !wp_script_is( $name, 'registered' ) ) {
349
-						wp_register_script( $name, $url, $support, $version, $footer );
350
-						wp_enqueue_script( $name );
346
+			if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) {
347
+				if ($is_script) {
348
+					if ( ! wp_script_is($name, 'registered')) {
349
+						wp_register_script($name, $url, $support, $version, $footer);
350
+						wp_enqueue_script($name);
351 351
 					}
352 352
 				} else {
353
-					if ( !wp_style_is( $name, 'registered' ) ) {
354
-						wp_register_style( $name, $url );
355
-						wp_enqueue_style( $name );
353
+					if ( ! wp_style_is($name, 'registered')) {
354
+						wp_register_style($name, $url);
355
+						wp_enqueue_style($name);
356 356
 					}
357 357
 				} // end if
358 358
 			} // end if
Please login to merge, or discard this patch.