Completed
Pull Request — develop (#1698)
by
unknown
01:26
created
src/wordlift/metabox/field/class-wordlift-metabox-field-duration.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,42 +20,42 @@
 block discarded – undo
20 20
  */
21 21
 class Wordlift_Metabox_Field_Duration extends Wl_Metabox_Field_date {
22 22
 
23
-	/**
24
-	 * {@inheritdoc}
25
-	 */
26
-	public function __construct( $args, $id, $type ) {
27
-		parent::__construct( $args, $id, $type );
28
-
29
-		$this->date_format = 'H:i';
30
-		$this->timepicker  = true;
31
-		$this->no_calendar = true;
32
-
33
-	}
34
-
35
-	/**
36
-	 * Sanitize a single value. Called from $this->sanitize_data. Default sanitization excludes empty values.
37
-	 * make sure the value is either empty, an integer representing valid number of minutes
38
-	 * or an HH:MM time format.
39
-	 *
40
-	 * @param mixed $value The value being sanitized.
41
-	 *
42
-	 * @return mixed Returns sanitized value, or null.
43
-	 */
44
-	public function sanitize_data_filter( $value ) {
45
-
46
-		if ( $value !== null && '' !== $value ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
47
-			preg_match(
48
-				'#((([01]?[0-9]{1}|2[0-3]{1}):)?[0-5]{1})?[0-9]{1}#',
49
-				trim( $value ),
50
-				$matches
51
-			);
52
-
53
-			if ( count( $matches ) > 0 ) {
54
-				return $matches[0];
55
-			}
56
-		}
57
-
58
-		return null;
59
-	}
23
+    /**
24
+     * {@inheritdoc}
25
+     */
26
+    public function __construct( $args, $id, $type ) {
27
+        parent::__construct( $args, $id, $type );
28
+
29
+        $this->date_format = 'H:i';
30
+        $this->timepicker  = true;
31
+        $this->no_calendar = true;
32
+
33
+    }
34
+
35
+    /**
36
+     * Sanitize a single value. Called from $this->sanitize_data. Default sanitization excludes empty values.
37
+     * make sure the value is either empty, an integer representing valid number of minutes
38
+     * or an HH:MM time format.
39
+     *
40
+     * @param mixed $value The value being sanitized.
41
+     *
42
+     * @return mixed Returns sanitized value, or null.
43
+     */
44
+    public function sanitize_data_filter( $value ) {
45
+
46
+        if ( $value !== null && '' !== $value ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
47
+            preg_match(
48
+                '#((([01]?[0-9]{1}|2[0-3]{1}):)?[0-5]{1})?[0-9]{1}#',
49
+                trim( $value ),
50
+                $matches
51
+            );
52
+
53
+            if ( count( $matches ) > 0 ) {
54
+                return $matches[0];
55
+            }
56
+        }
57
+
58
+        return null;
59
+    }
60 60
 
61 61
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * {@inheritdoc}
25 25
 	 */
26
-	public function __construct( $args, $id, $type ) {
27
-		parent::__construct( $args, $id, $type );
26
+	public function __construct($args, $id, $type) {
27
+		parent::__construct($args, $id, $type);
28 28
 
29 29
 		$this->date_format = 'H:i';
30 30
 		$this->timepicker  = true;
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return mixed Returns sanitized value, or null.
43 43
 	 */
44
-	public function sanitize_data_filter( $value ) {
44
+	public function sanitize_data_filter($value) {
45 45
 
46
-		if ( $value !== null && '' !== $value ) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
46
+		if ($value !== null && '' !== $value) {         // do not use 'empty()' -> https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ .
47 47
 			preg_match(
48 48
 				'#((([01]?[0-9]{1}|2[0-3]{1}):)?[0-5]{1})?[0-9]{1}#',
49
-				trim( $value ),
49
+				trim($value),
50 50
 				$matches
51 51
 			);
52 52
 
53
-			if ( count( $matches ) > 0 ) {
53
+			if (count($matches) > 0) {
54 54
 				return $matches[0];
55 55
 			}
56 56
 		}
Please login to merge, or discard this patch.
src/wordlift/metabox/field/store/class-store-factory.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
 
12 12
 class Store_Factory {
13 13
 
14
-	/**
15
-	 * @param $type
16
-	 *
17
-	 * @return Store
18
-	 */
19
-	public static function get_instance( $type ) {
14
+    /**
15
+     * @param $type
16
+     *
17
+     * @return Store
18
+     */
19
+    public static function get_instance( $type ) {
20 20
 
21
-		if ( Object_Type_Enum::POST === $type ) {
22
-			return new Post_Store();
23
-		} elseif ( Object_Type_Enum::TERM === $type ) {
24
-			return new Term_Store();
25
-		}
26
-		return null;
27
-	}
21
+        if ( Object_Type_Enum::POST === $type ) {
22
+            return new Post_Store();
23
+        } elseif ( Object_Type_Enum::TERM === $type ) {
24
+            return new Term_Store();
25
+        }
26
+        return null;
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
 	 *
17 17
 	 * @return Store
18 18
 	 */
19
-	public static function get_instance( $type ) {
19
+	public static function get_instance($type) {
20 20
 
21
-		if ( Object_Type_Enum::POST === $type ) {
21
+		if (Object_Type_Enum::POST === $type) {
22 22
 			return new Post_Store();
23
-		} elseif ( Object_Type_Enum::TERM === $type ) {
23
+		} elseif (Object_Type_Enum::TERM === $type) {
24 24
 			return new Term_Store();
25 25
 		}
26 26
 		return null;
Please login to merge, or discard this patch.
src/wordlift/metabox/field/store/class-post-store.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@
 block discarded – undo
9 9
 
10 10
 class Post_Store implements Store {
11 11
 
12
-	public static function get_data( $post_id, $meta_key ) {
13
-		return get_post_meta( $post_id, $meta_key );
14
-	}
12
+    public static function get_data( $post_id, $meta_key ) {
13
+        return get_post_meta( $post_id, $meta_key );
14
+    }
15 15
 
16
-	public static function save_data( $post_id, $meta_key, $cardinality, $values ) {
17
-		$entity_id = $post_id;
18
-		// Take away old values.
19
-		delete_post_meta( $entity_id, $meta_key );
20
-		// insert new values, respecting cardinality.
21
-		$single = ( 1 === $cardinality );
22
-		foreach ( $values as $value ) {
23
-			// To avoid duplicate values
24
-			delete_post_meta( $entity_id, $meta_key, $value );
25
-			add_post_meta( $entity_id, $meta_key, $value, $single );
26
-		}
27
-	}
16
+    public static function save_data( $post_id, $meta_key, $cardinality, $values ) {
17
+        $entity_id = $post_id;
18
+        // Take away old values.
19
+        delete_post_meta( $entity_id, $meta_key );
20
+        // insert new values, respecting cardinality.
21
+        $single = ( 1 === $cardinality );
22
+        foreach ( $values as $value ) {
23
+            // To avoid duplicate values
24
+            delete_post_meta( $entity_id, $meta_key, $value );
25
+            add_post_meta( $entity_id, $meta_key, $value, $single );
26
+        }
27
+    }
28 28
 
29
-	public static function delete_meta( $id, $meta_key ) {
30
-		delete_post_meta( $id, $meta_key );
31
-	}
29
+    public static function delete_meta( $id, $meta_key ) {
30
+        delete_post_meta( $id, $meta_key );
31
+    }
32 32
 
33
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
34
-		add_post_meta( $id, $meta_key, $meta_value, $is_unique );
35
-	}
33
+    public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
34
+        add_post_meta( $id, $meta_key, $meta_value, $is_unique );
35
+    }
36 36
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@
 block discarded – undo
9 9
 
10 10
 class Post_Store implements Store {
11 11
 
12
-	public static function get_data( $post_id, $meta_key ) {
13
-		return get_post_meta( $post_id, $meta_key );
12
+	public static function get_data($post_id, $meta_key) {
13
+		return get_post_meta($post_id, $meta_key);
14 14
 	}
15 15
 
16
-	public static function save_data( $post_id, $meta_key, $cardinality, $values ) {
16
+	public static function save_data($post_id, $meta_key, $cardinality, $values) {
17 17
 		$entity_id = $post_id;
18 18
 		// Take away old values.
19
-		delete_post_meta( $entity_id, $meta_key );
19
+		delete_post_meta($entity_id, $meta_key);
20 20
 		// insert new values, respecting cardinality.
21
-		$single = ( 1 === $cardinality );
22
-		foreach ( $values as $value ) {
21
+		$single = (1 === $cardinality);
22
+		foreach ($values as $value) {
23 23
 			// To avoid duplicate values
24
-			delete_post_meta( $entity_id, $meta_key, $value );
25
-			add_post_meta( $entity_id, $meta_key, $value, $single );
24
+			delete_post_meta($entity_id, $meta_key, $value);
25
+			add_post_meta($entity_id, $meta_key, $value, $single);
26 26
 		}
27 27
 	}
28 28
 
29
-	public static function delete_meta( $id, $meta_key ) {
30
-		delete_post_meta( $id, $meta_key );
29
+	public static function delete_meta($id, $meta_key) {
30
+		delete_post_meta($id, $meta_key);
31 31
 	}
32 32
 
33
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
34
-		add_post_meta( $id, $meta_key, $meta_value, $is_unique );
33
+	public static function add_meta($id, $meta_key, $meta_value, $is_unique) {
34
+		add_post_meta($id, $meta_key, $meta_value, $is_unique);
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
src/wordlift/metabox/field/store/class-term-store.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@
 block discarded – undo
9 9
 
10 10
 class Term_Store implements Store {
11 11
 
12
-	public static function get_data( $term_id, $meta_key ) {
13
-		return get_term_meta( $term_id, $meta_key );
14
-	}
12
+    public static function get_data( $term_id, $meta_key ) {
13
+        return get_term_meta( $term_id, $meta_key );
14
+    }
15 15
 
16
-	public static function save_data( $term_id, $meta_key, $cardinality, $values ) {
16
+    public static function save_data( $term_id, $meta_key, $cardinality, $values ) {
17 17
 
18
-		// Take away old values.
19
-		delete_term_meta( $term_id, $meta_key );
18
+        // Take away old values.
19
+        delete_term_meta( $term_id, $meta_key );
20 20
 
21
-		// insert new values, respecting cardinality.
22
-		$single = ( 1 === $cardinality );
23
-		foreach ( $values as $value ) {
24
-			// To avoid duplicate values
25
-			delete_term_meta( $term_id, $meta_key, $value );
26
-			add_term_meta( $term_id, $meta_key, $value, $single );
27
-		}
21
+        // insert new values, respecting cardinality.
22
+        $single = ( 1 === $cardinality );
23
+        foreach ( $values as $value ) {
24
+            // To avoid duplicate values
25
+            delete_term_meta( $term_id, $meta_key, $value );
26
+            add_term_meta( $term_id, $meta_key, $value, $single );
27
+        }
28 28
 
29
-	}
29
+    }
30 30
 
31
-	public static function delete_meta( $id, $meta_key ) {
32
-		delete_term_meta( $id, $meta_key );
33
-	}
31
+    public static function delete_meta( $id, $meta_key ) {
32
+        delete_term_meta( $id, $meta_key );
33
+    }
34 34
 
35
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
36
-		add_term_meta( $id, $meta_key, $meta_value, $is_unique );
37
-	}
35
+    public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
36
+        add_term_meta( $id, $meta_key, $meta_value, $is_unique );
37
+    }
38 38
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@
 block discarded – undo
9 9
 
10 10
 class Term_Store implements Store {
11 11
 
12
-	public static function get_data( $term_id, $meta_key ) {
13
-		return get_term_meta( $term_id, $meta_key );
12
+	public static function get_data($term_id, $meta_key) {
13
+		return get_term_meta($term_id, $meta_key);
14 14
 	}
15 15
 
16
-	public static function save_data( $term_id, $meta_key, $cardinality, $values ) {
16
+	public static function save_data($term_id, $meta_key, $cardinality, $values) {
17 17
 
18 18
 		// Take away old values.
19
-		delete_term_meta( $term_id, $meta_key );
19
+		delete_term_meta($term_id, $meta_key);
20 20
 
21 21
 		// insert new values, respecting cardinality.
22
-		$single = ( 1 === $cardinality );
23
-		foreach ( $values as $value ) {
22
+		$single = (1 === $cardinality);
23
+		foreach ($values as $value) {
24 24
 			// To avoid duplicate values
25
-			delete_term_meta( $term_id, $meta_key, $value );
26
-			add_term_meta( $term_id, $meta_key, $value, $single );
25
+			delete_term_meta($term_id, $meta_key, $value);
26
+			add_term_meta($term_id, $meta_key, $value, $single);
27 27
 		}
28 28
 
29 29
 	}
30 30
 
31
-	public static function delete_meta( $id, $meta_key ) {
32
-		delete_term_meta( $id, $meta_key );
31
+	public static function delete_meta($id, $meta_key) {
32
+		delete_term_meta($id, $meta_key);
33 33
 	}
34 34
 
35
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique ) {
36
-		add_term_meta( $id, $meta_key, $meta_value, $is_unique );
35
+	public static function add_meta($id, $meta_key, $meta_value, $is_unique) {
36
+		add_term_meta($id, $meta_key, $meta_value, $is_unique);
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
src/wordlift/metabox/field/store/class-store.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 
9 9
 interface Store {
10 10
 
11
-	public static function get_data( $post_id, $meta_key );
11
+    public static function get_data( $post_id, $meta_key );
12 12
 
13
-	public static function save_data( $post_id, $meta_key, $cardinality, $values );
13
+    public static function save_data( $post_id, $meta_key, $cardinality, $values );
14 14
 
15
-	public static function delete_meta( $id, $meta_key );
15
+    public static function delete_meta( $id, $meta_key );
16 16
 
17
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique );
17
+    public static function add_meta( $id, $meta_key, $meta_value, $is_unique );
18 18
 
19 19
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 
9 9
 interface Store {
10 10
 
11
-	public static function get_data( $post_id, $meta_key );
11
+	public static function get_data($post_id, $meta_key);
12 12
 
13
-	public static function save_data( $post_id, $meta_key, $cardinality, $values );
13
+	public static function save_data($post_id, $meta_key, $cardinality, $values);
14 14
 
15
-	public static function delete_meta( $id, $meta_key );
15
+	public static function delete_meta($id, $meta_key);
16 16
 
17
-	public static function add_meta( $id, $meta_key, $meta_value, $is_unique );
17
+	public static function add_meta($id, $meta_key, $meta_value, $is_unique);
18 18
 
19 19
 }
Please login to merge, or discard this patch.
src/wordlift/metabox/field/class-field.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -6,103 +6,103 @@
 block discarded – undo
6 6
 namespace Wordlift\Metabox\Field;
7 7
 
8 8
 interface Field {
9
-	/**
10
-	 * Return nonce HTML.
11
-	 *
12
-	 * Overwrite this method in a child class to obtain custom behaviour.
13
-	 */
14
-	public function html_nonce();
9
+    /**
10
+     * Return nonce HTML.
11
+     *
12
+     * Overwrite this method in a child class to obtain custom behaviour.
13
+     */
14
+    public function html_nonce();
15 15
 
16
-	/**
17
-	 * Verify nonce.
18
-	 *
19
-	 * Overwrite this method in a child class to obtain custom behaviour.
20
-	 *
21
-	 * @return bool Nonce verification.
22
-	 */
23
-	public function verify_nonce();
16
+    /**
17
+     * Verify nonce.
18
+     *
19
+     * Overwrite this method in a child class to obtain custom behaviour.
20
+     *
21
+     * @return bool Nonce verification.
22
+     */
23
+    public function verify_nonce();
24 24
 
25
-	/**
26
-	 * Load data from DB and store the resulting array in $this->data.
27
-	 *
28
-	 * Overwrite this method in a child class to obtain custom behaviour.
29
-	 */
30
-	public function get_data();
25
+    /**
26
+     * Load data from DB and store the resulting array in $this->data.
27
+     *
28
+     * Overwrite this method in a child class to obtain custom behaviour.
29
+     */
30
+    public function get_data();
31 31
 
32
-	/**
33
-	 * Sanitizes data before saving to DB. Default sanitization trashes empty
34
-	 * values.
35
-	 *
36
-	 * Stores the sanitized values into $this->data so they can be later processed.
37
-	 * Overwrite this method in a child class to obtain custom behaviour.
38
-	 *
39
-	 * @param array $values Array of values to be sanitized and then stored into
40
-	 *                      $this->data.
41
-	 *
42
-	 * @return array | string Return sanitized data.
43
-	 */
44
-	public function sanitize_data( $values );
32
+    /**
33
+     * Sanitizes data before saving to DB. Default sanitization trashes empty
34
+     * values.
35
+     *
36
+     * Stores the sanitized values into $this->data so they can be later processed.
37
+     * Overwrite this method in a child class to obtain custom behaviour.
38
+     *
39
+     * @param array $values Array of values to be sanitized and then stored into
40
+     *                      $this->data.
41
+     *
42
+     * @return array | string Return sanitized data.
43
+     */
44
+    public function sanitize_data( $values );
45 45
 
46
-	/**
47
-	 * Sanitize a single value. Called from $this->sanitize_data. Default
48
-	 * sanitization excludes empty values.
49
-	 *
50
-	 * Overwrite this method in a child class to obtain custom behaviour.
51
-	 *
52
-	 * @param string $value The value to sanitize.
53
-	 *
54
-	 * @return mixed Returns sanitized value, or null.
55
-	 */
56
-	public function sanitize_data_filter( $value );
46
+    /**
47
+     * Sanitize a single value. Called from $this->sanitize_data. Default
48
+     * sanitization excludes empty values.
49
+     *
50
+     * Overwrite this method in a child class to obtain custom behaviour.
51
+     *
52
+     * @param string $value The value to sanitize.
53
+     *
54
+     * @return mixed Returns sanitized value, or null.
55
+     */
56
+    public function sanitize_data_filter( $value );
57 57
 
58
-	/**
59
-	 * Save data to DB.
60
-	 *
61
-	 * Overwrite this method in a child class to obtain custom behaviour.
62
-	 *
63
-	 * @param array $values Array of values to be sanitized and then stored into $this->data.
64
-	 */
65
-	public function save_data( $values );
58
+    /**
59
+     * Save data to DB.
60
+     *
61
+     * Overwrite this method in a child class to obtain custom behaviour.
62
+     *
63
+     * @param array $values Array of values to be sanitized and then stored into $this->data.
64
+     */
65
+    public function save_data( $values );
66 66
 
67
-	/**
68
-	 * Returns the HTML tag that will contain the Field. By default the we
69
-	 * return a <div> with data- attributes on cardinality and expected types.
70
-	 *
71
-	 * It is useful to provide data- attributes for the JS scripts.
72
-	 *
73
-	 * Overwrite this method in a child class to obtain custom behaviour.
74
-	 */
75
-	public function html_wrapper_open();
67
+    /**
68
+     * Returns the HTML tag that will contain the Field. By default the we
69
+     * return a <div> with data- attributes on cardinality and expected types.
70
+     *
71
+     * It is useful to provide data- attributes for the JS scripts.
72
+     *
73
+     * Overwrite this method in a child class to obtain custom behaviour.
74
+     */
75
+    public function html_wrapper_open();
76 76
 
77
-	/**
78
-	 * Returns Field HTML (nonce included).
79
-	 *
80
-	 * Overwrite this method (or methods called from this method) in a child
81
-	 * class to obtain custom behaviour.
82
-	 *
83
-	 * The HTML fragment includes the following parts:
84
-	 * * html wrapper open.
85
-	 * * heading.
86
-	 * * nonce.
87
-	 * * stored values.
88
-	 * * an empty input when there are no stored values.
89
-	 * * an add button to add more values.
90
-	 * * html wrapper close.
91
-	 */
92
-	public function html();
77
+    /**
78
+     * Returns Field HTML (nonce included).
79
+     *
80
+     * Overwrite this method (or methods called from this method) in a child
81
+     * class to obtain custom behaviour.
82
+     *
83
+     * The HTML fragment includes the following parts:
84
+     * * html wrapper open.
85
+     * * heading.
86
+     * * nonce.
87
+     * * stored values.
88
+     * * an empty input when there are no stored values.
89
+     * * an add button to add more values.
90
+     * * html wrapper close.
91
+     */
92
+    public function html();
93 93
 
94
-	/**
95
-	 * Return a single <input> tag for the Field.
96
-	 *
97
-	 * @param mixed $value Input value.
98
-	 *
99
-	 * @return string The html code fragment.
100
-	 */
101
-	public function html_input( $value );
94
+    /**
95
+     * Return a single <input> tag for the Field.
96
+     *
97
+     * @param mixed $value Input value.
98
+     *
99
+     * @return string The html code fragment.
100
+     */
101
+    public function html_input( $value );
102 102
 
103
-	/**
104
-	 * Returns closing for the wrapper HTML tag.
105
-	 */
106
-	public function html_wrapper_close();
103
+    /**
104
+     * Returns closing for the wrapper HTML tag.
105
+     */
106
+    public function html_wrapper_close();
107 107
 
108 108
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return array | string Return sanitized data.
43 43
 	 */
44
-	public function sanitize_data( $values );
44
+	public function sanitize_data($values);
45 45
 
46 46
 	/**
47 47
 	 * Sanitize a single value. Called from $this->sanitize_data. Default
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return mixed Returns sanitized value, or null.
55 55
 	 */
56
-	public function sanitize_data_filter( $value );
56
+	public function sanitize_data_filter($value);
57 57
 
58 58
 	/**
59 59
 	 * Save data to DB.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @param array $values Array of values to be sanitized and then stored into $this->data.
64 64
 	 */
65
-	public function save_data( $values );
65
+	public function save_data($values);
66 66
 
67 67
 	/**
68 68
 	 * Returns the HTML tag that will contain the Field. By default the we
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return string The html code fragment.
100 100
 	 */
101
-	public function html_input( $value );
101
+	public function html_input($value);
102 102
 
103 103
 	/**
104 104
 	 * Returns closing for the wrapper HTML tag.
Please login to merge, or discard this patch.
src/wordlift/metabox/field/class-wl-metabox-field-date.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -21,63 +21,63 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Wl_Metabox_Field_Date extends Wl_Metabox_Field {
23 23
 
24
-	/**
25
-	 * Attribute to distinguish between date formats, inferred from the schema property export type
26
-	 *
27
-	 * @since  3.2.0
28
-	 * @access protected
29
-	 * @var string $date_format The date format.
30
-	 */
31
-	protected $date_format;
32
-
33
-	/**
34
-	 * Boolean flag to decide if the calendar should include time or not
35
-	 *
36
-	 * @since  3.2.0
37
-	 * @access protected
38
-	 * @var boolean $timepicker A boolean flag.
39
-	 */
40
-	protected $timepicker;
41
-
42
-	/**
43
-	 * Whether the calendar should be displayed or not.
44
-	 *
45
-	 * @since  3.14.0
46
-	 * @access protected
47
-	 * @var boolean $no_calendar Whether the calendar should be displayed or not.
48
-	 */
49
-	protected $no_calendar;
50
-
51
-	/**
52
-	 * {@inheritdoc}
53
-	 */
54
-	public function __construct( $args, $id, $type ) {
55
-		parent::__construct( $args, $id, $type );
56
-
57
-		$this->no_calendar = false;
58
-
59
-		// Distinguish between date and datetime
60
-		if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
61
-			$this->date_format = 'Y/m/d H:i';
62
-			$this->timepicker  = true;
63
-		} else {
64
-			$this->date_format = 'Y/m/d';
65
-			$this->timepicker  = false;
66
-		}
67
-
68
-	}
69
-
70
-	/**
71
-	 * @param mixed $date
72
-	 *
73
-	 * @return string
74
-	 */
75
-	public function html_input( $date ) {
76
-
77
-		$this->log->debug( "Creating date input with date value $date..." );
78
-
79
-		ob_start();
80
-		?>
24
+    /**
25
+     * Attribute to distinguish between date formats, inferred from the schema property export type
26
+     *
27
+     * @since  3.2.0
28
+     * @access protected
29
+     * @var string $date_format The date format.
30
+     */
31
+    protected $date_format;
32
+
33
+    /**
34
+     * Boolean flag to decide if the calendar should include time or not
35
+     *
36
+     * @since  3.2.0
37
+     * @access protected
38
+     * @var boolean $timepicker A boolean flag.
39
+     */
40
+    protected $timepicker;
41
+
42
+    /**
43
+     * Whether the calendar should be displayed or not.
44
+     *
45
+     * @since  3.14.0
46
+     * @access protected
47
+     * @var boolean $no_calendar Whether the calendar should be displayed or not.
48
+     */
49
+    protected $no_calendar;
50
+
51
+    /**
52
+     * {@inheritdoc}
53
+     */
54
+    public function __construct( $args, $id, $type ) {
55
+        parent::__construct( $args, $id, $type );
56
+
57
+        $this->no_calendar = false;
58
+
59
+        // Distinguish between date and datetime
60
+        if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
61
+            $this->date_format = 'Y/m/d H:i';
62
+            $this->timepicker  = true;
63
+        } else {
64
+            $this->date_format = 'Y/m/d';
65
+            $this->timepicker  = false;
66
+        }
67
+
68
+    }
69
+
70
+    /**
71
+     * @param mixed $date
72
+     *
73
+     * @return string
74
+     */
75
+    public function html_input( $date ) {
76
+
77
+        $this->log->debug( "Creating date input with date value $date..." );
78
+
79
+        ob_start();
80
+        ?>
81 81
 		<div class="wl-input-wrapper">
82 82
 			<input
83 83
 					type="text"
@@ -92,35 +92,35 @@  discard block
 block discarded – undo
92 92
 			</button>
93 93
 		</div>
94 94
 		<?php
95
-		$html = ob_get_clean();
95
+        $html = ob_get_clean();
96 96
 
97
-		return $html;
98
-	}
97
+        return $html;
98
+    }
99 99
 
100
-	public function html_wrapper_close() {
100
+    public function html_wrapper_close() {
101 101
 
102
-		// Should the widget include time picker?
103
-		$timepicker  = wp_json_encode( $this->timepicker );
104
-		$date_format = wp_json_encode( $this->date_format );
105
-		$no_calendar = wp_json_encode( $this->no_calendar );
102
+        // Should the widget include time picker?
103
+        $timepicker  = wp_json_encode( $this->timepicker );
104
+        $date_format = wp_json_encode( $this->date_format );
105
+        $no_calendar = wp_json_encode( $this->no_calendar );
106 106
 
107
-		// Set up the datetimepicker.
108
-		//
109
-		// See https://github.com/trentrichardson/jQuery-Timepicker-Addon
110
-		// See in http://trentrichardson.com/examples/timepicker.
107
+        // Set up the datetimepicker.
108
+        //
109
+        // See https://github.com/trentrichardson/jQuery-Timepicker-Addon
110
+        // See in http://trentrichardson.com/examples/timepicker.
111 111
 
112
-		$js = wp_json_encode(
113
-			array(
114
-				'enableTime' => $timepicker,
115
-				'noCalendar' => $no_calendar,
116
-				'time_24hr'  => true,
117
-				'dateFormat' => $date_format,
118
-			)
119
-		);
112
+        $js = wp_json_encode(
113
+            array(
114
+                'enableTime' => $timepicker,
115
+                'noCalendar' => $no_calendar,
116
+                'time_24hr'  => true,
117
+                'dateFormat' => $date_format,
118
+            )
119
+        );
120 120
 
121 121
         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
122
-		@ob_start();
123
-		?>
122
+        @ob_start();
123
+        ?>
124 124
 		<script type='text/javascript'>
125 125
 			(function ($) {
126 126
 				$(function () {
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 			})(jQuery);
130 130
 		</script>
131 131
 		<?php
132
-		$html = ob_get_clean();
132
+        $html = ob_get_clean();
133 133
 
134
-		$html .= parent::html_wrapper_close();
134
+        $html .= parent::html_wrapper_close();
135 135
 
136
-		return $html;
137
-	}
136
+        return $html;
137
+    }
138 138
 
139 139
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * {@inheritdoc}
53 53
 	 */
54
-	public function __construct( $args, $id, $type ) {
55
-		parent::__construct( $args, $id, $type );
54
+	public function __construct($args, $id, $type) {
55
+		parent::__construct($args, $id, $type);
56 56
 
57 57
 		$this->no_calendar = false;
58 58
 
59 59
 		// Distinguish between date and datetime
60
-		if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
60
+		if (isset($this->raw_custom_field['export_type']) && 'xsd:dateTime' === $this->raw_custom_field['export_type']) {
61 61
 			$this->date_format = 'Y/m/d H:i';
62 62
 			$this->timepicker  = true;
63 63
 		} else {
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string
74 74
 	 */
75
-	public function html_input( $date ) {
75
+	public function html_input($date) {
76 76
 
77
-		$this->log->debug( "Creating date input with date value $date..." );
77
+		$this->log->debug("Creating date input with date value $date...");
78 78
 
79 79
 		ob_start();
80 80
 		?>
81 81
 		<div class="wl-input-wrapper">
82 82
 			<input
83 83
 					type="text"
84
-					class="<?php echo esc_attr( $this->meta_name ); ?>"
85
-					name="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][]"
86
-					value="<?php echo esc_attr( $date ); ?>"
84
+					class="<?php echo esc_attr($this->meta_name); ?>"
85
+					name="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][]"
86
+					value="<?php echo esc_attr($date); ?>"
87 87
 					style="width:88%"
88 88
 			/>
89 89
 
90 90
 			<button class="button wl-remove-input wl-button" type="button">
91
-				<?php esc_html_e( 'Remove', 'wordlift' ); ?>
91
+				<?php esc_html_e('Remove', 'wordlift'); ?>
92 92
 			</button>
93 93
 		</div>
94 94
 		<?php
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	public function html_wrapper_close() {
101 101
 
102 102
 		// Should the widget include time picker?
103
-		$timepicker  = wp_json_encode( $this->timepicker );
104
-		$date_format = wp_json_encode( $this->date_format );
105
-		$no_calendar = wp_json_encode( $this->no_calendar );
103
+		$timepicker  = wp_json_encode($this->timepicker);
104
+		$date_format = wp_json_encode($this->date_format);
105
+		$no_calendar = wp_json_encode($this->no_calendar);
106 106
 
107 107
 		// Set up the datetimepicker.
108 108
 		//
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		<script type='text/javascript'>
125 125
 			(function ($) {
126 126
 				$(function () {
127
-					$('.<?php echo esc_js( $this->meta_name ); ?>[type=text]').flatpickr(<?php echo esc_html( $js ); ?>);
127
+					$('.<?php echo esc_js($this->meta_name); ?>[type=text]').flatpickr(<?php echo esc_html($js); ?>);
128 128
 				});
129 129
 			})(jQuery);
130 130
 		</script>
Please login to merge, or discard this patch.
src/wordlift/metabox/field/class-wordlift-metabox-field-multiline.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Wordlift_Metabox_Field_Multiline extends Wl_Metabox_Field {
22 22
 
23
-	/**
24
-	 * @inheritdoc
25
-	 */
26
-	public function html_input( $text ) {
23
+    /**
24
+     * @inheritdoc
25
+     */
26
+    public function html_input( $text ) {
27 27
         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
28
-		@ob_start();
29
-		?>
28
+        @ob_start();
29
+        ?>
30 30
 			<div class="wl-input-wrapper">
31 31
 				<textarea
32 32
 					id="<?php echo esc_attr( $this->meta_name ); ?>"
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 				</button>
41 41
 			</div>
42 42
 		<?php
43
-		$html = ob_get_clean();
43
+        $html = ob_get_clean();
44 44
 
45
-		return $html;
46
-	}
45
+        return $html;
46
+    }
47 47
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@
 block discarded – undo
23 23
 	/**
24 24
 	 * @inheritdoc
25 25
 	 */
26
-	public function html_input( $text ) {
26
+	public function html_input($text) {
27 27
         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
28 28
 		@ob_start();
29 29
 		?>
30 30
 			<div class="wl-input-wrapper">
31 31
 				<textarea
32
-					id="<?php echo esc_attr( $this->meta_name ); ?>"
33
-					class="<?php echo esc_attr( $this->meta_name ); ?>"
34
-					name="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][]"
32
+					id="<?php echo esc_attr($this->meta_name); ?>"
33
+					class="<?php echo esc_attr($this->meta_name); ?>"
34
+					name="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][]"
35 35
 					style="width:88%"
36
-				><?php echo esc_textarea( $text ); ?></textarea>
36
+				><?php echo esc_textarea($text); ?></textarea>
37 37
 
38 38
 				<button class="button wl-remove-input wl-button" type="button">
39
-					<?php esc_html_e( 'Remove', 'wordlift' ); ?>
39
+					<?php esc_html_e('Remove', 'wordlift'); ?>
40 40
 				</button>
41 41
 			</div>
42 42
 		<?php
Please login to merge, or discard this patch.
src/wordlift/metabox/field/class-wl-metabox-field-address.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -9,79 +9,79 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Wl_Metabox_Field_Address extends Wl_Metabox_Field {
11 11
 
12
-	/**
13
-	 * Sub-fields contained in the Field.
14
-	 *
15
-	 * @since 3.2.0
16
-	 * @access private
17
-	 * @var $subfields Array of WL_Metabox_Field objects, each dealing with a part of the http://schema.org/PostalAddress structure.
18
-	 */
19
-	private $subfields;
12
+    /**
13
+     * Sub-fields contained in the Field.
14
+     *
15
+     * @since 3.2.0
16
+     * @access private
17
+     * @var $subfields Array of WL_Metabox_Field objects, each dealing with a part of the http://schema.org/PostalAddress structure.
18
+     */
19
+    private $subfields;
20 20
 
21
-	/**
22
-	 * Constructor.
23
-	 *
24
-	 * @param array $args Set of fields containing info to build the subfields.
25
-	 * The structure of $args is:
26
-	 * array( 'address' => array( ... array of subfields ... ) )
27
-	 */
28
-	public function __construct( $args, $id, $type ) {
21
+    /**
22
+     * Constructor.
23
+     *
24
+     * @param array $args Set of fields containing info to build the subfields.
25
+     * The structure of $args is:
26
+     * array( 'address' => array( ... array of subfields ... ) )
27
+     */
28
+    public function __construct( $args, $id, $type ) {
29 29
 
30
-		$this->label = key( $args );
30
+        $this->label = key( $args );
31 31
 
32
-		// leverage the WL_Metabox_Field class to build the subfields
33
-		$this->subfields = array();
34
-		// Loop over subfields. Using 'reset' to take the data contained in the first element of $args
35
-		foreach ( reset( $args ) as $key => $subfield ) {
36
-			$this->subfields[] = new Wl_Metabox_Field( array( $key => $subfield ), $id, $type );
37
-		}
32
+        // leverage the WL_Metabox_Field class to build the subfields
33
+        $this->subfields = array();
34
+        // Loop over subfields. Using 'reset' to take the data contained in the first element of $args
35
+        foreach ( reset( $args ) as $key => $subfield ) {
36
+            $this->subfields[] = new Wl_Metabox_Field( array( $key => $subfield ), $id, $type );
37
+        }
38 38
 
39
-		// $_POST array key in which we will pass the values
40
-		$this->meta_name = 'wl_grouped_field_address';
41
-	}
39
+        // $_POST array key in which we will pass the values
40
+        $this->meta_name = 'wl_grouped_field_address';
41
+    }
42 42
 
43
-	/**
44
-	 * Load data from DB and store the resulting array in $this->data.
45
-	 */
46
-	public function get_data() {
43
+    /**
44
+     * Load data from DB and store the resulting array in $this->data.
45
+     */
46
+    public function get_data() {
47 47
 
48
-		foreach ( $this->subfields as $subfield ) {
49
-			$subfield->get_data();
50
-		}
51
-	}
48
+        foreach ( $this->subfields as $subfield ) {
49
+            $subfield->get_data();
50
+        }
51
+    }
52 52
 
53
-	/**
54
-	 * Save data to DB.
55
-	 *
56
-	 * @param array $values Values coming from $_POST and passed from WL_Metabox. We just send to each subfield its own value.
57
-	 */
58
-	public function save_data( $values ) {
53
+    /**
54
+     * Save data to DB.
55
+     *
56
+     * @param array $values Values coming from $_POST and passed from WL_Metabox. We just send to each subfield its own value.
57
+     */
58
+    public function save_data( $values ) {
59 59
 
60
-		foreach ( $this->subfields as $subfield ) {
61
-			$subfield_value = isset( $values[ $subfield->meta_name ] ) ? $values[ $subfield->meta_name ] : null;
62
-			$subfield->save_data( $subfield_value );
63
-		}
64
-	}
60
+        foreach ( $this->subfields as $subfield ) {
61
+            $subfield_value = isset( $values[ $subfield->meta_name ] ) ? $values[ $subfield->meta_name ] : null;
62
+            $subfield->save_data( $subfield_value );
63
+        }
64
+    }
65 65
 
66
-	/**
67
-	 * Returns Field HTML (nonce included).
68
-	 *
69
-	 * @return string Field HTML
70
-	 */
71
-	public function html() {
66
+    /**
67
+     * Returns Field HTML (nonce included).
68
+     *
69
+     * @return string Field HTML
70
+     */
71
+    public function html() {
72 72
         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
73
-		@ob_start();
74
-		// Open main <div> for the Field, then insert label and nonce
75
-		?>
73
+        @ob_start();
74
+        // Open main <div> for the Field, then insert label and nonce
75
+        ?>
76 76
 			<div class='wl-field'>
77 77
 			<h3><?php echo esc_attr( $this->label ); ?></h3>
78 78
 			<?php $this->html_nonce( true ); ?>
79 79
 
80 80
 		<?php
81
-		// print data loaded from DB
82
-		foreach ( $this->subfields as $subfield ) :
83
-			$value = isset( $subfield->data[0] ) ? $subfield->data[0] : '';
84
-			?>
81
+        // print data loaded from DB
82
+        foreach ( $this->subfields as $subfield ) :
83
+            $value = isset( $subfield->data[0] ) ? $subfield->data[0] : '';
84
+            ?>
85 85
 			<div class="wl-input-wrapper">
86 86
 				<label
87 87
 					for="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][<?php echo esc_attr( $subfield->meta_name ); ?>]"
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 				/>
99 99
 			</div>
100 100
 			<?php
101
-		endforeach;
102
-		$html = ob_get_clean();
101
+        endforeach;
102
+        $html = ob_get_clean();
103 103
 
104
-		// Close the HTML wrapper
105
-		$html .= $this->html_wrapper_close();
104
+        // Close the HTML wrapper
105
+        $html .= $this->html_wrapper_close();
106 106
 
107
-		return $html;
108
-	}
107
+        return $html;
108
+    }
109 109
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 	 * The structure of $args is:
26 26
 	 * array( 'address' => array( ... array of subfields ... ) )
27 27
 	 */
28
-	public function __construct( $args, $id, $type ) {
28
+	public function __construct($args, $id, $type) {
29 29
 
30
-		$this->label = key( $args );
30
+		$this->label = key($args);
31 31
 
32 32
 		// leverage the WL_Metabox_Field class to build the subfields
33 33
 		$this->subfields = array();
34 34
 		// Loop over subfields. Using 'reset' to take the data contained in the first element of $args
35
-		foreach ( reset( $args ) as $key => $subfield ) {
36
-			$this->subfields[] = new Wl_Metabox_Field( array( $key => $subfield ), $id, $type );
35
+		foreach (reset($args) as $key => $subfield) {
36
+			$this->subfields[] = new Wl_Metabox_Field(array($key => $subfield), $id, $type);
37 37
 		}
38 38
 
39 39
 		// $_POST array key in which we will pass the values
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function get_data() {
47 47
 
48
-		foreach ( $this->subfields as $subfield ) {
48
+		foreach ($this->subfields as $subfield) {
49 49
 			$subfield->get_data();
50 50
 		}
51 51
 	}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param array $values Values coming from $_POST and passed from WL_Metabox. We just send to each subfield its own value.
57 57
 	 */
58
-	public function save_data( $values ) {
58
+	public function save_data($values) {
59 59
 
60
-		foreach ( $this->subfields as $subfield ) {
61
-			$subfield_value = isset( $values[ $subfield->meta_name ] ) ? $values[ $subfield->meta_name ] : null;
62
-			$subfield->save_data( $subfield_value );
60
+		foreach ($this->subfields as $subfield) {
61
+			$subfield_value = isset($values[$subfield->meta_name]) ? $values[$subfield->meta_name] : null;
62
+			$subfield->save_data($subfield_value);
63 63
 		}
64 64
 	}
65 65
 
@@ -74,26 +74,26 @@  discard block
 block discarded – undo
74 74
 		// Open main <div> for the Field, then insert label and nonce
75 75
 		?>
76 76
 			<div class='wl-field'>
77
-			<h3><?php echo esc_attr( $this->label ); ?></h3>
78
-			<?php $this->html_nonce( true ); ?>
77
+			<h3><?php echo esc_attr($this->label); ?></h3>
78
+			<?php $this->html_nonce(true); ?>
79 79
 
80 80
 		<?php
81 81
 		// print data loaded from DB
82
-		foreach ( $this->subfields as $subfield ) :
83
-			$value = isset( $subfield->data[0] ) ? $subfield->data[0] : '';
82
+		foreach ($this->subfields as $subfield) :
83
+			$value = isset($subfield->data[0]) ? $subfield->data[0] : '';
84 84
 			?>
85 85
 			<div class="wl-input-wrapper">
86 86
 				<label
87
-					for="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][<?php echo esc_attr( $subfield->meta_name ); ?>]"
87
+					for="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][<?php echo esc_attr($subfield->meta_name); ?>]"
88 88
 					style="display:inline-block; width:20%;"
89 89
 				>
90
-					<?php echo esc_html( $subfield->label ); ?>
90
+					<?php echo esc_html($subfield->label); ?>
91 91
 				</label>
92 92
 
93 93
 				<input
94 94
 					type="text"
95
-					name="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][<?php echo esc_attr( $subfield->meta_name ); ?>]"
96
-					value="<?php echo esc_attr( $value ); ?>"
95
+					name="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][<?php echo esc_attr($subfield->meta_name); ?>]"
96
+					value="<?php echo esc_attr($value); ?>"
97 97
 					style="width:78%;"
98 98
 				/>
99 99
 			</div>
Please login to merge, or discard this patch.