@@ -8,32 +8,32 @@ |
||
| 8 | 8 | * @version 1.5.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 | // Load 'loop-templates/content-single.php' |
| 23 | - get_template_part( alnp_template_location() . 'content', 'single' ); |
|
| 23 | + get_template_part(alnp_template_location().'content', 'single'); |
|
| 24 | 24 | |
| 25 | 25 | // Load content after the post content. |
| 26 | - do_action( 'alnp_load_after_content' ); |
|
| 26 | + do_action('alnp_load_after_content'); |
|
| 27 | 27 | |
| 28 | 28 | // End the loop. |
| 29 | 29 | endwhile; |
| 30 | 30 | |
| 31 | 31 | // Load content after the loop. |
| 32 | - do_action( 'alnp_load_after_loop' ); |
|
| 32 | + do_action('alnp_load_after_loop'); |
|
| 33 | 33 | |
| 34 | 34 | else : |
| 35 | 35 | |
| 36 | 36 | // Load content if there are no more posts. |
| 37 | - do_action( 'alnp_no_more_posts' ); |
|
| 37 | + do_action('alnp_no_more_posts'); |
|
| 38 | 38 | |
| 39 | 39 | 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,40 +8,40 @@ |
||
| 8 | 8 | * @version 1.5.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 more posts to load. |
| 17 | - while ( have_posts() ) : the_post(); |
|
| 17 | + while (have_posts()) : the_post(); |
|
| 18 | 18 | |
| 19 | 19 | $post_type = alnp_get_post_type(); // Post Type e.g. single |
| 20 | 20 | |
| 21 | 21 | // Load content before the post content. |
| 22 | - do_action( 'alnp_load_before_content' ); |
|
| 22 | + do_action('alnp_load_before_content'); |
|
| 23 | 23 | |
| 24 | 24 | // Load content before the post content for a specific post type. |
| 25 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
| 25 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
| 26 | 26 | |
| 27 | 27 | // Load Make partial template for the correct post type. |
| 28 | - get_template_part( 'partials/content', $post_type ); |
|
| 28 | + get_template_part('partials/content', $post_type); |
|
| 29 | 29 | |
| 30 | 30 | // Load content after the post content for a specific post type. |
| 31 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
| 31 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
| 32 | 32 | |
| 33 | 33 | // Load content before the post content. |
| 34 | - do_action( 'alnp_load_after_content' ); |
|
| 34 | + do_action('alnp_load_after_content'); |
|
| 35 | 35 | |
| 36 | 36 | // End the loop. |
| 37 | 37 | endwhile; |
| 38 | 38 | |
| 39 | 39 | // Load content after the loop. |
| 40 | - do_action( 'alnp_load_after_loop' ); |
|
| 40 | + do_action('alnp_load_after_loop'); |
|
| 41 | 41 | |
| 42 | 42 | else : |
| 43 | 43 | |
| 44 | 44 | // Load content if there are no more posts. |
| 45 | - do_action( 'alnp_no_more_posts' ); |
|
| 45 | + do_action('alnp_no_more_posts'); |
|
| 46 | 46 | |
| 47 | 47 | endif; // END if have_posts() |
@@ -39,9 +39,11 @@ |
||
| 39 | 39 | // Load content after the loop. |
| 40 | 40 | do_action( 'alnp_load_after_loop' ); |
| 41 | 41 | |
| 42 | - else : |
|
| 42 | + else { |
|
| 43 | + : |
|
| 43 | 44 | |
| 44 | 45 | // Load content if there are no more posts. |
| 45 | 46 | do_action( 'alnp_no_more_posts' ); |
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | endif; // END if have_posts() |
@@ -16,69 +16,69 @@ |
||
| 16 | 16 | * @version 1.5.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 | - if ( false === $post_format ) { |
|
| 40 | + if (false === $post_format) { |
|
| 41 | 41 | /* |
| 42 | 42 | * Include the Post-Type-specific template for the content. |
| 43 | 43 | * content-___.php (where ___ is the Post Type name). |
| 44 | 44 | */ |
| 45 | - if ( locate_template( alnp_template_location() . 'content-' . $post_type . '.php') != '' ) { |
|
| 46 | - get_template_part( alnp_template_location() . 'content', $post_type ); |
|
| 45 | + if (locate_template(alnp_template_location().'content-'.$post_type.'.php') != '') { |
|
| 46 | + get_template_part(alnp_template_location().'content', $post_type); |
|
| 47 | 47 | } else { |
| 48 | 48 | // If no specific post type found then fallback to standard content.php file. |
| 49 | - get_template_part( alnp_template_location() . 'content' ); |
|
| 49 | + get_template_part(alnp_template_location().'content'); |
|
| 50 | 50 | } |
| 51 | 51 | } else { |
| 52 | 52 | /* |
| 53 | 53 | * Include the Post-Format-specific template for the content. |
| 54 | 54 | * called format-___.php (where ___ is the Post Format name). |
| 55 | 55 | */ |
| 56 | - if ( locate_template( alnp_template_location() . 'format-' . $post_format . '.php' ) != '' ) { |
|
| 57 | - get_template_part( alnp_template_location() . 'format', $post_format ); |
|
| 56 | + if (locate_template(alnp_template_location().'format-'.$post_format.'.php') != '') { |
|
| 57 | + get_template_part(alnp_template_location().'format', $post_format); |
|
| 58 | 58 | } else { |
| 59 | 59 | // If no format-{post-format}.php file found then fallback to content-{post-format}.php |
| 60 | - get_template_part( alnp_template_location() . 'content', $post_format ); |
|
| 60 | + get_template_part(alnp_template_location().'content', $post_format); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Load content after the post content for a specific post type. |
| 65 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
| 65 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
| 66 | 66 | |
| 67 | 67 | // Load content after the post content for a specific post format. |
| 68 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
| 68 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
| 69 | 69 | |
| 70 | 70 | // Load content after the post content. |
| 71 | - do_action( 'alnp_load_after_content' ); |
|
| 71 | + do_action('alnp_load_after_content'); |
|
| 72 | 72 | |
| 73 | 73 | // End the loop. |
| 74 | 74 | endwhile; |
| 75 | 75 | |
| 76 | 76 | // Load content after the loop. |
| 77 | - do_action( 'alnp_load_after_loop' ); |
|
| 77 | + do_action('alnp_load_after_loop'); |
|
| 78 | 78 | |
| 79 | 79 | else : |
| 80 | 80 | |
| 81 | 81 | // Load content if there are no more posts. |
| 82 | - do_action( 'alnp_no_more_posts' ); |
|
| 82 | + do_action('alnp_no_more_posts'); |
|
| 83 | 83 | |
| 84 | 84 | 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() |
@@ -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 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | 30 | // Update theme selectors if the theme was switched and it has theme support. |
| 31 | - add_action( 'after_switch_theme', array( $this, 'update_alnp_theme_selectors' ), 15, 2 ); |
|
| 31 | + add_action('after_switch_theme', array($this, 'update_alnp_theme_selectors'), 15, 2); |
|
| 32 | 32 | } // END __construct() |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @access public |
| 39 | 39 | */ |
| 40 | - public function update_alnp_theme_selectors( $stylesheet = '', $old_theme = false ) { |
|
| 40 | + public function update_alnp_theme_selectors($stylesheet = '', $old_theme = false) { |
|
| 41 | 41 | // Check if Auto Load Next Post is supported before updating the theme selectors. |
| 42 | - if ( is_alnp_supported() ) { |
|
| 43 | - $theme_support = get_theme_support( 'auto-load-next-post' ); |
|
| 42 | + if (is_alnp_supported()) { |
|
| 43 | + $theme_support = get_theme_support('auto-load-next-post'); |
|
| 44 | 44 | |
| 45 | - if ( is_array( $theme_support ) ) { |
|
| 45 | + if (is_array($theme_support)) { |
|
| 46 | 46 | // Preferred implementation, where theme provides an array of options |
| 47 | - if ( isset( $theme_support[0] ) && is_array( $theme_support[0] ) ) { |
|
| 48 | - foreach( $theme_support[0] as $key => $value ) { |
|
| 49 | - if ( ! empty( $value ) ) update_option( 'auto_load_next_post_' . $key, $value ); |
|
| 47 | + if (isset($theme_support[0]) && is_array($theme_support[0])) { |
|
| 48 | + foreach ($theme_support[0] as $key => $value) { |
|
| 49 | + if ( ! empty($value)) update_option('auto_load_next_post_'.$key, $value); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -46,7 +46,9 @@ |
||
| 46 | 46 | // Preferred implementation, where theme provides an array of options |
| 47 | 47 | if ( isset( $theme_support[0] ) && is_array( $theme_support[0] ) ) { |
| 48 | 48 | foreach( $theme_support[0] as $key => $value ) { |
| 49 | - if ( ! empty( $value ) ) update_option( 'auto_load_next_post_' . $key, $value ); |
|
| 49 | + if ( ! empty( $value ) ) { |
|
| 50 | + update_option( 'auto_load_next_post_' . $key, $value ); |
|
| 51 | + } |
|
| 50 | 52 | } |
| 51 | 53 | } |
| 52 | 54 | } |
@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | - if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | + if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( ! class_exists( 'Auto_Load_Next_Post_Autoloader' ) ) { |
|
| 19 | +if ( ! class_exists('Auto_Load_Next_Post_Autoloader')) { |
|
| 20 | 20 | |
| 21 | 21 | class Auto_Load_Next_Post_Autoloader { |
| 22 | 22 | |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * The Constructor. |
| 33 | 33 | */ |
| 34 | 34 | public function __construct() { |
| 35 | - if ( function_exists( '__autoload' ) ) { |
|
| 36 | - spl_autoload_register( '__autoload' ); |
|
| 35 | + if (function_exists('__autoload')) { |
|
| 36 | + spl_autoload_register('__autoload'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 39 | + spl_autoload_register(array($this, 'autoload')); |
|
| 40 | 40 | |
| 41 | - $this->include_path = untrailingslashit( plugin_dir_path( AUTO_LOAD_NEXT_POST_FILE ) ) . '/includes/'; |
|
| 41 | + $this->include_path = untrailingslashit(plugin_dir_path(AUTO_LOAD_NEXT_POST_FILE)).'/includes/'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * @param string $class Class name. |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - private function get_file_name_from_class( $class ) { |
|
| 52 | - return 'class-' . str_replace( '_', '-', $class ) . '.php'; |
|
| 51 | + private function get_file_name_from_class($class) { |
|
| 52 | + return 'class-'.str_replace('_', '-', $class).'.php'; |
|
| 53 | 53 | } // END get_file_name_from_class() |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | * @param string $path File path. |
| 60 | 60 | * @return bool Successful or not. |
| 61 | 61 | */ |
| 62 | - private function load_file( $path ) { |
|
| 63 | - if ( $path && is_readable( $path ) ) { |
|
| 62 | + private function load_file($path) { |
|
| 63 | + if ($path && is_readable($path)) { |
|
| 64 | 64 | include_once $path; |
| 65 | 65 | return true; |
| 66 | 66 | } |
@@ -73,22 +73,22 @@ discard block |
||
| 73 | 73 | * @access public |
| 74 | 74 | * @param string $class Class name. |
| 75 | 75 | */ |
| 76 | - public function autoload( $class ) { |
|
| 77 | - $class = strtolower( $class ); |
|
| 76 | + public function autoload($class) { |
|
| 77 | + $class = strtolower($class); |
|
| 78 | 78 | |
| 79 | - if ( 0 !== strpos( $class, 'alnp_' ) ) { |
|
| 79 | + if (0 !== strpos($class, 'alnp_')) { |
|
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $file = $this->get_file_name_from_class( $class ); |
|
| 83 | + $file = $this->get_file_name_from_class($class); |
|
| 84 | 84 | $path = ''; |
| 85 | 85 | |
| 86 | - if ( 0 === strpos( $class, 'alnp_admin' ) ) { |
|
| 87 | - $path = $this->include_path . 'admin/'; |
|
| 86 | + if (0 === strpos($class, 'alnp_admin')) { |
|
| 87 | + $path = $this->include_path.'admin/'; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( empty( $path ) || ! $this->load_file( $path . $file ) ) { |
|
| 91 | - $this->load_file( $this->include_path . $file ); |
|
| 90 | + if (empty($path) || ! $this->load_file($path.$file)) { |
|
| 91 | + $this->load_file($this->include_path.$file); |
|
| 92 | 92 | } |
| 93 | 93 | } // END autoload() |
| 94 | 94 | |
@@ -124,8 +124,7 @@ |
||
| 124 | 124 | add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
| 125 | 125 | update_option( 'auto_load_next_post_theme_supported', $template ); |
| 126 | 126 | } |
| 127 | - } |
|
| 128 | - else { |
|
| 127 | + } else { |
|
| 129 | 128 | // If theme not supported then delete option. |
| 130 | 129 | delete_option( 'auto_load_next_post_theme_supported' ); |
| 131 | 130 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Auto_Load_Next_Post_Admin_Notices' ) ) { |
|
| 18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Notices')) { |
|
| 19 | 19 | |
| 20 | 20 | class Auto_Load_Next_Post_Admin_Notices { |
| 21 | 21 | |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | * @version 1.5.11 |
| 38 | 38 | */ |
| 39 | 39 | public function __construct() { |
| 40 | - self::$install_date = get_site_option( 'auto_load_next_post_install_date', time() ); |
|
| 40 | + self::$install_date = get_site_option('auto_load_next_post_install_date', time()); |
|
| 41 | 41 | |
| 42 | 42 | // Check WordPress enviroment. |
| 43 | - add_action( 'admin_init', array( $this, 'check_wp' ), 12 ); |
|
| 43 | + add_action('admin_init', array($this, 'check_wp'), 12); |
|
| 44 | 44 | |
| 45 | 45 | // Don't bug the user if they don't want to see any notices. |
| 46 | - add_action( 'admin_init', array( $this, 'dont_bug_me' ), 15 ); |
|
| 46 | + add_action('admin_init', array($this, 'dont_bug_me'), 15); |
|
| 47 | 47 | |
| 48 | 48 | // Display other admin notices when required. All are dismissable. |
| 49 | - add_action( 'admin_print_styles', array( $this, 'add_notices' ), 0 ); |
|
| 49 | + add_action('admin_print_styles', array($this, 'add_notices'), 0); |
|
| 50 | 50 | } // END __construct() |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | global $wp_version; |
| 63 | 63 | |
| 64 | 64 | // If the current user can not install plugins then return nothing! |
| 65 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 65 | + if ( ! current_user_can('install_plugins')) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ( ! version_compare( $wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=' ) ) { |
|
| 70 | - add_action( 'admin_notices', array( $this, 'requirement_wp_notice' ) ); |
|
| 69 | + if ( ! version_compare($wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=')) { |
|
| 70 | + add_action('admin_notices', array($this, 'requirement_wp_notice')); |
|
| 71 | 71 | return false; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -87,25 +87,25 @@ discard block |
||
| 87 | 87 | $user_hidden_notice = false; |
| 88 | 88 | |
| 89 | 89 | // If the user is allowed to install plugins and requested to hide the review notice then hide it for that user. |
| 90 | - if ( ! empty( $_GET['hide_auto_load_next_post_review_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 91 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true ); |
|
| 90 | + if ( ! empty($_GET['hide_auto_load_next_post_review_notice']) && current_user_can('install_plugins')) { |
|
| 91 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true); |
|
| 92 | 92 | $user_hidden_notice = true; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // If the user is allowed to install plugins and requested to hide the welcome notice then hide it for that user. |
| 96 | - if ( ! empty( $_GET['hide_auto_load_next_post_welcome_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 97 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true ); |
|
| 96 | + if ( ! empty($_GET['hide_auto_load_next_post_welcome_notice']) && current_user_can('install_plugins')) { |
|
| 97 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true); |
|
| 98 | 98 | $user_hidden_notice = true; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( ! empty( $_GET['hide_auto_load_next_post_beta_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 102 | - set_transient( 'alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS ); |
|
| 101 | + if ( ! empty($_GET['hide_auto_load_next_post_beta_notice']) && current_user_can('install_plugins')) { |
|
| 102 | + set_transient('alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS); |
|
| 103 | 103 | $user_hidden_notice = true; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( $user_hidden_notice ) { |
|
| 106 | + if ($user_hidden_notice) { |
|
| 107 | 107 | // Redirect to the plugins page. |
| 108 | - wp_safe_redirect( admin_url( 'plugins.php' ) ); |
|
| 108 | + wp_safe_redirect(admin_url('plugins.php')); |
|
| 109 | 109 | exit; |
| 110 | 110 | } |
| 111 | 111 | } // END dont_bug_me() |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | global $current_user; |
| 125 | 125 | |
| 126 | 126 | // If the current user can not install plugins then return nothing! |
| 127 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 127 | + if ( ! current_user_can('install_plugins')) { |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -132,58 +132,58 @@ discard block |
||
| 132 | 132 | $screen_id = $screen ? $screen->id : ''; |
| 133 | 133 | |
| 134 | 134 | // Notices should only show on the main dashboard and on the plugins screen. |
| 135 | - if ( ! in_array( $screen_id, alnp_get_admin_screens() ) ) { |
|
| 135 | + if ( ! in_array($screen_id, alnp_get_admin_screens())) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Is admin welcome notice hidden? |
| 140 | - $hide_welcome_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', true ); |
|
| 140 | + $hide_welcome_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', true); |
|
| 141 | 141 | |
| 142 | 142 | // Check if we need to display the welcome notice. |
| 143 | - if ( empty( $hide_welcome_notice ) ) { |
|
| 143 | + if (empty($hide_welcome_notice)) { |
|
| 144 | 144 | // If the user has just installed the plugin for the first time then welcome the user. |
| 145 | - if ( ( intval( time() - self::$install_date ) / WEEK_IN_SECONDS ) % 52 <= 2 ) { |
|
| 146 | - add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); |
|
| 145 | + if ((intval(time() - self::$install_date) / WEEK_IN_SECONDS) % 52 <= 2) { |
|
| 146 | + add_action('admin_notices', array($this, 'welcome_notice')); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Is admin review notice hidden? |
| 151 | - $hide_review_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', true ); |
|
| 151 | + $hide_review_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', true); |
|
| 152 | 152 | |
| 153 | 153 | // Check if we need to display the review plugin notice. |
| 154 | - if ( empty( $hide_review_notice ) ) { |
|
| 154 | + if (empty($hide_review_notice)) { |
|
| 155 | 155 | // If it has been a week or more since activating the plugin then display the review notice. |
| 156 | - if ( ( intval( time() - self::$install_date ) ) > WEEK_IN_SECONDS ) { |
|
| 157 | - add_action( 'admin_notices', array( $this, 'plugin_review_notice' ) ); |
|
| 156 | + if ((intval(time() - self::$install_date)) > WEEK_IN_SECONDS) { |
|
| 157 | + add_action('admin_notices', array($this, 'plugin_review_notice')); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Is this version of Auto Load Next Post a beta release? |
| 162 | - if ( is_alnp_beta() && empty( get_transient( 'alnp_beta_notice_hidden' ) ) ) { |
|
| 163 | - add_action( 'admin_notices', array( $this, 'beta_notice' ) ); |
|
| 162 | + if (is_alnp_beta() && empty(get_transient('alnp_beta_notice_hidden'))) { |
|
| 163 | + add_action('admin_notices', array($this, 'beta_notice')); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $template = get_option( 'template' ); |
|
| 166 | + $template = get_option('template'); |
|
| 167 | 167 | |
| 168 | 168 | // Checks if the theme supports Auto Load Next Post and not provided via a plugin. |
| 169 | - if ( is_alnp_supported() ) { |
|
| 170 | - $plugin_supported = alnp_get_theme_support( 'plugin_support' ); |
|
| 169 | + if (is_alnp_supported()) { |
|
| 170 | + $plugin_supported = alnp_get_theme_support('plugin_support'); |
|
| 171 | 171 | |
| 172 | 172 | // Return if theme is supported via plugin. |
| 173 | - if ( ! empty( $plugin_supported ) && $plugin_supported == 'yes' ) { |
|
| 174 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 173 | + if ( ! empty($plugin_supported) && $plugin_supported == 'yes') { |
|
| 174 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 175 | 175 | return false; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // If supported theme does not match active theme then show notice. |
| 179 | - if ( get_option( 'auto_load_next_post_theme_supported' ) !== $template ) { |
|
| 180 | - add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
|
| 181 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 179 | + if (get_option('auto_load_next_post_theme_supported') !== $template) { |
|
| 180 | + add_action('admin_notices', array($this, 'theme_ready_notice')); |
|
| 181 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | else { |
| 185 | 185 | // If theme not supported then delete option. |
| 186 | - delete_option( 'auto_load_next_post_theme_supported' ); |
|
| 186 | + delete_option('auto_load_next_post_theme_supported'); |
|
| 187 | 187 | } |
| 188 | 188 | } // END add_notices() |
| 189 | 189 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @since 1.4.3 |
| 195 | 195 | */ |
| 196 | 196 | public function requirement_wp_notice() { |
| 197 | - include( dirname( __FILE__ ) . '/views/html-notice-requirement-wp.php' ); |
|
| 197 | + include(dirname(__FILE__).'/views/html-notice-requirement-wp.php'); |
|
| 198 | 198 | } // END requirement_wp_notice() |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @since 1.5.0 |
| 205 | 205 | */ |
| 206 | 206 | public function theme_ready_notice() { |
| 207 | - include( dirname( __FILE__ ) . '/views/html-notice-theme-ready.php' ); |
|
| 207 | + include(dirname(__FILE__).'/views/html-notice-theme-ready.php'); |
|
| 208 | 208 | } // END theme_ready_notice() |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @since 1.5.0 |
| 215 | 215 | */ |
| 216 | 216 | public function welcome_notice() { |
| 217 | - include( dirname( __FILE__ ) . '/views/html-notice-welcome.php' ); |
|
| 217 | + include(dirname(__FILE__).'/views/html-notice-welcome.php'); |
|
| 218 | 218 | } // END welcome_notice() |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @since 1.5.0 |
| 225 | 225 | */ |
| 226 | 226 | public function beta_notice() { |
| 227 | - include( dirname( __FILE__ ) . '/views/html-notice-trying-beta.php' ); |
|
| 227 | + include(dirname(__FILE__).'/views/html-notice-trying-beta.php'); |
|
| 228 | 228 | } // END beta_notice() |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | public function plugin_review_notice() { |
| 238 | 238 | $install_date = self::$install_date; |
| 239 | 239 | |
| 240 | - include( dirname( __FILE__ ) . '/views/html-notice-please-review.php' ); |
|
| 240 | + include(dirname(__FILE__).'/views/html-notice-please-review.php'); |
|
| 241 | 241 | } // END plugin_review_notice() |
| 242 | 242 | |
| 243 | 243 | } // END class. |
@@ -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( 'Auto_Load_Next_Post_Display_Video_Controller' ) ) { |
|
| 24 | +if ( ! class_exists('Auto_Load_Next_Post_Display_Video_Controller')) { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * This class is for the display video control in the Customizer. |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | // Checks if Auto Load Next Post Pro is installed before displaying sidebar. |
| 53 | 53 | if ( ! is_alnp_pro_version_installed() ) { |
| 54 | 54 | include_once( dirname( __FILE__ ) . '/html-admin-sidebar.php' ); |
| 55 | - } |
|
| 56 | - else { |
|
| 55 | + } else { |
|
| 57 | 56 | echo '<div class="alnp-sidebar">'; |
| 58 | 57 | |
| 59 | 58 | do_action( 'auto_load_next_post_after_settings' ); |
@@ -13,20 +13,20 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | global $current_section, $current_tab; |
| 21 | 21 | |
| 22 | 22 | // Get tabs for the settings page |
| 23 | -$tabs = apply_filters( 'auto_load_next_post_settings_tabs_array', array() ); |
|
| 23 | +$tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
| 24 | 24 | |
| 25 | -$tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'auto_load_next_post_sections_' . $current_tab ) || has_action( 'auto_load_next_post_settings_' . $current_tab ) || has_action( 'auto_load_next_post_settings_tabs_' . $current_tab ); |
|
| 26 | -$current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : ''; |
|
| 25 | +$tab_exists = isset($tabs[$current_tab]) || has_action('auto_load_next_post_sections_'.$current_tab) || has_action('auto_load_next_post_settings_'.$current_tab) || has_action('auto_load_next_post_settings_tabs_'.$current_tab); |
|
| 26 | +$current_tab_label = isset($tabs[$current_tab]) ? $tabs[$current_tab] : ''; |
|
| 27 | 27 | |
| 28 | -if ( ! $tab_exists ) { |
|
| 29 | - wp_safe_redirect( admin_url( 'options-general.php?page=auto-load-next-post-settings' ) ); |
|
| 28 | +if ( ! $tab_exists) { |
|
| 29 | + wp_safe_redirect(admin_url('options-general.php?page=auto-load-next-post-settings')); |
|
| 30 | 30 | exit; |
| 31 | 31 | } |
| 32 | 32 | ?> |
@@ -34,44 +34,44 @@ discard block |
||
| 34 | 34 | <form method="post" id="mainform" action="" enctype="multipart/form-data"> |
| 35 | 35 | <nav class="nav-tab-wrapper"> |
| 36 | 36 | <?php |
| 37 | - foreach ( $tabs as $slug => $label ) { |
|
| 38 | - $url = add_query_arg( array( |
|
| 37 | + foreach ($tabs as $slug => $label) { |
|
| 38 | + $url = add_query_arg(array( |
|
| 39 | 39 | 'page' => 'auto-load-next-post-settings', |
| 40 | - 'tab' => esc_attr( $slug ), |
|
| 41 | - ), admin_url( 'options-general.php' ) ); |
|
| 40 | + 'tab' => esc_attr($slug), |
|
| 41 | + ), admin_url('options-general.php')); |
|
| 42 | 42 | |
| 43 | - echo '<a href="' . esc_html( $url ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
| 43 | + echo '<a href="'.esc_html($url).'" class="nav-tab '.($current_tab === $slug ? 'nav-tab-active' : '').'">'.esc_html($label).'</a>'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
| 46 | + do_action('auto_load_next_post_settings_tabs'); |
|
| 47 | 47 | ?> |
| 48 | 48 | </nav> |
| 49 | - <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1> |
|
| 49 | + <h1 class="screen-reader-text"><?php echo esc_html($current_tab_label); ?></h1> |
|
| 50 | 50 | <?php |
| 51 | - do_action( 'auto_load_next_post_sections_' . $current_tab ); |
|
| 51 | + do_action('auto_load_next_post_sections_'.$current_tab); |
|
| 52 | 52 | |
| 53 | 53 | self::show_messages(); |
| 54 | 54 | |
| 55 | - do_action( 'auto_load_next_post_settings_' . $current_tab ); |
|
| 55 | + do_action('auto_load_next_post_settings_'.$current_tab); |
|
| 56 | 56 | ?> |
| 57 | 57 | <p class="submit"> |
| 58 | - <?php submit_button( esc_attr__( 'Save Changes', 'auto-load-next-post' ), 'button-primary', esc_attr__( 'Save Changes', 'auto-load-next-post' ), false, array( 'id' => 'save' ) ); ?> |
|
| 59 | - <?php wp_nonce_field( 'auto-load-next-post-settings' ); ?> |
|
| 58 | + <?php submit_button(esc_attr__('Save Changes', 'auto-load-next-post'), 'button-primary', esc_attr__('Save Changes', 'auto-load-next-post'), false, array('id' => 'save')); ?> |
|
| 59 | + <?php wp_nonce_field('auto-load-next-post-settings'); ?> |
|
| 60 | 60 | </p> |
| 61 | 61 | </form> |
| 62 | 62 | |
| 63 | 63 | <?php |
| 64 | 64 | // Checks if Auto Load Next Post Pro is installed before displaying sidebar. |
| 65 | - if ( ! is_alnp_pro_version_installed() ) { |
|
| 66 | - include_once( dirname( __FILE__ ) . '/html-admin-sidebar.php' ); |
|
| 65 | + if ( ! is_alnp_pro_version_installed()) { |
|
| 66 | + include_once(dirname(__FILE__).'/html-admin-sidebar.php'); |
|
| 67 | 67 | } |
| 68 | 68 | else { |
| 69 | 69 | echo '<div class="alnp-sidebar">'; |
| 70 | 70 | |
| 71 | - do_action( 'auto_load_next_post_after_settings' ); |
|
| 71 | + do_action('auto_load_next_post_after_settings'); |
|
| 72 | 72 | |
| 73 | 73 | // Use this hook to display after settings for a specific tab. |
| 74 | - do_action( 'auto_load_next_post_after_settings_' . $current_tab ); |
|
| 74 | + do_action('auto_load_next_post_after_settings_'.$current_tab); |
|
| 75 | 75 | |
| 76 | 76 | echo '</div>'; |
| 77 | 77 | } |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | ?> |
| 17 | 17 | <div class="notice notice-info"> |
| 18 | - <p><?php echo sprintf( __( 'This theme supports %s. No need to change the theme selectors as they have already been set by the theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
| 18 | + <p><?php echo sprintf(__('This theme supports %s. No need to change the theme selectors as they have already been set by the theme.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
| 19 | 19 | </div> |