Completed
Push — master ( 7388a0...c197b7 )
by
unknown
45s
created
redux-core/inc/extensions/metaboxes/redux-metaboxes-helpers.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -8,49 +8,49 @@
 block discarded – undo
8 8
 defined( 'ABSPATH' ) || exit;
9 9
 
10 10
 if ( ! function_exists( 'redux_metaboxes_loop_start' ) ) {
11
-	/**
12
-	 * Start loop.
13
-	 *
14
-	 * @param string $opt_name Panel opt_name.
15
-	 * @param array  $the_post Post object.
16
-	 */
17
-	function redux_metaboxes_loop_start( string $opt_name, array $the_post = array() ) {
18
-		$redux     = ReduxFrameworkInstances::get_instance( $opt_name );
19
-		$metaboxes = $redux->extensions['metaboxes'];
11
+    /**
12
+     * Start loop.
13
+     *
14
+     * @param string $opt_name Panel opt_name.
15
+     * @param array  $the_post Post object.
16
+     */
17
+    function redux_metaboxes_loop_start( string $opt_name, array $the_post = array() ) {
18
+        $redux     = ReduxFrameworkInstances::get_instance( $opt_name );
19
+        $metaboxes = $redux->extensions['metaboxes'];
20 20
 
21
-		$metaboxes->loop_start( $the_post );
22
-	}
21
+        $metaboxes->loop_start( $the_post );
22
+    }
23 23
 }
24 24
 
25 25
 if ( ! function_exists( 'redux_metaboxes_loop_end' ) ) {
26
-	/**
27
-	 * End loop.
28
-	 *
29
-	 * @param string $opt_name Panel opt_name.
30
-	 * @param array  $the_post Deprecated.
31
-	 */
32
-	function redux_metaboxes_loop_end( string $opt_name, array $the_post = array() ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
33
-		_deprecated_argument( __FUNCTION__, '4.5', '$the_post argument has been deprecated and will be removed in a future version. Please update your code accordingly!' );
26
+    /**
27
+     * End loop.
28
+     *
29
+     * @param string $opt_name Panel opt_name.
30
+     * @param array  $the_post Deprecated.
31
+     */
32
+    function redux_metaboxes_loop_end( string $opt_name, array $the_post = array() ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
33
+        _deprecated_argument( __FUNCTION__, '4.5', '$the_post argument has been deprecated and will be removed in a future version. Please update your code accordingly!' );
34 34
 
35
-		$redux     = ReduxFrameworkInstances::get_instance( $opt_name );
36
-		$metaboxes = $redux->extensions['metaboxes'];
35
+        $redux     = ReduxFrameworkInstances::get_instance( $opt_name );
36
+        $metaboxes = $redux->extensions['metaboxes'];
37 37
 
38
-		$metaboxes->loop_end();
39
-	}
38
+        $metaboxes->loop_end();
39
+    }
40 40
 }
41 41
 
42 42
 if ( ! function_exists( 'redux_post_meta' ) ) {
43
-	/**
44
-	 * Retrieve post meta values/settings.
45
-	 *
46
-	 * @param string $opt_name Panel opt_name.
47
-	 * @param mixed  $the_post Post ID.
48
-	 * @param string $meta_key Meta key.
49
-	 * @param mixed  $def_val  Default value.
50
-	 *
51
-	 * @return string|void
52
-	 */
53
-	function redux_post_meta( string $opt_name = '', $the_post = array(), string $meta_key = '', $def_val = '' ) {
54
-		return Redux::get_post_meta( $opt_name, $the_post, $meta_key, $def_val );
55
-	}
43
+    /**
44
+     * Retrieve post meta values/settings.
45
+     *
46
+     * @param string $opt_name Panel opt_name.
47
+     * @param mixed  $the_post Post ID.
48
+     * @param string $meta_key Meta key.
49
+     * @param mixed  $def_val  Default value.
50
+     *
51
+     * @return string|void
52
+     */
53
+    function redux_post_meta( string $opt_name = '', $the_post = array(), string $meta_key = '', $def_val = '' ) {
54
+        return Redux::get_post_meta( $opt_name, $the_post, $meta_key, $def_val );
55
+    }
56 56
 }
Please login to merge, or discard this patch.
redux-core/inc/extensions/users/class-redux-extension-users.php 2 patches
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			}
220 220
 
