示例#1
0
 /**
  * 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 = '')
 {
     /** 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', 'prose_do_custom_php');
     if (prose_make_stylesheet_path_writable()) {
         /** Write CSS */
         $f = fopen(prose_get_custom_stylesheet_path(), 'w+');
         if ($f !== FALSE) {
             fwrite($f, stripslashes($newvalue['css']));
             fclose($f);
             prose_create_stylesheets();
         }
         /** Write PHP */
         prose_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;
     }
 }
示例#2
0
文件: update.php 项目: hscale/webento
/**
 * Upgrade the database to version 1500.
 *
 * @since 1.5.0
 *
 * @uses _genesis_update_settings()
 */
function prose_update_1500()
{
    /** Calculate new unitless line height */
    $body_line_height = absint(prose_get_design_option('body_line_height')) / absint(prose_get_design_option('body_font_size'));
    /** Update Settings */
    _genesis_update_settings(array('theme_version' => '1.5.0', 'db_version' => '1500', 'body_line_height' => round($body_line_height, 3)), PROSE_SETTINGS_FIELD);
    /** write CSS to media folder */
    prose_create_stylesheets();
    /** write custom.php to media folder */
    prose_create_custom_php();
}
/**
 * Attempts to create all stylesheets when the Prose theme is activated.
 * 
 * @author Gary Jones
 * @since 1.0
 */
function prose_do_create_stylesheets()
{
    global $pagenow;
    if (is_admin() && (isset($_GET['activated']) && $pagenow == "themes.php" || isset($_GET['a']) && $pagenow == "theme-editor.php" && isset($_GET['file']) && strstr($_GET['file'], prose_get_custom_stylesheet_name()))) {
        prose_create_stylesheets();
    }
}