Completed
Push — master ( 3c99ea...a5a7ca )
by
unknown
18s
created
inc/extensions/import_export/import_export/class-redux-import-export.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -12,71 +12,71 @@  discard block
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_Import_Export', false ) ) {
14 14
 
15
-	/**
16
-	 * Main Redux_import_export class
17
-	 *
18
-	 * @since       1.0.0
19
-	 */
20
-	class Redux_Import_Export extends Redux_Field {
15
+    /**
16
+     * Main Redux_import_export class
17
+     *
18
+     * @since       1.0.0
19
+     */
20
+    class Redux_Import_Export extends Redux_Field {
21 21
 
22
-		/**
23
-		 * Is field.
24
-		 *
25
-		 * @var bool
26
-		 */
27
-		public $is_field;
22
+        /**
23
+         * Is field.
24
+         *
25
+         * @var bool
26
+         */
27
+        public $is_field;
28 28
 
29
-		/**
30
-		 * Redux_Import_Export constructor.
31
-		 *
32
-		 * @param array  $field  Field array.
33
-		 * @param string $value  Value array.
34
-		 * @param object $redux ReduxFramework object.
35
-		 *
36
-		 * @throws ReflectionException .
37
-		 */
38
-		public function __construct( $field, $value, $redux ) {
39
-			parent::__construct( $field, $value, $redux );
29
+        /**
30
+         * Redux_Import_Export constructor.
31
+         *
32
+         * @param array  $field  Field array.
33
+         * @param string $value  Value array.
34
+         * @param object $redux ReduxFramework object.
35
+         *
36
+         * @throws ReflectionException .
37
+         */
38
+        public function __construct( $field, $value, $redux ) {
39
+            parent::__construct( $field, $value, $redux );
40 40
 
41
-			$this->is_field = $this->parent->extensions['import_export']->is_field;
42
-		}
41
+            $this->is_field = $this->parent->extensions['import_export']->is_field;
42
+        }
43 43
 
44
-		/**
45
-		 * Set field defaults.
46
-		 */
47
-		public function set_defaults() {
48
-			// Set default args for this field to avoid bad indexes. Change this to anything you use.
49
-			$defaults = array(
50
-				'options'          => array(),
51
-				'stylesheet'       => '',
52
-				'output'           => true,
53
-				'enqueue'          => true,
54
-				'enqueue_frontend' => true,
55
-			);
44
+        /**
45
+         * Set field defaults.
46
+         */
47
+        public function set_defaults() {
48
+            // Set default args for this field to avoid bad indexes. Change this to anything you use.
49
+            $defaults = array(
50
+                'options'          => array(),
51
+                'stylesheet'       => '',
52
+                'output'           => true,
53
+                'enqueue'          => true,
54
+                'enqueue_frontend' => true,
55
+            );
56 56
 
57
-			$this->field = wp_parse_args( $this->field, $defaults );
58
-		}
57
+            $this->field = wp_parse_args( $this->field, $defaults );
58
+        }
59 59
 
60
-		/**
61
-		 * Field Render Function.
62
-		 * Takes the vars and outputs the HTML for the field in the settings
63
-		 *
64
-		 * @return      void
65
-		 * @since       1.0.0
66
-		 * @access      public
67
-		 */
68
-		public function render() {
69
-			$secret = wp_create_nonce( 'redux_io_' . $this->parent->args['opt_name'] );
60
+        /**
61
+         * Field Render Function.
62
+         * Takes the vars and outputs the HTML for the field in the settings
63
+         *
64
+         * @return      void
65
+         * @since       1.0.0
66
+         * @access      public
67
+         */
68
+        public function render() {
69
+            $secret = wp_create_nonce( 'redux_io_' . $this->parent->args['opt_name'] );
70 70
 
71
-			// No errors, please.
72
-			$defaults = array(
73
-				'full_width' => true,
74
-				'overflow'   => 'inherit',
75
-			);
71
+            // No errors, please.
72
+            $defaults = array(
73
+                'full_width' => true,
74
+                'overflow'   => 'inherit',
75
+            );
76 76
 
77
-			$this->field = wp_parse_args( $this->field, $defaults );
77
+            $this->field = wp_parse_args( $this->field, $defaults );
78 78
 
79
-			?>
79
+            ?>
80 80
 			<h4><?php esc_html_e( 'Import Options', 'redux-framework' ); ?></h4>
81 81
 			<p>
82 82
 				<a
@@ -142,44 +142,44 @@  discard block
 block discarded – undo
142 142
 			<p></p>
143 143
 			<label for="redux-export-code"></label><textarea class="large-text no-update" id="redux-export-code" rows="1"></textarea>
144 144
 			<?php
145
-		}
145
+        }
146 146
 
147
-		/**
148
-		 * Enqueue Function.
149
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
150
-		 *
151
-		 * @return      void
152
-		 * @since       1.0.0
153
-		 * @access      public
154
-		 */
155
-		public function enqueue() {
156
-			wp_enqueue_script(
157
-				'redux-extension-import-export',
158
-				$this->url . 'redux-import-export' . Redux_Functions::is_min() . '.js',
159
-				array(
160
-					'jquery',
161
-					'redux-js',
162
-				),
163
-				Redux_Extension_Import_Export::$version,
164
-				true
165
-			);
147
+        /**
148
+         * Enqueue Function.
149
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
150
+         *
151
+         * @return      void
152
+         * @since       1.0.0
153
+         * @access      public
154
+         */
155
+        public function enqueue() {
156
+            wp_enqueue_script(
157
+                'redux-extension-import-export',
158
+                $this->url . 'redux-import-export' . Redux_Functions::is_min() . '.js',
159
+                array(
160
+                    'jquery',
161
+                    'redux-js',
162
+                ),
163
+                Redux_Extension_Import_Export::$version,
164
+                true
165
+            );
166 166
 
167
-			wp_localize_script(
168
-				'redux-extension-import-export',
169
-				'ImportExport',
170
-				array(
171
-					'unchanged_values' => esc_html__( 'Your panel has unchanged values, would you like to save them now?', 'redux-framework' ),
172
-				)
173
-			);
167
+            wp_localize_script(
168
+                'redux-extension-import-export',
169
+                'ImportExport',
170
+                array(
171
+                    'unchanged_values' => esc_html__( 'Your panel has unchanged values, would you like to save them now?', 'redux-framework' ),
172
+                )
173
+            );
174 174
 
175
-			if ( $this->parent->args['dev_mode'] ) {
176
-				wp_enqueue_style(
177
-					'redux-import-export',
178
-					$this->url . 'redux-import-export.css',
179
-					array(),
180
-					Redux_Extension_Import_Export::$version
181
-				);
182
-			}
183
-		}
184
-	}
175
+            if ( $this->parent->args['dev_mode'] ) {
176
+                wp_enqueue_style(
177
+                    'redux-import-export',
178
+                    $this->url . 'redux-import-export.css',
179
+                    array(),
180
+                    Redux_Extension_Import_Export::$version
181
+                );
182
+            }
183
+        }
184
+    }
185 185
 }
Please login to merge, or discard this patch.
inc/extensions/import_export/class-redux-extension-import-export.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,9 +144,9 @@
 block discarded – undo
144 144
 		 */
145 145
 		public function remove_cookie() {
146 146
 			// Remove the import/export tab cookie.
147
-			if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) && 'import_export_default' === $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) {
147
+			if ( isset( $_COOKIE['redux_current_tab_' . $this->parent->args['opt_name']] ) && 'import_export_default' === $_COOKIE['redux_current_tab_' . $this->parent->args['opt_name']] ) {
148 148
 				setcookie( 'redux_current_tab_' . $this->parent->args['opt_name'], '', 1, '/' );
149
-				$_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] = 1;
149
+				$_COOKIE['redux_current_tab_' . $this->parent->args['opt_name']] = 1;
150 150
 			}
151 151
 		}
152 152
 	}
Please login to merge, or discard this patch.
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -14,146 +14,146 @@
 block discarded – undo
14 14
 // Don't duplicate me!
15 15
 if ( ! class_exists( 'Redux_Extension_Import_Export', false ) ) {
16 16
 
17
-	/**
18
-	 * Main ReduxFramework import_export extension class
19
-	 *
20
-	 * @since       3.1.6
21
-	 */
22
-	class Redux_Extension_Import_Export extends Redux_Extension_Abstract {
23
-
24
-		/**
25
-		 * Ext version.
26
-		 *
27
-		 * @var string
28
-		 */
29
-		public static $version = '4.0.0';
30
-
31
-		/**
32
-		 * Is field bit.
33
-		 *
34
-		 * @var bool
35
-		 */
36
-		public bool $is_field = false;
37
-
38
-		/**
39
-		 * Class Constructor. Defines the args for the extensions class
40
-		 *
41
-		 * @param object $redux ReduxFramework object.
42
-		 *
43
-		 * @return      void
44
-		 * @since       1.0.0
45
-		 * @access      public
46
-		 */
47
-		public function __construct( $redux ) {
48
-			parent::__construct( $redux, __FILE__ );
49
-
50
-			$this->add_field( 'import_export' );
51
-
52
-			add_action( 'wp_ajax_redux_download_options-' . $this->parent->args['opt_name'], array( $this, 'download_options' ) );
53
-			add_action( 'wp_ajax_nopriv_redux_download_options-' . $this->parent->args['opt_name'], array( $this, 'download_options' ) );
54
-
55
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
56
-			do_action( 'redux/options/' . $this->parent->args['opt_name'] . '/import', array( $this, 'remove_cookie' ) );
57
-
58
-			$this->is_field = Redux_Helpers::is_field_in_use( $redux, 'import_export' );
59
-
60
-			if ( ! $this->is_field && $this->parent->args['show_import_export'] ) {
61
-				$this->add_section();
62
-			}
63
-
64
-			add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
65
-		}
66
-
67
-		/**
68
-		 * Adds the appropriate mime types to WordPress
69
-		 *
70
-		 * @param array|null $existing_mimes .
71
-		 *
72
-		 * @return array
73
-		 */
74
-		public function custom_upload_mimes( ?array $existing_mimes = array() ): array {
75
-			$existing_mimes['redux'] = 'application/redux';
76
-
77
-			return $existing_mimes;
78
-		}
79
-
80
-		/**
81
-		 * Add section to panel.
82
-		 */
83
-		public function add_section() {
84
-			$this->parent->sections[] = array(
85
-				'id'         => 'import/export',
86
-				'title'      => esc_html__( 'Import / Export', 'redux-framework' ),
87
-				'heading'    => '',
88
-				'icon'       => 'el el-refresh',
89
-				'customizer' => false,
90
-				'fields'     => array(
91
-					array(
92
-						'id'         => 'redux_import_export',
93
-						'type'       => 'import_export',
94
-						'full_width' => true,
95
-					),
96
-				),
97
-			);
98
-		}
99
-
100
-		/**
101
-		 * Import download options.
102
-		 */
103
-		public function download_options() {
104
-			if ( ! isset( $_GET['secret'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['secret'] ) ), 'redux_io_' . $this->parent->args['opt_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
105
-				wp_die( 'Invalid Secret for options use.' );
106
-			}
107
-
108
-			$this->parent->options_class->get();
109
-			$backup_options                 = $this->parent->options;
110
-			$backup_options['redux-backup'] = 1;
111
-
112
-			if ( isset( $backup_options['REDUX_imported'] ) ) {
113
-				unset( $backup_options['REDUX_imported'] );
114
-			}
115
-
116
-			// No need to escape this, as it's been properly escaped previously and through json_encode.
117
-			$content = wp_json_encode( $backup_options );
118
-
119
-			if ( isset( $_GET['action'] ) && 'redux_download_options-' . $this->parent->args['opt_name'] === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
120
-				header( 'Content-Description: File Transfer' );
121
-				header( 'Content-type: application/txt' );
122
-				header( 'Content-Disposition: attachment; filename="redux_options_"' . $this->parent->args['opt_name'] . '_backup_' . gmdate( 'm-d-Y' ) . '.json' );
123
-				header( 'Content-Transfer-Encoding: binary' );
124
-				header( 'Expires: 0' );
125
-				header( 'Cache-Control: must-revalidate' );
126
-				header( 'Pragma: public' );
127
-			} else {
128
-				header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
129
-				header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . 'GMT' );
130
-				header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
131
-				header( 'Cache-Control: no-store, no-cache, must-revalidate' );
132
-				header( 'Cache-Control: post-check=0, pre-check=0', false );
133
-				header( 'Pragma: no-cache' );
134
-
135
-				// Can't include the type. Thanks old Firefox and IE. BAH.
136
-				// header('Content-type: application/json');.
137
-			}
138
-
139
-			// phpcs:ignore WordPress.Security.EscapeOutput
140
-			echo( $content );
141
-			exit;
142
-		}
143
-
144
-		/**
145
-		 * Remove current tab cookie.
146
-		 */
147
-		public function remove_cookie() {
148
-			// Remove the import/export tab cookie.
149
-			if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) && 'import_export_default' === $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) {
150
-				setcookie( 'redux_current_tab_' . $this->parent->args['opt_name'], '', 1, '/' );
151
-				$_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] = 1;
152
-			}
153
-		}
154
-	}
17
+    /**
18
+     * Main ReduxFramework import_export extension class
19
+     *
20
+     * @since       3.1.6
21
+     */
22
+    class Redux_Extension_Import_Export extends Redux_Extension_Abstract {
23
+
24
+        /**
25
+         * Ext version.
26
+         *
27
+         * @var string
28
+         */
29
+        public static $version = '4.0.0';
30
+
31
+        /**
32
+         * Is field bit.
33
+         *
34
+         * @var bool
35
+         */
36
+        public bool $is_field = false;
37
+
38
+        /**
39
+         * Class Constructor. Defines the args for the extensions class
40
+         *
41
+         * @param object $redux ReduxFramework object.
42
+         *
43
+         * @return      void
44
+         * @since       1.0.0
45
+         * @access      public
46
+         */
47
+        public function __construct( $redux ) {
48
+            parent::__construct( $redux, __FILE__ );
49
+
50
+            $this->add_field( 'import_export' );
51
+
52
+            add_action( 'wp_ajax_redux_download_options-' . $this->parent->args['opt_name'], array( $this, 'download_options' ) );
53
+            add_action( 'wp_ajax_nopriv_redux_download_options-' . $this->parent->args['opt_name'], array( $this, 'download_options' ) );
54
+
55
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
56
+            do_action( 'redux/options/' . $this->parent->args['opt_name'] . '/import', array( $this, 'remove_cookie' ) );
57
+
58
+            $this->is_field = Redux_Helpers::is_field_in_use( $redux, 'import_export' );
59
+
60
+            if ( ! $this->is_field && $this->parent->args['show_import_export'] ) {
61
+                $this->add_section();
62
+            }
63
+
64
+            add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
65
+        }
66
+
67
+        /**
68
+         * Adds the appropriate mime types to WordPress
69
+         *
70
+         * @param array|null $existing_mimes .
71
+         *
72
+         * @return array
73
+         */
74
+        public function custom_upload_mimes( ?array $existing_mimes = array() ): array {
75
+            $existing_mimes['redux'] = 'application/redux';
76
+
77
+            return $existing_mimes;
78
+        }
79
+
80
+        /**
81
+         * Add section to panel.
82
+         */
83
+        public function add_section() {
84
+            $this->parent->sections[] = array(
85
+                'id'         => 'import/export',
86
+                'title'      => esc_html__( 'Import / Export', 'redux-framework' ),
87
+                'heading'    => '',
88
+                'icon'       => 'el el-refresh',
89
+                'customizer' => false,
90
+                'fields'     => array(
91
+                    array(
92
+                        'id'         => 'redux_import_export',
93
+                        'type'       => 'import_export',
94
+                        'full_width' => true,
95
+                    ),
96
+                ),
97
+            );
98
+        }
99
+
100
+        /**
101
+         * Import download options.
102
+         */
103
+        public function download_options() {
104
+            if ( ! isset( $_GET['secret'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['secret'] ) ), 'redux_io_' . $this->parent->args['opt_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
105
+                wp_die( 'Invalid Secret for options use.' );
106
+            }
107
+
108
+            $this->parent->options_class->get();
109
+            $backup_options                 = $this->parent->options;
110
+            $backup_options['redux-backup'] = 1;
111
+
112
+            if ( isset( $backup_options['REDUX_imported'] ) ) {
113
+                unset( $backup_options['REDUX_imported'] );
114
+            }
115
+
116
+            // No need to escape this, as it's been properly escaped previously and through json_encode.
117
+            $content = wp_json_encode( $backup_options );
118
+
119
+            if ( isset( $_GET['action'] ) && 'redux_download_options-' . $this->parent->args['opt_name'] === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
120
+                header( 'Content-Description: File Transfer' );
121
+                header( 'Content-type: application/txt' );
122
+                header( 'Content-Disposition: attachment; filename="redux_options_"' . $this->parent->args['opt_name'] . '_backup_' . gmdate( 'm-d-Y' ) . '.json' );
123
+                header( 'Content-Transfer-Encoding: binary' );
124
+                header( 'Expires: 0' );
125
+                header( 'Cache-Control: must-revalidate' );
126
+                header( 'Pragma: public' );
127
+            } else {
128
+                header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
129
+                header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . 'GMT' );
130
+                header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
131
+                header( 'Cache-Control: no-store, no-cache, must-revalidate' );
132
+                header( 'Cache-Control: post-check=0, pre-check=0', false );
133
+                header( 'Pragma: no-cache' );
134
+
135
+                // Can't include the type. Thanks old Firefox and IE. BAH.
136
+                // header('Content-type: application/json');.
137
+            }
138
+
139
+            // phpcs:ignore WordPress.Security.EscapeOutput
140
+            echo( $content );
141
+            exit;
142
+        }
143
+
144
+        /**
145
+         * Remove current tab cookie.
146
+         */
147
+        public function remove_cookie() {
148
+            // Remove the import/export tab cookie.
149
+            if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) && 'import_export_default' === $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) {
150
+                setcookie( 'redux_current_tab_' . $this->parent->args['opt_name'], '', 1, '/' );
151
+                $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] = 1;
152
+            }
153
+        }
154
+    }
155 155
 }
