Completed
Branch master (8a106b)
by
unknown
01:39
created
template/content-partial.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,71 +16,71 @@
 block discarded – undo
16 16
  * @version 1.4.12
17 17
 */
18 18
 
19
-$template_location = apply_filters( 'alnp_template_location', '' ); // e.g. "template-parts/post/"
19
+$template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/"
20 20
 
21
-if ( have_posts() ) :
21
+if (have_posts()) :
22 22
 
23 23
 	// Load content before the loop.
24
-	do_action( 'alnp_load_before_loop' );
24
+	do_action('alnp_load_before_loop');
25 25
 
26 26
 	// Check that there are posts to load.
27
-	while ( have_posts() ) : the_post();
27
+	while (have_posts()) : the_post();
28 28
 
29 29
 		$post_format = get_post_format(); // Post Format e.g. video
30 30
 
31 31
 		$post_type = alnp_get_post_type(); // Post Type e.g. single
32 32
 
33 33
 		// Load content before the post content.
34
-		do_action( 'alnp_load_before_content' );
34
+		do_action('alnp_load_before_content');
35 35
 
36 36
 		// Load content before the post content for a specific post format.
37
-		do_action( 'alnp_load_before_content_post_format_' . $post_format );
37
+		do_action('alnp_load_before_content_post_format_'.$post_format);
38 38
 
39 39
 		// Load content before the post content for a specific post type.
40
-		do_action( 'alnp_load_before_content_post_type_' . $post_type );
40
+		do_action('alnp_load_before_content_post_type_'.$post_type);
41 41
 
