Ejemplo n.º 1
0
 /**
  * Class Constructor. Defines the args for the extions class
  *
  * @since       1.0.0
  * @access      public
  *
  * @param       array $sections   Panel sections.
  * @param       array $args       Class constructor arguments.
  * @param       array $extra_tabs Extra panel tabs.
  *
  * @return      void
  */
 public function __construct($parent)
 {
     $this->parent = $parent;
     $this->upload_dir = AvadaReduxFramework::$_upload_dir . 'advanced-customizer/';
     $this->upload_url = AvadaReduxFramework::$_upload_url . 'advanced-customizer/';
     //add_action('wp_head', array( $this, '_enqueue_new' ));
     if ($parent->args['customizer'] == false) {
         return;
     }
     // Override the AvadaReduxCore class
     add_filter("avadaredux/extension/{$this->parent->args['opt_name']}/customizer", array($this, 'remove_core_customizer_class'));
     global $pagenow, $wp_customize;
     if (!isset($wp_customize) && $pagenow !== "customize.php" && $pagenow !== "admin-ajax.php") {
         return;
     }
     if ($pagenow !== "customize.php" && $pagenow !== "admin-ajax.php" && !isset($GLOBALS['wp_customize'])) {
         //return;
     }
     if (empty($this->_extension_dir)) {
         $this->_extension_dir = AvadaRedux_Helpers::get_extension_dir(dirname(__FILE__));
         $this->_extension_url = AvadaRedux_Helpers::get_extension_url(dirname(__FILE__));
     }
     self::get_post_values();
     // Create defaults array
     $defaults = array();
     /*
      customize_controls_init
      customize_controls_enqueue_scripts
      customize_controls_print_styles
      customize_controls_print_scripts
      customize_controls_print_footer_scripts
     */
     //add_action('customize_save', );
     if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == "on") {
         $this->parent->args['customizer_only'] = true;
     }
     if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == "on" && isset($_POST['customized']) && !empty($_POST['customized']) && !isset($_POST['action'])) {
         add_action("avadaredux/options/{$this->parent->args['opt_name']}/options", array($this, '_override_values'), 100);
     }
     add_action('customize_register', array($this, '_register_customizer_controls'));
     // Create controls
     add_action('wp_head', array($this, 'customize_preview_init'));
     //add_action( 'customize_save', array( $this, 'customizer_save_before' ) ); // Before save
     add_action('customize_save_after', array(&$this, 'customizer_save_after'));
     // After save
     // Add global controls CSS file
     add_action('customize_controls_print_scripts', array($this, 'enqueue_controls_css'));
     add_action('customize_controls_init', array($this, 'enqueue_panel_css'));
     //add_action( 'wp_enqueue_scripts', array( &$this, '_enqueue_previewer_css' ) ); // Enqueue previewer css
     //add_action( 'wp_enqueue_scripts', array( &$this, '_enqueue_previewer_js' ) ); // Enqueue previewer javascript
     //add_action( "wp_footer", array( $this, '_enqueue_new' ), 100 );
     //$this->_enqueue_new();
 }
 public static function get_extension_url($dir)
 {
     $ext_dir = AvadaRedux_Helpers::get_extension_dir($dir);
     $ext_dir = str_replace(wp_normalize_path(WP_CONTENT_DIR), WP_CONTENT_URL, $dir);
     $ext_url = '';
     if (preg_match("/wp-content\\/(.*)/", $ext_dir, $match)) {
         $ext_url = site_url('/wp-content/' . $match[1]);
     }
     return $ext_url;
 }
 public static function get_extension_url($dir)
 {
     $ext_dir = AvadaRedux_Helpers::get_extension_dir($dir);
     $ext_url = str_replace(wp_normalize_path(WP_CONTENT_DIR), WP_CONTENT_URL, $ext_dir);
     return $ext_url;
 }