示例#1
0
function safecss_admin()
{
    global $screen_layout_columns;
    $custom_content_width = intval(get_option('safecss_content_width'));
    // if custom content width hasn't been overridden and the theme has a content_width value, use that as a default
    if ($custom_content_width <= 0 && !empty($GLOBALS['content_width'])) {
        $custom_content_width = intval($GLOBALS['content_width']);
    }
    ?>
<div id="poststuff" class="metabox-holder<?php 
    echo 2 == $screen_layout_columns ? ' has-right-sidebar' : '';
    ?>
">
<div class="wrap">
<h2><?php 
    _e('CSS Stylesheet Editor', 'safecss');
    ?>
</h2>
<form id="safecssform" action="" method="post">
	<p><textarea id="safecss" name="safecss"><?php 
    echo str_replace('</textarea>', '&lt;/textarea&gt', safecss());
    ?>
</textarea></p>
	<p class="custom-css-help"><?php 
    _e('For help with CSS try <a href="http://www.w3schools.com/css/default.asp">W3Schools</a>, <a href="http://alistapart.com/">A List Apart</a>, and our own <a href="http://support.wordpress.com/editing-css/">CSS documentation</a> and <a href="http://en.forums.wordpress.com/forum/css-customization">CSS Forum</a>.', 'safecss');
    ?>
</p>
	<h4><?php 
    _e("Do you want to make changes to your current theme's stylesheet, or do you want to start from scratch?", 'safecss');
    ?>
</h4>
	<p><label><input type="radio" name="add_to_existing" value="true" <?php 
    if (get_option('safecss_add') != 'no') {
        echo ' checked="checked"';
    }
    ?>
 /> <?php 
    printf(__('Add this to the %s theme\'s CSS stylesheet (<a href="%s">view original stylesheet</a>)', 'safecss'), get_current_theme(), get_bloginfo('stylesheet_directory') . '/style.css' . '?minify=false');
    ?>
</label><br />
	<label><input type="radio" name="add_to_existing" value="false" <?php 
    if (get_option('safecss_add') == 'no') {
        echo ' checked="checked"';
    }
    ?>
 /> <?php 
    _e('Start from scratch and just use this ', 'safecss');
    ?>
</label>
	</p>

	<h4> <?php 
    _e("If you change the width of your main content column, make sure your media files fit. Enter the maximum width for media files in your new CSS below.", 'safecss');
    ?>
</h4>
	<p class="custom_content_width"><label for="custom_content_width"><?php 
    _e('Limit width to', 'safecss');
    ?>
</label>
	<input type="text" name="custom_content_width" id="custom_content_width" value="<?php 
    echo $custom_content_width;
    ?>
" size=5 /> <?php 
    printf(__('pixels for videos, full size images, and other shortcodes. (<a href="%s">more info</a>)', 'safecss'), 'http://support.wordpress.com/editing-css/#limited-width');
    ?>
</p>
	<p class="submit">
		<input type="hidden" name="action" value="save" />

		<?php 
    wp_nonce_field('safecss');
    ?>

		<input type="button" class="button" id="preview" name="preview" value="<?php 
    _e('Preview', 'safecss');
    ?>
" />
<?php 
    if (!safecss_is_freetrial()) {
        ?>
		<input type="submit" class="button" id="save" name="save" value="<?php 
        _e('Save Stylesheet &raquo;', 'safecss');
        ?>
" />
<?php 
    }
    ?>
		<?php 
    wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
    ?>
	</p>
</form>

<?php 
    $safecss_post = get_safecss_post();
    if (0 < $safecss_post['ID'] && wp_get_post_revisions($safecss_post['ID'])) {
        function post_revisions_meta_box($safecss_post)
        {
            // Specify numberposts and ordering args
            $args = array('numberposts' => 5, 'orderby' => 'ID', 'order' => 'DESC');
            // Remove numberposts from args if show_all_rev is specified
            if (isset($_GET['show_all_rev'])) {
                unset($args['numberposts']);
            }
            wp_list_post_revisions($safecss_post['ID'], $args);
        }
        add_meta_box('revisionsdiv', __('CSS Revisions', 'safecss'), 'post_revisions_meta_box', 'editcss', 'normal');
        do_meta_boxes('editcss', 'normal', $safecss_post);
    }
    ?>
</div>
</div>
<?php 
}
function safecss_admin()
{
    ?>
<div class="wrap">
	<?php 
    do_action('custom_design_header');
    ?>
	<div id="poststuff" class="has-right-sidebar metabox-holder">
	<h2><?php 
    _e('CSS Stylesheet Editor', 'jetpack');
    ?>
</h2>
	<p class="css-support"><?php 
    echo apply_filters('safecss_intro_text', __('New to CSS? Start with a <a href="http://www.htmldog.com/guides/cssbeginner/">beginner tutorial</a>. Questions?
	Ask in the <a href="http://wordpress.org/support/forum/themes-and-templates">Themes and Templates forum</a>.', 'jetpack'));
    ?>
</p>

	<form id="safecssform" action="" method="post">
		<?php 
    if (defined('SAFECSS_USE_ACE') && SAFECSS_USE_ACE) {
        ?>
			<div id="safecss-container">
				<div id="safecss-ace"></div>
			</div>
			<script type="text/javascript">
				jQuery.fn.spin && jQuery("#safecss-container").spin( 'large' );
			</script>
			<textarea id="safecss" name="safecss" class="hide-if-js"><?php 
        echo esc_textarea(safecss());
        ?>
</textarea>
			<div class="clear"></div>
		<?php 
    } else {
        ?>
		<p><textarea id="safecss" name="safecss"><?php 
        echo str_replace('</textarea>', '&lt;/textarea&gt', safecss());
        ?>
</textarea></p>
		<?php 
    }
    ?>
		<p class="submit">
			<span>
				<input type="hidden" name="action" value="save" />
				<?php 
    wp_nonce_field('safecss');
    ?>
				<input type="button" class="button" id="preview" name="preview" value="<?php 
    esc_attr_e('Preview', 'jetpack');
    ?>
" />
				<input type="submit" class="button-primary" id="save" name="save" value="<?php 
    safecss_is_freetrial() ? esc_attr_e('Save Stylesheet &amp; Buy Upgrade', 'jetpack') : esc_attr_e('Save Stylesheet', 'jetpack');
    ?>
" />
				<?php 
    wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
    ?>
			</span>
		</p>

		<?php 
    add_meta_box('settingsdiv', __('CSS Settings', 'jetpack'), 'custom_css_meta_box', 'editcss', 'normal');
    ?>

		<?php 
    $safecss_post = get_safecss_post();
    if (!empty($safecss_post) && 0 < $safecss_post['ID'] && wp_get_post_revisions($safecss_post['ID'])) {
        echo '<div id="side-info-column" class="inner-sidebar">';
        add_meta_box('revisionsdiv', __('CSS Revisions', 'jetpack'), 'custom_css_post_revisions_meta_box', 'editcss', 'side');
        do_meta_boxes('editcss', 'side', $safecss_post);
        echo '</div>';
        echo '<div id="post-body"><div id="post-body-content">';
        do_meta_boxes('editcss', 'normal', $safecss_post);
        echo '</div></div>';
        echo '<div class="clear"></div>';
    } else {
        do_meta_boxes('editcss', 'normal', $safecss_post);
    }
    ?>
		</form>
	</div>
</div>
<?php 
}