@@ -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_Settings_Events_Tab' ) ) { |
|
| 18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Events_Tab')) { |
|
| 19 | 19 | |
| 20 | 20 | class Auto_Load_Next_Post_Settings_Events_Tab extends Auto_Load_Next_Post_Settings_Page { |
| 21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | 30 | $this->id = 'events'; |
| 31 | - $this->label = __( 'Events', 'auto-load-next-post' ); |
|
| 31 | + $this->label = __('Events', 'auto-load-next-post'); |
|
| 32 | 32 | |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | } // END __construct() |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | 'auto_load_next_post_general_settings', array( |
| 46 | 46 | |
| 47 | 47 | array( |
| 48 | - 'title' => __( 'Events', 'auto-load-next-post' ), |
|
| 48 | + 'title' => __('Events', 'auto-load-next-post'), |
|
| 49 | 49 | 'type' => 'title', |
| 50 | - 'desc' => sprintf( __( 'User defined events, below you can choose external JavaScript events to be triggered alongside Auto Load Next Post native events', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
| 50 | + 'desc' => sprintf(__('User defined events, below you can choose external JavaScript events to be triggered alongside Auto Load Next Post native events', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
| 51 | 51 | 'id' => 'events_options' |
| 52 | 52 | ), |
| 53 | 53 | |
| 54 | 54 | array( |
| 55 | - 'title' => __( 'Post loaded', 'auto-load-next-post' ), |
|
| 56 | - 'desc' => __( 'After the new post has loaded, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
|
| 55 | + 'title' => __('Post loaded', 'auto-load-next-post'), |
|
| 56 | + 'desc' => __('After the new post has loaded, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post'), |
|
| 57 | 57 | //'desc_tip' => true, |
| 58 | 58 | 'id' => 'auto_load_next_post_on_load_event', |
| 59 | 59 | 'placeholder' => 'event1,event2, ...', |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | ), |
| 64 | 64 | |
| 65 | 65 | array( |
| 66 | - 'title' => __( 'Entering a post', 'auto-load-next-post' ), |
|
| 67 | - 'desc' => __( 'Entering a post, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
|
| 66 | + 'title' => __('Entering a post', 'auto-load-next-post'), |
|
| 67 | + 'desc' => __('Entering a post, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post'), |
|
| 68 | 68 | //'desc_tip' => true, |
| 69 | 69 | 'id' => 'auto_load_next_post_on_entering_event', |
| 70 | 70 | 'placeholder' => 'event1,event2, ...', |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function output() { |
| 90 | 90 | $settings = $this->get_settings(); |
| 91 | 91 | |
| 92 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
| 92 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
| 93 | 93 | } // END output() |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $settings = $this->get_settings(); |
| 106 | 106 | |
| 107 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings, $current_tab ); |
|
| 107 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab); |
|
| 108 | 108 | } // END save() |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return array |
| 118 | 118 | */ |
| 119 | 119 | public function get_post_types() { |
| 120 | - $post_types = get_post_types( array( 'public' => true ), 'names' ); |
|
| 120 | + $post_types = get_post_types(array('public' => true), 'names'); |
|
| 121 | 121 | |
| 122 | 122 | return $post_types; |
| 123 | 123 | } // END get_post_types() |
@@ -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_Admin_Settings' ) ) { |
|
| 19 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Settings')) { |
|
| 20 | 20 | |
| 21 | 21 | class Auto_Load_Next_Post_Admin_Settings { |
| 22 | 22 | |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * @return $settings |
| 58 | 58 | */ |
| 59 | 59 | public static function get_settings_pages() { |
| 60 | - if ( empty( self::$settings ) ) { |
|
| 60 | + if (empty(self::$settings)) { |
|
| 61 | 61 | $settings = array(); |
| 62 | 62 | |
| 63 | - include_once( dirname( __FILE__ ) . '/settings/class-alnp-settings-page.php' ); |
|
| 63 | + include_once(dirname(__FILE__).'/settings/class-alnp-settings-page.php'); |
|
| 64 | 64 | |
| 65 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-general.php'); |
|
| 66 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-events.php'); |
|
| 65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-general.php'); |
|
| 66 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-events.php'); |
|
| 67 | 67 | |
| 68 | - self::$settings = apply_filters( 'auto_load_next_post_get_settings_pages', $settings ); |
|
| 68 | + self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return self::$settings; |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | public static function save() { |
| 84 | 84 | global $current_tab; |
| 85 | 85 | |
| 86 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
| 86 | + check_admin_referer('auto-load-next-post-settings'); |
|
| 87 | 87 | |
| 88 | 88 | // Trigger actions |
| 89 | - do_action( 'auto_load_next_post_settings_save_' . $current_tab ); |
|
| 90 | - do_action( 'auto_load_next_post_update_options_' . $current_tab ); |
|
| 91 | - do_action( 'auto_load_next_post_update_options' ); |
|
| 89 | + do_action('auto_load_next_post_settings_save_'.$current_tab); |
|
| 90 | + do_action('auto_load_next_post_update_options_'.$current_tab); |
|
| 91 | + do_action('auto_load_next_post_update_options'); |
|
| 92 | 92 | |
| 93 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
| 93 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
| 94 | 94 | |
| 95 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
| 95 | + do_action('auto_load_next_post_settings_saved'); |
|
| 96 | 96 | } // END save() |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @since 1.0.0 |
| 104 | 104 | * @param string $text Message |
| 105 | 105 | */ |
| 106 | - public static function add_message( $text ) { |
|
| 106 | + public static function add_message($text) { |
|
| 107 | 107 | self::$messages[] = $text; |
| 108 | 108 | } // END add_message() |
| 109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 1.0.0 |
| 116 | 116 | * @param string $text Error |
| 117 | 117 | */ |
| 118 | - public static function add_error( $text ) { |
|
| 118 | + public static function add_error($text) { |
|
| 119 | 119 | self::$errors[] = $text; |
| 120 | 120 | } // END add_error() |
| 121 | 121 | |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | 130 | public static function show_messages() { |
| 131 | - if ( count( self::$errors ) > 0 ) { |
|
| 132 | - foreach ( self::$errors as $error ) { |
|
| 133 | - echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
| 131 | + if (count(self::$errors) > 0) { |
|
| 132 | + foreach (self::$errors as $error) { |
|
| 133 | + echo '<div id="message" class="error inline"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
| 134 | 134 | } |
| 135 | - } elseif ( count( self::$messages ) > 0 ) { |
|
| 136 | - foreach ( self::$messages as $message ) { |
|
| 137 | - echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
| 135 | + } elseif (count(self::$messages) > 0) { |
|
| 136 | + foreach (self::$messages as $message) { |
|
| 137 | + echo '<div id="message" class="updated inline"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } // END show_messages() |
@@ -156,18 +156,18 @@ discard block |
||
| 156 | 156 | public static function output() { |
| 157 | 157 | global $current_section, $current_tab; |
| 158 | 158 | |
| 159 | - do_action( 'auto_load_next_post_settings_start' ); |
|
| 159 | + do_action('auto_load_next_post_settings_start'); |
|
| 160 | 160 | |
| 161 | - wp_enqueue_script( 'auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
| 161 | + wp_enqueue_script('auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
| 162 | 162 | |
| 163 | - wp_localize_script( 'auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
| 164 | - 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
| 165 | - ) ); |
|
| 163 | + wp_localize_script('auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
| 164 | + 'i18n_nav_warning' => __('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
| 165 | + )); |
|
| 166 | 166 | |
| 167 | 167 | // Get tabs for the settings page |
| 168 | - $tabs = apply_filters( 'auto_load_next_post_settings_tabs_array', array() ); |
|
| 168 | + $tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
| 169 | 169 | |
| 170 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
| 170 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
| 171 | 171 | } // END output() |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -179,20 +179,20 @@ discard block |
||
| 179 | 179 | * @param mixed $option_name |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | - public static function get_option( $option_name, $default = '' ) { |
|
| 182 | + public static function get_option($option_name, $default = '') { |
|
| 183 | 183 | // Array value |
| 184 | - if ( strstr( $option_name, '[' ) ) { |
|
| 185 | - parse_str( $option_name, $option_array ); |
|
| 184 | + if (strstr($option_name, '[')) { |
|
| 185 | + parse_str($option_name, $option_array); |
|
| 186 | 186 | |
| 187 | 187 | // Option name is first key |
| 188 | - $option_name = current( array_keys( $option_array ) ); |
|
| 188 | + $option_name = current(array_keys($option_array)); |
|
| 189 | 189 | |
| 190 | 190 | // Get value |
| 191 | - $option_values = get_option( $option_name, '' ); |
|
| 191 | + $option_values = get_option($option_name, ''); |
|
| 192 | 192 | |
| 193 | - $key = key( $option_array[$option_name] ); |
|
| 193 | + $key = key($option_array[$option_name]); |
|
| 194 | 194 | |
| 195 | - if ( isset( $option_values[$key] ) ) { |
|
| 195 | + if (isset($option_values[$key])) { |
|
| 196 | 196 | $option_value = $option_values[$key]; |
| 197 | 197 | } else { |
| 198 | 198 | $option_value = null; |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $option_value = get_option($option_name, null); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( is_array( $option_value ) ) { |
|
| 206 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
| 207 | - } elseif ( ! is_null( $option_value ) ) { |
|
| 208 | - $option_value = stripslashes( $option_value ); |
|
| 205 | + if (is_array($option_value)) { |
|
| 206 | + $option_value = array_map('stripslashes', $option_value); |
|
| 207 | + } elseif ( ! is_null($option_value)) { |
|
| 208 | + $option_value = stripslashes($option_value); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return $option_value === null ? $default : $option_value; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if ($tip && in_array($value['type'], array('checkbox'))) { |
| 284 | 284 | $tip = '<p class="description">'.$tip.'</p>'; |
| 285 | 285 | } else if ($tip) { |
| 286 | - $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="' . AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/help.png" height="16" width="16" />'; |
|
| 286 | + $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="'.AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/help.png" height="16" width="16" />'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Switch based on type |
@@ -531,8 +531,8 @@ discard block |
||
| 531 | 531 | * @param array $options Opens array to output |
| 532 | 532 | * @return bool |
| 533 | 533 | */ |
| 534 | - public static function save_fields( $options, $current_tab ) { |
|
| 535 | - if ( empty( $_POST ) ) { |
|
| 534 | + public static function save_fields($options, $current_tab) { |
|
| 535 | + if (empty($_POST)) { |
|
| 536 | 536 | return false; |
| 537 | 537 | } |
| 538 | 538 | |
@@ -540,21 +540,21 @@ discard block |
||
| 540 | 540 | $update_options = array(); |
| 541 | 541 | |
| 542 | 542 | // Loop options and get values to save |
| 543 | - foreach ( $options as $value ) { |
|
| 543 | + foreach ($options as $value) { |
|
| 544 | 544 | |
| 545 | - if ( ! isset( $value['id'] ) ) { |
|
| 545 | + if ( ! isset($value['id'])) { |
|
| 546 | 546 | continue; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; |
|
| 549 | + $type = isset($value['type']) ? sanitize_title($value['type']) : ''; |
|
| 550 | 550 | |
| 551 | 551 | // Get the option name |
| 552 | 552 | $option_value = null; |
| 553 | 553 | |
| 554 | - switch ( $type ) { |
|
| 554 | + switch ($type) { |
|
| 555 | 555 | // Standard types |
| 556 | 556 | case "checkbox" : |
| 557 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 557 | + if (isset($_POST[$value['id']])) { |
|
| 558 | 558 | $option_value = 'yes'; |
| 559 | 559 | } else { |
| 560 | 560 | $option_value = 'no'; |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | break; |
| 564 | 564 | |
| 565 | 565 | case "textarea" : |
| 566 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 567 | - $option_value = wp_kses_post( trim( stripslashes( $_POST[$value['id']] ) ) ); |
|
| 566 | + if (isset($_POST[$value['id']])) { |
|
| 567 | + $option_value = wp_kses_post(trim(stripslashes($_POST[$value['id']]))); |
|
| 568 | 568 | } else { |
| 569 | 569 | $option_value = ''; |
| 570 | 570 | } |
@@ -576,8 +576,8 @@ discard block |
||
| 576 | 576 | case "select" : |
| 577 | 577 | case "single_select_page" : |
| 578 | 578 | case "radio" : |
| 579 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 580 | - $option_value = auto_load_next_post_clean( stripslashes( $_POST[$value['id']] ) ); |
|
| 579 | + if (isset($_POST[$value['id']])) { |
|
| 580 | + $option_value = auto_load_next_post_clean(stripslashes($_POST[$value['id']])); |
|
| 581 | 581 | } else { |
| 582 | 582 | $option_value = ''; |
| 583 | 583 | } |
@@ -587,8 +587,8 @@ discard block |
||
| 587 | 587 | // Special types |
| 588 | 588 | case "multiselect" : |
| 589 | 589 | // Get array |
| 590 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 591 | - $selected_values = array_map( 'auto_load_next_post_clean', array_map( 'stripslashes', (array) $_POST[$value['id']] ) ); |
|
| 590 | + if (isset($_POST[$value['id']])) { |
|
| 591 | + $selected_values = array_map('auto_load_next_post_clean', array_map('stripslashes', (array) $_POST[$value['id']])); |
|
| 592 | 592 | } else { |
| 593 | 593 | $selected_values = array(); |
| 594 | 594 | } |
@@ -598,19 +598,19 @@ discard block |
||
| 598 | 598 | |
| 599 | 599 | // Custom handling |
| 600 | 600 | default : |
| 601 | - do_action( 'auto_load_next_post_update_option_' . $type, $value ); |
|
| 601 | + do_action('auto_load_next_post_update_option_'.$type, $value); |
|
| 602 | 602 | |
| 603 | 603 | break; |
| 604 | 604 | } // END switch() |
| 605 | 605 | |
| 606 | - if ( ! is_null( $option_value ) ) { |
|
| 606 | + if ( ! is_null($option_value)) { |
|
| 607 | 607 | |
| 608 | 608 | // Check if option is an array |
| 609 | - if ( strstr( $value['id'], '[') ) { |
|
| 610 | - parse_str( $value['id'], $option_array ); |
|
| 609 | + if (strstr($value['id'], '[')) { |
|
| 610 | + parse_str($value['id'], $option_array); |
|
| 611 | 611 | |
| 612 | 612 | // Option name is first key |
| 613 | - $option_name = current( array_keys( $option_array ) ); |
|
| 613 | + $option_name = current(array_keys($option_array)); |
|
| 614 | 614 | |
| 615 | 615 | // Get old option value |
| 616 | 616 | if ( ! isset($update_options[$option_name])) { |
@@ -633,16 +633,16 @@ discard block |
||
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | // Custom handling |
| 636 | - do_action( 'auto_load_next_post_update_option', $value ); |
|
| 636 | + do_action('auto_load_next_post_update_option', $value); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | // Now save the options |
| 640 | - foreach ( $update_options as $name => $value ) { |
|
| 641 | - update_option( $name, $value ); |
|
| 640 | + foreach ($update_options as $name => $value) { |
|
| 641 | + update_option($name, $value); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | // Save all options as an array. Ready for export. |
| 645 | - update_option( 'auto_load_next_post_options_' . $current_tab, $update_options ); |
|
| 645 | + update_option('auto_load_next_post_options_'.$current_tab, $update_options); |
|
| 646 | 646 | |
| 647 | 647 | return true; |
| 648 | 648 | } // END save_fields() |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @version 1.4.10 |
| 29 | 29 | */ |
| 30 | -if ( ! class_exists('Auto_Load_Next_Post') ) { |
|
| 30 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
| 31 | 31 | |
| 32 | 32 | class Auto_Load_Next_Post { |
| 33 | 33 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @return Auto_Load_Next_Post Single instance. |
| 53 | 53 | */ |
| 54 | 54 | public static function instance() { |
| 55 | - if ( is_null( self::$_instance ) ) { |
|
| 55 | + if (is_null(self::$_instance)) { |
|
| 56 | 56 | self::$_instance = new self(); |
| 57 | 57 | self::$_instance->setup_constants(); |
| 58 | 58 | self::$_instance->includes(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __clone() { |
| 71 | 71 | // Cloning instances of the class is forbidden |
| 72 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 72 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 73 | 73 | } // END __clone() |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | public function __wakeup() { |
| 83 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 83 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 84 | 84 | } // END __wakeup() |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function __construct() { |
| 94 | 94 | // Auto-load classes on demand |
| 95 | - if ( function_exists("__autoload") ) { |
|
| 95 | + if (function_exists("__autoload")) { |
|
| 96 | 96 | spl_autoload_register("__autoload"); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 99 | + spl_autoload_register(array($this, 'autoload')); |
|
| 100 | 100 | |
| 101 | 101 | // Load translation files. |
| 102 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 102 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
| 103 | 103 | |
| 104 | 104 | // Load Auto Load Next Post scripts on the frontend. |
| 105 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_scripts' ) ); |
|
| 105 | + add_action('wp_enqueue_scripts', array($this, 'alnp_scripts')); |
|
| 106 | 106 | } // END __construct() |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | * @param mixed $class |
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | - public function autoload( $class ) { |
|
| 116 | + public function autoload($class) { |
|
| 117 | 117 | $path = null; |
| 118 | - $file = strtolower( 'class-' . str_replace( '_', '-', $class ) ) . '.php'; |
|
| 118 | + $file = strtolower('class-'.str_replace('_', '-', $class)).'.php'; |
|
| 119 | 119 | |
| 120 | - if ( strpos( $class, 'auto_load_next_post_admin' ) === 0 ) { |
|
| 121 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/admin/'; |
|
| 122 | - } else if ( strpos( $class, 'auto_load_next_post_' ) === 0 ) { |
|
| 123 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/'; |
|
| 120 | + if (strpos($class, 'auto_load_next_post_admin') === 0) { |
|
| 121 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/admin/'; |
|
| 122 | + } else if (strpos($class, 'auto_load_next_post_') === 0) { |
|
| 123 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/'; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( $path !== null && is_readable( $path . $file ) ) { |
|
| 127 | - include_once( $path . $file ); |
|
| 126 | + if ($path !== null && is_readable($path.$file)) { |
|
| 127 | + include_once($path.$file); |
|
| 128 | 128 | return true; |
| 129 | 129 | } |
| 130 | 130 | } // END autoload() |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * @access private |
| 163 | 163 | * @since 1.4.3 |
| 164 | 164 | */ |
| 165 | - private function define( $name, $value ) { |
|
| 166 | - if ( ! defined( $name ) ) { |
|
| 167 | - define( $name, $value ); |
|
| 165 | + private function define($name, $value) { |
|
| 166 | + if ( ! defined($name)) { |
|
| 167 | + define($name, $value); |
|
| 168 | 168 | } |
| 169 | 169 | } // END define() |
| 170 | 170 | |
@@ -181,20 +181,20 @@ discard block |
||
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | 183 | public function includes() { |
| 184 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
| 184 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
| 185 | 185 | |
| 186 | 186 | // Include admin class to handle all back-end functions. |
| 187 | - if ( is_admin() ) { |
|
| 188 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
| 187 | + if (is_admin()) { |
|
| 188 | + include_once(dirname(__FILE__).'/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Install. |
| 192 | - require_once( dirname( __FILE__ ) . '/includes/class-auto-load-next-post-install.php' ); |
|
| 192 | + require_once(dirname(__FILE__).'/includes/class-auto-load-next-post-install.php'); |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * Auto Load Next Post is fully loaded. |
| 196 | 196 | */ |
| 197 | - do_action( 'auto_load_next_post_loaded' ); |
|
| 197 | + do_action('auto_load_next_post_loaded'); |
|
| 198 | 198 | } // END includes() |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return void |
| 210 | 210 | */ |
| 211 | 211 | public function load_plugin_textdomain() { |
| 212 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
| 212 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
| 213 | 213 | } // END load_plugin_textdomain() |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | /** |
| 224 | 224 | * Load the Javascript if found as a singluar post. |
| 225 | 225 | */ |
| 226 | - if ( is_singular() && get_post_type() == 'post' ) { |
|
| 227 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 226 | + if (is_singular() && get_post_type() == 'post') { |
|
| 227 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 228 | 228 | |
| 229 | 229 | // Only load History.js when not in the customizer. |
| 230 | - if ( ! is_customize_preview() ) { |
|
| 231 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 230 | + if ( ! is_customize_preview()) { |
|
| 231 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $this->load_file( 'auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post' . AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 234 | + $this->load_file('auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post'.AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 235 | 235 | |
| 236 | 236 | // Variables for JS scripts |
| 237 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
| 237 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
| 238 | 238 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
| 239 | 239 | 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
| 240 | 240 | 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | 'alnp_event_on_load' => get_option('auto_load_next_post_on_load_event'), |
| 246 | 246 | 'alnp_event_on_entering' => get_option('auto_load_next_post_on_entering_event'), |
| 247 | 247 | 'alnp_is_customizer' => is_customize_preview() |
| 248 | - ) ); |
|
| 248 | + )); |
|
| 249 | 249 | } // END if is_singular() && get_post_type() |
| 250 | 250 | } // END alnp_scripts() |
| 251 | 251 | |
@@ -262,18 +262,18 @@ discard block |
||
| 262 | 262 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
| 263 | 263 | * @global string $wp_version |
| 264 | 264 | */ |
| 265 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '' ) { |
|
| 265 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') { |
|
| 266 | 266 | global $wp_version; |
| 267 | 267 | |
| 268 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
| 268 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
| 269 | 269 | |
| 270 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
| 271 | - if ( $is_script ) { |
|
| 272 | - wp_register_script( $name, $url, $support, $version ); |
|
| 273 | - wp_enqueue_script( $name ); |
|
| 270 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
| 271 | + if ($is_script) { |
|
| 272 | + wp_register_script($name, $url, $support, $version); |
|
| 273 | + wp_enqueue_script($name); |
|
| 274 | 274 | } else { |
| 275 | - wp_register_style( $name, $url ); |
|
| 276 | - wp_enqueue_style( $name ); |
|
| 275 | + wp_register_style($name, $url); |
|
| 276 | + wp_enqueue_style($name); |
|
| 277 | 277 | } // end if |
| 278 | 278 | } // end if |
| 279 | 279 | |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | } // END run_auto_load_next_post() |
| 292 | 292 | |
| 293 | 293 | // Fetch the Php version checker. |
| 294 | -if ( ! class_exists( 'WP_Update_Php' ) ) { |
|
| 295 | - require_once( dirname( __FILE__ ) . '/wp-update-php/wp-update-php.php' ); |
|
| 294 | +if ( ! class_exists('WP_Update_Php')) { |
|
| 295 | + require_once(dirname(__FILE__).'/wp-update-php/wp-update-php.php'); |
|
| 296 | 296 | } |
| 297 | 297 | $updatePhp = new WP_Update_Php( |
| 298 | 298 | array( |
@@ -306,6 +306,6 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | // If the miniumum version of PHP required is available then run the plugin. |
| 309 | -if ( $updatePhp->does_it_meet_required_php_version() ) { |
|
| 309 | +if ($updatePhp->does_it_meet_required_php_version()) { |
|
| 310 | 310 | add_action('plugins_loaded', 'run_auto_load_next_post', 20); |
| 311 | 311 | } |