Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor bug fixes, added Convert Characters tool.

  • Loading branch information...
commit 9b7b9dcf043e2de1c358f0a2bc41d9192b723b3a 1 parent b7f8ce6
Michael Sisk authored
View
21 readme.txt
@@ -3,18 +3,22 @@ Contributors: mgsisk
Donate link: http://webcomicms.net/
Tags: webcomic, comic, multiple comics, storylines, chapters, library, management, themes, posts, publish, custom post type, custom taxonomy, template tags, widgets
Requires at least: 3.0
-Tested up to: 3.0
-Stable tag: 3.0.4
+Tested up to: 3.1
+Stable tag: 3.0.5
Comic publishing power for WordPress.
== Description ==
-Please see the [official Webcomic site](http://webcomicms.net/) for the users manual, video tutorials, support forum, bug reports, andfeature requests.
+Please see the [official Webcomic site](http://webcomicms.net/) for the users manual, video tutorials, support forum, bug reports, and feature requests. For more direct assistance, contact [support@webcomicms.net](mailto:support@webcomicms.net).
-= Upgrading? =
+= ✮ Inkblot & Archimedes Users ✮ =
-**Back up everything.** WordPress has a really handy export tool you can use to backup your data that we highly suggest you use before you attempt to upgrade. Upgrading directly from Webcomic 1 is *not* supported. Please upgrade to Webcomic 2 before you attempt to upgrade to Webcomic 3. You should also take note of the order of your chapters and anything else you'd really, really hate to lose, and watch this video:
+You must update your theme functions.php file and the mgs_core.php file found in the theme `/includes` directory after updating to Webcomic 3.0.5. You can download the latest versions of both Inkblot and Archimedes at [http://webcomicms.net/themes/](http://webcomicms.net/themes/).
+
+= Upgrading from Webcomic 1 or 2? =
+
+**Back up everything.** WordPress has a really handy export tool you can use to backup your data that we highly suggest you use before you attempt to upgrade. Upgrading directly from Webcomic 1 is *not* supported. Please upgrade to Webcomic 2 before you attempt to upgrade to Webcomic 3. You should also take note of the order of your chapters and anything else you'd really hate to lose, and watch this video:
[vimeo http://vimeo.com/12500716]
@@ -40,4 +44,9 @@ If you can't use the *Install Plugins* page for whatever reason, follow these st
= Using Webcomic =
-Webcomic's *Integrate* feature allows it to be used with any WordPress theme right out of the box, but to get the most out of Webcomic you may want to check out one of the [official Webcomic themes](http://webcomicms.net/support/manual/themes) or build your own theme using Webcomic's extensive selection of widgets, template tags, actions, and filters.
+Webcomic's *Integrate* feature allows it to be used with any WordPress theme right out of the box, but to get the most out of Webcomic you may want to check out one of the [official Webcomic themes](http://webcomicms.net/support/manual/themes) or build your own theme using Webcomic's extensive selection of widgets, template tags, actions, and filters.
+
+== Upgrade Notice ==
+
+= 3.0.5 =
+Introduces the **Character Converter** tool. Various minor bug fixes.
View
215 webcomic-includes/admin.php
@@ -401,15 +401,13 @@ function hook_admin_menu() {
if ( !$this->option( 'uninstall' ) ) {
global $menu;
- $p = ( isset( $menu[ 3 ] ) ) ? false : 3;
-
- add_menu_page( __( 'Webcomic', 'webcomic' ), __( 'Webcomic', 'webcomic' ), 'upload_files', 'webcomic_files', array( &$this, 'admin_files' ), $this->url . 'webcomic-includes/icon-small.png', $p );
+ add_menu_page( __( 'Webcomic', 'webcomic' ), __( 'Webcomic', 'webcomic' ), 'upload_files', 'webcomic_files', array( &$this, 'admin_files' ), $this->url . '/webcomic-includes/icon-small.png', $p );
$pages[ 'webcomics' ] = add_submenu_page( 'webcomic_files', __( 'Webcomic Files', 'webcomic' ), __( 'Webcomics', 'webcomic' ), 'upload_files', 'webcomic_files', array( &$this, 'admin_files' ) );
$pages[ 'storylines' ] = add_submenu_page( 'webcomic_files', __( 'Webcomic Storylines', 'webcomic' ), __( 'Storylines', 'webcomic' ), 'manage_categories', 'webcomic_storyline', array( &$this, 'admin_terms' ) );
$pages[ 'characters' ] = add_submenu_page( 'webcomic_files', __( 'Webcomic Characters', 'webcomic' ), __( 'Characters', 'webcomic' ), 'manage_categories', 'webcomic_character', array( &$this, 'admin_terms' ) );
$pages[ 'collections' ] = add_submenu_page( 'webcomic_files', __( 'Webcomic Collections', 'webcomic' ), __( 'Collections', 'webcomic' ), 'upload_files', 'webcomic_collection', array( &$this, 'admin_terms' ) );
} else
- add_menu_page( __( 'Webcomic', 'webcomic' ), __( 'Webcomic', 'webcomic' ), 'manage_options', 'webcomic_tools', array( &$this, 'admin_tools' ), $this->url . 'webcomic-includes/icon-small.png', 3 );
+ add_menu_page( __( 'Webcomic', 'webcomic' ), __( 'Webcomic', 'webcomic' ), 'manage_options', 'webcomic_tools', array( &$this, 'admin_tools' ), $this->url . '/webcomic-includes/icon-small.png', 3 );
$pages[ 'tools' ] = add_submenu_page( 'webcomic_files', __( 'Webcomic Tools', 'webcomic' ), __( 'Tools', 'webcomic' ), 'manage_options', 'webcomic_tools', array( &$this, 'admin_tools' ) );
@@ -494,6 +492,11 @@ function hook_admin_init() {
die();
}
+ $dc = $this->option( 'default_collection' );
+
+ if ( empty( $dc ) )
+ $this->errors[ 'no_default_collection' ] = sprintf( __( "It looks like you don't have a default webcomic collection set. Please <a href='%s'>set a default webcomic collection</a> now." ), 'admin.php?page=webcomic_collection' );
+
if ( isset( $_REQUEST[ 'webcomic_post_trashed' ] ) )
$this->update[ 'deleted_post' ] = __( 'Post moved to the trash', 'webcomic' );
@@ -1068,6 +1071,68 @@ function hook_admin_init() {
$this->update[ 'edit_files' ] = sprintf( __( 'If you uploaded any new files you may need to <a href="%s">go back and manually refresh the page</a> to see them.', 'webcomic' ), $_REQUEST[ 'referer' ] );
}
+ if ( 'convert_webcomic_characters' == $_REQUEST[ 'action' ] ) {
+ check_admin_referer( 'convert_webcomic_characters' );
+
+ $_REQUEST[ 'webcomic_converted_terms' ] = array();
+ $_REQUEST[ 'webcomic_unconverted_terms' ] = array();
+
+ if ( !empty( $_REQUEST[ 'webcomic_convert_tags' ] ) ) {
+ foreach ( $_REQUEST[ 'webcomic_convert_tags' ] as $tag ) {
+ $tag = get_term( $tag, 'post_tag' );
+
+ if ( !( $character = get_term_by( 'slug', $tag->slug, 'webcomic_character' ) ) ) {
+ if ( is_wp_error( $new_term = wp_insert_term( $tag->name, 'webcomic_character', array( 'slug' => $tag->slug, 'description' => $tag->description ) ) ) )
+ $_REQUEST[ 'webcomic_unconverted_terms' ][] = $tag;
+ else
+ $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ][] = $new_term[ 'term_id' ];
+ } else
+ $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ][] = $character->term_id;
+
+ $id = ( $character ) ? $character->term_id : $new_term[ 'term_id' ];
+
+ if ( $posts = get_posts( 'post_type=webcomic_post&numberposts=-1&tag=' . $tag->slug ) )
+ foreach ( $posts as $p )
+ wp_set_object_terms( $p->ID, ( int ) $id, 'webcomic_character', true );
+ }
+ }
+
+ if ( !empty( $_REQUEST[ 'webcomic_convert_categories' ] ) ) {
+ foreach ( $_REQUEST[ 'webcomic_convert_categories' ] as $category ) {
+ $category = get_term( $category, 'category' );
+
+ if ( !( $character = get_term_by( 'slug', $category->slug, 'webcomic_character' ) ) ) {
+ if ( is_wp_error( $new_term = wp_insert_term( $category->name, 'webcomic_character', array( 'slug' => $category->slug, 'description' => $category->description ) ) ) )
+ $_REQUEST[ 'webcomic_unconverted_terms' ][] = $category;
+ else
+ $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ][] = $new_term[ 'term_id' ];
+ } else
+ $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ][] = $character->term_id;
+
+ $id = ( $character ) ? $character->term_id : $new_term[ 'term_id' ];
+
+ if ( $posts = get_posts( 'post_type=webcomic_post&numberposts=-1&category=' . $category->term_id ) )
+ foreach ( $posts as $p )
+ wp_set_object_terms( $p->ID, ( int ) $id, 'webcomic_character', true );
+ }
+ }
+
+ if ( !empty( $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ] ) ) {
+ $c = count( $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ] );
+ $this->update[ 'characters_converted' ] = sprintf( _n( '%s term converted to a character.', '%s terms converted to characters.', $c, 'webcomic' ), $c );
+ }
+
+ if ( !empty( $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ] ) ) {
+ $c = count( $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ] );
+ $this->update[ 'characters_existing' ] = sprintf( _n( '%s existing character updated.', '%s existing characters updated.', $c, 'webcomic' ), $c );
+ }
+
+ if ( !empty( $_REQUEST[ 'webcomic_unconverted_terms' ] ) ) {
+ $c = count( $_REQUEST[ 'webcomic_unconverted_terms' ][ 'tags' ] ) + count( $_REQUEST[ 'webcomic_unconverted_terms' ][ 'categories' ] );
+ $this->errors[ 'characters_unconverted' ] = sprintf( _n( '%s term could not be converted or updated.', '%s terms could not be converted or updated.', $c, 'webcomic' ), $c );
+ }
+ }
+
if ( 'upgrade_legacy_webcomic' == $_REQUEST[ 'action' ] ) {
check_admin_referer( 'upgrade_legacy_webcomic' );
@@ -2165,7 +2230,7 @@ function admin_files() {
if ( 'webcomic_collection' != $page && ( !$wc || is_wp_error( $wc ) ) ) {
?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Webcomic Error', 'webcomc' ); ?></h2>
<p><?php printf( __( "Hold up: it looks like you don't have any collections! You should definitely <a href='%s'>create a collection</a> before you go any further.", 'webcomic' ), admin_url( 'admin.php?page=webcomic_collection' ) ); ?></p>
</div>
@@ -2173,7 +2238,7 @@ function admin_files() {
} elseif ( isset( $_REQUEST[ 'action' ] ) && 'bulk_webcomic_upload' == $_REQUEST[ 'action' ] ) { $i = 0; ?>
<style>#screen-options-link-wrap{display:none}.widefat img{max-height:<?php echo $this->option( 'small_h' ); ?>px;max-width:<?php echo $this->option( 'small_w' ); ?>px}.form-field input{width:auto}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php printf( __( 'Upload Files to %s', 'webcomic' ), $wc->name ); ?></h2>
<form action="<?php echo $view; ?>" method="post" enctype="multipart/form-data">
<?php wp_nonce_field( 'bulk_webcomic_upload' ); ?>
@@ -2246,7 +2311,7 @@ function admin_files() {
<?php } elseif ( !empty( $_REQUEST[ 'action' ] ) && !empty( $_REQUEST[ 'bulk' ] ) && ( isset( $_REQUEST[ 'action-1' ] ) || isset( $_REQUEST[ 'action-2' ] ) ) && ( $action = ( !empty( $_REQUEST[ 'submit-1' ] ) ) ? $_REQUEST[ 'action-1' ] : $_REQUEST[ 'action-2' ] ) && 'batch_post' == $action ) { $i = 0; ?>
<style>#screen-options-link-wrap{display:none}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php printf( __( 'Editing Posts in %s', 'webcomic' ), $wc->name ); ?></h2>
<form action="<?php echo $view; ?>" method="post">
<?php wp_nonce_field( 'batch_webcomic_posts' ); ?>
@@ -2431,7 +2496,7 @@ function admin_files() {
?>
<style>#screen-options-link-wrap{display:none}.form-field input[type=checkbox]{width:auto}.widefat img{max-height:<?php echo $this->option( 'small_h' ); ?>px;max-width:<?php echo $this->option( 'small_w' ); ?>px}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php printf( __( 'Post Files in %s', 'webcomic' ), $wc->name ); ?></h2>
<form action="<?php echo $view; ?>" method="post">
<?php wp_nonce_field( 'batch_webcomic_files' ); ?>
@@ -2649,7 +2714,7 @@ function admin_files() {
?>
<style>.widefat img{max-height:<?php echo $this->option( 'small_h' ); ?>px;max-width:<?php echo $this->option( 'small_w' ); ?>px}#availablethemes img{height:auto;max-height:<?php echo $this->option( 'small_h' ); ?>px;max-width:<?php echo $this->option( 'small_w' ); ?>px;width:auto}#availablethemes input[type=checkbox]{display:none}#availablethemes label{border:1px solid transparent;display:inline-block;padding:.25em}#availablethemes input:checked + label{background:#ffffe0;border:1px solid #e6db55}hr{border:3px double #ddd}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php printf( __( '%s in %s', 'webcomic' ), $post_object->labels->name, $wc->name ); ?> <a href="post-new.php?post_type=webcomic_post&amp;webcomic_collection=<?php echo $wc->term_id; ?>" class="button add-new-h2"><?php echo $post_object->labels->add_new; ?></a><?php if ( current_user_can( 'manage_categories' ) ) { ?><a href="<?php echo wp_nonce_url( $view . '&amp;action=bulk_webcomic_upload', 'bulk_webcomic_upload' ); ?>" class="button add-new-h2"><?php _e( 'Upload', 'webcomic' ); ?></a><?php } ?></h2>
<form action="<?php echo $view; ?>" method="post">
<p class="search-box">
@@ -2894,7 +2959,7 @@ function admin_terms() {
if ( 'webcomic_collection' != $page && ( !$wc || is_wp_error( $wc ) ) ) {
?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Webcomic Error', 'webcomc' ); ?></h2>
<p><?php printf( __( "Hold up: it looks like you don't have any collections! You should definitely <a href='%s'>create a collection</a> before you go any further.", 'webcomic' ), admin_url( 'admin.php?page=webcomic_collection' ) ); ?></p>
</div>
@@ -2904,7 +2969,7 @@ function admin_terms() {
?>
<style>#screen-options-link-wrap{display:none}th img{height:auto;max-height:<?php echo $this->option( 'small_h' ); ?>px;max-width:<?php echo $this->option( 'small_w' ); ?>px;width:auto}.form-field input[type=checkbox]{width:auto}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php echo $taxonomy->labels->edit_item; ?></h2>
<form action="<?php echo $view; ?>" method="post" enctype="multipart/form-data" class="media-upload-form">
<?php wp_nonce_field( 'update_webcomic_term' ); ?>
@@ -3149,7 +3214,7 @@ function admin_terms() {
<?php } else { $wco = ( 'webcomic_storyline' == $page ) ? true : false; $search = ( !empty( $_REQUEST[ 's' ] ) ) ? '&search=' . $_REQUEST[ 's' ] : ''; $tg = ( 'webcomic_collection' != $page ) ? '&term_group=' . $wc->term_id : ''; $terms = get_terms( $page, 'hide_empty=0&webcomic_order=' . $wco . $tg . $search ); $num_term = count( get_terms( $page, 'hide_empty=0&parent=0&term_group=' . $wc->term_id ) ); $max_term = ( $num_term < ( $pagenum * $tpp ) ) ? $num_term : $pagenum * $tpp; ?>
<style>.widefat .term-description{display:none}.widefat .term-description-toggle{cursor:pointer}.widefat th.column-characters,.widefat th.column-storylines{text-align:center}</style>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2>
<?php
if ( 'webcomic_collection' == $page )
@@ -3257,7 +3322,7 @@ function admin_terms() {
</div>
<?php if ( 'webcomic_storyline' == $page || 'webcomic_character' == $page ) { ?>
<div class="form-field">
- <label for="webcomic_parent"><?php _e( 'Parent', 'wecomic' ); ?></label>
+ <label for="webcomic_parent"><?php _e( 'Parent', 'webcomic' ); ?></label>
<select name="webcomic_parent" id="webcomic_parent">
<option value="0"><?php _e( 'None', 'webcomic' ); ?></option>
<?php
@@ -3317,7 +3382,7 @@ function admin_tools() {
$file[ 'small' ] = ( !empty( $files[ 'small' ][ $_REQUEST[ 'key' ] ] ) ) ? $files[ 'small' ][ $_REQUEST[ 'key' ] ] : array();
?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php printf( __( 'Editing %s', 'webcomic' ), $file[ 'full' ][ 'filename' ] ); ?></h2>
<form action="<?php echo $view; ?>&type=<?php echo $_REQUEST[ 'type' ]; ?>&src=<?php echo $_REQUEST[ 'src' ]; ?>&id=<?php echo $_REQUEST[ 'id' ]; ?>&key=<?php echo $_REQUEST[ 'key' ]; ?>" method="post" enctype="multipart/form-data">
<?php wp_nonce_field( 'edit_webcomic_files' ); ?>
@@ -3360,9 +3425,112 @@ function admin_tools() {
<input type="hidden" name="action" value="edit_webcomic_files">
</form>
</div>
- <?php } } elseif ( $subpage && 'upgrade_webcomic' == $_REQUEST[ 'subpage' ] ) { ?>
+ <?php } } elseif ( $subpage && 'convert_webcomic_characters' == $_REQUEST[ 'subpage' ] ) { ?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <h2><?php _e( 'Convert Characters', 'webcomic' ); ?></h2><div id="col-container" style="clear:both">
+ <div id="col-right">
+ <div class="col-wrap">
+ <?php if ( isset( $_REQUEST[ 'webcomic_converted_terms' ] ) ) { $collection = get_term( $_REQUEST[ 'webcomic_collection' ], 'webcomic_collection' ); ?>
+ <table class="widefat">
+ <thead>
+ <tr>
+ <th><?php _e( 'Name', 'webcomic' ); ?></th>
+ <th><?php _e( 'Webcomics', 'webcomic' ); ?></th>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <th><?php _e( 'Name', 'webcomic' ); ?></th>
+ <th><?php _e( 'Webcomics', 'webcomic' ); ?></th>
+ </tr>
+ </tfoot>
+ <tbody>
+ <?php if ( !empty( $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ] ) ) { ?>
+ <tr><th colspan="2" style="background:#ffffe0;"><?php printf( __( 'New %s Characters', 'webcomic' ), $collection->name ); ?></th></tr>
+ <?php foreach ( $_REQUEST[ 'webcomic_converted_terms' ][ 'generated' ] as $c ) { $c = get_term( $c, 'webcomic_character' ); $alt = ( !( $i % 2 ) ) ? ' class="alt"' : ''; ?>
+ <tr<?php echo $alt; ?>>
+ <td>
+ <span class="row-title"><?php echo $c->name; ?></span>
+ </td>
+ <td><?php echo $c->count; ?></td>
+ </tr>
+ <?php $i++; } } $i = 0; if ( !empty( $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ] ) ) { ?>
+ <tr><th colspan="2" style="background:#ffffe0;"><?php printf( __( 'Existing %s Characters', 'webcomic' ), $collection->name ); ?></th></tr>
+ <?php foreach ( $_REQUEST[ 'webcomic_converted_terms' ][ 'existing' ] as $c ) { $c = get_term( $c, 'webcomic_character' ); $alt = ( !( $i % 2 ) ) ? ' class="alt"' : ''; ?>
+ <tr<?php echo $alt; ?>>
+ <td>
+ <span class="row-title"><?php echo $c->name; ?></span>
+ </td>
+ <td><?php echo $c->count; ?></td>
+ </tr>
+ <?php $i++; } } $i = 0; if ( !empty( $_REQUEST[ 'webcomic_unconverted_terms' ] ) ) { ?>
+ <tr><th colspan="2" style="background:#ffffe0;"><?php _e( 'Unaffected Terms', 'webcomic' ); ?></th></tr>
+ <?php foreach ( $_REQUEST[ 'webcomic_unconverted_terms' ] as $c ) { $alt = ( !( $i % 2 ) ) ? ' class="alt"' : ''; ?>
+ <tr<?php echo $alt; ?>>
+ <td>
+ <span class="row-title"><?php echo $c->name; ?></span>
+ </td>
+ <td>&mdash;</td>
+ </tr>
+ <?php $i++; } } ?>
+ </tbody>
+ </tbody>
+ </table>
+ <?php } ?>
+ </div>
+ </div>
+ <div id="col-left">
+ <div class="col-wrap">
+ <div class="form-wrap">
+ <p><?php _e( "Select the terms you'd like to convert in the lists below. Webcomic will first attempt to match the terms to existing characters (based on the term slug) and assign webcomic posts to them appropriately. If no character can be matched to a term Webcomic will create a new character for the term.", 'webcomic' ); ?></p>
+ <form action="<?php echo $view; ?>" method="post" enctype="multipart/form-data">
+ <?php wp_nonce_field( 'convert_webcomic_characters' ); ?>
+ <h3><?php printf( __( 'Collection', 'webcomic' ), ucfirst( end( explode( '_', $page ) ) ) ); ?></h3>
+ <div class="form-field">
+ <select name="webcomic_collection">
+ <?php
+ $walker = new webcomic_Walker_AdminTermDropdown();
+ echo $walker->walk( get_terms( 'webcomic_collection', 'get=all' ), 0, array( 'selected' => array( $wc->term_id ) ) );
+ ?>
+ </select>
+ </div>
+ <?php if ( $tags = get_terms( 'post_tag', 'hide_empty=0' ) ) { ?>
+ <h3><?php printf( __( 'Tags', 'webcomic' ), ucfirst( end( explode( '_', $page ) ) ) ); ?></h3>
+ <div class="form-field">
+ <select name="webcomic_convert_tags[]" size="2" multiple style="height:10em;width:50%">
+ <?php
+ $walker = new webcomic_Walker_AdminTermDropdown();
+ echo $walker->walk( $tags, 0, array( 'selected' => array(), 'no_def' => true ) );
+ ?>
+ </select>
+ <p><?php _e( 'Hold <code>Ctrl</code> or <code>Command</code> to select multiple tags.', 'webcomic' ); ?></p>
+ </div>
+ <?php } if ( $categories = get_terms( 'category', 'hide_empty=0' ) ) { ?>
+ <h3><?php printf( __( 'Categories', 'webcomic' ), ucfirst( end( explode( '_', $page ) ) ) ); ?></h3>
+ <div class="form-field">
+ <select name="webcomic_convert_categories[]" size="2" multiple style="height:10em;width:50%">
+ <?php
+ $walker = new webcomic_Walker_AdminTermDropdown();
+ echo $walker->walk( $categories, 0, array( 'selected' => array(), 'no_def' => true ) );
+ ?>
+ </select>
+ <p><?php _e( 'Hold <code>Ctrl</code> or <code>Command</code> to select multiple categories.', 'webcomic' ); ?></p>
+ </div>
+ <?php } ?>
+ <p class="submit">
+ <input type="submit" class="button" name="submit" value="<?php _e( 'Convert Terms', 'webcomic' ); ?>">
+ <input type="hidden" name="action" value="convert_webcomic_characters">
+ </p>
+ </form>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php } elseif ( $subpage && 'upgrade_webcomic' == $_REQUEST[ 'subpage' ] ) { ?>
+ <div class="wrap">
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Upgrade Webcomic', 'webcomic' ); ?></h2>
<div id="col-wrap">
<div id="col-left">
@@ -3407,7 +3575,7 @@ function admin_tools() {
</div>
<?php } elseif ( $subpage && 'uninstall_webcomic' == $_REQUEST[ 'subpage' ] || $this->option( 'uninstall' ) ) { ?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Uninstall Webcomic', 'webcomic' ); ?></h2>
<div id="col-wrap">
<div id="col-left">
@@ -3437,7 +3605,7 @@ function admin_tools() {
</div>
<?php } else { ?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Tools', 'webcomic' ); ?></h2>
<table class="widefat" cellspacing="0">
<?php if ( get_option( 'webcomic_version' ) ) { ?>
@@ -3445,8 +3613,13 @@ function admin_tools() {
<th scope="row" class="import-system row-title"><a href="<?php echo $view . '&amp;subpage=upgrade_webcomic'; ?> "><?php _e( 'Upgrade Webcomic', 'webcomic' ); ?></a></th>
<td class="desc" style="vertical-align:middle"><?php _e( 'Upgrade from legacy versions of Webcomic.', 'webcomic' ); ?></td>
</tr>
+ <?php } else { ?>
+ <tr class="alternate">
+ <th scope="row" class="import-system row-title"><a href="<?php echo $view . '&amp;subpage=convert_webcomic_characters'; ?> "><?php _e( 'Convert Characters', 'webcomic' ); ?></a></th>
+ <td class="desc" style="vertical-align:middle"><?php _e( 'Convert existing categories and/or tags into Webcomic Characters.', 'webcomic' ); ?></td>
+ </tr>
<?php } if ( !$this->option( 'uninstall' ) ) { ?>
- <tr<?php if ( !get_option( 'webcomic_version' ) ) echo ' class="alternate"'; ?>>
+ <tr>
<th scope="row" class="import-system row-title delete"><a href="<?php echo $view . '&amp;subpage=uninstall_webcomic'; ?> "><?php _e( 'Uninstall Webcomic', 'webcomic' ); ?></a></th>
<td class="desc" style="vertical-align:middle"><?php _e( 'Remove all files and information related to Webcomic.', 'webcomic' ); ?></td>
</tr>
@@ -3471,7 +3644,7 @@ function admin_settings() {
natcasesort( $languages );
?>
<div class="wrap">
- <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . 'webcomic-includes/icon.png'; ?>" alt="icon"></div>
+ <div id="icon-webcomic" class="icon32"><img src="<?php echo $this->url . '/webcomic-includes/icon.png'; ?>" alt="icon"></div>
<h2><?php _e( 'Settings', 'webcomic' ); ?></h2>
<form method="post" action="">
<?php wp_nonce_field( 'webcomic_settings' ); ?>
@@ -3758,7 +3931,7 @@ function admin_metabox( $post ) {
</tr>
</tbody>
</table>
- <style>#icon-edit{background:url('<?php echo $this->url . 'webcomic-includes/icon.png'; ?>') 50% 50% no-repeat;}</style>
+ <style>#icon-edit{background:url('<?php echo $this->url . '/webcomic-includes/icon.png'; ?>') 50% 50% no-repeat;}</style>
<div id="webcomic_orphans">
<?php
if ( $wc ) {
View
32 webcomic-includes/mgs-core.php
@@ -58,18 +58,18 @@
if ( !$this->type ) $this->type = 'plugin';
$this->base = ( 'plugin' == $this->type ) ? plugin_basename( $this->file ) : dirname( $this->file );
- $this->cdir = ( is_multisite() ) ? trailingslashit( BLOGUPLOADDIR ) : trailingslashit( WP_CONTENT_DIR );
- $this->curl = ( is_multisite() ) ? trailingslashit( trailingslashit( get_bloginfo( 'url' ) ) . 'files' ) : trailingslashit( WP_CONTENT_URL );
+ $this->cdir = ( is_multisite() ) ? BLOGUPLOADDIR : WP_CONTENT_DIR;
+ $this->curl = ( is_multisite() ) ? trailingslashit( get_bloginfo( 'url' ) ) . 'files' : WP_CONTENT_URL;
$this->update = array();
$this->errors = array();
$this->options = $this->option();
if ( 'plugin' == $this->type ) {
- $this->dir = ( realpath( dirname( $this->file ) ) !== realpath( WPMU_PLUGIN_DIR ) ) ? trailingslashit( trailingslashit( WP_PLUGIN_DIR ) . dirname( $this->base ) ) : trailingslashit( trailingslashit( WPMU_PLUGIN_DIR ) );
- $this->url = ( realpath( dirname( $this->file ) ) !== realpath( WPMU_PLUGIN_DIR ) ) ? trailingslashit( trailingslashit( WP_PLUGIN_URL ) . str_replace( basename( $this->file ), '', $this->base ) ) : trailingslashit( trailingslashit( WPMU_PLUGIN_URL ) . str_replace( basename( $this->file ), '', $this->base ) );
+ $this->dir = ( realpath( dirname( $this->file ) ) !== realpath( WPMU_PLUGIN_DIR ) ) ? trailingslashit( WP_PLUGIN_DIR ) . dirname( $this->base ) : WPMU_PLUGIN_DIR;
+ $this->url = ( realpath( dirname( $this->file ) ) !== realpath( WPMU_PLUGIN_DIR ) ) ? trailingslashit( WP_PLUGIN_URL ) . str_replace( '/' . basename( $this->file ), '', $this->base ) : trailingslashit( WPMU_PLUGIN_URL ) . str_replace( '/' . basename( $this->file ), '', $this->base );
} else {
- $this->dir = trailingslashit( TEMPLATEPATH );
- $this->url = trailingslashit( get_template_directory_uri() );
+ $this->dir = TEMPLATEPATH;
+ $this->url = get_template_directory_uri();
}
$class = new ReflectionClass( get_class( $this ) );
@@ -94,8 +94,10 @@
if ( empty( $this->options ) )
add_filter( 'init', array( &$this, 'install' ) );
- elseif ( $this->options[ 'version' ] != $this->version )
+ elseif ( $this->options[ 'version' ] < $this->version )
add_filter( 'init', array( &$this, 'upgrade' ) );
+ elseif ( $this->options[ 'version' ] > $this->version )
+ add_filter( 'init', array( &$this, 'downgrade' ) );
elseif ( !empty( $this->options[ 'uninstall' ] ) && 'plugin' == $this->type )
register_deactivation_hook( $this->file, array( &$this, 'deactivate' ) );
}
@@ -129,14 +131,14 @@
*/
final function domain() {
if ( 'plugin' == $this->type && realpath( dirname( $this->file ) ) !== realpath( WPMU_PLUGIN_DIR ) )
- load_muplugin_textdomain( $this->name, $this->dir . $this->name . '-includes/languages' );
+ load_muplugin_textdomain( $this->name, $this->dir . '/' . $this->name . '-includes/languages' );
elseif ( 'plugin' == $this->type )
- load_plugin_textdomain( $this->name, $this->dir . $this->name . '-includes/languages', dirname( $this->base ) );
+ load_plugin_textdomain( $this->name, $this->dir . '/' . $this->name . '-includes/languages', dirname( $this->base ) );
elseif ( 'theme' == $this->type ) {
- load_theme_textdomain( $this->name, $this->dir . 'languages' );
+ load_theme_textdomain( $this->name, $this->dir . '/' . 'languages' );
$l = get_locale();
- $lf = $this->dir . "languages/$l.php";
+ $lf = $this->dir . "/languages/$l.php";
if ( is_readable( $lf ) ) require_once( $lf );
} else
@@ -189,8 +191,11 @@
* Install is a run-once function that should, at the very least,
* set plugin or theme options with a 'version' key.
*
- * Upgrade is run any time there's a mismatch between the class $version
- * and the version stored in the plugin or theme options.
+ * Upgrade is run if the class $version is greater than the version
+ * stored in the plugin or theme options.
+ *
+ * Downgrade is run if the class $version is less than the version
+ * stored in the plugin or theme options.
*
* Uninstall must be called by another class method and should, at the
* very least, set the 'uninstall' option to true.
@@ -200,6 +205,7 @@
*/
abstract function install();
abstract function upgrade();
+ abstract function downgrade();
abstract function uninstall();
}
?>
View
2  webcomic-includes/tags-legacy.php
@@ -11,7 +11,7 @@ function comic_loop( $num = 1, $dep1 = false, $q = false ) { global $webcomic; $
function ignore_comics() { return false; }
function in_comic_category( $terms = false, $id = false ) { global $webcomic; return $webcomic->in_webcomic_term( 'webcomic_collection', $terms, $id ); }
function in_comic_chapter( $terms = false, $id = false ) { global $webcomic; return $webcomic->in_webcomic_term( 'webcomic_storyline', $terms, $id ); }
-function get_the_comic( $id = false, $dep1 = false, $dep2 = false ) { global $webcomic; return $webocmic->get_webcomic_post( $id ); }
+function get_the_comic( $id = false, $dep1 = false, $dep2 = false ) { global $webcomic; return $webcomic->get_webcomic_post( $id ); }
function get_the_chapter( $id ) { return get_term( $id, 'webcomic_storyline' ); }
function get_comic_object( $id = false, $size = false, $dep1 = false ) { global $webcomic; $size = ( 'thumb' == $size ) ? 'small' : $size; return $webcomic->get_webcomic_object( $size, 'post', false, $id ); }
function get_comic_buffer( $term = false ) { global $webcomic; return $webcomic->get_webcomic_buffer( $term ); }
View
2  webcomic-includes/tags.php
@@ -10,7 +10,7 @@
function get_webcomic_post( $id = false ) { global $webcomic; return $webcomic->get_webcomic_post( $id ); }
function get_webcomic_object( $size = 'full', $type = false, $key = false, $id = false, $format = false ) { global $webcomic; return $webcomic->get_webcomic_object( $size, $type, $key, $id, $format ); }
function the_webcomic_object( $size = 'full', $link = false, $taxonomy = false, $terms = false, $key = false, $id = false ) { global $webcomic; echo $webcomic->get_the_webcomic_object( $size, $link, $taxonomy, $terms, $key, $id ); }
-function get_webcomic_embed( $format = 'shtml', $size = 'small', $key = false, $id = false ) { global $webcomic; return $webocmic->get_webcomic_embed( $format, $size, $key, $id ); }
+function get_webcomic_embed( $format = 'shtml', $size = 'small', $key = false, $id = false ) { global $webcomic; return $webcomic->get_webcomic_embed( $format, $size, $key, $id ); }
function the_webcomic_embed( $format = 'shtml', $size = 'small', $key = false, $id = false ) { global $webcomic; echo $webcomic->get_the_webcomic_embed( $format, $size, $key, $id ); }
function random_webcomic_url( $taxonomy = false, $terms = false, $id = false, $global = false ) { global $webcomic; echo $webcomic->get_relative_webcomic_url( 'random', $taxonomy, $terms, $id, $global ); }
function first_webcomic_url( $taxonomy = false, $terms = false, $id = false, $global = false ) { global $webcomic; echo $webcomic->get_relative_webcomic_url( 'first', $taxonomy, $terms, $id, $global ); }
View
2  webcomic-includes/template-verify-fail.php
@@ -12,7 +12,7 @@
* @since 3
*/
-global $webocmic; $webcomic->domain();
+global $webcomic; $webcomic->domain();
?>
<?php the_post(); get_header(); ?>
View
36 webcomic.php
@@ -4,7 +4,7 @@
Plugin Name: Webcomic
Plugin URI: http://webcomicms.net/
Description: Comic publishing power for WordPress. Create, manage, and share your webcomics like never before.
-Version: 3.0.4
+Version: 3.0.5
Author: Michael Sisk
Author URI: http://maikeruon.com/
@@ -42,7 +42,7 @@
class webcomic extends mgs_core {
/** Override mgs_core variables */
protected $name = 'webcomic';
- protected $version = '3.0.4';
+ protected $version = '3.0.5';
protected $file = __FILE__;
protected $type = 'plugin';
@@ -132,6 +132,16 @@ function upgrade() {
}
/**
+ * Downgrades newer versions. Reserved for future use.
+ *
+ * @package webcomic
+ * @since 3
+ */
+ function downgrade() {
+
+ }
+
+ /**
* Uninstalls the plugin
*
* @package webcomic
@@ -1266,7 +1276,7 @@ function webcomic_transcripts_template( $file = false ) {
return false;
$file = ( $file ) ? $file : 'webcomic_transcripts.php';
- $form = locate_template( array( $file ) ) ? locate_template( array( $file ) ) : $this->dir . 'webcomic-includes/template-transcripts.php';
+ $form = locate_template( array( $file ) ) ? locate_template( array( $file ) ) : $this->dir . '/webcomic-includes/template-transcripts.php';
require_once( $form );
}
@@ -2177,7 +2187,7 @@ function get_the_webcomic_archive( $args = false ) {
global $wpdb;
- $before = $p1 = $l = $p2 = $after = false;
+ $p1 = $l = $p2 = false;
if ( 'collection' == $group || 'storyline' == $group || 'character' == $group ) {
if ( 'storyline' == $group )
@@ -2725,8 +2735,6 @@ function hook_init() {
if ( get_option( 'webcomic_version' ) )
register_taxonomy( 'chapter', array( 'post', 'webcomic_post' ), array( 'label' => __( 'Chapter', 'webcomic' ), 'hierarchical' => true, 'public' => true, 'show_ui' => false, 'update_count_callback' => '_update_post_term_count' ) );
- flush_rewrite_rules();
-
wp_enqueue_script( 'swfobject', '', '', '', true );
remove_filter( 'pre_term_description', 'wp_filter_kses' );
@@ -2739,7 +2747,7 @@ function hook_init() {
$pass = true;
$type = $_REQUEST[ 'webcomic_paypal_ipn' ];
$req = 'cmd=_notify-validate';
- $log = ( $this->option( 'paypal_log' ) ) ? fopen( $this->dir . 'webcomic-includes/ipnlog-' . $id . '.txt', 'a' ) : false;
+ $log = ( $this->option( 'paypal_log' ) ) ? fopen( $this->dir . '/webcomic-includes/ipnlog-' . $id . '.txt', 'a' ) : false;
foreach ( $_POST as $key => $value ) {
$value = urlencode( stripslashes( $value ) );
@@ -2767,7 +2775,7 @@ function hook_init() {
while ( !feof( $fp ) ) {
$res = fgets ( $fp, 1024 );
- $file = file_get_contents( $this->dir . 'webcomic-includes/ipnlog-' . $id . '.txt' );
+ $file = file_get_contents( $this->dir . '/webcomic-includes/ipnlog-' . $id . '.txt' );
if ( 0 == strcmp( $res, "VERIFIED" ) ) {
if ( 'Completed' != $payment_status ) {
@@ -2952,7 +2960,7 @@ function hook_widgets_init() {
function hook_template_redirect() {
global $post;
- wp_enqueue_script( 'webcomic-scripts', $this->url . 'webcomic-includes/scripts.js', array( 'jquery', 'jquery-hotkeys' ), '', true );
+ wp_enqueue_script( 'webcomic-scripts', $this->url . '/webcomic-includes/scripts.js', array( 'jquery', 'jquery-hotkeys' ), '', true );
if ( ( $wc = $this->get_collection_by_path() ) && !empty( $wc->webcomic_theme ) && is_dir( get_theme_root() . '/' . $wc->webcomic_theme ) ) {
global $webcomic_theme;
@@ -2975,8 +2983,8 @@ function hook_template_redirect() {
$v = apply_filters( 'webcomic_verify_age_template', 'webcomic_verifyage.php' );
$f = apply_filters( 'webcomic_verify_fail_template', 'webcomic_verifyfail.php' );
- $form = ( locate_template( array( $v ) ) ) ? locate_template( array( $v ) ) : $this->dir . 'webcomic-includes/template-verify-age.php';
- $fail = ( locate_template( array( $f ) ) ) ? locate_template( array( $f ) ) : $this->dir . 'webcomic-includes/template-verify-fail.php';
+ $form = ( locate_template( array( $v ) ) ) ? locate_template( array( $v ) ) : $this->dir . '/webcomic-includes/template-verify-age.php';
+ $fail = ( locate_template( array( $f ) ) ) ? locate_template( array( $f ) ) : $this->dir . '/webcomic-includes/template-verify-fail.php';
if ( !$this->age() ) {
require_once( $form );
@@ -2993,7 +3001,7 @@ function hook_template_redirect() {
if ( locate_template( array( $v ) ) )
$p = locate_template( array( $v ) );
else
- $p = $this->dir . 'webcomic-includes/template-purchase-print.php';
+ $p = $this->dir . '/webcomic-includes/template-purchase-print.php';
require_once( $p );
die();
@@ -3672,8 +3680,8 @@ function usort_term_objects_by_date( $a, $b ) {
*/
function directory( $type = null, $sub = null ) {
switch ( $type ) {
- case 'abs': if ( $sub ) return $this->cdir . 'webcomic/' . $sub . '/'; else return $this->cdir . 'webcomic/';
- case 'url': if ( $sub ) return $this->curl . 'webcomic/' . $sub . '/'; else return $this->curl . 'webcomic/';
+ case 'abs': if ( $sub ) return $this->cdir . '/webcomic/' . $sub . '/'; else return $this->cdir . '/webcomic/';
+ case 'url': if ( $sub ) return $this->curl . '/webcomic/' . $sub . '/'; else return $this->curl . '/webcomic/';
default: return false;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.