@@ -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( 'ALNP_Privacy' ) ) { |
|
| 19 | +if ( ! class_exists('ALNP_Privacy')) { |
|
| 20 | 20 | |
| 21 | 21 | class ALNP_Privacy { |
| 22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'admin_init', array( $this, 'add_privacy_policy_guide_content' ) ); |
|
| 29 | + add_action('admin_init', array($this, 'add_privacy_policy_guide_content')); |
|
| 30 | 30 | } // END __construct() |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @static |
| 37 | 37 | */ |
| 38 | 38 | public static function add_privacy_policy_guide_content() { |
| 39 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
| 40 | - wp_add_privacy_policy_content( esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), self::get_privacy_policy_guide_message() ); |
|
| 39 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
| 40 | + wp_add_privacy_policy_content(esc_html__('Auto Load Next Post', 'auto-load-next-post'), self::get_privacy_policy_guide_message()); |
|
| 41 | 41 | } |
| 42 | 42 | } // END add_privacy_policy_guide_content() |
| 43 | 43 | |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | protected static function get_privacy_policy_guide_message() { |
| 52 | 52 | $content = ' |
| 53 | 53 | <div class="wp-suggested-text">' . |
| 54 | - '<p class="privacy-policy-tutorial">' . |
|
| 55 | - sprintf( __( '%s does not collect, store or share any personal data.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . |
|
| 56 | - '</p>' . |
|
| 54 | + '<p class="privacy-policy-tutorial">'. |
|
| 55 | + sprintf(__('%s does not collect, store or share any personal data.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')). |
|
| 56 | + '</p>'. |
|
| 57 | 57 | '</div>'; |
| 58 | 58 | |
| 59 | 59 | return $content; |
@@ -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( ' |
|