Completed
Push — master ( 3c99ea...a5a7ca )
by
unknown
18s
created
uninstall.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 // If uninstall, not called from WordPress, then exit.
11 11
 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 // TODO: Define uninstall functionality here.
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-transients.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Transients', false ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Transients
16
-	 */
17
-	class Redux_Transients extends Redux_Class {
14
+    /**
15
+     * Class Redux_Transients
16
+     */
17
+    class Redux_Transients extends Redux_Class {
18 18
 
19
-		/**
20
-		 * Get transients from database.
21
-		 */
22
-		public function get() {
23
-			$core = $this->core();
19
+        /**
20
+         * Get transients from database.
21
+         */
22
+        public function get() {
23
+            $core = $this->core();
24 24
 
25
-			if ( empty( $core->transients ) ) {
26
-				$core->transients = get_option( $core->args['opt_name'] . '-transients', array() );
27
-			}
28
-		}
25
+            if ( empty( $core->transients ) ) {
26
+                $core->transients = get_option( $core->args['opt_name'] . '-transients', array() );
27
+            }
28
+        }
29 29
 
30
-		/**
31
-		 * Set transients in database.
32
-		 */
33
-		public function set() {
34
-			$core = $this->core();
30
+        /**
31
+         * Set transients in database.
32
+         */
33
+        public function set() {
34
+            $core = $this->core();
35 35
 
36
-			if ( ! isset( $core->transients ) || ! isset( $core->transients_check ) || $core->transients_check !== $core->transients ) {
37
-				update_option( $core->args['opt_name'] . '-transients', $core->transients );
38
-			}
39
-		}
40
-	}
36
+            if ( ! isset( $core->transients ) || ! isset( $core->transients_check ) || $core->transients_check !== $core->transients ) {
37
+                update_option( $core->args['opt_name'] . '-transients', $core->transients );
38
+            }
39
+        }
40
+    }
41 41
 }
Please login to merge, or discard this patch.
redux-core/inc/themecheck/checks/class-redux-embedded.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -14,67 +14,67 @@
 block discarded – undo
14 14
  */
