Completed
Pull Request — master (#133)
by Sébastien
01:51
created
includes/theme-support/class-alnp-twenty-fifteen.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function init() {
31 31
 		// Add theme support and preset the theme selectors.
32
-		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
32
+		add_action('after_setup_theme', array(__CLASS__, 'add_theme_support'));
33 33
 	} // END init()
34 34
 
35 35
 	/**
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * @static
41 41
 	 */
42 42
 	public static function add_theme_support() {
43
-		add_theme_support( 'auto-load-next-post', array(
43
+		add_theme_support('auto-load-next-post', array(
44 44
 			'content_container'    => 'main.site-main',
45 45
 			'title_selector'       => 'h1.entry-title',
46 46
 			'navigation_container' => 'nav.post-navigation',
47 47
 			'comments_container'   => 'section#comments',
48
-		) );
48
+		));
49 49
 	} // END add_theme_support()
50 50
 
51 51
 } // END class
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-twenty-eleven.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function init() {
31 31
 		// This removes the default post navigation in the repeater template.
32
-		remove_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 );
32
+		remove_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10);
33 33
 
34 34
 		// Add a compaitable post navigation.
35
-		add_action( 'alnp_load_after_content', array( __CLASS__, 'alnp_twentyeleven_post_navigation' ), 1, 10 );
35
+		add_action('alnp_load_after_content', array(__CLASS__, 'alnp_twentyeleven_post_navigation'), 1, 10);
36 36
 
37 37
 		// Filters the repeater template location.
38
-		add_filter( 'alnp_template_redirect', array( __CLASS__, 'alnp_twentyeleven_template_redirect' ) );
38
+		add_filter('alnp_template_redirect', array(__CLASS__, 'alnp_twentyeleven_template_redirect'));
39 39
 
40 40
 		// Add theme support and preset the theme selectors.
41
-		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
41
+		add_action('after_setup_theme', array(__CLASS__, 'add_theme_support'));
42 42
 	} // END init()
43 43
 
44 44
 	/**
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	public static function alnp_twentyeleven_post_navigation() {
51 51
 		?>
52 52
 		<nav id="nav-single">
53
-			<h3 class="assistive-text"><?php _e( 'Post navigation', 'auto-load-next-post' ); ?></h3>
54
-			<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'auto-load-next-post' ) ); ?></span>
53
+			<h3 class="assistive-text"><?php _e('Post navigation', 'auto-load-next-post'); ?></h3>
54
+			<span class="nav-previous"><?php previous_post_link('%link', __('<span class="meta-nav">&larr;</span> Previous', 'auto-load-next-post')); ?></span>
55 55
 		</nav><!-- #nav-single -->
56 56
 		<?php
57 57
 	} // END alnp_twentyeleven_post_navigation()
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return string
65 65
 	 */
66 66
 	public static function alnp_twentyeleven_template_redirect() {
67
-		return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/twenty-eleven/content-alnp.php';
67
+		return AUTO_LOAD_NEXT_POST_FILE_PATH.'/template/theme-support/twenty-eleven/content-alnp.php';
68 68
 	} // END alnp_twentyeleven_template_redirect()
69 69
 
70 70
 	/**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 * @static
76 76
 	 */
77 77
 	public static function add_theme_support() {
78
-		add_theme_support( 'auto-load-next-post', array(
78
+		add_theme_support('auto-load-next-post', array(
79 79
 			'content_container'    => '#content',
80 80
 			'title_selector'       => 'h1.entry-title',
81 81
 			'navigation_container' => '#nav-single',
82 82
 			'comments_container'   => 'div#comments',
83
-		) );
83
+		));
84 84
 	} // END add_theme_support()
85 85
 
86 86
 } // END class
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-understrap.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function init() {
31 31
 		// Add theme support and preset the theme selectors.
32
-		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
32
+		add_action('after_setup_theme', array(__CLASS__, 'add_theme_support'));
33 33
 
34 34
 		// Filters the repeater template location.
35
-		add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_understrap_template_location' ) );
35
+		add_filter('alnp_template_location', array(__CLASS__, 'alnp_understrap_template_location'));
36 36
 	} // END init()
