Completed
Push — develop ( bfde1a...07de1c )
by David
03:08
created
src/wordlift/shipping-data/class-shipping-zone.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,41 +8,41 @@
 block discarded – undo
8 8
 
9 9
 class Shipping_Zone {
10 10
 
11
-	/**
12
-	 * @var WC_Shipping_Zone
13
-	 */
14
-	private $wc_shipping_zone;
11
+    /**
12
+     * @var WC_Shipping_Zone
13
+     */
14
+    private $wc_shipping_zone;
15 15
 
16
-	/**
17
-	 * @var Shipping_Method[]
18
-	 */
19
-	private $methods;
16
+    /**
17
+     * @var Shipping_Method[]
18
+     */
19
+    private $methods;
20 20
 
21
-	/**
22
-	 * Shipping_Zone constructor.
23
-	 *
24
-	 * @param WC_Shipping_Zone $wc_shipping_zone
25
-	 */
26
-	public function __construct( $wc_shipping_zone ) {
21
+    /**
22
+     * Shipping_Zone constructor.
23
+     *
24
+     * @param WC_Shipping_Zone $wc_shipping_zone
25
+     */
26
+    public function __construct( $wc_shipping_zone ) {
27 27
 
28
-		$this->wc_shipping_zone = $wc_shipping_zone;
28
+        $this->wc_shipping_zone = $wc_shipping_zone;
29 29
 
30
-	}
30
+    }
31 31
 
32
-	public function add_available_delivery_method( &$jsonld ) {
32
+    public function add_available_delivery_method( &$jsonld ) {
33 33
 
34
-		$this->methods = array_map( 'Wordlift\Shipping_Data\Shipping_Method::from_wc_shipping_method',
35
-			$this->wc_shipping_zone->get_shipping_methods( true ) );
34
+        $this->methods = array_map( 'Wordlift\Shipping_Data\Shipping_Method::from_wc_shipping_method',
35
+            $this->wc_shipping_zone->get_shipping_methods( true ) );
36 36
 
37
-		foreach ( $this->methods as $method ) {
38
-			$method->add_available_delivery_method( $jsonld );
39
-		}
37
+        foreach ( $this->methods as $method ) {
38
+            $method->add_available_delivery_method( $jsonld );
39
+        }
40 40
 
41
-	}
41
+    }
42 42
 
43
-	public static function from_wc_shipping_zone( $wc_shipping_zone ) {
43
+    public static function from_wc_shipping_zone( $wc_shipping_zone ) {
44 44
 
45
-		return new self( $wc_shipping_zone );
46
-	}
45
+        return new self( $wc_shipping_zone );
46
+    }
47 47
 
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@
 block discarded – undo
23 23
 	 *
24 24
 	 * @param WC_Shipping_Zone $wc_shipping_zone
25 25
 	 */
26
-	public function __construct( $wc_shipping_zone ) {
26
+	public function __construct($wc_shipping_zone) {
27 27
 
28 28
 		$this->wc_shipping_zone = $wc_shipping_zone;
29 29
 
30 30
 	}
31 31
 
32
-	public function add_available_delivery_method( &$jsonld ) {
32
+	public function add_available_delivery_method(&$jsonld) {
33 33
 
34
-		$this->methods = array_map( 'Wordlift\Shipping_Data\Shipping_Method::from_wc_shipping_method',
35
-			$this->wc_shipping_zone->get_shipping_methods( true ) );
34
+		$this->methods = array_map('Wordlift\Shipping_Data\Shipping_Method::from_wc_shipping_method',
35
+			$this->wc_shipping_zone->get_shipping_methods(true));
36 36
 
37
-		foreach ( $this->methods as $method ) {
38
-			$method->add_available_delivery_method( $jsonld );
37
+		foreach ($this->methods as $method) {
38
+			$method->add_available_delivery_method($jsonld);
39 39
 		}
40 40
 
41 41
 	}
42 42
 
43
-	public static function from_wc_shipping_zone( $wc_shipping_zone ) {
43
+	public static function from_wc_shipping_zone($wc_shipping_zone) {
44 44
 
45
-		return new self( $wc_shipping_zone );
45
+		return new self($wc_shipping_zone);
46 46
 	}
47 47
 
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-shipping-zones.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,30 +8,30 @@
 block discarded – undo
8 8
 
9 9
 class Shipping_Zones {
10 10
 
11
-	/**
12
-	 * @var Shipping_Zone[]
13
-	 */
14
-	private $zones;
11
+    /**
12
+     * @var Shipping_Zone[]
13
+     */
14
+    private $zones;
15 15
 
16
-	public function __construct() {
16
+    public function __construct() {
17 17
 
18
-		$this->zones = array();
18
+        $this->zones = array();
19 19
 
20
-	}
20
+    }
21 21
 
22
-	public function add_available_delivery_method( &$jsonld ) {
22
+    public function add_available_delivery_method( &$jsonld ) {
23 23
 
24
-		$zone_ids          = array_keys( WC_Shipping_Zones::get_zones() );
25
-		$wc_shipping_zones = array( WC_Shipping_Zones::get_zone( 0 ) );
26
-		foreach ( $zone_ids as $zone_id ) {
27
-			$wc_shipping_zones[] = WC_Shipping_Zones::get_zone( $zone_id );
28
-		}
29
-		$this->zones = array_map( 'Wordlift\Shipping_Data\Shipping_Zone::from_wc_shipping_zone', $wc_shipping_zones );
24
+        $zone_ids          = array_keys( WC_Shipping_Zones::get_zones() );
25
+        $wc_shipping_zones = array( WC_Shipping_Zones::get_zone( 0 ) );
26
+        foreach ( $zone_ids as $zone_id ) {
27
+            $wc_shipping_zones[] = WC_Shipping_Zones::get_zone( $zone_id );
28
+        }
29
+        $this->zones = array_map( 'Wordlift\Shipping_Data\Shipping_Zone::from_wc_shipping_zone', $wc_shipping_zones );
30 30
 
31
-		foreach ( $this->zones as $zone ) {
32
-			$zone->add_available_delivery_method( $jsonld );
33
-		}
31
+        foreach ( $this->zones as $zone ) {
32
+            $zone->add_available_delivery_method( $jsonld );
33
+        }
34 34
 
35
-	}
35
+    }
36 36
 
37 37
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@
 block discarded – undo
19 19
 
20 20
 	}
21 21
 
22
-	public function add_available_delivery_method( &$jsonld ) {
22
+	public function add_available_delivery_method(&$jsonld) {
23 23
 
24
-		$zone_ids          = array_keys( WC_Shipping_Zones::get_zones() );
25
-		$wc_shipping_zones = array( WC_Shipping_Zones::get_zone( 0 ) );
26
-		foreach ( $zone_ids as $zone_id ) {
27
-			$wc_shipping_zones[] = WC_Shipping_Zones::get_zone( $zone_id );
24
+		$zone_ids          = array_keys(WC_Shipping_Zones::get_zones());
25
+		$wc_shipping_zones = array(WC_Shipping_Zones::get_zone(0));
26
+		foreach ($zone_ids as $zone_id) {
27
+			$wc_shipping_zones[] = WC_Shipping_Zones::get_zone($zone_id);
28 28
 		}
29
-		$this->zones = array_map( 'Wordlift\Shipping_Data\Shipping_Zone::from_wc_shipping_zone', $wc_shipping_zones );
29
+		$this->zones = array_map('Wordlift\Shipping_Data\Shipping_Zone::from_wc_shipping_zone', $wc_shipping_zones);
30 30
 
31
-		foreach ( $this->zones as $zone ) {
32
-			$zone->add_available_delivery_method( $jsonld );
31
+		foreach ($this->zones as $zone) {
32
+			$zone->add_available_delivery_method($jsonld);
33 33
 		}
34 34
 
35 35
 	}
Please login to merge, or discard this patch.
src/wordlift/shipping-data/index.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use Wordlift\Shipping_Data\Shipping_Zones;
6 6
 
7 7
 if ( ! class_exists( '\WC_Shipping_Zones' ) ) {
8
-	return;
8
+    return;
9 9
 }
10 10
 
11 11
 $shipping_zones        = new Shipping_Zones();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 use Wordlift\Shipping_Data\Offer_Structured_Data;
5 5
 use Wordlift\Shipping_Data\Shipping_Zones;
6 6
 
7
-if ( ! class_exists( '\WC_Shipping_Zones' ) ) {
7
+if ( ! class_exists('\WC_Shipping_Zones')) {
8 8
 	return;
9 9
 }
10 10
 
11 11
 $shipping_zones        = new Shipping_Zones();
12
-$offer_structured_data = new Offer_Structured_Data( $shipping_zones );
12
+$offer_structured_data = new Offer_Structured_Data($shipping_zones);
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-local-pickup-shipping-method.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class Local_Pickup_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+    public function add_available_delivery_method( &$jsonld ) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
-			$jsonld['availableDeliveryMethod'] = array();
13
-		}
11
+        if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
+            $jsonld['availableDeliveryMethod'] = array();
13
+        }
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
-		}
15
+        if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
+            $jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
+        }
18 18
 
19
-		if ( ! in_array( 'OnSitePickup', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'OnSitePickup' );
21
-		}
19
+        if ( ! in_array( 'OnSitePickup', $jsonld['availableDeliveryMethod'] ) ) {
20
+            array_push( $jsonld['availableDeliveryMethod'], 'OnSitePickup' );
21
+        }
22 22
 
23
-	}
23
+    }
24 24
 
25 25
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 
7 7
 class Local_Pickup_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+	public function add_available_delivery_method(&$jsonld) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
11
+		if ( ! isset($jsonld['availableDeliveryMethod'])) {
12 12
 			$jsonld['availableDeliveryMethod'] = array();
13 13
 		}
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
15
+		if ( ! is_array($jsonld['availableDeliveryMethod'])) {
16
+			$jsonld['availableDeliveryMethod'] = array($jsonld['availableDeliveryMethod']);
17 17
 		}
18 18
 
19
-		if ( ! in_array( 'OnSitePickup', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'OnSitePickup' );
19
+		if ( ! in_array('OnSitePickup', $jsonld['availableDeliveryMethod'])) {
20
+			array_push($jsonld['availableDeliveryMethod'], 'OnSitePickup');
21 21
 		}
22 22
 
23 23
 	}
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-shipping-method.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,45 +8,45 @@
 block discarded – undo
8 8
 
9 9
 class Shipping_Method {
10 10
 
11
-	/**
12
-	 * @var WC_Shipping_Method $wc_shipping_method
13
-	 */
14
-	protected $wc_shipping_method;
15
-
16
-	/**
17
-	 * Shipping_Method constructor.
18
-	 *
19
-	 * @param WC_Shipping_Method $wc_shipping_method
20
-	 */
21
-	public function __construct( $wc_shipping_method ) {
22
-		$this->wc_shipping_method = $wc_shipping_method;
23
-	}
24
-
25
-	/**
26
-	 * @param WC_Shipping_Method $wc_shipping_method
27
-	 *
28
-	 * @return Shipping_Method
29
-	 */
30
-	public static function from_wc_shipping_method( $wc_shipping_method ) {
31
-
32
-		switch ( get_class( $wc_shipping_method ) ) {
33
-			case 'WC_Shipping_Local_Pickup':
34
-				return new Local_Pickup_Shipping_Method( $wc_shipping_method );
35
-
36
-			case 'WC_Shipping_Flat_Rate':
37
-				return new Flat_Rate_Shipping_Method( $wc_shipping_method );
38
-
39
-			case 'WC_Shipping_Free_Shipping':
40
-				return new Free_Shipping_Shipping_Method( $wc_shipping_method );
41
-
42
-			default:
43
-				return new self( $wc_shipping_method );
44
-		}
45
-
46
-	}
47
-
48
-	public function add_available_delivery_method( &$jsonld ) {
49
-
50
-	}
11
+    /**
12
+     * @var WC_Shipping_Method $wc_shipping_method
13
+     */
14
+    protected $wc_shipping_method;
15
+
16
+    /**
17
+     * Shipping_Method constructor.
18
+     *
19
+     * @param WC_Shipping_Method $wc_shipping_method
20
+     */
21
+    public function __construct( $wc_shipping_method ) {
22
+        $this->wc_shipping_method = $wc_shipping_method;
23
+    }
24
+
25
+    /**
26
+     * @param WC_Shipping_Method $wc_shipping_method
27
+     *
28
+     * @return Shipping_Method
29
+     */
30
+    public static function from_wc_shipping_method( $wc_shipping_method ) {
31
+
32
+        switch ( get_class( $wc_shipping_method ) ) {
33
+            case 'WC_Shipping_Local_Pickup':
34
+                return new Local_Pickup_Shipping_Method( $wc_shipping_method );
35
+
36
+            case 'WC_Shipping_Flat_Rate':
37
+                return new Flat_Rate_Shipping_Method( $wc_shipping_method );
38
+
39
+            case 'WC_Shipping_Free_Shipping':
40
+                return new Free_Shipping_Shipping_Method( $wc_shipping_method );
41
+
42
+            default:
43
+                return new self( $wc_shipping_method );
44
+        }
45
+
46
+    }
47
+
48
+    public function add_available_delivery_method( &$jsonld ) {
49
+
50
+    }
51 51
 
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param WC_Shipping_Method $wc_shipping_method
20 20
 	 */
21
-	public function __construct( $wc_shipping_method ) {
21
+	public function __construct($wc_shipping_method) {
22 22
 		$this->wc_shipping_method = $wc_shipping_method;
23 23
 	}
24 24
 
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @return Shipping_Method
29 29
 	 */
30
-	public static function from_wc_shipping_method( $wc_shipping_method ) {
30
+	public static function from_wc_shipping_method($wc_shipping_method) {
31 31
 
32
-		switch ( get_class( $wc_shipping_method ) ) {
32
+		switch (get_class($wc_shipping_method)) {
33 33
 			case 'WC_Shipping_Local_Pickup':
34
-				return new Local_Pickup_Shipping_Method( $wc_shipping_method );
34
+				return new Local_Pickup_Shipping_Method($wc_shipping_method);
35 35
 
36 36
 			case 'WC_Shipping_Flat_Rate':
37
-				return new Flat_Rate_Shipping_Method( $wc_shipping_method );
37
+				return new Flat_Rate_Shipping_Method($wc_shipping_method);
38 38
 
39 39
 			case 'WC_Shipping_Free_Shipping':
40
-				return new Free_Shipping_Shipping_Method( $wc_shipping_method );
40
+				return new Free_Shipping_Shipping_Method($wc_shipping_method);
41 41
 
42 42
 			default:
43
-				return new self( $wc_shipping_method );
43
+				return new self($wc_shipping_method);
44 44
 		}
45 45
 
46 46
 	}
47 47
 
48
-	public function add_available_delivery_method( &$jsonld ) {
48
+	public function add_available_delivery_method(&$jsonld) {
49 49
 
50 50
 	}
51 51
 
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-offer-structured-data.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@
 block discarded – undo
4 4
 
5 5
 class Offer_Structured_Data {
6 6
 
7
-	/**
8
-	 * @var Shipping_Zones
9
-	 */
10
-	private $shipping_zones;
7
+    /**
8
+     * @var Shipping_Zones
9
+     */
10
+    private $shipping_zones;
11 11
 
12
-	/**
13
-	 * Offer_Structured_Data constructor.
14
-	 *
15
-	 * @param Shipping_Zones $shipping_zones
16
-	 */
17
-	public function __construct( $shipping_zones ) {
12
+    /**
13
+     * Offer_Structured_Data constructor.
14
+     *
15
+     * @param Shipping_Zones $shipping_zones
16
+     */
17
+    public function __construct( $shipping_zones ) {
18 18
 
19
-		$this->shipping_zones = $shipping_zones;
19
+        $this->shipping_zones = $shipping_zones;
20 20
 
21
-		add_filter( 'wl_entity_jsonld', array( $this, 'entity_jsonld' ), 10, 2 );
21
+        add_filter( 'wl_entity_jsonld', array( $this, 'entity_jsonld' ), 10, 2 );
22 22
 
23
-	}
23
+    }
24 24
 
25
-	public function entity_jsonld( $jsonld, $post_id ) {
25
+    public function entity_jsonld( $jsonld, $post_id ) {
26 26
 
27
-		// Bail out if it's not a Product or the offers property isn't set.
28
-		if ( ! in_array( 'Product', (array) $jsonld['@type'] ) || ! isset( $jsonld['offers'] ) ) {
29
-			return $jsonld;
30
-		}
27
+        // Bail out if it's not a Product or the offers property isn't set.
28
+        if ( ! in_array( 'Product', (array) $jsonld['@type'] ) || ! isset( $jsonld['offers'] ) ) {
29
+            return $jsonld;
30
+        }
31 31
 
32
-		if ( ! is_array( $jsonld['offers'] ) || ! is_numeric( key( $jsonld['offers'] ) ) ) {
33
-			$jsonld['offers'] = array( $jsonld['offers'] );
34
-		}
32
+        if ( ! is_array( $jsonld['offers'] ) || ! is_numeric( key( $jsonld['offers'] ) ) ) {
33
+            $jsonld['offers'] = array( $jsonld['offers'] );
34
+        }
35 35
 
36
-		foreach ( $jsonld['offers'] as &$offer ) {
37
-			$this->shipping_zones->add_available_delivery_method( $offer );
38
-		}
36
+        foreach ( $jsonld['offers'] as &$offer ) {
37
+            $this->shipping_zones->add_available_delivery_method( $offer );
38
+        }
39 39
 
40
-		return $jsonld;
41
-	}
40
+        return $jsonld;
41
+    }
42 42
 
43 43
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @param Shipping_Zones $shipping_zones
16 16
 	 */
17
-	public function __construct( $shipping_zones ) {
17
+	public function __construct($shipping_zones) {
18 18
 
19 19
 		$this->shipping_zones = $shipping_zones;
20 20
 
21
-		add_filter( 'wl_entity_jsonld', array( $this, 'entity_jsonld' ), 10, 2 );
21
+		add_filter('wl_entity_jsonld', array($this, 'entity_jsonld'), 10, 2);
22 22
 
23 23
 	}
24 24
 
25
-	public function entity_jsonld( $jsonld, $post_id ) {
25
+	public function entity_jsonld($jsonld, $post_id) {
26 26
 
27 27
 		// Bail out if it's not a Product or the offers property isn't set.
28
-		if ( ! in_array( 'Product', (array) $jsonld['@type'] ) || ! isset( $jsonld['offers'] ) ) {
28
+		if ( ! in_array('Product', (array) $jsonld['@type']) || ! isset($jsonld['offers'])) {
29 29
 			return $jsonld;
30 30
 		}
31 31
 
32
-		if ( ! is_array( $jsonld['offers'] ) || ! is_numeric( key( $jsonld['offers'] ) ) ) {
33
-			$jsonld['offers'] = array( $jsonld['offers'] );
32
+		if ( ! is_array($jsonld['offers']) || ! is_numeric(key($jsonld['offers']))) {
33
+			$jsonld['offers'] = array($jsonld['offers']);
34 34
 		}
35 35
 
36
-		foreach ( $jsonld['offers'] as &$offer ) {
37
-			$this->shipping_zones->add_available_delivery_method( $offer );
36
+		foreach ($jsonld['offers'] as &$offer) {
37
+			$this->shipping_zones->add_available_delivery_method($offer);
38 38
 		}
39 39
 
40 40
 		return $jsonld;
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-flat-rate-shipping-method.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class Flat_Rate_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+    public function add_available_delivery_method( &$jsonld ) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
-			$jsonld['availableDeliveryMethod'] = array();
13
-		}
11
+        if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
+            $jsonld['availableDeliveryMethod'] = array();
13
+        }
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
-		}
15
+        if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
+            $jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
+        }
18 18
 
19
-		if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
21
-		}
19
+        if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
+            array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
21
+        }
22 22
 
23
-	}
23
+    }
24 24
 
25 25
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 
7 7
 class Flat_Rate_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+	public function add_available_delivery_method(&$jsonld) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
11
+		if ( ! isset($jsonld['availableDeliveryMethod'])) {
12 12
 			$jsonld['availableDeliveryMethod'] = array();
13 13
 		}
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
15
+		if ( ! is_array($jsonld['availableDeliveryMethod'])) {
16
+			$jsonld['availableDeliveryMethod'] = array($jsonld['availableDeliveryMethod']);
17 17
 		}
18 18
 
19
-		if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
19
+		if ( ! in_array('ParcelDelivery', $jsonld['availableDeliveryMethod'])) {
20
+			array_push($jsonld['availableDeliveryMethod'], 'ParcelDelivery');
21 21
 		}
22 22
 
23 23
 	}
Please login to merge, or discard this patch.
src/wordlift/shipping-data/class-free-shipping-shipping-method.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class Free_Shipping_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+    public function add_available_delivery_method( &$jsonld ) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
-			$jsonld['availableDeliveryMethod'] = array();
13
-		}
11
+        if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
12
+            $jsonld['availableDeliveryMethod'] = array();
13
+        }
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
-		}
15
+        if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
+            $jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
17
+        }
18 18
 
19
-		if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
21
-		}
19
+        if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
+            array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
21
+        }
22 22
 
