Completed
Push — master ( f73f9d...7388a0 )
by
unknown
35s
created
uninstall.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 // If uninstall, not called from WordPress, then exit.
11 11
 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
-	exit;
12
+    exit;
13 13
 }
14 14
 
15 15
 // TODO: Define uninstall functionality here.
Please login to merge, or discard this patch.
sample/sample-config.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 }
14 14
 
15 15
 // This is your option name where all the Redux data is stored.
16
-$opt_name = 'redux_demo';  // YOU MUST CHANGE THIS.  DO NOT USE 'redux_demo' IN YOUR PROJECT!!!
16
+$opt_name = 'redux_demo'; // YOU MUST CHANGE THIS.  DO NOT USE 'redux_demo' IN YOUR PROJECT!!!
17 17
 
18 18
 // Uncomment to disable demo mode.
19 19
 /* Redux::disable_demo(); */  // phpcs:ignore Squiz.PHP.CommentedOutCode
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
 		$warning = false;
644 644
 
645 645
 		// Do your validation.
646
-		if ( 1 === (int) $value ) {
646
+		if ( 1 === ( int ) $value ) {
647 647
 			$error = true;
648 648
 			$value = $existing_value;
649
-		} elseif ( 2 === (int) $value ) {
649
+		} elseif ( 2 === ( int ) $value ) {
650 650
 			$warning = true;
651 651
 			$value   = $existing_value;
652 652
 		}
Please login to merge, or discard this patch.
Indentation   +423 added lines, -423 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 defined( 'ABSPATH' ) || exit;
11 11
 
12 12
 if ( ! class_exists( 'Redux' ) ) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 // This is your option name where all the Redux data is stored.
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 $sample_patterns      = array();
32 32
 
33 33
 if ( is_dir( $sample_patterns_path ) ) {
34
-	$sample_patterns_dir = opendir( $sample_patterns_path );
35
-
36
-	if ( $sample_patterns_dir ) {
37
-
38
-		// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
39
-		while ( false !== ( $sample_patterns_file = readdir( $sample_patterns_dir ) ) ) {
40
-			if ( stristr( $sample_patterns_file, '.png' ) !== false || stristr( $sample_patterns_file, '.jpg' ) !== false ) {
41
-				$name              = explode( '.', $sample_patterns_file );
42
-				$name              = str_replace( '.' . end( $name ), '', $sample_patterns_file );
43
-				$sample_patterns[] = array(
44
-					'alt' => $name,
45
-					'img' => $sample_patterns_url . $sample_patterns_file,
46
-				);
47
-			}
48
-		}
49
-	}
34
+    $sample_patterns_dir = opendir( $sample_patterns_path );
35
+
36
+    if ( $sample_patterns_dir ) {
37
+
38
+        // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
39
+        while ( false !== ( $sample_patterns_file = readdir( $sample_patterns_dir ) ) ) {
40
+            if ( stristr( $sample_patterns_file, '.png' ) !== false || stristr( $sample_patterns_file, '.jpg' ) !== false ) {
41
+                $name              = explode( '.', $sample_patterns_file );
42
+                $name              = str_replace( '.' . end( $name ), '', $sample_patterns_file );
43
+                $sample_patterns[] = array(
44
+                    'alt' => $name,
45
+                    'img' => $sample_patterns_url . $sample_patterns_file,
46
+                );
47
+            }
48
+        }
49
+    }
50 50
 }
51 51
 
52 52
 // Used to except HTML tags in description arguments where esc_html would remove.
53 53
 $kses_exceptions = array(
54
-	'a'      => array(
55
-		'href' => array(),
56
-	),
57
-	'strong' => array(),
58
-	'br'     => array(),
59
-	'code'   => array(),
54
+    'a'      => array(
55
+        'href' => array(),
56
+    ),
57
+    'strong' => array(),
58
+    'br'     => array(),
59
+    'code'   => array(),
60 60
 );
61 61
 
62 62
 /*
@@ -71,153 +71,153 @@  discard block
 block discarded – undo
71 71
 
72 72
 // TYPICAL → Change these values as you need/desire.
73 73
 $args = array(
74
-	// This is where your data is stored in the database and also becomes your global variable name.
75
-	'opt_name'                  => $opt_name,
74
+    // This is where your data is stored in the database and also becomes your global variable name.
75
+    'opt_name'                  => $opt_name,
76 76
 
77
-	// Name that appears at the top of your panel.
78
-	'display_name'              => $theme->get( 'Name' ),
77
+    // Name that appears at the top of your panel.
78
+    'display_name'              => $theme->get( 'Name' ),
79 79
 
80
-	// Version that appears at the top of your panel.
81
-	'display_version'           => $theme->get( 'Version' ),
80
+    // Version that appears at the top of your panel.
81
+    'display_version'           => $theme->get( 'Version' ),
82 82
 
83
-	// Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only).
84
-	'menu_type'                 => 'menu',
83
+    // Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only).
84
+    'menu_type'                 => 'menu',
85 85
 
86
-	// Show the sections below the admin menu item or not.
87
-	'allow_sub_menu'            => true,
86
+    // Show the sections below the admin menu item or not.
87
+    'allow_sub_menu'            => true,
88 88
 
89
-	// The text to appear in the admin menu.
90
-	'menu_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
89
+    // The text to appear in the admin menu.
90
+    'menu_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
91 91
 
92
-	// The text to appear on the page title.
93
-	'page_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
92
+    // The text to appear on the page title.
93
+    'page_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
94 94
 
95
-	// Disable to create your own Google fonts loader.
96
-	'disable_google_fonts_link' => false,
95
+    // Disable to create your own Google fonts loader.
96
+    'disable_google_fonts_link' => false,
97 97
 
98
-	// Show the panel pages on the admin bar.
99
-	'admin_bar'                 => true,
98
+    // Show the panel pages on the admin bar.
99
+    'admin_bar'                 => true,
100 100
 
101
-	// Icon for the admin bar menu.
102
-	'admin_bar_icon'            => 'dashicons-portfolio',
101
+    // Icon for the admin bar menu.
102
+    'admin_bar_icon'            => 'dashicons-portfolio',
103 103
 
104
-	// Priority for the admin bar menu.
105
-	'admin_bar_priority'        => 50,
104
+    // Priority for the admin bar menu.
105
+    'admin_bar_priority'        => 50,
106 106
 
107
-	// Sets a different name for your global variable other than the opt_name.
108
-	'global_variable'           => $opt_name,
107
+    // Sets a different name for your global variable other than the opt_name.
108
+    'global_variable'           => $opt_name,
109 109
 
110
-	// Show the time the page took to load, etc. (forced on while on localhost or when WP_DEBUG is enabled).
111
-	'dev_mode'                  => true,
110
+    // Show the time the page took to load, etc. (forced on while on localhost or when WP_DEBUG is enabled).
111
+    'dev_mode'                  => true,
112 112
 
113
-	// Enable basic customizer support.
114
-	'customizer'                => true,
113
+    // Enable basic customizer support.
114
+    'customizer'                => true,
115 115
 
116
-	// Allow the panel to open expanded.
117
-	'open_expanded'             => false,
116
+    // Allow the panel to open expanded.
117
+    'open_expanded'             => false,
118 118
 
119
-	// Disable the save warning when a user changes a field.
120
-	'disable_save_warn'         => false,
119
+    // Disable the save warning when a user changes a field.
120
+    'disable_save_warn'         => false,
121 121
 
122
-	// Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
123
-	'page_priority'             => 90,
122
+    // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
123
+    'page_priority'             => 90,
124 124
 
125
-	// For a full list of options, visit: https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters.
126
-	'page_parent'               => 'themes.php',
125
+    // For a full list of options, visit: https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters.
126
+    'page_parent'               => 'themes.php',
127 127
 
128
-	// Permissions needed to access the options panel.
129
-	'page_permissions'          => 'manage_options',
128
+    // Permissions needed to access the options panel.
129
+    'page_permissions'          => 'manage_options',
130 130
 
131
-	// Specify a custom URL to an icon.
132
-	'menu_icon'                 => '',
131
+    // Specify a custom URL to an icon.
132
+    'menu_icon'                 => '',
133 133
 
134
-	// Force your panel to always open to a specific tab (by id).
135
-	'last_tab'                  => '',
134
+    // Force your panel to always open to a specific tab (by id).
135
+    'last_tab'                  => '',
136 136
 
137
-	// Icon displayed in the admin panel next to your menu_title.
138
-	'page_icon'                 => 'icon-themes',
137
+    // Icon displayed in the admin panel next to your menu_title.
138
+    'page_icon'                 => 'icon-themes',
139 139
 
140
-	// Page slug used to denote the panel, will be based off page title, then menu title, then opt_name if not provided.
141
-	'page_slug'                 => $opt_name,
140
+    // Page slug used to denote the panel, will be based off page title, then menu title, then opt_name if not provided.
141
+    'page_slug'                 => $opt_name,
142 142
 
143
-	// On load save the defaults to DB before user clicks save.
144
-	'save_defaults'             => true,
143
+    // On load save the defaults to DB before user clicks save.
144
+    'save_defaults'             => true,
145 145
 
146
-	// Display the default value next to each field when not set to the default value.
147
-	'default_show'              => false,
146
+    // Display the default value next to each field when not set to the default value.
147
+    'default_show'              => false,
148 148
 
149
-	// What to print by the field's title if the value shown is default.
150
-	'default_mark'              => '*',
149
+    // What to print by the field's title if the value shown is default.
150
+    'default_mark'              => '*',
151 151
 
152
-	// Shows the Import/Export panel when not used as a field.
153
-	'show_import_export'        => true,
152
+    // Shows the Import/Export panel when not used as a field.
153
+    'show_import_export'        => true,
154 154
 
155
-	// Shows the Options Object for debugging purposes. Show be set to false before deploying.
156
-	'show_options_object'       => true,
155
+    // Shows the Options Object for debugging purposes. Show be set to false before deploying.
156
+    'show_options_object'       => true,
157 157
 
158
-	// The time transients will expire when the 'database' arg is set.
159
-	'transient_time'            => 60 * MINUTE_IN_SECONDS,
158
+    // The time transients will expire when the 'database' arg is set.
159
+    'transient_time'            => 60 * MINUTE_IN_SECONDS,
160 160
 
161
-	// Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output.
162
-	'output'                    => true,
161
+    // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output.
162
+    'output'                    => true,
163 163
 
164
-	// Allows dynamic CSS to be generated for customizer and google fonts,
165
-	// but stops the dynamic CSS from going to the page head.
166
-	'output_tag'                => true,
164
+    // Allows dynamic CSS to be generated for customizer and google fonts,
165
+    // but stops the dynamic CSS from going to the page head.
166
+    'output_tag'                => true,
167 167
 
168
-	// Disable the footer credit of Redux. Please leave if you can help it.
169
-	'footer_credit'             => '',
168
+    // Disable the footer credit of Redux. Please leave if you can help it.
169
+    'footer_credit'             => '',
170 170
 
171
-	// If you prefer not to use the CDN for ACE Editor.
172
-	// You may download the Redux Vendor Support plugin to run locally or embed it in your code.
173
-	'use_cdn'                   => true,
171
+    // If you prefer not to use the CDN for ACE Editor.
172
+    // You may download the Redux Vendor Support plugin to run locally or embed it in your code.
173
+    'use_cdn'                   => true,
174 174
 
175
-	// Set the theme of the option panel.  Use 'wp' to use a more modern style, default is classic.
176
-	'admin_theme'               => 'wp',
175
+    // Set the theme of the option panel.  Use 'wp' to use a more modern style, default is classic.
176
+    'admin_theme'               => 'wp',
177 177
 
178
-	// Enable or disable flyout menus when hovering over a menu with submenus.
179
-	'flyout_submenus'           => true,
178
+    // Enable or disable flyout menus when hovering over a menu with submenus.
179
+    'flyout_submenus'           => true,
180 180
 
181
-	// Mode to display fonts (auto|block|swap|fallback|optional)
182
-	// See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display.
183
-	'font_display'              => 'swap',
181
+    // Mode to display fonts (auto|block|swap|fallback|optional)
182
+    // See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display.
183
+    'font_display'              => 'swap',
184 184
 
185
-	// HINTS.
186
-	'hints'                     => array(
187
-		'icon'          => 'el el-question-sign',
188
-		'icon_position' => 'right',
189
-		'icon_color'    => 'lightgray',
190
-		'icon_size'     => 'normal',
191
-		'tip_style'     => array(
192
-			'color'   => 'red',
193
-			'shadow'  => true,
194
-			'rounded' => false,
195
-			'style'   => '',
196
-		),
197
-		'tip_position'  => array(
198
-			'my' => 'top left',
199
-			'at' => 'bottom right',
200
-		),
201
-		'tip_effect'    => array(
202
-			'show' => array(
203
-				'effect'   => 'slide',
204
-				'duration' => '500',
205
-				'event'    => 'mouseover',
206
-			),
207
-			'hide' => array(
208
-				'effect'   => 'slide',
209
-				'duration' => '500',
210
-				'event'    => 'click mouseleave',
211
-			),
212
-		),
213
-	),
214
-
215
-	// FUTURE → Not in use yet, but reserved or partially implemented.
216
-	// Use at your own risk.
217
-	// Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
218
-	'database'                  => '',
219
-	'network_admin'             => true,
220
-	'search'                    => true,
185
+    // HINTS.
186
+    'hints'                     => array(
187
+        'icon'          => 'el el-question-sign',
188
+        'icon_position' => 'right',
189
+        'icon_color'    => 'lightgray',
190
+        'icon_size'     => 'normal',
191
+        'tip_style'     => array(
192
+            'color'   => 'red',
193
+            'shadow'  => true,
194
+            'rounded' => false,
195
+            'style'   => '',
196
+        ),
197
+        'tip_position'  => array(
198
+            'my' => 'top left',
199
+            'at' => 'bottom right',
200
+        ),
201
+        'tip_effect'    => array(
202
+            'show' => array(
203
+                'effect'   => 'slide',
204
+                'duration' => '500',
205
+                'event'    => 'mouseover',
206
+            ),
207
+            'hide' => array(
208
+                'effect'   => 'slide',
209
+                'duration' => '500',
210
+                'event'    => 'click mouseleave',
211
+            ),
212
+        ),
213
+    ),
214
+
215
+    // FUTURE → Not in use yet, but reserved or partially implemented.
216
+    // Use at your own risk.
217
+    // Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
218
+    'database'                  => '',
219
+    'network_admin'             => true,
220
+    'search'                    => true,
221 221
 );
222 222
 
223 223
 
@@ -225,53 +225,53 @@  discard block
 block discarded – undo
225 225
 // PLEASE CHANGE THESE SETTINGS IN YOUR THEME BEFORE RELEASING YOUR PRODUCT!!
226 226
 // If these are left unchanged, they will not display in your panel!
227 227
 $args['admin_bar_links'][] = array(
228
-	'id'    => 'redux-docs',
229
-	'href'  => '//devs.redux.io/',
230
-	'title' => __( 'Documentation', 'your-textdomain-here' ),
228
+    'id'    => 'redux-docs',
229
+    'href'  => '//devs.redux.io/',
230
+    'title' => __( 'Documentation', 'your-textdomain-here' ),
231 231
 );
232 232
 
233 233
 $args['admin_bar_links'][] = array(
234
-	'id'    => 'redux-support',
235
-	'href'  => '//github.com/ReduxFramework/redux-framework/issues',
236
-	'title' => __( 'Support', 'your-textdomain-here' ),
234
+    'id'    => 'redux-support',
235
+    'href'  => '//github.com/ReduxFramework/redux-framework/issues',
236
+    'title' => __( 'Support', 'your-textdomain-here' ),
237 237
 );
238 238
 
239 239
 // SOCIAL ICONS → Set up custom links in the footer for quick links in your panel footer icons.
240 240
 // PLEASE CHANGE THESE SETTINGS IN YOUR THEME BEFORE RELEASING YOUR PRODUCT!!
241 241
 // If these are left unchanged, they will not display in your panel!
242 242
 $args['share_icons'][] = array(
243
-	'url'   => '//github.com/ReduxFramework/ReduxFramework',
244
-	'title' => 'Visit us on GitHub',
245
-	'icon'  => 'el el-github',
243
+    'url'   => '//github.com/ReduxFramework/ReduxFramework',
244
+    'title' => 'Visit us on GitHub',
245
+    'icon'  => 'el el-github',
246 246
 );
247 247
 $args['share_icons'][] = array(
248
-	'url'   => '//www.facebook.com/pages/Redux-Framework/243141545850368',
249
-	'title' => 'Like us on Facebook',
250
-	'icon'  => 'el el-facebook',
248
+    'url'   => '//www.facebook.com/pages/Redux-Framework/243141545850368',
249
+    'title' => 'Like us on Facebook',
250
+    'icon'  => 'el el-facebook',
251 251
 );
252 252
 $args['share_icons'][] = array(
253
-	'url'   => '//twitter.com/reduxframework',
254
-	'title' => 'Follow us on Twitter',
255
-	'icon'  => 'el el-twitter',
253
+    'url'   => '//twitter.com/reduxframework',
254
+    'title' => 'Follow us on Twitter',
255
+    'icon'  => 'el el-twitter',
256 256
 );
257 257
 $args['share_icons'][] = array(
258
-	'url'   => '//www.linkedin.com/company/redux-framework',
259
-	'title' => 'Find us on LinkedIn',
260
-	'icon'  => 'el el-linkedin',
258
+    'url'   => '//www.linkedin.com/company/redux-framework',
259
+    'title' => 'Find us on LinkedIn',
260
+    'icon'  => 'el el-linkedin',
261 261
 );
262 262
 
263 263
 // Panel Intro text → before the form.
264 264
 if ( ! isset( $args['global_variable'] ) || false !== $args['global_variable'] ) {
265
-	if ( ! empty( $args['global_variable'] ) ) {
266
-		$v = $args['global_variable'];
267
-	} else {
268
-		$v = str_replace( '-', '_', $args['opt_name'] );
269
-	}
270
-
271
-	// translators:  Panel opt_name.
272
-	$args['intro_text'] = '<p>' . sprintf( esc_html__( 'Did you know that Redux sets a global variable for you? To access any of your saved options from within your code you can use your global variable: $%1$s', 'your-textdomain-here' ), '<strong>' . $v . '</strong>' ) . '<p>';
265
+    if ( ! empty( $args['global_variable'] ) ) {
266
+        $v = $args['global_variable'];
267
+    } else {
268
+        $v = str_replace( '-', '_', $args['opt_name'] );
269
+    }
270
+
271
+    // translators:  Panel opt_name.
272
+    $args['intro_text'] = '<p>' . sprintf( esc_html__( 'Did you know that Redux sets a global variable for you? To access any of your saved options from within your code you can use your global variable: $%1$s', 'your-textdomain-here' ), '<strong>' . $v . '</strong>' ) . '<p>';
273 273
 } else {
274
-	$args['intro_text'] = '<p>' . esc_html__( 'This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.', 'your-textdomain-here' ) . '</p>';
274
+    $args['intro_text'] = '<p>' . esc_html__( 'This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.', 'your-textdomain-here' ) . '</p>';
275 275
 }
276 276
 
277 277
 // Add content after the form.
@@ -287,16 +287,16 @@  discard block
 block discarded – undo
287 287
  * ---> START HELP TABS
288 288
  */
289 289
 $help_tabs = array(
290
-	array(
291
-		'id'      => 'redux-help-tab-1',
292
-		'title'   => esc_html__( 'Theme Information 1', 'your-textdomain-here' ),
293
-		'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
294
-	),
295
-	array(
296
-		'id'      => 'redux-help-tab-2',
297
-		'title'   => esc_html__( 'Theme Information 2', 'your-textdomain-here' ),
298
-		'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
299
-	),
290
+    array(
291
+        'id'      => 'redux-help-tab-1',
292
+        'title'   => esc_html__( 'Theme Information 1', 'your-textdomain-here' ),
293
+        'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
294
+    ),
295
+    array(
296
+        'id'      => 'redux-help-tab-2',
297
+        'title'   => esc_html__( 'Theme Information 2', 'your-textdomain-here' ),
298
+        'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
299
+    ),
300 300
 );
301 301
 Redux::set_help_tab( $opt_name, $help_tabs );
302 302
 
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 
316 316
 // -> START Basic Fields
317 317
 Redux::set_section(
318
-	$opt_name,
319
-	array(
320
-		'title'            => esc_html__( 'Basic Fields', 'your-textdomain-here' ),
321
-		'id'               => 'basic',
322
-		'desc'             => esc_html__( 'These are really basic fields!', 'your-textdomain-here' ),
323
-		'customizer_width' => '400px',
324
-		'icon'             => 'el el-home',
325
-	)
318
+    $opt_name,
319
+    array(
320
+        'title'            => esc_html__( 'Basic Fields', 'your-textdomain-here' ),
321
+        'id'               => 'basic',
322
+        'desc'             => esc_html__( 'These are really basic fields!', 'your-textdomain-here' ),
323
+        'customizer_width' => '400px',
324
+        'icon'             => 'el el-home',
325
+    )
326 326
 );
327 327
 
328 328
 require_once Redux_Core::$dir . '../sample/sections/basic-fields/checkbox.php';
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
 
336 336
 // -> START Editors.
337 337
 Redux::set_section(
338
-	$opt_name,
339
-	array(
340
-		'title'            => esc_html__( 'Editors', 'your-textdomain-here' ),
341
-		'id'               => 'editor',
342
-		'customizer_width' => '500px',
343
-		'icon'             => 'el el-edit',
344
-	)
338
+    $opt_name,
339
+    array(
340
+        'title'            => esc_html__( 'Editors', 'your-textdomain-here' ),
341
+        'id'               => 'editor',
342
+        'customizer_width' => '500px',
343
+        'icon'             => 'el el-edit',
344
+    )
345 345
 );
346 346
 
347 347
 require_once Redux_Core::$dir . '../sample/sections/editors/wordpress-editor.php';
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 
350 350
 // -> START Color Selection.
351 351
 Redux::set_section(
352
-	$opt_name,
353
-	array(
354
-		'title' => esc_html__( 'Color Selection', 'your-textdomain-here' ),
355
-		'id'    => 'color',
356
-		'icon'  => 'el el-brush',
357
-	)
352
+    $opt_name,
353
+    array(
354
+        'title' => esc_html__( 'Color Selection', 'your-textdomain-here' ),
355
+        'id'    => 'color',
356
+        'icon'  => 'el el-brush',
357
+    )
358 358
 );
359 359
 
360 360
 require_once Redux_Core::$dir . '../sample/sections/color-selection/color.php';
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
 
367 367
 // -> START Design Fields.
368 368
 Redux::set_section(
369
-	$opt_name,
370
-	array(
371
-		'title' => esc_html__( 'Design Fields', 'your-textdomain-here' ),
372
-		'id'    => 'design',
373
-		'icon'  => 'el el-wrench',
374
-	)
369
+    $opt_name,
370
+    array(
371
+        'title' => esc_html__( 'Design Fields', 'your-textdomain-here' ),
372
+        'id'    => 'design',
373
+        'icon'  => 'el el-wrench',
374
+    )
375 375
 );
376 376
 
377 377
 require_once Redux_Core::$dir . '../sample/sections/design-fields/background.php';
@@ -382,12 +382,12 @@  discard block
 block discarded – undo
382 382
 
383 383
 // -> START Media Uploads.
384 384
 Redux::set_section(
385
-	$opt_name,
386
-	array(
387
-		'title' => esc_html__( 'Media Uploads', 'your-textdomain-here' ),
388
-		'id'    => 'media',
389
-		'icon'  => 'el el-picture',
390
-	)
385
+    $opt_name,
386
+    array(
387
+        'title' => esc_html__( 'Media Uploads', 'your-textdomain-here' ),
388
+        'id'    => 'media',
389
+        'icon'  => 'el el-picture',
390
+    )
391 391
 );
392 392
 
393 393
 require_once Redux_Core::$dir . '../sample/sections/media-uploads/gallery.php';
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 
398 398
 // -> START Presentation Fields.
399 399
 Redux::set_section(
400
-	$opt_name,
401
-	array(
402
-		'title' => esc_html__( 'Presentation Fields', 'your-textdomain-here' ),
403
-		'id'    => 'presentation',
404
-		'icon'  => 'el el-screen',
405
-	)
400
+    $opt_name,
401
+    array(
402
+        'title' => esc_html__( 'Presentation Fields', 'your-textdomain-here' ),
403
+        'id'    => 'presentation',
404
+        'icon'  => 'el el-screen',
405
+    )
406 406
 );
407 407
 
408 408
 require_once Redux_Core::$dir . '../sample/sections/presentation-fields/divide.php';
@@ -411,21 +411,21 @@  discard block
 block discarded – undo
411 411
 require_once Redux_Core::$dir . '../sample/sections/presentation-fields/section.php';
412 412
 
413 413
 Redux::set_section(
414
-	$opt_name,
415
-	array(
416
-		'id'   => 'presentation-divide-sample',
417
-		'type' => 'divide',
418
-	)
414
+    $opt_name,
415
+    array(
416
+        'id'   => 'presentation-divide-sample',
417
+        'type' => 'divide',
418
+    )
419 419
 );
420 420
 
421 421
 // → START Switch & Button Set.
422 422
 Redux::set_section(
423
-	$opt_name,
424
-	array(
425
-		'title' => esc_html__( 'Switch / Button Set', 'your-textdomain-here' ),
426
-		'id'    => 'switch_buttonset',
427
-		'icon'  => 'el el-cogs',
428
-	)
423
+    $opt_name,
424
+    array(
425
+        'title' => esc_html__( 'Switch / Button Set', 'your-textdomain-here' ),
426
+        'id'    => 'switch_buttonset',
427
+        'icon'  => 'el el-cogs',
428
+    )
429 429
 );
430 430
 
431 431
 require_once Redux_Core::$dir . '../sample/sections/switch-button/button-set.php';
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 
434 434
 // -> START Select Fields.
435 435
 Redux::set_section(
436
-	$opt_name,
437
-	array(
438
-		'title' => esc_html__( 'Select Fields', 'your-textdomain-here' ),
439
-		'id'    => 'select',
440
-		'icon'  => 'el el-list-alt',
441
-	)
436
+    $opt_name,
437
+    array(
438
+        'title' => esc_html__( 'Select Fields', 'your-textdomain-here' ),
439
+        'id'    => 'select',
440
+        'icon'  => 'el el-list-alt',
441
+    )
442 442
 );
443 443
 
444 444
 require_once Redux_Core::$dir . '../sample/sections/select-fields/select.php';
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 
448 448
 // -> START Slider / Spinner.
449 449
 Redux::set_section(
450
-	$opt_name,
451
-	array(
452
-		'title' => esc_html__( 'Slider / Spinner', 'your-textdomain-here' ),
453
-		'id'    => 'slider_spinner',
454
-		'icon'  => 'el el-adjust-alt',
455
-	)
450
+    $opt_name,
451
+    array(
452
+        'title' => esc_html__( 'Slider / Spinner', 'your-textdomain-here' ),
453
+        'id'    => 'slider_spinner',
454
+        'icon'  => 'el el-adjust-alt',
455
+    )
456 456
 );
457 457
 
458 458
 require_once Redux_Core::$dir . '../sample/sections/slider-spinner/slider.php';
@@ -463,12 +463,12 @@  discard block
 block discarded – undo
463 463
 
464 464
 // -> START Additional Types.
465 465
 Redux::set_section(
466
-	$opt_name,
467
-	array(
468
-		'title' => esc_html__( 'Additional Types', 'your-textdomain-here' ),
469
-		'id'    => 'additional',
470
-		'icon'  => 'el el-magic',
471
-	)
466
+    $opt_name,
467
+    array(
468
+        'title' => esc_html__( 'Additional Types', 'your-textdomain-here' ),
469
+        'id'    => 'additional',
470
+        'icon'  => 'el el-magic',
471
+    )
472 472
 );
473 473
 
474 474
 require_once Redux_Core::$dir . '../sample/sections/additional-types/date.php';
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 require_once Redux_Core::$dir . '../sample/sections/additional-types/raw.php';
478 478
 
479 479
 Redux::set_section(
480
-	$opt_name,
481
-	array(
482
-		'title' => esc_html__( 'Advanced Features', 'your-textdomain-here' ),
483
-		'icon'  => 'el el-thumbs-up',
484
-	)
480
+    $opt_name,
481
+    array(
482
+        'title' => esc_html__( 'Advanced Features', 'your-textdomain-here' ),
483
+        'icon'  => 'el el-thumbs-up',
484
+    )
485 485
 );
486 486
 
487 487
 require_once Redux_Core::$dir . '../sample/sections/advanced-features/callback.php';
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 
500 500
 // -> START Disabling.
501 501
 Redux::set_section(
502
-	$opt_name,
503
-	array(
504
-		'title' => esc_html__( 'Disabling', 'your-textdomain-here' ),
505
-		'icon'  => 'el el-lock',
506
-	)
502
+    $opt_name,
503
+    array(
504
+        'title' => esc_html__( 'Disabling', 'your-textdomain-here' ),
505
+        'icon'  => 'el el-lock',
506
+    )
507 507
 );
508 508
 
509 509
 require_once Redux_Core::$dir . '../sample/sections/disabling/disable-field.php';
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
 
512 512
 // -> START Extensions.
513 513
 Redux::set_section(
514
-	$opt_name,
515
-	array(
516
-		'title' => esc_html__( 'Redux Extensions', 'your-textdomain-here' ),
517
-		'id'    => 'redux-extensions',
518
-		'icon'  => 'el el-redux',
519
-		'class' => 'pro_highlight',
520
-		'desc'  => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/" target="_blank">https://devs.redux.io/core-extensions/</a>',
521
-	)
514
+    $opt_name,
515
+    array(
516
+        'title' => esc_html__( 'Redux Extensions', 'your-textdomain-here' ),
517
+        'id'    => 'redux-extensions',
518
+        'icon'  => 'el el-redux',
519
+        'class' => 'pro_highlight',
520
+        'desc'  => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/" target="_blank">https://devs.redux.io/core-extensions/</a>',
521
+    )
522 522
 );
523 523
 
524 524
 require_once Redux_Core::$dir . '../sample/sections/extensions/accordion.php';
@@ -544,46 +544,46 @@  discard block
 block discarded – undo
544 544
  * Raw README
545 545
  */
546 546
 if ( file_exists( $dir . '/../README.md' ) ) {
547
-	$section = array(
548
-		'icon'   => 'el el-list-alt',
549
-		'title'  => esc_html__( 'Documentation', 'your-textdomain-here' ),
550
-		'fields' => array(
551
-			array(
552
-				'id'           => 'opt-raw-documentation',
553
-				'type'         => 'raw',
554
-				'markdown'     => true,
555
-				'content_path' => __DIR__ . '/../README.md', // FULL PATH, not relative, please.
556
-			),
557
-		),
558
-	);
559
-
560
-	Redux::set_section( $opt_name, $section );
547
+    $section = array(
548
+        'icon'   => 'el el-list-alt',
549
+        'title'  => esc_html__( 'Documentation', 'your-textdomain-here' ),
550
+        'fields' => array(
551
+            array(
552
+                'id'           => 'opt-raw-documentation',
553
+                'type'         => 'raw',
554
+                'markdown'     => true,
555
+                'content_path' => __DIR__ . '/../README.md', // FULL PATH, not relative, please.
556
+            ),
557
+        ),
558
+    );
559
+
560
+    Redux::set_section( $opt_name, $section );
561 561
 }
562 562
 
563 563
 Redux::set_section(
564
-	$opt_name,
565
-	array(
566
-		'icon'            => 'el el-list-alt',
567
-		'title'           => esc_html__( 'Customizer Only', 'your-textdomain-here' ),
568
-		'desc'            => '<p class="description">' . esc_html__( 'This Section should be visible only in Customizer', 'your-textdomain-here' ) . '</p>',
569
-		'customizer_only' => true,
570
-		'fields'          => array(
571
-			array(
572
-				'id'              => 'opt-customizer-only',
573
-				'type'            => 'select',
574
-				'title'           => esc_html__( 'Customizer Only Option', 'your-textdomain-here' ),
575
-				'subtitle'        => esc_html__( 'The subtitle is NOT visible in customizer', 'your-textdomain-here' ),
576
-				'desc'            => esc_html__( 'The field desc is NOT visible in customizer.', 'your-textdomain-here' ),
577
-				'customizer_only' => true,
578
-				'options'         => array(
579
-					'1' => esc_html__( 'Opt 1', 'your-textdomain-here' ),
580
-					'2' => esc_html__( 'Opt 2', 'your-textdomain-here' ),
581
-					'3' => esc_html__( 'Opt 3', 'your-textdomain-here' ),
582
-				),
583
-				'default'         => '2',
584
-			),
585
-		),
586
-	)
564
+    $opt_name,
565
+    array(
566
+        'icon'            => 'el el-list-alt',
567
+        'title'           => esc_html__( 'Customizer Only', 'your-textdomain-here' ),
568
+        'desc'            => '<p class="description">' . esc_html__( 'This Section should be visible only in Customizer', 'your-textdomain-here' ) . '</p>',
569
+        'customizer_only' => true,
570
+        'fields'          => array(
571
+            array(
572
+                'id'              => 'opt-customizer-only',
573
+                'type'            => 'select',
574
+                'title'           => esc_html__( 'Customizer Only Option', 'your-textdomain-here' ),
575
+                'subtitle'        => esc_html__( 'The subtitle is NOT visible in customizer', 'your-textdomain-here' ),
576
+                'desc'            => esc_html__( 'The field desc is NOT visible in customizer.', 'your-textdomain-here' ),
577
+                'customizer_only' => true,
578
+                'options'         => array(
579
+                    '1' => esc_html__( 'Opt 1', 'your-textdomain-here' ),
580
+                    '2' => esc_html__( 'Opt 2', 'your-textdomain-here' ),
581
+                    '3' => esc_html__( 'Opt 3', 'your-textdomain-here' ),
582
+                ),
583
+                'default'         => '2',
584
+            ),
585
+        ),
586
+    )
587 587
 );
588 588
 
589 589
 /*
@@ -613,150 +613,150 @@  discard block
 block discarded – undo
613 613
 // add_filter('redux/options/' . $opt_name . '/sections', 'dynamic_section');
614 614
 // .
615 615
 if ( ! function_exists( 'compiler_action' ) ) {
616
-	/**
617
-	 * This is a test function that will let you see when the compiler hook occurs.
618
-	 * It only runs if a field's value has changed and compiler => true is set.
619
-	 *
620
-	 * @param array  $options        Options values.
621
-	 * @param string $css            Compiler selector CSS values  compiler => array( CSS SELECTORS ).
622
-	 * @param array  $changed_values Any values that have changed since last save.
623
-	 */
624
-	function compiler_action( array $options, string $css, array $changed_values ) {
625
-		echo '<h1>The compiler hook has run!</h1>';
626
-		echo '<pre>';
627
-		// phpcs:ignore WordPress.PHP.DevelopmentFunctions
628
-		print_r( $changed_values ); // Values that have changed since the last save.
629
-		// echo '<br/>';
630
-		// print_r($options); //Option values.
631
-		// echo '<br/>';
632
-		// print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS ).
633
-		echo '</pre>';
634
-	}
616
+    /**
617
+     * This is a test function that will let you see when the compiler hook occurs.
618
+     * It only runs if a field's value has changed and compiler => true is set.
619
+     *
620
+     * @param array  $options        Options values.
621
+     * @param string $css            Compiler selector CSS values  compiler => array( CSS SELECTORS ).
622
+     * @param array  $changed_values Any values that have changed since last save.
623
+     */
624
+    function compiler_action( array $options, string $css, array $changed_values ) {
625
+        echo '<h1>The compiler hook has run!</h1>';
626
+        echo '<pre>';
627
+        // phpcs:ignore WordPress.PHP.DevelopmentFunctions
628
+        print_r( $changed_values ); // Values that have changed since the last save.
629
+        // echo '<br/>';
630
+        // print_r($options); //Option values.
631
+        // echo '<br/>';
632
+        // print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS ).
633
+        echo '</pre>';
634
+    }
635 635
 }
636 636
 
637 637
 if ( ! function_exists( 'redux_validate_callback_function' ) ) {
638
-	/**
639
-	 * Custom function for the callback validation referenced above
640
-	 *
641
-	 * @param array $field          Field array.
642
-	 * @param mixed $value          New value.
643
-	 * @param mixed $existing_value Existing value.
644
-	 *
645
-	 * @return array
646
-	 */
647
-	function redux_validate_callback_function( array $field, $value, $existing_value ): array {
648
-		$error   = false;
649
-		$warning = false;
650
-
651
-		// Do your validation.
652
-		if ( 1 === (int) $value ) {
653
-			$error = true;
654
-			$value = $existing_value;
655
-		} elseif ( 2 === (int) $value ) {
656
-			$warning = true;
657
-			$value   = $existing_value;
658
-		}
659
-
660
-		$return['value'] = $value;
661
-
662
-		if ( true === $error ) {
663
-			$field['msg']    = 'your custom error message';
664
-			$return['error'] = $field;
665
-		}
666
-
667
-		if ( true === $warning ) {
668
-			$field['msg']      = 'your custom warning message';
669
-			$return['warning'] = $field;
670
-		}
671
-
672
-		return $return;
673
-	}
638
+    /**
639
+     * Custom function for the callback validation referenced above
640
+     *
641
+     * @param array $field          Field array.
642
+     * @param mixed $value          New value.
643
+     * @param mixed $existing_value Existing value.
644
+     *
645
+     * @return array
646
+     */
647
+    function redux_validate_callback_function( array $field, $value, $existing_value ): array {
648
+        $error   = false;
649
+        $warning = false;
650
+
651
+        // Do your validation.
652
+        if ( 1 === (int) $value ) {
653
+            $error = true;
654
+            $value = $existing_value;
655
+        } elseif ( 2 === (int) $value ) {
656
+            $warning = true;
657
+            $value   = $existing_value;
658
+        }
659
+
660
+        $return['value'] = $value;
661
+
662
+        if ( true === $error ) {
663
+            $field['msg']    = 'your custom error message';
664
+            $return['error'] = $field;
665
+        }
666
+
667
+        if ( true === $warning ) {
668
+            $field['msg']      = 'your custom warning message';
669
+            $return['warning'] = $field;
670
+        }
671
+
672
+        return $return;
673
+    }
674 674
 }
675 675
 
676 676
 
677 677
 if ( ! function_exists( 'dynamic_section' ) ) {
678
-	/**
679
-	 * Custom function for filtering the section array.
680
-	 * Good for child themes to override or add to the sections.
681
-	 * Simply include this function in the child themes functions.php file.
682
-	 * NOTE: the defined constants for URLs and directories will NOT be available at this point in a child theme,
683
-	 * so you must use get_template_directory_uri() if you want to use any of the built-in icons.
684
-	 *
685
-	 * @param array $sections Section array.
686
-	 *
687
-	 * @return array
688
-	 */
689
-	function dynamic_section( array $sections ): array {
690
-		$sections[] = array(
691
-			'title'  => esc_html__( 'Section via hook', 'your-textdomain-here' ),
692
-			'desc'   => '<p class="description">' . esc_html__( 'This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.', 'your-textdomain-here' ) . '</p>',
693
-			'icon'   => 'el el-paper-clip',
694
-
695
-			// Leave this as a blank section, no options just some intro text set above.
696
-			'fields' => array(),
697
-		);
698
-
699
-		return $sections;
700
-	}
678
+    /**
679
+     * Custom function for filtering the section array.
680
+     * Good for child themes to override or add to the sections.
681
+     * Simply include this function in the child themes functions.php file.
682
+     * NOTE: the defined constants for URLs and directories will NOT be available at this point in a child theme,
683
+     * so you must use get_template_directory_uri() if you want to use any of the built-in icons.
684
+     *
685
+     * @param array $sections Section array.
686
+     *
687
+     * @return array
688
+     */
689
+    function dynamic_section( array $sections ): array {
690
+        $sections[] = array(
691
+            'title'  => esc_html__( 'Section via hook', 'your-textdomain-here' ),
692
+            'desc'   => '<p class="description">' . esc_html__( 'This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.', 'your-textdomain-here' ) . '</p>',
693
+            'icon'   => 'el el-paper-clip',
694
+
695
+            // Leave this as a blank section, no options just some intro text set above.
696
+            'fields' => array(),
697
+        );
698
+
699
+        return $sections;
700
+    }
701 701
 }
702 702
 
703 703
 if ( ! function_exists( 'change_arguments' ) ) {
704
-	/**
705
-	 * Filter hook for filtering the args.
706
-	 * Good for child themes to override or add to the args array.
707
-	 * It can also be used in other functions.
708
-	 *
709
-	 * @param array $args Global arguments array.
710
-	 *
711
-	 * @return array
712
-	 */
713
-	function change_arguments( array $args ): array {
714
-		$args['dev_mode'] = true;
715
-
716
-		return $args;
717
-	}
704
+    /**
705
+     * Filter hook for filtering the args.
706
+     * Good for child themes to override or add to the args array.
707
+     * It can also be used in other functions.
708
+     *
709
+     * @param array $args Global arguments array.
710
+     *
711
+     * @return array
712
+     */
713
+    function change_arguments( array $args ): array {
714
+        $args['dev_mode'] = true;
715
+
716
+        return $args;
717
+    }
718 718
 }
719 719
 
720 720
 if ( ! function_exists( 'change_defaults' ) ) {
721
-	/**
722
-	 * Filter hook for filtering the default value of any given field. Very useful in development mode.
723
-	 *
724
-	 * @param array $defaults Default value array.
725
-	 *
726
-	 * @return array
727
-	 */
728
-	function change_defaults( array $defaults ): array {
729
-		$defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' );
730
-
731
-		return $defaults;
732
-	}
721
+    /**
722
+     * Filter hook for filtering the default value of any given field. Very useful in development mode.
723
+     *
724
+     * @param array $defaults Default value array.
725
+     *
726
+     * @return array
727
+     */
728
+    function change_defaults( array $defaults ): array {
729
+        $defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' );
730
+
731
+        return $defaults;
732
+    }
733 733
 }
734 734
 
735 735
 if ( ! function_exists( 'redux_custom_sanitize' ) ) {
736
-	/**
737
-	 * Function to be used if the field sanitizes argument.
738
-	 * Return value MUST be formatted or cleaned text to display.
739
-	 *
740
-	 * @param string $value Value to evaluate or clean.  Required.
741
-	 *
742
-	 * @return string
743
-	 */
744
-	function redux_custom_sanitize( string $value ): string {
745
-		$return = '';
746
-
747
-		foreach ( explode( ' ', $value ) as $w ) {
748
-			foreach ( str_split( $w ) as $k => $v ) {
749
-				if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) {
750
-					$return .= mb_strtoupper( $v );
751
-				} else {
752
-					$return .= $v;
753
-				}
754
-			}
755
-
756
-			$return .= ' ';
757
-		}
758
-
759
-		return $return;
760
-	}
736
+    /**
737
+     * Function to be used if the field sanitizes argument.
738
+     * Return value MUST be formatted or cleaned text to display.
739
+     *
740
+     * @param string $value Value to evaluate or clean.  Required.
741
+     *
742
+     * @return string
743
+     */
744
+    function redux_custom_sanitize( string $value ): string {
745
+        $return = '';
746
+
747
+        foreach ( explode( ' ', $value ) as $w ) {
748
+            foreach ( str_split( $w ) as $k => $v ) {
749
+                if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) {
750
+                    $return .= mb_strtoupper( $v );
751
+                } else {
752
+                    $return .= $v;
753
+                }
754
+            }
755
+
756
+            $return .= ' ';
757
+        }
758
+
759
+        return $return;
760
+    }
761 761
 }
762 762
 // phpcs:enable
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-instances.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public static function get_instance( $opt_name = false ) {
37 37
 
38
-			if ( $opt_name && ! empty( self::$instances[ $opt_name ] ) ) {
39
-				return self::$instances[ $opt_name ];
38
+			if ( $opt_name && ! empty( self::$instances[$opt_name] ) ) {
39
+				return self::$instances[$opt_name];
40 40
 			}
41 41
 
42 42
 			return new self();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		public function store( $redux_framework ) {
84 84
 			if ( $redux_framework instanceof ReduxFramework ) {
85 85
 				$key                     = $redux_framework->args['opt_name'];
86
-				self::$instances[ $key ] = $redux_framework;
86
+				self::$instances[$key] = $redux_framework;
87 87
 			}
88 88
 		}
89 89
 	}
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -12,108 +12,108 @@
 block discarded – undo
12 12
 
13 13
 if ( ! class_exists( 'Redux_Instances', false ) ) {
14 14
 
15
-	/**
16
-	 * Class Redux_Instances
17
-	 */
18
-	class Redux_Instances {
15
+    /**
16
+     * Class Redux_Instances
17
+     */
18
+    class Redux_Instances {
19 19
 
20
-		/**
21
-		 * ReduxFramework instances
22
-		 *
23
-		 * @var ReduxFramework[]
24
-		 */
25
-		private static $instances;
20
+        /**
21
+         * ReduxFramework instances
22
+         *
23
+         * @var ReduxFramework[]
24
+         */
25
+        private static $instances;
26 26
 
27
-		/**
28
-		 * Get Instance
29
-		 * Get Redux_Instances instance
30
-		 * OR an instance of ReduxFramework by [opt_name]
31
-		 *
32
-		 * @param  string|false $opt_name the defined opt_name.
33
-		 *
34
-		 * @return ReduxFramework|Redux_Instances class instance
35
-		 */
36
-		public static function get_instance( $opt_name = false ) {
27
+        /**
28
+         * Get Instance
29
+         * Get Redux_Instances instance
30
+         * OR an instance of ReduxFramework by [opt_name]
31
+         *
32
+         * @param  string|false $opt_name the defined opt_name.
33
+         *
34
+         * @return ReduxFramework|Redux_Instances class instance
35
+         */
36
+        public static function get_instance( $opt_name = false ) {
37 37
 
38
-			if ( $opt_name && ! empty( self::$instances[ $opt_name ] ) ) {
39
-				return self::$instances[ $opt_name ];
40
-			}
38
+            if ( $opt_name && ! empty( self::$instances[ $opt_name ] ) ) {
39
+                return self::$instances[ $opt_name ];
40
+            }
41 41
 
42
-			return new self();
43
-		}
42
+            return new self();
43
+        }
44 44
 
45
-		/**
46
-		 * Shim for old get_redux_instance method.
47
-		 *
48
-		 * @param  string|false $opt_name the defined opt_name.
49
-		 *
50
-		 * @return ReduxFramework class instance
51
-		 */
52
-		public static function get_redux_instance( $opt_name = '' ) {
53
-			return self::get_instance( $opt_name );
54
-		}
45
+        /**
46
+         * Shim for old get_redux_instance method.
47
+         *
48
+         * @param  string|false $opt_name the defined opt_name.
49
+         *
50
+         * @return ReduxFramework class instance
51
+         */
52
+        public static function get_redux_instance( $opt_name = '' ) {
53
+            return self::get_instance( $opt_name );
54
+        }
55 55
 
56
-		/**
57
-		 * Get all instantiated ReduxFramework instances (so far)
58
-		 *
59
-		 * @return array|null [type] [description]
60
-		 */
61
-		public static function get_all_instances(): ?array {
62
-			return self::$instances;
63
-		}
56
+        /**
57
+         * Get all instantiated ReduxFramework instances (so far)
58
+         *
59
+         * @return array|null [type] [description]
60
+         */
61
+        public static function get_all_instances(): ?array {
62
+            return self::$instances;
63
+        }
64 64
 
65
-		/**
66
-		 * Redux_Instances constructor.
67
-		 *
68
-		 * @param mixed $redux_framework Is object.
69
-		 */
70
-		public function __construct( $redux_framework = false ) {
71
-			if ( false !== $redux_framework ) {
72
-				$this->store( $redux_framework );
73
-			} else {
74
-				add_action( 'redux/construct', array( $this, 'store' ), 5, 1 );
75
-			}
76
-		}
65
+        /**
66
+         * Redux_Instances constructor.
67
+         *
68
+         * @param mixed $redux_framework Is object.
69
+         */
70
+        public function __construct( $redux_framework = false ) {
71
+            if ( false !== $redux_framework ) {
72
+                $this->store( $redux_framework );
73
+            } else {
74
+                add_action( 'redux/construct', array( $this, 'store' ), 5, 1 );
75
+            }
76
+        }
77 77
 
78
-		/**
79
-		 * Action hook callback.
80
-		 *
81
-		 * @param object $redux_framework Pointer.
82
-		 */
83
-		public function store( $redux_framework ) {
84
-			if ( $redux_framework instanceof ReduxFramework ) {
85
-				$key                     = $redux_framework->args['opt_name'];
86
-				self::$instances[ $key ] = $redux_framework;
87
-			}
88
-		}
89
-	}
78
+        /**
79
+         * Action hook callback.
80
+         *
81
+         * @param object $redux_framework Pointer.
82
+         */
83
+        public function store( $redux_framework ) {
84
+            if ( $redux_framework instanceof ReduxFramework ) {
85
+                $key                     = $redux_framework->args['opt_name'];
86
+                self::$instances[ $key ] = $redux_framework;
87
+            }
88
+        }
89
+    }
90 90
 }
91 91
 
92 92
 if ( ! class_exists( 'ReduxFrameworkInstances' ) ) {
93
-	class_alias( 'Redux_Instances', 'ReduxFrameworkInstances' );
93
+    class_alias( 'Redux_Instances', 'ReduxFrameworkInstances' );
94 94
 }
95 95
 
96 96
 if ( ! function_exists( 'get_redux_instance' ) ) {
97
-	/**
98
-	 * Shim function that some theme oddly used.
99
-	 *
100
-	 * @param  string|false $opt_name the defined opt_name.
101
-	 *
102
-	 * @return ReduxFramework class instance
103
-	 */
104
-	function get_redux_instance( $opt_name ) {
105
-		return Redux_Instances::get_instance( $opt_name );
106
-	}
97
+    /**
98
+     * Shim function that some theme oddly used.
99
+     *
100
+     * @param  string|false $opt_name the defined opt_name.
101
+     *
102
+     * @return ReduxFramework class instance
103
+     */
104
+    function get_redux_instance( $opt_name ) {
105
+        return Redux_Instances::get_instance( $opt_name );
106
+    }
107 107
 }
108 108
 
109 109
 if ( ! function_exists( 'get_all_redux_instances' ) ) {
110
-	/**
111
-	 * Fetch all instances of ReduxFramework
112
-	 * as an associative array.
113
-	 *
114
-	 * @return array        format ['opt_name' => $ReduxFramework]
115
-	 */
116
-	function get_all_redux_instances(): ?array {
117
-		return Redux_Instances::get_all_instances();
118
-	}
110
+    /**
111
+     * Fetch all instances of ReduxFramework
112
+     * as an associative array.
113
+     *
114
+     * @return array        format ['opt_name' => $ReduxFramework]
115
+     */
116
+    function get_all_redux_instances(): ?array {
117
+        return Redux_Instances::get_all_instances();
118
+    }
119 119
 }
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-network.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@
 block discarded – undo
65 65
 		public function save_network_page() {
66 66
 			$core = $this->core();
67 67
 
68
-			if ( isset( $_POST[ $core->args['opt_name'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
69
-				$opt_name = sanitize_text_field( wp_unslash( $_POST[ $core->args['opt_name'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification
68
+			if ( isset( $_POST[$core->args['opt_name']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
69
+				$opt_name = sanitize_text_field( wp_unslash( $_POST[$core->args['opt_name']] ) ); // phpcs:ignore WordPress.Security.NonceVerification
70 70
 			}
71 71
 
72 72
 			$data = $core->options_class->validate_options( $opt_name );
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -11,81 +11,81 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Network', false ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Network
16
-	 */
17
-	class Redux_Network extends Redux_Class {
14
+    /**
15
+     * Class Redux_Network
16
+     */
17
+    class Redux_Network extends Redux_Class {
18 18
 
19
-		/**
20
-		 * Redux_Network constructor.
21
-		 *
22
-		 * @param object $redux ReduxFramework pointer.
23
-		 */
24
-		public function __construct( $redux ) {
25
-			parent::__construct( $redux );
19
+        /**
20
+         * Redux_Network constructor.
21
+         *
22
+         * @param object $redux ReduxFramework pointer.
23
+         */
24
+        public function __construct( $redux ) {
25
+            parent::__construct( $redux );
26 26
 
27
-			if ( 'network' === $redux->args['database'] && $redux->args['network_admin'] ) {
28
-				add_action(
29
-					'network_admin_edit_redux_' . $redux->args['opt_name'],
30
-					array(
31
-						$this,
32
-						'save_network_page',
33
-					),
34
-					10,
35
-					0
36
-				);
27
+            if ( 'network' === $redux->args['database'] && $redux->args['network_admin'] ) {
28
+                add_action(
29
+                    'network_admin_edit_redux_' . $redux->args['opt_name'],
30
+                    array(
31
+                        $this,
32
+                        'save_network_page',
33
+                    ),
34
+                    10,
35
+                    0
36
+                );
37 37
 
38
-				// phpcs:ignore Generic.Strings.UnnecessaryStringConcat
39
-				add_action( 'admin' . '_bar' . '_menu', array( $this, 'network_admin_bar' ), 999 );
40
-			}
41
-		}
38
+                // phpcs:ignore Generic.Strings.UnnecessaryStringConcat
39
+                add_action( 'admin' . '_bar' . '_menu', array( $this, 'network_admin_bar' ), 999 );
40
+            }
41
+        }
42 42
 
43
-		/**
44
-		 * Add node to network admin bar.
45
-		 *
46
-		 * @param object $wp_admin_bar Admin bar.
47
-		 */
48
-		public function network_admin_bar( $wp_admin_bar ) {
49
-			$core = $this->core();
43
+        /**
44
+         * Add node to network admin bar.
45
+         *
46
+         * @param object $wp_admin_bar Admin bar.
47
+         */
48
+        public function network_admin_bar( $wp_admin_bar ) {
49
+            $core = $this->core();
50 50
 
51
-			$args = array(
52
-				'id'     => $core->args['opt_name'] . '_network_admin',
53
-				'title'  => $core->args['menu_title'],
54
-				'parent' => 'network-admin',
55
-				'href'   => network_admin_url( 'settings.php' ) . '?page=' . $core->args['page_slug'],
56
-				'meta'   => array( 'class' => 'redux-network-admin' ),
57
-			);
51
+            $args = array(
52
+                'id'     => $core->args['opt_name'] . '_network_admin',
53
+                'title'  => $core->args['menu_title'],
54
+                'parent' => 'network-admin',
55
+                'href'   => network_admin_url( 'settings.php' ) . '?page=' . $core->args['page_slug'],
56
+                'meta'   => array( 'class' => 'redux-network-admin' ),
57
+            );
58 58
 
59
-			$wp_admin_bar->add_node( $args );
60
-		}
59
+            $wp_admin_bar->add_node( $args );
60
+        }
61 61
 
62
-		/**
63
-		 * Saves network options.
64
-		 */
65
-		public function save_network_page() {
66
-			$core = $this->core();
62
+        /**
63
+         * Saves network options.
64
+         */
65
+        public function save_network_page() {
66
+            $core = $this->core();
67 67
 
68
-			if ( isset( $_POST[ $core->args['opt_name'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
69
-				$opt_name = sanitize_text_field( wp_unslash( $_POST[ $core->args['opt_name'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification
70
-			}
68
+            if ( isset( $_POST[ $core->args['opt_name'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
69
+                $opt_name = sanitize_text_field( wp_unslash( $_POST[ $core->args['opt_name'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification
70
+            }
71 71
 
72
-			$data = $core->options_class->validate_options( $opt_name );
72
+            $data = $core->options_class->validate_options( $opt_name );
73 73
 
74
-			if ( ! empty( $data ) ) {
75
-				$core->options_class->set( $data );
76
-			}
74
+            if ( ! empty( $data ) ) {
75
+                $core->options_class->set( $data );
76
+            }
77 77
 
78
-			wp_safe_redirect(
79
-				add_query_arg(
80
-					array(
81
-						'page'    => $core->args['page_slug'],
82
-						'updated' => 'true',
83
-					),
84
-					network_admin_url( 'settings.php' )
85
-				)
86
-			);
78
+            wp_safe_redirect(
79
+                add_query_arg(
80
+                    array(
81
+                        'page'    => $core->args['page_slug'],
82
+                        'updated' => 'true',
83
+                    ),
84
+                    network_admin_url( 'settings.php' )
85
+                )
86
+            );
87 87
 
88
-			exit();
89
-		}
90
-	}
88
+            exit();
89
+        }
90
+    }
91 91
 }
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-ajax-select2.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 							$search_values = preg_grep( '~' . $args['s'] . '~i', $values );
72 72
 							if ( ! empty( $search_values ) ) {
73 73
 								foreach ( $search_values as $id => $val ) {
74
-									$to_json[ $keys[ $id ] ] = array(
75
-										'id'   => $keys[ $id ],
74
+									$to_json[$keys[$id]] = array(
75
+										'id'   => $keys[$id],
76 76
 										'text' => $val,
77 77
 									);
78 78
 								}
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 							$search_keys = preg_grep( '~' . $args['s'] . '~i', $keys );
82 82
 							if ( ! empty( $search_keys ) ) {
83 83
 								foreach ( $search_keys as $id => $val ) {
84
-									$to_json[ $val ] = array(
84
+									$to_json[$val] = array(
85 85
 										'id'   => $val,
86
-										'text' => $values[ $id ],
86
+										'text' => $values[$id],
87 87
 									);
88 88
 								}
89 89
 							}
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,86 +12,86 @@
 block discarded – undo
12 12
 
13 13
 if ( ! class_exists( 'Redux_AJAX_Select2', false ) ) {
14 14
 
15
-	/**
16
-	 * Class Redux_AJAX_Select2
17
-	 */
18
-	class Redux_AJAX_Select2 extends Redux_Class {
15
+    /**
16
+     * Class Redux_AJAX_Select2
17
+     */
18
+    class Redux_AJAX_Select2 extends Redux_Class {
19 19
 
20
-		/**
21
-		 * Redux_AJAX_Select2 constructor.
22
-		 *
23
-		 * @param object $redux ReduxFramework object pointer.
24
-		 */
25
-		public function __construct( $redux ) {
26
-			parent::__construct( $redux );
27
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
28
-			add_action( "wp_ajax_redux_{$redux->args['opt_name']}_select2", array( $this, 'ajax' ) );
29
-		}
20
+        /**
21
+         * Redux_AJAX_Select2 constructor.
22
+         *
23
+         * @param object $redux ReduxFramework object pointer.
24
+         */
25
+        public function __construct( $redux ) {
26
+            parent::__construct( $redux );
27
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
28
+            add_action( "wp_ajax_redux_{$redux->args['opt_name']}_select2", array( $this, 'ajax' ) );
29
+        }
30 30
 
31
-		/**
32
-		 * AJAX callback for select2 match search.
33
-		 */
34
-		public function ajax() {
35
-			$core = $this->core();
31
+        /**
32
+         * AJAX callback for select2 match search.
33
+         */
34
+        public function ajax() {
35
+            $core = $this->core();
36 36
 
37
-			if ( isset( $_REQUEST['nonce'] ) && isset( $_REQUEST['action'] ) ) {
38
-				if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) ) ) {
39
-					wp_send_json_error( esc_html__( 'Invalid security credential.  Please reload the page and try again.', 'redux-framework' ) );
40
-				}
37
+            if ( isset( $_REQUEST['nonce'] ) && isset( $_REQUEST['action'] ) ) {
38
+                if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) ) ) {
39
+                    wp_send_json_error( esc_html__( 'Invalid security credential.  Please reload the page and try again.', 'redux-framework' ) );
40
+                }
41 41
 
42
-				if ( ! Redux_Helpers::current_user_can( $this->parent->args['page_permissions'] ) ) {
43
-					wp_send_json_error( esc_html__( 'Invalid user capability.  Please reload the page and try again.', 'redux-framework' ) );
44
-				}
42
+                if ( ! Redux_Helpers::current_user_can( $this->parent->args['page_permissions'] ) ) {
43
+                    wp_send_json_error( esc_html__( 'Invalid user capability.  Please reload the page and try again.', 'redux-framework' ) );
44
+                }
45 45
 
46
-				if ( isset( $_REQUEST['data'] ) ) {
46
+                if ( isset( $_REQUEST['data'] ) ) {
47 47
 
48
-					$args = isset( $_REQUEST['data_args'] ) ? json_decode( sanitize_text_field( wp_unslash( $_REQUEST['data_args'] ) ), true ) : array();
49
-					$args = wp_parse_args(
50
-						$args,
51
-						array(
52
-							's' => isset( $_REQUEST['q'] ) && ! empty( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '',
53
-						)
54
-					);
48
+                    $args = isset( $_REQUEST['data_args'] ) ? json_decode( sanitize_text_field( wp_unslash( $_REQUEST['data_args'] ) ), true ) : array();
49
+                    $args = wp_parse_args(
50
+                        $args,
51
+                        array(
52
+                            's' => isset( $_REQUEST['q'] ) && ! empty( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '',
53
+                        )
54
+                    );
55 55
 
56
-					if ( isset( $_REQUEST['q'] ) && ! empty( $_REQUEST['q'] ) ) {
57
-						$criteria  = sanitize_text_field( wp_unslash( $_REQUEST['q'] ) );
58
-						$args['s'] = $criteria;
59
-					}
56
+                    if ( isset( $_REQUEST['q'] ) && ! empty( $_REQUEST['q'] ) ) {
57
+                        $criteria  = sanitize_text_field( wp_unslash( $_REQUEST['q'] ) );
58
+                        $args['s'] = $criteria;
59
+                    }
60 60
 
61
-					$return = $core->wordpress_data->get( sanitize_text_field( wp_unslash( $_REQUEST['data'] ) ), $args );
61
+                    $return = $core->wordpress_data->get( sanitize_text_field( wp_unslash( $_REQUEST['data'] ) ), $args );
62 62
 
63
-					if ( is_array( $return ) && ! empty( $_REQUEST['action'] ) ) {
64
-						if ( ! empty( $args['s'] ) ) {
65
-							$keys   = array_keys( $return );
66
-							$values = array_values( $return );
63
+                    if ( is_array( $return ) && ! empty( $_REQUEST['action'] ) ) {
64
+                        if ( ! empty( $args['s'] ) ) {
65
+                            $keys   = array_keys( $return );
66
+                            $values = array_values( $return );
67 67
 
68
-							$to_json = array();
68
+                            $to_json = array();
69 69
 
70
-							// Search all the values.
71
-							$search_values = preg_grep( '~' . $args['s'] . '~i', $values );
72
-							if ( ! empty( $search_values ) ) {
73
-								foreach ( $search_values as $id => $val ) {
74
-									$to_json[ $keys[ $id ] ] = array(
75
-										'id'   => $keys[ $id ],
76
-										'text' => $val,
77
-									);
78
-								}
79
-							}
80
-							// Search all the keys.
81
-							$search_keys = preg_grep( '~' . $args['s'] . '~i', $keys );
82
-							if ( ! empty( $search_keys ) ) {
83
-								foreach ( $search_keys as $id => $val ) {
84
-									$to_json[ $val ] = array(
85
-										'id'   => $val,
86
-										'text' => $values[ $id ],
87
-									);
88
-								}
89
-							}
90
-							wp_send_json_success( array_values( $to_json ) );
91
-						}
92
-					}
93
-				}
94
-			}
95
-		}
96
-	}
70
+                            // Search all the values.
71
+                            $search_values = preg_grep( '~' . $args['s'] . '~i', $values );
72
+                            if ( ! empty( $search_values ) ) {
73
+                                foreach ( $search_values as $id => $val ) {
74
+                                    $to_json[ $keys[ $id ] ] = array(
75
+                                        'id'   => $keys[ $id ],
76
+                                        'text' => $val,
77
+                                    );
78
+                                }
79
+                            }
80
+                            // Search all the keys.
81
+                            $search_keys = preg_grep( '~' . $args['s'] . '~i', $keys );
82
+                            if ( ! empty( $search_keys ) ) {
83
+                                foreach ( $search_keys as $id => $val ) {
84
+                                    $to_json[ $val ] = array(
85
+                                        'id'   => $val,
86
+                                        'text' => $values[ $id ],
87
+                                    );
88
+                                }
89
+                            }
90
+                            wp_send_json_success( array_values( $to_json ) );
91
+                        }
92
+                    }
93
+                }
94
+            }
95
+        }
96
+    }
97 97
 }
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-admin-notices.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			// phpcs:ignore WordPress.PHP.DontExtract
76 76
 			extract( $data );
77 77
 
78
-			self::$notices[ $parent->args['page_slug'] ][] = array(
78
+			self::$notices[$parent->args['page_slug']][] = array(
79 79
 				'type'    => $type,
80 80
 				'msg'     => $msg,
81 81
 				'id'      => $id . '_' . $parent->args['opt_name'],
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 
104 104
 				// Check for an active admin notice array.
105 105
 				if ( ! empty( $notices ) ) {
106
-					if ( isset( $notices[ $core->args['page_slug'] ] ) ) {
106
+					if ( isset( $notices[$core->args['page_slug']] ) ) {
107 107
 						// Enum admin notices.
108
-						foreach ( $notices[ $core->args['page_slug'] ] as $notice ) {
108
+						foreach ( $notices[$core->args['page_slug']] as $notice ) {
109 109
 
110 110
 							$add_style = '';
111 111
 							if ( strpos( $notice['type'], 'redux-message' ) !== false ) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 					}
163 163
 				}
164 164
 				// Clear the admin notice array.
165
-				self::$notices[ $core->args['opt_name'] ] = array();
165
+				self::$notices[$core->args['opt_name']] = array();
166 166
 			}
167 167
 		}
168 168
 
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -14,133 +14,133 @@  discard block
 block discarded – undo
14 14
 // Don't duplicate me!
15 15
 if ( ! class_exists( 'Redux_Admin_Notices', false ) ) {
16 16
 
17
-	/**
18
-	 * Redux Admin Notices Class
19
-	 *
20
-	 * @since       3.0.0
21
-	 */
22
-	class Redux_Admin_Notices extends Redux_Class {
23
-
24
-		/**
25
-		 * WordPress admin notice array.
26
-		 *
27
-		 * @var array
28
-		 * @access private
29
-		 */
30
-		private static array $notices = array();
31
-
32
-		/**
33
-		 * Redux_Admin_Notices constructor.
34
-		 *
35
-		 * @param array $redux ReduxFramework object.
36
-		 * @access public
37
-		 */
38
-		public function __construct( $redux ) {
39
-			parent::__construct( $redux );
40
-
41
-			add_action( 'wp_ajax_redux_hide_admin_notice', array( $this, 'ajax' ) );
42
-			add_action( 'admin_notices', array( $this, 'notices' ), 99 );
43
-			add_action( 'admin_init', array( $this, 'dismiss' ), 9 );
44
-		}
45
-
46
-		/**
47
-		 * Display notices stored in a notice array.
48
-		 *
49
-		 * @access public
50
-		 */
51
-		public function notices() {
52
-			$this->admin_notices( self::$notices );
53
-		}
54
-
55
-		/**
56
-		 * Dismisses admin notice
57
-		 *
58
-		 * @access public
59
-		 */
60
-		public function dismiss() {
61
-			$this->dismiss_admin_notice();
62
-		}
63
-
64
-		/**
65
-		 * Sets an admin notice for display.
66
-		 *
67
-		 * @param array $data Notice data.
68
-		 */
69
-		public static function set_notice( array $data ) {
70
-			$type    = null;
71
-			$msg     = null;
72
-			$id      = null;
73
-			$dismiss = null;
74
-
75
-			// phpcs:ignore WordPress.PHP.DontExtract
76
-			extract( $data );
77
-
78
-			self::$notices[ $parent->args['page_slug'] ][] = array(
79
-				'type'    => $type,
80
-				'msg'     => $msg,
81
-				'id'      => $id . '_' . $parent->args['opt_name'],
82
-				'dismiss' => $dismiss,
83
-				'color'   => $color ?? '#00A2E3',
84
-			);
85
-		}
86
-
87
-		/**
88
-		 * Evaluates a user-dismissed option for displaying admin notices.
89
-		 *
90
-		 * @param array $notices Array of stored notices to display.
91
-		 *
92
-		 * @return      void
93
-		 * @since       3.2.0
94
-		 * @access      public
95
-		 */
96
-		public function admin_notices( array $notices = array() ) {
97
-			global $current_user;
98
-
99
-			$core = $this->core();
100
-			if ( isset( $_GET['page'] ) && $core->args['page_slug'] === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification
101
-				do_action( 'redux_admin_notices_run', $core->args );
102
-
103
-				// Check for an active admin notice array.
104
-				if ( ! empty( $notices ) ) {
105
-					if ( isset( $notices[ $core->args['page_slug'] ] ) ) {
106
-						// Enum admin notices.
107
-						foreach ( $notices[ $core->args['page_slug'] ] as $notice ) {
108
-
109
-							$add_style = '';
110
-							if ( strpos( $notice['type'], 'redux-message' ) !== false ) {
111
-								$add_style = 'style="border-left: 4px solid ' . esc_attr( $notice['color'] ) . '!important;"';
112
-							}
113
-
114
-							if ( true === $notice['dismiss'] ) {
115
-
116
-								// Get user ID.
117
-								$userid = $current_user->ID;
118
-
119
-								if ( ! get_user_meta( $userid, 'ignore_' . $notice['id'] ) ) {
120
-									global $wp_version;
121
-
122
-									$css_id = '';
123
-
124
-									// Print the notice with the dismiss link.
125
-									if ( version_compare( $wp_version, '4.2', '>' ) ) {
126
-										$css_id    = esc_attr( $notice['id'] );
127
-										$css_class = esc_attr( $notice['type'] ) . ' redux-notice notice is-dismissible redux-notice';
128
-
129
-										$nonce = wp_create_nonce( $notice['id'] . $userid . 'nonce' );
130
-
131
-										echo '<div ' . $add_style . ' id="' . esc_attr( $css_id ) . '" class="' . esc_attr( $css_class ) . '">'; // phpcs:ignore WordPress.Security.EscapeOutput
132
-										echo '<input type="hidden" class="dismiss_data" id="' . esc_attr( $css_id ) . '" value="' . esc_attr( $nonce ) . '">';
133
-										echo '<p>' . wp_kses_post( $notice['msg'] ) . '</p>';
134
-										echo '</div>';
135
-									} else {
136
-										echo '<div ' . esc_html( $add_style ) . ' class="' . esc_attr( $notice['type'] ) . ' notice is-dismissable"><p>' . wp_kses_post( $notice['msg'] ) . '&nbsp;&nbsp;<a href="?dismiss=true&amp;id=' . esc_attr( $css_id ) . '">' . esc_html__( 'Dismiss', 'redux-framework' ) . '</a>.</p></div>';
137
-									}
138
-								}
139
-							} else {
140
-								// Standard notice.
141
-								echo '<div ' . esc_html( $add_style ) . ' class="' . esc_attr( $notice['type'] ) . ' notice"><p>' . wp_kses_post( $notice['msg'] ) . '</a>.</p></div>';
142
-							}
143
-							?>
17
+    /**
18
+     * Redux Admin Notices Class
19
+     *
20
+     * @since       3.0.0
21
+     */
22
+    class Redux_Admin_Notices extends Redux_Class {
23
+
24
+        /**
25
+         * WordPress admin notice array.
26
+         *
27
+         * @var array
28
+         * @access private
29
+         */
30
+        private static array $notices = array();
31
+
32
+        /**
33
+         * Redux_Admin_Notices constructor.
34
+         *
35
+         * @param array $redux ReduxFramework object.
36
+         * @access public
37
+         */
38
+        public function __construct( $redux ) {
39
+            parent::__construct( $redux );
40
+
41
+            add_action( 'wp_ajax_redux_hide_admin_notice', array( $this, 'ajax' ) );
42
+            add_action( 'admin_notices', array( $this, 'notices' ), 99 );
43
+            add_action( 'admin_init', array( $this, 'dismiss' ), 9 );
44
+        }
45
+
46
+        /**
47
+         * Display notices stored in a notice array.
48
+         *
49
+         * @access public
50
+         */
51
+        public function notices() {
52
+            $this->admin_notices( self::$notices );
53
+        }
54
+
55
+        /**
56
+         * Dismisses admin notice
57
+         *
58
+         * @access public
59
+         */
60
+        public function dismiss() {
61
+            $this->dismiss_admin_notice();
62
+        }
63
+
64
+        /**
65
+         * Sets an admin notice for display.
66
+         *
67
+         * @param array $data Notice data.
68
+         */
69
+        public static function set_notice( array $data ) {
70
+            $type    = null;
71
+            $msg     = null;
72
+            $id      = null;
73
+            $dismiss = null;
74
+
75
+            // phpcs:ignore WordPress.PHP.DontExtract
76
+            extract( $data );
77
+
78
+            self::$notices[ $parent->args['page_slug'] ][] = array(
79
+                'type'    => $type,
80
+                'msg'     => $msg,
81
+                'id'      => $id . '_' . $parent->args['opt_name'],
82
+                'dismiss' => $dismiss,
83
+                'color'   => $color ?? '#00A2E3',
84
+            );
85
+        }
86
+
87
+        /**
88
+         * Evaluates a user-dismissed option for displaying admin notices.
89
+         *
90
+         * @param array $notices Array of stored notices to display.
91
+         *
92
+         * @return      void
93
+         * @since       3.2.0
94
+         * @access      public
95
+         */
96
+        public function admin_notices( array $notices = array() ) {
97
+            global $current_user;
98
+
99
+            $core = $this->core();
100
+            if ( isset( $_GET['page'] ) && $core->args['page_slug'] === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification
101
+                do_action( 'redux_admin_notices_run', $core->args );
102
+
103
+                // Check for an active admin notice array.
104
+                if ( ! empty( $notices ) ) {
105
+                    if ( isset( $notices[ $core->args['page_slug'] ] ) ) {
106
+                        // Enum admin notices.
107
+                        foreach ( $notices[ $core->args['page_slug'] ] as $notice ) {
108
+
109
+                            $add_style = '';
110
+                            if ( strpos( $notice['type'], 'redux-message' ) !== false ) {
111
+                                $add_style = 'style="border-left: 4px solid ' . esc_attr( $notice['color'] ) . '!important;"';
112
+                            }
113
+
114
+                            if ( true === $notice['dismiss'] ) {
115
+
116
+                                // Get user ID.
117
+                                $userid = $current_user->ID;
118
+
119
+                                if ( ! get_user_meta( $userid, 'ignore_' . $notice['id'] ) ) {
120
+                                    global $wp_version;
121
+
122
+                                    $css_id = '';
123
+
124
+                                    // Print the notice with the dismiss link.
125
+                                    if ( version_compare( $wp_version, '4.2', '>' ) ) {
126
+                                        $css_id    = esc_attr( $notice['id'] );
127
+                                        $css_class = esc_attr( $notice['type'] ) . ' redux-notice notice is-dismissible redux-notice';
128
+
129
+                                        $nonce = wp_create_nonce( $notice['id'] . $userid . 'nonce' );
130
+
131
+                                        echo '<div ' . $add_style . ' id="' . esc_attr( $css_id ) . '" class="' . esc_attr( $css_class ) . '">'; // phpcs:ignore WordPress.Security.EscapeOutput
132
+                                        echo '<input type="hidden" class="dismiss_data" id="' . esc_attr( $css_id ) . '" value="' . esc_attr( $nonce ) . '">';
133
+                                        echo '<p>' . wp_kses_post( $notice['msg'] ) . '</p>';
134
+                                        echo '</div>';
135
+                                    } else {
136
+                                        echo '<div ' . esc_html( $add_style ) . ' class="' . esc_attr( $notice['type'] ) . ' notice is-dismissable"><p>' . wp_kses_post( $notice['msg'] ) . '&nbsp;&nbsp;<a href="?dismiss=true&amp;id=' . esc_attr( $css_id ) . '">' . esc_html__( 'Dismiss', 'redux-framework' ) . '</a>.</p></div>';
137
+                                    }
138
+                                }
139
+                            } else {
140
+                                // Standard notice.
141
+                                echo '<div ' . esc_html( $add_style ) . ' class="' . esc_attr( $notice['type'] ) . ' notice"><p>' . wp_kses_post( $notice['msg'] ) . '</a>.</p></div>';
142
+                            }
143
+                            ?>
144 144
 							<script>
145 145
 								document.addEventListener(
146 146
 									'DOMContentLoaded',
@@ -163,70 +163,70 @@  discard block
 block discarded – undo
163 163
 							</script>
164 164
 							<?php
165 165
 
166
-						}
167
-					}
168
-				}
169
-				// Clear the admin notice array.
170
-				self::$notices[ $core->args['opt_name'] ] = array();
171
-			}
172
-		}
173
-
174
-		/**
175
-		 * Updates user meta to store dismiss notice preference.
176
-		 *
177
-		 * @since       3.2.0
178
-		 * @access      private
179
-		 * @return      void
180
-		 */
181
-		private function dismiss_admin_notice() {
182
-			global $current_user;
183
-
184
-			// Verify the dismissed notice and id parameters are present.
185
-			if ( isset( $_GET['dismiss'] ) && isset( $_GET['id'] ) ) {
186
-				if ( isset( $_GET['nonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_GET['nonce'] ) ), 'redux_hint_toggle' ) ) {
187
-					if ( 'true' === $_GET['dismiss'] || 'false' === $_GET['dismiss'] ) {
188
-
189
-						// Get the user id.
190
-						$userid = $current_user->ID;
191
-
192
-						// Get the notice id.
193
-						$id  = sanitize_text_field( wp_unslash( $_GET['id'] ) );
194
-						$val = sanitize_text_field( wp_unslash( $_GET['dismiss'] ) );
195
-
196
-						// Add the dismissed request to the user meta.
197
-						update_user_meta( $userid, 'ignore_' . $id, $val );
198
-					}
199
-				} else {
200
-					wp_nonce_ays( 'redux_hint_toggle' );
201
-				}
202
-			}
203
-		}
204
-
205
-		/**
206
-		 * Updates user meta to store dismiss notice preference
207
-		 *
208
-		 * @since       3.2.0
209
-		 * @access      public
210
-		 * @return      void
211
-		 */
212
-		public function ajax() {
213
-			global $current_user;
214
-
215
-			if ( isset( $_POST['id'] ) ) {
216
-				// Get the notice id.
217
-				$id = explode( '&', sanitize_text_field( wp_unslash( $_POST['id'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification
218
-				$id = $id[0];
219
-
220
-				// Get the user id.
221
-				$userid = $current_user->ID;
222
-
223
-				if ( ! isset( $_POST['nonce'] ) || ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), $id . $userid . 'nonce' ) ) ) {
224
-					die( 0 );
225
-				} else {
226
-					// Add the dismissed request to the user meta.
227
-					update_user_meta( $userid, 'ignore_' . $id, true );
228
-				}
229
-			}
230
-		}
231
-	}
166
+                        }
167
+                    }
168
+                }
169
+                // Clear the admin notice array.
170
+                self::$notices[ $core->args['opt_name'] ] = array();
171
+            }
172
+        }
173
+
174
+        /**
175
+         * Updates user meta to store dismiss notice preference.
176
+         *
177
+         * @since       3.2.0
178
+         * @access      private
179
+         * @return      void
180
+         */
181
+        private function dismiss_admin_notice() {
182
+            global $current_user;
183
+
184
+            // Verify the dismissed notice and id parameters are present.
185
+            if ( isset( $_GET['dismiss'] ) && isset( $_GET['id'] ) ) {
186
+                if ( isset( $_GET['nonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_GET['nonce'] ) ), 'redux_hint_toggle' ) ) {
187
+                    if ( 'true' === $_GET['dismiss'] || 'false' === $_GET['dismiss'] ) {
188
+
189
+                        // Get the user id.
190
+                        $userid = $current_user->ID;
191
+
192
+                        // Get the notice id.
193
+                        $id  = sanitize_text_field( wp_unslash( $_GET['id'] ) );
194
+                        $val = sanitize_text_field( wp_unslash( $_GET['dismiss'] ) );
195
+
196
+                        // Add the dismissed request to the user meta.
197
+                        update_user_meta( $userid, 'ignore_' . $id, $val );
198
+                    }
199
+                } else {
200
+                    wp_nonce_ays( 'redux_hint_toggle' );
201
+                }
202
+            }
203
+        }
204
+
205
+        /**
206
+         * Updates user meta to store dismiss notice preference
207
+         *
208
+         * @since       3.2.0
209
+         * @access      public
210
+         * @return      void
211
+         */
212
+        public function ajax() {
213
+            global $current_user;
214
+
215
+            if ( isset( $_POST['id'] ) ) {
216
+                // Get the notice id.
217
+                $id = explode( '&', sanitize_text_field( wp_unslash( $_POST['id'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification
218
+                $id = $id[0];
219
+
220
+                // Get the user id.
221
+                $userid = $current_user->ID;
222
+
223
+                if ( ! isset( $_POST['nonce'] ) || ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), $id . $userid . 'nonce' ) ) ) {
224
+                    die( 0 );
225
+                } else {
226
+                    // Add the dismissed request to the user meta.
227
+                    update_user_meta( $userid, 'ignore_' . $id, true );
228
+                }
229
+            }
230
+        }
231
+    }
232 232
 }
Please login to merge, or discard this patch.
redux-core/inc/classes/class-redux-transients.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Transients', false ) ) {
13 13
 
14
-	/**
15
-	 * Class Redux_Transients
16
-	 */
17
-	class Redux_Transients extends Redux_Class {
14
+    /**
15
+     * Class Redux_Transients
16
+     */
17
+    class Redux_Transients extends Redux_Class {
18 18
 
19
-		/**
20
-		 * Get transients from database.
21
-		 */
22
-		public function get() {
23
-			$core = $this->core();
19
+        /**
20
+         * Get transients from database.
21
+         */
22
+        public function get() {
23
+            $core = $this->core();
24 24
 
25
-			if ( empty( $core->transients ) ) {
26
-				$core->transients = get_option( $core->args['opt_name'] . '-transients', array() );
27
-			}
28
-		}
25
+            if ( empty( $core->transients ) ) {
26
+                $core->transients = get_option( $core->args['opt_name'] . '-transients', array() );
27
+            }
28
+        }
29 29
 
30
-		/**
31
-		 * Set transients in database.
32
-		 */
33
-		public function set() {
34
-			$core = $this->core();
30
+        /**
31
+         * Set transients in database.
32
+         */
33
+        public function set() {
34
+            $core = $this->core();
35 35
 
36
-			if ( ! isset( $core->transients ) || ! isset( $core->transients_check ) || $core->transients_check !== $core->transients ) {
37
-				update_option( $core->args['opt_name'] . '-transients', $core->transients );
38
-			}
39
-		}
40
-	}
36
+            if ( ! isset( $core->transients ) || ! isset( $core->transients_check ) || $core->transients_check !== $core->transients ) {
37
+                update_option( $core->args['opt_name'] . '-transients', $core->transients );
38
+            }
39
+        }
40
+    }
41 41
 }
Please login to merge, or discard this patch.
redux-core/inc/themecheck/checks/class-redux-full-package.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 			foreach ( $blacklist as $file => $reason ) {
56 56
 				checkcount();
57 57
 				if ( file_exists( $redux['parent_dir'] . $file ) ) {
58
-					$errors[ $redux['parent_dir'] . $file ] = $reason;
58
+					$errors[$redux['parent_dir'] . $file] = $reason;
59 59
 				}
60 60
 			}
61 61
 
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -14,71 +14,71 @@
 block discarded – undo
14 14
  */
15 15
 class Redux_Full_Package implements themecheck {
16 16
 
17
-	/**
18
-	 * Themecheck error array.
19
-	 *
20
-	 * @var array $error Error storage.
21
-	 */
22
-	protected array $error = array();
23
-
24
-	/**
25
-	 * Check files.
26
-	 *
27
-	 * @param array $php_files File to check.
28
-	 * @param array $css_files Files to check.
29
-	 * @param array $other_files Files to check.
30
-	 *
31
-	 * @return bool
32
-	 */
33
-	public function check( $php_files, $css_files, $other_files ): bool {
34
-
35
-		$ret = true;
36
-
37
-		$check = Redux_ThemeCheck::get_instance();
38
-		$redux = $check::get_redux_details( $php_files );
39
-
40
-		if ( $redux ) {
41
-
42
-			$blacklist = array(
43
-				'codestyles'                       => esc_html__( 'Redux Code Styles', 'redux-framework' ),
44
-				'class-redux-framework-plugin.php' => esc_html__( 'Redux Plugin File', 'redux-framework' ),
45
-				'.travis.yml'                      => esc_html__( 'CI Testing File', 'redux-framework' ),
46
-			);
47
-
48
-			$errors = array();
49
-
50
-			foreach ( $blacklist as $file => $reason ) {
51
-				checkcount();
52
-				if ( file_exists( $redux['parent_dir'] . $file ) ) {
53
-					$errors[ $redux['parent_dir'] . $file ] = $reason;
54
-				}
55
-			}
56
-
57
-			if ( ! empty( $errors ) ) {
58
-				$error  = '<span class="tc-lead tc-required">REQUIRED</span> ' . esc_html__( 'It appears that you have embedded the full Redux package inside your theme. You need only embed the', 'redux-framework' ) . ' <strong>redux-core</strong> ' . esc_html__( 'folder. Embedding anything else will get your rejected from theme submission. Suspected Redux package file(s):', 'redux-framework' );
59
-				$error .= '<ol>';
60
-
61
-				foreach ( $errors as $key => $e ) {
62
-					$error .= '<li><strong>' . $e . '</strong>: ' . $key . '</li>';
63
-				}
64
-
65
-				$error        .= '</ol>';
66
-				$this->error[] = '<div class="redux-error">' . $error . '</div>';
67
-				$ret           = false;
68
-			}
69
-		}
70
-
71
-		return $ret;
72
-	}
73
-
74
-	/**
75
-	 * Retrieve errors.
76
-	 *
77
-	 * @return array
78
-	 */
79
-	public function getError(): array {
80
-		return $this->error;
81
-	}
17
+    /**
18
+     * Themecheck error array.
19
+     *
20
+     * @var array $error Error storage.
21
+     */
22
+    protected array $error = array();
23
+
24
+    /**
25
+     * Check files.
26
+     *
27
+     * @param array $php_files File to check.
28
+     * @param array $css_files Files to check.
29
+     * @param array $other_files Files to check.
30
+     *
31
+     * @return bool
32
+     */
33
+    public function check( $php_files, $css_files, $other_files ): bool {
34
+
35
+        $ret = true;
36
+
37
+        $check = Redux_ThemeCheck::get_instance();
38
+        $redux = $check::get_redux_details( $php_files );
39
+
40
+        if ( $redux ) {
41
+
42
+            $blacklist = array(
43
+                'codestyles'                       => esc_html__( 'Redux Code Styles', 'redux-framework' ),
44
+                'class-redux-framework-plugin.php' => esc_html__( 'Redux Plugin File', 'redux-framework' ),
45
+                '.travis.yml'                      => esc_html__( 'CI Testing File', 'redux-framework' ),
46
+            );
47
+
48
+            $errors = array();
49
+
50
+            foreach ( $blacklist as $file => $reason ) {
51
+                checkcount();
52
+                if ( file_exists( $redux['parent_dir'] . $file ) ) {
53
+                    $errors[ $redux['parent_dir'] . $file ] = $reason;
54
+                }
55
+            }
56
+
57
+            if ( ! empty( $errors ) ) {
58
+                $error  = '<span class="tc-lead tc-required">REQUIRED</span> ' . esc_html__( 'It appears that you have embedded the full Redux package inside your theme. You need only embed the', 'redux-framework' ) . ' <strong>redux-core</strong> ' . esc_html__( 'folder. Embedding anything else will get your rejected from theme submission. Suspected Redux package file(s):', 'redux-framework' );
59
+                $error .= '<ol>';
60
+
61
+                foreach ( $errors as $key => $e ) {
62
+                    $error .= '<li><strong>' . $e . '</strong>: ' . $key . '</li>';
63
+                }
64
+
65
+                $error        .= '</ol>';
66
+                $this->error[] = '<div class="redux-error">' . $error . '</div>';
67
+                $ret           = false;
68
+            }
69
+        }
70
+
71
+        return $ret;
72
+    }
73
+
74
+    /**
75
+     * Retrieve errors.
76
+     *
77
+     * @return array
78
+     */
79
+    public function getError(): array {
80
+        return $this->error;
81
+    }
82 82
 }
83 83
 
84 84
 $themechecks[] = new Redux_Full_Package();
Please login to merge, or discard this patch.
redux-core/inc/themecheck/class-redux-themecheck.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 
123 123
 					// phpcs:ignore Generic.Strings.UnnecessaryStringConcat
124 124
 					if ( false !== strpos( $phpfile, 'class' . ' ReduxFramework {' ) ) {
125
-						self::$redux_details               = array(
125
+						self::$redux_details = array(
126 126
 							'filename' => Redux_Core::strtolower( basename( $php_key ) ),
127 127
 							'path'     => $php_key,
128 128
 						);
Please login to merge, or discard this patch.
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -12,221 +12,221 @@
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_ThemeCheck', false ) ) {
14 14
 
15
-	/**
16
-	 * Class Redux_ThemeCheck
17
-	 */
18
-	class Redux_ThemeCheck {
19
-
20
-		/**
21
-		 * Plugin version, used for cache-busting of style and script file references.
22
-		 *
23
-		 * @since   1.0.0
24
-		 * @var     string
25
-		 */
26
-		protected string $version = '1.0.0';
27
-
28
-		/**
29
-		 * Instance of this class.
30
-		 *
31
-		 * @since    1.0.0
32
-		 * @var      Redux_ThemeCheck|null
33
-		 */
34
-		protected static ?Redux_ThemeCheck $instance = null;
35
-
36
-		/**
37
-		 * Instance of the Redux class.
38
-		 *
39
-		 * @since    1.0.0
40
-		 * @var      ReduxFramework|null
41
-		 */
42
-		protected static ?ReduxFramework $redux;
43
-
44
-		/**
45
-		 * Details of the embedded Redux class.
46
-		 *
47
-		 * @since    1.0.0
48
-		 * @var      mixed|null
49
-		 */
50
-		protected static $redux_details = array();
51
-
52
-		/**
53
-		 * Slug for various elements.
54
-		 *
55
-		 * @since   1.0.0
56
-		 * @var     string
57
-		 */
58
-		protected string $slug = 'redux_themecheck';
59
-
60
-		/**
61
-		 * Initialize the plugin by setting localization, filters, and administration functions.
62
-		 *
63
-		 * @since     1.0.0
64
-		 */
65
-		private function __construct() {
66
-			if ( ! class_exists( 'ThemeCheckMain' ) ) {
67
-				return;
68
-			}
69
-
70
-			// Load the admin stylesheet and JavaScript.
71
-			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
72
-			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
73
-
74
-			add_action( 'themecheck_checks_loaded', array( $this, 'disable_checks' ) );
75
-			add_action( 'themecheck_checks_loaded', array( $this, 'add_checks' ) );
76
-		}
77
-
78
-		/**
79
-		 * Return an instance of this class.
80
-		 *
81
-		 * @since     1.0.0
82
-		 * @return    object    A single instance of this class.
83
-		 */
84
-		public static function get_instance() {
85
-
86
-			// If the single instance hasn't been set, set it now.
87
-			if ( null === self::$instance ) {
88
-				self::$instance = new self();
89
-			}
90
-
91
-			return self::$instance;
92
-		}
93
-
94
-		/**
95
-		 * Return an instance of this class.
96
-		 *
97
-		 * @since     1.0.0
98
-		 * @return    object    A single instance of this class.
99
-		 */
100
-		public static function get_redux_instance() {
101
-
102
-			// If the single instance hasn't been set, set it now.
103
-			if ( null === self::$redux && Redux_Core::$as_plugin ) {
104
-				self::$redux = new ReduxFramework();
105
-				self::$redux->init();
106
-			}
107
-
108
-			return self::$redux;
109
-		}
110
-
111
-		/**
112
-		 * Return the Redux path info, if had.
113
-		 *
114
-		 * @param array $php_files Array of files to check.
115
-		 *
116
-		 * @return    array|false|null    A single instance of this class.
117
-		 * @since     1.0.0
118
-		 */
119
-		public static function get_redux_details( array $php_files = array() ) {
120
-			if ( null === self::$redux_details ) {
121
-				foreach ( $php_files as $php_key => $phpfile ) {
122
-
123
-					// phpcs:ignore Generic.Strings.UnnecessaryStringConcat
124
-					if ( false !== strpos( $phpfile, 'class' . ' ReduxFramework {' ) ) {
125
-						self::$redux_details               = array(
126
-							'filename' => Redux_Core::strtolower( basename( $php_key ) ),
127
-							'path'     => $php_key,
128
-						);
129
-						self::$redux_details['dir']        = str_replace( basename( $php_key ), '', $php_key );
130
-						self::$redux_details['parent_dir'] = str_replace( basename( self::$redux_details['dir'] ) . '/', '', self::$redux_details['dir'] );
131
-					}
132
-				}
133
-			}
134
-			if ( null === self::$redux_details ) {
135
-				self::$redux_details = false;
136
-			}
137
-
138
-			return self::$redux_details;
139
-		}
140
-
141
-		/**
142
-		 * Disable Theme-Check checks that aren't relevant for ThemeForest themes
143
-		 *
144
-		 * @since    1.0.0
145
-		 */
146
-		public function disable_checks() {
147
-			/**
148
-			 * Uncomment code to use.
149
-			 *
150
-			 * global $themechecks;
151
-			 *
152
-			 * $checks_to_disable = array(
153
-			 *    'IncludeCheck',
154
-			 *    'I18NCheck',
155
-			 *    'AdminMenu',
156
-			 *    'Bad_Checks',
157
-			 *    'MalwareCheck',
158
-			 *    'Theme_Support',
159
-			 *    'CustomCheck',
160
-			 *    'EditorStyleCheck',
161
-			 *    'IframeCheck',
162
-			 * );
163
-			 * foreach ( $themechecks as $keyindex => $check ) {
164
-			 *    if ( $check instanceof themecheck ) {
165
-			 *        $check_class = get_class( $check );
166
-			 *        if ( in_array( $check_class, $checks_to_disable ) ) {
167
-			 *            unset( $themechecks[$keyindex] );
168
-			 *        }
169
-			 *    }
170
-			 * }
171
-			 */
172
-		}
173
-
174
-		/**
175
-		 * Disable Theme-Check checks that aren't relevant for ThemeForest themes
176
-		 *
177
-		 * @since    1.0.0
178
-		 */
179
-		public function add_checks() {
180
-
181
-			// load all the checks in the checks directory.
182
-			$dir = 'checks';
183
-			foreach ( glob( __DIR__ . '/' . $dir . '/*.php' ) as $file ) {
184
-				require_once $file;
185
-			}
186
-		}
187
-
188
-		/**
189
-		 * Register and enqueue admin-specific style sheet.
190
-		 *
191
-		 * @since     1.0.1
192
-		 */
193
-		public function enqueue_admin_styles() {
194
-			$screen = get_current_screen();
195
-			if ( 'appearance_page_themecheck' === $screen->id ) {
196
-				wp_enqueue_style( $this->slug . '-admin-styles', Redux_Core::$url . 'inc/themecheck/css/admin.css', array(), $this->version );
197
-			}
198
-		}
199
-
200
-		/**
201
-		 * Register and enqueue admin-specific JavaScript.
202
-		 *
203
-		 * @since     1.0.1
204
-		 */
205
-		public function enqueue_admin_scripts() {
206
-
207
-			$screen = get_current_screen();
208
-
209
-			if ( 'appearance_page_themecheck' === $screen->id ) {
210
-				wp_enqueue_script(
211
-					$this->slug . '-admin-script',
212
-					Redux_Core::$url . 'inc/themecheck/js/admin' . Redux_Functions::is_min() . '.js',
213
-					array( 'jquery' ),
214
-					$this->version,
215
-					true
216
-				);
217
-
218
-				if ( ! isset( $_POST['themename'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
219
-
220
-					$intro  = '<h2>Redux Theme-Check</h2>';
221
-					$intro .= '<p>Extra checks for Redux to ensure you\'re ready for marketplace submission to marketplaces.</p>';
222
-
223
-					$redux_check_intro['text'] = $intro;
224
-
225
-					wp_localize_script( $this->slug . '-admin-script', 'redux_check_intro', $redux_check_intro );
226
-				}
227
-			}
228
-		}
229
-	}
230
-
231
-	Redux_ThemeCheck::get_instance();
15
+    /**
16
+     * Class Redux_ThemeCheck
17
+     */
18
+    class Redux_ThemeCheck {
19
+
20
+        /**
21
+         * Plugin version, used for cache-busting of style and script file references.
22
+         *
23
+         * @since   1.0.0
24
+         * @var     string
25
+         */
26
+        protected string $version = '1.0.0';
27
+
28
+        /**
29
+         * Instance of this class.
30
+         *
31
+         * @since    1.0.0
32
+         * @var      Redux_ThemeCheck|null
33
+         */
34
+        protected static ?Redux_ThemeCheck $instance = null;
35
+
36
+        /**
37
+         * Instance of the Redux class.
38
+         *
39
+         * @since    1.0.0
40
+         * @var      ReduxFramework|null
41
+         */
42
+        protected static ?ReduxFramework $redux;
43
+
44
+        /**
45
+         * Details of the embedded Redux class.
46
+         *
47
+         * @since    1.0.0
48
+         * @var      mixed|null
49
+         */
50
+        protected static $redux_details = array();
51
+
52
+        /**
53
+         * Slug for various elements.
54
+         *
55
+         * @since   1.0.0
56
+         * @var     string
57
+         */
58
+        protected string $slug = 'redux_themecheck';
59
+
60
+        /**
61
+         * Initialize the plugin by setting localization, filters, and administration functions.
62
+         *
63
+         * @since     1.0.0
64
+         */
65
+        private function __construct() {
66
+            if ( ! class_exists( 'ThemeCheckMain' ) ) {
67
+                return;
68
+            }
69
+
70
+            // Load the admin stylesheet and JavaScript.
71
+            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
72
+            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
73
+
74
+            add_action( 'themecheck_checks_loaded', array( $this, 'disable_checks' ) );
75
+            add_action( 'themecheck_checks_loaded', array( $this, 'add_checks' ) );
76
+        }
77
+
78
+        /**
79
+         * Return an instance of this class.
80
+         *
81
+         * @since     1.0.0
82
+         * @return    object    A single instance of this class.
83
+         */
84
+        public static function get_instance() {
85
+
86
+            // If the single instance hasn't been set, set it now.
87
+            if ( null === self::$instance ) {
88
+                self::$instance = new self();
89
+            }
90
+
91
+            return self::$instance;
92
+        }
93
+
94
+        /**
95
+         * Return an instance of this class.
96
+         *
97
+         * @since     1.0.0
98
+         * @return    object    A single instance of this class.
99
+         */
100
+        public static function get_redux_instance() {
101
+
102
+            // If the single instance hasn't been set, set it now.
103
+            if ( null === self::$redux && Redux_Core::$as_plugin ) {
104
+                self::$redux = new ReduxFramework();
105
+                self::$redux->init();
106
+            }
107
+
108
+            return self::$redux;
109
+        }
110
+
111
+        /**
112
+         * Return the Redux path info, if had.
113
+         *
114
+         * @param array $php_files Array of files to check.
115
+         *
116
+         * @return    array|false|null    A single instance of this class.
117
+         * @since     1.0.0
118
+         */
119
+        public static function get_redux_details( array $php_files = array() ) {
120
+            if ( null === self::$redux_details ) {
121
+                foreach ( $php_files as $php_key => $phpfile ) {
122
+
123
+                    // phpcs:ignore Generic.Strings.UnnecessaryStringConcat
124
+                    if ( false !== strpos( $phpfile, 'class' . ' ReduxFramework {' ) ) {
125
+                        self::$redux_details               = array(
126
+                            'filename' => Redux_Core::strtolower( basename( $php_key ) ),
127
+                            'path'     => $php_key,
128
+                        );
129
+                        self::$redux_details['dir']        = str_replace( basename( $php_key ), '', $php_key );
130
+                        self::$redux_details['parent_dir'] = str_replace( basename( self::$redux_details['dir'] ) . '/', '', self::$redux_details['dir'] );
131
+                    }
132
+                }
133
+            }
134
+            if ( null === self::$redux_details ) {
135
+                self::$redux_details = false;
136
+            }
137
+
138
+            return self::$redux_details;
139
+        }
140
+
141
+        /**
142
+         * Disable Theme-Check checks that aren't relevant for ThemeForest themes
143
+         *
144
+         * @since    1.0.0
145
+         */
146
+        public function disable_checks() {
147
+            /**
148
+             * Uncomment code to use.
149
+             *
150
+             * global $themechecks;
151
+             *
152
+             * $checks_to_disable = array(
153
+             *    'IncludeCheck',
154
+             *    'I18NCheck',
155
+             *    'AdminMenu',
156
+             *    'Bad_Checks',
157
+             *    'MalwareCheck',
158
+             *    'Theme_Support',
159
+             *    'CustomCheck',
160
+             *    'EditorStyleCheck',
161
+             *    'IframeCheck',
162
+             * );
163
+             * foreach ( $themechecks as $keyindex => $check ) {
164
+             *    if ( $check instanceof themecheck ) {
165
+             *        $check_class = get_class( $check );
166
+             *        if ( in_array( $check_class, $checks_to_disable ) ) {
167
+             *            unset( $themechecks[$keyindex] );
168
+             *        }
169
+             *    }
170
+             * }
171
+             */
172
+        }
173
+
174
+        /**
175
+         * Disable Theme-Check checks that aren't relevant for ThemeForest themes
176
+         *
177
+         * @since    1.0.0
178
+         */
179
+        public function add_checks() {
180
+
181
+            // load all the checks in the checks directory.
182
+            $dir = 'checks';
183
+            foreach ( glob( __DIR__ . '/' . $dir . '/*.php' ) as $file ) {
184
+                require_once $file;
185
+            }
186
+        }
187
+
188
+        /**
189
+         * Register and enqueue admin-specific style sheet.
190
+         *
191
+         * @since     1.0.1
192
+         */
193
+        public function enqueue_admin_styles() {
194
+            $screen = get_current_screen();
195
+            if ( 'appearance_page_themecheck' === $screen->id ) {
196
+                wp_enqueue_style( $this->slug . '-admin-styles', Redux_Core::$url . 'inc/themecheck/css/admin.css', array(), $this->version );
197
+            }
198
+        }
199
+
200
+        /**
201
+         * Register and enqueue admin-specific JavaScript.
202
+         *
203
+         * @since     1.0.1
204
+         */
205
+        public function enqueue_admin_scripts() {
206
+
207
+            $screen = get_current_screen();
208
+
209
+            if ( 'appearance_page_themecheck' === $screen->id ) {
210
+                wp_enqueue_script(
211
+                    $this->slug . '-admin-script',
212
+                    Redux_Core::$url . 'inc/themecheck/js/admin' . Redux_Functions::is_min() . '.js',
213
+                    array( 'jquery' ),
214
+                    $this->version,
215
+                    true
216
+                );
217
+
218
+                if ( ! isset( $_POST['themename'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
219
+
220
+                    $intro  = '<h2>Redux Theme-Check</h2>';
221
+                    $intro .= '<p>Extra checks for Redux to ensure you\'re ready for marketplace submission to marketplaces.</p>';
222
+
223
+                    $redux_check_intro['text'] = $intro;
224
+
225
+                    wp_localize_script( $this->slug . '-admin-script', 'redux_check_intro', $redux_check_intro );
226
+                }
227
+            }
228
+        }
229
+    }
230
+
231
+    Redux_ThemeCheck::get_instance();
232 232
 }
Please login to merge, or discard this patch.