Completed
Branch codeclean (07bbe5)
by Sébastien
01:40
created
includes/admin/views/html-notice-requirement-wp.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 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 18
 <div class="notice notice-error">
19
-	<p><?php echo sprintf( __( 'Sorry, <strong>%s</strong> requires WordPress %s or higher. Please upgrade your WordPress setup.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE ); ?></p>
19
+	<p><?php echo sprintf(__('Sorry, <strong>%s</strong> requires WordPress %s or higher. Please upgrade your WordPress setup.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE); ?></p>
20 20
 </div>
Please login to merge, or discard this patch.
includes/auto-load-next-post-conditional-functions.php 1 patch
Spacing   +45 added lines, -45 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
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 }
245 245
 
246
-if ( ! function_exists( 'alnp_check_jetpack' ) ) {
246
+if ( ! function_exists('alnp_check_jetpack')) {
247 247
 	/**
248 248
 	 * Check if Jetpack is installed.
249 249
 	 *
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return string
253 253
 	 */
254 254
 	function alnp_check_jetpack() {
255
-		$jetpack_active = class_exists( 'Jetpack' );
255
+		$jetpack_active = class_exists('Jetpack');
256 256
 
257 257
 		$is_active = $jetpack_active ? 'yes' : 'no';
258 258
 
Please login to merge, or discard this patch.
includes/customizer/class-alnp-arbitrary-controller.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Exit if WP_Customize_Control does not exsist.
18
-if ( ! class_exists( 'WP_Customize_Control' ) ) {
18
+if ( ! class_exists('WP_Customize_Control')) {
19 19
 	return null;
20 20
 }
21 21
 
22
-if ( !class_exists( 'Auto_Load_Next_Post_Arbitrary_Control' ) ) {
22
+if ( ! class_exists('Auto_Load_Next_Post_Arbitrary_Control')) {
23 23
 
24 24
 	/**
25 25
 	 * The 'alnp_arbitrary' for Auto Load Next Post Arbitrary control class.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 		 * @return void
33 33
 		 */
34 34
 		public function render_content() {
35
-			switch ( $this->type ) {
35
+			switch ($this->type) {
36 36
 				default:
37 37
 				case 'text':
38
-					echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
38
+					echo '<p class="description">'.wp_kses_post($this->description).'</p>';
39 39
 					break;
40 40
 
41 41
 				case 'heading':
42
-					echo '<span class="customize-control-title">' . $this->label . '</span>';
42
+					echo '<span class="customize-control-title">'.$this->label.'</span>';
43 43
 					break;
44 44
 
45 45
 				case 'divider':
Please login to merge, or discard this patch.
includes/admin/views/html-notice-upgrade-warning.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 ?>
17 17
 <div class="notice notice-error is-dismissible">
18
-	<p><?php echo sprintf( __( 'Warning! Version 1.5.0 of %1$s is coming soon and is a major update. Before updating, please test on a staging site. %2$sLearn more about the changes in version 1.5.0 &raquo;%3$s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://autoloadnextpost.com/2018/05/28/whats-coming-in-v1-5-0-of-auto-load-next-post/" target="_blank">', '</a>' ); ?></p>
18
+	<p><?php echo sprintf(__('Warning! Version 1.5.0 of %1$s is coming soon and is a major update. Before updating, please test on a staging site. %2$sLearn more about the changes in version 1.5.0 &raquo;%3$s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://autoloadnextpost.com/2018/05/28/whats-coming-in-v1-5-0-of-auto-load-next-post/" target="_blank">', '</a>'); ?></p>
19 19
 </div>
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-storefront.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,14 +40,14 @@  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
 			'load_js_in_footer'    => 'no',
49 49
 			'lock_js_in_footer'    => 'no',
50
-		) );
50
+		));
51 51
 	} // END add_theme_support()
52 52
 
53 53
 } // END class
Please login to merge, or discard this patch.
includes/theme-support/class-alnp-make.php 1 patch
Spacing   +6 added lines, -6 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
 		// Filters the repeater template location.
32
-		add_filter( 'alnp_template_redirect', array( __CLASS__, 'alnp_make_template_redirect' ) );
32
+		add_filter('alnp_template_redirect', array(__CLASS__, 'alnp_make_template_redirect'));
33 33
 
34 34
 		// Add theme support and preset the theme selectors.
35
-		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
35
+		add_action('after_setup_theme', array(__CLASS__, 'add_theme_support'));
36 36
 	} // END init()
37 37
 
38 38
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return string
44 44
 	 */
45 45
 	public static function alnp_make_template_redirect() {
46
-		return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/make/content-alnp.php';
46
+		return AUTO_LOAD_NEXT_POST_FILE_PATH.'/template/theme-support/make/content-alnp.php';
47 47
 	} // END alnp_make_template_redirect()
48 48
 
49 49
 	/**
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	 * @static
55 55
 	 */
56 56
 	public static function add_theme_support() {
57
-		add_theme_support( 'auto-load-next-post', array(
57
+		add_theme_support('auto-load-next-post', array(
58 58
 			'content_container'    => 'main.site-main',
59 59
 			'title_selector'       => 'h1.entry-title',
60 60
 			'navigation_container' => 'nav.post-navigation',
61 61
 			'comments_container'   => 'div#comments',
62 62
 			'load_js_in_footer'    => 'no',
63 63
 			'lock_js_in_footer'    => 'no',
64
-		) );
64
+		));
65 65
 	} // END add_theme_support()
66 66
 
67 67
 } // 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,14 +53,14 @@  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
 			'load_js_in_footer'    => 'no',
62 62
 			'lock_js_in_footer'    => 'no',
63
-		) );
63
+		));
64 64
 	} // END add_theme_support()
65 65
 
66 66
 } // END class
