Completed
Push — develop ( 36a199...920e68 )
by David
01:14
created
src/modules/food-kg/includes/Module.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -6,56 +6,56 @@
 block discarded – undo
6 6
 
7 7
 class Module {
8 8
 
9
-	const RUN_EVENT = 'wl_food_kg__run';
10
-
11
-	/**
12
-	 * @var Api_Service_Ext
13
-	 */
14
-	private $api_service;
15
-
16
-	/**
17
-	 * @var Recipe_Lift_Strategy
18
-	 */
19
-	private $recipe_lift_strategies;
20
-
21
-	/**
22
-	 * @param Api_Service_Ext        $api_service
23
-	 * @param Recipe_Lift_Strategy[] $recipe_lift_strategies
24
-	 */
25
-	public function __construct( Api_Service_Ext $api_service, array $recipe_lift_strategies ) {
26
-		$this->api_service            = $api_service;
27
-		$this->recipe_lift_strategies = $recipe_lift_strategies;
28
-	}
29
-
30
-	public function register_hooks() {
31
-		add_action( 'wl_key_updated', array( $this, '__key_updated' ) );
32
-		add_action( 'wp_ajax_wl_food_kg__run', array( $this, '__run' ) );
33
-	}
34
-
35
-	public function __key_updated() {
36
-		try {
37
-			$me_response    = $this->api_service->me();
38
-			$has_food_kg    = isset( $me_response->networks )
39
-							  && array_reduce( $me_response->networks, array( $this, '__has_food_kg' ), false );
40
-			$next_scheduled = wp_next_scheduled( self::RUN_EVENT );
41
-
42
-			// We're connected to the Food KG, but not yet scheduled.
43
-			if ( $has_food_kg && ! $next_scheduled ) {
44
-				wp_schedule_event( time(), 'daily', self::RUN_EVENT );
45
-			}
46
-
47
-			// We're not connected to the Food KG, but we're scheduled.
48
-			if ( ! $has_food_kg && $next_scheduled ) {
49
-				wp_unschedule_event( $next_scheduled, self::RUN_EVENT );
50
-			}
51
-			// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
52
-		} catch ( \Exception $e ) {
53
-			// Do nothing.
54
-		}
55
-	}
56
-
57
-	private function __has_food_kg( $carry, $item ) {
58
-		return $carry || 'https://knowledge.cafemedia.com/food/' === $item->dataset_uri;
59
-	}
9
+    const RUN_EVENT = 'wl_food_kg__run';
10
+
11
+    /**
12
+     * @var Api_Service_Ext
13
+     */
14
+    private $api_service;
15
+
16
+    /**
17
+     * @var Recipe_Lift_Strategy
18
+     */
19
+    private $recipe_lift_strategies;
20
+
21
+    /**
22
+     * @param Api_Service_Ext        $api_service
23
+     * @param Recipe_Lift_Strategy[] $recipe_lift_strategies
24
+     */
25
+    public function __construct( Api_Service_Ext $api_service, array $recipe_lift_strategies ) {
26
+        $this->api_service            = $api_service;
27
+        $this->recipe_lift_strategies = $recipe_lift_strategies;
28
+    }
29
+
30
+    public function register_hooks() {
31
+        add_action( 'wl_key_updated', array( $this, '__key_updated' ) );
32
+        add_action( 'wp_ajax_wl_food_kg__run', array( $this, '__run' ) );
33
+    }
34
+
35
+    public function __key_updated() {
36
+        try {
37
+            $me_response    = $this->api_service->me();
38
+            $has_food_kg    = isset( $me_response->networks )
39
+                              && array_reduce( $me_response->networks, array( $this, '__has_food_kg' ), false );
40
+            $next_scheduled = wp_next_scheduled( self::RUN_EVENT );
41
+
42
+            // We're connected to the Food KG, but not yet scheduled.
43
+            if ( $has_food_kg && ! $next_scheduled ) {
44
+                wp_schedule_event( time(), 'daily', self::RUN_EVENT );
45
+            }
46
+
47
+            // We're not connected to the Food KG, but we're scheduled.
48
+            if ( ! $has_food_kg && $next_scheduled ) {
49
+                wp_unschedule_event( $next_scheduled, self::RUN_EVENT );
50
+            }
51
+            // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
52
+        } catch ( \Exception $e ) {
53
+            // Do nothing.
54
+        }
55
+    }
56
+
57
+    private function __has_food_kg( $carry, $item ) {
58
+        return $carry || 'https://knowledge.cafemedia.com/food/' === $item->dataset_uri;
59
+    }
60 60
 
61 61
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,39 +22,39 @@
 block discarded – undo
22 22
 	 * @param Api_Service_Ext        $api_service
23 23
 	 * @param Recipe_Lift_Strategy[] $recipe_lift_strategies
24 24
 	 */
25
-	public function __construct( Api_Service_Ext $api_service, array $recipe_lift_strategies ) {
25
+	public function __construct(Api_Service_Ext $api_service, array $recipe_lift_strategies) {
26 26
 		$this->api_service            = $api_service;
27 27
 		$this->recipe_lift_strategies = $recipe_lift_strategies;
28 28
 	}
29 29
 
30 30
 	public function register_hooks() {
31
-		add_action( 'wl_key_updated', array( $this, '__key_updated' ) );
32
-		add_action( 'wp_ajax_wl_food_kg__run', array( $this, '__run' ) );
31
+		add_action('wl_key_updated', array($this, '__key_updated'));
32
+		add_action('wp_ajax_wl_food_kg__run', array($this, '__run'));
33 33
 	}
34 34
 
35 35
 	public function __key_updated() {
36 36
 		try {
37 37
 			$me_response    = $this->api_service->me();
38
-			$has_food_kg    = isset( $me_response->networks )
39
-							  && array_reduce( $me_response->networks, array( $this, '__has_food_kg' ), false );
40
-			$next_scheduled = wp_next_scheduled( self::RUN_EVENT );
38
+			$has_food_kg    = isset($me_response->networks)
39
+							  && array_reduce($me_response->networks, array($this, '__has_food_kg'), false);
40
+			$next_scheduled = wp_next_scheduled(self::RUN_EVENT);
41 41
 
42 42
 			// We're connected to the Food KG, but not yet scheduled.
43
-			if ( $has_food_kg && ! $next_scheduled ) {
44
-				wp_schedule_event( time(), 'daily', self::RUN_EVENT );
43
+			if ($has_food_kg && ! $next_scheduled) {
44
+				wp_schedule_event(time(), 'daily', self::RUN_EVENT);
45 45
 			}
46 46
 
47 47
 			// We're not connected to the Food KG, but we're scheduled.
48
-			if ( ! $has_food_kg && $next_scheduled ) {
49
-				wp_unschedule_event( $next_scheduled, self::RUN_EVENT );
48
+			if ( ! $has_food_kg && $next_scheduled) {
49
+				wp_unschedule_event($next_scheduled, self::RUN_EVENT);
50 50
 			}
51 51
 			// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
52
-		} catch ( \Exception $e ) {
52
+		} catch (\Exception $e) {
53 53
 			// Do nothing.
54 54
 		}
55 55
 	}
56 56
 
57
-	private function __has_food_kg( $carry, $item ) {
57
+	private function __has_food_kg($carry, $item) {
58 58
 		return $carry || 'https://knowledge.cafemedia.com/food/' === $item->dataset_uri;
59 59
 	}
60 60
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-key-validation-service.php 2 patches
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -21,190 +21,190 @@
 block discarded – undo
21 21
  */
22 22
 class Wordlift_Key_Validation_Service {
23 23
 
24
-	/**
25
-	 * A {@link Wordlift_Log_Service} instance.
26
-	 *
27
-	 * @since  3.14.0
28
-	 * @access private
29
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
30
-	 */
31
-	private $log;
32
-
33
-	/**
34
-	 * @var Ttl_Cache
35
-	 */
36
-	private $ttl_cache_service;
37
-
38
-	/**
39
-	 * Create a {@link Wordlift_Key_Validation_Service} instance.
40
-	 *
41
-	 * @since 3.14.0
42
-	 */
43
-	public function __construct() {
44
-
45
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Key_Validation_Service' );
46
-
47
-		add_action( 'admin_init', array( $this, 'wl_load_plugin' ) );
48
-		/**
49
-		 * Filter: wl_feature__enable__notices.
50
-		 *
51
-		 * @return bool
52
-		 * @since 3.27.6
53
-		 */
54
-		if ( apply_filters( 'wl_feature__enable__notices', true ) ) {
55
-			add_action( 'admin_notices', array( $this, 'wl_key_update_notice' ) );
56
-		}
57
-
58
-		$this->ttl_cache_service = new Ttl_Cache( 'key-validation-notification' );
59
-
60
-	}
61
-
62
-	/**
63
-	 * Validate the provided key.
64
-	 *
65
-	 * @param string $key WordLift's key to validate.
66
-	 *
67
-	 * @return WP_Error|array The response or WP_Error on failure.
68
-	 * @since 3.9.0
69
-	 */
70
-	public function get_account_info( $key ) {
71
-
72
-		$this->log->debug( 'Validating key...' );
73
-
74
-		$response = Default_Api_Service::get_instance()->get(
75
-			'/accounts/info',
76
-			array(
77
-				'Authorization' => "Key $key",
78
-			)
79
-		);
80
-
81
-		/**
82
-		 * @param $response \Wordlift\Api\Response
83
-		 *
84
-		 * @since 3.38.5
85
-		 * This action is fired when the key is validated.
86
-		 */
87
-		do_action( 'wl_key_validation_response', $response );
88
-
89
-		return $response->get_response();
90
-	}
91
-
92
-	private function key_validation_request( $key ) {
93
-		$response = $this->get_account_info( $key );
94
-
95
-		if ( is_wp_error( $response ) || 2 !== (int) $response['response']['code'] / 100 ) {
96
-			throw new \Exception( __( 'An error occurred, please contact us at [email protected]', 'wordlift' ) );
97
-		}
98
-
99
-		$res_body = json_decode( wp_remote_retrieve_body( $response ), true );
100
-
101
-		$url = $res_body['url'];
102
-
103
-		$enabled_features = array_keys( array_filter( (array) $res_body['features'] ) );
104
-		$plugin_features  = array(
105
-			Entity_Type_Setter::STARTER_PLAN,
106
-			Entity_Type_Setter::PROFESSIONAL_PLAN,
107
-			Entity_Type_Setter::BUSINESS_PLAN,
108
-		);
109
-
110
-		if ( count( array_intersect( $enabled_features, $plugin_features ) ) === 0 ) {
111
-			throw new \Exception( __( 'This key is not valid. Start building your Knowledge Graph by purchasing a WordLift subscription <a href=\'https://wordlift.io/pricing/\'>here</a>.', 'wordlift' ) );
112
-		}
113
-
114
-		// Considering that production URL may be filtered.
115
-		$home_url = get_option( 'home' );
116
-		$site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) );
117
-
118
-		if ( ! empty( $url ) && $url !== $site_url ) {
119
-			throw new \Exception( __( 'The key is already used on another site, please contact us at [email protected] to move the key to another site.', 'wordlift' ) );
120
-		}
121
-
122
-		return true;
123
-	}
124
-
125
-	/**
126
-	 * Check if key is valid
127
-	 *
128
-	 * @param $key string
129
-	 *
130
-	 * @return bool
131
-	 */
132
-	public function is_key_valid( $key ) {
133
-		try {
134
-			$this->key_validation_request( $key );
135
-
136
-			return true;
137
-		} catch ( \Exception $e ) {
138
-			return false;
139
-		}
140
-	}
141
-
142
-	/**
143
-	 * This function is hooked to the `wl_validate_key` AJAX call.
144
-	 *
145
-	 * @since 3.9.0
146
-	 */
147
-	public function validate_key() {
148
-
149
-		// Ensure we don't have garbage before us.
150
-		ob_clean();
151
-
152
-		// Check if we have a key.
153
-		if ( ! isset( $_POST['key'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Missing
154
-			wp_send_json_error( 'The key parameter is required.' );
155
-		}
156
-
157
-		$this->ttl_cache_service->delete( 'is_key_valid' );
158
-
159
-		try {
160
-			$this->key_validation_request( sanitize_text_field( wp_unslash( (string) $_POST['key'] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
161
-			wp_send_json_success(
162
-				array(
163
-					'valid'   => true,
164
-					'message' => '',
165
-				)
166
-			);
167
-
168
-		} catch ( \Exception $e ) {
169
-			Wordlift_Configuration_Service::get_instance()->set_key( '' );
170
-			wp_send_json_success(
171
-				array(
172
-					'valid'   => false,
173
-					'message' => $e->getMessage(),
174
-					'api_url' => Default_Api_Service::get_instance()->get_base_url(),
175
-				)
176
-			);
177
-		}
178
-	}
179
-
180
-	/**
181
-	 * This function is hooked `admin_init` to check _wl_blog_url.
182
-	 */
183
-	public function wl_load_plugin() {
184
-
185
-		$wl_blog_url = get_option( '_wl_blog_url' );
186
-		$home_url    = get_option( 'home' );
187
-
188
-		if ( ! $wl_blog_url ) {
189
-			update_option( '_wl_blog_url', $home_url, true );
190
-		} elseif ( $wl_blog_url !== $home_url ) {
191
-			update_option( '_wl_blog_url', $home_url, true );
192
-			Wordlift_Configuration_Service::get_instance()->set_key( '' );
193
-			set_transient( 'wl-key-error-msg', __( "Your web site URL has changed. To avoid data corruption, WordLift's key has been removed. Please provide a new key in WordLift Settings. If you believe this to be an error, please contact us at [email protected]", 'wordlift' ), 10 );
194
-		}
195
-
196
-	}
197
-
198
-	/**
199
-	 * This function is hooked to the `admin_notices` to show admin notification.
200
-	 */
201
-	public function wl_key_update_notice() {
202
-		if ( get_transient( 'wl-key-error-msg' ) ) {
203
-			?>
24
+    /**
25
+     * A {@link Wordlift_Log_Service} instance.
26
+     *
27
+     * @since  3.14.0
28
+     * @access private
29
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
30
+     */
31
+    private $log;
32
+
33
+    /**
34
+     * @var Ttl_Cache
35
+     */
36
+    private $ttl_cache_service;
37
+
38
+    /**
39
+     * Create a {@link Wordlift_Key_Validation_Service} instance.
40
+     *
41
+     * @since 3.14.0
42
+     */
43
+    public function __construct() {
44
+
45
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Key_Validation_Service' );
46
+
47
+        add_action( 'admin_init', array( $this, 'wl_load_plugin' ) );
48
+        /**
49
+         * Filter: wl_feature__enable__notices.
50
+         *
51
+         * @return bool
52
+         * @since 3.27.6
53
+         */
54
+        if ( apply_filters( 'wl_feature__enable__notices', true ) ) {
55
+            add_action( 'admin_notices', array( $this, 'wl_key_update_notice' ) );
56
+        }
57
+
58
+        $this->ttl_cache_service = new Ttl_Cache( 'key-validation-notification' );
59
+
60
+    }
61
+
62
+    /**
63
+     * Validate the provided key.
64
+     *
65
+     * @param string $key WordLift's key to validate.
66
+     *
67
+     * @return WP_Error|array The response or WP_Error on failure.
68
+     * @since 3.9.0
69
+     */
70
+    public function get_account_info( $key ) {
71
+
72
+        $this->log->debug( 'Validating key...' );
73
+
74
+        $response = Default_Api_Service::get_instance()->get(
75
+            '/accounts/info',
76
+            array(
77
+                'Authorization' => "Key $key",
78
+            )
79
+        );
80
+
81
+        /**
82
+         * @param $response \Wordlift\Api\Response
83
+         *
84
+         * @since 3.38.5
85
+         * This action is fired when the key is validated.
86
+         */
87
+        do_action( 'wl_key_validation_response', $response );
88
+
89
+        return $response->get_response();
90
+    }
91
+
92
+    private function key_validation_request( $key ) {
93
+        $response = $this->get_account_info( $key );
94
+
95
+        if ( is_wp_error( $response ) || 2 !== (int) $response['response']['code'] / 100 ) {
96
+            throw new \Exception( __( 'An error occurred, please contact us at [email protected]', 'wordlift' ) );
97
+        }
98
+
99
+        $res_body = json_decode( wp_remote_retrieve_body( $response ), true );
100
+
101
+        $url = $res_body['url'];
102
+
103
+        $enabled_features = array_keys( array_filter( (array) $res_body['features'] ) );
104
+        $plugin_features  = array(
105
+            Entity_Type_Setter::STARTER_PLAN,
106
+            Entity_Type_Setter::PROFESSIONAL_PLAN,
107
+            Entity_Type_Setter::BUSINESS_PLAN,
108
+        );
109
+
110
+        if ( count( array_intersect( $enabled_features, $plugin_features ) ) === 0 ) {
111
+            throw new \Exception( __( 'This key is not valid. Start building your Knowledge Graph by purchasing a WordLift subscription <a href=\'https://wordlift.io/pricing/\'>here</a>.', 'wordlift' ) );
112
+        }
113
+
114
+        // Considering that production URL may be filtered.
115
+        $home_url = get_option( 'home' );
116
+        $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) );
117
+
118
+        if ( ! empty( $url ) && $url !== $site_url ) {
119
+            throw new \Exception( __( 'The key is already used on another site, please contact us at [email protected] to move the key to another site.', 'wordlift' ) );
120
+        }
121
+
122
+        return true;
123
+    }
124
+
125
+    /**
126
+     * Check if key is valid
127
+     *
128
+     * @param $key string
129
+     *
130
+     * @return bool
131
+     */
132
+    public function is_key_valid( $key ) {
133
+        try {
134
+            $this->key_validation_request( $key );
135
+
136
+            return true;
137
+        } catch ( \Exception $e ) {
138
+            return false;
139
+        }
140
+    }
141
+
142
+    /**
143
+     * This function is hooked to the `wl_validate_key` AJAX call.
144
+     *
145
+     * @since 3.9.0
146
+     */
147
+    public function validate_key() {
148
+
149
+        // Ensure we don't have garbage before us.
150
+        ob_clean();
151
+
152
+        // Check if we have a key.
153
+        if ( ! isset( $_POST['key'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Missing
154
+            wp_send_json_error( 'The key parameter is required.' );
155
+        }
156
+
157
+        $this->ttl_cache_service->delete( 'is_key_valid' );
158
+
159
+        try {
160
+            $this->key_validation_request( sanitize_text_field( wp_unslash( (string) $_POST['key'] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
161
+            wp_send_json_success(
162
+                array(
163
+                    'valid'   => true,
164
+                    'message' => '',
165
+                )
166
+            );
167
+
168
+        } catch ( \Exception $e ) {
169
+            Wordlift_Configuration_Service::get_instance()->set_key( '' );
170
+            wp_send_json_success(
171
+                array(
172
+                    'valid'   => false,
173
+                    'message' => $e->getMessage(),
174
+                    'api_url' => Default_Api_Service::get_instance()->get_base_url(),
175
+                )
176
+            );
177
+        }
178
+    }
179
+
180
+    /**
181
+     * This function is hooked `admin_init` to check _wl_blog_url.
182
+     */
183
+    public function wl_load_plugin() {
184
+
185
+        $wl_blog_url = get_option( '_wl_blog_url' );
186
+        $home_url    = get_option( 'home' );
187
+
188
+        if ( ! $wl_blog_url ) {
189
+            update_option( '_wl_blog_url', $home_url, true );
190
+        } elseif ( $wl_blog_url !== $home_url ) {
191
+            update_option( '_wl_blog_url', $home_url, true );
192
+            Wordlift_Configuration_Service::get_instance()->set_key( '' );
193
+            set_transient( 'wl-key-error-msg', __( "Your web site URL has changed. To avoid data corruption, WordLift's key has been removed. Please provide a new key in WordLift Settings. If you believe this to be an error, please contact us at [email protected]", 'wordlift' ), 10 );
194
+        }
195
+
196
+    }
197
+
198
+    /**
199
+     * This function is hooked to the `admin_notices` to show admin notification.
200
+     */
201
+    public function wl_key_update_notice() {
202
+        if ( get_transient( 'wl-key-error-msg' ) ) {
203
+            ?>
204 204
 		  <div class="updated notice is-dismissible error">
205 205
 			<p><?php esc_html( get_transient( 'wl-key-error-msg' ) ); ?></p>
206 206
 		  </div>
207 207
 			<?php
208
-		}
209
-	}
208
+        }
209
+    }
210 210
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function __construct() {
44 44
 
45
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Key_Validation_Service' );
45
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Key_Validation_Service');
46 46
 
47
-		add_action( 'admin_init', array( $this, 'wl_load_plugin' ) );
47
+		add_action('admin_init', array($this, 'wl_load_plugin'));
48 48
 		/**
49 49
 		 * Filter: wl_feature__enable__notices.
50 50
 		 *
51 51
 		 * @return bool
52 52
 		 * @since 3.27.6
53 53
 		 */
54
-		if ( apply_filters( 'wl_feature__enable__notices', true ) ) {
55
-			add_action( 'admin_notices', array( $this, 'wl_key_update_notice' ) );
54
+		if (apply_filters('wl_feature__enable__notices', true)) {
55
+			add_action('admin_notices', array($this, 'wl_key_update_notice'));
56 56
 		}
57 57
 
58
-		$this->ttl_cache_service = new Ttl_Cache( 'key-validation-notification' );
58
+		$this->ttl_cache_service = new Ttl_Cache('key-validation-notification');
59 59
 
60 60
 	}
61 61
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return WP_Error|array The response or WP_Error on failure.
68 68
 	 * @since 3.9.0
69 69
 	 */
70
-	public function get_account_info( $key ) {
70
+	public function get_account_info($key) {
71 71
 
72
-		$this->log->debug( 'Validating key...' );
72
+		$this->log->debug('Validating key...');
73 73
 
74 74
 		$response = Default_Api_Service::get_instance()->get(
75 75
 			'/accounts/info',
@@ -84,39 +84,39 @@  discard block
 block discarded – undo
84 84
 		 * @since 3.38.5
85 85
 		 * This action is fired when the key is validated.
86 86
 		 */
87
-		do_action( 'wl_key_validation_response', $response );
87
+		do_action('wl_key_validation_response', $response);
88 88
 
89 89
 		return $response->get_response();
90 90
 	}
91 91
 
92
-	private function key_validation_request( $key ) {
93
-		$response = $this->get_account_info( $key );
92
+	private function key_validation_request($key) {
93
+		$response = $this->get_account_info($key);
94 94
 
95
-		if ( is_wp_error( $response ) || 2 !== (int) $response['response']['code'] / 100 ) {
96
-			throw new \Exception( __( 'An error occurred, please contact us at [email protected]', 'wordlift' ) );
95
+		if (is_wp_error($response) || 2 !== (int) $response['response']['code'] / 100) {
96
+			throw new \Exception(__('An error occurred, please contact us at [email protected]', 'wordlift'));
97 97
 		}
98 98
 
99
-		$res_body = json_decode( wp_remote_retrieve_body( $response ), true );
99
+		$res_body = json_decode(wp_remote_retrieve_body($response), true);
100 100
 
101 101
 		$url = $res_body['url'];
102 102
 
103
-		$enabled_features = array_keys( array_filter( (array) $res_body['features'] ) );
103
+		$enabled_features = array_keys(array_filter((array) $res_body['features']));
104 104
 		$plugin_features  = array(
105 105
 			Entity_Type_Setter::STARTER_PLAN,
106 106
 			Entity_Type_Setter::PROFESSIONAL_PLAN,
107 107
 			Entity_Type_Setter::BUSINESS_PLAN,
108 108
 		);
109 109
 
110
-		if ( count( array_intersect( $enabled_features, $plugin_features ) ) === 0 ) {
111
-			throw new \Exception( __( 'This key is not valid. Start building your Knowledge Graph by purchasing a WordLift subscription <a href=\'https://wordlift.io/pricing/\'>here</a>.', 'wordlift' ) );
110
+		if (count(array_intersect($enabled_features, $plugin_features)) === 0) {
111
+			throw new \Exception(__('This key is not valid. Start building your Knowledge Graph by purchasing a WordLift subscription <a href=\'https://wordlift.io/pricing/\'>here</a>.', 'wordlift'));
112 112
 		}
113 113
 
114 114
 		// Considering that production URL may be filtered.
115
-		$home_url = get_option( 'home' );
116
-		$site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) );
115
+		$home_url = get_option('home');
116
+		$site_url = apply_filters('wl_production_site_url', untrailingslashit($home_url));
117 117
 
118
-		if ( ! empty( $url ) && $url !== $site_url ) {
119
-			throw new \Exception( __( 'The key is already used on another site, please contact us at [email protected] to move the key to another site.', 'wordlift' ) );
118
+		if ( ! empty($url) && $url !== $site_url) {
119
+			throw new \Exception(__('The key is already used on another site, please contact us at [email protected] to move the key to another site.', 'wordlift'));
120 120
 		}
121 121
 
122 122
 		return true;
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return bool
131 131
 	 */
132
-	public function is_key_valid( $key ) {
132
+	public function is_key_valid($key) {
133 133
 		try {
134
-			$this->key_validation_request( $key );
134
+			$this->key_validation_request($key);
135 135
 
136 136
 			return true;
137
-		} catch ( \Exception $e ) {
137
+		} catch (\Exception $e) {
138 138
 			return false;
139 139
 		}
140 140
 	}
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		ob_clean();
151 151
 
152 152
 		// Check if we have a key.
153
-		if ( ! isset( $_POST['key'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Missing
154
-			wp_send_json_error( 'The key parameter is required.' );
153
+		if ( ! isset($_POST['key'])) {  //phpcs:ignore WordPress.Security.NonceVerification.Missing
154
+			wp_send_json_error('The key parameter is required.');
155 155
 		}
156 156
 
157
-		$this->ttl_cache_service->delete( 'is_key_valid' );
157
+		$this->ttl_cache_service->delete('is_key_valid');
158 158
 
159 159
 		try {
160
-			$this->key_validation_request( sanitize_text_field( wp_unslash( (string) $_POST['key'] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
160
+			$this->key_validation_request(sanitize_text_field(wp_unslash((string) $_POST['key']))); //phpcs:ignore WordPress.Security.NonceVerification.Missing
161 161
 			wp_send_json_success(
162 162
 				array(
163 163
 					'valid'   => true,
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 				)
166 166
 			);
167 167
 
168
-		} catch ( \Exception $e ) {
169
-			Wordlift_Configuration_Service::get_instance()->set_key( '' );
168
+		} catch (\Exception $e) {
169
+			Wordlift_Configuration_Service::get_instance()->set_key('');
170 170
 			wp_send_json_success(
171 171
 				array(
172 172
 					'valid'   => false,
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function wl_load_plugin() {
184 184
 
185
-		$wl_blog_url = get_option( '_wl_blog_url' );
186
-		$home_url    = get_option( 'home' );
185
+		$wl_blog_url = get_option('_wl_blog_url');
186
+		$home_url    = get_option('home');
187 187
 
188
-		if ( ! $wl_blog_url ) {
189
-			update_option( '_wl_blog_url', $home_url, true );
190
-		} elseif ( $wl_blog_url !== $home_url ) {
191
-			update_option( '_wl_blog_url', $home_url, true );
192
-			Wordlift_Configuration_Service::get_instance()->set_key( '' );
193
-			set_transient( 'wl-key-error-msg', __( "Your web site URL has changed. To avoid data corruption, WordLift's key has been removed. Please provide a new key in WordLift Settings. If you believe this to be an error, please contact us at [email protected]", 'wordlift' ), 10 );
188
+		if ( ! $wl_blog_url) {
189
+			update_option('_wl_blog_url', $home_url, true);
190
+		} elseif ($wl_blog_url !== $home_url) {
191
+			update_option('_wl_blog_url', $home_url, true);
192
+			Wordlift_Configuration_Service::get_instance()->set_key('');
193
+			set_transient('wl-key-error-msg', __("Your web site URL has changed. To avoid data corruption, WordLift's key has been removed. Please provide a new key in WordLift Settings. If you believe this to be an error, please contact us at [email protected]", 'wordlift'), 10);
194 194
 		}
195 195
 
196 196
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * This function is hooked to the `admin_notices` to show admin notification.
200 200
 	 */
201 201
 	public function wl_key_update_notice() {
202
-		if ( get_transient( 'wl-key-error-msg' ) ) {
202
+		if (get_transient('wl-key-error-msg')) {
203 203
 			?>
204 204
 		  <div class="updated notice is-dismissible error">
205
-			<p><?php esc_html( get_transient( 'wl-key-error-msg' ) ); ?></p>
205
+			<p><?php esc_html(get_transient('wl-key-error-msg')); ?></p>
206 206
 		  </div>
207 207
 			<?php
208 208
 		}
Please login to merge, or discard this patch.
src/admin/wordlift-admin-menu.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function wl_admin_menu() {
17 17
 
18
-	$menu_slug  = 'wl_admin_menu';
19
-	$capability = 'manage_options';
18
+    $menu_slug  = 'wl_admin_menu';
19
+    $capability = 'manage_options';
20 20
 
21
-	// see http://codex.wordpress.org/Function_Reference/add_menu_page
22
-	add_menu_page(
23
-		__( 'WordLift', 'wordlift' ),
24
-		__( 'WordLift', 'wordlift' ),
25
-		$capability,                 // capabilities
26
-		$menu_slug,                  // menu slug
27
-		'_wl_dashboard__main',  // TODO: function callback to draw the coming dashboard
28
-		WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-logo-icon.svg',
29
-		58.9
30
-	);
21
+    // see http://codex.wordpress.org/Function_Reference/add_menu_page
22
+    add_menu_page(
23
+        __( 'WordLift', 'wordlift' ),
24
+        __( 'WordLift', 'wordlift' ),
25
+        $capability,                 // capabilities
26
+        $menu_slug,                  // menu slug
27
+        '_wl_dashboard__main',  // TODO: function callback to draw the coming dashboard
28
+        WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-logo-icon.svg',
29
+        58.9
30
+    );
31 31
 
32
-	// Call hooked functions.
33
-	do_action( 'wl_admin_menu', $menu_slug, $capability );
32
+    // Call hooked functions.
33
+    do_action( 'wl_admin_menu', $menu_slug, $capability );
34 34
 
35 35
 }
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * @return void
41 41
  */
42 42
 function _wl_dashboard__main() {
43
-	do_action( '_wl_dashboard__main' );
43
+    do_action( '_wl_dashboard__main' );
44 44
 }
45 45
 
46 46
 add_action( 'admin_menu', 'wl_admin_menu' );
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
  * @since 3.15.0
54 54
  */
55 55
 function wl_remove_entity_type_menu() {
56
-	/*
56
+    /*
57 57
 	 * Remove from the menu links to the entity type admin page when
58 58
 	 * under non entity hierarchy.
59 59
 	 */
60
-	foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
61
-		// In the context of admin menues post has no explicit indication of post type in the urls.
62
-		if ( 'post' !== $post_type ) {
63
-			remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
64
-		}
60
+    foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
61
+        // In the context of admin menues post has no explicit indication of post type in the urls.
62
+        if ( 'post' !== $post_type ) {
63
+            remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
64
+        }
65 65
 
66
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $post_type ) {
67
-			remove_submenu_page( 'edit.php?post_type=' . $post_type, 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . '&amp;post_type=' . $post_type );
68
-		}
69
-	}
66
+        if ( Wordlift_Entity_Service::TYPE_NAME !== $post_type ) {
67
+            remove_submenu_page( 'edit.php?post_type=' . $post_type, 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . '&amp;post_type=' . $post_type );
68
+        }
69
+    }
70 70
 }
71 71
 
72 72
 add_action( 'admin_menu', 'wl_remove_entity_type_menu', 100 );
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function wl_admin_menu_callback() {
80 80
 
81
-	if ( ! current_user_can( 'manage_options' ) ) {
82
-		wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default' ) );
83
-	}
81
+    if ( ! current_user_can( 'manage_options' ) ) {
82
+        wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default' ) );
83
+    }
84 84
 
85
-	echo '<div class="wrap">';
86
-	echo '<p>Here is where the form would go if I actually had options.</p>';
87
-	echo '</div>';
85
+    echo '<div class="wrap">';
86
+    echo '<p>Here is where the form would go if I actually had options.</p>';
87
+    echo '</div>';
88 88
 
89 89
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 	// see http://codex.wordpress.org/Function_Reference/add_menu_page
22 22
 	add_menu_page(
23
-		__( 'WordLift', 'wordlift' ),
24
-		__( 'WordLift', 'wordlift' ),
25
-		$capability,                 // capabilities
26
-		$menu_slug,                  // menu slug
27
-		'_wl_dashboard__main',  // TODO: function callback to draw the coming dashboard
28
-		WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-logo-icon.svg',
23
+		__('WordLift', 'wordlift'),
24
+		__('WordLift', 'wordlift'),
25
+		$capability, // capabilities
26
+		$menu_slug, // menu slug
27
+		'_wl_dashboard__main', // TODO: function callback to draw the coming dashboard
28
+		WP_CONTENT_URL.'/plugins/wordlift/images/svg/wl-logo-icon.svg',
29 29
 		58.9
30 30
 	);
31 31
 
32 32
 	// Call hooked functions.
33
-	do_action( 'wl_admin_menu', $menu_slug, $capability );
33
+	do_action('wl_admin_menu', $menu_slug, $capability);
34 34
 
35 35
 }
36 36
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
  * @return void
41 41
  */
42 42
 function _wl_dashboard__main() {
43
-	do_action( '_wl_dashboard__main' );
43
+	do_action('_wl_dashboard__main');
44 44
 }
45 45
 
46
-add_action( 'admin_menu', 'wl_admin_menu' );
46
+add_action('admin_menu', 'wl_admin_menu');
47 47
 
48 48
 /**
49 49
  * This function is called by the *admin_menu* hook to remove for the admin menu
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 	 * Remove from the menu links to the entity type admin page when
58 58
 	 * under non entity hierarchy.
59 59
 	 */
60
-	foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $post_type ) {
60
+	foreach (Wordlift_Entity_Service::valid_entity_post_types() as $post_type) {
61 61
 		// In the context of admin menues post has no explicit indication of post type in the urls.
62
-		if ( 'post' !== $post_type ) {
63
-			remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
62
+		if ('post' !== $post_type) {
63
+			remove_submenu_page('edit.php', 'edit-tags.php?taxonomy='.Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
64 64
 		}
65 65
 
66
-		if ( Wordlift_Entity_Service::TYPE_NAME !== $post_type ) {
67
-			remove_submenu_page( 'edit.php?post_type=' . $post_type, 'edit-tags.php?taxonomy=' . Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME . '&amp;post_type=' . $post_type );
66
+		if (Wordlift_Entity_Service::TYPE_NAME !== $post_type) {
67
+			remove_submenu_page('edit.php?post_type='.$post_type, 'edit-tags.php?taxonomy='.Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME.'&amp;post_type='.$post_type);
68 68
 		}
69 69
 	}
70 70
 }
71 71
 
72
-add_action( 'admin_menu', 'wl_remove_entity_type_menu', 100 );
72
+add_action('admin_menu', 'wl_remove_entity_type_menu', 100);
73 73
 
74 74
 /**
75 75
  * This function is called as a callback by the *wl_admin_menu* to display the actual page.
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function wl_admin_menu_callback() {
80 80
 
81
-	if ( ! current_user_can( 'manage_options' ) ) {
82
-		wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'default' ) );
81
+	if ( ! current_user_can('manage_options')) {
82
+		wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'default'));
83 83
 	}
84 84
 
85 85
 	echo '<div class="wrap">';
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-41-0.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Wordlift_Install_3_41_0 extends Wordlift_Install {
11 11
 
12
-	/**
13
-	 * {@inheritdoc}
14
-	 */
15
-	protected static $version = '3.41.0';
12
+    /**
13
+     * {@inheritdoc}
14
+     */
15
+    protected static $version = '3.41.0';
16 16
 
17
-	public function install() {
17
+    public function install() {
18 18
 
19
-		global $wpdb;
19
+        global $wpdb;
20 20
 
21
-		$charset_collate = $wpdb->get_charset_collate();
21
+        $charset_collate = $wpdb->get_charset_collate();
22 22
 
23
-		dbDelta(
24
-			$wpdb->prepare(
25
-				"CREATE TABLE {$wpdb->prefix}wl_entities (
23
+        dbDelta(
24
+            $wpdb->prepare(
25
+                "CREATE TABLE {$wpdb->prefix}wl_entities (
26 26
 			id bigint(20) unsigned NOT NULL auto_increment,
27 27
 			content_id bigint(20) unsigned NOT NULL,
28 28
 			content_type tinyint(1) unsigned NOT NULL,
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 			UNIQUE KEY uq__content_id__content_type (content_id,content_type),
36 36
 			UNIQUE KEY uq__rel_uri_hash (rel_uri_hash)
37 37
 		) %1s;", // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder
38
-				$charset_collate
39
-			)
40
-		);
38
+                $charset_collate
39
+            )
40
+        );
41 41
 
42
-	}
42
+    }
43 43
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once ABSPATH . 'wp-admin/includes/upgrade.php';
3
+require_once ABSPATH.'wp-admin/includes/upgrade.php';
4 4
 
5 5
 /**
6 6
  * Create a daily schedule for WLP for existing installs.
Please login to merge, or discard this patch.
src/modules/dashboard/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 ComposerAutoloaderInit1bf0023e82df98e9965e078c6e62e256::getLoader();
Please login to merge, or discard this patch.
src/modules/dashboard/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/dashboard/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/dashboard/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' => '6344fb2d8d447db3a425429247f5fcae5a3bc68e',
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' => '6344fb2d8d447db3a425429247f5fcae5a3bc68e',
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.
src/modules/dashboard/vendor/composer/InstalledVersions.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public static function getVersionRanges($packageName)
138 138
     {
139 139
         foreach (self::getInstalled() as $installed) {
140
-            if (!isset($installed['versions'][$packageName])) {
140
+            if ( ! isset($installed['versions'][$packageName])) {
141 141
                 continue;
142 142
             }
143 143
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             return implode(' || ', $ranges);
159 159
         }
160 160
 
161
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
161
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
162 162
     }
163 163
 
164 164
     /**
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
     public static function getVersion($packageName)
169 169
     {
170 170
         foreach (self::getInstalled() as $installed) {
171
-            if (!isset($installed['versions'][$packageName])) {
171
+            if ( ! isset($installed['versions'][$packageName])) {
172 172
                 continue;
173 173
             }
174 174
 
175
-            if (!isset($installed['versions'][$packageName]['version'])) {
175
+            if ( ! isset($installed['versions'][$packageName]['version'])) {
176 176
                 return null;
177 177
             }
178 178
 
179 179
             return $installed['versions'][$packageName]['version'];
180 180
         }
181 181
 
182
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
182
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
183 183
     }
184 184
 
185 185
     /**
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
     public static function getPrettyVersion($packageName)
190 190
     {
191 191
         foreach (self::getInstalled() as $installed) {
192
-            if (!isset($installed['versions'][$packageName])) {
192
+            if ( ! isset($installed['versions'][$packageName])) {
193 193
                 continue;
194 194
             }
195 195
 
196
-            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
196
+            if ( ! isset($installed['versions'][$packageName]['pretty_version'])) {
197 197
                 return null;
198 198
             }
199 199
 
200 200
             return $installed['versions'][$packageName]['pretty_version'];
201 201
         }
202 202
 
203
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
203
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
204 204
     }
205 205
 
206 206
     /**
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
     public static function getReference($packageName)
211 211
     {
212 212
         foreach (self::getInstalled() as $installed) {
213
-            if (!isset($installed['versions'][$packageName])) {
213
+            if ( ! isset($installed['versions'][$packageName])) {
214 214
                 continue;
215 215
             }
216 216
 
217
-            if (!isset($installed['versions'][$packageName]['reference'])) {
217
+            if ( ! isset($installed['versions'][$packageName]['reference'])) {
218 218
                 return null;
219 219
             }
220 220
 
221 221
             return $installed['versions'][$packageName]['reference'];
222 222
         }
223 223
 
224
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
224
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
225 225
     }
226 226
 
227 227
     /**
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
     public static function getInstallPath($packageName)
232 232
     {
233 233
         foreach (self::getInstalled() as $installed) {
234
-            if (!isset($installed['versions'][$packageName])) {
234
+            if ( ! isset($installed['versions'][$packageName])) {
235 235
                 continue;
236 236
             }
237 237
 
238 238
             return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 239
         }
240 240
 
241
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
241
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
242 242
     }
243 243
 
244 244
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             // only require the installed.php file if this file is loaded from its dumped location,
268 268
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269 269
             if (substr(__DIR__, -8, 1) !== 'C') {
270
-                self::$installed = include __DIR__ . '/installed.php';
270
+                self::$installed = include __DIR__.'/installed.php';
271 271
             } else {
272 272
                 self::$installed = array();
273 273
             }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             // only require the installed.php file if this file is loaded from its dumped location,
341 341
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
342 342
             if (substr(__DIR__, -8, 1) !== 'C') {
343
-                self::$installed = require __DIR__ . '/installed.php';
343
+                self::$installed = require __DIR__.'/installed.php';
344 344
             } else {
345 345
                 self::$installed = array();
346 346
             }
Please login to merge, or discard this patch.