23
-	}
23
+    }
24 24
 
25 25
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 
7 7
 class Free_Shipping_Shipping_Method extends Shipping_Method {
8 8
 
9
-	public function add_available_delivery_method( &$jsonld ) {
9
+	public function add_available_delivery_method(&$jsonld) {
10 10
 
11
-		if ( ! isset( $jsonld['availableDeliveryMethod'] ) ) {
11
+		if ( ! isset($jsonld['availableDeliveryMethod'])) {
12 12
 			$jsonld['availableDeliveryMethod'] = array();
13 13
 		}
14 14
 
15
-		if ( ! is_array( $jsonld['availableDeliveryMethod'] ) ) {
16
-			$jsonld['availableDeliveryMethod'] = array( $jsonld['availableDeliveryMethod'] );
15
+		if ( ! is_array($jsonld['availableDeliveryMethod'])) {
16
+			$jsonld['availableDeliveryMethod'] = array($jsonld['availableDeliveryMethod']);
17 17
 		}
18 18
 
19
-		if ( ! in_array( 'ParcelDelivery', $jsonld['availableDeliveryMethod'] ) ) {
20
-			array_push( $jsonld['availableDeliveryMethod'], 'ParcelDelivery' );
19
+		if ( ! in_array('ParcelDelivery', $jsonld['availableDeliveryMethod'])) {
20
+			array_push($jsonld['availableDeliveryMethod'], 'ParcelDelivery');
21 21
 		}
22 22
 
23 23
 	}
Please login to merge, or discard this patch.
src/wordlift.php 2 patches
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 // If this file is called directly, abort.
53 53
 if ( ! defined( 'WPINC' ) ) {
54
-	die;
54
+    die;
55 55
 }
56 56
 
57 57
 require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  */
75 75
 function wl_write_log( $log ) {
76 76
 
77
-	Wordlift_Log_Service::get_instance()->debug( $log );
77
+    Wordlift_Log_Service::get_instance()->debug( $log );
78 78
 
79 79
 }
80 80
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
  */
92 92
 function wl_write_log_hide_key( $text ) {
93 93
 
94
-	return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
94
+    return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
95 95
 }
96 96
 
97 97
 /**
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
  * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
100 100
  */
101 101
 function wordlift_allowed_post_tags() {
102
-	global $allowedposttags;
103
-
104
-	$tags           = array( 'span' );
105
-	$new_attributes = array(
106
-		'itemscope' => array(),
107
-		'itemtype'  => array(),
108
-		'itemprop'  => array(),
109
-		'itemid'    => array(),
110
-	);
111
-
112
-	foreach ( $tags as $tag ) {
113
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
114
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
115
-		}
116
-	}
102
+    global $allowedposttags;
103
+
104
+    $tags           = array( 'span' );
105
+    $new_attributes = array(
106
+        'itemscope' => array(),
107
+        'itemtype'  => array(),
108
+        'itemprop'  => array(),
109
+        'itemid'    => array(),
110
+    );
111
+
112
+    foreach ( $tags as $tag ) {
113
+        if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
114
+            $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
115
+        }
116
+    }
117 117
 }
118 118
 
119 119
 // add allowed post tags.
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function wordlift_admin_enqueue_scripts() {
126 126
 
127
-	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
128
-	wp_enqueue_script( 'wpdialogs' );
129
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
127
+    // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
128
+    wp_enqueue_script( 'wpdialogs' );
129
+    wp_enqueue_style( 'wp-jquery-ui-dialog' );
130 130
 
131
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
131
+    wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
132 132
 
133
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
133
+    wp_enqueue_script( 'jquery-ui-autocomplete' );
134 134
 
135
-	// Disable auto-save for custom entity posts only
136
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
137
-		wp_dequeue_script( 'autosave' );
138
-	}
135
+    // Disable auto-save for custom entity posts only
136
+    if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
137
+        wp_dequeue_script( 'autosave' );
138
+    }
139 139
 
140 140
 }
141 141
 
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function wordlift_allowed_html( $allowedtags, $context ) {
153 153
 
154
-	if ( 'post' !== $context ) {
155
-		return $allowedtags;
156
-	}
157
-
158
-	return array_merge_recursive( $allowedtags, array(
159
-		'span' => array(
160
-			'itemscope' => true,
161
-			'itemtype'  => true,
162
-			'itemid'    => true,
163
-			'itemprop'  => true,
164
-		),
165
-	) );
154
+    if ( 'post' !== $context ) {
155
+        return $allowedtags;
156
+    }
157
+
158
+    return array_merge_recursive( $allowedtags, array(
159
+        'span' => array(
160
+            'itemscope' => true,
161
+            'itemtype'  => true,
162
+            'itemid'    => true,
163
+            'itemprop'  => true,
164
+        ),
165
+    ) );
166 166
 }
167 167
 
168 168
 add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
@@ -176,16 +176,16 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function wl_get_coordinates( $post_id ) {
178 178
 
179
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
180
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
179
+    $latitude  = wl_schema_get_value( $post_id, 'latitude' );
180
+    $longitude = wl_schema_get_value( $post_id, 'longitude' );
181 181
 
182
-	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific
183
-	// place on the globe:"The zero/zero point of this system is located in the
184
-	// Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
185
-	return array(
186
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
187
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
188
-	);
182
+    // DO NOT set latitude/longitude to 0/0 as default values. It's a specific
183
+    // place on the globe:"The zero/zero point of this system is located in the
184
+    // Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
185
+    return array(
186
+        'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
187
+        'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
188
+    );
189 189
 }
190 190
 
191 191
 /**
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
  */
200 200
 function wl_get_image_urls( $post_id ) {
201 201
 
202
-	return Wordlift_Storage_Factory::get_instance()
203
-	                               ->post_images()
204
-	                               ->get( $post_id );
202
+    return Wordlift_Storage_Factory::get_instance()
203
+                                    ->post_images()
204
+                                    ->get( $post_id );
205 205
 
206 206
 }
207 207
 
@@ -215,24 +215,24 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
217 217
 
218
-	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
218
+    // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
219 219
 
220
-	$posts = get_posts( array(
221
-		'post_type'      => 'attachment',
222
-		'posts_per_page' => 1,
223
-		'post_status'    => 'any',
224
-		'post_parent'    => $parent_post_id,
225
-		'meta_key'       => 'wl_source_url',
226
-		'meta_value'     => $source_url,
227
-	) );
220
+    $posts = get_posts( array(
221
+        'post_type'      => 'attachment',
222
+        'posts_per_page' => 1,
223
+        'post_status'    => 'any',
224
+        'post_parent'    => $parent_post_id,
225
+        'meta_key'       => 'wl_source_url',
226
+        'meta_value'     => $source_url,
227
+    ) );
228 228
 
229
-	// Return the found post.
230
-	if ( 1 === count( $posts ) ) {
231
-		return $posts[0];
232
-	}
229
+    // Return the found post.
230
+    if ( 1 === count( $posts ) ) {
231
+        return $posts[0];
232
+    }
233 233
 
234
-	// Return null.
235
-	return null;
234
+    // Return null.
235
+    return null;
236 236
 }