221 221
 			foreach ( $this->profiles as $bk => $profile ) {
222
-				$profile['roles'] = isset( $profile['roles'] ) ? (array) $profile['roles'] : array( 'read' );
222
+				$profile['roles'] = isset( $profile['roles'] ) ? ( array ) $profile['roles'] : array( 'read' );
223 223
 
224 224
 				if ( ! empty( $profile['sections'] ) ) {
225 225
 					$this->sections = $profile['sections'];
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 									if ( ! isset( $field['class'] ) ) {
244 244
 										$field['class'] = '';
245 245
 
246
-										$this->profiles[ $bk ]['sections'][ $sk ]['fields'][ $fk ] = $field;
246
+										$this->profiles[$bk]['sections'][$sk]['fields'][$fk] = $field;
247 247
 									}
248 248
 
249 249
 									$this->parent->required_class->check_dependencies( $field );
@@ -254,37 +254,37 @@  discard block
 block discarded – undo
254 254
 										}
255 255
 
256 256
 										if ( isset( $field['default'] ) ) {
257
-											$this->options_defaults[ $field['id'] ] = $field['default'];
257
+											$this->options_defaults[$field['id']] = $field['default'];
258 258
 										} else {
259
-											$this->options_defaults[ $field['id'] ] = $this->field_default( $field );
259
+											$this->options_defaults[$field['id']] = $this->field_default( $field );
260 260
 										}
261 261
 
262 262
 										foreach ( $profile['roles'] as $type ) {
263
-											$this->profile_fields[ $type ][ $field['id'] ] = 1;
263
+											$this->profile_fields[$type][$field['id']] = 1;
264 264
 										}
265 265
 
266 266
 										if ( ! empty( $field['output'] ) ) {
267
-											$this->output[ $field['id'] ] = isset( $this->output[ $field['id'] ] ) ? array_merge( $field['output'], $this->output[ $field['id'] ] ) : $field['output'];
267
+											$this->output[$field['id']] = isset( $this->output[$field['id']] ) ? array_merge( $field['output'], $this->output[$field['id']] ) : $field['output'];
268 268
 										}
269 269
 
270 270
 										// Detect what field types are being used.
271
-										if ( ! isset( $this->parent->fields[ $field['type'] ][ $field['id'] ] ) ) {
272
-											$this->parent->fields[ $field['type'] ][ $field['id'] ] = 1;
271
+										if ( ! isset( $this->parent->fields[$field['type']][$field['id']] ) ) {
272
+											$this->parent->fields[$field['type']][$field['id']] = 1;
273 273
 										} else {
274
-											$this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 );
274
+											$this->parent->fields[$field['type']] = array( $field['id'] => 1 );
275 275
 										}
276 276
 
277
-										if ( isset( $this->options_defaults[ $field['id'] ] ) ) {
278
-											$this->to_replace[ $field['id'] ] = $field;
277
+										if ( isset( $this->options_defaults[$field['id']] ) ) {
278
+											$this->to_replace[$field['id']] = $field;
279 279
 										}
280 280
 									}
281 281
 
282
-									if ( ! isset( $this->parent->options[ $field['id'] ] ) ) {
283
-										$this->parent->sections[ ( count( $this->parent->sections ) - 1 ) ]['fields'][] = $field;
282
+									if ( ! isset( $this->parent->options[$field['id']] ) ) {
283
+										$this->parent->sections[( count( $this->parent->sections ) - 1 )]['fields'][] = $field;
284 284
 									}
285 285
 
286
-									if ( ! isset( $this->meta[ $field['id'] ] ) ) {
287
-										$this->meta[ $field['id'] ] = $this->options_defaults[ $field['id'] ];
286
+									if ( ! isset( $this->meta[$field['id']] ) ) {
287
+										$this->meta[$field['id']] = $this->options_defaults[$field['id']];
288 288
 									}
289 289
 
290 290
 									// Only override if it exists, and it's not the default.
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 		 * @return mixed
327 327
 		 */
328 328
 		public function replace_field( array $field ) {
329
-			if ( isset( $this->to_replace[ $field['id'] ] ) ) {
330
-				$field = $this->to_replace[ $field['id'] ];
329
+			if ( isset( $this->to_replace[$field['id']] ) ) {
330
+				$field = $this->to_replace[$field['id']];
331 331
 			}
332 332
 
333 333
 			return $field;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 		 * @return array
342 342
 		 */
343 343
 		public function output_css( array $field ): array {
344
-			if ( isset( $this->output[ $field['id'] ] ) ) {
345
-				$field['output'] = $this->output[ $field['id'] ];
344
+			if ( isset( $this->output[$field['id']] ) ) {
345
+				$field['output'] = $this->output[$field['id']];
346 346
 			}
347 347
 
348 348
 			return $field;
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 			$data = wp_parse_args( $this->meta, $this->options_defaults );
369 369
 
370 370
 			foreach ( $data as $key => $value ) {
371
-				if ( isset( $meta[ $key ] ) && '' !== $meta[ $key ] ) {
372
-					$data[ $key ] = $meta[ $key ];
371
+				if ( isset( $meta[$key] ) && '' !== $meta[$key] ) {
372
+					$data[$key] = $meta[$key];
373 373
 					continue;
374 374
 				}
375 375
 
376
-				if ( isset( $options[ $key ] ) ) {
377
-					$data[ $key ] = $options[ $key ];
376
+				if ( isset( $options[$key] ) ) {
377
+					$data[$key] = $options[$key];
378 378
 				}
379 379
 			}
380 380
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 					$relation = $query;
399 399
 
400 400
 				} elseif ( ! is_array( $query ) ) {
401
-					$clean_queries[ $key ]['values'] = array( $query );
401
+					$clean_queries[$key]['values'] = array( $query );
402 402
 
403 403
 					// First-order clause.
404 404
 				} elseif ( $this->is_first_order_clause( $query ) ) {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 						unset( $query['value'] );
408 408
 					}
409 409
 
410
-					$clean_queries[ $key ] = $query;
410
+					$clean_queries[$key] = $query;
411 411
 
412 412
 					// Otherwise, it's a nested query, so we recurse.
413 413
 				} else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					$cleaned_query = $this->sanitize_query( $query );
416 416
 
417 417
 					if ( ! empty( $cleaned_query ) ) {
418
-						$clean_queries[ $key ] = $cleaned_query;
418
+						$clean_queries[$key] = $cleaned_query;
419 419
 					}
420 420
 				}
421 421
 			}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 							} else {
535 535
 								$section['id'] = sanitize_title( $section['title'], $sk );
536 536
 							}
537
-							$this->profiles[ $key ]['sections'][ $sk ] = $section;
537
+							$this->profiles[$key]['sections'][$sk] = $section;
538 538
 						}
539 539
 						if ( isset( $section['fields'] ) ) {
540 540
 							foreach ( $section['fields'] as $k => $field ) {
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 								}
544 544
 
545 545
 								if ( 'ace_editor' === $field['type'] && isset( $field['options'] ) ) {
546
-									$this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['args'] = $field['options'];
547
-									unset( $this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['options'] );
546
+									$this->profiles[$key]['sections'][$sk]['fields'][$k]['args'] = $field['options'];
547
+									unset( $this->profiles[$key]['sections'][$sk]['fields'][$k]['options'] );
548 548
 								}
549 549
 
550 550
 								if ( 'section' === $field['type'] && isset( $field['indent'] ) && true === $field['indent'] ) {
551 551
 									$field['class']  = $field['class'] ?? '';
552 552
 									$field['class'] .= 'redux-section-indent-start';
553 553
 
554
-									$this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ] = $field;
554
+									$this->profiles[$key]['sections'][$sk]['fields'][$k] = $field;
555 555
 								}
556 556
 
557 557
 								if ( ! isset( $this->parent->options_defaults_class ) ) {
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
 				$this->parent->options_class->get();
661 661
 			}
662 662
 
663
-			if ( isset( $this->parent->options[ $field_id['id'] ] ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) && $this->parent->options[ $field_id['id'] ] !== $this->parent->options_defaults[ $field_id['id'] ] ) {
664
-				return $this->parent->options[ $field_id['id'] ];
663
+			if ( isset( $this->parent->options[$field_id['id']] ) && isset( $this->parent->options_defaults[$field_id['id']] ) && $this->parent->options[$field_id['id']] !== $this->parent->options_defaults[$field_id['id']] ) {
664
+				return $this->parent->options[$field_id['id']];
665 665
 			} else {
666 666
 				if ( empty( $this->options_defaults ) ) {
667 667
 					$this->default_values(); // fill cache.
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 
670 670
 				$data = '';
671 671
 				if ( ! empty( $this->options_defaults ) ) {
672
-					$data = $this->options_defaults[ $field_id['id'] ] ?? '';
672
+					$data = $this->options_defaults[$field_id['id']] ?? '';
673 673
 				}
674 674
 
675
-				if ( empty( $data ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) ) {
676
-					$data = $this->parent->options_defaults[ $field_id['id'] ] ?? '';
675
+				if ( empty( $data ) && isset( $this->parent->options_defaults[$field_id['id']] ) ) {
676
+					$data = $this->parent->options_defaults[$field_id['id']] ?? '';
677 677
 				}
678 678
 
679 679
 				return $data;
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 		 * @return array
689 689
 		 */
690 690
 		private function get_meta( string $id ): array {
691
-			if ( ! isset( $this->meta[ $id ] ) ) {
692
-				$this->meta[ $id ] = array();
691
+			if ( ! isset( $this->meta[$id] ) ) {
692
+				$this->meta[$id] = array();
693 693
 				$o_data            = get_post_meta( $id );
694 694
 
695 695
 				// phpcs:ignore WordPress.NamingConventions.ValidHookName
@@ -698,30 +698,30 @@  discard block
 block discarded – undo
698 698
 				if ( ! empty( $o_data ) ) {
699 699
 					foreach ( $o_data as $key => $value ) {
700 700
 						if ( count( $value ) === 1 ) {
701
-							$this->meta[ $id ][ $key ] = maybe_unserialize( $value[0] );
701
+							$this->meta[$id][$key] = maybe_unserialize( $value[0] );
702 702
 						} else {
703 703
 							$new_value = array_map( 'maybe_unserialize', $value );
704 704
 
705
-							$this->meta[ $id ][ $key ] = $new_value[0];
705
+							$this->meta[$id][$key] = $new_value[0];
706 706
 						}
707 707
 					}
708 708
 				}
709 709
 
710
-				if ( isset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ) ) {
711
-					$data = maybe_unserialize( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
710
+				if ( isset( $this->meta[$id][$this->parent->args['opt_name']] ) ) {
711
+					$data = maybe_unserialize( $this->meta[$id][$this->parent->args['opt_name']] );
712 712
 
713 713
 					foreach ( $data as $key => $value ) {
714
-						$this->meta[ $id ][ $key ] = $value;
714
+						$this->meta[$id][$key] = $value;
715 715
 						update_post_meta( $id, $key, $value );
716 716
 					}
717 717
 
718
-					unset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
718
+					unset( $this->meta[$id][$this->parent->args['opt_name']] );
719 719
 
720 720
 					delete_post_meta( $id, $this->parent->args['opt_name'] );
721 721
 				}
722 722
 			}
723 723
 
724
-			return $this->meta[ $id ];
724
+			return $this->meta[$id];
725 725
 		}
726 726
 
727 727
 		/**
@@ -737,29 +737,29 @@  discard block
 block discarded – undo
737 737
 
738 738
 			// Override these values if they differ from the admin panel defaults.  ;).
739 739
 			if ( isset( $the_post->users_role ) && in_array( $the_post->users_role, $this->users_roles, true ) ) {
740
-				if ( isset( $this->users_role_values[ $the_post->users_role ] ) ) {
741
-					$meta = $this->profile_fields[ $the_post->users_role ];
740
+				if ( isset( $this->users_role_values[$the_post->users_role] ) ) {
741
+					$meta = $this->profile_fields[$the_post->users_role];
742 742
 				} else {
743 743
 					$defaults = array();
744
-					if ( ! empty( $this->profile_fields[ $the_post->users_role ] ) ) {
745
-						foreach ( $this->profile_fields[ $the_post->users_role ] as $key => $null ) {
746
-							if ( isset( $this->options_defaults[ $key ] ) ) {
747
-								$defaults[ $key ] = $this->options_defaults[ $key ];
744
+					if ( ! empty( $this->profile_fields[$the_post->users_role] ) ) {
745
+						foreach ( $this->profile_fields[$the_post->users_role] as $key => $null ) {
746
+							if ( isset( $this->options_defaults[$key] ) ) {
747
+								$defaults[$key] = $this->options_defaults[$key];
748 748
 							}
749 749
 						}
750 750
 					}
751 751
 
752 752
 					$meta = wp_parse_args( $this->get_meta( $the_post->ID ), $defaults );
753 753
 
754
-					$this->profile_fields[ $the_post->users_role ] = $meta;
754
+					$this->profile_fields[$the_post->users_role] = $meta;
755 755
 				}
756 756
 
757 757
 				if ( ! empty( $meta_key ) ) {
758
-					if ( ! isset( $meta[ $meta_key ] ) ) {
759
-						$meta[ $meta_key ] = $def_val;
758
+					if ( ! isset( $meta[$meta_key] ) ) {
759
+						$meta[$meta_key] = $def_val;
760 760
 					}
761 761
 
762
-					return $meta[ $meta_key ];
762
+					return $meta[$meta_key];
763 763
 				} else {
764 764
 					return $meta;
765 765
 				}
@@ -958,11 +958,11 @@  discard block
 block discarded – undo
958 958
 									$field['class'] .= 'redux-section-indent-start';
959 959
 								}
960 960
 
961
-								if ( ! isset( $this->meta[ $field['id'] ] ) ) {
962
-									$this->meta[ $field['id'] ] = '';
961
+								if ( ! isset( $this->meta[$field['id']] ) ) {
962
+									$this->meta[$field['id']] = '';
963 963
 								}
964 964
 
965
-								$this->parent->render_class->field_input( $field, $this->meta[ $field['id'] ] );
965
+								$this->parent->render_class->field_input( $field, $this->meta[$field['id']] );
966 966
 								echo '</td></tr>';
967 967
 							}
968 968
 							echo '</tbody></table>';
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			}
995 995
 
996 996
 			// Check if our nonce is set.
997
-			if ( ! isset( $_POST['redux_users_meta_nonce'] ) || ! isset( $_POST[ $this->parent->args['opt_name'] ] ) ) {
997
+			if ( ! isset( $_POST['redux_users_meta_nonce'] ) || ! isset( $_POST[$this->parent->args['opt_name']] ) ) {
998 998
 				return false;
999 999
 			}
1000 1000
 
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
 			$to_delete  = array();
1014 1014
 			$dont_save  = true;
1015 1015
 
1016
-			$field_args = Redux_Users::$fields[ $this->parent->args['opt_name'] ];
1016
+			$field_args = Redux_Users::$fields[$this->parent->args['opt_name']];
1017 1017
 
1018
-			foreach ( $_POST[ $this->parent->args['opt_name'] ] as $key => $value ) { // phpcs:ignore WordPress.Security
1018
+			foreach ( $_POST[$this->parent->args['opt_name']] as $key => $value ) { // phpcs:ignore WordPress.Security
1019 1019
 				$key = sanitize_text_field( wp_unslash( $key ) );
1020 1020
 
1021
-				if ( ! empty( $field_args[ $key ]['permissions'] ) ) {
1022
-					foreach ( (array) $field_args[ $key ]['permissions'] as $pv ) {
1021
+				if ( ! empty( $field_args[$key]['permissions'] ) ) {
1022
+					foreach ( ( array ) $field_args[$key]['permissions'] as $pv ) {
1023 1023
 
1024 1024
 						// Do not save anything the user doesn't have permissions for.
1025
-						if ( isset( $field_args[ $key ] ) ) {
1025
+						if ( isset( $field_args[$key] ) ) {
1026 1026
 							if ( user_can( $user_id, $pv ) && user_can( $check_user_id, $pv ) ) {
1027 1027
 								break;
1028 1028
 							}
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 				if ( is_array( $value ) ) {
1035 1035
 					foreach ( $value as $k => $v ) {
1036 1036
 						if ( ! is_array( $v ) ) {
1037
-							$value[ $k ] = sanitize_text_field( wp_unslash( $v ) );
1037
+							$value[$k] = sanitize_text_field( wp_unslash( $v ) );
1038 1038
 						}
1039 1039
 					}
1040 1040
 				}
@@ -1042,19 +1042,19 @@  discard block
 block discarded – undo
1042 1042
 				$save = true;
1043 1043
 
1044 1044
 				// parent_options.
1045
-				if ( ! $dont_save && isset( $this->options_defaults[ $key ] ) && $value === $this->options_defaults[ $key ] ) {
1045
+				if ( ! $dont_save && isset( $this->options_defaults[$key] ) && $value === $this->options_defaults[$key] ) {
1046 1046
 					$save = false;
1047 1047
 				}
1048 1048
 
1049
-				if ( $save && isset( $this->parent_options[ $key ] ) && $this->parent_options[ $key ] !== $value ) {
1049
+				if ( $save && isset( $this->parent_options[$key] ) && $this->parent_options[$key] !== $value ) {
1050 1050
 					$save = false;
1051 1051
 				}
1052 1052
 
1053 1053
 				if ( $save ) {
1054
-					$to_save[ $key ]    = $value;
1055
-					$to_compare[ $key ] = $this->parent->options[ $key ] ?? '';
1054
+					$to_save[$key]    = $value;
1055
+					$to_compare[$key] = $this->parent->options[$key] ?? '';
1056 1056
 				} else {
1057
-					$to_delete[ $key ] = $value;
1057
+					$to_delete[$key] = $value;
1058 1058
 				}
1059 1059
 			}
1060 1060
 
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 			// Validate fields (if needed).
1067 1067
 			foreach ( $to_save as $key => $value ) {
1068
-				if ( isset( $validate[ $key ] ) && $validate[ $key ] !== $value ) {
1069
-					if ( isset( $this->meta[ $key ] ) && $validate[ $key ] === $this->meta[ $key ] ) {
1070
-						unset( $to_save[ $key ] );
1068
+				if ( isset( $validate[$key] ) && $validate[$key] !== $value ) {
1069
+					if ( isset( $this->meta[$key] ) && $validate[$key] === $this->meta[$key] ) {
1070
+						unset( $to_save[$key] );
1071 1071
 					} else {
1072
-						$to_save[ $key ] = $validate[ $key ];
1072
+						$to_save[$key] = $validate[$key];
1073 1073
 					}
1074 1074
 				}
1075 1075
 			}
@@ -1099,21 +1099,21 @@  discard block
 block discarded – undo
1099 1099
 			$to_save = apply_filters( 'redux/users/save', $to_save, $to_compare, $this->sections );
1100 1100
 
1101 1101
 			foreach ( $to_save as $key => $value ) {
1102
-				$prev_value = $this->meta[ $key ] ?? '';
1102
+				$prev_value = $this->meta[$key] ?? '';
1103 1103
 
1104
-				if ( isset( $check[ $key ] ) ) {
1105
-					unset( $check[ $key ] );
1104
+				if ( isset( $check[$key] ) ) {
1105
+					unset( $check[$key] );
1106 1106
 				}
1107 1107
 
1108 1108
 				update_user_meta( $user_id, $key, $value, $prev_value );
1109 1109
 			}
1110 1110
 
1111 1111
 			foreach ( $to_delete as $key => $value ) {
1112
-				if ( isset( $check[ $key ] ) ) {
1113
-					unset( $check[ $key ] );
1112
+				if ( isset( $check[$key] ) ) {
1113
+					unset( $check[$key] );
1114 1114
 				}
1115 1115
 
1116
-				$prev_value = $this->meta[ $key ] ?? '';
1116
+				$prev_value = $this->meta[$key] ?? '';
1117 1117
 				delete_user_meta( $user_id, $key, $prev_value );
1118 1118
 			}
1119 1119
 			if ( ! empty( $check ) ) {
Please login to merge, or discard this patch.
Indentation   +1091 added lines, -1091 removed lines patch added patch discarded remove patch
@@ -13,827 +13,827 @@  discard block
 block discarded – undo
13 13
 // Don't duplicate me!
14 14
 if ( ! class_exists( 'Redux_Extension_Users' ) ) {
15 15
 
16
-	/**
17
-	 * Main Redux_Extension_Users class
18
-	 *
19
-	 * @since       1.0.0
20
-	 */
21
-	class Redux_Extension_Users extends Redux_Extension_Abstract {
22
-
23
-		/**
24
-		 * Extension version.
25
-		 *
26
-		 * @var string
27
-		 */
28
-		public static $version = '4.5.6';
29
-
30
-		/**
31
-		 * Extension friendly name.
32
-		 *
33
-		 * @var string
34
-		 */
35
-		public string $extension_name = 'Users';
36
-
37
-
38
-		/**
39
-		 * Profiles array.
40
-		 *
41
-		 * @var null|array
42
-		 */
43
-		public ?array $profiles = array();
44
-
45
-		/**
46
-		 * User roles array.
47
-		 *
48
-		 * @var null|array
49
-		 */
50
-		public ?array $users_roles = array();
51
-
52
-		/**
53
-		 * User role array.
54
-		 *
55
-		 * @var null|array
56
-		 */
57
-		public ?array $users_role = array();
58
-
59
-		/**
60
-		 * Sections array.
61
-		 *
62
-		 * @var null|array
63
-		 */
64
-		public ?array $sections = array();
65
-
66
-		/**
67
-		 * Original args array.
68
-		 *
69
-		 * @var null|array
70
-		 */
71
-		public ?array $orig_args = array();
72
-
73
-		/**
74
-		 * Output array.
75
-		 *
76
-		 * @var null|array
77
-		 */
78
-		public ?array $output = array();
79
-
80
-		/**
81
-		 * Parent options array.
82
-		 *
83
-		 * @var null|array
84
-		 */
85
-		public ?array $parent_options = array();
86
-
87
-		/**
88
-		 * Parent defaults.
89
-		 *
90
-		 * @var null|array
91
-		 */
92
-		public ?array $parent_defaults = array();
93
-
94
-		/**
95
-		 * Profile fields array.
96
-		 *
97
-		 * @var null|array
98
-		 */
99
-		public ?array $profile_fields = array();
100
-
101
-		/**
102
-		 * Options defaults.
103
-		 *
104
-		 * @var null|array
105
-		 */
106
-		public ?array $options_defaults = array();
107
-
108
-		/**
109
-		 * To replace array.
110
-		 *
111
-		 * @var null|array
112
-		 */
113
-		public ?array $to_replace = array();
114
-
115
-		/**
116
-		 * Meta array.
117
-		 *
118
-		 * @var null|array
119
-		 */
120
-		public ?array $meta = array();
121
-
122
-		/**
123
-		 * Array of page names.
124
-		 *
125
-		 * @var null|array
126
-		 */
127
-		public ?array $pagenows;
128
-
129
-		/**
130
-		 * Notices array.
131
-		 *
132
-		 * @var null|array
133
-		 */
134
-		public ?array $notices;
135
-
136
-		/**
137
-		 * Redux_Extension_Users constructor.
138
-		 *
139
-		 * @param object $redux ReduxFramework pointer.
140
-		 */
141
-		public function __construct( $redux ) {
142
-			global $pagenow;
143
-
144
-			parent::__construct( $redux, __FILE__ );
145
-
146
-			$this->parent = $redux;
147
-
148
-			$this->add_field( 'users' );
149
-			$this->parent->extensions['users'] = $this;
150
-
151
-			$this->pagenows = array( 'user-new.php', 'profile.php', 'user-edit.php' );
152
-
153
-			require_once __DIR__ . '/redux-users-helpers.php';
154
-
155
-			add_action( 'admin_notices', array( $this, 'meta_profiles_show_errors' ), 0 );
156
-			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 20 );
157
-
158
-			if ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) {
159
-				$this->init();
160
-
161
-				add_action( 'personal_options_update', array( $this, 'user_meta_save' ) );
162
-				add_action( 'edit_user_profile_update', array( $this, 'user_meta_save' ) );
163
-
164
-			}
165
-		}
166
-
167
-		/**
168
-		 * Add term classes.
169
-		 *
170
-		 * @param array $classes Classes.
171
-		 *
172
-		 * @return array
173
-		 */
174
-		public function add_user_classes( array $classes ): array {
175
-			$classes[] = 'redux-users';
176
-			$classes[] = 'redux-' . $this->parent->args['opt_name'];
177
-
178
-			if ( '' !== $this->parent->args['class'] ) {
179
-				$classes[] = $this->parent->args['class'];
180
-			}
181
-
182
-			return $classes;
183
-		}
184
-
185
-		/**
186
-		 * Add hide term class.
187
-		 *
188
-		 * @param array $classes Classes.
189
-		 *
190
-		 * @return array
191
-		 */
192
-		public function add_user_hide_class( array $classes ): array {
193
-			$classes[] = 'hide';
194
-
195
-			return $classes;
196
-		}
197
-
198
-		/**
199
-		 * Init.
200
-		 */
201
-		public function init() {
202
-			global $pagenow;
203
-
204
-			if ( isset( $_POST['action'] ) && 'redux_demo_customizer_save' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
205
-				return;
206
-			}
207
-
208
-			$this->parent->transients['run_compiler'] = false;
209
-
210
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
211
-			$this->profiles = apply_filters( 'redux/users/' . $this->parent->args['opt_name'] . '/profiles', $this->profiles, $this->parent->args['opt_name'] );
212
-
213
-			if ( empty( $this->profiles ) && class_exists( 'Redux_Users' ) ) {
214
-				$this->profiles = Redux_Users::construct_profiles( $this->parent->args['opt_name'] );
215
-			}
216
-
217
-			if ( empty( $this->profiles ) || ! is_array( $this->profiles ) ) {
218
-				return;
219
-			}
220
-
221
-			foreach ( $this->profiles as $bk => $profile ) {
222
-				$profile['roles'] = isset( $profile['roles'] ) ? (array) $profile['roles'] : array( 'read' );
223
-
224
-				if ( ! empty( $profile['sections'] ) ) {
225
-					$this->sections = $profile['sections'];
226
-
227
-					$this->users_roles = wp_parse_args( $this->users_roles, $profile['roles'] );
228
-
229
-					// Checking to override the parent variables.
230
-					$add_field = false;
231
-
232
-					foreach ( $profile['roles'] as $role ) {
233
-						if ( $this->users_role === $role ) {
234
-							$add_field = true;
235
-						}
236
-					}
237
-
238
-					// Replacing all the fields.
239
-					if ( $add_field || ( ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) || ( ! is_admin() ) ) ) {
240
-						foreach ( $profile['sections'] as $sk => $section ) {
241
-							if ( ! empty( $section['fields'] ) ) {
242
-								foreach ( $section['fields'] as $fk => $field ) {
243
-									if ( ! isset( $field['class'] ) ) {
244
-										$field['class'] = '';
245
-
246
-										$this->profiles[ $bk ]['sections'][ $sk ]['fields'][ $fk ] = $field;
247
-									}
248
-
249
-									$this->parent->required_class->check_dependencies( $field );
250
-
251
-									if ( $add_field || ( ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) || ( ! is_admin() ) ) ) {
252
-										if ( empty( $field['id'] ) ) {
253
-											continue;
254
-										}
255
-
256
-										if ( isset( $field['default'] ) ) {
257
-											$this->options_defaults[ $field['id'] ] = $field['default'];
258
-										} else {
259
-											$this->options_defaults[ $field['id'] ] = $this->field_default( $field );
260
-										}
261
-
262
-										foreach ( $profile['roles'] as $type ) {
263
-											$this->profile_fields[ $type ][ $field['id'] ] = 1;
264
-										}
265
-
266
-										if ( ! empty( $field['output'] ) ) {
267
-											$this->output[ $field['id'] ] = isset( $this->output[ $field['id'] ] ) ? array_merge( $field['output'], $this->output[ $field['id'] ] ) : $field['output'];
268
-										}
269
-
270
-										// Detect what field types are being used.
271
-										if ( ! isset( $this->parent->fields[ $field['type'] ][ $field['id'] ] ) ) {
272
-											$this->parent->fields[ $field['type'] ][ $field['id'] ] = 1;
273
-										} else {
274
-											$this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 );
275
-										}
276
-
277
-										if ( isset( $this->options_defaults[ $field['id'] ] ) ) {
278
-											$this->to_replace[ $field['id'] ] = $field;
279
-										}
280
-									}
281
-
282
-									if ( ! isset( $this->parent->options[ $field['id'] ] ) ) {
283
-										$this->parent->sections[ ( count( $this->parent->sections ) - 1 ) ]['fields'][] = $field;
284
-									}
285
-
286
-									if ( ! isset( $this->meta[ $field['id'] ] ) ) {
287
-										$this->meta[ $field['id'] ] = $this->options_defaults[ $field['id'] ];
288
-									}
289
-
290
-									// Only override if it exists, and it's not the default.
291
-									/** If ( isset( $this->meta[ $field['id'] ] ) && isset( $field['default'] ) && $this->meta[ $field['id'] ] === $field['default'] ) {
292
-									 *    // unset($this->meta[$this->tag_id][$field['id']]);
293
-									 *  }
294
-									 */
295
-								}
296
-							}
297
-						}
298
-					}
299
-				}
300
-			}
301
-
302
-			$this->parent_options = array();
303
-
304
-			if ( ! empty( $this->to_replace ) ) {
305
-				foreach ( $this->to_replace as $id => $field ) {
306
-					add_filter( "redux/options/{$this->parent->args['opt_name']}/field/$id/register", array( $this, 'replace_field' ) );
307
-				}
308
-			}
309
-
310
-			add_filter( "redux/options/{$this->parent->args['opt_name']}/options", array( $this, 'override_options' ) );
311
-
312
-			if ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) {
313
-				$priority = $this->parent->args['user_priority'] ?? 3;
314
-
315
-				add_action( 'show_user_profile', array( $this, 'add_profiles' ), $priority );
316
-				add_action( 'edit_user_profile', array( $this, 'add_profiles' ), $priority );
317
-				add_action( 'user_new_form', array( $this, 'add_profiles' ), $priority );
318
-			}
319
-		}
320
-
321
-		/**
322
-		 * Replace field.
323
-		 *
324
-		 * @param array $field Field array.
325
-		 *
326
-		 * @return mixed
327
-		 */
328
-		public function replace_field( array $field ) {
329
-			if ( isset( $this->to_replace[ $field['id'] ] ) ) {
330
-				$field = $this->to_replace[ $field['id'] ];
331
-			}
332
-
333
-			return $field;
334
-		}
335
-
336
-		/**
337
-		 * Output CSS.
338
-		 *
339
-		 * @param array $field Field array.
340
-		 *
341
-		 * @return array
342
-		 */
343
-		public function output_css( array $field ): array {
344
-			if ( isset( $this->output[ $field['id'] ] ) ) {
345
-				$field['output'] = $this->output[ $field['id'] ];
346
-			}
347
-
348
-			return $field;
349
-		}
350
-
351
-		/**
352
-		 * Make sure the defaults are the defaults
353
-		 *
354
-		 * @param array $options Option array.
355
-		 *
356
-		 * @return array
357
-		 */
358
-		public function override_options( array $options ): array {
359
-			$this->parent->options_class->default_values();
360
-			$this->parent_defaults = $this->parent->options_defaults;
361
-
362
-			if ( empty( $this->meta ) ) {
363
-				// phpcs:ignore WordPress.Security.NonceVerification
364
-				$user       = isset( $_GET['user_id'] ) ? sanitize_text_field( wp_unslash( $_GET['user_id'] ) ) : get_current_user_id();
365
-				$this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
366
-			}
367
-
368
-			$data = wp_parse_args( $this->meta, $this->options_defaults );
369
-
370
-			foreach ( $data as $key => $value ) {
371
-				if ( isset( $meta[ $key ] ) && '' !== $meta[ $key ] ) {
372
-					$data[ $key ] = $meta[ $key ];
373
-					continue;
374
-				}
375
-
376
-				if ( isset( $options[ $key ] ) ) {
377
-					$data[ $key ] = $options[ $key ];
378
-				}
379
-			}
380
-
381
-			$this->parent->options_defaults = wp_parse_args( $this->options_defaults, $this->parent->options_defaults );
382
-
383
-			return wp_parse_args( $data, $options );
384
-		}
385
-
386
-		/**
387
-		 * Sanitize Query.
388
-		 *
389
-		 * @param array $queries Queries.
390
-		 *
391
-		 * @return array
392
-		 */
393
-		public function sanitize_query( array $queries ): array {
394
-			$clean_queries = array();
395
-
396
-			foreach ( $queries as $key => $query ) {
397
-				if ( 'relation' === $key ) {
398
-					$relation = $query;
399
-
400
-				} elseif ( ! is_array( $query ) ) {
401
-					$clean_queries[ $key ]['values'] = array( $query );
402
-
403
-					// First-order clause.
404
-				} elseif ( $this->is_first_order_clause( $query ) ) {
405
-					print( 'h3' );
406
-					if ( isset( $query['value'] ) && array() === $query['value'] ) {
407
-						unset( $query['value'] );
408
-					}
409
-
410
-					$clean_queries[ $key ] = $query;
411
-
412
-					// Otherwise, it's a nested query, so we recurse.
413
-				} else {
414
-					print( 'h4' );
415
-					$cleaned_query = $this->sanitize_query( $query );
416
-
417
-					if ( ! empty( $cleaned_query ) ) {
418
-						$clean_queries[ $key ] = $cleaned_query;
419
-					}
420
-				}
421
-			}
422
-
423
-			if ( empty( $clean_queries ) ) {
424
-				return $clean_queries;
425
-			}
426
-
427
-			// Sanitize the 'relation' key provided in the query.
428
-			if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) {
429
-				$clean_queries['relation'] = 'OR';
430
-
431
-				/*
16
+    /**
17
+     * Main Redux_Extension_Users class
18
+     *
19
+     * @since       1.0.0
20
+     */
21
+    class Redux_Extension_Users extends Redux_Extension_Abstract {
22
+
23
+        /**
24
+         * Extension version.
25
+         *
26
+         * @var string
27
+         */
28
+        public static $version = '4.5.6';
29
+
30
+        /**
31
+         * Extension friendly name.
32
+         *
33
+         * @var string
34
+         */
35
+        public string $extension_name = 'Users';
36
+
37
+
38
+        /**
39
+         * Profiles array.
40
+         *
41
+         * @var null|array
42
+         */
43
+        public ?array $profiles = array();
44
+
45
+        /**
46
+         * User roles array.
47
+         *
48
+         * @var null|array
49
+         */
50
+        public ?array $users_roles = array();
51
+
52
+        /**
53
+         * User role array.
54
+         *
55
+         * @var null|array
56
+         */
57
+        public ?array $users_role = array();
58
+
59
+        /**
60
+         * Sections array.
61
+         *
62
+         * @var null|array
63
+         */
64
+        public ?array $sections = array();
65
+
66
+        /**
67
+         * Original args array.
68
+         *
69
+         * @var null|array
70
+         */
71
+        public ?array $orig_args = array();
72
+
73
+        /**
74
+         * Output array.
75
+         *
76
+         * @var null|array
77
+         */
78
+        public ?array $output = array();
79
+
80
+        /**
81
+         * Parent options array.
82
+         *
83
+         * @var null|array
84
+         */
85
+        public ?array $parent_options = array();
86
+
87
+        /**
88
+         * Parent defaults.
89
+         *
90
+         * @var null|array
91
+         */
92
+        public ?array $parent_defaults = array();
93
+
94
+        /**
95
+         * Profile fields array.
96
+         *
97
+         * @var null|array
98
+         */
99
+        public ?array $profile_fields = array();
100
+
101
+        /**
102
+         * Options defaults.
103
+         *
104
+         * @var null|array
105
+         */
106
+        public ?array $options_defaults = array();
107
+
108
+        /**
109
+         * To replace array.
110
+         *
111
+         * @var null|array
112
+         */
113
+        public ?array $to_replace = array();
114
+
115
+        /**
116
+         * Meta array.
117
+         *
118
+         * @var null|array
119
+         */
120
+        public ?array $meta = array();
121
+
122
+        /**
123
+         * Array of page names.
124
+         *
125
+         * @var null|array
126
+         */
127
+        public ?array $pagenows;
128
+
129
+        /**
130
+         * Notices array.
131
+         *
132
+         * @var null|array
133
+         */
134
+        public ?array $notices;
135
+
136
+        /**
137
+         * Redux_Extension_Users constructor.
138
+         *
139
+         * @param object $redux ReduxFramework pointer.
140
+         */
141
+        public function __construct( $redux ) {
142
+            global $pagenow;
143
+
144
+            parent::__construct( $redux, __FILE__ );
145
+
146
+            $this->parent = $redux;
147
+
148
+            $this->add_field( 'users' );
149
+            $this->parent->extensions['users'] = $this;
150
+
151
+            $this->pagenows = array( 'user-new.php', 'profile.php', 'user-edit.php' );
152
+
153
+            require_once __DIR__ . '/redux-users-helpers.php';
154
+
155
+            add_action( 'admin_notices', array( $this, 'meta_profiles_show_errors' ), 0 );
156
+            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 20 );
157
+
158
+            if ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) {
159
+                $this->init();
160
+
161
+                add_action( 'personal_options_update', array( $this, 'user_meta_save' ) );
162
+                add_action( 'edit_user_profile_update', array( $this, 'user_meta_save' ) );
163
+
164
+            }
165
+        }
166
+
167
+        /**
168
+         * Add term classes.
169
+         *
170
+         * @param array $classes Classes.
171
+         *
172
+         * @return array
173
+         */
174
+        public function add_user_classes( array $classes ): array {
175
+            $classes[] = 'redux-users';
176
+            $classes[] = 'redux-' . $this->parent->args['opt_name'];
177
+
178
+            if ( '' !== $this->parent->args['class'] ) {
179
+                $classes[] = $this->parent->args['class'];
180
+            }
181
+
182
+            return $classes;
183
+        }
184
+
185
+        /**
186
+         * Add hide term class.
187
+         *
188
+         * @param array $classes Classes.
189
+         *
190
+         * @return array
191
+         */
192
+        public function add_user_hide_class( array $classes ): array {
193
+            $classes[] = 'hide';
194
+
195
+            return $classes;
196
+        }
197
+
198
+        /**
199
+         * Init.
200
+         */
201
+        public function init() {
202
+            global $pagenow;
203
+
204
+            if ( isset( $_POST['action'] ) && 'redux_demo_customizer_save' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
205
+                return;
206
+            }
207
+
208
+            $this->parent->transients['run_compiler'] = false;
209
+
210
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
211
+            $this->profiles = apply_filters( 'redux/users/' . $this->parent->args['opt_name'] . '/profiles', $this->profiles, $this->parent->args['opt_name'] );
212
+
213
+            if ( empty( $this->profiles ) && class_exists( 'Redux_Users' ) ) {
214
+                $this->profiles = Redux_Users::construct_profiles( $this->parent->args['opt_name'] );
215
+            }
216
+
217
+            if ( empty( $this->profiles ) || ! is_array( $this->profiles ) ) {
218
+                return;
219
+            }
220
+
221
+            foreach ( $this->profiles as $bk => $profile ) {
222
+                $profile['roles'] = isset( $profile['roles'] ) ? (array) $profile['roles'] : array( 'read' );
223
+
224
+                if ( ! empty( $profile['sections'] ) ) {
225
+                    $this->sections = $profile['sections'];
226
+
227
+                    $this->users_roles = wp_parse_args( $this->users_roles, $profile['roles'] );
228
+
229
+                    // Checking to override the parent variables.
230
+                    $add_field = false;
231
+
232
+                    foreach ( $profile['roles'] as $role ) {
233
+                        if ( $this->users_role === $role ) {
234
+                            $add_field = true;
235
+                        }
236
+                    }
237
+
238
+                    // Replacing all the fields.
239
+                    if ( $add_field || ( ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) || ( ! is_admin() ) ) ) {
240
+                        foreach ( $profile['sections'] as $sk => $section ) {
241
+                            if ( ! empty( $section['fields'] ) ) {
242
+                                foreach ( $section['fields'] as $fk => $field ) {
243
+                                    if ( ! isset( $field['class'] ) ) {
244
+                                        $field['class'] = '';
245
+
246
+                                        $this->profiles[ $bk ]['sections'][ $sk ]['fields'][ $fk ] = $field;
247
+                                    }
248
+
249
+                                    $this->parent->required_class->check_dependencies( $field );
250
+
251
+                                    if ( $add_field || ( ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) || ( ! is_admin() ) ) ) {
252
+                                        if ( empty( $field['id'] ) ) {
253
+                                            continue;
254
+                                        }
255
+
256
+                                        if ( isset( $field['default'] ) ) {
257
+                                            $this->options_defaults[ $field['id'] ] = $field['default'];
258
+                                        } else {
259
+                                            $this->options_defaults[ $field['id'] ] = $this->field_default( $field );
260
+                                        }
261
+
262
+                                        foreach ( $profile['roles'] as $type ) {
263
+                                            $this->profile_fields[ $type ][ $field['id'] ] = 1;
264
+                                        }
265
+
266
+                                        if ( ! empty( $field['output'] ) ) {
267
+                                            $this->output[ $field['id'] ] = isset( $this->output[ $field['id'] ] ) ? array_merge( $field['output'], $this->output[ $field['id'] ] ) : $field['output'];
268
+                                        }
269
+
270
+                                        // Detect what field types are being used.
271
+                                        if ( ! isset( $this->parent->fields[ $field['type'] ][ $field['id'] ] ) ) {
272
+                                            $this->parent->fields[ $field['type'] ][ $field['id'] ] = 1;
273
+                                        } else {
274
+                                            $this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 );
275
+                                        }
276
+
277
+                                        if ( isset( $this->options_defaults[ $field['id'] ] ) ) {
278
+                                            $this->to_replace[ $field['id'] ] = $field;
279
+                                        }
280
+                                    }
281
+
282
+                                    if ( ! isset( $this->parent->options[ $field['id'] ] ) ) {
283
+                                        $this->parent->sections[ ( count( $this->parent->sections ) - 1 ) ]['fields'][] = $field;
284
+                                    }
285
+
286
+                                    if ( ! isset( $this->meta[ $field['id'] ] ) ) {
287
+                                        $this->meta[ $field['id'] ] = $this->options_defaults[ $field['id'] ];
288
+                                    }
289
+
290
+                                    // Only override if it exists, and it's not the default.
291
+                                    /** If ( isset( $this->meta[ $field['id'] ] ) && isset( $field['default'] ) && $this->meta[ $field['id'] ] === $field['default'] ) {
292
+                                     *    // unset($this->meta[$this->tag_id][$field['id']]);
293
+                                     *  }
294
+                                     */
295
+                                }
296
+                            }
297
+                        }
298
+                    }
299
+                }
300
+            }
301
+
302
+            $this->parent_options = array();
303
+
304
+            if ( ! empty( $this->to_replace ) ) {
305
+                foreach ( $this->to_replace as $id => $field ) {
306
+                    add_filter( "redux/options/{$this->parent->args['opt_name']}/field/$id/register", array( $this, 'replace_field' ) );
307
+                }
308
+            }
309
+
310
+            add_filter( "redux/options/{$this->parent->args['opt_name']}/options", array( $this, 'override_options' ) );
311
+
312
+            if ( is_admin() && in_array( $pagenow, $this->pagenows, true ) ) {
313
+                $priority = $this->parent->args['user_priority'] ?? 3;
314
+
315
+                add_action( 'show_user_profile', array( $this, 'add_profiles' ), $priority );
316
+                add_action( 'edit_user_profile', array( $this, 'add_profiles' ), $priority );
317
+                add_action( 'user_new_form', array( $this, 'add_profiles' ), $priority );
318
+            }
319
+        }
320
+
321
+        /**
322
+         * Replace field.
323
+         *
324
+         * @param array $field Field array.
325
+         *
326
+         * @return mixed
327
+         */
328
+        public function replace_field( array $field ) {
329
+            if ( isset( $this->to_replace[ $field['id'] ] ) ) {
330
+                $field = $this->to_replace[ $field['id'] ];
331
+            }
332
+
333
+            return $field;
334
+        }
335
+
336
+        /**
337
+         * Output CSS.
338
+         *
339
+         * @param array $field Field array.
340
+         *
341
+         * @return array
342
+         */
343
+        public function output_css( array $field ): array {
344
+            if ( isset( $this->output[ $field['id'] ] ) ) {
345
+                $field['output'] = $this->output[ $field['id'] ];
346
+            }
347
+
348
+            return $field;
349
+        }
350
+
351
+        /**
352
+         * Make sure the defaults are the defaults
353
+         *
354
+         * @param array $options Option array.
355
+         *
356
+         * @return array
357
+         */
358
+        public function override_options( array $options ): array {
359
+            $this->parent->options_class->default_values();
360
+            $this->parent_defaults = $this->parent->options_defaults;
361
+
362
+            if ( empty( $this->meta ) ) {
363
+                // phpcs:ignore WordPress.Security.NonceVerification
364
+                $user       = isset( $_GET['user_id'] ) ? sanitize_text_field( wp_unslash( $_GET['user_id'] ) ) : get_current_user_id();
365
+                $this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
366
+            }
367
+
368
+            $data = wp_parse_args( $this->meta, $this->options_defaults );
369
+
370
+            foreach ( $data as $key => $value ) {
371
+                if ( isset( $meta[ $key ] ) && '' !== $meta[ $key ] ) {
372
+                    $data[ $key ] = $meta[ $key ];
373
+                    continue;
374
+                }
375
+
376
+                if ( isset( $options[ $key ] ) ) {
377
+                    $data[ $key ] = $options[ $key ];
378
+                }
379
+            }
380
+
381
+            $this->parent->options_defaults = wp_parse_args( $this->options_defaults, $this->parent->options_defaults );
382
+
383
+            return wp_parse_args( $data, $options );
384
+        }
385
+
386
+        /**
387
+         * Sanitize Query.
388
+         *
389
+         * @param array $queries Queries.
390
+         *
391
+         * @return array
392
+         */
393
+        public function sanitize_query( array $queries ): array {
394
+            $clean_queries = array();
395
+
396
+            foreach ( $queries as $key => $query ) {
397
+                if ( 'relation' === $key ) {
398
+                    $relation = $query;
399
+
400
+                } elseif ( ! is_array( $query ) ) {
401
+                    $clean_queries[ $key ]['values'] = array( $query );
402
+
403
+                    // First-order clause.
404
+                } elseif ( $this->is_first_order_clause( $query ) ) {
405
+                    print( 'h3' );
406
+                    if ( isset( $query['value'] ) && array() === $query['value'] ) {
407
+                        unset( $query['value'] );
408
+                    }
409
+
410
+                    $clean_queries[ $key ] = $query;
411
+
412
+                    // Otherwise, it's a nested query, so we recurse.
413
+                } else {
414
+                    print( 'h4' );
415
+                    $cleaned_query = $this->sanitize_query( $query );
416
+
417
+                    if ( ! empty( $cleaned_query ) ) {
418
+                        $clean_queries[ $key ] = $cleaned_query;
419
+                    }
420
+                }
421
+            }
422
+
423
+            if ( empty( $clean_queries ) ) {
424
+                return $clean_queries;
425
+            }
426
+
427
+            // Sanitize the 'relation' key provided in the query.
428
+            if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) {
429
+                $clean_queries['relation'] = 'OR';
430
+
431
+                /*
432 432
 				 * If there is only a single clause, call the relation 'OR'.
433 433
 				 * This value will not be used to join clauses, but it
434 434
 				 * simplifies the logic around combining key-only queries.
435 435
 				 */
436
-			} elseif ( 1 === count( $clean_queries ) ) {
437
-				$clean_queries['relation'] = 'OR';
438
-
439
-				// Default to AND.
440
-			} else {
441
-				$clean_queries['relation'] = 'AND';
442
-			}
443
-
444
-			return $clean_queries;
445
-		}
446
-
447
-		/**
448
-		 * Is the first order clause.
449
-		 *
450
-		 * @param array $query Query array.
451
-		 *
452
-		 * @return bool
453
-		 */
454
-		protected function is_first_order_clause( array $query ): bool {
455
-			return isset( $query['key'] ) || isset( $query['value'] );
456
-		}
457
-
458
-		/**
459
-		 * Support file and field enqueue.
460
-		 */
461
-		public function enqueue() {
462
-			global $pagenow;
463
-
464
-			if ( in_array( $pagenow, $this->pagenows, true ) ) {
465
-
466
-				if ( 'user-new.php' === $pagenow ) {
467
-					$this->parent->args['disable_save_warn'] = true;
468
-				}
469
-
470
-				$this->parent->transients       = get_transient( $this->parent->args['opt_name'] . '-transients-users' );
471
-				$this->parent->transients_check = $this->parent->transients;
472
-
473
-				if ( isset( $this->parent->transients['notices'] ) ) {
474
-					$this->notices                              = $this->parent->transients['notices'];
475
-					$this->parent->transients['last_save_mode'] = 'users';
476
-				}
477
-
478
-				delete_transient( $this->parent->args['opt_name'] . '-transients-users' );
479
-
480
-				$this->parent->enqueue_class->init();
481
-
482
-				// phpcs:ignore WordPress.NamingConventions.ValidHookName
483
-				do_action( "redux/users/{$this->parent->args['opt_name']}/enqueue" );
484
-
485
-				/**
486
-				 * Redux users CSS
487
-				 * filter 'redux/page/{opt_name}/enqueue/redux-extension-users-css'
488
-				 */
489
-				if ( true === $this->parent->args['dev_mode'] ) {
490
-					wp_enqueue_style(
491
-						'redux-extension-users',
492
-						// phpcs:ignore WordPress.NamingConventions.ValidHookName
493
-						apply_filters( "redux/users/{$this->parent->args['opt_name']}/enqueue/redux-extension-users-css", $this->extension_url . 'redux-extension-users.css' ),
494
-						array(),
495
-						self::$version
496
-					);
497
-				}
498
-
499
-				/**
500
-				 * Redux users JS
501
-				 * filter 'redux/page/{opt_name}/enqueue/redux-extension-users-js
502
-				 */
503
-				wp_enqueue_script(
504
-					'redux-extension-users',
505
-					// phpcs:ignore WordPress.NamingConventions.ValidHookName
506
-					apply_filters( "redux/users/{$this->parent->args['opt_name']}/enqueue/redux-extension-users-js", $this->extension_url . 'redux-extension-users' . Redux_Functions::is_min() . '.js' ),
507
-					array( 'jquery', 'redux-js' ),
508
-					self::$version,
509
-					true
510
-				);
511
-
512
-				// Values used by the JavaScript.
513
-				wp_localize_script( 'redux-extension-users', 'reduxUsers', $this->users_roles );
514
-
515
-			}
516
-		}
517
-
518
-
519
-		/**
520
-		 * DEPRECATED
521
-		 */
522
-		public function default_values() {
523
-			if ( ! empty( $this->profiles ) && empty( $this->options_defaults ) ) {
524
-				foreach ( $this->profiles as $key => $profile ) {
525
-					if ( empty( $profile['sections'] ) ) {
526
-						continue;
527
-					}
528
-
529
-					// fill the cache.
530
-					foreach ( $profile['sections'] as $sk => $section ) {
531
-						if ( ! isset( $section['id'] ) ) {
532
-							if ( ! is_numeric( $sk ) || ! isset( $section['title'] ) ) {
533
-								$section['id'] = $sk;
534
-							} else {
535
-								$section['id'] = sanitize_title( $section['title'], $sk );
536
-							}
537
-							$this->profiles[ $key ]['sections'][ $sk ] = $section;
538
-						}
539
-						if ( isset( $section['fields'] ) ) {
540
-							foreach ( $section['fields'] as $k => $field ) {
541
-								if ( empty( $field['id'] ) && empty( $field['type'] ) ) {
542
-									continue;
543
-								}
544
-
545
-								if ( 'ace_editor' === $field['type'] && isset( $field['options'] ) ) {
546
-									$this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['args'] = $field['options'];
547
-									unset( $this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['options'] );
548
-								}
549
-
550
-								if ( 'section' === $field['type'] && isset( $field['indent'] ) && true === $field['indent'] ) {
551
-									$field['class']  = $field['class'] ?? '';
552
-									$field['class'] .= 'redux-section-indent-start';
553
-
554
-									$this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ] = $field;
555
-								}
556
-
557
-								if ( ! isset( $this->parent->options_defaults_class ) ) {
558
-									$this->parent->options_defaults_class = new Redux_Options_Defaults();
559
-								}
560
-
561
-								$this->parent->options_defaults_class->field_default_values( $this->parent->args['opt_name'], $field );
562
-
563
-								if ( 'repeater' === $field['type'] ) {
564
-									foreach ( $field['fields'] as $f ) {
565
-										$this->parent->options_defaults_class->field_default_values( $this->parent->args['opt_name'], $f, null, true );
566
-									}
567
-								}
568
-
569
-								$this->parent->options_defaults = $this->parent->options_defaults_class->options_defaults;
570
-							}
571
-						}
572
-					}
573
-				}
574
-			}
575
-
576
-			if ( empty( $this->meta ) ) {
577
-				// phpcs:ignore WordPress.Security.NonceVerification
578
-				$user       = isset( $_GET['user_id'] ) ? sanitize_text_field( wp_unslash( $_GET['user_id'] ) ) : get_current_user_id();
579
-				$this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
580
-			}
581
-		}
582
-
583
-		/**
584
-		 * Add Profiles.
585
-		 */
586
-		public function add_profiles() {
587
-			if ( empty( $this->profiles ) || ! is_array( $this->profiles ) ) {
588
-				return;
589
-			}
590
-
591
-			foreach ( $this->profiles as $key => $profile ) {
592
-				if ( empty( $profile['sections'] ) ) {
593
-					continue;
594
-				}
595
-
596
-				$defaults = array(
597
-					'id'         => "$key",
598
-					'section_id' => $key,
599
-					'profiles'   => array(),
600
-				);
601
-
602
-				$profile = wp_parse_args( $profile, $defaults );
603
-
604
-				// Override the parent args on a meta-term level.
605
-				if ( empty( $this->orig_args ) ) {
606
-					$this->orig_args = $this->parent->args;
607
-				}
608
-
609
-				if ( isset( $profile['args'] ) ) {
610
-					$this->parent->args = wp_parse_args( $profile['args'], $this->orig_args );
611
-				} elseif ( $this->parent->args !== $this->orig_args ) {
612
-					$this->parent->args = $this->orig_args;
613
-				}
614
-
615
-				if ( ! isset( $profile['class'] ) ) {
616
-					$profile['class'] = array();
617
-				}
618
-
619
-				if ( ! empty( $profile['class'] ) ) {
620
-					if ( ! is_array( $profile['class'] ) ) {
621
-						$profile['class'] = array( $profile['class'] );
622
-					}
623
-				}
624
-
625
-				$profile['class'] = $this->add_user_classes( $profile['class'] );
626
-
627
-				if ( isset( $profile['post_format'] ) ) {
628
-					$profile['class'] = $this->add_user_hide_class( $profile['class'] );
629
-				}
630
-
631
-				global $pagenow;
632
-				if ( strpos( $pagenow, 'edit-' ) !== false ) {
633
-
634
-					$profile['style']   = 'wp';
635
-					$profile['class'][] = ' edit-page';
636
-					$profile['class'][] = ' redux-wp-style';
637
-				}
638
-
639
-				$this->generate_profiles( array( 'args' => $profile ) );
640
-			}
641
-		}
642
-
643
-		/**
644
-		 * Field Default.
645
-		 *
646
-		 * @param array $field_id ID.
647
-		 *
648
-		 * @return mixed|string
649
-		 */
650
-		public function field_default( array $field_id ) {
651
-			if ( ! isset( $this->parent->options_defaults ) ) {
652
-				$this->parent->options_defaults = $this->parent->default_values();
653
-			}
654
-
655
-			if ( ! isset( $this->parent->options ) || empty( $this->parent->options ) ) {
656
-				if ( ! isset( $this->parent->options_class ) ) {
657
-					$this->parent->options_class = new Redux_Options_Constructor( $this->parent );
658
-				}
659
-
660
-				$this->parent->options_class->get();
661
-			}
662
-
663
-			if ( isset( $this->parent->options[ $field_id['id'] ] ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) && $this->parent->options[ $field_id['id'] ] !== $this->parent->options_defaults[ $field_id['id'] ] ) {
664
-				return $this->parent->options[ $field_id['id'] ];
665
-			} else {
666
-				if ( empty( $this->options_defaults ) ) {
667
-					$this->default_values(); // fill cache.
668
-				}
669
-
670
-				$data = '';
671
-				if ( ! empty( $this->options_defaults ) ) {
672
-					$data = $this->options_defaults[ $field_id['id'] ] ?? '';
673
-				}
674
-
675
-				if ( empty( $data ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) ) {
676
-					$data = $this->parent->options_defaults[ $field_id['id'] ] ?? '';
677
-				}
678
-
679
-				return $data;
680
-			}
681
-		}
682
-
683
-		/**
684
-		 * Function to get and cache the post-meta.
685
-		 *
686
-		 * @param string $id ID.
687
-		 *
688
-		 * @return array
689
-		 */
690
-		private function get_meta( string $id ): array {
691
-			if ( ! isset( $this->meta[ $id ] ) ) {
692
-				$this->meta[ $id ] = array();
693
-				$o_data            = get_post_meta( $id );
694
-
695
-				// phpcs:ignore WordPress.NamingConventions.ValidHookName
696
-				$o_data = apply_filters( "redux/users/{$this->parent->args['opt_name']}/get_meta", $o_data );
697
-
698
-				if ( ! empty( $o_data ) ) {
699
-					foreach ( $o_data as $key => $value ) {
700
-						if ( count( $value ) === 1 ) {
701
-							$this->meta[ $id ][ $key ] = maybe_unserialize( $value[0] );
702
-						} else {
703
-							$new_value = array_map( 'maybe_unserialize', $value );
704
-
705
-							$this->meta[ $id ][ $key ] = $new_value[0];
706
-						}
707
-					}
708
-				}
709
-
710
-				if ( isset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ) ) {
711
-					$data = maybe_unserialize( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
712
-
713
-					foreach ( $data as $key => $value ) {
714
-						$this->meta[ $id ][ $key ] = $value;
715
-						update_post_meta( $id, $key, $value );
716
-					}
717
-
718
-					unset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
719
-
720
-					delete_post_meta( $id, $this->parent->args['opt_name'] );
721
-				}
722
-			}
723
-
724
-			return $this->meta[ $id ];
725
-		}
726
-
727
-		/**
728
-		 * Get values.
729
-		 *
730
-		 * @param mixed  $the_post Post array.
731
-		 * @param string $meta_key Meta key.
732
-		 * @param string $def_val  Default value.
733
-		 *
734
-		 * @return mixed|string
735
-		 */
736
-		public function get_values( $the_post, string $meta_key = '', string $def_val = '' ) {
737
-
738
-			// Override these values if they differ from the admin panel defaults.  ;).
739
-			if ( isset( $the_post->users_role ) && in_array( $the_post->users_role, $this->users_roles, true ) ) {
740
-				if ( isset( $this->users_role_values[ $the_post->users_role ] ) ) {
741
-					$meta = $this->profile_fields[ $the_post->users_role ];
742
-				} else {
743
-					$defaults = array();
744
-					if ( ! empty( $this->profile_fields[ $the_post->users_role ] ) ) {
745
-						foreach ( $this->profile_fields[ $the_post->users_role ] as $key => $null ) {
746
-							if ( isset( $this->options_defaults[ $key ] ) ) {
747
-								$defaults[ $key ] = $this->options_defaults[ $key ];
748
-							}
749
-						}
750
-					}
751
-
752
-					$meta = wp_parse_args( $this->get_meta( $the_post->ID ), $defaults );
753
-
754
-					$this->profile_fields[ $the_post->users_role ] = $meta;
755
-				}
756
-
757
-				if ( ! empty( $meta_key ) ) {
758
-					if ( ! isset( $meta[ $meta_key ] ) ) {
759
-						$meta[ $meta_key ] = $def_val;
760
-					}
761
-
762
-					return $meta[ $meta_key ];
763
-				} else {
764
-					return $meta;
765
-				}
766
-			}
767
-
768
-			return $def_val;
769
-		}
770
-
771
-		/**
772
-		 * Check Edit Visibility.
773
-		 *
774
-		 * @param array $params Array.
775
-		 *
776
-		 * @return bool
777
-		 */
778
-		private function check_edit_visibility( array $params = array() ): bool {
779
-			global $pagenow;
780
-
781
-			// Edit page visibility.
782
-			if ( strpos( $pagenow, 'edit-' ) !== false ) {
783
-				if ( isset( $params['fields'] ) ) {
784
-					foreach ( $params['fields'] as $field ) {
785
-						if ( in_array( $field['id'], Redux_Core::$fields_hidden, true ) ) { //phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf
786
-							// Not visible.
787
-						} elseif ( isset( $field['add_visibility'] ) && $field['add_visibility'] ) {
788
-							return true;
789
-						}
790
-					}
791
-
792
-					return false;
793
-				}
794
-				if ( isset( $params['add_visibility'] ) && $params['add_visibility'] ) {
795
-					return true;
796
-				}
797
-
798
-				return false;
799
-			}
800
-
801
-			return true;
802
-		}
803
-
804
-		/**
805
-		 * Generate Profiles.
806
-		 *
807
-		 * @param array $metaterm Meta term.
808
-		 */
809
-		private function generate_profiles( array $metaterm ) {
810
-			if ( ! empty( $metaterm['args']['permissions'] ) && ! Redux_Helpers::current_user_can( $metaterm['args']['permissions'] ) ) {
811
-				return;
812
-			}
813
-
814
-			if ( isset( $metaterm['args']['style'] ) && in_array( $metaterm['args']['style'], array( 'wp', 'wordpress' ), true ) ) {
815
-				$container_class             = 'redux-wp-style';
816
-				$metaterm['args']['sidebar'] = false;
817
-			} elseif ( isset( $metaterm['args']['sidebar'] ) && ! $metaterm['args']['sidebar'] ) {
818
-				$container_class = 'redux-no-sections';
819
-			} else {
820
-				$container_class = 'redux-has-sections';
821
-			}
822
-
823
-			$class = implode( ' ', $metaterm['args']['class'] );
824
-			echo '<div class="' . esc_attr( $class ) . '">';
825
-
826
-			$sections = $metaterm['args']['sections'];
827
-
828
-			wp_nonce_field( 'redux_users_meta_nonce', 'redux_users_meta_nonce' );
829
-
830
-			wp_dequeue_script( 'json-view-js' );
831
-
832
-			$sidebar = true;
833
-			if ( count( $sections ) === 1 || ( isset( $metaterm['args']['sidebar'] ) && false === $metaterm['args']['sidebar'] ) ) {
834
-				$sidebar = false; // Show the section dividers or not.
835
-			}
836
-			?>
436
+            } elseif ( 1 === count( $clean_queries ) ) {
437
+                $clean_queries['relation'] = 'OR';
438
+
439
+                // Default to AND.
440
+            } else {
441
+                $clean_queries['relation'] = 'AND';
442
+            }
443
+
444
+            return $clean_queries;
445
+        }
446
+
447
+        /**
448
+         * Is the first order clause.
449
+         *
450
+         * @param array $query Query array.
451
+         *
452
+         * @return bool
453
+         */
454
+        protected function is_first_order_clause( array $query ): bool {
455
+            return isset( $query['key'] ) || isset( $query['value'] );
456
+        }
457
+
458
+        /**
459
+         * Support file and field enqueue.
460
+         */
461
+        public function enqueue() {
462
+            global $pagenow;
463
+
464
+            if ( in_array( $pagenow, $this->pagenows, true ) ) {
465
+
466
+                if ( 'user-new.php' === $pagenow ) {
467
+                    $this->parent->args['disable_save_warn'] = true;
468
+                }
469
+
470
+                $this->parent->transients       = get_transient( $this->parent->args['opt_name'] . '-transients-users' );
471
+                $this->parent->transients_check = $this->parent->transients;
472
+
473
+                if ( isset( $this->parent->transients['notices'] ) ) {
474
+                    $this->notices                              = $this->parent->transients['notices'];
475
+                    $this->parent->transients['last_save_mode'] = 'users';
476
+                }
477
+
478
+                delete_transient( $this->parent->args['opt_name'] . '-transients-users' );
479
+
480
+                $this->parent->enqueue_class->init();
481
+
482
+                // phpcs:ignore WordPress.NamingConventions.ValidHookName
483
+                do_action( "redux/users/{$this->parent->args['opt_name']}/enqueue" );
484
+
485
+                /**
486
+                 * Redux users CSS
487
+                 * filter 'redux/page/{opt_name}/enqueue/redux-extension-users-css'
488
+                 */
489
+                if ( true === $this->parent->args['dev_mode'] ) {
490
+                    wp_enqueue_style(
491
+                        'redux-extension-users',
492
+                        // phpcs:ignore WordPress.NamingConventions.ValidHookName
493
+                        apply_filters( "redux/users/{$this->parent->args['opt_name']}/enqueue/redux-extension-users-css", $this->extension_url . 'redux-extension-users.css' ),
494
+                        array(),
495
+                        self::$version
496
+                    );
497
+                }
498
+
499
+                /**
500
+                 * Redux users JS
501
+                 * filter 'redux/page/{opt_name}/enqueue/redux-extension-users-js
502
+                 */
503
+                wp_enqueue_script(
504
+                    'redux-extension-users',
505
+                    // phpcs:ignore WordPress.NamingConventions.ValidHookName
506
+                    apply_filters( "redux/users/{$this->parent->args['opt_name']}/enqueue/redux-extension-users-js", $this->extension_url . 'redux-extension-users' . Redux_Functions::is_min() . '.js' ),
507
+                    array( 'jquery', 'redux-js' ),
508
+                    self::$version,
509
+                    true
510
+                );
511
+
512
+                // Values used by the JavaScript.
513
+                wp_localize_script( 'redux-extension-users', 'reduxUsers', $this->users_roles );
514
+
515
+            }
516
+        }
517
+
518
+
519
+        /**
520
+         * DEPRECATED
521
+         */
522
+        public function default_values() {
523
+            if ( ! empty( $this->profiles ) && empty( $this->options_defaults ) ) {
524
+                foreach ( $this->profiles as $key => $profile ) {
525
+                    if ( empty( $profile['sections'] ) ) {
526
+                        continue;
527
+                    }
528
+
529
+                    // fill the cache.
530
+                    foreach ( $profile['sections'] as $sk => $section ) {
531
+                        if ( ! isset( $section['id'] ) ) {
532
+                            if ( ! is_numeric( $sk ) || ! isset( $section['title'] ) ) {
533
+                                $section['id'] = $sk;
534
+                            } else {
535
+                                $section['id'] = sanitize_title( $section['title'], $sk );
536
+                            }
537
+                            $this->profiles[ $key ]['sections'][ $sk ] = $section;
538
+                        }
539
+                        if ( isset( $section['fields'] ) ) {
540
+                            foreach ( $section['fields'] as $k => $field ) {
541
+                                if ( empty( $field['id'] ) && empty( $field['type'] ) ) {
542
+                                    continue;
543
+                                }
544
+
545
+                                if ( 'ace_editor' === $field['type'] && isset( $field['options'] ) ) {
546
+                                    $this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['args'] = $field['options'];
547
+                                    unset( $this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ]['options'] );
548
+                                }
549
+
550
+                                if ( 'section' === $field['type'] && isset( $field['indent'] ) && true === $field['indent'] ) {
551
+                                    $field['class']  = $field['class'] ?? '';
552
+                                    $field['class'] .= 'redux-section-indent-start';
553
+
554
+                                    $this->profiles[ $key ]['sections'][ $sk ]['fields'][ $k ] = $field;
555
+                                }
556
+
557
+                                if ( ! isset( $this->parent->options_defaults_class ) ) {
558
+                                    $this->parent->options_defaults_class = new Redux_Options_Defaults();
559
+                                }
560
+
561
+                                $this->parent->options_defaults_class->field_default_values( $this->parent->args['opt_name'], $field );
562
+
563
+                                if ( 'repeater' === $field['type'] ) {
564
+                                    foreach ( $field['fields'] as $f ) {
565
+                                        $this->parent->options_defaults_class->field_default_values( $this->parent->args['opt_name'], $f, null, true );
566
+                                    }
567
+                                }
568
+
569
+                                $this->parent->options_defaults = $this->parent->options_defaults_class->options_defaults;
570
+                            }
571
+                        }
572
+                    }
573
+                }
574
+            }
575
+
576
+            if ( empty( $this->meta ) ) {
577
+                // phpcs:ignore WordPress.Security.NonceVerification
578
+                $user       = isset( $_GET['user_id'] ) ? sanitize_text_field( wp_unslash( $_GET['user_id'] ) ) : get_current_user_id();
579
+                $this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
580
+            }
581
+        }
582
+
583
+        /**
584
+         * Add Profiles.
585
+         */
586
+        public function add_profiles() {
587
+            if ( empty( $this->profiles ) || ! is_array( $this->profiles ) ) {
588
+                return;
589
+            }
590
+
591
+            foreach ( $this->profiles as $key => $profile ) {
592
+                if ( empty( $profile['sections'] ) ) {
593
+                    continue;
594
+                }
595
+
596
+                $defaults = array(
597
+                    'id'         => "$key",
598
+                    'section_id' => $key,
599
+                    'profiles'   => array(),
600
+                );
601
+
602
+                $profile = wp_parse_args( $profile, $defaults );
603
+
604
+                // Override the parent args on a meta-term level.
605
+                if ( empty( $this->orig_args ) ) {
606
+                    $this->orig_args = $this->parent->args;
607
+                }
608
+
609
+                if ( isset( $profile['args'] ) ) {
610
+                    $this->parent->args = wp_parse_args( $profile['args'], $this->orig_args );
611
+                } elseif ( $this->parent->args !== $this->orig_args ) {
612
+                    $this->parent->args = $this->orig_args;
613
+                }
614
+
615
+                if ( ! isset( $profile['class'] ) ) {
616
+                    $profile['class'] = array();
617
+                }
618
+
619
+                if ( ! empty( $profile['class'] ) ) {
620
+                    if ( ! is_array( $profile['class'] ) ) {
621
+                        $profile['class'] = array( $profile['class'] );
622
+                    }
623
+                }
624
+
625
+                $profile['class'] = $this->add_user_classes( $profile['class'] );
626
+
627
+                if ( isset( $profile['post_format'] ) ) {
628
+                    $profile['class'] = $this->add_user_hide_class( $profile['class'] );
629
+                }
630
+
631
+                global $pagenow;
632
+                if ( strpos( $pagenow, 'edit-' ) !== false ) {
633
+
634
+                    $profile['style']   = 'wp';
635
+                    $profile['class'][] = ' edit-page';
636
+                    $profile['class'][] = ' redux-wp-style';
637
+                }
638
+
639
+                $this->generate_profiles( array( 'args' => $profile ) );
640
+            }
641
+        }
642
+
643
+        /**
644
+         * Field Default.
645
+         *
646
+         * @param array $field_id ID.
647
+         *
648
+         * @return mixed|string
649
+         */
650
+        public function field_default( array $field_id ) {
651
+            if ( ! isset( $this->parent->options_defaults ) ) {
652
+                $this->parent->options_defaults = $this->parent->default_values();
653
+            }
654
+
655
+            if ( ! isset( $this->parent->options ) || empty( $this->parent->options ) ) {
656
+                if ( ! isset( $this->parent->options_class ) ) {
657
+                    $this->parent->options_class = new Redux_Options_Constructor( $this->parent );
658
+                }
659
+
660
+                $this->parent->options_class->get();
661
+            }
662
+
663
+            if ( isset( $this->parent->options[ $field_id['id'] ] ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) && $this->parent->options[ $field_id['id'] ] !== $this->parent->options_defaults[ $field_id['id'] ] ) {
664
+                return $this->parent->options[ $field_id['id'] ];
665
+            } else {
666
+                if ( empty( $this->options_defaults ) ) {
667
+                    $this->default_values(); // fill cache.
668
+                }
669
+
670
+                $data = '';
671
+                if ( ! empty( $this->options_defaults ) ) {
672
+                    $data = $this->options_defaults[ $field_id['id'] ] ?? '';
673
+                }
674
+
675
+                if ( empty( $data ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) ) {
676
+                    $data = $this->parent->options_defaults[ $field_id['id'] ] ?? '';
677
+                }
678
+
679
+                return $data;
680
+            }
681
+        }
682
+
683
+        /**
684
+         * Function to get and cache the post-meta.
685
+         *
686
+         * @param string $id ID.
687
+         *
688
+         * @return array
689
+         */
690
+        private function get_meta( string $id ): array {
691
+            if ( ! isset( $this->meta[ $id ] ) ) {
692
+                $this->meta[ $id ] = array();
693
+                $o_data            = get_post_meta( $id );
694
+
695
+                // phpcs:ignore WordPress.NamingConventions.ValidHookName
696
+                $o_data = apply_filters( "redux/users/{$this->parent->args['opt_name']}/get_meta", $o_data );
697
+
698
+                if ( ! empty( $o_data ) ) {
699
+                    foreach ( $o_data as $key => $value ) {
700
+                        if ( count( $value ) === 1 ) {
701
+                            $this->meta[ $id ][ $key ] = maybe_unserialize( $value[0] );
702
+                        } else {
703
+                            $new_value = array_map( 'maybe_unserialize', $value );
704
+
705
+                            $this->meta[ $id ][ $key ] = $new_value[0];
706
+                        }
707
+                    }
708
+                }
709
+
710
+                if ( isset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ) ) {
711
+                    $data = maybe_unserialize( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
712
+
713
+                    foreach ( $data as $key => $value ) {
714
+                        $this->meta[ $id ][ $key ] = $value;
715
+                        update_post_meta( $id, $key, $value );
716
+                    }
717
+
718
+                    unset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] );
719
+
720
+                    delete_post_meta( $id, $this->parent->args['opt_name'] );
721
+                }
722
+            }
723
+
724
+            return $this->meta[ $id ];
725
+        }
726
+
727
+        /**
728
+         * Get values.
729
+         *
730
+         * @param mixed  $the_post Post array.
731
+         * @param string $meta_key Meta key.
732
+         * @param string $def_val  Default value.
733
+         *
734
+         * @return mixed|string
735
+         */
736
+        public function get_values( $the_post, string $meta_key = '', string $def_val = '' ) {
737
+
738
+            // Override these values if they differ from the admin panel defaults.  ;).
739
+            if ( isset( $the_post->users_role ) && in_array( $the_post->users_role, $this->users_roles, true ) ) {
740
+                if ( isset( $this->users_role_values[ $the_post->users_role ] ) ) {
741
+                    $meta = $this->profile_fields[ $the_post->users_role ];
742
+                } else {
743
+                    $defaults = array();
744
+                    if ( ! empty( $this->profile_fields[ $the_post->users_role ] ) ) {
745
+                        foreach ( $this->profile_fields[ $the_post->users_role ] as $key => $null ) {
746
+                            if ( isset( $this->options_defaults[ $key ] ) ) {
747
+                                $defaults[ $key ] = $this->options_defaults[ $key ];
748
+                            }
749
+                        }
750
+                    }
751
+
752
+                    $meta = wp_parse_args( $this->get_meta( $the_post->ID ), $defaults );
753
+
754
+                    $this->profile_fields[ $the_post->users_role ] = $meta;
755
+                }
756
+
757
+                if ( ! empty( $meta_key ) ) {
758
+                    if ( ! isset( $meta[ $meta_key ] ) ) {
759
+                        $meta[ $meta_key ] = $def_val;
760
+                    }
761
+
762
+                    return $meta[ $meta_key ];
763
+                } else {
764
+                    return $meta;
765
+                }
766
+            }
767
+
768
+            return $def_val;
769
+        }
770
+
771
+        /**
772
+         * Check Edit Visibility.
773
+         *
774
+         * @param array $params Array.
775
+         *
776
+         * @return bool
777
+         */
778
+        private function check_edit_visibility( array $params = array() ): bool {
779
+            global $pagenow;
780
+
781
+            // Edit page visibility.
782
+            if ( strpos( $pagenow, 'edit-' ) !== false ) {
783
+                if ( isset( $params['fields'] ) ) {
784
+                    foreach ( $params['fields'] as $field ) {
785
+                        if ( in_array( $field['id'], Redux_Core::$fields_hidden, true ) ) { //phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf
786
+                            // Not visible.
787
+                        } elseif ( isset( $field['add_visibility'] ) && $field['add_visibility'] ) {
788
+                            return true;
789
+                        }
790
+                    }
791
+
792
+                    return false;
793
+                }
794
+                if ( isset( $params['add_visibility'] ) && $params['add_visibility'] ) {
795
+                    return true;
796
+                }
797
+
798
+                return false;
799
+            }
800
+
801
+            return true;
802
+        }
803
+
804
+        /**
805
+         * Generate Profiles.
806
+         *
807
+         * @param array $metaterm Meta term.
808
+         */
809
+        private function generate_profiles( array $metaterm ) {
810
+            if ( ! empty( $metaterm['args']['permissions'] ) && ! Redux_Helpers::current_user_can( $metaterm['args']['permissions'] ) ) {
811
+                return;
812
+            }
813
+
814
+            if ( isset( $metaterm['args']['style'] ) && in_array( $metaterm['args']['style'], array( 'wp', 'wordpress' ), true ) ) {
815
+                $container_class             = 'redux-wp-style';
816
+                $metaterm['args']['sidebar'] = false;
817
+            } elseif ( isset( $metaterm['args']['sidebar'] ) && ! $metaterm['args']['sidebar'] ) {
818
+                $container_class = 'redux-no-sections';
819
+            } else {
820
+                $container_class = 'redux-has-sections';
821
+            }
822
+
823
+            $class = implode( ' ', $metaterm['args']['class'] );
824
+            echo '<div class="' . esc_attr( $class ) . '">';
825
+
826
+            $sections = $metaterm['args']['sections'];
827
+
828
+            wp_nonce_field( 'redux_users_meta_nonce', 'redux_users_meta_nonce' );
829
+
830
+            wp_dequeue_script( 'json-view-js' );
831
+
832
+            $sidebar = true;
833
+            if ( count( $sections ) === 1 || ( isset( $metaterm['args']['sidebar'] ) && false === $metaterm['args']['sidebar'] ) ) {
834
+                $sidebar = false; // Show the section dividers or not.
835
+            }
836
+            ?>
837 837
 			<div data-opt-name="<?php echo esc_attr( $this->parent->args['opt_name'] ); ?>"
838 838
 				class="redux-container <?php echo( esc_attr( $container_class ) ); ?> redux-term redux-box-normal redux-term-normal">
839 839
 				<div class="redux-notices">
@@ -857,292 +857,292 @@  discard block
 block discarded – undo
857 857
 					</div>
858 858
 				</div>
859 859
 				<?php
860
-				echo '<a href="javascript:void(0);" class="expand_options hide" style="display:none;">' . esc_html__( 'Expand', 'redux-framework' ) . '</a>';
861
-				if ( $sidebar ) {
862
-					?>
860
+                echo '<a href="javascript:void(0);" class="expand_options hide" style="display:none;">' . esc_html__( 'Expand', 'redux-framework' ) . '</a>';
861
+                if ( $sidebar ) {
862
+                    ?>
863 863
 					<div class="redux-sidebar">
864 864
 						<ul class="redux-group-menu">
865 865
 							<?php
866
-							foreach ( $sections as $s_key => $section ) {
867
-								if ( ! empty( $section['permissions'] ) && ! Redux_Helpers::current_user_can( $section['permissions'] ) ) {
868
-									continue;
869
-								}
870
-
871
-								// phpcs:ignore WordPress.Security.EscapeOutput
872
-								echo $this->parent->render_class->section_menu( $s_key, $section, '_' . $metaterm['args']['id'], $sections );
873
-							}
874
-							?>
866
+                            foreach ( $sections as $s_key => $section ) {
867
+                                if ( ! empty( $section['permissions'] ) && ! Redux_Helpers::current_user_can( $section['permissions'] ) ) {
868
+                                    continue;
869
+                                }
870
+
871
+                                // phpcs:ignore WordPress.Security.EscapeOutput
872
+                                echo $this->parent->render_class->section_menu( $s_key, $section, '_' . $metaterm['args']['id'], $sections );
873
+                            }
874
+                            ?>
875 875
 						</ul>
876 876
 					</div>
877 877
 				<?php } ?>
878 878
 				<div class="redux-main">
879 879
 					<?php
880 880
 
881
-					foreach ( $sections as $s_key => $section ) {
882
-						if ( ! $this->check_edit_visibility( $section ) ) {
883
-							continue;
884
-						}
885
-
886
-						if ( ! empty( $section['permissions'] ) && ! Redux_Helpers::current_user_can( $section['permissions'] ) ) {
887
-							continue;
888
-						}
889
-
890
-						if ( ! empty( $section['fields'] ) ) {
891
-							if ( isset( $section['args'] ) ) {
892
-								$this->parent->args = wp_parse_args( $section['args'], $this->orig_args );
893
-							} elseif ( $this->parent->args !== $this->orig_args ) {
894
-								$this->parent->args = $this->orig_args;
895
-							}
896
-
897
-							$hide             = $sidebar ? '' : ' display-group';
898
-							$section['class'] = isset( $section['class'] ) ? " {$section['class']}" : '';
899
-
900
-							// phpcs:ignore WordPress.Security.EscapeOutput
901
-							echo "<div id='{$s_key}_{$metaterm['args']['id']}_section_group' class='redux-group-tab{$section['class']} redux_metaterm_panel$hide'>";
902
-
903
-							if ( ! empty( $section['title'] ) ) {
904
-								echo '<h3 class="redux-section-title">' . wp_kses_post( $section['title'] ) . '</h3>';
905
-							}
906
-
907
-							if ( ! empty( $section['desc'] ) ) {
908
-								echo '<div class="redux-section-desc">' . wp_kses_post( $section['desc'] ) . '</div>';
909
-							}
910
-
911
-							echo '<table class="form-table"><tbody>';
912
-
913
-							foreach ( $section['fields'] as $field ) {
914
-								if ( ! $this->check_edit_visibility( $field ) ) {
915
-									continue;
916
-								}
917
-
918
-								if ( ! empty( $field['permissions'] ) && ! Redux_Helpers::current_user_can( $field['permissions'] ) ) {
919
-									continue;
920
-								}
921
-
922
-								$field['name'] = $this->parent->args['opt_name'] . '[' . $field['id'] . ']';
923
-
924
-								$is_hidden = false;
925
-								$ex_style  = '';
926
-								if ( isset( $field['hidden'] ) && $field['hidden'] ) {
927
-									$is_hidden = true;
928
-									$ex_style  = ' style="border-bottom: none;"';
929
-								}
930
-
931
-								echo '<tr valign="top"' . $ex_style . '>'; // phpcs:ignore WordPress.Security.EscapeOutput
932
-
933
-								$th = $this->parent->render_class->get_header_html( $field );
934
-
935
-								if ( $is_hidden ) {
936
-									$str_pos = strpos( $th, 'redux_field_th' );
937
-
938
-									if ( $str_pos > - 1 ) {
939
-										$th = str_replace( 'redux_field_th', 'redux_field_th hide', $th );
940
-									}
941
-								}
942
-
943
-								if ( $sidebar ) {
944
-									if ( ! ( isset( $metaterm['args']['sections'] ) && count( $metaterm['args']['sections'] ) === 1 && isset( $metaterm['args']['sections'][0]['fields'] ) && count( $metaterm['args']['sections'][0]['fields'] ) === 1 ) && isset( $field['title'] ) ) {
945
-										echo '<th scope="row">';
946
-										if ( ! empty( $th ) ) {
947
-											echo $th; //phpcs:ignore WordPress.Security.EscapeOutput
948
-										}
949
-										echo '</th>';
950
-										echo '<td>';
951
-									}
952
-								} else {
953
-									echo '<td>' . $th; //phpcs:ignore WordPress.Security.EscapeOutput
954
-								}
955
-
956
-								if ( 'section' === $field['type'] && true === $field['indent'] ) {
957
-									$field['class']  = $field['class'] ?? '';
958
-									$field['class'] .= 'redux-section-indent-start';
959
-								}
960
-
961
-								if ( ! isset( $this->meta[ $field['id'] ] ) ) {
962
-									$this->meta[ $field['id'] ] = '';
963
-								}
964
-
965
-								$this->parent->render_class->field_input( $field, $this->meta[ $field['id'] ] );
966
-								echo '</td></tr>';
967
-							}
968
-							echo '</tbody></table>';
969
-							echo '</div>';
970
-						}
971
-					}
972
-					?>
881
+                    foreach ( $sections as $s_key => $section ) {
882
+                        if ( ! $this->check_edit_visibility( $section ) ) {
883
+                            continue;
884
+                        }
885
+
886
+                        if ( ! empty( $section['permissions'] ) && ! Redux_Helpers::current_user_can( $section['permissions'] ) ) {
887
+                            continue;
888
+                        }
889
+
890
+                        if ( ! empty( $section['fields'] ) ) {
891
+                            if ( isset( $section['args'] ) ) {
892
+                                $this->parent->args = wp_parse_args( $section['args'], $this->orig_args );
893
+                            } elseif ( $this->parent->args !== $this->orig_args ) {
894
+                                $this->parent->args = $this->orig_args;
895
+                            }
896
+
897
+                            $hide             = $sidebar ? '' : ' display-group';
898
+                            $section['class'] = isset( $section['class'] ) ? " {$section['class']}" : '';
899
+
900
+                            // phpcs:ignore WordPress.Security.EscapeOutput
901
+                            echo "<div id='{$s_key}_{$metaterm['args']['id']}_section_group' class='redux-group-tab{$section['class']} redux_metaterm_panel$hide'>";
902
+
903
+                            if ( ! empty( $section['title'] ) ) {
904
+                                echo '<h3 class="redux-section-title">' . wp_kses_post( $section['title'] ) . '</h3>';
905
+                            }
906
+
907
+                            if ( ! empty( $section['desc'] ) ) {
908
+                                echo '<div class="redux-section-desc">' . wp_kses_post( $section['desc'] ) . '</div>';
909
+                            }
910
+
911
+                            echo '<table class="form-table"><tbody>';
912
+
913
+                            foreach ( $section['fields'] as $field ) {
914
+                                if ( ! $this->check_edit_visibility( $field ) ) {
915
+                                    continue;
916
+                                }
917
+
918
+                                if ( ! empty( $field['permissions'] ) && ! Redux_Helpers::current_user_can( $field['permissions'] ) ) {
919
+                                    continue;
920
+                                }
921
+
922
+                                $field['name'] = $this->parent->args['opt_name'] . '[' . $field['id'] . ']';
923
+
924
+                                $is_hidden = false;
925
+                                $ex_style  = '';
926
+                                if ( isset( $field['hidden'] ) && $field['hidden'] ) {
927
+                                    $is_hidden = true;
928
+                                    $ex_style  = ' style="border-bottom: none;"';
929
+                                }
930
+
931
+                                echo '<tr valign="top"' . $ex_style . '>'; // phpcs:ignore WordPress.Security.EscapeOutput
932
+
933
+                                $th = $this->parent->render_class->get_header_html( $field );
934
+
935
+                                if ( $is_hidden ) {
936
+                                    $str_pos = strpos( $th, 'redux_field_th' );
937
+
938
+                                    if ( $str_pos > - 1 ) {
939
+                                        $th = str_replace( 'redux_field_th', 'redux_field_th hide', $th );
940
+                                    }
941
+                                }
942
+
943
+                                if ( $sidebar ) {
944
+                                    if ( ! ( isset( $metaterm['args']['sections'] ) && count( $metaterm['args']['sections'] ) === 1 && isset( $metaterm['args']['sections'][0]['fields'] ) && count( $metaterm['args']['sections'][0]['fields'] ) === 1 ) && isset( $field['title'] ) ) {
945
+                                        echo '<th scope="row">';
946
+                                        if ( ! empty( $th ) ) {
947
+                                            echo $th; //phpcs:ignore WordPress.Security.EscapeOutput
948
+                                        }
949
+                                        echo '</th>';
950
+                                        echo '<td>';
951
+                                    }
952
+                                } else {
953
+                                    echo '<td>' . $th; //phpcs:ignore WordPress.Security.EscapeOutput
954
+                                }
955
+
956
+                                if ( 'section' === $field['type'] && true === $field['indent'] ) {
957
+                                    $field['class']  = $field['class'] ?? '';
958
+                                    $field['class'] .= 'redux-section-indent-start';
959
+                                }
960
+
961
+                                if ( ! isset( $this->meta[ $field['id'] ] ) ) {
962
+                                    $this->meta[ $field['id'] ] = '';
963
+                                }
964
+
965
+                                $this->parent->render_class->field_input( $field, $this->meta[ $field['id'] ] );
966
+                                echo '</td></tr>';
967
+                            }
968
+                            echo '</tbody></table>';
969
+                            echo '</div>';
970
+                        }
971
+                    }
972
+                    ?>
973 973
 				</div>
974 974
 				<div class="clear"></div>
975 975
 			</div>
976 976
 			<?php
977 977
 
978
-			echo '</div>';
979
-		}
980
-
981
-		/**
982
-		 * Save meta-profiles
983
-		 * Runs when a post is saved and does an action which to write panel save scripts can hook into.
984
-		 *
985
-		 * @access public
986
-		 *
987
-		 * @param mixed $user_id User ID.
988
-		 *
989
-		 * @return boolean
990
-		 */
991
-		public function user_meta_save( $user_id = 0 ): bool {
992
-			if ( ! current_user_can( 'edit_user', $user_id ) ) {
993
-				return false;
994
-			}
995
-
996
-			// Check if our nonce is set.
997
-			if ( ! isset( $_POST['redux_users_meta_nonce'] ) || ! isset( $_POST[ $this->parent->args['opt_name'] ] ) ) {
998
-				return false;
999
-			}
1000
-
1001
-			// Verify that the nonce is valid.
1002
-			if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['redux_users_meta_nonce'] ) ), 'redux_users_meta_nonce' ) ) {
1003
-				return false;
1004
-			}
1005
-
1006
-			$check_user_id = sanitize_text_field( wp_unslash( $_POST['checkuser_id'] ?? 1 ) );
1007
-
1008
-			$user       = sanitize_text_field( wp_unslash( $_POST['user_id'] ?? get_current_user_id() ) );
1009
-			$this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
1010
-
1011
-			$to_save    = array();
1012
-			$to_compare = array();
1013
-			$to_delete  = array();
1014
-			$dont_save  = true;
1015
-
1016
-			$field_args = Redux_Users::$fields[ $this->parent->args['opt_name'] ];
1017
-
1018
-			foreach ( $_POST[ $this->parent->args['opt_name'] ] as $key => $value ) { // phpcs:ignore WordPress.Security
1019
-				$key = sanitize_text_field( wp_unslash( $key ) );
1020
-
1021
-				if ( ! empty( $field_args[ $key ]['permissions'] ) ) {
1022
-					foreach ( (array) $field_args[ $key ]['permissions'] as $pv ) {
1023
-
1024
-						// Do not save anything the user doesn't have permissions for.
1025
-						if ( isset( $field_args[ $key ] ) ) {
1026
-							if ( user_can( $user_id, $pv ) && user_can( $check_user_id, $pv ) ) {
1027
-								break;
1028
-							}
1029
-						}
1030
-					}
1031
-				}
1032
-
1033
-				// Have to remove the escaping for array comparison.
1034
-				if ( is_array( $value ) ) {
1035
-					foreach ( $value as $k => $v ) {
1036
-						if ( ! is_array( $v ) ) {
1037
-							$value[ $k ] = sanitize_text_field( wp_unslash( $v ) );
1038
-						}
1039
-					}
1040
-				}
1041
-
1042
-				$save = true;
1043
-
1044
-				// parent_options.
1045
-				if ( ! $dont_save && isset( $this->options_defaults[ $key ] ) && $value === $this->options_defaults[ $key ] ) {
1046
-					$save = false;
1047
-				}
1048
-
1049
-				if ( $save && isset( $this->parent_options[ $key ] ) && $this->parent_options[ $key ] !== $value ) {
1050
-					$save = false;
1051
-				}
1052
-
1053
-				if ( $save ) {
1054
-					$to_save[ $key ]    = $value;
1055
-					$to_compare[ $key ] = $this->parent->options[ $key ] ?? '';
1056
-				} else {
1057
-					$to_delete[ $key ] = $value;
1058
-				}
1059
-			}
1060
-
1061
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
1062
-			$to_save = apply_filters( "redux/{$this->parent->args['opt_name']}/users/save/before_validate", $to_save, $to_compare, $this->sections );
1063
-
1064
-			$validate = $this->parent->validate_class->validate( $to_save, $to_compare, $this->sections );
1065
-
1066
-			// Validate fields (if needed).
1067
-			foreach ( $to_save as $key => $value ) {
1068
-				if ( isset( $validate[ $key ] ) && $validate[ $key ] !== $value ) {
1069
-					if ( isset( $this->meta[ $key ] ) && $validate[ $key ] === $this->meta[ $key ] ) {
1070
-						unset( $to_save[ $key ] );
1071
-					} else {
1072
-						$to_save[ $key ] = $validate[ $key ];
1073
-					}
1074
-				}
1075
-			}
1076
-
1077
-			if ( ! empty( $this->parent->errors ) || ! empty( $this->parent->warnings ) ) {
1078
-				$this->parent->transients['notices'] = ( isset( $this->parent->transients['notices'] ) && is_array( $this->parent->transients['notices'] ) ) ? $this->parent->transients['notices'] : array();
1079
-
1080
-				if ( ! isset( $this->parent->transients['notices']['errors'] ) || $this->parent->transients['notices']['errors'] !== $this->parent->errors ) {
1081
-					$this->parent->transients['notices']['errors'] = $this->parent->errors;
1082
-					$update_transients                             = true;
1083
-				}
1084
-
1085
-				if ( ! isset( $this->parent->transients['notices']['warnings'] ) || $this->parent->transients['notices']['warnings'] !== $this->parent->warnings ) {
1086
-					$this->parent->transients['notices']['warnings'] = $this->parent->warnings;
1087
-					$update_transients                               = true;
1088
-				}
1089
-
1090
-				if ( isset( $update_transients ) ) {
1091
-					$this->parent->transients['notices']['override'] = 1;
1092
-					set_transient( $this->parent->args['opt_name'] . '-transients-users', $this->parent->transients );
1093
-				}
1094
-			}
1095
-
1096
-			$check = $this->profile_fields;
1097
-
1098
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
1099
-			$to_save = apply_filters( 'redux/users/save', $to_save, $to_compare, $this->sections );
1100
-
1101
-			foreach ( $to_save as $key => $value ) {
1102
-				$prev_value = $this->meta[ $key ] ?? '';
1103
-
1104
-				if ( isset( $check[ $key ] ) ) {
1105
-					unset( $check[ $key ] );
1106
-				}
1107
-
1108
-				update_user_meta( $user_id, $key, $value, $prev_value );
1109
-			}
1110
-
1111
-			foreach ( $to_delete as $key => $value ) {
1112
-				if ( isset( $check[ $key ] ) ) {
1113
-					unset( $check[ $key ] );
1114
-				}
1115
-
1116
-				$prev_value = $this->meta[ $key ] ?? '';
1117
-				delete_user_meta( $user_id, $key, $prev_value );
1118
-			}
1119
-			if ( ! empty( $check ) ) {
1120
-				foreach ( $check as $key => $value ) {
1121
-					delete_user_meta( $user_id, $key );
1122
-				}
1123
-			}
1124
-
1125
-			return true;
1126
-		}
1127
-
1128
-		/**
1129
-		 * Show any stored error messages.
1130
-		 *
1131
-		 * @access public
1132
-		 * @return void
1133
-		 */
1134
-		public function meta_profiles_show_errors() {
1135
-			if ( isset( $this->notices['errors'] ) && ! empty( $this->notices['errors'] ) ) {
1136
-				echo '<div id="redux_users_errors" class="error fade">';
1137
-				echo '<p><strong><span></span> ' . count( $this->notices['errors'] ) . ' ' . esc_html__( 'error(s) were found!', 'redux-framework' ) . '</strong></p>';
1138
-				echo '</div>';
1139
-			}
1140
-
1141
-			if ( isset( $this->notices['warnings'] ) && ! empty( $this->notices['warnings'] ) ) {
1142
-				echo '<div id="redux_users_warnings" class="error fade" style="border-left-color: #E8E20C;">';
1143
-				echo '<p><strong><span></span> ' . count( $this->notices['warnings'] ) . ' ' . esc_html__( 'warnings(s) were found!', 'redux-framework' ) . '</strong></p>';
1144
-				echo '</div>';
1145
-			}
1146
-		}
1147
-	}
978
+            echo '</div>';
979
+        }
980
+
981
+        /**
982
+         * Save meta-profiles
983
+         * Runs when a post is saved and does an action which to write panel save scripts can hook into.
984
+         *
985
+         * @access public
986
+         *
987
+         * @param mixed $user_id User ID.
988
+         *
989
+         * @return boolean
990
+         */
991
+        public function user_meta_save( $user_id = 0 ): bool {
992
+            if ( ! current_user_can( 'edit_user', $user_id ) ) {
993
+                return false;
994
+            }
995
+
996
+            // Check if our nonce is set.
997
+            if ( ! isset( $_POST['redux_users_meta_nonce'] ) || ! isset( $_POST[ $this->parent->args['opt_name'] ] ) ) {
998
+                return false;
999
+            }
1000
+
1001
+            // Verify that the nonce is valid.
1002
+            if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['redux_users_meta_nonce'] ) ), 'redux_users_meta_nonce' ) ) {
1003
+                return false;
1004
+            }
1005
+
1006
+            $check_user_id = sanitize_text_field( wp_unslash( $_POST['checkuser_id'] ?? 1 ) );
1007
+
1008
+            $user       = sanitize_text_field( wp_unslash( $_POST['user_id'] ?? get_current_user_id() ) );
1009
+            $this->meta = Redux_Users::get_user_meta( array( 'user' => $user ) );
1010
+
1011
+            $to_save    = array();
1012
+            $to_compare = array();
1013
+            $to_delete  = array();
1014
+            $dont_save  = true;
1015
+
1016
+            $field_args = Redux_Users::$fields[ $this->parent->args['opt_name'] ];
1017
+
1018
+            foreach ( $_POST[ $this->parent->args['opt_name'] ] as $key => $value ) { // phpcs:ignore WordPress.Security
1019
+                $key = sanitize_text_field( wp_unslash( $key ) );
1020
+
1021
+                if ( ! empty( $field_args[ $key ]['permissions'] ) ) {
1022
+                    foreach ( (array) $field_args[ $key ]['permissions'] as $pv ) {
1023
+
1024
+                        // Do not save anything the user doesn't have permissions for.
1025
+                        if ( isset( $field_args[ $key ] ) ) {
1026
+                            if ( user_can( $user_id, $pv ) && user_can( $check_user_id, $pv ) ) {
1027
+                                break;
1028
+                            }
1029
+                        }
1030
+                    }
1031
+                }
1032
+
1033
+                // Have to remove the escaping for array comparison.
1034
+                if ( is_array( $value ) ) {
1035
+                    foreach ( $value as $k => $v ) {
1036
+                        if ( ! is_array( $v ) ) {
1037
+                            $value[ $k ] = sanitize_text_field( wp_unslash( $v ) );
1038
+                        }
1039
+                    }
1040
+                }
1041
+
1042
+                $save = true;
1043
+
1044
+                // parent_options.
1045
+                if ( ! $dont_save && isset( $this->options_defaults[ $key ] ) && $value === $this->options_defaults[ $key ] ) {
1046
+                    $save = false;
1047
+                }
1048
+
1049
+                if ( $save && isset( $this->parent_options[ $key ] ) && $this->parent_options[ $key ] !== $value ) {
1050
+                    $save = false;
1051
+                }
1052
+
1053
+                if ( $save ) {
1054
+                    $to_save[ $key ]    = $value;
1055
+                    $to_compare[ $key ] = $this->parent->options[ $key ] ?? '';
1056
+                } else {
1057
+                    $to_delete[ $key ] = $value;
1058
+                }
1059
+            }
1060
+
1061
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
1062
+            $to_save = apply_filters( "redux/{$this->parent->args['opt_name']}/users/save/before_validate", $to_save, $to_compare, $this->sections );
1063
+
1064
+            $validate = $this->parent->validate_class->validate( $to_save, $to_compare, $this->sections );
1065
+
1066
+            // Validate fields (if needed).
1067
+            foreach ( $to_save as $key => $value ) {
1068
+                if ( isset( $validate[ $key ] ) && $validate[ $key ] !== $value ) {
1069
+                    if ( isset( $this->meta[ $key ] ) && $validate[ $key ] === $this->meta[ $key ] ) {
1070
+                        unset( $to_save[ $key ] );
1071
+                    } else {
1072
+                        $to_save[ $key ] = $validate[ $key ];
1073
+                    }
1074
+                }
1075
+            }
1076
+
1077
+            if ( ! empty( $this->parent->errors ) || ! empty( $this->parent->warnings ) ) {
1078
+                $this->parent->transients['notices'] = ( isset( $this->parent->transients['notices'] ) && is_array( $this->parent->transients['notices'] ) ) ? $this->parent->transients['notices'] : array();
1079
+
1080
+                if ( ! isset( $this->parent->transients['notices']['errors'] ) || $this->parent->transients['notices']['errors'] !== $this->parent->errors ) {
1081
+                    $this->parent->transients['notices']['errors'] = $this->parent->errors;
1082
+                    $update_transients                             = true;
1083
+                }
1084
+
1085
+                if ( ! isset( $this->parent->transients['notices']['warnings'] ) || $this->parent->transients['notices']['warnings'] !== $this->parent->warnings ) {
1086
+                    $this->parent->transients['notices']['warnings'] = $this->parent->warnings;
1087
+                    $update_transients                               = true;
1088
+                }
1089
+
1090
+                if ( isset( $update_transients ) ) {
1091
+                    $this->parent->transients['notices']['override'] = 1;
1092
+                    set_transient( $this->parent->args['opt_name'] . '-transients-users', $this->parent->transients );
1093
+                }
1094
+            }
1095
+
1096
+            $check = $this->profile_fields;
1097
+
1098
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
1099
+            $to_save = apply_filters( 'redux/users/save', $to_save, $to_compare, $this->sections );
1100
+
1101
+            foreach ( $to_save as $key => $value ) {
1102
+                $prev_value = $this->meta[ $key ] ?? '';
1103
+
1104
+                if ( isset( $check[ $key ] ) ) {
1105
+                    unset( $check[ $key ] );
1106
+                }
1107
+
1108
+                update_user_meta( $user_id, $key, $value, $prev_value );
1109
+            }
1110
+
1111
+            foreach ( $to_delete as $key => $value ) {
1112
+                if ( isset( $check[ $key ] ) ) {
1113
+                    unset( $check[ $key ] );
1114
+                }
1115
+
1116
+                $prev_value = $this->meta[ $key ] ?? '';
1117
+                delete_user_meta( $user_id, $key, $prev_value );
1118
+            }
1119
+            if ( ! empty( $check ) ) {
1120
+                foreach ( $check as $key => $value ) {
1121
+                    delete_user_meta( $user_id, $key );
1122
+                }
1123
+            }
1124
+
1125
+            return true;
1126
+        }
1127
+
1128
+        /**
1129
+         * Show any stored error messages.
1130
+         *
1131
+         * @access public
1132
+         * @return void
1133
+         */
1134
+        public function meta_profiles_show_errors() {
1135
+            if ( isset( $this->notices['errors'] ) && ! empty( $this->notices['errors'] ) ) {
1136
+                echo '<div id="redux_users_errors" class="error fade">';
1137
+                echo '<p><strong><span></span> ' . count( $this->notices['errors'] ) . ' ' . esc_html__( 'error(s) were found!', 'redux-framework' ) . '</strong></p>';
1138
+                echo '</div>';
1139
+            }
1140
+
1141
+            if ( isset( $this->notices['warnings'] ) && ! empty( $this->notices['warnings'] ) ) {
1142
+                echo '<div id="redux_users_warnings" class="error fade" style="border-left-color: #E8E20C;">';
1143
+                echo '<p><strong><span></span> ' . count( $this->notices['warnings'] ) . ' ' . esc_html__( 'warnings(s) were found!', 'redux-framework' ) . '</strong></p>';
1144
+                echo '</div>';
1145
+            }
1146
+        }
1147
+    }
1148 1148
 }
