示例#1
0
 public static function init()
 {
     global $wp_filesystem;
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = str_replace($wp_content_dir, '', self::$_dir);
     self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
     self::$_url = self::$wp_content_url . $relative_url;
     // See if Redux is a plugin or not
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
         self::$_is_plugin = false;
     }
     // Create our private upload directory
     Redux_Functions::initWpFilesystem();
     self::$_upload_dir = trailingslashit($wp_filesystem->wp_content_dir()) . '/redux/';
     self::$_upload_url = trailingslashit(content_url()) . '/redux/';
     if (function_exists('sys_get_temp_dir')) {
         $tmp = sys_get_temp_dir();
         if (empty($tmp)) {
             $tmpDir = self::$_upload_url . 'tmp';
             if (file_exists($tmpDir)) {
                 Redux_Helpers::rmdir($tmpDir);
             }
             putenv('TMPDIR=' . self::$_upload_dir . 'tmp');
         }
     }
     // Ensure it exists
     if (!is_dir(self::$_upload_dir)) {
         // Create the directory
         $wp_filesystem->mkdir(self::$_upload_dir);
     }
 }
示例#2
0
 public static function compile_sass($parent)
 {
     if (!empty(self::$path)) {
         if (!class_exists('scssc') && !isset($GLOBALS['redux_scss_compiler'])) {
             $GLOBALS['redux_scss_compiler'] = true;
             require "scssphp/scss.inc.php";
         }
         $scss = new scssc();
         $scss->setImportPaths(self::$path);
         if (!$parent->args['dev_mode']) {
             $scss->setFormatter("scss_formatter_compressed");
         }
         $new_css = '';
         foreach (self::$import as $import) {
             $new_css .= $scss->compile($import);
         }
         if ($new_css != '') {
             if ($parent->args['sass']['page_output']) {
                 echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>';
             } else {
                 $filesystem = $parent->filesystem;
                 $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css');
                 $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css));
             }
         }
     }
 }
示例#3
0
文件: framework.php 项目: 6226/wp
 static function init()
 {
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = str_replace($wp_content_dir, '', self::$_dir);
     self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
     self::$_url = self::$wp_content_url . $relative_url;
     // See if Redux is a plugin or not
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
         self::$_is_plugin = false;
     }
     // Create our private upload directory
     $upload = wp_upload_dir();
     self::$_upload_dir = Redux_Helpers::cleanFilePath($upload['basedir']) . '/redux/';
     self::$_upload_url = Redux_Helpers::cleanFilePath($upload['baseurl']) . '/redux/';
     // Ensure it exists
     if (!is_dir(self::$_upload_dir)) {
         global $wp_filesystem;
         // Init wp_filesystem
         Redux_Functions::initWpFilesystem();
         // Create the directory
         $wp_filesystem->mkdir(self::$_upload_dir);
     }
 }
 public static function compile_sass($parent)
 {
     if (!empty(self::$path)) {
         require "scssphp/scss.inc.php";
         $scss = new scssc();
         $scss->setImportPaths(self::$path);
         if (!$parent->args['dev_mode']) {
             $scss->setFormatter("scss_formatter_compressed");
         }
         $new_css = '';
         foreach (self::$import as $import) {
             $new_css .= $scss->compile($import);
         }
         if ($new_css != '') {
             if ($parent->args['sass']['page_output']) {
                 echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>';
             } else {
                 //Redux_Functions::initWpFilesystem();
                 //global $wp_filesystem;
                 $filesystem = $parent->filesystem;
                 $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css');
                 //$ret_val    = $wp_filesystem->put_contents($css_file, $new_css, FS_CHMOD_FILE);
                 $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css));
             }
         }
     }
 }
示例#5
0
 static function init()
 {
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = str_replace($wp_content_dir, '', self::$_dir);
     $wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL);
     self::$_url = trailingslashit($wp_content_url) . $relative_url;
     // See if Redux is a plugin or not
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
         self::$_is_plugin = false;
     }
     /**
             Still need to port these.
     
                 $defaults['footer_credit']      = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="' . $this->framework_url . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>';
                 $defaults['help_tabs']          = array();
                 $defaults['help_sidebar']       = ''; // __( '', 'redux-framework' );
                 $defaults['database']           = ''; // possible: options, theme_mods, theme_mods_expanded, transient
                 $defaults['customizer']         = false; // setting to true forces get_theme_mod_expanded
                 $defaults['global_variable']    = '';
                 $defaults['output']             = true; // Dynamically generate CSS
                 $defaults['transient_time']     = 60 * MINUTE_IN_SECONDS;
     
                 // The defaults are set so it will preserve the old behavior.
                 $defaults['default_show']       = false; // If true, it shows the default value
                 $defaults['default_mark']       = ''; // What to print by the field's title if the value shown is default
     **/
     self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false)));
 }
