示例#1
0
 /**
  * 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 (!genesis_is_menu_page($this->page_id)) {
         return;
     }
     /** Show error if can't write to server */
     if (!prose_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.', 'prose');
         } else {
             $message = __('The %s folder does not exist or is not writeable. Please contact your network administrator.', 'prose');
         }
         $css_path = prose_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();
 }
/**
 * Merges style.css, settings stylesheet and custom.css, then minifies it into
 * one minified.css file. Also creates individual beautified settings stylesheet
 * so they are in sync, and attempts to create custom stylesheet if it doesn't 
 * exist.
 * 
 * @author Gary Jones
 * @since 0.9.7
 * @version 1.0
 */
function prose_create_stylesheets()
{
    prose_make_stylesheet_path_writable();
    $css_prefix = '/* ' . __('This file is auto-generated from the style.css, the settings page and custom.css. Any direct edits here will be lost if the settings page is saved', PROSE_DOMAIN) . ' */' . "\n";
    $css = file_get_contents(CHILD_URL . '/style.css');
    $css .= prose_prepare_settings_stylesheet();
    //    if ( file_exists(prose_get_custom_stylesheet_path()) ) {
    if (prose_is_custom_stylesheet_used()) {
        $css .= file_get_contents(prose_get_custom_stylesheet_path());
    }
    $css = $css_prefix . prose_minify_css($css);
    $handle = @fopen(prose_get_minified_stylesheet_path(), 'w');
    @fwrite($handle, $css);
    @fclose($handle);
    prose_create_settings_stylesheet();
    prose_create_custom_stylesheet();
}
function prose_settings_notice()
{
    if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'design-settings') {
        return;
    }
    if (isset($_REQUEST['reset']) && $_REQUEST['reset'] == 'true') {
        echo '<div id="message" class="updated"><p>' . __('Design Settings Reset', PROSE_DOMAIN) . '</p></div>';
    } elseif (isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true') {
        echo '<div id="message" class="updated"><p>' . __('Design Settings Saved', PROSE_DOMAIN) . '</p></div>';
    } elseif (isset($_REQUEST['prose']) && 'import' == $_REQUEST['prose']) {
        echo '<div id="message" class="updated"><p>' . __('Design Settings Imported', PROSE_DOMAIN) . '</p></div>';
    } elseif (isset($_REQUEST['prose']) && 'wrongfile' == $_REQUEST['prose']) {
        echo '<div id="message" class="error"><p><strong>' . sprintf(__('You tried to import an incorrect file. The filename should start with "%s".', PROSE_DOMAIN), prose_get_export_filename_prefix()) . '</strong></p></div>';
    } elseif (isset($_REQUEST['prose']) && 'file' == $_REQUEST['prose']) {
        echo '<div id="message" class="error"><p><strong>' . __('There was a problem with the file you uploaded.', PROSE_DOMAIN) . '</strong></p></div>';
    }
    if (prose_make_stylesheet_path_writable()) {
        echo '<div id="message-unwritable" class="error"><p><strong>' . sprintf(__('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.', PROSE_DOMAIN), _get_template_edit_filename(prose_get_stylesheet_location('path'), dirname(prose_get_stylesheet_location('path')))) . '</strong></p></div>';
    }
}