42
-		if ( false === $post_format ) {
42
+		if (false === $post_format) {
43 43
 			/*
44 44
 			 * Include the Post-Type-specific template for the content.
45 45
 			 * content-___.php (where ___ is the Post Type name).
46 46
 			 */
47
-			if ( locate_template( $template_location . 'content-' . $post_type . '.php') != '' ) {
48
-				get_template_part( $template_location . 'content', $post_type );
47
+			if (locate_template($template_location.'content-'.$post_type.'.php') != '') {
48
+				get_template_part($template_location.'content', $post_type);
49 49
 			} else {
50 50
 				// If no specific post type found then fallback to standard content.php file.
51
-				get_template_part( $template_location . 'content' );
51
+				get_template_part($template_location.'content');
52 52
 			}
53 53
 		} else {
54 54
 			/*
55 55
 			 * Include the Post-Format-specific template for the content.
56 56
 			 * called format-___.php (where ___ is the Post Format name).
57 57
 			 */
58
-			if ( locate_template( $template_location . 'format-' . $post_format . '.php' ) != '' ) {
59
-				get_template_part( $template_location . 'format', $post_format );
58
+			if (locate_template($template_location.'format-'.$post_format.'.php') != '') {
59
+				get_template_part($template_location.'format', $post_format);
60 60
 			} else {
61 61
 				// If no format-{post-format}.php file found then fallback to content-{post-format}.php
62
-				get_template_part( $template_location . 'content', $post_format );
62
+				get_template_part($template_location.'content', $post_format);
63 63
 			}
64 64
 		}
65 65
 
66 66
 		// Load content after the post content for a specific post type.
67
-		do_action( 'alnp_load_after_content_post_type_' . $post_type );
67
+		do_action('alnp_load_after_content_post_type_'.$post_type);
68 68
 
69 69
 		// Load content after the post content for a specific post format.
70
-		do_action( 'alnp_load_after_content_post_format_' . $post_format );
70
+		do_action('alnp_load_after_content_post_format_'.$post_format);
71 71
 
72 72
 		// Load content after the post content.
73
-		do_action( 'alnp_load_after_content' );
73
+		do_action('alnp_load_after_content');
74 74
 
75 75
 	// End the loop.
76 76
 	endwhile;
77 77
 
78 78
 		// Load content after the loop.
79
-		do_action( 'alnp_load_after_loop' );
79
+		do_action('alnp_load_after_loop');
80 80
 
81 81
 else :
82 82
 
83 83
 	// Load content if there are no more posts.
84
-	do_action( 'alnp_no_more_posts' );
84
+	do_action('alnp_no_more_posts');
85 85
 
86 86
 endif; // END if have_posts()
Please login to merge, or discard this patch.
auto-load-next-post.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @version 1.4.10
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
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		 * @return Auto_Load_Next_Post Single instance.
53 53
 		 */
54 54
 		public static function instance() {
55
-			if ( is_null( self::$_instance ) ) {
55
+			if (is_null(self::$_instance)) {
56 56
 				self::$_instance = new self();
57 57
 				self::$_instance->setup_constants();
58 58
 				self::$_instance->includes();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		 */
70 70
 		public function __clone() {
71 71
 			// Cloning instances of the class is forbidden
72
-			_doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION );
72
+			_doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION);
73 73
 		} // END __clone()
74 74
 
75 75
 		/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 * @return void
81 81
 		 */
82 82
 		public function __wakeup() {
83
-			_doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION );
83
+			_doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION);
84 84
 		} // END __wakeup()
85 85
 
86 86
 		/**
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 		 */
93 93
 		public function __construct() {
94 94
 			// Auto-load classes on demand
95
-			if ( function_exists("__autoload") ) {
95
+			if (function_exists("__autoload")) {
96 96
 				spl_autoload_register("__autoload");
97 97
 			}
98 98
 
99
-			spl_autoload_register( array( $this, 'autoload' ) );
99
+			spl_autoload_register(array($this, 'autoload'));
100 100
 
101 101
 			// Load translation files.
102
-			add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
102
+			add_action('init', array($this, 'load_plugin_textdomain'));
103 103
 
104 104
 			// Load Auto Load Next Post scripts on the frontend.
105
-			add_action( 'wp_enqueue_scripts', array( $this, 'alnp_scripts' ) );
105
+			add_action('wp_enqueue_scripts', array($this, 'alnp_scripts'));
106 106
 		} // END __construct()
107 107
 
108 108
 		/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 		 * @param  mixed $class
114 114
 		 * @return void
115 115
 		 */
116
-		public function autoload( $class ) {
116
+		public function autoload($class) {
117 117
 			$path  = null;
118
-			$file  = strtolower( 'class-' . str_replace( '_', '-', $class ) ) . '.php';
118
+			$file  = strtolower('class-'.str_replace('_', '-', $class)).'.php';
119 119
 
120
-			if ( strpos( $class, 'auto_load_next_post_admin' ) === 0 ) {
121
-				$path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/admin/';
122
-			} else if ( strpos( $class, 'auto_load_next_post_' ) === 0 ) {
123
-				$path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/';
120
+			if (strpos($class, 'auto_load_next_post_admin') === 0) {
121
+				$path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/admin/';
122
+			} else if (strpos($class, 'auto_load_next_post_') === 0) {
123
+				$path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/';
124 124
 			}
125 125
 
126
-			if ( $path !== null && is_readable( $path . $file ) ) {
127
-				include_once( $path . $file );
126
+			if ($path !== null && is_readable($path.$file)) {
127
+				include_once($path.$file);
128 128
 				return true;
129 129
 			}
130 130
 		} // END autoload()
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 		 * @access private
163 163
 		 * @since  1.4.3
164 164
 		 */
165
-		private function define( $name, $value ) {
166
-			if ( ! defined( $name ) ) {
167
-				define( $name, $value );
165
+		private function define($name, $value) {
166
+			if ( ! defined($name)) {
167
+				define($name, $value);
168 168
 			}
169 169
 		} // END define()
170 170
 
@@ -181,20 +181,20 @@  discard block
 block discarded – undo
181 181
 		 * @return  void
182 182
 		 */
183 183
 		public function includes() {
184
-			include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end.
184
+			include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end.
185 185
 
186 186
 			// Include admin class to handle all back-end functions.
187
-			if ( is_admin() ) {
188
-				include_once( dirname( __FILE__ ) . '/includes/admin/class-auto-load-next-post-admin.php'); // Admin section.
187
+			if (is_admin()) {
188
+				include_once(dirname(__FILE__).'/includes/admin/class-auto-load-next-post-admin.php'); // Admin section.
189 189
 			}
190 190
 
191 191
 			// Install.
192
-			require_once( dirname( __FILE__ ) . '/includes/class-auto-load-next-post-install.php' );
192
+			require_once(dirname(__FILE__).'/includes/class-auto-load-next-post-install.php');
193 193
 
194 194
 			/**
195 195
 			 * Auto Load Next Post is fully loaded.
196 196
 			 */
197
-			do_action( 'auto_load_next_post_loaded' );
197
+			do_action('auto_load_next_post_loaded');
198 198
 		} // END includes()
199 199
 
200 200
 		/**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		 * @return  void
210 210
 		 */
211 211
 		public function load_plugin_textdomain() {
212
-			load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
212
+			load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/');
213 213
 		} // END load_plugin_textdomain()
214 214
 
215 215
 		/**
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
 			/**
224 224
 			 * Load the Javascript if found as a singluar post.
225 225
 			 */
226
-			if ( is_singular() && get_post_type() == 'post' ) {
227
-				$this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION );
226
+			if (is_singular() && get_post_type() == 'post') {
227
+				$this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION);
228 228
 
229 229
 				// Only load History.js when not in the customizer.
230
-				if ( ! is_customize_preview() ) {
231
-					$this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION );
230
+				if ( ! is_customize_preview()) {
231
+					$this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION);
232 232
 				}
233 233
 
234
-				$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 );
234
+				$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);
235 235
 
236 236
 				// Variables for JS scripts
237
-				wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array(
237
+				wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array(
238 238
 					'alnp_version'              => AUTO_LOAD_NEXT_POST_VERSION,
239 239
 					'alnp_content_container'    => get_option('auto_load_next_post_content_container'),
240 240
 					'alnp_title_selector'       => get_option('auto_load_next_post_title_selector'),
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					'alnp_remove_comments'      => get_option('auto_load_next_post_remove_comments'),
244 244
 					'alnp_google_analytics'     => get_option('auto_load_next_post_google_analytics'),
245 245
 					'alnp_is_customizer'        => is_customize_preview()
246
-				) );
246
+				));
247 247
 			} // END if is_singular() && get_post_type()
248 248
 		} // END alnp_scripts()
249 249
 
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
 		 * @param  string  $version   Optional, can match the version of the plugin or version of the source file.
261 261
 		 * @global string  $wp_version
262 262
 		 */
263
-		public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '' ) {
263
+		public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') {
264 264
 			global $wp_version;
265 265
 
266
-			$url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file.
266
+			$url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file.
267 267
 
268
-			if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) {
269
-				if ( $is_script ) {
270
-					wp_register_script( $name, $url, $support, $version );
271
-					wp_enqueue_script( $name );
268
+			if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) {
269
+				if ($is_script) {
270
+					wp_register_script($name, $url, $support, $version);
271
+					wp_enqueue_script($name);
272 272
 				} else {
273
-					wp_register_style( $name, $url );
274
-					wp_enqueue_style( $name );
273
+					wp_register_style($name, $url);
274
+					wp_enqueue_style($name);
275 275
 				} // end if
276 276
 			} // end if
277 277
 
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 } // END run_auto_load_next_post()
290 290
 
291 291
 // Fetch the Php version checker.
292
-if ( ! class_exists( 'WP_Update_Php' ) ) {
293
-	require_once( dirname( __FILE__ ) . '/wp-update-php/wp-update-php.php' );
292
+if ( ! class_exists('WP_Update_Php')) {
293
+	require_once(dirname(__FILE__).'/wp-update-php/wp-update-php.php');
294 294
 }
295 295
 $updatePhp = new WP_Update_Php(
296 296
 	array(
@@ -304,6 +304,6 @@  discard block
 block discarded – undo
304 304
 );
305 305
 
306 306
 // If the miniumum version of PHP required is available then run the plugin.
307
-if ( $updatePhp->does_it_meet_required_php_version() ) {
307
+if ($updatePhp->does_it_meet_required_php_version()) {
308 308
 	add_action('plugins_loaded', 'run_auto_load_next_post', 20);
309 309
 }
Please login to merge, or discard this patch.
includes/auto-load-next-post-conditional-functions.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! function_exists( 'auto_load_next_post_is_ajax' ) ) {
20
+if ( ! function_exists('auto_load_next_post_is_ajax')) {
21 21
 	/**
22 22
 	 * Returns true when the page is loaded via ajax.
23 23
 	 *
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 	 * @return bool
27 27
 	 */
28 28
 	function auto_load_next_post_is_ajax() {
29
-		if ( defined( 'DOING_AJAX' ) ) {
29
+		if (defined('DOING_AJAX')) {
30 30
 			return true;
31 31
 		}
32 32
 
33
-		return( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false;
33
+		return(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false;
34 34
 	} // END auto_load_next_post_is_ajax
35 35
 }
36 36
 
37
-if ( ! function_exists( 'supports_alnp' ) ) {
37
+if ( ! function_exists('supports_alnp')) {
38 38
 	/**
39 39
 	 * Returns true or false if Auto Load Next Post supports the theme.
40 40
 	 *
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 			'storefront'
54 54
 		);
55 55
 
56
-		$supported_themes = array_merge( $core_themes, $other_themes );
56
+		$supported_themes = array_merge($core_themes, $other_themes);
57 57
 
58
-		if ( in_array( get_option('template'), $supported_themes ) ) {
58
+		if (in_array(get_option('template'), $supported_themes)) {
59 59
 			return true;
60
-		} else if ( current_theme_supports( 'auto-load-next-post' ) ) {
60
+		} else if (current_theme_supports('auto-load-next-post')) {
61 61
 			return true;
62 62
 		}
63 63
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	} // END supports_alnp()
66 66
 }
67 67
 
68
-if ( ! function_exists( 'alnp_template_location' ) ) {
68
+if ( ! function_exists('alnp_template_location')) {
69 69
 	/**
70 70
 	 * Filters the template location for get_template_part().
71 71
 	 *
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	function alnp_template_location() {
78 78
 		$current_theme = get_option('template');
79 79
 
80
-		switch( $current_theme ) {
80
+		switch ($current_theme) {
81 81
 			case 'twentyseventeen':
82 82
 				$path = 'template-parts/post/';
83 83
 				break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	add_filter('alnp_template_location', 'alnp_template_location');
98 98
 }
99 99
 
100
-if ( ! function_exists( 'is_alnp_pro_version_installed' ) ) {
100
+if ( ! function_exists('is_alnp_pro_version_installed')) {
101 101
 	/**
102 102
 	 * Detects if Auto Load Next Post Pro is installed.
103 103
 	 *
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 	 * @return boolen
107 107
 	 */
108 108
 	function is_alnp_pro_version_installed() {
109
-		$active_plugins = (array) get_option( 'active_plugins', array() );
109
+		$active_plugins = (array) get_option('active_plugins', array());
110 110
 
111
-		if ( is_multisite() ) {
112
-			$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
111
+		if (is_multisite()) {
112
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
113 113
 		}
114 114
 
115
-		return in_array( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins ) || array_key_exists( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins );
115
+		return in_array('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins) || array_key_exists('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins);
116 116
 	}
117 117
 }
118 118
 
119
-if ( ! function_exists( 'alnp_get_post_type' ) ) {
119
+if ( ! function_exists('alnp_get_post_type')) {
120 120
 	/**
121 121
 	 * Returns the post type.
122 122
 	 *
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		$post_type = get_post_type();
129 129
 
130 130
 		// If the post type is a post then return single instead.
131
-		if ( $post_type == 'post' ) {
131
+		if ($post_type == 'post') {
132 132
 			return 'single';
133 133
 		}
134 134
 
Please login to merge, or discard this patch.