237 237
 
238 238
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function wl_set_source_url( $post_id, $source_url ) {
245 245
 
246
-	delete_post_meta( $post_id, 'wl_source_url' );
247
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
246
+    delete_post_meta( $post_id, 'wl_source_url' );
247
+    add_post_meta( $post_id, 'wl_source_url', $source_url );
248 248
 }
249 249
 
250 250
 /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
  */
262 262
 function wl_sanitize_uri_path( $path, $char = '_' ) {
263 263
 
264
-	return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
264
+    return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
265 265
 }
266 266
 
267 267
 /**
@@ -273,47 +273,47 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function wl_replace_item_id_with_uri( $content ) {
275 275
 
276
-	$log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
277
-	$log->trace( 'Replacing item IDs with URIs...' );
276
+    $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
277
+    $log->trace( 'Replacing item IDs with URIs...' );
278 278
 
279
-	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
280
-	$content = stripslashes( $content );
279
+    // Strip slashes, see https://core.trac.wordpress.org/ticket/21767
280
+    $content = stripslashes( $content );
281 281
 
282
-	// If any match are found.
283
-	$matches = array();
284
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
282
+    // If any match are found.
283
+    $matches = array();
284
+    if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
285 285
 
286
-		foreach ( $matches as $match ) {
286
+        foreach ( $matches as $match ) {
287 287
 
288
-			// Get the item ID.
289
-			$item_id = $match[1];
288
+            // Get the item ID.
289
+            $item_id = $match[1];
290 290
 
291
-			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
292
-			$post = Wordlift_Entity_Service::get_instance()
293
-			                               ->get_entity_post_by_uri( $item_id );
291
+            // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
292
+            $post = Wordlift_Entity_Service::get_instance()
293
+                                            ->get_entity_post_by_uri( $item_id );
294 294
 
295
-			// If no entity is found, continue to the next one.
296
-			if ( null === $post ) {
297
-				continue;
298
-			}
295
+            // If no entity is found, continue to the next one.
296
+            if ( null === $post ) {
297
+                continue;
298
+            }
299 299
 
300
-			// Get the URI for that post.
301
-			$uri = wl_get_entity_uri( $post->ID );
300
+            // Get the URI for that post.
301
+            $uri = wl_get_entity_uri( $post->ID );
302 302
 
303
-			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
303
+            // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
304 304
 
305
-			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
306
-			if ( ! empty( $uri ) && $item_id !== $uri ) {
307
-				$uri_e   = esc_html( $uri );
308
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
309
-			}
310
-		}
311
-	}
305
+            // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
306
+            if ( ! empty( $uri ) && $item_id !== $uri ) {
307
+                $uri_e   = esc_html( $uri );
308
+                $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
309
+            }
310
+        }
311
+    }
312 312
 
313
-	// Reapply slashes.
314
-	$content = addslashes( $content );
313
+    // Reapply slashes.
314
+    $content = addslashes( $content );
315 315
 
316
-	return $content;
316
+    return $content;
317 317
 }
318 318
 
319 319
 add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
@@ -376,29 +376,29 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function activate_wordlift() {
378 378
 
379
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
380
-
381
-	$log->info( 'Activating WordLift...' );
382
-
383
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
384
-	Wordlift_Activator::activate();
385
-
386
-	/**
387
-	 * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
388
-	 *
389
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
390
-	 * @since 3.19.2
391
-	 */
392
-	Wordlift_Http_Api::activate();
393
-
394
-	// Ensure the post type is registered before flushing the rewrite rules.
395
-	Wordlift_Entity_Post_Type_Service::get_instance()->register();
396
-	flush_rewrite_rules();
397
-	/**
398
-	 * @since 3.27.7
399
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
400
-	 */
401
-	Top_Entities::activate();
379
+    $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
380
+
381
+    $log->info( 'Activating WordLift...' );
382
+
383
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
384
+    Wordlift_Activator::activate();
385
+
386
+    /**
387
+     * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
388
+     *
389
+     * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
390
+     * @since 3.19.2
391
+     */
392
+    Wordlift_Http_Api::activate();
393
+
394
+    // Ensure the post type is registered before flushing the rewrite rules.
395
+    Wordlift_Entity_Post_Type_Service::get_instance()->register();
396
+    flush_rewrite_rules();
397
+    /**
398
+     * @since 3.27.7
399
+     * @see https://github.com/insideout10/wordlift-plugin/issues/1214
400
+     */
401
+    Top_Entities::activate();
402 402
 }