Please login to merge, or discard this patch.
redux-templates/classes/class-templates.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -17,155 +17,155 @@
 block discarded – undo
17 17
  */
18 18
 class Templates {
19 19
 
20
-	/**
21
-	 * Default container width.
22
-	 *
23
-	 * @var int
24
-	 */
25
-	public static int $content_width = 1200;
26
-
27
-	/**
28
-	 * ReduxTemplates Template.
29
-	 *
30
-	 * @since 4.0.0
31
-	 */
32
-	public function __construct() {
33
-		global $pagenow;
34
-
35
-		if ( 'widgets.php' === $pagenow ) {
36
-			return;
37
-		}
38
-
39
-		if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && ( class_exists( 'Classic_Editor' ) || defined( 'DISABLE_GUTENBERG_FILE' ) || class_exists( 'CodePopular_disable_gutenberg' ) ) ) {
40
-
41
-			// We don't want to add templates unless it's a gutenberg page.
42
-			return;
43
-		}
44
-
45
-		// Include ReduxTemplates default template without a wrapper.
46
-		add_filter( 'template_include', array( $this, 'template_include' ) );
47
-
48
-		// Override the default content-width when using Redux templates so the template doesn't look like shit.
49
-		add_action( 'wp', array( $this, 'modify_template_content_width' ) );
50
-
51
-		// Add ReduxTemplates supported Post types in page template.
52
-		$post_types = get_post_types( array(), 'object' );
53
-
54
-		if ( ! empty( $post_types ) ) {
55
-			foreach ( $post_types as $post_type ) {
56
-				if ( isset( $post_type->name ) && isset( $post_type->show_in_rest ) && true === $post_type->show_in_rest ) {
57
-					add_filter( "theme_{$post_type->name}_templates", array( $this, 'add_templates' ) );
58
-				}
59
-			}
60
-		}
61
-
62
-		add_filter( 'admin_body_class', array( $this, 'add_body_class' ), 999 );
63
-	}
64
-
65
-	/**
66
-	 * Add the redux-template class to the admin body if a redux-templates page type is selected.
67
-	 *
68
-	 * @param string|null $classes Classes string for the admin panel.
69
-	 *
70
-	 * @return string|null
71
-	 * @since 4.1.19
72
-	 */
73
-	public function add_body_class( ?string $classes ): ?string {
74
-		global $post;
75
-
76
-		$screen = get_current_screen();
77
-
78
-		if ( 'post' === $screen->base && get_current_screen()->is_block_editor() ) {
79
-			$check = get_post_meta( $post->ID, '_wp_page_template', true );
80
-
81
-			if ( strpos( $check, 'redux-templates_' ) !== false ) {
82
-				$classes .= ' redux-template';
83
-			}
84
-		}
85
-
86
-		return $classes;
87
-	}
88
-
89
-	/**
90
-	 * Override the $content_width variable for themes, so our templates work properly and don't look squished.
91
-	 *
92
-	 * @param array $to_find Template keys to check against.
93
-	 *
94
-	 * @return bool
95
-	 * @since 4.0.0
96
-	 */
97
-	public function check_template( array $to_find = array() ): bool {
98
-		global $post;
99
-
100
-		if ( ! empty( $post ) ) {
101
-			$template = get_page_template_slug( $post->ID );
102
-
103
-			if ( false !== strpos( $template, 'redux' ) ) {
104
-				$test = mb_strtolower( preg_replace( '/[^A-Za-z0-9 ]/', '', $template ) );
105
-
106
-				foreach ( $to_find as $key ) {
107
-					if ( false !== strpos( $test, $key ) ) {
108
-						return true;
109
-					}
110
-				}
111
-			}
112
-		}
113
-
114
-		return false;
115
-	}
116
-
117
-	/**
118
-	 * Override the $content_width variable for themes, so our templates work properly and don't look squished.
119
-	 *
120
-	 * @since 4.0.0
121
-	 */
122
-	public function modify_template_content_width() {
123
-		$to_find = array( 'cover', 'canvas', 'fullwidth' );
124
-		if ( $this->check_template( $to_find ) ) {
125
-			global $content_width;
126
-			if ( $content_width < 1000 ) {
127
-				$content_width = get_option( '_redux_content_width', self::$content_width );
128
-			}
129
-		}
130
-	}
131
-
132
-	/**
133
-	 * Include the template
134
-	 *
135
-	 * @param string|null $template Template type.
136
-	 *
137
-	 * @return string|null
138
-	 * @since 4.0.0
139
-	 */
140
-	public function template_include( ?string $template ): ?string {
141
-		if ( is_singular() ) {
142
-			$page_template = get_post_meta( get_the_ID(), '_wp_page_template', true );
143
-
144
-			if ( 'redux-templates_full_width' === $page_template ) {
145
-				$template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-full-width.php';
146
-			} elseif ( 'redux-templates_contained' === $page_template ) {
147
-				$template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-contained.php';
148
-			} elseif ( 'redux-templates_canvas' === $page_template ) {
149
-				$template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-canvas.php';
150
-			}
151
-		}
152
-
153
-		return $template;
154
-	}
155
-
156
-	/**
157
-	 * Hook to add the templates to the dropdown
158
-	 *
159
-	 * @param array $post_templates Default post template array.
160
-	 *
161
-	 * @return array
162
-	 * @since 4.0.0
163
-	 */
164
-	public function add_templates( array $post_templates ): array {
165
-		$post_templates['redux-templates_contained']  = __( 'Redux Contained', 'redux-framework' );
166
-		$post_templates['redux-templates_full_width'] = __( 'Redux Full Width', 'redux-framework' );
167
-		$post_templates['redux-templates_canvas']     = __( 'Redux Canvas', 'redux-framework' );
168
-
169
-		return $post_templates;
170
-	}
20
+    /**
21
+     * Default container width.
22
+     *
23
+     * @var int
24
+     */
25
+    public static int $content_width = 1200;
26
+
27
+    /**
28
+     * ReduxTemplates Template.
29
+     *
30
+     * @since 4.0.0
31
+     */
32
+    public function __construct() {
33
+        global $pagenow;
34
+
35
+        if ( 'widgets.php' === $pagenow ) {
36
+            return;
37
+        }
38
+
39
+        if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && ( class_exists( 'Classic_Editor' ) || defined( 'DISABLE_GUTENBERG_FILE' ) || class_exists( 'CodePopular_disable_gutenberg' ) ) ) {
40
+
41
+            // We don't want to add templates unless it's a gutenberg page.
42
+            return;
43
+        }
44
+
45
+        // Include ReduxTemplates default template without a wrapper.
46
+        add_filter( 'template_include', array( $this, 'template_include' ) );
47
+
48
+        // Override the default content-width when using Redux templates so the template doesn't look like shit.
49
+        add_action( 'wp', array( $this, 'modify_template_content_width' ) );
50
+
51
+        // Add ReduxTemplates supported Post types in page template.
52
+        $post_types = get_post_types( array(), 'object' );
53
+
54
+        if ( ! empty( $post_types ) ) {
55
+            foreach ( $post_types as $post_type ) {
56
+                if ( isset( $post_type->name ) && isset( $post_type->show_in_rest ) && true === $post_type->show_in_rest ) {
57
+                    add_filter( "theme_{$post_type->name}_templates", array( $this, 'add_templates' ) );
58
+                }
59
+            }
60
+        }
61
+
62
+        add_filter( 'admin_body_class', array( $this, 'add_body_class' ), 999 );
63
+    }
64
+
65
+    /**
66
+     * Add the redux-template class to the admin body if a redux-templates page type is selected.
67
+     *
68
+     * @param string|null $classes Classes string for the admin panel.
69
+     *
70
+     * @return string|null
71
+     * @since 4.1.19
72
+     */
73
+    public function add_body_class( ?string $classes ): ?string {
74
+        global $post;
75
+
76
+        $screen = get_current_screen();
77
+
78
+        if ( 'post' === $screen->base && get_current_screen()->is_block_editor() ) {
79
+            $check = get_post_meta( $post->ID, '_wp_page_template', true );
80
+
81
+            if ( strpos( $check, 'redux-templates_' ) !== false ) {
82
+                $classes .= ' redux-template';
83
+            }
84
+        }
85
+
86
+        return $classes;
87
+    }
88
+
89
+    /**
90
+     * Override the $content_width variable for themes, so our templates work properly and don't look squished.
91
+     *
92
+     * @param array $to_find Template keys to check against.
93
+     *
94
+     * @return bool
95
+     * @since 4.0.0
96
+     */
97
+    public function check_template( array $to_find = array() ): bool {
98
+        global $post;
99
+
100
+        if ( ! empty( $post ) ) {
101
+            $template = get_page_template_slug( $post->ID );
102
+
103
+            if ( false !== strpos( $template, 'redux' ) ) {
104
+                $test = mb_strtolower( preg_replace( '/[^A-Za-z0-9 ]/', '', $template ) );
105
+
106
+                foreach ( $to_find as $key ) {
107
+                    if ( false !== strpos( $test, $key ) ) {
108
+                        return true;
109
+                    }
110
+                }
111
+            }
112
+        }
113
+
114
+        return false;
115
+    }
116
+
117
+    /**
118
+     * Override the $content_width variable for themes, so our templates work properly and don't look squished.
119
+     *
120
+     * @since 4.0.0
121
+     */
122
+    public function modify_template_content_width() {
123
+        $to_find = array( 'cover', 'canvas', 'fullwidth' );
124
+        if ( $this->check_template( $to_find ) ) {
125
+            global $content_width;
126
+            if ( $content_width < 1000 ) {
127
+                $content_width = get_option( '_redux_content_width', self::$content_width );
128
+            }
129
+        }
130
+    }
131
+
132
+    /**
133
+     * Include the template
134
+     *
135
+     * @param string|null $template Template type.
136
+     *
137
+     * @return string|null
138
+     * @since 4.0.0
139
+     */
140
+    public function template_include( ?string $template ): ?string {
141
+        if ( is_singular() ) {
142
+            $page_template = get_post_meta( get_the_ID(), '_wp_page_template', true );
143
+
144
+            if ( 'redux-templates_full_width' === $page_template ) {
145
+                $template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-full-width.php';
146
+            } elseif ( 'redux-templates_contained' === $page_template ) {
147
+                $template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-contained.php';
148
+            } elseif ( 'redux-templates_canvas' === $page_template ) {
149
+                $template = REDUXTEMPLATES_DIR_PATH . 'classes/templates/template-canvas.php';
150
+            }
151
+        }
152
+
153
+        return $template;
154
+    }
155
+
156
+    /**
157
+     * Hook to add the templates to the dropdown
158
+     *
159
+     * @param array $post_templates Default post template array.
160
+     *
161
+     * @return array
162
+     * @since 4.0.0
163
+     */
164
+    public function add_templates( array $post_templates ): array {
165
+        $post_templates['redux-templates_contained']  = __( 'Redux Contained', 'redux-framework' );
166
+        $post_templates['redux-templates_full_width'] = __( 'Redux Full Width', 'redux-framework' );
167
+        $post_templates['redux-templates_canvas']     = __( 'Redux Canvas', 'redux-framework' );
168
+
169
+        return $post_templates;
170
+    }
171 171
 }
