/** * Save the Custom CSS and PHP files * * This function highjacks the option on the way & saves the CSS/PHP to the custom file. We don't actually * want to save the custom code to the DB, just to the files in the media folder. * * @param array $newvalue Values submitted from the design settings page. * @param array $oldvalue Unused * @return false * @since 1.5.0 */ function save($newvalue, $oldvalue = '') { global $premise_design_settings; /** Permission check */ if (!current_user_can('unfiltered_html')) { return false; } /** Don't load custom.php when trying to save custom.php */ remove_action('after_setup_theme', 'premise_do_custom_php'); if (premise_make_stylesheet_path_writable()) { foreach ($premise_design_settings->get_settings() as $key => $style) { /** Write CSS */ $f = fopen(premise_get_custom_stylesheet_path($key), 'w+'); if ($f !== FALSE) { fwrite($f, stripslashes($newvalue['css'][$key])); fclose($f); premise_create_stylesheets(); if (!isset($style['premise_custom_css'])) { continue; } unset($style['premise_custom_css']); $premise_design_settings->update_settings($style, $key); } } /** Write PHP */ premise_edit_custom_php($newvalue['php']); } /** Retain only the reset value, if necessary, otherwise just revert to defaults */ if (isset($newvalue['reset'])) { return wp_parse_args($newvalue, $this->default_settings); } else { return $this->default_settings; } }
function create_stylesheets() { require_once PREMISE_LIB_DIR . 'stylesheets.php'; premise_create_stylesheets(); }
function enqueue_theme_scripts_css() { global $premise_base; $post_id = $this->get_post_id(); $meta = $premise_base->get_premise_meta($post_id); $key = $meta['style']; if (!file_exists(premise_get_settings_stylesheet_path($key)) || trim(premise_get_settings_stylesheet_contents($key)) == '') { premise_create_stylesheets(); } if (!file_exists(premise_get_custom_buttons_stylesheet_path())) { $premise_base->save_configured_buttons_stylesheet(array(), $premise_base->get_configured_buttons()); } if ($this->_use_premise_theme && file_exists(premise_get_settings_stylesheet_path($key))) { if (!premise_is_minified($key)) { wp_enqueue_style('premise', PREMISE_THEMES_URL . 'premise/style.css', array(), filemtime(PREMISE_DIR . 'themes/premise/style.css')); wp_enqueue_style('premise_settings_stylesheet', premise_get_settings_stylesheet_url($key), false, filemtime(premise_get_settings_stylesheet_path($key))); if (is_file(premise_get_custom_stylesheet_path($key))) { wp_enqueue_style('premise_custom_stylesheet', premise_get_custom_stylesheet_url($key), false, filemtime(premise_get_custom_stylesheet_path($key))); } } else { // Otherwise, if minified, then add reference to minified stylesheet, and remove style.css reference wp_enqueue_style('premise_minified_stylesheet', premise_get_minified_stylesheet_url($key), false, filemtime(premise_get_minified_stylesheet_path($key))); } } wp_enqueue_style('premise_custom_buttons', premise_get_custom_buttons_stylesheet_url()); wp_enqueue_script('premise_easing', PREMISE_THEMES_URL . 'premise/js/jquery-easing.js', array('jquery'), PREMISE_VERSION); wp_enqueue_script('premise_coda_slider', PREMISE_THEMES_URL . 'premise/js/jquery-coda.js', array('jquery', 'premise_easing'), PREMISE_VERSION); wp_enqueue_script('premise_pretty_photo', PREMISE_THEMES_URL . 'premise/js/jquery-overlay.js', array('jquery'), PREMISE_VERSION); }