Completed
Branch master (9fc475)
by
unknown
02:10
created
includes/class-alnp-install.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
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_Install' ) ) {
18
+if ( ! class_exists('Auto_Load_Next_Post_Install')) {
19 19
 
20 20
 	class Auto_Load_Next_Post_Install {
21 21
 
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 		 * @access public
37 37
 		 */
38 38
 		public function __construct() {
39
-			add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 0 );
40
-			add_action( 'init', array( __CLASS__, 'check_version' ), 5 );
39
+			add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 0);
40
+			add_action('init', array(__CLASS__, 'check_version'), 5);
41 41
 
42 42
 			// Get plugin version.
43
-			self::$current_version = get_option( 'auto_load_next_post_version' );
43
+			self::$current_version = get_option('auto_load_next_post_version');
44 44
 		} // END __construct()
45 45
 
46 46
 		/**
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 		 * @since  1.4.10
54 54
 		 */
55 55
 		public static function check_version() {
56
-			if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<' ) ) {
56
+			if ( ! defined('IFRAME_REQUEST') && version_compare(self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<')) {
57 57
 				self::install();
58
-				do_action( 'auto_load_next_post_updated' );
58
+				do_action('auto_load_next_post_updated');
59 59
 			}
60 60
 		} // END check_version()
61 61
 
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 		 * @version 1.5.0
69 69
 		 */
70 70
 		public static function install() {
71
-			if ( ! is_blog_installed() ) {
71
+			if ( ! is_blog_installed()) {
72 72
 				return;
73 73
 			}
74 74
 
75 75
 			// Check if we are not already running this routine.
76
-			if ( 'yes' === get_transient( 'alnp_installing' ) ) {
76
+			if ('yes' === get_transient('alnp_installing')) {
77 77
 				return;
78 78
 			}
79 79
 
80 80
 			// If we made it till here nothing is running yet, lets set the transient now for five minutes.
81
-			set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 5 );
82
-			if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) {
83
-				define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true );
81
+			set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 5);
82
+			if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) {
83
+				define('AUTO_LOAD_NEXT_POST_INSTALLING', true);
84 84
 			}
85 85
 
86 86
 			// Add default options.
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 			// Refresh rewrite rules.
99 99
 			self::flush_rewrite_rules();
100 100
 
101
-			delete_transient( 'alnp_installing' );
101
+			delete_transient('alnp_installing');
102 102
 
103
-			do_action( 'alnp_installed' );
103
+			do_action('alnp_installed');
104 104
 		} // END install()
105 105
 
106 106
 		/**
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 		 * @since  1.5.0
113 113
 		 */
114 114
 		private static function set_theme_selectors() {
115
-			if ( is_alnp_supported() ) {
116
-				$content_container    = alnp_get_theme_support( 'content_container' );
117
-				$title_selector       = alnp_get_theme_support( 'title_selector' );
118
-				$navigation_container = alnp_get_theme_support( 'navigation_container' );
119
-				$comments_container   = alnp_get_theme_support( 'comments_container' );
120
-
121
-				if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container );
122
-				if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector );
123
-				if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container );
124
-				if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container );
115
+			if (is_alnp_supported()) {
116
+				$content_container    = alnp_get_theme_support('content_container');
117
+				$title_selector       = alnp_get_theme_support('title_selector');
118
+				$navigation_container = alnp_get_theme_support('navigation_container');
119
+				$comments_container   = alnp_get_theme_support('comments_container');
120
+
121
+				if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container);
122
+				if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector);
123
+				if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container);
124
+				if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container);
125 125
 			}
126 126
 		} // END set_theme_selectors()
127 127
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		 * @static
133 133
 		 */
134 134
 		private static function update_version() {
135
-			update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION );
135
+			update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION);
136 136
 		} // END update_version()
137 137
 
138 138
 		/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 		 * @version 1.5.0
145 145
 		 */
