@@ -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( 'Auto_Load_Next_Post_Settings_Theme_Selectors_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Theme_Selectors_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Theme_Selectors_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'theme-selectors'; |
31 | - $this->label = esc_html__( 'Theme Selectors', 'auto-load-next-post' ); |
|
31 | + $this->label = esc_html__('Theme Selectors', 'auto-load-next-post'); |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | |
35 | - add_action( 'auto_load_next_post_sections_theme-selectors', array( __CLASS__, 'is_theme_supported' ), 10 ); |
|
36 | - add_action( 'auto_load_next_post_sections_theme-selectors', array( __CLASS__, 'no_theme_selectors_set' ), 10 ); |
|
35 | + add_action('auto_load_next_post_sections_theme-selectors', array(__CLASS__, 'is_theme_supported'), 10); |
|
36 | + add_action('auto_load_next_post_sections_theme-selectors', array(__CLASS__, 'no_theme_selectors_set'), 10); |
|
37 | 37 | } // END __construct() |
38 | 38 | |
39 | 39 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * @since 1.5.10 |
45 | 45 | */ |
46 | 46 | public static function is_theme_supported() { |
47 | - if ( is_alnp_supported() ) { |
|
48 | - $plugin_supported = alnp_get_theme_support( 'plugin_support' ); |
|
47 | + if (is_alnp_supported()) { |
|
48 | + $plugin_supported = alnp_get_theme_support('plugin_support'); |
|
49 | 49 | |
50 | 50 | // Is the theme supported by theme or plugin? |
51 | - if ( ! empty( $plugin_supported ) && $plugin_supported == 'yes' ) { |
|
52 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-plugin-supported.php' ); |
|
51 | + if ( ! empty($plugin_supported) && $plugin_supported == 'yes') { |
|
52 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-plugin-supported.php'); |
|
53 | 53 | } else { |
54 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-is-supported.php' ); |
|
54 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-is-supported.php'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } // END is_theme_supported() |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | public static function no_theme_selectors_set() { |
67 | 67 | $set_selectors = array(); |
68 | 68 | |
69 | - $content_container = get_option( 'auto_load_next_post_content_container' ); |
|
70 | - $title_selector = get_option( 'auto_load_next_post_title_selector' ); |
|
71 | - $navigation_container = get_option( 'auto_load_next_post_navigation_container' ); |
|
69 | + $content_container = get_option('auto_load_next_post_content_container'); |
|
70 | + $title_selector = get_option('auto_load_next_post_title_selector'); |
|
71 | + $navigation_container = get_option('auto_load_next_post_navigation_container'); |
|
72 | 72 | |
73 | - if ( ! empty( $content_container ) ) { |
|
73 | + if ( ! empty($content_container)) { |
|
74 | 74 | $set_selectors[] = $content_container; |
75 | 75 | } |
76 | 76 | |
77 | - if ( ! empty( $title_selector ) ) { |
|
77 | + if ( ! empty($title_selector)) { |
|
78 | 78 | $set_selectors[] = $title_selector; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $navigation_container ) ) { |
|
81 | + if ( ! empty($navigation_container)) { |
|
82 | 82 | $set_selectors[] = $navigation_container; |
83 | 83 | } |
84 | 84 | |
85 | - if ( empty( $set_selectors ) || is_array( $set_selectors ) && count( $set_selectors ) < 3 ) { |
|
86 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-theme-selectors.php' ); |
|
85 | + if (empty($set_selectors) || is_array($set_selectors) && count($set_selectors) < 3) { |
|
86 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-theme-selectors.php'); |
|
87 | 87 | } |
88 | 88 | } // END no_theme_selectors_set() |
89 | 89 | |
@@ -102,26 +102,26 @@ discard block |
||
102 | 102 | 'auto_load_next_post_theme_selectors_settings', array( |
103 | 103 | |
104 | 104 | array( |
105 | - 'title' => esc_html__( 'Theme Selectors', 'auto-load-next-post' ), |
|
105 | + 'title' => esc_html__('Theme Selectors', 'auto-load-next-post'), |
|
106 | 106 | 'type' => 'title', |
107 | - 'desc' => sprintf( esc_html__( 'Here you set the theme selectors below according to your active theme. All are required for %s to work.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
107 | + 'desc' => sprintf(esc_html__('Here you set the theme selectors below according to your active theme. All are required for %s to work.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
108 | 108 | 'id' => 'theme_selectors_options' |
109 | 109 | ), |
110 | 110 | |
111 | 111 | array( |
112 | - 'title' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
|
113 | - 'desc' => sprintf( __( 'The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post' ), '<code>main.site-main</code>' ), |
|
112 | + 'title' => esc_html__('Content Container', 'auto-load-next-post'), |
|
113 | + 'desc' => sprintf(__('The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post'), '<code>main.site-main</code>'), |
|
114 | 114 | 'id' => 'auto_load_next_post_content_container', |
115 | 115 | 'default' => 'main.site-main', |
116 | - 'placeholder' => esc_html__( 'Required', 'auto-load-next-post' ), |
|
116 | + 'placeholder' => esc_html__('Required', 'auto-load-next-post'), |
|
117 | 117 | 'type' => 'text', |
118 | 118 | 'css' => 'min-width:300px;', |
119 | 119 | 'autoload' => false |
120 | 120 | ), |
121 | 121 | |
122 | 122 | array( |
123 | - 'title' => esc_html__( 'Post Title', 'auto-load-next-post' ), |
|
124 | - 'desc' => sprintf( __( 'Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post' ), '<code>h1.entry-title</code>' ), |
|
123 | + 'title' => esc_html__('Post Title', 'auto-load-next-post'), |
|
124 | + 'desc' => sprintf(__('Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post'), '<code>h1.entry-title</code>'), |
|
125 | 125 | 'id' => 'auto_load_next_post_title_selector', |
126 | 126 | 'default' => 'h1.entry-title', |
127 | 127 | 'type' => 'text', |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | ), |
131 | 131 | |
132 | 132 | array( |
133 | - 'title' => esc_html__( 'Post Navigation', 'auto-load-next-post' ), |
|
134 | - 'desc' => sprintf( __( 'Used to identify which post to load next if any. Default: %s', 'auto-load-next-post' ), '<code>nav.post-navigation</code>' ), |
|
133 | + 'title' => esc_html__('Post Navigation', 'auto-load-next-post'), |
|
134 | + 'desc' => sprintf(__('Used to identify which post to load next if any. Default: %s', 'auto-load-next-post'), '<code>nav.post-navigation</code>'), |
|
135 | 135 | 'id' => 'auto_load_next_post_navigation_container', |
136 | 136 | 'default' => 'nav.post-navigation', |
137 | 137 | 'type' => 'text', |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | ), |
141 | 141 | |
142 | 142 | array( |
143 | - 'title' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
|
144 | - 'desc' => sprintf( __( 'Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post' ), '<strong><a href="' . get_admin_url( $blog_id, 'options-general.php?page=auto-load-next-post-settings&tab=misc' ) . '">', '</a></strong>', '<code>div#comments</code>' ), |
|
143 | + 'title' => esc_html__('Comments Container', 'auto-load-next-post'), |
|
144 | + 'desc' => sprintf(__('Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post'), '<strong><a href="'.get_admin_url($blog_id, 'options-general.php?page=auto-load-next-post-settings&tab=misc').'">', '</a></strong>', '<code>div#comments</code>'), |
|
145 | 145 | 'id' => 'auto_load_next_post_comments_container', |
146 | 146 | 'default' => 'div#comments', |
147 | 147 | 'type' => 'text', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function output() { |
166 | 166 | $settings = $this->get_settings(); |
167 | 167 | |
168 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
168 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
169 | 169 | } // END output() |
170 | 170 | |
171 | 171 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function save() { |
179 | 179 | $settings = $this->get_settings(); |
180 | 180 | |
181 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
181 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
182 | 182 | } // END save() |
183 | 183 | |
184 | 184 | } // END class |
@@ -10,12 +10,12 @@ |
||
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 | $active_theme = wp_get_theme(); |
18 | 18 | ?> |
19 | 19 | <div class="notice notice-info"> |
20 | - <p><?php echo sprintf( __( '%s theme is supported via a plugin. Do <strong>NOT</strong> change the theme selectors.', 'auto-load-next-post' ), $active_theme->name ); ?></p> |
|
20 | + <p><?php echo sprintf(__('%s theme is supported via a plugin. Do <strong>NOT</strong> change the theme selectors.', 'auto-load-next-post'), $active_theme->name); ?></p> |
|
21 | 21 | </div> |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
|
2 | +defined('ABSPATH') || die('Cheatin’ uh?'); |
|
3 | 3 | |
4 | -require AUTO_LOAD_NEXT_POST_3RD_PARTY . 'plugins/wp-rocket.php'; |
|
5 | 4 | \ No newline at end of file |
5 | +require AUTO_LOAD_NEXT_POST_3RD_PARTY.'plugins/wp-rocket.php'; |
|
6 | 6 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
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 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function init() { |
32 | 32 | // Add theme support and preset the theme selectors. |
33 | - add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) ); |
|
33 | + add_action('after_setup_theme', array(__CLASS__, 'add_theme_support')); |
|
34 | 34 | |
35 | 35 | // Display the post thumbnail before the content. |
36 | - add_action( 'alnp_load_before_content', array( __CLASS__, 'the_post_thumbnail' ), 10 ); |
|
36 | + add_action('alnp_load_before_content', array(__CLASS__, 'the_post_thumbnail'), 10); |
|
37 | 37 | |
38 | 38 | // Filters the repeater template location. |
39 | - add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_poseidon_template_location' ) ); |
|
39 | + add_filter('alnp_template_location', array(__CLASS__, 'alnp_poseidon_template_location')); |
|
40 | 40 | } // END init() |
41 | 41 | |
42 | 42 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // Get theme options from database. |
53 | 53 | $theme_options = poseidon_theme_options(); |
54 | 54 | |
55 | - if ( is_single() && has_post_thumbnail() && 'header' == $theme_options['post_layout_single'] ) { |
|
55 | + if (is_single() && has_post_thumbnail() && 'header' == $theme_options['post_layout_single']) { |
|
56 | 56 | the_post_thumbnail(); |
57 | 57 | } |
58 | 58 | } // END the_post_thumbnail() |
@@ -75,14 +75,14 @@ discard block |
||
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' => 'main.site-main', |
80 | 80 | 'title_selector' => 'h1.entry-title', |
81 | 81 | 'navigation_container' => 'nav.post-navigation', |
82 | 82 | 'comments_container' => 'div#comments', |
83 | 83 | 'load_js_in_footer' => 'no', |
84 | 84 | 'lock_js_in_footer' => 'no', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | } // END add_theme_support() |
87 | 87 | |
88 | 88 | } // END class |
@@ -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('Auto_Load_Next_Post_Admin_Settings' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Settings')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Admin_Settings { |
21 | 21 | |
@@ -56,16 +56,16 @@ 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-misc.php'); |
|
66 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-events.php'); |
|
64 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-theme-selectors.php'); |
|
65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-misc.php'); |
|
66 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-events.php'); |
|
67 | 67 | |
68 | - self::$settings = apply_filters( 'auto_load_next_post_get_settings_pages', $settings ); |
|
68 | + self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return self::$settings; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public static function save() { |
84 | 84 | global $current_tab; |
85 | 85 | |
86 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
86 | + check_admin_referer('auto-load-next-post-settings'); |
|
87 | 87 | |
88 | 88 | // Trigger actions |
89 | - do_action( 'auto_load_next_post_settings_save_' . $current_tab ); |
|
90 | - do_action( 'auto_load_next_post_update_options_' . $current_tab ); |
|
91 | - do_action( 'auto_load_next_post_update_options' ); |
|
89 | + do_action('auto_load_next_post_settings_save_'.$current_tab); |
|
90 | + do_action('auto_load_next_post_update_options_'.$current_tab); |
|
91 | + do_action('auto_load_next_post_update_options'); |
|
92 | 92 | |
93 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
93 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
94 | 94 | |
95 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
95 | + do_action('auto_load_next_post_settings_saved'); |
|
96 | 96 | } // END save() |
97 | 97 | |
98 | 98 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.0.0 |
104 | 104 | * @param string $text Message |
105 | 105 | */ |
106 | - public static function add_message( $text ) { |
|
106 | + public static function add_message($text) { |
|
107 | 107 | self::$messages[] = $text; |
108 | 108 | } // END add_message() |
109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 1.0.0 |
116 | 116 | * @param string $text Error |
117 | 117 | */ |
118 | - public static function add_error( $text ) { |
|
118 | + public static function add_error($text) { |
|
119 | 119 | self::$errors[] = $text; |
120 | 120 | } // END add_error() |
121 | 121 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public static function show_messages() { |
131 | - if ( count( self::$errors ) > 0 ) { |
|
132 | - foreach ( self::$errors as $error ) { |
|
133 | - echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
131 | + if (count(self::$errors) > 0) { |
|
132 | + foreach (self::$errors as $error) { |
|
133 | + echo '<div id="message" class="error inline"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
134 | 134 | } |
135 | - } elseif ( count( self::$messages ) > 0 ) { |
|
136 | - foreach ( self::$messages as $message ) { |
|
137 | - echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
135 | + } elseif (count(self::$messages) > 0) { |
|
136 | + foreach (self::$messages as $message) { |
|
137 | + echo '<div id="message" class="updated inline"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } // END show_messages() |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @return void |
153 | 153 | */ |
154 | 154 | public static function output() { |
155 | - do_action( 'auto_load_next_post_settings_start' ); |
|
155 | + do_action('auto_load_next_post_settings_start'); |
|
156 | 156 | |
157 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
157 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
158 | 158 | } // END output() |
159 | 159 | |
160 | 160 | /** |
@@ -166,33 +166,33 @@ discard block |
||
166 | 166 | * @param mixed $option_name |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - public static function get_option( $option_name, $default = '' ) { |
|
169 | + public static function get_option($option_name, $default = '') { |
|
170 | 170 | // Array value |
171 | - if ( strstr( $option_name, '[' ) ) { |
|
172 | - parse_str( $option_name, $option_array ); |
|
171 | + if (strstr($option_name, '[')) { |
|
172 | + parse_str($option_name, $option_array); |
|
173 | 173 | |
174 | 174 | // Option name is first key |
175 | - $option_name = current( array_keys( $option_array ) ); |
|
175 | + $option_name = current(array_keys($option_array)); |
|
176 | 176 | |
177 | 177 | // Get value |
178 | - $option_values = get_option( $option_name, '' ); |
|
178 | + $option_values = get_option($option_name, ''); |
|
179 | 179 | |
180 | - $key = key( $option_array[$option_name] ); |
|
180 | + $key = key($option_array[$option_name]); |
|
181 | 181 | |
182 | - if ( isset( $option_values[$key] ) ) { |
|
182 | + if (isset($option_values[$key])) { |
|
183 | 183 | $option_value = $option_values[$key]; |
184 | 184 | } else { |
185 | 185 | $option_value = null; |
186 | 186 | } |
187 | 187 | } else { |
188 | 188 | // Single value |
189 | - $option_value = get_option( $option_name, null ); |
|
189 | + $option_value = get_option($option_name, null); |
|
190 | 190 | } |
191 | 191 | |
192 | - if ( is_array( $option_value ) ) { |
|
193 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
194 | - } elseif ( ! is_null( $option_value ) ) { |
|
195 | - $option_value = stripslashes( $option_value ); |
|
192 | + if (is_array($option_value)) { |
|
193 | + $option_value = array_map('stripslashes', $option_value); |
|
194 | + } elseif ( ! is_null($option_value)) { |
|
195 | + $option_value = stripslashes($option_value); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $option_value === null ? $default : $option_value; |
@@ -209,84 +209,84 @@ discard block |
||
209 | 209 | * @version 1.5.0 |
210 | 210 | * @param array $options Opens array to output |
211 | 211 | */ |
212 | - public static function output_fields( $options ) { |
|
213 | - foreach ( $options as $key => $value ) { |
|
212 | + public static function output_fields($options) { |
|
213 | + foreach ($options as $key => $value) { |
|
214 | 214 | |
215 | - if ( ! isset( $value['type'] ) ) { |
|
215 | + if ( ! isset($value['type'])) { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | - if ( ! isset( $value['id'] ) ) { |
|
218 | + if ( ! isset($value['id'])) { |
|
219 | 219 | $value['id'] = ''; |
220 | 220 | } |
221 | - if ( ! isset( $value['title'] ) ) { |
|
222 | - $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
221 | + if ( ! isset($value['title'])) { |
|
222 | + $value['title'] = isset($value['name']) ? $value['name'] : ''; |
|
223 | 223 | } |
224 | - if ( ! isset( $value['class'] ) ) { |
|
224 | + if ( ! isset($value['class'])) { |
|
225 | 225 | $value['class'] = ''; |
226 | 226 | } |
227 | - if ( ! isset( $value['css'] ) ) { |
|
227 | + if ( ! isset($value['css'])) { |
|
228 | 228 | $value['css'] = ''; |
229 | 229 | } |
230 | - if ( ! isset( $value['default'] ) ) { |
|
230 | + if ( ! isset($value['default'])) { |
|
231 | 231 | $value['default'] = ''; |
232 | 232 | } |
233 | - if ( ! isset( $value['desc'] ) ) { |
|
233 | + if ( ! isset($value['desc'])) { |
|
234 | 234 | $value['desc'] = ''; |
235 | 235 | } |
236 | - if ( ! isset( $value['placeholder'] ) ) { |
|
236 | + if ( ! isset($value['placeholder'])) { |
|
237 | 237 | $value['placeholder'] = ''; |
238 | 238 | } |
239 | 239 | |
240 | 240 | // Custom attribute handling |
241 | 241 | $custom_attributes = array(); |
242 | 242 | |
243 | - if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { |
|
244 | - foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { |
|
245 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
243 | + if ( ! empty($value['custom_attributes']) && is_array($value['custom_attributes'])) { |
|
244 | + foreach ($value['custom_attributes'] as $attribute => $attribute_value) { |
|
245 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | 249 | // Description handling |
250 | - if ( ! empty( $value['desc'] ) ) { |
|
250 | + if ( ! empty($value['desc'])) { |
|
251 | 251 | $description = $value['desc']; |
252 | 252 | } |
253 | 253 | |
254 | - if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ), true ) ) { |
|
255 | - $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>'; |
|
256 | - } elseif ( $description && in_array( $value['type'], array( 'checkbox' ), true ) ) { |
|
257 | - $description = wp_kses_post( $description ); |
|
258 | - } elseif ( $description ) { |
|
259 | - $description = '<p class="description">' . wp_kses_post( $description ) . '</p>'; |
|
254 | + if ($description && in_array($value['type'], array('textarea', 'radio'), true)) { |
|
255 | + $description = '<p style="margin-top:0">'.wp_kses_post($description).'</p>'; |
|
256 | + } elseif ($description && in_array($value['type'], array('checkbox'), true)) { |
|
257 | + $description = wp_kses_post($description); |
|
258 | + } elseif ($description) { |
|
259 | + $description = '<p class="description">'.wp_kses_post($description).'</p>'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // Switch based on type |
263 | - switch( $value['type'] ) { |
|
263 | + switch ($value['type']) { |
|
264 | 264 | |
265 | 265 | // Section Titles |
266 | 266 | case 'title': |
267 | - if ( ! empty( $value['title'] ) ) { |
|
268 | - echo '<h2>' . esc_html( $value['title'] ) . '</h2>'; |
|
267 | + if ( ! empty($value['title'])) { |
|
268 | + echo '<h2>'.esc_html($value['title']).'</h2>'; |
|
269 | 269 | } |
270 | - if ( ! empty( $value['desc'] ) ) { |
|
271 | - echo '<div id="' . esc_attr( sanitize_title( $value['id'] ) ) . '-description">'; |
|
272 | - echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) ); |
|
270 | + if ( ! empty($value['desc'])) { |
|
271 | + echo '<div id="'.esc_attr(sanitize_title($value['id'])).'-description">'; |
|
272 | + echo wp_kses_post(wpautop(wptexturize($value['desc']))); |
|
273 | 273 | echo '</div>'; |
274 | 274 | } |
275 | 275 | echo '<table class="form-table">'."\n\n"; |
276 | - if ( ! empty( $value['id'] ) ) { |
|
277 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) ); |
|
276 | + if ( ! empty($value['id'])) { |
|
277 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id'])); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | break; |
281 | 281 | |
282 | 282 | // Section Ends |
283 | 283 | case 'sectionend': |
284 | - if ( ! empty( $value['id'] ) ) { |
|
285 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
284 | + if ( ! empty($value['id'])) { |
|
285 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_end'); |
|
286 | 286 | } |
287 | 287 | echo '</table>'; |
288 | - if ( ! empty( $value['id'] ) ) { |
|
289 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
288 | + if ( ! empty($value['id'])) { |
|
289 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_after'); |
|
290 | 290 | } |
291 | 291 | break; |
292 | 292 | |
@@ -299,22 +299,22 @@ discard block |
||
299 | 299 | case 'time': |
300 | 300 | case 'week': |
301 | 301 | case 'email': |
302 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
302 | + $option_value = self::get_option($value['id'], $value['default']); |
|
303 | 303 | |
304 | 304 | ?><tr valign="top"> |
305 | 305 | <th scope="row" class="titledesc"> |
306 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
306 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
307 | 307 | </th> |
308 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
308 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
309 | 309 | <input |
310 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
311 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
312 | - type="<?php echo esc_attr( $value['type'] ); ?>" |
|
313 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
314 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
315 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
316 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
317 | - <?php echo implode(' ', $custom_attributes ); ?> |
|
310 | + name="<?php echo esc_attr($value['id']); ?>" |
|
311 | + id="<?php echo esc_attr($value['id']); ?>" |
|
312 | + type="<?php echo esc_attr($value['type']); ?>" |
|
313 | + style="<?php echo esc_attr($value['css']); ?>" |
|
314 | + value="<?php echo esc_attr($option_value); ?>" |
|
315 | + class="<?php echo esc_attr($value['class']); ?>" |
|
316 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
317 | + <?php echo implode(' ', $custom_attributes); ?> |
|
318 | 318 | /><?php echo $description; ?> |
319 | 319 | </td> |
320 | 320 | </tr><?php |
@@ -322,23 +322,23 @@ discard block |
||
322 | 322 | |
323 | 323 | // Textarea. |
324 | 324 | case 'textarea': |
325 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
325 | + $option_value = self::get_option($value['id'], $value['default']); |
|
326 | 326 | ?> |
327 | 327 | <tr valign="top"> |
328 | 328 | <th scope="row" class="titledesc"> |
329 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
329 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
330 | 330 | </th> |
331 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
331 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
332 | 332 | <?php echo $description; ?> |
333 | 333 | |
334 | 334 | <textarea |
335 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
336 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
337 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
338 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
339 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
340 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
341 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
335 | + name="<?php echo esc_attr($value['id']); ?>" |
|
336 | + id="<?php echo esc_attr($value['id']); ?>" |
|
337 | + style="<?php echo esc_attr($value['css']); ?>" |
|
338 | + class="<?php echo esc_attr($value['class']); ?>" |
|
339 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
340 | + <?php echo implode(' ', $custom_attributes); ?> |
|
341 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
342 | 342 | </td> |
343 | 343 | </tr> |
344 | 344 | <?php |
@@ -347,35 +347,35 @@ discard block |
||
347 | 347 | // Select boxes. |
348 | 348 | case 'select': |
349 | 349 | case 'multiselect': |
350 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
350 | + $option_value = self::get_option($value['id'], $value['default']); |
|
351 | 351 | ?> |
352 | 352 | <tr valign="top"> |
353 | 353 | <th scope="row" class="titledesc"> |
354 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
354 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
355 | 355 | </th> |
356 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
356 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
357 | 357 | <select |
358 | - name="<?php echo esc_attr( $value['id'] ); ?><?php echo ( 'multiselect' === $value['type'] ) ? '[]' : ''; ?>" |
|
359 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
360 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
361 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
362 | - data-placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
363 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
358 | + name="<?php echo esc_attr($value['id']); ?><?php echo ('multiselect' === $value['type']) ? '[]' : ''; ?>" |
|
359 | + id="<?php echo esc_attr($value['id']); ?>" |
|
360 | + style="<?php echo esc_attr($value['css']); ?>" |
|
361 | + class="<?php echo esc_attr($value['class']); ?>" |
|
362 | + data-placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
363 | + <?php echo implode(' ', $custom_attributes); ?> |
|
364 | 364 | <?php echo 'multiselect' === $value['type'] ? 'multiple="multiple"' : ''; ?> |
365 | 365 | > |
366 | 366 | <?php |
367 | - foreach ( $value['options'] as $key => $val ) { |
|
367 | + foreach ($value['options'] as $key => $val) { |
|
368 | 368 | ?> |
369 | - <option value="<?php echo esc_attr( $key ); ?>" |
|
369 | + <option value="<?php echo esc_attr($key); ?>" |
|
370 | 370 | <?php |
371 | - if ( is_array( $option_value ) ) { |
|
372 | - selected( in_array( (string) $key, $option_value, true ), true ); |
|
371 | + if (is_array($option_value)) { |
|
372 | + selected(in_array((string) $key, $option_value, true), true); |
|
373 | 373 | } else { |
374 | - selected( $option_value, (string) $key ); |
|
374 | + selected($option_value, (string) $key); |
|
375 | 375 | } |
376 | 376 | ?> |
377 | 377 | > |
378 | - <?php echo esc_html( $val ); ?></option> |
|
378 | + <?php echo esc_html($val); ?></option> |
|
379 | 379 | <?php |
380 | 380 | } |
381 | 381 | ?> |
@@ -387,29 +387,29 @@ discard block |
||
387 | 387 | |
388 | 388 | // Radio inputs. |
389 | 389 | case 'radio': |
390 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
390 | + $option_value = self::get_option($value['id'], $value['default']); |
|
391 | 391 | ?> |
392 | 392 | <tr valign="top"> |
393 | 393 | <th scope="row" class="titledesc"> |
394 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
394 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
395 | 395 | </th> |
396 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
396 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
397 | 397 | <fieldset> |
398 | 398 | <?php echo $description; ?> |
399 | 399 | <ul> |
400 | 400 | <?php |
401 | - foreach ( $value['options'] as $key => $val ) { |
|
401 | + foreach ($value['options'] as $key => $val) { |
|
402 | 402 | ?> |
403 | 403 | <li> |
404 | 404 | <label><input |
405 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
406 | - value="<?php echo esc_attr( $key ); ?>" |
|
405 | + name="<?php echo esc_attr($value['id']); ?>" |
|
406 | + value="<?php echo esc_attr($key); ?>" |
|
407 | 407 | type="radio" |
408 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
409 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
410 | - <?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?> |
|
411 | - <?php checked( $key, $option_value ); ?> |
|
412 | - /> <?php echo esc_html( $val ); ?></label> |
|
408 | + style="<?php echo esc_attr($value['css']); ?>" |
|
409 | + class="<?php echo esc_attr($value['class']); ?>" |
|
410 | + <?php echo implode(' ', $custom_attributes); // WPCS: XSS ok. ?> |
|
411 | + <?php checked($key, $option_value); ?> |
|
412 | + /> <?php echo esc_html($val); ?></label> |
|
413 | 413 | </li> |
414 | 414 | <?php |
415 | 415 | } |
@@ -423,58 +423,58 @@ discard block |
||
423 | 423 | |
424 | 424 | // Checkbox input. |
425 | 425 | case 'checkbox': |
426 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
426 | + $option_value = self::get_option($value['id'], $value['default']); |
|
427 | 427 | $visibility_class = array(); |
428 | 428 | |
429 | - if ( ! isset( $value['hide_if_checked'] ) ) { |
|
429 | + if ( ! isset($value['hide_if_checked'])) { |
|
430 | 430 | $value['hide_if_checked'] = false; |
431 | 431 | } |
432 | - if ( ! isset( $value['show_if_checked'] ) ) { |
|
432 | + if ( ! isset($value['show_if_checked'])) { |
|
433 | 433 | $value['show_if_checked'] = false; |
434 | 434 | } |
435 | - if ( 'yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked'] ) { |
|
435 | + if ('yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked']) { |
|
436 | 436 | $visibility_class[] = 'hidden_option'; |
437 | 437 | } |
438 | - if ( 'option' === $value['hide_if_checked'] ) { |
|
438 | + if ('option' === $value['hide_if_checked']) { |
|
439 | 439 | $visibility_class[] = 'hide_options_if_checked'; |
440 | 440 | } |
441 | - if ( 'option' === $value['show_if_checked'] ) { |
|
441 | + if ('option' === $value['show_if_checked']) { |
|
442 | 442 | $visibility_class[] = 'show_options_if_checked'; |
443 | 443 | } |
444 | 444 | |
445 | - if ( ! isset( $value['checkboxgroup'] ) || 'start' === $value['checkboxgroup'] ) { |
|
445 | + if ( ! isset($value['checkboxgroup']) || 'start' === $value['checkboxgroup']) { |
|
446 | 446 | ?> |
447 | - <tr valign="top" class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
448 | - <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?></th> |
|
447 | + <tr valign="top" class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
448 | + <th scope="row" class="titledesc"><?php echo esc_html($value['title']); ?></th> |
|
449 | 449 | <td class="forminp forminp-checkbox"> |
450 | 450 | <fieldset> |
451 | 451 | <?php |
452 | 452 | } else { |
453 | 453 | ?> |
454 | - <fieldset class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
454 | + <fieldset class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
455 | 455 | <?php |
456 | 456 | } |
457 | 457 | |
458 | - if ( ! empty( $value['title'] ) ) { |
|
458 | + if ( ! empty($value['title'])) { |
|
459 | 459 | ?> |
460 | - <legend class="screen-reader-text"><span><?php echo esc_html( $value['title'] ); ?></span></legend> |
|
460 | + <legend class="screen-reader-text"><span><?php echo esc_html($value['title']); ?></span></legend> |
|
461 | 461 | <?php |
462 | 462 | } |
463 | 463 | ?> |
464 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"> |
|
464 | + <label for="<?php echo esc_attr($value['id']); ?>"> |
|
465 | 465 | <input |
466 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
467 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
466 | + name="<?php echo esc_attr($value['id']); ?>" |
|
467 | + id="<?php echo esc_attr($value['id']); ?>" |
|
468 | 468 | type="checkbox" |
469 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
469 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
470 | 470 | value="1" |
471 | - <?php checked( $option_value, 'yes' ); ?> |
|
472 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
471 | + <?php checked($option_value, 'yes'); ?> |
|
472 | + <?php echo implode(' ', $custom_attributes); ?> |
|
473 | 473 | /> <?php echo $description; ?> |
474 | 474 | </label> |
475 | 475 | <?php |
476 | 476 | |
477 | - if ( ! isset( $value['checkboxgroup'] ) || 'end' === $value['checkboxgroup'] ) { |
|
477 | + if ( ! isset($value['checkboxgroup']) || 'end' === $value['checkboxgroup']) { |
|
478 | 478 | ?> |
479 | 479 | </fieldset> |
480 | 480 | </td> |
@@ -488,12 +488,12 @@ discard block |
||
488 | 488 | break; |
489 | 489 | |
490 | 490 | case 'button': |
491 | - if ( isset( $value['url'] ) && ! empty( $value['url'] ) ) { |
|
491 | + if (isset($value['url']) && ! empty($value['url'])) { |
|
492 | 492 | ?> |
493 | 493 | <tr valign="top"> |
494 | - <th scope="row" class="titledesc"><?php echo $value['title'];?></th> |
|
495 | - <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
496 | - <a href="<?php echo $value['url']; ?>" class="button-secondary <?php echo esc_attr( $value['class'] ); ?>"> |
|
494 | + <th scope="row" class="titledesc"><?php echo $value['title']; ?></th> |
|
495 | + <td class="forminp forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
496 | + <a href="<?php echo $value['url']; ?>" class="button-secondary <?php echo esc_attr($value['class']); ?>"> |
|
497 | 497 | <?php echo $value['value']; ?> |
498 | 498 | </a> |
499 | 499 | <?php echo $description; ?> |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | // Default: run an action |
507 | 507 | default: |
508 | - do_action( 'auto_load_next_post_admin_field_' . $value['type'], $value ); |
|
508 | + do_action('auto_load_next_post_admin_field_'.$value['type'], $value); |
|
509 | 509 | |
510 | 510 | break; |
511 | 511 | } // end switch() |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @param array $options Opens array to output |
525 | 525 | * @return bool |
526 | 526 | */ |
527 | - public static function save_fields( $options ) { |
|
528 | - if ( empty( $_POST ) ) { |
|
527 | + public static function save_fields($options) { |
|
528 | + if (empty($_POST)) { |
|
529 | 529 | return false; |
530 | 530 | } |
531 | 531 | |
@@ -534,48 +534,48 @@ discard block |
||
534 | 534 | $autoload_options = array(); |
535 | 535 | |
536 | 536 | // Loop options and get values to save |
537 | - foreach ( $options as $option ) { |
|
538 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
537 | + foreach ($options as $option) { |
|
538 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
539 | 539 | continue; |
540 | 540 | } |
541 | 541 | |
542 | 542 | // Get posted value. |
543 | - if ( strstr( $option['id'], '[' ) ) { |
|
544 | - parse_str( $option['id'], $option_name_array ); |
|
545 | - $option_name = current( array_keys( $option_name_array ) ); |
|
546 | - $setting_name = key( $option_name_array[ $option_name ] ); |
|
547 | - $raw_value = isset( $_POST[ $option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $option_name ][ $setting_name ] ) : null; |
|
543 | + if (strstr($option['id'], '[')) { |
|
544 | + parse_str($option['id'], $option_name_array); |
|
545 | + $option_name = current(array_keys($option_name_array)); |
|
546 | + $setting_name = key($option_name_array[$option_name]); |
|
547 | + $raw_value = isset($_POST[$option_name][$setting_name]) ? wp_unslash($_POST[$option_name][$setting_name]) : null; |
|
548 | 548 | } else { |
549 | 549 | $option_name = $option['id']; |
550 | 550 | $setting_name = ''; |
551 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
551 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
552 | 552 | } |
553 | 553 | |
554 | - switch ( $option['type'] ) { |
|
554 | + switch ($option['type']) { |
|
555 | 555 | case "checkbox" : |
556 | 556 | $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no'; |
557 | 557 | break; |
558 | 558 | |
559 | 559 | case "textarea" : |
560 | - $value = wp_kses_post( trim( stripslashes( $_POST[$option['id']] ) ) ); |
|
560 | + $value = wp_kses_post(trim(stripslashes($_POST[$option['id']]))); |
|
561 | 561 | break; |
562 | 562 | |
563 | 563 | case "multiselect" : |
564 | - $value = array_filter( array_map( 'auto_load_next_post_clean', (array) $raw_value ) ); |
|
564 | + $value = array_filter(array_map('auto_load_next_post_clean', (array) $raw_value)); |
|
565 | 565 | break; |
566 | 566 | |
567 | 567 | case 'select' : |
568 | - $allowed_values = empty( $option['options'] ) ? array() : array_map( 'strval', array_keys( $option['options'] ) ); |
|
569 | - if ( empty( $option['default'] ) && empty( $allowed_values ) ) { |
|
568 | + $allowed_values = empty($option['options']) ? array() : array_map('strval', array_keys($option['options'])); |
|
569 | + if (empty($option['default']) && empty($allowed_values)) { |
|
570 | 570 | $value = null; |
571 | 571 | break; |
572 | 572 | } |
573 | - $default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] ); |
|
574 | - $value = in_array( $raw_value, $allowed_values, true ) ? $raw_value : $default; |
|
573 | + $default = (empty($option['default']) ? $allowed_values[0] : $option['default']); |
|
574 | + $value = in_array($raw_value, $allowed_values, true) ? $raw_value : $default; |
|
575 | 575 | break; |
576 | 576 | |
577 | 577 | default : |
578 | - $value = auto_load_next_post_clean( $raw_value ); |
|
578 | + $value = auto_load_next_post_clean($raw_value); |
|
579 | 579 | break; |
580 | 580 | } // END switch() |
581 | 581 | |
@@ -584,59 +584,59 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
586 | 586 | */ |
587 | - if ( has_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) ) ) { |
|
588 | - if ( is_ajax() ) { |
|
589 | - error_log( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) . ' is deprecated since version 1.5.0' ); |
|
587 | + if (has_action('auto_load_next_post_update_option_'.sanitize_title($option['type']))) { |
|
588 | + if (is_ajax()) { |
|
589 | + error_log('auto_load_next_post_update_option_'.sanitize_title($option['type']).' is deprecated since version 1.5.0'); |
|
590 | 590 | } else { |
591 | - _deprecated_hook( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), '1.5.0' ); |
|
591 | + _deprecated_hook('auto_load_next_post_update_option_'.sanitize_title($option['type']), '1.5.0'); |
|
592 | 592 | } |
593 | 593 | |
594 | - do_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), $option ); |
|
594 | + do_action('auto_load_next_post_update_option_'.sanitize_title($option['type']), $option); |
|
595 | 595 | continue; |
596 | 596 | } |
597 | 597 | |
598 | - if ( is_null( $value ) ) { |
|
598 | + if (is_null($value)) { |
|
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | |
602 | 602 | // Check if option is an array and handle that differently to single values. |
603 | - if ( $option_name && $setting_name ) { |
|
604 | - if ( ! isset( $update_options[ $option_name ] ) ) { |
|
605 | - $update_options[ $option_name ] = get_option( $option_name, array() ); |
|
603 | + if ($option_name && $setting_name) { |
|
604 | + if ( ! isset($update_options[$option_name])) { |
|
605 | + $update_options[$option_name] = get_option($option_name, array()); |
|
606 | 606 | } |
607 | - if ( ! is_array( $update_options[ $option_name ] ) ) { |
|
608 | - $update_options[ $option_name ] = array(); |
|
607 | + if ( ! is_array($update_options[$option_name])) { |
|
608 | + $update_options[$option_name] = array(); |
|
609 | 609 | } |
610 | - $update_options[ $option_name ][ $setting_name ] = $value; |
|
610 | + $update_options[$option_name][$setting_name] = $value; |
|
611 | 611 | } else { |
612 | - $update_options[ $option_name ] = $value; |
|
612 | + $update_options[$option_name] = $value; |
|
613 | 613 | } |
614 | 614 | |
615 | - $autoload_options[ $option_name ] = isset( $option['autoload'] ) ? (bool) $option['autoload'] : true; |
|
615 | + $autoload_options[$option_name] = isset($option['autoload']) ? (bool) $option['autoload'] : true; |
|
616 | 616 | |
617 | 617 | /** |
618 | 618 | * Fire an action before saved. |
619 | 619 | * |
620 | 620 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
621 | 621 | */ |
622 | - if ( has_action( 'auto_load_next_post_update_option' ) ) { |
|
623 | - if ( is_ajax() ) { |
|
624 | - error_log( 'auto_load_next_post_update_option is deprecated since version 1.5.0' ); |
|
622 | + if (has_action('auto_load_next_post_update_option')) { |
|
623 | + if (is_ajax()) { |
|
624 | + error_log('auto_load_next_post_update_option is deprecated since version 1.5.0'); |
|
625 | 625 | } else { |
626 | - _deprecated_hook( 'auto_load_next_post_update_option', '1.5.0' ); |
|
626 | + _deprecated_hook('auto_load_next_post_update_option', '1.5.0'); |
|
627 | 627 | } |
628 | 628 | |
629 | - do_action( 'auto_load_next_post_update_option', $option ); |
|
629 | + do_action('auto_load_next_post_update_option', $option); |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | 633 | // Now save the options |
634 | - foreach ( $update_options as $name => $value ) { |
|
635 | - update_option( $name, $value, $autoload_options[ $name ] ? 'yes' : 'no' ); |
|
634 | + foreach ($update_options as $name => $value) { |
|
635 | + update_option($name, $value, $autoload_options[$name] ? 'yes' : 'no'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | // Save all options as an array. Ready for export. |
639 | - update_option( 'auto_load_next_post_options', $update_options ); |
|
639 | + update_option('auto_load_next_post_options', $update_options); |
|
640 | 640 | |
641 | 641 | return true; |
642 | 642 | } // END save_fields() |
@@ -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( '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 | |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | 39 | // Resets Auto Load Next Post settings when requested. |
40 | - add_action( 'init', array( __CLASS__, 'reset_alnp' ), 0 ); |
|
40 | + add_action('init', array(__CLASS__, 'reset_alnp'), 0); |
|
41 | 41 | |
42 | 42 | // Checks version of Auto Load Next Post and install/update if needed. |
43 | - add_action( 'init', array( __CLASS__, 'check_version' ), 5 ); |
|
43 | + add_action('init', array(__CLASS__, 'check_version'), 5); |
|
44 | 44 | |
45 | 45 | // Adds rewrite endpoint. |
46 | - add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 10 ); |
|
46 | + add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 10); |
|
47 | 47 | |
48 | 48 | // Get plugin version. |
49 | - self::$current_version = get_option( 'auto_load_next_post_version' ); |
|
49 | + self::$current_version = get_option('auto_load_next_post_version'); |
|
50 | 50 | } // END __construct() |
51 | 51 | |
52 | 52 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @version 1.5.11 |
61 | 61 | */ |
62 | 62 | public static function check_version() { |
63 | - if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<' ) && current_user_can( 'install_plugins' ) ) { |
|
63 | + if ( ! defined('IFRAME_REQUEST') && version_compare(self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<') && current_user_can('install_plugins')) { |
|
64 | 64 | self::install(); |
65 | - do_action( 'auto_load_next_post_updated' ); |
|
65 | + do_action('auto_load_next_post_updated'); |
|
66 | 66 | } |
67 | 67 | } // END check_version() |
68 | 68 | |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | * @version 1.5.0 |
76 | 76 | */ |
77 | 77 | public static function install() { |
78 | - if ( ! is_blog_installed() ) { |
|
78 | + if ( ! is_blog_installed()) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | 82 | // Check if we are not already running this routine. |
83 | - if ( 'yes' === get_transient( 'alnp_installing' ) ) { |
|
83 | + if ('yes' === get_transient('alnp_installing')) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // If we made it till here nothing is running yet, lets set the transient now for five minutes. |
88 | - set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 5 ); |
|
89 | - if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) { |
|
90 | - define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true ); |
|
88 | + set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 5); |
|
89 | + if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) { |
|
90 | + define('AUTO_LOAD_NEXT_POST_INSTALLING', true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Add default options. |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | // Refresh rewrite rules. |
109 | 109 | self::flush_rewrite_rules(); |
110 | 110 | |
111 | - delete_transient( 'alnp_installing' ); |
|
111 | + delete_transient('alnp_installing'); |
|
112 | 112 | |
113 | - do_action( 'alnp_installed' ); |
|
113 | + do_action('alnp_installed'); |
|
114 | 114 | } // END install() |
115 | 115 | |
116 | 116 | /** |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @since 1.5.0 |
123 | 123 | */ |
124 | 124 | private static function set_theme_selectors() { |
125 | - if ( is_alnp_supported() ) { |
|
126 | - $content_container = alnp_get_theme_support( 'content_container' ); |
|
127 | - $title_selector = alnp_get_theme_support( 'title_selector' ); |
|
128 | - $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
|
129 | - $comments_container = alnp_get_theme_support( 'comments_container' ); |
|
130 | - |
|
131 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
132 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
133 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
134 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
125 | + if (is_alnp_supported()) { |
|
126 | + $content_container = alnp_get_theme_support('content_container'); |
|
127 | + $title_selector = alnp_get_theme_support('title_selector'); |
|
128 | + $navigation_container = alnp_get_theme_support('navigation_container'); |
|
129 | + $comments_container = alnp_get_theme_support('comments_container'); |
|
130 | + |
|
131 | + if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container); |
|
132 | + if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector); |
|
133 | + if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container); |
|
134 | + if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container); |
|
135 | 135 | } |
136 | 136 | } // END set_theme_selectors() |
137 | 137 | |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @version 1.5.3 |
147 | 147 | */ |
148 | 148 | private static function set_js_in_footer() { |
149 | - if ( is_alnp_supported() ) { |
|
150 | - $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
|
151 | - $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
|
149 | + if (is_alnp_supported()) { |
|
150 | + $load_js_in_footer = alnp_get_theme_support('load_js_in_footer'); |
|
151 | + $lock_js_in_footer = alnp_get_theme_support('lock_js_in_footer'); |
|
152 | 152 | |
153 | - 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 ); |
|
154 | - 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 ); |
|
153 | + 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); |
|
154 | + 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); |
|
155 | 155 | } |
156 | 156 | } // END set_js_in_footer() |
157 | 157 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @static |
163 | 163 | */ |
164 | 164 | private static function update_version() { |
165 | - update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION ); |
|
165 | + update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION); |
|
166 | 166 | } // END update_version() |
167 | 167 | |
168 | 168 | /** |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | * @version 1.5.0 |
175 | 175 | */ |
176 | 176 | public static function set_install_date() { |
177 | - $install_date = get_site_option( 'auto_load_next_post_install_date' ); |
|
177 | + $install_date = get_site_option('auto_load_next_post_install_date'); |
|
178 | 178 | |
179 | 179 | // If ALNP was installed before but the install date was not converted to time then convert it. |
180 | - if ( ! empty( $install_date ) && !intval( $install_date ) ) { |
|
181 | - update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) ); |
|
180 | + if ( ! empty($install_date) && ! intval($install_date)) { |
|
181 | + update_site_option('auto_load_next_post_install_date', strtotime($install_date)); |
|
182 | 182 | } else { |
183 | - add_site_option( 'auto_load_next_post_install_date', time() ); |
|
183 | + add_site_option('auto_load_next_post_install_date', time()); |
|
184 | 184 | } |
185 | 185 | } // END set_install_date() |
186 | 186 | |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public static function create_options() { |
198 | 198 | // Include settings so that we can run through defaults |
199 | - include_once( dirname( __FILE__ ) . '/admin/class-alnp-admin-settings.php' ); |
|
199 | + include_once(dirname(__FILE__).'/admin/class-alnp-admin-settings.php'); |
|
200 | 200 | |
201 | 201 | $settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
202 | 202 | |
203 | - foreach ( $settings as $section ) { |
|
204 | - foreach ( $section->get_settings() as $value ) { |
|
205 | - if ( isset( $value['default'] ) && isset( $value['id'] ) ) { |
|
206 | - $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true; |
|
207 | - add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) ); |
|
203 | + foreach ($settings as $section) { |
|
204 | + foreach ($section->get_settings() as $value) { |
|
205 | + if (isset($value['default']) && isset($value['id'])) { |
|
206 | + $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true; |
|
207 | + add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no')); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @version 1.5.0 |
220 | 220 | */ |
221 | 221 | public static function add_rewrite_endpoint() { |
222 | - add_rewrite_endpoint( 'alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT ); |
|
222 | + add_rewrite_endpoint('alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT); |
|
223 | 223 | } // END add_rewrite_endpoint() |
224 | 224 | |
225 | 225 | /** |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | * @global object $wpdb |
243 | 243 | */ |
244 | 244 | public static function reset_alnp() { |
245 | - if ( current_user_can( 'install_plugins' ) && isset( $_GET['reset-alnp'] ) && $_GET['reset-alnp'] == 'yes' ) { |
|
245 | + if (current_user_can('install_plugins') && isset($_GET['reset-alnp']) && $_GET['reset-alnp'] == 'yes') { |
|
246 | 246 | global $wpdb; |
247 | 247 | |
248 | 248 | // Make sure it is only a single site we are resetting. |
249 | - if ( ! is_multisite() ) { |
|
249 | + if ( ! is_multisite()) { |
|
250 | 250 | // Delete options |
251 | 251 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'"); |
252 | 252 | |
@@ -254,26 +254,26 @@ discard block |
||
254 | 254 | $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'auto_load_next_post_%'"); |
255 | 255 | |
256 | 256 | // Delete Uninstall Data - Just to double check it has been removed. |
257 | - delete_option( 'auto_load_next_post_uninstall_data' ); |
|
257 | + delete_option('auto_load_next_post_uninstall_data'); |
|
258 | 258 | |
259 | 259 | // Delete Install Date |
260 | - delete_option( 'auto_load_next_post_install_date' ); |
|
260 | + delete_option('auto_load_next_post_install_date'); |
|
261 | 261 | } |
262 | 262 | else { |
263 | 263 | // Delete Uninstall Data |
264 | - delete_site_option( 'auto_load_next_post_uninstall_data' ); |
|
264 | + delete_site_option('auto_load_next_post_uninstall_data'); |
|
265 | 265 | |
266 | 266 | // Delete Install Date |
267 | - delete_site_option( 'auto_load_next_post_install_date' ); |
|
267 | + delete_site_option('auto_load_next_post_install_date'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | // Re-install Auto Load Next Post |
271 | 271 | self::install(); |
272 | 272 | |
273 | - wp_safe_redirect( add_query_arg( array( |
|
273 | + wp_safe_redirect(add_query_arg(array( |
|
274 | 274 | 'page' => 'auto-load-next-post-settings', |
275 | 275 | 'reset' => 'done' |
276 | - ), admin_url( 'options-general.php' ) ) ); |
|
276 | + ), admin_url('options-general.php'))); |
|
277 | 277 | exit; |
278 | 278 | } |
279 | 279 | } // END reset_alnp() |
@@ -128,10 +128,18 @@ discard block |
||
128 | 128 | $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
129 | 129 | $comments_container = alnp_get_theme_support( 'comments_container' ); |
130 | 130 | |
131 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
132 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
133 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
134 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
131 | + if ( ! empty( $content_container ) ) { |
|
132 | + update_option( 'auto_load_next_post_content_container', $content_container ); |
|
133 | + } |
|
134 | + if ( ! empty( $title_selector ) ) { |
|
135 | + update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
136 | + } |
|
137 | + if ( ! empty( $navigation_container ) ) { |
|
138 | + update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
139 | + } |
|
140 | + if ( ! empty( $comments_container ) ) { |
|
141 | + update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
142 | + } |
|
135 | 143 | } |
136 | 144 | } // END set_theme_selectors() |
137 | 145 | |
@@ -150,8 +158,12 @@ discard block |
||
150 | 158 | $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
151 | 159 | $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
152 | 160 | |
153 | - 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 ); |
|
154 | - 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 ); |
|
161 | + if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) { |
|
162 | + update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
163 | + } |
|
164 | + if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) { |
|
165 | + update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
166 | + } |
|
155 | 167 | } |
156 | 168 | } // END set_js_in_footer() |
157 | 169 | |
@@ -258,8 +270,7 @@ discard block |
||
258 | 270 | |
259 | 271 | // Delete Install Date |
260 | 272 | delete_option( 'auto_load_next_post_install_date' ); |
261 | - } |
|
262 | - else { |
|
273 | + } else { |
|
263 | 274 | // Delete Uninstall Data |
264 | 275 | delete_site_option( 'auto_load_next_post_uninstall_data' ); |
265 | 276 |
@@ -11,24 +11,24 @@ |
||
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-info auto-load-next-post-notice"> |
19 | 19 | <div class="auto-load-next-post-notice-inner"> |
20 | 20 | <div class="auto-load-next-post-notice-icon"> |
21 | - <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' ); ?>" /> |
|
21 | + <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 | 22 | </div> |
23 | 23 | |
24 | 24 | <div class="auto-load-next-post-notice-content"> |
25 | - <h3><?php echo esc_html__( 'Thanks for trying out this beta!', 'auto-load-next-post' ); ?></h3> |
|
26 | - <p><?php echo esc_html__( 'If you have any questions about the beta or if you have any feedback at all including features to be added or integrations to support, please let me know. Any little bit you\'re willing to share helps.', 'auto-load-next-post' ); ?></p> |
|
25 | + <h3><?php echo esc_html__('Thanks for trying out this beta!', 'auto-load-next-post'); ?></h3> |
|
26 | + <p><?php echo esc_html__('If you have any questions about the beta or if you have any feedback at all including features to be added or integrations to support, please let me know. Any little bit you\'re willing to share helps.', 'auto-load-next-post'); ?></p> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="auto-load-next-post-send-feedback"> |
30 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'contact/' ), esc_html__( 'Give Feedback', 'auto-load-next-post' ) ); ?> |
|
31 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_beta_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Ask me again in 7 days', 'auto-load-next-post' ); ?></a> |
|
30 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'contact/'), esc_html__('Give Feedback', 'auto-load-next-post')); ?> |
|
31 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_beta_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Ask me again in 7 days', 'auto-load-next-post'); ?></a> |
|
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | </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( 'Auto_Load_Next_Post_Settings_Misc_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Misc_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Misc_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'misc'; |
31 | - $this->label = esc_html__( 'Misc', 'auto-load-next-post' ); |
|
31 | + $this->label = esc_html__('Misc', 'auto-load-next-post'); |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | |
35 | - add_filter( 'auto_load_next_post_misc_settings', array( __CLASS__, 'lock_js_in_footer' ), 0, 1 ); |
|
36 | - add_action( 'auto_load_next_post_sections_misc', array( __CLASS__, 'no_comment_selector_set' ), 10 ); |
|
35 | + add_filter('auto_load_next_post_misc_settings', array(__CLASS__, 'lock_js_in_footer'), 0, 1); |
|
36 | + add_action('auto_load_next_post_sections_misc', array(__CLASS__, 'no_comment_selector_set'), 10); |
|
37 | 37 | } // END __construct() |
38 | 38 | |
39 | 39 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @since 1.5.0 |
45 | 45 | */ |
46 | 46 | public static function no_comment_selector_set() { |
47 | - $comments_container = get_option( 'auto_load_next_post_comments_container' ); |
|
48 | - $remove_comments = get_option( 'auto_load_next_post_remove_comments' ); |
|
47 | + $comments_container = get_option('auto_load_next_post_comments_container'); |
|
48 | + $remove_comments = get_option('auto_load_next_post_remove_comments'); |
|
49 | 49 | |
50 | - if ( empty( $comments_container ) && ! empty( $remove_comments ) ) { |
|
51 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-comment-selector.php' ); |
|
50 | + if (empty($comments_container) && ! empty($remove_comments)) { |
|
51 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-comment-selector.php'); |
|
52 | 52 | } |
53 | 53 | } // END no_comment_selector_set() |
54 | 54 | |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | * @param array $settings |
65 | 65 | * @return array $settings |
66 | 66 | */ |
67 | - public static function lock_js_in_footer( $settings ) { |
|
68 | - $js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' ); |
|
67 | + public static function lock_js_in_footer($settings) { |
|
68 | + $js_locked_in_footer = get_option('auto_load_next_post_lock_js_in_footer'); |
|
69 | 69 | |
70 | - if ( ! empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) { |
|
70 | + if ( ! empty($js_locked_in_footer) && $js_locked_in_footer == 'yes') { |
|
71 | 71 | // Setting key to look for. |
72 | 72 | $key = 'load_js_in_footer'; |
73 | 73 | |
74 | 74 | // Find the setting. |
75 | - $find_setting = array_search( $key, $settings ); |
|
75 | + $find_setting = array_search($key, $settings); |
|
76 | 76 | |
77 | 77 | // Does the setting exist? |
78 | - if ( is_bool( $find_setting ) === true ) { |
|
79 | - unset( $settings[$key] ); |
|
78 | + if (is_bool($find_setting) === true) { |
|
79 | + unset($settings[$key]); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -98,47 +98,47 @@ discard block |
||
98 | 98 | 'title' => array( |
99 | 99 | 'title' => $this->label, |
100 | 100 | 'type' => 'title', |
101 | - 'desc' => sprintf( esc_html__( 'Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
101 | + 'desc' => sprintf(esc_html__('Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
102 | 102 | 'id' => 'misc_options' |
103 | 103 | ), |
104 | 104 | |
105 | 105 | 'remove_comments' => array( |
106 | - 'title' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
107 | - 'desc' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
106 | + 'title' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
107 | + 'desc' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
108 | 108 | 'id' => 'auto_load_next_post_remove_comments', |
109 | 109 | 'default' => 'yes', |
110 | 110 | 'type' => 'checkbox' |
111 | 111 | ), |
112 | 112 | |
113 | 113 | 'google_analytics' => array( |
114 | - 'title' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
115 | - 'desc' => esc_html__( 'Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post' ), |
|
114 | + 'title' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
115 | + 'desc' => esc_html__('Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post'), |
|
116 | 116 | 'id' => 'auto_load_next_post_google_analytics', |
117 | 117 | 'default' => 'no', |
118 | 118 | 'type' => 'checkbox' |
119 | 119 | ), |
120 | 120 | |
121 | 121 | 'load_js_in_footer' => array( |
122 | - 'title' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
123 | - 'desc' => esc_html__( 'Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post' ), |
|
122 | + 'title' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
123 | + 'desc' => esc_html__('Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post'), |
|
124 | 124 | 'id' => 'auto_load_next_post_load_js_in_footer', |
125 | 125 | 'default' => 'no', |
126 | 126 | 'type' => 'checkbox' |
127 | 127 | ), |
128 | 128 | |
129 | 129 | 'reset_data' => array( |
130 | - 'title' => esc_html__( 'Reset all data?', 'auto-load-next-post' ), |
|
131 | - 'desc' => esc_html__( 'Press the reset button to clear all settings for this plugin and re-initialize.', 'auto-load-next-post' ), |
|
130 | + 'title' => esc_html__('Reset all data?', 'auto-load-next-post'), |
|
131 | + 'desc' => esc_html__('Press the reset button to clear all settings for this plugin and re-initialize.', 'auto-load-next-post'), |
|
132 | 132 | 'id' => 'auto_load_next_post_reset_data', |
133 | 133 | 'class' => 'reset-settings', |
134 | - 'value' => esc_html__( 'Reset', 'auto-load-next-post' ), |
|
135 | - 'url' => add_query_arg( array( 'page' => 'auto-load-next-post-settings', 'tab' => esc_attr( $this->id ), 'reset-alnp' => 'yes' ), admin_url( 'options-general.php' ) ), |
|
134 | + 'value' => esc_html__('Reset', 'auto-load-next-post'), |
|
135 | + 'url' => add_query_arg(array('page' => 'auto-load-next-post-settings', 'tab' => esc_attr($this->id), 'reset-alnp' => 'yes'), admin_url('options-general.php')), |
|
136 | 136 | 'type' => 'button' |
137 | 137 | ), |
138 | 138 | |
139 | 139 | 'uninstall' => array( |
140 | - 'title' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
141 | - 'desc' => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
|
140 | + 'title' => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'), |
|
141 | + 'desc' => esc_html__('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'), |
|
142 | 142 | 'id' => 'auto_load_next_post_uninstall_data', |
143 | 143 | 'default' => 'no', |
144 | 144 | 'type' => 'checkbox' |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function output() { |
162 | 162 | $settings = $this->get_settings(); |
163 | 163 | |
164 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
164 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
165 | 165 | } // END output() |
166 | 166 | |
167 | 167 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function save() { |
174 | 174 | $settings = $this->get_settings(); |
175 | 175 | |
176 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
176 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
177 | 177 | } // END save() |
178 | 178 | |
179 | 179 | } // END class |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
|
2 | +defined('ABSPATH') || die('Cheatin’ uh?'); |
|
3 | 3 | |
4 | -if ( defined( 'WP_ROCKET_VERSION' ) ) : |
|
4 | +if (defined('WP_ROCKET_VERSION')) : |
|
5 | 5 | /** |
6 | 6 | * Excludes Auto Load Next Post scripts from JS minification. |
7 | 7 | * |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | * @param Array $excluded_js An array of JS handles enqueued in WordPress. |
10 | 10 | * @return Array $excluded_js the updated array of handles. |
11 | 11 | */ |
12 | - function rocket_exclude_js_alnp( $excluded_js ) { |
|
13 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.js' ) ); |
|
14 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.min.js' ) ); |
|
15 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.dev.js' ) ); |
|
16 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/jquery.history.js' ) ); |
|
17 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/scrollspy.min.js' ) ); |
|
12 | + function rocket_exclude_js_alnp($excluded_js) { |
|
13 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.js')); |
|
14 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.min.js')); |
|
15 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.dev.js')); |
|
16 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/libs/jquery.history.js')); |
|
17 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/libs/scrollspy.min.js')); |
|
18 | 18 | |
19 | 19 | return $excluded_js; |
20 | 20 | } |
21 | - add_filter( 'rocket_exclude_js', 'rocket_exclude_js_alnp' ); |
|
21 | + add_filter('rocket_exclude_js', 'rocket_exclude_js_alnp'); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Excludes Auto Load Next Post JS files from defer JS |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param Array $exclude_defer_js Array of JS filepaths to be excluded. |
28 | 28 | * @return Array $exclude_defer_js the updated array of defer JS |
29 | 29 | */ |
30 | - function rocket_exclude_defer_js_alnp( $exclude_defer_js ) { |
|
31 | - $exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.js' ); |
|
32 | - $exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.min.js' ); |
|
33 | - $exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.dev.js' ); |
|
30 | + function rocket_exclude_defer_js_alnp($exclude_defer_js) { |
|
31 | + $exclude_defer_js[] = rocket_clean_exclude_file(AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/frontend/auto-load-next-post.js'); |
|
32 | + $exclude_defer_js[] = rocket_clean_exclude_file(AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/frontend/auto-load-next-post.min.js'); |
|
33 | + $exclude_defer_js[] = rocket_clean_exclude_file(AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/frontend/auto-load-next-post.dev.js'); |
|
34 | 34 | |
35 | 35 | return $exclude_defer_js; |
36 | 36 | } |
37 | - add_filter( 'rocket_exclude_defer_js', 'rocket_exclude_defer_js_alnp' ); |
|
37 | + add_filter('rocket_exclude_defer_js', 'rocket_exclude_defer_js_alnp'); |
|
38 | 38 | |
39 | 39 | endif; |