403 403
 
404 404
 /**
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  */
408 408
 function deactivate_wordlift() {
409 409
 
410
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
411
-	Wordlift_Deactivator::deactivate();
412
-	Wordlift_Http_Api::deactivate();
413
-	Ttl_Cache_Cleaner::deactivate();
414
-	/**
415
-	 * @since 3.27.7
416
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
417
-	 */
418
-	Top_Entities::deactivate();
419
-	/**
420
-	 * @since 3.27.8
421
-	 * Remove notification flag on deactivation.
422
-	 */
423
-	Key_Validation_Notice::remove_notification_flag();
424
-	flush_rewrite_rules();
410
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
411
+    Wordlift_Deactivator::deactivate();
412
+    Wordlift_Http_Api::deactivate();
413
+    Ttl_Cache_Cleaner::deactivate();
414
+    /**
415
+     * @since 3.27.7
416
+     * @see https://github.com/insideout10/wordlift-plugin/issues/1214
417
+     */
418
+    Top_Entities::deactivate();
419
+    /**
420
+     * @since 3.27.8
421
+     * Remove notification flag on deactivation.
422
+     */
423
+    Key_Validation_Notice::remove_notification_flag();
424
+    flush_rewrite_rules();
425 425
 
426 426
 }
427 427
 
@@ -444,105 +444,105 @@  discard block
 block discarded – undo
444 444
  * @since    1.0.0
445 445
  */
446 446
 function run_wordlift() {
447
-	/**
448
-	 * Filter: wl_feature__enable__widgets.
449
-	 *
450
-	 * @param bool whether the widgets needed to be registered, defaults to true.
451
-	 *
452
-	 * @return bool
453
-	 * @since 3.27.6
454
-	 */
455
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
456
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
457
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
458
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
459
-	}
460
-	add_filter( 'widget_text', 'do_shortcode' );
461
-
462
-
463
-	/**
464
-	 * Filter: wl_feature__enable__analysis
465
-	 *
466
-	 * @param bool Whether to send api request to analysis or not
467
-	 *
468
-	 * @return bool
469
-	 * @since 3.27.6
470
-	 */
471
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
472
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
473
-	} else {
474
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
475
-	}
476
-
477
-	/*
447
+    /**
448
+     * Filter: wl_feature__enable__widgets.
449
+     *
450
+     * @param bool whether the widgets needed to be registered, defaults to true.
451
+     *
452
+     * @return bool
453
+     * @since 3.27.6
454
+     */
455
+    if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
456
+        add_action( 'widgets_init', 'wl_register_chord_widget' );
457
+        add_action( 'widgets_init', 'wl_register_geo_widget' );
458
+        add_action( 'widgets_init', 'wl_register_timeline_widget' );
459
+    }
460
+    add_filter( 'widget_text', 'do_shortcode' );
461
+
462
+
463
+    /**
464
+     * Filter: wl_feature__enable__analysis
465
+     *
466
+     * @param bool Whether to send api request to analysis or not
467
+     *
468
+     * @return bool
469
+     * @since 3.27.6
470
+     */
471
+    if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
472
+        add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
473
+    } else {
474
+        add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
475
+    }
476
+
477
+    /*
478 478
 	 * We introduce the WordLift autoloader, since we start using classes in namespaces, i.e. Wordlift\Http.
479 479
 	 *
480 480
 	 * @since 3.21.2
481 481
 	 */