37 37
 
38 38
 	/**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @static
54 54
 	 */
55 55
 	public static function add_theme_support() {
56
-		add_theme_support( 'auto-load-next-post', array(
56
+		add_theme_support('auto-load-next-post', array(
57 57
 			'content_container'    => 'main.site-main',
58 58
 			'title_selector'       => 'h1.entry-title',
59 59
 			'navigation_container' => 'nav.post-navigation',
60 60
 			'comments_container'   => 'div#comments',
61
-		) );
61
+		));
62 62
 	} // END add_theme_support()
63 63
 
64 64
 } // END class
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-twenty-twelve.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function init() {
31 31
 		// This removes the default post navigation in the repeater template.
32
-		remove_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 );
32
+		remove_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10);
33 33
 
34 34
 		// Add a compaitable post navigation.
35
-		add_action( 'alnp_load_after_content', array( __CLASS__, 'alnp_twentytwelve_post_navigation' ), 1, 10 );
35
+		add_action('alnp_load_after_content', array(__CLASS__, 'alnp_twentytwelve_post_navigation'), 1, 10);
36 36
 
37 37
 		// Add theme support and preset the theme selectors.
38
-		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
38
+		add_action('after_setup_theme', array(__CLASS__, 'add_theme_support'));
39 39
 	} // END init()
40 40
 
41 41
 	/**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	public static function alnp_twentytwelve_post_navigation() {
48 48
 	?>
49 49
 	<nav class="nav-single">
50
-		<h3 class="assistive-text"><?php _e( 'Post navigation', 'auto-load-next-post' ); ?></h3>
51
-		<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'auto-load-next-post' ) . '</span> %title' ); ?></span>
50
+		<h3 class="assistive-text"><?php _e('Post navigation', 'auto-load-next-post'); ?></h3>
51
+		<span class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">'._x('&larr;', 'Previous post link', 'auto-load-next-post').'</span> %title'); ?></span>
52 52
 	</nav><!-- .nav-single -->
53 53
 	<?php
54 54
 	} // END alnp_twentytwelve_post_navigation()
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	 * @static
62 62
 	 */
63 63
 	public static function add_theme_support() {
64
-		add_theme_support( 'auto-load-next-post', array(
64
+		add_theme_support('auto-load-next-post', array(
65 65
 			'content_container'    => '#content',
66 66
 			'title_selector'       => 'h1.entry-title',
67 67
 			'navigation_container' => '.nav-single',
68 68
 			'comments_container'   => 'div#comments',
69
-		) );
69
+		));
70 70
 	} // END add_theme_support()
71 71
 
72 72
 } // END class
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-theme-support.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct() {
30 30
 		// Update theme selectors if the theme was switched and it has theme support.
31
-		add_action( 'after_switch_theme', array( $this, 'update_alnp_theme_selectors' ), 15, 2 );
31
+		add_action('after_switch_theme', array($this, 'update_alnp_theme_selectors'), 15, 2);
32 32
 	} // END __construct()
33 33
 
34 34
 	/**
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @access public
39 39
 	 */
