PluginProbe
LoftLoader / 2.1.10
LoftLoader v2.1.10
trunk 1.0.0 1.0.1 1.0.2 2.0.0 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 All 34 releases
← All changes | inc/class-loftloader-customize.php +39 -65 2.3.12.1.10 View file →
@@ -45,9 +45,9 @@
45 45
46 46 public function customize_scripts() {
47 47 global $wp_scripts, $wp_styles;
48 48 $js_url = LOFTLOADER_URI . 'assets/js/customize.min.js';
49 - $js_dep = array('jquery', 'wp-color-picker', 'jquery-ui-slider', 'customize-controls', 'media-editor' );
49 + $js_dep = array('jquery', 'wp-color-picker', 'jquery-ui-slider', 'customize-controls');
50 50 $ui_css = LOFTLOADER_URI . 'assets/css/jquery-ui.css';
51 51 $loader_css = LOFTLOADER_URI . 'assets/css/loftloader-settings.min.css';
52 52
53 53 wp_register_script( 'loftloader-lite-customize', $js_url, $js_dep, LOFTLOADER_ASSET_VERSION );
@@ -56,14 +56,14 @@
56 56
57 57 wp_enqueue_style( 'loftloader-lite-ui', $ui_css, array(), LOFTLOADER_ASSET_VERSION );
58 58 wp_enqueue_style( 'loftloader-lite-customize', $loader_css, array(), LOFTLOADER_ASSET_VERSION );
59 59
60 - foreach ( $wp_scripts->registered as $h => $o ) {
60 + foreach ( $wp_scripts->registered as $h => $o ) {
61 61 if ( strpos($o->src, 'wp-content/themes') !== false ) {
62 62 wp_dequeue_script( $h );
63 63 }
64 64 };
65 - foreach ( $wp_styles->registered as $h => $o ) {
65 + foreach ( $wp_styles->registered as $h => $o ) {
66 66 if ( strpos($o->src, 'wp-content/themes') !== false ) {
67 67 wp_dequeue_style( $h );
68 68 }
69 69 };
@@ -101,10 +101,10 @@
101 101 if ( 'loftloader_switch' === $this->type ) :
102 102 $switch = $this->manager->get_setting('loftloader_main_switch')->value();
103 103 $classes = 'accordion-section control-section control-section-' . $this->type; ?>
104 104
105 - <li
106 - id="accordion-section-<?php echo esc_attr( $this->id ); ?>"
105 + <li
106 + id="accordion-section-<?php echo esc_attr( $this->id ); ?>"
107 107 class="accordion-section control-section control-section-<?php echo esc_attr( $this->type ); ?>"
108 108 >
109 109 <h3 class="accordion-section-title" tabindex="0">
110 110 <?php echo esc_html( $this->title ); ?>
@@ -126,9 +126,9 @@
126 126 <div class="description customize-section-description"><?php echo wp_kses_post( $this->description ); ?></div> <?php
127 127 endif; ?>
128 128 </li>
129 129 </ul>
130 - </li> <?php
130 + </li> <?php
131 131 else :
132 132 parent::render();
133 133 endif;
134 134 }
@@ -136,14 +136,12 @@
136 136
137 137 // LoftLoader base customize control class: add class properties as displaying dependency.
138 138 class LoftLoader_Customize_Control extends WP_Customize_Control {
139 139 public $filter = false;
140 - public $text = '';
141 140 public $parent_setting_id = '';
142 141 public $show_filter = array();
143 - public $img = '';
142 + public $img = '';
144 143 public $href = '';
145 - public $note_below = '';
146 144 public function active_callback() {
147 145 if ( $this->filter && ( $this->manager->get_setting($this->parent_setting_id ) instanceof WP_Customize_Setting ) && ! empty( $this->show_filter ) ) {
148 146 $parent_setting_value = $this->manager->get_setting( $this->parent_setting_id )->value();
149 147 return in_array( $parent_setting_value, $this->show_filter ) ? true : false;
@@ -152,30 +150,30 @@
152 150 }
153 151 public function render_content() {
154 152 switch ( $this->type ) {
155 153 case 'loftloader-ad':
156 - if ( ! empty( $this->label ) ) : ?>
157 - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
154 + if ( ! empty( $this->label ) ) : ?>
155 + <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
158 156 endif;
159 - if ( ! empty( $this->img ) ) : ?>
157 + if ( ! empty( $this->img ) ) : ?>
160 158 <a href="<?php echo esc_url( $this->href ); ?>" target="_blank">
161 159 <img src="<?php echo esc_url( $this->img ); ?>" >
162 - </a> <?php
160 + </a> <?php
163 161 endif; ?>
164 162 <div class="customize-control-notifications-container"></div> <?php
165 163 break;
166 164 case 'loftloader-any-page':
167 - if ( ! empty( $this->label ) ) : ?>
168 - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
165 + if ( ! empty( $this->label ) ) : ?>
166 + <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
169 167 endif;
170 - if ( ! empty( $this->description ) ) : ?>
171 - <span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span> <?php
168 + if ( ! empty( $this->description ) ) : ?>
169 + <span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span> <?php
172 170 endif; ?>
173 - <input
174 - type="button"
175 - <?php $this->link(); ?>
176 - class="button button-primary loftloader-any-page-generate"
177 - value="<?php esc_attr_e( 'Generate', 'loftloader' ); ?>"
171 + <input
172 + type="button"
173 + <?php $this->link(); ?>
174 + class="button button-primary loftloader-any-page-generate"
175 + value="<?php esc_attr_e( 'Generate', 'loftloader' ); ?>"
178 176 /><br/><br/>
179 177 <textarea class="loftloader-any-page-shortcode" cols="30" rows="4"></textarea>
180 178 <div class="customize-control-notifications-container"></div> <?php
181 179 break;
@@ -184,9 +182,9 @@
184 182 if ( ! empty( $this->label ) ) : ?>
185 183 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
186 184 endif;
187 185 if ( ! empty( $this->description ) ) : ?>
188 - <span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span> <?php
186 + <span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span> <?php
189 187 endif; ?>
190 188 <input class="loftlader-checkbox" type="checkbox" value="on" name="<?php echo esc_attr( $this->id ); ?>" <?php checked( 'on', $this->value() ); ?> />
191 189 <input style="display:none;" type="checkbox" value="on" <?php $this->link(); ?> <?php checked( 'on', $this->value() ); ?> />
192 190 </label> <?php break;
@@ -191,14 +189,8 @@
191 189 <input style="display:none;" type="checkbox" value="on" <?php $this->link(); ?> <?php checked( 'on', $this->value() ); ?> />
192 190 </label> <?php break;
193 191 default:
194 192 parent::render_content();
195 - if ( ! empty( $this->text ) ) {
196 - echo esc_html( $this->text ) . '<br/>';
197 - }
198 - if ( ! empty( $this->note_below ) ) : ?>
199 - <span class="description"><?php echo esc_html( $this->note_below ); ?></span><?php
200 - endif;
201 193 }
202 194 }
203 195 }
204 196 // Modify the color control class to add the display dependency logic.
@@ -237,9 +229,9 @@
237 229 } ?>
238 230
239 231 <label class="amount opacity"> <?php
240 232 if ( ! empty( $this->label ) ) : ?>
241 - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
233 + <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <?php
242 234 endif; ?>
243 235 <span class="<?php echo esc_attr( $this->input_class ); ?>">
244 236 <input readonly="readonly" type="text" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>" >
245 237 <?php echo wp_kses_post( $this->after_text ); ?>
@@ -244,11 +236,11 @@
244 236 <input readonly="readonly" type="text" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>" >
245 237 <?php echo wp_kses_post( $this->after_text ); ?>
246 238 </span>
247 239 </label>
248 - <div
249 - class="ui-slider loader-ui-slider"
250 - data-value="<?php echo esc_attr( $this->manager->get_setting($this->id)->value() ); ?>"
240 + <div
241 + class="ui-slider loader-ui-slider"
242 + data-value="<?php echo esc_attr( $this->manager->get_setting($this->id)->value() ); ?>"
251 243 <?php $this->input_attrs(); ?>
252 244 >
253 245 </div>
254 246 <div class="customize-control-notifications-container"></div> <?php
@@ -282,17 +274,17 @@
282 274 }
283 275 $item_id = sanitize_title( $this->id . '-' . $value );
284 276 ?>
285 277 <label for="<?php echo esc_attr( $item_id ); ?>" title="<?php echo esc_attr($attrs['label']); ?>">
286 - <input
287 - id="<?php echo esc_attr( $item_id ); ?>"
288 - class="loftloader-radiobtn <?php echo esc_attr( $value ); ?>"
289 - type="radio"
290 - value="<?php echo esc_attr( $value ); ?>"
291 - name="<?php echo esc_attr( $name ); ?>"
278 + <input
279 + id="<?php echo esc_attr( $item_id ); ?>"
280 + class="loftloader-radiobtn <?php echo esc_attr( $value ); ?>"
281 + type="radio"
282 + value="<?php echo esc_attr( $value ); ?>"
283 + name="<?php echo esc_attr( $name ); ?>"
292 284 <?php $this->link(); ?>
293 - <?php checked( $this->value(), $value ); ?>
294 - <?php echo wp_kses_post( $attr ); ?>
285 + <?php checked( $this->value(), $value ); ?>
286 + <?php echo wp_kses_post( $attr ); ?>
295 287 />
296 288 <span></span>
297 289 </label>
298 290 <?php endforeach; ?>
@@ -313,14 +305,14 @@
313 305 if ( ! empty( $this->description ) ) : ?>
314 306 <span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
315 307 <?php endif; ?>
316 308 <span class="<?php echo esc_attr($this->input_wrap_class); ?>">
317 - <input
318 - class="<?php echo esc_attr( $this->input_class ); ?>"
319 - type="<?php echo esc_attr( $this->type ); ?>"
320 - <?php $this->input_attrs(); ?>
321 - value="<?php echo esc_attr( $this->value() ); ?>"
322 - <?php $this->link(); ?>
309 + <input
310 + class="<?php echo esc_attr( $this->input_class ); ?>"
311 + type="<?php echo esc_attr( $this->type ); ?>"
312 + <?php $this->input_attrs(); ?>
313 + value="<?php echo esc_attr( $this->value() ); ?>"
314 + <?php $this->link(); ?>
323 315 />
324 316 <?php echo esc_attr( $this->after_text ); ?>
325 317 </span>
326 318 </label>
@@ -352,25 +344,7 @@
352 344 function loftloader_sanitize_choice( $input, $setting ) {
353 345 $choices = $setting->manager->get_control( $setting->id )->choices;
354 346 $choices = array_keys( $choices );
355 347 return in_array( $input, $choices ) ? $input : $setting->default;
356 - }
357 - }
358 -
359 - if ( ! function_exists( 'loftloader_sanitize_number' ) ) {
360 - /**
361 - * Check the value is float with 1 decimal
362 - *
363 - * @param string the value from user
364 - * @param object customize setting object
365 - * @return string the value from user or the default setting value
366 - */
367 -
368 - function loftloader_sanitize_number( $value) {
369 - if ( ! empty( $value ) ) {
370 - $value = floatval( $value );
371 - return number_format( $value, 1, '.', '' );
372 - }
373 - return 0;
374 348 }
375 349 }
376 350 }