15 15
 class Redux_Embedded implements themecheck {
16 16
 
17
-	/**
18
-	 * Error array.
19
-	 *
20
-	 * @var array
21
-	 */
22
-	protected array $error = array();
17
+    /**
18
+     * Error array.
19
+     *
20
+     * @var array
21
+     */
22
+    protected array $error = array();
23 23
 
24
-	/**
25
-	 * Run checker.
26
-	 *
27
-	 * @param array $php_files - Files to check.
28
-	 * @param array $css_files - Files to check.
29
-	 * @param array $other_files - Files to check.
30
-	 *
31
-	 * @return bool
32
-	 */
33
-	public function check( $php_files, $css_files, $other_files ): bool {
24
+    /**
25
+     * Run checker.
26
+     *
27
+     * @param array $php_files - Files to check.
28
+     * @param array $css_files - Files to check.
29
+     * @param array $other_files - Files to check.
30
+     *
31
+     * @return bool
32
+     */
33
+    public function check( $php_files, $css_files, $other_files ): bool {
34 34
 
35
-		$ret   = true;
36
-		$check = Redux_ThemeCheck::get_instance();
37
-		$redux = $check::get_redux_details( $php_files );
35
+        $ret   = true;
36
+        $check = Redux_ThemeCheck::get_instance();
37
+        $redux = $check::get_redux_details( $php_files );
38 38
 
39
-		if ( $redux ) {
40
-			checkcount();
39
+        if ( $redux ) {
40
+            checkcount();
41 41
 
42
-			if ( ! isset( $_POST['redux_wporg'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
43
-				$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'If you are submitting to WordPress.org Theme Repository, it is', 'redux-framework' ) . ' <strong>' . esc_html__( 'strongly', 'redux-framework' ) . '</strong> ' . esc_html__( 'suggested that you read', 'redux-framework' ) . ' <a href="%s" target="_blank">' . esc_html__( 'this document', 'redux-framework' ) . '</a>, ' . esc_html__( 'or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docsv3.redux.io/core/wordpress-org-submissions/' ) . '</div>';
44
-				$ret           = false;
45
-			} else {
46
-				// TODO Granular WP.org tests!!!
47
-				// Check for Tracking.
48
-				$tracking = $redux['dir'] . 'inc/tracking.php';
49
-				if ( file_exists( $tracking ) ) {
50
-					$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-required">' . esc_html__( 'REQUIRED', 'redux-framework' ) . '</span>: ' . esc_html__( 'You MUST delete', 'redux-framework' ) . ' <strong> %s </strong>, ' . esc_html__( 'or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework' ), $tracking ) . '</div>';
51
-					$ret           = false;
52
-				}
42
+            if ( ! isset( $_POST['redux_wporg'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
43
+                $this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'If you are submitting to WordPress.org Theme Repository, it is', 'redux-framework' ) . ' <strong>' . esc_html__( 'strongly', 'redux-framework' ) . '</strong> ' . esc_html__( 'suggested that you read', 'redux-framework' ) . ' <a href="%s" target="_blank">' . esc_html__( 'this document', 'redux-framework' ) . '</a>, ' . esc_html__( 'or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docsv3.redux.io/core/wordpress-org-submissions/' ) . '</div>';
44
+                $ret           = false;
45
+            } else {
46
+                // TODO Granular WP.org tests!!!
47
+                // Check for Tracking.
48
+                $tracking = $redux['dir'] . 'inc/tracking.php';
49
+                if ( file_exists( $tracking ) ) {
50
+                    $this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-required">' . esc_html__( 'REQUIRED', 'redux-framework' ) . '</span>: ' . esc_html__( 'You MUST delete', 'redux-framework' ) . ' <strong> %s </strong>, ' . esc_html__( 'or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework' ), $tracking ) . '</div>';
51
+                    $ret           = false;
52
+                }
53 53
 
54
-				// Embedded CDN package
55
-				// use_cdn
56
-				// Arguments.
57
-				$args          = '<ol>';
58
-				$args         .= "<li><code>'save_defaults' => false</code></li>";
59
-				$args         .= "<li><code>'use_cdn' => false</code></li>";
60
-				$args         .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
61
-				$args         .= "<li><code>'database' => 'theme_mods'</code> (' . esc_html__( 'Optional', 'redux-framework' ) . ')</li>";
62
-				$args         .= '</ol>';
63
-				$this->error[] = '<div class="redux-error"><span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '</div>';
64
-			}
65
-		}
54
+                // Embedded CDN package
55
+                // use_cdn
56
+                // Arguments.
57
+                $args          = '<ol>';
58
+                $args         .= "<li><code>'save_defaults' => false</code></li>";
59
+                $args         .= "<li><code>'use_cdn' => false</code></li>";
60
+                $args         .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
61
+                $args         .= "<li><code>'database' => 'theme_mods'</code> (' . esc_html__( 'Optional', 'redux-framework' ) . ')</li>";
62
+                $args         .= '</ol>';
63
+                $this->error[] = '<div class="redux-error"><span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '</div>';
64
+            }
65
+        }
66 66
 
67
-		return $ret;
68
-	}
67
+        return $ret;
68
+    }
69 69
 
70
-	/**
71
-	 * Return error array.
72
-	 *
73
-	 * @return array
74
-	 */
75
-	public function getError(): array {
76
-		return $this->error;
77
-	}
70
+    /**
71
+     * Return error array.
72
+     *
73
+     * @return array
74
+     */
75
+    public function getError(): array {
76
+        return $this->error;
77
+    }
78 78
 
79 79
 }
80 80
 
Please login to merge, or discard this patch.
redux-core/inc/fields/divide/class-redux-divide.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,46 +12,46 @@
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_Divide', false ) ) {
14 14
 
15
-	/**
16
-	 * Main Redux_divide class
17
-	 *
18
-	 * @since       1.0.0
19
-	 */
20
-	class Redux_Divide extends Redux_Field {
15
+    /**
16
+     * Main Redux_divide class
17
+     *
18
+     * @since       1.0.0
19
+     */
20
+    class Redux_Divide extends Redux_Field {
21 21
 
22
-		/**
23
-		 * Field Render Function.
24
-		 * Takes the vars and outputs the HTML for the field in the settings
25
-		 *
26
-		 * @since         1.0.0
27
-		 * @access        public
28
-		 * @return        void
29
-		 */
30
-		public function render() {
31
-			echo '</td></tr></table>';
32
-			echo '<div data-id="' . esc_attr( $this->field['id'] ) . '" id="divide-' . esc_attr( $this->field['id'] ) . '" class="divide ' . esc_attr( $this->field['class'] ) . '"><div class="inner"><span>&nbsp;</span></div></div>';
33
-			echo '<table class="form-table no-border"><tbody><tr><th></th><td>';
34
-		}
22
+        /**
23
+         * Field Render Function.
24
+         * Takes the vars and outputs the HTML for the field in the settings
25
+         *
26
+         * @since         1.0.0
27
+         * @access        public
28
+         * @return        void
29
+         */
30
+        public function render() {
31
+            echo '</td></tr></table>';
32
+            echo '<div data-id="' . esc_attr( $this->field['id'] ) . '" id="divide-' . esc_attr( $this->field['id'] ) . '" class="divide ' . esc_attr( $this->field['class'] ) . '"><div class="inner"><span>&nbsp;</span></div></div>';
33
+            echo '<table class="form-table no-border"><tbody><tr><th></th><td>';
34
+        }
35 35
 
36
-		/**
37
-		 * Enqueue Function.
38
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
39
-		 *
40
-		 * @since       1.0.0
41
-		 * @access      public
42
-		 * @return      void
43
-		 */
44
-		public function enqueue() {
45
-			if ( $this->parent->args['dev_mode'] ) {
46
-				wp_enqueue_style(
47
-					'redux-field-divide',
48
-					Redux_Core::$url . 'inc/fields/divide/redux-divide.css',
49
-					array(),
50
-					$this->timestamp
51
-				);
52
-			}
53
-		}
54
-	}
36
+        /**
37
+         * Enqueue Function.
38
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
39
+         *
40
+         * @since       1.0.0
41
+         * @access      public
42
+         * @return      void
43
+         */
44
+        public function enqueue() {
45
+            if ( $this->parent->args['dev_mode'] ) {
46
+                wp_enqueue_style(
47
+                    'redux-field-divide',
48
+                    Redux_Core::$url . 'inc/fields/divide/redux-divide.css',
49
+                    array(),
50
+                    $this->timestamp
51
+                );
52
+            }
53
+        }
54
+    }
55 55
 }
56 56
 
57 57
 class_alias( 'Redux_Divide', 'ReduxFramework_Divide' );
Please login to merge, or discard this patch.
redux-core/inc/fields/password/class-redux-password.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -11,67 +11,67 @@  discard block
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Password', false ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Password
16
-	 */
17
-	class Redux_Password extends Redux_Field {
14
+    /**
15
+     * Class Redux_Password
16
+     */
17
+    class Redux_Password extends Redux_Field {
18 18
 
19
-		/**
20
-		 * Field Render Function.
21
-		 * Takes the vars and outputs the HTML for the field in the settings
22
-		 *
23
-		 * @since ReduxFramework 1.0.1
24
-		 */
25
-		public function render() {
26
-			if ( ! empty( $this->field['username'] ) && true === $this->field['username'] ) {
27
-				$this->render_combined_field();
28
-			} else {
29
-				$this->render_single_field();
30
-			}
31
-		}
19
+        /**
20
+         * Field Render Function.
21
+         * Takes the vars and outputs the HTML for the field in the settings
22
+         *
23
+         * @since ReduxFramework 1.0.1
24
+         */
25
+        public function render() {
26
+            if ( ! empty( $this->field['username'] ) && true === $this->field['username'] ) {
27
+                $this->render_combined_field();
28
+            } else {
29
+                $this->render_single_field();
30
+            }
31
+        }
32 32
 
33
-		/**
34
-		 * This will render a combined User/Password field
35
-		 *
36
-		 * @since ReduxFramework 3.0.9
37
-		 * @example
38
-		 *        <code>
39
-		 *        array(
40
-		 *        'id'          => 'smtp_account',
41
-		 *        'type'        => 'password',
42
-		 *        'username'    => true,
43
-		 *        'title'       => 'SMTP Account',
44
-		 *        'placeholder' => array('username' => 'Username')
45
-		 *        )
46
-		 *        </code>
47
-		 */
48
-		private function render_combined_field() {
49
-			$defaults = array(
50
-				'username'    => '',
51
-				'password'    => '',
52
-				'placeholder' => array(
53
-					'password' => esc_html__( 'Password', 'redux-framework' ),
54
-					'username' => esc_html__( 'Username', 'redux-framework' ),
55
-				),
56
-			);
33
+        /**
34
+         * This will render a combined User/Password field
35
+         *
36
+         * @since ReduxFramework 3.0.9
37
+         * @example
38
+         *        <code>
39
+         *        array(
40
+         *        'id'          => 'smtp_account',
41
+         *        'type'        => 'password',
42
+         *        'username'    => true,
43
+         *        'title'       => 'SMTP Account',
44
+         *        'placeholder' => array('username' => 'Username')
45
+         *        )
46
+         *        </code>
47
+         */
48
+        private function render_combined_field() {
49
+            $defaults = array(
50
+                'username'    => '',
51
+                'password'    => '',
52
+                'placeholder' => array(
53
+                    'password' => esc_html__( 'Password', 'redux-framework' ),
54
+                    'username' => esc_html__( 'Username', 'redux-framework' ),
55
+                ),
56
+            );
57 57
 
58
-			$this->value = wp_parse_args( $this->value, $defaults );
58
+            $this->value = wp_parse_args( $this->value, $defaults );
59 59
 
60
-			if ( ! empty( $this->field['placeholder'] ) ) {
61
-				if ( is_array( $this->field['placeholder'] ) ) {
62
-					if ( ! empty( $this->field['placeholder']['password'] ) ) {
63
-						$this->value['placeholder']['password'] = $this->field['placeholder']['password'];
64
-					}
65
-					if ( ! empty( $this->field['placeholder']['username'] ) ) {
66
-						$this->value['placeholder']['username'] = $this->field['placeholder']['username'];
67
-					}
68
-				} else {
69
-					$this->value['placeholder']['password'] = $this->field['placeholder'];
70
-				}
71
-			}
60
+            if ( ! empty( $this->field['placeholder'] ) ) {
61
+                if ( is_array( $this->field['placeholder'] ) ) {
62
+                    if ( ! empty( $this->field['placeholder']['password'] ) ) {
63
+                        $this->value['placeholder']['password'] = $this->field['placeholder']['password'];
64
+                    }
65
+                    if ( ! empty( $this->field['placeholder']['username'] ) ) {
66
+                        $this->value['placeholder']['username'] = $this->field['placeholder']['username'];
67
+                    }
68
+                } else {
69
+                    $this->value['placeholder']['password'] = $this->field['placeholder'];
70
+                }
71
+            }
72 72
 
73
-			// Username field.
74
-			echo '<input 
73
+            // Username field.
74
+            echo '<input 
75 75
 					type="text" 
76 76
 					autocomplete="off" 
77 77
 					placeholder="' . esc_attr( $this->value['placeholder']['username'] ) . '" 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 					value="' . esc_attr( $this->value['username'] ) . '" 
81 81
 					class="' . esc_attr( $this->field['class'] ) . '" />&nbsp;';
82 82
 
83
-			// Password field.
84
-			echo '<input 
83
+            // Password field.
84
+            echo '<input 
85 85
 					type="password" 
86 86
 					autocomplete="off" 
87 87
 					placeholder="' . esc_attr( $this->value['placeholder']['password'] ) . '" 
@@ -89,30 +89,30 @@  discard block
 block discarded – undo
89 89
 					name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[password]" 
90 90
 					value="' . esc_attr( $this->value['password'] ) . '" 
91 91
 					class="' . esc_attr( $this->field['class'] ) . '" />';
92
-		}
92
+        }
93 93
 
94
-		/**
95
-		 * This will render a single Password field
96
-		 *
97
-		 * @since ReduxFramework 3.0.9
98
-		 * @example
99
-		 *        <code>
100
-		 *        array(
101
-		 *        'id'    => 'smtp_password',
102
-		 *        'type'  => 'password',
103
-		 *        'title' => 'SMTP Password'
104
-		 *        )
105
-		 *        </code>
106
-		 */
107
-		private function render_single_field() {
108
-			echo '<input 
94
+        /**
95
+         * This will render a single Password field
96
+         *
97
+         * @since ReduxFramework 3.0.9
98
+         * @example
99
+         *        <code>
100
+         *        array(
101
+         *        'id'    => 'smtp_password',
102
+         *        'type'  => 'password',
103
+         *        'title' => 'SMTP Password'
104
+         *        )
105
+         *        </code>
106
+         */
107
+        private function render_single_field() {
108
+            echo '<input 
109 109
 					type="password" 
110 110
 					id="' . esc_attr( $this->field['id'] ) . '" 
111 111
 					name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" 
112 112
 					value="' . esc_attr( $this->value ) . '" 
113 113
 					class="' . esc_attr( $this->field['class'] ) . '" />';
114
-		}
115
-	}
114
+        }
115
+    }
116 116
 }