156 156
 
157 157
 if ( ! class_exists( 'ReduxFramework_extension_import_export' ) ) {
158
-	class_alias( 'Redux_Extension_Import_Export', 'ReduxFramework_extension_import_export' );
158
+    class_alias( 'Redux_Extension_Import_Export', 'ReduxFramework_extension_import_export' );
159 159
 }
Please login to merge, or discard this patch.
redux-core/inc/extensions/accordion/accordion/class-redux-accordion.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -12,112 +12,112 @@
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_Accordion' ) ) {
14 14
 
15
-	/**
16
-	 * Main ReduxFramework_Accordion class
17
-	 *
18
-	 * @since       1.0.0
19
-	 */
20
-	class Redux_Accordion extends Redux_Field {
21
-
22
-		/**
23
-		 * Set field defaults.
24
-		 */
25
-		public function set_defaults() {
26
-			$defaults = array(
27
-				'position'   => 'end',
28
-				'style'      => '',
29
-				'class'      => '',
30
-				'title'      => '',
31
-				'subtitle'   => '',
32
-				'open'       => '',
33
-				'open-icon'  => 'el-plus',
34
-				'close-icon' => 'el-minus',
35
-			);
36
-
37
-			$this->field = wp_parse_args( $this->field, $defaults );
38
-		}
39
-
40
-		/**
41
-		 * Field Render Function.
42
-		 * Takes the vars and outputs the HTML for the field in the settings
43
-		 *
44
-		 * @since       1.0.0
45
-		 * @access      public
46
-		 * @return      void
47
-		 */
48
-		public function render() {
49
-			$guid      = uniqid();
50
-			$field_pos = '';
51
-			$add_class = '';
52
-
53
-			// primary container.
54
-			if ( 'start' === $this->field['position'] ) {
55
-				$add_class = ' form-table-accordion';
56
-				$field_pos = 'start';
57
-			} elseif ( 'end' === $this->field['position'] ) {
58
-				$add_class = ' hide';
59
-				$field_pos = 'end';
60
-			}
61
-
62
-			echo '<input type="hidden" id="accordion-' . esc_attr( $this->field['id'] ) . '-marker" data-open-icon="' . esc_attr( $this->field['open-icon'] ) . '" data-close-icon="' . esc_attr( $this->field['close-icon'] ) . '"></td></tr></table>';
63
-
64
-			$is_open = false;
65
-			if ( isset( $this->field['open'] ) && true === $this->field['open'] ) {
66
-				$is_open = true;
67
-			}
68
-
69
-			echo '<div data-state="' . esc_attr( $is_open ) . '" data-position="' . esc_attr( $field_pos ) . '" id="' . esc_attr( $this->field['id'] ) . '" class="redux-accordion-field redux-field ' . esc_attr( $this->field['style'] ) . esc_attr( $this->field['class'] ) . '">';
70
-			echo '<div class="control">';
71
-			echo '<div class="redux-accordion-info' . esc_attr( $add_class ) . '">';
72
-
73
-			if ( ! empty( $this->field['title'] ) ) {
74
-				echo '<h3>' . esc_html( $this->field['title'] ) . '</h3>';
75
-			}
76
-
77
-			$icon_class = '';
78
-			if ( ! empty( $this->field['subtitle'] ) ) {
79
-				echo '<div class="redux-accordion-desc">' . esc_html( $this->field['subtitle'] ) . '</div>';
80
-				$icon_class = ' subtitled';
81
-			}
82
-
83
-			echo '<span class="el el-plus' . esc_attr( $icon_class ) . '"></span>';
84
-			echo '</div>';
85
-			echo '</div>';
86
-			echo '</div>';
87
-			echo '<table id="accordion-table-' . esc_attr( $this->field['id'] ) . '" data-id="' . esc_attr( $this->field['id'] ) . '" class="form-table form-table-accordion no-border' . esc_attr( $add_class ) . '"><tbody><tr class="hide"><th></th><td id="' . esc_attr( $guid ) . '">';
88
-		}
89
-
90
-		/**
91
-		 * Enqueue Function.
92
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
93
-		 *
94
-		 * @since       1.0.0
95
-		 * @access      public
96
-		 * @return      void
97
-		 */
98
-		public function enqueue() {
99
-
100
-			// Set up min files for dev_mode = false.
101
-			$min = Redux_Functions::isMin();
102
-
103
-			// Field dependent JS.
104
-			wp_enqueue_script(
105
-				'redux-field-accordion',
106
-				$this->url . 'redux-accordion' . $min . '.js',
107
-				array( 'jquery', 'redux-js' ),
108
-				Redux_Extension_Accordion::$version,
109
-				true
110
-			);
111
-
112
-			// Field CSS.
113
-			if ( $this->parent->args['dev_mode'] ) {
114
-				wp_enqueue_style(
115
-					'redux-field-accordion',
116
-					$this->url . 'redux-accordion.css',
117
-					array(),
118
-					Redux_Extension_Accordion::$version
119
-				);
120
-			}
121
-		}
122
-	}
15
+    /**
16
+     * Main ReduxFramework_Accordion class
17
+     *
18
+     * @since       1.0.0
19
+     */
20
+    class Redux_Accordion extends Redux_Field {
21
+
22
+        /**
23
+         * Set field defaults.
24
+         */
25
+        public function set_defaults() {
26
+            $defaults = array(
27
+                'position'   => 'end',
28
+                'style'      => '',
29
+                'class'      => '',
30
+                'title'      => '',
31
+                'subtitle'   => '',
32
+                'open'       => '',
33
+                'open-icon'  => 'el-plus',
34
+                'close-icon' => 'el-minus',
35
+            );
36
+
37
+            $this->field = wp_parse_args( $this->field, $defaults );
38
+        }
39
+
40
+        /**
41
+         * Field Render Function.
42
+         * Takes the vars and outputs the HTML for the field in the settings
43
+         *
44
+         * @since       1.0.0
45
+         * @access      public
46
+         * @return      void
47
+         */
48
+        public function render() {
49
+            $guid      = uniqid();
50
+            $field_pos = '';
51
+            $add_class = '';
52
+
53
+            // primary container.
54
+            if ( 'start' === $this->field['position'] ) {
55
+                $add_class = ' form-table-accordion';
56
+                $field_pos = 'start';
57
+            } elseif ( 'end' === $this->field['position'] ) {
58
+                $add_class = ' hide';
59
+                $field_pos = 'end';
60
+            }
61
+
62
+            echo '<input type="hidden" id="accordion-' . esc_attr( $this->field['id'] ) . '-marker" data-open-icon="' . esc_attr( $this->field['open-icon'] ) . '" data-close-icon="' . esc_attr( $this->field['close-icon'] ) . '"></td></tr></table>';
63
+
64
+            $is_open = false;
65
+            if ( isset( $this->field['open'] ) && true === $this->field['open'] ) {
66
+                $is_open = true;
67
+            }
68
+
69
+            echo '<div data-state="' . esc_attr( $is_open ) . '" data-position="' . esc_attr( $field_pos ) . '" id="' . esc_attr( $this->field['id'] ) . '" class="redux-accordion-field redux-field ' . esc_attr( $this->field['style'] ) . esc_attr( $this->field['class'] ) . '">';
70
+            echo '<div class="control">';
71
+            echo '<div class="redux-accordion-info' . esc_attr( $add_class ) . '">';
72
+
73
+            if ( ! empty( $this->field['title'] ) ) {
74
+                echo '<h3>' . esc_html( $this->field['title'] ) . '</h3>';
75
+            }
76
+
77
+            $icon_class = '';
78
+            if ( ! empty( $this->field['subtitle'] ) ) {
79
+                echo '<div class="redux-accordion-desc">' . esc_html( $this->field['subtitle'] ) . '</div>';
80
+                $icon_class = ' subtitled';
81
+            }
82
+
83
+            echo '<span class="el el-plus' . esc_attr( $icon_class ) . '"></span>';
84
+            echo '</div>';
85
+            echo '</div>';
86
+            echo '</div>';
87
+            echo '<table id="accordion-table-' . esc_attr( $this->field['id'] ) . '" data-id="' . esc_attr( $this->field['id'] ) . '" class="form-table form-table-accordion no-border' . esc_attr( $add_class ) . '"><tbody><tr class="hide"><th></th><td id="' . esc_attr( $guid ) . '">';
88
+        }
89
+
90
+        /**
91
+         * Enqueue Function.
92
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
93
+         *
94
+         * @since       1.0.0
95
+         * @access      public
96
+         * @return      void
97
+         */
98
+        public function enqueue() {
99
+
100
+            // Set up min files for dev_mode = false.
101
+            $min = Redux_Functions::isMin();
102
+
103
+            // Field dependent JS.
104
+            wp_enqueue_script(
105
+                'redux-field-accordion',
106
+                $this->url . 'redux-accordion' . $min . '.js',
107
+                array( 'jquery', 'redux-js' ),
108
+                Redux_Extension_Accordion::$version,
109
+                true
110
+            );
111
+
112
+            // Field CSS.
113
+            if ( $this->parent->args['dev_mode'] ) {
114
+                wp_enqueue_style(
115
+                    'redux-field-accordion',
116
+                    $this->url . 'redux-accordion.css',
117
+                    array(),
118
+                    Redux_Extension_Accordion::$version
119
+                );
120
+            }
121
+        }
122
+    }
123 123
 }
Please login to merge, or discard this patch.
inc/extensions/multi_media/multi_media/class-redux-multi-media.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 
54 54
 						foreach ( $exp_arr as $ext ) {
55 55
 							if ( in_array( $ext, $lib_array, true ) ) {
56
-								$json_arr[ $ext ] = $type;
56
+								$json_arr[$ext] = $type;
57 57
 							}
58 58
 						}
59 59
 					} elseif ( in_array( $ext, $lib_array, true ) ) {
60
-						$json_arr[ $ext ] = $type;
60
+						$json_arr[$ext] = $type;
61 61
 					}
62 62
 				}
63 63
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 						$part_count = count( $parts );
139 139
 
140 140
 						for ( $i = 0; $i < $part_count; ++$i ) {
141
-							$title = $parts[ $i ];
141
+							$title = $parts[$i];
142 142
 						}
143 143
 
144 144
 						// Add file to array.
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 			$ext_arr = array( 'jpg', 'jpeg', 'png', 'gif', 'ico', 'icon' );
211 211
 
212
-			$valid = empty( $valid ) ? (array) apply_filters( 'redux_valid_img_types', $ext_arr ) : $valid;
212
+			$valid = empty( $valid ) ? ( array ) apply_filters( 'redux_valid_img_types', $ext_arr ) : $valid;
213 213
 
214 214
 			return ( $file_ext && in_array( $file_ext, $valid, true ) );
215 215
 		}
Please login to merge, or discard this patch.
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -11,276 +11,276 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Multi_Media' ) ) {
13 13
 