示例#6
0
 public function __construct()
 {
     // This is needed. Bah WordPress bugs.  ;)
     if (defined('BOW_TEMPLATE_DIR') && strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(BOW_TEMPLATE_DIR)) !== false) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
 public function __construct()
 {
     // This is needed. Bah WordPress bugs.  ;)
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
示例#8
0
 static function init()
 {
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = '/themeoptions/';
     self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
     self::$_url = get_template_directory_uri() . $relative_url;
 }
 public function ftp_form()
 {
     if (isset($this->parent->ftp_form) && !empty($this->parent->ftp_form)) {
         echo '<div class="wrap"><div class="error"><p>';
         echo __('Unable to modify required files. Please ensure that', 'redux-framework');
         echo ' <code>' . Redux_Helpers::cleanFilePath(trailingslashit(WP_CONTENT_DIR)) . '/uploads/</code> ';
         echo __('has the proper read/write permissions or enter your FTP information below.', 'redux-framework');
         echo '</p></div><h2></h2>' . $this->parent->ftp_form . '</div>';
     }
 }
示例#10
0
 public function __construct()
 {
     if (!class_exists("ReduxFramework")) {
         return;
     }
     // This is needed. Bah WordPress bugs.  ;)
     if (defined('TEMPLATEPATH') && strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     // This is needed. Bah WordPress bugs.  ;)
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
示例#12
0
 static function init()
 {
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = str_replace($wp_content_dir, '', self::$_dir);
     self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
     self::$_url = self::$wp_content_url . $relative_url;
     // See if Redux is a plugin or not
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
         self::$_is_plugin = false;
     }
 }
示例#13
0
 static function init()
 {
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
     $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
     $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
     $relative_url = str_replace($wp_content_dir, '', self::$_dir);
     $wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL);
     self::$_url = trailingslashit($wp_content_url) . $relative_url;
     // See if Redux is a plugin or not
     if (defined('TEMPLATEPATH') && strpos(__FILE__, TEMPLATEPATH) !== false) {
         self::$_is_plugin = false;
     }
     self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false)));
 }
 public static function init()
 {
     $dir = Redux_Helpers::cleanFilePath(dirname(__FILE__));
     // Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
     self::$_dir = trailingslashit($dir);
     self::$wp_content_url = trailingslashit(Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL));
     // See if Redux is a plugin or not
     if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false || strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory_uri())) !== false || strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(WP_CONTENT_DIR . '/themes/')) !== false) {
         self::$_is_plugin = false;
     } else {
         // Check if plugin is a symbolic link, see if it's a plugin. If embedded, we can't do a thing.
         if (strpos(self::$_dir, ABSPATH) === false) {
             if (!function_exists('get_plugins')) {
                 require_once ABSPATH . 'wp-admin/includes/plugin.php';
             }
             $is_plugin = false;
             foreach (get_plugins() as $key => $value) {
                 if (is_plugin_active($key) && strpos($key, 'redux-framework.php') !== false) {
                     self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR . '/plugins/' . plugin_dir_path($key) . 'ReduxCore/'));
                     $is_plugin = true;
                 }
             }
             if (!$is_plugin) {
                 self::$_is_plugin = false;
             }
         }
     }
     if (self::$_is_plugin == true || self::$_as_plugin == true) {
         self::$_url = plugin_dir_url(__FILE__);
     } else {
         if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_template_directory())) !== false) {
             $relative_url = str_replace(Redux_Helpers::cleanFilePath(get_template_directory()), '', self::$_dir);
             self::$_url = trailingslashit(get_template_directory_uri() . $relative_url);
         } else {
             if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
                 $relative_url = str_replace(Redux_Helpers::cleanFilePath(get_stylesheet_directory()), '', self::$_dir);
                 self::$_url = trailingslashit(get_stylesheet_directory_uri() . $relative_url);
             } else {
                 $wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
                 $wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
                 $relative_url = str_replace($wp_content_dir, '', self::$_dir);
                 self::$_url = trailingslashit(self::$wp_content_url . $relative_url);
             }
         }
     }
     self::$_url = apply_filters("redux/_url", self::$_url);
     self::$_dir = apply_filters("redux/_dir", self::$_dir);
     self::$_is_plugin = apply_filters("redux/_is_plugin", self::$_is_plugin);
 }
