@@ -16,48 +16,48 @@ |
||
| 16 | 16 | * @version 1.6.0 |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -if ( have_posts() ) : |
|
| 19 | +if (have_posts()) : |
|
| 20 | 20 | |
| 21 | 21 | // Load content before the loop. |
| 22 | - do_action( 'alnp_load_before_loop' ); |
|
| 22 | + do_action('alnp_load_before_loop'); |
|
| 23 | 23 | |
| 24 | 24 | // Check that there are posts to load. |
| 25 | - while ( have_posts() ) : the_post(); |
|
| 25 | + while (have_posts()) : the_post(); |
|
| 26 | 26 | |
| 27 | 27 | $post_format = get_post_format(); // Post Format e.g. video |
| 28 | 28 | |
| 29 | 29 | $post_type = alnp_get_post_type(); // Post Type e.g. single |
| 30 | 30 | |
| 31 | 31 | // Load content before the post content. |
| 32 | - do_action( 'alnp_load_before_content' ); |
|
| 32 | + do_action('alnp_load_before_content'); |
|
| 33 | 33 | |
| 34 | 34 | // Load content before the post content for a specific post format. |
| 35 | - do_action( 'alnp_load_before_content_post_format_' . $post_format ); |
|
| 35 | + do_action('alnp_load_before_content_post_format_'.$post_format); |
|
| 36 | 36 | |
| 37 | 37 | // Load content before the post content for a specific post type. |
| 38 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
| 38 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
| 39 | 39 | |
| 40 | 40 | // Loads the content. |
| 41 | - alnp_load_content( $post_type, $post_format ); |
|
| 41 | + alnp_load_content($post_type, $post_format); |
|
| 42 | 42 | |
| 43 | 43 | // Load content after the post content for a specific post type. |
| 44 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
| 44 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
| 45 | 45 | |
| 46 | 46 | // Load content after the post content for a specific post format. |
| 47 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
| 47 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
| 48 | 48 | |
| 49 | 49 | // Load content after the post content. |
| 50 | - do_action( 'alnp_load_after_content' ); |
|
| 50 | + do_action('alnp_load_after_content'); |
|
| 51 | 51 | |
| 52 | 52 | // End the loop. |
| 53 | 53 | endwhile; |
| 54 | 54 | |
| 55 | 55 | // Load content after the loop. |
| 56 | - do_action( 'alnp_load_after_loop' ); |
|
| 56 | + do_action('alnp_load_after_loop'); |
|
| 57 | 57 | |
| 58 | 58 | else : |
| 59 | 59 | |
| 60 | 60 | // Load content if there are no more posts. |
| 61 | - do_action( 'alnp_no_more_posts' ); |
|
| 61 | + do_action('alnp_no_more_posts'); |
|
| 62 | 62 | |
| 63 | 63 | endif; // END if have_posts() |
@@ -10,12 +10,12 @@ 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 | // Exit if ALNP_Customizer_Scripts class already exists. |
| 18 | -if ( !class_exists( 'ALNP_Customizer_Scripts' ) ) { |
|
| 18 | +if ( ! class_exists('ALNP_Customizer_Scripts')) { |
|
| 19 | 19 | |
| 20 | 20 | class ALNP_Customizer_Scripts { |
| 21 | 21 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'customize_preview_init', array( $this, 'alnp_add_customizer_preview_scripts' ) ); |
|
| 30 | - add_action( 'customize_controls_print_scripts', array( $this, 'alnp_add_scripts' ), 30 ); |
|
| 29 | + add_action('customize_preview_init', array($this, 'alnp_add_customizer_preview_scripts')); |
|
| 30 | + add_action('customize_controls_print_scripts', array($this, 'alnp_add_scripts'), 30); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @since 1.5.0 |
| 37 | 37 | */ |
| 38 | 38 | public function alnp_add_customizer_preview_scripts() { |
| 39 | - Auto_Load_Next_Post::load_file( 'alnp-theme-customizer', '/assets/js/customizer/theme-customizer.js', true, array( 'customize-preview' ), '', true ); |
|
| 39 | + Auto_Load_Next_Post::load_file('alnp-theme-customizer', '/assets/js/customizer/theme-customizer.js', true, array('customize-preview'), '', true); |
|
| 40 | 40 | } // END alnp_add_customizer_preview_scripts() |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * but we are not viewing a single post. |
| 68 | 68 | */ |
| 69 | 69 | if ( isExpanded && !is_page_single ) { |
| 70 | - wp.customize.previewer.previewUrl.set( '<?php echo esc_js( alnp_get_random_page_permalink() ); ?>' ); |
|
| 70 | + wp.customize.previewer.previewUrl.set( '<?php echo esc_js(alnp_get_random_page_permalink()); ?>' ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } ); |
@@ -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( 'ALNP_Pro_Preview_Controller' ) ) { |
|
| 24 | +if ( ! class_exists('ALNP_Pro_Preview_Controller')) { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * The 'alnp_pro_preview' for Auto Load Next Post Pro control class. |
@@ -45,39 +45,39 @@ discard block |
||
| 45 | 45 | <span class="customize-control-title"><?php echo $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 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> |
|
| 53 | - <li><?php echo wptexturize( esc_html__( 'Page and Media Attachment Support', 'auto-load-next-post' ) ); ?></li> |
|
| 54 | - <li><?php echo wptexturize( esc_html__( 'Custom Post Type Support', 'auto-load-next-post' ) ); ?></li> |
|
| 55 | - <li><?php echo wptexturize( esc_html__( 'Paginated Posts Supported', 'auto-load-next-post' ) ); ?></li> |
|
| 56 | - <li><?php echo wptexturize( esc_html__( 'Exclude Post Formats', 'auto-load-next-post' ) ); ?></li> |
|
| 57 | - <li><?php echo wptexturize( esc_html__( 'Limit Posts per Session', 'auto-load-next-post' ) ); ?></li> |
|
| 58 | - <li><?php echo wptexturize( esc_html__( 'Query Posts by Category and Tag', 'auto-load-next-post' ) ); ?></li> |
|
| 59 | - <li><?php echo wptexturize( esc_html__( 'Exclude User Roles and Specific Users', 'auto-load-next-post' ) ); ?></li> |
|
| 60 | - <li><?php echo wptexturize( esc_html__( 'Pre-Query Posts Ready to Load', 'auto-load-next-post' ) ); ?></li> |
|
| 61 | - <li><?php echo wptexturize( esc_html__( 'Hide Comments and Show by Toggle Button', 'auto-load-next-post' ) ); ?></li> |
|
| 62 | - <li><?php echo wptexturize( sprintf( esc_html__( 'Multilingual Support for %1$s and %2$s', 'auto-load-next-post' ), 'WPML', 'Polylang' ) ); ?></li> |
|
| 63 | - <li><?php echo wptexturize( esc_html__( 'Email Support', 'auto-load-next-post' ) ); ?></li> |
|
| 52 | + <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> |
|
| 53 | + <li><?php echo wptexturize(esc_html__('Page and Media Attachment Support', 'auto-load-next-post')); ?></li> |
|
| 54 | + <li><?php echo wptexturize(esc_html__('Custom Post Type Support', 'auto-load-next-post')); ?></li> |
|
| 55 | + <li><?php echo wptexturize(esc_html__('Paginated Posts Supported', 'auto-load-next-post')); ?></li> |
|
| 56 | + <li><?php echo wptexturize(esc_html__('Exclude Post Formats', 'auto-load-next-post')); ?></li> |
|
| 57 | + <li><?php echo wptexturize(esc_html__('Limit Posts per Session', 'auto-load-next-post')); ?></li> |
|
| 58 | + <li><?php echo wptexturize(esc_html__('Query Posts by Category and Tag', 'auto-load-next-post')); ?></li> |
|
| 59 | + <li><?php echo wptexturize(esc_html__('Exclude User Roles and Specific Users', 'auto-load-next-post')); ?></li> |
|
| 60 | + <li><?php echo wptexturize(esc_html__('Pre-Query Posts Ready to Load', 'auto-load-next-post')); ?></li> |
|
| 61 | + <li><?php echo wptexturize(esc_html__('Hide Comments and Show by Toggle Button', 'auto-load-next-post')); ?></li> |
|
| 62 | + <li><?php echo wptexturize(sprintf(esc_html__('Multilingual Support for %1$s and %2$s', 'auto-load-next-post'), 'WPML', 'Polylang')); ?></li> |
|
| 63 | + <li><?php echo wptexturize(esc_html__('Email Support', 'auto-load-next-post')); ?></li> |
|
| 64 | 64 | </ul> |
| 65 | 65 | |
| 66 | 66 | <p> |
| 67 | - <?php printf( esc_html__( 'Find out more about %1$s%2$s%3$s.', 'auto-load-next-post'), '<a target="_blank" href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'pro/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview' ) . '">', esc_html__( 'Auto Load Next Post Pro', 'auto-load-next-post' ), '</a>' ); ?> |
|
| 67 | + <?php printf(esc_html__('Find out more about %1$s%2$s%3$s.', 'auto-load-next-post'), '<a target="_blank" href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'pro/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview').'">', esc_html__('Auto Load Next Post Pro', 'auto-load-next-post'), '</a>'); ?> |
|
| 68 | 68 | </p> |
| 69 | 69 | |
| 70 | - <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> |
|
| 70 | + <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> |
|
| 71 | 71 | |
| 72 | 72 | <p> |
| 73 | - <?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( AUTO_LOAD_NEXT_POST_STORE_URL . 'add-ons/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview' ) . '">', '</a>' ); ?> |
|
| 73 | + <?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(AUTO_LOAD_NEXT_POST_STORE_URL.'add-ons/?utm_source=wpcustomizer&utm_campaign=plugin-settings-pro-preview').'">', '</a>'); ?> |
|
| 74 | 74 | </p> |
| 75 | 75 | |
| 76 | - <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> |
|
| 76 | + <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> |
|
| 77 | 77 | |
| 78 | 78 | <div class="notice inline notice-info"> |
| 79 | 79 | <p> |
| 80 | - <?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>' ); ?> |
|
| 80 | + <?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>'); ?> |
|
| 81 | 81 | </p> |
| 82 | 82 | </div> |
| 83 | 83 | <?php |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'ALNP_Customizer' ) ) { |
|
| 18 | +if ( ! class_exists('ALNP_Customizer')) { |
|
| 19 | 19 | |
| 20 | 20 | class ALNP_Customizer { |
| 21 | 21 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @since 1.5.0 |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'customize_register', array( $this, 'alnp_init_customizer' ), 50 ); |
|
| 30 | - add_filter( 'customize_loaded_components', array( $this, 'alnp_remove_widgets_panel' ) ); |
|
| 29 | + add_action('customize_register', array($this, 'alnp_init_customizer'), 50); |
|
| 30 | + add_filter('customize_loaded_components', array($this, 'alnp_remove_widgets_panel')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -37,21 +37,21 @@ discard block |
||
| 37 | 37 | * @since 1.5.0 |
| 38 | 38 | * @param WP_Customize_Manager $wp_customize The Customizer object. |
| 39 | 39 | */ |
| 40 | - public function alnp_init_customizer( $wp_customize ) { |
|
| 40 | + public function alnp_init_customizer($wp_customize) { |
|
| 41 | 41 | /** |
| 42 | 42 | * Dont add settings to the customizer if the user does |
| 43 | 43 | * not have permission to make changes to the theme. |
| 44 | 44 | */ |
| 45 | - if ( ! current_user_can( 'edit_theme_options' ) ) { |
|
| 45 | + if ( ! current_user_can('edit_theme_options')) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Load custom controllers. |
| 50 | - require_once( dirname( __FILE__ ) . '/class-alnp-arbitrary-controller.php' ); |
|
| 50 | + require_once(dirname(__FILE__).'/class-alnp-arbitrary-controller.php'); |
|
| 51 | 51 | //require_once( dirname( __FILE__ ) . '/class-alnp-display-video-controller.php' ); |
| 52 | 52 | |
| 53 | 53 | // Auto Load Next Post Panel. |
| 54 | - $panel = array( 'panel' => 'alnp' ); |
|
| 54 | + $panel = array('panel' => 'alnp'); |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Add the main panel and sections. |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | $wp_customize->add_panel( |
| 62 | 62 | 'alnp', array( |
| 63 | - 'title' => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
| 63 | + 'title' => esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
| 64 | 64 | 'capability' => 'edit_theme_options', |
| 65 | - 'description' => sprintf( esc_html__( '%s increases your pageviews by engaging the site viewers to keep reading your content rather than increasing your bounce rate.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
| 65 | + 'description' => sprintf(esc_html__('%s increases your pageviews by engaging the site viewers to keep reading your content rather than increasing your bounce rate.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
| 66 | 66 | 'priority' => 160, |
| 67 | - 'active_callback' => array( $this, 'is_page_alnp_ready' ) |
|
| 67 | + 'active_callback' => array($this, 'is_page_alnp_ready') |
|
| 68 | 68 | ) |
| 69 | 69 | ); |
| 70 | 70 | |
@@ -72,24 +72,24 @@ discard block |
||
| 72 | 72 | $sections = $this->alnp_get_customizer_sections(); |
| 73 | 73 | |
| 74 | 74 | // Add each section. |
| 75 | - foreach ( $sections as $section => $args ) { |
|
| 75 | + foreach ($sections as $section => $args) { |
|
| 76 | 76 | /** |
| 77 | 77 | * If we are not only viewing Auto Load Next Post customizer sections |
| 78 | 78 | * then move them under our own panel. |
| 79 | 79 | */ |
| 80 | - if ( ! $this->alnp_is_customizer() ) { |
|
| 81 | - $args = array_merge( $args, $panel ); |
|
| 80 | + if ( ! $this->alnp_is_customizer()) { |
|
| 81 | + $args = array_merge($args, $panel); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $wp_customize->add_section( $section, $args ); |
|
| 84 | + $wp_customize->add_section($section, $args); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Get plugin settings. |
| 88 | 88 | $settings = $this->alnp_get_customizer_settings(); |
| 89 | 89 | |
| 90 | 90 | // Add each setting. |
| 91 | - foreach ( $settings as $setting => $args ) { |
|
| 92 | - $wp_customize->add_setting( $setting, $args ); |
|
| 91 | + foreach ($settings as $setting => $args) { |
|
| 92 | + $wp_customize->add_setting($setting, $args); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | * @since 1.5.0 |
| 99 | 99 | * @param WP_Customize_Manager $wp_customize The Customizer object. |
| 100 | 100 | */ |
| 101 | - do_action( 'alnp_customizer_register', $wp_customize ); |
|
| 101 | + do_action('alnp_customizer_register', $wp_customize); |
|
| 102 | 102 | |
| 103 | 103 | $controls = $this->alnp_get_customizer_controls(); |
| 104 | 104 | |
| 105 | - foreach ( $controls as $control => $args ) { |
|
| 106 | - $wp_customize->add_control( new $args['class']( $wp_customize, $control, $args ) ); |
|
| 105 | + foreach ($controls as $control => $args) { |
|
| 106 | + $wp_customize->add_control(new $args['class']($wp_customize, $control, $args)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( $this->alnp_is_customizer() ) { |
|
| 110 | - $this->alnp_remove_default_customizer_panels( $wp_customize ); // Remove controls from the customizer. |
|
| 109 | + if ($this->alnp_is_customizer()) { |
|
| 110 | + $this->alnp_remove_default_customizer_panels($wp_customize); // Remove controls from the customizer. |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Video Help - Coming Soon |
@@ -129,30 +129,30 @@ discard block |
||
| 129 | 129 | * to tell users about the pro version, what comes with it |
| 130 | 130 | * and link to product page. |
| 131 | 131 | */ |
| 132 | - if ( ! is_alnp_pro_version_installed() ) { |
|
| 133 | - include_once( dirname( __FILE__ ) . '/class-alnp-pro-preview-controller.php' ); |
|
| 132 | + if ( ! is_alnp_pro_version_installed()) { |
|
| 133 | + include_once(dirname(__FILE__).'/class-alnp-pro-preview-controller.php'); |
|
| 134 | 134 | |
| 135 | 135 | $preview_args = array( |
| 136 | - 'title' => esc_html__( 'More?', 'auto-load-next-post' ), |
|
| 136 | + 'title' => esc_html__('More?', 'auto-load-next-post'), |
|
| 137 | 137 | 'priority' => 999, |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - if ( ! $this->alnp_is_customizer() ) { |
|
| 141 | - $preview_args = array_merge( $preview_args, $panel ); |
|
| 140 | + if ( ! $this->alnp_is_customizer()) { |
|
| 141 | + $preview_args = array_merge($preview_args, $panel); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $wp_customize->add_section( 'alnp_pro_preview', $preview_args ); |
|
| 144 | + $wp_customize->add_section('alnp_pro_preview', $preview_args); |
|
| 145 | 145 | |
| 146 | - $wp_customize->add_setting( 'alnp_pro_preview', array( |
|
| 146 | + $wp_customize->add_setting('alnp_pro_preview', array( |
|
| 147 | 147 | 'default' => null, |
| 148 | - ) ); |
|
| 148 | + )); |
|
| 149 | 149 | |
| 150 | - $wp_customize->add_control( new ALNP_Pro_Preview_Controller( $wp_customize, 'alnp_pro_preview', array( |
|
| 151 | - 'label' => __( 'Looking for more options?', 'auto-load-next-post' ), |
|
| 150 | + $wp_customize->add_control(new ALNP_Pro_Preview_Controller($wp_customize, 'alnp_pro_preview', array( |
|
| 151 | + 'label' => __('Looking for more options?', 'auto-load-next-post'), |
|
| 152 | 152 | 'section' => 'alnp_pro_preview', |
| 153 | 153 | 'settings' => 'alnp_pro_preview', |
| 154 | 154 | 'priority' => 1, |
| 155 | - ) ) ); |
|
| 155 | + ))); |
|
| 156 | 156 | } |
| 157 | 157 | } // END alnp_init_customizer() |
| 158 | 158 | |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | * @param array $components Core Customizer components list. |
| 165 | 165 | * @return array (Maybe) modified components list. |
| 166 | 166 | */ |
| 167 | - public function alnp_remove_widgets_panel( $components ) { |
|
| 168 | - if ( $this->alnp_is_customizer() ) { |
|
| 169 | - foreach( $components as $key => $component ) { |
|
| 170 | - if ( $component == 'widgets' ) { |
|
| 171 | - unset( $components[ 'widgets' ] ); |
|
| 167 | + public function alnp_remove_widgets_panel($components) { |
|
| 168 | + if ($this->alnp_is_customizer()) { |
|
| 169 | + foreach ($components as $key => $component) { |
|
| 170 | + if ($component == 'widgets') { |
|
| 171 | + unset($components['widgets']); |
|
| 172 | 172 | } |
| 173 | - if ( $component == 'nav_menus' ) { |
|
| 174 | - unset( $components[ 'nav_menus' ] ); |
|
| 173 | + if ($component == 'nav_menus') { |
|
| 174 | + unset($components['nav_menus']); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @param object $wp_customize |
| 189 | 189 | * @return boolean |
| 190 | 190 | */ |
| 191 | - public function alnp_remove_default_customizer_panels( $wp_customize ) { |
|
| 191 | + public function alnp_remove_default_customizer_panels($wp_customize) { |
|
| 192 | 192 | global $wp_customize; |
| 193 | 193 | |
| 194 | 194 | $wp_customize->remove_section("themes"); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return boolean |
| 213 | 213 | */ |
| 214 | 214 | public function alnp_is_customizer() { |
| 215 | - return isset( $_GET['alnp-customizer'] ) && $_GET['alnp-customizer'] === 'yes'; |
|
| 215 | + return isset($_GET['alnp-customizer']) && $_GET['alnp-customizer'] === 'yes'; |
|
| 216 | 216 | } // END alnp_is_customizer() |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -228,23 +228,23 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @param array $sections Customizer sections to add. |
| 230 | 230 | */ |
| 231 | - return apply_filters( 'alnp_get_customizer_sections', array( |
|
| 231 | + return apply_filters('alnp_get_customizer_sections', array( |
|
| 232 | 232 | 'auto_load_next_post_theme_selectors' => array( |
| 233 | 233 | 'capability' => 'edit_theme_options', |
| 234 | - 'title' => esc_html__( 'Theme Selectors', 'auto-load-next-post' ), |
|
| 235 | - 'description' => sprintf( __( 'Set the theme selectors below according to the theme. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post' ), '<a href="' . esc_url( 'https://github.com/autoloadnextpost/alnp-documentation/blob/master/en_US/theme-selectors.md#how-to-find-your-theme-selectors' ) . '" target="_blank">', '</a>' ), |
|
| 234 | + 'title' => esc_html__('Theme Selectors', 'auto-load-next-post'), |
|
| 235 | + 'description' => sprintf(__('Set the theme selectors below according to the theme. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post'), '<a href="'.esc_url('https://github.com/autoloadnextpost/alnp-documentation/blob/master/en_US/theme-selectors.md#how-to-find-your-theme-selectors').'" target="_blank">', '</a>'), |
|
| 236 | 236 | ), |
| 237 | 237 | 'auto_load_next_post_misc' => array( |
| 238 | 238 | 'capability' => 'edit_theme_options', |
| 239 | - 'title' => esc_html__( 'Misc Settings', 'auto-load-next-post' ), |
|
| 240 | - 'description' => sprintf( __( 'Here you can set if you want to track pageviews, remove comments and load %s javascript in the footer and disable for mobile users.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
| 239 | + 'title' => esc_html__('Misc Settings', 'auto-load-next-post'), |
|
| 240 | + 'description' => sprintf(__('Here you can set if you want to track pageviews, remove comments and load %s javascript in the footer and disable for mobile users.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
| 241 | 241 | ), |
| 242 | 242 | 'auto_load_next_post_events' => array( |
| 243 | 243 | 'capability' => 'edit_theme_options', |
| 244 | - 'title' => esc_html__( 'Events', 'auto-load-next-post' ), |
|
| 245 | - 'description' => sprintf( __( 'Below you can enter external JavaScript events to be triggered alongside %1$s native events. Separate each event like so: %2$s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<code>event1, event2,</code>' ), |
|
| 244 | + 'title' => esc_html__('Events', 'auto-load-next-post'), |
|
| 245 | + 'description' => sprintf(__('Below you can enter external JavaScript events to be triggered alongside %1$s native events. Separate each event like so: %2$s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<code>event1, event2,</code>'), |
|
| 246 | 246 | ), |
| 247 | - ) ); |
|
| 247 | + )); |
|
| 248 | 248 | } // END alnp_get_customizer_sections() |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -263,12 +263,12 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param array $settings Customizer settings to add. |
| 265 | 265 | */ |
| 266 | - return apply_filters( 'alnp_get_customizer_settings', array( |
|
| 266 | + return apply_filters('alnp_get_customizer_settings', array( |
|
| 267 | 267 | 'auto_load_next_post_content_container' => array( |
| 268 | 268 | 'capability' => 'edit_theme_options', |
| 269 | 269 | 'default' => $settings['alnp_content_container'], |
| 270 | 270 | 'sanitize_callback' => 'wp_filter_post_kses', |
| 271 | - 'validate_callback' => array( $this, 'alnp_validate_content_container_selector' ), |
|
| 271 | + 'validate_callback' => array($this, 'alnp_validate_content_container_selector'), |
|
| 272 | 272 | 'transport' => 'postMessage', |
| 273 | 273 | 'type' => 'option', |
| 274 | 274 | ), |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | 'capability' => 'edit_theme_options', |
| 277 | 277 | 'default' => $settings['alnp_title_selector'], |
| 278 | 278 | 'sanitize_callback' => 'wp_filter_post_kses', |
| 279 | - 'validate_callback' => array( $this, 'alnp_validate_post_title_selector' ), |
|
| 279 | + 'validate_callback' => array($this, 'alnp_validate_post_title_selector'), |
|
| 280 | 280 | 'transport' => 'postMessage', |
| 281 | 281 | 'type' => 'option', |
| 282 | 282 | ), |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | 'capability' => 'edit_theme_options', |
| 285 | 285 | 'default' => $settings['alnp_navigation_container'], |
| 286 | 286 | 'sanitize_callback' => 'wp_filter_post_kses', |
| 287 | - 'validate_callback' => array( $this, 'alnp_validate_post_navigation_selector' ), |
|
| 287 | + 'validate_callback' => array($this, 'alnp_validate_post_navigation_selector'), |
|
| 288 | 288 | 'transport' => 'postMessage', |
| 289 | 289 | 'type' => 'option', |
| 290 | 290 | ), |
@@ -304,28 +304,28 @@ discard block |
||
| 304 | 304 | ), |
| 305 | 305 | 'auto_load_next_post_remove_comments' => array( |
| 306 | 306 | 'capability' => 'edit_theme_options', |
| 307 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 307 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
| 308 | 308 | 'default' => 'yes', |
| 309 | 309 | 'transport' => 'refresh', |
| 310 | 310 | 'type' => 'option', |
| 311 | 311 | ), |
| 312 | 312 | 'auto_load_next_post_google_analytics' => array( |
| 313 | 313 | 'capability' => 'edit_theme_options', |
| 314 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 314 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
| 315 | 315 | 'default' => 'no', |
| 316 | 316 | 'transport' => 'refresh', |
| 317 | 317 | 'type' => 'option', |
| 318 | 318 | ), |
| 319 | 319 | 'auto_load_next_post_load_js_in_footer' => array( |
| 320 | 320 | 'capability' => 'edit_theme_options', |
| 321 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 321 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
| 322 | 322 | 'default' => 'no', |
| 323 | 323 | 'transport' => 'refresh', |
| 324 | 324 | 'type' => 'option', |
| 325 | 325 | ), |
| 326 | 326 | 'auto_load_next_post_disable_on_mobile' => array( |
| 327 | 327 | 'capability' => 'edit_theme_options', |
| 328 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 328 | + 'sanitize_callback' => array($this, 'sanitize_checkbox'), |
|
| 329 | 329 | 'default' => 'no', |
| 330 | 330 | 'type' => 'option', |
| 331 | 331 | 'transport' => 'refresh', |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | 'transport' => 'postMessage', |
| 343 | 343 | 'type' => 'option', |
| 344 | 344 | ), |
| 345 | - ) ); |
|
| 345 | + )); |
|
| 346 | 346 | } // END alnp_get_customizer_settings() |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -359,88 +359,88 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @param array $controls Customizer controls to add. |
| 361 | 361 | */ |
| 362 | - return apply_filters( 'alnp_get_customizer_controls', array( |
|
| 362 | + return apply_filters('alnp_get_customizer_controls', array( |
|
| 363 | 363 | 'alnp_content_container' => array( |
| 364 | 364 | 'class' => 'WP_Customize_Control', |
| 365 | - 'label' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
|
| 366 | - 'description' => sprintf( __( 'The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post' ), '<code>main.site-main</code>' ), |
|
| 365 | + 'label' => esc_html__('Content Container', 'auto-load-next-post'), |
|
| 366 | + 'description' => sprintf(__('The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post'), '<code>main.site-main</code>'), |
|
| 367 | 367 | 'section' => 'auto_load_next_post_theme_selectors', |
| 368 | 368 | 'settings' => 'auto_load_next_post_content_container', |
| 369 | 369 | 'type' => 'text', |
| 370 | 370 | ), |
| 371 | 371 | 'alnp_title_selector' => array( |
| 372 | 372 | 'class' => 'WP_Customize_Control', |
| 373 | - 'label' => esc_html__( 'Post Title Selector', 'auto-load-next-post' ), |
|
| 374 | - 'description' => sprintf( __( 'Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post' ), '<code>h1.entry-title</code>' ), |
|
| 373 | + 'label' => esc_html__('Post Title Selector', 'auto-load-next-post'), |
|
| 374 | + 'description' => sprintf(__('Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post'), '<code>h1.entry-title</code>'), |
|
| 375 | 375 | 'section' => 'auto_load_next_post_theme_selectors', |
| 376 | 376 | 'settings' => 'auto_load_next_post_title_selector', |
| 377 | 377 | 'type' => 'text', |
| 378 | 378 | ), |
| 379 | 379 | 'alnp_navigation_container' => array( |
| 380 | 380 | 'class' => 'WP_Customize_Control', |
| 381 | - 'label' => esc_html__( 'Post Navigation Container', 'auto-load-next-post' ), |
|
| 382 | - 'description' => sprintf( __( 'Used to identify which post to load next if any. Default: %s', 'auto-load-next-post' ), '<code>nav.post-navigation</code>' ), |
|
| 381 | + 'label' => esc_html__('Post Navigation Container', 'auto-load-next-post'), |
|
| 382 | + 'description' => sprintf(__('Used to identify which post to load next if any. Default: %s', 'auto-load-next-post'), '<code>nav.post-navigation</code>'), |
|
| 383 | 383 | 'section' => 'auto_load_next_post_theme_selectors', |
| 384 | 384 | 'settings' => 'auto_load_next_post_navigation_container', |
| 385 | 385 | 'type' => 'text', |
| 386 | 386 | ), |
| 387 | 387 | 'alnp_comments_container' => array( |
| 388 | 388 | 'class' => 'WP_Customize_Control', |
| 389 | - 'label' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
|
| 390 | - 'description' => sprintf( __( 'Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post' ), '<strong><a href="javascript:wp.customize.section( \'auto_load_next_post_misc\' ).focus();">', '</a></strong>', '<code>div#comments</code>' ), |
|
| 389 | + 'label' => esc_html__('Comments Container', 'auto-load-next-post'), |
|
| 390 | + 'description' => sprintf(__('Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post'), '<strong><a href="javascript:wp.customize.section( \'auto_load_next_post_misc\' ).focus();">', '</a></strong>', '<code>div#comments</code>'), |
|
| 391 | 391 | 'section' => 'auto_load_next_post_theme_selectors', |
| 392 | 392 | 'settings' => 'auto_load_next_post_comments_container', |
| 393 | 393 | 'type' => 'text', |
| 394 | 394 | ), |
| 395 | 395 | 'alnp_remove_comments' => array( |
| 396 | 396 | 'class' => 'WP_Customize_Control', |
| 397 | - 'label' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
| 398 | - 'description' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
| 397 | + 'label' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
| 398 | + 'description' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
| 399 | 399 | 'section' => 'auto_load_next_post_misc', |
| 400 | 400 | 'settings' => 'auto_load_next_post_remove_comments', |
| 401 | 401 | 'type' => 'checkbox', |
| 402 | 402 | ), |
| 403 | 403 | 'alnp_google_analytics' => array( |
| 404 | 404 | 'class' => 'WP_Customize_Control', |
| 405 | - 'label' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
| 406 | - 'description' => 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' ), |
|
| 405 | + 'label' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
| 406 | + 'description' => 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'), |
|
| 407 | 407 | 'section' => 'auto_load_next_post_misc', |
| 408 | 408 | 'settings' => 'auto_load_next_post_google_analytics', |
| 409 | 409 | 'type' => 'checkbox', |
| 410 | 410 | ), |
| 411 | 411 | 'alnp_js_footer' => array( |
| 412 | 412 | 'class' => 'WP_Customize_Control', |
| 413 | - 'label' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
| 414 | - 'description' => esc_html__( 'Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site.', 'auto-load-next-post' ), |
|
| 413 | + 'label' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
| 414 | + 'description' => esc_html__('Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site.', 'auto-load-next-post'), |
|
| 415 | 415 | 'section' => 'auto_load_next_post_misc', |
| 416 | 416 | 'settings' => 'auto_load_next_post_load_js_in_footer', |
| 417 | 417 | 'type' => 'checkbox', |
| 418 | 418 | ), |
| 419 | 419 | 'alnp_disable_on_mobile' => array( |
| 420 | 420 | 'class' => 'WP_Customize_Control', |
| 421 | - 'label' => esc_html__( 'Disable for Mobile?', 'auto-load-next-post' ), |
|
| 422 | - 'description' => sprintf( esc_html__( 'Enable to disable %s from running on mobile devices.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
| 421 | + 'label' => esc_html__('Disable for Mobile?', 'auto-load-next-post'), |
|
| 422 | + 'description' => sprintf(esc_html__('Enable to disable %s from running on mobile devices.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
| 423 | 423 | 'section' => 'auto_load_next_post_misc', |
| 424 | 424 | 'settings' => 'auto_load_next_post_disable_on_mobile', |
| 425 | 425 | 'type' => 'checkbox', |
| 426 | 426 | ), |
| 427 | 427 | 'alnp_on_load_event' => array( |
| 428 | 428 | 'class' => 'WP_Customize_Control', |
| 429 | - 'label' => esc_html__( 'Post loaded', 'auto-load-next-post' ), |
|
| 430 | - 'description' => esc_html__( 'Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post' ), |
|
| 429 | + 'label' => esc_html__('Post loaded', 'auto-load-next-post'), |
|
| 430 | + 'description' => esc_html__('Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post'), |
|
| 431 | 431 | 'section' => 'auto_load_next_post_events', |
| 432 | 432 | 'settings' => 'auto_load_next_post_on_load_event', |
| 433 | 433 | 'type' => 'textarea', |
| 434 | 434 | ), |
| 435 | 435 | 'alnp_on_entering_event' => array( |
| 436 | 436 | 'class' => 'WP_Customize_Control', |
| 437 | - 'label' => esc_html__( 'Entering a Post', 'auto-load-next-post' ), |
|
| 438 | - 'description' => esc_html__( 'Events listed here will be triggered when entering a post.', 'auto-load-next-post' ), |
|
| 437 | + 'label' => esc_html__('Entering a Post', 'auto-load-next-post'), |
|
| 438 | + 'description' => esc_html__('Events listed here will be triggered when entering a post.', 'auto-load-next-post'), |
|
| 439 | 439 | 'section' => 'auto_load_next_post_events', |
| 440 | 440 | 'settings' => 'auto_load_next_post_on_entering_event', |
| 441 | 441 | 'type' => 'textarea', |
| 442 | 442 | ), |
| 443 | - ) ); |
|
| 443 | + )); |
|
| 444 | 444 | } // END alnp_get_customizer_controls() |
| 445 | 445 | |
| 446 | 446 | /** |
@@ -452,9 +452,9 @@ discard block |
||
| 452 | 452 | * @param string $value Value, normally pre-sanitized. |
| 453 | 453 | * @return WP_Error $validity |
| 454 | 454 | */ |
| 455 | - public function alnp_validate_content_container_selector( $validity, $value ) { |
|
| 456 | - if ( empty( $value ) ) { |
|
| 457 | - $validity->add( 'required', esc_html__( 'The content container selector is empty. Will not know where to load posts without it.', 'auto-load-next-post' ) ); |
|
| 455 | + public function alnp_validate_content_container_selector($validity, $value) { |
|
| 456 | + if (empty($value)) { |
|
| 457 | + $validity->add('required', esc_html__('The content container selector is empty. Will not know where to load posts without it.', 'auto-load-next-post')); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $validity; |
@@ -469,9 +469,9 @@ discard block |
||
| 469 | 469 | * @param string $value Value, normally pre-sanitized. |
| 470 | 470 | * @return WP_Error $validity |
| 471 | 471 | */ |
| 472 | - public function alnp_validate_post_title_selector( $validity, $value ) { |
|
| 473 | - if ( empty( $value ) ) { |
|
| 474 | - $validity->add( 'required', esc_html__( 'The post title selector is empty. Will not be able to identify which article the user is reading.', 'auto-load-next-post' ) ); |
|
| 472 | + public function alnp_validate_post_title_selector($validity, $value) { |
|
| 473 | + if (empty($value)) { |
|
| 474 | + $validity->add('required', esc_html__('The post title selector is empty. Will not be able to identify which article the user is reading.', 'auto-load-next-post')); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | return $validity; |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | * @param string $value Value, normally pre-sanitized. |
| 487 | 487 | * @return WP_Error $validity |
| 488 | 488 | */ |
| 489 | - public function alnp_validate_post_navigation_selector( $validity, $value ) { |
|
| 490 | - if ( empty( $value ) ) { |
|
| 491 | - $validity->add( 'required', esc_html__( 'The post navigation container selector is empty. Required so ALNP can look up the next post to load.', 'auto-load-next-post' ) ); |
|
| 489 | + public function alnp_validate_post_navigation_selector($validity, $value) { |
|
| 490 | + if (empty($value)) { |
|
| 491 | + $validity->add('required', esc_html__('The post navigation container selector is empty. Required so ALNP can look up the next post to load.', 'auto-load-next-post')); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | return $validity; |
@@ -504,17 +504,17 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | public function alnp_get_settings() { |
| 506 | 506 | $args = array( |
| 507 | - 'alnp_content_container' => get_option( 'auto_load_next_post_content_container' ), |
|
| 508 | - 'alnp_title_selector' => get_option( 'auto_load_next_post_title_selector' ), |
|
| 509 | - 'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ), |
|
| 510 | - 'alnp_previous_post_selector' => get_option( 'auto_load_next_post_previous_post_selector' ), |
|
| 511 | - 'alnp_comments_container' => get_option( 'auto_load_next_post_comments_container' ), |
|
| 512 | - 'alnp_remove_comments' => get_option( 'auto_load_next_post_remove_comments' ), |
|
| 513 | - 'alnp_google_analytics' => get_option( 'auto_load_next_post_google_analytics' ), |
|
| 514 | - 'alnp_js_footer' => get_option( 'auto_load_next_post_load_js_in_footer' ), |
|
| 515 | - 'alnp_disable_on_mobile' => get_option( 'auto_load_next_post_disable_on_mobile' ), |
|
| 516 | - 'alnp_on_load_event' => get_option( 'auto_load_next_post_on_load_event' ), |
|
| 517 | - 'alnp_on_entering_event' => get_option( 'auto_load_next_post_on_entering_event' ), |
|
| 507 | + 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
|
| 508 | + 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
|
| 509 | + 'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'), |
|
| 510 | + 'alnp_previous_post_selector' => get_option('auto_load_next_post_previous_post_selector'), |
|
| 511 | + 'alnp_comments_container' => get_option('auto_load_next_post_comments_container'), |
|
| 512 | + 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
|
| 513 | + 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
|
| 514 | + 'alnp_js_footer' => get_option('auto_load_next_post_load_js_in_footer'), |
|
| 515 | + 'alnp_disable_on_mobile' => get_option('auto_load_next_post_disable_on_mobile'), |
|
| 516 | + 'alnp_on_load_event' => get_option('auto_load_next_post_on_load_event'), |
|
| 517 | + 'alnp_on_entering_event' => get_option('auto_load_next_post_on_entering_event'), |
|
| 518 | 518 | ); |
| 519 | 519 | |
| 520 | 520 | return $args; |
@@ -529,13 +529,13 @@ discard block |
||
| 529 | 529 | * @return boolean |
| 530 | 530 | */ |
| 531 | 531 | public function is_page_alnp_ready() { |
| 532 | - if ( is_front_page() && is_home() ) { |
|
| 532 | + if (is_front_page() && is_home()) { |
|
| 533 | 533 | return false; |
| 534 | - } elseif ( is_front_page() ) { |
|
| 534 | + } elseif (is_front_page()) { |
|
| 535 | 535 | return false; |
| 536 | - } elseif ( is_home() ) { |
|
| 536 | + } elseif (is_home()) { |
|
| 537 | 537 | return true; |
| 538 | - } elseif ( is_singular( apply_filters( 'alnp_customizer_posts_ready', array( 'post' ) ) ) ) { |
|
| 538 | + } elseif (is_singular(apply_filters('alnp_customizer_posts_ready', array('post')))) { |
|
| 539 | 539 | return true; |
| 540 | 540 | } |
| 541 | 541 | |
@@ -550,8 +550,8 @@ discard block |
||
| 550 | 550 | * @param bool $input |
| 551 | 551 | * @return string |
| 552 | 552 | */ |
| 553 | - public function sanitize_checkbox( $input ) { |
|
| 554 | - return ( $input === true ) ? 'yes' : 'no'; |
|
| 553 | + public function sanitize_checkbox($input) { |
|
| 554 | + return ($input === true) ? 'yes' : 'no'; |
|
| 555 | 555 | } // END sansitize_checkbox() |
| 556 | 556 | |
| 557 | 557 | } // END Class |
@@ -10,16 +10,16 @@ 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 | // Exit if WP_Customize_Control does not exsist. |
| 18 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 18 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 19 | 19 | return null; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if ( !class_exists( 'ALNP_Arbitrary_Control' ) ) { |
|
| 22 | +if ( ! class_exists('ALNP_Arbitrary_Control')) { |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * The 'alnp_arbitrary' for Auto Load Next Post Arbitrary control class. |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | * @return void |
| 33 | 33 | */ |
| 34 | 34 | public function render_content() { |
| 35 | - switch ( $this->type ) { |
|
| 35 | + switch ($this->type) { |
|
| 36 | 36 | default: |
| 37 | 37 | case 'text': |
| 38 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
| 38 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
| 39 | 39 | break; |
| 40 | 40 | |
| 41 | 41 | case 'heading': |
| 42 | - echo '<span class="customize-control-title">' . $this->label . '</span>'; |
|
| 42 | + echo '<span class="customize-control-title">'.$this->label.'</span>'; |
|
| 43 | 43 | break; |
| 44 | 44 | |
| 45 | 45 | case 'divider': |
@@ -12,16 +12,16 @@ |
||
| 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( 'ALNP_Display_Video_Controller' ) ) { |
|
| 24 | +if ( ! class_exists('ALNP_Display_Video_Controller')) { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * This class is for the display video control in the Customizer. |
@@ -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 ( ! function_exists( 'auto_load_next_post_clean' ) ) { |
|
| 18 | +if ( ! function_exists('auto_load_next_post_clean')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Clean variables using sanitize_text_field. Arrays are cleaned recursively. |
| 21 | 21 | * Non-scalar values are ignored. |
@@ -25,16 +25,16 @@ discard block |
||
| 25 | 25 | * @param string|array $var Data to sanitize. |
| 26 | 26 | * @return string|array * |
| 27 | 27 | */ |
| 28 | - function auto_load_next_post_clean( $var ) { |
|
| 29 | - if ( is_array( $var ) ) { |
|
| 30 | - return array_map( 'auto_load_next_post_clean', $var ); |
|
| 28 | + function auto_load_next_post_clean($var) { |
|
| 29 | + if (is_array($var)) { |
|
| 30 | + return array_map('auto_load_next_post_clean', $var); |
|
| 31 | 31 | } else { |
| 32 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
| 32 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
| 33 | 33 | } |
| 34 | 34 | } // END auto_load_next_post_clean() |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -if ( ! function_exists( 'auto_load_next_post_seconds_to_words' ) ) { |
|
| 37 | +if ( ! function_exists('auto_load_next_post_seconds_to_words')) { |
|
| 38 | 38 | /** |
| 39 | 39 | * Seconds to words. |
| 40 | 40 | * |
@@ -45,59 +45,59 @@ discard block |
||
| 45 | 45 | * @param string $seconds Seconds in time. |
| 46 | 46 | * @return string |
| 47 | 47 | */ |
| 48 | - function auto_load_next_post_seconds_to_words( $seconds ) { |
|
| 48 | + function auto_load_next_post_seconds_to_words($seconds) { |
|
| 49 | 49 | // Get the years. |
| 50 | - $years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100; |
|
| 51 | - if ( $years > 1 ) { |
|
| 50 | + $years = (intval($seconds) / YEAR_IN_SECONDS) % 100; |
|
| 51 | + if ($years > 1) { |
|
| 52 | 52 | /* translators: Number of years */ |
| 53 | - return sprintf( __( '%s years', 'auto-load-next-post' ), $years ); |
|
| 54 | - } elseif ( $years > 0 ) { |
|
| 55 | - return __( 'a year', 'auto-load-next-post' ); |
|
| 53 | + return sprintf(__('%s years', 'auto-load-next-post'), $years); |
|
| 54 | + } elseif ($years > 0) { |
|
| 55 | + return __('a year', 'auto-load-next-post'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Get the weeks. |
| 59 | - $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52; |
|
| 60 | - if ( $weeks > 1 ) { |
|
| 59 | + $weeks = (intval($seconds) / WEEK_IN_SECONDS) % 52; |
|
| 60 | + if ($weeks > 1) { |
|
| 61 | 61 | /* translators: Number of weeks */ |
| 62 | - return sprintf( __( '%s weeks', 'auto-load-next-post' ), $weeks ); |
|
| 63 | - } elseif ( $weeks > 0 ) { |
|
| 64 | - return __( 'a week', 'auto-load-next-post' ); |
|
| 62 | + return sprintf(__('%s weeks', 'auto-load-next-post'), $weeks); |
|
| 63 | + } elseif ($weeks > 0) { |
|
| 64 | + return __('a week', 'auto-load-next-post'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Get the days. |
| 68 | - $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7; |
|
| 69 | - if ( $days > 1 ) { |
|
| 68 | + $days = (intval($seconds) / DAY_IN_SECONDS) % 7; |
|
| 69 | + if ($days > 1) { |
|
| 70 | 70 | /* translators: Number of days */ |
| 71 | - return sprintf( __( '%s days', 'auto-load-next-post' ), $days ); |
|
| 72 | - } elseif ( $days > 0 ) { |
|
| 73 | - return __( 'a day', 'auto-load-next-post' ); |
|
| 71 | + return sprintf(__('%s days', 'auto-load-next-post'), $days); |
|
| 72 | + } elseif ($days > 0) { |
|
| 73 | + return __('a day', 'auto-load-next-post'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Get the hours. |
| 77 | - $hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24; |
|
| 78 | - if ( $hours > 1 ) { |
|
| 77 | + $hours = (intval($seconds) / HOUR_IN_SECONDS) % 24; |
|
| 78 | + if ($hours > 1) { |
|
| 79 | 79 | /* translators: Number of hours */ |
| 80 | - return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours ); |
|
| 81 | - } elseif ( $hours > 0 ) { |
|
| 82 | - return __( 'an hour', 'auto-load-next-post' ); |
|
| 80 | + return sprintf(__('%s hours', 'auto-load-next-post'), $hours); |
|
| 81 | + } elseif ($hours > 0) { |
|
| 82 | + return __('an hour', 'auto-load-next-post'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Get the minutes. |
| 86 | - $minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60; |
|
| 87 | - if ( $minutes > 1 ) { |
|
| 86 | + $minutes = (intval($seconds) / MINUTE_IN_SECONDS) % 60; |
|
| 87 | + if ($minutes > 1) { |
|
| 88 | 88 | /* translators: Number of minutes */ |
| 89 | - return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes ); |
|
| 90 | - } elseif ( $minutes > 0 ) { |
|
| 91 | - return __( 'a minute', 'auto-load-next-post' ); |
|
| 89 | + return sprintf(__('%s minutes', 'auto-load-next-post'), $minutes); |
|
| 90 | + } elseif ($minutes > 0) { |
|
| 91 | + return __('a minute', 'auto-load-next-post'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Get the seconds. |
| 95 | - $seconds = intval( $seconds ) % 60; |
|
| 96 | - if ( $seconds > 1 ) { |
|
| 95 | + $seconds = intval($seconds) % 60; |
|
| 96 | + if ($seconds > 1) { |
|
| 97 | 97 | /* translators: Number of seconds */ |
| 98 | - return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds ); |
|
| 99 | - } elseif ( $seconds > 0 ) { |
|
| 100 | - return __( 'a second', 'auto-load-next-post' ); |
|
| 98 | + return sprintf(__('%s seconds', 'auto-load-next-post'), $seconds); |
|
| 99 | + } elseif ($seconds > 0) { |
|
| 100 | + return __('a second', 'auto-load-next-post'); |
|
| 101 | 101 | } |
| 102 | 102 | } // END auto_load_next_post_seconds_to_words() |
| 103 | 103 | } |
@@ -12,7 +12,7 @@ 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 | |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | * @param string $version Version when the function was deprecated. |
| 24 | 24 | * @param string $replacement Replacement for the called function if any. |
| 25 | 25 | */ |
| 26 | -function alnp_deprecated_function( $function, $version, $replacement = null ) { |
|
| 27 | - if ( is_ajax() ) { |
|
| 28 | - do_action( 'deprecated_function_run', $function, $replacement, $version ); |
|
| 29 | - $log_string = sprintf( esc_html__( 'The %1$s function is deprecated since version %2$s', 'auto-load-next-post' ), $function, $version ); |
|
| 30 | - $log_string .= $replacement ? " " . sprintf( esc_html__( 'Replace with %s.', 'auto-load-next-post' ), $replacement ) : ''; |
|
| 26 | +function alnp_deprecated_function($function, $version, $replacement = null) { |
|
| 27 | + if (is_ajax()) { |
|
| 28 | + do_action('deprecated_function_run', $function, $replacement, $version); |
|
| 29 | + $log_string = sprintf(esc_html__('The %1$s function is deprecated since version %2$s', 'auto-load-next-post'), $function, $version); |
|
| 30 | + $log_string .= $replacement ? " ".sprintf(esc_html__('Replace with %s.', 'auto-load-next-post'), $replacement) : ''; |
|
| 31 | 31 | |
| 32 | - error_log( $log_string ); |
|
| 32 | + error_log($log_string); |
|
| 33 | 33 | } else { |
| 34 | - _deprecated_function( $function, $version, $replacement ); |
|
| 34 | + _deprecated_function($function, $version, $replacement); |
|
| 35 | 35 | } |
| 36 | 36 | } // END alnp_deprecated_function() |
| 37 | 37 | |
| 38 | -if ( ! function_exists( 'auto_load_next_post_is_ajax' ) ) { |
|
| 38 | +if ( ! function_exists('auto_load_next_post_is_ajax')) { |
|
| 39 | 39 | /** |
| 40 | 40 | * Returns true when the page is loaded via ajax. |
| 41 | 41 | * |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @return bool |
| 45 | 45 | */ |
| 46 | 46 | function auto_load_next_post_is_ajax() { |
| 47 | - alnp_deprecated_function( 'auto_load_next_post_is_ajax', '1.6.0', null ); |
|
| 47 | + alnp_deprecated_function('auto_load_next_post_is_ajax', '1.6.0', null); |
|
| 48 | 48 | |
| 49 | - if ( defined( 'DOING_AJAX' ) ) { |
|
| 49 | + if (defined('DOING_AJAX')) { |
|
| 50 | 50 | return true; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - return( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false; |
|
| 53 | + return(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false; |
|
| 54 | 54 | } // END auto_load_next_post_is_ajax |
| 55 | 55 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'ALNP_Admin' ) ) { |
|
| 18 | +if ( ! class_exists('ALNP_Admin')) { |
|
| 19 | 19 | |
| 20 | 20 | class ALNP_Admin { |
| 21 | 21 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | self::includes(); |
| 32 | 32 | |
| 33 | 33 | // Add settings page. |
| 34 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); |
|
| 34 | + add_action('admin_menu', array($this, 'admin_menu'), 9); |
|
| 35 | 35 | } // END __construct() |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | public function includes() { |
| 46 | 46 | global $wp_version; |
| 47 | 47 | |
| 48 | - include( dirname( __FILE__ ) . '/class-alnp-admin-action-links.php' ); // Action Links |
|
| 49 | - include( dirname( __FILE__ ) . '/class-alnp-admin-assets.php' ); // Admin Assets |
|
| 50 | - include( dirname( __FILE__ ) . '/class-alnp-admin-notices.php' ); // Plugin Notices |
|
| 48 | + include(dirname(__FILE__).'/class-alnp-admin-action-links.php'); // Action Links |
|
| 49 | + include(dirname(__FILE__).'/class-alnp-admin-assets.php'); // Admin Assets |
|
| 50 | + include(dirname(__FILE__).'/class-alnp-admin-notices.php'); // Plugin Notices |
|
| 51 | 51 | |
| 52 | - if ( apply_filters( 'alnp_enable_admin_help_tab', true ) ) { |
|
| 53 | - include( dirname( __FILE__ ) . '/class-alnp-admin-help.php' ); // Plugin Help Tab |
|
| 52 | + if (apply_filters('alnp_enable_admin_help_tab', true)) { |
|
| 53 | + include(dirname(__FILE__).'/class-alnp-admin-help.php'); // Plugin Help Tab |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - include_once( dirname( __FILE__ ) . '/class-alnp-getting-started.php'); // Getting Started. |
|
| 57 | - include_once( dirname( __FILE__ ) . '/class-alnp-setup-wizard.php'); // Setup Wizard. |
|
| 58 | - include_once( dirname( __FILE__ ) . '/class-alnp-extensions.php'); // Extensions. |
|
| 56 | + include_once(dirname(__FILE__).'/class-alnp-getting-started.php'); // Getting Started. |
|
| 57 | + include_once(dirname(__FILE__).'/class-alnp-setup-wizard.php'); // Setup Wizard. |
|
| 58 | + include_once(dirname(__FILE__).'/class-alnp-extensions.php'); // Extensions. |
|
| 59 | 59 | |
| 60 | - if ( ! is_alnp_pro_version_installed() ) { |
|
| 61 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-pro-preview.php'); // Pro Preview. |
|
| 60 | + if ( ! is_alnp_pro_version_installed()) { |
|
| 61 | + include_once(dirname(__FILE__).'/class-alnp-admin-pro-preview.php'); // Pro Preview. |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - include( dirname( __FILE__ ) . '/class-alnp-sidebar.php' ); // Sidebar |
|
| 65 | - include( dirname( __FILE__ ) . '/class-alnp-admin-footer.php' ); // Admin Footer |
|
| 66 | - include( dirname( __FILE__ ) . '/class-alnp-privacy.php' ); // Plugin Privacy |
|
| 64 | + include(dirname(__FILE__).'/class-alnp-sidebar.php'); // Sidebar |
|
| 65 | + include(dirname(__FILE__).'/class-alnp-admin-footer.php'); // Admin Footer |
|
| 66 | + include(dirname(__FILE__).'/class-alnp-privacy.php'); // Plugin Privacy |
|
| 67 | 67 | |
| 68 | - if ( version_compare( $wp_version, '5.2', '>=' ) ) { |
|
| 69 | - include( dirname( __FILE__ ) . '/class-alnp-admin-site-health.php' ); // Site Health |
|
| 68 | + if (version_compare($wp_version, '5.2', '>=')) { |
|
| 69 | + include(dirname(__FILE__).'/class-alnp-admin-site-health.php'); // Site Health |
|
| 70 | 70 | } |
| 71 | 71 | } // END includes() |
| 72 | 72 | |
@@ -78,33 +78,33 @@ discard block |
||
| 78 | 78 | * @version 1.6.0 |
| 79 | 79 | */ |
| 80 | 80 | public function admin_menu() { |
| 81 | - $current_view = ! empty( $_GET['view'] ) ? sanitize_title( wp_unslash( $_GET['view'] ) ) : ''; |
|
| 81 | + $current_view = ! empty($_GET['view']) ? sanitize_title(wp_unslash($_GET['view'])) : ''; |
|
| 82 | 82 | $title = ''; |
| 83 | 83 | |
| 84 | - switch( $current_view ) { |
|
| 84 | + switch ($current_view) { |
|
| 85 | 85 | case 'getting-started': |
| 86 | - $title = sprintf( esc_attr__( 'Getting Started with %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); |
|
| 86 | + $title = sprintf(esc_attr__('Getting Started with %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); |
|
| 87 | 87 | break; |
| 88 | 88 | case 'setup-wizard': |
| 89 | - $title = sprintf( esc_attr__( 'Setup Wizard for %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); |
|
| 89 | + $title = sprintf(esc_attr__('Setup Wizard for %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); |
|
| 90 | 90 | break; |
| 91 | 91 | case 'extensions': |
| 92 | - $title = sprintf( esc_attr__( '%s | Extensions', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); |
|
| 92 | + $title = sprintf(esc_attr__('%s | Extensions', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); |
|
| 93 | 93 | break; |
| 94 | 94 | default: |
| 95 | - $title = sprintf( esc_attr__( '%s Settings', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); |
|
| 95 | + $title = sprintf(esc_attr__('%s Settings', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); |
|
| 96 | 96 | break; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $settings_page = add_options_page( |
| 100 | 100 | $title, |
| 101 | - esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
| 101 | + esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
| 102 | 102 | 'manage_options', |
| 103 | 103 | 'auto-load-next-post', |
| 104 | - array( $this, 'settings_page' ) |
|
| 104 | + array($this, 'settings_page') |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | - add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) ); |
|
| 107 | + add_action('load-'.$settings_page, array($this, 'settings_page_init')); |
|
| 108 | 108 | } // END admin_menu() |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -120,29 +120,29 @@ discard block |
||
| 120 | 120 | global $current_view, $current_section; |
| 121 | 121 | |
| 122 | 122 | // Include settings pages. |
| 123 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
| 123 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
| 124 | 124 | |
| 125 | 125 | ALNP_Admin_Settings::get_settings_pages(); |
| 126 | 126 | |
| 127 | 127 | // Get current view/section. |
| 128 | - $current_view = empty( $_GET['view'] ) ? 'theme-selectors' : sanitize_title( wp_unslash( $_GET['view'] ) ); |
|
| 129 | - $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); |
|
| 128 | + $current_view = empty($_GET['view']) ? 'theme-selectors' : sanitize_title(wp_unslash($_GET['view'])); |
|
| 129 | + $current_section = empty($_REQUEST['section']) ? '' : sanitize_title(wp_unslash($_REQUEST['section'])); |
|
| 130 | 130 | |
| 131 | 131 | // Save settings if data has been posted. |
| 132 | - if ( apply_filters( '' !== $current_section ? "alnp_save_settings_{$current_view}_{$current_section}" : "alnp_save_settings_{$current_view}", ! empty( $_POST ) ) ) { |
|
| 132 | + if (apply_filters('' !== $current_section ? "alnp_save_settings_{$current_view}_{$current_section}" : "alnp_save_settings_{$current_view}", ! empty($_POST))) { |
|
| 133 | 133 | ALNP_Admin_Settings::save(); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // Add any posted messages. |
| 137 | - if ( ! empty( $_GET['auto_load_next_post_error'] ) ) { |
|
| 138 | - ALNP_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_error'] ) ) ); |
|
| 137 | + if ( ! empty($_GET['auto_load_next_post_error'])) { |
|
| 138 | + ALNP_Admin_Settings::add_error(wp_kses_post(wp_unslash($_GET['auto_load_next_post_error']))); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( ! empty( $_GET['auto_load_next_post_message'] ) ) { |
|
| 142 | - ALNP_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_message'] ) ) ); |
|
| 141 | + if ( ! empty($_GET['auto_load_next_post_message'])) { |
|
| 142 | + ALNP_Admin_Settings::add_message(wp_kses_post(wp_unslash($_GET['auto_load_next_post_message']))); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - do_action( 'auto_load_next_post_settings_page_init' ); |
|
| 145 | + do_action('auto_load_next_post_settings_page_init'); |
|
| 146 | 146 | } // END settings_page_init() |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @since 1.0.0 |
| 153 | 153 | */ |
| 154 | 154 | public function settings_page() { |
| 155 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
| 155 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
| 156 | 156 | |
| 157 | 157 | ALNP_Admin_Settings::output(); |
| 158 | 158 | } // END settings_page() |