function processPremiseDesignSettings() { $data = stripslashes_deep($_POST); $key = isset($data['premise-design-key']) ? $data['premise-design-key'] : null; $design = $data['premise-design']; if (isset($design['reset'])) { $settings = $this->getDefaultDesignSettings(); $message = 'reset=true'; } else { if (!empty($key)) { $settings = $this->getDefaultDesignSettings(); } else { $settings = $this->getConfiguredStyle($key); } $settings = array_merge($settings, $design); if (!isset($design['minify_css']) || $design['minify_css'] != 'true' || !is_writeable(premise_get_stylesheet_location('file'))) { unset($settings['minify_css']); } $message = 'updated=true'; } $key = $this->saveDesignSettings($settings, $key); return "premise-design-key={$key}&{$message}"; }
/** * Try and make stylesheet directory writable. May not work if safe-mode or * other server configurations are enabled. * * @author Gary Jones * @since 1.0 */ function premise_make_stylesheet_path_writable() { if (!is_dir(premise_get_stylesheet_location('path'))) { mkdir(premise_get_stylesheet_location('path')); } if (!is_writable(premise_get_stylesheet_location('path'))) { @chmod(premise_get_stylesheet_location('path'), 0777); } if (!is_writable(premise_get_stylesheet_location('path'))) { return true; } return false; }
/** * Add notices to the top of the page when certain actions take place. * * Add default notices via parent::notices() as well as a few custom ones. * * @since 1.5.0 * */ function notices() { /** Check to verify we're on the right page */ if (!accesspress_is_menu_page($this->page_id)) { return; } /** Show error if can't write to server */ if (!premise_make_stylesheet_path_writable()) { if (!is_multisite() || is_super_admin()) { $message = __('The %s folder does not exist or is not writeable. Please create it or <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a> to 777.', 'premise'); } else { $message = __('The %s folder does not exist or is not writeable. Please contact your network administrator.', 'premise'); } $css_path = premise_get_stylesheet_location('path'); echo '<div id="message-unwritable" class="error"><p><strong>' . sprintf($message, _get_template_edit_filename($css_path, dirname($css_path))) . '</strong></p></div>'; } /** Genesis_Admin notices */ parent::notices(); }
/** * Try and make stylesheet directory writable. May not work if safe-mode or * other server configurations are enabled. * * @author Gary Jones * @since 1.0 */ function premise_make_stylesheet_path_writable() { $stylesheet_path = premise_get_stylesheet_location('path'); if (!is_dir($stylesheet_path)) { mkdir(premise_get_stylesheet_location('path')); } return is_writable(premise_get_stylesheet_location('path')); }
/** * Return the full path to the custom.php file for editing and inclusion. * * @uses prose_get_stylesheet_location() * * @since 1.5.0 * */ function premise_get_custom_php_path() { return premise_get_stylesheet_location('path') . 'custom.php'; }