14
-	/**
15
-	 * Main ReduxFramework_multi_media class
16
-	 *
17
-	 * @since       1.0.0
18
-	 */
19
-	class Redux_Multi_Media extends Redux_Field {
20
-
21
-		/**
22
-		 * Field Render Function.
23
-		 * Takes the vars and outputs the HTML for the field in the settings
24
-		 *
25
-		 * @since       1.0.0
26
-		 * @access      public
27
-		 * @return      void
28
-		 */
29
-		public function render() {
30
-			$field_id = $this->field['id'];
31
-
32
-			$button_text    = $this->field['labels']['button'] ?? esc_html__( 'Add or Upload File(s)', 'redux-framework' );
33
-			$max_file_count = $this->field['max_file_upload'] ?? 0;
34
-
35
-			// Set library filter data, if it's set.
36
-			if ( ! isset( $this->field['library_filter'] ) ) {
37
-				$lib_filter = '';
38
-			} else {
39
-				if ( ! is_array( $this->field['library_filter'] ) ) {
40
-					$this->field['library_filter'] = array( $this->field['library_filter'] );
41
-				}
42
-
43
-				$mime_types = get_allowed_mime_types();
44
-
45
-				$lib_array = $this->field['library_filter'];
46
-
47
-				$json_arr = array();
48
-
49
-				// Enum mime types.
50
-				foreach ( $mime_types as $ext => $type ) {
51
-					if ( strpos( $ext, '|' ) ) {
52
-						$exp_arr = explode( '|', $ext );
53
-
54
-						foreach ( $exp_arr as $ext ) {
55
-							if ( in_array( $ext, $lib_array, true ) ) {
56
-								$json_arr[ $ext ] = $type;
57
-							}
58
-						}
59
-					} elseif ( in_array( $ext, $lib_array, true ) ) {
60
-						$json_arr[ $ext ] = $type;
61
-					}
62
-				}
63
-
64
-				// Encode for transit to JS.
65
-				$lib_filter = rawurlencode( wp_json_encode( $json_arr ) );
66
-			}
67
-
68
-			// primary container.
69
-			echo '<div
14
+    /**
15
+     * Main ReduxFramework_multi_media class
16
+     *
17
+     * @since       1.0.0
18
+     */
19
+    class Redux_Multi_Media extends Redux_Field {
20
+
21
+        /**
22
+         * Field Render Function.
23
+         * Takes the vars and outputs the HTML for the field in the settings
24
+         *
25
+         * @since       1.0.0
26
+         * @access      public
27
+         * @return      void
28
+         */
29
+        public function render() {
30
+            $field_id = $this->field['id'];
31
+
32
+            $button_text    = $this->field['labels']['button'] ?? esc_html__( 'Add or Upload File(s)', 'redux-framework' );
33
+            $max_file_count = $this->field['max_file_upload'] ?? 0;
34
+
35
+            // Set library filter data, if it's set.
36
+            if ( ! isset( $this->field['library_filter'] ) ) {
37
+                $lib_filter = '';
38
+            } else {
39
+                if ( ! is_array( $this->field['library_filter'] ) ) {
40
+                    $this->field['library_filter'] = array( $this->field['library_filter'] );
41
+                }
42
+
43
+                $mime_types = get_allowed_mime_types();
44
+
45
+                $lib_array = $this->field['library_filter'];
46
+
47
+                $json_arr = array();
48
+
49
+                // Enum mime types.
50
+                foreach ( $mime_types as $ext => $type ) {
51
+                    if ( strpos( $ext, '|' ) ) {
52
+                        $exp_arr = explode( '|', $ext );
53
+
54
+                        foreach ( $exp_arr as $ext ) {
55
+                            if ( in_array( $ext, $lib_array, true ) ) {
56
+                                $json_arr[ $ext ] = $type;
57
+                            }
58
+                        }
59
+                    } elseif ( in_array( $ext, $lib_array, true ) ) {
60
+                        $json_arr[ $ext ] = $type;
61
+                    }
62
+                }
63
+
64
+                // Encode for transit to JS.
65
+                $lib_filter = rawurlencode( wp_json_encode( $json_arr ) );
66
+            }
67
+
68
+            // primary container.
69
+            echo '<div
70 70
 					class="redux-multi-media-container' . esc_attr( $this->field['class'] ) . '"
71 71
 					id="' . esc_attr( $field_id ) . '"
72 72
 					data-max-file-upload="' . intval( $max_file_count ) . '"
73 73
 					data-id="' . esc_attr( $field_id ) . '">';
74 74
 
75
-			// Library filter.
76
-			echo '<input type="hidden" class="library-filter" data-lib-filter="' . $lib_filter . '" />'; // phpcs:ignore WordPress.Security.EscapeOutput
75
+            // Library filter.
76
+            echo '<input type="hidden" class="library-filter" data-lib-filter="' . $lib_filter . '" />'; // phpcs:ignore WordPress.Security.EscapeOutput
77 77
 
78
-			// Hidden inout for file(s).
79
-			echo '<input
78
+            // Hidden inout for file(s).
79
+            echo '<input
80 80
 					data-name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '"
81 81
 					id="' . esc_attr( $field_id ) . '-multi-media"
82 82
 					class="redux_upload_file redux_upload_list"
83 83
 					type="hidden"
84 84
 					size="45" />';
85 85
 
86
-			// Upload button.
87
-			echo '<input
86
+            // Upload button.
87
+            echo '<input
88 88
 					type="button"
89 89
 					class="redux_upload_button button redux_upload_list"
90 90
 					name=""
91 91
 					id="' . esc_attr( $field_id ) . '-multi-media-upload"
92 92
 					value="' . esc_attr( $button_text ) . '" />';
93 93
 
94
-			// list container.
95
-			echo '<ul id="' . esc_attr( $this->parent->args['opt_name'] ) . '_' . esc_attr( $field_id ) . '_status" class="redux_media_status attach_list">';
94
+            // list container.
95
+            echo '<ul id="' . esc_attr( $this->parent->args['opt_name'] ) . '_' . esc_attr( $field_id ) . '_status" class="redux_media_status attach_list">';
96 96
 
97
-			$file_arr = array();
98
-			$img_arr  = array();
99
-			$all_arr  = array();
97
+            $file_arr = array();
98
+            $img_arr  = array();
99
+            $all_arr  = array();
100 100
 
101
-			// Check for file entries in array format.
102
-			if ( $this->value && is_array( $this->value ) ) {
101
+            // Check for file entries in array format.
102
+            if ( $this->value && is_array( $this->value ) ) {
103 103
 
104
-				// Enum existing file entries.
105
-				foreach ( $this->value as $id => $url ) {
104
+                // Enum existing file entries.
105
+                foreach ( $this->value as $id => $url ) {
106 106
 
107
-					// hidden ID input.
108
-					$id_input = '<input
107
+                    // hidden ID input.
108
+                    $id_input = '<input
109 109
                                     type="hidden"
110 110
                                     value="' . $url . '"
111 111
                                     name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[' . intval( $id ) . ']"
112 112
                                     id="filelist-' . $id . '"
113 113
                                     class="" />';
114 114
 
115
-					// Check for a valid image extension.
116
-					if ( $this->is_valid_img_ext( $url ) ) {
117
-
118
-						// Add image to array.
119
-						$html  = '<li class="img_status">';
120
-						$html .= wp_get_attachment_image( $id, array( 50, 50 ) );
121
-						$html .= '<p class="redux_remove_wrapper">';
122
-						$html .= '<a href="#" class="redux_remove_file_button">' . esc_html__( 'Remove Image', 'redux-framework' ) . '</a>';
123
-						$html .= '</p>';
124
-						$html .= $id_input;
125
-						$html .= '</li>';
126
-
127
-						$img_arr[] = $html;
128
-
129
-						// No image?  Output standard file info.
130
-					} else {
131
-
132
-						// Get parts of URL.
133
-						$parts = explode( '/', $url );
134
-
135
-						// Get the filename.
136
-						$title      = '';
137
-						$part_count = count( $parts );
138
-
139
-						for ( $i = 0; $i < $part_count; ++$i ) {
140
-							$title = $parts[ $i ];
141
-						}
142
-
143
-						// Add file to array.
144
-						$html  = '<li>';
145
-						$html .= esc_html__( 'File: ', 'redux-framework' );
146
-						$html .= '<strong>' . $title . '</strong>&nbsp;&nbsp;&nbsp;';
147
-						$html .= '(<a href="' . $url . '" target="_blank" rel="external">' . esc_html__( 'Download', 'redux-framework' ) . '</a> / <a href="#" class="redux_remove_file_button">' . __( 'Remove', 'redux-framework' ) . '</a>)';
148
-						$html .= $id_input;
149
-						$html .= '</li>';
150
-
151
-						$file_arr[] = $html;
152
-					}
153
-				}
154
-			}
155
-
156
-			// Push images onto array stack.
157
-			if ( ! empty( $img_arr ) ) {
158
-				foreach ( $img_arr as $html ) {
159
-					$all_arr[] = $html;
160
-				}
161
-			}
162
-
163
-			// Push files onto array stack.
164
-			if ( ! empty( $file_arr ) ) {
165
-				foreach ( $file_arr as $html ) {
166
-					$all_arr[] = $html;
167
-				}
168
-			}
169
-
170
-			// Output array to page.
171
-			if ( ! empty( $all_arr ) ) {
172
-				foreach ( $all_arr as $html ) {
173
-					echo $html; // phpcs:ignore WordPress.Security.EscapeOutput
174
-				}
175
-			}
176
-
177
-			// Close the list.
178
-			echo '</ul>';
179
-
180
-			// Close container.
181
-			echo '</div>';
182
-		}
183
-
184
-		/**
185
-		 * Determine a file's extension
186
-		 *
187
-		 * @param  string $file File url.
188
-		 *
189
-		 * @return string|false     File extension or false
190
-		 * @since  1.0.0
191
-		 */
192
-		private function get_file_ext( string $file ) {
193
-			$parsed = wp_parse_url( $file, PHP_URL_PATH );
194
-
195
-			return $parsed ? strtolower( pathinfo( $parsed, PATHINFO_EXTENSION ) ) : false;
196
-		}
197
-
198
-		/**
199
-		 * Determines if a file has a valid image extension
200
-		 *
201
-		 * @param  string $file File url.
202
-		 *
203
-		 * @return bool         Whether the file has a valid image extension
204
-		 * @since  1.0.0
205
-		 */
206
-		private function is_valid_img_ext( string $file ): bool {
207
-			$file_ext = $this->get_file_ext( $file );
208
-
209
-			$ext_arr = array( 'jpg', 'jpeg', 'png', 'gif', 'ico', 'icon' );
210
-
211
-			$valid = empty( $valid ) ? (array) apply_filters( 'redux_valid_img_types', $ext_arr ) : $valid;
212
-
213
-			return ( $file_ext && in_array( $file_ext, $valid, true ) );
214
-		}
215
-
216
-		/**
217
-		 * Enqueue Function.
218
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
219
-		 *
220
-		 * @since       1.0.0
221
-		 * @access      public
222
-		 * @return      void
223
-		 */
224
-		public function enqueue() {
225
-
226
-			// Get labels for localization.
227
-			$upload_file    = $this->field['labels']['upload_file'] ?? esc_html__( 'Select File(s)', 'redux-framework' );
228
-			$remove_image   = $this->field['labels']['remove_image'] ?? esc_html__( 'Remove Image', 'redux-framework' );
229
-			$remove_file    = $this->field['labels']['remove_file'] ?? esc_html__( 'Remove', 'redux-framework' );
230
-			$file_label     = $this->field['labels']['file'] ?? esc_html__( 'File: ', 'redux-framework' );
231
-			$download_label = $this->field['labels']['download'] ?? esc_html__( 'Download', 'redux-framework' );
232
-			$media_title    = $this->field['labels']['title'] ?? 'Title';
233
-
234
-			// translators: %s: Filename.
235
-			$dup_warn = $this->field['labels']['duplicate'] ?? esc_html__( '%s already exists in your file queue.', 'redux-framework' );
236
-
237
-			// translators: %s: Upload limit.
238
-			$max_warn = $this->field['labels']['max_limit'] ?? esc_html__( 'Maximum upload limit of %s reached/exceeded.', 'redux-framework' );
239
-
240
-			// Set up min files for dev_mode = false.
241
-			$min = Redux_Functions::isMin();
242
-
243
-			if ( function_exists( 'wp_enqueue_media' ) ) {
244
-				wp_enqueue_media();
245
-			} else {
246
-				wp_enqueue_script( 'media-upload' );
247
-			}
248
-
249
-			// Field dependent JS.
250
-			wp_enqueue_script(
251
-				'redux-field-multi-media',
252
-				$this->url . 'redux-multi-media' . $min . '.js',
253
-				array( 'jquery', 'redux-js' ),
254
-				Redux_Extension_Multi_Media::$version,
255
-				true
256
-			);
257
-
258
-			if ( $this->parent->args['dev_mode'] ) {
259
-				wp_enqueue_style(
260
-					'redux-field-multi-media',
261
-					$this->url . 'redux-multi-media.css',
262
-					array(),
263
-					Redux_Extension_Multi_Media::$version
264
-				);
265
-			}
266
-
267
-			// Localization.
268
-			$data_arr = array(
269
-				'upload_file'  => $upload_file,
270
-				'remove_image' => $remove_image,
271
-				'remove_file'  => $remove_file,
272
-				'file'         => $file_label,
273
-				'download'     => $download_label,
274
-				'title'        => $media_title,
275
-				'dup_warn'     => $dup_warn,
276
-				'max_warn'     => $max_warn,
277
-			);
278
-
279
-			wp_localize_script(
280
-				'redux-field-multi-media',
281
-				'redux_multi_media_l10',
282
-				apply_filters( 'redux_multi_media_localized_data', $data_arr )
283
-			);
284
-		}
285
-	}
115
+                    // Check for a valid image extension.
116
+                    if ( $this->is_valid_img_ext( $url ) ) {
117
+
118
+                        // Add image to array.
119
+                        $html  = '<li class="img_status">';
120
+                        $html .= wp_get_attachment_image( $id, array( 50, 50 ) );
121
+                        $html .= '<p class="redux_remove_wrapper">';
122
+                        $html .= '<a href="#" class="redux_remove_file_button">' . esc_html__( 'Remove Image', 'redux-framework' ) . '</a>';
123
+                        $html .= '</p>';
124
+                        $html .= $id_input;
125
+                        $html .= '</li>';
126
+
127
+                        $img_arr[] = $html;
128
+
129
+                        // No image?  Output standard file info.
130
+                    } else {
131
+
132
+                        // Get parts of URL.
133
+                        $parts = explode( '/', $url );
134
+
135
+                        // Get the filename.
136
+                        $title      = '';
137
+                        $part_count = count( $parts );
138
+
139
+                        for ( $i = 0; $i < $part_count; ++$i ) {
140
+                            $title = $parts[ $i ];
141
+                        }
142
+
143
+                        // Add file to array.
144
+                        $html  = '<li>';
145
+                        $html .= esc_html__( 'File: ', 'redux-framework' );
146
+                        $html .= '<strong>' . $title . '</strong>&nbsp;&nbsp;&nbsp;';
147
+                        $html .= '(<a href="' . $url . '" target="_blank" rel="external">' . esc_html__( 'Download', 'redux-framework' ) . '</a> / <a href="#" class="redux_remove_file_button">' . __( 'Remove', 'redux-framework' ) . '</a>)';
148
+                        $html .= $id_input;
149
+                        $html .= '</li>';
150
+
151
+                        $file_arr[] = $html;
152
+                    }
153
+                }
154
+            }
155
+
156
+            // Push images onto array stack.
157
+            if ( ! empty( $img_arr ) ) {
158
+                foreach ( $img_arr as $html ) {
159
+                    $all_arr[] = $html;
160
+                }
161
+            }
162
+
163
+            // Push files onto array stack.
164
+            if ( ! empty( $file_arr ) ) {
165
+                foreach ( $file_arr as $html ) {
166
+                    $all_arr[] = $html;
167
+                }
168
+            }
169
+
170
+            // Output array to page.
171
+            if ( ! empty( $all_arr ) ) {
172
+                foreach ( $all_arr as $html ) {
173
+                    echo $html; // phpcs:ignore WordPress.Security.EscapeOutput
174
+                }
175
+            }
176
+
177
+            // Close the list.
178
+            echo '</ul>';
179
+
180
+            // Close container.
181
+            echo '</div>';
182
+        }
183
+
184
+        /**
185
+         * Determine a file's extension
186
+         *
187
+         * @param  string $file File url.
188
+         *
189
+         * @return string|false     File extension or false
190
+         * @since  1.0.0
191
+         */
192
+        private function get_file_ext( string $file ) {
193
+            $parsed = wp_parse_url( $file, PHP_URL_PATH );
194
+
195
+            return $parsed ? strtolower( pathinfo( $parsed, PATHINFO_EXTENSION ) ) : false;
196
+        }
197
+
198
+        /**
199
+         * Determines if a file has a valid image extension
200
+         *
201
+         * @param  string $file File url.
202
+         *
203
+         * @return bool         Whether the file has a valid image extension
204
+         * @since  1.0.0
205
+         */
206
+        private function is_valid_img_ext( string $file ): bool {
207
+            $file_ext = $this->get_file_ext( $file );
208
+
209
+            $ext_arr = array( 'jpg', 'jpeg', 'png', 'gif', 'ico', 'icon' );
210
+
211
+            $valid = empty( $valid ) ? (array) apply_filters( 'redux_valid_img_types', $ext_arr ) : $valid;
212
+
213
+            return ( $file_ext && in_array( $file_ext, $valid, true ) );
214
+        }
215
+
216
+        /**
217
+         * Enqueue Function.
218
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
219
+         *
220
+         * @since       1.0.0
221
+         * @access      public
222
+         * @return      void
223
+         */
224
+        public function enqueue() {
225
+
226
+            // Get labels for localization.
227
+            $upload_file    = $this->field['labels']['upload_file'] ?? esc_html__( 'Select File(s)', 'redux-framework' );
228
+            $remove_image   = $this->field['labels']['remove_image'] ?? esc_html__( 'Remove Image', 'redux-framework' );
229
+            $remove_file    = $this->field['labels']['remove_file'] ?? esc_html__( 'Remove', 'redux-framework' );
230
+            $file_label     = $this->field['labels']['file'] ?? esc_html__( 'File: ', 'redux-framework' );
231
+            $download_label = $this->field['labels']['download'] ?? esc_html__( 'Download', 'redux-framework' );
232
+            $media_title    = $this->field['labels']['title'] ?? 'Title';
233
+
234
+            // translators: %s: Filename.
235
+            $dup_warn = $this->field['labels']['duplicate'] ?? esc_html__( '%s already exists in your file queue.', 'redux-framework' );
236
+
237
+            // translators: %s: Upload limit.
238
+            $max_warn = $this->field['labels']['max_limit'] ?? esc_html__( 'Maximum upload limit of %s reached/exceeded.', 'redux-framework' );
239
+
240
+            // Set up min files for dev_mode = false.
241
+            $min = Redux_Functions::isMin();
242
+
243
+            if ( function_exists( 'wp_enqueue_media' ) ) {
244
+                wp_enqueue_media();
245
+            } else {
246
+                wp_enqueue_script( 'media-upload' );
247
+            }
248
+
249
+            // Field dependent JS.
250
+            wp_enqueue_script(
251
+                'redux-field-multi-media',
252
+                $this->url . 'redux-multi-media' . $min . '.js',
253
+                array( 'jquery', 'redux-js' ),
254
+                Redux_Extension_Multi_Media::$version,
255
+                true
256
+            );
257
+
258
+            if ( $this->parent->args['dev_mode'] ) {
259
+                wp_enqueue_style(
260
+                    'redux-field-multi-media',
261
+                    $this->url . 'redux-multi-media.css',
262
+                    array(),
263
+                    Redux_Extension_Multi_Media::$version
264
+                );
265
+            }
266
+
267
+            // Localization.
268
+            $data_arr = array(
269
+                'upload_file'  => $upload_file,
270
+                'remove_image' => $remove_image,
271
+                'remove_file'  => $remove_file,
272
+                'file'         => $file_label,
273
+                'download'     => $download_label,
274
+                'title'        => $media_title,
275
+                'dup_warn'     => $dup_warn,
276
+                'max_warn'     => $max_warn,
277
+            );
278
+
279
+            wp_localize_script(
280
+                'redux-field-multi-media',
281
+                'redux_multi_media_l10',
282
+                apply_filters( 'redux_multi_media_localized_data', $data_arr )
283
+            );
284
+        }
285
+    }
286 286
 }