示例#15
0
 public function load_first()
 {
     $plugin_dir = Redux_Helpers::cleanFilePath(WP_PLUGIN_DIR) . '/';
     $self_file = Redux_Helpers::cleanFilePath(__FILE__);
     $path = str_replace($plugin_dir, '', $self_file);
     $path = str_replace('class.redux-plugin.php', 'redux-framework.php', $path);
     if ($plugins = get_option('active_plugins')) {
         if ($key = array_search($path, $plugins)) {
             array_splice($plugins, $key, 1);
             array_unshift($plugins, $path);
             update_option('active_plugins', $plugins);
         }
     }
 }
示例#16
0
 public static function compile_sass($parent)
 {
     if (!empty(self::$path)) {
         $do_compile = false;
         $as_output = false;
         if (!self::is_sass_dir(ReduxFramework::$_upload_dir . 'sass')) {
             $as_output = true;
         }
         if ($parent->args['sass']['page_output']) {
             $as_output = true;
         }
         $mb = $parent->extensions['metaboxes'];
         if (!empty($mb->boxes)) {
             $as_output = true;
         }
         $opt_name = $parent->args['opt_name'];
         self::$matrix_file = ReduxFramework::$_upload_dir . 'sass/' . $opt_name . '-id-matrix';
         self::$matrix_key = 'redux-sass-' . $opt_name . '-id-matrix';
         if (!$as_output) {
             $current_ids = self::get_current_id_matrix($parent);
             $saved_ids = self::get_id_matrix();
             if ($saved_ids == '' || empty($saved_ids)) {
                 $ret = self::set_id_matrix($current_ids);
                 $do_compile = true;
             } else {
                 if ($current_ids != $saved_ids) {
                     logconsole('not the same');
                     self::set_id_matrix($current_ids);
                     $do_compile = true;
                 } else {
                     logconsole('the same');
                 }
             }
         } else {
             $do_compile = true;
         }
         if ($do_compile || self::$_do_compile) {
             logconsole('compiler run');
             if (!class_exists('scssc') && !isset($GLOBALS['redux_scss_compiler'])) {
                 $GLOBALS['redux_scss_compiler'] = true;
                 require "scssphp/scss.inc.php";
             }
             $scss = new scssc();
             $scss->setImportPaths(self::$path);
             if (!$parent->args['dev_mode']) {
                 $scss->setFormatter("scss_formatter_compressed");
             }
             $new_css = '';
             foreach (self::$import as $import) {
                 $new_css .= $scss->compile($import);
             }
             unset($scss);
             if ($new_css != '') {
                 if ($as_output) {
                     self::css_to_page($opt_name, $new_css);
                     return self::SASS_PAGE_OUTPUT;
                 } else {
                     $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css');
                     $ret = @file_put_contents($css_file, $new_css);
                     if ($ret == false) {
                         self::css_to_page($opt_name, $new_css);
                         return self::SASS_PAGE_OUTPUT;
                     }
                     return self::SASS_FILE_COMPILE;
                 }
             }
         }
         // do_compile
     }
     return self::SASS_NO_COMPILE;
 }
 private function set_redux_content()
 {
     $wp_content_dir = Redux_Helpers::cleanFilePath(trailingslashit(WP_CONTENT_DIR));
     self::$_upload_dir = $wp_content_dir . '/uploads/redux/';
     self::$_upload_url = Redux_Helpers::cleanFilePath(trailingslashit(content_url())) . '/uploads/redux/';
     if (!is_dir(self::$_upload_dir)) {
         $this->filesystem->execute('mkdir', self::$_upload_dir);
     }
 }
 public function do_action($action, $file = '', $params = '')
 {
     if (!empty($params)) {
         extract($params);
     }
     global $wp_filesystem;
     if (!isset($params['chmod']) || isset($params['chmod']) && empty($params['chmod'])) {
         if (defined('FS_CHMOD_FILE')) {
             $chmod = FS_CHMOD_FILE;
         } else {
             $chmod = 0644;
         }
     }
     $res = false;
     if (!isset($recursive)) {
         $recursive = false;
     }
     //$target_dir = $wp_filesystem->find_folder( dirname( $file ) );
     // Do unique stuff
     if ($action == 'mkdir') {
         if (defined('FS_CHMOD_DIR')) {
             $chmod = FS_CHMOD_DIR;
         } else {
             $chmod = 0755;
         }
         $res = $wp_filesystem->mkdir($file);
         if (!$res) {
             wp_mkdir_p($file);
             $res = file_exists($file);
             if (!$res) {
                 mkdir($file, $chmod, true);
                 $res = file_exists($file);
             }
         }
     } elseif ($action == 'rmdir') {
         $res = $wp_filesystem->rmdir($file, $recursive);
     } elseif ($action == 'copy' && !isset($this->filesystem->killswitch)) {
         if (isset($this->parent->ftp_form) && !empty($this->parent->ftp_form)) {
             $res = copy($file, $destination);
             if ($res) {
                 chmod($destination, $chmod);
             }
         } else {
             $res = $wp_filesystem->copy($file, $destination, $overwrite, $chmod);
         }
     } elseif ($action == 'move' && !isset($this->filesystem->killswitch)) {
         $res = $wp_filesystem->copy($file, $destination, $overwrite);
     } elseif ($action == 'delete') {
         $res = $wp_filesystem->delete($file, $recursive);
     } elseif ($action == 'rmdir') {
         $res = $wp_filesystem->rmdir($file, $recursive);
     } elseif ($action == 'dirlist') {
         if (!isset($include_hidden)) {
             $include_hidden = true;
         }
         $res = $wp_filesystem->dirlist($file, $include_hidden, $recursive);
     } elseif ($action == 'put_contents' && !isset($this->filesystem->killswitch)) {
         // Write a string to a file
         if (isset($this->parent->ftp_form) && !empty($this->parent->ftp_form)) {
             self::load_direct();
             $res = self::$direct->put_contents($file, $content, $chmod);
         } else {
             $res = $wp_filesystem->put_contents($file, $content, $chmod);
         }
     } elseif ($action == 'chown') {
         // Changes file owner
         if (isset($owner) && !empty($owner)) {
             $res = $wp_filesystem->chmod($file, $chmod, $recursive);
         }
     } elseif ($action == 'owner') {
         // Gets file owner
         $res = $wp_filesystem->owner($file);
     } elseif ($action == 'chmod') {
         if (!isset($params['chmod']) || isset($params['chmod']) && empty($params['chmod'])) {
             $chmod = false;
         }
         $res = $wp_filesystem->chmod($file, $chmod, $recursive);
     } elseif ($action == 'get_contents') {
         // Reads entire file into a string
         if (isset($this->parent->ftp_form) && !empty($this->parent->ftp_form)) {
             self::load_direct();
             $res = self::$direct->get_contents($file);
         } else {
             $res = $wp_filesystem->get_contents($file);
         }
     } elseif ($action == 'get_contents_array') {
         // Reads entire file into an array
         $res = $wp_filesystem->get_contents_array($file);
     } elseif ($action == 'object') {
         $res = $wp_filesystem;
     } elseif ($action == 'unzip') {
         $unzipfile = unzip_file($file, $destination);
         if ($unzipfile) {
             $res = true;
         }
     }
     if (!$res) {
         if ($action == 'dirlist') {
             if (empty($res) || $res == false || $res == '') {
                 return;
             }
             if (is_array($res) && empty($res)) {
                 return;
             }
             if (!is_array($res)) {
                 if (count(glob("{$file}*")) == 0) {
                     return;
                 }
             }
         }
         $this->killswitch = true;
         $this->parent->admin_notices[] = array('type' => 'error', 'msg' => '<strong>' . __('File Permission Issues', 'redux-framework') . '</strong><br/>' . sprintf(__('We were unable to modify required files. Please ensure that <code>%1s</code> has the proper read-write permissions, or modify your wp-config.php file to contain your FTP login credentials as <a href="%2s" target="_blank">outlined here</a>.', 'redux-framework'), Redux_Helpers::cleanFilePath(trailingslashit(WP_CONTENT_DIR)) . '/uploads/', 'https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants'), 'id' => 'redux-wp-login', 'dismiss' => false);
         //add_action( "redux/page/{$this->parent->args['opt_name']}/form/before", array(
         //    $this,
         //    'ftp_form'
         //) );
     }
     return $res;
 }