Completed
Push — develop ( b02327...823fd6 )
by Naveen
41s queued 12s
created
src/wordlift.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -32,22 +32,22 @@  discard block
 block discarded – undo
32 32
 use Wordlift\Post\Post_Adapter;
33 33
 
34 34
 // If this file is called directly, abort.
35
-if ( ! defined( 'WPINC' ) ) {
35
+if ( ! defined('WPINC')) {
36 36
 	die;
37 37
 }
38 38
 
39
-define( 'WORDLIFT_VERSION', '3.38.0' );
39
+define('WORDLIFT_VERSION', '3.38.0');
40 40
 
41 41
 /**
42 42
  * Filter to disable WLP on any request, defaults to true.
43 43
  *
44 44
  * @since 3.33.6
45 45
  */
46
-if ( ! apply_filters( 'wl_is_enabled', true ) ) {
46
+if ( ! apply_filters('wl_is_enabled', true)) {
47 47
 	return;
48 48
 }
49 49
 
50
-require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
50
+require_once plugin_dir_path(__FILE__).'vendor/autoload.php';
51 51
 
52 52
 /*
53 53
 	 * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http.
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 wordlift_plugin_autoload_register();
58 58
 
59 59
 // Include WordLift constants.
60
-require_once plugin_dir_path( __FILE__ ) . 'wordlift-constants.php';
60
+require_once plugin_dir_path(__FILE__).'wordlift-constants.php';
61 61
 
62 62
 // Load modules.
63
-require_once plugin_dir_path( __FILE__ ) . 'modules/core/wordlift-core.php';
63
+require_once plugin_dir_path(__FILE__).'modules/core/wordlift-core.php';
64 64
 
65
-require_once plugin_dir_path( __FILE__ ) . 'deprecations.php';
65
+require_once plugin_dir_path(__FILE__).'deprecations.php';
66 66
 
67 67
 // Load early to enable/disable features.
68
-require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
68
+require_once plugin_dir_path(__FILE__).'wordlift/features/index.php';
69 69
 
70 70
 /**
71 71
  * The code that runs during plugin activation.
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function activate_wordlift() {
75 75
 
76
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
76
+	$log = Wordlift_Log_Service::get_logger('activate_wordlift');
77 77
 
78
-	$log->info( 'Activating WordLift...' );
78
+	$log->info('Activating WordLift...');
79 79
 
80
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
80
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
81 81
 	Wordlift_Activator::activate();
82 82
 
83 83
 	/**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  */
105 105
 function deactivate_wordlift() {
106 106
 
107
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
107
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
108 108
 	Wordlift_Deactivator::deactivate();
109 109
 	Wordlift_Http_Api::deactivate();
110 110
 	Ttl_Cache_Cleaner::deactivate();
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 
123 123
 }
124 124
 
125
-register_activation_hook( __FILE__, 'activate_wordlift' );
126
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
125
+register_activation_hook(__FILE__, 'activate_wordlift');
126
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
127 127
 
128 128
 /**
129 129
  * The core plugin class that is used to define internationalization,
130 130
  * admin-specific hooks, and public-facing site hooks.
131 131
  */
132
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
132
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
133 133
 
134 134
 /**
135 135
  * Begins execution of the plugin.
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	 * @return bool
150 150
 	 * @since 3.27.6
151 151
 	 */
152
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
153
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
154
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
155
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
152
+	if (apply_filters('wl_feature__enable__widgets', true)) {
153
+		add_action('widgets_init', 'wl_register_chord_widget');
154
+		add_action('widgets_init', 'wl_register_geo_widget');
155
+		add_action('widgets_init', 'wl_register_timeline_widget');
156 156
 	}
157
-	add_filter( 'widget_text', 'do_shortcode' );
157
+	add_filter('widget_text', 'do_shortcode');
158 158
 
159 159
 	/**
160 160
 	 * Filter: wl_feature__enable__analysis
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	 * @return bool
165 165
 	 * @since 3.27.6
166 166
 	 */
167
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
168
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
167
+	if (apply_filters('wl_feature__enable__analysis', true)) {
168
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action');
169 169
 	} else {
170
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
170
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action');
171 171
 	}
172 172
 
173 173
 	$plugin = new Wordlift();
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 	add_action(
186 186
 		'plugins_loaded',
187
-		function () {
187
+		function() {
188 188
 			// All features from registry should be initialized here.
189 189
 			$features_registry = Features_Registry::get_instance();
190 190
 			$features_registry->initialize_all_features();
@@ -195,27 +195,27 @@  discard block
 block discarded – undo
195 195
 	add_action(
196 196
 		'plugins_loaded',
197 197
 		// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
198
-		function () use ( $plugin ) {
198
+		function() use ($plugin) {
199 199
 
200 200
 			new Wordlift_Products_Navigator_Shortcode_REST();
201 201
 
202 202
 			// Register the Dataset module, requires `$api_service`.
203
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
204
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
203
+			require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php';
204
+			require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php';
205 205
 
206 206
 			/*
207 207
 			* Require the Entity annotation cleanup module.
208 208
 			*
209 209
 			* @since 3.34.6
210 210
 			*/
211
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php';
211
+			require_once plugin_dir_path(__FILE__).'wordlift/cleanup/index.php';
212 212
 
213 213
 			/*
214 214
 			* Import LOD entities.
215 215
 			*
216 216
 			* @since 3.35.0
217 217
 			*/
218
-			require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php';
218
+			require_once plugin_dir_path(__FILE__).'wordlift/lod-import/index.php';
219 219
 
220 220
 		}
221 221
 	);
@@ -233,23 +233,23 @@  discard block
 block discarded – undo
233 233
 function wordlift_plugin_autoload_register() {
234 234
 
235 235
 	spl_autoload_register(
236
-		function ( $class_name ) {
236
+		function($class_name) {
237 237
 
238 238
 			// Bail out if these are not our classes.
239
-			if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
239
+			if (0 !== strpos($class_name, 'Wordlift\\')) {
240 240
 				return false;
241 241
 			}
242 242
 
243
-			$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
243
+			$class_name_lc = strtolower(str_replace('_', '-', $class_name));
244 244
 
245
-			preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
245
+			preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches);
246 246
 
247
-			$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
248
-			$file = 'class-' . $matches[2] . '.php';
247
+			$path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]);
248
+			$file = 'class-'.$matches[2].'.php';
249 249
 
250
-			$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
250
+			$full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file;
251 251
 
252
-			if ( ! file_exists( $full_path ) ) {
252
+			if ( ! file_exists($full_path)) {
253 253
 				return false;
254 254
 			}
255 255
 
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
 
262 262
 }
263 263
 
264
-function wl_block_categories( $categories ) {
264
+function wl_block_categories($categories) {
265 265
 	return array_merge(
266 266
 		$categories,
267 267
 		array(
268 268
 			array(
269 269
 				'slug'  => 'wordlift',
270
-				'title' => __( 'WordLift', 'wordlift' ),
270
+				'title' => __('WordLift', 'wordlift'),
271 271
 			),
272 272
 		)
273 273
 	);
@@ -277,22 +277,22 @@  discard block
 block discarded – undo
277 277
  * This function is created temporarily to handle the legacy library,
278 278
  * this has to be removed when removing the legacy fields from the ui.
279 279
  */
280
-function wl_enqueue_leaflet( $in_footer = false ) {
280
+function wl_enqueue_leaflet($in_footer = false) {
281 281
 	// Leaflet.
282
-	wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' );
283
-	wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer );
282
+	wp_enqueue_style('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.css', array(), '1.6.0');
283
+	wp_enqueue_script('wl-leaflet', plugin_dir_url(__FILE__).'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer);
284 284
 }
285 285
 
286
-add_filter( 'block_categories', 'wl_block_categories', 10 );
286
+add_filter('block_categories', 'wl_block_categories', 10);
287 287
 
288 288
 // Temporary fix for a typo in WooCommerce Extension.
289 289
 add_filter(
290 290
 	'wl_feature__enable__dataset',
291
-	function ( $value ) {
292
-		return apply_filters( 'wl_features__enable__dataset', $value );
291
+	function($value) {
292
+		return apply_filters('wl_features__enable__dataset', $value);
293 293
 	}
294 294
 );
295 295
 
296
-require_once __DIR__ . '/modules/food-kg/load.php';
297
-require_once __DIR__ . '/modules/acf4so/load.php';
298
-require_once __DIR__ . '/modules/pods/load.php';
296
+require_once __DIR__.'/modules/food-kg/load.php';
297
+require_once __DIR__.'/modules/acf4so/load.php';
298
+require_once __DIR__.'/modules/pods/load.php';
Please login to merge, or discard this patch.