Please login to merge, or discard this patch.
inc/extensions/social_profiles/class-redux-extension-social-profiles.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 		 * @return array
130 130
 		 */
131 131
 		public function reset_defaults_section( array $defaults = array() ): array {
132
-			if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) ) {
133
-				$cur_tab = sanitize_title( wp_unslash( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) );
134
-				$tab_num = strval( $this->parent->field_sections['social_profiles'][ $this->field_id ] );
132
+			if ( isset( $_COOKIE['redux_current_tab_' . $this->parent->args['opt_name']] ) ) {
133
+				$cur_tab = sanitize_title( wp_unslash( $_COOKIE['redux_current_tab_' . $this->parent->args['opt_name']] ) );
134
+				$tab_num = strval( $this->parent->field_sections['social_profiles'][$this->field_id] );
135 135
 
136 136
 				if ( $cur_tab === $tab_num ) {
137
-					if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
137
+					if ( '' !== $this->field_id && isset( $this->parent->options_defaults[$this->field_id] ) ) {
138 138
 						$data = Redux_Social_Profiles_Functions::get_default_data();
139 139
 
140 140
 						Redux_Social_Profiles_Functions::write_data_file( $data );
141 141
 					}
142 142
 				}
143 143
 
144
-				$defaults[ $this->field_id ] = Redux_Social_Profiles_Functions::read_data_file();
144
+				$defaults[$this->field_id] = Redux_Social_Profiles_Functions::read_data_file();
145 145
 			}
146 146
 
147 147
 			return $defaults;
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 		 * @return array
156 156
 		 */
157 157
 		public function reset_defaults( array $defaults = array() ): array {
158
-			if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
158
+			if ( '' !== $this->field_id && isset( $this->parent->options_defaults[$this->field_id] ) ) {
159 159
 				$data = Redux_Social_Profiles_Functions::get_default_data();
160 160
 
161 161
 				Redux_Social_Profiles_Functions::write_data_file( $data );
162 162
 
163
-				$defaults[ $this->field_id ] = $data;
163
+				$defaults[$this->field_id] = $data;
164 164
 			}
165 165
 
166 166
 			return $defaults;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
 				Redux_Social_Profiles_Functions::write_data_file( $data );
187 187
 
188
-				$this->parent->options[ $this->field_id ] = $data;
188
+				$this->parent->options[$this->field_id] = $data;
189 189
 			}
190 190
 
191 191
 			return $defaults;
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				$this->field_id = $this->field['id'];
206 206
 			}
207 207
 
208
-			if ( ! isset( $saved_options[ $this->field_id ] ) || empty( $saved_options[ $this->field_id ] ) || ( is_array( $saved_options[ $this->field_id ] ) && $saved_options === $changed_values ) || ! array_key_exists( $this->field_id, $saved_options ) ) {
208
+			if ( ! isset( $saved_options[$this->field_id] ) || empty( $saved_options[$this->field_id] ) || ( is_array( $saved_options[$this->field_id] ) && $saved_options === $changed_values ) || ! array_key_exists( $this->field_id, $saved_options ) ) {
209 209
 				return $saved_options;
210 210
 			}
211 211
 
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 				return $saved_options;
215 215
 			}
216 216
 
217
-			$first_value = reset( $saved_options[ $this->field_id ] ); // First Element's Value.
217
+			$first_value = reset( $saved_options[$this->field_id] ); // First Element's Value.
218 218
 
