/** * 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 = ReduxFramework::$_upload_dir . 'custom-fonts/'; $this->upload_url = ReduxFramework::$_upload_url . 'custom-fonts/'; if (!is_dir($this->upload_dir)) { $this->parent->filesystem->execute('mkdir', $this->upload_dir); } if (!is_dir($this->upload_dir . '/custom')) { $this->parent->filesystem->execute('mkdir', $this->upload_dir . '/custom'); } $this->getFonts(); if (file_exists($this->upload_dir . 'fonts.css')) { if (filemtime($this->upload_dir . 'custom') > filemtime($this->upload_dir . 'fonts.css') + 10) { $this->generateCSS(); } } else { $this->generateCSS(); } if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); } $this->field_name = 'custom_fonts'; 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')); add_action('wp_ajax_redux_custom_fonts', array($this, 'ajax')); add_action('wp_ajax_redux_custom_font_timer', array($this, 'timer')); add_filter("redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array($this, 'addCustomFonts')); $this->is_field = Redux_Helpers::isFieldInUse($parent, 'custom_fonts'); if (!$this->is_field) { $this->add_section(); } //$this->dynamic_section(); add_filter("redux/options/{$this->parent->args['opt_name']}/section/redux_dynamic_font_control", array($this, 'remove_dynamic_section')); add_filter('upload_mimes', array($this, 'custom_upload_mimes')); add_action('wp_head', array($this, '_enqueue_output'), 150); add_filter('tiny_mce_before_init', array($this, 'extend_tinymce_dropdown')); }
/** * 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) { global $wp_filesystem; // Initialize the Wordpress filesystem, no more using file_put_contents function if (empty($wp_filesystem)) { require_once ABSPATH . '/wp-admin/includes/file.php'; WP_Filesystem(); } $upload = wp_upload_dir(); $this->upload_dir = ReduxFramework::$_upload_dir . 'custom-fonts/'; //$upload['basedir'] . '/redux_custom_fonts/'; $this->upload_url = ReduxFramework::$_upload_url . 'custom-fonts/'; //$upload['baseurl'] . '/redux_custom_fonts/'; $this->getFonts(); if (file_exists($this->upload_dir . '/fonts.css')) { if (filemtime($this->upload_dir) > filemtime($this->upload_dir . '/fonts.css') + 20) { //echo "regen existing file"; $this->generateCSS(); } } else { //echo "create non existing file"; $this->generateCSS(); } $this->parent = $parent; if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); } $this->field_name = 'custom_fonts'; 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')); add_action('wp_ajax_redux_custom_fonts', array($this, 'ajax')); add_filter("redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array($this, 'addCustomFonts')); $this->dynamic_section(); //require_once 'System.php'; // Wordpress core file //if ( class_exists('System') === true ) { add_filter('upload_mimes', array($this, 'custom_upload_mimes')); //} add_action('wp_head', array($this, '_enqueue_output'), 150); add_filter('tiny_mce_before_init', array($this, 'extend_tinymce_dropdown')); }
/** * 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->filesystem = $this->parent->filesystem->execute('object'); $this->upload_dir = ReduxFramework::$_upload_dir . 'custom-fonts/'; // $upload['basedir'] . '/redux_custom_fonts/'; $this->upload_url = ReduxFramework::$_upload_url . 'custom-fonts/'; // $upload['baseurl'] . '/redux_custom_fonts/'; //echo substr(sprintf('%o', fileperms($this->upload_dir )), -4); $this->getFonts(); if (file_exists($this->upload_dir . 'fonts.css')) { if (filemtime($this->upload_dir . 'custom') > filemtime($this->upload_dir . 'fonts.css') + 10) { //echo "regen existing file"; $this->generateCSS(); } } else { //echo "create non existing file"; $this->generateCSS(); } if (empty($this->extension_dir)) { $this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); } $this->field_name = 'custom_fonts'; 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')); add_action('wp_ajax_redux_custom_fonts', array($this, 'ajax')); //$this->ajax(); //add_action( 'wp_ajax_nopriv_redux_custom_fonts', array( // $this, // 'ajax' //) ); add_filter("redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array($this, 'addCustomFonts')); $this->is_field = Redux_Helpers::isFieldInUse($parent, 'custom_fonts'); if (!$this->is_field) { $this->add_section(); } //require_once 'System.php'; // Wordpress core file //if ( class_exists('System') === true ) { add_filter('upload_mimes', array($this, 'custom_upload_mimes')); //} add_action('wp_head', array($this, '_enqueue_output'), 150); add_filter('tiny_mce_before_init', array($this, 'extend_tinymce_dropdown')); }