@@ -12,16 +12,16 @@ 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 | 19 | // Exit if WP_Customize_Control does not exsist. |
20 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
20 | +if ( ! class_exists('WP_Customize_Control')) { |
|
21 | 21 | return null; |
22 | 22 | } |
23 | 23 | |
24 | -if ( !class_exists( 'Auto_Load_Next_Post_Pro_Preview_Controller' ) ) { |
|
24 | +if ( ! class_exists('Auto_Load_Next_Post_Pro_Preview_Controller')) { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * The 'alnp_pro_preview' for Auto Load Next Post Pro control class. |
@@ -42,35 +42,35 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function render_content() { |
44 | 44 | ?> |
45 | - <span class="customize-control-title"><?php esc_html_e( $this->label ); ?></span> |
|
45 | + <span class="customize-control-title"><?php esc_html_e($this->label); ?></span> |
|
46 | 46 | |
47 | 47 | <p> |
48 | - <?php printf( esc_html__( '%1$s is coming soon and will come with more powerful features. Here are just a few of them you can look forward to.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post Pro', 'auto-load-next-post' ) ); ?> |
|
48 | + <?php printf(esc_html__('%1$s is coming soon and will come with more powerful features. Here are just a few of them you can look forward to.', 'auto-load-next-post'), esc_html__('Auto Load Next Post Pro', 'auto-load-next-post')); ?> |
|
49 | 49 | </p> |
50 | 50 | |
51 | 51 | <ul style="list-style: disc; margin-left: 1em;"> |
52 | - <li><?php _e( 'User Role Restrictions', 'auto-load-next-post' ); ?></li> |
|
53 | - <li><?php _e( 'Custom Post Type Support', 'auto-load-next-post' ); ?></li> |
|
54 | - <li><?php _e( 'Media Attachment Support', 'auto-load-next-post' ); ?></li> |
|
55 | - <li><?php _e( 'Limit Posts per Session', 'auto-load-next-post' ); ?></li> |
|
56 | - <li><?php _e( 'Query Posts by Category or Tag', 'auto-load-next-post' ); ?></li> |
|
52 | + <li><?php _e('User Role Restrictions', 'auto-load-next-post'); ?></li> |
|
53 | + <li><?php _e('Custom Post Type Support', 'auto-load-next-post'); ?></li> |
|
54 | + <li><?php _e('Media Attachment Support', 'auto-load-next-post'); ?></li> |
|
55 | + <li><?php _e('Limit Posts per Session', 'auto-load-next-post'); ?></li> |
|
56 | + <li><?php _e('Query Posts by Category or Tag', 'auto-load-next-post'); ?></li> |
|
57 | 57 | </ul> |
58 | 58 | |
59 | 59 | <p> |
60 | - <?php printf( esc_html__( 'Find out more about %1$s%2$s%3$s.', 'auto-load-next-post'), '<a target="_blank" href="' . esc_url( 'https://autoloadnextpost.com/pro/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview' ) . '">', esc_html__( 'Auto Load Next Post Pro', 'auto-load-next-post' ), '</a>' ); ?> |
|
60 | + <?php printf(esc_html__('Find out more about %1$s%2$s%3$s.', 'auto-load-next-post'), '<a target="_blank" href="'.esc_url('https://autoloadnextpost.com/pro/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview').'">', esc_html__('Auto Load Next Post Pro', 'auto-load-next-post'), '</a>'); ?> |
|
61 | 61 | </p> |
62 | 62 | |
63 | - <span class="customize-control-title"><?php printf( esc_html__( 'Add-ons for %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></span> |
|
63 | + <span class="customize-control-title"><?php printf(esc_html__('Add-ons for %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></span> |
|
64 | 64 | |
65 | 65 | <p> |
66 | - <?php printf( esc_html__( 'Add-ons available provide additional support or options for %1$s. %2$sCheck out the add-ons%3$s to see what is available.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a target="_blank" href="' . esc_url( 'https://autoloadnextpost.com/add-ons/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview' ) . '">', '</a>' ); ?> |
|
66 | + <?php printf(esc_html__('Add-ons available provide additional support or options for %1$s. %2$sCheck out the add-ons%3$s to see what is available.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a target="_blank" href="'.esc_url('https://autoloadnextpost.com/add-ons/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview').'">', '</a>'); ?> |
|
67 | 67 | </p> |
68 | 68 | |
69 | - <span class="customize-control-title"><?php printf( esc_html__( 'Enjoying %s?', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></span> |
|
69 | + <span class="customize-control-title"><?php printf(esc_html__('Enjoying %s?', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></span> |
|
70 | 70 | |
71 | 71 | <div class="notice inline notice-info"> |
72 | 72 | <p> |
73 | - <?php printf( esc_html__( 'Why not leave me a review on %1$sWordPress.org%2$s? I\'d really appreciate it!', 'auto-load-next-post' ), '<a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform">', '</a>' ); ?> |
|
73 | + <?php printf(esc_html__('Why not leave me a review on %1$sWordPress.org%2$s? I\'d really appreciate it!', 'auto-load-next-post'), '<a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform">', '</a>'); ?> |
|
74 | 74 | </p> |
75 | 75 | </div> |
76 | 76 | <?php |
@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="notice notice-error auto-load-next-post-message"> |
18 | - <p><?php echo sprintf( __( 'It seems that not all of the required theme selectors have been set. These theme selectors are required in order for %1$s to work. %2$sHow to find my theme selectors?%3$s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-theme-selectors" target="_blank">', '</a>' ); ?></p> |
|
18 | + <p><?php echo sprintf(__('It seems that not all of the required theme selectors have been set. These theme selectors are required in order for %1$s to work. %2$sHow to find my theme selectors?%3$s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-theme-selectors" target="_blank">', '</a>'); ?></p> |
|
19 | 19 | </div> |
@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="notice notice-info auto-load-next-post-message"> |
18 | - <p><?php echo sprintf( __( 'This theme supports %s. No need to change the theme selectors as they have already been set by the theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
18 | + <p><?php echo sprintf(__('This theme supports %s. No need to change the theme selectors as they have already been set by the theme.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
19 | 19 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | <div class="notice notice-success auto-load-next-post-notice is-dismissible"> |
20 | 20 | <div class="auto-load-next-post-notice-inner"> |
21 | 21 | <div class="auto-load-next-post-notice-icon"> |
22 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
22 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
23 | 23 | </div> |
24 | 24 | |
25 | 25 | <div class="auto-load-next-post-notice-content"> |
26 | - <h3><?php echo esc_html__( 'Congratulations!', 'auto-load-next-post' ); ?></h3> |
|
27 | - <p><?php echo sprintf( __( 'Your current theme <strong>%1$s</strong> is supported. %2$s is ready to increase your pageviews. There is nothing else to setup so your good to go.', 'auto-load-next-post' ), $active_theme->name, esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
26 | + <h3><?php echo esc_html__('Congratulations!', 'auto-load-next-post'); ?></h3> |
|
27 | + <p><?php echo sprintf(__('Your current theme <strong>%1$s</strong> is supported. %2$s is ready to increase your pageviews. There is nothing else to setup so your good to go.', 'auto-load-next-post'), $active_theme->name, esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | </div> |
@@ -11,24 +11,24 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div class="notice notice-info auto-load-next-post-notice"> |
19 | 19 | <div class="auto-load-next-post-notice-inner"> |
20 | 20 | <div class="auto-load-next-post-notice-icon"> |
21 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
21 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
22 | 22 | </div> |
23 | 23 | |
24 | 24 | <div class="auto-load-next-post-notice-content"> |
25 | - <h3><?php echo esc_html__( 'Thanks for trying out this beta!', 'auto-load-next-post' ); ?></h3> |
|
26 | - <p><?php printf( esc_html__( 'If you have any questions about the beta or if you have any feedback at all, let me know. Any little bit you\'re willing to share helps. You can %1$sjoin the Slack channel%2$s to provide feedback, discuss features to be added and integrations to support. Or you can just give feedback the old fashion way pressing the big button on the side.', 'auto-load-next-post' ), '<a href="' . esc_url( 'https://launchpass.com/autoloadnextpost' ) . '" target="_blank">', '</a>' ); ?></p> |
|
25 | + <h3><?php echo esc_html__('Thanks for trying out this beta!', 'auto-load-next-post'); ?></h3> |
|
26 | + <p><?php printf(esc_html__('If you have any questions about the beta or if you have any feedback at all, let me know. Any little bit you\'re willing to share helps. You can %1$sjoin the Slack channel%2$s to provide feedback, discuss features to be added and integrations to support. Or you can just give feedback the old fashion way pressing the big button on the side.', 'auto-load-next-post'), '<a href="'.esc_url('https://launchpass.com/autoloadnextpost').'" target="_blank">', '</a>'); ?></p> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="auto-load-next-post-send-feedback"> |
30 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url( 'https://autoloadnextpost.com/contact/' ), esc_html__( 'Give Feedback', 'auto-load-next-post' ) ); ?> |
|
31 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_beta_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Ask me again in 7 days', 'auto-load-next-post' ); ?></a> |
|
30 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url('https://autoloadnextpost.com/contact/'), esc_html__('Give Feedback', 'auto-load-next-post')); ?> |
|
31 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_beta_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Ask me again in 7 days', 'auto-load-next-post'); ?></a> |
|
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | </div> |
@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="notice notice-error auto-load-next-post-message"> |
18 | - <p><?php echo sprintf( __( 'In order to remove comments we need to know what the comments container is. Please identify the comments container under <strong>Theme Selectors</strong>. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post' ), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-misc" target="_blank">', '</a>' ); ?></p> |
|
18 | + <p><?php echo sprintf(__('In order to remove comments we need to know what the comments container is. Please identify the comments container under <strong>Theme Selectors</strong>. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post'), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-misc" target="_blank">', '</a>'); ?></p> |
|
19 | 19 | </div> |
@@ -11,28 +11,28 @@ |
||
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 | $current_user = wp_get_current_user(); |
19 | 19 | |
20 | -$time = auto_load_next_post_seconds_to_words( time() - $install_date ); |
|
20 | +$time = auto_load_next_post_seconds_to_words(time() - $install_date); |
|
21 | 21 | ?> |
22 | 22 | <div class="notice notice-info auto-load-next-post-notice"> |
23 | 23 | <div class="auto-load-next-post-notice-inner"> |
24 | 24 | <div class="auto-load-next-post-notice-icon"> |
25 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
25 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class="auto-load-next-post-notice-content"> |
29 | - <h3><?php echo esc_html__( 'Are you enjoying Auto Load Next Post?', 'auto-load-next-post' ); ?></h3> |
|
30 | - <p><?php printf( esc_html__( 'You have been using %1$s for %2$s now! Mind leaving a quick review and let me know know what you think of the plugin? I\'d really appreciate it!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), esc_html( $time ) ); ?></p> |
|
29 | + <h3><?php echo esc_html__('Are you enjoying Auto Load Next Post?', 'auto-load-next-post'); ?></h3> |
|
30 | + <p><?php printf(esc_html__('You have been using %1$s for %2$s now! Mind leaving a quick review and let me know know what you think of the plugin? I\'d really appreciate it!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), esc_html($time)); ?></p> |
|
31 | 31 | </div> |
32 | 32 | |
33 | 33 | <div class="auto-load-next-post-review-now"> |
34 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-review-button" target="_blank">%2$s</a>', esc_url( 'https://wordpress.org/support/plugin/auto-load-next-post/reviews?rate=5#new-post' ), esc_html__( 'Leave a Review', 'auto-load-next-post' ) ); ?> |
|
35 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_review_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'No thank you / I already have', 'auto-load-next-post' ); ?></a> |
|
34 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-review-button" target="_blank">%2$s</a>', esc_url('https://wordpress.org/support/plugin/auto-load-next-post/reviews?rate=5#new-post'), esc_html__('Leave a Review', 'auto-load-next-post')); ?> |
|
35 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_review_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('No thank you / I already have', 'auto-load-next-post'); ?></a> |
|
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | </div> |
@@ -10,31 +10,31 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="notice notice-success auto-load-next-post-notice"> |
18 | 18 | <div class="auto-load-next-post-notice-inner"> |
19 | 19 | <div class="auto-load-next-post-notice-icon"> |
20 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
20 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
21 | 21 | </div> |
22 | 22 | |
23 | 23 | <div class="auto-load-next-post-notice-content"> |
24 | - <h3><?php echo esc_html__( 'Welcome!', 'auto-load-next-post' ); ?></h3> |
|
24 | + <h3><?php echo esc_html__('Welcome!', 'auto-load-next-post'); ?></h3> |
|
25 | 25 | <p> |
26 | - <?php echo sprintf( __( 'Thank you for activating %1$s! If you\'re a first time user, welcome! You\'re well on your way to increasing your pageviews.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?> |
|
26 | + <?php echo sprintf(__('Thank you for activating %1$s! If you\'re a first time user, welcome! You\'re well on your way to increasing your pageviews.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?> |
|
27 | 27 | <?php |
28 | 28 | // If the theme has not added support then encourage the user to see the documentation. |
29 | - if ( !is_alnp_supported() ) { |
|
29 | + if ( ! is_alnp_supported()) { |
|
30 | 30 | $query = array( |
31 | 31 | 'autofocus[panel]' => 'alnp', |
32 | 32 | 'autofocus[section]' => 'auto_load_next_post_theme_selectors', |
33 | 33 | 'url' => ALNP_Customizer::alnp_get_random_page_permalink(), |
34 | - 'return' => admin_url( 'options-general.php?page=auto-load-next-post-settings' ), |
|
34 | + 'return' => admin_url('options-general.php?page=auto-load-next-post-settings'), |
|
35 | 35 | ); |
36 | - $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) ); |
|
37 | - echo sprintf( __( 'I encourage you to check out the plugin documentation and getting started with %1$ssetting up your theme selectors%2$s.', 'auto-load-next-post' ), '<a href="' . esc_url( $customizer_link ) . '">', '</a>' ); |
|
36 | + $customizer_link = add_query_arg($query, admin_url('customize.php')); |
|
37 | + echo sprintf(__('I encourage you to check out the plugin documentation and getting started with %1$ssetting up your theme selectors%2$s.', 'auto-load-next-post'), '<a href="'.esc_url($customizer_link).'">', '</a>'); |
|
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | </p> |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <div class="auto-load-next-post-documentation"> |
44 | 44 | <?php |
45 | 45 | // If the theme has not added support then display button to documentation. |
46 | - if ( !is_alnp_supported() ) { |
|
47 | - printf( '<a href="%1$s" class="button button-primary auto-load-next-post-documentation-button" target="_blank">%2$s</a>', esc_url( 'https://autoloadnextpost.com/documentation/?utm_source=plugin&utm_medium=link&utm_campaign=welcome-notice' ), esc_html__( 'Documentation', 'auto-load-next-post' ) ); |
|
46 | + if ( ! is_alnp_supported()) { |
|
47 | + printf('<a href="%1$s" class="button button-primary auto-load-next-post-documentation-button" target="_blank">%2$s</a>', esc_url('https://autoloadnextpost.com/documentation/?utm_source=plugin&utm_medium=link&utm_campaign=welcome-notice'), esc_html__('Documentation', 'auto-load-next-post')); |
|
48 | 48 | } |
49 | 49 | ?> |
50 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_welcome_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Dismiss Notice', 'auto-load-next-post' ); ?></a> |
|
50 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_welcome_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Dismiss Notice', 'auto-load-next-post'); ?></a> |
|
51 | 51 | </div> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists('Auto_Load_Next_Post_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,15 +56,15 @@ 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'); |
|
64 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-theme-selectors.php'); |
|
65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-misc.php'); |
|
66 | 66 | |
67 | - self::$settings = apply_filters( 'auto_load_next_post_get_settings_pages', $settings ); |
|
67 | + self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return self::$settings; |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | public static function save() { |
83 | 83 | global $current_tab; |
84 | 84 | |
85 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
85 | + check_admin_referer('auto-load-next-post-settings'); |
|
86 | 86 | |
87 | 87 | // Trigger actions |
88 | - do_action( 'auto_load_next_post_settings_save_' . $current_tab ); |
|
89 | - do_action( 'auto_load_next_post_update_options_' . $current_tab ); |
|
90 | - do_action( 'auto_load_next_post_update_options' ); |
|
88 | + do_action('auto_load_next_post_settings_save_'.$current_tab); |
|
89 | + do_action('auto_load_next_post_update_options_'.$current_tab); |
|
90 | + do_action('auto_load_next_post_update_options'); |
|
91 | 91 | |
92 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
92 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
93 | 93 | |
94 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
94 | + do_action('auto_load_next_post_settings_saved'); |
|
95 | 95 | } // END save() |
96 | 96 | |
97 | 97 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @since 1.0.0 |
103 | 103 | * @param string $text Message |
104 | 104 | */ |
105 | - public static function add_message( $text ) { |
|
105 | + public static function add_message($text) { |
|
106 | 106 | self::$messages[] = $text; |
107 | 107 | } // END add_message() |
108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @since 1.0.0 |
115 | 115 | * @param string $text Error |
116 | 116 | */ |
117 | - public static function add_error( $text ) { |
|
117 | + public static function add_error($text) { |
|
118 | 118 | self::$errors[] = $text; |
119 | 119 | } // END add_error() |
120 | 120 | |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | * @return string |
128 | 128 | */ |
129 | 129 | public static function show_messages() { |
130 | - if ( count( self::$errors ) > 0 ) { |
|
131 | - foreach ( self::$errors as $error ) { |
|
132 | - echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
130 | + if (count(self::$errors) > 0) { |
|
131 | + foreach (self::$errors as $error) { |
|
132 | + echo '<div id="message" class="error inline"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
133 | 133 | } |
134 | - } elseif ( count( self::$messages ) > 0 ) { |
|
135 | - foreach ( self::$messages as $message ) { |
|
136 | - echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
134 | + } elseif (count(self::$messages) > 0) { |
|
135 | + foreach (self::$messages as $message) { |
|
136 | + echo '<div id="message" class="updated inline"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } // END show_messages() |
@@ -155,18 +155,18 @@ discard block |
||
155 | 155 | public static function output() { |
156 | 156 | global $current_section, $current_tab; |
157 | 157 | |
158 | - do_action( 'auto_load_next_post_settings_start' ); |
|
158 | + do_action('auto_load_next_post_settings_start'); |
|
159 | 159 | |
160 | - wp_enqueue_script( 'auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
160 | + wp_enqueue_script('auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
161 | 161 | |
162 | - wp_localize_script( 'auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
163 | - 'i18n_nav_warning' => __( 'The changes you have made will be lost if you navigate away from this page before saving.', 'auto-load-next-post' ), |
|
164 | - ) ); |
|
162 | + wp_localize_script('auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
163 | + 'i18n_nav_warning' => __('The changes you have made will be lost if you navigate away from this page before saving.', 'auto-load-next-post'), |
|
164 | + )); |
|
165 | 165 | |
166 | 166 | // Get tabs for the settings page |
167 | - $tabs = apply_filters( 'auto_load_next_post_settings_tabs_array', array() ); |
|
167 | + $tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
168 | 168 | |
169 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
169 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
170 | 170 | } // END output() |
171 | 171 | |
172 | 172 | /** |
@@ -178,33 +178,33 @@ discard block |
||
178 | 178 | * @param mixed $option_name |
179 | 179 | * @return string |
180 | 180 | */ |
181 | - public static function get_option( $option_name, $default = '' ) { |
|
181 | + public static function get_option($option_name, $default = '') { |
|
182 | 182 | // Array value |
183 | - if ( strstr( $option_name, '[' ) ) { |
|
184 | - parse_str( $option_name, $option_array ); |
|
183 | + if (strstr($option_name, '[')) { |
|
184 | + parse_str($option_name, $option_array); |
|
185 | 185 | |
186 | 186 | // Option name is first key |
187 | - $option_name = current( array_keys( $option_array ) ); |
|
187 | + $option_name = current(array_keys($option_array)); |
|
188 | 188 | |
189 | 189 | // Get value |
190 | - $option_values = get_option( $option_name, '' ); |
|
190 | + $option_values = get_option($option_name, ''); |
|
191 | 191 | |
192 | - $key = key( $option_array[$option_name] ); |
|
192 | + $key = key($option_array[$option_name]); |
|
193 | 193 | |
194 | - if ( isset( $option_values[$key] ) ) { |
|
194 | + if (isset($option_values[$key])) { |
|
195 | 195 | $option_value = $option_values[$key]; |
196 | 196 | } else { |
197 | 197 | $option_value = null; |
198 | 198 | } |
199 | 199 | // Single value |
200 | 200 | } else { |
201 | - $option_value = get_option( $option_name, null ); |
|
201 | + $option_value = get_option($option_name, null); |
|
202 | 202 | } |
203 | 203 | |
204 | - if ( is_array( $option_value ) ) { |
|
205 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
206 | - } elseif ( ! is_null( $option_value ) ) { |
|
207 | - $option_value = stripslashes( $option_value ); |
|
204 | + if (is_array($option_value)) { |
|
205 | + $option_value = array_map('stripslashes', $option_value); |
|
206 | + } elseif ( ! is_null($option_value)) { |
|
207 | + $option_value = stripslashes($option_value); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return $option_value === null ? $default : $option_value; |
@@ -221,103 +221,103 @@ discard block |
||
221 | 221 | * @version 1.5.0 |
222 | 222 | * @param array $options Opens array to output |
223 | 223 | */ |
224 | - public static function output_fields( $options ) { |
|
225 | - foreach ( $options as $value ) { |
|
226 | - if ( ! isset( $value['type'] ) ) { |
|
224 | + public static function output_fields($options) { |
|
225 | + foreach ($options as $value) { |
|
226 | + if ( ! isset($value['type'])) { |
|
227 | 227 | continue; |
228 | 228 | } |
229 | - if ( ! isset( $value['id'] ) ) { |
|
229 | + if ( ! isset($value['id'])) { |
|
230 | 230 | $value['id'] = ''; |
231 | 231 | } |
232 | - if ( ! isset( $value['title'] ) ) { |
|
233 | - $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
232 | + if ( ! isset($value['title'])) { |
|
233 | + $value['title'] = isset($value['name']) ? $value['name'] : ''; |
|
234 | 234 | } |
235 | - if ( ! isset( $value['class'] ) ) { |
|
235 | + if ( ! isset($value['class'])) { |
|
236 | 236 | $value['class'] = ''; |
237 | 237 | } |
238 | - if ( ! isset( $value['css'] ) ) { |
|
238 | + if ( ! isset($value['css'])) { |
|
239 | 239 | $value['css'] = ''; |
240 | 240 | } |
241 | - if ( ! isset( $value['default'] ) ) { |
|
241 | + if ( ! isset($value['default'])) { |
|
242 | 242 | $value['default'] = ''; |
243 | 243 | } |
244 | - if ( ! isset( $value['desc'] ) ) { |
|
244 | + if ( ! isset($value['desc'])) { |
|
245 | 245 | $value['desc'] = ''; |
246 | 246 | } |
247 | - if ( ! isset( $value['placeholder'] ) ) { |
|
247 | + if ( ! isset($value['placeholder'])) { |
|
248 | 248 | $value['placeholder'] = ''; |
249 | 249 | } |
250 | 250 | |
251 | 251 | // Custom attribute handling |
252 | 252 | $custom_attributes = array(); |
253 | 253 | |
254 | - if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { |
|
255 | - foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { |
|
256 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
254 | + if ( ! empty($value['custom_attributes']) && is_array($value['custom_attributes'])) { |
|
255 | + foreach ($value['custom_attributes'] as $attribute => $attribute_value) { |
|
256 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | // Description handling |
261 | - if ( ! empty( $value['desc'] ) ) { |
|
261 | + if ( ! empty($value['desc'])) { |
|
262 | 262 | $description = $value['desc']; |
263 | 263 | } |
264 | 264 | |
265 | - if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ), true ) ) { |
|
266 | - $description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>'; |
|
267 | - } elseif ( $description && in_array( $value['type'], array( 'checkbox' ), true ) ) { |
|
268 | - $description = wp_kses_post( $description ); |
|
269 | - } elseif ( $description ) { |
|
270 | - $description = '<p class="description">' . wp_kses_post( $description ) . '</p>'; |
|
265 | + if ($description && in_array($value['type'], array('textarea', 'radio'), true)) { |
|
266 | + $description = '<p style="margin-top:0">'.wp_kses_post($description).'</p>'; |
|
267 | + } elseif ($description && in_array($value['type'], array('checkbox'), true)) { |
|
268 | + $description = wp_kses_post($description); |
|
269 | + } elseif ($description) { |
|
270 | + $description = '<p class="description">'.wp_kses_post($description).'</p>'; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Switch based on type |
274 | - switch( $value['type'] ) { |
|
274 | + switch ($value['type']) { |
|
275 | 275 | |
276 | 276 | // Section Titles |
277 | 277 | case 'title': |
278 | - if ( ! empty( $value['title'] ) ) { |
|
279 | - echo '<h2>' . esc_html( $value['title'] ) . '</h2>'; |
|
278 | + if ( ! empty($value['title'])) { |
|
279 | + echo '<h2>'.esc_html($value['title']).'</h2>'; |
|
280 | 280 | } |
281 | - if ( ! empty( $value['desc'] ) ) { |
|
282 | - echo wp_kses_post( wpautop( wptexturize( $value['desc'] ) ) ); |
|
281 | + if ( ! empty($value['desc'])) { |
|
282 | + echo wp_kses_post(wpautop(wptexturize($value['desc']))); |
|
283 | 283 | } |
284 | 284 | echo '<table class="form-table">'."\n\n"; |
285 | - if ( ! empty( $value['id'] ) ) { |
|
286 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) ); |
|
285 | + if ( ! empty($value['id'])) { |
|
286 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id'])); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | break; |
290 | 290 | |
291 | 291 | // Section Ends |
292 | 292 | case 'sectionend': |
293 | - if ( ! empty( $value['id'] ) ) { |
|
294 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
293 | + if ( ! empty($value['id'])) { |
|
294 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_end'); |
|
295 | 295 | } |
296 | 296 | echo '</table>'; |
297 | - if ( ! empty( $value['id'] ) ) { |
|
298 | - do_action( 'auto_load_next_post_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
297 | + if ( ! empty($value['id'])) { |
|
298 | + do_action('auto_load_next_post_settings_'.sanitize_title($value['id']).'_after'); |
|
299 | 299 | } |
300 | 300 | break; |
301 | 301 | |
302 | 302 | // Standard text inputs and subtypes like 'number' |
303 | 303 | case 'text': |
304 | 304 | case 'number': |
305 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
305 | + $option_value = self::get_option($value['id'], $value['default']); |
|
306 | 306 | |
307 | 307 | ?><tr valign="top"> |
308 | 308 | <th scope="row" class="titledesc"> |
309 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
309 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
310 | 310 | </th> |
311 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
311 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
312 | 312 | <input |
313 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
314 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
315 | - type="<?php echo esc_attr( $value['type'] ); ?>" |
|
316 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
317 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
318 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
319 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
320 | - <?php echo implode(' ', $custom_attributes ); ?> |
|
313 | + name="<?php echo esc_attr($value['id']); ?>" |
|
314 | + id="<?php echo esc_attr($value['id']); ?>" |
|
315 | + type="<?php echo esc_attr($value['type']); ?>" |
|
316 | + style="<?php echo esc_attr($value['css']); ?>" |
|
317 | + value="<?php echo esc_attr($option_value); ?>" |
|
318 | + class="<?php echo esc_attr($value['class']); ?>" |
|
319 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
320 | + <?php echo implode(' ', $custom_attributes); ?> |
|
321 | 321 | /><?php echo $description; ?> |
322 | 322 | </td> |
323 | 323 | </tr><?php |
@@ -325,22 +325,22 @@ discard block |
||
325 | 325 | |
326 | 326 | // Textarea. |
327 | 327 | case 'textarea': |
328 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
328 | + $option_value = self::get_option($value['id'], $value['default']); |
|
329 | 329 | ?> |
330 | 330 | <tr valign="top"> |
331 | 331 | <th scope="row" class="titledesc"> |
332 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
332 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
333 | 333 | </th> |
334 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
334 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
335 | 335 | <?php echo $description; ?> |
336 | 336 | <textarea |
337 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
338 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
339 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
340 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
341 | - placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" |
|
342 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
343 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
337 | + name="<?php echo esc_attr($value['id']); ?>" |
|
338 | + id="<?php echo esc_attr($value['id']); ?>" |
|
339 | + style="<?php echo esc_attr($value['css']); ?>" |
|
340 | + class="<?php echo esc_attr($value['class']); ?>" |
|
341 | + placeholder="<?php echo esc_attr($value['placeholder']); ?>" |
|
342 | + <?php echo implode(' ', $custom_attributes); ?> |
|
343 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
344 | 344 | </td> |
345 | 345 | </tr> |
346 | 346 | <?php |
@@ -349,30 +349,30 @@ discard block |
||
349 | 349 | // Select boxes. |
350 | 350 | case 'select': |
351 | 351 | case 'multiselect': |
352 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
352 | + $option_value = self::get_option($value['id'], $value['default']); |
|
353 | 353 | ?> |
354 | 354 | <tr valign="top"> |
355 | 355 | <th scope="row" class="titledesc"> |
356 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
356 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
357 | 357 | </th> |
358 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
358 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
359 | 359 | <select |
360 | - name="<?php echo esc_attr( $value['id'] ); ?><?php echo ( 'multiselect' === $value['type'] ) ? '[]' : ''; ?>" |
|
361 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
362 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
363 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
364 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
360 | + name="<?php echo esc_attr($value['id']); ?><?php echo ('multiselect' === $value['type']) ? '[]' : ''; ?>" |
|
361 | + id="<?php echo esc_attr($value['id']); ?>" |
|
362 | + style="<?php echo esc_attr($value['css']); ?>" |
|
363 | + class="<?php echo esc_attr($value['class']); ?>" |
|
364 | + <?php echo implode(' ', $custom_attributes); ?> |
|
365 | 365 | <?php echo 'multiselect' === $value['type'] ? 'multiple="multiple"' : ''; ?>> |
366 | - <?php foreach ( $value['options'] as $key => $val ) { ?> |
|
367 | - <option value="<?php echo esc_attr( $key ); ?>" |
|
366 | + <?php foreach ($value['options'] as $key => $val) { ?> |
|
367 | + <option value="<?php echo esc_attr($key); ?>" |
|
368 | 368 | <?php |
369 | - if ( is_array( $option_value ) ) { |
|
370 | - selected( in_array( (string) $key, $option_value, true ), true ); |
|
369 | + if (is_array($option_value)) { |
|
370 | + selected(in_array((string) $key, $option_value, true), true); |
|
371 | 371 | } else { |
372 | - selected( $option_value, (string) $key ); |
|
372 | + selected($option_value, (string) $key); |
|
373 | 373 | } |
374 | 374 | ?>> |
375 | - <?php echo esc_html( $val ); ?></option> |
|
375 | + <?php echo esc_html($val); ?></option> |
|
376 | 376 | <?php |
377 | 377 | } |
378 | 378 | ?> |
@@ -384,28 +384,28 @@ discard block |
||
384 | 384 | |
385 | 385 | // Radio inputs. |
386 | 386 | case 'radio': |
387 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
387 | + $option_value = self::get_option($value['id'], $value['default']); |
|
388 | 388 | ?> |
389 | 389 | <tr valign="top"> |
390 | 390 | <th scope="row" class="titledesc"> |
391 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label> |
|
391 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_html($value['title']); ?></label> |
|
392 | 392 | </th> |
393 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>"> |
|
393 | + <td class="forminp forminp-<?php echo esc_attr(sanitize_title($value['type'])); ?>"> |
|
394 | 394 | <fieldset> |
395 | 395 | <?php echo $description; ?> |
396 | 396 | <ul> |
397 | - <?php foreach ( $value['options'] as $key => $val ) { ?> |
|
397 | + <?php foreach ($value['options'] as $key => $val) { ?> |
|
398 | 398 | <li> |
399 | 399 | <label> |
400 | 400 | <input |
401 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
402 | - value="<?php echo esc_attr( $key ); ?>" |
|
401 | + name="<?php echo esc_attr($value['id']); ?>" |
|
402 | + value="<?php echo esc_attr($key); ?>" |
|
403 | 403 | type="radio" |
404 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
405 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
406 | - <?php echo implode( ' ', $custom_attributes ); // WPCS: XSS ok. ?> |
|
407 | - <?php checked( $key, $option_value ); ?> |
|
408 | - /> <?php echo esc_html( $val ); ?> |
|
404 | + style="<?php echo esc_attr($value['css']); ?>" |
|
405 | + class="<?php echo esc_attr($value['class']); ?>" |
|
406 | + <?php echo implode(' ', $custom_attributes); // WPCS: XSS ok. ?> |
|
407 | + <?php checked($key, $option_value); ?> |
|
408 | + /> <?php echo esc_html($val); ?> |
|
409 | 409 | </label> |
410 | 410 | </li> |
411 | 411 | <?php |
@@ -420,58 +420,58 @@ discard block |
||
420 | 420 | |
421 | 421 | // Checkbox input. |
422 | 422 | case 'checkbox': |
423 | - $option_value = self::get_option( $value['id'], $value['default'] ); |
|
423 | + $option_value = self::get_option($value['id'], $value['default']); |
|
424 | 424 | $visibility_class = array(); |
425 | 425 | |
426 | - if ( ! isset( $value['hide_if_checked'] ) ) { |
|
426 | + if ( ! isset($value['hide_if_checked'])) { |
|
427 | 427 | $value['hide_if_checked'] = false; |
428 | 428 | } |
429 | - if ( ! isset( $value['show_if_checked'] ) ) { |
|
429 | + if ( ! isset($value['show_if_checked'])) { |
|
430 | 430 | $value['show_if_checked'] = false; |
431 | 431 | } |
432 | - if ( 'yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked'] ) { |
|
432 | + if ('yes' === $value['hide_if_checked'] || 'yes' === $value['show_if_checked']) { |
|
433 | 433 | $visibility_class[] = 'hidden_option'; |
434 | 434 | } |
435 | - if ( 'option' === $value['hide_if_checked'] ) { |
|
435 | + if ('option' === $value['hide_if_checked']) { |
|
436 | 436 | $visibility_class[] = 'hide_options_if_checked'; |
437 | 437 | } |
438 | - if ( 'option' === $value['show_if_checked'] ) { |
|
438 | + if ('option' === $value['show_if_checked']) { |
|
439 | 439 | $visibility_class[] = 'show_options_if_checked'; |
440 | 440 | } |
441 | 441 | |
442 | - if ( ! isset( $value['checkboxgroup'] ) || 'start' === $value['checkboxgroup'] ) { |
|
442 | + if ( ! isset($value['checkboxgroup']) || 'start' === $value['checkboxgroup']) { |
|
443 | 443 | ?> |
444 | - <tr valign="top" class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
445 | - <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ); ?></th> |
|
444 | + <tr valign="top" class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
445 | + <th scope="row" class="titledesc"><?php echo esc_html($value['title']); ?></th> |
|
446 | 446 | <td class="forminp forminp-checkbox"> |
447 | 447 | <fieldset> |
448 | 448 | <?php |
449 | 449 | } else { |
450 | 450 | ?> |
451 | - <fieldset class="<?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>"> |
|
451 | + <fieldset class="<?php echo esc_attr(implode(' ', $visibility_class)); ?>"> |
|
452 | 452 | <?php |
453 | 453 | } |
454 | 454 | |
455 | - if ( ! empty( $value['title'] ) ) { |
|
455 | + if ( ! empty($value['title'])) { |
|
456 | 456 | ?> |
457 | - <legend class="screen-reader-text"><span><?php echo esc_html( $value['title'] ); ?></span></legend> |
|
457 | + <legend class="screen-reader-text"><span><?php echo esc_html($value['title']); ?></span></legend> |
|
458 | 458 | <?php |
459 | 459 | } |
460 | 460 | ?> |
461 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"> |
|
461 | + <label for="<?php echo esc_attr($value['id']); ?>"> |
|
462 | 462 | <input |
463 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
464 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
463 | + name="<?php echo esc_attr($value['id']); ?>" |
|
464 | + id="<?php echo esc_attr($value['id']); ?>" |
|
465 | 465 | type="checkbox" |
466 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
466 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
467 | 467 | value="1" |
468 | - <?php checked( $option_value, 'yes' ); ?> |
|
469 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
468 | + <?php checked($option_value, 'yes'); ?> |
|
469 | + <?php echo implode(' ', $custom_attributes); ?> |
|
470 | 470 | /> <?php echo $description; ?> |
471 | 471 | </label> |
472 | 472 | <?php |
473 | 473 | |
474 | - if ( ! isset( $value['checkboxgroup'] ) || 'end' === $value['checkboxgroup'] ) { |
|
474 | + if ( ! isset($value['checkboxgroup']) || 'end' === $value['checkboxgroup']) { |
|
475 | 475 | ?> |
476 | 476 | </fieldset> |
477 | 477 | </td> |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | |
487 | 487 | // Default: run an action |
488 | 488 | default: |
489 | - do_action( 'auto_load_next_post_admin_field_' . $value['type'], $value ); |
|
489 | + do_action('auto_load_next_post_admin_field_'.$value['type'], $value); |
|
490 | 490 | |
491 | 491 | break; |
492 | 492 | } // end switch() |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param array $options Opens array to output |
505 | 505 | * @return bool |
506 | 506 | */ |
507 | - public static function save_fields( $options, $current_tab ) { |
|
508 | - if ( empty( $_POST ) ) { |
|
507 | + public static function save_fields($options, $current_tab) { |
|
508 | + if (empty($_POST)) { |
|
509 | 509 | return false; |
510 | 510 | } |
511 | 511 | |
@@ -513,21 +513,21 @@ discard block |
||
513 | 513 | $update_options = array(); |
514 | 514 | |
515 | 515 | // Loop options and get values to save |
516 | - foreach ( $options as $value ) { |
|
516 | + foreach ($options as $value) { |
|
517 | 517 | |
518 | - if ( ! isset( $value['id'] ) ) { |
|
518 | + if ( ! isset($value['id'])) { |
|
519 | 519 | continue; |
520 | 520 | } |
521 | 521 | |
522 | - $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; |
|
522 | + $type = isset($value['type']) ? sanitize_title($value['type']) : ''; |
|
523 | 523 | |
524 | 524 | // Get the option name |
525 | 525 | $option_value = null; |
526 | 526 | |
527 | - switch ( $type ) { |
|
527 | + switch ($type) { |
|
528 | 528 | // Standard types |
529 | 529 | case "checkbox" : |
530 | - if ( isset( $_POST[$value['id']] ) ) { |
|
530 | + if (isset($_POST[$value['id']])) { |
|
531 | 531 | $option_value = 'yes'; |
532 | 532 | } else { |
533 | 533 | $option_value = 'no'; |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | break; |
537 | 537 | |
538 | 538 | case "textarea" : |
539 | - if ( isset( $_POST[$value['id']] ) ) { |
|
540 | - $option_value = wp_kses_post( trim( stripslashes( $_POST[$value['id']] ) ) ); |
|
539 | + if (isset($_POST[$value['id']])) { |
|
540 | + $option_value = wp_kses_post(trim(stripslashes($_POST[$value['id']]))); |
|
541 | 541 | } else { |
542 | 542 | $option_value = ''; |
543 | 543 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | case "number": |
549 | 549 | case "select" : |
550 | 550 | case "radio" : |
551 | - if ( isset( $_POST[$value['id']] ) ) { |
|
552 | - $option_value = auto_load_next_post_clean( stripslashes( $_POST[$value['id']] ) ); |
|
551 | + if (isset($_POST[$value['id']])) { |
|
552 | + $option_value = auto_load_next_post_clean(stripslashes($_POST[$value['id']])); |
|
553 | 553 | } else { |
554 | 554 | $option_value = ''; |
555 | 555 | } |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | // Special types |
560 | 560 | case "multiselect" : |
561 | 561 | // Get array |
562 | - if ( isset( $_POST[$value['id']] ) ) { |
|
563 | - $selected_values = array_map( 'auto_load_next_post_clean', array_map( 'stripslashes', (array) $_POST[$value['id']] ) ); |
|
562 | + if (isset($_POST[$value['id']])) { |
|
563 | + $selected_values = array_map('auto_load_next_post_clean', array_map('stripslashes', (array) $_POST[$value['id']])); |
|
564 | 564 | } else { |
565 | 565 | $selected_values = array(); |
566 | 566 | } |
@@ -570,31 +570,31 @@ discard block |
||
570 | 570 | |
571 | 571 | // Custom handling |
572 | 572 | default : |
573 | - do_action( 'auto_load_next_post_update_option_' . $type, $value ); |
|
573 | + do_action('auto_load_next_post_update_option_'.$type, $value); |
|
574 | 574 | |
575 | 575 | break; |
576 | 576 | } // END switch() |
577 | 577 | |
578 | - if ( ! is_null( $option_value ) ) { |
|
578 | + if ( ! is_null($option_value)) { |
|
579 | 579 | |
580 | 580 | // Check if option is an array |
581 | - if ( strstr( $value['id'], '[') ) { |
|
582 | - parse_str( $value['id'], $option_array ); |
|
581 | + if (strstr($value['id'], '[')) { |
|
582 | + parse_str($value['id'], $option_array); |
|
583 | 583 | |
584 | 584 | // Option name is first key |
585 | - $option_name = current( array_keys( $option_array ) ); |
|
585 | + $option_name = current(array_keys($option_array)); |
|
586 | 586 | |
587 | 587 | // Get old option value |
588 | - if ( ! isset( $update_options[$option_name] ) ) { |
|
589 | - $update_options[$option_name] = get_option( $option_name, array() ); |
|
588 | + if ( ! isset($update_options[$option_name])) { |
|
589 | + $update_options[$option_name] = get_option($option_name, array()); |
|
590 | 590 | } |
591 | 591 | |
592 | - if ( ! is_array( $update_options[$option_name] ) ) { |
|
592 | + if ( ! is_array($update_options[$option_name])) { |
|
593 | 593 | $update_options[$option_name] = array(); |
594 | 594 | } |
595 | 595 | |
596 | 596 | // Set keys and value |
597 | - $key = key( $option_array[$option_name] ); |
|
597 | + $key = key($option_array[$option_name]); |
|
598 | 598 | $update_options[$option_name][$key] = $option_value; |
599 | 599 | |
600 | 600 | // Single value |
@@ -605,16 +605,16 @@ discard block |
||
605 | 605 | } |
606 | 606 | |
607 | 607 | // Custom handling |
608 | - do_action( 'auto_load_next_post_update_option', $value ); |
|
608 | + do_action('auto_load_next_post_update_option', $value); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | // Now save the options |
612 | - foreach ( $update_options as $name => $value ) { |
|
613 | - update_option( $name, $value ); |
|
612 | + foreach ($update_options as $name => $value) { |
|
613 | + update_option($name, $value); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | // Save all options as an array. Ready for export. |
617 | - update_option( 'auto_load_next_post_options_' . $current_tab, $update_options ); |
|
617 | + update_option('auto_load_next_post_options_'.$current_tab, $update_options); |
|
618 | 618 | |
619 | 619 | return true; |
620 | 620 | } // END save_fields() |