219 219
 			if ( isset( $first_value['data'] ) ) {
220
-				$raw_data = $saved_options[ $this->field_id ];
220
+				$raw_data = $saved_options[$this->field_id];
221 221
 
222 222
 				$save_data = array();
223 223
 
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 
248 248
 				$save_file = false;
249 249
 
250
-				if ( ! isset( $old_options[ $this->field_id ] ) || ( isset( $old_options[ $this->field_id ] ) && ! empty( $old_options[ $this->field_id ] ) ) ) {
250
+				if ( ! isset( $old_options[$this->field_id] ) || ( isset( $old_options[$this->field_id] ) && ! empty( $old_options[$this->field_id] ) ) ) {
251 251
 					$save_file = true;
252 252
 				}
253 253
 
254
-				if ( ! empty( $old_options[ $this->field_id ] ) && $old_options[ $this->field_id ] !== $saved_options[ $this->field_id ] ) {
254
+				if ( ! empty( $old_options[$this->field_id] ) && $old_options[$this->field_id] !== $saved_options[$this->field_id] ) {
255 255
 					$save_file = true;
256 256
 				}
257 257
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 					Redux_Social_Profiles_Functions::write_data_file( $save_data );
260 260
 				}
261 261
 
262
-				$saved_options[ $this->field_id ] = $save_data;
262
+				$saved_options[$this->field_id] = $save_data;
263 263
 			}
264 264
 
265 265
 			return $saved_options;
Please login to merge, or discard this patch.
Indentation   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -15,272 +15,272 @@
 block discarded – undo
15 15
 if ( ! class_exists( 'Redux_Extension_Social_Profiles' ) ) {
16 16
 
17 17
 
18
-	/**
19
-	 * Main ReduxFramework social profiles extension class
20
-	 *
21
-	 * @since       1.0.0
22
-	 */
23
-	class Redux_Extension_Social_Profiles extends Redux_Extension_Abstract {
24
-
25
-		/**
26
-		 * Extension version.
27
-		 *
28
-		 * @var string
29
-		 */
30
-		public static $version = '4.5.8';
31
-
32
-		/**
33
-		 * Extension friendly name.
34
-		 *
35
-		 * @var string
36
-		 */
37
-		public string $extension_name = 'Social Profiles';
38
-
39
-		/**
40
-		 * Field ID.
41
-		 *
42
-		 * @var mixed|null
43
-		 */
44
-		private $field_id = null;
45
-
46
-		/**
47
-		 * Field array.
48
-		 *
49
-		 * @var array|null
50
-		 */
51
-		public ?array $field = array();
52
-
53
-		/**
54
-		 * Panel opt_name.
55
-		 *
56
-		 * @var string
57
-		 */
58
-		public string $opt_name;
59
-
60
-		/**
61
-		 * Class Constructor. Defines the args for the extensions class
62
-		 *
63
-		 * @since       1.0.0
64
-		 * @access      public
65
-		 *
66
-		 * @param       ReduxFramework $redux Parent settings.
67
-		 *
68
-		 * @return      void
69
-		 */
70
-		public function __construct( $redux ) {
71
-			parent::__construct( $redux, __FILE__ );
72
-
73
-			$this->add_field( 'social_profiles' );
74
-
75
-			require_once __DIR__ . '/redux-social-profiles-helpers.php';
76
-
77
-			include_once 'social_profiles/inc/class-redux-social-profiles-defaults.php';
78
-			include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
79
-
80
-			Redux_Social_Profiles_Functions::init( $redux );
81
-
82
-			$this->field = Redux_Social_Profiles_Functions::get_field( $redux );
83
-
84
-			if ( ! is_array( $this->field ) ) {
85
-				return;
86
-			}
87
-
88
-			$this->field_id = $this->field['id'];
89
-			$this->opt_name = $redux->args['opt_name'];
90
-
91
-			$upload_dir = Redux_Social_Profiles_Functions::$upload_dir;
92
-
93
-			if ( ! is_dir( $upload_dir ) ) {
94
-				Redux_Core::$filesystem->execute( 'mkdir', $upload_dir );
95
-			}
96
-
97
-			if ( ! class_exists( 'Redux_Social_Profiles_Widget' ) ) {
98
-				$enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/widget/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
99
-
100
-				if ( $enable ) {
101
-					include_once 'social_profiles/inc/class-redux-social-profiles-widget.php';
102
-					new Redux_Social_Profiles_Widget( $redux, $this->field_id );
103
-				}
104
-			}
105
-
106
-			if ( ! class_exists( 'Redux_Social_Profiles_Shortcode' ) ) {
107
-				$enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/shortcode/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
108
-
109
-				if ( $enable ) {
110
-					include_once 'social_profiles/inc/class-redux-social-profiles-shortcode.php';
111
-					new Redux_Social_Profiles_Shortcode( $redux, $this->field_id );
112
-				}
113
-			}
114
-
115
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
116
-
117
-			add_filter( "redux/options/{$this->parent->args['opt_name']}/defaults", array( $this, 'set_defaults' ) );
118
-			add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/before_validation', array( $this, 'save_me' ), 0, 3 );
119
-			add_filter( 'redux/metaboxes/save/before_validate', array( $this, 'save_me' ), 0, 3 );
120
-
121
-			// Reset hooks.
122
-			add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults', array( $this, 'reset_defaults' ), 0, 3 );
123
-			add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults_section', array( $this, 'reset_defaults_section' ), 0, 3 );
124
-		}
125
-
126
-		/**
127
-		 * Reset section defaults.
128
-		 *
129
-		 * @param array $defaults Default values.
130
-		 *
131
-		 * @return array
132
-		 */
133
-		public function reset_defaults_section( array $defaults = array() ): array {
134
-			if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) ) {
135
-				$cur_tab = sanitize_title( wp_unslash( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) );
136
-				$tab_num = strval( $this->parent->field_sections['social_profiles'][ $this->field_id ] );
137
-
138
-				if ( $cur_tab === $tab_num ) {
139
-					if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
140
-						$data = Redux_Social_Profiles_Functions::get_default_data();
141
-
142
-						Redux_Social_Profiles_Functions::write_data_file( $data );
143
-					}
144
-				}
145
-
146
-				$defaults[ $this->field_id ] = Redux_Social_Profiles_Functions::read_data_file();
147
-			}
148
-
149
-			return $defaults;
150
-		}
151
-
152
-		/**
153
-		 * Reset defaults.
154
-		 *
155
-		 * @param array $defaults Default values.
156
-		 *
157
-		 * @return array
158
-		 */
159
-		public function reset_defaults( array $defaults = array() ): array {
160
-			if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
161
-				$data = Redux_Social_Profiles_Functions::get_default_data();
162
-
163
-				Redux_Social_Profiles_Functions::write_data_file( $data );
164
-
165
-				$defaults[ $this->field_id ] = $data;
166
-			}
167
-
168
-			return $defaults;
169
-		}
170
-
171
-		/**
172
-		 * Set default values.
173
-		 *
174
-		 * @param array $defaults Default values.
175
-		 *
176
-		 * @return array
177
-		 */
178
-		public function set_defaults( array $defaults = array() ): array {
179
-			if ( empty( $this->field_id ) ) {
180
-				return $defaults;
181
-			}
182
-
183
-			$comp_file = Redux_Social_Profiles_Functions::get_data_path();
184
-
185
-			if ( ! file_exists( $comp_file ) ) {
186
-				$data = Redux_Social_Profiles_Functions::get_default_data();
187
-
188
-				Redux_Social_Profiles_Functions::write_data_file( $data );
189
-
190
-				$this->parent->options[ $this->field_id ] = $data;
191
-			}
192
-
193
-			return $defaults;
194
-		}
195
-
196
-		/**
197
-		 * Save Data.
198
-		 *
199
-		 * @param array $saved_options  Saved options.
200
-		 * @param array $changed_values Changed values.
201
-		 *
202
-		 * @return array
203
-		 */
204
-		public function save_me( array $saved_options = array(), array $changed_values = array() ): array {
205
-			if ( empty( $this->field ) ) {
206
-				$this->field    = Redux_Social_Profiles_Functions::get_field();
207
-				$this->field_id = $this->field['id'];
208
-			}
209
-
210
-			if ( ! isset( $saved_options[ $this->field_id ] ) || empty( $saved_options[ $this->field_id ] ) || ( is_array( $saved_options[ $this->field_id ] ) && $saved_options === $changed_values ) || ! array_key_exists( $this->field_id, $saved_options ) ) {
211
-				return $saved_options;
212
-			}
213
-
214
-			// We'll use the reset hook instead.
215
-			if ( ! empty( $saved_options['defaults'] ) || ! empty( $saved_options['defaults-section'] ) ) {
216
-				return $saved_options;
217
-			}
218
-
219
-			$first_value = reset( $saved_options[ $this->field_id ] ); // First Element's Value.
220
-
221
-			if ( isset( $first_value['data'] ) ) {
222
-				$raw_data = $saved_options[ $this->field_id ];
223
-
224
-				$save_data = array();
225
-
226
-				// Enum through saved data.
227
-				foreach ( $raw_data as $val ) {
228
-					if ( is_array( $val ) ) {
229
-
230
-						if ( ! isset( $val['data'] ) ) {
231
-							return array();
232
-						}
233
-
234
-						$data = json_decode( rawurldecode( $val['data'] ), true );
235
-
236
-						$save_data[] = array(
237
-							'id'         => $data['id'],
238
-							'class'      => $data['class'] ?? 'fa',
239
-							'icon'       => $data['icon'],
240
-							'enabled'    => $data['enabled'],
241
-							'url'        => $data['url'],
242
-							'color'      => $data['color'],
243
-							'background' => $data['background'],
244
-							'order'      => $data['order'],
245
-							'name'       => $data['name'],
246
-							'label'      => $data['label'],
247
-						);
248
-					}
249
-				}
250
-
251
-				$save_file = false;
252
-
253
-				if ( ! isset( $old_options[ $this->field_id ] ) || ( isset( $old_options[ $this->field_id ] ) && ! empty( $old_options[ $this->field_id ] ) ) ) {
254
-					$save_file = true;
255
-				}
256
-
257
-				if ( ! empty( $old_options[ $this->field_id ] ) && $old_options[ $this->field_id ] !== $saved_options[ $this->field_id ] ) {
258
-					$save_file = true;
259
-				}
260
-
261
-				if ( $save_file ) {
262
-					Redux_Social_Profiles_Functions::write_data_file( $save_data );
263
-				}
264
-
265
-				$saved_options[ $this->field_id ] = $save_data;
266
-			}
267
-
268
-			return $saved_options;
269
-		}
270
-
271
-		/**
272
-		 * Enqueue scripts/styles.
273
-		 */
274
-		public function enqueue_styles() {
275
-			// Field CSS.
276
-			wp_enqueue_style(
277
-				'redux-field-social-profiles-frontend',
278
-				$this->extension_url . 'social_profiles/css/field_social_profiles_frontend.css',
279
-				array(),
280
-				self::$version
281
-			);
282
-		}
283
-	}
284
-
285
-	class_alias( Redux_Extension_Social_Profiles::class, 'ReduxFramework_Extension_social_profiles' );
18
+    /**
19
+     * Main ReduxFramework social profiles extension class
20
+     *
21
+     * @since       1.0.0
22
+     */
23
+    class Redux_Extension_Social_Profiles extends Redux_Extension_Abstract {
24
+
25
+        /**
26
+         * Extension version.
27
+         *
28
+         * @var string
29
+         */
30
+        public static $version = '4.5.8';
31
+
32
+        /**
33
+         * Extension friendly name.
34
+         *
35
+         * @var string
36
+         */
37
+        public string $extension_name = 'Social Profiles';
38
+
39
+        /**
40
+         * Field ID.
41
+         *
42
+         * @var mixed|null
43
+         */
44
+        private $field_id = null;
45
+
46
+        /**
47
+         * Field array.
48
+         *
49
+         * @var array|null
50
+         */
51
+        public ?array $field = array();
52
+
53
+        /**
54
+         * Panel opt_name.
55
+         *
56
+         * @var string
57
+         */
58
+        public string $opt_name;
59
+
60
+        /**
61
+         * Class Constructor. Defines the args for the extensions class
62
+         *
63
+         * @since       1.0.0
64
+         * @access      public
65
+         *
66
+         * @param       ReduxFramework $redux Parent settings.
67
+         *
68
+         * @return      void
69
+         */
70
+        public function __construct( $redux ) {
71
+            parent::__construct( $redux, __FILE__ );
72
+
73
+            $this->add_field( 'social_profiles' );
74
+
75
+            require_once __DIR__ . '/redux-social-profiles-helpers.php';
76
+
77
+            include_once 'social_profiles/inc/class-redux-social-profiles-defaults.php';
78
+            include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
79
+
80
+            Redux_Social_Profiles_Functions::init( $redux );
81
+
82
+            $this->field = Redux_Social_Profiles_Functions::get_field( $redux );
83
+
84
+            if ( ! is_array( $this->field ) ) {
85
+                return;
86
+            }
87
+
88
+            $this->field_id = $this->field['id'];
89
+            $this->opt_name = $redux->args['opt_name'];
90
+
91
+            $upload_dir = Redux_Social_Profiles_Functions::$upload_dir;
92
+
93
+            if ( ! is_dir( $upload_dir ) ) {
94
+                Redux_Core::$filesystem->execute( 'mkdir', $upload_dir );
95
+            }
96
+
97
+            if ( ! class_exists( 'Redux_Social_Profiles_Widget' ) ) {
98
+                $enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/widget/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
99
+
100
+                if ( $enable ) {
101
+                    include_once 'social_profiles/inc/class-redux-social-profiles-widget.php';
102
+                    new Redux_Social_Profiles_Widget( $redux, $this->field_id );
103
+                }
104
+            }
105
+
106
+            if ( ! class_exists( 'Redux_Social_Profiles_Shortcode' ) ) {
107
+                $enable = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/shortcode/enable', true ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
108
+
109
+                if ( $enable ) {
110
+                    include_once 'social_profiles/inc/class-redux-social-profiles-shortcode.php';
111
+                    new Redux_Social_Profiles_Shortcode( $redux, $this->field_id );
112
+                }
113
+            }
114
+
115
+            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
116
+
117
+            add_filter( "redux/options/{$this->parent->args['opt_name']}/defaults", array( $this, 'set_defaults' ) );
118
+            add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/before_validation', array( $this, 'save_me' ), 0, 3 );
119
+            add_filter( 'redux/metaboxes/save/before_validate', array( $this, 'save_me' ), 0, 3 );
120
+
121
+            // Reset hooks.
122
+            add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults', array( $this, 'reset_defaults' ), 0, 3 );
123
+            add_action( 'redux/validate/' . $this->parent->args['opt_name'] . '/defaults_section', array( $this, 'reset_defaults_section' ), 0, 3 );
124
+        }
125
+
126
+        /**
127
+         * Reset section defaults.
128
+         *
129
+         * @param array $defaults Default values.
130
+         *
131
+         * @return array
132
+         */
133
+        public function reset_defaults_section( array $defaults = array() ): array {
134
+            if ( isset( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) ) {
135
+                $cur_tab = sanitize_title( wp_unslash( $_COOKIE[ 'redux_current_tab_' . $this->parent->args['opt_name'] ] ) );
136
+                $tab_num = strval( $this->parent->field_sections['social_profiles'][ $this->field_id ] );
137
+
138
+                if ( $cur_tab === $tab_num ) {
139
+                    if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
140
+                        $data = Redux_Social_Profiles_Functions::get_default_data();
141
+
142
+                        Redux_Social_Profiles_Functions::write_data_file( $data );
143
+                    }
144
+                }
145
+
146
+                $defaults[ $this->field_id ] = Redux_Social_Profiles_Functions::read_data_file();
147
+            }
148
+
149
+            return $defaults;
150
+        }
151
+
152
+        /**
153
+         * Reset defaults.
154
+         *
155
+         * @param array $defaults Default values.
156
+         *
157
+         * @return array
158
+         */
159
+        public function reset_defaults( array $defaults = array() ): array {
160
+            if ( '' !== $this->field_id && isset( $this->parent->options_defaults[ $this->field_id ] ) ) {
161
+                $data = Redux_Social_Profiles_Functions::get_default_data();
162
+
163
+                Redux_Social_Profiles_Functions::write_data_file( $data );
164
+
165
+                $defaults[ $this->field_id ] = $data;
166
+            }
167
+
168
+            return $defaults;
169
+        }
170
+
171
+        /**
172
+         * Set default values.
173
+         *
174
+         * @param array $defaults Default values.
175
+         *
176
+         * @return array
177
+         */
178
+        public function set_defaults( array $defaults = array() ): array {
179
+            if ( empty( $this->field_id ) ) {
180
+                return $defaults;
181
+            }
182
+
183
+            $comp_file = Redux_Social_Profiles_Functions::get_data_path();
184
+
185
+            if ( ! file_exists( $comp_file ) ) {
186
+                $data = Redux_Social_Profiles_Functions::get_default_data();
187
+
188
+                Redux_Social_Profiles_Functions::write_data_file( $data );
189
+
190
+                $this->parent->options[ $this->field_id ] = $data;
191
+            }
192
+
193
+            return $defaults;
194
+        }
195
+
196
+        /**
197
+         * Save Data.
198
+         *
199
+         * @param array $saved_options  Saved options.
200
+         * @param array $changed_values Changed values.
201
+         *
202
+         * @return array
203
+         */
204
+        public function save_me( array $saved_options = array(), array $changed_values = array() ): array {
205
+            if ( empty( $this->field ) ) {
206
+                $this->field    = Redux_Social_Profiles_Functions::get_field();
207
+                $this->field_id = $this->field['id'];
208
+            }
209
+
210
+            if ( ! isset( $saved_options[ $this->field_id ] ) || empty( $saved_options[ $this->field_id ] ) || ( is_array( $saved_options[ $this->field_id ] ) && $saved_options === $changed_values ) || ! array_key_exists( $this->field_id, $saved_options ) ) {
211
+                return $saved_options;
212
+            }
213
+
214
+            // We'll use the reset hook instead.
215
+            if ( ! empty( $saved_options['defaults'] ) || ! empty( $saved_options['defaults-section'] ) ) {
216
+                return $saved_options;
217
+            }
218
+
219
+            $first_value = reset( $saved_options[ $this->field_id ] ); // First Element's Value.
220
+
221
+            if ( isset( $first_value['data'] ) ) {
222
+                $raw_data = $saved_options[ $this->field_id ];
223
+
224
+                $save_data = array();
225
+
226
+                // Enum through saved data.
227
+                foreach ( $raw_data as $val ) {
228
+                    if ( is_array( $val ) ) {
229
+
230
+                        if ( ! isset( $val['data'] ) ) {
231
+                            return array();
232
+                        }
233
+
234
+                        $data = json_decode( rawurldecode( $val['data'] ), true );
235
+
236
+                        $save_data[] = array(
237
+                            'id'         => $data['id'],
238
+                            'class'      => $data['class'] ?? 'fa',
239
+                            'icon'       => $data['icon'],
240
+                            'enabled'    => $data['enabled'],
241
+                            'url'        => $data['url'],
242
+                            'color'      => $data['color'],
243
+                            'background' => $data['background'],
244
+                            'order'      => $data['order'],
245
+                            'name'       => $data['name'],
246
+                            'label'      => $data['label'],
247
+                        );
248
+                    }
249
+                }
250
+
251
+                $save_file = false;
252
+
253
+                if ( ! isset( $old_options[ $this->field_id ] ) || ( isset( $old_options[ $this->field_id ] ) && ! empty( $old_options[ $this->field_id ] ) ) ) {
254
+                    $save_file = true;
255
+                }
256
+
257
+                if ( ! empty( $old_options[ $this->field_id ] ) && $old_options[ $this->field_id ] !== $saved_options[ $this->field_id ] ) {
258
+                    $save_file = true;
259
+                }
260
+
261
+                if ( $save_file ) {
262
+                    Redux_Social_Profiles_Functions::write_data_file( $save_data );
263
+                }
264
+
265
+                $saved_options[ $this->field_id ] = $save_data;
266
+            }
267
+
268
+            return $saved_options;
269
+        }
270
+
271
+        /**
272
+         * Enqueue scripts/styles.
273
+         */
274
+        public function enqueue_styles() {
275
+            // Field CSS.
276
+            wp_enqueue_style(
277
+                'redux-field-social-profiles-frontend',
278
+                $this->extension_url . 'social_profiles/css/field_social_profiles_frontend.css',
279
+                array(),
280
+                self::$version
281
+            );
282
+        }
283
+    }
284
+
285
+    class_alias( Redux_Extension_Social_Profiles::class, 'ReduxFramework_Extension_social_profiles' );
286 286
 }
