@@ -10,7 +10,7 @@ |
||
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 | ?> |
@@ -11,15 +11,15 @@ 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 | -$tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'auto_load_next_post_sections_' . $current_tab ) || has_action( 'auto_load_next_post_settings_' . $current_tab ) || has_action( 'auto_load_next_post_settings_tabs_' . $current_tab ); |
|
19 | -$current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : ''; |
|
18 | +$tab_exists = isset($tabs[$current_tab]) || has_action('auto_load_next_post_sections_'.$current_tab) || has_action('auto_load_next_post_settings_'.$current_tab) || has_action('auto_load_next_post_settings_tabs_'.$current_tab); |
|
19 | +$current_tab_label = isset($tabs[$current_tab]) ? $tabs[$current_tab] : ''; |
|
20 | 20 | |
21 | -if ( ! $tab_exists ) { |
|
22 | - wp_safe_redirect( admin_url( 'options-general.php?page=auto-load-next-post-settings' ) ); |
|
21 | +if ( ! $tab_exists) { |
|
22 | + wp_safe_redirect(admin_url('options-general.php?page=auto-load-next-post-settings')); |
|
23 | 23 | exit; |
24 | 24 | } |
25 | 25 | ?> |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | <form method="post" id="mainform" action="" enctype="multipart/form-data"> |
28 | 28 | <nav class="nav-tab-wrapper"> |
29 | 29 | <?php |
30 | - foreach ( $tabs as $slug => $label ) { |
|
31 | - echo '<a href="' . esc_html( admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
30 | + foreach ($tabs as $slug => $label) { |
|
31 | + echo '<a href="'.esc_html(admin_url('options-general.php?page=auto-load-next-post-settings&tab='.esc_attr($slug))).'" class="nav-tab '.($current_tab === $slug ? 'nav-tab-active' : '').'">'.esc_html($label).'</a>'; |
|
32 | 32 | } |
33 | 33 | |
34 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
34 | + do_action('auto_load_next_post_settings_tabs'); |
|
35 | 35 | ?> |
36 | 36 | </nav> |
37 | - <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1> |
|
37 | + <h1 class="screen-reader-text"><?php echo esc_html($current_tab_label); ?></h1> |
|
38 | 38 | <?php |
39 | - do_action( 'auto_load_next_post_sections_' . $current_tab ); |
|
39 | + do_action('auto_load_next_post_sections_'.$current_tab); |
|
40 | 40 | |
41 | 41 | self::show_messages(); |
42 | 42 | |
43 | - do_action( 'auto_load_next_post_settings_' . $current_tab ); |
|
43 | + do_action('auto_load_next_post_settings_'.$current_tab); |
|
44 | 44 | ?> |
45 | 45 | <p class="submit"> |
46 | - <?php submit_button( esc_attr__( 'Save Changes', 'auto-load-next-post' ), 'button-primary', esc_attr__( 'Save Changes', 'auto-load-next-post' ), false, array( 'id' => 'save' ) ); ?> |
|
47 | - <?php wp_nonce_field( 'auto-load-next-post-settings' ); ?> |
|
46 | + <?php submit_button(esc_attr__('Save Changes', 'auto-load-next-post'), 'button-primary', esc_attr__('Save Changes', 'auto-load-next-post'), false, array('id' => 'save')); ?> |
|
47 | + <?php wp_nonce_field('auto-load-next-post-settings'); ?> |
|
48 | 48 | </p> |
49 | 49 | </form> |
50 | 50 | |
51 | 51 | <div class="alnp-sidebar"> |
52 | 52 | <?php |
53 | - do_action( 'auto_load_next_post_sidebar', $current_tab ); |
|
53 | + do_action('auto_load_next_post_sidebar', $current_tab); |
|
54 | 54 | ?> |
55 | 55 | </div> |
56 | 56 | </div> |
@@ -11,61 +11,61 @@ |
||
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="alnp-upgrade-details"> |
19 | - <h1><?php esc_html_e( 'Pro Coming Soon', 'auto-load-next-post' ); ?></h1> |
|
19 | + <h1><?php esc_html_e('Pro Coming Soon', 'auto-load-next-post'); ?></h1> |
|
20 | 20 | |
21 | 21 | <ul> |
22 | - <li><?php echo wptexturize( esc_html__( 'Load the Next Post or Next Post with same Category or New Posts or Related Posts or by Custom Query', 'auto-load-next-post' ) ); ?></li> |
|
23 | - <li><?php echo wptexturize( esc_html__( 'Page and Media Attachment Support', 'auto-load-next-post' ) ); ?></li> |
|
24 | - <li><?php echo wptexturize( esc_html__( 'Custom Post Type Support', 'auto-load-next-post' ) ); ?></li> |
|
25 | - <li><?php echo wptexturize( esc_html__( 'Paginated Posts Supported', 'auto-load-next-post' ) ); ?></li> |
|
26 | - <li><?php echo wptexturize( esc_html__( 'Exclude Post Formats', 'auto-load-next-post' ) ); ?></li> |
|
27 | - <li><?php echo wptexturize( esc_html__( 'Limit Posts per Session', 'auto-load-next-post' ) ); ?></li> |
|
28 | - <li><?php echo wptexturize( esc_html__( 'Query Posts by Category and Tag', 'auto-load-next-post' ) ); ?></li> |
|
29 | - <li><?php echo wptexturize( esc_html__( 'Exclude User Roles and Specific Users', 'auto-load-next-post' ) ); ?></li> |
|
30 | - <li><?php echo wptexturize( esc_html__( 'Pre-Query Posts Ready to Load', 'auto-load-next-post' ) ); ?></li> |
|
31 | - <li><?php echo wptexturize( esc_html__( 'Hide Comments and Show by Toggle Button', 'auto-load-next-post' ) ); ?></li> |
|
32 | - <li><?php echo wptexturize( sprintf( esc_html__( 'Multilingual Support for %1$s and %2$s', 'auto-load-next-post' ), 'WPML', 'Polylang' ) ); ?></li> |
|
33 | - <li><?php echo wptexturize( esc_html__( 'Email Support', 'auto-load-next-post' ) ); ?></li> |
|
22 | + <li><?php echo wptexturize(esc_html__('Load the Next Post or Next Post with same Category or New Posts or Related Posts or by Custom Query', 'auto-load-next-post')); ?></li> |
|
23 | + <li><?php echo wptexturize(esc_html__('Page and Media Attachment Support', 'auto-load-next-post')); ?></li> |
|
24 | + <li><?php echo wptexturize(esc_html__('Custom Post Type Support', 'auto-load-next-post')); ?></li> |
|
25 | + <li><?php echo wptexturize(esc_html__('Paginated Posts Supported', 'auto-load-next-post')); ?></li> |
|
26 | + <li><?php echo wptexturize(esc_html__('Exclude Post Formats', 'auto-load-next-post')); ?></li> |
|
27 | + <li><?php echo wptexturize(esc_html__('Limit Posts per Session', 'auto-load-next-post')); ?></li> |
|
28 | + <li><?php echo wptexturize(esc_html__('Query Posts by Category and Tag', 'auto-load-next-post')); ?></li> |
|
29 | + <li><?php echo wptexturize(esc_html__('Exclude User Roles and Specific Users', 'auto-load-next-post')); ?></li> |
|
30 | + <li><?php echo wptexturize(esc_html__('Pre-Query Posts Ready to Load', 'auto-load-next-post')); ?></li> |
|
31 | + <li><?php echo wptexturize(esc_html__('Hide Comments and Show by Toggle Button', 'auto-load-next-post')); ?></li> |
|
32 | + <li><?php echo wptexturize(sprintf(esc_html__('Multilingual Support for %1$s and %2$s', 'auto-load-next-post'), 'WPML', 'Polylang')); ?></li> |
|
33 | + <li><?php echo wptexturize(esc_html__('Email Support', 'auto-load-next-post')); ?></li> |
|
34 | 34 | </ul> |
35 | 35 | |
36 | 36 | <p> |
37 | - <a href="https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=alnp-settings-page"><?php esc_html_e( 'Visit autoloadnextpost.com →', 'auto-load-next-post' ); ?></a> |
|
37 | + <a href="https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=alnp-settings-page"><?php esc_html_e('Visit autoloadnextpost.com →', 'auto-load-next-post'); ?></a> |
|
38 | 38 | </p> |
39 | 39 | |
40 | 40 | </div> |
41 | 41 | |
42 | 42 | <form method="post" action="https://sebastiendumont.us1.list-manage.com/subscribe/post?u=48ead612ad85b23fe2239c6e3&id=79e97b5275" name="mc-embedded-subscribe-form" target="_blank" class="subscribe block"> |
43 | - <h2><?php esc_html_e( 'Sign up to pre-order first', 'auto-load-next-post' ); ?></h2> |
|
43 | + <h2><?php esc_html_e('Sign up to pre-order first', 'auto-load-next-post'); ?></h2> |
|
44 | 44 | |
45 | 45 | <p class="intro"> |
46 | - <?php echo wptexturize( esc_html__( 'Submit your name and email and be the first to know when you can pre-order Auto Load Next Post Pro and keep up to date with my developments plus a 10% discount.', 'auto-load-next-post' ) ); ?> |
|
46 | + <?php echo wptexturize(esc_html__('Submit your name and email and be the first to know when you can pre-order Auto Load Next Post Pro and keep up to date with my developments plus a 10% discount.', 'auto-load-next-post')); ?> |
|
47 | 47 | </p> |
48 | 48 | |
49 | 49 | <div class="field"> |
50 | - <input type="email" name="EMAIL" value="" placeholder="<?php esc_html_e( 'Your Email Address', 'auto-load-next-post' ); ?>"/> |
|
50 | + <input type="email" name="EMAIL" value="" placeholder="<?php esc_html_e('Your Email Address', 'auto-load-next-post'); ?>"/> |
|
51 | 51 | </div> |
52 | 52 | |
53 | 53 | <div class="field"> |
54 | - <input type="text" name="FNAME" value="" placeholder="<?php esc_html_e( 'First Name', 'auto-load-next-post' ); ?>"/> |
|
54 | + <input type="text" name="FNAME" value="" placeholder="<?php esc_html_e('First Name', 'auto-load-next-post'); ?>"/> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class="field"> |
58 | - <input type="text" name="LNAME" value="" placeholder="<?php esc_html_e( 'Last Name', 'auto-load-next-post' ); ?>"/> |
|
58 | + <input type="text" name="LNAME" value="" placeholder="<?php esc_html_e('Last Name', 'auto-load-next-post'); ?>"/> |
|
59 | 59 | </div> |
60 | 60 | |
61 | 61 | <input type="hidden" name="group[35169][1]" value="1"> |
62 | 62 | |
63 | 63 | <div class="field submit-button"> |
64 | 64 | <div style="position: absolute; left: -9999px;" aria-hidden="true"><input type="text" name="b_48ead612ad85b23fe2239c6e3_79e97b5275" tabindex="-1" value=""></div> |
65 | - <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_html_e( 'Sign me up', 'auto-load-next-post' ); ?>"/> |
|
65 | + <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_html_e('Sign me up', 'auto-load-next-post'); ?>"/> |
|
66 | 66 | </div> |
67 | 67 | |
68 | 68 | <p class="promise"> |
69 | - <?php esc_html_e( 'I promise I will not use your email for anything else and you can unsubscribe with 1-click anytime.', 'auto-load-next-post' ); ?> |
|
69 | + <?php esc_html_e('I promise I will not use your email for anything else and you can unsubscribe with 1-click anytime.', 'auto-load-next-post'); ?> |
|
70 | 70 | </p> |
71 | 71 | </form> |
@@ -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 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | 32 | $this->id = 'misc'; |
33 | - $this->label = esc_html__( 'Misc', 'auto-load-next-post' ); |
|
33 | + $this->label = esc_html__('Misc', 'auto-load-next-post'); |
|
34 | 34 | |
35 | 35 | parent::__construct(); |
36 | 36 | |
37 | - add_filter( 'auto_load_next_post_misc_settings', array( __CLASS__, 'lock_js_in_footer' ), 0, 1 ); |
|
38 | - add_action( 'auto_load_next_post_sections_misc', array( __CLASS__, 'no_comment_selector_set' ), 10 ); |
|
37 | + add_filter('auto_load_next_post_misc_settings', array(__CLASS__, 'lock_js_in_footer'), 0, 1); |
|
38 | + add_action('auto_load_next_post_sections_misc', array(__CLASS__, 'no_comment_selector_set'), 10); |
|
39 | 39 | } // END __construct() |
40 | 40 | |
41 | 41 | /** |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * @since 1.5.0 |
47 | 47 | */ |
48 | 48 | public static function no_comment_selector_set() { |
49 | - $comments_container = get_option( 'auto_load_next_post_comments_container' ); |
|
50 | - $remove_comments = get_option( 'auto_load_next_post_remove_comments' ); |
|
49 | + $comments_container = get_option('auto_load_next_post_comments_container'); |
|
50 | + $remove_comments = get_option('auto_load_next_post_remove_comments'); |
|
51 | 51 | |
52 | - if ( empty( $comments_container ) && ! empty( $remove_comments ) ) { |
|
53 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-comment-selector.php' ); |
|
52 | + if (empty($comments_container) && ! empty($remove_comments)) { |
|
53 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-comment-selector.php'); |
|
54 | 54 | } |
55 | 55 | } // END no_comment_selector_set() |
56 | 56 | |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | * @param array $settings |
67 | 67 | * @return array $settings |
68 | 68 | */ |
69 | - public static function lock_js_in_footer( $settings ) { |
|
70 | - $js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' ); |
|
69 | + public static function lock_js_in_footer($settings) { |
|
70 | + $js_locked_in_footer = get_option('auto_load_next_post_lock_js_in_footer'); |
|
71 | 71 | |
72 | - if ( !empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) { |
|
72 | + if ( ! empty($js_locked_in_footer) && $js_locked_in_footer == 'yes') { |
|
73 | 73 | // Setting key to look for. |
74 | 74 | $key = 'load_js_in_footer'; |
75 | 75 | |
76 | 76 | // Find the setting. |
77 | - $find_setting = array_search( $key, $settings ); |
|
77 | + $find_setting = array_search($key, $settings); |
|
78 | 78 | |
79 | 79 | // Does the setting exist? |
80 | - if ( is_bool( $find_setting ) === true ) { |
|
81 | - unset( $settings[$key] ); |
|
80 | + if (is_bool($find_setting) === true) { |
|
81 | + unset($settings[$key]); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -99,45 +99,45 @@ discard block |
||
99 | 99 | 'title' => array( |
100 | 100 | 'title' => $this->label, |
101 | 101 | 'type' => 'title', |
102 | - '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 | + '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')), |
|
103 | 103 | 'id' => 'misc_options' |
104 | 104 | ), |
105 | 105 | |
106 | 106 | 'remove_comments' => array( |
107 | - 'title' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
108 | - 'desc' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
107 | + 'title' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
108 | + 'desc' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
109 | 109 | 'id' => 'auto_load_next_post_remove_comments', |
110 | 110 | 'default' => 'yes', |
111 | 111 | 'type' => 'checkbox' |
112 | 112 | ), |
113 | 113 | |
114 | 114 | 'google_analytics' => array( |
115 | - 'title' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
116 | - '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' ), |
|
115 | + 'title' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
116 | + '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'), |
|
117 | 117 | 'id' => 'auto_load_next_post_google_analytics', |
118 | 118 | 'default' => 'no', |
119 | 119 | 'type' => 'checkbox' |
120 | 120 | ), |
121 | 121 | |
122 | 122 | 'load_js_in_footer' => array( |
123 | - 'title' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
124 | - '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' ), |
|
123 | + 'title' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
124 | + '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'), |
|
125 | 125 | 'id' => 'auto_load_next_post_load_js_in_footer', |
126 | 126 | 'default' => 'no', |
127 | 127 | 'type' => 'checkbox' |
128 | 128 | ), |
129 | 129 | |
130 | 130 | 'reset_data' => array( |
131 | - 'title' => esc_html__( 'Reset all data?', 'auto-load-next-post' ), |
|
132 | - 'desc' => esc_html__( 'Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post' ), |
|
131 | + 'title' => esc_html__('Reset all data?', 'auto-load-next-post'), |
|
132 | + 'desc' => esc_html__('Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post'), |
|
133 | 133 | 'id' => 'auto_load_next_post_reset_data', |
134 | 134 | 'default' => 'no', |
135 | 135 | 'type' => 'reset_data' |
136 | 136 | ), |
137 | 137 | |
138 | 138 | 'uninstall' => array( |
139 | - 'title' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
140 | - 'desc' => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
|
139 | + 'title' => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'), |
|
140 | + 'desc' => esc_html__('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'), |
|
141 | 141 | 'id' => 'auto_load_next_post_uninstall_data', |
142 | 142 | 'default' => 'no', |
143 | 143 | 'type' => 'checkbox' |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @since 1.5.0 |
158 | 158 | * @param mixed $settings |
159 | 159 | */ |
160 | - public function customize_button( $settings ) { |
|
160 | + public function customize_button($settings) { |
|
161 | 161 | ?> |
162 | 162 | <tr valign="top"> |
163 | - <th scope="row" class="titledesc"><?php echo $settings['title'];?></th> |
|
164 | - <td class="forminp forminp-<?php echo sanitize_title( $settings['type'] ) ?>"> |
|
165 | - <a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr( $settings['class'] ); ?>"> |
|
163 | + <th scope="row" class="titledesc"><?php echo $settings['title']; ?></th> |
|
164 | + <td class="forminp forminp-<?php echo sanitize_title($settings['type']) ?>"> |
|
165 | + <a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr($settings['class']); ?>"> |
|
166 | 166 | <?php echo $settings['button_text']; ?> |
167 | 167 | </a> |
168 | - <span class="description"><?php echo $settings['desc'];?></span> |
|
168 | + <span class="description"><?php echo $settings['desc']; ?></span> |
|
169 | 169 | </td> |
170 | 170 | </tr> |
171 | 171 | <?php |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function output() { |
183 | 183 | $settings = $this->get_settings(); |
184 | 184 | |
185 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
185 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
186 | 186 | } // END output() |
187 | 187 | |
188 | 188 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | public function save() { |
195 | 195 | $settings = $this->get_settings(); |
196 | 196 | |
197 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
197 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
198 | 198 | } // END save() |
199 | 199 | |
200 | 200 | } // END class |
@@ -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( 'Auto_Load_Next_Post_Settings_Page' ) ) { |
|
17 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Page')) { |
|
18 | 18 | |
19 | 19 | abstract class Auto_Load_Next_Post_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( 'auto_load_next_post_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
46 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'need_help' ), 0 ); |
|
47 | - add_action( 'auto_load_next_post_sections_' . $this->id, array( $this, 'output_sections' ) ); |
|
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('auto_load_next_post_settings_tabs_array', array($this, 'add_settings_page'), 20); |
|
46 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'need_help'), 0); |
|
47 | + add_action('auto_load_next_post_sections_'.$this->id, array($this, 'output_sections')); |
|
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,16 +133,16 @@ 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 | - echo '<li><a href="' . admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
144 | + foreach ($sections as $id => $label) { |
|
145 | + echo '<li><a href="'.admin_url('options-general.php?page=auto-load-next-post-settings&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | echo '</ul><br class="clear" />'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function output() { |
158 | 158 | $settings = $this->get_settings(); |
159 | 159 | |
160 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
160 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
161 | 161 | } // END output() |
162 | 162 | |
163 | 163 | /** |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | |
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 | |
178 | - if ( $current_section ) { |
|
179 | - do_action( 'auto_load_next_post_update_options_' . $this->id . '_' . $current_section ); |
|
178 | + if ($current_section) { |
|
179 | + do_action('auto_load_next_post_update_options_'.$this->id.'_'.$current_section); |
|
180 | 180 | } |
181 | 181 | } // END save() |
182 | 182 | |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | global $current_tab; |
195 | 195 | |
196 | 196 | // If theme is already supported then don't show help button for theme selectors. |
197 | - if ( is_alnp_supported() && $current_tab == 'theme-selectors' ) { |
|
197 | + if (is_alnp_supported() && $current_tab == 'theme-selectors') { |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
201 | - echo '<a href="#" class="need-help trigger-help" data-tab="' . $current_tab . '"><span class="sonar-dot"></span> ' . esc_html( 'Need Help?', 'auto-load-next-post' ) . '</a>'; |
|
201 | + echo '<a href="#" class="need-help trigger-help" data-tab="'.$current_tab.'"><span class="sonar-dot"></span> '.esc_html('Need Help?', 'auto-load-next-post').'</a>'; |
|
202 | 202 | } // END need_help() |
203 | 203 | |
204 | 204 | } // END class |
@@ -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( 'Auto_Load_Next_Post_Extensions' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Extensions')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Extensions { |
22 | 22 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | $this->id = 'extensions'; |
38 | - $this->label = esc_html__( 'Extensions', 'auto-load-next-post' ); |
|
38 | + $this->label = esc_html__('Extensions', 'auto-load-next-post'); |
|
39 | 39 | |
40 | 40 | // Below are extensions hosted on WordPress.org |
41 | 41 | self::$extensions = array( |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | |
47 | - include_once( AUTO_LOAD_NEXT_POST_FILE_PATH . '/vendor/connekt-plugin-installer/class-connekt-plugin-installer.php'); // Plugin Installer |
|
47 | + include_once(AUTO_LOAD_NEXT_POST_FILE_PATH.'/vendor/connekt-plugin-installer/class-connekt-plugin-installer.php'); // Plugin Installer |
|
48 | 48 | |
49 | - add_filter( 'auto_load_next_post_settings_tabs_array', array( $this, 'add_extensions_page' ), 99 ); |
|
50 | - add_action( 'auto_load_next_post_settings_end', array( $this, 'output' ), 10, 2 ); |
|
49 | + add_filter('auto_load_next_post_settings_tabs_array', array($this, 'add_extensions_page'), 99); |
|
50 | + add_action('auto_load_next_post_settings_end', array($this, 'output'), 10, 2); |
|
51 | 51 | } // END __construct() |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param array $pages |
58 | 58 | * @return array $pages |
59 | 59 | */ |
60 | - public function add_extensions_page( $pages ) { |
|
60 | + public function add_extensions_page($pages) { |
|
61 | 61 | $pages[$this->id] = $this->label; |
62 | 62 | |
63 | 63 | return $pages; |
@@ -70,30 +70,30 @@ discard block |
||
70 | 70 | * @param string $current_tab |
71 | 71 | * @param array $tabs |
72 | 72 | */ |
73 | - public function output( $current_tab, $tabs ) { |
|
74 | - if ( $current_tab !== 'extensions' ) { |
|
73 | + public function output($current_tab, $tabs) { |
|
74 | + if ($current_tab !== 'extensions') { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - $tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'auto_load_next_post_sections_' . $current_tab ) || has_action( 'auto_load_next_post_settings_' . $current_tab ) || has_action( 'auto_load_next_post_settings_tabs_' . $current_tab ); |
|
79 | - $current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : ''; |
|
78 | + $tab_exists = isset($tabs[$current_tab]) || has_action('auto_load_next_post_sections_'.$current_tab) || has_action('auto_load_next_post_settings_'.$current_tab) || has_action('auto_load_next_post_settings_tabs_'.$current_tab); |
|
79 | + $current_tab_label = isset($tabs[$current_tab]) ? $tabs[$current_tab] : ''; |
|
80 | 80 | ?> |
81 | 81 | <div class="wrap auto-load-next-post"> |
82 | 82 | <nav class="nav-tab-wrapper"> |
83 | 83 | <?php |
84 | - foreach ( $tabs as $slug => $label ) { |
|
85 | - echo '<a href="' . esc_html( admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
84 | + foreach ($tabs as $slug => $label) { |
|
85 | + echo '<a href="'.esc_html(admin_url('options-general.php?page=auto-load-next-post-settings&tab='.esc_attr($slug))).'" class="nav-tab '.($current_tab === $slug ? 'nav-tab-active' : '').'">'.esc_html($label).'</a>'; |
|
86 | 86 | } |
87 | 87 | |
88 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
88 | + do_action('auto_load_next_post_settings_tabs'); |
|
89 | 89 | ?> |
90 | 90 | </nav> |
91 | - <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1> |
|
91 | + <h1 class="screen-reader-text"><?php echo esc_html($current_tab_label); ?></h1> |
|
92 | 92 | </div> |
93 | 93 | |
94 | 94 | <?php |
95 | - if ( class_exists( 'Connekt_Plugin_Installer' ) ) { |
|
96 | - Connekt_Plugin_Installer::init( self::$extensions ); |
|
95 | + if (class_exists('Connekt_Plugin_Installer')) { |
|
96 | + Connekt_Plugin_Installer::init(self::$extensions); |
|
97 | 97 | } |
98 | 98 | } // END output() |
99 | 99 |
@@ -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' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Admin { |
21 | 21 | |
@@ -28,28 +28,28 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | // Include classes. |
31 | - add_action( 'admin_init', array( $this, 'includes' ), 10 ); |
|
31 | + add_action('admin_init', array($this, 'includes'), 10); |
|
32 | 32 | |
33 | 33 | // Register scripts and styles for settings page. |
34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ), 10 ); |
|
35 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 10 ); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_styles'), 10); |
|
35 | + add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 10); |
|
36 | 36 | |
37 | 37 | // Add a message in the WP Privacy Policy Guide page. |
38 | - add_action( 'admin_init', array( $this, 'add_privacy_policy_guide_content' ) ); |
|
38 | + add_action('admin_init', array($this, 'add_privacy_policy_guide_content')); |
|
39 | 39 | |
40 | 40 | // Add settings page. |
41 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); |
|
41 | + add_action('admin_menu', array($this, 'admin_menu'), 9); |
|
42 | 42 | |
43 | 43 | // Filters |
44 | - add_filter( 'plugin_action_links_' . plugin_basename( AUTO_LOAD_NEXT_POST_FILE ), array( $this, 'plugin_action_links' ) ); |
|
45 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta'), 10, 3 ); |
|
46 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
47 | - add_filter( 'update_footer', array( $this, 'update_footer'), 15 ); |
|
44 | + add_filter('plugin_action_links_'.plugin_basename(AUTO_LOAD_NEXT_POST_FILE), array($this, 'plugin_action_links')); |
|
45 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 3); |
|
46 | + add_filter('admin_footer_text', array($this, 'admin_footer_text')); |
|
47 | + add_filter('update_footer', array($this, 'update_footer'), 15); |
|
48 | 48 | |
49 | 49 | // Add sidebar |
50 | - add_action( 'auto_load_next_post_sidebar', array( $this, 'sidebar_top' ), 0 ); |
|
51 | - add_action( 'auto_load_next_post_sidebar', array( $this, 'upgrade_details' ), 1 ); |
|
52 | - add_action( 'auto_load_next_post_sidebar', array( $this, 'sidebar_bottom' ), 999 ); |
|
50 | + add_action('auto_load_next_post_sidebar', array($this, 'sidebar_top'), 0); |
|
51 | + add_action('auto_load_next_post_sidebar', array($this, 'upgrade_details'), 1); |
|
52 | + add_action('auto_load_next_post_sidebar', array($this, 'sidebar_bottom'), 999); |
|
53 | 53 | } // END __construct() |
54 | 54 | |
55 | 55 | /** |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function includes() { |
62 | 62 | // Classes we only need if the ajax is not-ajax |
63 | - if ( ! auto_load_next_post_is_ajax() ) { |
|
64 | - include( dirname( __FILE__ ) . '/class-alnp-admin-notices.php' ); // Plugin Notices |
|
65 | - include( dirname( __FILE__ ) . '/class-alnp-admin-help.php' ); // Plugin Help Tab |
|
63 | + if ( ! auto_load_next_post_is_ajax()) { |
|
64 | + include(dirname(__FILE__).'/class-alnp-admin-notices.php'); // Plugin Notices |
|
65 | + include(dirname(__FILE__).'/class-alnp-admin-help.php'); // Plugin Help Tab |
|
66 | 66 | } |
67 | 67 | |
68 | - include_once( dirname( __FILE__ ) . '/class-alnp-extensions.php'); // Extensions. |
|
68 | + include_once(dirname(__FILE__).'/class-alnp-extensions.php'); // Extensions. |
|
69 | 69 | } // END includes() |
70 | 70 | |
71 | 71 | /** |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | $screen = get_current_screen(); |
82 | 82 | $screen_id = $screen ? $screen->id : ''; |
83 | 83 | |
84 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin', '/assets/css/admin/auto-load-next-post' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.css' ); |
|
84 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin', '/assets/css/admin/auto-load-next-post'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
85 | 85 | |
86 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
86 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
87 | 87 | // Select2 - Make sure that we remove other registered Select2 to prevent styling issues. |
88 | - if ( wp_script_is( 'select2', 'registered' ) ) { |
|
89 | - wp_dequeue_style( 'select2' ); |
|
90 | - wp_deregister_style( 'select2' ); |
|
88 | + if (wp_script_is('select2', 'registered')) { |
|
89 | + wp_dequeue_style('select2'); |
|
90 | + wp_deregister_style('select2'); |
|
91 | 91 | } |
92 | 92 | |
93 | - Auto_Load_Next_Post::load_file( 'select2', '/assets/css/libs/select2' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.css' ); |
|
93 | + Auto_Load_Next_Post::load_file('select2', '/assets/css/libs/select2'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
94 | 94 | } |
95 | 95 | } // END admin_styles() |
96 | 96 | |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | $screen = get_current_screen(); |
106 | 106 | $screen_id = $screen ? $screen->id : ''; |
107 | 107 | |
108 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
108 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
109 | 109 | // Select2 - Make sure that we remove other registered Select2 to prevent plugin conflict issues. |
110 | - if ( wp_script_is( 'select2', 'registered' ) ) { |
|
111 | - wp_dequeue_script( 'select2' ); |
|
112 | - wp_deregister_script( 'select2' ); |
|
110 | + if (wp_script_is('select2', 'registered')) { |
|
111 | + wp_dequeue_script('select2'); |
|
112 | + wp_deregister_script('select2'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Load Select2 |
116 | - Auto_Load_Next_Post::load_file( 'select2', '/assets/js/libs/select2' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array( 'jquery' ), '4.0.5', true ); |
|
116 | + Auto_Load_Next_Post::load_file('select2', '/assets/js/libs/select2'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), '4.0.5', true); |
|
117 | 117 | |
118 | 118 | // Load plugin settings. |
119 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin', '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array( 'jquery' ), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
119 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin', '/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
120 | 120 | |
121 | 121 | // Variables for Admin JavaScripts |
122 | - wp_localize_script( AUTO_LOAD_NEXT_POST_SLUG . '_admin', 'alnp_settings_params', array( |
|
122 | + wp_localize_script(AUTO_LOAD_NEXT_POST_SLUG.'_admin', 'alnp_settings_params', array( |
|
123 | 123 | 'is_rtl' => is_rtl() ? 'rtl' : 'ltr', |
124 | - 'i18n_nav_warning' => esc_html__( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
125 | - ) ); |
|
124 | + 'i18n_nav_warning' => esc_html__('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
125 | + )); |
|
126 | 126 | } |
127 | 127 | } // END admin_scripts() |
128 | 128 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @static |
135 | 135 | */ |
136 | 136 | public static function add_privacy_policy_guide_content() { |
137 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
138 | - wp_add_privacy_policy_content( esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), self::get_privacy_policy_guide_message() ); |
|
137 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
138 | + wp_add_privacy_policy_content(esc_html__('Auto Load Next Post', 'auto-load-next-post'), self::get_privacy_policy_guide_message()); |
|
139 | 139 | } |
140 | 140 | } // END add_privacy_policy_guide_content() |
141 | 141 | |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | protected static function get_privacy_policy_guide_message() { |
151 | 151 | $content = ' |
152 | 152 | <div contenteditable="false">' . |
153 | - '<p class="wp-policy-help">' . |
|
154 | - sprintf( __( '%s does not collect, store or share any personal data.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . |
|
155 | - '</p>' . |
|
153 | + '<p class="wp-policy-help">'. |
|
154 | + sprintf(__('%s does not collect, store or share any personal data.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')). |
|
155 | + '</p>'. |
|
156 | 156 | '</div>'; |
157 | 157 | |
158 | 158 | return $content; |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function admin_menu() { |
169 | 169 | $settings_page = add_options_page( |
170 | - sprintf( __( '%s Settings', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
171 | - esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
170 | + sprintf(__('%s Settings', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
171 | + esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
172 | 172 | 'manage_options', |
173 | 173 | 'auto-load-next-post-settings', |
174 | - array( $this, 'settings_page' ) |
|
174 | + array($this, 'settings_page') |
|
175 | 175 | ); |
176 | 176 | |
177 | - add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) ); |
|
177 | + add_action('load-'.$settings_page, array($this, 'settings_page_init')); |
|
178 | 178 | } // END admin_menu() |
179 | 179 | |
180 | 180 | /** |
@@ -189,29 +189,29 @@ discard block |
||
189 | 189 | global $current_tab, $current_section; |
190 | 190 | |
191 | 191 | // Include settings pages. |
192 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
192 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
193 | 193 | |
194 | 194 | Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
195 | 195 | |
196 | 196 | // Get current tab/section. |
197 | - $current_tab = empty( $_GET['tab'] ) ? 'theme-selectors' : sanitize_title( wp_unslash( $_GET['tab'] ) ); |
|
198 | - $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); |
|
197 | + $current_tab = empty($_GET['tab']) ? 'theme-selectors' : sanitize_title(wp_unslash($_GET['tab'])); |
|
198 | + $current_section = empty($_REQUEST['section']) ? '' : sanitize_title(wp_unslash($_REQUEST['section'])); |
|
199 | 199 | |
200 | 200 | // Save settings if data has been posted. |
201 | - if ( apply_filters( '' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty( $_POST ) ) ) { |
|
201 | + if (apply_filters('' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty($_POST))) { |
|
202 | 202 | Auto_Load_Next_Post_Admin_Settings::save(); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Add any posted messages. |
206 | - if ( ! empty( $_GET['auto_load_next_post_error'] ) ) { |
|
207 | - Auto_Load_Next_Post_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_error'] ) ) ); |
|
206 | + if ( ! empty($_GET['auto_load_next_post_error'])) { |
|
207 | + Auto_Load_Next_Post_Admin_Settings::add_error(wp_kses_post(wp_unslash($_GET['auto_load_next_post_error']))); |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( ! empty( $_GET['auto_load_next_post_message'] ) ) { |
|
211 | - Auto_Load_Next_Post_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_message'] ) ) ); |
|
210 | + if ( ! empty($_GET['auto_load_next_post_message'])) { |
|
211 | + Auto_Load_Next_Post_Admin_Settings::add_message(wp_kses_post(wp_unslash($_GET['auto_load_next_post_message']))); |
|
212 | 212 | } |
213 | 213 | |
214 | - do_action( 'auto_load_next_post_settings_page_init' ); |
|
214 | + do_action('auto_load_next_post_settings_page_init'); |
|
215 | 215 | } // END settings_page_init() |
216 | 216 | |
217 | 217 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @since 1.0.0 |
222 | 222 | */ |
223 | 223 | public function settings_page() { |
224 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
224 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
225 | 225 | |
226 | 226 | Auto_Load_Next_Post_Admin_Settings::output(); |
227 | 227 | } // END settings_page() |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | * @param array $links |
236 | 236 | * @return array $links |
237 | 237 | */ |
238 | - public function plugin_action_links( $links ) { |
|
238 | + public function plugin_action_links($links) { |
|
239 | 239 | $plugin_action_links = array(); |
240 | 240 | |
241 | - if ( current_user_can( 'manage_options' ) ) { |
|
241 | + if (current_user_can('manage_options')) { |
|
242 | 242 | // Checks if Auto Load Next Post Pro has been installed. |
243 | - if ( ! is_alnp_pro_version_installed() ) { |
|
244 | - $plugin_action_links['go-pro'] = '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" aria-label="' . esc_attr__( 'Sign up for Auto Load Next Post Pro', 'auto-load-next-post' ) . '" target="_blank" style="color:green; font-weight:bold;">' . __( 'Sign up for Pro', 'auto-load-next-post' ) . '</a>'; |
|
243 | + if ( ! is_alnp_pro_version_installed()) { |
|
244 | + $plugin_action_links['go-pro'] = '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" aria-label="'.esc_attr__('Sign up for Auto Load Next Post Pro', 'auto-load-next-post').'" target="_blank" style="color:green; font-weight:bold;">'.__('Sign up for Pro', 'auto-load-next-post').'</a>'; |
|
245 | 245 | } |
246 | 246 | |
247 | - $plugin_action_links['settings'] = '<a href="' . admin_url( 'options-general.php?page=auto-load-next-post-settings' ) . '" aria-label="' . esc_attr__( 'View Auto Load Next Post settings', 'auto-load-next-post' ) . '">' . __( 'Settings', 'auto-load-next-post' ) . '</a>'; |
|
247 | + $plugin_action_links['settings'] = '<a href="'.admin_url('options-general.php?page=auto-load-next-post-settings').'" aria-label="'.esc_attr__('View Auto Load Next Post settings', 'auto-load-next-post').'">'.__('Settings', 'auto-load-next-post').'</a>'; |
|
248 | 248 | |
249 | - return array_merge( $plugin_action_links, $links ); |
|
249 | + return array_merge($plugin_action_links, $links); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $links; |
@@ -263,17 +263,17 @@ discard block |
||
263 | 263 | * @param array $data Plugin Information |
264 | 264 | * @return array $links |
265 | 265 | */ |
266 | - public function plugin_row_meta( $links, $file, $data ) { |
|
267 | - if ( $file == plugin_basename( AUTO_LOAD_NEXT_POST_FILE ) ) { |
|
268 | - $links[ 1 ] = sprintf( __( 'Developed By %s', 'auto-load-next-post' ), '<a href="' . $data[ 'AuthorURI' ] . '" aria-label="' . esc_attr__( 'View the developers site', 'auto-load-next-post' ) . '">' . $data[ 'Author' ] . '</a>' ); |
|
266 | + public function plugin_row_meta($links, $file, $data) { |
|
267 | + if ($file == plugin_basename(AUTO_LOAD_NEXT_POST_FILE)) { |
|
268 | + $links[1] = sprintf(__('Developed By %s', 'auto-load-next-post'), '<a href="'.$data['AuthorURI'].'" aria-label="'.esc_attr__('View the developers site', 'auto-load-next-post').'">'.$data['Author'].'</a>'); |
|
269 | 269 | |
270 | 270 | $row_meta = array( |
271 | - 'docs' => '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'documentation/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" aria-label="' . esc_attr__( 'View Auto Load Next Post documentation', 'auto-load-next-post' ) . '" target="_blank">' . esc_attr__( 'Documentation', 'auto-load-next-post' ) . '</a>', |
|
272 | - 'community' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/auto-load-next-post' ) . '" aria-label="' . esc_attr__( 'Get support from the community', 'auto-load-next-post' ). '" target="_blank">' . esc_attr__( 'Community Support', 'auto-load-next-post' ) . '</a>', |
|
273 | - 'theme-support' => '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" attr-label="' . esc_attr__( 'Get theme support', 'auto-load-next-post' ) . '" target="_blank">' . esc_attr__( 'Theme Support', 'auto-load-next-post' ) . '</a>', |
|
271 | + 'docs' => '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'documentation/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" aria-label="'.esc_attr__('View Auto Load Next Post documentation', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Documentation', 'auto-load-next-post').'</a>', |
|
272 | + 'community' => '<a href="'.esc_url('https://wordpress.org/support/plugin/auto-load-next-post').'" aria-label="'.esc_attr__('Get support from the community', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Community Support', 'auto-load-next-post').'</a>', |
|
273 | + 'theme-support' => '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" attr-label="'.esc_attr__('Get theme support', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Theme Support', 'auto-load-next-post').'</a>', |
|
274 | 274 | ); |
275 | 275 | |
276 | - $links = array_merge( $links, $row_meta ); |
|
276 | + $links = array_merge($links, $row_meta); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return $links; |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * @param string $text |
290 | 290 | * @return string $text |
291 | 291 | */ |
292 | - public function admin_footer_text( $text ) { |
|
292 | + public function admin_footer_text($text) { |
|
293 | 293 | $current_screen = get_current_screen(); |
294 | 294 | |
295 | - if ( isset( $current_screen->id ) && $current_screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
295 | + if (isset($current_screen->id) && $current_screen->id == 'settings_page_auto-load-next-post-settings') { |
|
296 | 296 | // Rating and Review |
297 | 297 | return sprintf( |
298 | 298 | /* translators: 1: Auto Load Next Post 2:: five stars */ |
299 | - __( 'If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post' ), |
|
300 | - sprintf( '<strong>%1$s</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
301 | - '<a href="' . AUTO_LOAD_NEXT_POST_REVIEW_URL . '?rate=5#new-post" target="_blank" data-rated="' . esc_attr__( 'Thanks :)', 'auto-load-next-post' ) . '">★★★★★</a>' |
|
299 | + __('If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post'), |
|
300 | + sprintf('<strong>%1$s</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
301 | + '<a href="'.AUTO_LOAD_NEXT_POST_REVIEW_URL.'?rate=5#new-post" target="_blank" data-rated="'.esc_attr__('Thanks :)', 'auto-load-next-post').'">★★★★★</a>' |
|
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | * @param string $text |
316 | 316 | * @return string $text |
317 | 317 | */ |
318 | - public function update_footer( $text ) { |
|
318 | + public function update_footer($text) { |
|
319 | 319 | $screen = get_current_screen(); |
320 | 320 | |
321 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
322 | - return '<p class="alignright">' . sprintf( __( '%s Version', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . ' ' . esc_attr( AUTO_LOAD_NEXT_POST_VERSION ) . '</p>'; |
|
321 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
322 | + return '<p class="alignright">'.sprintf(__('%s Version', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).' '.esc_attr(AUTO_LOAD_NEXT_POST_VERSION).'</p>'; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | return $text; |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | * @since 1.6.0 |
333 | 333 | */ |
334 | 334 | public function sidebar_top() { |
335 | - include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar-logo.php' ); |
|
335 | + include_once(dirname(__FILE__).'/views/html-admin-sidebar-logo.php'); |
|
336 | 336 | |
337 | - do_action( 'auto_load_next_post_sidebar_top' ); |
|
337 | + do_action('auto_load_next_post_sidebar_top'); |
|
338 | 338 | } // END sidebar_top() |
339 | 339 | |
340 | 340 | /** |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | * @since 1.6.0 |
346 | 346 | */ |
347 | 347 | public function upgrade_details() { |
348 | - if ( ! is_alnp_pro_version_installed() ) { |
|
349 | - include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar.php' ); |
|
348 | + if ( ! is_alnp_pro_version_installed()) { |
|
349 | + include_once(dirname(__FILE__).'/views/html-admin-sidebar.php'); |
|
350 | 350 | } |
351 | 351 | } // END upgrade_details() |
352 | 352 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | * @since 1.6.0 |
358 | 358 | */ |
359 | 359 | public function sidebar_bottom() { |
360 | - do_action( 'auto_load_next_post_sidebar_bottom' ); |
|
360 | + do_action('auto_load_next_post_sidebar_bottom'); |
|
361 | 361 | |
362 | - include_once( dirname( __FILE__ ) . '/views/html-admin-sidebar-credits.php' ); |
|
362 | + include_once(dirname(__FILE__).'/views/html-admin-sidebar-credits.php'); |
|
363 | 363 | } // END sidebar_bottom() |
364 | 364 | |
365 | 365 | } // 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() |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | public static function output() { |
157 | 157 | global $current_section, $current_tab; |
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( 'auto_load_next_post_settings_tabs_array', array() ); |
|
162 | + $tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
163 | 163 | |
164 | 164 | // These tabs do not require settings output. |
165 | - $no_settings_req = array( 'extensions', 'videos' ); |
|
165 | + $no_settings_req = array('extensions', 'videos'); |
|
166 | 166 | |
167 | 167 | // Only include settings output if the current tab requires it. |
168 | - if ( ! in_array( $current_tab, $no_settings_req ) ) { |
|
169 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
168 | + if ( ! in_array($current_tab, $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_tab, $tabs ); |
|
172 | + do_action('auto_load_next_post_settings_end', $current_tab, $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,84 +224,84 @@ discard block |
||
224 | 224 | * @version 1.5.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 | 255 | // Custom attribute handling |
256 | 256 | $custom_attributes = array(); |
257 | 257 | |
258 | - if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { |
|
259 | - foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { |
|
260 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
258 | + if ( ! empty($value['custom_attributes']) && is_array($value['custom_attributes'])) { |
|
259 | + foreach ($value['custom_attributes'] as $attribute => $attribute_value) { |
|
260 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | 264 | // Description handling |
265 | - if ( ! empty( $value['desc'] ) ) { |
|
265 | + if ( ! empty($value['desc'])) { |
|
266 | 266 | $description = $value['desc']; |
267 | 267 | } |
268 | 268 | |
269 | - if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ), true ) ) { |
|
270 | - $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>'; |
|
271 | - } elseif ( $description && in_array( $value['type'], array( 'checkbox' ), true ) ) { |
|
272 | - $description = wp_kses_post( $description ); |
|
273 | - } elseif ( $description ) { |
|
274 | - $description = '<p class="description">' . wp_kses_post( $description ) . '</p>'; |
|
269 | + if ($description && in_array($value['type'], array('textarea', 'radio'), true)) { |
|
270 | + $description = '<p style="margin-top:0">'.wp_kses_post($description).'</p>'; |
|
271 | + } elseif ($description && in_array($value['type'], array('checkbox'), true)) { |
|
272 | + $description = wp_kses_post($description); |
|
273 | + } elseif ($description) { |
|
274 | + $description = '<p class="description">'.wp_kses_post($description).'</p>'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Switch based on type |
278 | - switch( $value['type'] ) { |
|
278 | + switch ($value['type']) { |
|
279 | 279 | |
280 | 280 | // Section Titles |
281 | 281 | case 'title': |
282 | - if ( ! empty( $value['title'] ) ) { |
|
283 | - echo '<h2>' . esc_html( $value['title'] ) . '</h2>'; |
|
282 | + if ( ! empty($value['title'])) { |
|
283 | + echo '<h2>'.esc_html($value['title']).'</h2>'; |
|
284 | 284 | } |
285 | - if ( ! empty( $value['desc'] ) ) { |
|
286 | - echo '<div id="' . esc_attr( sanitize_title( $value['id'] ) ) . '-description">'; |
|
287 | - echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) ); |
|
285 | + if ( ! empty($value['desc'])) { |
|
286 | + echo '<div id="'.esc_attr(sanitize_title($value['id'])).'-description">'; |
|
287 | + echo wp_kses_post(wpautop(wptexturize($value['desc']))); |
|
288 | 288 | echo '</div>'; |
289 | 289 | } |
290 | 290 | echo '<table class="form-table">'."\n\n"; |
291 | - if ( ! empty( $value['id'] ) ) { |
|
292 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) ); |
|
291 | + if ( ! empty($value['id'])) { |
|
292 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id'])); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | break; |
296 | 296 | |
297 | 297 | // Section Ends |
298 | 298 | case 'sectionend': |
299 | - if ( ! empty( $value['id'] ) ) { |
|
300 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
299 | + if ( ! empty($value['id'])) { |
|
300 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_end'); |
|
301 | 301 | } |
302 | 302 | echo '</table>'; |
303 | - if ( ! empty( $value['id'] ) ) { |
|
304 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
303 | + if ( ! empty($value['id'])) { |
|
304 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_after'); |
|
305 | 305 | } |
306 | 306 | break; |
307 | 307 | |
@@ -314,22 +314,22 @@ discard block |
||
314 | 314 | case 'time': |
315 | 315 | case 'week': |
316 | 316 | case 'email': |
317 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
317 | + $option_value = self::get_option($value['id'], $value['default']); |
|
318 | 318 | |
319 | 319 | ?><tr valign="top"> |
320 | 320 | <th scope="row" class="titledesc"> |
321 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
321 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
322 | 322 | </th> |
323 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
323 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
324 | 324 | <input |
325 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
326 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
327 | - type="<?php echo esc_attr( $value['type'] ); ?>" |
|
328 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
329 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
330 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
331 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
332 | - <?php echo implode(' ', $custom_attributes ); ?> |
|
325 | + name="<?php echo esc_attr($value['id']); ?>" |
|
326 | + id="<?php echo esc_attr($value['id']); ?>" |
|
327 | + type="<?php echo esc_attr($value['type']); ?>" |
|
328 | + style="<?php echo esc_attr($value['css']); ?>" |
|
329 | + value="<?php echo esc_attr($option_value); ?>" |
|
330 | + class="<?php echo esc_attr($value['class']); ?>" |
|
331 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
332 | + <?php echo implode(' ', $custom_attributes); ?> |
|
333 | 333 | /><?php echo $description; ?> |
334 | 334 | </td> |
335 | 335 | </tr><?php |
@@ -337,23 +337,23 @@ discard block |
||
337 | 337 | |
338 | 338 | // Textarea. |
339 | 339 | case 'textarea': |
340 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
340 | + $option_value = self::get_option($value['id'], $value['default']); |
|
341 | 341 | ?> |
342 | 342 | <tr valign="top"> |
343 | 343 | <th scope="row" class="titledesc"> |
344 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
344 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
345 | 345 | </th> |
346 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
346 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
347 | 347 | <?php echo $description; ?> |
348 | 348 | |
349 | 349 | <textarea |
350 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
351 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
352 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
353 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
354 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
355 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
356 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
350 | + name="<?php echo esc_attr($value['id']); ?>" |
|
351 | + id="<?php echo esc_attr($value['id']); ?>" |
|
352 | + style="<?php echo esc_attr($value['css']); ?>" |
|
353 | + class="<?php echo esc_attr($value['class']); ?>" |
|
354 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
355 | + <?php echo implode(' ', $custom_attributes); ?> |
|
356 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
357 | 357 | </td> |
358 | 358 | </tr> |
359 | 359 | <?php |
@@ -362,35 +362,35 @@ discard block |
||
362 | 362 | // Select boxes. |
363 | 363 | case 'select': |
364 | 364 | case 'multiselect': |
365 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
365 | + $option_value = self::get_option($value['id'], $value['default']); |
|
366 | 366 | ?> |
367 | 367 | <tr valign="top"> |
368 | 368 | <th scope="row" class="titledesc"> |
369 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
369 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
370 | 370 | </th> |
371 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
371 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
372 | 372 | <select |
373 | - name="<?php echo esc_attr( $value['id'] ); ?><?php echo ( 'multiselect' === $value['type'] ) ? '[]' : ''; ?>" |
|
374 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
375 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
376 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
377 | - data-placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
378 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
373 | + name="<?php echo esc_attr($value['id']); ?><?php echo ('multiselect' === $value['type']) ? '[]' : ''; ?>" |
|
374 | + id="<?php echo esc_attr($value['id']); ?>" |
|
375 | + style="<?php echo esc_attr($value['css']); ?>" |
|
376 | + class="<?php echo esc_attr($value['class']); ?>" |
|
377 | + data-placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
378 | + <?php echo implode(' ', $custom_attributes); ?> |
|
379 | 379 | <?php echo 'multiselect' === $value['type'] ? 'multiple="multiple"' : ''; ?> |
380 | 380 | > |
381 | 381 | <?php |
382 | - foreach ( $value['options'] as $key => $val ) { |
|
382 | + foreach ($value['options'] as $key => $val) { |
|
383 | 383 | ?> |
384 | - <option value="<?php echo esc_attr( $key ); ?>" |
|
384 | + <option value="<?php echo esc_attr($key); ?>" |
|
385 | 385 | <?php |
386 | - if ( is_array( $option_value ) ) { |
|
387 | - selected( in_array( (string) $key, $option_value, true ), true ); |
|
386 | + if (is_array($option_value)) { |
|
387 | + selected(in_array((string) $key, $option_value, true), true); |
|
388 | 388 | } else { |
389 | - selected( $option_value, (string) $key ); |
|
389 | + selected($option_value, (string) $key); |
|
390 | 390 | } |
391 | 391 | ?> |
392 | 392 | > |
393 | - <?php echo esc_html( $val ); ?></option> |
|
393 | + <?php echo esc_html($val); ?></option> |
|
394 | 394 | <?php |
395 | 395 | } |
396 | 396 | ?> |
@@ -402,29 +402,29 @@ discard block |
||
402 | 402 | |
403 | 403 | // Radio inputs. |
404 | 404 | case 'radio': |
405 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
405 | + $option_value = self::get_option($value['id'], $value['default']); |
|
406 | 406 | ?> |
407 | 407 | <tr valign="top"> |
408 | 408 | <th scope="row" class="titledesc"> |
409 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
409 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
410 | 410 | </th> |
411 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
411 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
412 | 412 | <fieldset> |
413 | 413 | <?php echo $description; ?> |
414 | 414 | <ul> |
415 | 415 | <?php |
416 | - foreach ( $value['options'] as $key => $val ) { |
|
416 | + foreach ($value['options'] as $key => $val) { |
|
417 | 417 | ?> |
418 | 418 | <li> |
419 | 419 | <label><input |
420 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
421 | - value="<?php echo esc_attr( $key ); ?>" |
|
420 | + name="<?php echo esc_attr($value['id']); ?>" |
|
421 | + value="<?php echo esc_attr($key); ?>" |
|
422 | 422 | type="radio" |
423 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
424 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
425 | - <?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?> |
|
426 | - <?php checked( $key, $option_value ); ?> |
|
427 | - /> <?php echo esc_html( $val ); ?></label> |
|
423 | + style="<?php echo esc_attr($value['css']); ?>" |
|
424 | + class="<?php echo esc_attr($value['class']); ?>" |
|
425 | + <?php echo implode(' ', $custom_attributes); // WPCS: XSS ok. ?> |
|
426 | + <?php checked($key, $option_value); ?> |
|
427 | + /> <?php echo esc_html($val); ?></label> |
|
428 | 428 | </li> |
429 | 429 | <?php |
430 | 430 | } |
@@ -438,58 +438,58 @@ discard block |
||
438 | 438 | |
439 | 439 | // Checkbox input. |
440 | 440 | case 'checkbox': |
441 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
441 | + $option_value = self::get_option($value['id'], $value['default']); |
|
442 | 442 | $visibility_class = array(); |
443 | 443 | |
444 | - if ( ! isset( $value['hide_if_checked'] ) ) { |
|
444 | + if ( ! isset($value['hide_if_checked'])) { |
|
445 | 445 | $value['hide_if_checked'] = false; |
446 | 446 | } |
447 | - if ( ! isset( $value['show_if_checked'] ) ) { |
|
447 | + if ( ! isset($value['show_if_checked'])) { |
|
448 | 448 | $value['show_if_checked'] = false; |
449 | 449 | } |
450 | - if ( 'yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked'] ) { |
|
450 | + if ('yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked']) { |
|
451 | 451 | $visibility_class[] = 'hidden_option'; |
452 | 452 | } |
453 | - if ( 'option' === $value['hide_if_checked'] ) { |
|
453 | + if ('option' === $value['hide_if_checked']) { |
|
454 | 454 | $visibility_class[] = 'hide_options_if_checked'; |
455 | 455 | } |
456 | - if ( 'option' === $value['show_if_checked'] ) { |
|
456 | + if ('option' === $value['show_if_checked']) { |
|
457 | 457 | $visibility_class[] = 'show_options_if_checked'; |
458 | 458 | } |
459 | 459 | |
460 | - if ( ! isset( $value['checkboxgroup'] ) || 'start' === $value['checkboxgroup'] ) { |
|
460 | + if ( ! isset($value['checkboxgroup']) || 'start' === $value['checkboxgroup']) { |
|
461 | 461 | ?> |
462 | - <tr valign="top" class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
463 | - <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?></th> |
|
462 | + <tr valign="top" class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
463 | + <th scope="row" class="titledesc"><?php echo esc_html($value['title']); ?></th> |
|
464 | 464 | <td class="forminp forminp-checkbox"> |
465 | 465 | <fieldset> |
466 | 466 | <?php |
467 | 467 | } else { |
468 | 468 | ?> |
469 | - <fieldset class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
469 | + <fieldset class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
470 | 470 | <?php |
471 | 471 | } |
472 | 472 | |
473 | - if ( ! empty( $value['title'] ) ) { |
|
473 | + if ( ! empty($value['title'])) { |
|
474 | 474 | ?> |
475 | - <legend class="screen-reader-text"><span><?php echo esc_html( $value['title'] ); ?></span></legend> |
|
475 | + <legend class="screen-reader-text"><span><?php echo esc_html($value['title']); ?></span></legend> |
|
476 | 476 | <?php |
477 | 477 | } |
478 | 478 | ?> |
479 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"> |
|
479 | + <label for="<?php echo esc_attr($value['id']); ?>"> |
|
480 | 480 | <input |
481 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
482 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
481 | + name="<?php echo esc_attr($value['id']); ?>" |
|
482 | + id="<?php echo esc_attr($value['id']); ?>" |
|
483 | 483 | type="checkbox" |
484 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
484 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
485 | 485 | value="1" |
486 | - <?php checked( $option_value, 'yes' ); ?> |
|
487 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
486 | + <?php checked($option_value, 'yes'); ?> |
|
487 | + <?php echo implode(' ', $custom_attributes); ?> |
|
488 | 488 | /> <?php echo $description; ?> |
489 | 489 | </label> |
490 | 490 | <?php |
491 | 491 | |
492 | - if ( ! isset( $value['checkboxgroup'] ) || 'end' === $value['checkboxgroup'] ) { |
|
492 | + if ( ! isset($value['checkboxgroup']) || 'end' === $value['checkboxgroup']) { |
|
493 | 493 | ?> |
494 | 494 | </fieldset> |
495 | 495 | </td> |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | // Default: run an action |
506 | 506 | default: |
507 | - do_action( 'auto_load_next_post_admin_field_' . $value['type'], $value ); |
|
507 | + do_action('auto_load_next_post_admin_field_'.$value['type'], $value); |
|
508 | 508 | |
509 | 509 | break; |
510 | 510 | } // end switch() |
@@ -523,8 +523,8 @@ discard block |
||
523 | 523 | * @param array $options Opens array to output |
524 | 524 | * @return bool |
525 | 525 | */ |
526 | - public static function save_fields( $options ) { |
|
527 | - if ( empty( $_POST ) ) { |
|
526 | + public static function save_fields($options) { |
|
527 | + if (empty($_POST)) { |
|
528 | 528 | return false; |
529 | 529 | } |
530 | 530 | |
@@ -533,48 +533,48 @@ discard block |
||
533 | 533 | $autoload_options = array(); |
534 | 534 | |
535 | 535 | // Loop options and get values to save |
536 | - foreach ( $options as $option ) { |
|
537 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
536 | + foreach ($options as $option) { |
|
537 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
538 | 538 | continue; |
539 | 539 | } |
540 | 540 | |
541 | 541 | // Get posted value. |
542 | - if ( strstr( $option['id'], '[' ) ) { |
|
543 | - parse_str( $option['id'], $option_name_array ); |
|
544 | - $option_name = current( array_keys( $option_name_array ) ); |
|
545 | - $setting_name = key( $option_name_array[ $option_name ] ); |
|
546 | - $raw_value = isset( $_POST[ $option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $option_name ][ $setting_name ] ) : null; |
|
542 | + if (strstr($option['id'], '[')) { |
|
543 | + parse_str($option['id'], $option_name_array); |
|
544 | + $option_name = current(array_keys($option_name_array)); |
|
545 | + $setting_name = key($option_name_array[$option_name]); |
|
546 | + $raw_value = isset($_POST[$option_name][$setting_name]) ? wp_unslash($_POST[$option_name][$setting_name]) : null; |
|
547 | 547 | } else { |
548 | 548 | $option_name = $option['id']; |
549 | 549 | $setting_name = ''; |
550 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
550 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
551 | 551 | } |
552 | 552 | |
553 | - switch ( $option['type'] ) { |
|
553 | + switch ($option['type']) { |
|
554 | 554 | case "checkbox" : |
555 | 555 | $value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no'; |
556 | 556 | break; |
557 | 557 | |
558 | 558 | case "textarea" : |
559 | - $value = wp_kses_post( trim( stripslashes( $_POST[$option['id']] ) ) ); |
|
559 | + $value = wp_kses_post(trim(stripslashes($_POST[$option['id']]))); |
|
560 | 560 | break; |
561 | 561 | |
562 | 562 | case "multiselect" : |
563 | - $value = array_filter( array_map( 'auto_load_next_post_clean', (array) $raw_value ) ); |
|
563 | + $value = array_filter(array_map('auto_load_next_post_clean', (array) $raw_value)); |
|
564 | 564 | break; |
565 | 565 | |
566 | 566 | case 'select' : |
567 | - $allowed_values = empty( $option['options'] ) ? array() : array_map( 'strval', array_keys( $option['options'] ) ); |
|
568 | - if ( empty( $option['default'] ) && empty( $allowed_values ) ) { |
|
567 | + $allowed_values = empty($option['options']) ? array() : array_map('strval', array_keys($option['options'])); |
|
568 | + if (empty($option['default']) && empty($allowed_values)) { |
|
569 | 569 | $value = null; |
570 | 570 | break; |
571 | 571 | } |
572 | - $default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] ); |
|
573 | - $value = in_array( $raw_value, $allowed_values, true ) ? $raw_value : $default; |
|
572 | + $default = (empty($option['default']) ? $allowed_values[0] : $option['default']); |
|
573 | + $value = in_array($raw_value, $allowed_values, true) ? $raw_value : $default; |
|
574 | 574 | break; |
575 | 575 | |
576 | 576 | default : |
577 | - $value = auto_load_next_post_clean( $raw_value ); |
|
577 | + $value = auto_load_next_post_clean($raw_value); |
|
578 | 578 | break; |
579 | 579 | } // END switch() |
580 | 580 | |
@@ -583,59 +583,59 @@ discard block |
||
583 | 583 | * |
584 | 584 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
585 | 585 | */ |
586 | - if ( has_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) ) ) { |
|
587 | - if ( is_ajax() ) { |
|
588 | - error_log( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ) . ' is deprecated since version 1.5.0' ); |
|
586 | + if (has_action('auto_load_next_post_update_option_'.sanitize_title($option['type']))) { |
|
587 | + if (is_ajax()) { |
|
588 | + error_log('auto_load_next_post_update_option_'.sanitize_title($option['type']).' is deprecated since version 1.5.0'); |
|
589 | 589 | } else { |
590 | - _deprecated_hook( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), '1.5.0' ); |
|
590 | + _deprecated_hook('auto_load_next_post_update_option_'.sanitize_title($option['type']), '1.5.0'); |
|
591 | 591 | } |
592 | 592 | |
593 | - do_action( 'auto_load_next_post_update_option_' . sanitize_title( $option['type'] ), $option ); |
|
593 | + do_action('auto_load_next_post_update_option_'.sanitize_title($option['type']), $option); |
|
594 | 594 | continue; |
595 | 595 | } |
596 | 596 | |
597 | - if ( is_null( $value ) ) { |
|
597 | + if (is_null($value)) { |
|
598 | 598 | continue; |
599 | 599 | } |
600 | 600 | |
601 | 601 | // Check if option is an array and handle that differently to single values. |
602 | - if ( $option_name && $setting_name ) { |
|
603 | - if ( ! isset( $update_options[ $option_name ] ) ) { |
|
604 | - $update_options[ $option_name ] = get_option( $option_name, array() ); |
|
602 | + if ($option_name && $setting_name) { |
|
603 | + if ( ! isset($update_options[$option_name])) { |
|
604 | + $update_options[$option_name] = get_option($option_name, array()); |
|
605 | 605 | } |
606 | - if ( ! is_array( $update_options[ $option_name ] ) ) { |
|
607 | - $update_options[ $option_name ] = array(); |
|
606 | + if ( ! is_array($update_options[$option_name])) { |
|
607 | + $update_options[$option_name] = array(); |
|
608 | 608 | } |
609 | - $update_options[ $option_name ][ $setting_name ] = $value; |
|
609 | + $update_options[$option_name][$setting_name] = $value; |
|
610 | 610 | } else { |
611 | - $update_options[ $option_name ] = $value; |
|
611 | + $update_options[$option_name] = $value; |
|
612 | 612 | } |
613 | 613 | |
614 | - $autoload_options[ $option_name ] = isset( $option['autoload'] ) ? (bool) $option['autoload'] : true; |
|
614 | + $autoload_options[$option_name] = isset($option['autoload']) ? (bool) $option['autoload'] : true; |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Fire an action before saved. |
618 | 618 | * |
619 | 619 | * @deprecated 1.5.0 - doesn't allow manipulation of values! |
620 | 620 | */ |
621 | - if ( has_action( 'auto_load_next_post_update_option' ) ) { |
|
622 | - if ( is_ajax() ) { |
|
623 | - error_log( 'auto_load_next_post_update_option is deprecated since version 1.5.0' ); |
|
621 | + if (has_action('auto_load_next_post_update_option')) { |
|
622 | + if (is_ajax()) { |
|
623 | + error_log('auto_load_next_post_update_option is deprecated since version 1.5.0'); |
|
624 | 624 | } else { |
625 | - _deprecated_hook( 'auto_load_next_post_update_option', '1.5.0' ); |
|
625 | + _deprecated_hook('auto_load_next_post_update_option', '1.5.0'); |
|
626 | 626 | } |
627 | 627 | |
628 | - do_action( 'auto_load_next_post_update_option', $option ); |
|
628 | + do_action('auto_load_next_post_update_option', $option); |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
632 | 632 | // Now save the options |
633 | - foreach ( $update_options as $name => $value ) { |
|
634 | - update_option( $name, $value, $autoload_options[ $name ] ? 'yes' : 'no' ); |
|
633 | + foreach ($update_options as $name => $value) { |
|
634 | + update_option($name, $value, $autoload_options[$name] ? 'yes' : 'no'); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | // Save all options as an array. Ready for export. |
638 | - update_option( 'auto_load_next_post_options', $update_options ); |
|
638 | + update_option('auto_load_next_post_options', $update_options); |
|
639 | 639 | |
640 | 640 | return true; |
641 | 641 | } // END save_fields() |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | |
12 | -if (!defined('ABSPATH')) exit; |
|
12 | +if ( ! defined('ABSPATH')) exit; |
|
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | -if( !class_exists('Connekt_Plugin_Installer') ) { |
|
16 | +if ( ! class_exists('Connekt_Plugin_Installer')) { |
|
17 | 17 | |
18 | 18 | class Connekt_Plugin_Installer { |
19 | 19 | |
20 | - public function start(){ |
|
21 | - if(!defined('CNKT_INSTALLER_PATH')){ |
|
20 | + public function start() { |
|
21 | + if ( ! defined('CNKT_INSTALLER_PATH')) { |
|
22 | 22 | // Update this constant to use outside the plugins directory |
23 | 23 | define('CNKT_INSTALLER_PATH', plugins_url('/', __FILE__)); |
24 | 24 | } |
25 | - add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_scripts' )); // Enqueue scripts and Localize |
|
26 | - add_action( 'wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer' )); // Install plugin |
|
27 | - add_action( 'wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation' )); // Activate plugin |
|
25 | + add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts')); // Enqueue scripts and Localize |
|
26 | + add_action('wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer')); // Install plugin |
|
27 | + add_action('wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation')); // Activate plugin |
|
28 | 28 | |
29 | 29 | } |
30 | 30 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - public static function init($plugins){ ?> |
|
43 | + public static function init($plugins) { ?> |
|
44 | 44 | |
45 | 45 | <div class="cnkt-plugin-installer"> |
46 | 46 | <?php |
47 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
47 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
48 | 48 | |
49 | - foreach($plugins as $plugin) : |
|
49 | + foreach ($plugins as $plugin) : |
|
50 | 50 | |
51 | 51 | $button_classes = 'install button'; |
52 | 52 | $button_text = __('Install Now', 'framework'); |
53 | 53 | |
54 | - $api = plugins_api( 'plugin_information', |
|
54 | + $api = plugins_api('plugin_information', |
|
55 | 55 | array( |
56 | 56 | 'slug' => sanitize_file_name($plugin['slug']), |
57 | 57 | 'fields' => array( |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | //echo '</pre>'; |
77 | 77 | |
78 | 78 | |
79 | - if ( !is_wp_error( $api ) ) { // confirm error free |
|
79 | + if ( ! is_wp_error($api)) { // confirm error free |
|
80 | 80 | |
81 | 81 | $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin['slug']); // Get main plugin file |
82 | 82 | //echo $main_plugin_file; |
83 | - if(self::check_file_extension($main_plugin_file)){ // check file extension |
|
84 | - if(is_plugin_active($main_plugin_file)){ |
|
83 | + if (self::check_file_extension($main_plugin_file)) { // check file extension |
|
84 | + if (is_plugin_active($main_plugin_file)) { |
|
85 | 85 | // plugin activation, confirmed! |
86 | 86 | $button_classes = 'button disabled'; |
87 | 87 | $button_text = __('Activated', 'framework'); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.0 |
120 | 120 | */ |
121 | - public static function render_template($plugin, $api, $button_text, $button_classes){ |
|
121 | + public static function render_template($plugin, $api, $button_text, $button_classes) { |
|
122 | 122 | ?> |
123 | 123 | <div class="plugin"> |
124 | 124 | <div class="plugin-wrap"> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <a class="<?php echo $button_classes; ?>" |
134 | 134 | data-slug="<?php echo $api->slug; ?>" |
135 | 135 | data-name="<?php echo $api->name; ?>" |
136 | - href="<?php echo get_admin_url(); ?>/update.php?action=install-plugin&plugin=<?php echo $api->slug; ?>&_wpnonce=<?php echo wp_create_nonce('install-plugin_'. $api->slug) ?>"> |
|
136 | + href="<?php echo get_admin_url(); ?>/update.php?action=install-plugin&plugin=<?php echo $api->slug; ?>&_wpnonce=<?php echo wp_create_nonce('install-plugin_'.$api->slug) ?>"> |
|
137 | 137 | <?php echo $button_text; ?> |
138 | 138 | </a> |
139 | 139 | </li> |
@@ -158,27 +158,27 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @since 1.0 |
160 | 160 | */ |
161 | - public function cnkt_plugin_installer(){ |
|
161 | + public function cnkt_plugin_installer() { |
|
162 | 162 | |
163 | - if ( ! current_user_can('install_plugins') ) |
|
164 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'framework' ) ); |
|
163 | + if ( ! current_user_can('install_plugins')) |
|
164 | + wp_die(__('Sorry, you are not allowed to install plugins on this site.', 'framework')); |
|
165 | 165 | |
166 | 166 | $nonce = $_POST["nonce"]; |
167 | 167 | $plugin = $_POST["plugin"]; |
168 | 168 | |
169 | 169 | // Check our nonce, if they don't match then bounce! |
170 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
171 | - wp_die( __( 'Error - unable to verify nonce, please try again.', 'framework') ); |
|
170 | + if ( ! wp_verify_nonce($nonce, 'cnkt_installer_nonce')) |
|
171 | + wp_die(__('Error - unable to verify nonce, please try again.', 'framework')); |
|
172 | 172 | |
173 | 173 | |
174 | 174 | // Include required libs for installation |
175 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
176 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
177 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php' ); |
|
178 | - require_once( ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php' ); |
|
175 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
176 | + require_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
177 | + require_once(ABSPATH.'wp-admin/includes/class-wp-ajax-upgrader-skin.php'); |
|
178 | + require_once(ABSPATH.'wp-admin/includes/class-plugin-upgrader.php'); |
|
179 | 179 | |
180 | 180 | // Get Plugin Info |
181 | - $api = plugins_api( 'plugin_information', |
|
181 | + $api = plugins_api('plugin_information', |
|
182 | 182 | array( |
183 | 183 | 'slug' => $plugin, |
184 | 184 | 'fields' => array( |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | ); |
200 | 200 | |
201 | 201 | $skin = new WP_Ajax_Upgrader_Skin(); |
202 | - $upgrader = new Plugin_Upgrader( $skin ); |
|
202 | + $upgrader = new Plugin_Upgrader($skin); |
|
203 | 203 | $upgrader->install($api->download_link); |
204 | 204 | |
205 | - if($api->name){ |
|
205 | + if ($api->name) { |
|
206 | 206 | $status = 'success'; |
207 | - $msg = $api->name .' successfully installed.'; |
|
207 | + $msg = $api->name.' successfully installed.'; |
|
208 | 208 | } else { |
209 | 209 | $status = 'failed'; |
210 | - $msg = 'There was an error installing '. $api->name .'.'; |
|
210 | + $msg = 'There was an error installing '.$api->name.'.'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $json = array( |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @since 1.0 |
232 | 232 | */ |
233 | - public function cnkt_plugin_activation(){ |
|
234 | - if ( ! current_user_can('install_plugins') ) |
|
235 | - wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'framework' ) ); |
|
233 | + public function cnkt_plugin_activation() { |
|
234 | + if ( ! current_user_can('install_plugins')) |
|
235 | + wp_die(__('Sorry, you are not allowed to activate plugins on this site.', 'framework')); |
|
236 | 236 | |
237 | 237 | $nonce = $_POST["nonce"]; |
238 | 238 | $plugin = $_POST["plugin"]; |
239 | 239 | |
240 | 240 | // Check our nonce, if they don't match then bounce! |
241 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
242 | - die( __( 'Error - unable to verify nonce, please try again.', 'framework' ) ); |
|
241 | + if ( ! wp_verify_nonce($nonce, 'cnkt_installer_nonce')) |
|
242 | + die(__('Error - unable to verify nonce, please try again.', 'framework')); |
|
243 | 243 | |
244 | 244 | |
245 | 245 | // Include required libs for activation |
246 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
247 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
248 | - require_once( ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php' ); |
|
246 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
247 | + require_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
248 | + require_once(ABSPATH.'wp-admin/includes/class-plugin-upgrader.php'); |
|
249 | 249 | |
250 | 250 | |
251 | 251 | // Get Plugin Info |
252 | - $api = plugins_api( 'plugin_information', |
|
252 | + $api = plugins_api('plugin_information', |
|
253 | 253 | array( |
254 | 254 | 'slug' => $plugin, |
255 | 255 | 'fields' => array( |
@@ -270,16 +270,16 @@ discard block |
||
270 | 270 | ); |
271 | 271 | |
272 | 272 | |
273 | - if($api->name){ |
|
273 | + if ($api->name) { |
|
274 | 274 | $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin); |
275 | 275 | $status = 'success'; |
276 | - if($main_plugin_file){ |
|
276 | + if ($main_plugin_file) { |
|
277 | 277 | activate_plugin($main_plugin_file); |
278 | - $msg = $api->name .' successfully activated.'; |
|
278 | + $msg = $api->name.' successfully activated.'; |
|
279 | 279 | } |
280 | 280 | } else { |
281 | 281 | $status = 'failed'; |
282 | - $msg = 'There was an error activating '. $api->name .'.'; |
|
282 | + $msg = 'There was an error activating '.$api->name.'.'; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | $json = array( |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | * @since 1.0 |
306 | 306 | */ |
307 | 307 | |
308 | - public static function get_plugin_file( $plugin_slug ) { |
|
309 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); // Load plugin lib |
|
308 | + public static function get_plugin_file($plugin_slug) { |
|
309 | + require_once(ABSPATH.'/wp-admin/includes/plugin.php'); // Load plugin lib |
|
310 | 310 | $plugins = get_plugins(); |
311 | 311 | |
312 | - foreach( $plugins as $plugin_file => $plugin_info ) { |
|
312 | + foreach ($plugins as $plugin_file => $plugin_info) { |
|
313 | 313 | |
314 | 314 | // Get the basename of the plugin e.g. [askismet]/askismet.php |
315 | - $slug = dirname( plugin_basename( $plugin_file ) ); |
|
315 | + $slug = dirname(plugin_basename($plugin_file)); |
|
316 | 316 | |
317 | - if($slug){ |
|
318 | - if ( $slug == $plugin_slug ) { |
|
317 | + if ($slug) { |
|
318 | + if ($slug == $plugin_slug) { |
|
319 | 319 | return $plugin_file; // If $slug = $plugin_name |
320 | 320 | } |
321 | 321 | } |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @since 1.0 |
338 | 338 | */ |
339 | - public static function check_file_extension( $filename ) { |
|
340 | - if( substr( strrchr($filename, '.' ), 1 ) === 'php' ){ |
|
339 | + public static function check_file_extension($filename) { |
|
340 | + if (substr(strrchr($filename, '.'), 1) === 'php') { |
|
341 | 341 | // has .php exension |
342 | 342 | return true; |
343 | 343 | } else { |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - public function enqueue_scripts(){ |
|
360 | - wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.js', array( 'jquery' )); |
|
361 | - wp_localize_script( 'plugin-installer', 'cnkt_installer_localize', array( |
|
359 | + public function enqueue_scripts() { |
|
360 | + wp_enqueue_script('plugin-installer', CNKT_INSTALLER_PATH.'assets/installer.js', array('jquery')); |
|
361 | + wp_localize_script('plugin-installer', 'cnkt_installer_localize', array( |
|
362 | 362 | 'ajax_url' => admin_url('admin-ajax.php'), |
363 | 363 | 'admin_nonce' => wp_create_nonce('cnkt_installer_nonce'), |
364 | 364 | 'install_now' => __('Are you sure you want to install this plugin?', 'framework'), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'installed_btn' => __('Activated', 'framework') |
368 | 368 | )); |
369 | 369 | |
370 | - wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.css'); |
|
370 | + wp_enqueue_style('plugin-installer', CNKT_INSTALLER_PATH.'assets/installer.css'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | } |