Completed
Pull Request — develop (#1554)
by Naveen
57s
created
src/wordlift/mappings/validators/class-rule-validators-registry.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -18,43 +18,43 @@
 block discarded – undo
18 18
  */
19 19
 class Rule_Validators_Registry {
20 20
 
21
-	/**
22
-	 * An array of {@link Rule_Validator}s.
23
-	 *
24
-	 * @var array An array of {@link Rule_Validator}s.
25
-	 */
26
-	private $rule_validators;
27
-
28
-	/**
29
-	 * Rule_Validators_Registry constructor.
30
-	 *
31
-	 * @param Rule_Validator $default The default rule validator.
32
-	 *
33
-	 * @throws Exception throws an exception if an invalid validator has been provided.
34
-	 */
35
-	public function __construct( $default ) {
36
-
37
-		// Check that a valid validator has been provided.
38
-		if ( ! ( $default instanceof Rule_Validator ) ) {
39
-			throw new Exception( "An invalid Rule_Validator was provided as default validator." );
40
-		}
41
-
42
-		// Allow 3rd parties to register other validators.
43
-		$this->rule_validators = apply_filters( 'wl_mappings_rule_validators', array( '__default__' => $default, ) );
44
-
45
-	}
46
-
47
-	/**
48
-	 * Get a rule validator by its key.
49
-	 *
50
-	 * @param string $key A key uniquely identifying a validator.
51
-	 *
52
-	 * @return Rule_Validator A {@link Rule_Validator} instance or the default one when not found.
53
-	 */
54
-	public function get_rule_validator( $key ) {
55
-
56
-		return isset( $this->rule_validators[ $key ] )
57
-			? $this->rule_validators[ $key ] : $this->rule_validators['__default__'];
58
-	}
21
+    /**
22
+     * An array of {@link Rule_Validator}s.
23
+     *
24
+     * @var array An array of {@link Rule_Validator}s.
25
+     */
26
+    private $rule_validators;
27
+
28
+    /**
29
+     * Rule_Validators_Registry constructor.
30
+     *
31
+     * @param Rule_Validator $default The default rule validator.
32
+     *
33
+     * @throws Exception throws an exception if an invalid validator has been provided.
34
+     */
35
+    public function __construct( $default ) {
36
+
37
+        // Check that a valid validator has been provided.
38
+        if ( ! ( $default instanceof Rule_Validator ) ) {
39
+            throw new Exception( "An invalid Rule_Validator was provided as default validator." );
40
+        }
41
+
42
+        // Allow 3rd parties to register other validators.
43
+        $this->rule_validators = apply_filters( 'wl_mappings_rule_validators', array( '__default__' => $default, ) );
44
+
45
+    }
46
+
47
+    /**
48
+     * Get a rule validator by its key.
49
+     *
50
+     * @param string $key A key uniquely identifying a validator.
51
+     *
52
+     * @return Rule_Validator A {@link Rule_Validator} instance or the default one when not found.
53
+     */
54
+    public function get_rule_validator( $key ) {
55
+
56
+        return isset( $this->rule_validators[ $key ] )
57
+            ? $this->rule_validators[ $key ] : $this->rule_validators['__default__'];
58
+    }
59 59
 
60 60
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @throws Exception throws an exception if an invalid validator has been provided.
34 34
 	 */
35
-	public function __construct( $default ) {
35
+	public function __construct($default) {
36 36
 
37 37
 		// Check that a valid validator has been provided.
38
-		if ( ! ( $default instanceof Rule_Validator ) ) {
39
-			throw new Exception( "An invalid Rule_Validator was provided as default validator." );
38
+		if ( ! ($default instanceof Rule_Validator)) {
39
+			throw new Exception("An invalid Rule_Validator was provided as default validator.");
40 40
 		}
41 41
 
42 42
 		// Allow 3rd parties to register other validators.
43
-		$this->rule_validators = apply_filters( 'wl_mappings_rule_validators', array( '__default__' => $default, ) );
43
+		$this->rule_validators = apply_filters('wl_mappings_rule_validators', array('__default__' => $default,));
44 44
 
45 45
 	}
46 46
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return Rule_Validator A {@link Rule_Validator} instance or the default one when not found.
53 53
 	 */
54
-	public function get_rule_validator( $key ) {
54
+	public function get_rule_validator($key) {
55 55
 
56
-		return isset( $this->rule_validators[ $key ] )
57
-			? $this->rule_validators[ $key ] : $this->rule_validators['__default__'];
56
+		return isset($this->rule_validators[$key])
57
+			? $this->rule_validators[$key] : $this->rule_validators['__default__'];
58 58
 	}
59 59
 
60 60
 }
Please login to merge, or discard this patch.
src/wordlift/mappings/class-mappings-transform-functions-registry.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -12,109 +12,109 @@
 block discarded – undo
12 12
  */
13 13
 class Mappings_Transform_Functions_Registry {
14 14
 
15
-	/**
16
-	 * Holds an array of transformation functions, all the transformation
17
-	 * functions are instance of { @link \Mappings_Transform_Function} Interface
18
-	 *
19
-	 * @since  3.25.0
20
-	 * @access private
21
-	 * @var Mappings_Validator $validator The {@link Mappings_Validator} instance to test.
22
-	 */
23
-	private $transform_function_array = array();
24
-
25
-	/**
26
-	 * Construct a list of transform function array.
27
-	 */
28
-	public function __construct() {
29
-
30
-		$this->transform_function_array = apply_filters( 'wl_mappings_transformation_functions', array() );
31
-
32
-	}
33
-
34
-	/**
35
-	 * Return options required for ui
36
-	 *
37
-	 * @return array An Array of transform function options.
38
-	 */
39
-	public function get_options() {
40
-		$this->sync_transformation_functions_from_external_plugins();
41
-		$options = array();
42
-		foreach ( $this->transform_function_array as $transform_function ) {
43
-			array_push(
44
-				$options,
45
-				array(
46
-					'label' => $transform_function->get_label(),
47
-					'value' => $transform_function->get_name(),
48
-				)
49
-			);
50
-		}
51
-
52
-		return $options;
53
-	}
54
-
55
-	/**
56
-	 * Return instance of the transform function.
57
-	 *
58
-	 * @param string $transform_function_name The name of the transform function which needs to applied.
59
-	 *
60
-	 * @return Mappings_Transform_Function|null An Instance of transform function from any one of
61
-	 * the classes extending this interface, if nothing matches null is returned.
62
-	 */
63
-	public function get_transform_function( $transform_function_name ) {
64
-		$this->sync_transformation_functions_from_external_plugins();
65
-		foreach ( $this->transform_function_array as $transform_function_instance ) {
66
-			if ( $transform_function_instance->get_name() === $transform_function_name ) {
67
-				return $transform_function_instance;
68
-			}
69
-		}
70
-
71
-		// Returns null if the transform function doesn't match.
72
-		return null;
73
-	}
74
-
75
-	/**
76
-	 * Sync the transformation function from external plugins to registry.
77
-	 * @return void
78
-	 */
79
-	private function sync_transformation_functions_from_external_plugins() {
80
-		$this->transform_function_array = apply_filters(
81
-			'wl_mappings_transformation_functions',
82
-			$this->transform_function_array
83
-		);
84
-		$this->remove_duplicate_transformation_functions_after_sync();
85
-	}
86
-
87
-	/**
88
-	 * @return int|void Returns the number of transformation functions present in registry.
89
-	 */
90
-	public function get_transform_function_count() {
91
-		return count( $this->transform_function_array );
92
-	}
93
-
94
-	/**
95
-	 * Check if any duplicate transformation functions are present in registry, run this
96
-	 * function after syncing with the registry.
97
-	 */
98
-	private function remove_duplicate_transformation_functions_after_sync() {
99
-		/**
100
-		 * This check is done to avoid transformation function conflicts if they share a same name
101
-		 * For example if plugin A and plugin B registers transformation function with same name C,
102
-		 * we remove the duplicated transformation function
103
-		 */
104
-		$transformation_function_names = array();
105
-		$transformation_functions      = array();
106
-		foreach ( $this->transform_function_array as $transformation_function ) {
107
-			if ( ! in_array( $transformation_function->get_name(), $transformation_function_names ) ) {
108
-				array_push( $transformation_function_names, $transformation_function->get_name() );
109
-				array_push( $transformation_functions, $transformation_function );
110
-			}
111
-		}
112
-		$this->transform_function_array = $transformation_functions;
113
-	}
114
-
115
-	public function get_transforms() {
116
-
117
-		return $this->transform_function_array;
118
-	}
15
+    /**
16
+     * Holds an array of transformation functions, all the transformation
17
+     * functions are instance of { @link \Mappings_Transform_Function} Interface
18
+     *
19
+     * @since  3.25.0
20
+     * @access private
21
+     * @var Mappings_Validator $validator The {@link Mappings_Validator} instance to test.
22
+     */
23
+    private $transform_function_array = array();
24
+
25
+    /**
26
+     * Construct a list of transform function array.
27
+     */
28
+    public function __construct() {
29
+
30
+        $this->transform_function_array = apply_filters( 'wl_mappings_transformation_functions', array() );
31
+
32
+    }
33
+
34
+    /**
35
+     * Return options required for ui
36
+     *
37
+     * @return array An Array of transform function options.
38
+     */
39
+    public function get_options() {
40
+        $this->sync_transformation_functions_from_external_plugins();
41
+        $options = array();
42
+        foreach ( $this->transform_function_array as $transform_function ) {
43
+            array_push(
44
+                $options,
45
+                array(
46
+                    'label' => $transform_function->get_label(),
47
+                    'value' => $transform_function->get_name(),
48
+                )
49
+            );
50
+        }
51
+
52
+        return $options;
53
+    }
54
+
55
+    /**
56
+     * Return instance of the transform function.
57
+     *
58
+     * @param string $transform_function_name The name of the transform function which needs to applied.
59
+     *
60
+     * @return Mappings_Transform_Function|null An Instance of transform function from any one of
61
+     * the classes extending this interface, if nothing matches null is returned.
62
+     */
63
+    public function get_transform_function( $transform_function_name ) {
64
+        $this->sync_transformation_functions_from_external_plugins();
65
+        foreach ( $this->transform_function_array as $transform_function_instance ) {
66
+            if ( $transform_function_instance->get_name() === $transform_function_name ) {
67
+                return $transform_function_instance;
68
+            }
69
+        }
70
+
71
+        // Returns null if the transform function doesn't match.
72
+        return null;
73
+    }
74
+
75
+    /**
76
+     * Sync the transformation function from external plugins to registry.
77
+     * @return void
78
+     */
79
+    private function sync_transformation_functions_from_external_plugins() {
80
+        $this->transform_function_array = apply_filters(
81
+            'wl_mappings_transformation_functions',
82
+            $this->transform_function_array
83
+        );
84
+        $this->remove_duplicate_transformation_functions_after_sync();
85
+    }
86
+
87
+    /**
88
+     * @return int|void Returns the number of transformation functions present in registry.
89
+     */
90
+    public function get_transform_function_count() {
91
+        return count( $this->transform_function_array );
92
+    }
93
+
94
+    /**
95
+     * Check if any duplicate transformation functions are present in registry, run this
96
+     * function after syncing with the registry.
97
+     */
98
+    private function remove_duplicate_transformation_functions_after_sync() {
99
+        /**
100
+         * This check is done to avoid transformation function conflicts if they share a same name
101
+         * For example if plugin A and plugin B registers transformation function with same name C,
102
+         * we remove the duplicated transformation function
103
+         */
104
+        $transformation_function_names = array();
105
+        $transformation_functions      = array();
106
+        foreach ( $this->transform_function_array as $transformation_function ) {
107
+            if ( ! in_array( $transformation_function->get_name(), $transformation_function_names ) ) {
108
+                array_push( $transformation_function_names, $transformation_function->get_name() );
109
+                array_push( $transformation_functions, $transformation_function );
110
+            }
111
+        }
112
+        $this->transform_function_array = $transformation_functions;
113
+    }
114
+
115
+    public function get_transforms() {
116
+
117
+        return $this->transform_function_array;
118
+    }
119 119
 
120 120
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 
30
-		$this->transform_function_array = apply_filters( 'wl_mappings_transformation_functions', array() );
30
+		$this->transform_function_array = apply_filters('wl_mappings_transformation_functions', array());
31 31
 
32 32
 	}
33 33
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	public function get_options() {
40 40
 		$this->sync_transformation_functions_from_external_plugins();
41 41
 		$options = array();
42
-		foreach ( $this->transform_function_array as $transform_function ) {
42
+		foreach ($this->transform_function_array as $transform_function) {
43 43
 			array_push(
44 44
 				$options,
45 45
 				array(
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	 * @return Mappings_Transform_Function|null An Instance of transform function from any one of
61 61
 	 * the classes extending this interface, if nothing matches null is returned.
62 62
 	 */
63
-	public function get_transform_function( $transform_function_name ) {
63
+	public function get_transform_function($transform_function_name) {
64 64
 		$this->sync_transformation_functions_from_external_plugins();
65
-		foreach ( $this->transform_function_array as $transform_function_instance ) {
66
-			if ( $transform_function_instance->get_name() === $transform_function_name ) {
65
+		foreach ($this->transform_function_array as $transform_function_instance) {
66
+			if ($transform_function_instance->get_name() === $transform_function_name) {
67 67
 				return $transform_function_instance;
68 68
 			}
69 69
 		}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @return int|void Returns the number of transformation functions present in registry.
89 89
 	 */
90 90
 	public function get_transform_function_count() {
91
-		return count( $this->transform_function_array );
91
+		return count($this->transform_function_array);
92 92
 	}
93 93
 
94 94
 	/**
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		 */
104 104
 		$transformation_function_names = array();
105 105
 		$transformation_functions      = array();
106
-		foreach ( $this->transform_function_array as $transformation_function ) {
107
-			if ( ! in_array( $transformation_function->get_name(), $transformation_function_names ) ) {
108
-				array_push( $transformation_function_names, $transformation_function->get_name() );
109
-				array_push( $transformation_functions, $transformation_function );
106
+		foreach ($this->transform_function_array as $transformation_function) {
107
+			if ( ! in_array($transformation_function->get_name(), $transformation_function_names)) {
108
+				array_push($transformation_function_names, $transformation_function->get_name());
109
+				array_push($transformation_functions, $transformation_function);
110 110
 			}
111 111
 		}
112 112
 		$this->transform_function_array = $transformation_functions;
Please login to merge, or discard this patch.
src/wordlift/mappings/transforms/class-url-to-entity-transform-function.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -19,71 +19,71 @@
 block discarded – undo
19 19
  */
20 20
 class Url_To_Entity_Transform_Function implements Mappings_Transform_Function {
21 21
 
22
-	/**
23
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
24
-	 *
25
-	 * @var Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
26
-	 */
27
-	private $entity_uri_service;
28
-
29
-	/**
30
-	 * Url_To_Entity_Transform_Function constructor.
31
-	 *
32
-	 * @param Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
33
-	 */
34
-	public function __construct( $entity_uri_service ) {
35
-
36
-		$this->entity_uri_service = $entity_uri_service;
37
-
38
-		add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
39
-
40
-	}
41
-
42
-	/**
43
-	 * Hook to add ourselves to the list of available transform functions.
44
-	 *
45
-	 * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s.
46
-	 *
47
-	 * @return Mappings_Transform_Function[] An updated array with ourselves too.
48
-	 */
49
-	public function wl_mappings_transformation_functions( $value ) {
50
-
51
-		$value[] = $this;
52
-
53
-		return $value;
54
-	}
55
-
56
-	/**
57
-	 * @inheritDoc
58
-	 */
59
-	public function get_name() {
60
-
61
-		return 'url_to_entity';
62
-	}
63
-
64
-	/**
65
-	 * @inheritDoc
66
-	 */
67
-	public function get_label() {
68
-
69
-		return __( 'URL to Entity', 'wordlift' );
70
-	}
71
-
72
-	/**
73
-	 * @inheritDoc
74
-	 */
75
-	public function transform_data( $data, $jsonld, &$references, $post_id ) {
76
-
77
-		// Get the entity by URI.
78
-		$post = $this->entity_uri_service->get_entity( $data );
79
-
80
-		// If found, add the reference.
81
-		if ( is_a( $post, 'WP_Post' ) ) {
82
-			// Add the entity among the references using the post ID.
83
-			$references[] = $post->ID;
84
-		}
85
-
86
-		return array( "@id" => $data, );
87
-	}
22
+    /**
23
+     * The {@link Wordlift_Entity_Uri_Service} instance.
24
+     *
25
+     * @var Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
26
+     */
27
+    private $entity_uri_service;
28
+
29
+    /**
30
+     * Url_To_Entity_Transform_Function constructor.
31
+     *
32
+     * @param Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
33
+     */
34
+    public function __construct( $entity_uri_service ) {
35
+
36
+        $this->entity_uri_service = $entity_uri_service;
37
+
38
+        add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
39
+
40
+    }
41
+
42
+    /**
43
+     * Hook to add ourselves to the list of available transform functions.
44
+     *
45
+     * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s.
46
+     *
47
+     * @return Mappings_Transform_Function[] An updated array with ourselves too.
48
+     */
49
+    public function wl_mappings_transformation_functions( $value ) {
50
+
51
+        $value[] = $this;
52
+
53
+        return $value;
54
+    }
55
+
56
+    /**
57
+     * @inheritDoc
58
+     */
59
+    public function get_name() {
60
+
61
+        return 'url_to_entity';
62
+    }
63
+
64
+    /**
65
+     * @inheritDoc
66
+     */
67
+    public function get_label() {
68
+
69
+        return __( 'URL to Entity', 'wordlift' );
70
+    }
71
+
72
+    /**
73
+     * @inheritDoc
74
+     */
75
+    public function transform_data( $data, $jsonld, &$references, $post_id ) {
76
+
77
+        // Get the entity by URI.
78
+        $post = $this->entity_uri_service->get_entity( $data );
79
+
80
+        // If found, add the reference.
81
+        if ( is_a( $post, 'WP_Post' ) ) {
82
+            // Add the entity among the references using the post ID.
83
+            $references[] = $post->ID;
84
+        }
85
+
86
+        return array( "@id" => $data, );
87
+    }
88 88
 
89 89
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
33 33
 	 */
34
-	public function __construct( $entity_uri_service ) {
34
+	public function __construct($entity_uri_service) {
35 35
 
36 36
 		$this->entity_uri_service = $entity_uri_service;
37 37
 
38
-		add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
38
+		add_filter('wl_mappings_transformation_functions', array($this, 'wl_mappings_transformation_functions'));
39 39
 
40 40
 	}
41 41
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return Mappings_Transform_Function[] An updated array with ourselves too.
48 48
 	 */
49
-	public function wl_mappings_transformation_functions( $value ) {
49
+	public function wl_mappings_transformation_functions($value) {
50 50
 
51 51
 		$value[] = $this;
52 52
 
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function get_label() {
68 68
 
69
-		return __( 'URL to Entity', 'wordlift' );
69
+		return __('URL to Entity', 'wordlift');
70 70
 	}
71 71
 
72 72
 	/**
73 73
 	 * @inheritDoc
74 74
 	 */
75
-	public function transform_data( $data, $jsonld, &$references, $post_id ) {
75
+	public function transform_data($data, $jsonld, &$references, $post_id) {
76 76
 
77 77
 		// Get the entity by URI.
78
-		$post = $this->entity_uri_service->get_entity( $data );
78
+		$post = $this->entity_uri_service->get_entity($data);
79 79
 
80 80
 		// If found, add the reference.
81
-		if ( is_a( $post, 'WP_Post' ) ) {
81
+		if (is_a($post, 'WP_Post')) {
82 82
 			// Add the entity among the references using the post ID.
83 83
 			$references[] = $post->ID;
84 84
 		}
85 85
 
86
-		return array( "@id" => $data, );
86
+		return array("@id" => $data,);
87 87
 	}
88 88
 
89 89
 }
Please login to merge, or discard this patch.
wordlift/mappings/transforms/class-taxonomy-to-terms-transform-function.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -19,57 +19,57 @@
 block discarded – undo
19 19
 class Taxonomy_To_Terms_Transform_Function implements Mappings_Transform_Function {
20 20
 
21 21
 
22
-	/**
23
-	 * Taxonomy_To_Terms_Transform_Function constructor.
24
-	 */
25
-	public function __construct() {
22
+    /**
23
+     * Taxonomy_To_Terms_Transform_Function constructor.
24
+     */
25
+    public function __construct() {
26 26
 
27
-		add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
27
+        add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
28 28
 
29
-	}
29
+    }
30 30
 
31
-	/**
32
-	 * Hook to add ourselves to the list of available transform functions.
33
-	 *
34
-	 * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s.
35
-	 *
36
-	 * @return Mappings_Transform_Function[] An updated array with ourselves too.
37
-	 */
38
-	public function wl_mappings_transformation_functions( $value ) {
31
+    /**
32
+     * Hook to add ourselves to the list of available transform functions.
33
+     *
34
+     * @param Mappings_Transform_Function[] $value An array of {@link Mappings_Transform_Function}s.
35
+     *
36
+     * @return Mappings_Transform_Function[] An updated array with ourselves too.
37
+     */
38
+    public function wl_mappings_transformation_functions( $value ) {
39 39
 
40
-		$value[] = $this;
40
+        $value[] = $this;
41 41
 
42
-		return $value;
43
-	}
42
+        return $value;
43
+    }
44 44
 
45
-	/**
46
-	 * @inheritDoc
47
-	 */
48
-	public function get_name() {
45
+    /**
46
+     * @inheritDoc
47
+     */
48
+    public function get_name() {
49 49
 
50
-		return 'taxonomy_to_terms';
51
-	}
50
+        return 'taxonomy_to_terms';
51
+    }
52 52
 
53
-	/**
54
-	 * @inheritDoc
55
-	 */
56
-	public function get_label() {
53
+    /**
54
+     * @inheritDoc
55
+     */
56
+    public function get_label() {
57 57
 
58
-		return __( 'Taxonomy to Terms', 'wordlift' );
59
-	}
58
+        return __( 'Taxonomy to Terms', 'wordlift' );
59
+    }
60 60
 
61
-	/**
62
-	 * @inheritDoc
63
-	 */
64
-	public function transform_data( $data, $jsonld, &$references, $post_id ) {
61
+    /**
62
+     * @inheritDoc
63
+     */
64
+    public function transform_data( $data, $jsonld, &$references, $post_id ) {
65 65
 
66
-		$terms = wp_get_object_terms( $post_id, $data, array( 'fields' => 'names', ) );
66
+        $terms = wp_get_object_terms( $post_id, $data, array( 'fields' => 'names', ) );
67 67
 
68
-		if ( ! is_array( $terms ) || empty( $terms ) ) {
69
-			return null;
70
-		}
68
+        if ( ! is_array( $terms ) || empty( $terms ) ) {
69
+            return null;
70
+        }
71 71
 
72
-		return $terms;
73
-	}
72
+        return $terms;
73
+    }
74 74
 
75 75
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		add_filter( 'wl_mappings_transformation_functions', array( $this, 'wl_mappings_transformation_functions' ) );
27
+		add_filter('wl_mappings_transformation_functions', array($this, 'wl_mappings_transformation_functions'));
28 28
 
29 29
 	}
30 30
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return Mappings_Transform_Function[] An updated array with ourselves too.
37 37
 	 */
38
-	public function wl_mappings_transformation_functions( $value ) {
38
+	public function wl_mappings_transformation_functions($value) {
39 39
 
40 40
 		$value[] = $this;
41 41
 
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function get_label() {
57 57
 
58
-		return __( 'Taxonomy to Terms', 'wordlift' );
58
+		return __('Taxonomy to Terms', 'wordlift');
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * @inheritDoc
63 63
 	 */
64
-	public function transform_data( $data, $jsonld, &$references, $post_id ) {
64
+	public function transform_data($data, $jsonld, &$references, $post_id) {
65 65
 
66
-		$terms = wp_get_object_terms( $post_id, $data, array( 'fields' => 'names', ) );
66
+		$terms = wp_get_object_terms($post_id, $data, array('fields' => 'names',));
67 67
 
68
-		if ( ! is_array( $terms ) || empty( $terms ) ) {
68
+		if ( ! is_array($terms) || empty($terms)) {
69 69
 			return null;
70 70
 		}
71 71
 
Please login to merge, or discard this patch.
src/wordlift/scripts/class-scripts-helper.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -19,70 +19,70 @@
 block discarded – undo
19 19
 
20 20
 class Scripts_Helper {
21 21
 
22
-	/**
23
-	 * This function loads the javascript file according to the WordPress version.
24
-	 *
25
-	 * For WordPress < 5.0 it'll load the javascript file using the `.full` suffix i.e. the file that embeds all the
26
-	 * dependencies.
27
-	 *
28
-	 * For WordPress >= 5.0 it'll load the stripped down js.
29
-	 *
30
-	 * @param string $handle The handle name.
31
-	 * @param string $script_name The full script URL without the `.js` extension.
32
-	 * @param array $dependencies An array of dependencies to be added only in WordPress > 5.0.
33
-	 */
34
-	public static function enqueue_based_on_wordpress_version( $handle, $script_name, $dependencies, $in_footer = false ) {
35
-		global $wp_version;
22
+    /**
23
+     * This function loads the javascript file according to the WordPress version.
24
+     *
25
+     * For WordPress < 5.0 it'll load the javascript file using the `.full` suffix i.e. the file that embeds all the
26
+     * dependencies.
27
+     *
28
+     * For WordPress >= 5.0 it'll load the stripped down js.
29
+     *
30
+     * @param string $handle The handle name.
31
+     * @param string $script_name The full script URL without the `.js` extension.
32
+     * @param array $dependencies An array of dependencies to be added only in WordPress > 5.0.
33
+     */
34
+    public static function enqueue_based_on_wordpress_version( $handle, $script_name, $dependencies, $in_footer = false ) {
35
+        global $wp_version;
36 36
 
37
-		if ( version_compare( $wp_version, '5.0', '<' ) ) {
38
-			$actual_script_name  = "$script_name.full.js";
39
-			$actual_dependencies = array();
40
-		} else {
41
-			$actual_script_name  = "$script_name.js";
42
-			$actual_dependencies = $dependencies;
43
-		}
37
+        if ( version_compare( $wp_version, '5.0', '<' ) ) {
38
+            $actual_script_name  = "$script_name.full.js";
39
+            $actual_dependencies = array();
40
+        } else {
41
+            $actual_script_name  = "$script_name.js";
42
+            $actual_dependencies = $dependencies;
43
+        }
44 44
 
45
-		$wordlift = \Wordlift::get_instance();
46
-		wp_enqueue_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
45
+        $wordlift = \Wordlift::get_instance();
46
+        wp_enqueue_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
47 47
 
48
-	}
49
-	/**
50
-	 * This function registers the javascript file according to the WordPress version.
51
-	 *
52
-	 * For WordPress < 5.0 it'll register the javascript file using the `.full` suffix i.e. the file that embeds all the
53
-	 * dependencies.
54
-	 *
55
-	 * For WordPress >= 5.0 it'll register the stripped down js.
56
-	 *
57
-	 * @param string $handle The handle name.
58
-	 * @param string $script_name The full script URL without the `.js` extension.
59
-	 * @param array  $dependencies An array of dependencies to be added only in WordPress > 5.0.
60
-	 */
61
-	public static function register_based_on_wordpress_version(
62
-			$handle,
63
-			$script_name,
64
-			$dependencies,
65
-			$action = 'wp_enqueue_scripts',
66
-			$in_footer = false
67
-		) {
68
-		global $wp_version;
48
+    }
49
+    /**
50
+     * This function registers the javascript file according to the WordPress version.
51
+     *
52
+     * For WordPress < 5.0 it'll register the javascript file using the `.full` suffix i.e. the file that embeds all the
53
+     * dependencies.
54
+     *
55
+     * For WordPress >= 5.0 it'll register the stripped down js.
56
+     *
57
+     * @param string $handle The handle name.
58
+     * @param string $script_name The full script URL without the `.js` extension.
59
+     * @param array  $dependencies An array of dependencies to be added only in WordPress > 5.0.
60
+     */
61
+    public static function register_based_on_wordpress_version(
62
+            $handle,
63
+            $script_name,
64
+            $dependencies,
65
+            $action = 'wp_enqueue_scripts',
66
+            $in_footer = false
67
+        ) {
68
+        global $wp_version;
69 69
 
70
-		if ( version_compare( $wp_version, '5.0', '<' ) ) {
71
-			$actual_script_name  = "$script_name.full.js";
72
-			$actual_dependencies = array();
73
-		} else {
74
-			$actual_script_name  = "$script_name.js";
75
-			$actual_dependencies = $dependencies;
76
-		}
70
+        if ( version_compare( $wp_version, '5.0', '<' ) ) {
71
+            $actual_script_name  = "$script_name.full.js";
72
+            $actual_dependencies = array();
73
+        } else {
74
+            $actual_script_name  = "$script_name.js";
75
+            $actual_dependencies = $dependencies;
76
+        }
77 77
 
78
-		$wordlift = \Wordlift::get_instance();
79
-		add_action(
80
-			$action,
81
-			function () use ( $handle, $actual_script_name, $actual_dependencies, $wordlift, $in_footer ) {
82
-				wp_register_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
83
-			}
84
-		);
78
+        $wordlift = \Wordlift::get_instance();
79
+        add_action(
80
+            $action,
81
+            function () use ( $handle, $actual_script_name, $actual_dependencies, $wordlift, $in_footer ) {
82
+                wp_register_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
83
+            }
84
+        );
85 85
 
86
-	}
86
+    }
87 87
 
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	 * @param string $script_name The full script URL without the `.js` extension.
32 32
 	 * @param array $dependencies An array of dependencies to be added only in WordPress > 5.0.
33 33
 	 */
34
-	public static function enqueue_based_on_wordpress_version( $handle, $script_name, $dependencies, $in_footer = false ) {
34
+	public static function enqueue_based_on_wordpress_version($handle, $script_name, $dependencies, $in_footer = false) {
35 35
 		global $wp_version;
36 36
 
37
-		if ( version_compare( $wp_version, '5.0', '<' ) ) {
37
+		if (version_compare($wp_version, '5.0', '<')) {
38 38
 			$actual_script_name  = "$script_name.full.js";
39 39
 			$actual_dependencies = array();
40 40
 		} else {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$wordlift = \Wordlift::get_instance();
46
-		wp_enqueue_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
46
+		wp_enqueue_script($handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer);
47 47
 
48 48
 	}
49 49
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		) {
68 68
 		global $wp_version;
69 69
 
70
-		if ( version_compare( $wp_version, '5.0', '<' ) ) {
70
+		if (version_compare($wp_version, '5.0', '<')) {
71 71
 			$actual_script_name  = "$script_name.full.js";
72 72
 			$actual_dependencies = array();
73 73
 		} else {
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 		$wordlift = \Wordlift::get_instance();
79 79
 		add_action(
80 80
 			$action,
81
-			function () use ( $handle, $actual_script_name, $actual_dependencies, $wordlift, $in_footer ) {
82
-				wp_register_script( $handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer );
81
+			function() use ($handle, $actual_script_name, $actual_dependencies, $wordlift, $in_footer) {
82
+				wp_register_script($handle, $actual_script_name, $actual_dependencies, $wordlift->get_version(), $in_footer);
83 83
 			}
84 84
 		);
85 85
 
Please login to merge, or discard this patch.
src/wordlift/templates/class-templates-ajax-endpoint.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@
 block discarded – undo
17 17
  */
18 18
 class Templates_Ajax_Endpoint {
19 19
 
20
-	/**
21
-	 * Templates_Ajax_Endpoint constructor.
22
-	 *
23
-	 * Hook to `wl_templates` Ajax action.
24
-	 */
25
-	public function __construct() {
20
+    /**
21
+     * Templates_Ajax_Endpoint constructor.
22
+     *
23
+     * Hook to `wl_templates` Ajax action.
24
+     */
25
+    public function __construct() {
26 26
 
27
-		add_action( 'wp_ajax_wl_templates', array( $this, 'template' ) );
27
+        add_action( 'wp_ajax_wl_templates', array( $this, 'template' ) );
28 28
 
29
-	}
29
+    }
30 30
 
31
-	/**
32
-	 * Display the requested template. The template is searched in wp-content/wordlift/templates/wordlift-widget-be/
33
-	 *
34
-	 * Non alphanumeric names (including `-`) are considered invalid.
35
-	 */
36
-	public function template() {
31
+    /**
32
+     * Display the requested template. The template is searched in wp-content/wordlift/templates/wordlift-widget-be/
33
+     *
34
+     * Non alphanumeric names (including `-`) are considered invalid.
35
+     */
36
+    public function template() {
37 37
 
38
-		$name = filter_input( INPUT_GET, 'name' );
38
+        $name = filter_input( INPUT_GET, 'name' );
39 39
 
40
-		if ( 1 !== preg_match( '|^[a-z0-9\-]+$|', $name ) ) {
41
-			return wp_send_json_error( 'Invalid name.' );
42
-		}
40
+        if ( 1 !== preg_match( '|^[a-z0-9\-]+$|', $name ) ) {
41
+            return wp_send_json_error( 'Invalid name.' );
42
+        }
43 43
 
44
-		require( dirname( dirname( dirname( __FILE__ ) ) ) . "/templates/wordlift-widget-be/$name.html" );
44
+        require( dirname( dirname( dirname( __FILE__ ) ) ) . "/templates/wordlift-widget-be/$name.html" );
45 45
 
46
-		die();
47
-	}
46
+        die();
47
+    }
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		add_action( 'wp_ajax_wl_templates', array( $this, 'template' ) );
27
+		add_action('wp_ajax_wl_templates', array($this, 'template'));
28 28
 
29 29
 	}
30 30
 
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function template() {
37 37
 
38
-		$name = filter_input( INPUT_GET, 'name' );
38
+		$name = filter_input(INPUT_GET, 'name');
39 39
 
40
-		if ( 1 !== preg_match( '|^[a-z0-9\-]+$|', $name ) ) {
41
-			return wp_send_json_error( 'Invalid name.' );
40
+		if (1 !== preg_match('|^[a-z0-9\-]+$|', $name)) {
41
+			return wp_send_json_error('Invalid name.');
42 42
 		}
43 43
 
44
-		require( dirname( dirname( dirname( __FILE__ ) ) ) . "/templates/wordlift-widget-be/$name.html" );
44
+		require(dirname(dirname(dirname(__FILE__)))."/templates/wordlift-widget-be/$name.html");
45 45
 
46 46
 		die();
47 47
 	}
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-25-0.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  */
51 51
 
52 52
 // @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
53
-require_once ABSPATH . 'wp-admin/includes/upgrade.php';
53
+require_once ABSPATH.'wp-admin/includes/upgrade.php';
54 54
 
55 55
 /**
56 56
  * Define the {@link Wordlift_Install_3_25_0} interface.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 */
106 106
 	public function create_mappings_table() {
107
-		$table_name      = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
107
+		$table_name      = $this->wpdb->prefix.WL_MAPPING_TABLE_NAME;
108 108
 		$charset_collate = $this->wpdb->get_charset_collate();
109 109
 		// @@todo: is necessary to prefix the column names with `mapping_` ? we're the mappings table already.
110 110
 		$sql = <<<EOF
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         ) $charset_collate;
117 117
 EOF;
118 118
 		// Execute the query for mappings table.
119
-		dbDelta( $sql );
119
+		dbDelta($sql);
120 120
 	}
121 121
 
122 122
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 * @since 3.25.0
138 138
 	 */
139 139
 	public function create_rule_table() {
140
-		$table_name            = $this->wpdb->prefix . WL_RULE_TABLE_NAME;
141
-		$rule_group_table_name = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
140
+		$table_name            = $this->wpdb->prefix.WL_RULE_TABLE_NAME;
141
+		$rule_group_table_name = $this->wpdb->prefix.WL_RULE_GROUP_TABLE_NAME;
142 142
 		$charset_collate       = $this->wpdb->get_charset_collate();
143 143
 		// @@todo: is necessary to prefix the column names with `rule_` ? we're the rules table already.
144 144
 		$sql = <<<EOF
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         ) $charset_collate;
155 155
 EOF;
156 156
 		// Execute the query for mappings table.
157
-		$this->wpdb->query( $sql );
157
+		$this->wpdb->query($sql);
158 158
 	}
159 159
 
160 160
 	/**
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @since 3.25.0
173 173
 	 */
174 174
 	public function create_rule_group_table() {
175
-		$table_name      = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
175
+		$table_name      = $this->wpdb->prefix.WL_RULE_GROUP_TABLE_NAME;
176 176
 		$charset_collate = $this->wpdb->get_charset_collate();
177 177
 
178
-		$mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
178
+		$mapping_table_name = $this->wpdb->prefix.WL_MAPPING_TABLE_NAME;
179 179
 		// @@todo is this table actually needed? I am not understanding what it does.
180 180
 		$sql = <<<EOF
181 181
         CREATE TABLE IF NOT EXISTS $table_name (
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 EOF;
189 189
 		// Execute the query for rule group table, we cant use db delta
190 190
 		// due to lack of support for foreign keys.
191
-		$this->wpdb->query( $sql );
191
+		$this->wpdb->query($sql);
192 192
 	}
193 193
 
194 194
 
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @since 3.25.0
213 213
 	 */
214 214
 	public function create_property_table() {
215
-		$table_name      = $this->wpdb->prefix . WL_PROPERTY_TABLE_NAME;
215
+		$table_name      = $this->wpdb->prefix.WL_PROPERTY_TABLE_NAME;
216 216
 		$charset_collate = $this->wpdb->get_charset_collate();
217 217
 
218
-		$mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
218
+		$mapping_table_name = $this->wpdb->prefix.WL_MAPPING_TABLE_NAME;
219 219
 		// @@todo do you we need the `property_` prefix? this is the property table anyway.
220 220
 		$sql = <<<EOF
221 221
         CREATE TABLE IF NOT EXISTS $table_name (
@@ -233,16 +233,16 @@  discard block
 block discarded – undo
233 233
 EOF;
234 234
 		// Execute the query for property table, we cant use db delta
235 235
 		// due to lack of support for foreign keys.
236
-		$this->wpdb->query( $sql );
236
+		$this->wpdb->query($sql);
237 237
 	}
238 238
 
239 239
 	public static function drop_tables() {
240 240
 		global $wpdb;
241 241
 
242
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_PROPERTY_TABLE_NAME );
243
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_TABLE_NAME );
244
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_GROUP_TABLE_NAME );
245
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_MAPPING_TABLE_NAME );
242
+		$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.WL_PROPERTY_TABLE_NAME);
243
+		$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.WL_RULE_TABLE_NAME);
244
+		$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.WL_RULE_GROUP_TABLE_NAME);
245
+		$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.WL_MAPPING_TABLE_NAME);
246 246
 	}
247 247
 
248 248
 }
Please login to merge, or discard this patch.
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -60,54 +60,54 @@  discard block
 block discarded – undo
60 60
  * @subpackage Wordlift/install
61 61
  */
62 62
 class Wordlift_Install_3_25_0 extends Wordlift_Install {
63
-	/**
64
-	 * @inheritdoc
65
-	 */
66
-	protected static $version = '3.25.3';
67
-
68
-	/**
69
-	 * Reference to global $wpdb instance.
70
-	 *
71
-	 * @var $wpdb
72
-	 * */
73
-	private $wpdb;
74
-
75
-	/** Constructor for 3_25_0 installer. */
76
-	public function __construct() {
77
-		global $wpdb;
78
-		$this->wpdb = $wpdb;
79
-	}
80
-
81
-	/**
82
-	 * @inheritdoc
83
-	 */
84
-	public function install() {
85
-		$this->create_mappings_table();
86
-		$this->create_rule_group_table();
87
-		$this->create_rule_table();
88
-		$this->create_property_table();
89
-	}
90
-
91
-	/**
92
-	 * Install mappings table.
93
-	 *
94
-	 * +----------------+--------------+------+-----+---------+----------------+
95
-	 * | Field          | Type         | Null | Key | Default | Extra          |
96
-	 * +----------------+--------------+------+-----+---------+----------------+
97
-	 * | mapping_id     | int(11)      | NO   | PRI | NULL    | auto_increment |
98
-	 * | mapping_title  | varchar(255) | NO   |     | NULL    |                |
99
-	 * | mapping_status | varchar(255) | NO   |     | active  |                |
100
-	 * +----------------+--------------+------+-----+---------+----------------+
101
-	 *
102
-	 * @return void
103
-	 * @since 3.25.0
104
-	 *
105
-	 */
106
-	public function create_mappings_table() {
107
-		$table_name      = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
108
-		$charset_collate = $this->wpdb->get_charset_collate();
109
-		// @@todo: is necessary to prefix the column names with `mapping_` ? we're the mappings table already.
110
-		$sql = <<<EOF
63
+    /**
64
+     * @inheritdoc
65
+     */
66
+    protected static $version = '3.25.3';
67
+
68
+    /**
69
+     * Reference to global $wpdb instance.
70
+     *
71
+     * @var $wpdb
72
+     * */
73
+    private $wpdb;
74
+
75
+    /** Constructor for 3_25_0 installer. */
76
+    public function __construct() {
77
+        global $wpdb;
78
+        $this->wpdb = $wpdb;
79
+    }
80
+
81
+    /**
82
+     * @inheritdoc
83
+     */
84
+    public function install() {
85
+        $this->create_mappings_table();
86
+        $this->create_rule_group_table();
87
+        $this->create_rule_table();
88
+        $this->create_property_table();
89
+    }
90
+
91
+    /**
92
+     * Install mappings table.
93
+     *
94
+     * +----------------+--------------+------+-----+---------+----------------+
95
+     * | Field          | Type         | Null | Key | Default | Extra          |
96
+     * +----------------+--------------+------+-----+---------+----------------+
97
+     * | mapping_id     | int(11)      | NO   | PRI | NULL    | auto_increment |
98
+     * | mapping_title  | varchar(255) | NO   |     | NULL    |                |
99
+     * | mapping_status | varchar(255) | NO   |     | active  |                |
100
+     * +----------------+--------------+------+-----+---------+----------------+
101
+     *
102
+     * @return void
103
+     * @since 3.25.0
104
+     *
105
+     */
106
+    public function create_mappings_table() {
107
+        $table_name      = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
108
+        $charset_collate = $this->wpdb->get_charset_collate();
109
+        // @@todo: is necessary to prefix the column names with `mapping_` ? we're the mappings table already.
110
+        $sql = <<<EOF
111 111
         CREATE TABLE $table_name (
112 112
 			mapping_id INT(11) NOT NULL AUTO_INCREMENT, 
113 113
 			mapping_title VARCHAR(255) NOT NULL,
@@ -115,33 +115,33 @@  discard block
 block discarded – undo
115 115
 			PRIMARY KEY  (mapping_id)
116 116
         ) $charset_collate;
117 117
 EOF;
118
-		// Execute the query for mappings table.
119
-		dbDelta( $sql );
120
-	}
121
-
122
-
123
-	/**
124
-	 * Install rule table
125
-	 *
126
-	 * +------------------+--------------+------+-----+---------+----------------+
127
-	 * | Field            | Type         | Null | Key | Default | Extra          |
128
-	 * +------------------+--------------+------+-----+---------+----------------+
129
-	 * | rule_id          | int(11)      | NO   | PRI | NULL    | auto_increment |
130
-	 * | rule_field_one   | varchar(255) | NO   |     | NULL    |                |
131
-	 * | rule_logic_field | varchar(255) | NO   |     | NULL    |                |
132
-	 * | rule_field_two   | varchar(255) | NO   |     | NULL    |                |
133
-	 * | rule_group_id    | int(11)      | NO   | MUL | NULL    |                |
134
-	 * +------------------+--------------+------+-----+---------+----------------+
135
-	 *
136
-	 * @return void
137
-	 * @since 3.25.0
138
-	 */
139
-	public function create_rule_table() {
140
-		$table_name            = $this->wpdb->prefix . WL_RULE_TABLE_NAME;
141
-		$rule_group_table_name = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
142
-		$charset_collate       = $this->wpdb->get_charset_collate();
143
-		// @@todo: is necessary to prefix the column names with `rule_` ? we're the rules table already.
144
-		$sql = <<<EOF
118
+        // Execute the query for mappings table.
119
+        dbDelta( $sql );
120
+    }
121
+
122
+
123
+    /**
124
+     * Install rule table
125
+     *
126
+     * +------------------+--------------+------+-----+---------+----------------+
127
+     * | Field            | Type         | Null | Key | Default | Extra          |
128
+     * +------------------+--------------+------+-----+---------+----------------+
129
+     * | rule_id          | int(11)      | NO   | PRI | NULL    | auto_increment |
130
+     * | rule_field_one   | varchar(255) | NO   |     | NULL    |                |
131
+     * | rule_logic_field | varchar(255) | NO   |     | NULL    |                |
132
+     * | rule_field_two   | varchar(255) | NO   |     | NULL    |                |
133
+     * | rule_group_id    | int(11)      | NO   | MUL | NULL    |                |
134
+     * +------------------+--------------+------+-----+---------+----------------+
135
+     *
136
+     * @return void
137
+     * @since 3.25.0
138
+     */
139
+    public function create_rule_table() {
140
+        $table_name            = $this->wpdb->prefix . WL_RULE_TABLE_NAME;
141
+        $rule_group_table_name = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
142
+        $charset_collate       = $this->wpdb->get_charset_collate();
143
+        // @@todo: is necessary to prefix the column names with `rule_` ? we're the rules table already.
144
+        $sql = <<<EOF
145 145
         CREATE TABLE IF NOT EXISTS $table_name (
146 146
 				rule_id INT(11) NOT NULL AUTO_INCREMENT,
147 147
 				rule_field_one VARCHAR(255) NOT NULL,
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 				PRIMARY KEY  (rule_id)
154 154
         ) $charset_collate;
155 155
 EOF;
156
-		// Execute the query for mappings table.
157
-		$this->wpdb->query( $sql );
158
-	}
159
-
160
-	/**
161
-	 * Install rule group table, should run after creating mapping and
162
-	 * rule table due to foreign key reference.
163
-	 *
164
-	 * +---------------+---------+------+-----+---------+----------------+
165
-	 * | Field         | Type    | Null | Key | Default | Extra          |
166
-	 * +---------------+---------+------+-----+---------+----------------+
167
-	 * | rule_group_id | int(11) | NO   | PRI | NULL    | auto_increment |
168
-	 * | mapping_id    | int(11) | NO   | MUL | NULL    |                |
169
-	 * +---------------+---------+------+-----+---------+----------------+
170
-	 *
171
-	 * @return void
172
-	 * @since 3.25.0
173
-	 */
174
-	public function create_rule_group_table() {
175
-		$table_name      = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
176
-		$charset_collate = $this->wpdb->get_charset_collate();
177
-
178
-		$mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
179
-		// @@todo is this table actually needed? I am not understanding what it does.
180
-		$sql = <<<EOF
156
+        // Execute the query for mappings table.
157
+        $this->wpdb->query( $sql );
158
+    }
159
+
160
+    /**
161
+     * Install rule group table, should run after creating mapping and
162
+     * rule table due to foreign key reference.
163
+     *
164
+     * +---------------+---------+------+-----+---------+----------------+
165
+     * | Field         | Type    | Null | Key | Default | Extra          |
166
+     * +---------------+---------+------+-----+---------+----------------+
167
+     * | rule_group_id | int(11) | NO   | PRI | NULL    | auto_increment |
168
+     * | mapping_id    | int(11) | NO   | MUL | NULL    |                |
169
+     * +---------------+---------+------+-----+---------+----------------+
170
+     *
171
+     * @return void
172
+     * @since 3.25.0
173
+     */
174
+    public function create_rule_group_table() {
175
+        $table_name      = $this->wpdb->prefix . WL_RULE_GROUP_TABLE_NAME;
176
+        $charset_collate = $this->wpdb->get_charset_collate();
177
+
178
+        $mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
179
+        // @@todo is this table actually needed? I am not understanding what it does.
180
+        $sql = <<<EOF
181 181
         CREATE TABLE IF NOT EXISTS $table_name (
182 182
                 rule_group_id INT(11) NOT NULL AUTO_INCREMENT,
183 183
                 mapping_id INT(11) NOT NULL,
@@ -186,38 +186,38 @@  discard block
 block discarded – undo
186 186
                 ON DELETE CASCADE
187 187
         ) $charset_collate;
188 188
 EOF;
189
-		// Execute the query for rule group table, we cant use db delta
190
-		// due to lack of support for foreign keys.
191
-		$this->wpdb->query( $sql );
192
-	}
193
-
194
-
195
-	/**
196
-	 * Install property table, should run after mapping table due to
197
-	 * foreign key reference.
198
-	 *
199
-	 * +--------------------+--------------+------+-----+---------+----------------+
200
-	 * | Field              | Type         | Null | Key | Default | Extra          |
201
-	 * +--------------------+--------------+------+-----+---------+----------------+
202
-	 * | property_id        | int(11)      | NO   | PRI | NULL    | auto_increment |
203
-	 * | mapping_id         | int(11)      | NO   | MUL | NULL    |                |
204
-	 * | property_name      | varchar(255) | NO   |     | NULL    |                |
205
-	 * | field_type         | varchar(255) | NO   |     | NULL    |                |
206
-	 * | field_name         | varchar(255) | NO   |     | NULL    |                |
207
-	 * | transform_function | varchar(255) | NO   |     | NULL    |                |
208
-	 * | property_status    | varchar(255) | NO   |     | active  |                |
209
-	 * +--------------------+--------------+------+-----+---------+----------------+
210
-	 *
211
-	 * @return void
212
-	 * @since 3.25.0
213
-	 */
214
-	public function create_property_table() {
215
-		$table_name      = $this->wpdb->prefix . WL_PROPERTY_TABLE_NAME;
216
-		$charset_collate = $this->wpdb->get_charset_collate();
217
-
218
-		$mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
219
-		// @@todo do you we need the `property_` prefix? this is the property table anyway.
220
-		$sql = <<<EOF
189
+        // Execute the query for rule group table, we cant use db delta
190
+        // due to lack of support for foreign keys.
191
+        $this->wpdb->query( $sql );
192
+    }
193
+
194
+
195
+    /**
196
+     * Install property table, should run after mapping table due to
197
+     * foreign key reference.
198
+     *
199
+     * +--------------------+--------------+------+-----+---------+----------------+
200
+     * | Field              | Type         | Null | Key | Default | Extra          |
201
+     * +--------------------+--------------+------+-----+---------+----------------+
202
+     * | property_id        | int(11)      | NO   | PRI | NULL    | auto_increment |
203
+     * | mapping_id         | int(11)      | NO   | MUL | NULL    |                |
204
+     * | property_name      | varchar(255) | NO   |     | NULL    |                |
205
+     * | field_type         | varchar(255) | NO   |     | NULL    |                |
206
+     * | field_name         | varchar(255) | NO   |     | NULL    |                |
207
+     * | transform_function | varchar(255) | NO   |     | NULL    |                |
208
+     * | property_status    | varchar(255) | NO   |     | active  |                |
209
+     * +--------------------+--------------+------+-----+---------+----------------+
210
+     *
211
+     * @return void
212
+     * @since 3.25.0
213
+     */
214
+    public function create_property_table() {
215
+        $table_name      = $this->wpdb->prefix . WL_PROPERTY_TABLE_NAME;
216
+        $charset_collate = $this->wpdb->get_charset_collate();
217
+
218
+        $mapping_table_name = $this->wpdb->prefix . WL_MAPPING_TABLE_NAME;
219
+        // @@todo do you we need the `property_` prefix? this is the property table anyway.
220
+        $sql = <<<EOF
221 221
         CREATE TABLE IF NOT EXISTS $table_name (
222 222
                 property_id INT(11) NOT NULL AUTO_INCREMENT,
223 223
                 mapping_id INT(11) NOT NULL,
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
                 ON DELETE CASCADE
232 232
         ) $charset_collate;
233 233
 EOF;
234
-		// Execute the query for property table, we cant use db delta
235
-		// due to lack of support for foreign keys.
236
-		$this->wpdb->query( $sql );
237
-	}
238
-
239
-	public static function drop_tables() {
240
-		global $wpdb;
241
-
242
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_PROPERTY_TABLE_NAME );
243
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_TABLE_NAME );
244
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_GROUP_TABLE_NAME );
245
-		$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_MAPPING_TABLE_NAME );
246
-	}
234
+        // Execute the query for property table, we cant use db delta
235
+        // due to lack of support for foreign keys.
236
+        $this->wpdb->query( $sql );
237
+    }
238
+
239
+    public static function drop_tables() {
240
+        global $wpdb;
241
+
242
+        $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_PROPERTY_TABLE_NAME );
243
+        $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_TABLE_NAME );
244
+        $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_RULE_GROUP_TABLE_NAME );
245
+        $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . WL_MAPPING_TABLE_NAME );
246
+    }
247 247
 
248 248
 }
Please login to merge, or discard this patch.
src/wordlift_entity_type.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function wl_set_entity_main_type( $post_id, $type_uri ) {
13 13
 
14
-	Wordlift_Entity_Type_Service::get_instance()
15
-	                            ->set( $post_id, $type_uri );
14
+    Wordlift_Entity_Type_Service::get_instance()
15
+                                ->set( $post_id, $type_uri );
16 16
 
17 17
 }
18 18
 
@@ -21,35 +21,35 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function wl_print_entity_type_inline_js() {
23 23
 
24
-	$terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) );
24
+    $terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) );
25 25
 
26
-	// Load the type data.
27
-	$schema_service = Wordlift_Schema_Service::get_instance();
28
-	$entity_types   = array_reduce( $terms, function ( $carry, $term ) use ( $schema_service ) {
29
-		$type = $schema_service->get_schema( $term->slug );
26
+    // Load the type data.
27
+    $schema_service = Wordlift_Schema_Service::get_instance();
28
+    $entity_types   = array_reduce( $terms, function ( $carry, $term ) use ( $schema_service ) {
29
+        $type = $schema_service->get_schema( $term->slug );
30 30
 
31
-		// Skip if no `uri`.
32
-		if ( empty( $type['uri'] ) ) {
33
-			return $carry;
34
-		}
31
+        // Skip if no `uri`.
32
+        if ( empty( $type['uri'] ) ) {
33
+            return $carry;
34
+        }
35 35
 
36
-		$carry[] = array(
37
-			'label'     => $term->name,
38
-			'uri'       => $type['uri'],
39
-			'css'       => $type['css_class'],
40
-			'sameAs'    => isset( $type['same_as'] ) ? $type['same_as'] : array(),
41
-			'slug'      => $term->slug,
42
-			'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
43
-		);
36
+        $carry[] = array(
37
+            'label'     => $term->name,
38
+            'uri'       => $type['uri'],
39
+            'css'       => $type['css_class'],
40
+            'sameAs'    => isset( $type['same_as'] ) ? $type['same_as'] : array(),
41
+            'slug'      => $term->slug,
42
+            'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
43
+        );
44 44
 
45
-		return $carry;
46
-	}, array() );
45
+        return $carry;
46
+    }, array() );
47 47
 
48
-	// Hook to the Block Editor script.
49
-	wp_localize_script( 'wl-block-editor', '_wlEntityTypes', $entity_types );
48
+    // Hook to the Block Editor script.
49
+    wp_localize_script( 'wl-block-editor', '_wlEntityTypes', $entity_types );
50 50
 
51
-	// Hook to the Classic Editor script, see Wordlift_Admin_Post_Edit_Page.
52
-	wp_localize_script( 'wl-classic-editor', '_wlEntityTypes', $entity_types );
51
+    // Hook to the Classic Editor script, see Wordlift_Admin_Post_Edit_Page.
52
+    wp_localize_script( 'wl-classic-editor', '_wlEntityTypes', $entity_types );
53 53
 
54 54
 }
55 55
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  * @deprecated use Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri )
10 10
  *
11 11
  */
12
-function wl_set_entity_main_type( $post_id, $type_uri ) {
12
+function wl_set_entity_main_type($post_id, $type_uri) {
13 13
 
14 14
 	Wordlift_Entity_Type_Service::get_instance()
15
-	                            ->set( $post_id, $type_uri );
15
+	                            ->set($post_id, $type_uri);
16 16
 
17 17
 }
18 18
 
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function wl_print_entity_type_inline_js() {
23 23
 
24
-	$terms = get_terms( Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array( 'get' => 'all', ) );
24
+	$terms = get_terms(Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, array('get' => 'all',));
25 25
 
26 26
 	// Load the type data.
27 27
 	$schema_service = Wordlift_Schema_Service::get_instance();
28
-	$entity_types   = array_reduce( $terms, function ( $carry, $term ) use ( $schema_service ) {
29
-		$type = $schema_service->get_schema( $term->slug );
28
+	$entity_types   = array_reduce($terms, function($carry, $term) use ($schema_service) {
29
+		$type = $schema_service->get_schema($term->slug);
30 30
 
31 31
 		// Skip if no `uri`.
32
-		if ( empty( $type['uri'] ) ) {
32
+		if (empty($type['uri'])) {
33 33
 			return $carry;
34 34
 		}
35 35
 
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
 			'label'     => $term->name,
38 38
 			'uri'       => $type['uri'],
39 39
 			'css'       => $type['css_class'],
40
-			'sameAs'    => isset( $type['same_as'] ) ? $type['same_as'] : array(),
40
+			'sameAs'    => isset($type['same_as']) ? $type['same_as'] : array(),
41 41
 			'slug'      => $term->slug,
42
-			'templates' => ( isset( $type['templates'] ) ? $type['templates'] : array() ),
42
+			'templates' => (isset($type['templates']) ? $type['templates'] : array()),
43 43
 		);
44 44
 
45 45
 		return $carry;
46
-	}, array() );
46
+	}, array());
47 47
 
48 48
 	// Hook to the Block Editor script.
49
-	wp_localize_script( 'wl-block-editor', '_wlEntityTypes', $entity_types );
49
+	wp_localize_script('wl-block-editor', '_wlEntityTypes', $entity_types);
50 50
 
51 51
 	// Hook to the Classic Editor script, see Wordlift_Admin_Post_Edit_Page.
52
-	wp_localize_script( 'wl-classic-editor', '_wlEntityTypes', $entity_types );
52
+	wp_localize_script('wl-classic-editor', '_wlEntityTypes', $entity_types);
53 53
 
54 54
 }
55 55
 
56 56
 // Allow Classic and Block Editor scripts to register first.
57
-add_action( 'admin_print_scripts-post.php', 'wl_print_entity_type_inline_js', 11 );
58
-add_action( 'admin_print_scripts-post-new.php', 'wl_print_entity_type_inline_js', 11 );
57
+add_action('admin_print_scripts-post.php', 'wl_print_entity_type_inline_js', 11);
58
+add_action('admin_print_scripts-post-new.php', 'wl_print_entity_type_inline_js', 11);
Please login to merge, or discard this patch.
src/wordlift/autocomplete/class-abstract-autocomplete-service.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,30 +11,30 @@
 block discarded – undo
11 11
 
12 12
 abstract class Abstract_Autocomplete_Service implements Autocomplete_Service {
13 13
 
14
-	/**
15
-	 * Filter out results that are in the excludes list.
16
-	 *
17
-	 * @param array $results {
18
-	 * An array of results.
19
-	 *
20
-	 * @type array The result's data.
21
-	 * }
22
-	 *
23
-	 * @param array $excludes An array of URLs.
24
-	 *
25
-	 * @return array The filtered array of results.
26
-	 */
27
-	protected function filter( $results, $excludes ) {
14
+    /**
15
+     * Filter out results that are in the excludes list.
16
+     *
17
+     * @param array $results {
18
+     * An array of results.
19
+     *
20
+     * @type array The result's data.
21
+     * }
22
+     *
23
+     * @param array $excludes An array of URLs.
24
+     *
25
+     * @return array The filtered array of results.
26
+     */
27
+    protected function filter( $results, $excludes ) {
28 28
 
29
-		$excludes_array = (array) $excludes;
29
+        $excludes_array = (array) $excludes;
30 30
 
31
-		return array_filter( $results, function ( $item ) use ( $excludes_array ) {
31
+        return array_filter( $results, function ( $item ) use ( $excludes_array ) {
32 32
 
33
-			return 0 === count( array_intersect(
34
-					array_merge( (array) $item['id'], $item['sameAss'] ),
35
-					$excludes_array
36
-				) );
37
-		} );
38
-	}
33
+            return 0 === count( array_intersect(
34
+                    array_merge( (array) $item['id'], $item['sameAss'] ),
35
+                    $excludes_array
36
+                ) );
37
+        } );
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@
 block discarded – undo
24 24
 	 *
25 25
 	 * @return array The filtered array of results.
26 26
 	 */
27
-	protected function filter( $results, $excludes ) {
27
+	protected function filter($results, $excludes) {
28 28
 
29 29
 		$excludes_array = (array) $excludes;
30 30
 
31
-		return array_filter( $results, function ( $item ) use ( $excludes_array ) {
31
+		return array_filter($results, function($item) use ($excludes_array) {
32 32
 
33
-			return 0 === count( array_intersect(
34
-					array_merge( (array) $item['id'], $item['sameAss'] ),
33
+			return 0 === count(array_intersect(
34
+					array_merge((array) $item['id'], $item['sameAss']),
35 35
 					$excludes_array
36
-				) );
36
+				));
37 37
 		} );
38 38
 	}
39 39
 
Please login to merge, or discard this patch.