Please login to merge, or discard this patch.
social_profiles/inc/class-redux-social-profiles-shortcode.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		 */
51 51
 		public function redux_social_profiles(): string {
52 52
 			$redux_options = get_option( $this->parent->args['opt_name'] );
53
-			$social_items  = $redux_options[ $this->field_id ];
53
+			$social_items  = $redux_options[$this->field_id];
54 54
 
55 55
 			$html = '<ul class="redux-social-media-list clearfix">';
56 56
 
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -11,73 +11,73 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Social_Profiles_Shortcode' ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Social_Profiles_Shortcode
16
-	 */
17
-	class Redux_Social_Profiles_Shortcode {
14
+    /**
15
+     * Class Redux_Social_Profiles_Shortcode
16
+     */
17
+    class Redux_Social_Profiles_Shortcode {
18 18
 
19
-		/**
20
-		 * ReduxFramework object pointer.
21
-		 *
22
-		 * @var ReduxFramework
23
-		 */
24
-		private ReduxFramework $parent;
19
+        /**
20
+         * ReduxFramework object pointer.
21
+         *
22
+         * @var ReduxFramework
23
+         */
24
+        private ReduxFramework $parent;
25 25
 
26
-		/**
27
-		 * Field ID.
28
-		 *
29
-		 * @var string
30
-		 */
31
-		private string $field_id;
26
+        /**
27
+         * Field ID.
28
+         *
29
+         * @var string
30
+         */
31
+        private string $field_id;
32 32
 
33
-		/**
34
-		 * Redux_Social_Profiles_Shortcode constructor.
35
-		 *
36
-		 * @param ReduxFramework $redux    ReduxFramework object.
37
-		 * @param string         $field_id Field ID.
38
-		 */
39
-		public function __construct( ReduxFramework $redux, string $field_id ) {
40
-			$this->parent   = $redux;
41
-			$this->field_id = $field_id;
33
+        /**
34
+         * Redux_Social_Profiles_Shortcode constructor.
35
+         *
36
+         * @param ReduxFramework $redux    ReduxFramework object.
37
+         * @param string         $field_id Field ID.
38
+         */
39
+        public function __construct( ReduxFramework $redux, string $field_id ) {
40
+            $this->parent   = $redux;
41
+            $this->field_id = $field_id;
42 42
 
43
-			add_shortcode( 'social_profiles', array( $this, 'redux_social_profiles' ) );
44
-		}
43
+            add_shortcode( 'social_profiles', array( $this, 'redux_social_profiles' ) );
44
+        }
45 45
 
46
-		/**
47
-		 * Render shortcode.
48
-		 *
49
-		 * @return string
50
-		 */
51
-		public function redux_social_profiles(): string {
52
-			$redux_options = get_option( $this->parent->args['opt_name'] );
53
-			$social_items  = $redux_options[ $this->field_id ];
46
+        /**
47
+         * Render shortcode.
48
+         *
49
+         * @return string
50
+         */
51
+        public function redux_social_profiles(): string {
52
+            $redux_options = get_option( $this->parent->args['opt_name'] );
53
+            $social_items  = $redux_options[ $this->field_id ];
54 54
 
55
-			$html = '<ul class="redux-social-media-list clearfix">';
55
+            $html = '<ul class="redux-social-media-list clearfix">';
56 56
 
57
-			if ( is_array( $social_items ) ) {
58
-				foreach ( $social_items as $social_item ) {
59
-					if ( $social_item['enabled'] ) {
60
-						$icon       = $social_item['icon'];
61
-						$class      = $social_item['class'] ?? 'fa';
62
-						$color      = $social_item['color'];
63
-						$background = $social_item['background'];
64
-						$base_url   = $social_item['url'];
65
-						$id         = $social_item['id'];
57
+            if ( is_array( $social_items ) ) {
58
+                foreach ( $social_items as $social_item ) {
59
+                    if ( $social_item['enabled'] ) {
60
+                        $icon       = $social_item['icon'];
61
+                        $class      = $social_item['class'] ?? 'fa';
62
+                        $color      = $social_item['color'];
63
+                        $background = $social_item['background'];
64
+                        $base_url   = $social_item['url'];
65
+                        $id         = $social_item['id'];
66 66
 
67
-						// phpcs:ignore WordPress.NamingConventions.ValidHookName
68
-						$url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
67
+                        // phpcs:ignore WordPress.NamingConventions.ValidHookName
68
+                        $url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
69 69
 
70
-						$html .= '<li style="list-style: none;">';
71
-						$html .= "<a href='" . $url . "'>";
72
-						$html .= Redux_Social_Profiles_Functions::render_icon( $class, $icon, $color, $background, '', false );
73
-						$html .= '</a>';
74
-						$html .= '</li>';
75
-					}
76
-				}
77
-			}
78
-			$html .= '</ul>';
70
+                        $html .= '<li style="list-style: none;">';
71
+                        $html .= "<a href='" . $url . "'>";
72
+                        $html .= Redux_Social_Profiles_Functions::render_icon( $class, $icon, $color, $background, '', false );
73
+                        $html .= '</a>';
74
+                        $html .= '</li>';
75
+                    }
76
+                }
77
+            }
78
+            $html .= '</ul>';
79 79
 
80
-			return $html;
81
-		}
82
-	}
80
+            return $html;
81
+        }
82
+    }
83 83
 }
Please login to merge, or discard this patch.
redux-core/inc/extensions/social_profiles/redux-social-profiles-helpers.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 		$social_profiles = $redux->extensions['social_profiles'];
29 29
 
30 30
 		$redux_options = get_option( $social_profiles->opt_name );
31
-		$settings      = $redux_options[ $social_profiles->field_id ];
31
+		$settings      = $redux_options[$social_profiles->field_id];
32 32
 