482
-	wordlift_plugin_autoload_register();
482
+    wordlift_plugin_autoload_register();
483 483
 
484
-	$plugin = new Wordlift();
485
-	$plugin->run();
484
+    $plugin = new Wordlift();
485
+    $plugin->run();
486 486
 
487
-	// Initialize the TTL Cache Cleaner.
488
-	new Ttl_Cache_Cleaner();
487
+    // Initialize the TTL Cache Cleaner.
488
+    new Ttl_Cache_Cleaner();
489 489
 
490
-	// Load the new Post Adapter.
491
-	new Post_Adapter();
490
+    // Load the new Post Adapter.
491
+    new Post_Adapter();
492 492
 
493
-	// Load the API Data Hooks.
494
-	new Api_Data_Hooks( Wordlift_Configuration_Service::get_instance() );
493
+    // Load the API Data Hooks.
494
+    new Api_Data_Hooks( Wordlift_Configuration_Service::get_instance() );
495 495
 
496
-	add_action( 'plugins_loaded', function () {
497
-		// Load early. **PLEASE NOTE** that features are applied only to calls that happen **AFTER** the `plugins_loaded`
498
-		// action.
499
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
496
+    add_action( 'plugins_loaded', function () {
497
+        // Load early. **PLEASE NOTE** that features are applied only to calls that happen **AFTER** the `plugins_loaded`
498
+        // action.
499
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
500 500
 
501
-		// All features from registry should be initialized here.
502
-		$features_registry = Features_Registry::get_instance();
503
-		$features_registry->initialize_all_features();
504
-	}, 1 );
501
+        // All features from registry should be initialized here.
502
+        $features_registry = Features_Registry::get_instance();
503
+        $features_registry->initialize_all_features();
504
+    }, 1 );
505 505
 