146 146
 		public static function set_install_date() {
147
-			$install_date = get_site_option( 'auto_load_next_post_install_date' );
147
+			$install_date = get_site_option('auto_load_next_post_install_date');
148 148
 
149 149
 			// If ALNP was installed before but the install date was not converted to time then convert it.
150
-			if ( ! empty( $install_date ) && !intval( $install_date ) ) {
151
-				update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) );
150
+			if ( ! empty($install_date) && ! intval($install_date)) {
151
+				update_site_option('auto_load_next_post_install_date', strtotime($install_date));
152 152
 			} else {
153
-				add_site_option( 'auto_load_next_post_install_date', time() );
153
+				add_site_option('auto_load_next_post_install_date', time());
154 154
 			}
155 155
 		} // END set_install_date()
156 156
 
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 		 */
166 166
 		public static function create_options() {
167 167
 			// Include settings so that we can run through defaults
168
-			include_once( dirname( __FILE__ ) . '/admin/class-auto-load-next-post-admin-settings.php' );
168
+			include_once(dirname(__FILE__).'/admin/class-auto-load-next-post-admin-settings.php');
169 169
 
170 170
 			$settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages();
171 171
 
172
-			foreach ( $settings as $section ) {
173
-				foreach ( $section->get_settings() as $value ) {
174
-					if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
175
-						$autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
176
-						add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
172
+			foreach ($settings as $section) {
173
+				foreach ($section->get_settings() as $value) {
174
+					if (isset($value['default']) && isset($value['id'])) {
175
+						$autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
176
+						add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no'));
177 177
 					}
178 178
 				}
179 179
 			}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		 * @version 1.5.0
189 189
 		 */
190 190
 		public static function add_rewrite_endpoint() {
191
-			add_rewrite_endpoint( 'alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
191
+			add_rewrite_endpoint('alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT);
192 192
 		} // END add_rewrite_endpoint()
193 193
 
194 194
 		/**
Please login to merge, or discard this patch.
includes/admin/settings/class-alnp-settings-misc.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
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
-if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Misc_Tab' ) ) {
17
+if ( ! class_exists('Auto_Load_Next_Post_Settings_Misc_Tab')) {
18 18
 
19 19
 	class Auto_Load_Next_Post_Settings_Misc_Tab extends Auto_Load_Next_Post_Settings_Page {
20 20
 
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 		 */
29 29
 		public function __construct() {
30 30
 			$this->id    = 'misc';
31
-			$this->label = esc_html__( 'Misc', 'auto-load-next-post' );
31
+			$this->label = esc_html__('Misc', 'auto-load-next-post');
32 32
 
33 33
 			parent::__construct();
34 34
 
35
-			add_action( 'auto_load_next_post_sections_' . $this->id, array( __CLASS__, 'no_comment_selector_set' ), 10 );
35
+			add_action('auto_load_next_post_sections_'.$this->id, array(__CLASS__, 'no_comment_selector_set'), 10);
36 36
 		} // END __construct()
37 37
 
38 38
 		/**
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 		 * @since  1.5.0
44 44
 		 */
45 45
 		public static function no_comment_selector_set() {
46
-			$comments_container = get_option( 'auto_load_next_post_comments_container' );
47
-			$remove_comments    = get_option( 'auto_load_next_post_remove_comments' );
46
+			$comments_container = get_option('auto_load_next_post_comments_container');
47
+			$remove_comments    = get_option('auto_load_next_post_remove_comments');
48 48
 
49
-			if ( empty( $comments_container ) && ! empty( $remove_comments ) ) {
50
-				include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-comment-selector.php' );
49
+			if (empty($comments_container) && ! empty($remove_comments)) {
50
+				include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-comment-selector.php');
51 51
 			}
52 52
 		} // END no_comment_selector_set()
53 53
 
@@ -65,45 +65,45 @@  discard block
 block discarded – undo
65 65
 					array(
66 66
 						'title' => $this->label,
67 67
 						'type'  => 'title',
68
-						'desc'  => sprintf( esc_html__( 'Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ),
68
+						'desc'  => sprintf(esc_html__('Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')),
69 69
 						'id'    => 'misc_options'
70 70
 					),
71 71
 
72 72
 					array(
73
-						'title'   => esc_html__( 'Remove Comments', 'auto-load-next-post' ),
74
-						'desc'    => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ),
73
+						'title'   => esc_html__('Remove Comments', 'auto-load-next-post'),
74
+						'desc'    => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'),
75 75
 						'id'      => 'auto_load_next_post_remove_comments',
76 76
 						'default' => 'yes',
77 77
 						'type'    => 'checkbox'
78 78
 					),
79 79
 
80 80
 					array(
81
-						'title'   => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ),
82
-						'desc'    => 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' ),
81
+						'title'   => esc_html__('Update Google Analytics', 'auto-load-next-post'),
82
+						'desc'    => 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'),
83 83
 						'id'      => 'auto_load_next_post_google_analytics',
84 84
 						'default' => 'no',
85 85
 						'type'    => 'checkbox'
86 86
 					),
87 87
 
88 88
 					array(
89
-						'title'   => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ),
90
-						'desc'    => 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' ),
89
+						'title'   => esc_html__('JavaScript in Footer?', 'auto-load-next-post'),
90
+						'desc'    => 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'),
91 91
 						'id'      => 'auto_load_next_post_js_footer',
92 92
 						'default' => 'no',
93 93
 						'type'    => 'checkbox'
94 94
 					),
95 95
 
96 96
 					array(
97
-						'title'   => esc_html__( 'Reset all data?', 'auto-load-next-post' ),
98
-						'desc'    => esc_html__( 'Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post' ),
97
+						'title'   => esc_html__('Reset all data?', 'auto-load-next-post'),
98
+						'desc'    => esc_html__('Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post'),
99 99
 						'id'      => 'auto_load_next_post_reset_data',
100 100
 						'default' => 'no',
101 101
 						'type'    => 'reset_data'
102 102
 					),
103 103
 
104 104
 					array(
105
-						'title'   => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ),
106
-						'desc'    => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ),
105
+						'title'   => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'),
106
+						'desc'    => esc_html__('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'),
107 107
 						'id'      => 'auto_load_next_post_uninstall_data',
108 108
 						'default' => 'no',
109 109
 						'type'    => 'checkbox'
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 		 * @since 1.5.0
124 124
 		 * @param mixed $settings
125 125
 		 */
126
-		public function customize_button( $settings ) {
126
+		public function customize_button($settings) {
127 127
 			?>
128 128
 			<tr valign="top">
129
-				<th scope="row" class="titledesc"><?php echo $settings['title'];?></th>
130
-				<td class="forminp forminp-<?php echo sanitize_title( $settings['type'] ) ?>">
131
-					<a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr( $settings['class'] ); ?>">
129
+				<th scope="row" class="titledesc"><?php echo $settings['title']; ?></th>
130
+				<td class="forminp forminp-<?php echo sanitize_title($settings['type']) ?>">
131
+					<a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr($settings['class']); ?>">
132 132
 						<?php echo $settings['button_text']; ?>
133 133
 					</a>
134
-					<span class="description"><?php echo $settings['desc'];?></span>
134
+					<span class="description"><?php echo $settings['desc']; ?></span>
135 135
 				</td>
136 136
 			</tr>
137 137
 			<?php
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		public function output() {
149 149
 			$settings = $this->get_settings();
150 150
 
151
-			Auto_Load_Next_Post_Admin_Settings::output_fields( $settings );
151
+			Auto_Load_Next_Post_Admin_Settings::output_fields($settings);
152 152
 		} // END output()
153 153
 
154 154
 		/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		public function save() {
161 161
 			$settings = $this->get_settings();
162 162
 
163
-			Auto_Load_Next_Post_Admin_Settings::save_fields( $settings );
163
+			Auto_Load_Next_Post_Admin_Settings::save_fields($settings);
164 164
 		} // END save()
165 165
 
166 166
 	} // END class
Please login to merge, or discard this patch.
includes/admin/settings/class-alnp-settings-events.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
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
-if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Events_Tab' ) ) {
17
+if ( ! class_exists('Auto_Load_Next_Post_Settings_Events_Tab')) {
18 18
 
19 19
 	class Auto_Load_Next_Post_Settings_Events_Tab extends Auto_Load_Next_Post_Settings_Page {
20 20
 
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 		 */
26 26
 		public function __construct() {
27 27
 			$this->id    = 'events';
28
-			$this->label = esc_html__( 'Events', 'auto-load-next-post' );
28
+			$this->label = esc_html__('Events', 'auto-load-next-post');
29 29
 
30 30
 			parent::__construct();
31 31
 
32
-			add_action( 'auto_load_next_post_settings_' . $this->id, array( __CLASS__, 'is_jetpack_lazy_images_active' ), 10 );
32
+			add_action('auto_load_next_post_settings_'.$this->id, array(__CLASS__, 'is_jetpack_lazy_images_active'), 10);
33 33
 		} // END __construct()
34 34
 
35 35
 		/**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		 * @static
41 41
 		 */
42 42
 		public static function is_jetpack_lazy_images_active() {
43
-			if ( alnp_check_jetpack() == 'yes' ) {
44
-				if ( Jetpack::is_module_active( 'lazy-images' ) ) {
45
-					include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-jetpack-lazy-images-module.php' );
43
+			if (alnp_check_jetpack() == 'yes') {
44
+				if (Jetpack::is_module_active('lazy-images')) {
45
+					include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-jetpack-lazy-images-module.php');
46 46
 				}
47 47
 			}
48 48
 		} // END is_jetpack_lazy_images_active()
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 					array(
61 61
 						'title' => $this->label,
62 62
 						'type'  => 'title',
63
-						'desc'  => 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>' ),
63
+						'desc'  => 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>'),
64 64
 						'id'    => 'events_options'
65 65
 					),
66 66
 
67 67
 					array(
68
-						'title'    => esc_html__( 'Post loaded', 'auto-load-next-post' ),
69
-						'desc'     => esc_html__( 'Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post' ),
68
+						'title'    => esc_html__('Post loaded', 'auto-load-next-post'),
69
+						'desc'     => esc_html__('Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post'),
70 70
 						'id'       => 'auto_load_next_post_on_load_event',
71 71
 						'default'  => '',
72 72
 						'type'     => 'textarea',
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 					),
76 76
 
77 77
 					array(
78
-						'title'    => esc_html__( 'Entering a Post', 'auto-load-next-post' ),
79
-						'desc'     => esc_html__( 'Events listed here will be triggered when entering a post.', 'auto-load-next-post' ),
78
+						'title'    => esc_html__('Entering a Post', 'auto-load-next-post'),
79
+						'desc'     => esc_html__('Events listed here will be triggered when entering a post.', 'auto-load-next-post'),
80 80
 						'id'       => 'auto_load_next_post_on_entering_event',
81 81
 						'default'  => '',
82 82
 						'type'     => 'textarea',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		public function output() {
100 100
 			$settings = $this->get_settings();
101 101
 
102
-			Auto_Load_Next_Post_Admin_Settings::output_fields( $settings );
102
+			Auto_Load_Next_Post_Admin_Settings::output_fields($settings);
103 103
 		} // END output()
104 104
 
105 105
 		/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		public function save() {
111 111
 			$settings = $this->get_settings();
112 112
 
113
-			Auto_Load_Next_Post_Admin_Settings::save_fields( $settings );
113
+			Auto_Load_Next_Post_Admin_Settings::save_fields($settings);
114 114
 		} // END save()
115 115
 
116 116
 	} // END class
Please login to merge, or discard this patch.