33 33
 		foreach ( $settings as $arr ) {
34 34
 			if ( $id === $arr['id'] ) {
35 35
 				if ( $arr['enabled'] ) {
36
-					if ( isset( $arr[ $value ] ) ) {
37
-						return $arr[ $value ];
36
+					if ( isset( $arr[$value] ) ) {
37
+						return $arr[$value];
38 38
 					}
39 39
 				} else {
40 40
 					return '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$social_profiles = $redux->extensions['social_profiles'];
71 71
 
72 72
 		$redux_options = get_option( $social_profiles->opt_name );
73
-		$settings      = $redux_options[ $social_profiles->field_id ];
73
+		$settings      = $redux_options[$social_profiles->field_id];
74 74
 
75 75
 		foreach ( $settings as $arr ) {
76 76
 			if ( $id === $arr['id'] ) {
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -8,93 +8,93 @@
 block discarded – undo
8 8
 defined( 'ABSPATH' ) || exit;
9 9
 
10 10
 if ( ! function_exists( 'redux_social_profile_value_from_id' ) ) {
11
-	/**
12
-	 * Returns social profile value from passed profile ID.
13
-	 *
14
-	 * @param string $opt_name Redux Framework opt_name.
15
-	 * @param string $id       Profile ID.
16
-	 * @param string $value    Social profile value to return (icon, name, class, background, color, url, or order).
17
-	 *
18
-	 * @return      string Returns HTML string when $echo is set to false.  Otherwise, true.
19
-	 * @since       1.0.0
20
-	 * @access      public
21
-	 */
22
-	function redux_social_profile_value_from_id( string $opt_name, string $id, string $value ): string {
23
-		if ( empty( $opt_name ) || empty( $id ) || empty( $value ) ) {
24
-			return '';
25
-		}
26
-
27
-		$redux           = ReduxFrameworkInstances::get_instance( $opt_name );
28
-		$social_profiles = $redux->extensions['social_profiles'];
29
-
30
-		$redux_options = get_option( $social_profiles->opt_name );
31
-		$settings      = $redux_options[ $social_profiles->field_id ];
32
-
33
-		foreach ( $settings as $arr ) {
34
-			if ( $id === $arr['id'] ) {
35
-				if ( $arr['enabled'] ) {
36
-					if ( isset( $arr[ $value ] ) ) {
37
-						return $arr[ $value ];
38
-					}
39
-				} else {
40
-					return '';
41
-				}
42
-			}
43
-		}
44
-
45
-		return '';
46
-	}
11
+    /**
12
+     * Returns social profile value from passed profile ID.
13
+     *
14
+     * @param string $opt_name Redux Framework opt_name.
15
+     * @param string $id       Profile ID.
16
+     * @param string $value    Social profile value to return (icon, name, class, background, color, url, or order).
17
+     *
18
+     * @return      string Returns HTML string when $echo is set to false.  Otherwise, true.
19
+     * @since       1.0.0
20
+     * @access      public
21
+     */
22
+    function redux_social_profile_value_from_id( string $opt_name, string $id, string $value ): string {
23
+        if ( empty( $opt_name ) || empty( $id ) || empty( $value ) ) {
24
+            return '';
25
+        }
26
+
27
+        $redux           = ReduxFrameworkInstances::get_instance( $opt_name );
28
+        $social_profiles = $redux->extensions['social_profiles'];
29
+
30
+        $redux_options = get_option( $social_profiles->opt_name );
31
+        $settings      = $redux_options[ $social_profiles->field_id ];
32
+
33
+        foreach ( $settings as $arr ) {
34
+            if ( $id === $arr['id'] ) {
35
+                if ( $arr['enabled'] ) {
36
+                    if ( isset( $arr[ $value ] ) ) {
37
+                        return $arr[ $value ];
38
+                    }
39
+                } else {
40
+                    return '';
41
+                }
42
+            }
43
+        }
44
+
45
+        return '';
46
+    }
47 47
 }
48 48
 
49 49
 if ( ! function_exists( 'redux_render_icon_from_id' ) ) {
50
-	/**
51
-	 * Renders social icon from passed profile ID.
52
-	 *
53
-	 * @param string  $opt_name Redux Framework opt_name.
54
-	 * @param string  $id       Profile ID.
55
-	 * @param boolean $output   Echos icon HTML when true.  Returns icon HTML when false.
56
-	 * @param string  $a_class  Class name for a tag.
57
-	 *
58
-	 * @return      string Returns HTML string when $echo is set to false.  Otherwise, true.
59
-	 * @since       1.0.0
60
-	 * @access      public
61
-	 */
62
-	function redux_render_icon_from_id( string $opt_name, string $id, bool $output = true, string $a_class = '' ) {
63
-		if ( empty( $opt_name ) || empty( $id ) ) {
64
-			return '';
65
-		}
66
-
67
-		include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
68
-
69
-		$redux           = ReduxFrameworkInstances::get_instance( $opt_name );
70
-		$social_profiles = $redux->extensions['social_profiles'];
71
-
72
-		$redux_options = get_option( $social_profiles->opt_name );
73
-		$settings      = $redux_options[ $social_profiles->field_id ];
74
-
75
-		foreach ( $settings as $arr ) {
76
-			if ( $id === $arr['id'] ) {
77
-				if ( $arr['enabled'] ) {
78
-					$arr['class'] = $arr['class'] ?? 'fa';
79
-
80
-					if ( $output ) {
81
-						echo '<a class="' . esc_attr( $a_class ) . '" href="' . esc_url( $arr['url'] ) . '">';
82
-						Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '' );
83
-						echo '</a>';
84
-
85
-						return true;
86
-					} else {
87
-						$html = '<a class="' . $a_class . '"href="' . $arr['url'] . '">';
88
-
89
-						$html .= Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '', false );
90
-						$html .= '</a>';
91
-
92
-						return $html;
93
-					}
94
-				}
95
-			}
96
-		}
97
-
98
-		return '';
99
-	}
50
+    /**
51
+     * Renders social icon from passed profile ID.
52
+     *
53
+     * @param string  $opt_name Redux Framework opt_name.
54
+     * @param string  $id       Profile ID.
55
+     * @param boolean $output   Echos icon HTML when true.  Returns icon HTML when false.
56
+     * @param string  $a_class  Class name for a tag.
57
+     *
58
+     * @return      string Returns HTML string when $echo is set to false.  Otherwise, true.
59
+     * @since       1.0.0
60
+     * @access      public
61
+     */
62
+    function redux_render_icon_from_id( string $opt_name, string $id, bool $output = true, string $a_class = '' ) {
63
+        if ( empty( $opt_name ) || empty( $id ) ) {
64
+            return '';
65
+        }
66
+
67
+        include_once 'social_profiles/inc/class-redux-social-profiles-functions.php';
68
+
69
+        $redux           = ReduxFrameworkInstances::get_instance( $opt_name );
70
+        $social_profiles = $redux->extensions['social_profiles'];
71
+
72
+        $redux_options = get_option( $social_profiles->opt_name );
73
+        $settings      = $redux_options[ $social_profiles->field_id ];
74
+
75
+        foreach ( $settings as $arr ) {
76
+            if ( $id === $arr['id'] ) {
77
+                if ( $arr['enabled'] ) {
78
+                    $arr['class'] = $arr['class'] ?? 'fa';
79
+
80
+                    if ( $output ) {
81
+                        echo '<a class="' . esc_attr( $a_class ) . '" href="' . esc_url( $arr['url'] ) . '">';
82
+                        Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '' );
83
+                        echo '</a>';
84
+
85
+                        return true;
86
+                    } else {
87
+                        $html = '<a class="' . $a_class . '"href="' . $arr['url'] . '">';
88
+
89
+                        $html .= Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '', false );
90
+                        $html .= '</a>';
91
+
92
+                        return $html;
93
+                    }
94
+                }
95
+            }
96
+        }
97
+
98
+        return '';
99
+    }
100 100
 }
Please login to merge, or discard this patch.
redux-core/inc/extensions/users/redux-users-helpers.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
 		$instances = Redux::all_instances();
20 20
 
21 21
 		foreach ( $_POST as $key => $value ) { // phpcs:ignore WordPress.Security.NonceVerification
22
-			if ( is_array( $value ) && isset( $instances[ $key ] ) ) {
23
-				$instances[ $key ]->extensions['users']->user_meta_save( $profile_id );
22
+			if ( is_array( $value ) && isset( $instances[$key] ) ) {
23
+				$instances[$key]->extensions['users']->user_meta_save( $profile_id );
24 24
 			}
25 25
 		}
26 26
 	}
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
10 10
 // Helper function to bypass WordPress hook priorities.  ;).
11 11
 if ( ! function_exists( 'create_term_redux_users' ) ) {
12 12
 
13
-	/**
14
-	 * Create_term_redux_users.
15
-	 *
16
-	 * @param string $profile_id Profile ID.
17
-	 */
18
-	function create_term_redux_users( string $profile_id ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Existing API already used in themes. Cannot change due to backward compatibility. Contains the plugin name.
19
-		$instances = Redux::all_instances();
13
+    /**
14
+     * Create_term_redux_users.
15
+     *
16
+     * @param string $profile_id Profile ID.
17
+     */
18
+    function create_term_redux_users( string $profile_id ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Existing API already used in themes. Cannot change due to backward compatibility. Contains the plugin name.
19
+        $instances = Redux::all_instances();
20 20
 
21
-		foreach ( $_POST as $key => $value ) { // phpcs:ignore WordPress.Security.NonceVerification
22
-			if ( is_array( $value ) && isset( $instances[ $key ] ) ) {
23
-				$instances[ $key ]->extensions['users']->user_meta_save( $profile_id );
24
-			}
25
-		}
26
-	}
21
+        foreach ( $_POST as $key => $value ) { // phpcs:ignore WordPress.Security.NonceVerification
22
+            if ( is_array( $value ) && isset( $instances[ $key ] ) ) {
23
+                $instances[ $key ]->extensions['users']->user_meta_save( $profile_id );
24
+            }
25
+        }
26
+    }
27 27
 }
28 28
 
29 29
 add_action( 'create_term', 'create_term_redux_users', 4 );
Please login to merge, or discard this patch.
redux-core/inc/fields/link_color/class-redux-link-color.php 1 patch
Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -12,347 +12,347 @@
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_Link_Color', false ) ) {
14 14
 
15
-	/**
16
-	 * Main Redux_link_color class
17
-	 *
18
-	 * @since       1.0.0
19
-	 */
20
-	class Redux_Link_Color extends Redux_Field {
21
-
22
-		/**
23
-		 * Set field and value defaults.
24
-		 */
25
-		public function set_defaults() {
26
-			$defaults = array(
27
-				'regular' => true,
28
-				'hover'   => true,
29
-				'visited' => false,
30
-				'active'  => true,
31
-				'focus'   => false,
32
-			);
33
-
34
-			$this->field = wp_parse_args( $this->field, $defaults );
35
-
36
-			$defaults = array(
37
-				'regular' => '',
38
-				'hover'   => '',
39
-				'visited' => '',
40
-				'active'  => '',
41
-				'focus'   => '',
42
-			);
43
-
44
-			$this->value = wp_parse_args( $this->value, $defaults );
45
-
46
-			// In case user passes no default values.
47
-			if ( isset( $this->field['default'] ) ) {
48
-				$this->field['default'] = wp_parse_args( $this->field['default'], $defaults );
49
-			} else {
50
-				$this->field['default'] = $defaults;
51
-			}
52
-		}
53
-
54
-		/**
55
-		 * Field Render Function.
56
-		 * Takes the vars and outputs the HTML for the field in the settings.
57
-		 *
58
-		 * @since       1.0.0
59
-		 * @access      public
60
-		 * @return      void
61
-		 */
62
-		public function render() {
63
-			if ( true === $this->field['regular'] && false !== $this->field['default']['regular'] ) {
64
-				echo '<span class="linkColor">';
65
-				echo '<strong>' . esc_html__( 'Regular', 'redux-framework' ) . '</strong>&nbsp;';
66
-				echo '<input ';
67
-				echo 'id="' . esc_attr( $this->field['id'] ) . '-regular" ';
68
-				echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[regular]"';
69
-				echo 'value="' . esc_attr( $this->value['regular'] ) . '"';
70
-				echo 'class="color-picker redux-color redux-color-regular redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
71
-				echo 'type="text"';
72
-				echo 'data-default-color="' . esc_attr( $this->field['default']['regular'] ) . '"';
73
-
74
-				$data = array(
75
-					'field' => $this->field,
76
-					'index' => 'regular',
77
-				);
78
-
79
-				echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
80
-
81
-				echo '>';
82
-				echo '</span>';
83
-			}
84
-
85
-			if ( true === $this->field['hover'] && false !== $this->field['default']['hover'] ) {
86
-				echo '<span class="linkColor">';
87
-				echo '<strong>' . esc_html__( 'Hover', 'redux-framework' ) . '</strong>&nbsp;';
88
-				echo '<input ';
89
-				echo 'id="' . esc_attr( $this->field['id'] ) . '-hover"';
90
-				echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[hover]"';
91
-				echo 'value="' . esc_attr( $this->value['hover'] ) . '"';
92
-				echo 'class="color-picker redux-color redux-color-hover redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
93
-				echo 'type="text"';
94
-				echo 'data-default-color="' . esc_attr( $this->field['default']['hover'] ) . '"';
95
-
96
-				$data = array(
97
-					'field' => $this->field,
98
-					'index' => 'hover',
99
-				);
100
-
101
-				echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
102
-
103
-				echo '>';
104
-				echo '</span>';
105
-			}
106
-
107
-			if ( true === $this->field['visited'] && false !== $this->field['default']['visited'] ) {
108
-				echo '<span class="linkColor">';
109
-				echo '<strong>' . esc_html__( 'Visited', 'redux-framework' ) . '</strong>&nbsp;';
110
-				echo '<input ';
111
-				echo 'id="' . esc_attr( $this->field['id'] ) . '-visited"';
112
-				echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[visited]"';
113
-				echo 'value="' . esc_attr( $this->value['visited'] ) . '"';
114
-				echo 'class="color-picker redux-color redux-color-visited redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
115
-				echo 'type="text"';
116
-				echo 'data-default-color="' . esc_attr( $this->field['default']['visited'] ) . '"';
117
-
118
-				$data = array(
119
-					'field' => $this->field,
120
-					'index' => 'visited',
121
-				);
122
-
123
-				echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
124
-
125
-				echo '>';
126
-				echo '</span>';
127
-			}
128
-
129
-			if ( true === $this->field['active'] && false !== $this->field['default']['active'] ) {
130
-				echo '<span class="linkColor">';
131
-				echo '<strong>' . esc_html__( 'Active', 'redux-framework' ) . '</strong>&nbsp;';
132
-				echo '<input ';
133
-				echo 'id="' . esc_attr( $this->field['id'] ) . '-active"';
134
-				echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[active]"';
135
-				echo 'value="' . esc_attr( $this->value['active'] ) . '"';
136
-				echo 'class="color-picker redux-color redux-color-active redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
137
-				echo 'type="text"';
138
-				echo 'data-default-color="' . esc_attr( $this->field['default']['active'] ) . '"';
139
-
140
-				$data = array(
141
-					'field' => $this->field,
142
-					'index' => 'active',
143
-				);
144
-
145
-				echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
146
-
147
-				echo '>';
148
-				echo '</span>';
149
-			}
150
-
151
-			if ( true === $this->field['focus'] && false !== $this->field['default']['focus'] ) {
152
-				echo '<span class="linkColor">';
153
-				echo '<strong>' . esc_html__( 'Focus', 'redux-framework' ) . '</strong>&nbsp;';
154
-				echo '<input ';
155
-				echo 'id="' . esc_attr( $this->field['id'] ) . '-focus"';
156
-				echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[focus]"';
157
-				echo 'value="' . esc_attr( $this->value['focus'] ) . '"';
158
-				echo 'class="color-picker redux-color redux-color-focus redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
159
-				echo 'type="text"';
160
-				echo 'data-default-color="' . esc_attr( $this->field['default']['focus'] ) . '"';
161
-
162
-				$data = array(
163
-					'field' => $this->field,
164
-					'index' => 'focus',
165
-				);
166
-
167
-				echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
168
-
169
-				echo '>';
170
-				echo '</span>';
171
-			}
172
-		}
173
-
174
-
175
-		/**
176
-		 * Do enqueue for each field instance.
177
-		 *
178
-		 * @return void
179
-		 */
180
-		public function always_enqueue() {
181
-			if ( isset( $this->field['color_alpha'] ) && $this->field['color_alpha'] ) {
182
-				if ( ! wp_script_is( 'redux-wp-color-picker-alpha' ) ) {
183
-					wp_enqueue_script( 'redux-wp-color-picker-alpha' );
184
-				}
185
-			}
186
-		}
187
-
188
-		/**
189
-		 * Enqueue Function.
190
-		 * If this field requires any scripts, or CSS define this function and register/enqueue the scripts/css
191
-		 *
192
-		 * @since       1.0.0
193
-		 * @access      public
194
-		 * @return      void
195
-		 */
196
-		public function enqueue() {
197
-			wp_enqueue_style( 'wp-color-picker' );
198
-
199
-			$dep_array = array( 'jquery', 'wp-color-picker', 'redux-js' );
200
-
201
-			wp_enqueue_script(
202
-				'redux-field-link-color',
203
-				Redux_Core::$url . 'inc/fields/link_color/redux-link-color' . Redux_Functions::is_min() . '.js',
204
-				$dep_array,
205
-				$this->timestamp,
206
-				true
207
-			);
208
-
209
-			if ( $this->parent->args['dev_mode'] ) {
210
-				wp_enqueue_style( 'redux-color-picker' );
211
-
212
-				wp_enqueue_style(
213
-					'redux-field-link_color',
214
-					Redux_Core::$url . 'inc/fields/link_color/redux-link-color.css',
215
-					array(),
216
-					$this->timestamp
217
-				);
218
-			}
219
-		}
220
-
221
-		/**
222
-		 * Compile CSS data for output.
223
-		 *
224
-		 * @param string $data CSS data.
225
-		 *
226
-		 * @return array
227
-		 */
228
-		public function css_style( $data ): array {
229
-			$style = array();
230
-
231
-			if ( ! empty( $this->value['regular'] ) && true === $this->field['regular'] && false !== $this->field['default']['regular'] ) {
232
-				$style[] = 'color:' . $this->value['regular'] . ';';
233
-			}
234
-
235
-			if ( ! empty( $this->value['visited'] ) && true === $this->field['visited'] && false !== $this->field['default']['visited'] ) {
236
-				$style['visited'] = 'color:' . $this->value['visited'] . ';';
237
-			}
238
-
239
-			if ( ! empty( $this->value['hover'] ) && true === $this->field['hover'] && false !== $this->field['default']['hover'] ) {
240
-				$style['hover'] = 'color:' . $this->value['hover'] . ';';
241
-			}
242
-
243
-			if ( ! empty( $this->value['active'] ) && true === $this->field['active'] && false !== $this->field['default']['active'] ) {
244
-				$style['active'] = 'color:' . $this->value['active'] . ';';
245
-			}
246
-
247
-			if ( ! empty( $this->value['focus'] ) && true === $this->field['focus'] && false !== $this->field['default']['focus'] ) {
248
-				$style['focus'] = 'color:' . $this->value['focus'] . ';';
249
-			}
250
-
251
-			return $style;
252
-		}
253
-
254
-		/**
255
-		 * Output CSS/compiler.
256
-		 *
257
-		 * @param string|null|array $style Style to output.
258
-		 */
259
-		public function output( $style = '' ) {
260
-			if ( ! empty( $style ) ) {
261
-				if ( isset( $this->field['output'] ) && ! is_array( $this->field['output'] ) ) {
262
-					$this->field['output'] = array( $this->field['output'] );
263
-				}
264
-
265
-				if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) {
266
-					$style_string = '';
267
-
268
-					if ( isset( $this->field['output']['important'] ) ) {
269
-						if ( $this->field['output']['important'] ) {
270
-							$style = str_replace( ';', ' !important;', $style );
271
-						}
272
-						unset( $this->field['output']['important'] );
273
-					}
274
-
275
-					foreach ( $style as $key => $value ) {
276
-						if ( is_numeric( $key ) ) {
277
-							$style_string .= implode( ',', $this->field['output'] ) . '{' . $value . '}';
278
-						} elseif ( 1 === count( $this->field['output'] ) ) {
279
-								$elem = '';
280
-
281
-							foreach ( $this->field['output'] as $elem ) {
282
-								break;
283
-							}
284
-
285
-							if ( false !== strpos( $elem, ',' ) ) {
286
-								$selector_arr = explode( ',', $elem );
287
-								$sel_list     = '';
288
-
289
-								foreach ( $selector_arr as $selector ) {
290
-									$sel_list .= $selector . ':' . $key . ',';
291
-								}
292
-
293
-								$sel_list      = rtrim( $sel_list, ',' );
294
-								$style_string .= $sel_list . '{' . $value . '}';
295
-							} else {
296
-								$style_string .= $elem . ':' . $key . '{' . $value . '}';
297
-							}
298
-						} else {
299
-							$blah = '';
300
-							foreach ( $this->field['output'] as $sel ) {
301
-								$blah .= $sel . ':' . $key . ',';
302
-							}
303
-
304
-							$blah          = substr( $blah, 0, strlen( $blah ) - 1 );
305
-							$style_string .= $blah . '{' . $value . '}';
306
-						}
307
-					}
308
-
309
-					$this->parent->outputCSS .= $style_string;
310
-				}
311
-
312
-				if ( isset( $this->field['compiler'] ) && ! is_array( $this->field['compiler'] ) ) {
313
-					$this->field['compiler'] = array( $this->field['compiler'] );
314
-				}
315
-
316
-				if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) {
317
-					$style_string = '';
318
-
319
-					if ( isset( $this->field['compiler']['important'] ) ) {
320
-						if ( $this->field['compiler']['important'] ) {
321
-							$style = str_replace( ';', ' !important;', $style );
322
-						}
323
-						unset( $this->field['compiler']['important'] );
324
-					}
325
-
326
-					foreach ( $style as $key => $value ) {
327
-						if ( is_numeric( $key ) ) {
328
-							$style_string .= implode( ',', $this->field['compiler'] ) . '{' . $value . '}';
329
-						} elseif ( 1 === count( $this->field['compiler'] ) ) {
330
-								$style_string .= $this->field['compiler'][0] . ':' . $key . '{' . $value . '}';
331
-						} else {
332
-							$blah = '';
333
-							foreach ( $this->field['compiler'] as $sel ) {
334
-								$blah .= $sel . ':' . $key . ',';
335
-							}
336
-
337
-							$blah          = substr( $blah, 0, strlen( $blah ) - 1 );
338
-							$style_string .= $blah . '{' . $value . '}';
339
-						}
340
-					}
341
-					$this->parent->compilerCSS .= $style_string;
342
-				}
343
-			}
344
-		}
345
-
346
-		/**
347
-		 * Enable output_variables to be generated.
348
-		 *
349
-		 * @since       4.0.3
350
-		 * @return void
351
-		 */
352
-		public function output_variables() {
353
-			// No code needed, just defining the method is enough.
354
-		}
355
-	}
15
+    /**
16
+     * Main Redux_link_color class
17
+     *
18
+     * @since       1.0.0
19
+     */
20
+    class Redux_Link_Color extends Redux_Field {
21
+
22
+        /**
23
+         * Set field and value defaults.
24
+         */
25
+        public function set_defaults() {
26
+            $defaults = array(
27
+                'regular' => true,
28
+                'hover'   => true,
29
+                'visited' => false,
30
+                'active'  => true,
31
+                'focus'   => false,
32
+            );
33
+
34
+            $this->field = wp_parse_args( $this->field, $defaults );
35
+
36
+            $defaults = array(
37
+                'regular' => '',
38
+                'hover'   => '',
39
+                'visited' => '',
40
+                'active'  => '',
41
+                'focus'   => '',
42
+            );
43
+
44
+            $this->value = wp_parse_args( $this->value, $defaults );
45
+
46
+            // In case user passes no default values.
47
+            if ( isset( $this->field['default'] ) ) {
48
+                $this->field['default'] = wp_parse_args( $this->field['default'], $defaults );
49
+            } else {
50
+                $this->field['default'] = $defaults;
51
+            }
52
+        }
53
+
54
+        /**
55
+         * Field Render Function.
56
+         * Takes the vars and outputs the HTML for the field in the settings.
57
+         *
58
+         * @since       1.0.0
59
+         * @access      public
60
+         * @return      void
61
+         */
62
+        public function render() {
63
+            if ( true === $this->field['regular'] && false !== $this->field['default']['regular'] ) {
64
+                echo '<span class="linkColor">';
65
+                echo '<strong>' . esc_html__( 'Regular', 'redux-framework' ) . '</strong>&nbsp;';
66
+                echo '<input ';
67
+                echo 'id="' . esc_attr( $this->field['id'] ) . '-regular" ';
68
+                echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[regular]"';
69
+                echo 'value="' . esc_attr( $this->value['regular'] ) . '"';
70
+                echo 'class="color-picker redux-color redux-color-regular redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
71
+                echo 'type="text"';
72
+                echo 'data-default-color="' . esc_attr( $this->field['default']['regular'] ) . '"';
73
+
74
+                $data = array(
75
+                    'field' => $this->field,
76
+                    'index' => 'regular',
77
+                );
78
+
79
+                echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
80
+
81
+                echo '>';
82
+                echo '</span>';
83
+            }
84
+
85
+            if ( true === $this->field['hover'] && false !== $this->field['default']['hover'] ) {
86
+                echo '<span class="linkColor">';
87
+                echo '<strong>' . esc_html__( 'Hover', 'redux-framework' ) . '</strong>&nbsp;';
88
+                echo '<input ';
89
+                echo 'id="' . esc_attr( $this->field['id'] ) . '-hover"';
90
+                echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[hover]"';
91
+                echo 'value="' . esc_attr( $this->value['hover'] ) . '"';
92
+                echo 'class="color-picker redux-color redux-color-hover redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
93
+                echo 'type="text"';
94
+                echo 'data-default-color="' . esc_attr( $this->field['default']['hover'] ) . '"';
95
+
96
+                $data = array(
97
+                    'field' => $this->field,
98
+                    'index' => 'hover',
99
+                );
100
+
101
+                echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
102
+
103
+                echo '>';
104
+                echo '</span>';
105
+            }
106
+
107
+            if ( true === $this->field['visited'] && false !== $this->field['default']['visited'] ) {
108
+                echo '<span class="linkColor">';
109
+                echo '<strong>' . esc_html__( 'Visited', 'redux-framework' ) . '</strong>&nbsp;';
110
+                echo '<input ';
111
+                echo 'id="' . esc_attr( $this->field['id'] ) . '-visited"';
112
+                echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[visited]"';
113
+                echo 'value="' . esc_attr( $this->value['visited'] ) . '"';
114
+                echo 'class="color-picker redux-color redux-color-visited redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
115
+                echo 'type="text"';
116
+                echo 'data-default-color="' . esc_attr( $this->field['default']['visited'] ) . '"';
117
+
118
+                $data = array(
119
+                    'field' => $this->field,
120
+                    'index' => 'visited',
121
+                );
122
+
123
+                echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
124
+
125
+                echo '>';
126
+                echo '</span>';
127
+            }
128
+
129
+            if ( true === $this->field['active'] && false !== $this->field['default']['active'] ) {
130
+                echo '<span class="linkColor">';
131
+                echo '<strong>' . esc_html__( 'Active', 'redux-framework' ) . '</strong>&nbsp;';
132
+                echo '<input ';
133
+                echo 'id="' . esc_attr( $this->field['id'] ) . '-active"';
134
+                echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[active]"';
135
+                echo 'value="' . esc_attr( $this->value['active'] ) . '"';
136
+                echo 'class="color-picker redux-color redux-color-active redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
137
+                echo 'type="text"';
138
+                echo 'data-default-color="' . esc_attr( $this->field['default']['active'] ) . '"';
139
+
140
+                $data = array(
141
+                    'field' => $this->field,
142
+                    'index' => 'active',
143
+                );
144
+
145
+                echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
146
+
147
+                echo '>';
148
+                echo '</span>';
149
+            }
150
+
151
+            if ( true === $this->field['focus'] && false !== $this->field['default']['focus'] ) {
152
+                echo '<span class="linkColor">';
153
+                echo '<strong>' . esc_html__( 'Focus', 'redux-framework' ) . '</strong>&nbsp;';
154
+                echo '<input ';
155
+                echo 'id="' . esc_attr( $this->field['id'] ) . '-focus"';
156
+                echo 'name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[focus]"';
157
+                echo 'value="' . esc_attr( $this->value['focus'] ) . '"';
158
+                echo 'class="color-picker redux-color redux-color-focus redux-color-init ' . esc_attr( $this->field['class'] ) . '"';
159
+                echo 'type="text"';
160
+                echo 'data-default-color="' . esc_attr( $this->field['default']['focus'] ) . '"';
161
+
162
+                $data = array(
163
+                    'field' => $this->field,
164
+                    'index' => 'focus',
165
+                );
166
+
167
+                echo Redux_Functions_Ex::output_alpha_data( $data ); // phpcs:ignore WordPress.Security.EscapeOutput
168
+
169
+                echo '>';
170
+                echo '</span>';
171
+            }
172
+        }
173
+
174
+
175
+        /**
176
+         * Do enqueue for each field instance.
177
+         *
178
+         * @return void
179
+         */
180
+        public function always_enqueue() {
181
+            if ( isset( $this->field['color_alpha'] ) && $this->field['color_alpha'] ) {
182
+                if ( ! wp_script_is( 'redux-wp-color-picker-alpha' ) ) {
183
+                    wp_enqueue_script( 'redux-wp-color-picker-alpha' );
184
+                }
185
+            }
186
+        }
187
+
188
+        /**
189
+         * Enqueue Function.
190
+         * If this field requires any scripts, or CSS define this function and register/enqueue the scripts/css
191
+         *
192
+         * @since       1.0.0
193
+         * @access      public
194
+         * @return      void
195
+         */
196
+        public function enqueue() {
197
+            wp_enqueue_style( 'wp-color-picker' );
198
+
199
+            $dep_array = array( 'jquery', 'wp-color-picker', 'redux-js' );
200
+
201
+            wp_enqueue_script(
202
+                'redux-field-link-color',
203
+                Redux_Core::$url . 'inc/fields/link_color/redux-link-color' . Redux_Functions::is_min() . '.js',
204
+                $dep_array,
205
+                $this->timestamp,
206
+                true
207
+            );
208
+
209
+            if ( $this->parent->args['dev_mode'] ) {
210
+                wp_enqueue_style( 'redux-color-picker' );
211
+
212
+                wp_enqueue_style(
213
+                    'redux-field-link_color',
214
+                    Redux_Core::$url . 'inc/fields/link_color/redux-link-color.css',
215
+                    array(),
216
+                    $this->timestamp
217
+                );
218
+            }
219
+        }
220
+
221
+        /**
222
+         * Compile CSS data for output.
223
+         *
224
+         * @param string $data CSS data.
225
+         *
226
+         * @return array
227
+         */
228
+        public function css_style( $data ): array {
229
+            $style = array();
230
+
231
+            if ( ! empty( $this->value['regular'] ) && true === $this->field['regular'] && false !== $this->field['default']['regular'] ) {
232
+                $style[] = 'color:' . $this->value['regular'] . ';';
233
+            }
234
+
235
+            if ( ! empty( $this->value['visited'] ) && true === $this->field['visited'] && false !== $this->field['default']['visited'] ) {
236
+                $style['visited'] = 'color:' . $this->value['visited'] . ';';
237
+            }
238
+
239
+            if ( ! empty( $this->value['hover'] ) && true === $this->field['hover'] && false !== $this->field['default']['hover'] ) {
240
+                $style['hover'] = 'color:' . $this->value['hover'] . ';';
241
+            }
242
+
243
+            if ( ! empty( $this->value['active'] ) && true === $this->field['active'] && false !== $this->field['default']['active'] ) {
244
+                $style['active'] = 'color:' . $this->value['active'] . ';';
245
+            }
246
+
247
+            if ( ! empty( $this->value['focus'] ) && true === $this->field['focus'] && false !== $this->field['default']['focus'] ) {
248
+                $style['focus'] = 'color:' . $this->value['focus'] . ';';
249
+            }
250
+
251
+            return $style;
252
+        }
253
+
254
+        /**
255
+         * Output CSS/compiler.
256
+         *
257
+         * @param string|null|array $style Style to output.
258
+         */
259
+        public function output( $style = '' ) {
260
+            if ( ! empty( $style ) ) {
261
+                if ( isset( $this->field['output'] ) && ! is_array( $this->field['output'] ) ) {
262
+                    $this->field['output'] = array( $this->field['output'] );
263
+                }
264
+
265
+                if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) {
266
+                    $style_string = '';
267
+
268
+                    if ( isset( $this->field['output']['important'] ) ) {
269
+                        if ( $this->field['output']['important'] ) {
270
+                            $style = str_replace( ';', ' !important;', $style );
271
+                        }
272
+                        unset( $this->field['output']['important'] );
273
+                    }
274
+
275
+                    foreach ( $style as $key => $value ) {
276
+                        if ( is_numeric( $key ) ) {
277
+                            $style_string .= implode( ',', $this->field['output'] ) . '{' . $value . '}';
278
+                        } elseif ( 1 === count( $this->field['output'] ) ) {
279
+                                $elem = '';
280
+
281
+                            foreach ( $this->field['output'] as $elem ) {
282
+                                break;
283
+                            }
284
+
285
+                            if ( false !== strpos( $elem, ',' ) ) {
286
+                                $selector_arr = explode( ',', $elem );
287
+                                $sel_list     = '';
288
+
289
+                                foreach ( $selector_arr as $selector ) {
290
+                                    $sel_list .= $selector . ':' . $key . ',';
291
+                                }
292
+
293
+                                $sel_list      = rtrim( $sel_list, ',' );
294
+                                $style_string .= $sel_list . '{' . $value . '}';
295
+                            } else {
296
+                                $style_string .= $elem . ':' . $key . '{' . $value . '}';
297
+                            }
298
+                        } else {
299
+                            $blah = '';
300
+                            foreach ( $this->field['output'] as $sel ) {
301
+                                $blah .= $sel . ':' . $key . ',';
302
+                            }
303
+
304
+                            $blah          = substr( $blah, 0, strlen( $blah ) - 1 );
305
+                            $style_string .= $blah . '{' . $value . '}';
306
+                        }
307
+                    }
308
+
309
+                    $this->parent->outputCSS .= $style_string;
310
+                }
311
+
312
+                if ( isset( $this->field['compiler'] ) && ! is_array( $this->field['compiler'] ) ) {
313
+                    $this->field['compiler'] = array( $this->field['compiler'] );
314
+                }
315
+
316
+                if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) {
317
+                    $style_string = '';
318
+
319
+                    if ( isset( $this->field['compiler']['important'] ) ) {
320
+                        if ( $this->field['compiler']['important'] ) {
321
+                            $style = str_replace( ';', ' !important;', $style );
322
+                        }
323
+                        unset( $this->field['compiler']['important'] );
324
+                    }
325
+
326
+                    foreach ( $style as $key => $value ) {
327
+                        if ( is_numeric( $key ) ) {
328
+                            $style_string .= implode( ',', $this->field['compiler'] ) . '{' . $value . '}';
329
+                        } elseif ( 1 === count( $this->field['compiler'] ) ) {
330
+                                $style_string .= $this->field['compiler'][0] . ':' . $key . '{' . $value . '}';
331
+                        } else {
332
+                            $blah = '';
333
+                            foreach ( $this->field['compiler'] as $sel ) {
334
+                                $blah .= $sel . ':' . $key . ',';
335
+                            }
336
+
337
+                            $blah          = substr( $blah, 0, strlen( $blah ) - 1 );
338
+                            $style_string .= $blah . '{' . $value . '}';
339
+                        }
340
+                    }
341
+                    $this->parent->compilerCSS .= $style_string;
342
+                }
343
+            }
344
+        }
345
+
346
+        /**
347
+         * Enable output_variables to be generated.
348
+         *
349
+         * @since       4.0.3
350
+         * @return void
351
+         */
352
+        public function output_variables() {
353
+            // No code needed, just defining the method is enough.
354
+        }
355
+    }
356 356
 }
357 357
 
358 358
 class_alias( 'Redux_Link_Color', 'ReduxFramework_Link_Color' );
Please login to merge, or discard this patch.