117 117
 
118 118
 class_alias( 'Redux_Password', 'ReduxFramework_Password' );
Please login to merge, or discard this patch.
inc/validation/preg_replace/class-redux-validation-preg-replace.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 
13 13
 if ( ! class_exists( 'Redux_Validation_Preg_Replace', false ) ) {
14 14
 
15
-	/**
16
-	 * Class Redux_Validation_Preg_Replace
17
-	 */
18
-	class Redux_Validation_Preg_Replace extends Redux_Validate {
15
+    /**
16
+     * Class Redux_Validation_Preg_Replace
17
+     */
18
+    class Redux_Validation_Preg_Replace extends Redux_Validate {
19 19
 
20
-		/**
21
-		 * Field Validate Function.
22
-		 * Takes the vars and validates them
23
-		 *
24
-		 * @since ReduxFramework 1.0.0
25
-		 */
26
-		public function validate() {
27
-			$that                   = $this;
28
-			$this->value            = preg_replace( $this->field['preg']['pattern'], $that->field['preg']['replacement'], $this->value );
29
-			$this->field['current'] = $this->value;
20
+        /**
21
+         * Field Validate Function.
22
+         * Takes the vars and validates them
23
+         *
24
+         * @since ReduxFramework 1.0.0
25
+         */
26
+        public function validate() {
27
+            $that                   = $this;
28
+            $this->value            = preg_replace( $this->field['preg']['pattern'], $that->field['preg']['replacement'], $this->value );
29
+            $this->field['current'] = $this->value;
30 30
 
31
-			$this->sanitize = $this->field;
32
-		}
33
-	}
31
+            $this->sanitize = $this->field;
32
+        }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
inc/validation/str_replace/class-redux-validation-str-replace.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@
 block discarded – undo
12 12
 
13 13
 if ( ! class_exists( 'Redux_Validation_Str_Replace', false ) ) {
14 14
 
15
-	/**
16
-	 * Class Redux_Validation_Str_Replace
17
-	 */
18
-	class Redux_Validation_Str_Replace extends Redux_Validate {
15
+    /**
16
+     * Class Redux_Validation_Str_Replace
17
+     */
18
+    class Redux_Validation_Str_Replace extends Redux_Validate {
19 19
 
20
-		/**
21
-		 * Field Validate Function.
22
-		 * Takes the vars and validates them
23
-		 *
24
-		 * @since ReduxFramework 1.0.0
25
-		 */
26
-		public function validate() {
27
-			$this->value = str_replace( $this->field['str']['search'], $this->field['str']['replacement'], $this->value );
20
+        /**
21
+         * Field Validate Function.
22
+         * Takes the vars and validates them
23
+         *
24
+         * @since ReduxFramework 1.0.0
25
+         */
26
+        public function validate() {
27
+            $this->value = str_replace( $this->field['str']['search'], $this->field['str']['replacement'], $this->value );
28 28
 
29
-			$this->field['current'] = $this->value;
30
-			$this->sanitize         = $this->field;
31
-		}
32
-	}
29
+            $this->field['current'] = $this->value;
30
+            $this->sanitize         = $this->field;
31
+        }
32
+    }
33 33
 }
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-sanitize.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -11,119 +11,119 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Sanitize', false ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Sanitize
16
-	 */
17
-	class Redux_Sanitize extends Redux_Class {
18
-
19
-		/**
20
-		 * Sanitize values from options form (used in settings api validate function)
21
-		 *
22
-		 * @since       4.0.0
23
-		 * @access      public
24
-		 *
25
-		 * @param       array $plugin_options Plugin Options.
26
-		 * @param       array $options Options.
27
-		 * @param       array $sections Sections array.
28
-		 *
29
-		 * @return      array $plugin_options
30
-		 */
31
-		public function sanitize( array $plugin_options, array $options, array $sections ): array {
32
-			$core = $this->core();
33
-
34
-			foreach ( $sections as $k => $section ) {
35
-				if ( isset( $section['fields'] ) ) {
36
-					foreach ( $section['fields'] as $field ) {
37
-
38
-						if ( is_array( $field ) ) {
39
-							$field['section_id'] = $k;
40
-						}
41
-
42
-						if ( isset( $field['type'] ) && ( 'text' === $field['type'] || 'textarea' === $field['type'] || 'multi_text' === $field['type'] ) ) {
43
-
44
-							// Make sure 'sanitize' field is set.
45
-							if ( isset( $field['sanitize'] ) ) {
46
-
47
-								// Can we make this an array of validations?
48
-								$val_arr = array();
49
-
50
-								if ( is_array( $field['sanitize'] ) ) {
51
-									$val_arr = $field['sanitize'];
52
-								} else {
53
-									$val_arr[] = $field['sanitize'];
54
-								}
55
-
56
-								foreach ( $val_arr as $function ) {
57
-
58
-									// Check for empty id value.
59
-									if ( ! isset( $field['id'] ) || ! isset( $plugin_options[ $field['id'] ] ) || ( '' === $plugin_options[ $field['id'] ] ) ) {
60
-										continue;
61
-									}
62
-
63
-									if ( function_exists( $function ) ) {
64
-										if ( empty( $options[ $field['id'] ] ) ) {
65
-											$options[ $field['id'] ] = '';
66
-										}
67
-
68
-										if ( is_array( $plugin_options[ $field['id'] ] ) && ! empty( $plugin_options[ $field['id'] ] ) ) {
69
-											foreach ( $plugin_options[ $field['id'] ] as $key => $value ) {
70
-												$before = null;
71
-												$after  = null;
72
-
73
-												if ( isset( $plugin_options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
74
-													if ( is_array( $plugin_options[ $field['id'] ][ $key ] ) ) {
75
-														$before = $plugin_options[ $field['id'] ][ $key ];
76
-													} else {
77
-														$before = trim( $plugin_options[ $field['id'] ][ $key ] );
78
-													}
79
-												}
80
-
81
-												if ( isset( $options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
82
-													$after = $options[ $field['id'] ][ $key ];
83
-												}
84
-
85
-												$value = call_user_func( $function, $before );
86
-
87
-												if ( false !== $value ) {
88
-													$plugin_options[ $field['id'] ][ $key ] = $value;
89
-												} else {
90
-													unset( $plugin_options[ $field['id'] ][ $key ] );
91
-												}
92
-
93
-												$field['current'] = $value;
94
-
95
-												$core->sanitize[] = $field;
96
-											}
97
-										} else {
98
-											if ( isset( $plugin_options[ $field['id'] ] ) ) {
99
-												if ( is_array( $plugin_options[ $field['id'] ] ) ) {
100
-													$pofi = $plugin_options[ $field['id'] ];
101
-												} else {
102
-													$pofi = trim( $plugin_options[ $field['id'] ] );
103
-												}
104
-											} else {
105
-												$pofi = null;
106
-											}
107
-
108
-											$value = call_user_func( $function, $pofi );
109
-
110
-											$plugin_options[ $field['id'] ] = $value;
111
-
112
-											$field['current'] = $value;
113
-
114
-											$core->sanitize[] = $field;
115
-										}
116
-
117
-										break;
118
-									}
119
-								}
120
-							}
121
-						}
122
-					}
123
-				}
124
-			}
125
-
126
-			return $plugin_options;
127
-		}
128
-	}
14
+    /**
15
+     * Class Redux_Sanitize
16
+     */
17
+    class Redux_Sanitize extends Redux_Class {
18
+
19
+        /**
20
+         * Sanitize values from options form (used in settings api validate function)
21
+         *
22
+         * @since       4.0.0
23
+         * @access      public
24
+         *
25
+         * @param       array $plugin_options Plugin Options.
26
+         * @param       array $options Options.
27
+         * @param       array $sections Sections array.
28
+         *
29
+         * @return      array $plugin_options
30
+         */
31
+        public function sanitize( array $plugin_options, array $options, array $sections ): array {
32
+            $core = $this->core();
33
+
34
+            foreach ( $sections as $k => $section ) {
35
+                if ( isset( $section['fields'] ) ) {
36
+                    foreach ( $section['fields'] as $field ) {
37
+
38
+                        if ( is_array( $field ) ) {
39
+                            $field['section_id'] = $k;
40
+                        }
41
+
42
+                        if ( isset( $field['type'] ) && ( 'text' === $field['type'] || 'textarea' === $field['type'] || 'multi_text' === $field['type'] ) ) {
43
+
44
+                            // Make sure 'sanitize' field is set.
45
+                            if ( isset( $field['sanitize'] ) ) {
46
+
47
+                                // Can we make this an array of validations?
48
+                                $val_arr = array();
49
+
50
+                                if ( is_array( $field['sanitize'] ) ) {
51
+                                    $val_arr = $field['sanitize'];
52
+                                } else {
53
+                                    $val_arr[] = $field['sanitize'];
54
+                                }
55
+
56
+                                foreach ( $val_arr as $function ) {
57
+
58
+                                    // Check for empty id value.
59
+                                    if ( ! isset( $field['id'] ) || ! isset( $plugin_options[ $field['id'] ] ) || ( '' === $plugin_options[ $field['id'] ] ) ) {
60
+                                        continue;
61
+                                    }
62
+
63
+                                    if ( function_exists( $function ) ) {
64
+                                        if ( empty( $options[ $field['id'] ] ) ) {
65
+                                            $options[ $field['id'] ] = '';
66
+                                        }
67
+
68
+                                        if ( is_array( $plugin_options[ $field['id'] ] ) && ! empty( $plugin_options[ $field['id'] ] ) ) {
69
+                                            foreach ( $plugin_options[ $field['id'] ] as $key => $value ) {
70
+                                                $before = null;
71
+                                                $after  = null;
72
+
73
+                                                if ( isset( $plugin_options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
74
+                                                    if ( is_array( $plugin_options[ $field['id'] ][ $key ] ) ) {
75
+                                                        $before = $plugin_options[ $field['id'] ][ $key ];
76
+                                                    } else {
77
+                                                        $before = trim( $plugin_options[ $field['id'] ][ $key ] );
78
+                                                    }
79
+                                                }
80
+
81
+                                                if ( isset( $options[ $field['id'] ][ $key ] ) && ( ! empty( $plugin_options[ $field['id'] ][ $key ] ) || '0' === $plugin_options[ $field['id'] ][ $key ] ) ) {
82
+                                                    $after = $options[ $field['id'] ][ $key ];
83
+                                                }
84
+
85
+                                                $value = call_user_func( $function, $before );
86
+
87
+                                                if ( false !== $value ) {
88
+                                                    $plugin_options[ $field['id'] ][ $key ] = $value;
89
+                                                } else {
90
+                                                    unset( $plugin_options[ $field['id'] ][ $key ] );
91
+                                                }
92
+
93
+                                                $field['current'] = $value;
94
+
95
+                                                $core->sanitize[] = $field;
96
+                                            }
97
+                                        } else {
98
+                                            if ( isset( $plugin_options[ $field['id'] ] ) ) {
99
+                                                if ( is_array( $plugin_options[ $field['id'] ] ) ) {
100
+                                                    $pofi = $plugin_options[ $field['id'] ];
101
+                                                } else {
102
+                                                    $pofi = trim( $plugin_options[ $field['id'] ] );
103
+                                                }
104
+                                            } else {
105
+                                                $pofi = null;
106
+                                            }
107
+
108
+                                            $value = call_user_func( $function, $pofi );
109
+
110
+                                            $plugin_options[ $field['id'] ] = $value;
111
+
112
+                                            $field['current'] = $value;
113
+
114
+                                            $core->sanitize[] = $field;
115
+                                        }
116
+
117
+                                        break;
118
+                                    }
119
+                                }
120
+                            }
121
+                        }
122
+                    }
123
+                }
124
+            }
125
+
126
+            return $plugin_options;
127
+        }
128
+    }
129 129
 }
Please login to merge, or discard this patch.
redux-templates/classes/class-template-overrides.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Template_Overrides {
20 20
 
21
-	/**
22
-	 * ReduxTemplates Template_Overrides.
23
-	 *
24
-	 * @since 4.0.0
25
-	 */
26
-	public function __construct() {
27
-	}
28
-
29
-	/**
30
-	 * Detects if the current page has blocks or not.
31
-	 *
32
-	 * @return bool
33
-	 * @since 4.0.0
34
-	 */
35
-	public static function is_gutenberg(): bool {
36
-		global $post;
37
-		if ( function_exists( 'has_blocks' ) && has_blocks( $post->ID ) ) {
38
-			return true;
39
-		}
40
-
41
-		return false;
42
-	}
43
-
44
-	/**
45
-	 * Detects the current theme and provides overrides.
46
-	 *
47
-	 * @return string
48
-	 * @since 4.0.0
49
-	 */
50
-	public static function get_overrides(): string {
51
-
52
-		if ( ! self::is_gutenberg() ) {
53
-			return '';
54
-		}
55
-
56
-		$template = mb_strtolower( get_template() );
57
-
58
-		$css = '';
59
-		if ( method_exists( __CLASS__, $template ) ) {
60
-			$css = call_user_func( array( __CLASS__, $template ) );
61
-			$css = preg_replace( '/\s+/S', ' ', $css );
62
-		}
63
-
64
-		$css .= <<<'EOD'
21
+    /**
22
+     * ReduxTemplates Template_Overrides.
23
+     *
24
+     * @since 4.0.0
25
+     */
26
+    public function __construct() {
27
+    }
28
+
29
+    /**
30
+     * Detects if the current page has blocks or not.
31
+     *
32
+     * @return bool
33
+     * @since 4.0.0
34
+     */
35
+    public static function is_gutenberg(): bool {
36
+        global $post;
37
+        if ( function_exists( 'has_blocks' ) && has_blocks( $post->ID ) ) {
38
+            return true;
39
+        }
40
+
41
+        return false;
42
+    }
43
+
44
+    /**
45
+     * Detects the current theme and provides overrides.
46
+     *
47
+     * @return string
48
+     * @since 4.0.0
49
+     */
50
+    public static function get_overrides(): string {
51
+
52
+        if ( ! self::is_gutenberg() ) {
53
+            return '';
54
+        }
55
+
56
+        $template = mb_strtolower( get_template() );
57
+
58
+        $css = '';
59
+        if ( method_exists( __CLASS__, $template ) ) {
60
+            $css = call_user_func( array( __CLASS__, $template ) );
61
+            $css = preg_replace( '/\s+/S', ' ', $css );
62
+        }
63
+
64
+        $css .= <<<'EOD'
65 65
 			#main {
66 66
 				padding: unset !important;
67 67
 			}
@@ -78,68 +78,68 @@  discard block
 block discarded – undo
78 78
 			}
79 79
 }
80 80
 EOD;
81
-		// Remove comments.
82
-		$css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
83
-		// Remove space after colons.
84
-		$css = str_replace( ': ', ':', $css );
85
-		// Remove space after commas.
86
-		$css = str_replace( ', ', ',', $css );
87
-		// Remove space after opening bracket.
88
-		$css = str_replace( ' {', '{', $css );
89
-		// Remove whitespace.
90
-		return str_replace( array( "\r\n", "\r", "\n", "\t", '  ', '    ', '    ' ), '', $css );
91
-	}
92
-
93
-	/**
94
-	 * Consulting theme overrides.
95
-	 *
96
-	 * @return string
97
-	 * @since 4.0.0
98
-	 */
99
-	public static function consulting(): string {
100
-		return <<<'EOD'
81
+        // Remove comments.
82
+        $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
83
+        // Remove space after colons.
84
+        $css = str_replace( ': ', ':', $css );
85
+        // Remove space after commas.
86
+        $css = str_replace( ', ', ',', $css );
87
+        // Remove space after opening bracket.
88
+        $css = str_replace( ' {', '{', $css );
89
+        // Remove whitespace.
90
+        return str_replace( array( "\r\n", "\r", "\n", "\t", '  ', '    ', '    ' ), '', $css );
91
+    }
92
+
93
+    /**
94
+     * Consulting theme overrides.
95
+     *
96
+     * @return string
97
+     * @since 4.0.0
98
+     */
99
+    public static function consulting(): string {
100
+        return <<<'EOD'
101 101
 			#content-core {
102 102
 				max-width: 100%;
103 103
 			}
104 104
 EOD;
105
-	}
106
-
107
-	/**
108
-	 * Avada theme overrides.
109
-	 *
110
-	 * @return string
111
-	 * @since 4.0.0
112
-	 */
113
-	public static function avada(): string {
114
-		return <<<'EOD'
105
+    }
106
+
107
+    /**
108
+     * Avada theme overrides.
109
+     *
110
+     * @return string
111
+     * @since 4.0.0
112
+     */
113
+    public static function avada(): string {
114
+        return <<<'EOD'
115 115
 			#main .fusion-row {
116 116
 				max-width: unset;
117 117
 			}
118 118
 EOD;
119
-	}
120
-
121
-	/**
122
-	 * GeneratePress theme overrides.
123
-	 *
124
-	 * @return string
125
-	 * @since 4.1.24
126
-	 */
127
-	public static function generatepress(): string {
128
-		return <<<'EOD'
119
+    }
120
+
121
+    /**
122
+     * GeneratePress theme overrides.
123
+     *
124
+     * @return string
125
+     * @since 4.1.24
126
+     */
127
+    public static function generatepress(): string {
128
+        return <<<'EOD'
129 129
 			.site-content {
130 130
                             display: block!important;
131 131
                         }
132 132
 EOD;
133
-	}
134
-
135
-	/**
136
-	 * TwentyTwenty theme overrides.
137
-	 *
138
-	 * @return string
139
-	 * @since 4.0.0
140
-	 */
141
-	public static function twentytwenty(): string {
142
-		return <<<'EOD'
133
+    }
134
+
135
+    /**
136
+     * TwentyTwenty theme overrides.
137
+     *
138
+     * @return string
139
+     * @since 4.0.0
140
+     */
141
+    public static function twentytwenty(): string {
142
+        return <<<'EOD'
143 143
 			[class*="__inner-container"] > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide) {
144 144
 				max-width: unset !important;
145 145
 			}
@@ -148,6 +148,6 @@  discard block
 block discarded – undo
148 148
 				margin-bottom: unset;
149 149
 			}
150 150
 EOD;
151
-	}
151
+    }
152 152
 
153 153
 }
Please login to merge, or discard this patch.