40
-	public function update_alnp_theme_selectors( $stylesheet = '', $old_theme = false ) {
40
+	public function update_alnp_theme_selectors($stylesheet = '', $old_theme = false) {
41 41
 		// Check if Auto Load Next Post is supported before updating the theme selectors.
42
-		if ( is_alnp_supported() ) {
43
-			$theme_support = get_theme_support( 'auto-load-next-post' );
42
+		if (is_alnp_supported()) {
43
+			$theme_support = get_theme_support('auto-load-next-post');
44 44
 
45
-			if ( is_array( $theme_support ) ) {
45
+			if (is_array($theme_support)) {
46 46
 				// Preferred implementation, where theme provides an array of options
47
-				if ( isset( $theme_support[0] ) && is_array( $theme_support[0] ) ) {
48
-					foreach( $theme_support[0] as $key => $value ) {
49
-						if ( ! empty( $value ) ) update_option( 'auto_load_next_post_' . $key, $value );
47
+				if (isset($theme_support[0]) && is_array($theme_support[0])) {
48
+					foreach ($theme_support[0] as $key => $value) {
49
+						if ( ! empty($value)) update_option('auto_load_next_post_'.$key, $value);
50 50
 					}
51 51
 				}
52 52
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@
 block discarded – undo
46 46
 				// Preferred implementation, where theme provides an array of options
47 47
 				if ( isset( $theme_support[0] ) && is_array( $theme_support[0] ) ) {
48 48
 					foreach( $theme_support[0] as $key => $value ) {
49
-						if ( ! empty( $value ) ) update_option( 'auto_load_next_post_' . $key, $value );
49
+						if ( ! empty( $value ) ) {
50
+							update_option( 'auto_load_next_post_' . $key, $value );
51
+						}
50 52
 					}
51 53
 				}
52 54
 			}
Please login to merge, or discard this patch.
includes/auto-load-next-post-core-functions.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	global $wp_query;
30 30
 
31 31
 	// If this is not a request for alnp or a singular object then bail
32
-	if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) {
32
+	if ( ! isset($wp_query->query_vars['alnp']) || ! is_singular()) {
33 33
 		return;
34 34
 	}
35 35
 
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
 	 * If theme does not have a template file for Auto Load Next Post,
39 39
 	 * the plugin will load a default template.
40 40
 	 */
41
-	$child_path    = get_stylesheet_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH;
42
-	$template_path = get_template_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH;
41
+	$child_path    = get_stylesheet_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH;
42
+	$template_path = get_template_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH;
43 43
 	$default_path  = AUTO_LOAD_NEXT_POST_FILE_PATH;
44 44
 
45
-	if ( file_exists( $child_path . 'content-alnp.php' ) ) {
46
-		$template_redirect = $child_path . 'content-alnp.php';
45
+	if (file_exists($child_path.'content-alnp.php')) {
46
+		$template_redirect = $child_path.'content-alnp.php';
47 47
 	}
48
-	else if( file_exists( $template_path . 'content-alnp.php') ) {
49
-		$template_redirect = $template_path . 'content-alnp.php';
48
+	else if (file_exists($template_path.'content-alnp.php')) {
49
+		$template_redirect = $template_path.'content-alnp.php';
50 50
 	}
51
-	else if( file_exists( $default_path . '/template/content-alnp.php' ) ) {
52
-		$template_redirect = $default_path . '/template/content-alnp.php';
51
+	else if (file_exists($default_path.'/template/content-alnp.php')) {
52
+		$template_redirect = $default_path.'/template/content-alnp.php';
53 53
 	}
54 54
 
55
-	$template_redirect = apply_filters( 'alnp_template_redirect', $template_redirect );
55
+	$template_redirect = apply_filters('alnp_template_redirect', $template_redirect);
56 56
 
57
-	include( $template_redirect );
57
+	include($template_redirect);
58 58
 
59 59
 	exit;
60 60
 }
61
-add_action( 'template_redirect', 'auto_load_next_post_template_redirect' );
61
+add_action('template_redirect', 'auto_load_next_post_template_redirect');
62 62
 
63 63
 /**
64 64
  * Adds the comments template after the post content.
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
  */
69 69
 function auto_load_next_post_comments() {
70 70
 	// If comments are open or we have at least one comment, load up the comment template.
71
-	if ( comments_open() || get_comments_number() ) :
71
+	if (comments_open() || get_comments_number()) :
72 72
 		comments_template();
73 73
 	endif;
74 74
 }
75
-add_action( 'alnp_load_after_content', 'auto_load_next_post_comments', 1, 5 );
75
+add_action('alnp_load_after_content', 'auto_load_next_post_comments', 1, 5);
76 76
 
77 77
 /**
78 78
  * Adds the post navigation for the previous link only after the post content.
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 function auto_load_next_post_navigation() {
84 84
 	?>
85 85
 	<nav class="navigation post-navigation" role="navigation">
86
-		<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'auto-load-next-post' ) . '</span> %title' ); ?></span>
86
+		<span class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">'._x('&larr;', 'Previous post link', 'auto-load-next-post').'</span> %title'); ?></span>
87 87
 	</nav>
88 88
 	<?php
89 89
 }
90
-add_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 );
90
+add_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,11 +44,9 @@
 block discarded – undo
44 44
 
45 45
 	if ( file_exists( $child_path . 'content-alnp.php' ) ) {
46 46
 		$template_redirect = $child_path . 'content-alnp.php';
47
-	}
48
-	else if( file_exists( $template_path . 'content-alnp.php') ) {
47
+	} else if( file_exists( $template_path . 'content-alnp.php') ) {
49 48
 		$template_redirect = $template_path . 'content-alnp.php';
50
-	}
51
-	else if( file_exists( $default_path . '/template/content-alnp.php' ) ) {
49
+	} else if( file_exists( $default_path . '/template/content-alnp.php' ) ) {
52 50
 		$template_redirect = $default_path . '/template/content-alnp.php';
53 51
 	}
54 52
 
Please login to merge, or discard this patch.
includes/class-alnp-autoloader.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
  // Exit if accessed directly.
15
- if ( ! defined( 'ABSPATH' ) ) {
15
+ if ( ! defined('ABSPATH')) {
16 16
  	exit;
17 17
  }
18 18
 
19
-if ( ! class_exists( 'Auto_Load_Next_Post_Autoloader' ) ) {
19
+if ( ! class_exists('Auto_Load_Next_Post_Autoloader')) {
20 20
 
21 21
 	class Auto_Load_Next_Post_Autoloader {
22 22
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		 * The Constructor.
33 33
 		 */
34 34
 		public function __construct() {
35
-			if ( function_exists( '__autoload' ) ) {
36
-				spl_autoload_register( '__autoload' );
35
+			if (function_exists('__autoload')) {
36
+				spl_autoload_register('__autoload');
37 37
 			}
38 38
 
39
-			spl_autoload_register( array( $this, 'autoload' ) );
39
+			spl_autoload_register(array($this, 'autoload'));
40 40
 
41
-			$this->include_path = untrailingslashit( plugin_dir_path( AUTO_LOAD_NEXT_POST_FILE ) ) . '/includes/';
41
+			$this->include_path = untrailingslashit(plugin_dir_path(AUTO_LOAD_NEXT_POST_FILE)).'/includes/';
42 42
 		}
43 43
 
44 44
 		/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		 * @param  string $class Class name.
49 49
 		 * @return string
50 50
 		 */
51
-		private function get_file_name_from_class( $class ) {
52
-			return 'class-' . str_replace( '_', '-', $class ) . '.php';
51
+		private function get_file_name_from_class($class) {
52
+			return 'class-'.str_replace('_', '-', $class).'.php';
53 53
 		} // END get_file_name_from_class()
54 54
 
55 55
 		/**
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		 * @param  string $path File path.
60 60
 		 * @return bool Successful or not.
61 61
 		 */
62
-		private function load_file( $path ) {
63
-			if ( $path && is_readable( $path ) ) {
62
+		private function load_file($path) {
63
+			if ($path && is_readable($path)) {
64 64
 				include_once $path;
65 65
 				return true;
66 66
 			}
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
 		 * @access public
74 74
 		 * @param  string $class Class name.
75 75
 		 */
76
-		public function autoload( $class ) {
77
-			$class = strtolower( $class );
76
+		public function autoload($class) {
77
+			$class = strtolower($class);
78 78
 
79
-			if ( 0 !== strpos( $class, 'alnp_' ) ) {
79
+			if (0 !== strpos($class, 'alnp_')) {
80 80
 				return;
81 81
 			}
82 82
 
83
-			$file = $this->get_file_name_from_class( $class );
83
+			$file = $this->get_file_name_from_class($class);
84 84
 			$path = '';
85 85
 
86
-			if ( 0 === strpos( $class, 'alnp_admin' ) ) {
87
-				$path = $this->include_path . 'admin/';
86
+			if (0 === strpos($class, 'alnp_admin')) {
87
+				$path = $this->include_path.'admin/';
88 88
 			}
89 89
 
90
-			if ( empty( $path ) || ! $this->load_file( $path . $file ) ) {
91
-				$this->load_file( $this->include_path . $file );
90
+			if (empty($path) || ! $this->load_file($path.$file)) {
91
+				$this->load_file($this->include_path.$file);
92 92
 			}
93 93
 		} // END autoload()
94 94
 
Please login to merge, or discard this patch.
includes/auto-load-next-post-conditional-functions.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
 // Exit if accessed directly.
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if ( ! defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21
-if ( ! function_exists( 'auto_load_next_post_is_ajax' ) ) {
21
+if ( ! function_exists('auto_load_next_post_is_ajax')) {
22 22
 	/**
23 23
 	 * Returns true when the page is loaded via ajax.
24 24
 	 *
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 * @return bool
28 28
 	 */
29 29
 	function auto_load_next_post_is_ajax() {
30
-		if ( defined( 'DOING_AJAX' ) ) {
30
+		if (defined('DOING_AJAX')) {
31 31
 			return true;
32 32
 		}
33 33
 
34
-		return( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false;
34
+		return(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false;
35 35
 	} // END auto_load_next_post_is_ajax
36 36
 }
37 37
 
38
-if ( ! function_exists( 'alnp_template_location' ) ) {
38
+if ( ! function_exists('alnp_template_location')) {
39 39
 	/**
40 40
 	 * Filters the template location for get_template_part().
41 41
 	 *
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	function alnp_template_location() {
48 48
 		$current_theme = get_option('template');
49 49
 
50
-		switch( $current_theme ) {
50
+		switch ($current_theme) {
51 51
 			case 'twentyseventeen':
52 52
 				$path = 'template-parts/post/';
53 53
 				break;
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 				break;
62 62
 		}
63 63
 
64
-		return apply_filters( 'alnp_template_location', $path );
64
+		return apply_filters('alnp_template_location', $path);
65 65
 	} // END alnp_template_location()
66 66
 }
67 67
 
68
-if ( ! function_exists( 'is_alnp_pro_version_installed' ) ) {
68
+if ( ! function_exists('is_alnp_pro_version_installed')) {
69 69
 	/**
70 70
 	 * Detects if Auto Load Next Post Pro is installed.
71 71
 	 *
@@ -74,17 +74,17 @@  discard block
 block discarded – undo
74 74
 	 * @return boolean
75 75
 	 */
76 76
 	function is_alnp_pro_version_installed() {
77
-		$active_plugins = (array) get_option( 'active_plugins', array() );
77
+		$active_plugins = (array) get_option('active_plugins', array());
78 78
 
79
-		if ( is_multisite() ) {
80
-			$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
79
+		if (is_multisite()) {
80
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
81 81
 		}
82 82
 
83
-		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 );
83
+		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);
84 84
 	}
85 85
 }
86 86
 
87
-if ( ! function_exists( 'is_alnp_beta' ) ) {
87
+if ( ! function_exists('is_alnp_beta')) {
88 88
 	/**
89 89
 	 * Returns true if Auto Load Next Post is a beta release.
90 90
 	 *
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return boolean
93 93
 	 */
94 94
 	function is_alnp_beta() {
95
-		if ( strpos( AUTO_LOAD_NEXT_POST_VERSION, 'beta' ) ) {
95
+		if (strpos(AUTO_LOAD_NEXT_POST_VERSION, 'beta')) {
96 96
 			return true;
97 97
 		}
98 98
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 }
102 102
 
103
-if ( ! function_exists( 'is_alnp_active_theme' ) ) {
103
+if ( ! function_exists('is_alnp_active_theme')) {
104 104
 	/**
105 105
 	 * See if theme/s is activate or not.
106 106
 	 *
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 	 * @param string|array $theme Theme name or array of theme names to check.
109 109
 	 * @return boolean
110 110
 	 */
111
-	function is_alnp_active_theme( $theme ) {
112
-		return is_array( $theme ) ? in_array( get_template(), $theme, true ) : get_template() === $theme;
111
+	function is_alnp_active_theme($theme) {
112
+		return is_array($theme) ? in_array(get_template(), $theme, true) : get_template() === $theme;
113 113
 	}
114 114
 }
115 115
 
116
-if ( ! function_exists( 'is_alnp_supported' ) ) {
116
+if ( ! function_exists('is_alnp_supported')) {
117 117
 	/**
118 118
 	 * Returns true if Auto Load Next Post is supported in the theme.
119 119
 	 *
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @return boolean
122 122
 	 */
123 123
 	function is_alnp_supported() {
124
-		$theme_support = current_theme_supports( 'auto-load-next-post' );
124
+		$theme_support = current_theme_supports('auto-load-next-post');
125 125
 
126
-		if ( ! $theme_support ) {
126
+		if ( ! $theme_support) {
127 127
 			return false;
128 128
 		}
129 129
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 }
133 133
 
134
-if ( ! function_exists( 'alnp_get_theme_support' ) ) {
134
+if ( ! function_exists('alnp_get_theme_support')) {
135 135
 	/**
136 136
 	 * Return "theme support" values from the current theme, if set.
137 137
 	 *
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
 	 * @param  mixed  $default Optional value to return if the theme does not declare support for a prop.
141 141
 	 * @return mixed  Value of prop(s).
142 142
 	 */
143
-	function alnp_get_theme_support( $prop = '', $default = null ) {
144
-		$theme_support = get_theme_support( 'auto-load-next-post' );
145
-		$theme_support = is_array( $theme_support ) ? $theme_support[0] : false;
143
+	function alnp_get_theme_support($prop = '', $default = null) {
144
+		$theme_support = get_theme_support('auto-load-next-post');
145
+		$theme_support = is_array($theme_support) ? $theme_support[0] : false;
146 146
 
147
-		if ( ! $theme_support ) {
147
+		if ( ! $theme_support) {
148 148
 			return $default;
149 149
 		}
150 150
 
151
-		if ( ! empty( $prop ) ) {
152
-			$prop_stack = explode( '::', $prop );
153
-			$prop_key   = array_shift( $prop_stack );
151
+		if ( ! empty($prop)) {
152
+			$prop_stack = explode('::', $prop);
153
+			$prop_key   = array_shift($prop_stack);
154 154
 
155
-			if ( isset( $theme_support[ $prop_key ] ) ) {
156
-				$value = $theme_support[ $prop_key ];
155
+			if (isset($theme_support[$prop_key])) {
156
+				$value = $theme_support[$prop_key];
157 157
 
158
-				if ( count( $prop_stack ) ) {
159
-					foreach ( $prop_stack as $prop_key ) {
160
-						if ( is_array( $value ) && isset( $value[ $prop_key ] ) ) {
161
-							$value = $value[ $prop_key ];
158
+				if (count($prop_stack)) {
159
+					foreach ($prop_stack as $prop_key) {
160
+						if (is_array($value) && isset($value[$prop_key])) {
161
+							$value = $value[$prop_key];
162 162
 						} else {
163 163
 							$value = $default;
164 164
 							break;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 }
178 178
 
179
-if ( ! function_exists( 'alnp_is_bot' ) ) {
179
+if ( ! function_exists('alnp_is_bot')) {
180 180
 	/**
181 181
 	 * Was the current request made by a known bot?
182 182
 	 *
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @return boolean
185 185
 	 */
186 186
 	function alnp_is_bot() {
187
-		$is_bot = alnp_is_bot_user_agent( $_SERVER['HTTP_USER_AGENT'] );
187
+		$is_bot = alnp_is_bot_user_agent($_SERVER['HTTP_USER_AGENT']);
188 188
 
189 189
 		return $is_bot;
190 190
 	}
191 191
 }
192 192
 
193
-if ( ! function_exists( 'alnp_is_bot_user_agent' ) ) {
193
+if ( ! function_exists('alnp_is_bot_user_agent')) {
194 194
 	/**
195 195
 	 * Is the given user-agent a known bot?
196 196
 	 *
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 * @param  string A user-agent string
199 199
 	 * @return boolean
200 200
 	 */
201
-	function alnp_is_bot_user_agent( $ua = null ) {
202
-		if ( empty( $ua ) ) {
201
+	function alnp_is_bot_user_agent($ua = null) {
202
+		if (empty($ua)) {
203 203
 			return false;
204 204
 		}
205 205
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 			'livelapbot', 'germcrawler', 'domaintunocrawler', 'grapeshotcrawler', 'cloudflare-alwaysonline',
214 214
 		);
215 215
 
216
-		foreach ( $bot_agents as $bot_agent ) {
217
-			if ( false !== stripos( $ua, $bot_agent ) ) {
216
+		foreach ($bot_agents as $bot_agent) {
217
+			if (false !== stripos($ua, $bot_agent)) {
218 218
 				return true;
219 219
 			}
220 220
 		}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	}
224 224
 }
225 225
 
226
-if ( ! function_exists( 'alnp_get_post_type' ) ) {
226
+if ( ! function_exists('alnp_get_post_type')) {
227 227
 	/**
228 228
 	 * Returns the post type.
229 229
 	 *
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$post_type = get_post_type();
236 236
 
237 237
 		// If the post type is a post then return single instead.
238
-		if ( $post_type == 'post' ) {
238
+		if ($post_type == 'post') {
239 239
 			return 'single';
240 240
 		}
241 241
 
Please login to merge, or discard this patch.
includes/class-alnp-install.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Auto_Load_Next_Post_Install' ) ) {
18
+if ( ! class_exists('Auto_Load_Next_Post_Install')) {
19 19
 
20 20
 	class Auto_Load_Next_Post_Install {
21 21
 
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 		 * @access public
37 37
 		 */
38 38
 		public function __construct() {
39
-			add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 0 );
40
-			add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
39
+			add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 0);
40
+			add_action('init', array(__CLASS__, 'check_version'), 5);
41 41
 
42 42
 			// Get plugin version.
43
-			self::$current_version = get_option( 'auto_load_next_post_version', null );
43
+			self::$current_version = get_option('auto_load_next_post_version', null);
44 44
 		} // END __construct()
45 45
 
46 46
 		/**
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 		 * @since  1.4.10
54 54
 		 */
55 55
 		public static function check_version() {
56
-			if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<' ) ) {
56
+			if ( ! defined('IFRAME_REQUEST') && version_compare(self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<')) {
57 57
 				self::install();
58
-				do_action( 'auto_load_next_post_updated' );
58
+				do_action('auto_load_next_post_updated');
59 59
 			}
60 60
 		} // END check_version()
61 61
 
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 		 * @version 1.5.0
69 69
 		 */
70 70
 		public static function install() {
71
-			if ( ! is_blog_installed() ) {
71
+			if ( ! is_blog_installed()) {
72 72
 				return;
73 73
 			}
74 74
 
75 75
 			// Check if we are not already running this routine.
76
-			if ( 'yes' === get_transient( 'alnp_installing' ) ) {
76
+			if ('yes' === get_transient('alnp_installing')) {
77 77
 				return;
78 78
 			}
79 79
 
80 80
 			// If we made it till here nothing is running yet, lets set the transient now for five minutes.
81
-			set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 5 );
82
-			if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) {
83
-				define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true );
81
+			set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 5);
82
+			if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) {
83
+				define('AUTO_LOAD_NEXT_POST_INSTALLING', true);
84 84
 			}
85 85
 
86 86
 			// Add default options.
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 			// Refresh rewrite rules.
99 99
 			self::flush_rewrite_rules();
100 100
 
101
-			delete_transient( 'alnp_installing' );
101
+			delete_transient('alnp_installing');
102 102
 
103
-			do_action( 'alnp_installed' );
103
+			do_action('alnp_installed');
104 104
 		} // END install()
105 105
 
106 106
 		/**
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 		 * @since  1.5.0
113 113
 		 */
114 114
 		private static function set_theme_selectors() {
115
-			if ( is_alnp_supported() ) {
116
-				$content_container    = alnp_get_theme_support( 'content_container' );
117
-				$title_selector       = alnp_get_theme_support( 'title_selector' );
118
-				$navigation_container = alnp_get_theme_support( 'navigation_container' );
119
-				$comments_container   = alnp_get_theme_support( 'comments_container' );
120
-
121
-				if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container );
122
-				if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector );
123
-				if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container );
124
-				if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container );
115
+			if (is_alnp_supported()) {
116
+				$content_container    = alnp_get_theme_support('content_container');
117
+				$title_selector       = alnp_get_theme_support('title_selector');
118
+				$navigation_container = alnp_get_theme_support('navigation_container');
119
+				$comments_container   = alnp_get_theme_support('comments_container');
120
+
121
+				if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container);
122
+				if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector);
123
+				if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container);
124
+				if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container);
125 125
 			}
126 126
 		} // END set_theme_selectors()
127 127
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		 * @static
133 133
 		 */
134 134
 		private static function update_version() {
135
-			update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION );
135
+			update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION);
136 136
 		} // END update_version()
137 137
 
138 138
 		/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 		 * @version 1.5.0
145 145
 		 */
146 146
 		public static function set_install_date() {
147
-			$install_date = get_site_option( 'auto_load_next_post_install_date' );
147
+			$install_date = get_site_option('auto_load_next_post_install_date');
148 148
 
149 149
 			// If ALNP was installed before but the install date was not converted to time then convert it.
150
-			if ( ! empty( $install_date ) && !intval( $install_date ) ) {
151
-				update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) );
150
+			if ( ! empty($install_date) && ! intval($install_date)) {
151
+				update_site_option('auto_load_next_post_install_date', strtotime($install_date));
152 152
 			} else {
153
-				add_site_option( 'auto_load_next_post_install_date', time() );
153
+				add_site_option('auto_load_next_post_install_date', time());
154 154
 			}
155 155
 		} // END set_install_date()
156 156
 
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 		 */
166 166
 		public static function create_options() {
167 167
 			// Include settings so that we can run through defaults
168
-			include_once( dirname( __FILE__ ) . '/admin/class-auto-load-next-post-admin-settings.php' );
168
+			include_once(dirname(__FILE__).'/admin/class-auto-load-next-post-admin-settings.php');
169 169
 
170 170
 			$settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages();
171 171
 
172
-			foreach ( $settings as $section ) {
173
-				foreach ( $section->get_settings() as $value ) {
174
-					if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
175
-						$autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
176
-						add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
172
+			foreach ($settings as $section) {
173
+				foreach ($section->get_settings() as $value) {
174
+					if (isset($value['default']) && isset($value['id'])) {
175
+						$autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
176
+						add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no'));
177 177
 					}
178 178
 				}
179 179
 			}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		 * @version 1.5.0
189 189
 		 */
190 190
 		public static function add_rewrite_endpoint() {
191
-			add_rewrite_endpoint( 'alnp', EP_PERMALINK );
191
+			add_rewrite_endpoint('alnp', EP_PERMALINK);
192 192
 		} // END add_rewrite_endpoint()
193 193
 
194 194
 		/**
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,10 +118,18 @@
 block discarded – undo
118 118
 				$navigation_container = alnp_get_theme_support( 'navigation_container' );
119 119
 				$comments_container   = alnp_get_theme_support( 'comments_container' );
120 120
 
121
-				if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container );
122
-				if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector );
123
-				if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container );
124
-				if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container );
121
+				if ( ! empty( $content_container ) ) {
122
+					update_option( 'auto_load_next_post_content_container', $content_container );
123
+				}
124
+				if ( ! empty( $title_selector ) ) {
125
+					update_option( 'auto_load_next_post_title_selector', $title_selector );
126
+				}
127
+				if ( ! empty( $navigation_container ) ) {
128
+					update_option( 'auto_load_next_post_navigation_container', $navigation_container );
129
+				}
130
+				if ( ! empty( $comments_container ) ) {
131
+					update_option( 'auto_load_next_post_comments_container', $comments_container );
132
+				}
125 133
 			}
126 134
 		} // END set_theme_selectors()
127 135
 
Please login to merge, or discard this patch.