Please login to merge, or discard this patch.
includes/class-alnp-install.php 2 patches
Spacing   +41 added lines, -41 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' );
43
+			self::$current_version = get_option('auto_load_next_post_version');
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.
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 			// Refresh rewrite rules.
102 102
 			self::flush_rewrite_rules();
103 103
 
104
-			delete_transient( 'alnp_installing' );
104
+			delete_transient('alnp_installing');
105 105
 
106
-			do_action( 'alnp_installed' );
106
+			do_action('alnp_installed');
107 107
 		} // END install()
108 108
 
109 109
 		/**
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 		 * @since  1.5.0
116 116
 		 */
117 117
 		private static function set_theme_selectors() {
118
-			if ( is_alnp_supported() ) {
119
-				$content_container    = alnp_get_theme_support( 'content_container' );
120
-				$title_selector       = alnp_get_theme_support( 'title_selector' );
121
-				$navigation_container = alnp_get_theme_support( 'navigation_container' );
122
-				$comments_container   = alnp_get_theme_support( 'comments_container' );
123
-
124
-				if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container );
125
-				if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector );
126
-				if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container );
127
-				if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container );
118
+			if (is_alnp_supported()) {
119
+				$content_container    = alnp_get_theme_support('content_container');
120
+				$title_selector       = alnp_get_theme_support('title_selector');
121
+				$navigation_container = alnp_get_theme_support('navigation_container');
122
+				$comments_container   = alnp_get_theme_support('comments_container');
123
+
124
+				if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container);
125
+				if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector);
126
+				if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container);
127
+				if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container);
128 128
 			}
129 129
 		} // END set_theme_selectors()
130 130
 
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 		 * @version 1.5.3
140 140
 		 */
141 141
 		private static function set_js_in_footer() {
142
-			if ( is_alnp_supported() ) {
143
-				$load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' );
144
-				$lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' );
142
+			if (is_alnp_supported()) {
143
+				$load_js_in_footer = alnp_get_theme_support('load_js_in_footer');
144
+				$lock_js_in_footer = alnp_get_theme_support('lock_js_in_footer');
145 145
 
146
-				if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer );
147
-				if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer );
146
+				if ( ! empty($load_js_in_footer) && $load_js_in_footer == 'yes') update_option('auto_load_next_post_load_js_in_footer', $load_js_in_footer);
147
+				if ( ! empty($lock_js_in_footer) && $lock_js_in_footer == 'yes') update_option('auto_load_next_post_lock_js_in_footer', $lock_js_in_footer);
148 148
 			}
149 149
 		} // END set_js_in_footer()
150 150
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		 * @static
156 156
 		 */
157 157
 		private static function update_version() {
158
-			update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION );
158
+			update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION);
159 159
 		} // END update_version()
160 160
 
161 161
 		/**
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		 * @version 1.5.0
168 168
 		 */
