@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | * @version 1.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -if ( have_posts() ) : |
|
11 | +if (have_posts()) : |
|
12 | 12 | |
13 | 13 | // Load content before the loop. |
14 | - do_action( 'alnp_load_before_loop' ); |
|
14 | + do_action('alnp_load_before_loop'); |
|
15 | 15 | |
16 | 16 | // Check that there are posts to load. |
17 | - while ( have_posts() ) : the_post(); |
|
17 | + while (have_posts()) : the_post(); |
|
18 | 18 | |
19 | 19 | // Load content before the post content. |
20 | - do_action( 'alnp_load_before_content' ); |
|
20 | + do_action('alnp_load_before_content'); |
|
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
@@ -29,26 +29,26 @@ discard block |
||
29 | 29 | |
30 | 30 | <div class="entry-content"> |
31 | 31 | <?php the_content(); ?> |
32 | - <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'auto-load-next-post' ), 'after' => '</div>' ) ); ?> |
|
32 | + <?php wp_link_pages(array('before' => '<div class="page-link">'.__('Pages:', 'auto-load-next-post'), 'after' => '</div>')); ?> |
|
33 | 33 | </div><!-- .entry-content --> |
34 | 34 | |
35 | - <?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?> |
|
35 | + <?php if (get_the_author_meta('description')) : // If a user has filled out their description, show a bio on their entries ?> |
|
36 | 36 | <div id="entry-author-info"> |
37 | 37 | <div id="author-avatar"> |
38 | 38 | |
39 | 39 | <?php |
40 | 40 | /** This filter is documented in author.php */ |
41 | - echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); |
|
41 | + echo get_avatar(get_the_author_meta('user_email'), apply_filters('twentyten_author_bio_avatar_size', 60)); |
|
42 | 42 | ?> |
43 | 43 | </div><!-- #author-avatar --> |
44 | 44 | |
45 | 45 | <div id="author-description"> |
46 | 46 | |
47 | - <h2><?php printf( __( 'About %s', 'auto-load-next-post' ), get_the_author() ); ?></h2> |
|
48 | - <?php the_author_meta( 'description' ); ?> |
|
47 | + <h2><?php printf(__('About %s', 'auto-load-next-post'), get_the_author()); ?></h2> |
|
48 | + <?php the_author_meta('description'); ?> |
|
49 | 49 | <div id="author-link"> |
50 | - <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author"> |
|
51 | - <?php printf( __( 'View all posts by %s <span class="meta-nav">→</span>', 'auto-load-next-post' ), get_the_author() ); ?> |
|
50 | + <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" rel="author"> |
|
51 | + <?php printf(__('View all posts by %s <span class="meta-nav">→</span>', 'auto-load-next-post'), get_the_author()); ?> |
|
52 | 52 | </a> |
53 | 53 | </div><!-- #author-link --> |
54 | 54 | |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | </div><!-- #post-## --> |
65 | 65 | |
66 | 66 | <div id="nav-below" class="navigation"> |
67 | - <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'auto-load-next-post' ) . '</span> %title' ); ?></div> |
|
67 | + <div class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">'._x('←', 'Previous post link', 'auto-load-next-post').'</span> %title'); ?></div> |
|
68 | 68 | </div><!-- #nav-below --> |
69 | 69 | |
70 | 70 | <?php |
71 | 71 | // Load content after the post content. |
72 | - do_action( 'alnp_load_after_content' ); |
|
72 | + do_action('alnp_load_after_content'); |
|
73 | 73 | |
74 | 74 | // End the loop. |
75 | 75 | endwhile; |
76 | 76 | |
77 | 77 | // Load content after the loop. |
78 | - do_action( 'alnp_load_after_loop' ); |
|
78 | + do_action('alnp_load_after_loop'); |
|
79 | 79 | |
80 | 80 | else : |
81 | 81 | |
82 | 82 | // Load content if there are no more posts. |
83 | - do_action( 'alnp_no_more_posts' ); |
|
83 | + do_action('alnp_no_more_posts'); |
|
84 | 84 | |
85 | 85 | endif; // END if have_posts() |
@@ -31,9 +31,11 @@ |
||
31 | 31 | // Load content after the loop. |
32 | 32 | do_action( 'alnp_load_after_loop' ); |
33 | 33 | |
34 | -else : |
|
34 | +else { |
|
35 | + : |
|
35 | 36 | |
36 | 37 | // Load content if there are no more posts. |
37 | 38 | do_action( 'alnp_no_more_posts' ); |
39 | +} |
|
38 | 40 | |
39 | 41 | endif; // END if have_posts() |
@@ -8,60 +8,60 @@ |
||
8 | 8 | * @version 1.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -if ( have_posts() ) : |
|
11 | +if (have_posts()) : |
|
12 | 12 | |
13 | 13 | // Load content before the loop. |
14 | - do_action( 'alnp_load_before_loop' ); |
|
14 | + do_action('alnp_load_before_loop'); |
|
15 | 15 | |
16 | 16 | // Check that there are posts to load. |
17 | - while ( have_posts() ) : the_post(); |
|
17 | + while (have_posts()) : the_post(); |
|
18 | 18 | |
19 | 19 | $post_format = get_post_format(); // Post Format e.g. video |
20 | 20 | |
21 | 21 | $post_type = alnp_get_post_type(); // Post Type e.g. single |
22 | 22 | |
23 | 23 | // Load content before the post content. |
24 | - do_action( 'alnp_load_before_content' ); |
|
24 | + do_action('alnp_load_before_content'); |
|
25 | 25 | |
26 | 26 | // Load content before the post content for a specific post format. |
27 | - do_action( 'alnp_load_before_content_post_format_' . $post_format ); |
|
27 | + do_action('alnp_load_before_content_post_format_'.$post_format); |
|
28 | 28 | |
29 | 29 | // Load content before the post content for a specific post type. |
30 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
30 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
31 | 31 | |
32 | - if ( false === $post_format ) { |
|
32 | + if (false === $post_format) { |
|
33 | 33 | /* |
34 | 34 | * Include the Post-Type-specific template for the content. |
35 | 35 | * layout-___.php (where ___ is the Post Type name). |
36 | 36 | */ |
37 | - if ( locate_template( alnp_template_location() . 'layout-' . $post_type . '.php') != '' ) { |
|
38 | - get_template_part( alnp_template_location() . 'layout', $post_type ); |
|
37 | + if (locate_template(alnp_template_location().'layout-'.$post_type.'.php') != '') { |
|
38 | + get_template_part(alnp_template_location().'layout', $post_type); |
|
39 | 39 | } else { |
40 | 40 | // If no specific post type found then fallback to standard layout.php file. |
41 | - get_template_part( alnp_template_location() . 'layout' ); |
|
41 | + get_template_part(alnp_template_location().'layout'); |
|
42 | 42 | } |
43 | 43 | } else { |
44 | - get_template_part( alnp_template_location() . 'layout', $post_format ); |
|
44 | + get_template_part(alnp_template_location().'layout', $post_format); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Load content after the post content for a specific post type. |
48 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
48 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
49 | 49 | |
50 | 50 | // Load content after the post content for a specific post format. |
51 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
51 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
52 | 52 | |
53 | 53 | // Load content after the post content. |
54 | - do_action( 'alnp_load_after_content' ); |
|
54 | + do_action('alnp_load_after_content'); |
|
55 | 55 | |
56 | 56 | // End the loop. |
57 | 57 | endwhile; |
58 | 58 | |
59 | 59 | // Load content after the loop. |
60 | - do_action( 'alnp_load_after_loop' ); |
|
60 | + do_action('alnp_load_after_loop'); |
|
61 | 61 | |
62 | 62 | else : |
63 | 63 | |
64 | 64 | // Load content if there are no more posts. |
65 | - do_action( 'alnp_no_more_posts' ); |
|
65 | + do_action('alnp_no_more_posts'); |
|
66 | 66 | |
67 | 67 | endif; // END if have_posts() |
@@ -31,9 +31,11 @@ |
||
31 | 31 | // Load content after the loop. |
32 | 32 | do_action( 'alnp_load_after_loop' ); |
33 | 33 | |
34 | -else : |
|
34 | +else { |
|
35 | + : |
|
35 | 36 | |
36 | 37 | // Load content if there are no more posts. |
37 | 38 | do_action( 'alnp_no_more_posts' ); |
39 | +} |
|
38 | 40 | |
39 | 41 | endif; // END if have_posts() |
@@ -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() |
@@ -31,9 +31,11 @@ |
||
31 | 31 | // Load content after the loop. |
32 | 32 | do_action( 'alnp_load_after_loop' ); |
33 | 33 | |
34 | -else : |
|
34 | +else { |
|
35 | + : |
|
35 | 36 | |
36 | 37 | // Load content if there are no more posts. |
37 | 38 | do_action( 'alnp_no_more_posts' ); |
39 | +} |
|
38 | 40 | |
39 | 41 | endif; // END if have_posts() |
@@ -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_Install' ) ) { |
|
18 | +if ( ! class_exists('ALNP_Install')) { |
|
19 | 19 | |
20 | 20 | class ALNP_Install { |
21 | 21 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | // Resets Auto Load Next Post settings when requested. |
31 | - add_action( 'init', array( __CLASS__, 'reset_alnp' ), 0 ); |
|
31 | + add_action('init', array(__CLASS__, 'reset_alnp'), 0); |
|
32 | 32 | |
33 | 33 | // Checks version of Auto Load Next Post and install/update if needed. |
34 | - add_action( 'init', array( __CLASS__, 'check_version' ), 5 ); |
|
34 | + add_action('init', array(__CLASS__, 'check_version'), 5); |
|
35 | 35 | |
36 | 36 | // Adds rewrite endpoint. |
37 | - add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 10 ); |
|
37 | + add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 10); |
|
38 | 38 | |
39 | 39 | // Redirect to Getting Started page once activated. |
40 | - add_action( 'activated_plugin', array( __CLASS__, 'redirect_getting_started') ); |
|
40 | + add_action('activated_plugin', array(__CLASS__, 'redirect_getting_started')); |
|
41 | 41 | } // END __construct() |
42 | 42 | |
43 | 43 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function check_version() { |
54 | 54 | // Check if we are not already running this routine. |
55 | - if ( 'yes' === get_transient( 'alnp_resetting' ) ) { |
|
55 | + if ('yes' === get_transient('alnp_resetting')) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( get_option( 'auto_load_next_post_version' ), AUTO_LOAD_NEXT_POST_VERSION, '<' ) && current_user_can( 'install_plugins' ) ) { |
|
59 | + if ( ! defined('IFRAME_REQUEST') && version_compare(get_option('auto_load_next_post_version'), AUTO_LOAD_NEXT_POST_VERSION, '<') && current_user_can('install_plugins')) { |
|
60 | 60 | self::install(); |
61 | - do_action( 'auto_load_next_post_updated' ); |
|
61 | + do_action('auto_load_next_post_updated'); |
|
62 | 62 | } |
63 | 63 | } // END check_version() |
64 | 64 | |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | * @version 1.6.0 |
72 | 72 | */ |
73 | 73 | public static function install() { |
74 | - if ( ! is_blog_installed() ) { |
|
74 | + if ( ! is_blog_installed()) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Check if we are not already running this routine. |
79 | - if ( 'yes' === get_transient( 'alnp_installing' ) ) { |
|
79 | + if ('yes' === get_transient('alnp_installing')) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // If we made it till here nothing is running yet, lets set the transient now for two minutes. |
84 | - set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 2 ); |
|
85 | - if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) { |
|
86 | - define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true ); |
|
84 | + set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 2); |
|
85 | + if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) { |
|
86 | + define('AUTO_LOAD_NEXT_POST_INSTALLING', true); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Add default options. |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | // Refresh rewrite rules. |
108 | 108 | self::flush_rewrite_rules(); |
109 | 109 | |
110 | - delete_transient( 'alnp_installing' ); |
|
110 | + delete_transient('alnp_installing'); |
|
111 | 111 | |
112 | - do_action( 'alnp_installed' ); |
|
112 | + do_action('alnp_installed'); |
|
113 | 113 | } // END install() |
114 | 114 | |
115 | 115 | /** |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | * @since 1.5.0 |
122 | 122 | */ |
123 | 123 | private static function set_theme_selectors() { |
124 | - if ( is_alnp_supported() ) { |
|
125 | - $content_container = alnp_get_theme_support( 'content_container' ); |
|
126 | - $title_selector = alnp_get_theme_support( 'title_selector' ); |
|
127 | - $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
|
128 | - $comments_container = alnp_get_theme_support( 'comments_container' ); |
|
129 | - |
|
130 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
131 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
132 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
133 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
124 | + if (is_alnp_supported()) { |
|
125 | + $content_container = alnp_get_theme_support('content_container'); |
|
126 | + $title_selector = alnp_get_theme_support('title_selector'); |
|
127 | + $navigation_container = alnp_get_theme_support('navigation_container'); |
|
128 | + $comments_container = alnp_get_theme_support('comments_container'); |
|
129 | + |
|
130 | + if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container); |
|
131 | + if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector); |
|
132 | + if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container); |
|
133 | + if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container); |
|
134 | 134 | } |
135 | 135 | } // END set_theme_selectors() |
136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @version 1.5.3 |
146 | 146 | */ |
147 | 147 | private static function set_js_in_footer() { |
148 | - if ( is_alnp_supported() ) { |
|
149 | - $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
|
150 | - $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
|
148 | + if (is_alnp_supported()) { |
|
149 | + $load_js_in_footer = alnp_get_theme_support('load_js_in_footer'); |
|
150 | + $lock_js_in_footer = alnp_get_theme_support('lock_js_in_footer'); |
|
151 | 151 | |
152 | - if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
153 | - if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
152 | + if ( ! empty($load_js_in_footer) && $load_js_in_footer == 'yes') update_option('auto_load_next_post_load_js_in_footer', $load_js_in_footer); |
|
153 | + if ( ! empty($lock_js_in_footer) && $lock_js_in_footer == 'yes') update_option('auto_load_next_post_lock_js_in_footer', $lock_js_in_footer); |
|
154 | 154 | } |
155 | 155 | } // END set_js_in_footer() |
156 | 156 | |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * @since 1.6.0 |
164 | 164 | */ |
165 | 165 | private static function set_template_directory() { |
166 | - if ( is_alnp_supported() ) { |
|
167 | - $directory = alnp_get_theme_support( 'directory_post' ); |
|
166 | + if (is_alnp_supported()) { |
|
167 | + $directory = alnp_get_theme_support('directory_post'); |
|
168 | 168 | |
169 | - if ( ! empty( $directory ) ) update_option( 'auto_load_next_post_directory_post', $directory ); |
|
169 | + if ( ! empty($directory)) update_option('auto_load_next_post_directory_post', $directory); |
|
170 | 170 | } |
171 | 171 | } // END set_template_directory() |
172 | 172 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @static |
178 | 178 | */ |
179 | 179 | private static function update_version() { |
180 | - update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION ); |
|
180 | + update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION); |
|
181 | 181 | } // END update_version() |
182 | 182 | |
183 | 183 | /** |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @version 1.5.0 |
190 | 190 | */ |
191 | 191 | public static function set_install_date() { |
192 | - $install_date = get_site_option( 'auto_load_next_post_install_date' ); |
|
192 | + $install_date = get_site_option('auto_load_next_post_install_date'); |
|
193 | 193 | |
194 | 194 | // If ALNP was installed before but the install date was not converted to time then convert it. |
195 | - if ( ! empty( $install_date ) && ! intval( $install_date ) ) { |
|
196 | - update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) ); |
|
195 | + if ( ! empty($install_date) && ! intval($install_date)) { |
|
196 | + update_site_option('auto_load_next_post_install_date', strtotime($install_date)); |
|
197 | 197 | } else { |
198 | - add_site_option( 'auto_load_next_post_install_date', time() ); |
|
198 | + add_site_option('auto_load_next_post_install_date', time()); |
|
199 | 199 | } |
200 | 200 | } // END set_install_date() |
201 | 201 | |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public static function create_options() { |
213 | 213 | // Include settings so that we can run through defaults |
214 | - include_once( dirname( __FILE__ ) . '/admin/class-alnp-admin-settings.php' ); |
|
214 | + include_once(dirname(__FILE__).'/admin/class-alnp-admin-settings.php'); |
|
215 | 215 | |
216 | 216 | $settings = ALNP_Admin_Settings::get_settings_pages(); |
217 | 217 | |
218 | - foreach ( $settings as $section ) { |
|
219 | - foreach ( $section->get_settings() as $value ) { |
|
220 | - if ( isset( $value['default'] ) && isset( $value['id'] ) ) { |
|
221 | - $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true; |
|
222 | - add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) ); |
|
218 | + foreach ($settings as $section) { |
|
219 | + foreach ($section->get_settings() as $value) { |
|
220 | + if (isset($value['default']) && isset($value['id'])) { |
|
221 | + $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true; |
|
222 | + add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no')); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @version 1.5.0 |
235 | 235 | */ |
236 | 236 | public static function add_rewrite_endpoint() { |
237 | - add_rewrite_endpoint( 'alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT ); |
|
237 | + add_rewrite_endpoint('alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT); |
|
238 | 238 | } // END add_rewrite_endpoint() |
239 | 239 | |
240 | 240 | /** |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | * @global object $wpdb |
259 | 259 | */ |
260 | 260 | public static function reset_alnp() { |
261 | - if ( current_user_can( 'install_plugins' ) && isset( $_GET['reset-alnp'] ) && $_GET['reset-alnp'] == 'yes' ) { |
|
261 | + if (current_user_can('install_plugins') && isset($_GET['reset-alnp']) && $_GET['reset-alnp'] == 'yes') { |
|
262 | 262 | global $wpdb; |
263 | 263 | |
264 | 264 | // If we made it till here nothing is running yet, lets set the transient now for two minutes. |
265 | - set_transient( 'alnp_resetting', 'yes', MINUTE_IN_SECONDS * 2 ); |
|
265 | + set_transient('alnp_resetting', 'yes', MINUTE_IN_SECONDS * 2); |
|
266 | 266 | |
267 | 267 | // Make sure it is only a single site we are resetting. |
268 | - if ( ! is_multisite() ) { |
|
268 | + if ( ! is_multisite()) { |
|
269 | 269 | // Delete options |
270 | 270 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'"); |
271 | 271 | |
@@ -274,19 +274,19 @@ discard block |
||
274 | 274 | } |
275 | 275 | else { |
276 | 276 | // Delete Uninstall Data |
277 | - delete_site_option( 'auto_load_next_post_uninstall_data' ); |
|
277 | + delete_site_option('auto_load_next_post_uninstall_data'); |
|
278 | 278 | |
279 | 279 | // Delete Install Date |
280 | - delete_site_option( 'auto_load_next_post_install_date' ); |
|
280 | + delete_site_option('auto_load_next_post_install_date'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | // Re-install Auto Load Next Post |
284 | 284 | self::install(); |
285 | 285 | |
286 | - wp_safe_redirect( add_query_arg( array( |
|
286 | + wp_safe_redirect(add_query_arg(array( |
|
287 | 287 | 'page' => 'auto-load-next-post', |
288 | 288 | 'reset' => 'done' |
289 | - ), admin_url( 'options-general.php' ) ) ); |
|
289 | + ), admin_url('options-general.php'))); |
|
290 | 290 | exit; |
291 | 291 | } |
292 | 292 | } // END reset_alnp() |
@@ -299,36 +299,36 @@ discard block |
||
299 | 299 | * @since 1.6.0 |
300 | 300 | * @param string $plugin The activate plugin name. |
301 | 301 | */ |
302 | - public static function redirect_getting_started( $plugin ) { |
|
302 | + public static function redirect_getting_started($plugin) { |
|
303 | 303 | // Prevent redirect if plugin name does not match. |
304 | - if ( $plugin !== plugin_basename( AUTO_LOAD_NEXT_POST_FILE ) ) { |
|
304 | + if ($plugin !== plugin_basename(AUTO_LOAD_NEXT_POST_FILE)) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
308 | - $getting_started = add_query_arg( array( |
|
308 | + $getting_started = add_query_arg(array( |
|
309 | 309 | 'page' => 'auto-load-next-post', |
310 | 310 | 'view' => 'getting-started' |
311 | - ), admin_url( 'options-general.php' ) ); |
|
311 | + ), admin_url('options-general.php')); |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Should Auto Load Next Post be installed via WP-CLI, |
315 | 315 | * display a link to the Getting Started page. |
316 | 316 | */ |
317 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
317 | + if (defined('WP_CLI') && WP_CLI) { |
|
318 | 318 | WP_CLI::log( |
319 | 319 | WP_CLI::colorize( |
320 | - '%y' . sprintf( ' |
@@ -127,10 +127,18 @@ discard block |
||
127 | 127 | $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
128 | 128 | $comments_container = alnp_get_theme_support( 'comments_container' ); |
129 | 129 | |
130 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
131 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
132 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
133 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
130 | + if ( ! empty( $content_container ) ) { |
|
131 | + update_option( 'auto_load_next_post_content_container', $content_container ); |
|
132 | + } |
|
133 | + if ( ! empty( $title_selector ) ) { |
|
134 | + update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
135 | + } |
|
136 | + if ( ! empty( $navigation_container ) ) { |
|
137 | + update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
138 | + } |
|
139 | + if ( ! empty( $comments_container ) ) { |
|
140 | + update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
141 | + } |
|
134 | 142 | } |
135 | 143 | } // END set_theme_selectors() |
136 | 144 | |
@@ -149,8 +157,12 @@ discard block |
||
149 | 157 | $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
150 | 158 | $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
151 | 159 | |
152 | - if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
153 | - if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
160 | + if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) { |
|
161 | + update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
162 | + } |
|
163 | + if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) { |
|
164 | + update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
165 | + } |
|
154 | 166 | } |
155 | 167 | } // END set_js_in_footer() |
156 | 168 | |
@@ -166,7 +178,9 @@ discard block |
||
166 | 178 | if ( is_alnp_supported() ) { |
167 | 179 | $directory = alnp_get_theme_support( 'directory_post' ); |
168 | 180 | |
169 | - if ( ! empty( $directory ) ) update_option( 'auto_load_next_post_directory_post', $directory ); |
|
181 | + if ( ! empty( $directory ) ) { |
|
182 | + update_option( 'auto_load_next_post_directory_post', $directory ); |
|
183 | + } |
|
170 | 184 | } |
171 | 185 | } // END set_template_directory() |
172 | 186 | |
@@ -271,8 +285,7 @@ discard block |
||
271 | 285 | |
272 | 286 | // Delete user interactions |
273 | 287 | $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'auto_load_next_post_%'"); |
274 | - } |
|
275 | - else { |
|
288 | + } else { |
|
276 | 289 | // Delete Uninstall Data |
277 | 290 | delete_site_option( 'auto_load_next_post_uninstall_data' ); |
278 | 291 |
@@ -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. |