@@ -11,10 +11,10 @@ |
||
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, %1$s%3$s%2$s requires WordPress %4$s or higher. Please upgrade your WordPress setup.', 'auto-load-next-post' ), '<strong>', '</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE ); ?></p> |
|
19 | + <p><?php echo sprintf(__('Sorry, %1$s%3$s%2$s requires WordPress %4$s or higher. Please upgrade your WordPress setup.', 'auto-load-next-post'), '<strong>', '</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE); ?></p> |
|
20 | 20 | </div> |
@@ -11,10 +11,10 @@ |
||
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 jetpack-info"> |
19 | - <p><?php echo sprintf( esc_attr__( 'Lazy-loading for the Images module is enabled in %1$sJetPack%2$s. To trigger the lazy loading event apply %3$s to %4$s%5$s%6$s.', 'auto-load-next-post' ), '<a href="' . admin_url( 'admin.php?page=jetpack#/performance' ) . '">', '</a>', '<code>jetpack-lazy-images-load</code>', '<strong>', __( 'Entering a Post', 'auto-load-next-post'), '</strong>' ); ?></p> |
|
19 | + <p><?php echo sprintf(esc_attr__('Lazy-loading for the Images module is enabled in %1$sJetPack%2$s. To trigger the lazy loading event apply %3$s to %4$s%5$s%6$s.', 'auto-load-next-post'), '<a href="'.admin_url('admin.php?page=jetpack#/performance').'">', '</a>', '<code>jetpack-lazy-images-load</code>', '<strong>', __('Entering a Post', 'auto-load-next-post'), '</strong>'); ?></p> |
|
20 | 20 | </div> |
@@ -11,12 +11,12 @@ |
||
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 | $active_theme = wp_get_theme(); |
19 | 19 | ?> |
20 | 20 | <div class="notice notice-info"> |
21 | - <p><?php echo sprintf( __( 'Your active theme %s, is supported via a plugin. Changes to set theme selectors are disabled.', 'auto-load-next-post' ), $active_theme->name ); ?></p> |
|
21 | + <p><?php echo sprintf(__('Your active theme %s, is supported via a plugin. Changes to set theme selectors are disabled.', 'auto-load-next-post'), $active_theme->name); ?></p> |
|
22 | 22 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | <div class="notice notice-info auto-load-next-post-notice"> |
20 | 20 | <div class="auto-load-next-post-notice-inner"> |
21 | 21 | <div class="auto-load-next-post-notice-icon"> |
22 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
22 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
23 | 23 | </div> |
24 | 24 | |
25 | 25 | <div class="auto-load-next-post-notice-content"> |
26 | - <h3><?php printf( esc_html__( 'Hi %s.', 'auto-load-next-post' ), $current_user->display_name ); ?></h3> |
|
27 | - <p><?php printf( esc_html__( 'Try the Setup Wizard to help identify your theme selectors and template location. Once done %s will be ready!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
26 | + <h3><?php printf(esc_html__('Hi %s.', 'auto-load-next-post'), $current_user->display_name); ?></h3> |
|
27 | + <p><?php printf(esc_html__('Try the Setup Wizard to help identify your theme selectors and template location. Once done %s will be ready!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <div class="auto-load-next-post-setup-wizard"> |
31 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-setup-button">%2$s</a>', add_query_arg( array( 'page' => 'auto-load-next-post', 'view' => 'setup-wizard' ), admin_url( 'options-general.php' ) ), esc_html__( 'Run the Setup Wizard', 'auto-load-next-post' ) ); ?> |
|
32 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_setup_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'No need / I already have', 'auto-load-next-post' ); ?></a> |
|
31 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-setup-button">%2$s</a>', add_query_arg(array('page' => 'auto-load-next-post', 'view' => 'setup-wizard'), admin_url('options-general.php')), esc_html__('Run the Setup Wizard', 'auto-load-next-post')); ?> |
|
32 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_setup_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('No need / I already have', 'auto-load-next-post'); ?></a> |
|
33 | 33 | </div> |
34 | 34 | </div> |
35 | 35 | </div> |
@@ -10,21 +10,21 @@ |
||
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 | <nav class="nav-tab-wrapper"> |
18 | 18 | <?php |
19 | - foreach ( $tabs as $slug => $label ) { |
|
20 | - $url = add_query_arg( array( |
|
19 | + foreach ($tabs as $slug => $label) { |
|
20 | + $url = add_query_arg(array( |
|
21 | 21 | 'page' => 'auto-load-next-post', |
22 | - 'view' => esc_attr( $slug ), |
|
23 | - ), admin_url( 'options-general.php' ) ); |
|
22 | + 'view' => esc_attr($slug), |
|
23 | + ), admin_url('options-general.php')); |
|
24 | 24 | |
25 | - echo '<a href="' . apply_filters( 'alnp_settings_tab_url', esc_html( $url ), $slug ) . '" class="nav-tab ' . ( $current_view === $slug ? 'nav-tab-active' : '' ) . '" data-tab="' . $slug . '">' . esc_html( $label ) . '</a>'; |
|
25 | + echo '<a href="'.apply_filters('alnp_settings_tab_url', esc_html($url), $slug).'" class="nav-tab '.($current_view === $slug ? 'nav-tab-active' : '').'" data-tab="'.$slug.'">'.esc_html($label).'</a>'; |
|
26 | 26 | } |
27 | 27 | |
28 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
28 | + do_action('auto_load_next_post_settings_tabs'); |
|
29 | 29 | ?> |
30 | 30 | </nav> |
@@ -11,7 +11,7 @@ discard block |
||
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 | |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | <div class="notice notice-success auto-load-next-post-notice is-dismissible"> |
21 | 21 | <div class="auto-load-next-post-notice-inner"> |
22 | 22 | <div class="auto-load-next-post-notice-icon"> |
23 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
23 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="auto-load-next-post-notice-content"> |
27 | - <h3><?php echo sprintf( esc_html__( 'Thank you for installing %1$s!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></h3> |
|
28 | - <p><?php echo sprintf( __( 'We detected your theme %1$s%3$s%2$s already supports %4$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post' ), '<strong>', '</strong>', $active_theme->name, esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
27 | + <h3><?php echo sprintf(esc_html__('Thank you for installing %1$s!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></h3> |
|
28 | + <p><?php echo sprintf(__('We detected your theme %1$s%3$s%2$s already supports %4$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post'), '<strong>', '</strong>', $active_theme->name, esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 | </div> |
@@ -11,11 +11,11 @@ discard block |
||
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( 'ALNP_Admin_Settings' ) ) { |
|
18 | +if ( ! class_exists('ALNP_Admin_Settings')) { |
|
19 | 19 | |
20 | 20 | class ALNP_Admin_Settings { |
21 | 21 | |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | * @return $settings |
57 | 57 | */ |
58 | 58 | public static function get_settings_pages() { |
59 | - if ( empty( self::$settings ) ) { |
|
59 | + if (empty(self::$settings)) { |
|
60 | 60 | $settings = array(); |
61 | 61 | |
62 | - include_once( dirname( __FILE__ ) . '/settings/class-alnp-settings-page.php' ); |
|
62 | + include_once(dirname(__FILE__).'/settings/class-alnp-settings-page.php'); |
|
63 | 63 | |
64 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-theme-selectors.php' ); |
|
65 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-templates.php' ); |
|
66 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-events.php' ); |
|
67 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-misc.php' ); |
|
64 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-theme-selectors.php'); |
|
65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-templates.php'); |
|
66 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-events.php'); |
|
67 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-misc.php'); |
|
68 | 68 | |
69 | - self::$settings = apply_filters( 'alnp_get_settings_pages', $settings ); |
|
69 | + self::$settings = apply_filters('alnp_get_settings_pages', $settings); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return self::$settings; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | public static function save() { |
85 | 85 | global $current_view; |
86 | 86 | |
87 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
87 | + check_admin_referer('auto-load-next-post-settings'); |
|
88 | 88 | |
89 | 89 | // Trigger actions |
90 | - do_action( 'auto_load_next_post_settings_save_' . $current_view ); |
|
91 | - do_action( 'auto_load_next_post_update_options_' . $current_view ); |
|
92 | - do_action( 'auto_load_next_post_update_options' ); |
|
90 | + do_action('auto_load_next_post_settings_save_'.$current_view); |
|
91 | + do_action('auto_load_next_post_update_options_'.$current_view); |
|
92 | + do_action('auto_load_next_post_update_options'); |
|
93 | 93 | |
94 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
94 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
95 | 95 | |
96 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
96 | + do_action('auto_load_next_post_settings_saved'); |
|
97 | 97 | } // END save() |
98 | 98 | |
99 | 99 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @since 1.0.0 |
105 | 105 | * @param string $text Message |
106 | 106 | */ |
107 | - public static function add_message( $text ) { |
|
107 | + public static function add_message($text) { |
|
108 | 108 | self::$messages[] = $text; |
109 | 109 | } // END add_message() |
110 | 110 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @since 1.0.0 |
117 | 117 | * @param string $text Error |
118 | 118 | */ |
119 | - public static function add_error( $text ) { |
|
119 | + public static function add_error($text) { |
|
120 | 120 | self::$errors[] = $text; |
121 | 121 | } // END add_error() |
122 | 122 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | * @return string |
131 | 131 | */ |
132 | 132 | public static function show_messages() { |
133 | - if ( count( self::$errors ) > 0 ) { |
|
134 | - foreach ( self::$errors as $error ) { |
|
135 | - echo '<div class="notice notice-error"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
133 | + if (count(self::$errors) > 0) { |
|
134 | + foreach (self::$errors as $error) { |
|
135 | + echo '<div class="notice notice-error"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
136 | 136 | } |
137 | - } elseif ( count( self::$messages ) > 0 ) { |
|
138 | - foreach ( self::$messages as $message ) { |
|
139 | - echo '<div class="notice notice-success"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
137 | + } elseif (count(self::$messages) > 0) { |
|
138 | + foreach (self::$messages as $message) { |
|
139 | + echo '<div class="notice notice-success"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } // END show_messages() |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | public static function output() { |
157 | 157 | global $current_view; |
158 | 158 | |
159 | - do_action( 'auto_load_next_post_settings_start' ); |
|
159 | + do_action('auto_load_next_post_settings_start'); |
|
160 | 160 | |
161 | 161 | // Get tabs for the settings page. |
162 | - $tabs = apply_filters( 'alnp_settings_tabs_array', array() ); |
|
162 | + $tabs = apply_filters('alnp_settings_tabs_array', array()); |
|
163 | 163 | |
164 | 164 | // These tabs do not require a settings output. |
165 | - $no_settings_req = array( 'getting-started', 'setup-wizard', 'extensions', 'videos' ); |
|
165 | + $no_settings_req = array('getting-started', 'setup-wizard', 'extensions', 'videos'); |
|
166 | 166 | |
167 | 167 | // Only include settings output if the current tab requires it. |
168 | - if ( ! in_array( $current_view, $no_settings_req ) ) { |
|
169 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
168 | + if ( ! in_array($current_view, $no_settings_req)) { |
|
169 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
170 | 170 | } |
171 | 171 | |
172 | - do_action( 'auto_load_next_post_settings_end', $current_view, $tabs ); |
|
172 | + do_action('auto_load_next_post_settings_end', $current_view, $tabs); |
|
173 | 173 | } // END output() |
174 | 174 | |
175 | 175 | /** |
@@ -181,33 +181,33 @@ discard block |
||
181 | 181 | * @param mixed $option_name |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public static function get_option( $option_name, $default = '' ) { |
|
184 | + public static function get_option($option_name, $default = '') { |
|
185 | 185 | // Array value |
186 | - if ( strstr( $option_name, '[' ) ) { |
|
187 | - parse_str( $option_name, $option_array ); |
|
186 | + if (strstr($option_name, '[')) { |
|
187 | + parse_str($option_name, $option_array); |
|
188 | 188 | |
189 | 189 | // Option name is first key |
190 | - $option_name = current( array_keys( $option_array ) ); |
|
190 | + $option_name = current(array_keys($option_array)); |
|
191 | 191 | |
192 | 192 | // Get value |
193 | - $option_values = get_option( $option_name, '' ); |
|
193 | + $option_values = get_option($option_name, ''); |
|
194 | 194 | |
195 | - $key = key( $option_array[$option_name] ); |
|
195 | + $key = key($option_array[$option_name]); |
|
196 | 196 | |
197 | - if ( isset( $option_values[$key] ) ) { |
|
197 | + if (isset($option_values[$key])) { |
|
198 | 198 | $option_value = $option_values[$key]; |
199 | 199 | } else { |
200 | 200 | $option_value = null; |
201 | 201 | } |
202 | 202 | } else { |
203 | 203 | // Single value |
204 | - $option_value = get_option( $option_name, null ); |
|
204 | + $option_value = get_option($option_name, null); |
|
205 | 205 | } |
206 | 206 | |
207 | - if ( is_array( $option_value ) ) { |
|
208 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
209 | - } elseif ( ! is_null( $option_value ) ) { |
|
210 | - $option_value = stripslashes( $option_value ); |
|
207 | + if (is_array($option_value)) { |
|
208 | + $option_value = array_map('stripslashes', $option_value); |
|
209 | + } elseif ( ! is_null($option_value)) { |
|
210 | + $option_value = stripslashes($option_value); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $option_value === null ? $default : $option_value; |
@@ -224,88 +224,88 @@ discard block |
||
224 | 224 | * @version 1.6.0 |
225 | 225 | * @param array $options Opens array to output |
226 | 226 | */ |
227 | - public static function output_fields( $options ) { |
|
228 | - foreach ( $options as $key => $value ) { |
|
227 | + public static function output_fields($options) { |
|
228 | + foreach ($options as $key => $value) { |
|
229 | 229 | |
230 | - if ( ! isset( $value['type'] ) ) { |
|
230 | + if ( ! isset($value['type'])) { |
|
231 | 231 | continue; |
232 | 232 | } |
233 | - if ( ! isset( $value['id'] ) ) { |
|
233 | + if ( ! isset($value['id'])) { |
|
234 | 234 | $value['id'] = ''; |
235 | 235 | } |
236 | - if ( ! isset( $value['title'] ) ) { |
|
237 | - $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
236 | + if ( ! isset($value['title'])) { |
|
237 | + $value['title'] = isset($value['name']) ? $value['name'] : ''; |
|
238 | 238 | } |
239 | - if ( ! isset( $value['class'] ) ) { |
|
239 | + if ( ! isset($value['class'])) { |
|
240 | 240 | $value['class'] = ''; |
241 | 241 | } |
242 | - if ( ! isset( $value['css'] ) ) { |
|
242 | + if ( ! isset($value['css'])) { |
|
243 | 243 | $value['css'] = ''; |
244 | 244 | } |
245 | - if ( ! isset( $value['default'] ) ) { |
|
245 | + if ( ! isset($value['default'])) { |
|
246 | 246 | $value['default'] = ''; |
247 | 247 | } |
248 | - if ( ! isset( $value['desc'] ) ) { |
|
248 | + if ( ! isset($value['desc'])) { |
|
249 | 249 | $value['desc'] = ''; |
250 | 250 | } |
251 | - if ( ! isset( $value['placeholder'] ) ) { |
|
251 | + if ( ! isset($value['placeholder'])) { |
|
252 | 252 | $value['placeholder'] = ''; |
253 | 253 | } |
254 | 254 | |
255 | - $value['readonly'] = isset( $value['readonly'] ) && $value['readonly'] == 'yes' ? 'readonly' : ''; |
|
255 | + $value['readonly'] = isset($value['readonly']) && $value['readonly'] == 'yes' ? 'readonly' : ''; |
|
256 | 256 | |
257 | 257 | // Custom attribute handling |
258 | 258 | $custom_attributes = array(); |
259 | 259 | |
260 | - if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { |
|
261 | - foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { |
|
262 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
260 | + if ( ! empty($value['custom_attributes']) && is_array($value['custom_attributes'])) { |
|
261 | + foreach ($value['custom_attributes'] as $attribute => $attribute_value) { |
|
262 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | 266 | // Description handling |
267 | 267 | $description = ''; |
268 | 268 | |
269 | - if ( ! empty( $value['desc'] ) ) { |
|
269 | + if ( ! empty($value['desc'])) { |
|
270 | 270 | $description = $value['desc']; |
271 | 271 | } |
272 | 272 | |
273 | - if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ), true ) ) { |
|
274 | - $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>'; |
|
275 | - } elseif ( $description && in_array( $value['type'], array( 'checkbox' ), true ) ) { |
|
276 | - $description = wp_kses_post( $description ); |
|
277 | - } elseif ( $description ) { |
|
278 | - $description = '<p class="description">' . wp_kses_post( $description ) . '</p>'; |
|
273 | + if ($description && in_array($value['type'], array('textarea', 'radio'), true)) { |
|
274 | + $description = '<p style="margin-top:0">'.wp_kses_post($description).'</p>'; |
|
275 | + } elseif ($description && in_array($value['type'], array('checkbox'), true)) { |
|
276 | + $description = wp_kses_post($description); |
|
277 | + } elseif ($description) { |
|
278 | + $description = '<p class="description">'.wp_kses_post($description).'</p>'; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Switch based on type |
282 | - switch( $value['type'] ) { |
|
282 | + switch ($value['type']) { |
|
283 | 283 | |
284 | 284 | // Section Titles |
285 | 285 | case 'title': |
286 | - if ( ! empty( $value['title'] ) ) { |
|
287 | - echo '<h2>' . esc_html( $value['title'] ) . '</h2>'; |
|
286 | + if ( ! empty($value['title'])) { |
|
287 | + echo '<h2>'.esc_html($value['title']).'</h2>'; |
|
288 | 288 | } |
289 | - if ( ! empty( $value['desc'] ) ) { |
|
290 | - echo '<div id="' . esc_attr( sanitize_title( $value['id'] ) ) . '-description">'; |
|
291 | - echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) ); |
|
289 | + if ( ! empty($value['desc'])) { |
|
290 | + echo '<div id="'.esc_attr(sanitize_title($value['id'])).'-description">'; |
|
291 | + echo wp_kses_post(wpautop(wptexturize($value['desc']))); |
|
292 | 292 | echo '</div>'; |
293 | 293 | } |
294 | 294 | echo '<table class="alnp-table">'."\n\n"; |
295 | - if ( ! empty( $value['id'] ) ) { |
|
296 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) ); |
|
295 | + if ( ! empty($value['id'])) { |
|
296 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id'])); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | break; |
300 | 300 | |
301 | 301 | // Section Ends |
302 | 302 | case 'sectionend': |
303 | - if ( ! empty( $value['id'] ) ) { |
|
304 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
303 | + if ( ! empty($value['id'])) { |
|
304 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_end'); |
|
305 | 305 | } |
306 | 306 | echo '</table>'; |
307 | - if ( ! empty( $value['id'] ) ) { |
|
308 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
307 | + if ( ! empty($value['id'])) { |
|
308 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_after'); |
|
309 | 309 | } |
310 | 310 | break; |
311 | 311 | |
@@ -318,23 +318,23 @@ discard block |
||
318 | 318 | case 'time': |
319 | 319 | case 'week': |
320 | 320 | case 'email': |
321 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
321 | + $option_value = self::get_option($value['id'], $value['default']); |
|
322 | 322 | |
323 | 323 | ?><tr valign="top"> |
324 | 324 | <th scope="row" class="titledesc"> |
325 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
325 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
326 | 326 | </th> |
327 | 327 | <td> |
328 | 328 | <input |
329 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
330 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
331 | - type="<?php echo esc_attr( $value['type'] ); ?>" |
|
332 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
333 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
334 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
335 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
336 | - <?php echo esc_attr( $value['readonly'] ); ?> |
|
337 | - <?php echo implode(' ', $custom_attributes ); ?> |
|
329 | + name="<?php echo esc_attr($value['id']); ?>" |
|
330 | + id="<?php echo esc_attr($value['id']); ?>" |
|
331 | + type="<?php echo esc_attr($value['type']); ?>" |
|
332 | + style="<?php echo esc_attr($value['css']); ?>" |
|
333 | + value="<?php echo esc_attr($option_value); ?>" |
|
334 | + class="<?php echo esc_attr($value['class']); ?>" |
|
335 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
336 | + <?php echo esc_attr($value['readonly']); ?> |
|
337 | + <?php echo implode(' ', $custom_attributes); ?> |
|
338 | 338 | /><?php echo $description; ?> |
339 | 339 | </td> |
340 | 340 | </tr><?php |
@@ -342,23 +342,23 @@ discard block |
||
342 | 342 | |
343 | 343 | // Textarea. |
344 | 344 | case 'textarea': |
345 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
345 | + $option_value = self::get_option($value['id'], $value['default']); |
|
346 | 346 | ?> |
347 | 347 | <tr valign="top"> |
348 | 348 | <th scope="row" class="titledesc"> |
349 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
349 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
350 | 350 | </th> |
351 | 351 | <td> |
352 | 352 | <?php echo $description; ?> |
353 | 353 | |
354 | 354 | <textarea |
355 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
356 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
357 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
358 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
359 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
360 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
361 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
355 | + name="<?php echo esc_attr($value['id']); ?>" |
|
356 | + id="<?php echo esc_attr($value['id']); ?>" |
|
357 | + style="<?php echo esc_attr($value['css']); ?>" |
|
358 | + class="<?php echo esc_attr($value['class']); ?>" |
|
359 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
360 | + <?php echo implode(' ', $custom_attributes); ?> |
|
361 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
362 | 362 | </td> |
363 | 363 | </tr> |
364 | 364 | <?php |
@@ -367,35 +367,35 @@ discard block |
||
367 | 367 | // Select boxes. |
368 | 368 | case 'select': |
369 | 369 | case 'multiselect': |
370 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
370 | + $option_value = self::get_option($value['id'], $value['default']); |
|
371 | 371 | ?> |
372 | 372 | <tr valign="top"> |
373 | 373 | <th scope="row" class="titledesc"> |
374 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
374 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
375 | 375 | </th> |
376 | 376 | <td> |
377 | 377 | <select |
378 | - name="<?php echo esc_attr( $value['id'] ); ?><?php echo ( 'multiselect' === $value['type'] ) ? '[]' : ''; ?>" |
|
379 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
380 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
381 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
382 | - data-placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
383 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
378 | + name="<?php echo esc_attr($value['id']); ?><?php echo ('multiselect' === $value['type']) ? '[]' : ''; ?>" |
|
379 | + id="<?php echo esc_attr($value['id']); ?>" |
|
380 | + style="<?php echo esc_attr($value['css']); ?>" |
|
381 | + class="<?php echo esc_attr($value['class']); ?>" |
|
382 | + data-placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
383 | + <?php echo implode(' ', $custom_attributes); ?> |
|
384 | 384 | <?php echo 'multiselect' === $value['type'] ? 'multiple="multiple"' : ''; ?> |
385 | 385 | > |
386 | 386 | <?php |
387 | - foreach ( $value['options'] as $key => $val ) { |
|
387 | + foreach ($value['options'] as $key => $val) { |
|
388 | 388 | ?> |
389 | - <option value="<?php echo esc_attr( $key ); ?>" |
|
389 | + <option value="<?php echo esc_attr($key); ?>" |
|
390 | 390 | <?php |
391 | - if ( is_array( $option_value ) ) { |
|
392 | - selected( in_array( (string) $key, $option_value, true ), true ); |
|
391 | + if (is_array($option_value)) { |
|
392 | + selected(in_array((string) $key, $option_value, true), true); |
|
393 | 393 | } else { |
394 | - selected( $option_value, (string) $key ); |
|
394 | + selected($option_value, (string) $key); |
|
395 | 395 | } |
396 | 396 | ?> |
397 | 397 | > |
398 | - <?php echo esc_html( $val ); ?></option> |
|
398 | + <?php echo esc_html($val); ?></option> |
|
399 | 399 | <?php |
400 | 400 | } |
401 | 401 | ?> |
@@ -407,29 +407,29 @@ discard block |
||
407 | 407 | |
408 | 408 | // Radio inputs. |
409 | 409 | case 'radio': |
410 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
410 | + $option_value = self::get_option($value['id'], $value['default']); |
|
411 | 411 | ?> |
412 | 412 | <tr valign="top"> |
413 | 413 | <th scope="row" class="titledesc"> |
414 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
414 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
415 | 415 | </th> |
416 | 416 | <td> |
417 | 417 | <fieldset> |
418 | 418 | <?php echo $description; ?> |
419 | 419 | <ul> |
420 | 420 | <?php |
421 | - foreach ( $value['options'] as $key => $val ) { |
|
421 | + foreach ($value['options'] as $key => $val) { |
|
422 | 422 | ?> |
423 | 423 | <li> |
424 | 424 | <label><input |
425 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
426 | - value="<?php echo esc_attr( $key ); ?>" |
|
425 | + name="<?php echo esc_attr($value['id']); ?>" |
|
426 | + value="<?php echo esc_attr($key); ?>" |
|
427 | 427 | type="radio" |
428 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
429 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
430 | - <?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?> |
|
431 | - <?php checked( $key, $option_value ); ?> |
|
432 | - /> <?php echo esc_html( $val ); ?></label> |
|
428 | + style="<?php echo esc_attr($value['css']); ?>" |
|
429 | + class="<?php echo esc_attr($value['class']); ?>" |
|
430 | + <?php echo implode(' ', $custom_attributes); // WPCS: XSS ok. ?> |
|
431 | + <?php checked($key, $option_value); ?> |
|
432 | + /> <?php echo esc_html($val); ?></label> |
|
433 | 433 | </li> |
434 | 434 | <?php |
435 | 435 | } |
@@ -443,58 +443,58 @@ discard block |
||
443 | 443 | |
444 | 444 | // Checkbox input. |
445 | 445 | case 'checkbox': |
446 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
446 | + $option_value = self::get_option($value['id'], $value['default']); |
|
447 | 447 | $visibility_class = array(); |
448 | 448 | |
449 | - if ( ! isset( $value['hide_if_checked'] ) ) { |
|
449 | + if ( ! isset($value['hide_if_checked'])) { |
|
450 | 450 | $value['hide_if_checked'] = false; |
451 | 451 | } |
452 | - if ( ! isset( $value['show_if_checked'] ) ) { |
|
452 | + if ( ! isset($value['show_if_checked'])) { |
|
453 | 453 | $value['show_if_checked'] = false; |
454 | 454 | } |
455 | - if ( 'yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked'] ) { |
|
455 | + if ('yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked']) { |
|
456 | 456 | $visibility_class[] = 'hidden_option'; |
457 | 457 | } |
458 | - if ( 'option' === $value['hide_if_checked'] ) { |
|
458 | + if ('option' === $value['hide_if_checked']) { |
|
459 | 459 | $visibility_class[] = 'hide_options_if_checked'; |
460 | 460 | } |
461 | - if ( 'option' === $value['show_if_checked'] ) { |
|
461 | + if ('option' === $value['show_if_checked']) { |
|
462 | 462 | $visibility_class[] = 'show_options_if_checked'; |
463 | 463 | } |
464 | 464 | |
465 | - if ( ! isset( $value['checkboxgroup'] ) || 'start' === $value['checkboxgroup'] ) { |
|
465 | + if ( ! isset($value['checkboxgroup']) || 'start' === $value['checkboxgroup']) { |
|
466 | 466 | ?> |
467 | - <tr valign="top" class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
468 | - <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?></th> |
|
467 | + <tr valign="top" class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
468 | + <th scope="row" class="titledesc"><?php echo esc_html($value['title']); ?></th> |
|
469 | 469 | <td> |
470 | 470 | <fieldset> |
471 | 471 | <?php |
472 | 472 | } else { |
473 | 473 | ?> |
474 | - <fieldset class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
474 | + <fieldset class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
475 | 475 | <?php |
476 | 476 | } |
477 | 477 | |
478 | - if ( ! empty( $value['title'] ) ) { |
|
478 | + if ( ! empty($value['title'])) { |
|
479 | 479 | ?> |
480 | - <legend class="screen-reader-text"><span><?php echo esc_html( $value['title'] ); ?></span></legend> |
|
480 | + <legend class="screen-reader-text"><span><?php echo esc_html($value['title']); ?></span></legend> |
|
481 | 481 | <?php |
482 | 482 | } |
483 | 483 | ?> |
484 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"> |
|
484 | + <label for="<?php echo esc_attr($value['id']); ?>"> |
|
485 | 485 | <input |
486 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
487 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
486 | + name="<?php echo esc_attr($value['id']); ?>" |
|
487 | + id="<?php echo esc_attr($value['id']); ?>" |
|
488 | 488 | type="checkbox" |
489 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
489 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
490 | 490 | value="1" |
491 | - <?php checked( $option_value, 'yes' ); ?> |
|
492 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
491 | + <?php checked($option_value, 'yes'); ?> |
|
492 | + <?php echo implode(' ', $custom_attributes); ?> |
|
493 | 493 | /> <?php echo $description; ?> |
494 | 494 | </label> |
495 | 495 | <?php |
496 | 496 | |
497 | - if ( ! isset( $value['checkboxgroup'] ) || 'end' === $value['checkboxgroup'] ) { |
|
497 | + if ( ! isset($value['checkboxgroup']) || 'end' === $value['checkboxgroup']) { |
|
498 | 498 | ?> |
499 | 499 | </fieldset> |
500 | 500 | </td> |
@@ -508,12 +508,12 @@ discard block |
||
508 | 508 | break; |
509 | 509 | |
510 | 510 | case 'button': |
511 | - if ( isset( $value['url'] ) && ! empty( $value['url'] ) ) { |
|
511 | + if (isset($value['url']) && ! empty($value['url'])) { |
|
512 | 512 | ?> |
513 | 513 | <tr valign="top"> |
514 | - <th scope="row" class="titledesc"><?php echo $value['title'];?></th> |
|
514 | + <th scope="row" class="titledesc"><?php echo $value['title']; ?></th> |
|
515 | 515 | <td> |
516 | - <a href="<?php echo $value['url']; ?>" class="button-secondary <?php echo esc_attr( $value['class'] ); ?>"> |
|
516 | + <a href="<?php echo $value['url']; ?>" class="button-secondary <?php echo esc_attr($value['class']); ?>"> |
|
517 | 517 | <?php echo $value['value']; ?> |
518 | 518 | </a> |
519 | 519 | <?php echo $description; ?> |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | // Default: run an action |
527 | 527 | default: |
528 | - do_action( 'auto_load_next_post_admin_field_' . $value['type'], $value ); |
|
528 | + do_action('auto_load_next_post_admin_field_'.$value['type'], $value); |
|
529 | 529 | |
530 | 530 | break; |
531 | 531 | } // end switch() |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param array $options Opens array to output |
545 | 545 | * @return bool |
546 | 546 | */ |
547 | - public static function save_fields( $options ) { |
|
548 | - if ( empty( $_POST ) ) { |
|
547 | + public static function save_fields($options) { |
|
548 | + if (empty($_POST)) { |
|
549 | 549 | return false; |
550 | 550 | } |
551 | 551 | |
@@ -554,48 +554,48 @@ discard block |
||
554 | 554 | $autoload_options = array(); |
555 | 555 | |
556 | 556 | // Loop options and get values to save |
557 | - foreach ( $options as $option ) { |
|
558 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
557 | + foreach ($options as $option) { |
|
558 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
559 | 559 | continue; |
560 | 560 | } |
561 | 561 | |
562 | 562 | // Get posted value. |
563 | - if ( strstr( $option['id'], '[' ) ) { |
|
564 | - parse_str( $option['id'], $option_name_array ); |
|
565 | - $option_name = current( array_keys( $option_name_array ) ); |
|
566 | - $setting_name = key( $option_name_array[ $option_name ] ); |
|
567 | - $raw_value = isset( $_POST[ $option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $option_name ][ $setting_name ] ) : null; |
|
563 | + if (strstr($option['id'], '[')) { |
|
564 | + parse_str($option['id'], $option_name_array); |
|
565 | + $option_name = current(array_keys($option_name_array)); |
|
566 | + $setting_name = key($option_name_array[$option_name]); |
|
567 | + $raw_value = isset($_POST[$option_name][$setting_name]) ? wp_unslash($_POST[$option_name][$setting_name]) : null; |
|
568 | 568 | } else { |
569 | 569 | $option_name = $option['id']; |
570 | 570 | $setting_name = ''; |
571 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
571 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
572 | 572 | } |
573 | 573 | |
574 | - switch ( $option['type'] ) { |
|
574 | + switch ($option['type']) { |
|
575 | 575 | case "checkbox" : |
576 | 576 | $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no'; |
577 | 577 | break; |
578 | 578 | |
579 | 579 | case "textarea" : |
580 | - $value = wp_kses_post( trim( stripslashes( $_POST[$option['id']] ) ) ); |
|
580 | + $value = wp_kses_post(trim(stripslashes($_POST[$option['id']]))); |
|
581 | 581 | break; |
582 | 582 | |
583 | 583 | case "multiselect" : |
584 | - $value = array_filter( array_map( 'auto_load_next_post_clean', (array) $raw_value ) ); |
|
584 | + $value = array_filter(array_map('auto_load_next_post_clean', (array) $raw_value)); |
|
585 | 585 | break; |
586 | 586 | |
587 | 587 | case 'select' : |
588 | - $allowed_values = empty( $option['options'] ) ? array() : array_map( 'strval', array_keys( $option['options'] ) ); |
|
589 | - if ( empty( $option['default'] ) && empty( $allowed_values ) ) { |
|
588 | + $allowed_values = empty($option['options']) ? array() : array_map('strval', array_keys($option['options'])); |
|
589 | + if (empty($option['default']) && empty($allowed_values)) { |
|
590 | 590 | $value = null; |
591 | 591 | break; |
592 | 592 | } |
593 | - $default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] ); |
|
594 | - $value = in_array( $raw_value, $allowed_values, true ) ? $raw_value : $default; |
|
593 | + $default = (empty($option['default']) ? $allowed_values[0] : $option['default']); |
|
594 | + $value = in_array($raw_value, $allowed_values, true) ? $raw_value : $default; |
|
595 | 595 | break; |
596 | 596 | |
597 | 597 | default : |
598 | - $value = auto_load_next_post_clean( $raw_value ); |
|
598 | + $value = auto_load_next_post_clean($raw_value); |
|
599 | 599 | break; |
600 | 600 | } // END switch() |
601 | 601 | |
@@ -604,59 +604,59 @@ discard block |
||
604 | 604 | * |
605 | 605 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
606 | 606 | */ |
607 | - if ( has_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) ) ) { |
|
608 | - if ( is_ajax() ) { |
|
609 | - error_log( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) . ' is deprecated since version 1.5.0' ); |
|
607 | + if (has_action('auto_load_next_post_update_option_'.sanitize_title($option['type']))) { |
|
608 | + if (is_ajax()) { |
|
609 | + error_log('auto_load_next_post_update_option_'.sanitize_title($option['type']).' is deprecated since version 1.5.0'); |
|
610 | 610 | } else { |
611 | - _deprecated_hook( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), '1.5.0' ); |
|
611 | + _deprecated_hook('auto_load_next_post_update_option_'.sanitize_title($option['type']), '1.5.0'); |
|
612 | 612 | } |
613 | 613 | |
614 | - do_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), $option ); |
|
614 | + do_action('auto_load_next_post_update_option_'.sanitize_title($option['type']), $option); |
|
615 | 615 | continue; |
616 | 616 | } |
617 | 617 | |
618 | - if ( is_null( $value ) ) { |
|
618 | + if (is_null($value)) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | |
622 | 622 | // Check if option is an array and handle that differently to single values. |
623 | - if ( $option_name && $setting_name ) { |
|
624 | - if ( ! isset( $update_options[ $option_name ] ) ) { |
|
625 | - $update_options[ $option_name ] = get_option( $option_name, array() ); |
|
623 | + if ($option_name && $setting_name) { |
|
624 | + if ( ! isset($update_options[$option_name])) { |
|
625 | + $update_options[$option_name] = get_option($option_name, array()); |
|
626 | 626 | } |
627 | - if ( ! is_array( $update_options[ $option_name ] ) ) { |
|
628 | - $update_options[ $option_name ] = array(); |
|
627 | + if ( ! is_array($update_options[$option_name])) { |
|
628 | + $update_options[$option_name] = array(); |
|
629 | 629 | } |
630 | - $update_options[ $option_name ][ $setting_name ] = $value; |
|
630 | + $update_options[$option_name][$setting_name] = $value; |
|
631 | 631 | } else { |
632 | - $update_options[ $option_name ] = $value; |
|
632 | + $update_options[$option_name] = $value; |
|
633 | 633 | } |
634 | 634 | |
635 | - $autoload_options[ $option_name ] = isset( $option['autoload'] ) ? (bool) $option['autoload'] : true; |
|
635 | + $autoload_options[$option_name] = isset($option['autoload']) ? (bool) $option['autoload'] : true; |
|
636 | 636 | |
637 | 637 | /** |
638 | 638 | * Fire an action before saved. |
639 | 639 | * |
640 | 640 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
641 | 641 | */ |
642 | - if ( has_action( 'auto_load_next_post_update_option' ) ) { |
|
643 | - if ( is_ajax() ) { |
|
644 | - error_log( 'auto_load_next_post_update_option is deprecated since version 1.5.0' ); |
|
642 | + if (has_action('auto_load_next_post_update_option')) { |
|
643 | + if (is_ajax()) { |
|
644 | + error_log('auto_load_next_post_update_option is deprecated since version 1.5.0'); |
|
645 | 645 | } else { |
646 | - _deprecated_hook( 'auto_load_next_post_update_option', '1.5.0' ); |
|
646 | + _deprecated_hook('auto_load_next_post_update_option', '1.5.0'); |
|
647 | 647 | } |
648 | 648 | |
649 | - do_action( 'auto_load_next_post_update_option', $option ); |
|
649 | + do_action('auto_load_next_post_update_option', $option); |
|
650 | 650 | } |
651 | 651 | } |
652 | 652 | |
653 | 653 | // Now save the options |
654 | - foreach ( $update_options as $name => $value ) { |
|
655 | - update_option( $name, $value, $autoload_options[ $name ] ? 'yes' : 'no' ); |
|
654 | + foreach ($update_options as $name => $value) { |
|
655 | + update_option($name, $value, $autoload_options[$name] ? 'yes' : 'no'); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | // Save all options as an array. Ready for export. |
659 | - update_option( 'auto_load_next_post_options', $update_options ); |
|
659 | + update_option('auto_load_next_post_options', $update_options); |
|
660 | 660 | |
661 | 661 | return true; |
662 | 662 | } // END save_fields() |
@@ -12,11 +12,11 @@ discard block |
||
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( 'ALNP_Admin_Site_Health' ) ) { |
|
19 | +if ( ! class_exists('ALNP_Admin_Site_Health')) { |
|
20 | 20 | |
21 | 21 | class ALNP_Admin_Site_Health { |
22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @access public |
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | - add_filter( 'debug_information', array( $this, 'add_debug_info' ) ); |
|
29 | + add_filter('debug_information', array($this, 'add_debug_info')); |
|
30 | 30 | } // END __construct() |
31 | 31 | |
32 | 32 | /** |
@@ -36,75 +36,75 @@ discard block |
||
36 | 36 | * @param array $debug_info |
37 | 37 | * @return array $debug_info |
38 | 38 | */ |
39 | - public function add_debug_info( $debug_info ) { |
|
39 | + public function add_debug_info($debug_info) { |
|
40 | 40 | $debug_info['auto-load-next-post'] = array( |
41 | - 'label' => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
41 | + 'label' => esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
42 | 42 | 'fields' => array( |
43 | 43 | // Theme Selectors |
44 | 44 | 'content_container' => array( |
45 | - 'label' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
|
46 | - 'value' => get_option( 'auto_load_next_post_content_container', 'main.site-main' ), |
|
45 | + 'label' => esc_html__('Content Container', 'auto-load-next-post'), |
|
46 | + 'value' => get_option('auto_load_next_post_content_container', 'main.site-main'), |
|
47 | 47 | 'private' => false, |
48 | 48 | ), |
49 | 49 | 'post_title_selector' => array( |
50 | - 'label' => esc_html__( 'Post Title', 'auto-load-next-post' ), |
|
51 | - 'value' => get_option( 'auto_load_next_post_title_selector', 'h1.entry-title' ), |
|
50 | + 'label' => esc_html__('Post Title', 'auto-load-next-post'), |
|
51 | + 'value' => get_option('auto_load_next_post_title_selector', 'h1.entry-title'), |
|
52 | 52 | 'private' => false, |
53 | 53 | ), |
54 | 54 | 'navigation_container' => array( |
55 | - 'label' => esc_html__( 'Post Navigation', 'auto-load-next-post' ), |
|
56 | - 'value' => get_option( 'auto_load_next_post_navigation_container', 'nav.post-navigation' ), |
|
55 | + 'label' => esc_html__('Post Navigation', 'auto-load-next-post'), |
|
56 | + 'value' => get_option('auto_load_next_post_navigation_container', 'nav.post-navigation'), |
|
57 | 57 | 'private' => false, |
58 | 58 | ), |
59 | 59 | 'comments_container' => array( |
60 | - 'label' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
|
61 | - 'value' => get_option( 'auto_load_next_post_comments_container', 'div#comments' ), |
|
60 | + 'label' => esc_html__('Comments Container', 'auto-load-next-post'), |
|
61 | + 'value' => get_option('auto_load_next_post_comments_container', 'div#comments'), |
|
62 | 62 | 'private' => false, |
63 | 63 | ), |
64 | 64 | |
65 | 65 | // Templates |
66 | 66 | 'use_fallback' => array( |
67 | - 'label' => esc_html__( 'Use Fallback?', 'auto-load-next-post' ), |
|
68 | - 'value' => get_option( 'auto_load_next_post_use_fallback', 'no' ), |
|
67 | + 'label' => esc_html__('Use Fallback?', 'auto-load-next-post'), |
|
68 | + 'value' => get_option('auto_load_next_post_use_fallback', 'no'), |
|
69 | 69 | 'private' => false, |
70 | 70 | ), |
71 | 71 | |
72 | 72 | // Misc |
73 | 73 | 'remove_comments' => array( |
74 | - 'label' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
75 | - 'value' => get_option( 'auto_load_next_post_remove_comments', 'yes' ), |
|
74 | + 'label' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
75 | + 'value' => get_option('auto_load_next_post_remove_comments', 'yes'), |
|
76 | 76 | 'private' => false, |
77 | 77 | ), |
78 | 78 | 'google_analytics' => array( |
79 | - 'label' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
80 | - 'value' => get_option( 'auto_load_next_post_google_analytics', 'no' ), |
|
79 | + 'label' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
80 | + 'value' => get_option('auto_load_next_post_google_analytics', 'no'), |
|
81 | 81 | 'private' => false, |
82 | 82 | ), |
83 | 83 | 'load_js_in_footer' => array( |
84 | - 'label' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
85 | - 'value' => get_option( 'auto_load_next_post_load_js_in_footer', 'no' ), |
|
84 | + 'label' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
85 | + 'value' => get_option('auto_load_next_post_load_js_in_footer', 'no'), |
|
86 | 86 | 'private' => false, |
87 | 87 | ), |
88 | 88 | 'disable_on_mobile' => array( |
89 | - 'label' => esc_html__( 'Disable for Mobile?', 'auto-load-next-post' ), |
|
90 | - 'value' => get_option( 'auto_load_next_post_disable_on_mobile', 'no' ), |
|
89 | + 'label' => esc_html__('Disable for Mobile?', 'auto-load-next-post'), |
|
90 | + 'value' => get_option('auto_load_next_post_disable_on_mobile', 'no'), |
|
91 | 91 | 'private' => false, |
92 | 92 | ), |
93 | 93 | 'uninstall' => array( |
94 | - 'label' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
95 | - 'value' => get_option( 'auto_load_next_post_uninstall_data', 'no' ), |
|
94 | + 'label' => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'), |
|
95 | + 'value' => get_option('auto_load_next_post_uninstall_data', 'no'), |
|
96 | 96 | 'private' => false, |
97 | 97 | ), |
98 | 98 | |
99 | 99 | // Events |
100 | 100 | 'on_load_event' => array( |
101 | - 'label' => esc_html__( 'Post loaded', 'auto-load-next-post' ), |
|
102 | - 'value' => get_option( 'auto_load_next_post_on_load_event', '' ), |
|
101 | + 'label' => esc_html__('Post loaded', 'auto-load-next-post'), |
|
102 | + 'value' => get_option('auto_load_next_post_on_load_event', ''), |
|
103 | 103 | 'private' => false, |
104 | 104 | ), |
105 | 105 | 'on_entering_event' => array( |
106 | - 'label' => esc_html__( 'Entering a Post', 'auto-load-next-post' ), |
|
107 | - 'value' => get_option( 'auto_load_next_post_on_entering_event', '' ), |
|
106 | + 'label' => esc_html__('Entering a Post', 'auto-load-next-post'), |
|
107 | + 'value' => get_option('auto_load_next_post_on_entering_event', ''), |
|
108 | 108 | 'private' => false, |
109 | 109 | ), |
110 | 110 | ), |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | * @license GPL-2.0+ |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined('ABSPATH') ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; // Exit if accessed directly. |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'ALNP_Settings_Page' ) ) { |
|
17 | +if ( ! class_exists('ALNP_Settings_Page')) { |
|
18 | 18 | |
19 | 19 | abstract class ALNP_Settings_Page { |
20 | 20 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @version 1.6.0 |
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | - add_filter( 'alnp_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
46 | - add_action( 'auto_load_next_post_sections_' . $this->id, array( $this, 'output_sections' ) ); |
|
47 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'need_help' ), 5 ); |
|
48 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'output' ), 10 ); |
|
49 | - add_action( 'auto_load_next_post_settings_save_' . $this->id, array( $this, 'save' ) ); |
|
45 | + add_filter('alnp_settings_tabs_array', array($this, 'add_settings_page'), 20); |
|
46 | + add_action('auto_load_next_post_sections_'.$this->id, array($this, 'output_sections')); |
|
47 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'need_help'), 5); |
|
48 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'output'), 10); |
|
49 | + add_action('auto_load_next_post_settings_save_'.$this->id, array($this, 'save')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param array $pages |
80 | 80 | * @return array $pages |
81 | 81 | */ |
82 | - public function add_settings_page( $pages ) { |
|
82 | + public function add_settings_page($pages) { |
|
83 | 83 | $pages[$this->id] = $this->label; |
84 | 84 | |
85 | 85 | return $pages; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param array $pages |
94 | 94 | * @return array $pages |
95 | 95 | */ |
96 | - public function add_menu_page( $pages ) { |
|
96 | + public function add_menu_page($pages) { |
|
97 | 97 | $pages[$this->id] = $this->label; |
98 | 98 | |
99 | 99 | return $pages; |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | |
134 | 134 | $sections = $this->get_sections(); |
135 | 135 | |
136 | - if ( empty( $sections ) || 1 === sizeof( $sections ) ) { |
|
136 | + if (empty($sections) || 1 === sizeof($sections)) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | 140 | echo '<ul class="subsubsub">'; |
141 | 141 | |
142 | - $array_keys = array_keys( $sections ); |
|
142 | + $array_keys = array_keys($sections); |
|
143 | 143 | |
144 | - foreach ( $sections as $id => $label ) { |
|
145 | - $url = add_query_arg( array( |
|
144 | + foreach ($sections as $id => $label) { |
|
145 | + $url = add_query_arg(array( |
|
146 | 146 | 'page' => 'auto-load-next-post', |
147 | 147 | 'view' => $this->id, |
148 | - 'section' => sanitize_title( $id ), |
|
149 | - ), admin_url( 'options-general.php' ) ); |
|
148 | + 'section' => sanitize_title($id), |
|
149 | + ), admin_url('options-general.php')); |
|
150 | 150 | |
151 | - echo '<li><a href="' . $url . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
151 | + echo '<li><a href="'.$url.'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | echo '</ul><br class="clear" />'; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | public function output() { |
164 | 164 | $settings = $this->get_settings(); |
165 | 165 | |
166 | - ALNP_Admin_Settings::output_fields( $settings ); |
|
166 | + ALNP_Admin_Settings::output_fields($settings); |
|
167 | 167 | } // END output() |
168 | 168 | |
169 | 169 | /** |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | |
180 | 180 | $settings = $this->get_settings(); |
181 | 181 | |
182 | - ALNP_Admin_Settings::save_fields( $settings ); |
|
182 | + ALNP_Admin_Settings::save_fields($settings); |
|
183 | 183 | |
184 | - if ( $current_section ) { |
|
185 | - do_action( 'auto_load_next_post_update_options_' . $this->id . '_' . $current_section ); |
|
184 | + if ($current_section) { |
|
185 | + do_action('auto_load_next_post_update_options_'.$this->id.'_'.$current_section); |
|
186 | 186 | } |
187 | 187 | } // END save() |
188 | 188 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | global $current_view; |
202 | 202 | |
203 | 203 | // If theme is already supported then don't show help button for theme selectors. |
204 | - if ( is_alnp_supported() && $current_view == 'theme-selectors' ) { |
|
204 | + if (is_alnp_supported() && $current_view == 'theme-selectors') { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | - echo '<a href="#" class="need-help trigger-help" data-tab="' . $current_view . '"><span class="sonar-dot"></span> ' . esc_html__( 'Need Help?', 'auto-load-next-post' ) . '</a>'; |
|
208 | + echo '<a href="#" class="need-help trigger-help" data-tab="'.$current_view.'"><span class="sonar-dot"></span> '.esc_html__('Need Help?', 'auto-load-next-post').'</a>'; |
|
209 | 209 | } // END need_help() |
210 | 210 | |
211 | 211 | } // END class |