Please login to merge, or discard this patch.
redux-core/framework.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		 *
453 453
 		 * @deprecated 4.0.0
454 454
 		 */
455
-		public static bool $_as_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
455
+		public static bool $_as_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration
456 456
 
457 457
 		/**
458 458
 		 * Deprecated shim for v3 as plugin check.
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		 *
462 462
 		 * @deprecated 4.0.0
463 463
 		 */
464
-		public static bool $_is_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
464
+		public static bool $_is_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration
465 465
 
466 466
 		/**
467 467
 		 * Cloning is forbidden.
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 				return;
508 508
 			}
509 509
 
510
-			if ( ! isset( Redux::$init[ $args['opt_name'] ] ) ) {
510
+			if ( ! isset( Redux::$init[$args['opt_name']] ) ) {
511 511
 				// Let's go back to the Redux API instead of having it run directly.
512 512
 				Redux_Functions_Ex::record_caller( $args['opt_name'] );
513 513
 				Redux::set_args( $args['opt_name'], $args );
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 				$sections = Redux::construct_sections( $args['opt_name'] );
518 518
 				$args     = Redux::construct_args( $args['opt_name'] );
519 519
 				Redux::set_defaults( $args['opt_name'] );
520
-				Redux::$init[ $args['opt_name'] ] = 1;
520
+				Redux::$init[$args['opt_name']] = 1;
521 521
 			}
522 522
 
523 523
 			$args             = new Redux_Args( $this, $args );
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 		 * @return      mixed
914 914
 		 */
