Completed
Push — master ( 44aca2...0191c7 )
by
unknown
36s
created
social_profiles/social_profiles/inc/class-redux-social-profiles-widget.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		 * @param null             $param  Who knows.
73 73
 		 */
74 74
 		public function register( $widget, $param = null ) {
75
-			$this->widgets[ $widget ] = new $widget( $param );
75
+			$this->widgets[$widget] = new $widget( $param );
76 76
 		}
77 77
 	}
78 78
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			$title         = $instance['title'];
126 126
 			$redux_options = get_option( $this->parent->args['opt_name'] );
127 127
 
128
-			$social_items = $redux_options[ $this->field_id ];
128
+			$social_items = $redux_options[$this->field_id];
129 129
 
130 130
 			echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput
131 131
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'title' => esc_html__( 'Social', 'redux-framework' ),
191 191
 			);
192 192
 
193
-			$instance = wp_parse_args( (array) $instance, $defaults );
193
+			$instance = wp_parse_args( ( array ) $instance, $defaults );
194 194
 			?>
195 195
 			<p>
196 196
 				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
Please login to merge, or discard this patch.
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -13,187 +13,187 @@  discard block
 block discarded – undo
13 13
 
14 14
 if ( ! class_exists( 'Redux_Social_Profiles_Widget' ) ) {
15 15
 
16
-	/**
17
-	 * Class Redux_Social_Profiles_Widget
18
-	 */
19
-	class Redux_Social_Profiles_Widget {
20
-
21
-		/**
22
-		 * Field ID.
23
-		 *
24
-		 * @var string|null
25
-		 */
26
-		public ?string $field_id = '';
27
-
28
-		/**
29
-		 * ReduxFramework object pointer.
30
-		 *
31
-		 * @var ReduxFramework|null
32
-		 */
33
-		public ?ReduxFramework $parent = null;
34
-
35
-		/**
36
-		 * Redux_Social_Profiles_Widget constructor.
37
-		 *
38
-		 * @param ReduxFramework $redux    ReduxFramework object.
39
-		 * @param string         $field_id Field ID.
40
-		 */
41
-		public function __construct( ReduxFramework $redux, string $field_id ) {
42
-			return;
43
-
44
-			$this->parent   = $redux;
45
-			$this->field_id = $field_id;
46
-
47
-
48
-			$this->params = array(
49
-				'parent'   => $this->parent,
50
-				'field_id' => $this->field_id,
51
-			);
52
-
53
-			add_action( 'widgets_init', array( $this, 'load_widget' ), 0 );
54
-		}
55
-
56
-		/**
57
-		 * Load widget
58
-		 */
59
-		public function load_widget() {
60
-			$x = new Extend_WP_Widget_Factory();
61
-			$x->register( 'Redux_Social_Widget_Display', $this->params );
62
-		}
63
-	}
64
-
65
-	/**
66
-	 * Class Extend_WP_Widget_Factory
67
-	 */
68
-	// phpcs:ignore Generic.Files.OneClassPerFile
69
-	class Extend_WP_Widget_Factory extends WP_Widget_Factory {
70
-		/**
71
-		 * Register widget.
72
-		 *
73
-		 * @param string|WP_Widget $widget Widget class.
74
-		 * @param null             $param  Who knows.
75
-		 */
76
-		public function register( $widget, $param = null ) {
77
-			$this->widgets[ $widget ] = new $widget( $param );
78
-		}
79
-	}
80
-
81
-	/**
82
-	 * Class Redux_Social_Widget_Display
83
-	 */
84
-	class Redux_Social_Widget_Display extends WP_Widget {
85
-
86
-		public $show_instance_in_rest = true;
87
-
88
-		/**
89
-		 * Redux_Social_Widget_Display constructor.
90
-		 *
91
-		 * @param array $params Params.
92
-		 */
93
-		public function __construct( $params ) {
94
-
95
-			extract( $params ); // phpcs:ignore WordPress.PHP.DontExtract
96
-
97
-			$this->parent   = $parent;
98
-			$this->field_id = $field_id;
99
-
100
-			$widget_ops = array(
101
-				'classname'   => 'redux-social-icons-display',
102
-				'description' => __( 'Display social media links', 'redux-framework' ),
103
-				'show_instance_in_rest' => true
104
-			);
105
-
106
-			$control_ops = array(
107
-				'width'                 => 250,
108
-				'height'                => 200,
109
-				'id_base'               => 'redux-social-icons-display',
110
-				'show_instance_in_rest' => true,
111
-			);
112
-
113
-			parent::__construct( 'redux-social-icons-display', 'Redux Social Widget', $widget_ops, $control_ops );
114
-		}
115
-
116
-		/**
117
-		 * Widget render.
118
-		 *
119
-		 * @param array $args Args.
120
-		 * @param array $instance Instance.
121
-		 */
122
-		public function widget( $args, $instance ) {
123
-			include_once 'class-redux-social-profiles-functions.php';
124
-
125
-			extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract
126
-
127
-			$title         = $instance['title'];
128
-			$redux_options = get_option( $this->parent->args['opt_name'] );
129
-
130
-			$social_items = $redux_options[ $this->field_id ];
131
-
132
-			echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput
133
-
134
-			if ( $title ) {
135
-				echo $before_title . esc_html( $title ) . $after_title; // phpcs:ignore WordPress.Security.EscapeOutput
136
-			}
137
-
138
-			?>
16
+    /**
17
+     * Class Redux_Social_Profiles_Widget
18
+     */
19
+    class Redux_Social_Profiles_Widget {
20
+
21
+        /**
22
+         * Field ID.
23
+         *
24
+         * @var string|null
25
+         */
26
+        public ?string $field_id = '';
27
+
28
+        /**
29
+         * ReduxFramework object pointer.
30
+         *
31
+         * @var ReduxFramework|null
32
+         */
33
+        public ?ReduxFramework $parent = null;
34
+
35
+        /**
36
+         * Redux_Social_Profiles_Widget constructor.
37
+         *
38
+         * @param ReduxFramework $redux    ReduxFramework object.
39
+         * @param string         $field_id Field ID.
40
+         */
41
+        public function __construct( ReduxFramework $redux, string $field_id ) {
42
+            return;
43
+
44
+            $this->parent   = $redux;
45
+            $this->field_id = $field_id;
46
+
47
+
48
+            $this->params = array(
49
+                'parent'   => $this->parent,
50
+                'field_id' => $this->field_id,
51
+            );
52
+
53
+            add_action( 'widgets_init', array( $this, 'load_widget' ), 0 );
54
+        }
55
+
56
+        /**
57
+         * Load widget
58
+         */
59
+        public function load_widget() {
60
+            $x = new Extend_WP_Widget_Factory();
61
+            $x->register( 'Redux_Social_Widget_Display', $this->params );
62
+        }
63
+    }
64
+
65
+    /**
66
+     * Class Extend_WP_Widget_Factory
67
+     */
68
+    // phpcs:ignore Generic.Files.OneClassPerFile
69
+    class Extend_WP_Widget_Factory extends WP_Widget_Factory {
70
+        /**
71
+         * Register widget.
72
+         *
73
+         * @param string|WP_Widget $widget Widget class.
74
+         * @param null             $param  Who knows.
75
+         */
76
+        public function register( $widget, $param = null ) {
77
+            $this->widgets[ $widget ] = new $widget( $param );
78
+        }
79
+    }
80
+
81
+    /**
82
+     * Class Redux_Social_Widget_Display
83
+     */
84
+    class Redux_Social_Widget_Display extends WP_Widget {
85
+
86
+        public $show_instance_in_rest = true;
87
+
88
+        /**
89
+         * Redux_Social_Widget_Display constructor.
90
+         *
91
+         * @param array $params Params.
92
+         */
93
+        public function __construct( $params ) {
94
+
95
+            extract( $params ); // phpcs:ignore WordPress.PHP.DontExtract
96
+
97
+            $this->parent   = $parent;
98
+            $this->field_id = $field_id;
99
+
100
+            $widget_ops = array(
101
+                'classname'   => 'redux-social-icons-display',
102
+                'description' => __( 'Display social media links', 'redux-framework' ),
103
+                'show_instance_in_rest' => true
104
+            );
105
+
106
+            $control_ops = array(
107
+                'width'                 => 250,
108
+                'height'                => 200,
109
+                'id_base'               => 'redux-social-icons-display',
110
+                'show_instance_in_rest' => true,
111
+            );
112
+
113
+            parent::__construct( 'redux-social-icons-display', 'Redux Social Widget', $widget_ops, $control_ops );
114
+        }
115
+
116
+        /**
117
+         * Widget render.
118
+         *
119
+         * @param array $args Args.
120
+         * @param array $instance Instance.
121
+         */
122
+        public function widget( $args, $instance ) {
123
+            include_once 'class-redux-social-profiles-functions.php';
124
+
125
+            extract( $args, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract
126
+
127
+            $title         = $instance['title'];
128
+            $redux_options = get_option( $this->parent->args['opt_name'] );
129
+
130
+            $social_items = $redux_options[ $this->field_id ];
131
+
132
+            echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput
133
+
134
+            if ( $title ) {
135
+                echo $before_title . esc_html( $title ) . $after_title; // phpcs:ignore WordPress.Security.EscapeOutput
136
+            }
137
+
138
+            ?>
139 139
 			<ul class="redux-social-media-list clearfix">
140 140
 				<?php
141
-				if ( is_array( $social_items ) ) {
142
-					foreach ( $social_items as $social_item ) {
143
-						if ( $social_item['enabled'] ) {
144
-							$icon       = $social_item['icon'];
145
-							$color      = $social_item['color'];
146
-							$background = $social_item['background'];
147
-							$base_url   = $social_item['url'];
148
-							$id         = $social_item['id'];
149
-
150
-							// phpcs:ignore WordPress.NamingConventions.ValidHookName
151
-							$url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
152
-
153
-							echo '<li>';
154
-							echo '<a href="' . esc_url( $url ) . '">';
155
-							Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, '' );
156
-							echo '</a>';
157
-							echo '</li>';
158
-						}
159
-					}
160
-				}
161
-				?>
141
+                if ( is_array( $social_items ) ) {
142
+                    foreach ( $social_items as $social_item ) {
143
+                        if ( $social_item['enabled'] ) {
144
+                            $icon       = $social_item['icon'];
145
+                            $color      = $social_item['color'];
146
+                            $background = $social_item['background'];
147
+                            $base_url   = $social_item['url'];
148
+                            $id         = $social_item['id'];
149
+
150
+                            // phpcs:ignore WordPress.NamingConventions.ValidHookName
151
+                            $url = apply_filters( 'redux/extensions/social_profiles/' . $this->parent->args['opt_name'] . '/icon_url', $id, $base_url );
152
+
153
+                            echo '<li>';
154
+                            echo '<a href="' . esc_url( $url ) . '">';
155
+                            Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, '' );
156
+                            echo '</a>';
157
+                            echo '</li>';
158
+                        }
159
+                    }
160
+                }
161
+                ?>
162 162
 			</ul>
163 163
 			<?php
164 164
 
165
-			echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput
166
-		}
167
-
168
-		/**
169
-		 * Update Widget.
170
-		 *
171
-		 * @param array $new_instance New instance.
172
-		 * @param array $old_instance Old instance.
173
-		 *
174
-		 * @return array
175
-		 */
176
-		public function update( $new_instance, $old_instance ): array {
177
-			$instance          = $old_instance;
178
-			$instance['title'] = wp_strip_all_tags( $new_instance['title'] ?? '' );
179
-
180
-			return $instance;
181
-		}
182
-
183
-		/**
184
-		 * Render widget form.
185
-		 *
186
-		 * @param array $instance Instance.
187
-		 *
188
-		 * @return void
189
-		 */
190
-		public function form( $instance ) {
191
-			$defaults = array(
192
-				'title' => esc_html__( 'Social', 'redux-framework' ),
193
-			);
194
-
195
-			$instance = wp_parse_args( (array) $instance, $defaults );
196
-			?>
165
+            echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput
166
+        }
167
+
168
+        /**
169
+         * Update Widget.
170
+         *
171
+         * @param array $new_instance New instance.
172
+         * @param array $old_instance Old instance.
173
+         *
174
+         * @return array
175
+         */
176
+        public function update( $new_instance, $old_instance ): array {
177
+            $instance          = $old_instance;
178
+            $instance['title'] = wp_strip_all_tags( $new_instance['title'] ?? '' );
179
+
180
+            return $instance;
181
+        }
182
+
183
+        /**
184
+         * Render widget form.
185
+         *
186
+         * @param array $instance Instance.
187
+         *
188
+         * @return void
189
+         */
190
+        public function form( $instance ) {
191
+            $defaults = array(
192
+                'title' => esc_html__( 'Social', 'redux-framework' ),
193
+            );
194
+
195
+            $instance = wp_parse_args( (array) $instance, $defaults );
196
+            ?>
197 197
 			<p>
198 198
 				<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
199 199
 					<?php esc_html_e( 'Title', 'redux-framework' ); ?>
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 				</label>
207 207
 				<label for="redux-social-icons-info">
208 208
 					<?php
209
-					$tab  = Redux_Helpers::tab_from_field( $this->parent, 'social_profiles' );
210
-					$slug = $this->parent->args['page_slug'];
209
+                    $tab  = Redux_Helpers::tab_from_field( $this->parent, 'social_profiles' );
210
+                    $slug = $this->parent->args['page_slug'];
211 211
 
212
-					// translators: %1$s: Settings page URL.  %2$s: Closing a tag.
213
-					printf( esc_html__( 'Control which icons are displayed and their urls on the %1$sssettings page%2$s', 'redux-framework' ), '<a href="' . esc_url( admin_url( 'admin.php?page=' . esc_attr( $slug ) . '&tab=' . esc_attr( $tab ) ) ) . '">', '</a>' );
214
-					?>
212
+                    // translators: %1$s: Settings page URL.  %2$s: Closing a tag.
213
+                    printf( esc_html__( 'Control which icons are displayed and their urls on the %1$sssettings page%2$s', 'redux-framework' ), '<a href="' . esc_url( admin_url( 'admin.php?page=' . esc_attr( $slug ) . '&tab=' . esc_attr( $tab ) ) ) . '">', '</a>' );
214
+                    ?>
215 215
 				</label>
216 216
 			</p>
217 217
 			<?php
218
-		}
219
-	}
218
+        }
219
+    }
220 220
 }