506
-	add_action( 'plugins_loaded', function () use ( $plugin ) {
507
-		// Licenses Images.
508
-		$user_agent                   = User_Agent::get_user_agent();
509
-		$wordlift_key                 = Wordlift_Configuration_Service::get_instance()->get_key();
510
-		$api_service                  = new Default_Api_Service( apply_filters( 'wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE ), 60, $user_agent, $wordlift_key );
511
-		$image_license_factory        = new Image_License_Factory();
512
-		$image_license_service        = new Image_License_Service( $api_service, $image_license_factory );
513
-		$image_license_cache          = new Ttl_Cache( 'image-license', 86400 * 30 ); // 30 days.
514
-		$cached_image_license_service = new Cached_Image_License_Service( $image_license_service, $image_license_cache );
506
+    add_action( 'plugins_loaded', function () use ( $plugin ) {
507
+        // Licenses Images.
508
+        $user_agent                   = User_Agent::get_user_agent();
509
+        $wordlift_key                 = Wordlift_Configuration_Service::get_instance()->get_key();
510
+        $api_service                  = new Default_Api_Service( apply_filters( 'wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE ), 60, $user_agent, $wordlift_key );
511
+        $image_license_factory        = new Image_License_Factory();
512
+        $image_license_service        = new Image_License_Service( $api_service, $image_license_factory );
513
+        $image_license_cache          = new Ttl_Cache( 'image-license', 86400 * 30 ); // 30 days.
514
+        $cached_image_license_service = new Cached_Image_License_Service( $image_license_service, $image_license_cache );
515 515
 
516
-		$image_license_scheduler       = new Image_License_Scheduler( $image_license_service, $image_license_cache );
517
-		$image_license_cleanup_service = new Image_License_Cleanup_Service();
516
+        $image_license_scheduler       = new Image_License_Scheduler( $image_license_service, $image_license_cache );
517
+        $image_license_cleanup_service = new Image_License_Cleanup_Service();
518 518
 
519
-		// Get the cached data. If we have cached data, we load the notifier.
520
-		$image_license_data = $image_license_cache->get( Cached_Image_License_Service::GET_NON_PUBLIC_DOMAIN_IMAGES );
521
-		if ( null !== $image_license_data ) {
522
-			$image_license_page = new Image_License_Page( $image_license_data, Wordlift::get_instance()->get_version() );
523
-			new Image_License_Notifier( $image_license_data, $image_license_page );
524
-		}
519
+        // Get the cached data. If we have cached data, we load the notifier.
520
+        $image_license_data = $image_license_cache->get( Cached_Image_License_Service::GET_NON_PUBLIC_DOMAIN_IMAGES );
521
+        if ( null !== $image_license_data ) {
522
+            $image_license_page = new Image_License_Page( $image_license_data, Wordlift::get_instance()->get_version() );
523
+            new Image_License_Notifier( $image_license_data, $image_license_page );
524
+        }
525 525
 
526
-		$remove_all_images_task         = new Remove_All_Images_Task( $cached_image_license_service );
527
-		$remove_all_images_task_adapter = new Task_Ajax_Adapter( $remove_all_images_task );
526
+        $remove_all_images_task         = new Remove_All_Images_Task( $cached_image_license_service );
527
+        $remove_all_images_task_adapter = new Task_Ajax_Adapter( $remove_all_images_task );
528 528
 
529
-		$reload_data_task         = new Reload_Data_Task();
530
-		$reload_data_task_adapter = new Task_Ajax_Adapter( $reload_data_task );
529
+        $reload_data_task         = new Reload_Data_Task();
530
+        $reload_data_task_adapter = new Task_Ajax_Adapter( $reload_data_task );
531 531
 
532
-		$add_license_caption_or_remove_task         = new Add_License_Caption_Or_Remove_Task( $cached_image_license_service );
533
-		$add_license_caption_or_remove_task_adapter = new Task_Ajax_Adapter( $add_license_caption_or_remove_task );
532
+        $add_license_caption_or_remove_task         = new Add_License_Caption_Or_Remove_Task( $cached_image_license_service );
533
+        $add_license_caption_or_remove_task_adapter = new Task_Ajax_Adapter( $add_license_caption_or_remove_task );
534 534
 
535
-		$remove_all_images_task_page             = new Remove_All_Images_Page( new Task_Ajax_Adapters_Registry( $remove_all_images_task_adapter ), $plugin->get_version() );
536
-		$reload_data_task_page                   = new Reload_Data_Page( new Task_Ajax_Adapters_Registry( $reload_data_task_adapter ), $plugin->get_version() );
537
-		$add_license_caption_or_remove_task_page = new Add_License_Caption_Or_Remove_Page( new Task_Ajax_Adapters_Registry( $add_license_caption_or_remove_task_adapter ), $plugin->get_version() );
535
+        $remove_all_images_task_page             = new Remove_All_Images_Page( new Task_Ajax_Adapters_Registry( $remove_all_images_task_adapter ), $plugin->get_version() );
536
+        $reload_data_task_page                   = new Reload_Data_Page( new Task_Ajax_Adapters_Registry( $reload_data_task_adapter ), $plugin->get_version() );
537
+        $add_license_caption_or_remove_task_page = new Add_License_Caption_Or_Remove_Page( new Task_Ajax_Adapters_Registry( $add_license_caption_or_remove_task_adapter ), $plugin->get_version() );
538 538
 
539
-		new Wordlift_Products_Navigator_Shortcode_REST();
539
+        new Wordlift_Products_Navigator_Shortcode_REST();
540 540
 
541
-		// Register the Dataset module, requires `$api_service`.
542
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
543
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
541
+        // Register the Dataset module, requires `$api_service`.
542
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
543
+        require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
544 544
 
545
-	} );
545
+    } );
546 546
 
547 547
 }
548 548
 
@@ -556,45 +556,45 @@  discard block
 block discarded – undo
556 556
  */
557 557
 function wordlift_plugin_autoload_register() {
558 558
 
559
-	spl_autoload_register( function ( $class_name ) {
559
+    spl_autoload_register( function ( $class_name ) {
560 560
 
561
-		// Bail out if these are not our classes.
562
-		if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
563
-			return false;
564
-		}
561
+        // Bail out if these are not our classes.
562
+        if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
563
+            return false;
564
+        }
565 565
 
566
-		$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
566
+        $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
567 567
 
568
-		preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
568
+        preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
569 569
 
570
-		$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
571
-		$file = 'class-' . $matches[2] . '.php';
570
+        $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
571
+        $file = 'class-' . $matches[2] . '.php';
572 572
 
573
-		$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
573
+        $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
574 574
 
575
-		if ( ! file_exists( $full_path ) ) {
576
-			echo( "Class $class_name not found at $full_path." );
575
+        if ( ! file_exists( $full_path ) ) {
576
+            echo( "Class $class_name not found at $full_path." );
577 577
 
578
-			return false;
579
-		}
578
+            return false;
579
+        }
580 580
 
581
-		require_once $full_path;
581
+        require_once $full_path;
582 582
 
583
-		return true;
584
-	} );
583
+        return true;
584
+    } );
585 585
 
586 586
 }
587 587
 
588 588
 function wl_block_categories( $categories, $post ) {
589
-	return array_merge(
590
-		$categories,
591
-		array(
592
-			array(
593
-				'slug'  => 'wordlift',
594
-				'title' => __( 'WordLift', 'wordlift' ),
595
-			),
596
-		)
597
-	);
589
+    return array_merge(
590
+        $categories,
591
+        array(
592
+            array(
593
+                'slug'  => 'wordlift',
594
+                'title' => __( 'WordLift', 'wordlift' ),
595
+            ),
596
+        )
597
+    );
598 598
 }
599 599
 
600 600
 add_filter( 'block_categories', 'wl_block_categories', 10, 2 );
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
 use Wordlift\Tasks\Task_Ajax_Adapters_Registry;
51 51
 
52 52
 // If this file is called directly, abort.
53
-if ( ! defined( 'WPINC' ) ) {
53
+if ( ! defined('WPINC')) {
54 54
 	die;
55 55
 }
56 56
 
57
-require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
57
+require_once plugin_dir_path(__FILE__).'vendor/autoload.php';
58 58
 
59 59
 // Include WordLift constants.
60
-require_once( 'wordlift_constants.php' );
60
+require_once('wordlift_constants.php');
61 61
 
62 62
 // Load modules.
63
-require_once( 'modules/core/wordlift_core.php' );
63
+require_once('modules/core/wordlift_core.php');
64 64
 
65 65
 /**
66 66
  * Log to the debug.log file.
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
  * @deprecated use Wordlift_Log_Service::get_instance()->info( $log );
73 73
  *
74 74
  */
75
-function wl_write_log( $log ) {
75
+function wl_write_log($log) {
76 76
 
77
-	Wordlift_Log_Service::get_instance()->debug( $log );
77
+	Wordlift_Log_Service::get_instance()->debug($log);
78 78
 
79 79
 }
80 80
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
  * @since 3.0.0
90 90
  *
91 91
  */
92
-function wl_write_log_hide_key( $text ) {
92
+function wl_write_log_hide_key($text) {
93 93
 
94
-	return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
94
+	return str_ireplace(wl_configuration_get_key(), '<hidden>', $text);
95 95
 }
96 96
 
97 97
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 function wordlift_allowed_post_tags() {
102 102
 	global $allowedposttags;
103 103
 
104
-	$tags           = array( 'span' );
104
+	$tags           = array('span');
105 105
 	$new_attributes = array(
106 106
 		'itemscope' => array(),
107 107
 		'itemtype'  => array(),
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 		'itemid'    => array(),
110 110
 	);
111 111
 
112
-	foreach ( $tags as $tag ) {
113
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
114
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
112
+	foreach ($tags as $tag) {
113
+		if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) {
114
+			$allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes);
115 115
 		}
116 116
 	}
117 117
 }
118 118
 
119 119
 // add allowed post tags.
120
-add_action( 'init', 'wordlift_allowed_post_tags' );
120
+add_action('init', 'wordlift_allowed_post_tags');
121 121
 
122 122
 /**
123 123
  * Register additional scripts for the admin UI.
@@ -125,21 +125,21 @@  discard block
 block discarded – undo
125 125
 function wordlift_admin_enqueue_scripts() {
126 126
 
127 127
 	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
128
-	wp_enqueue_script( 'wpdialogs' );
129
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
128
+	wp_enqueue_script('wpdialogs');
129
+	wp_enqueue_style('wp-jquery-ui-dialog');
130 130
 
131
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
131
+	wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css');
132 132
 
133
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
133
+	wp_enqueue_script('jquery-ui-autocomplete');
134 134
 
135 135
 	// Disable auto-save for custom entity posts only
136
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
137
-		wp_dequeue_script( 'autosave' );
136
+	if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) {
137
+		wp_dequeue_script('autosave');
138 138
 	}
139 139
 
140 140
 }
141 141
 
142
-add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
142
+add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts');
143 143
 
144 144
 /**
145 145
  * Hooked to *wp_kses_allowed_html* filter, adds microdata attributes.
@@ -149,23 +149,23 @@  discard block
 block discarded – undo
149 149
  *
150 150
  * @return array An array which contains allowed microdata attributes.
151 151
  */
152
-function wordlift_allowed_html( $allowedtags, $context ) {
152
+function wordlift_allowed_html($allowedtags, $context) {
153 153
 
154
-	if ( 'post' !== $context ) {
154
+	if ('post' !== $context) {
155 155
 		return $allowedtags;
156 156
 	}
157 157
 
158
-	return array_merge_recursive( $allowedtags, array(
158
+	return array_merge_recursive($allowedtags, array(
159 159
 		'span' => array(
160 160
 			'itemscope' => true,
161 161
 			'itemtype'  => true,
162 162
 			'itemid'    => true,
163 163
 			'itemprop'  => true,
164 164
 		),
165
-	) );
165
+	));
166 166
 }
167 167
 
168
-add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
168
+add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2);
169 169
 
170 170
 /**
171 171
  * Get the coordinates for the specified post ID.
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
  *
175 175
  * @return array|null An array of coordinates or null.
176 176
  */
177
-function wl_get_coordinates( $post_id ) {
177
+function wl_get_coordinates($post_id) {
178 178
 
179
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
180
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
179
+	$latitude  = wl_schema_get_value($post_id, 'latitude');
180
+	$longitude = wl_schema_get_value($post_id, 'longitude');
181 181
 
182 182
 	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific
183 183
 	// place on the globe:"The zero/zero point of this system is located in the
184 184
 	// Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
185 185
 	return array(
186
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
187
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
186
+		'latitude'  => isset($latitude[0]) && is_numeric($latitude[0]) ? $latitude[0] : '',
187
+		'longitude' => isset($longitude[0]) && is_numeric($longitude[0]) ? $longitude[0] : '',
188 188
 	);
189 189
 }
190 190
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
  * @deprecated use Wordlift_Storage_Factory::get_instance()->post_images()->get( $post_id )
198 198
  *
199 199
  */
200
-function wl_get_image_urls( $post_id ) {
200
+function wl_get_image_urls($post_id) {
201 201
 
202 202
 	return Wordlift_Storage_Factory::get_instance()
203 203
 	                               ->post_images()
204
-	                               ->get( $post_id );
204
+	                               ->get($post_id);
205 205
 
206 206
 }
207 207
 
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
  *
214 214
  * @return WP_Post|null A post instance or null if not found.
215 215
  */
216
-function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
216
+function wl_get_attachment_for_source_url($parent_post_id, $source_url) {
217 217
 
218 218
 	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
219 219
 
220
-	$posts = get_posts( array(
220
+	$posts = get_posts(array(
221 221
 		'post_type'      => 'attachment',
222 222
 		'posts_per_page' => 1,
223 223
 		'post_status'    => 'any',
224 224
 		'post_parent'    => $parent_post_id,
225 225
 		'meta_key'       => 'wl_source_url',
226 226
 		'meta_value'     => $source_url,
227
-	) );
227
+	));
228 228
 
229 229
 	// Return the found post.
230
-	if ( 1 === count( $posts ) ) {
230
+	if (1 === count($posts)) {
231 231
 		return $posts[0];
232 232
 	}
233 233
 
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
  * @param int $post_id The post ID.
242 242
  * @param string $source_url The source URL.
243 243
  */
244
-function wl_set_source_url( $post_id, $source_url ) {
244
+function wl_set_source_url($post_id, $source_url) {
245 245
 
246
-	delete_post_meta( $post_id, 'wl_source_url' );
247
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
246
+	delete_post_meta($post_id, 'wl_source_url');
247
+	add_post_meta($post_id, 'wl_source_url', $source_url);
248 248
 }
249 249
 
250 250
 /**
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
  * @see        https://codex.wordpress.org/Function_Reference/sanitize_title
260 260
  *
261 261
  */
262
-function wl_sanitize_uri_path( $path, $char = '_' ) {
262
+function wl_sanitize_uri_path($path, $char = '_') {
263 263
 
264
-	return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
264
+	return Wordlift_Uri_Service::get_instance()->sanitize_path($path, $char);
265 265
 }
266 266
 
267 267
 /**
@@ -271,104 +271,104 @@  discard block
 block discarded – undo
271 271
  *
272 272
  * @return string The updated post content.
273 273
  */
274
-function wl_replace_item_id_with_uri( $content ) {
274
+function wl_replace_item_id_with_uri($content) {
275 275
 
276
-	$log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
277
-	$log->trace( 'Replacing item IDs with URIs...' );
276
+	$log = Wordlift_Log_Service::get_logger('wl_replace_item_id_with_uri');
277
+	$log->trace('Replacing item IDs with URIs...');
278 278
 
279 279
 	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
280
-	$content = stripslashes( $content );
280
+	$content = stripslashes($content);
281 281
 
282 282
 	// If any match are found.
283 283
 	$matches = array();
284
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
284
+	if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) {
285 285
 
286
-		foreach ( $matches as $match ) {
286
+		foreach ($matches as $match) {
287 287
 
288 288
 			// Get the item ID.
289 289
 			$item_id = $match[1];
290 290
 
291 291
 			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
292 292
 			$post = Wordlift_Entity_Service::get_instance()
293
-			                               ->get_entity_post_by_uri( $item_id );
293
+			                               ->get_entity_post_by_uri($item_id);
294 294
 
295 295
 			// If no entity is found, continue to the next one.
296
-			if ( null === $post ) {
296
+			if (null === $post) {
297 297
 				continue;
298 298
 			}
299 299
 
300 300
 			// Get the URI for that post.
301
-			$uri = wl_get_entity_uri( $post->ID );
301
+			$uri = wl_get_entity_uri($post->ID);
302 302
 
303 303
 			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
304 304
 
305 305
 			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
306
-			if ( ! empty( $uri ) && $item_id !== $uri ) {
307
-				$uri_e   = esc_html( $uri );
308
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
306
+			if ( ! empty($uri) && $item_id !== $uri) {
307
+				$uri_e   = esc_html($uri);
308
+				$content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content);
309 309
 			}
310 310
 		}
311 311
 	}
312 312
 
313 313
 	// Reapply slashes.
314
-	$content = addslashes( $content );
314
+	$content = addslashes($content);
315 315
 
316 316
 	return $content;
317 317
 }
318 318
 
319
-add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
319
+add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1);
320 320
 
321
-require_once( 'wordlift_entity_functions.php' );
321
+require_once('wordlift_entity_functions.php');
322 322
 
323 323
 // add editor related methods.
324
-require_once( 'wordlift_editor.php' );
324
+require_once('wordlift_editor.php');
325 325
 
326 326
 // add the WordLift entity custom type.
327
-require_once( 'wordlift_entity_type.php' );
327
+require_once('wordlift_entity_type.php');
328 328
 
329 329
 // add callbacks on post save to notify data changes from wp to redlink triple store
330
-require_once( 'wordlift_to_redlink_data_push_callbacks.php' );
330
+require_once('wordlift_to_redlink_data_push_callbacks.php');
331 331
 
332
-require_once( 'modules/configuration/wordlift_configuration_settings.php' );
332
+require_once('modules/configuration/wordlift_configuration_settings.php');
333 333
 
334 334
 // Load modules
335
-require_once( 'modules/analyzer/wordlift_analyzer.php' );
336
-require_once( 'modules/linked_data/wordlift_linked_data.php' );
337
-require_once( 'modules/prefixes/wordlift_prefixes.php' );
335
+require_once('modules/analyzer/wordlift_analyzer.php');
336
+require_once('modules/linked_data/wordlift_linked_data.php');
337
+require_once('modules/prefixes/wordlift_prefixes.php');
338 338
 
339 339
 // Shortcodes
340 340
 
341
-require_once( 'modules/geo_widget/wordlift_geo_widget.php' );
342
-require_once( 'shortcodes/class-wordlift-shortcode-rest.php' );
343
-require_once( 'shortcodes/wordlift_shortcode_chord.php' );
344
-require_once( 'shortcodes/wordlift_shortcode_geomap.php' );
345
-require_once( 'shortcodes/wordlift_shortcode_field.php' );
346
-require_once( 'shortcodes/wordlift_shortcode_faceted_search.php' );
347
-require_once( 'shortcodes/wordlift_shortcode_navigator.php' );
348
-require_once( 'shortcodes/class-wordlift-products-navigator-shortcode-rest.php' );
341
+require_once('modules/geo_widget/wordlift_geo_widget.php');
342
+require_once('shortcodes/class-wordlift-shortcode-rest.php');
343
+require_once('shortcodes/wordlift_shortcode_chord.php');
344
+require_once('shortcodes/wordlift_shortcode_geomap.php');
345
+require_once('shortcodes/wordlift_shortcode_field.php');
346
+require_once('shortcodes/wordlift_shortcode_faceted_search.php');
347
+require_once('shortcodes/wordlift_shortcode_navigator.php');
348
+require_once('shortcodes/class-wordlift-products-navigator-shortcode-rest.php');
349 349
 
350
-require_once( 'widgets/wordlift_widget_geo.php' );
351
-require_once( 'widgets/class-wordlift-chord-widget.php' );
352
-require_once( 'widgets/wordlift_widget_timeline.php' );
350
+require_once('widgets/wordlift_widget_geo.php');
351
+require_once('widgets/class-wordlift-chord-widget.php');
352
+require_once('widgets/wordlift_widget_timeline.php');
353 353
 
354
-require_once( 'wordlift_redlink.php' );
354
+require_once('wordlift_redlink.php');
355 355
 
356 356
 // Add admin functions.
357 357
 // TODO: find a way to make 'admin' UI tests work.
358 358
 //if ( is_admin() ) {
359 359
 
360
-require_once( 'admin/wordlift_admin.php' );
361
-require_once( 'admin/wordlift_admin_edit_post.php' );
362
-require_once( 'admin/wordlift_admin_save_post.php' );
360
+require_once('admin/wordlift_admin.php');
361
+require_once('admin/wordlift_admin_edit_post.php');
362
+require_once('admin/wordlift_admin_save_post.php');
363 363
 
364 364
 // add the entities meta box.
365
-require_once( 'admin/wordlift_admin_meta_box_entities.php' );
365
+require_once('admin/wordlift_admin_meta_box_entities.php');
366 366
 
367 367
 // add the entity creation AJAX.
368
-require_once( 'admin/wordlift_admin_ajax_related_posts.php' );
368
+require_once('admin/wordlift_admin_ajax_related_posts.php');
369 369
 
370 370
 // Load the wl_chord TinyMCE button and configuration dialog.
371
-require_once( 'admin/wordlift_admin_shortcodes.php' );
371
+require_once('admin/wordlift_admin_shortcodes.php');
372 372
 
373 373
 /**
374 374
  * The code that runs during plugin activation.
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function activate_wordlift() {
378 378
 
379
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
379
+	$log = Wordlift_Log_Service::get_logger('activate_wordlift');
380 380
 
381
-	$log->info( 'Activating WordLift...' );
381
+	$log->info('Activating WordLift...');
382 382
 
383
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
383
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
384 384
 	Wordlift_Activator::activate();
385 385
 
386 386
 	/**
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
  */
408 408
 function deactivate_wordlift() {
409 409
 
410
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
410
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
411 411
 	Wordlift_Deactivator::deactivate();
412 412
 	Wordlift_Http_Api::deactivate();
413 413
 	Ttl_Cache_Cleaner::deactivate();
@@ -425,14 +425,14 @@  discard block
 block discarded – undo
425 425
 
426 426
 }
427 427
 
428
-register_activation_hook( __FILE__, 'activate_wordlift' );
429
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
428
+register_activation_hook(__FILE__, 'activate_wordlift');
429
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
430 430
 
431 431
 /**
432 432
  * The core plugin class that is used to define internationalization,
433 433
  * admin-specific hooks, and public-facing site hooks.
434 434
  */
435
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
435
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
436 436
 
437 437
 /**
438 438
  * Begins execution of the plugin.
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 	 * @return bool
453 453
 	 * @since 3.27.6
454 454
 	 */
455
-	if ( apply_filters( 'wl_feature__enable__widgets', true ) ) {
456
-		add_action( 'widgets_init', 'wl_register_chord_widget' );
457
-		add_action( 'widgets_init', 'wl_register_geo_widget' );
458
-		add_action( 'widgets_init', 'wl_register_timeline_widget' );
455
+	if (apply_filters('wl_feature__enable__widgets', true)) {
456
+		add_action('widgets_init', 'wl_register_chord_widget');
457
+		add_action('widgets_init', 'wl_register_geo_widget');
458
+		add_action('widgets_init', 'wl_register_timeline_widget');
459 459
 	}
460
-	add_filter( 'widget_text', 'do_shortcode' );
460
+	add_filter('widget_text', 'do_shortcode');
461 461
 
462 462
 
463 463
 	/**
@@ -468,10 +468,10 @@  discard block
 block discarded – undo
468 468
 	 * @return bool
469 469
 	 * @since 3.27.6
470 470
 	 */
471
-	if ( apply_filters( 'wl_feature__enable__analysis', true ) ) {
472
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' );
471
+	if (apply_filters('wl_feature__enable__analysis', true)) {
472
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_action');
473 473
 	} else {
474
-		add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' );
474
+		add_action('wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action');
475 475
 	}
476 476
 
477 477
 	/*
@@ -491,56 +491,56 @@  discard block
 block discarded – undo
491 491
 	new Post_Adapter();
492 492
 
493 493
 	// Load the API Data Hooks.
494
-	new Api_Data_Hooks( Wordlift_Configuration_Service::get_instance() );
494
+	new Api_Data_Hooks(Wordlift_Configuration_Service::get_instance());
495 495
 
496
-	add_action( 'plugins_loaded', function () {
496
+	add_action('plugins_loaded', function() {
497 497
 		// Load early. **PLEASE NOTE** that features are applied only to calls that happen **AFTER** the `plugins_loaded`
498 498
 		// action.
499
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/features/index.php';
499
+		require_once plugin_dir_path(__FILE__).'wordlift/features/index.php';
500 500
 
501 501
 		// All features from registry should be initialized here.
502 502
 		$features_registry = Features_Registry::get_instance();
503 503
 		$features_registry->initialize_all_features();
504
-	}, 1 );
504
+	}, 1);
505 505
 
506
-	add_action( 'plugins_loaded', function () use ( $plugin ) {
506
+	add_action('plugins_loaded', function() use ($plugin) {
507 507
 		// Licenses Images.
508 508
 		$user_agent                   = User_Agent::get_user_agent();
509 509
 		$wordlift_key                 = Wordlift_Configuration_Service::get_instance()->get_key();
510
-		$api_service                  = new Default_Api_Service( apply_filters( 'wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE ), 60, $user_agent, $wordlift_key );
510
+		$api_service                  = new Default_Api_Service(apply_filters('wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE), 60, $user_agent, $wordlift_key);
511 511
 		$image_license_factory        = new Image_License_Factory();
512
-		$image_license_service        = new Image_License_Service( $api_service, $image_license_factory );
513
-		$image_license_cache          = new Ttl_Cache( 'image-license', 86400 * 30 ); // 30 days.
514
-		$cached_image_license_service = new Cached_Image_License_Service( $image_license_service, $image_license_cache );
512
+		$image_license_service        = new Image_License_Service($api_service, $image_license_factory);
513
+		$image_license_cache          = new Ttl_Cache('image-license', 86400 * 30); // 30 days.
514
+		$cached_image_license_service = new Cached_Image_License_Service($image_license_service, $image_license_cache);
515 515
 
516
-		$image_license_scheduler       = new Image_License_Scheduler( $image_license_service, $image_license_cache );
516
+		$image_license_scheduler       = new Image_License_Scheduler($image_license_service, $image_license_cache);
517 517
 		$image_license_cleanup_service = new Image_License_Cleanup_Service();
518 518
 
519 519
 		// Get the cached data. If we have cached data, we load the notifier.
520
-		$image_license_data = $image_license_cache->get( Cached_Image_License_Service::GET_NON_PUBLIC_DOMAIN_IMAGES );
521
-		if ( null !== $image_license_data ) {
522
-			$image_license_page = new Image_License_Page( $image_license_data, Wordlift::get_instance()->get_version() );
523
-			new Image_License_Notifier( $image_license_data, $image_license_page );
520
+		$image_license_data = $image_license_cache->get(Cached_Image_License_Service::GET_NON_PUBLIC_DOMAIN_IMAGES);
521
+		if (null !== $image_license_data) {
522
+			$image_license_page = new Image_License_Page($image_license_data, Wordlift::get_instance()->get_version());
523
+			new Image_License_Notifier($image_license_data, $image_license_page);
524 524
 		}
525 525
 
526
-		$remove_all_images_task         = new Remove_All_Images_Task( $cached_image_license_service );
527
-		$remove_all_images_task_adapter = new Task_Ajax_Adapter( $remove_all_images_task );
526
+		$remove_all_images_task         = new Remove_All_Images_Task($cached_image_license_service);
527
+		$remove_all_images_task_adapter = new Task_Ajax_Adapter($remove_all_images_task);
528 528
 
529 529
 		$reload_data_task         = new Reload_Data_Task();
530
-		$reload_data_task_adapter = new Task_Ajax_Adapter( $reload_data_task );
530
+		$reload_data_task_adapter = new Task_Ajax_Adapter($reload_data_task);
531 531
 
532
-		$add_license_caption_or_remove_task         = new Add_License_Caption_Or_Remove_Task( $cached_image_license_service );
533
-		$add_license_caption_or_remove_task_adapter = new Task_Ajax_Adapter( $add_license_caption_or_remove_task );
532
+		$add_license_caption_or_remove_task         = new Add_License_Caption_Or_Remove_Task($cached_image_license_service);
533
+		$add_license_caption_or_remove_task_adapter = new Task_Ajax_Adapter($add_license_caption_or_remove_task);
534 534
 
535
-		$remove_all_images_task_page             = new Remove_All_Images_Page( new Task_Ajax_Adapters_Registry( $remove_all_images_task_adapter ), $plugin->get_version() );
536
-		$reload_data_task_page                   = new Reload_Data_Page( new Task_Ajax_Adapters_Registry( $reload_data_task_adapter ), $plugin->get_version() );
537
-		$add_license_caption_or_remove_task_page = new Add_License_Caption_Or_Remove_Page( new Task_Ajax_Adapters_Registry( $add_license_caption_or_remove_task_adapter ), $plugin->get_version() );
535
+		$remove_all_images_task_page             = new Remove_All_Images_Page(new Task_Ajax_Adapters_Registry($remove_all_images_task_adapter), $plugin->get_version());
536
+		$reload_data_task_page                   = new Reload_Data_Page(new Task_Ajax_Adapters_Registry($reload_data_task_adapter), $plugin->get_version());
537
+		$add_license_caption_or_remove_task_page = new Add_License_Caption_Or_Remove_Page(new Task_Ajax_Adapters_Registry($add_license_caption_or_remove_task_adapter), $plugin->get_version());
538 538
 
539 539
 		new Wordlift_Products_Navigator_Shortcode_REST();
540 540
 
541 541
 		// Register the Dataset module, requires `$api_service`.
542
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php';
543
-		require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php';
542
+		require_once plugin_dir_path(__FILE__).'wordlift/dataset/index.php';
543
+		require_once plugin_dir_path(__FILE__).'wordlift/shipping-data/index.php';
544 544
 
545 545
 	} );
546 546
 
@@ -556,24 +556,24 @@  discard block
 block discarded – undo
556 556
  */
557 557
 function wordlift_plugin_autoload_register() {
558 558
 
559
-	spl_autoload_register( function ( $class_name ) {
559
+	spl_autoload_register(function($class_name) {
560 560
 
561 561
 		// Bail out if these are not our classes.
562
-		if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) {
562
+		if (0 !== strpos($class_name, 'Wordlift\\')) {
563 563
 			return false;
564 564
 		}
565 565
 
566
-		$class_name_lc = strtolower( str_replace( '_', '-', $class_name ) );
566
+		$class_name_lc = strtolower(str_replace('_', '-', $class_name));
567 567
 
568
-		preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches );
568
+		preg_match('|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches);
569 569
 
570
-		$path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] );
571
-		$file = 'class-' . $matches[2] . '.php';
570
+		$path = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]);
571
+		$file = 'class-'.$matches[2].'.php';
572 572
 
573
-		$full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file;
573
+		$full_path = plugin_dir_path(__FILE__).$path.DIRECTORY_SEPARATOR.$file;
574 574
 
575
-		if ( ! file_exists( $full_path ) ) {
576
-			echo( "Class $class_name not found at $full_path." );
575
+		if ( ! file_exists($full_path)) {
576
+			echo("Class $class_name not found at $full_path.");
577 577
 
578 578
 			return false;
579 579
 		}
@@ -585,16 +585,16 @@  discard block
 block discarded – undo
585 585
 
586 586
 }
587 587
 
588
-function wl_block_categories( $categories, $post ) {
588
+function wl_block_categories($categories, $post) {
589 589
 	return array_merge(
590 590
 		$categories,
591 591
 		array(
592 592
 			array(
593 593
 				'slug'  => 'wordlift',
594
-				'title' => __( 'WordLift', 'wordlift' ),
594
+				'title' => __('WordLift', 'wordlift'),
595 595
 			),
596 596
 		)
597 597
 	);
598 598
 }
599 599
 
600
-add_filter( 'block_categories', 'wl_block_categories', 10, 2 );
600
+add_filter('block_categories', 'wl_block_categories', 10, 2);
Please login to merge, or discard this patch.