169 169
 		public static function set_install_date() {
170
-			$install_date = get_site_option( 'auto_load_next_post_install_date' );
170
+			$install_date = get_site_option('auto_load_next_post_install_date');
171 171
 
172 172
 			// If ALNP was installed before but the install date was not converted to time then convert it.
173
-			if ( ! empty( $install_date ) && !intval( $install_date ) ) {
174
-				update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) );
173
+			if ( ! empty($install_date) && ! intval($install_date)) {
174
+				update_site_option('auto_load_next_post_install_date', strtotime($install_date));
175 175
 			} else {
176
-				add_site_option( 'auto_load_next_post_install_date', time() );
176
+				add_site_option('auto_load_next_post_install_date', time());
177 177
 			}
178 178
 		} // END set_install_date()
179 179
 
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 		 */
190 190
 		public static function create_options() {
191 191
 			// Include settings so that we can run through defaults
192
-			include_once( dirname( __FILE__ ) . '/admin/class-alnp-admin-settings.php' );
192
+			include_once(dirname(__FILE__).'/admin/class-alnp-admin-settings.php');
193 193
 
194 194
 			$settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages();
195 195
 
196
-			foreach ( $settings as $section ) {
197
-				foreach ( $section->get_settings() as $value ) {
198
-					if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
199
-						$autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
200
-						add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
196
+			foreach ($settings as $section) {
197
+				foreach ($section->get_settings() as $value) {
198
+					if (isset($value['default']) && isset($value['id'])) {
199
+						$autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
200
+						add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no'));
201 201
 					}
202 202
 				}
203 203
 			}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		 * @version 1.5.0
213 213
 		 */
214 214
 		public static function add_rewrite_endpoint() {
215
-			add_rewrite_endpoint( 'alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
215
+			add_rewrite_endpoint('alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT);
216 216
 		} // END add_rewrite_endpoint()
217 217
 
218 218
 		/**
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,10 +121,18 @@  discard block
 block discarded – undo
121 121
 				$navigation_container = alnp_get_theme_support( 'navigation_container' );
122 122
 				$comments_container   = alnp_get_theme_support( 'comments_container' );
123 123
 
124
-				if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container );
125
-				if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector );
126
-				if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container );
127
-				if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container );
124
+				if ( ! empty( $content_container ) ) {
125
+					update_option( 'auto_load_next_post_content_container', $content_container );
126
+				}
127
+				if ( ! empty( $title_selector ) ) {
128
+					update_option( 'auto_load_next_post_title_selector', $title_selector );
129
+				}
130
+				if ( ! empty( $navigation_container ) ) {
131
+					update_option( 'auto_load_next_post_navigation_container', $navigation_container );
132
+				}
133
+				if ( ! empty( $comments_container ) ) {
134
+					update_option( 'auto_load_next_post_comments_container', $comments_container );
135
+				}
128 136
 			}
129 137
 		} // END set_theme_selectors()
130 138
 
@@ -143,8 +151,12 @@  discard block
 block discarded – undo
143 151
 				$load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' );
144 152
 				$lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' );
145 153
 
146
-				if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer );
147
-				if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer );
154
+				if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) {
155
+					update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer );
156
+				}
157
+				if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) {
158
+					update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer );
159
+				}
148 160
 			}
149 161
 		} // END set_js_in_footer()
150 162
 
Please login to merge, or discard this patch.
includes/auto-load-next-post-formatting-functions.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  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
 
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
  * @param   string|array $var Data to sanitize.
25 25
  * @return  string|array *
26 26
  */
27
-if ( ! function_exists( 'auto_load_next_post_clean' ) ) {
28
-	function auto_load_next_post_clean( $var ) {
29
-		if ( is_array( $var ) ) {
30
-			return array_map( 'auto_load_next_post_clean', $var );
27
+if ( ! function_exists('auto_load_next_post_clean')) {
28
+	function auto_load_next_post_clean($var) {
29
+		if (is_array($var)) {
30
+			return array_map('auto_load_next_post_clean', $var);
31 31
 		} else {
32
-			return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
32
+			return is_scalar($var) ? sanitize_text_field($var) : $var;
33 33
 		}
34 34
 	} // END auto_load_next_post_clean()
35 35
 }
@@ -44,60 +44,60 @@  discard block
 block discarded – undo
44 44
  * @param   string $seconds Seconds in time.
45 45
  * @return  string
46 46
  */
47
-if ( ! function_exists( 'auto_load_next_post_seconds_to_words' ) ) {
48
-	function auto_load_next_post_seconds_to_words( $seconds ) {
47
+if ( ! function_exists('auto_load_next_post_seconds_to_words')) {
48
+	function auto_load_next_post_seconds_to_words($seconds) {
49 49
 		// Get the years.
50
-		$years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
51
-		if ( $years > 1 ) {
50
+		$years = (intval($seconds) / YEAR_IN_SECONDS) % 100;
51
+		if ($years > 1) {
52 52
 			/* translators: Number of years */
53
-			return sprintf( __( '%s years', 'auto-load-next-post' ), $years );
54
-		} elseif ( $years > 0 ) {
55
-			return __( 'a year', 'auto-load-next-post' );
53
+			return sprintf(__('%s years', 'auto-load-next-post'), $years);
54
+		} elseif ($years > 0) {
55
+			return __('a year', 'auto-load-next-post');
56 56
 		}
57 57
 
58 58
 		// Get the weeks.
59
-		$weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
60
-		if ( $weeks > 1 ) {
59
+		$weeks = (intval($seconds) / WEEK_IN_SECONDS) % 52;
60
+		if ($weeks > 1) {
61 61
 			/* translators: Number of weeks */
62
-			return sprintf( __( '%s weeks', 'auto-load-next-post' ), $weeks );
63
-		} elseif ( $weeks > 0 ) {
64
-			return __( 'a week', 'auto-load-next-post' );
62
+			return sprintf(__('%s weeks', 'auto-load-next-post'), $weeks);
63
+		} elseif ($weeks > 0) {
64
+			return __('a week', 'auto-load-next-post');
65 65
 		}
66 66
 
67 67
 		// Get the days.
68
-		$days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
69
-		if ( $days > 1 ) {
68
+		$days = (intval($seconds) / DAY_IN_SECONDS) % 7;
69
+		if ($days > 1) {
70 70
 			/* translators: Number of days */
71
-			return sprintf( __( '%s days', 'auto-load-next-post' ), $days );
72
-		} elseif ( $days > 0 ) {
73
-			return __( 'a day', 'auto-load-next-post' );
71
+			return sprintf(__('%s days', 'auto-load-next-post'), $days);
72
+		} elseif ($days > 0) {
73
+			return __('a day', 'auto-load-next-post');
74 74
 		}
75 75
 
76 76
 		// Get the hours.
77
-		$hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24;
78
-		if ( $hours > 1 ) {
77
+		$hours = (intval($seconds) / HOUR_IN_SECONDS) % 24;
78
+		if ($hours > 1) {
79 79
 			/* translators: Number of hours */
80
-			return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours );
81
-		} elseif ( $hours > 0 ) {
82
-			return __( 'an hour', 'auto-load-next-post' );
80
+			return sprintf(__('%s hours', 'auto-load-next-post'), $hours);
81
+		} elseif ($hours > 0) {
82
+			return __('an hour', 'auto-load-next-post');
83 83
 		}
84 84
 
85 85
 		// Get the minutes.
86
-		$minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60;
87
-		if ( $minutes > 1 ) {
86
+		$minutes = (intval($seconds) / MINUTE_IN_SECONDS) % 60;
87
+		if ($minutes > 1) {
88 88
 			/* translators: Number of minutes */
89
-			return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes );
90
-		} elseif ( $minutes > 0 ) {
91
-			return __( 'a minute', 'auto-load-next-post' );
89
+			return sprintf(__('%s minutes', 'auto-load-next-post'), $minutes);
90
+		} elseif ($minutes > 0) {
91
+			return __('a minute', 'auto-load-next-post');
92 92
 		}
93 93
 
94 94
 		// Get the seconds.
95
-		$seconds = intval( $seconds ) % 60;
96
-		if ( $seconds > 1 ) {
95
+		$seconds = intval($seconds) % 60;
96
+		if ($seconds > 1) {
97 97
 			/* translators: Number of seconds */
98
-			return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds );
99
-		} elseif ( $seconds > 0 ) {
100
-			return __( 'a second', 'auto-load-next-post' );
98
+			return sprintf(__('%s seconds', 'auto-load-next-post'), $seconds);
99
+		} elseif ($seconds > 0) {
100
+			return __('a second', 'auto-load-next-post');
101 101
 		}
102 102
 	} // END auto_load_next_post_seconds_to_words()
103 103
 }
Please login to merge, or discard this patch.