Please login to merge, or discard this patch.
redux-templates/classes/class-template-overrides.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Template_Overrides {
20 20
 
21
-	/**
22
-	 * ReduxTemplates Template_Overrides.
23
-	 *
24
-	 * @since 4.0.0
25
-	 */
26
-	public function __construct() {
27
-	}
28
-
29
-	/**
30
-	 * Detects if the current page has blocks or not.
31
-	 *
32
-	 * @return bool
33
-	 * @since 4.0.0
34
-	 */
35
-	public static function is_gutenberg(): bool {
36
-		global $post;
37
-		if ( function_exists( 'has_blocks' ) && has_blocks( $post->ID ) ) {
38
-			return true;
39
-		}
40
-
41
-		return false;
42
-	}
43
-
44
-	/**
45
-	 * Detects the current theme and provides overrides.
46
-	 *
47
-	 * @return string
48
-	 * @since 4.0.0
49
-	 */
50
-	public static function get_overrides(): string {
51
-
52
-		if ( ! self::is_gutenberg() ) {
53
-			return '';
54
-		}
55
-
56
-		$template = mb_strtolower( get_template() );
57
-
58
-		$css = '';
59
-		if ( method_exists( __CLASS__, $template ) ) {
60
-			$css = call_user_func( array( __CLASS__, $template ) );
61
-			$css = preg_replace( '/\s+/S', ' ', $css );
62
-		}
63
-
64
-		$css .= <<<'EOD'
21
+    /**
22
+     * ReduxTemplates Template_Overrides.
23
+     *
24
+     * @since 4.0.0
25
+     */
26
+    public function __construct() {
27
+    }
28
+
29
+    /**
30
+     * Detects if the current page has blocks or not.
31
+     *
32
+     * @return bool
33
+     * @since 4.0.0
34
+     */
35
+    public static function is_gutenberg(): bool {
36
+        global $post;
37
+        if ( function_exists( 'has_blocks' ) && has_blocks( $post->ID ) ) {
38
+            return true;
39
+        }
40
+
41
+        return false;
42
+    }
43
+
44
+    /**
45
+     * Detects the current theme and provides overrides.
46
+     *
47
+     * @return string
48
+     * @since 4.0.0
49
+     */
50
+    public static function get_overrides(): string {
51
+
52
+        if ( ! self::is_gutenberg() ) {
53
+            return '';
54
+        }
55
+
56
+        $template = mb_strtolower( get_template() );
57
+
58
+        $css = '';
59
+        if ( method_exists( __CLASS__, $template ) ) {
60
+            $css = call_user_func( array( __CLASS__, $template ) );
61
+            $css = preg_replace( '/\s+/S', ' ', $css );
62
+        }
63
+
64
+        $css .= <<<'EOD'
65 65
 			#main {
66 66
 				padding: unset !important;
67 67
 			}
@@ -78,68 +78,68 @@  discard block
 block discarded – undo
78 78
 			}
79 79
 }
80 80
 EOD;
81
-		// Remove comments.
82
-		$css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
83
-		// Remove space after colons.
84
-		$css = str_replace( ': ', ':', $css );
85
-		// Remove space after commas.
86
-		$css = str_replace( ', ', ',', $css );
87
-		// Remove space after opening bracket.
88
-		$css = str_replace( ' {', '{', $css );
89
-		// Remove whitespace.
90
-		return str_replace( array( "\r\n", "\r", "\n", "\t", '  ', '    ', '    ' ), '', $css );
91
-	}
92
-
93
-	/**
94
-	 * Consulting theme overrides.
95
-	 *
96
-	 * @return string
97
-	 * @since 4.0.0
98
-	 */
99
-	public static function consulting(): string {
100
-		return <<<'EOD'
81
+        // Remove comments.
82
+        $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
83
+        // Remove space after colons.
84
+        $css = str_replace( ': ', ':', $css );
85
+        // Remove space after commas.
86
+        $css = str_replace( ', ', ',', $css );
87
+        // Remove space after opening bracket.
88
+        $css = str_replace( ' {', '{', $css );
89
+        // Remove whitespace.
90
+        return str_replace( array( "\r\n", "\r", "\n", "\t", '  ', '    ', '    ' ), '', $css );
91
+    }
92
+
93
+    /**
94
+     * Consulting theme overrides.
95
+     *
96
+     * @return string
97
+     * @since 4.0.0
98
+     */
99
+    public static function consulting(): string {
100
+        return <<<'EOD'
101 101
 			#content-core {
102 102
 				max-width: 100%;
103 103
 			}
104 104
 EOD;
105
-	}
106
-
107
-	/**
108
-	 * Avada theme overrides.
109
-	 *
110
-	 * @return string
111
-	 * @since 4.0.0
112
-	 */
113
-	public static function avada(): string {
114
-		return <<<'EOD'
105
+    }
106
+
107
+    /**
108
+     * Avada theme overrides.
109
+     *
110
+     * @return string
111
+     * @since 4.0.0
112
+     */
113
+    public static function avada(): string {
114
+        return <<<'EOD'
115 115
 			#main .fusion-row {
116 116
 				max-width: unset;
117 117
 			}
118 118
 EOD;
119
-	}
120
-
121
-	/**
122
-	 * GeneratePress theme overrides.
123
-	 *
124
-	 * @return string
125
-	 * @since 4.1.24
126
-	 */
127
-	public static function generatepress(): string {
128
-		return <<<'EOD'
119
+    }
120
+
121
+    /**
122
+     * GeneratePress theme overrides.
123
+     *
124
+     * @return string
125
+     * @since 4.1.24
126
+     */
127
+    public static function generatepress(): string {
128
+        return <<<'EOD'
129 129
 			.site-content {
130 130
                             display: block!important;
131 131
                         }
132 132
 EOD;
133
-	}
134
-
135
-	/**
136
-	 * TwentyTwenty theme overrides.
137
-	 *
138
-	 * @return string
139
-	 * @since 4.0.0
140
-	 */
141
-	public static function twentytwenty(): string {
142
-		return <<<'EOD'
133
+    }
134
+
135
+    /**
136
+     * TwentyTwenty theme overrides.
137
+     *
138
+     * @return string
139
+     * @since 4.0.0
140
+     */
141
+    public static function twentytwenty(): string {
142
+        return <<<'EOD'
143 143
 			[class*="__inner-container"] > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide) {
144 144
 				max-width: unset !important;
145 145
 			}
@@ -148,6 +148,6 @@  discard block
 block discarded – undo
148 148
 				margin-bottom: unset;
149 149
 			}
150 150
 EOD;
151
-	}
151
+    }
152 152
 
153 153
 }
Please login to merge, or discard this patch.
redux-templates/classes/templates/template-canvas.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,23 +19,23 @@
 block discarded – undo
19 19
 		<title><?php echo esc_html( wp_get_document_title() ); ?></title>
20 20
 	<?php endif; ?>
21 21
 	<?php
