Customify – A Theme Customizer Booster - Version 1.5.1

Version Description

  • Added support for active_callback argument for customizer controls
  • Customizer assets refactor
Download this release

Release Info

Developer euthelup
Plugin Icon Customify – A Theme Customizer Booster
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

class-pixcustomify.php CHANGED
@@ -131,7 +131,7 @@ class PixCustomifyPlugin {
131
  * @access private
132
  * @since 1.5.0
133
  */
134
- private $minimalRequiredPhpVersion = 5.2;
135
 
136
  protected function __construct( $file, $version = '1.0.0' ) {
137
  //the main plugin file (the one that loads all this)
@@ -153,7 +153,7 @@ class PixCustomifyPlugin {
153
  */
154
  private function init() {
155
  // Load the config file
156
- $this->config = $this->get_config();
157
  // Load the plugin's settings from the DB
158
  $this->plugin_settings = get_option( $this->config['settings-key'] );
159
 
@@ -204,11 +204,18 @@ class PixCustomifyPlugin {
204
  /*
205
  * Now it's time for the Customizer logic to kick in
206
  */
207
- // Both in the Customizer and on the frontend
 
208
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_admin_customizer_styles' ), 10 );
 
 
209
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_admin_customizer_scripts' ), 10 );
 
 
 
210
  add_action( 'customize_preview_init', array( $this, 'customizer_live_preview_enqueue_scripts' ), 99999 );
211
 
 
212
  $load_location = $this->get_plugin_setting( 'style_resources_location', 'wp_head' );
213
 
214
  add_action( $load_location, array( $this, 'output_dynamic_style' ), 99999 );
@@ -224,9 +231,8 @@ class PixCustomifyPlugin {
224
  /*
225
  * Jetpack Related
226
  */
227
- add_action( 'init', array( $this, 'set_jetpack_modules_config') );
228
  add_filter( 'default_option_jetpack_active_modules', array( $this, 'default_jetpack_active_modules' ), 10, 1 );
229
- add_filter( 'jetpack_get_available_modules', array( $this, 'jetpack_hide_blocked_modules'), 10, 1 );
230
  add_filter( 'default_option_sharing-options', array( $this, 'default_jetpack_sharing_options' ), 10, 1 );
231
  }
232
 
@@ -253,14 +259,14 @@ class PixCustomifyPlugin {
253
 
254
  // allow themes or other plugins to filter the config
255
  $this->customizer_config = apply_filters( 'customify_filter_fields', $this->customizer_config );
256
- $this->opt_name = $this->localized['options_name'] = $this->customizer_config['opt-name'];
257
- $this->options_list = $this->get_options();
258
 
259
  // Load the current options values
260
  $this->current_values = $this->get_current_values();
261
 
262
  if ( $this->import_button_exists() ) {
263
- $this->localized['import_rest_url'] = get_rest_url( '/customify/1.0/' );
264
  $this->localized['import_rest_nonce'] = wp_create_nonce( 'wp_rest' );
265
 
266
  $this->register_import_api();
@@ -269,43 +275,39 @@ class PixCustomifyPlugin {
269
  $this->localized['theme_fonts'] = $this->theme_fonts = Customify_Font_Selector::instance()->get_theme_fonts();
270
  }
271
 
272
- function set_jetpack_modules_config() {
273
- // We expect an array of string module names like array( 'infinite-scroll', 'widgets' )
274
- // See jetpack/modules/modules-heading.php for module names
275
- $this->jetpack_default_modules = apply_filters ( 'customify_filter_jetpack_default_modules', array(
276
- 'shortcodes',
277
- 'widget-visibility',
278
- 'widgets',
279
- ) );
280
-
281
- // We expect an array of string module names like array( 'infinite-scroll', 'widgets' )
282
- // See jetpack/modules/modules-heading.php for module names
283
- $this->jetpack_blocked_modules = apply_filters ( 'customify_filter_jetpack_blocked_modules', array() );
284
-
285
- $this->jetpack_sharing_default_options = apply_filters ( 'customify_filter_jetpack_sharing_default_options', array() );
286
- }
287
-
288
  /**
289
  * Control the default modules that are activated in Jetpack.
290
  * Use the `customify_filter_jetpack_default_modules` to set your's.
291
  *
292
- * @param array $default The default value to return if the option does not exist
293
  * in the database.
 
294
  * @return array
295
  */
296
  function default_jetpack_active_modules( $default ) {
297
  if ( ! is_array( $default ) ) {
298
  $default = array();
299
  }
 
 
 
 
 
 
 
300
 
301
- return array_merge( $default, $this->jetpack_default_modules );
 
 
 
 
302
  }
303
 
304
  /**
305
  * Control the default Jetpack Sharing options.
306
  * Use the `customify_filter_jetpack_sharing_default_options` to set your's.
307
  *
308
- * @param array $default The default value to return if the option does not exist
309
  * in the database.
310
  *
311
  * @return array
@@ -362,41 +364,60 @@ class PixCustomifyPlugin {
362
  /** === RESOURCES === **/
363
 
364
  /**
365
- * Customizer admin styles
 
 
 
 
 
 
 
 
366
  */
367
  function enqueue_admin_customizer_styles() {
368
- wp_enqueue_style( 'customify_select2', plugins_url( 'js/select2/css/select2.css', $this->file ), array(), $this->_version );
369
- wp_enqueue_style( 'customify_style', plugins_url( 'css/customizer.css', $this->file ), array(), $this->_version );
370
  }
371
 
372
  /**
373
- * Customizer admin scripts
374
  */
375
- function enqueue_admin_customizer_scripts() {
376
 
377
- wp_enqueue_script( 'customify_select2', plugins_url( 'js/select2/js/select2.js', $this->file ), array( 'jquery' ), $this->_version );
378
- wp_enqueue_script( 'jquery-react', plugins_url( 'js/jquery-react.js', $this->file ), array( 'jquery' ), $this->_version );
379
- wp_enqueue_script( $this->plugin_slug . '-customizer-scripts', plugins_url( 'js/customizer.js', $this->file ), array(
380
  'jquery',
381
  'customify_select2',
382
  'underscore',
383
  'customize-controls'
384
  ), $this->_version );
 
 
 
 
 
 
 
 
385
 
386
  wp_localize_script( $this->plugin_slug . '-customizer-scripts', 'customify_settings', $this->localized );
387
  }
388
 
389
- /** Customizer scripts loaded only on previewer page */
390
- function customizer_live_preview_enqueue_scripts() {
391
-
392
  wp_register_script( $this->plugin_slug . 'CSSOM', plugins_url( 'js/CSSOM.js', $this->file ), array( 'jquery' ), $this->_version, true );
393
  wp_register_script( $this->plugin_slug . 'cssUpdate', plugins_url( 'js/jquery.cssUpdate.js', $this->file ), array(), $this->_version, true );
394
- wp_enqueue_script( $this->plugin_slug . '-previewer-scripts', plugins_url( 'js/customizer_preview.js', $this->file ), array(
395
  'jquery',
396
  'customize-preview',
397
  $this->plugin_slug . 'CSSOM',
398
  $this->plugin_slug . 'cssUpdate'
399
  ), $this->_version, true );
 
 
 
 
 
400
 
401
  // when a live preview field is in action we need to know which props need 'px' as defaults
402
  $this->localized['px_dependent_css_props'] = self::$pixel_dependent_css_properties;
@@ -441,7 +462,10 @@ class PixCustomifyPlugin {
441
  }
442
 
443
 
444
- wp_localize_script( $this->plugin_slug . '-customizer-scripts', 'WP_API_Settings', array( 'root' => esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ) ) );
 
 
 
445
  }
446
 
447
  /**
@@ -475,7 +499,7 @@ class PixCustomifyPlugin {
475
  foreach ( $properties as $key => $property ) {
476
  $property_settings = $property['property'];
477
  $property_value = $property['value'];
478
- $custom_css .= $this->proccess_css_property( $property_settings, $property_value );
479
  }
480
 
481
  $custom_css .= " }\n";
@@ -484,9 +508,10 @@ class PixCustomifyPlugin {
484
  }
485
 
486
  $custom_css .= "\n";
487
- ?><style id="customify_output_style">
488
- <?php echo apply_filters( 'customify_dynamic_style', $custom_css ); ?>
489
- </style><?php
 
490
 
491
  /**
492
  * from now on we output only style tags only for the preview purpose
@@ -516,7 +541,8 @@ class PixCustomifyPlugin {
516
 
517
  $this_value = $this->get_option( $option_id );
518
  foreach ( $options['css'] as $key => $properties_set ) { ?>
519
- <style id="dynamic_setting_<?php echo $option_id . '_property_' . str_replace( '-', '_', $properties_set['property'] ); ?>" type="text/css"><?php
 
520
 
521
  if ( isset( $properties_set['media'] ) && ! empty( $properties_set['media'] ) ) {
522
  echo '@media '. $properties_set['media'] . " {\n";
@@ -661,29 +687,29 @@ class PixCustomifyPlugin {
661
 
662
  if ( ! empty ( $families ) && $this->get_plugin_setting( 'typography', '1' ) && $this->get_plugin_setting( 'typography_google_fonts', 1 ) ) { ?>
663
  <script type="text/javascript">
664
- if ( typeof WebFont !== 'undefined' ) {<?php // if there is a WebFont object, use it ?>
665
- WebFont.load( {
666
- google: {families: [<?php echo( rtrim( $families, ',' ) ); ?>]},
667
- classes: false,
668
- events: false
669
- } );
670
- } else {<?php // basically when we don't have the WebFont object we create the google script dynamically ?>
671
-
672
- var tk = document.createElement( 'script' );
673
- tk.src = '//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
674
- tk.type = 'text/javascript';
675
-
676
- tk.onload = tk.onreadystatechange = function() {
677
- WebFont.load( {
678
- google: {families: [<?php echo( rtrim( $families, ',' ) ); ?>]},
679
- classes: false,
680
- events: false
681
- } );
682
- };
683
-
684
- var s = document.getElementsByTagName( 'script' )[0];
685
- s.parentNode.insertBefore( tk, s );
686
- }
687
  </script>
688
  <?php } ?>
689
  <style id="customify_typography_output_style">
@@ -830,12 +856,14 @@ class PixCustomifyPlugin {
830
  $value = $this->google_fonts[ $font_name ];
831
  $value['font_family'] = $font_name;
832
  $value['type'] = 'google';
 
833
  return $value;
834
  } elseif ( isset( $this->theme_fonts[ $font_name ] ) ) {
835
- $value['type'] = 'theme_font';
836
- $value['src'] = $this->theme_fonts[ $font_name ]['src'];
837
- $value['variants'] = $this->theme_fonts[ $font_name ]['variants'];
838
  $value['font_family'] = $this->theme_fonts[ $font_name ]['family'];
 
839
  return $value;
840
  }
841
 
@@ -889,7 +917,7 @@ class PixCustomifyPlugin {
889
  $unit = 'px';
890
  }
891
  // lose the tons of tabs
892
- $css_property['selector'] = trim(preg_replace('/\t+/', '', $css_property['selector'] ));
893
 
894
  $this_property_output = $css_property['selector'] . ' { ' . $css_property['property'] . ': ' . $this_value . $unit . "; }\n";
895
 
@@ -906,7 +934,7 @@ class PixCustomifyPlugin {
906
  if ( ! isset( $options['value'] ) ) {
907
  return false;
908
  }
909
- $value = $options['value'];
910
 
911
  if ( ! isset( $options['output'] ) ) {
912
  return $selector;
@@ -1288,6 +1316,10 @@ class PixCustomifyPlugin {
1288
  $control_args['description'] = $setting_config['desc'];
1289
  }
1290
 
 
 
 
 
1291
 
1292
  $control_args['type'] = $setting_config['type'];
1293
 
@@ -1730,20 +1762,21 @@ class PixCustomifyPlugin {
1730
  global $wp_customize;
1731
 
1732
  $opt_name = $this->opt_name;
1733
- $values = $this->current_values;
1734
 
1735
  // In case someone asked for a DB value too early but it has given us the opt_name under which to search, let's do it
1736
  if ( empty( $opt_name ) && ! empty( $alt_opt_name ) ) {
1737
  $opt_name = $alt_opt_name;
1738
- $values = $this->get_current_values( $opt_name );
1739
  }
1740
 
1741
- if ( ! empty( $wp_customize ) && method_exists( $wp_customize, 'get_setting') ) {
1742
 
1743
  $option_key = $opt_name . '[' . $option . ']';
1744
- $setting = $wp_customize->get_setting( $option_key );
1745
  if ( ! empty( $setting ) ) {
1746
  $value = $setting->value();
 
1747
  return $value;
1748
  }
1749
  }
@@ -1773,7 +1806,7 @@ class PixCustomifyPlugin {
1773
  *
1774
  * @return bool|null|string
1775
  */
1776
- public function get_option( $option, $default = null, $alt_opt_name = null ) {
1777
 
1778
  $return = $this->get_value( $option, $alt_opt_name );
1779
 
@@ -1875,14 +1908,14 @@ class PixCustomifyPlugin {
1875
  return array_keys( $keys ) !== $keys;
1876
  }
1877
 
1878
- function register_import_api(){
1879
 
1880
  include_once( $this->get_base_path() . '/features/class-Customify_Importer.php' );
1881
  $controller = new Customify_Importer_Controller();
1882
  $controller->init();
1883
  }
1884
 
1885
- function get_options_configs () {
1886
  return $this->options_list;
1887
  }
1888
 
@@ -1900,7 +1933,8 @@ class PixCustomifyPlugin {
1900
 
1901
  $str = strtr( rawurlencode( $str ), $revert );
1902
  } else {
1903
- var_dump('boooom');die;
 
1904
  }
1905
 
1906
  return $str;
@@ -1917,7 +1951,7 @@ class PixCustomifyPlugin {
1917
  //if we get an array we just let it be
1918
  if ( is_string( $str ) ) {
1919
  $revert = array( '!' => '%21', '*' => '%2A', "'" => '%27', '(' => '%28', ')' => '%29' );
1920
- $str = rawurldecode( strtr( $str, $revert ) );
1921
  }
1922
 
1923
  return $str;
@@ -1930,6 +1964,7 @@ class PixCustomifyPlugin {
1930
 
1931
  if ( version_compare( phpversion(), $this->minimalRequiredPhpVersion ) < 0 ) {
1932
  add_action( 'admin_notices', array( $this, 'notice_php_version_wrong' ) );
 
1933
  return false;
1934
  }
1935
 
@@ -1948,7 +1983,8 @@ class PixCustomifyPlugin {
1948
  *
1949
  * @since 1.0.0
1950
  * @static
1951
- * @param string $file File.
 
1952
  * @param string $version Version.
1953
  *
1954
  * @see PixCustomifyPlugin()
@@ -1970,7 +2006,7 @@ class PixCustomifyPlugin {
1970
  */
1971
  public function __clone() {
1972
 
1973
- _doing_it_wrong( __FUNCTION__,esc_html( __( 'Cheatin&#8217; huh?' ) ), esc_html( $this->_version ) );
1974
  } // End __clone ()
1975
 
1976
  /**
@@ -1980,6 +2016,6 @@ class PixCustomifyPlugin {
1980
  */
1981
  public function __wakeup() {
1982
 
1983
- _doing_it_wrong( __FUNCTION__, esc_html( __( 'Cheatin&#8217; huh?' ) ), esc_html( $this->_version ) );
1984
  } // End __wakeup ()
1985
  }
131
  * @access private
132
  * @since 1.5.0
133
  */
134
+ private $minimalRequiredPhpVersion = 5.2;
135
 
136
  protected function __construct( $file, $version = '1.0.0' ) {
137
  //the main plugin file (the one that loads all this)
153
  */
154
  private function init() {
155
  // Load the config file
156
+ $this->config = $this->get_config();
157
  // Load the plugin's settings from the DB
158
  $this->plugin_settings = get_option( $this->config['settings-key'] );
159
 
204
  /*
205
  * Now it's time for the Customizer logic to kick in
206
  */
207
+ // Styles for the Customizer
208
+ add_action( 'customize_controls_init', array( $this, 'register_admin_customizer_styles' ), 10 );
209
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_admin_customizer_styles' ), 10 );
210
+ // Scripts enqueued in the Customizer
211
+ add_action( 'customize_controls_init', array( $this, 'register_admin_customizer_scripts' ), 10 );
212
  add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_admin_customizer_scripts' ), 10 );
213
+
214
+ // Scripts enqueued only in the theme preview
215
+ add_action( 'customize_preview_init', array( $this, 'customizer_live_preview_register_scripts' ), 10 );
216
  add_action( 'customize_preview_init', array( $this, 'customizer_live_preview_enqueue_scripts' ), 99999 );
217
 
218
+ // The frontend effects of the Customizer controls
219
  $load_location = $this->get_plugin_setting( 'style_resources_location', 'wp_head' );
220
 
221
  add_action( $load_location, array( $this, 'output_dynamic_style' ), 99999 );
231
  /*
232
  * Jetpack Related
233
  */
 
234
  add_filter( 'default_option_jetpack_active_modules', array( $this, 'default_jetpack_active_modules' ), 10, 1 );
235
+ add_filter( 'jetpack_get_available_modules', array( $this, 'jetpack_hide_blocked_modules' ), 10, 1 );
236
  add_filter( 'default_option_sharing-options', array( $this, 'default_jetpack_sharing_options' ), 10, 1 );
237
  }
238
 
259
 
260
  // allow themes or other plugins to filter the config
261
  $this->customizer_config = apply_filters( 'customify_filter_fields', $this->customizer_config );
262
+ $this->opt_name = $this->localized['options_name'] = $this->customizer_config['opt-name'];
263
+ $this->options_list = $this->get_options();
264
 
265
  // Load the current options values
266
  $this->current_values = $this->get_current_values();
267
 
268
  if ( $this->import_button_exists() ) {
269
+ $this->localized['import_rest_url'] = get_rest_url( '/customify/1.0/' );
270
  $this->localized['import_rest_nonce'] = wp_create_nonce( 'wp_rest' );
271
 
272
  $this->register_import_api();
275
  $this->localized['theme_fonts'] = $this->theme_fonts = Customify_Font_Selector::instance()->get_theme_fonts();
276
  }
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  /**
279
  * Control the default modules that are activated in Jetpack.
280
  * Use the `customify_filter_jetpack_default_modules` to set your's.
281
  *
282
+ * @param array $default The default value to return if the option does not exist
283
  * in the database.
284
+ *
285
  * @return array
286
  */
287
  function default_jetpack_active_modules( $default ) {
288
  if ( ! is_array( $default ) ) {
289
  $default = array();
290
  }
291
+ $jetpack_default_modules = array();
292
+
293
+ $theme_default_modules = get_theme_mod( 'pixelgrade_jetpack_default_active_modules', array() );
294
+
295
+ if ( ! is_array( $theme_default_modules ) ) {
296
+ return array_merge( $default, $jetpack_default_modules );
297
+ }
298
 
299
+ foreach ( $theme_default_modules as $module ) {
300
+ array_push( $jetpack_default_modules, $module );
301
+ }
302
+
303
+ return array_merge( $default, $jetpack_default_modules );
304
  }
305
 
306
  /**
307
  * Control the default Jetpack Sharing options.
308
  * Use the `customify_filter_jetpack_sharing_default_options` to set your's.
309
  *
310
+ * @param array $default The default value to return if the option does not exist
311
  * in the database.
312
  *
313
  * @return array
364
  /** === RESOURCES === **/
365
 
366
  /**
367
+ * Register Customizer admin styles
368
+ */
369
+ function register_admin_customizer_styles() {
370
+ wp_register_style( 'customify_select2', plugins_url( 'js/select2/css/select2.css', $this->file ), array(), $this->_version );
371
+ wp_register_style( 'customify_style', plugins_url( 'css/customizer.css', $this->file ), array( 'customify_select2' ), $this->_version );
372
+ }
373
+
374
+ /**
375
+ * Enqueue Customizer admin styles
376
  */
377
  function enqueue_admin_customizer_styles() {
378
+ wp_enqueue_style( 'customify_style' );
 
379
  }
380
 
381
  /**
382
+ * Register Customizer admin scripts
383
  */
384
+ function register_admin_customizer_scripts() {
385
 
386
+ wp_register_script( 'customify_select2', plugins_url( 'js/select2/js/select2.js', $this->file ), array( 'jquery' ), $this->_version );
387
+ wp_register_script( 'jquery-react', plugins_url( 'js/jquery-react.js', $this->file ), array( 'jquery' ), $this->_version );
388
+ wp_register_script( $this->plugin_slug . '-customizer-scripts', plugins_url( 'js/customizer.js', $this->file ), array(
389
  'jquery',
390
  'customify_select2',
391
  'underscore',
392
  'customize-controls'
393
  ), $this->_version );
394
+ }
395
+
396
+ /**
397
+ * Enqueue Customizer admin scripts
398
+ */
399
+ function enqueue_admin_customizer_scripts() {
400
+ wp_enqueue_script( 'jquery-react' );
401
+ wp_enqueue_script( $this->plugin_slug . '-customizer-scripts' );
402
 
403
  wp_localize_script( $this->plugin_slug . '-customizer-scripts', 'customify_settings', $this->localized );
404
  }
405
 
406
+ /** Register Customizer scripts loaded only on previewer page */
407
+ function customizer_live_preview_register_scripts() {
 
408
  wp_register_script( $this->plugin_slug . 'CSSOM', plugins_url( 'js/CSSOM.js', $this->file ), array( 'jquery' ), $this->_version, true );
409
  wp_register_script( $this->plugin_slug . 'cssUpdate', plugins_url( 'js/jquery.cssUpdate.js', $this->file ), array(), $this->_version, true );
410
+ wp_register_script( $this->plugin_slug . '-previewer-scripts', plugins_url( 'js/customizer_preview.js', $this->file ), array(
411
  'jquery',
412
  'customize-preview',
413
  $this->plugin_slug . 'CSSOM',
414
  $this->plugin_slug . 'cssUpdate'
415
  ), $this->_version, true );
416
+ }
417
+
418
+ /** Enqueue Customizer scripts loaded only on previewer page */
419
+ function customizer_live_preview_enqueue_scripts() {
420
+ wp_enqueue_script( $this->plugin_slug . '-previewer-scripts' );
421
 
422
  // when a live preview field is in action we need to know which props need 'px' as defaults
423
  $this->localized['px_dependent_css_props'] = self::$pixel_dependent_css_properties;
462
  }
463
 
464
 
465
+ wp_localize_script( $this->plugin_slug . '-customizer-scripts', 'WP_API_Settings', array(
466
+ 'root' => esc_url_raw( rest_url() ),
467
+ 'nonce' => wp_create_nonce( 'wp_rest' )
468
+ ) );
469
  }
470
 
471
  /**
499
  foreach ( $properties as $key => $property ) {
500
  $property_settings = $property['property'];
501
  $property_value = $property['value'];
502
+ $custom_css .= $this->proccess_css_property( $property_settings, $property_value );
503
  }
504
 
505
  $custom_css .= " }\n";
508
  }
509
 
510
  $custom_css .= "\n";
511
+ ?>
512
+ <style id="customify_output_style">
513
+ <?php echo apply_filters( 'customify_dynamic_style', $custom_css ); ?>
514
+ </style><?php
515
 
516
  /**
517
  * from now on we output only style tags only for the preview purpose
541
 
542
  $this_value = $this->get_option( $option_id );
543
  foreach ( $options['css'] as $key => $properties_set ) { ?>
544
+ <style id="dynamic_setting_<?php echo $option_id . '_property_' . str_replace( '-', '_', $properties_set['property'] ); ?>"
545
+ type="text/css"><?php
546
 
547
  if ( isset( $properties_set['media'] ) && ! empty( $properties_set['media'] ) ) {
548
  echo '@media '. $properties_set['media'] . " {\n";
687
 
688
  if ( ! empty ( $families ) && $this->get_plugin_setting( 'typography', '1' ) && $this->get_plugin_setting( 'typography_google_fonts', 1 ) ) { ?>
689
  <script type="text/javascript">
690
+ if (typeof WebFont !== 'undefined') {<?php // if there is a WebFont object, use it ?>
691
+ WebFont.load({
692
+ google: {families: [<?php echo( rtrim( $families, ',' ) ); ?>]},
693
+ classes: false,
694
+ events: false
695
+ });
696
+ } else {<?php // basically when we don't have the WebFont object we create the google script dynamically ?>
697
+
698
+ var tk = document.createElement('script');
699
+ tk.src = '//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
700
+ tk.type = 'text/javascript';
701
+
702
+ tk.onload = tk.onreadystatechange = function () {
703
+ WebFont.load({
704
+ google: {families: [<?php echo( rtrim( $families, ',' ) ); ?>]},
705
+ classes: false,
706
+ events: false
707
+ });
708
+ };
709
+
710
+ var s = document.getElementsByTagName('script')[0];
711
+ s.parentNode.insertBefore(tk, s);
712
+ }
713
  </script>
714
  <?php } ?>
715
  <style id="customify_typography_output_style">
856
  $value = $this->google_fonts[ $font_name ];
857
  $value['font_family'] = $font_name;
858
  $value['type'] = 'google';
859
+
860
  return $value;
861
  } elseif ( isset( $this->theme_fonts[ $font_name ] ) ) {
862
+ $value['type'] = 'theme_font';
863
+ $value['src'] = $this->theme_fonts[ $font_name ]['src'];
864
+ $value['variants'] = $this->theme_fonts[ $font_name ]['variants'];
865
  $value['font_family'] = $this->theme_fonts[ $font_name ]['family'];
866
+
867
  return $value;
868
  }
869
 
917
  $unit = 'px';
918
  }
919
  // lose the tons of tabs
920
+ $css_property['selector'] = trim( preg_replace( '/\t+/', '', $css_property['selector'] ) );
921
 
922
  $this_property_output = $css_property['selector'] . ' { ' . $css_property['property'] . ': ' . $this_value . $unit . "; }\n";
923
 
934
  if ( ! isset( $options['value'] ) ) {
935
  return false;
936
  }
937
+ $value = $options['value'];
938
 
939
  if ( ! isset( $options['output'] ) ) {
940
  return $selector;
1316
  $control_args['description'] = $setting_config['desc'];
1317
  }
1318
 
1319
+ if ( isset( $setting_config['active_callback'] ) && ! empty( $setting_config['active_callback'] ) ) {
1320
+ $control_args['active_callback'] = $setting_config['active_callback'];
1321
+ }
1322
+
1323
 
1324
  $control_args['type'] = $setting_config['type'];
1325
 
1762
  global $wp_customize;
1763
 
1764
  $opt_name = $this->opt_name;
1765
+ $values = $this->current_values;
1766
 
1767
  // In case someone asked for a DB value too early but it has given us the opt_name under which to search, let's do it
1768
  if ( empty( $opt_name ) && ! empty( $alt_opt_name ) ) {
1769
  $opt_name = $alt_opt_name;
1770
+ $values = $this->get_current_values( $opt_name );
1771
  }
1772
 
1773
+ if ( ! empty( $wp_customize ) && method_exists( $wp_customize, 'get_setting' ) ) {
1774
 
1775
  $option_key = $opt_name . '[' . $option . ']';
1776
+ $setting = $wp_customize->get_setting( $option_key );
1777
  if ( ! empty( $setting ) ) {
1778
  $value = $setting->value();
1779
+
1780
  return $value;
1781
  }
1782
  }
1806
  *
1807
  * @return bool|null|string
1808
  */
1809
+ public function get_option( $option, $default = null, $alt_opt_name = null ) {
1810
 
1811
  $return = $this->get_value( $option, $alt_opt_name );
1812
 
1908
  return array_keys( $keys ) !== $keys;
1909
  }
1910
 
1911
+ function register_import_api() {
1912
 
1913
  include_once( $this->get_base_path() . '/features/class-Customify_Importer.php' );
1914
  $controller = new Customify_Importer_Controller();
1915
  $controller->init();
1916
  }
1917
 
1918
+ function get_options_configs() {
1919
  return $this->options_list;
1920
  }
1921
 
1933
 
1934
  $str = strtr( rawurlencode( $str ), $revert );
1935
  } else {
1936
+ var_dump( 'boooom' );
1937
+ die;
1938
  }
1939
 
1940
  return $str;
1951
  //if we get an array we just let it be
1952
  if ( is_string( $str ) ) {
1953
  $revert = array( '!' => '%21', '*' => '%2A', "'" => '%27', '(' => '%28', ')' => '%29' );
1954
+ $str = rawurldecode( strtr( $str, $revert ) );
1955
  }
1956
 
1957
  return $str;
1964
 
1965
  if ( version_compare( phpversion(), $this->minimalRequiredPhpVersion ) < 0 ) {
1966
  add_action( 'admin_notices', array( $this, 'notice_php_version_wrong' ) );
1967
+
1968
  return false;
1969
  }
1970
 
1983
  *
1984
  * @since 1.0.0
1985
  * @static
1986
+ *
1987
+ * @param string $file File.
1988
  * @param string $version Version.
1989
  *
1990
  * @see PixCustomifyPlugin()
2006
  */
2007
  public function __clone() {
2008
 
2009
+ _doing_it_wrong( __FUNCTION__, esc_html( __( 'Cheatin&#8217; huh?' ) ), esc_html( $this->_version ) );
2010
  } // End __clone ()
2011
 
2012
  /**
2016
  */
2017
  public function __wakeup() {
2018
 
2019
+ _doing_it_wrong( __FUNCTION__, esc_html( __( 'Cheatin&#8217; huh?' ) ), esc_html( $this->_version ) );
2020
  } // End __wakeup ()
2021
  }
css/customizer.css CHANGED
@@ -609,8 +609,7 @@ ul.font-options__options-list .select2-container [multiple].select2-selection--s
609
  color: #416b7e;
610
  }
611
 
612
- .customize-control-html + .customize-control.customize-control-checkbox,
613
- .customize-control-html + .customize-control.customize-control-radio
614
  {
615
  margin-top: -24px;
616
  }
609
  color: #416b7e;
610
  }
611
 
612
+ .customize-control-html + .customize-control.customize-control-checkbox
 
613
  {
614
  margin-top: -24px;
615
  }
customify.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Customify
4
  Plugin URI: https://wordpress.org/plugins/customify/
5
  Description: A Theme Customizer Booster
6
- Version: 1.5.0
7
  Author: PixelGrade
8
  Author URI: https://pixelgrade.com
9
  Author Email: contact@pixelgrade.com
@@ -54,7 +54,7 @@ if ( $current_data === false ) {
54
  function PixCustomifyPlugin() {
55
 
56
  require_once( plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php' );
57
- $instance = PixCustomifyPlugin::instance( __FILE__, '1.5.0' );
58
  return $instance;
59
  }
60
 
3
  Plugin Name: Customify
4
  Plugin URI: https://wordpress.org/plugins/customify/
5
  Description: A Theme Customizer Booster
6
+ Version: 1.5.1
7
  Author: PixelGrade
8
  Author URI: https://pixelgrade.com
9
  Author Email: contact@pixelgrade.com
54
  function PixCustomifyPlugin() {
55
 
56
  require_once( plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php' );
57
+ $instance = PixCustomifyPlugin::instance( __FILE__, '1.5.1' );
58
  return $instance;
59
  }
60
 
js/customizer.js CHANGED
@@ -390,7 +390,7 @@
390
  return; // no key, no fun
391
  }
392
 
393
- var value = 1, // by default we use 1 the most used value for checboxes or inputs
394
  compare = '==', // ... ye
395
  action = "show",
396
  between = [0,1]; // can only be `show` or `hide`
390
  return; // no key, no fun
391
  }
392
 
393
+ var value = 1, // by default we use 1 the most used value for checkboxes or inputs
394
  compare = '==', // ... ye
395
  action = "show",
396
  between = [0,1]; // can only be `show` or `hide`
languages/customify.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the same license as the Customify package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Customify 1.5.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customify\n"
7
  "POT-Creation-Date: 2017-02-13 13:29:14+00:00\n"
8
  "MIME-Version: 1.0\n"
2
  # This file is distributed under the same license as the Customify package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Customify 1.5.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customify\n"
7
  "POT-Creation-Date: 2017-02-13 13:29:14+00:00\n"
8
  "MIME-Version: 1.0\n"
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pixelgrade, euthelup, babbardel, vlad.olaru, cristianfrumusanu, ra
3
  Tags: customizer, css, editor, live, preview, customise
4
  Requires at least: 4.5.0
5
  Tested up to: 4.7.3
6
- Stable tag: 1.5.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -37,6 +37,10 @@ With [Customify](https://github.com/pixelgrade/customify), developers can easily
37
 
38
  == Changelog ==
39
 
 
 
 
 
40
  = 1.5.0 =
41
  * Plugin core refactored for a better performance
42
  * Fixed Font Weight saving
3
  Tags: customizer, css, editor, live, preview, customise
4
  Requires at least: 4.5.0
5
  Tested up to: 4.7.3
6
+ Stable tag: 1.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
37
 
38
  == Changelog ==
39
 
40
+ = 1.5.1 =
41
+ * Added support for `active_callback` argument for customizer controls
42
+ * Customizer assets refactor
43
+
44
  = 1.5.0 =
45
  * Plugin core refactored for a better performance
46
  * Fixed Font Weight saving
scss/customizer.scss CHANGED
@@ -705,15 +705,10 @@ $background-hover : #f5fcff;
705
 
706
  }
707
 
708
- // Select HTML Labels followed by a Checkbox or Radio field
709
- .customize-control-html + & {
710
- margin-top: -24px;
711
- }
712
-
713
- // Except de dividers titles
714
- [id*="divider"] + & {
715
- margin-top: 0;
716
- }
717
  }
718
 
719
  // Radios
@@ -725,6 +720,13 @@ $background-hover : #f5fcff;
725
  }
726
  }
727
 
 
 
 
 
 
 
 
728
  &.customize-control-radio {
729
  label {
730
  margin-top: $fields-spacing/2;
705
 
706
  }
707
 
708
+ // Except the dividers titles
709
+ [id*="divider"] + & {
710
+ margin-top: 0;
711
+ }
 
 
 
 
 
712
  }
713
 
714
  // Radios
720
  }
721
  }
722
 
723
+ &.customize-control-checkbox {
724
+ // Select HTML Labels followed by a Checkbox field
725
+ .customize-control-html + & {
726
+ margin-top: -24px;
727
+ }
728
+ }
729
+
730
  &.customize-control-radio {
731
  label {
732
  margin-top: $fields-spacing/2;