/** * Class Constructor. Defines the args for the extions class * * @since 1.0.0 * @access public * @param array $parent Parent settings. * @return void */ public function __construct($parent) { $redux_ver = ReduxFramework::$_version; // Set parent object $this->parent = $parent; // Set extension dir if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); $this->extension_url = site_url(str_replace(trailingslashit(str_replace('\\', '/', ABSPATH)), '', $this->extension_dir)); self::$ext_url = $this->extension_url; } // Set field name $this->field_name = 'js_button'; // Set instance self::$theInstance = $this; // Adds the local field add_filter('redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(&$this, 'overload_field_path')); }
/** * Enqueue Function. * * If this field requires any scripts, or css define this function and register/enqueue the scripts/css * * @since 1.0.0 * @access public * @return void */ public function enqueue() { $extension = ReduxFramework_extension_js_button::getInstance(); // Make sure script data exists first if (isset($this->field['script']) && !empty($this->field['script'])) { // URI location of script to enqueue $script_url = isset($this->field['script']['url']) ? $this->field['script']['url'] : ''; // Get deps, if any $script_dep = isset($this->field['script']['dep']) ? $this->field['script']['dep'] : array(); // Get ver, if any $script_ver = isset($this->field['script']['ver']) ? $this->field['script']['ver'] : time(); // Script location in HTML $script_footer = isset($this->field['script']['in_footer']) ? $this->field['script']['in_footer'] : true; // If a script exists, enqueue it. if ($script_url != '') { wp_enqueue_script('redux-js-button-' . $this->field['id'] . '-js', $script_url, $script_dep, $script_ver, $script_footer); } } // Set up min files for dev_mode = false. $min = Redux_Functions::isMin(); // Field dependent JS wp_enqueue_script('redux-field-js-button-js', $this->extension_url . 'field_js_button' . $min . '.js', array('jquery'), time(), true); }