22
-		wp_head();
23
-		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
24
-		echo '<style id="redux-template-overrides">' . ReduxTemplates\Template_Overrides::get_overrides() . '</style>';
25
-	?>
22
+        wp_head();
23
+        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
24
+        echo '<style id="redux-template-overrides">' . ReduxTemplates\Template_Overrides::get_overrides() . '</style>';
25
+    ?>
26 26
 </head>
27 27
 <body <?php body_class(); ?>>
28 28
 <?php wp_body_open(); ?>
29 29
 <?php
30 30
 while ( have_posts() ) :
31
-	the_post();
32
-	the_content();
31
+    the_post();
32
+    the_content();
33 33
 
34
-	// If comments are open, or we have at least one comment, load up the comment template.
35
-	if ( comments_open() || get_comments_number() ) :
36
-		comments_template();
37
-	endif;
38
-	?>
34
+    // If comments are open, or we have at least one comment, load up the comment template.
35
+    if ( comments_open() || get_comments_number() ) :
36
+        comments_template();
37
+    endif;
38
+    ?>
39 39
 <?php endwhile; ?>
40 40
 <?php wp_footer(); ?>
41 41
 </body>
Please login to merge, or discard this patch.
redux-templates/classes/templates/template-full-width.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 echo '<style id="redux-template-overrides">' . ReduxTemplates\Template_Overrides::get_overrides() . '</style>';
15 15
 
16 16
 while ( have_posts() ) :
17
-	the_post();
18
-	the_content();
17
+    the_post();
18
+    the_content();
19 19
 
20
-	// If comments are open, or we have at least one comment, load up the comment template.
21
-	if ( comments_open() || get_comments_number() ) :
22
-		comments_template();
23
-	endif;
20
+    // If comments are open, or we have at least one comment, load up the comment template.
21
+    if ( comments_open() || get_comments_number() ) :
22
+        comments_template();
23
+    endif;
24 24
 endwhile; // End of the loop.
25 25
 
26 26
 get_footer();
Please login to merge, or discard this patch.
redux-templates/classes/templates/template-contained.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 echo '<style id="redux-template-overrides">' . ReduxTemplates\Template_Overrides::get_overrides() . '</style>';
15 15
 
16 16
 while ( have_posts() ) :
17
-	the_post();
18
-	the_content();
17
+    the_post();
18
+    the_content();
19 19
 
20
-	// If comments are open, or we have at least one comment, load up the comment template.
21
-	if ( comments_open() || get_comments_number() ) :
22
-		comments_template();
23
-	endif;
20
+    // If comments are open, or we have at least one comment, load up the comment template.
21
+    if ( comments_open() || get_comments_number() ) :
22
+        comments_template();
23
+    endif;
24 24
 endwhile; // End of the loop.
25 25
 
26 26
 get_footer();
Please login to merge, or discard this patch.
redux-core/inc/extensions/widget_areas/class-redux-widget-areas.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				if ( ! is_numeric( $counter ) ) {
162 162
 					$new_name = $name . ' 1';
163 163
 				} else {
164
-					$new_name = substr( $name, 0, - 1 ) . ( (int) $counter + 1 );
164
+					$new_name = substr( $name, 0, - 1 ) . ( ( int ) $counter + 1 );
165 165
 				}
166 166
 
167 167
 				$name = $this->check_widget_area_name( $new_name );
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 					$key                = array_search( $name, $this->widget_areas, true );
253 253
 
254 254
 					if ( $key >= 0 ) {
255
-						unset( $this->widget_areas[ $key ] );
255
+						unset( $this->widget_areas[$key] );
256 256
 						$this->save_widget_areas();
257 257
 					}
258 258
 
Please login to merge, or discard this patch.
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -12,84 +12,84 @@  discard block
 block discarded – undo
12 12
 // Don't duplicate me!
