From 70f49b92756dd69ea5155a31f5211462eea7c41c Mon Sep 17 00:00:00 2001 From: lechuck <l3chuck@autistici.org> Date: Sat, 14 Jul 2012 09:15:03 +0000 Subject: [PATCH] Upgrade ComicPress to 0.3.4 --- .../comicpress-companion/companion.php | 28 ++------ .../comicpress-companion/companion_core.php | 69 +++++++++---------- .../includes/ccexamples.php | 2 +- .../comicpress-companion/includes/cchelp.php | 11 +-- .../plugins/comicpress-companion/readme.txt | 8 ++- 5 files changed, 51 insertions(+), 67 deletions(-) diff --git a/wp-content/plugins/comicpress-companion/companion.php b/wp-content/plugins/comicpress-companion/companion.php index 25653ddbb..03a21353d 100644 --- a/wp-content/plugins/comicpress-companion/companion.php +++ b/wp-content/plugins/comicpress-companion/companion.php @@ -3,11 +3,11 @@ Plugin Name: Theme Companion Plugin URI: http://frumph.net/ Description: CSS Editor, Extra Options and Functions for themes. -Version: 0.3.0 +Version: 0.3.4 Author: Philip M. Hofer (Frumph) Author URI: http://frumph.net/ -Copyright 2009 Philip M. Hofer (Frumph) (email : philip@frumph.net) +Copyright 2009-2012 Philip M. Hofer (Frumph) (email : philip@frumph.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,27 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ if (is_admin()) { - // check if this is a comicpress theme, if not, dont execute. -/* if (strpos(get_template_directory(), 'comicpress') == false) { - if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) return; - - function companion_no_comicpress_theme() { - $output = '<div class="error">'; - $output .= '<h2>'.__('Theme Companion Error','companion').'</h2>'; - $output .= __('The current theme is not a ComicPress theme; ComicPress Companion will not load.','companion').'<br />'; - $output .='<br />'; - $output .='</div>'; - echo $output; - } - - add_action( 'admin_notices', 'companion_no_comicpress_theme' ); - return; - } */ - require_once(dirname (__FILE__) . '/companion_core.php'); + @require_once(dirname (__FILE__) . '/companion_core.php'); } -// Make this work even no matter what, you just cant use the editor unless the comicpress theme is avail. - add_action('wp_head', 'companion_html_header_load'); function companion_html_header_load() { @@ -57,11 +39,9 @@ function companion_html_header_load() { echo $companion_file_contents; } } - // This is still unqueued because I could *not* figure out how to queue it. + if (file_exists($wp_dirs['basedir'] . '/css/custom_style.css')) { ?> - <link rel='stylesheet' id='custom_stylesheet' href='<?php echo $wp_dirs['baseurl']; ?>/css/custom_style.css' type='text/css' media='all' /> - <?php } } diff --git a/wp-content/plugins/comicpress-companion/companion_core.php b/wp-content/plugins/comicpress-companion/companion_core.php index 5b2e66dd1..a049c8d9b 100644 --- a/wp-content/plugins/comicpress-companion/companion_core.php +++ b/wp-content/plugins/comicpress-companion/companion_core.php @@ -33,7 +33,7 @@ function companion_is_multisite() { // Add menu page function companion_init_hooks() { - $companion_hook = add_submenu_page('themes.php', 'companion', __('Companion', 'companion'), 10, 'companion', 'companion_admin_page'); + $companion_hook = add_submenu_page('themes.php', 'companion', __('Companion', 'companion'), 'manage_options', 'companion', 'companion_admin_page'); add_action('admin_head-'.$companion_hook, 'companion_config_page_head'); add_action('admin_print_scripts-'.$companion_hook, 'companion_load_scripts'); add_action('admin_print_styles-'.$companion_hook, 'companion_load_styles'); @@ -76,19 +76,20 @@ function companion_admin_page() { <div class="wrap"> <h2 class="alignleft">Theme Companion</h2> <br clear="all" /> - <?php - switch ( stripslashes($_REQUEST['file']) ) { - case "style": - $edit_file = "custom_style"; - break; - case "head": - $edit_file = "header"; - break; - default: - $edit_file = "custom_style"; - break; - } - + <?php + if (isset($_REQUEST['file'])) { + switch ( stripslashes($_REQUEST['file']) ) { + case "style": + $edit_file = "custom_style"; + break; + case "head": + $edit_file = "header"; + break; + default: + $edit_file = "custom_style"; + break; + } + } else $edit_file = "custom_style"; if ($edit_file == 'header') { $companion_edit_type = 'html'; } else { @@ -96,19 +97,18 @@ function companion_admin_page() { } $companion_edit_file = companion_pluginfo('basedir') . '/css/' . $edit_file . '.' . $companion_edit_type; - $original = false; - if (stripslashes($_REQUEST['file']) == 'original') { + if (isset($_REQUEST['file']) && ($_REQUEST['file'] == 'original')) { $original = true; $companion_edit_file = companion_pluginfo('themepath') . '/style.css'; } - - $companion_file_content = trim(stripslashes($_REQUEST['newcontent'])); + + if (isset($_REQUEST['newcontent'])) $companion_file_content = trim(stripslashes($_REQUEST['newcontent'])); ?> <?php - if ( wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) { + if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) { if ('companion_css_save' == $_REQUEST['action'] ) { $companion_file_content = trim(stripslashes($_REQUEST['newcontent'])); @@ -136,12 +136,12 @@ function companion_admin_page() { } } } - if (file_exists($companion_edit_file)) { $f = fopen($companion_edit_file, 'r'); $companion_file_content = fread($f, filesize($companion_edit_file)); $companion_file_content = htmlspecialchars($companion_file_content); } else { + global $current_theme, $themes; if ($companion_edit_type == 'css') { $companion_file_content = "/* Companion Custom CSS over-rides for [ ".get_bloginfo('name')." ]: $current_theme - ".$themes[$current_theme]['Version']." */\r\n"; } else { @@ -173,23 +173,22 @@ function companion_admin_page() { if (!$original) { if ( $is_iis7 ) { - if (win_is_writable($companion_edit_file)) { ?> - File exists and is writable.<br /> - <?php } else { - wp_mkdir_p(dirname($companion_edit_file)); ?> - File Does *not* exist or is not writable, try to save the file. If you still get this error check permissions.<br /> - <?php } + if (win_is_writable($companion_edit_file)) { + echo 'WIN: File exists and is writable.<br />'; + } else { + wp_mkdir_p(dirname($companion_edit_file)); + echo '<i>WIN: File '.basename($companion_edit_file).' does *not* exist or is not writable, try to save the file. If you still get this error check permissions.</i><br />'; + } } else { - if (is_writable($companion_edit_file)) { ?> - File Exists and is writable.<br /> - <?php } else { - wp_mkdir_p(dirname($companion_edit_file)); ?> - File Does *not* exist or is not writable, try to save the file. If you still get this error check permissions.<br /> - <?php } + if (is_writable($companion_edit_file)) { + echo 'NIX: File Exists and is writable.<br />'; + } else { + wp_mkdir_p(dirname($companion_edit_file)); + echo '<i>NIX: File '.basename($companion_edit_file).' does *not* exist or is not writable, try to save the file. If you still get this error check permissions.</i><br />'; + } } - } else { ?> - Loading Original Style.CSS, it is NOT writable, you are to use the custom editor area to add changes that you want to make, and only changes.<br /> - <?php + } else { + echo 'Loading Original Style.CSS, it is NOT writable, you are to use the custom editor area to add changes that you want to make, and only changes.<br />'; } $base = admin_url(); ?> diff --git a/wp-content/plugins/comicpress-companion/includes/ccexamples.php b/wp-content/plugins/comicpress-companion/includes/ccexamples.php index 6f4da67bd..15ffaed47 100644 --- a/wp-content/plugins/comicpress-companion/includes/ccexamples.php +++ b/wp-content/plugins/comicpress-companion/includes/ccexamples.php @@ -32,7 +32,7 @@ } </p> <p> - <em style="color: #5db408">/* make the html page not wobble when reloading to a new page. */</em> + <em style="color: #5db408">/* make the html page not wobble when reloading to a new page. */</em><br /> html { overflow-y: scroll; } <br /> </p> </td> diff --git a/wp-content/plugins/comicpress-companion/includes/cchelp.php b/wp-content/plugins/comicpress-companion/includes/cchelp.php index e9f11268e..f63defccf 100644 --- a/wp-content/plugins/comicpress-companion/includes/cchelp.php +++ b/wp-content/plugins/comicpress-companion/includes/cchelp.php @@ -11,10 +11,13 @@ </ol> </ul> </td> - <td> - <p id="colorpickerHolder"></p> - </td> - </tr> + </tr> + <tr> + <td> + <strong>Debug Information:</strong></br> + <?php var_dump(companion_pluginfo()); ?> + </td> + </tr> </table> </div> </div> diff --git a/wp-content/plugins/comicpress-companion/readme.txt b/wp-content/plugins/comicpress-companion/readme.txt index 18e8b1e18..681b7af3c 100644 --- a/wp-content/plugins/comicpress-companion/readme.txt +++ b/wp-content/plugins/comicpress-companion/readme.txt @@ -1,9 +1,9 @@ === Theme Companion === -Contributors: frumph +Contributors: Frumph Tags: comicpress, css, editor, plugin, multisite, theme, companion, webcomic Requires at least: 3.0 -Tested up to: 3.1 -Stable tag: 0.3.0 +Tested up to: 3.4 +Stable tag: 0.3.4 Donate link: http://frumph.net/ This plugin is used to assist in designing sites without editing the original style.css @@ -25,6 +25,8 @@ body { background: #333333; } Notice that you do *not* need to replace the entire CSS element but just the portion you want to override / change. == Changelog == += 0.3.4 = +Cleaned up notices/warnings, verified to work with WordPress 3.4 = 0.3.0 = Verified to work with WordPress 3.1 -- GitLab