915 915
 		public function get( string $opt_name, $defaults = null ) {
916
-			return ( ! empty( $this->options[ $opt_name ] ) ) ? $this->options[ $opt_name ] : $this->options_class->get_default( $opt_name, $defaults );
916
+			return ( ! empty( $this->options[$opt_name] ) ) ? $this->options[$opt_name] : $this->options_class->get_default( $opt_name, $defaults );
917 917
 		}
918 918
 
919 919
 		/**
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 		 */
930 930
 		public function set( string $opt_name = '', $values = array() ) {
931 931
 			if ( ! empty( $opt_name ) && is_array( $values ) ) {
932
-				$this->options[ $opt_name ] = $values;
932
+				$this->options[$opt_name] = $values;
933 933
 				$this->options_class->set( $values );
934 934
 			}
935 935
 		}
Please login to merge, or discard this patch.
Indentation   +849 added lines, -849 removed lines patch added patch discarded remove patch
@@ -39,853 +39,853 @@
 block discarded – undo
39 39
 // Don't duplicate me!
40 40
 if ( ! class_exists( 'ReduxFramework', false ) ) {
41 41
 
42
-	/**
43
-	 * Main ReduxFramework class
44
-	 *
45
-	 * @since       1.0.0
46
-	 */
47
-	class ReduxFramework {
48
-
49
-		/**
50
-		 * ReduxFramework instance storage.
51
-		 *
52
-		 * @var null|ReduxFramework
53
-		 * @access public
54
-		 */
55
-		public static ?ReduxFramework $instance;
56
-
57
-		/**
58
-		 * Redux current version.
59
-		 *
60
-		 * @var string
61
-		 * @access public
62
-		 *
63
-		 * @deprecated 4.0.0
64
-		 */
65
-		public static string $_version = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
66
-
67
-		/**
68
-		 * Absolute directory of the Redux instance.
69
-		 *
70
-		 * @var string
71
-		 * @access public
72
-		 *
73
-		 * @deprecated 4.0.0
74
-		 */
75
-		public static string $_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
76
-
77
-		/**
78
-		 * Full URL of the Redux instance.
79
-		 *
80
-		 * @var string
81
-		 * @access public
82
-		 *
83
-		 * @deprecated 4.0.0
84
-		 */
85
-		public static string $_url = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
86
-
87
-		/**
88
-		 * Current WordPress upload directory.
89
-		 *
90
-		 * @var string
91
-		 * @access public
92
-		 *
93
-		 * @deprecated 4.0.0
94
-		 */
95
-		public static string $_upload_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
96
-
97
-		/**
98
-		 * Current WordPress upload URL
99
-		 *
100
-		 * @var string
101
-		 * @access public
102
-		 *
103
-		 * @deprecated 4.0.0
104
-		 */
105
-		public static string $_upload_url; // phpcs:ignore PSR2.Classes.PropertyDeclaration
106
-
107
-		/**
108
-		 * Init
109
-		 *
110
-		 * Backward compatibility for previous versions of Redux.
111
-		 */
112
-		public static function init() {
113
-
114
-			// Backward compatibility for extensions.
115
-			self::$_version    = Redux_Core::$version;
116
-			self::$_dir        = Redux_Core::$dir;
117
-			self::$_url        = Redux_Core::$url;
118
-			self::$_upload_dir = Redux_Core::$upload_dir;
119
-			self::$_upload_url = Redux_Core::$upload_url;
120
-			self::$_as_plugin  = Redux_Core::$as_plugin;
121
-			self::$_is_plugin  = Redux_Core::$is_plugin;
122
-		}
123
-
124
-		/**
125
-		 * Array of field arrays.
126
-		 *
127
-		 * @var null|array
128
-		 */
129
-		public ?array $fields = array();
130
-
131
-		/**
132
-		 * Array of field sections.
133
-		 *
134
-		 * @var null|array
135
-		 */
136
-		public ?array $field_sections = array();
137
-
138
-		/**
139
-		 * Array of field types.
140
-		 *
141
-		 * @var null|array
142
-		 */
143
-		public ?array $field_types = array();
144
-
145
-		/**
146
-		 * Array of field heads.
147
-		 *
148
-		 * @var null|array
149
-		 */
150
-		public ?array $field_head = array();
151
-
152
-		/**
153
-		 * Array of extensions by type used in the panel.
154
-		 *
155
-		 * @var null|array
156
-		 */
157
-		public ?array $extensions = array();
158
-
159
-		/**
160
-		 * Array of sections and fields arrays.
161
-		 *
162
-		 * @var null|array
163
-		 */
164
-		public ?array $sections = array();
165
-
166
-		/**
167
-		 * Array of generated errors from the panel for localization.
168
-		 *
169
-		 * @var null|array
170
-		 */
171
-		public ?array $errors = array();
172
-
173
-		/**
174
-		 * Array of generated warnings from the panel for localization.
175
-		 *
176
-		 * @var null|array
177
-		 */
178
-		public ?array $warnings = array();
179
-
180
-		/**
181
-		 * Array of generated sanitize notices from the panel for localization.
182
-		 *
183
-		 * @var null|array
184
-		 */
185
-		public ?array $sanitize = array();
186
-
187
-		/**
188
-		 * Array of current option values.
189
-		 *
190
-		 * @var null|array
191
-		 */
192
-		public ?array $options = array();
193
-
194
-		/**
195
-		 * Array of option defaults.
196
-		 *
197
-		 * @var null|array
198
-		 */
199
-		public ?array $options_defaults = null;
200
-
201
-		/**
202
-		 * Array of fields set to trigger the compiler hook.
203
-		 *
204
-		 * @var null|array
205
-		 */
206
-		public ?array $compiler_fields = array();
207
-
208
-		/**
209
-		 * Array of fields with CSS output selectors.
210
-		 *
211
-		 * @var null|array
212
-		 */
213
-		public ?array $output = array();
214
-
215
-		/**
216
-		 * Autogenerated CSS appended to the header (snake case maintained for backward compatibility).
217
-		 *
218
-		 * @var null|string
219
-		 */
220
-		public ?string $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
221
-
222
-		/**
223
-		 * Autogenerated variables appended to dynamic output.
224
-		 *
225
-		 * @var null|array
226
-		 */
227
-		public ?array $output_variables = array();
228
-
229
-		/**
230
-		 * CSS sent to the compiler hook (snake case maintained for backward compatibility).
231
-		 *
232
-		 * @var null|string
233
-		 */
234
-		public ?string $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
235
-
236
-		/**
237
-		 * Array of global arguments.
238
-		 *
239
-		 * @var array|null
240
-		 */
241
-		public ?array $args = array();
242
-
243
-		/**
244
-		 * Used in customizer hooks.
245
-		 *
246
-		 * @var null|string
247
-		 */
248
-		public ?string $old_opt_name = '';
249
-
250
-		/**
251
-		 * Pointer to the Redux_Options_Default class.
252
-		 *
253
-		 * @var null|Redux_Options_Defaults
254
-		 */
255
-		public ?Redux_Options_Defaults $options_defaults_class = null;
256
-
257
-		/**
258
-		 * Pointer to the Redux_Options class.
259
-		 *
260
-		 * @var null|Redux_Options_Constructor
261
-		 */
262
-		public ?Redux_Options_Constructor $options_class = null;
263
-
264
-		/**
265
-		 * Pointer to the Redux_Required class
266
-		 *
267
-		 * @var null|Redux_Required
268
-		 */
269
-		public ?Redux_Required $required_class = null;
270
-
271
-		/**
272
-		 * Pointer to the Redux_Output class.
273
-		 *
274
-		 * @var null|Redux_Output
275
-		 */
276
-		public ?Redux_Output $output_class = null;
277
-
278
-		/**
279
-		 * Pointer to the Redux_Page_Render class.
280
-		 *
281
-		 * @var null|Redux_Page_Render
282
-		 */
283
-		public ?Redux_Page_Render $render_class = null;
284
-
285
-		/**
286
-		 * Pointer to the Redux_Enqueue class.
287
-		 *
288
-		 * @var null|Redux_Enqueue
289
-		 */
290
-		public ?Redux_Enqueue $enqueue_class = null;
291
-
292
-		/**
293
-		 * Pointer to the Redux_Transients class.
294
-		 *
295
-		 * @var null|Redux_Transients
296
-		 */
297
-		public ?Redux_Transients $transient_class = null;
298
-
299
-		/**
300
-		 * Pointer to the Redux_wordPress_Data class.
301
-		 *
302
-		 * @var null|Redux_WordPress_Data
303
-		 */
304
-		public ?Redux_WordPress_Data $wordpress_data = null;
305
-
306
-		/**
307
-		 * Pointer to the Redux_Validation class.
308
-		 *
309
-		 * @var null|Redux_Validation
310
-		 */
311
-		public ?Redux_Validation $validate_class = null;
312
-
313
-		/**
314
-		 * Pointer to the Redux_Sanitize class.
315
-		 *
316
-		 * @var null|Redux_Sanitize
317
-		 */
318
-		public ?Redux_Sanitize $sanitize_class = null;
319
-
320
-		/**
321
-		 * Pointer to the Redux_Args class.
322
-		 *
323
-		 * @var null|Redux_Args
324
-		 */
325
-		public ?Redux_Args $args_class = null;
326
-
327
-		/**
328
-		 * Array of active transients used by Redux.
329
-		 *
330
-		 * @var null|mixed
331
-		 */
332
-		public $transients = array();
333
-
334
-		/**
335
-		 * Array of localized repeater data.
336
-		 *
337
-		 * @var null|array
338
-		 */
339
-		public ?array $repeater_data = array();
340
-
341
-		/**
342
-		 * Array of localized data.
343
-		 *
344
-		 * @var null|array
345
-		 */
346
-		public ?array $localize_data = array();
347
-
348
-		/**
349
-		 * Array of checked transients used by Redux.
350
-		 *
351
-		 * @var null|mixed
352
-		 */
353
-		public $transients_check = array();
354
-
355
-		/**
356
-		 * Never save to DB flag for metaboxes.
357
-		 *
358
-		 * @var bool
359
-		 */
360
-		public bool $never_save_to_db;
361
-
362
-		/**
363
-		 * File system object used for I/O file operations.  Done the WordPress way.
364
-		 *
365
-		 * @var null|object
366
-		 *
367
-		 * @deprecated 4.5.1
368
-		 */
369
-		public ?object $filesystem;
370
-
371
-		/**
372
-		 * Deprecated shim for v3 templates.
373
-		 *
374
-		 * @var null|array
375
-		 *
376
-		 * @deprecated 4.0.0
377
-		 */
378
-		public ?array $hidden_perm_sections = array();
379
-
380
-		/**
381
-		 * Deprecated shim for v3 as plugin check.
382
-		 *
383
-		 * @var bool
384
-		 *
385
-		 * @deprecated 4.0.0
386
-		 */
387
-		public static bool $_as_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
388
-
389
-		/**
390
-		 * Deprecated shim for v3 as plugin check.
391
-		 *
392
-		 * @var bool
393
-		 *
394
-		 * @deprecated 4.0.0
395
-		 */
396
-		public static bool $_is_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
397
-
398
-		/**
399
-		 * Cloning is forbidden.
400
-		 *
401
-		 * @since 4.0.0
402
-		 */
403
-		public function __clone() {
404
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; eh?', 'redux-framework' ), '4.0' );
405
-		}
406
-
407
-		/**
408
-		 * Un-serializing instances of this class are forbidden.
409
-		 *
410
-		 * @since 4.0.0
411
-		 */
412
-		public function __wakeup() {
413
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; eh?', 'redux-framework' ), '4.0' );
414
-		}
415
-
416
-		/**
417
-		 * Add a deprecating notice for all the old themes that still use this method..
418
-		 *
419
-		 * @param object $filesystem Filesystem object.
420
-		 *
421
-		 * @since 4.0.0
422
-		 */
423
-		private function deprecated_filesystem( $filesystem ) {
424
-			//_deprecated_function( esc_html__( 'The global variable "$filesystem" of the ReduxFramework object', 'redux-framework' ), '4.5.1', 'Redux_Core::$filesystem' );
425
-
426
-			return $filesystem;
427
-		}
428
-
429
-		/**
430
-		 * Class Constructor. Defines the args for the theme options class
431
-		 *
432
-		 * @param array $sections Panel sections.
433
-		 * @param array $args     Class constructor arguments.
434
-		 *
435
-		 * @throws ReflectionException Exception.
436
-		 * @since       1.0.0
437
-		 */
438
-		public function __construct( array $sections = array(), array $args = array() ) {
439
-			global $pagenow;
440
-
441
-			if ( Redux_Core::is_heartbeat() ) {
442
-				return;
443
-			}
444
-
445
-			$args['load_on_cron'] = $args['load_on_cron'] ?? false;
446
-
447
-			if ( false === $args['load_on_cron'] && 'wp-cron.php' === $pagenow ) {
448
-				return;
449
-			}
450
-
451
-			if ( empty( $args ) || ( empty( $args['opt_name'] ) ) ) {
452
-				return;
453
-			}
454
-
455
-			if ( ! isset( Redux::$init[ $args['opt_name'] ] ) ) {
456
-				// Let's go back to the Redux API instead of having it run directly.
457
-				Redux_Functions_Ex::record_caller( $args['opt_name'] );
458
-				Redux::set_args( $args['opt_name'], $args );
459
-				if ( ! empty( $sections ) ) {
460
-					Redux::set_sections( $args['opt_name'], $sections );
461
-				}
462
-				$sections = Redux::construct_sections( $args['opt_name'] );
463
-				$args     = Redux::construct_args( $args['opt_name'] );
464
-				Redux::set_defaults( $args['opt_name'] );
465
-				Redux::$init[ $args['opt_name'] ] = 1;
466
-			}
467
-
468
-			$args             = new Redux_Args( $this, $args );
469
-			$this->args_class = $args;
470
-			$this->args       = $args->get;
471
-
472
-			Redux_Core::core_construct( $this );
473
-
474
-			new Redux_Admin_Notices( $this );
475
-
476
-			if ( ! empty( $this->args['opt_name'] ) ) {
477
-				new Redux_Instances( $this );
478
-
479
-				Redux_Core::$filesystem = Redux_Filesystem::get_instance( $this );
480
-
481
-				$this->filesystem = $this->deprecated_filesystem( Redux_Core::$filesystem );
482
-
483
-				/**
484
-				 * Filter 'redux/options/{opt_name}/sections'
485
-				 *
486
-				 * @param  array $sections field option sections
487
-				 */
488
-
489
-				// phpcs:ignore WordPress.NamingConventions.ValidHookName
490
-				$this->sections = apply_filters( "redux/options/{$this->args['opt_name']}/sections", $sections );
491
-
492
-				/**
493
-				 * Construct hook
494
-				 * action 'redux/construct'
495
-				 *
496
-				 * @param object $this ReduxFramework
497
-				 */
498
-
499
-				// phpcs:ignore WordPress.NamingConventions.ValidHookName
500
-				do_action( 'redux/construct', $this );
501
-
502
-				// Internationalization.
503
-				new Redux_I18n( $this, __FILE__ );
504
-
505
-				$this->required_class  = new Redux_Required( $this );
506
-				$this->transient_class = new Redux_Transients( $this );
507
-				$this->wordpress_data  = new Redux_WordPress_Data( $this );
508
-				$this->validate_class  = new Redux_Validation( $this );
509
-				$this->sanitize_class  = new Redux_Sanitize( $this );
510
-
511
-				// Register extra extensions.
512
-				new Redux_Extensions( $this );
513
-
514
-				// Grab database values.
515
-				$this->options_defaults_class = new Redux_Options_Defaults();
516
-				$this->options_class          = new Redux_Options_Constructor( $this );
517
-				$this->options_class->get();
518
-
519
-				$this->output_class  = new Redux_Output( $this );
520
-				$this->render_class  = new Redux_Page_Render( $this );
521
-				$this->enqueue_class = new Redux_Enqueue( $this );
522
-
523
-				new Redux_AJAX_Save( $this );
524
-				new Redux_AJAX_Typography( $this );
525
-				new Redux_AJAX_Select2( $this );
526
-			}
527
-
528
-			/**
529
-			 * Loaded hook
530
-			 * action 'redux/loaded'
531
-			 *
532
-			 * @param  object $this ReduxFramework
533
-			 */
534
-
535
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
536
-			do_action( 'redux/loaded', $this );
537
-		}
538
-
539
-		/**
540
-		 * Begin backward compatibility shims for Redux v3 configs and extensions.
541
-		 */
542
-
543
-		/**
544
-		 * SHIM: _register_settings
545
-		 *
546
-		 * @deprecated 4.0.0
547
-		 */
548
-		public function _register_settings() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
549
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->register()' );
550
-
551
-			$this->options_class->register();
552
-		}
553
-
554
-		/**
555
-		 * SHIM: _field_input
556
-		 *
557
-		 * @param array        $field Field array.
558
-		 * @param string|array $v     Field values.
559
-		 *
560
-		 * @deprecated 4.0.0
561
-		 */
562
-		public function _field_input( array $field, $v = null ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
563
-			_deprecated_function( __FUNCTION__, '4.0.0', 'render_class->field_input( $field, $value )' );
564
-
565
-			$this->render_class->field_input( $field, $v );
566
-		}
567
-
568
-		/**
569
-		 * SHIM: field_default_values
570
-		 *
571
-		 * @param array $field Field array.
572
-		 *
573
-		 * @deprecated 4.0.0
574
-		 */
575
-		public function field_default_values( array $field ) {
576
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_defaults_class->field_default_values( $opt_name, $field )' );
577
-
578
-			$this->options_defaults_class->field_default_values( '', $field );
579
-		}
580
-
581
-		/**
582
-		 * SHIM: set_options
583
-		 *
584
-		 * @param string|array $value Option values.
585
-		 *
586
-		 * @deprecated 4.0.0
587
-		 */
588
-		public function set_options( $value ) {
589
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->set( $value )' );
590
-
591
-			$this->options_class->set( $value );
592
-		}
593
-
594
-		/**
595
-		 * SHIM: get_options
596
-		 *
597
-		 * @deprecated 4.0.0
598
-		 */
599
-		public function get_options() {
600
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get()' );
601
-
602
-			$this->options_class->get();
603
-		}
604
-
605
-		/**
606
-		 * SHIM: _default_values
607
-		 *
608
-		 * @return array
609
-		 *
610
-		 * @deprecated 4.0.0
611
-		 */
612
-		public function _default_values() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
613
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->default_values()' );
614
-
615
-			return $this->default_values();
616
-		}
617
-
618
-		/**
619
-		 * Get default values.
620
-		 *
621
-		 * @return array
622
-		 */
623
-		public function default_values() {
624
-			if ( ! isset( $this->options_class ) ) {
625
-				$this->options_defaults_class = new Redux_Options_Defaults();
626
-				$this->options_class          = new Redux_Options_Constructor( $this );
627
-			}
628
-
629
-			return $this->options_class->default_values();
630
-		}
631
-
632
-		/**
633
-		 * SHIM: check_dependencies
634
-		 *
635
-		 * @param array $field Field array.
636
-		 *
637
-		 * @deprecated 4.0.0
638
-		 */
639
-		public function check_dependencies( array $field ) {
640
-			_deprecated_function( __FUNCTION__, '4.0.0', 'required_class->check_dependencies( $field )' );
641
-
642
-			$this->required_class->check_dependencies( $field );
643
-		}
644
-
645
-		/**
646
-		 * SHIM: _enqueue_output
647
-		 *
648
-		 * @throws ReflectionException Exception.
649
-		 *
650
-		 * @deprecated 4.0.0
651
-		 */
652
-		public function _enqueue_output() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
653
-			_deprecated_function( __FUNCTION__, '4.0.0', 'output_class->enqueue()' );
654
-
655
-			if ( empty( $this->output_class ) ) {
656
-				$obj          = new ReduxFramework( $this->sections, $this->args );
657
-				$obj->options = $this->options;
658
-				$obj->output_class->enqueue();
659
-				$this->outputCSS = $obj->outputCSS; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
660
-			} else {
661
-				$this->output_class->enqueue();
662
-			}
663
-		}
664
-
665
-		/**
666
-		 * SHIM: _enqueue
667
-		 *
668
-		 * @deprecated 4.0.0
669
-		 */
670
-		public function _enqueue() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
671
-			_deprecated_function( __FUNCTION__, '4.0.0', 'enqueue_class->init()' );
672
-
673
-			$this->enqueue_class->init();
674
-		}
675
-
676
-		/**
677
-		 * _enqueue replacement.
678
-		 *
679
-		 * @return void
680
-		 */
681
-		public function init_enqueue() {
682
-			$this->enqueue_class->init();
683
-		}
684
-
685
-		/**
686
-		 * SHIM: generate_panel
687
-		 *
688
-		 * @since       1.0.0
689
-		 * @access      public
690
-		 * @return      void
691
-		 *
692
-		 * @deprecated 4.0.0
693
-		 */
694
-		public function generate_panel() {
695
-			_deprecated_function( __FUNCTION__, '4.0.0', 'render_class->generate_panel()' );
696
-
697
-			$this->render_class->generate_panel();
698
-		}
699
-
700
-		/**
701
-		 * SHIM: get_default_values
702
-		 *
703
-		 * @param string $key       Key value.
704
-		 * @param bool   $array_key Flag to determine array status.
705
-		 *
706
-		 * @return array
707
-		 *
708
-		 * @deprecated 4.0.0
709
-		 */
710
-		public function get_default_values( $key, $array_key = false ) {
711
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' );
712
-
713
-			if ( ! isset( $this->options_class ) ) {
714
-				$this->options_defaults_class = new Redux_Options_Defaults();
715
-				$this->options_class          = new Redux_Options_Constructor( $this );
716
-			}
717
-
718
-			return $this->options_class->get_default_value( $key, $array_key );
719
-		}
720
-
721
-		/**
722
-		 * SHIM: get_default_value
723
-		 *
724
-		 * @param string $key       Key value.
725
-		 * @param bool   $array_key Flag to determine array status.
726
-		 *
727
-		 * @return array
728
-		 *
729
-		 * @deprecated 4.0.0
730
-		 */
731
-		public function get_default_value( $key, $array_key = false ) {
732
-			_deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' );
733
-
734
-			if ( ! isset( $this->options_class ) ) {
735
-				$this->options_defaults_class = new Redux_Options_Defaults();
736
-				$this->options_class          = new Redux_Options_Constructor( $this );
737
-			}
738
-
739
-			return $this->options_class->get_default_value( $key, $array_key );
740
-		}
741
-
742
-		/**
743
-		 * SHIM: get_wordpress_data
744
-		 *
745
-		 * @param bool         $type data type.
746
-		 * @param array        $args args to pass to WordPress API.
747
-		 * @param string|array $current_value Current value.
748
-		 *
749
-		 * @return array|mixed|string|void
750
-		 *
751
-		 * @deprecated 4.0.0
752
-		 */
753
-		public function get_wordpress_data( $type = false, $args = array(), $current_value = null ) {
754
-			_deprecated_function( __FUNCTION__, '4.0.0', 'wordpress_data->get( $type, $args, $opt_name, $value )' );
755
-
756
-			return $this->wordpress_data->get( $type, $args, $this->args['opt_name'], $current_value );
757
-		}
758
-
759
-		/**
760
-		 * SHIM: _validate_values
761
-		 *
762
-		 * @param array $plugin_options Current panel options.
763
-		 * @param array $options        Options to validate.
764
-		 * @param array $sections       Sections array.
765
-		 *
766
-		 * @return array
767
-		 *
768
-		 * @deprecated 4.0.0
769
-		 */
770
-		public function _validate_values( $plugin_options, $options, $sections ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
771
-			_deprecated_function( __FUNCTION__, '4.0.0', 'validate_class->validate( $plugin_options, $options, $sections )' );
772
-
773
-			if ( ! isset( $this->validate_class ) ) {
774
-				$this->validate_class = new Redux_Validation( $this );
775
-			}
776
-				return $this->validate_class->validate( $plugin_options, $options, $sections );
777
-		}
778
-
779
-		/**
780
-		 * SHIM: set_transients
781
-		 *
782
-		 * @return void
783
-		 *
784
-		 * @deprecated 4.0.0
785
-		 */
786
-		public function set_transients() {
787
-			_deprecated_function( __FUNCTION__, '4.0.0', 'Please update the extension that uses this deprecated function.' );
788
-		}
789
-
790
-		/**
791
-		 * SHIM: section_menu
792
-		 *
793
-		 * @param int    $k        Array Key.
794
-		 * @param array  $section  Section array.
795
-		 * @param string $suffix   Unique string.
796
-		 * @param array  $sections Section array.
797
-		 *
798
-		 * @return string
799
-		 *
800
-		 * @deprecated 4.0.0
801
-		 */
802
-		public function section_menu( $k, $section, $suffix = '', $sections = array() ) {
803
-			_deprecated_function( __FUNCTION__, '4.0.0', 'render_class->section_menu( $index, $section, $suffix, $sections )' );
804
-
805
-			return $this->render_class->section_menu( $k, $section, $suffix, $sections );
806
-		}
807
-
808
-		/**
809
-		 * SHIM: get_header_html
810
-		 *
811
-		 * @param array $field Field array.
812
-		 *
813
-		 * @return string
814
-		 *
815
-		 * @deprecated 4.0.0
816
-		 */
817
-		public function get_header_html( $field ) {
818
-			_deprecated_function( __FUNCTION__, '4.0.0', 'render_class->get_header_html( $field )' );
819
-
820
-			return $this->render_class->get_header_html( $field );
821
-		}
822
-
823
-		/**
824
-		 * SHIM: current_user_can
825
-		 *
826
-		 * @param string $permission User permission.
827
-		 *
828
-		 * @return bool
829
-		 *
830
-		 * @deprecated 4.0.0
831
-		 */
832
-		public function current_user_can( $permission ) {
833
-			_deprecated_function( __FUNCTION__, '4.0.0', 'Redux_Helpers::current_user_can' );
834
-
835
-			return Redux_Helpers::current_user_can( $permission );
836
-		}
837
-
838
-		/**
839
-		 * End backward compatibility shims for Redux v3 configs and extensions.
840
-		 */
841
-
842
-		/**
843
-		 * Pointer to the ReduxFramework instance.
844
-		 *
845
-		 * @return ReduxFramework|null
846
-		 */
847
-		public function get_instance(): ?ReduxFramework {
848
-			return self::$instance;
849
-		}
850
-
851
-		/**
852
-		 * →get(); This is used to return and option value from the option array
853
-		 *
854
-		 * @since       1.0.0
855
-		 * @access      public
856
-		 *
857
-		 * @param       string $opt_name The option name to return.
858
-		 * @param       mixed  $defaults (null) The value to return if an option isn't set.
859
-		 *
860
-		 * @return      mixed
861
-		 */
862
-		public function get( string $opt_name, $defaults = null ) {
863
-			return ( ! empty( $this->options[ $opt_name ] ) ) ? $this->options[ $opt_name ] : $this->options_class->get_default( $opt_name, $defaults );
864
-		}
865
-
866
-		/**
867
-		 * →set(); This is used to set an arbitrary option in the option array
868
-		 *
869
-		 * @since       1.0.0
870
-		 * @access      public
871
-		 *
872
-		 * @param       string $opt_name The name of the option being added.
873
-		 * @param       mixed  $values   The value of the option being added.
874
-		 *
875
-		 * @return      void
876
-		 */
877
-		public function set( string $opt_name = '', $values = array() ) {
878
-			if ( ! empty( $opt_name ) && is_array( $values ) ) {
879
-				$this->options[ $opt_name ] = $values;
880
-				$this->options_class->set( $values );
881
-			}
882
-		}
883
-	}
884
-
885
-	ReduxFramework::init();
886
-
887
-	/**
888
-	 * Action 'redux/init'
889
-	 */
890
-	do_action( 'redux/init' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
42
+    /**
43
+     * Main ReduxFramework class
44
+     *
45
+     * @since       1.0.0
46
+     */
47
+    class ReduxFramework {
48
+
49
+        /**
50
+         * ReduxFramework instance storage.
51
+         *
52
+         * @var null|ReduxFramework
53
+         * @access public
54
+         */
55
+        public static ?ReduxFramework $instance;
56
+
57
+        /**
58
+         * Redux current version.
59
+         *
60
+         * @var string
61
+         * @access public
62
+         *
63
+         * @deprecated 4.0.0
64
+         */
65
+        public static string $_version = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
66
+
67
+        /**
68
+         * Absolute directory of the Redux instance.
69
+         *
70
+         * @var string
71
+         * @access public
72
+         *
73
+         * @deprecated 4.0.0
74
+         */
75
+        public static string $_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
76
+
77
+        /**
78
+         * Full URL of the Redux instance.
79
+         *
80
+         * @var string
81
+         * @access public
82
+         *
83
+         * @deprecated 4.0.0
84
+         */
85
+        public static string $_url = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
86
+
87
+        /**
88
+         * Current WordPress upload directory.
89
+         *
90
+         * @var string
91
+         * @access public
92
+         *
93
+         * @deprecated 4.0.0
94
+         */
95
+        public static string $_upload_dir = ''; // phpcs:ignore PSR2.Classes.PropertyDeclaration
96
+
97
+        /**
98
+         * Current WordPress upload URL
99
+         *
100
+         * @var string
101
+         * @access public
102
+         *
103
+         * @deprecated 4.0.0
104
+         */
105
+        public static string $_upload_url; // phpcs:ignore PSR2.Classes.PropertyDeclaration
106
+
107
+        /**
108
+         * Init
109
+         *
110
+         * Backward compatibility for previous versions of Redux.
111
+         */
112
+        public static function init() {
113
+
114
+            // Backward compatibility for extensions.
115
+            self::$_version    = Redux_Core::$version;
116
+            self::$_dir        = Redux_Core::$dir;
117
+            self::$_url        = Redux_Core::$url;
118
+            self::$_upload_dir = Redux_Core::$upload_dir;
119
+            self::$_upload_url = Redux_Core::$upload_url;
120
+            self::$_as_plugin  = Redux_Core::$as_plugin;
121
+            self::$_is_plugin  = Redux_Core::$is_plugin;
122
+        }
123
+
124
+        /**
125
+         * Array of field arrays.
126
+         *
127
+         * @var null|array
128
+         */
129
+        public ?array $fields = array();
130
+
131
+        /**
132
+         * Array of field sections.
133
+         *
134
+         * @var null|array
135
+         */
136
+        public ?array $field_sections = array();
137
+
138
+        /**
139
+         * Array of field types.
140
+         *
141
+         * @var null|array
142
+         */
143
+        public ?array $field_types = array();
144
+
145
+        /**
146
+         * Array of field heads.
147
+         *
148
+         * @var null|array
149
+         */
150
+        public ?array $field_head = array();
151
+
152
+        /**
153
+         * Array of extensions by type used in the panel.
154
+         *
155
+         * @var null|array
156
+         */
157
+        public ?array $extensions = array();
158
+
159
+        /**
160
+         * Array of sections and fields arrays.
161
+         *
162
+         * @var null|array
163
+         */
164
+        public ?array $sections = array();
165
+
166
+        /**
167
+         * Array of generated errors from the panel for localization.
168
+         *
169
+         * @var null|array
170
+         */
171
+        public ?array $errors = array();
172
+
173
+        /**
174
+         * Array of generated warnings from the panel for localization.
175
+         *
176
+         * @var null|array
177
+         */
178
+        public ?array $warnings = array();
179
+
180
+        /**
181
+         * Array of generated sanitize notices from the panel for localization.
182
+         *
183
+         * @var null|array
184
+         */
185
+        public ?array $sanitize = array();
186
+
187
+        /**
188
+         * Array of current option values.
189
+         *
190
+         * @var null|array
191
+         */
192
+        public ?array $options = array();
193
+
194
+        /**
195
+         * Array of option defaults.
196
+         *
197
+         * @var null|array
198
+         */
199
+        public ?array $options_defaults = null;
200
+
201
+        /**
202
+         * Array of fields set to trigger the compiler hook.
203
+         *
204
+         * @var null|array
205
+         */
206
+        public ?array $compiler_fields = array();
207
+
208
+        /**
209
+         * Array of fields with CSS output selectors.
210
+         *
211
+         * @var null|array
212
+         */
213
+        public ?array $output = array();
214
+
215
+        /**
216
+         * Autogenerated CSS appended to the header (snake case maintained for backward compatibility).
217
+         *
218
+         * @var null|string
219
+         */
220
+        public ?string $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
221
+
222
+        /**
223
+         * Autogenerated variables appended to dynamic output.
224
+         *
225
+         * @var null|array
226
+         */
227
+        public ?array $output_variables = array();
228
+
229
+        /**
230
+         * CSS sent to the compiler hook (snake case maintained for backward compatibility).
231
+         *
232
+         * @var null|string
233
+         */
234
+        public ?string $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
235
+
236
+        /**
237
+         * Array of global arguments.
238
+         *
239
+         * @var array|null
240
+         */
241
+        public ?array $args = array();
242
+
243
+        /**
244
+         * Used in customizer hooks.
245
+         *
246
+         * @var null|string
247
+         */
248
+        public ?string $old_opt_name = '';
249
+
250
+        /**
251
+         * Pointer to the Redux_Options_Default class.
252
+         *
253
+         * @var null|Redux_Options_Defaults
254
+         */
255
+        public ?Redux_Options_Defaults $options_defaults_class = null;
256
+
257
+        /**
258
+         * Pointer to the Redux_Options class.
259
+         *
260
+         * @var null|Redux_Options_Constructor
261
+         */
262
+        public ?Redux_Options_Constructor $options_class = null;
263
+
264
+        /**
265
+         * Pointer to the Redux_Required class
266
+         *
267
+         * @var null|Redux_Required
268
+         */
269
+        public ?Redux_Required $required_class = null;
270
+
271
+        /**
272
+         * Pointer to the Redux_Output class.
273
+         *
274
+         * @var null|Redux_Output
275
+         */
276
+        public ?Redux_Output $output_class = null;
277
+
278
+        /**
279
+         * Pointer to the Redux_Page_Render class.
280
+         *
281
+         * @var null|Redux_Page_Render
282
+         */
283
+        public ?Redux_Page_Render $render_class = null;
284
+
285
+        /**
286
+         * Pointer to the Redux_Enqueue class.
287
+         *
288
+         * @var null|Redux_Enqueue
289
+         */
290
+        public ?Redux_Enqueue $enqueue_class = null;
291
+
292
+        /**
293
+         * Pointer to the Redux_Transients class.
294
+         *
295
+         * @var null|Redux_Transients
296
+         */
297
+        public ?Redux_Transients $transient_class = null;
298
+
299
+        /**
300
+         * Pointer to the Redux_wordPress_Data class.
301
+         *
302
+         * @var null|Redux_WordPress_Data
303
+         */
304
+        public ?Redux_WordPress_Data $wordpress_data = null;
305
+
306
+        /**
307
+         * Pointer to the Redux_Validation class.
308
+         *
309
+         * @var null|Redux_Validation
310
+         */
311
+        public ?Redux_Validation $validate_class = null;
312
+
313
+        /**
314
+         * Pointer to the Redux_Sanitize class.
315
+         *
316
+         * @var null|Redux_Sanitize
317
+         */
318
+        public ?Redux_Sanitize $sanitize_class = null;
319
+
320
+        /**
321
+         * Pointer to the Redux_Args class.
322
+         *
323
+         * @var null|Redux_Args
324
+         */
325
+        public ?Redux_Args $args_class = null;
326
+
327
+        /**
328
+         * Array of active transients used by Redux.
329
+         *
330
+         * @var null|mixed
331
+         */
332
+        public $transients = array();
333
+
334
+        /**
335
+         * Array of localized repeater data.
336
+         *
337
+         * @var null|array
338
+         */
339
+        public ?array $repeater_data = array();
340
+
341
+        /**
342
+         * Array of localized data.
343
+         *
344
+         * @var null|array
345
+         */
346
+        public ?array $localize_data = array();
347
+
348
+        /**
349
+         * Array of checked transients used by Redux.
350
+         *
351
+         * @var null|mixed
352
+         */
353
+        public $transients_check = array();
354
+
355
+        /**
356
+         * Never save to DB flag for metaboxes.
357
+         *
358
+         * @var bool
359
+         */
360
+        public bool $never_save_to_db;
361
+
362
+        /**
363
+         * File system object used for I/O file operations.  Done the WordPress way.
364
+         *
365
+         * @var null|object
366
+         *
367
+         * @deprecated 4.5.1
368
+         */
369
+        public ?object $filesystem;
370
+
371
+        /**
372
+         * Deprecated shim for v3 templates.
373
+         *
374
+         * @var null|array
375
+         *
376
+         * @deprecated 4.0.0
377
+         */
378
+        public ?array $hidden_perm_sections = array();
379
+
380
+        /**
381
+         * Deprecated shim for v3 as plugin check.
382
+         *
383
+         * @var bool
384
+         *
385
+         * @deprecated 4.0.0
386
+         */
387
+        public static bool $_as_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
388
+
389
+        /**
390
+         * Deprecated shim for v3 as plugin check.
391
+         *
392
+         * @var bool
393
+         *
394
+         * @deprecated 4.0.0
395
+         */
396
+        public static bool $_is_plugin = false;  // phpcs:ignore PSR2.Classes.PropertyDeclaration
397
+
398
+        /**
399
+         * Cloning is forbidden.
400
+         *
401
+         * @since 4.0.0
402
+         */
403
+        public function __clone() {
404
+            _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; eh?', 'redux-framework' ), '4.0' );
405
+        }
406
+
407
+        /**
408
+         * Un-serializing instances of this class are forbidden.
409
+         *
410
+         * @since 4.0.0
411
+         */
412
+        public function __wakeup() {
413
+            _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; eh?', 'redux-framework' ), '4.0' );
414
+        }
415
+
416
+        /**
417
+         * Add a deprecating notice for all the old themes that still use this method..
418
+         *
419
+         * @param object $filesystem Filesystem object.
420
+         *
421
+         * @since 4.0.0
422
+         */
423
+        private function deprecated_filesystem( $filesystem ) {
424
+            //_deprecated_function( esc_html__( 'The global variable "$filesystem" of the ReduxFramework object', 'redux-framework' ), '4.5.1', 'Redux_Core::$filesystem' );
425
+
426
+            return $filesystem;
427
+        }
428
+
429
+        /**
430
+         * Class Constructor. Defines the args for the theme options class
431
+         *
432
+         * @param array $sections Panel sections.
433
+         * @param array $args     Class constructor arguments.
434
+         *
435
+         * @throws ReflectionException Exception.
436
+         * @since       1.0.0
437
+         */
438
+        public function __construct( array $sections = array(), array $args = array() ) {
439
+            global $pagenow;
440
+
441
+            if ( Redux_Core::is_heartbeat() ) {
442
+                return;
443
+            }
444
+
445
+            $args['load_on_cron'] = $args['load_on_cron'] ?? false;
446
+
447
+            if ( false === $args['load_on_cron'] && 'wp-cron.php' === $pagenow ) {
448
+                return;
449
+            }
450
+
451
+            if ( empty( $args ) || ( empty( $args['opt_name'] ) ) ) {
452
+                return;
453
+            }
454
+
455
+            if ( ! isset( Redux::$init[ $args['opt_name'] ] ) ) {
456
+                // Let's go back to the Redux API instead of having it run directly.
457
+                Redux_Functions_Ex::record_caller( $args['opt_name'] );
458
+                Redux::set_args( $args['opt_name'], $args );
459
+                if ( ! empty( $sections ) ) {
460
+                    Redux::set_sections( $args['opt_name'], $sections );
461
+                }
462
+                $sections = Redux::construct_sections( $args['opt_name'] );
463
+                $args     = Redux::construct_args( $args['opt_name'] );
464
+                Redux::set_defaults( $args['opt_name'] );
465
+                Redux::$init[ $args['opt_name'] ] = 1;
466
+            }
467
+
468
+            $args             = new Redux_Args( $this, $args );
469
+            $this->args_class = $args;
470
+            $this->args       = $args->get;
471
+
472
+            Redux_Core::core_construct( $this );
473
+
474
+            new Redux_Admin_Notices( $this );
475
+
476
+            if ( ! empty( $this->args['opt_name'] ) ) {
477
+                new Redux_Instances( $this );
478
+
479
+                Redux_Core::$filesystem = Redux_Filesystem::get_instance( $this );
480
+
481
+                $this->filesystem = $this->deprecated_filesystem( Redux_Core::$filesystem );
482
+
483
+                /**
484
+                 * Filter 'redux/options/{opt_name}/sections'
485
+                 *
486
+                 * @param  array $sections field option sections
487
+                 */
488
+
489
+                // phpcs:ignore WordPress.NamingConventions.ValidHookName
490
+                $this->sections = apply_filters( "redux/options/{$this->args['opt_name']}/sections", $sections );
491
+
492
+                /**
493
+                 * Construct hook
494
+                 * action 'redux/construct'
495
+                 *
496
+                 * @param object $this ReduxFramework
497
+                 */
498
+
499
+                // phpcs:ignore WordPress.NamingConventions.ValidHookName
500
+                do_action( 'redux/construct', $this );
501
+
502
+                // Internationalization.
503
+                new Redux_I18n( $this, __FILE__ );
504
+
505
+                $this->required_class  = new Redux_Required( $this );
506
+                $this->transient_class = new Redux_Transients( $this );
507
+                $this->wordpress_data  = new Redux_WordPress_Data( $this );
508
+                $this->validate_class  = new Redux_Validation( $this );
509
+                $this->sanitize_class  = new Redux_Sanitize( $this );
510
+
511
+                // Register extra extensions.
512
+                new Redux_Extensions( $this );
513
+
514
+                // Grab database values.
515
+                $this->options_defaults_class = new Redux_Options_Defaults();
516
+                $this->options_class          = new Redux_Options_Constructor( $this );
517
+                $this->options_class->get();
518
+
519
+                $this->output_class  = new Redux_Output( $this );
520
+                $this->render_class  = new Redux_Page_Render( $this );
521
+                $this->enqueue_class = new Redux_Enqueue( $this );
522
+
523
+                new Redux_AJAX_Save( $this );
524
+                new Redux_AJAX_Typography( $this );
525
+                new Redux_AJAX_Select2( $this );
526
+            }
527
+
528
+            /**
529
+             * Loaded hook
530
+             * action 'redux/loaded'
531
+             *
532
+             * @param  object $this ReduxFramework
533
+             */
534
+
535
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
536
+            do_action( 'redux/loaded', $this );
537
+        }
538
+
539
+        /**
540
+         * Begin backward compatibility shims for Redux v3 configs and extensions.
541
+         */
542
+
543
+        /**
544
+         * SHIM: _register_settings
545
+         *
546
+         * @deprecated 4.0.0
547
+         */
548
+        public function _register_settings() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
549
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->register()' );
550
+
551
+            $this->options_class->register();
552
+        }
553
+
554
+        /**
555
+         * SHIM: _field_input
556
+         *
557
+         * @param array        $field Field array.
558
+         * @param string|array $v     Field values.
559
+         *
560
+         * @deprecated 4.0.0
561
+         */
562
+        public function _field_input( array $field, $v = null ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
563
+            _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->field_input( $field, $value )' );
564
+
565
+            $this->render_class->field_input( $field, $v );
566
+        }
567
+
568
+        /**
569
+         * SHIM: field_default_values
570
+         *
571
+         * @param array $field Field array.
572
+         *
573
+         * @deprecated 4.0.0
574
+         */
575
+        public function field_default_values( array $field ) {
576
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_defaults_class->field_default_values( $opt_name, $field )' );
577
+
578
+            $this->options_defaults_class->field_default_values( '', $field );
579
+        }
580
+
581
+        /**
582
+         * SHIM: set_options
583
+         *
584
+         * @param string|array $value Option values.
585
+         *
586
+         * @deprecated 4.0.0
587
+         */
588
+        public function set_options( $value ) {
589
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->set( $value )' );
590
+
591
+            $this->options_class->set( $value );
592
+        }
593
+
594
+        /**
595
+         * SHIM: get_options
596
+         *
597
+         * @deprecated 4.0.0
598
+         */
599
+        public function get_options() {
600
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get()' );
601
+
602
+            $this->options_class->get();
603
+        }
604
+
605
+        /**
606
+         * SHIM: _default_values
607
+         *
608
+         * @return array
609
+         *
610
+         * @deprecated 4.0.0
611
+         */
612
+        public function _default_values() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
613
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->default_values()' );
614
+
615
+            return $this->default_values();
616
+        }
617
+
618
+        /**
619
+         * Get default values.
620
+         *
621
+         * @return array
622
+         */
623
+        public function default_values() {
624
+            if ( ! isset( $this->options_class ) ) {
625
+                $this->options_defaults_class = new Redux_Options_Defaults();
626
+                $this->options_class          = new Redux_Options_Constructor( $this );
627
+            }
628
+
629
+            return $this->options_class->default_values();
630
+        }
631
+
632
+        /**
633
+         * SHIM: check_dependencies
634
+         *
635
+         * @param array $field Field array.
636
+         *
637
+         * @deprecated 4.0.0
638
+         */
639
+        public function check_dependencies( array $field ) {
640
+            _deprecated_function( __FUNCTION__, '4.0.0', 'required_class->check_dependencies( $field )' );
641
+
642
+            $this->required_class->check_dependencies( $field );
643
+        }
644
+
645
+        /**
646
+         * SHIM: _enqueue_output
647
+         *
648
+         * @throws ReflectionException Exception.
649
+         *
650
+         * @deprecated 4.0.0
651
+         */
652
+        public function _enqueue_output() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
653
+            _deprecated_function( __FUNCTION__, '4.0.0', 'output_class->enqueue()' );
654
+
655
+            if ( empty( $this->output_class ) ) {
656
+                $obj          = new ReduxFramework( $this->sections, $this->args );
657
+                $obj->options = $this->options;
658
+                $obj->output_class->enqueue();
659
+                $this->outputCSS = $obj->outputCSS; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
660
+            } else {
661
+                $this->output_class->enqueue();
662
+            }
663
+        }
664
+
665
+        /**
666
+         * SHIM: _enqueue
667
+         *
668
+         * @deprecated 4.0.0
669
+         */
670
+        public function _enqueue() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
671
+            _deprecated_function( __FUNCTION__, '4.0.0', 'enqueue_class->init()' );
672
+
673
+            $this->enqueue_class->init();
674
+        }
675
+
676
+        /**
677
+         * _enqueue replacement.
678
+         *
679
+         * @return void
680
+         */
681
+        public function init_enqueue() {
682
+            $this->enqueue_class->init();
683
+        }
684
+
685
+        /**
686
+         * SHIM: generate_panel
687
+         *
688
+         * @since       1.0.0
689
+         * @access      public
690
+         * @return      void
691
+         *
692
+         * @deprecated 4.0.0
693
+         */
694
+        public function generate_panel() {
695
+            _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->generate_panel()' );
696
+
697
+            $this->render_class->generate_panel();
698
+        }
699
+
700
+        /**
701
+         * SHIM: get_default_values
702
+         *
703
+         * @param string $key       Key value.
704
+         * @param bool   $array_key Flag to determine array status.
705
+         *
706
+         * @return array
707
+         *
708
+         * @deprecated 4.0.0
709
+         */
710
+        public function get_default_values( $key, $array_key = false ) {
711
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' );
712
+
713
+            if ( ! isset( $this->options_class ) ) {
714
+                $this->options_defaults_class = new Redux_Options_Defaults();
715
+                $this->options_class          = new Redux_Options_Constructor( $this );
716
+            }
717
+
718
+            return $this->options_class->get_default_value( $key, $array_key );
719
+        }
720
+
721
+        /**
722
+         * SHIM: get_default_value
723
+         *
724
+         * @param string $key       Key value.
725
+         * @param bool   $array_key Flag to determine array status.
726
+         *
727
+         * @return array
728
+         *
729
+         * @deprecated 4.0.0
730
+         */
731
+        public function get_default_value( $key, $array_key = false ) {
732
+            _deprecated_function( __FUNCTION__, '4.0.0', 'options_class->get_default_value( $key, $array_key )' );
733
+
734
+            if ( ! isset( $this->options_class ) ) {
735
+                $this->options_defaults_class = new Redux_Options_Defaults();
736
+                $this->options_class          = new Redux_Options_Constructor( $this );
737
+            }
738
+
739
+            return $this->options_class->get_default_value( $key, $array_key );
740
+        }
741
+
742
+        /**
743
+         * SHIM: get_wordpress_data
744
+         *
745
+         * @param bool         $type data type.
746
+         * @param array        $args args to pass to WordPress API.
747
+         * @param string|array $current_value Current value.
748
+         *
749
+         * @return array|mixed|string|void
750
+         *
751
+         * @deprecated 4.0.0
752
+         */
753
+        public function get_wordpress_data( $type = false, $args = array(), $current_value = null ) {
754
+            _deprecated_function( __FUNCTION__, '4.0.0', 'wordpress_data->get( $type, $args, $opt_name, $value )' );
755
+
756
+            return $this->wordpress_data->get( $type, $args, $this->args['opt_name'], $current_value );
757
+        }
758
+
759
+        /**
760
+         * SHIM: _validate_values
761
+         *
762
+         * @param array $plugin_options Current panel options.
763
+         * @param array $options        Options to validate.
764
+         * @param array $sections       Sections array.
765
+         *
766
+         * @return array
767
+         *
768
+         * @deprecated 4.0.0
769
+         */
770
+        public function _validate_values( $plugin_options, $options, $sections ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
771
+            _deprecated_function( __FUNCTION__, '4.0.0', 'validate_class->validate( $plugin_options, $options, $sections )' );
772
+
773
+            if ( ! isset( $this->validate_class ) ) {
774
+                $this->validate_class = new Redux_Validation( $this );
775
+            }
776
+                return $this->validate_class->validate( $plugin_options, $options, $sections );
777
+        }
778
+
779
+        /**
780
+         * SHIM: set_transients
781
+         *
782
+         * @return void
783
+         *
784
+         * @deprecated 4.0.0
785
+         */
786
+        public function set_transients() {
787
+            _deprecated_function( __FUNCTION__, '4.0.0', 'Please update the extension that uses this deprecated function.' );
788
+        }
789
+
790
+        /**
791
+         * SHIM: section_menu
792
+         *
793
+         * @param int    $k        Array Key.
794
+         * @param array  $section  Section array.
795
+         * @param string $suffix   Unique string.
796
+         * @param array  $sections Section array.
797
+         *
798
+         * @return string
799
+         *
800
+         * @deprecated 4.0.0
801
+         */
802
+        public function section_menu( $k, $section, $suffix = '', $sections = array() ) {
803
+            _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->section_menu( $index, $section, $suffix, $sections )' );
804
+
805
+            return $this->render_class->section_menu( $k, $section, $suffix, $sections );
806
+        }
807
+
808
+        /**
809
+         * SHIM: get_header_html
810
+         *
811
+         * @param array $field Field array.
812
+         *
813
+         * @return string
814
+         *
815
+         * @deprecated 4.0.0
816
+         */
817
+        public function get_header_html( $field ) {
818
+            _deprecated_function( __FUNCTION__, '4.0.0', 'render_class->get_header_html( $field )' );
819
+
820
+            return $this->render_class->get_header_html( $field );
821
+        }
822
+
823
+        /**
824
+         * SHIM: current_user_can
825
+         *
826
+         * @param string $permission User permission.
827
+         *
828
+         * @return bool
829
+         *
830
+         * @deprecated 4.0.0
831
+         */
832
+        public function current_user_can( $permission ) {
833
+            _deprecated_function( __FUNCTION__, '4.0.0', 'Redux_Helpers::current_user_can' );
834
+
835
+            return Redux_Helpers::current_user_can( $permission );
836
+        }
837
+
838
+        /**
839
+         * End backward compatibility shims for Redux v3 configs and extensions.
840
+         */
841
+
842
+        /**
843
+         * Pointer to the ReduxFramework instance.
844
+         *
845
+         * @return ReduxFramework|null
846
+         */
847
+        public function get_instance(): ?ReduxFramework {
848
+            return self::$instance;
849
+        }
850
+
851
+        /**
852
+         * →get(); This is used to return and option value from the option array
853
+         *
854
+         * @since       1.0.0
855
+         * @access      public
856
+         *
857
+         * @param       string $opt_name The option name to return.
858
+         * @param       mixed  $defaults (null) The value to return if an option isn't set.
859
+         *
860
+         * @return      mixed
861
+         */
862
+        public function get( string $opt_name, $defaults = null ) {
863
+            return ( ! empty( $this->options[ $opt_name ] ) ) ? $this->options[ $opt_name ] : $this->options_class->get_default( $opt_name, $defaults );
864
+        }
865
+
866
+        /**
867
+         * →set(); This is used to set an arbitrary option in the option array
868
+         *
869
+         * @since       1.0.0
870
+         * @access      public
871
+         *
872
+         * @param       string $opt_name The name of the option being added.
873
+         * @param       mixed  $values   The value of the option being added.
874
+         *
875
+         * @return      void
876
+         */
877
+        public function set( string $opt_name = '', $values = array() ) {
878
+            if ( ! empty( $opt_name ) && is_array( $values ) ) {
879
+                $this->options[ $opt_name ] = $values;
880
+                $this->options_class->set( $values );
881
+            }
882
+        }
883
+    }
884
+
885
+    ReduxFramework::init();
886
+
887
+    /**
888
+     * Action 'redux/init'
889
+     */
890
+    do_action( 'redux/init' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
891 891
 }
Please login to merge, or discard this patch.
redux-core/inc/fields/ace_editor/class-redux-ace-editor.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@  discard block
 block discarded – undo
13 13
 // Don't duplicate me!
14 14
 if ( ! class_exists( 'Redux_Ace_Editor', false ) ) {
15 15
 
16
-	/**
17
-	 * Class Redux_Ace_Editor
18
-	 */
19
-	class Redux_Ace_Editor extends Redux_Field {
16
+    /**
17
+     * Class Redux_Ace_Editor
18
+     */
19
+    class Redux_Ace_Editor extends Redux_Field {
20 20
 
21
-		/**
22
-		 * Field Render Function.
23
-		 * Takes the vars and outputs the HTML for the field in the settings
24
-		 *
25
-		 * @since ReduxFramework 1.0.0
26
-		 */
27
-		public function render() {
28
-			if ( is_array( $this->value ) ) {
29
-				$this->value = '';
30
-			} else {
31
-				$this->value = trim( $this->value );
32
-			}
21
+        /**
22
+         * Field Render Function.
23
+         * Takes the vars and outputs the HTML for the field in the settings
24
+         *
25
+         * @since ReduxFramework 1.0.0
26
+         */
27
+        public function render() {
28
+            if ( is_array( $this->value ) ) {
29
+                $this->value = '';
30
+            } else {
31
+                $this->value = trim( $this->value );
32
+            }
33 33
 
34
-			if ( ! empty( $this->field['options'] ) ) {
35
-				$this->field['args'] = $this->field['options'];
36
-				unset( $this->field['options'] );
37
-			}
34
+            if ( ! empty( $this->field['options'] ) ) {
35
+                $this->field['args'] = $this->field['options'];
36
+                unset( $this->field['options'] );
37
+            }
38 38
 
39
-			if ( ! isset( $this->field['mode'] ) ) {
40
-				$this->field['mode'] = 'javascript';
41
-			}
42
-			if ( ! isset( $this->field['theme'] ) ) {
43
-				$this->field['theme'] = 'monokai';
44
-			}
39
+            if ( ! isset( $this->field['mode'] ) ) {
40
+                $this->field['mode'] = 'javascript';
41
+            }
42
+            if ( ! isset( $this->field['theme'] ) ) {
43
+                $this->field['theme'] = 'monokai';
44
+            }
45 45
 
46
-			$params = array(
47
-				'minLines' => 10,
48
-				'maxLines' => 30,
49
-			);
46
+            $params = array(
47
+                'minLines' => 10,
48
+                'maxLines' => 30,
49
+            );
50 50
 
51
-			if ( isset( $this->field['args'] ) && ! empty( $this->field['args'] ) && is_array( $this->field['args'] ) ) {
52
-				$params = wp_parse_args( $this->field['args'], $params );
53
-			}
54
-			?>
51
+            if ( isset( $this->field['args'] ) && ! empty( $this->field['args'] ) && is_array( $this->field['args'] ) ) {
52
+                $params = wp_parse_args( $this->field['args'], $params );
53
+            }
54
+            ?>
55 55
 			<div class="ace-wrapper">
56 56
 				<input
57 57
 					type="hidden"
@@ -70,46 +70,46 @@  discard block
 block discarded – undo
70 70
 					class="ace-editor-area"><?php echo esc_html( $this->value ); ?></pre>
71 71
 			</div>
72 72
 			<?php
73
-		}
73
+        }
74 74
 
75
-		/**
76
-		 * Enqueue Function.
77
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
78
-		 *
79
-		 * @since       1.0.0
80
-		 * @access      public
81
-		 * @return      void
82
-		 */
83
-		public function enqueue() {
84
-			if ( $this->parent->args['dev_mode'] ) {
85
-				wp_enqueue_style(
86
-					'redux-field-ace-editor',
87
-					Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor.css',
88
-					array(),
89
-					$this->timestamp
90
-				);
91
-			}
75
+        /**
76
+         * Enqueue Function.
77
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
78
+         *
79
+         * @since       1.0.0
80
+         * @access      public
81
+         * @return      void
82
+         */
83
+        public function enqueue() {
84
+            if ( $this->parent->args['dev_mode'] ) {
85
+                wp_enqueue_style(
86
+                    'redux-field-ace-editor',
87
+                    Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor.css',
88
+                    array(),
89
+                    $this->timestamp
90
+                );
91
+            }
92 92
 
93
-			if ( ! wp_script_is( 'ace-editor-js' ) ) {
94
-				wp_enqueue_script(
95
-					'ace-editor-js',
96
-					// phpcs:ignore Generic.Strings.UnnecessaryStringConcat
97
-					apply_filters( 'redux/' . $this->parent->args['opt_name'] . 'fields/ace/script', '//' . 'cdnjs' . '.cloudflare' . '.com/ajax/libs/ace/1.23.0/ace.min.js' ),
98
-					array( 'jquery' ),
99
-					'1.23.0',
100
-					true
101
-				);
102
-			}
93
+            if ( ! wp_script_is( 'ace-editor-js' ) ) {
94
+                wp_enqueue_script(
95
+                    'ace-editor-js',
96
+                    // phpcs:ignore Generic.Strings.UnnecessaryStringConcat
97
+                    apply_filters( 'redux/' . $this->parent->args['opt_name'] . 'fields/ace/script', '//' . 'cdnjs' . '.cloudflare' . '.com/ajax/libs/ace/1.23.0/ace.min.js' ),
98
+                    array( 'jquery' ),
99
+                    '1.23.0',
100
+                    true
101
+                );
102
+            }
103 103
 
104
-			wp_enqueue_script(
105
-				'redux-field-ace-editor',
106
-				Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor' . Redux_Functions::is_min() . '.js',
107
-				array( 'jquery', 'ace-editor-js', 'redux-js' ),
108
-				$this->timestamp,
109
-				true
110
-			);
111
-		}
112
-	}
104
+            wp_enqueue_script(
105
+                'redux-field-ace-editor',
106
+                Redux_Core::$url . 'inc/fields/ace_editor/redux-ace-editor' . Redux_Functions::is_min() . '.js',
107
+                array( 'jquery', 'ace-editor-js', 'redux-js' ),
108
+                $this->timestamp,
109
+                true
110
+            );
111
+        }
112
+    }
113 113
 }
114 114
 
115 115
 class_alias( 'Redux_Ace_Editor', 'ReduxFramework_Ace_Editor' );
Please login to merge, or discard this patch.
redux-core/inc/welcome/class-redux-welcome.php 1 patch
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -8,111 +8,111 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit;
11
+    exit;
12 12
 }
13 13
 
14 14
 if ( ! class_exists( 'Redux_Welcome', false ) ) {
15 15
 
16
-	/**
17
-	 * Class Redux_Welcome
18
-	 */
19
-	class Redux_Welcome {
20
-
21
-		/**
22
-		 * Min capacity.
23
-		 *
24
-		 * @var string The capability users should have to view the page
25
-		 */
26
-		public string $minimum_capability = 'manage_options';
27
-
28
-		/**
29
-		 * Display version.
30
-		 *
31
-		 * @var string
32
-		 */
33
-		public string $display_version = '';
34
-
35
-		/**
36
-		 * Is loaded.
37
-		 *
38
-		 * @var bool
39
-		 */
40
-		public bool $redux_loaded = false;
41
-
42
-		/**
43
-		 * Get things started
44
-		 *
45
-		 * @since 1.4
46
-		 */
47
-		public function __construct() {
48
-			// Load the welcome page even if a Redux panel isn't running.
49
-			add_action( 'init', array( $this, 'init' ), 999 );
50
-		}
51
-
52
-		/**
53
-		 * Class init.
54
-		 */
55
-		public function init() {
56
-			if ( $this->redux_loaded ) {
57
-				return;
58
-			}
59
-
60
-			$this->redux_loaded = true;
61
-			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
62
-
63
-			if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
64
-				if ( 'redux-' === substr( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 0, 6 ) ) { // phpcs:ignore WordPress.Security.NonceVerification
65
-					$version               = explode( '.', Redux_Core::$version );
66
-					$this->display_version = $version[0] . '.' . $version[1];
67
-					add_filter( 'admin_footer_text', array( $this, 'change_wp_footer' ) );
68
-					add_action( 'admin_head', array( $this, 'admin_head' ) );
69
-				}
70
-			}
71
-		}
72
-
73
-		/**
74
-		 * Do Redirect.
75
-		 */
76
-		public function do_redirect() {
77
-			if ( ! defined( 'WP_CLI' ) ) {
78
-				wp_safe_redirect( esc_url( admin_url( add_query_arg( array( 'page' => 'redux-framework' ), 'options-general.php' ) ) ) );
79
-				exit();
80
-			}
81
-		}
82
-
83
-		/**
84
-		 * Change Footer.
85
-		 */
86
-		public function change_wp_footer() {
87
-			echo esc_html__( 'If you like', 'redux-framework' ) . ' <strong>Redux</strong> ' . esc_html__( 'please leave us a', 'redux-framework' ) . ' <a href="https://wordpress.org/support/view/plugin-reviews/redux-framework?filter=5#postform" target="_blank" class="redux-rating-link" data-rated="Thanks :)">&#9733;&#9733;&#9733;&#9733;&#9733;</a> ' . esc_html__( 'rating. A huge thank you in advance!', 'redux-framework' );
88
-		}
89
-
90
-
91
-
92
-		/**
93
-		 * Register the Dashboard Pages which are later hidden but these pages
94
-		 * are used to render the What's Redux pages.
95
-		 *
96
-		 * @access public
97
-		 * @since  1.4
98
-		 * @return void
99
-		 */
100
-		public function admin_menus() {
101
-			$page = 'add_options_page';
102
-
103
-			// About Page.
104
-			$page( esc_html__( 'What is Redux Framework?', 'redux-framework' ), esc_html__( 'Redux', 'redux-framework' ), $this->minimum_capability, 'redux-framework', array( $this, 'about_screen' ) );
105
-		}
106
-
107
-		/**
108
-		 * Hide Individual Dashboard Pages
109
-		 *
110
-		 * @access public
111
-		 * @since  1.4
112
-		 * @return void
113
-		 */
114
-		public function admin_head() {
115
-			?>
16
+    /**
17
+     * Class Redux_Welcome
18
+     */
19
+    class Redux_Welcome {
20
+
21
+        /**
22
+         * Min capacity.
23
+         *
24
+         * @var string The capability users should have to view the page
25
+         */
26
+        public string $minimum_capability = 'manage_options';
27
+
28
+        /**
29
+         * Display version.
30
+         *
31
+         * @var string
32
+         */
33
+        public string $display_version = '';
34
+
35
+        /**
36
+         * Is loaded.
37
+         *
38
+         * @var bool
39
+         */
40
+        public bool $redux_loaded = false;
41
+
42
+        /**
43
+         * Get things started
44
+         *
45
+         * @since 1.4
46
+         */
47
+        public function __construct() {
48
+            // Load the welcome page even if a Redux panel isn't running.
49
+            add_action( 'init', array( $this, 'init' ), 999 );
50
+        }
51
+
52
+        /**
53
+         * Class init.
54
+         */
55
+        public function init() {
56
+            if ( $this->redux_loaded ) {
57
+                return;
58
+            }
59
+
60
+            $this->redux_loaded = true;
61
+            add_action( 'admin_menu', array( $this, 'admin_menus' ) );
62
+
63
+            if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
64
+                if ( 'redux-' === substr( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 0, 6 ) ) { // phpcs:ignore WordPress.Security.NonceVerification
65
+                    $version               = explode( '.', Redux_Core::$version );
66
+                    $this->display_version = $version[0] . '.' . $version[1];
67
+                    add_filter( 'admin_footer_text', array( $this, 'change_wp_footer' ) );
68
+                    add_action( 'admin_head', array( $this, 'admin_head' ) );
69
+                }
70
+            }
71
+        }
72
+
73
+        /**
74
+         * Do Redirect.
75
+         */
76
+        public function do_redirect() {
77
+            if ( ! defined( 'WP_CLI' ) ) {
78
+                wp_safe_redirect( esc_url( admin_url( add_query_arg( array( 'page' => 'redux-framework' ), 'options-general.php' ) ) ) );
79
+                exit();
80
+            }
81
+        }
82
+
83
+        /**
84
+         * Change Footer.
85
+         */
86
+        public function change_wp_footer() {
87
+            echo esc_html__( 'If you like', 'redux-framework' ) . ' <strong>Redux</strong> ' . esc_html__( 'please leave us a', 'redux-framework' ) . ' <a href="https://wordpress.org/support/view/plugin-reviews/redux-framework?filter=5#postform" target="_blank" class="redux-rating-link" data-rated="Thanks :)">&#9733;&#9733;&#9733;&#9733;&#9733;</a> ' . esc_html__( 'rating. A huge thank you in advance!', 'redux-framework' );
88
+        }
89
+
90
+
91
+
92
+        /**
93
+         * Register the Dashboard Pages which are later hidden but these pages
94
+         * are used to render the What's Redux pages.
95
+         *
96
+         * @access public
97
+         * @since  1.4
98
+         * @return void
99
+         */
100
+        public function admin_menus() {
101
+            $page = 'add_options_page';
102
+
103
+            // About Page.
104
+            $page( esc_html__( 'What is Redux Framework?', 'redux-framework' ), esc_html__( 'Redux', 'redux-framework' ), $this->minimum_capability, 'redux-framework', array( $this, 'about_screen' ) );
105
+        }
106
+
107
+        /**
108
+         * Hide Individual Dashboard Pages
109
+         *
110
+         * @access public
111
+         * @since  1.4
112
+         * @return void
113
+         */
114
+        public function admin_head() {
115
+            ?>
116 116
 			<link
117 117
 				rel='stylesheet' id='elusive-icons' <?php // phpcs:ignore WordPress.WP.EnqueuedResources ?>
118 118
 				href='<?php echo esc_url( Redux_Core::$url ); ?>assets/css/vendor/elusive-icons.css'
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
 				}
134 134
 			</style>
135 135
 			<?php
136
-		}
137
-
138
-		/**
139
-		 * Navigation tabs
140
-		 *
141
-		 * @access public
142
-		 * @since  1.9
143
-		 * @return void
144
-		 */
145
-		public function tabs() {
146
-			$selected = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'redux-framework'; // phpcs:ignore WordPress.Security.NonceVerification
147
-
148
-			?>
136
+        }
137
+
138
+        /**
139
+         * Navigation tabs
140
+         *
141
+         * @access public
142
+         * @since  1.9
143
+         * @return void
144
+         */
145
+        public function tabs() {
146
+            $selected = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'redux-framework'; // phpcs:ignore WordPress.Security.NonceVerification
147
+
148
+            ?>
149 149
 			<h2 class="nav-tab-wrapper">
150 150
 				<a
151 151
 					class="nav-tab <?php echo( 'redux-framework' === $selected ? 'nav-tab-active' : '' ); ?>"
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 				</a>
155 155
 			</h2>
156 156
 			<?php
157
-		}
158
-
159
-		/**
160
-		 * Render About Screen
161
-		 *
162
-		 * @access public
163
-		 * @since  1.4
164
-		 * @return void
165
-		 */
166
-		public function about_screen() {
167
-			// Stupid hack for WordPress alerts and warnings.
168
-			echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
169
-
170
-			require_once 'views/about.php';
171
-		}
172
-
173
-		/**
174
-		 * Action.
175
-		 */
176
-		public function actions() {
177
-			?>
157
+        }
158
+
159
+        /**
160
+         * Render About Screen
161
+         *
162
+         * @access public
163
+         * @since  1.4
164
+         * @return void
165
+         */
166
+        public function about_screen() {
167
+            // Stupid hack for WordPress alerts and warnings.
168
+            echo '<div class="wrap" style="height:0;overflow:hidden;"><h2></h2></div>';
169
+
170
+            require_once 'views/about.php';
171
+        }
172
+
173
+        /**
174
+         * Action.
175
+         */
176
+        public function actions() {
177
+            ?>
178 178
 			<p class="redux-actions">
179 179
 				<a href="https://devs.redux.io/" class="docs button button-primary">Docs</a>
180 180
 				<a
@@ -189,30 +189,30 @@  discard block
 block discarded – undo
189 189
 					data-via="ReduxFramework" data-size="large" data-hashtags="Redux">Tweet</a>
190 190
 				<?php
191 191
 
192
-				$options = Redux_Helpers::get_plugin_options();
193
-				$nonce   = wp_create_nonce( 'redux_framework_demo' );
192
+                $options = Redux_Helpers::get_plugin_options();
193
+                $nonce   = wp_create_nonce( 'redux_framework_demo' );
194 194
 
195
-				$query_args = array(
196
-					'page'                   => 'redux-framework',
197
-					'redux-framework-plugin' => 'demo',
198
-					'nonce'                  => $nonce,
199
-				);
195
+                $query_args = array(
196
+                    'page'                   => 'redux-framework',
197
+                    'redux-framework-plugin' => 'demo',
198
+                    'nonce'                  => $nonce,
199
+                );
200 200
 
201
-				if ( $options['demo'] ) {
202
-					?>
201
+                if ( $options['demo'] ) {
202
+                    ?>
203 203
 					<a
204 204
 						href="<?php echo esc_url( admin_url( add_query_arg( $query_args, 'options-general.php' ) ) ); ?>"
205 205
 						class=" button-text button-demo"><?php echo esc_html__( 'Disable Panel Demo', 'redux-framework' ); ?></a>
206 206
 					<?php
207
-				} else {
208
-					?>
207
+                } else {
208
+                    ?>
209 209
 					<a
210 210
 						href="<?php echo esc_url( admin_url( add_query_arg( $query_args, 'options-general.php' ) ) ); ?>"
211 211
 						class=" button-text button-demo active"><?php echo esc_html__( 'Enable Panel Demo', 'redux-framework' ); ?></a>
212 212
 					<?php
213
-				}
213
+                }
214 214
 
215
-				?>
215
+                ?>
216 216
 				<script>
217 217
 					!function( d, s, id ) {
218 218
 						let js;
@@ -229,6 +229,6 @@  discard block
 block discarded – undo
229 229
 				</script>
230 230
 			</p>
231 231
 			<?php
232
-		}
233
-	}
232
+        }
233
+    }
234 234
 }
Please login to merge, or discard this patch.
redux-core/inc/themecheck/checks/class-redux-embedded.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -14,67 +14,67 @@
 block discarded – undo
14 14
  */
15 15
 class Redux_Embedded implements themecheck {
16 16
 
17
-	/**
18
-	 * Error array.
19
-	 *
20
-	 * @var array
21
-	 */
22
-	protected array $error = array();
17
+    /**
18
+     * Error array.
19
+     *
20
+     * @var array
21
+     */
22
+    protected array $error = array();
23 23
 
24
-	/**
25
-	 * Run checker.
26
-	 *
27
-	 * @param array $php_files - Files to check.
28
-	 * @param array $css_files - Files to check.
29
-	 * @param array $other_files - Files to check.
30
-	 *
31
-	 * @return bool
32
-	 */
33
-	public function check( $php_files, $css_files, $other_files ): bool {
24
+    /**
25
+     * Run checker.
26
+     *
27
+     * @param array $php_files - Files to check.
28
+     * @param array $css_files - Files to check.
29
+     * @param array $other_files - Files to check.
30
+     *
31
+     * @return bool
32
+     */
33
+    public function check( $php_files, $css_files, $other_files ): bool {
34 34
 
35
-		$ret   = true;
36
-		$check = Redux_ThemeCheck::get_instance();
37
-		$redux = $check::get_redux_details( $php_files );
35
+        $ret   = true;
36
+        $check = Redux_ThemeCheck::get_instance();
37
+        $redux = $check::get_redux_details( $php_files );
38 38
 
39
-		if ( $redux ) {
40
-			checkcount();
39
+        if ( $redux ) {
40
+            checkcount();
41 41
 
42
-			if ( ! isset( $_POST['redux_wporg'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
43
-				$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'If you are submitting to WordPress.org Theme Repository, it is', 'redux-framework' ) . ' <strong>' . esc_html__( 'strongly', 'redux-framework' ) . '</strong> ' . esc_html__( 'suggested that you read', 'redux-framework' ) . ' <a href="%s" target="_blank">' . esc_html__( 'this document', 'redux-framework' ) . '</a>, ' . esc_html__( 'or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docsv3.redux.io/core/wordpress-org-submissions/' ) . '</div>';
44
-				$ret           = false;
45
-			} else {
46
-				// TODO Granular WP.org tests!!!
47
-				// Check for Tracking.
48
-				$tracking = $redux['dir'] . 'inc/tracking.php';
49
-				if ( file_exists( $tracking ) ) {
50
-					$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-required">' . esc_html__( 'REQUIRED', 'redux-framework' ) . '</span>: ' . esc_html__( 'You MUST delete', 'redux-framework' ) . ' <strong> %s </strong>, ' . esc_html__( 'or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework' ), $tracking ) . '</div>';
51
-					$ret           = false;
52
-				}
42
+            if ( ! isset( $_POST['redux_wporg'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
43
+                $this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'If you are submitting to WordPress.org Theme Repository, it is', 'redux-framework' ) . ' <strong>' . esc_html__( 'strongly', 'redux-framework' ) . '</strong> ' . esc_html__( 'suggested that you read', 'redux-framework' ) . ' <a href="%s" target="_blank">' . esc_html__( 'this document', 'redux-framework' ) . '</a>, ' . esc_html__( 'or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docsv3.redux.io/core/wordpress-org-submissions/' ) . '</div>';
44
+                $ret           = false;
45
+            } else {
46
+                // TODO Granular WP.org tests!!!
47
+                // Check for Tracking.
48
+                $tracking = $redux['dir'] . 'inc/tracking.php';
49
+                if ( file_exists( $tracking ) ) {
50
+                    $this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-required">' . esc_html__( 'REQUIRED', 'redux-framework' ) . '</span>: ' . esc_html__( 'You MUST delete', 'redux-framework' ) . ' <strong> %s </strong>, ' . esc_html__( 'or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework' ), $tracking ) . '</div>';
51
+                    $ret           = false;
52
+                }
53 53
 
54
-				// Embedded CDN package
55
-				// use_cdn
56
-				// Arguments.
57
-				$args          = '<ol>';
58
-				$args         .= "<li><code>'save_defaults' => false</code></li>";
59
-				$args         .= "<li><code>'use_cdn' => false</code></li>";
60
-				$args         .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
61
-				$args         .= "<li><code>'database' => 'theme_mods'</code> (' . esc_html__( 'Optional', 'redux-framework' ) . ')</li>";
62
-				$args         .= '</ol>';
63
-				$this->error[] = '<div class="redux-error"><span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '</div>';
64
-			}
65
-		}
54
+                // Embedded CDN package
55
+                // use_cdn
56
+                // Arguments.
57
+                $args          = '<ol>';
58
+                $args         .= "<li><code>'save_defaults' => false</code></li>";
59
+                $args         .= "<li><code>'use_cdn' => false</code></li>";
60
+                $args         .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
61
+                $args         .= "<li><code>'database' => 'theme_mods'</code> (' . esc_html__( 'Optional', 'redux-framework' ) . ')</li>";
62
+                $args         .= '</ol>';
63
+                $this->error[] = '<div class="redux-error"><span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '</div>';
64
+            }
65
+        }
66 66
 
67
-		return $ret;
68
-	}
67
+        return $ret;
68
+    }
69 69
 
70
-	/**
71
-	 * Return error array.
72
-	 *
73
-	 * @return array
74
-	 */
75
-	public function getError(): array {
76
-		return $this->error;
77
-	}
70
+    /**
71
+     * Return error array.
72
+     *
73
+     * @return array
74
+     */
75
+    public function getError(): array {
76
+        return $this->error;
77
+    }
78 78
 }
79 79
 
80 80
 $themechecks[] = new Redux_Embedded();
Please login to merge, or discard this patch.
redux-core/inc/lib/redux-instances.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
  * @return ReduxFramework                ReduxFramework
18 18
  */
19 19
 function get_redux_instance( string $opt_name ): ReduxFramework {
20
-	_deprecated_function( __FUNCTION__, '4.0', 'Redux::instance($opt_name)' );
20
+    _deprecated_function( __FUNCTION__, '4.0', 'Redux::instance($opt_name)' );
21 21
 
22
-	return Redux::instance( $opt_name );
22
+    return Redux::instance( $opt_name );
23 23
 }
24 24
 
25 25
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @return array        format ['opt_name' => $ReduxFramework]
31 31
  */
32 32
 function get_all_redux_instances(): array {
33
-	_deprecated_function( __FUNCTION__, '4.0', 'Redux::all_instances()' );
33
+    _deprecated_function( __FUNCTION__, '4.0', 'Redux::all_instances()' );
34 34
 
35
-	return Redux::all_instances();
35
+    return Redux::all_instances();
36 36
 }
Please login to merge, or discard this patch.
redux-core/inc/lib/elusive-icons.php 1 patch
Indentation   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -16,304 +16,304 @@
 block discarded – undo
16 16
  * @return array
17 17
  */
18 18
 function redux_get_font_icons(): array {
19
-	return array(
20
-		'el el-address-book-alt',
21
-		'el el-address-book',
22
-		'el el-adjust-alt',
23
-		'el el-adjust',
24
-		'el el-adult',
25
-		'el el-align-center',
26
-		'el el-align-justify',
27
-		'el el-align-left',
28
-		'el el-align-right',
29
-		'el el-arrow-down',
30
-		'el el-arrow-left',
31
-		'el el-arrow-right',
32
-		'el el-arrow-up',
33
-		'el el-asl',
34
-		'el el-asterisk',
35
-		'el el-backward',
36
-		'el el-ban-circle',
37
-		'el el-barcode',
38
-		'el el-behance',
39
-		'el el-bell',
40
-		'el el-blind',
41
-		'el el-blogger',
42
-		'el el-bold',
43
-		'el el-book',
44
-		'el el-bookmark-empty',
45
-		'el el-bookmark',
46
-		'el el-braille',
47
-		'el el-briefcase',
48
-		'el el-broom',
49
-		'el el-brush',
50
-		'el el-bulb',
51
-		'el el-bullhorn',
52
-		'el el-calendar-sign',
53
-		'el el-calendar',
54
-		'el el-camera',
55
-		'el el-car',
56
-		'el el-caret-down',
57
-		'el el-caret-left',
58
-		'el el-caret-right',
59
-		'el el-caret-up',
60
-		'el el-cc',
61
-		'el el-certificate',
62
-		'el el-check-empty',
63
-		'el el-check',
64
-		'el el-chevron-down',
65
-		'el el-chevron-left',
66
-		'el el-chevron-right',
67
-		'el el-chevron-up',
68
-		'el el-child',
69
-		'el el-circle-arrow-down',
70
-		'el el-circle-arrow-left',
71
-		'el el-circle-arrow-right',
72
-		'el el-circle-arrow-up',
73
-		'el el-cloud-alt',
74
-		'el el-cloud',
75
-		'el el-cog-alt',
76
-		'el el-cog',
77
-		'el el-cogs',
78
-		'el el-comment-alt',
79
-		'el el-comment',
80
-		'el el-compass-alt',
81
-		'el el-compass',
82
-		'el el-credit-card',
83
-		'el el-css',
84
-		'el el-dashboard',
85
-		'el el-delicious',
86
-		'el el-deviantart',
87
-		'el el-digg',
88
-		'el el-download-alt',
89
-		'el el-download',
90
-		'el el-dribbble',
91
-		'el el-edit',
92
-		'el el-eject',
93
-		'el el-envelope-alt',
94
-		'el el-envelope',
95
-		'el el-error-alt',
96
-		'el el-error',
97
-		'el el-eur',
98
-		'el el-exclamation-sign',
99
-		'el el-eye-close',
100
-		'el el-eye-open',
101
-		'el el-facebook',
102
-		'el el-facetime-video',
103
-		'el el-fast-backward',
104
-		'el el-fast-forward',
105
-		'el el-female',
106
-		'el el-file-alt',
107
-		'el el-file-edit-alt',
108
-		'el el-file-edit',
109
-		'el el-file-new-alt',
110
-		'el el-file-new',
111
-		'el el-file',
112
-		'el el-film',
113
-		'el el-filter',
114
-		'el el-fire',
115
-		'el el-flag-alt',
116
-		'el el-flag',
117
-		'el el-flickr',
118
-		'el el-folder-close',
119
-		'el el-folder-open',
120
-		'el el-folder-sign',
121
-		'el el-folder',
122
-		'el el-font',
123
-		'el el-fontsize',
124
-		'el el-fork',
125
-		'el el-forward-alt',
126
-		'el el-forward',
127
-		'el el-foursquare',
128
-		'el el-friendfeed-rect',
129
-		'el el-friendfeed',
130
-		'el el-fullscreen',
131
-		'el el-gbp',
132
-		'el el-gift',
133
-		'el el-github-text',
134
-		'el el-github',
135
-		'el el-glass',
136
-		'el el-glasses',
137
-		'el el-globe-alt',
138
-		'el el-globe',
139
-		'el el-googleplus',
140
-		'el el-graph-alt',
141
-		'el el-graph',
142
-		'el el-group-alt',
143
-		'el el-group',
144
-		'el el-guidedog',
145
-		'el el-hand-down',
146
-		'el el-hand-left',
147
-		'el el-hand-right',
148
-		'el el-hand-up',
149
-		'el el-hdd',
150
-		'el el-headphones',
151
-		'el el-hearing-impaired',
152
-		'el el-heart-alt',
153
-		'el el-heart-empty',
154
-		'el el-heart',
155
-		'el el-home-alt',
156
-		'el el-home',
157
-		'el el-hourglass',
158
-		'el el-idea-alt',
159
-		'el el-idea',
160
-		'el el-inbox-alt',
161
-		'el el-inbox-box',
162
-		'el el-inbox',
163
-		'el el-indent-left',
164
-		'el el-indent-right',
165
-		'el el-info-circle',
166
-		'el el-instagram',
167
-		'el el-iphone-home',
168
-		'el el-italic',
169
-		'el el-key',
170
-		'el el-laptop-alt',
171
-		'el el-laptop',
172
-		'el el-lastfm',
173
-		'el el-leaf',
174
-		'el el-lines',
175
-		'el el-link',
176
-		'el el-linkedin',
177
-		'el el-list-alt',
178
-		'el el-list',
179
-		'el el-livejournal',
180
-		'el el-lock-alt',
181
-		'el el-lock',
182
-		'el el-magic',
183
-		'el el-magnet',
184
-		'el el-male',
185
-		'el el-map-marker-alt',
186
-		'el el-map-marker',
187
-		'el el-mic-alt',
188
-		'el el-mic',
189
-		'el el-minus-sign',
190
-		'el el-minus',
191
-		'el el-move',
192
-		'el el-music',
193
-		'el el-myspace',
194
-		'el el-network',
195
-		'el el-off',
196
-		'el el-ok-circle',
197
-		'el el-ok-sign',
198
-		'el el-ok',
199
-		'el el-opensource',
200
-		'el el-paper-clip-alt',
201
-		'el el-paper-clip',
202
-		'el el-path',
203
-		'el el-pause-alt',
204
-		'el el-pause',
205
-		'el el-pencil-alt',
206
-		'el el-pencil',
207
-		'el el-person',
208
-		'el el-phone-alt',
209
-		'el el-phone',
210
-		'el el-photo-alt',
211
-		'el el-photo',
212
-		'el el-picasa',
213
-		'el el-picture',
214
-		'el el-plane',
215
-		'el el-play-alt',
216
-		'el el-play-circle',
217
-		'el el-play',
218
-		'el el-plus-sign',
219
-		'el el-plus',
220
-		'el el-podcast',
221
-		'el el-print',
222
-		'el el-puzzle',
223
-		'el el-qrcode',
224
-		'el el-question-sign',
225
-		'el el-question',
226
-		'el el-quote-alt',
227
-		'el el-quotes',
228
-		'el el-random',
229
-		'el el-record',
230
-		'el el-reddit',
231
-		'el el-refresh',
232
-		'el el-remove-circle',
233
-		'el el-remove-sign',
234
-		'el el-remove',
235
-		'el el-repeat-alt',
236
-		'el el-repeat',
237
-		'el el-resize-full',
238
-		'el el-resize-horizontal',
239
-		'el el-resize-small',
240
-		'el el-resize-vertical',
241
-		'el el-return-key',
242
-		'el el-retweet',
243
-		'el el-reverse-alt',
244
-		'el el-road',
245
-		'el el-rss',
246
-		'el el-scissors',
247
-		'el el-screen-alt',
248
-		'el el-screen',
249
-		'el el-screenshot',
250
-		'el el-search-alt',
251
-		'el el-search',
252
-		'el el-share-alt',
253
-		'el el-share',
254
-		'el el-shopping-cart-sign',
255
-		'el el-shopping-cart',
256
-		'el el-signal',
257
-		'el el-skype',
258
-		'el el-slideshare',
259
-		'el el-smiley-alt',
260
-		'el el-smiley',
261
-		'el el-soundcloud',
262
-		'el el-speaker',
263
-		'el el-spotify',
264
-		'el el-stackoverflow',
265
-		'el el-star-alt',
266
-		'el el-star-empty',
267
-		'el el-star',
268
-		'el el-step-backward',
269
-		'el el-step-forward',
270
-		'el el-stop-alt',
271
-		'el el-stop',
272
-		'el el-stumbleupon',
273
-		'el el-tag',
274
-		'el el-tags',
275
-		'el el-tasks',
276
-		'el el-text-height',
277
-		'el el-text-width',
278
-		'el el-th-large',
279
-		'el el-th-list',
280
-		'el el-th',
281
-		'el el-thumbs-down',
282
-		'el el-thumbs-up',
283
-		'el el-time-alt',
284
-		'el el-time',
285
-		'el el-tint',
286
-		'el el-torso',
287
-		'el el-trash-alt',
288
-		'el el-trash',
289
-		'el el-tumblr',
290
-		'el el-twitter',
291
-		'el el-universal-access',
292
-		'el el-unlock-alt',
293
-		'el el-unlock',
294
-		'el el-upload',
295
-		'el el-usd',
296
-		'el el-user',
297
-		'el el-viadeo',
298
-		'el el-video-alt',
299
-		'el el-video-chat',
300
-		'el el-video',
301
-		'el el-view-mode',
302
-		'el el-vimeo',
303
-		'el el-vkontakte',
304
-		'el el-volume-down',
305
-		'el el-volume-off',
306
-		'el el-volume-up',
307
-		'el el-w3c',
308
-		'el el-warning-sign',
309
-		'el el-website-alt',
310
-		'el el-website',
311
-		'el el-wheelchair',
312
-		'el el-wordpress',
313
-		'el el-wrench-alt',
314
-		'el el-wrench',
315
-		'el el-youtube',
316
-		'el el-zoom-in',
317
-		'el el-zoom-out',
318
-	);
19
+    return array(
20
+        'el el-address-book-alt',
21
+        'el el-address-book',
22
+        'el el-adjust-alt',
23
+        'el el-adjust',
24
+        'el el-adult',
25
+        'el el-align-center',
26
+        'el el-align-justify',
27
+        'el el-align-left',
28
+        'el el-align-right',
29
+        'el el-arrow-down',
30
+        'el el-arrow-left',
31
+        'el el-arrow-right',
32
+        'el el-arrow-up',
33
+        'el el-asl',
34
+        'el el-asterisk',
35
+        'el el-backward',
36
+        'el el-ban-circle',
37
+        'el el-barcode',
38
+        'el el-behance',
39
+        'el el-bell',
40
+        'el el-blind',
41
+        'el el-blogger',
42
+        'el el-bold',
43
+        'el el-book',
44
+        'el el-bookmark-empty',
45
+        'el el-bookmark',
46
+        'el el-braille',
47
+        'el el-briefcase',
48
+        'el el-broom',
49
+        'el el-brush',
50
+        'el el-bulb',
51
+        'el el-bullhorn',
52
+        'el el-calendar-sign',
53
+        'el el-calendar',
54
+        'el el-camera',
55
+        'el el-car',
56
+        'el el-caret-down',
57
+        'el el-caret-left',
58
+        'el el-caret-right',
59
+        'el el-caret-up',
60
+        'el el-cc',
61
+        'el el-certificate',
62
+        'el el-check-empty',
63
+        'el el-check',
64
+        'el el-chevron-down',
65
+        'el el-chevron-left',
66
+        'el el-chevron-right',
67
+        'el el-chevron-up',
68
+        'el el-child',
69
+        'el el-circle-arrow-down',
70
+        'el el-circle-arrow-left',
71
+        'el el-circle-arrow-right',
72
+        'el el-circle-arrow-up',
73
+        'el el-cloud-alt',
74
+        'el el-cloud',
75
+        'el el-cog-alt',
76
+        'el el-cog',
77
+        'el el-cogs',
78
+        'el el-comment-alt',
79
+        'el el-comment',
80
+        'el el-compass-alt',
81
+        'el el-compass',
82
+        'el el-credit-card',
83
+        'el el-css',
84
+        'el el-dashboard',
85
+        'el el-delicious',
86
+        'el el-deviantart',
87
+        'el el-digg',
88
+        'el el-download-alt',
89
+        'el el-download',
90
+        'el el-dribbble',
91
+        'el el-edit',
92
+        'el el-eject',
93
+        'el el-envelope-alt',
94
+        'el el-envelope',
95
+        'el el-error-alt',
96
+        'el el-error',
97
+        'el el-eur',
98
+        'el el-exclamation-sign',
99
+        'el el-eye-close',
100
+        'el el-eye-open',
101
+        'el el-facebook',
102
+        'el el-facetime-video',
103
+        'el el-fast-backward',
104
+        'el el-fast-forward',
105
+        'el el-female',
106
+        'el el-file-alt',
107
+        'el el-file-edit-alt',
108
+        'el el-file-edit',
109
+        'el el-file-new-alt',
110
+        'el el-file-new',
111
+        'el el-file',
112
+        'el el-film',
113
+        'el el-filter',
114
+        'el el-fire',
115
+        'el el-flag-alt',
116
+        'el el-flag',
117
+        'el el-flickr',
118
+        'el el-folder-close',
119
+        'el el-folder-open',
120
+        'el el-folder-sign',
121
+        'el el-folder',
122
+        'el el-font',
123
+        'el el-fontsize',
124
+        'el el-fork',
125
+        'el el-forward-alt',
126
+        'el el-forward',
127
+        'el el-foursquare',
128
+        'el el-friendfeed-rect',
129
+        'el el-friendfeed',
130
+        'el el-fullscreen',
131
+        'el el-gbp',
132
+        'el el-gift',
133
+        'el el-github-text',
134
+        'el el-github',
135
+        'el el-glass',
136
+        'el el-glasses',
137
+        'el el-globe-alt',
138
+        'el el-globe',
139
+        'el el-googleplus',
140
+        'el el-graph-alt',
141
+        'el el-graph',
142
+        'el el-group-alt',
143
+        'el el-group',
144
+        'el el-guidedog',
145
+        'el el-hand-down',
146
+        'el el-hand-left',
147
+        'el el-hand-right',
148
+        'el el-hand-up',
149
+        'el el-hdd',
150
+        'el el-headphones',
151
+        'el el-hearing-impaired',
152
+        'el el-heart-alt',
153
+        'el el-heart-empty',
154
+        'el el-heart',
155
+        'el el-home-alt',
156
+        'el el-home',
157
+        'el el-hourglass',
158
+        'el el-idea-alt',
159
+        'el el-idea',
160
+        'el el-inbox-alt',
161
+        'el el-inbox-box',
162
+        'el el-inbox',
163
+        'el el-indent-left',
164
+        'el el-indent-right',
165
+        'el el-info-circle',
166
+        'el el-instagram',
167
+        'el el-iphone-home',
168
+        'el el-italic',
169
+        'el el-key',
170
+        'el el-laptop-alt',
171
+        'el el-laptop',
172
+        'el el-lastfm',
173
+        'el el-leaf',
174
+        'el el-lines',
175
+        'el el-link',
176
+        'el el-linkedin',
177
+        'el el-list-alt',
178
+        'el el-list',
179
+        'el el-livejournal',
180
+        'el el-lock-alt',
181
+        'el el-lock',
182
+        'el el-magic',
183
+        'el el-magnet',
184
+        'el el-male',
185
+        'el el-map-marker-alt',
186
+        'el el-map-marker',
187
+        'el el-mic-alt',
188
+        'el el-mic',
189
+        'el el-minus-sign',
190
+        'el el-minus',
191
+        'el el-move',
192
+        'el el-music',
193
+        'el el-myspace',
194
+        'el el-network',
195
+        'el el-off',
196
+        'el el-ok-circle',
197
+        'el el-ok-sign',
198
+        'el el-ok',
199
+        'el el-opensource',
200
+        'el el-paper-clip-alt',
201
+        'el el-paper-clip',
202
+        'el el-path',
203
+        'el el-pause-alt',
204
+        'el el-pause',
205
+        'el el-pencil-alt',
206
+        'el el-pencil',
207
+        'el el-person',
208
+        'el el-phone-alt',
209
+        'el el-phone',
210
+        'el el-photo-alt',
211
+        'el el-photo',
212
+        'el el-picasa',
213
+        'el el-picture',
214
+        'el el-plane',
215
+        'el el-play-alt',
216
+        'el el-play-circle',
217
+        'el el-play',
218
+        'el el-plus-sign',
219
+        'el el-plus',
220
+        'el el-podcast',
221
+        'el el-print',
222
+        'el el-puzzle',
223
+        'el el-qrcode',
224
+        'el el-question-sign',
225
+        'el el-question',
226
+        'el el-quote-alt',
227
+        'el el-quotes',
228
+        'el el-random',
229
+        'el el-record',
230
+        'el el-reddit',
231
+        'el el-refresh',
232
+        'el el-remove-circle',
233
+        'el el-remove-sign',
234
+        'el el-remove',
235
+        'el el-repeat-alt',
236
+        'el el-repeat',
237
+        'el el-resize-full',
238
+        'el el-resize-horizontal',
239
+        'el el-resize-small',
240
+        'el el-resize-vertical',
241
+        'el el-return-key',
242
+        'el el-retweet',
243
+        'el el-reverse-alt',
244
+        'el el-road',
245
+        'el el-rss',
246
+        'el el-scissors',
247
+        'el el-screen-alt',
248
+        'el el-screen',
249
+        'el el-screenshot',
250
+        'el el-search-alt',
251
+        'el el-search',
252
+        'el el-share-alt',
253
+        'el el-share',
254
+        'el el-shopping-cart-sign',
255
+        'el el-shopping-cart',
256
+        'el el-signal',
257
+        'el el-skype',
258
+        'el el-slideshare',
259
+        'el el-smiley-alt',
260
+        'el el-smiley',
261
+        'el el-soundcloud',
262
+        'el el-speaker',
263
+        'el el-spotify',
264
+        'el el-stackoverflow',
265
+        'el el-star-alt',
266
+        'el el-star-empty',
267
+        'el el-star',
268
+        'el el-step-backward',
269
+        'el el-step-forward',
270
+        'el el-stop-alt',
271
+        'el el-stop',
272
+        'el el-stumbleupon',
273
+        'el el-tag',
274
+        'el el-tags',
275
+        'el el-tasks',
276
+        'el el-text-height',
277
+        'el el-text-width',
278
+        'el el-th-large',
279
+        'el el-th-list',
280
+        'el el-th',
281
+        'el el-thumbs-down',
282
+        'el el-thumbs-up',
283
+        'el el-time-alt',
284
+        'el el-time',
285
+        'el el-tint',
286
+        'el el-torso',
287
+        'el el-trash-alt',
288
+        'el el-trash',
289
+        'el el-tumblr',
290
+        'el el-twitter',
291
+        'el el-universal-access',
292
+        'el el-unlock-alt',
293
+        'el el-unlock',
294
+        'el el-upload',
295
+        'el el-usd',
296
+        'el el-user',
297
+        'el el-viadeo',
298
+        'el el-video-alt',
299
+        'el el-video-chat',
300
+        'el el-video',
301
+        'el el-view-mode',
302
+        'el el-vimeo',
303
+        'el el-vkontakte',
304
+        'el el-volume-down',
305
+        'el el-volume-off',
306
+        'el el-volume-up',
307
+        'el el-w3c',
308
+        'el el-warning-sign',
309
+        'el el-website-alt',
310
+        'el el-website',
311
+        'el el-wheelchair',
312
+        'el el-wordpress',
313
+        'el el-wrench-alt',
314
+        'el el-wrench',
315
+        'el el-youtube',
316
+        'el el-zoom-in',
317
+        'el el-zoom-out',
318
+    );
319 319
 }
Please login to merge, or discard this patch.