13 13
 if ( ! class_exists( 'Redux_Widget_Areas' ) ) {
14 14
 
15
-	/**
16
-	 * Main ReduxFramework customizer extension class
17
-	 *
18
-	 * @since       1.0.0
19
-	 */
20
-	class Redux_Widget_Areas {
21
-
22
-		/**
23
-		 * Extension URI.
24
-		 *
25
-		 * @var null|string
26
-		 */
27
-		private ?string $extension_url;
28
-
29
-		/** Extension directory.
30
-		 *
31
-		 * @var string
32
-		 */
33
-		private string $extension_dir;
34
-
35
-		/**
36
-		 * Array of enabled widget_areas
37
-		 *
38
-		 * @since    1.0.0
39
-		 * @var      array
40
-		 */
41
-		protected array $widget_areas = array();
42
-
43
-		/**
44
-		 * Widget array.
45
-		 *
46
-		 * @var array
47
-		 */
48
-		protected array $orig = array();
49
-
50
-		/**
51
-		 * ReduxFramework object.
52
-		 *
53
-		 * @var ReduxFramework
54
-		 */
55
-		private ReduxFramework $parent;
56
-
57
-		/**
58
-		 * Redux_Widget_Areas constructor.
59
-		 *
60
-		 * @param ReduxFramework $redux ReduxFramework pointer.
61
-		 */
62
-		public function __construct( ReduxFramework $redux ) {
63
-			global $pagenow;
64
-
65
-			$this->parent = $redux;
66
-
67
-			if ( empty( $this->extension_dir ) ) {
68
-				$this->extension_dir = trailingslashit( str_replace( '\\', '/', __DIR__ ) );
69
-				$this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
70
-			}
71
-
72
-			add_action( 'init', array( &$this, 'register_custom_widget_areas' ), 1000 );
73
-
74
-			if ( 'widgets.php' === $pagenow ) {
75
-				if ( true === $redux->args['widget_area'] ) {
76
-					add_action( 'admin_print_scripts', array( $this, 'add_new_widget_area_box' ) );
77
-				}
78
-				add_action( 'load-widgets.php', array( $this, 'add_widget_area_area' ), 100 );
79
-				add_action( 'load-widgets.php', array( $this, 'enqueue' ), 100 );
80
-			}
81
-		}
82
-
83
-		/**
84
-		 * Function to create the HTML used to create widget_areas.
85
-		 *
86
-		 * @since     1.0.0
87
-		 */
88
-		public function add_new_widget_area_box() {
89
-			$nonce     = wp_create_nonce( 'add-redux-widget_area-nonce' );
90
-			$del_nonce = wp_create_nonce( 'delete-redux-widget_area-nonce' );
91
-
92
-			?>
15
+    /**
16
+     * Main ReduxFramework customizer extension class
17
+     *
18
+     * @since       1.0.0
19
+     */
20
+    class Redux_Widget_Areas {
21
+
22
+        /**
23
+         * Extension URI.
24
+         *
25
+         * @var null|string
26
+         */
27
+        private ?string $extension_url;
28
+
29
+        /** Extension directory.
30
+         *
31
+         * @var string
32
+         */
33
+        private string $extension_dir;
34
+
35
+        /**
36
+         * Array of enabled widget_areas
37
+         *
38
+         * @since    1.0.0
39
+         * @var      array
40
+         */
41
+        protected array $widget_areas = array();
42
+
43
+        /**
44
+         * Widget array.
45
+         *
46
+         * @var array
47
+         */
48
+        protected array $orig = array();
49
+
50
+        /**
51
+         * ReduxFramework object.
52
+         *
53
+         * @var ReduxFramework
54
+         */
55
+        private ReduxFramework $parent;
56
+
57
+        /**
58
+         * Redux_Widget_Areas constructor.
59
+         *
60
+         * @param ReduxFramework $redux ReduxFramework pointer.
61
+         */
62
+        public function __construct( ReduxFramework $redux ) {
63
+            global $pagenow;
64
+
65
+            $this->parent = $redux;
66
+
67
+            if ( empty( $this->extension_dir ) ) {
68
+                $this->extension_dir = trailingslashit( str_replace( '\\', '/', __DIR__ ) );
69
+                $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
70
+            }
71
+
72
+            add_action( 'init', array( &$this, 'register_custom_widget_areas' ), 1000 );
73
+
74
+            if ( 'widgets.php' === $pagenow ) {
75
+                if ( true === $redux->args['widget_area'] ) {
76
+                    add_action( 'admin_print_scripts', array( $this, 'add_new_widget_area_box' ) );
77
+                }
78
+                add_action( 'load-widgets.php', array( $this, 'add_widget_area_area' ), 100 );
79
+                add_action( 'load-widgets.php', array( $this, 'enqueue' ), 100 );
80
+            }
81
+        }
82
+
83
+        /**
84
+         * Function to create the HTML used to create widget_areas.
85
+         *
86
+         * @since     1.0.0
87
+         */
88
+        public function add_new_widget_area_box() {
89
+            $nonce     = wp_create_nonce( 'add-redux-widget_area-nonce' );
90
+            $del_nonce = wp_create_nonce( 'delete-redux-widget_area-nonce' );
91
+
92
+            ?>
93 93
 			<script type="text/html" id="redux-add-widget-template">
94 94
 				<div id="redux-add-widget" class="widgets-holder-wrap">
95 95
 					<div class="">
@@ -122,191 +122,191 @@  discard block
 block discarded – undo
122 122
 				</div>
123 123
 			</script>
124 124
 			<?php
125
-		}
126
-
127
-		/**
128
-		 * Add widget area.
129
-		 */
130
-		public function add_widget_area_area() {
131
-			if ( isset( $_POST ) && isset( $_POST['redux-add-widget-nonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['redux-add-widget-nonce'] ) ), 'add-redux-widget_area-nonce' ) ) {
132
-				if ( ! empty( $_POST['redux-add-widget-input'] ) ) {
133
-					$this->widget_areas = $this->get_widget_areas();
134
-
135
-					$this->widget_areas[] = $this->check_widget_area_name( sanitize_text_field( wp_unslash( $_POST['redux-add-widget-input'] ) ) );
136
-
137
-					$this->save_widget_areas();
138
-
139
-					wp_safe_redirect( admin_url( 'widgets.php' ) );
140
-
141
-					die();
142
-				}
143
-			}
144
-		}
145
-
146
-		/**
147
-		 * Before we create a new widget_area, verify it doesn't already exist. If it does, append a number to the name.
148
-		 *
149
-		 * @param    string $name Name of the widget_area to be created.
150
-		 *
151
-		 * @return    string|void     $name Name of the new widget_area just created.
152
-		 * @since     1.0.0
153
-		 */
154
-		private function check_widget_area_name( string $name ) {
155
-			if ( empty( $GLOBALS['wp_registered_widget_areas'] ) ) {
156
-				return $name;
157
-			}
158
-
159
-			$taken = array();
160
-
161
-			foreach ( $GLOBALS['wp_registered_widget_areas'] as $widget_area ) {
162
-				$taken[] = $widget_area['name'];
163
-			}
164
-
165
-			$taken = array_merge( $taken, $this->widget_areas );
166
-
167
-			if ( in_array( $name, $taken, true ) ) {
168
-				$counter = substr( $name, - 1 );
169
-
170
-				if ( ! is_numeric( $counter ) ) {
171
-					$new_name = $name . ' 1';
172
-				} else {
173
-					$new_name = substr( $name, 0, - 1 ) . ( (int) $counter + 1 );
174
-				}
175
-
176
-				$name = $this->check_widget_area_name( $new_name );
177
-			}
178
-
179
-			echo $name; // phpcs:disable WordPress.Security.EscapeOutput
180
-
181
-			exit();
182
-		}
183
-
184
-		/**
185
-		 * Save Widget Areas.
186
-		 */
187
-		private function save_widget_areas() {
188
-			set_theme_mod( 'redux-widget-areas', array_unique( $this->widget_areas ) );
189
-		}
190
-
191
-		/**
192
-		 * Register and display the custom widget_area areas we have set.
193
-		 *
194
-		 * @since     1.0.0
195
-		 */
196
-		public function register_custom_widget_areas() {
197
-
198
-			// If the single instance hasn't been set, set it now.
199
-			if ( empty( $this->widget_areas ) ) {
200
-				$this->widget_areas = $this->get_widget_areas();
201
-			}
202
-
203
-			// phpcs:ignore WordPress.NamingConventions.ValidHookName
204
-			$this->orig = array_unique( apply_filters( 'redux/' . $this->parent->args['opt_name'] . '/widget_areas', array() ) );
205
-
206
-			if ( ! empty( $this->orig ) && $this->orig !== $this->widget_areas ) {
207
-				$this->widget_areas = array_unique( array_merge( $this->widget_areas, $this->orig ) );
208
-				$this->save_widget_areas();
209
-			}
210
-
211
-			$options = array(
212
-				'before_title'  => '<h3 class="widgettitle">',
213
-				'after_title'   => '</h3>',
214
-				'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
215
-				'after_widget'  => '</div>',
216
-			);
217
-
218
-			$options = apply_filters( 'redux_custom_widget_args', $options );
219
-
220
-			foreach ( array_unique( $this->widget_areas ) as $widget_area ) {
221
-				$options['class'] = 'redux-custom';
222
-				$options['name']  = $widget_area;
223
-				$options['id']    = sanitize_key( $widget_area );
224
-
225
-				register_sidebar( $options );
226
-			}
227
-		}
228
-
229
-
230
-		/**
231
-		 * Return the widget_areas array.
232
-		 *
233
-		 * @since     1.0.0
234
-		 * @return    array    If not empty, active redux widget_areas are returned.
235
-		 */
236
-		public function get_widget_areas(): array {
237
-
238
-			// If the single instance hasn't been set, set it now.
239
-			if ( ! empty( $this->widget_areas ) ) {
240
-				return $this->widget_areas;
241
-			}
242
-
243
-			$db = get_theme_mod( 'redux-widget-areas' );
244
-
245
-			if ( ! empty( $db ) ) {
246
-				$this->widget_areas = array_unique( array_merge( $this->widget_areas, $db ) );
247
-			}
248
-
249
-			return $this->widget_areas;
250
-		}
251
-
252
-		/**
253
-		 * Delete widget area.
254
-		 */
255
-		public function redux_delete_widget_area_area() {
256
-			if ( isset( $_POST ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'delete-redux-widget_area-nonce' ) ) {
257
-				if ( isset( $_POST['name'] ) && ! empty( sanitize_text_field( wp_unslash( $_POST['name'] ) ) ) ) {
258
-					$name               = sanitize_text_field( wp_unslash( $_POST['name'] ) );
259
-					$this->widget_areas = $this->get_widget_areas();
260
-					$key                = array_search( $name, $this->widget_areas, true );
261
-
262
-					if ( $key >= 0 ) {
263
-						unset( $this->widget_areas[ $key ] );
264
-						$this->save_widget_areas();
265
-					}
266
-
267
-					echo 'widget_area-deleted';
268
-				}
269
-			}
270
-
271
-			die();
272
-		}
273
-
274
-		/**
275
-		 * Enqueue support files.
276
-		 */
277
-		public function enqueue() {
278
-			$min = Redux_Functions::is_min();
279
-
280
-			wp_enqueue_style( 'dashicons' );
281
-
282
-			wp_enqueue_script(
283
-				'redux-widget-areas',
284
-				$this->extension_url . 'redux-extension-widget-areas' . $min . '.js',
285
-				array( 'jquery' ),
286
-				Redux_Extension_Widget_Areas::$version,
287
-				true
288
-			);
289
-
290
-			if ( $this->parent->args['dev_mode'] ) {
291
-				wp_enqueue_style(
292
-					'redux-widget-areas',
293
-					$this->extension_url . 'redux-extension-widget-areas.css',
294
-					array(),
295
-					Redux_Extension_Widget_Areas::$version
296
-				);
297
-			}
298
-
299
-			// Localize script.
300
-			wp_localize_script(
301
-				'redux-widget-areas',
302
-				'reduxWidgetAreasLocalize',
303
-				array(
304
-					'count'   => count( $this->orig ),
305
-					'delete'  => esc_html__( 'Delete', 'redux-framework' ),
306
-					'confirm' => esc_html__( 'Confirm', 'redux-framework' ),
307
-					'cancel'  => esc_html__( 'Cancel', 'redux-framework' ),
308
-				)
309
-			);
310
-		}
311
-	}
125
+        }
126
+
127
+        /**
128
+         * Add widget area.
129
+         */
130
+        public function add_widget_area_area() {
131
+            if ( isset( $_POST ) && isset( $_POST['redux-add-widget-nonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['redux-add-widget-nonce'] ) ), 'add-redux-widget_area-nonce' ) ) {
132
+                if ( ! empty( $_POST['redux-add-widget-input'] ) ) {
133
+                    $this->widget_areas = $this->get_widget_areas();
134
+
135
+                    $this->widget_areas[] = $this->check_widget_area_name( sanitize_text_field( wp_unslash( $_POST['redux-add-widget-input'] ) ) );
136
+
137
+                    $this->save_widget_areas();
138
+
139
+                    wp_safe_redirect( admin_url( 'widgets.php' ) );
140
+
141
+                    die();
142
+                }
143
+            }
144
+        }
145
+
146
+        /**
147
+         * Before we create a new widget_area, verify it doesn't already exist. If it does, append a number to the name.
148
+         *
149
+         * @param    string $name Name of the widget_area to be created.
150
+         *
151
+         * @return    string|void     $name Name of the new widget_area just created.
152
+         * @since     1.0.0
153
+         */
154
+        private function check_widget_area_name( string $name ) {
155
+            if ( empty( $GLOBALS['wp_registered_widget_areas'] ) ) {
156
+                return $name;
157
+            }
158
+
159
+            $taken = array();
160
+
161
+            foreach ( $GLOBALS['wp_registered_widget_areas'] as $widget_area ) {
162
+                $taken[] = $widget_area['name'];
163
+            }
164
+
165
+            $taken = array_merge( $taken, $this->widget_areas );
166
+
167
+            if ( in_array( $name, $taken, true ) ) {
168
+                $counter = substr( $name, - 1 );
169
+
170
+                if ( ! is_numeric( $counter ) ) {
171
+                    $new_name = $name . ' 1';
172
+                } else {
173
+                    $new_name = substr( $name, 0, - 1 ) . ( (int) $counter + 1 );
174
+                }
175
+
176
+                $name = $this->check_widget_area_name( $new_name );
177
+            }
178
+
179
+            echo $name; // phpcs:disable WordPress.Security.EscapeOutput
180
+
181
+            exit();
182
+        }
183
+
184
+        /**
185
+         * Save Widget Areas.
186
+         */
187
+        private function save_widget_areas() {
188
+            set_theme_mod( 'redux-widget-areas', array_unique( $this->widget_areas ) );
189
+        }
190
+
191
+        /**
192
+         * Register and display the custom widget_area areas we have set.
193
+         *
194
+         * @since     1.0.0
195
+         */
196
+        public function register_custom_widget_areas() {
197
+
198
+            // If the single instance hasn't been set, set it now.
199
+            if ( empty( $this->widget_areas ) ) {
200
+                $this->widget_areas = $this->get_widget_areas();
201
+            }
202
+
203
+            // phpcs:ignore WordPress.NamingConventions.ValidHookName
204
+            $this->orig = array_unique( apply_filters( 'redux/' . $this->parent->args['opt_name'] . '/widget_areas', array() ) );
205
+
206
+            if ( ! empty( $this->orig ) && $this->orig !== $this->widget_areas ) {
207
+                $this->widget_areas = array_unique( array_merge( $this->widget_areas, $this->orig ) );
208
+                $this->save_widget_areas();
209
+            }
210
+
211
+            $options = array(
212
+                'before_title'  => '<h3 class="widgettitle">',
213
+                'after_title'   => '</h3>',
214
+                'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
215
+                'after_widget'  => '</div>',
216
+            );
217
+
218
+            $options = apply_filters( 'redux_custom_widget_args', $options );
219
+
220
+            foreach ( array_unique( $this->widget_areas ) as $widget_area ) {
221
+                $options['class'] = 'redux-custom';
222
+                $options['name']  = $widget_area;
223
+                $options['id']    = sanitize_key( $widget_area );
224
+
225
+                register_sidebar( $options );
226
+            }
227
+        }
228
+
229
+
230
+        /**
231
+         * Return the widget_areas array.
232
+         *
233
+         * @since     1.0.0
234
+         * @return    array    If not empty, active redux widget_areas are returned.
235
+         */
236
+        public function get_widget_areas(): array {
237
+
238
+            // If the single instance hasn't been set, set it now.
239
+            if ( ! empty( $this->widget_areas ) ) {
240
+                return $this->widget_areas;
241
+            }
242
+
243
+            $db = get_theme_mod( 'redux-widget-areas' );
244
+
245
+            if ( ! empty( $db ) ) {
246
+                $this->widget_areas = array_unique( array_merge( $this->widget_areas, $db ) );
247
+            }
248
+
249
+            return $this->widget_areas;
250
+        }
251
+
252
+        /**
253
+         * Delete widget area.
254
+         */
255
+        public function redux_delete_widget_area_area() {
256
+            if ( isset( $_POST ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'delete-redux-widget_area-nonce' ) ) {
257
+                if ( isset( $_POST['name'] ) && ! empty( sanitize_text_field( wp_unslash( $_POST['name'] ) ) ) ) {
258
+                    $name               = sanitize_text_field( wp_unslash( $_POST['name'] ) );
259
+                    $this->widget_areas = $this->get_widget_areas();
260
+                    $key                = array_search( $name, $this->widget_areas, true );
261
+
262
+                    if ( $key >= 0 ) {
263
+                        unset( $this->widget_areas[ $key ] );
264
+                        $this->save_widget_areas();
265
+                    }
266
+
267
+                    echo 'widget_area-deleted';
268
+                }
269
+            }
270
+
271
+            die();
272
+        }
273
+
274
+        /**
275
+         * Enqueue support files.
276
+         */
277
+        public function enqueue() {
278
+            $min = Redux_Functions::is_min();
279
+
280
+            wp_enqueue_style( 'dashicons' );
281
+
282
+            wp_enqueue_script(
283
+                'redux-widget-areas',
284
+                $this->extension_url . 'redux-extension-widget-areas' . $min . '.js',
285
+                array( 'jquery' ),
286
+                Redux_Extension_Widget_Areas::$version,
287
+                true
288
+            );
289
+
290
+            if ( $this->parent->args['dev_mode'] ) {
291
+                wp_enqueue_style(
292
+                    'redux-widget-areas',
293
+                    $this->extension_url . 'redux-extension-widget-areas.css',
294
+                    array(),
295
+                    Redux_Extension_Widget_Areas::$version
296
+                );
297
+            }
298
+
299
+            // Localize script.
300
+            wp_localize_script(
301
+                'redux-widget-areas',
302
+                'reduxWidgetAreasLocalize',
303
+                array(
304
+                    'count'   => count( $this->orig ),
305
+                    'delete'  => esc_html__( 'Delete', 'redux-framework' ),
306
+                    'confirm' => esc_html__( 'Confirm', 'redux-framework' ),
307
+                    'cancel'  => esc_html__( 'Cancel', 'redux-framework' ),
308
+                )
309
+            );
310
+        }
311
+    }
312 312
 }
Please login to merge, or discard this patch.
sample/sections/extensions/google-maps.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 				'full_width'   => true,
41 41
 				'default'      => array(
42 42
 					'latitude'  => 38.8976758,
43
-					'longitude' => - 77.03648229999999,
43
+					'longitude' => -77.03648229999999,
44 44
 					'zoom'      => 7,
45 45
 				),
46 46
 			),
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,42 +10,42 @@
 block discarded – undo
10 10
 defined( 'ABSPATH' ) || exit;
11 11
 
12 12
 Redux::set_section(
13
-	$opt_name,
14
-	array(
15
-		'title'      => esc_html__( 'Google Maps', 'your-textdomain-here' ),
16
-		'desc'       => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/google-maps.html" target="_blank">https://devs.redux.io/core-extensions/google-maps.html</a>',
17
-		'subsection' => true,
18
-		'fields'     => array(
19
-			array(
20
-				'id'           => 'location_geocode',
21
-				'type'         => 'google_maps',
22
-				'title'        => esc_html__( 'Google Maps', 'your-textdomain-here' ),
23
-				'subtitle'     => esc_html__( 'This map is set using only address information with a zoom factor of 3.  Lat/Long is returned automatically.', 'your-textdomain-here' ),
24
-				'show_api_key' => true,
25
-				'default'      => array(
26
-					'zoom'                        => '17', // Zoom far: 3 zoom close 17.
27
-					'street_number'               => '1600', // Address.
28
-					'route'                       => 'Pennsylvania Avenue', // STREET.
29
-					'locality'                    => 'Washington', // CITY.
30
-					'administrative_area_level_1' => 'DC', // STATE.
31
-					'postal_code'                 => '20500',
32
-					'country'                     => 'United States',
33
-				),
34
-			),
35
-			array(
36
-				'id'           => 'location_geocode2',
37
-				'type'         => 'google_maps',
38
-				'title'        => esc_html__( 'Google Maps', 'your-textdomain-here' ),
39
-				'subtitle'     => esc_html__( 'This map is set using only latitude and longitude with a zoom factor of 7.  When setting a Google map using lat/long, address information will not be returned.', 'your-textdomain-here' ),
40
-				'show_api_key' => false,
41
-				'full_width'   => true,
42
-				'default'      => array(
43
-					'latitude'  => 38.8976758,
44
-					'longitude' => - 77.03648229999999,
45
-					'zoom'      => 7,
46
-				),
47
-			),
48
-		),
49
-	)
13
+    $opt_name,
14
+    array(
15
+        'title'      => esc_html__( 'Google Maps', 'your-textdomain-here' ),
16
+        'desc'       => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/google-maps.html" target="_blank">https://devs.redux.io/core-extensions/google-maps.html</a>',
17
+        'subsection' => true,
18
+        'fields'     => array(
19
+            array(
20
+                'id'           => 'location_geocode',
21
+                'type'         => 'google_maps',
22
+                'title'        => esc_html__( 'Google Maps', 'your-textdomain-here' ),
23
+                'subtitle'     => esc_html__( 'This map is set using only address information with a zoom factor of 3.  Lat/Long is returned automatically.', 'your-textdomain-here' ),
24
+                'show_api_key' => true,
25
+                'default'      => array(
26
+                    'zoom'                        => '17', // Zoom far: 3 zoom close 17.
27
+                    'street_number'               => '1600', // Address.
28
+                    'route'                       => 'Pennsylvania Avenue', // STREET.
29
+                    'locality'                    => 'Washington', // CITY.
30
+                    'administrative_area_level_1' => 'DC', // STATE.
31
+                    'postal_code'                 => '20500',
32
+                    'country'                     => 'United States',
33
+                ),
34
+            ),
35
+            array(
36
+                'id'           => 'location_geocode2',
37
+                'type'         => 'google_maps',
38
+                'title'        => esc_html__( 'Google Maps', 'your-textdomain-here' ),
39
+                'subtitle'     => esc_html__( 'This map is set using only latitude and longitude with a zoom factor of 7.  When setting a Google map using lat/long, address information will not be returned.', 'your-textdomain-here' ),
40
+                'show_api_key' => false,
41
+                'full_width'   => true,
42
+                'default'      => array(
43
+                    'latitude'  => 38.8976758,
44
+                    'longitude' => - 77.03648229999999,
45
+                    'zoom'      => 7,
46
+                ),
47
+            ),
48
+        ),
49
+    )
50 50
 );
51 51
 // phpcs:enable
Please login to merge, or discard this patch.
inc/extensions/google_maps/google_maps/class-redux-google-maps.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 				'street_number'               => $def_street_number,
59 59
 				'route'                       => $def_route,
60 60
 				'locality'                    => $def_locality,
61
-				'administrative_area_level_1' => $def_state,    // <-dickheads at google. lol, srsly...wtf?
61
+				'administrative_area_level_1' => $def_state, // <-dickheads at google. lol, srsly...wtf?
62 62
 				// level_1 huh? maybe It's for multiple planets one day.
63 63
 				'postal_code'                 => $def_postal,
64 64
 				'country'                     => $def_country,
Please login to merge, or discard this patch.
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -11,145 +11,145 @@  discard block
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Google_Maps' ) ) {
13 13
 
14
-	/**
15
-	 * Main ReduxFramework_google_maps class
16
-	 *
17
-	 * @since       1.0.0
18
-	 */
19
-	class Redux_Google_Maps extends Redux_Field {
20
-
21
-		/**
22
-		 * API Key.
23
-		 *
24
-		 * @var string|null
25
-		 */
26
-		private ?string $api_key = '';
27
-
28
-		/**
29
-		 * Get field defaults.
30
-		 */
31
-		public function set_defaults() {
32
-			$field = array(
33
-				'api_key'     => '',
34
-				'map_version' => 'weekly',
35
-			);
36
-
37
-			$this->field = wp_parse_args( $this->field, $field );
38
-
39
-			$this->api_key = null;
40
-
41
-			$this->field['api_key'] = $this->field['api_key'] ?? '';
42
-
43
-			if ( empty( $this->field['api_key'] ) ) {
44
-				$redux         = get_option( $this->parent->args['opt_name'] );
45
-				$this->api_key = $redux['google_map_api_key'] ?? '';
46
-			} else {
47
-				$this->api_key = $this->field['api_key'];
48
-			}
49
-
50
-			// Necessary, in case the user doesn't fill out a default array.
51
-			$def_street_number = $this->field['default']['street_number'] ?? '';
52
-			$def_route         = $this->field['default']['route'] ?? '';
53
-			$def_locality      = $this->field['default']['locality'] ?? '';
54
-			$def_state         = $this->field['default']['administrative_area_level_1'] ?? '';
55
-			$def_postal        = $this->field['default']['postal_code'] ?? '';
56
-			$def_country       = $this->field['default']['country'] ?? '';
57
-			$def_lat           = $this->field['default']['latitude'] ?? '';
58
-			$def_long          = $this->field['default']['longitude'] ?? '';
59
-			$def_marker_info   = $this->field['default']['marker_info'] ?? '';
60
-			$def_zoom          = $this->field['default']['zoom'] ?? '';
61
-
62
-			$defaults = array(
63
-				'latitude'                    => $def_lat,
64
-				'longitude'                   => $def_long,
65
-				'street_number'               => $def_street_number,
66
-				'route'                       => $def_route,
67
-				'locality'                    => $def_locality,
68
-				'administrative_area_level_1' => $def_state,    // <-dickheads at google. lol, srsly...wtf?
69
-				// level_1 huh? maybe It's for multiple planets one day.
70
-				'postal_code'                 => $def_postal,
71
-				'country'                     => $def_country,
72
-				'marker_info'                 => $def_marker_info,
73
-				'zoom'                        => $def_zoom,
74
-			);
75
-
76
-			$this->value = wp_parse_args( $this->value, $defaults );
77
-		}
78
-
79
-
80
-		/**
81
-		 * Field Render Function.
82
-		 * Takes the vars and outputs the HTML for the field in the settings
83
-		 *
84
-		 * @since       1.0.0
85
-		 * @access      public
86
-		 * @return      void
87
-		 */
88
-		public function render() {
89
-
90
-			// Set default or saved zoom
91
-			// USA: 39.11676722061108,-100.47761000000003
92
-			// Zoom far: 3
93
-			// zoom close 17.
94
-			if ( empty( $this->value['zoom'] ) ) {
95
-				if ( $this->value['street_number'] ) {
96
-					$the_zoom = 17; // make it close if the street is included.
97
-				} else {
98
-					$the_zoom = 3; // make it far if it's not.
99
-				}
100
-			} else {
101
-				$the_zoom = $this->value['zoom'];
102
-			}
103
-
104
-			// Make full address.
105
-			$locality = ! empty( $this->value['locality'] ) ? $this->value['locality'] . ', ' : '';
106
-			$route    = ! empty( $this->value['route'] ) ? $this->value['route'] . ', ' : '';
107
-			$country  = ! empty( $this->value['country'] ) ? ', ' . $this->value['country'] : '';
108
-
109
-			$full      = $this->value['street_number'] . ' ' . $route . ' ' . $locality . $this->value['administrative_area_level_1'] . ' ' . $this->value['postal_code'] . $country;
110
-			$data_full = rawurlencode( $full );
111
-
112
-			// Hide/show various input fields.
113
-			$show_address     = $this->field['show_address'] ?? true;
114
-			$show_city        = $this->field['show_city'] ?? true;
115
-			$show_state       = $this->field['show_state'] ?? true;
116
-			$show_postal      = $this->field['show_postal'] ?? true;
117
-			$show_country     = $this->field['show_country'] ?? true;
118
-			$show_lat         = $this->field['show_latitude'] ?? true;
119
-			$show_long        = $this->field['show_longitude'] ?? true;
120
-			$show_marker_info = $this->field['show_marker_info'] ?? true;
121
-			$show_controls    = $this->field['show_controls'] ?? true;
122
-
123
-			$this->field['placeholder']         = $this->field['placeholder'] ?? esc_html__( 'Enter your address', 'redux-framework' );
124
-			$this->field['marker_tooltip']      = $this->field['marker_tooltip'] ?? esc_html__( 'Left mouse down on top of me to move me!', 'redux-framework' );
125
-			$this->field['no_geometry_alert']   = $this->field['no_geometry_alert'] ?? esc_html__( 'The returned place contains no geometric data.', 'redux-framework' );
126
-			$this->field['delay_render']        = $this->field['delay_render'] ?? false;
127
-			$this->field['class']               = $this->field['class'] ?? '';
128
-			$this->field['show_api_key']        = $this->field['show_api_key'] ?? true;
129
-			$this->field['street_view_control'] = $this->field['street_view_control'] ?? true;
130
-			$this->field['map_type_control']    = $this->field['map_type_control'] ?? true;
131
-			$this->field['scroll_wheel']        = $this->field['scroll_wheel'] ?? false;
132
-			$this->field['map_height']          = $this->field['map_height'] ?? '';
133
-
134
-			$map_height = '';
135
-
136
-			if ( ! empty( $this->field['map_height'] ) ) {
137
-				$map_height = 'style="height:' . esc_attr( $this->field['map_height'] ) . ';"';
138
-			}
139
-
140
-			$geo_alert = rawurlencode( $this->field['no_geometry_alert'] );
141
-
142
-			// admin defined.
143
-			$the_lat        = $this->value['latitude'];
144
-			$the_long       = $this->value['longitude'];
145
-			$marker_tooltip = rawurlencode( $this->field['marker_tooltip'] );
146
-
147
-			if ( ! empty( $the_lat ) && ! empty( $the_long ) ) {
148
-				$full = '';
149
-			}
150
-
151
-			$hidden_style = ' style="display: none!important;" ';
152
-			?>
14
+    /**
15
+     * Main ReduxFramework_google_maps class
16
+     *
17
+     * @since       1.0.0
18
+     */
19
+    class Redux_Google_Maps extends Redux_Field {
20
+
21
+        /**
22
+         * API Key.
23
+         *
24
+         * @var string|null
25
+         */
26
+        private ?string $api_key = '';
27
+
28
+        /**
29
+         * Get field defaults.
30
+         */
31
+        public function set_defaults() {
32
+            $field = array(
33
+                'api_key'     => '',
34
+                'map_version' => 'weekly',
35
+            );
36
+
37
+            $this->field = wp_parse_args( $this->field, $field );
38
+
39
+            $this->api_key = null;
40
+
41
+            $this->field['api_key'] = $this->field['api_key'] ?? '';
42
+
43
+            if ( empty( $this->field['api_key'] ) ) {
44
+                $redux         = get_option( $this->parent->args['opt_name'] );
45
+                $this->api_key = $redux['google_map_api_key'] ?? '';
46
+            } else {
47
+                $this->api_key = $this->field['api_key'];
48
+            }
49
+
50
+            // Necessary, in case the user doesn't fill out a default array.
51
+            $def_street_number = $this->field['default']['street_number'] ?? '';
52
+            $def_route         = $this->field['default']['route'] ?? '';
53
+            $def_locality      = $this->field['default']['locality'] ?? '';
54
+            $def_state         = $this->field['default']['administrative_area_level_1'] ?? '';
55
+            $def_postal        = $this->field['default']['postal_code'] ?? '';
56
+            $def_country       = $this->field['default']['country'] ?? '';
57
+            $def_lat           = $this->field['default']['latitude'] ?? '';
58
+            $def_long          = $this->field['default']['longitude'] ?? '';
59
+            $def_marker_info   = $this->field['default']['marker_info'] ?? '';
60
+            $def_zoom          = $this->field['default']['zoom'] ?? '';
61
+
62
+            $defaults = array(
63
+                'latitude'                    => $def_lat,
64
+                'longitude'                   => $def_long,
65
+                'street_number'               => $def_street_number,
66
+                'route'                       => $def_route,
67
+                'locality'                    => $def_locality,
68
+                'administrative_area_level_1' => $def_state,    // <-dickheads at google. lol, srsly...wtf?
69
+                // level_1 huh? maybe It's for multiple planets one day.
70
+                'postal_code'                 => $def_postal,
71
+                'country'                     => $def_country,
72
+                'marker_info'                 => $def_marker_info,
73
+                'zoom'                        => $def_zoom,
74
+            );
75
+
76
+            $this->value = wp_parse_args( $this->value, $defaults );
77
+        }
78
+
79
+
80
+        /**
81
+         * Field Render Function.
82
+         * Takes the vars and outputs the HTML for the field in the settings
83
+         *
84
+         * @since       1.0.0
85
+         * @access      public
86
+         * @return      void
87
+         */
88
+        public function render() {
89
+
90
+            // Set default or saved zoom
91
+            // USA: 39.11676722061108,-100.47761000000003
92
+            // Zoom far: 3
93
+            // zoom close 17.
94
+            if ( empty( $this->value['zoom'] ) ) {
95
+                if ( $this->value['street_number'] ) {
96
+                    $the_zoom = 17; // make it close if the street is included.
97
+                } else {
98
+                    $the_zoom = 3; // make it far if it's not.
99
+                }
100
+            } else {
101
+                $the_zoom = $this->value['zoom'];
102
+            }
103
+
104
+            // Make full address.
105
+            $locality = ! empty( $this->value['locality'] ) ? $this->value['locality'] . ', ' : '';
106
+            $route    = ! empty( $this->value['route'] ) ? $this->value['route'] . ', ' : '';
107
+            $country  = ! empty( $this->value['country'] ) ? ', ' . $this->value['country'] : '';
108
+
109
+            $full      = $this->value['street_number'] . ' ' . $route . ' ' . $locality . $this->value['administrative_area_level_1'] . ' ' . $this->value['postal_code'] . $country;
110
+            $data_full = rawurlencode( $full );
111
+
112
+            // Hide/show various input fields.
113
+            $show_address     = $this->field['show_address'] ?? true;
114
+            $show_city        = $this->field['show_city'] ?? true;
115
+            $show_state       = $this->field['show_state'] ?? true;
116
+            $show_postal      = $this->field['show_postal'] ?? true;
117
+            $show_country     = $this->field['show_country'] ?? true;
118
+            $show_lat         = $this->field['show_latitude'] ?? true;
119
+            $show_long        = $this->field['show_longitude'] ?? true;
120
+            $show_marker_info = $this->field['show_marker_info'] ?? true;
121
+            $show_controls    = $this->field['show_controls'] ?? true;
122
+
123
+            $this->field['placeholder']         = $this->field['placeholder'] ?? esc_html__( 'Enter your address', 'redux-framework' );
124
+            $this->field['marker_tooltip']      = $this->field['marker_tooltip'] ?? esc_html__( 'Left mouse down on top of me to move me!', 'redux-framework' );
125
+            $this->field['no_geometry_alert']   = $this->field['no_geometry_alert'] ?? esc_html__( 'The returned place contains no geometric data.', 'redux-framework' );
126
+            $this->field['delay_render']        = $this->field['delay_render'] ?? false;
127
+            $this->field['class']               = $this->field['class'] ?? '';
128
+            $this->field['show_api_key']        = $this->field['show_api_key'] ?? true;
129
+            $this->field['street_view_control'] = $this->field['street_view_control'] ?? true;
130
+            $this->field['map_type_control']    = $this->field['map_type_control'] ?? true;
131
+            $this->field['scroll_wheel']        = $this->field['scroll_wheel'] ?? false;
132
+            $this->field['map_height']          = $this->field['map_height'] ?? '';
133
+
134
+            $map_height = '';
135
+
136
+            if ( ! empty( $this->field['map_height'] ) ) {
137
+                $map_height = 'style="height:' . esc_attr( $this->field['map_height'] ) . ';"';
138
+            }
139
+
140
+            $geo_alert = rawurlencode( $this->field['no_geometry_alert'] );
141
+
142
+            // admin defined.
143
+            $the_lat        = $this->value['latitude'];
144
+            $the_long       = $this->value['longitude'];
145
+            $marker_tooltip = rawurlencode( $this->field['marker_tooltip'] );
146
+
147
+            if ( ! empty( $the_lat ) && ! empty( $the_long ) ) {
148
+                $full = '';
149
+            }
150
+
151
+            $hidden_style = ' style="display: none!important;" ';
152
+            ?>
153 153
 
154 154
 			<div
155 155
 				class="redux_framework_google_maps <?php echo esc_attr( $this->field['class'] ); ?>"
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 						<div class="google_m_api_key_wrapper">
318 318
 							<p class="description" id="google_m_api_key_description">
319 319
 								<?php
320
-								$api_key_site     = ' ' . sprintf( '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">%s</a>', esc_html__( 'Get an API Key', 'redux-framework' ) ) . ' ';
321
-								$usage_limit_site = ' ' . sprintf( '<a href="https://developers.google.com/maps/documentation/javascript/usage" target="_blank">%s</a>', esc_html__( 'Google Map Usage Limits', 'redux-framework' ) ) . ' ';
320
+                                $api_key_site     = ' ' . sprintf( '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">%s</a>', esc_html__( 'Get an API Key', 'redux-framework' ) ) . ' ';
321
+                                $usage_limit_site = ' ' . sprintf( '<a href="https://developers.google.com/maps/documentation/javascript/usage" target="_blank">%s</a>', esc_html__( 'Google Map Usage Limits', 'redux-framework' ) ) . ' ';
322 322
 
323
-								// translators: %1$s: Google Maps API Key url. %2$s: Google Maps Usage URL.
324
-								echo sprintf( esc_html__( 'Google Maps supports 25,000 free map loads per 24 hours for 90 consecutive days.  In the events you run a high volume site, you may need to obtain an API Key to continue using Google Map output beyond the free quota.  To sign up for an API Key, please visit the %1$s site.  For more information about Google Map usage limits, please visit the %2$s guide.', 'redux-framework' ), $api_key_site, $usage_limit_site ) . '<br><br>' . esc_html__( 'Once you have obtained an API Key, please enter it in the text box below and save the options panel.', 'redux-framework' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
325
-								?>
323
+                                // translators: %1$s: Google Maps API Key url. %2$s: Google Maps Usage URL.
324
+                                echo sprintf( esc_html__( 'Google Maps supports 25,000 free map loads per 24 hours for 90 consecutive days.  In the events you run a high volume site, you may need to obtain an API Key to continue using Google Map output beyond the free quota.  To sign up for an API Key, please visit the %1$s site.  For more information about Google Map usage limits, please visit the %2$s guide.', 'redux-framework' ), $api_key_site, $usage_limit_site ) . '<br><br>' . esc_html__( 'Once you have obtained an API Key, please enter it in the text box below and save the options panel.', 'redux-framework' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
325
+                                ?>
326 326
 							</p>
327 327
 							<label for="google_m_api_key_input"><?php esc_html_e( 'API Key', 'redux-framework' ); ?></label>
328 328
 							<input
@@ -336,51 +336,51 @@  discard block
 block discarded – undo
336 336
 			</div>
337 337
 
338 338
 			<?php
339
-		}
340
-
341
-		/**
342
-		 * Enqueue Function.
343
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
344
-		 *
345
-		 * @since       1.0.0
346
-		 * @access      public
347
-		 * @return      void
348
-		 */
349
-		public function enqueue() {
350
-			$min = Redux_Functions::isMin();
351
-
352
-			$api_key = '';
353
-			if ( ! empty( $this->api_key ) ) {
354
-				$api_key = $this->api_key;
355
-			}
356
-
357
-			wp_register_script(
358
-				'redux-field-google-maps',
359
-				$this->url . 'redux-google-maps' . $min . '.js',
360
-				array( 'jquery', 'redux-js' ),
361
-				Redux_Extension_Google_Maps::$version,
362
-				true
363
-			);
364
-
365
-			if ( ! wp_script_is( 'redux-field-google-maps' ) ) {
366
-				$script = '(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
339
+        }
340
+
341
+        /**
342
+         * Enqueue Function.
343
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
344
+         *
345
+         * @since       1.0.0
346
+         * @access      public
347
+         * @return      void
348
+         */
349
+        public function enqueue() {
350
+            $min = Redux_Functions::isMin();
351
+
352
+            $api_key = '';
353
+            if ( ! empty( $this->api_key ) ) {
354
+                $api_key = $this->api_key;
355
+            }
356
+
357
+            wp_register_script(
358
+                'redux-field-google-maps',
359
+                $this->url . 'redux-google-maps' . $min . '.js',
360
+                array( 'jquery', 'redux-js' ),
361
+                Redux_Extension_Google_Maps::$version,
362
+                true
363
+            );
364
+
365
+            if ( ! wp_script_is( 'redux-field-google-maps' ) ) {
366
+                $script = '(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
367 367
 					key:"' . $api_key . '",
368 368
 					v:"' . $this->field['map_version'] . '",
369 369
 				});';
370 370
 
371
-				wp_add_inline_script( 'redux-field-google-maps', $script );
372
-			}
373
-
374
-			wp_enqueue_script( 'redux-field-google-maps' );
375
-
376
-			if ( $this->parent->args['dev_mode'] ) {
377
-				wp_enqueue_style(
378
-					'redux-field-google-maps',
379
-					$this->url . 'redux-google-maps.css',
380
-					array(),
381
-					Redux_Extension_Google_Maps::$version
382
-				);
383
-			}
384
-		}
385
-	}
371
+                wp_add_inline_script( 'redux-field-google-maps', $script );
372
+            }
373
+
374
+            wp_enqueue_script( 'redux-field-google-maps' );
375
+
376
+            if ( $this->parent->args['dev_mode'] ) {
377
+                wp_enqueue_style(
378
+                    'redux-field-google-maps',
379
+                    $this->url . 'redux-google-maps.css',
380
+                    array(),
381
+                    Redux_Extension_Google_Maps::$version
382
+                );
383
+            }
384
+        }
385
+    }
386 386
 }
Please login to merge, or discard this patch.
inc/extensions/custom_fonts/custom_fonts/class-redux-custom-fonts.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
 			$nonce = wp_create_nonce( 'redux_custom_fonts' );
58 58
 
59
-			$this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args[ 'opt_name' ]}/field/typography/custom_fonts", array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
59
+			$this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
60 60
 
61 61
 			if ( $can_convert ) {
62 62
 				echo '<div class="">';
Please login to merge, or discard this patch.
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -11,194 +11,194 @@
 block discarded – undo
11 11
 
12 12
 if ( ! class_exists( 'Redux_Custom_Fonts' ) ) {
13 13
 
14
-	/**
15
-	 * Main ReduxFramework_custom_fonts class
16
-	 *
17
-	 * @since       1.0.0
18
-	 */
19
-	class Redux_Custom_Fonts extends Redux_Field {
20
-
21
-		/**
22
-		 * Set field defaults.
23
-		 */
24
-		public function set_defaults() {
25
-			$defaults = array(
26
-				'convert' => false,
27
-				'eot'     => false,
28
-				'svg'     => false,
29
-				'ttf'     => false,
30
-				'woff'    => true,
31
-				'woff2'   => true,
32
-			);
33
-
34
-			$this->value = wp_parse_args( $this->value, $defaults );
35
-		}
36
-
37
-		/**
38
-		 * Field Render Function.
39
-		 * Takes the vars and outputs the HTML for the field in the settings
40
-		 *
41
-		 * @return      void
42
-		 * @since       1.0.0
43
-		 * @access      public
44
-		 */
45
-		public function render() {
46
-			echo '</fieldset></td></tr>';
47
-			echo '<tr>';
48
-			echo '<td colspan="2">';
49
-			echo '<fieldset
14
+    /**
15
+     * Main ReduxFramework_custom_fonts class
16
+     *
17
+     * @since       1.0.0
18
+     */
19
+    class Redux_Custom_Fonts extends Redux_Field {
20
+
21
+        /**
22
+         * Set field defaults.
23
+         */
24
+        public function set_defaults() {
25
+            $defaults = array(
26
+                'convert' => false,
27
+                'eot'     => false,
28
+                'svg'     => false,
29
+                'ttf'     => false,
30
+                'woff'    => true,
31
+                'woff2'   => true,
32
+            );
33
+
34
+            $this->value = wp_parse_args( $this->value, $defaults );
35
+        }
36
+
37
+        /**
38
+         * Field Render Function.
39
+         * Takes the vars and outputs the HTML for the field in the settings
40
+         *
41
+         * @return      void
42
+         * @since       1.0.0
43
+         * @access      public
44
+         */
45
+        public function render() {
46
+            echo '</fieldset></td></tr>';
47
+            echo '<tr>';
48
+            echo '<td colspan="2">';
49
+            echo '<fieldset
50 50
                     class="redux-field-container redux-field redux-field-init redux-container-custom_font"
51 51
                     data-type="' . esc_attr( $this->field['type'] ) . '"
52 52
                     data-id="' . esc_attr( $this->field['id'] ) . '"
53 53
                   >';
54 54
 
55
-			$can_convert = true;
56
-
57
-			$nonce = wp_create_nonce( 'redux_custom_fonts' );
58
-
59
-			$this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args[ 'opt_name' ]}/field/typography/custom_fonts", array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
60
-
61
-			if ( $can_convert ) {
62
-				echo '<div class="">';
63
-				echo '<label for="custom-font-convert">';
64
-				echo '<input type="hidden" class="checkbox-check" data-val="1" name="' . esc_attr( $this->field['name'] ) . '[convert]" value="' . esc_attr( $this->value['convert'] ) . '"/>';
65
-				echo '<input type="checkbox" class="checkbox" id="custom-font-convert" value="1"' . checked( $this->value['convert'], '1', false ) . '">';
66
-				echo 'Enable font conversion';
67
-				echo '</label>';
68
-				echo '</div>';
69
-				echo '</div>';
70
-			}
71
-
72
-			if ( ! empty( $this->field['custom_fonts'] ) ) {
73
-				foreach ( $this->field['custom_fonts'] as $section => $fonts ) {
74
-					if ( empty( $fonts ) ) {
75
-						continue;
76
-					}
77
-
78
-					echo '<h3>' . esc_html( $section ) . '</h3>';
79
-					echo '<div class="font-error" style="display: none;"><p><strong>' . esc_html__( 'Error', 'redux-framework' ) . '</strong>: <span></span></p></div>';
80
-
81
-					echo '<table class="wp-list-table widefat plugins" style="border-spacing:0;"><tbody>';
82
-
83
-					foreach ( $fonts as $font => $pieces ) {
84
-						echo '<tr class="active">';
85
-						echo '<td class="plugin-title" style="min-width: 40%"><strong>' . esc_html( $font ) . '</strong></td>';
86
-						echo '<td class="column-description desc">';
87
-						echo '<div class="plugin-description">';
88
-
89
-						if ( is_array( $pieces ) && ! empty( $pieces ) ) {
90
-							foreach ( $pieces as $piece ) {
91
-								echo '<span class="button button-primary button-small font-pieces">' . esc_html( $piece ) . '</span>';
92
-							}
93
-						}
94
-
95
-						echo '</div>';
96
-						echo '</td>';
97
-						echo '<td style="width: 140px;"><div class="action-row visible">';
98
-						echo '<span style="display:none;"><a href="#" class="rename">Rename</a> | </span>';
99
-						echo '<a href="#" class="fontDelete delete" data-section="' . esc_attr( $section ) . '" data-name="' . esc_attr( $font ) . '" data-type="delete">' . esc_html__( 'Delete', 'redux-framework' ) . '</a>';
100
-						echo '<span class="spinner" style="display:none; visibility: visible;"></span>';
101
-						echo '</div>';
102
-						echo '</td>';
103
-						echo '</tr>';
104
-					}
105
-
106
-					echo '</tbody></table>';
107
-				}
108
-
109
-				echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . esc_attr( $nonce ) . '" id="' . esc_attr( $this->field['id'] ) . '-custom_fonts">' . esc_html__( 'Add Font', 'redux-framework' ) . '</span></div><br />';
110
-			} else {
111
-				echo '<h3>' . esc_html__( 'No Custom Fonts Found', 'redux-framework' ) . '</h3>';
112
-				echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . esc_attr( $nonce ) . '" id="' . esc_attr( $this->field['id'] ) . '-custom_fonts">' . esc_html__( 'Add Font', 'redux-framework' ) . '</span></div>';
113
-			}
114
-
115
-			echo '</fieldset></td></tr>';
116
-		}
117
-
118
-		/**
119
-		 * Functions to pass data from the PHP to the JS at render time.
120
-		 *
121
-		 * @param array  $field Field.
122
-		 * @param string $value Value.
123
-		 *
124
-		 * @return array
125
-		 */
126
-		public function localize( $field, $value = '' ): array {
127
-			$params = array();
128
-
129
-			if ( ! isset( $field['mode'] ) ) {
130
-				$field['mode'] = 'image';
131
-			}
132
-
133
-			$params['mode'] = $field['mode'];
134
-
135
-			if ( empty( $value ) && isset( $this->value ) ) {
136
-				$value = $this->value;
137
-			}
138
-
139
-			$params['val'] = $value;
140
-
141
-			return $params;
142
-		}
143
-
144
-		/**
145
-		 * Enqueue Function.
146
-		 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
147
-		 *
148
-		 * @return      void
149
-		 * @since       1.0.0
150
-		 * @access      public
151
-		 */
152
-		public function enqueue() {
153
-			$min = Redux_Functions::isMin();
154
-
155
-			wp_enqueue_script(
156
-				'redux-field-custom-fonts',
157
-				$this->url . '/redux-custom-fonts' . $min . '.js',
158
-				array( 'jquery', 'redux-block-ui' ),
159
-				Redux_Extension_Custom_Fonts::$version,
160
-				true
161
-			);
162
-
163
-			wp_localize_script(
164
-				'redux-field-custom-fonts',
165
-				'redux_custom_fonts_l10',
166
-				apply_filters(
167
-					'redux_custom_fonts_localized_data',
168
-					array(
169
-						'delete_error' => esc_html__( 'There was an error deleting your font:', 'redux-framework' ),
170
-						'unzip'        => esc_html__( 'Unzipping archive and generating any missing font files.', 'redux-framework' ),
171
-						'convert'      => esc_html__( 'Converting font file(s)...', 'redux-framework' ),
172
-						'partial'      => esc_html__( 'The only file(s) imported were those uploaded.  Please refresh the page to continue (making note of any errors before doing so, please).', 'redux-framework' ),
173
-						'unknown'      => esc_html__( 'An unknown error occurred. Please try again.', 'redux-framework' ),
174
-						'complete'     => esc_html__( 'Conversion complete.  Refreshing page...', 'redux-framework' ),
175
-						'media_title'  => esc_html__( 'Choose Font file or ZIP of font files.', 'redux-framework' ),
176
-						'media_button' => esc_html__( 'Update', 'redux-framework' ),
177
-					)
178
-				)
179
-			);
180
-
181
-			if ( $this->parent->args['dev_mode'] ) {
182
-				wp_enqueue_style(
183
-					'redux-field-custom-fonts',
184
-					$this->url . 'redux-custom-fonts.css',
185
-					array(),
186
-					Redux_Extension_Custom_Fonts::$version
187
-				);
188
-			}
189
-
190
-			$class = Redux_Extension_Custom_Fonts::$instance;
191
-
192
-			if ( ! empty( $class->custom_fonts ) ) {
193
-				if ( file_exists( $class->upload_dir . 'fonts.css' ) ) {
194
-					wp_enqueue_style(
195
-						'redux-custom_fonts',
196
-						$class->upload_url . 'fonts.css',
197
-						array(),
198
-						filemtime( $class->upload_dir . 'fonts.css' )
199
-					);
200
-				}
201
-			}
202
-		}
203
-	}
55
+            $can_convert = true;
56
+
57
+            $nonce = wp_create_nonce( 'redux_custom_fonts' );
58
+
59
+            $this->field['custom_fonts'] = apply_filters( "redux/{$this->parent->args[ 'opt_name' ]}/field/typography/custom_fonts", array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName
60
+
61
+            if ( $can_convert ) {
62
+                echo '<div class="">';
63
+                echo '<label for="custom-font-convert">';
64
+                echo '<input type="hidden" class="checkbox-check" data-val="1" name="' . esc_attr( $this->field['name'] ) . '[convert]" value="' . esc_attr( $this->value['convert'] ) . '"/>';
65
+                echo '<input type="checkbox" class="checkbox" id="custom-font-convert" value="1"' . checked( $this->value['convert'], '1', false ) . '">';
66
+                echo 'Enable font conversion';
67
+                echo '</label>';
68
+                echo '</div>';
69
+                echo '</div>';
70
+            }
71
+
72
+            if ( ! empty( $this->field['custom_fonts'] ) ) {
73
+                foreach ( $this->field['custom_fonts'] as $section => $fonts ) {
74
+                    if ( empty( $fonts ) ) {
75
+                        continue;
76
+                    }
77
+
78
+                    echo '<h3>' . esc_html( $section ) . '</h3>';
79
+                    echo '<div class="font-error" style="display: none;"><p><strong>' . esc_html__( 'Error', 'redux-framework' ) . '</strong>: <span></span></p></div>';
80
+
81
+                    echo '<table class="wp-list-table widefat plugins" style="border-spacing:0;"><tbody>';
82
+
83
+                    foreach ( $fonts as $font => $pieces ) {
84
+                        echo '<tr class="active">';
85
+                        echo '<td class="plugin-title" style="min-width: 40%"><strong>' . esc_html( $font ) . '</strong></td>';
86
+                        echo '<td class="column-description desc">';
87
+                        echo '<div class="plugin-description">';
88
+
89
+                        if ( is_array( $pieces ) && ! empty( $pieces ) ) {
90
+                            foreach ( $pieces as $piece ) {
91
+                                echo '<span class="button button-primary button-small font-pieces">' . esc_html( $piece ) . '</span>';
92
+                            }
93
+                        }
94
+
95
+                        echo '</div>';
96
+                        echo '</td>';
97
+                        echo '<td style="width: 140px;"><div class="action-row visible">';
98
+                        echo '<span style="display:none;"><a href="#" class="rename">Rename</a> | </span>';
99
+                        echo '<a href="#" class="fontDelete delete" data-section="' . esc_attr( $section ) . '" data-name="' . esc_attr( $font ) . '" data-type="delete">' . esc_html__( 'Delete', 'redux-framework' ) . '</a>';
100
+                        echo '<span class="spinner" style="display:none; visibility: visible;"></span>';
101
+                        echo '</div>';
102
+                        echo '</td>';
103
+                        echo '</tr>';
104
+                    }
105
+
106
+                    echo '</tbody></table>';
107
+                }
108
+
109
+                echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . esc_attr( $nonce ) . '" id="' . esc_attr( $this->field['id'] ) . '-custom_fonts">' . esc_html__( 'Add Font', 'redux-framework' ) . '</span></div><br />';
110
+            } else {
111
+                echo '<h3>' . esc_html__( 'No Custom Fonts Found', 'redux-framework' ) . '</h3>';
112
+                echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . esc_attr( $nonce ) . '" id="' . esc_attr( $this->field['id'] ) . '-custom_fonts">' . esc_html__( 'Add Font', 'redux-framework' ) . '</span></div>';
113
+            }
114
+
115
+            echo '</fieldset></td></tr>';
116
+        }
117
+
118
+        /**
119
+         * Functions to pass data from the PHP to the JS at render time.
120
+         *
121
+         * @param array  $field Field.
122
+         * @param string $value Value.
123
+         *
124
+         * @return array
125
+         */
126
+        public function localize( $field, $value = '' ): array {
127
+            $params = array();
128
+
129
+            if ( ! isset( $field['mode'] ) ) {
130
+                $field['mode'] = 'image';
131
+            }
132
+
133
+            $params['mode'] = $field['mode'];
134
+
135
+            if ( empty( $value ) && isset( $this->value ) ) {
136
+                $value = $this->value;
137
+            }
138
+
139
+            $params['val'] = $value;
140
+
141
+            return $params;
142
+        }
143
+
144
+        /**
145
+         * Enqueue Function.
146
+         * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
147
+         *
148
+         * @return      void
149
+         * @since       1.0.0
150
+         * @access      public
151
+         */
152
+        public function enqueue() {
153
+            $min = Redux_Functions::isMin();
154
+
155
+            wp_enqueue_script(
156
+                'redux-field-custom-fonts',
157
+                $this->url . '/redux-custom-fonts' . $min . '.js',
158
+                array( 'jquery', 'redux-block-ui' ),
159
+                Redux_Extension_Custom_Fonts::$version,
160
+                true
161
+            );
162
+
163
+            wp_localize_script(
164
+                'redux-field-custom-fonts',
165
+                'redux_custom_fonts_l10',
166
+                apply_filters(
167
+                    'redux_custom_fonts_localized_data',
168
+                    array(
169
+                        'delete_error' => esc_html__( 'There was an error deleting your font:', 'redux-framework' ),
170
+                        'unzip'        => esc_html__( 'Unzipping archive and generating any missing font files.', 'redux-framework' ),
171
+                        'convert'      => esc_html__( 'Converting font file(s)...', 'redux-framework' ),
172
+                        'partial'      => esc_html__( 'The only file(s) imported were those uploaded.  Please refresh the page to continue (making note of any errors before doing so, please).', 'redux-framework' ),
173
+                        'unknown'      => esc_html__( 'An unknown error occurred. Please try again.', 'redux-framework' ),
174
+                        'complete'     => esc_html__( 'Conversion complete.  Refreshing page...', 'redux-framework' ),
175
+                        'media_title'  => esc_html__( 'Choose Font file or ZIP of font files.', 'redux-framework' ),
176
+                        'media_button' => esc_html__( 'Update', 'redux-framework' ),
177
+                    )
178
+                )
179
+            );
180
+
181
+            if ( $this->parent->args['dev_mode'] ) {
182
+                wp_enqueue_style(
183
+                    'redux-field-custom-fonts',
184
+                    $this->url . 'redux-custom-fonts.css',
185
+                    array(),
186
+                    Redux_Extension_Custom_Fonts::$version
187
+                );
188
+            }
189
+
190
+            $class = Redux_Extension_Custom_Fonts::$instance;
191
+
192
+            if ( ! empty( $class->custom_fonts ) ) {
193
+                if ( file_exists( $class->upload_dir . 'fonts.css' ) ) {
194
+                    wp_enqueue_style(
195
+                        'redux-custom_fonts',
196
+                        $class->upload_url . 'fonts.css',
197
+                        array(),
198
+                        filemtime( $class->upload_dir . 'fonts.css' )
199
+                    );
200
+                }
201
+            }
202
+        }
203
+    }
204 204
 }
Please login to merge, or discard this patch.