Exemplo n.º 1
0
<?php

add_meta_box('revisionsdiv', __('CSS Revisions', 'safecss'), array('Improved_Simpler_CSS', 'revisions_meta_box'), 's-custom-css', 'side');
$message = '';
if (isset($_POST)) {
    $nonce = $_POST['_wpnonce'];
    if (wp_verify_nonce($_POST['update_custom_css_field'], 'update_custom_css')) {
        Improved_Simpler_CSS::update_css($_POST['editor']);
        $message = 'Updated Custom CSS';
    }
}
$data = Improved_Simpler_CSS::get(false);
if (isset($_GET['revision'])) {
    $message = "Custom CSS restored to revision from " . self::revision_time($data);
    Improved_Simpler_CSS::update_files($data);
}
if ($data->post_excerpt) {
    if (!file_exists(Improved_Simpler_CSS::$object->path_to . $data->post_excerpt)) {
        $message .= ' File Doesn\'t exist! Save the changes to create the file again';
    }
}
if (is_array(Improved_Simpler_CSS::$object->error)) {
    $message .= implode(Improved_Simpler_CSS::$object->error, ', ');
}
?>
	<div class="wrap">
		<div id="icon-themes" class="icon32"></div>
		<h2>Custom CSS</h2>
		<?php 
if (!empty($message)) {
    ?>
Exemplo n.º 2
0
 /**
  * include_css function.
  * 
  * @access public
  * @return void
  */
 function include_css()
 {
     self::$url = self::get_url();
     if (current_user_can('manage_options') || !self::$url) {
         echo '<style id="simpler-css-style" type="text/css">' . "\n";
         echo self::get_css();
         echo '</style><!-- end of custom css -->' . "\n";
     } elseif (self::$load_style) {
         echo "<link rel='stylesheet' id='custom-css-css'  href='" . self::make_url_agnostic(self::$url) . "' type='text/css' media='all' />";
     }
 }