Completed
Push — develop ( 0af133...0b4679 )
by Naveen
02:17 queued 01:08
created
src/admin/class-wordlift-admin-setup.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since      3.9.0
13 13
  */
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @since    3.9.0
76 76
 	 */
77
-	public function __construct( $key_validation_service, $entity_service, $language_select_element, $country_select_element ) {
77
+	public function __construct($key_validation_service, $entity_service, $language_select_element, $country_select_element) {
78 78
 
79 79
 		// Set a reference to the key validation service.
80 80
 		$this->key_validation_service = $key_validation_service;
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// Hook to some WP's events:
90 90
 		// When WP is loaded check whether the user decided to skip the set-up, i.e. don't show us even if WL is not set up.
91
-		add_action( 'wp_loaded', array( $this, 'hide_notices' ) );
91
+		add_action('wp_loaded', array($this, 'hide_notices'));
92 92
 
93 93
 		// Hook to `admin_menu` in order to add our own setup wizard page.
94
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
94
+		add_action('admin_menu', array($this, 'admin_menu'));
95 95
 
96 96
 		// Triggered when the user accesses the admin area, we decide whether to show our own wizard.
97
-		add_action( 'admin_init', array( $this, 'show_page' ) );
97
+		add_action('admin_init', array($this, 'show_page'));
98 98
 
99 99
 		/**
100 100
 		 * Filter: wl_feature__enable__notices.
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 		 * @return bool
105 105
 		 * @since 3.27.6
106 106
 		 */
107
-		if ( apply_filters( 'wl_feature__enable__notices', true ) ) {
107
+		if (apply_filters('wl_feature__enable__notices', true)) {
108 108
 			// Hook to `admin_notices` to display our notices.
109
-			add_action( 'admin_notices', array( $this, 'admin_notices' ) );
109
+			add_action('admin_notices', array($this, 'admin_notices'));
110 110
 		}
111 111
 	}
112 112
 
@@ -118,21 +118,21 @@  discard block
 block discarded – undo
118 118
 	public function admin_init() {
119 119
 
120 120
 		// If the `_wl_activation_redirect` is set, the redirect to the setup page.
121
-		if ( get_transient( '_wl_activation_redirect' ) ) {
122
-			delete_transient( '_wl_activation_redirect' );
121
+		if (get_transient('_wl_activation_redirect')) {
122
+			delete_transient('_wl_activation_redirect');
123 123
 
124 124
 			// If the user asked to skip the wizard then comply.
125
-			if ( Wordlift_Configuration_Service::get_instance()->is_skip_wizard() ) {
125
+			if (Wordlift_Configuration_Service::get_instance()->is_skip_wizard()) {
126 126
 				return;
127 127
 			}
128 128
 
129 129
 			// If we're already on the page or the user doesn't have permissions, return.
130
-			if ( ( ! empty( $_GET['page'] ) && 'wl-setup' === $_GET['page'] ) || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
130
+			if (( ! empty($_GET['page']) && 'wl-setup' === $_GET['page']) || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
131 131
 				return;
132 132
 			}
133 133
 
134 134
 			// Finally redirect to the setup page.
135
-			wp_safe_redirect( admin_url( 'index.php?page=wl-setup' ) );
135
+			wp_safe_redirect(admin_url('index.php?page=wl-setup'));
136 136
 
137 137
 			exit;
138 138
 		}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	public function admin_notices() {
148 148
 
149 149
 		// Use `wl_configuration_get_key` to check whether WL's key is set and that the user didn't disable the wizard.
150
-		if ( '' === Wordlift_Configuration_Service::get_instance()->get_key() && ! Wordlift_Configuration_Service::get_instance()->is_skip_wizard() ) { ?>
150
+		if ('' === Wordlift_Configuration_Service::get_instance()->get_key() && ! Wordlift_Configuration_Service::get_instance()->is_skip_wizard()) { ?>
151 151
 			<div id="wl-message" class="updated">
152
-				<p><?php esc_html_e( 'Welcome to WordLift &#8211; You&lsquo;re almost ready to start', 'wordlift' ); ?></p>
152
+				<p><?php esc_html_e('Welcome to WordLift &#8211; You&lsquo;re almost ready to start', 'wordlift'); ?></p>
153 153
 				<p class="submit">
154
-					<a href="<?php echo esc_url( admin_url( 'admin.php?page=wl-setup' ) ); ?>"
155
-					   class="button-primary"><?php esc_html_e( 'Run the Setup Wizard', 'wordlift' ); ?></a>
154
+					<a href="<?php echo esc_url(admin_url('admin.php?page=wl-setup')); ?>"
155
+					   class="button-primary"><?php esc_html_e('Run the Setup Wizard', 'wordlift'); ?></a>
156 156
 					<a class="button-secondary skip"
157
-					   href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wl-hide-notice', 'install' ), 'wordlift_hide_notices_nonce', '_wl_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'wordlift' ); ?></a>
157
+					   href="<?php echo esc_url(wp_nonce_url(add_query_arg('wl-hide-notice', 'install'), 'wordlift_hide_notices_nonce', '_wl_notice_nonce')); ?>"><?php esc_html_e('Skip Setup', 'wordlift'); ?></a>
158 158
 				</p>
159 159
 			</div>
160 160
 			<?php
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 	public function hide_notices() {
171 171
 
172 172
 		// If it's not a `wl-hide-notice` or the nonce is not set, return.
173
-		if ( ! isset( $_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'] ) ) {
173
+		if ( ! isset($_GET['wl-hide-notice'], $_GET['_wl_notice_nonce'])) {
174 174
 			return;
175 175
 		}
176 176
 
177 177
 		// If the nonce is invalid, return an error.
178
-		if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wl_notice_nonce'] ) ), 'wordlift_hide_notices_nonce' ) ) {
179
-			wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'wordlift' ) );
178
+		if ( ! wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['_wl_notice_nonce'])), 'wordlift_hide_notices_nonce')) {
179
+			wp_die(esc_html__('Action failed. Please refresh the page and retry.', 'wordlift'));
180 180
 		}
181 181
 
182 182
 		// If the user doesn't have the right privileges, return an error.
183
-		if ( ! current_user_can( 'manage_options' ) ) {
184
-			wp_die( esc_html__( 'Cheatin&#8217; huh?', 'wordlift' ) );
183
+		if ( ! current_user_can('manage_options')) {
184
+			wp_die(esc_html__('Cheatin&#8217; huh?', 'wordlift'));
185 185
 		}
186 186
 
187 187
 		// Store a flag telling to skip the wizard.
188
-		Wordlift_Configuration_Service::get_instance()->set_skip_wizard( true );
188
+		Wordlift_Configuration_Service::get_instance()->set_skip_wizard(true);
189 189
 
190 190
 	}
191 191
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		 * @since 3.27.7
202 202
 		 */
203 203
 		// @todo: find another way to do this, since this is adding an empty space in WP's dashboard menu.
204
-		add_dashboard_page( '', '', 'manage_options', 'wl-setup', '' );
204
+		add_dashboard_page('', '', 'manage_options', 'wl-setup', '');
205 205
 	}
206 206
 
207 207
 	/**
@@ -212,29 +212,29 @@  discard block
 block discarded – undo
212 212
 	public function show_page() {
213 213
 
214 214
 		// First check if we are in the wizard page at all, if not do nothing.
215
-		if ( empty( $_GET['page'] ) || 'wl-setup' !== $_GET['page'] ) {
215
+		if (empty($_GET['page']) || 'wl-setup' !== $_GET['page']) {
216 216
 			return;
217 217
 		}
218 218
 
219 219
 		// Allow 3rd parties to provide alternative setups, this is useful for whitelabel setups.
220
-		do_action( 'wl_admin_setup__pre' );
220
+		do_action('wl_admin_setup__pre');
221 221
 
222 222
 		// If it's a POST and the `wl-save-configuration` action is set, save the configuration.
223
-		if ( isset( $_POST['action'] ) && 'wl-save-configuration' === $_POST['action'] ) {
223
+		if (isset($_POST['action']) && 'wl-save-configuration' === $_POST['action']) {
224 224
 
225 225
 			// Check the nonce and the user capabilities.
226
-			check_admin_referer( 'wl-save-configuration' );
226
+			check_admin_referer('wl-save-configuration');
227 227
 
228 228
 			// Check if the user has the right privileges.
229
-			if ( ! current_user_can( 'manage_options' ) ) {
230
-				wp_die( esc_html__( 'Sorry, you do not have a permission to save the settings', 'wordlift' ) );
229
+			if ( ! current_user_can('manage_options')) {
230
+				wp_die(esc_html__('Sorry, you do not have a permission to save the settings', 'wordlift'));
231 231
 			}
232 232
 
233 233
 			// Save the configuration.
234
-			$this->save_configuration( $_POST );
234
+			$this->save_configuration($_POST);
235 235
 
236 236
 			// Redirect to the admin's page.
237
-			wp_safe_redirect( admin_url() );
237
+			wp_safe_redirect(admin_url());
238 238
 			exit();
239 239
 		}
240 240
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
244 244
 		$country_select = $this->country_select_element;
245 245
 
246
-		include plugin_dir_path( __DIR__ ) . 'admin/partials/wordlift-admin-setup.php';
246
+		include plugin_dir_path(__DIR__).'admin/partials/wordlift-admin-setup.php';
247 247
 
248 248
 		exit;
249 249
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 *
256 256
 	 * @since 3.9.0
257 257
 	 */
258
-	public function save_configuration( $params ) {
258
+	public function save_configuration($params) {
259 259
 
260 260
 		// We have the following parameters:
261 261
 		// `key`, holding WL's key,
@@ -267,29 +267,29 @@  discard block
 block discarded – undo
267 267
 		// `logo`, the attachment id for the `personal` or `company` entity.
268 268
 
269 269
 		// Store the key:
270
-		Wordlift_Configuration_Service::get_instance()->set_key( $params['key'] );
270
+		Wordlift_Configuration_Service::get_instance()->set_key($params['key']);
271 271
 
272 272
 		// Store the vocabulary path:
273
-		Wordlift_Configuration_Service::get_instance()->set_entity_base_path( $params['vocabulary'] );
273
+		Wordlift_Configuration_Service::get_instance()->set_entity_base_path($params['vocabulary']);
274 274
 
275 275
 		// Store the site's country:
276
-		Wordlift_Configuration_Service::get_instance()->set_country_code( $params['wl-country-code'] );
276
+		Wordlift_Configuration_Service::get_instance()->set_country_code($params['wl-country-code']);
277 277
 
278 278
 		// Store the preferences in variable, because if the checkbox is not checked
279 279
 		// the `share-diagnostic` will not exists in `$params` array.
280
-		$share_diagnostic_preferences = empty( $params['share-diagnostic'] ) ? 'no' : 'yes';
280
+		$share_diagnostic_preferences = empty($params['share-diagnostic']) ? 'no' : 'yes';
281 281
 
282 282
 		// Store the diagnostic preferences:
283
-		Wordlift_Configuration_Service::get_instance()->set_diagnostic_preferences( $share_diagnostic_preferences );
283
+		Wordlift_Configuration_Service::get_instance()->set_diagnostic_preferences($share_diagnostic_preferences);
284 284
 
285 285
 		// Set the type URI, either http://schema.org/Person or http://schema.org/Organization.
286
-		$type_uri = sprintf( 'http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person' );
286
+		$type_uri = sprintf('http://schema.org/%s', 'organization' === $params['user_type'] ? 'Organization' : 'Person');
287 287
 
288 288
 		// Create an entity for the publisher.
289
-		$publisher_post_id = $this->entity_service->create( $params['name'], $type_uri, $params['logo'], 'publish' );
289
+		$publisher_post_id = $this->entity_service->create($params['name'], $type_uri, $params['logo'], 'publish');
290 290
 
291 291
 		// Store the publisher entity post id in the configuration.
292
-		Wordlift_Configuration_Service::get_instance()->set_publisher_id( $publisher_post_id );
292
+		Wordlift_Configuration_Service::get_instance()->set_publisher_id($publisher_post_id);
293 293
 
294 294
 		flush_rewrite_rules(); // Needed because of possible change to the entity base path.
295 295
 
Please login to merge, or discard this patch.
src/wordlift.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 use Wordlift\Features\Features_Registry;
32 32
 use Wordlift\Post\Post_Adapter;
33 33
 
34
-define( 'WORDLIFT_PLUGIN_FILE', __FILE__ );
35
-define( 'WORDLIFT_VERSION', '3.46.0-0' );
34
+define('WORDLIFT_PLUGIN_FILE', __FILE__);
35
+define('WORDLIFT_VERSION', '3.46.0-0');
36 36
 
37 37
 // DO NOT REMOVE THIS LINE: WHITELABEL PLACEHOLDER ##
38
-define( 'WL_RAPTIVE', true );
38
+define('WL_RAPTIVE', true);
39 39
 
40
-require_once plugin_dir_path( __FILE__ ) . '/libraries/action-scheduler/action-scheduler.php';
41
-require_once __DIR__ . '/modules/common/load.php';
42
-require_once __DIR__ . '/modules/app/load.php';
43
-require_once __DIR__ . '/modules/include-exclude/load.php';
40
+require_once plugin_dir_path(__FILE__).'/libraries/action-scheduler/action-scheduler.php';
41
+require_once __DIR__.'/modules/common/load.php';
42
+require_once __DIR__.'/modules/app/load.php';
43
+require_once __DIR__.'/modules/include-exclude/load.php';
44 44
 
45 45
 /**
46 46
  * Filter to disable WLP on any request, defaults to true.
47 47
  *
48 48
  * @since 3.33.6
49 49
  */
50
-if ( ! apply_filters( 'wl_is_enabled', true ) ) {
50
+if ( ! apply_filters('wl_is_enabled', true)) {
51 51
 	return;
52 52
 }
53 53
 
54
-require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
54
+require_once plugin_dir_path(__FILE__).'vendor/autoload.php';
55 55
 
56 56
 /*
57 57
  * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http.
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 wordlift_plugin_autoload_register();
62 62
 
63 63
 // Include WordLift constants.
64
-require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php';
64
+require_once plugin_dir_path(__FILE__).'wordlift-constants.php';
65 65
 
66 66
 // Load modules.
67
-require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php';
67
+require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php';
68 68
 
69
-require_once plugin_dir_path( __FILE__ ) . 'deprecations.php';
69
+require_once plugin_dir_path(__FILE__).'deprecations.php';
70 70
 
71 71
 // Load early to enable/disable features.
72
-require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
72
+require_once plugin_dir_path(__FILE__).'wordlift/features/index.php';
73 73
 
74 74
 /**
75 75
  * The code that runs during plugin activation.
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function activate_wordlift() {
79 79
 
80
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
80
+	$log = Wordlift_Log_Service::get_logger('activate_wordlift');
81 81
 
82
-	$log->info( 'Activating WordLift...' );
82
+	$log->info('Activating WordLift...');
83 83
 
84
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
84
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
85 85
 	Wordlift_Activator::activate();
86 86
 
87 87
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	Top_Entities::activate();
103 103
 
104
-	if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) {
105
-		wp_schedule_event( time(), 'daily', 'wl_daily_cron' );
104
+	if ( ! wp_next_scheduled('wl_daily_cron')) {
105
+		wp_schedule_event(time(), 'daily', 'wl_daily_cron');
106 106
 	}
107 107
 
108 108
 }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
  */
114 114
 function deactivate_wordlift() {
115 115
 
116
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
116
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
117 117
 	Wordlift_Deactivator::deactivate();
118 118
 	Wordlift_Http_Api::deactivate();
119 119
 	Ttl_Cache_Cleaner::deactivate();
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 	Key_Validation_Notice::remove_notification_flag();
130 130
 	flush_rewrite_rules();
131 131
 
132
-	wp_clear_scheduled_hook( 'wl_daily_cron' );
132
+	wp_clear_scheduled_hook('wl_daily_cron');
133 133
 
134 134
 }
135 135
 
136
-register_activation_hook( __FILE__, 'activate_wordlift' );
137
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
136
+register_activation_hook(__FILE__, 'activate_wordlift');
137
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
138 138
 
139 139
 /**
140 140
  * The core plugin class that is used to define internationalization,
141 141
  * admin-specific hooks, and public-facing site hooks.
142 142
  */
143
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
143
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
144 144
 
145 145
 /**
146 146
  * Begins execution of the plugin.
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	 * @return bool
161 161
 	 * @since 3.27.6
162 162
 	 */
163
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
164
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
165
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
166
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
163
+	if (apply_filters('wl_feature__enable__widgets', true)) {
164
+		add_action('widgets_init', 'wl_register_chord_widget');
165
+		add_action('widgets_init', 'wl_register_geo_widget');
166
+		add_action('widgets_init', 'wl_register_timeline_widget');
167 167
 	}
168
-	add_filter( 'widget_text', 'do_shortcode' );
168
+	add_filter('widget_text', 'do_shortcode');
169 169
 
170 170
 	/**
171 171
 	 * Filter: wl_feature__enable__analysis
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @return bool
176 176
 	 * @since 3.27.6
177 177
 	 */
178
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
179
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
178
+	if (apply_filters('wl_feature__enable__analysis', true)) {
179
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action');
180 180
 	} else {
181
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
181
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action');
182 182
 	}
183 183
 
184 184
 	$plugin = new Wordlift();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 	add_action(
197 197
 		'plugins_loaded',
198
-		function () {
198
+		function() {
199 199
 			// All features from registry should be initialized here.
200 200
 			$features_registry = Features_Registry::get_instance();
201 201
 			$features_registry->initialize_all_features();
@@ -206,27 +206,27 @@  discard block
 block discarded – undo
206 206
 	add_action(
207 207
 		'plugins_loaded',
208 208
 		// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
209
-		function () use ( $plugin ) {
209
+		function() use ($plugin) {
210 210
 
211 211
 			new Wordlift_Products_Navigator_Shortcode_REST();
212 212
 
213 213
 			// Register the Dataset module, requires `$api_service`.
214
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
215
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
214
+			require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php';
215
+			require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php';
216 216
 
217 217
 			/*
218 218
 			* Require the Entity annotation cleanup module.
219 219
 			*
220 220
 			* @since 3.34.6
221 221
 			*/
222
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php';
222
+			require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php';
223 223
 
224 224
 			/*
225 225
 			* Import LOD entities.
226 226
 			*
227 227
 			* @since 3.35.0
228 228
 			*/
229
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php';
229
+			require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php';
230 230
 
231 231
 		}
232 232
 	);
@@ -244,23 +244,23 @@  discard block
 block discarded – undo
244 244
 function wordlift_plugin_autoload_register() {
245 245
 
246 246
 	spl_autoload_register(
247
-		function ( $class_name ) {
247
+		function($class_name) {
248 248
 
249 249
 			// Bail out if these are not our classes.
250
-			if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
250
+			if (0 !== strpos($class_name, 'Wordlift\\')) {
251 251
 				return false;
252 252
 			}
253 253
 
254
-			$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
254
+			$class_name_lc = strtolower(str_replace('_', '-', $class_name));
255 255
 
256
-			preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
256
+			preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches);
257 257
 
258
-			$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
259
-			$file = 'class-' . $matches[2] . '.php';
258
+			$path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]);
259
+			$file = 'class-'.$matches[2].'.php';
260 260
 
261
-			$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
261
+			$full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file;
262 262
 
263
-			if ( ! file_exists( $full_path ) ) {
263
+			if ( ! file_exists($full_path)) {
264 264
 				return false;
265 265
 			}
266 266
 
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 
273 273
 }
274 274
 
275
-function wl_block_categories( $categories ) {
275
+function wl_block_categories($categories) {
276 276
 	return array_merge(
277 277
 		$categories,
278 278
 		array(
279 279
 			array(
280 280
 				'slug'  => 'wordlift',
281
-				'title' => __( 'WordLift', 'wordlift' ),
281
+				'title' => __('WordLift', 'wordlift'),
282 282
 			),
283 283
 		)
284 284
 	);
@@ -288,48 +288,48 @@  discard block
 block discarded – undo
288 288
  * This function is created temporarily to handle the legacy library,
289 289
  * this has to be removed when removing the legacy fields from the ui.
290 290
  */
291
-function wl_enqueue_leaflet( $in_footer = false ) {
291
+function wl_enqueue_leaflet($in_footer = false) {
292 292
 	// Leaflet.
293
-	wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' );
294
-	wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer );
293
+	wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0');
294
+	wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer);
295 295
 }
296 296
 
297
-add_filter( 'block_categories', 'wl_block_categories', 10 );
297
+add_filter('block_categories', 'wl_block_categories', 10);
298 298
 
299 299
 // Temporary fix for a typo in WooCommerce Extension.
300 300
 add_filter(
301 301
 	'wl_feature__enable__dataset',
302
-	function ( $value ) {
303
-		return apply_filters( 'wl_features__enable__dataset', $value );
302
+	function($value) {
303
+		return apply_filters('wl_features__enable__dataset', $value);
304 304
 	}
305 305
 );
306 306
 
307
-require_once __DIR__ . '/modules/food-kg/load.php';
308
-require_once __DIR__ . '/modules/gardening-kg/load.php';
309
-require_once __DIR__ . '/modules/acf4so/load.php';
310
-require_once __DIR__ . '/modules/dashboard/load.php';
311
-require_once __DIR__ . '/modules/pods/load.php';
312
-require_once __DIR__ . '/modules/include-exclude-push-config/load.php';
313
-require_once __DIR__ . '/modules/super-resolution/load.php';
314
-require_once __DIR__ . '/modules/redeem-code/load.php';
315
-require_once __DIR__ . '/modules/raptive-setup/load.php';
316
-
317
-function _wl_update_plugins_raptive_domain( $update, $plugin_data, $plugin_file ) {
307
+require_once __DIR__.'/modules/food-kg/load.php';
308
+require_once __DIR__.'/modules/gardening-kg/load.php';
309
+require_once __DIR__.'/modules/acf4so/load.php';
310
+require_once __DIR__.'/modules/dashboard/load.php';
311
+require_once __DIR__.'/modules/pods/load.php';
312
+require_once __DIR__.'/modules/include-exclude-push-config/load.php';
313
+require_once __DIR__.'/modules/super-resolution/load.php';
314
+require_once __DIR__.'/modules/redeem-code/load.php';
315
+require_once __DIR__.'/modules/raptive-setup/load.php';
316
+
317
+function _wl_update_plugins_raptive_domain($update, $plugin_data, $plugin_file) {
318 318
 	// Bail out if it's not our plugin.
319 319
 	$update_uri = $plugin_data['UpdateURI'];
320
-	if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) {
320
+	if ('wordlift/wordlift.php' !== $plugin_file || ! isset($update_uri)) {
321 321
 		return $update;
322 322
 	}
323 323
 
324
-	$response = wp_remote_get( "$update_uri?nocache=" . time() );
324
+	$response = wp_remote_get("$update_uri?nocache=".time());
325 325
 
326
-	if ( is_wp_error( $response ) ) {
326
+	if (is_wp_error($response)) {
327 327
 		return $update;
328 328
 	}
329 329
 
330 330
 	try {
331
-		return json_decode( wp_remote_retrieve_body( $response ) );
332
-	} catch ( Exception $e ) {
331
+		return json_decode(wp_remote_retrieve_body($response));
332
+	} catch (Exception $e) {
333 333
 		return $update;
334 334
 	}
335 335
 }
Please login to merge, or discard this patch.
src/modules/raptive-setup/load.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if this is not a Raptive install.
11
-if ( ! defined( 'WL_RAPTIVE' ) || ! WL_RAPTIVE ) {
11
+if ( ! defined('WL_RAPTIVE') || ! WL_RAPTIVE) {
12 12
 	return;
13 13
 }
14 14
 
15 15
 function __wl_raptive_admin_setup() {
16 16
 
17
-	wp_print_scripts( WL_ANGULAR_APP_SCRIPT_HANDLE );
18
-	$iframe_src = WL_ANGULAR_APP_URL . '#/raptive/setup/welcome';
17
+	wp_print_scripts(WL_ANGULAR_APP_SCRIPT_HANDLE);
18
+	$iframe_src = WL_ANGULAR_APP_URL.'#/raptive/setup/welcome';
19 19
 	// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
20 20
 	echo "
21 21
 			<style>
@@ -36,4 +36,4 @@  discard block
 block discarded – undo
36 36
 	exit;
37 37
 }
38 38
 
39
-add_action( 'wl_admin_setup__pre', '__wl_raptive_admin_setup' );
39
+add_action('wl_admin_setup__pre', '__wl_raptive_admin_setup');
Please login to merge, or discard this patch.
src/modules/app/load.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,38 +13,38 @@
 block discarded – undo
13 13
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\ContainerBuilder;
14 14
 use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
15 15
 
16
-if ( ! defined( 'WL_ANGULAR_APP_URL' ) ) {
17
-	define( 'WL_ANGULAR_APP_URL', esc_url( plugin_dir_url( __DIR__ ) . 'app/app/iframe.html' ) . '?v=' . WORDLIFT_VERSION );
16
+if ( ! defined('WL_ANGULAR_APP_URL')) {
17
+	define('WL_ANGULAR_APP_URL', esc_url(plugin_dir_url(__DIR__).'app/app/iframe.html').'?v='.WORDLIFT_VERSION);
18 18
 }
19 19
 
20
-if ( ! defined( 'WL_ANGULAR_APP_SCRIPT_HANDLE' ) ) {
21
-	define( 'WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app' );
20
+if ( ! defined('WL_ANGULAR_APP_SCRIPT_HANDLE')) {
21
+	define('WL_ANGULAR_APP_SCRIPT_HANDLE', 'wl-angular-app');
22 22
 }
23 23
 
24 24
 function __wl_app__init() {
25 25
 
26 26
 	// Load the rest of the module only on admin calls.
27
-	if ( ! is_admin() ) {
27
+	if ( ! is_admin()) {
28 28
 		return;
29 29
 	}
30 30
 
31 31
 	// Autoloader for plugin itself.
32
-	if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
33
-		require_once __DIR__ . '/vendor/autoload.php';
32
+	if (file_exists(__DIR__.'/vendor/autoload.php')) {
33
+		require_once __DIR__.'/vendor/autoload.php';
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @var $app Plugin_App
38 38
 	 */
39 39
 	$container_builder = new ContainerBuilder();
40
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
41
-	$loader->load( 'services.yml' );
40
+	$loader            = new YamlFileLoader($container_builder, new FileLocator(__DIR__));
41
+	$loader->load('services.yml');
42 42
 	$container_builder->compile();
43 43
 
44 44
 	/** @var Plugin_App $app */
45
-	$app = $container_builder->get( Plugin_App::class );
45
+	$app = $container_builder->get(Plugin_App::class);
46 46
 	$app->register_handle();
47 47
 }
48 48
 
49
-add_action( 'init', '__wl_app__init' );
49
+add_action('init', '__wl_app__init');
50 50
 
Please login to merge, or discard this patch.
src/modules/app/includes/Plugin_App.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 
9 9
 		wp_register_script(
10 10
 			WL_ANGULAR_APP_SCRIPT_HANDLE,
11
-			plugin_dir_url( __DIR__ ) . 'js/app.js',
11
+			plugin_dir_url(__DIR__).'js/app.js',
12 12
 			array(),
13 13
 			WORDLIFT_VERSION,
14 14
 			true
15 15
 		);
16
-		$settings = wp_json_encode( $this->get_settings() );
17
-		wp_add_inline_script( WL_ANGULAR_APP_SCRIPT_HANDLE, "var _wlPluginAppSettings = {$settings};" );
16
+		$settings = wp_json_encode($this->get_settings());
17
+		wp_add_inline_script(WL_ANGULAR_APP_SCRIPT_HANDLE, "var _wlPluginAppSettings = {$settings};");
18 18
 
19 19
 		// add_action(
20 20
 		// 'admin_enqueue_scripts',
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 			'wl_plugin_app_settings',
32 32
 			array(
33 33
 				// @see https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/
34
-				'wp_api_nonce'      => wp_create_nonce( 'wp_rest' ),
35
-				'wp_api_base'       => untrailingslashit( rest_url() ),
34
+				'wp_api_nonce'      => wp_create_nonce('wp_rest'),
35
+				'wp_api_base'       => untrailingslashit(rest_url()),
36 36
 				// Load wordlift api url and key.
37
-				'wl_api_base'       => apply_filters( 'wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE ),
37
+				'wl_api_base'       => apply_filters('wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE),
38 38
 				'wl_api_key'        => \Wordlift_Configuration_Service::get_instance()->get_key(),
39
-				'wl_dashboard_link' => admin_url( 'admin.php?page=wl_admin_menu' ),
39
+				'wl_dashboard_link' => admin_url('admin.php?page=wl_admin_menu'),
40 40
 			)
41 41
 		);
42 42
 	}
Please login to merge, or discard this patch.
src/modules/redeem-code/vendor/autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 // autoload.php @generated by Composer
4 4
 
5 5
 if (PHP_VERSION_ID < 50600) {
6
-    if (!headers_sent()) {
6
+    if ( ! headers_sent()) {
7 7
         header('HTTP/1.1 500 Internal Server Error');
8 8
     }
9 9
     $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
-    if (!ini_get('display_errors')) {
10
+    if ( ! ini_get('display_errors')) {
11 11
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12 12
             fwrite(STDERR, $err);
13
-        } elseif (!headers_sent()) {
13
+        } elseif ( ! headers_sent()) {
14 14
             echo $err;
15 15
         }
16 16
     }
@@ -20,6 +20,6 @@  discard block
 block discarded – undo
20 20
     );
21 21
 }
22 22
 
23
-require_once __DIR__ . '/composer/autoload_real.php';
23
+require_once __DIR__.'/composer/autoload_real.php';
24 24
 
25 25
 return ComposerAutoloaderInit74415885e7c3fa89b174bf8bc3b1fc6d::getLoader();
Please login to merge, or discard this patch.
src/modules/redeem-code/vendor/composer/platform_check.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,23 +4,23 @@
 block discarded – undo
4 4
 
5 5
 $issues = array();
6 6
 
7
-if (!(PHP_VERSION_ID >= 50600)) {
8
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
7
+if ( ! (PHP_VERSION_ID >= 50600)) {
8
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running '.PHP_VERSION.'.';
9 9
 }
10 10
 
11 11
 if ($issues) {
12
-    if (!headers_sent()) {
12
+    if ( ! headers_sent()) {
13 13
         header('HTTP/1.1 500 Internal Server Error');
14 14
     }
15
-    if (!ini_get('display_errors')) {
15
+    if ( ! ini_get('display_errors')) {
16 16
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
-            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
-        } elseif (!headers_sent()) {
19
-            echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
17
+            fwrite(STDERR, 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.implode(PHP_EOL, $issues).PHP_EOL.PHP_EOL);
18
+        } elseif ( ! headers_sent()) {
19
+            echo 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)).PHP_EOL.PHP_EOL;
20 20
         }
21 21
     }
22 22
     trigger_error(
23
-        'Composer detected issues in your platform: ' . implode(' ', $issues),
23
+        'Composer detected issues in your platform: '.implode(' ', $issues),
24 24
         E_USER_ERROR
25 25
     );
26 26
 }
Please login to merge, or discard this patch.
src/modules/redeem-code/vendor/composer/ClassLoader.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getPrefixes()
115 115
     {
116
-        if (!empty($this->prefixesPsr0)) {
116
+        if ( ! empty($this->prefixesPsr0)) {
117 117
             return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118 118
         }
119 119
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function add($prefix, $paths, $prepend = false)
185 185
     {
186
-        if (!$prefix) {
186
+        if ( ! $prefix) {
187 187
             if ($prepend) {
188 188
                 $this->fallbackDirsPsr0 = array_merge(
189 189
                     (array) $paths,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         $first = $prefix[0];
203
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
203
+        if ( ! isset($this->prefixesPsr0[$first][$prefix])) {
204 204
             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
205 205
 
206 206
             return;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function addPsr4($prefix, $paths, $prepend = false)
234 234
     {
235
-        if (!$prefix) {
235
+        if ( ! $prefix) {
236 236
             // Register directories for the root namespace.
237 237
             if ($prepend) {
238 238
                 $this->fallbackDirsPsr4 = array_merge(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     (array) $paths
246 246
                 );
247 247
             }
248
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
248
+        } elseif ( ! isset($this->prefixDirsPsr4[$prefix])) {
249 249
             // Register directories for a new namespace.
250 250
             $length = strlen($prefix);
251 251
             if ('\\' !== $prefix[$length - 1]) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function set($prefix, $paths)
281 281
     {
282
-        if (!$prefix) {
282
+        if ( ! $prefix) {
283 283
             $this->fallbackDirsPsr0 = (array) $paths;
284 284
         } else {
285 285
             $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function setPsr4($prefix, $paths)
301 301
     {
302
-        if (!$prefix) {
302
+        if ( ! $prefix) {
303 303
             $this->fallbackDirsPsr4 = (array) $paths;
304 304
         } else {
305 305
             $length = strlen($prefix);
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
     private function findFileWithExtension($class, $ext)
494 494
     {
495 495
         // PSR-4 lookup
496
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
497 497
 
498 498
         $first = $class[0];
499 499
         if (isset($this->prefixLengthsPsr4[$first])) {
500 500
             $subPath = $class;
501 501
             while (false !== $lastPos = strrpos($subPath, '\\')) {
502 502
                 $subPath = substr($subPath, 0, $lastPos);
503
-                $search = $subPath . '\\';
503
+                $search = $subPath.'\\';
504 504
                 if (isset($this->prefixDirsPsr4[$search])) {
505
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
506 506
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
-                        if (file_exists($file = $dir . $pathEnd)) {
507
+                        if (file_exists($file = $dir.$pathEnd)) {
508 508
                             return $file;
509 509
                         }
510 510
                     }
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         // PSR-4 fallback dirs
516 516
         foreach ($this->fallbackDirsPsr4 as $dir) {
517
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
518 518
                 return $file;
519 519
             }
520 520
         }
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
527 527
         } else {
528 528
             // PEAR-like class name
529
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
530 530
         }
531 531
 
532 532
         if (isset($this->prefixesPsr0[$first])) {
533 533
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534 534
                 if (0 === strpos($class, $prefix)) {
535 535
                     foreach ($dirs as $dir) {
536
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
537 537
                             return $file;
538 538
                         }
539 539
                     }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 
544 544
         // PSR-0 fallback dirs
545 545
         foreach ($this->fallbackDirsPsr0 as $dir) {
546
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
547 547
                 return $file;
548 548
             }
549 549
         }
Please login to merge, or discard this patch.
src/modules/redeem-code/vendor/composer/installed.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
         'version' => 'dev-develop',
6 6
         'reference' => '342dc6c9834a4b69989f21261c9e3f1df5707a66',
7 7
         'type' => 'wordpress-plugin',
8
-        'install_path' => __DIR__ . '/../../',
8
+        'install_path' => __DIR__.'/../../',
9 9
         'aliases' => array(),
10 10
         'dev' => true,
11 11
     ),
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             'version' => 'dev-develop',
16 16
             'reference' => '342dc6c9834a4b69989f21261c9e3f1df5707a66',
17 17
             'type' => 'wordpress-plugin',
18
-            'install_path' => __DIR__ . '/../../',
18
+            'install_path' => __DIR__.'/../../',
19 19
             'aliases' => array(),
20 20
             'dev_requirement' => false,
21 21
         ),
Please login to merge, or discard this patch.