Permalink
Browse files

Add crossover term support.

Includes several new template tags and shortcodes, a new ep_mask for
taxonomy archives, and various fixes to template handling. Closes #83
  • Loading branch information...
1 parent 09c0673 commit 1513129a12d379bd56b9635552975ed3dadb6b7e Michael Sisk committed Feb 11, 2013
Showing with 1,070 additions and 196 deletions.
  1. +9 −1 -/php/admin.php
  2. +125 −8 -/php/shortcodes.php
  3. +813 −118 -/php/tags.php
  4. +123 −69 webcomic.php
View
@@ -396,7 +396,7 @@ public function deactivate() {
flush_rewrite_rules();
}
- /** Handle dynamic requests.
+ /** Handle dynamic requests and remove taxonomy submenus.
*
* Dynamic request must have a 'webcomic_admin_ajax' value that is a
* valid callback in the form of a static class method, like
@@ -410,6 +410,14 @@ public function admin_init() {
die;
}
+
+ foreach ( self::$config[ 'collections' ] as $k => $v ) {
+ foreach ( $v[ 'taxonomies' ] as $taxonomy ) {
+ if ( preg_match( '/^webcomic\d+_(storyline|character)$/', $taxonomy ) ) {
+ remove_submenu_page( "edit.php?post_type={$k}", "edit-tags.php?taxonomy={$taxonomy}&post_type={$k}" );
+ }
+ }
+ }
}
/** Add contextual help and change the post type icon.
View
@@ -30,13 +30,19 @@ public function __construct() {
* @uses WebcomicShortcode::the_related_webcomics()
* @uses WebcomicShortcode::the_webcomic_term_link()
* @uses WebcomicShortcode::the_webcomic_collection()
+ * @uses WebcomicShortcode::the_webcomic_collections()
* @uses WebcomicShortcode::webcomic_term_title()
* @uses WebcomicShortcode::webcomic_term_description()
* @uses WebcomicShortcode::webcomic_term_image()
+ * @uses WebcomicShortcode::webcomic_term_crossovers()
+ * @uses WebcomicShortcode::webcomic_crossover_title()
+ * @uses WebcomicShortcode::webcomic_crossover_description()
+ * @uses WebcomicShortcode::webcomic_crossover_image()
* @uses WebcomicShortcode::webcomic_collection_title()
* @uses WebcomicShortcode::webcomic_collection_description()
* @uses WebcomicShortcode::webcomic_collection_image()
* @uses WebcomicShortcode::webcomic_collection_print_amount()
+ * @uses WebcomicShortcode::webcomic_collection_crossovers()
* @uses WebcomicShortcode::webcomic_donation_amount()
* @uses WebcomicShortcode::webcomic_donation_form()
* @uses WebcomicShortcode::webcomic_print_amount()
@@ -64,6 +70,7 @@ public function init() {
add_shortcode( 'random_webcomic_link', array( $this, 'the_webcomic_link' ) );
add_shortcode( 'purchase_webcomic_link', array( $this, 'the_webcomic_link' ) );
add_shortcode( 'the_webcomic_collection', array( $this, 'the_webcomic_collection' ) );
+ add_shortcode( 'the_webcomic_collections', array( $this, 'the_webcomic_collections' ) );
add_shortcode( 'the_webcomic_storylines', array( $this, 'the_webcomic_terms' ) );
add_shortcode( 'the_webcomic_characters', array( $this, 'the_webcomic_terms' ) );
add_shortcode( 'previous_webcomic_storyline_link', array( $this, 'the_webcomic_term_link' ) );
@@ -82,10 +89,16 @@ public function init() {
add_shortcode( 'webcomic_character_description', array( $this, 'webcomic_term_description' ) );
add_shortcode( 'webcomic_storyline_cover', array( $this, 'webcomic_term_image' ) );
add_shortcode( 'webcomic_character_avatar', array( $this, 'webcomic_term_image' ) );
+ add_shortcode( 'webcomic_storyline_crossovers', array( $this, 'webcomic_term_crossovers' ) );
+ add_shortcode( 'webcomic_character_crossovers', array( $this, 'webcomic_term_crossovers' ) );
+ add_shortcode( 'webcomic_crossover_title', array( $this, 'webcomic_crossover_title' ) );
+ add_shortcode( 'webcomic_crossover_description', array( $this, 'webcomic_crossover_description' ) );
+ add_shortcode( 'webcomic_crossover_poster', array( $this, 'webcomic_crossover_image' ) );
add_shortcode( 'webcomic_collection_title', array( $this, 'webcomic_collection_title' ) );
add_shortcode( 'webcomic_collection_description', array( $this, 'webcomic_collection_description' ) );
add_shortcode( 'webcomic_collection_poster', array( $this, 'webcomic_collection_image' ) );
add_shortcode( 'webcomic_collection_print_amount', array( $this, 'webcomic_collection_print_amount' ) );
+ add_shortcode( 'webcomic_collection_crossovers', array( $this, 'webcomic_collection_crossovers' ) );
add_shortcode( 'webcomic_donation_amount', array( $this, 'webcomic_donation_amount' ) );
add_shortcode( 'webcomic_donation_form', array( $this, 'webcomic_donation_form' ) );
add_shortcode( 'webcomic_print_amount', array( $this, 'webcomic_print_amount' ) );
@@ -288,9 +301,7 @@ public function the_webcomic_link( $atts, $content, $name ) {
/** Handle the_webcomic_collection shortcode.
*
- * @param array $atts Shortcode attributes.
- * @return string
- * @uses WebcomicTag::webcomic_collection_link()
+ * @deprecated 4.0.7 4.1 Use the_webcomic_collections instead.
*/
public function the_webcomic_collection( $atts ) {
extract( shortcode_atts( array(
@@ -303,6 +314,26 @@ public function the_webcomic_collection( $atts ) {
return WebcomicTag::webcomic_collection_link( $format, $link, $target, $collection );
}
+ /** Handle the_webcomic_collections shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @return string
+ * @uses WebcomicTag::get_the_webcomic_collection_list()
+ */
+ public function the_webcomic_collections( $atts ) {
+ extract( shortcode_atts( array(
+ 'id' => 0,
+ 'before' => '',
+ 'sep' => ', ',
+ 'after' => '',
+ 'target' => 'archive',
+ 'image' => '',
+ 'crossover' => true
+ ), $atts ) );
+
+ return WebcomicTag::get_the_webcomic_collection_list( $id, $before, $sep, $after, $target, $image, $crossover );
+ }
+
/** Handle the_webcomic_(terms) shortcodes.
*
* @param array $atts Shortcode attributes.
@@ -477,15 +508,84 @@ public function webcomic_term_image( $atts, $content, $name ) {
return WebcomicTag::webcomic_term_image( $size, $term, $collection ? "{$collection}_{$tax}" : '' );
}
- /** Handle webcomic_collection_title shortcode.
+ /** Handle webcomic_crossover_title shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @param string $content Shortcode content.
+ * @return string
+ * @uses WebcomicTag::webcomic_crossover_title()
+ */
+ public function webcomic_crossover_title( $atts, $content ) {
+ extract( shortcode_atts( array(
+ 'prefix' => ''
+ ), $atts ) );
+
+ $prefix = $content ? do_shortcode( $content ) : $prefix;
+
+ return WebcomicTag::webcomic_crossover_title( $prefix );
+ }
+
+ /** Handle webcomic_collection_description shortcode.
+ *
+ * @return string
+ * @uses WebcomicTag::webcomic_crossover_description()
+ */
+ public function webcomic_crossover_description( $atts, $content, $name ) {
+ return WebcomicTag::webcomic_crossover_description();
+ }
+
+ /** Handle webcomic_crossover_poster shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @return string
+ * @uses WebcomicTag::webcomic_crossover_image()
+ */
+ public function webcomic_crossover_image( $atts ) {
+ extract( shortcode_atts( array(
+ 'size' => 'full'
+ ), $atts ) );
+
+ return WebcomicTag::webcomic_crossover_image( $size );
+ }
+
+ /** Handle webcomic_(storyline|character)_crossovers shortcode.
*
* @param array $atts Shortcode attributes.
* @param string $content Shortcode content.
* @param string $name Shortcode name.
* @return string
+ * @uses WebcomicTag::webcomic_term_crossovers()
+ */
+ public function webcomic_term_crossovers( $atts, $content, $name ) {
+ extract( shortcode_atts( array(
+ 'before' => '',
+ 'sep' => ', ',
+ 'after' => '',
+ 'target' => 'archive',
+ 'image' => '',
+ 'term' => 0,
+ 'collection' => ''
+ ), $atts ) );
+
+ if ( false !== strpos( $name, 'storyline' ) ) {
+ $tax = 'storyline';
+ } elseif ( false !== strpos( $name, 'character' ) ) {
+ $tax = 'character';
+ } else {
+ $tax = '';
+ }
+
+ return WebcomicTag::webcomic_term_crossovers( $term, $collection ? "{$collection}_{$tax}" : '', $before, $sep, $after, $target, $image );
+ }
+
+ /** Handle webcomic_collection_title shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @param string $content Shortcode content.
+ * @return string
* @uses WebcomicTag::webcomic_collection_title()
*/
- public function webcomic_collection_title( $atts, $content, $name ) {
+ public function webcomic_collection_title( $atts, $content ) {
extract( shortcode_atts( array(
'prefix' => '',
'collection' => ''
@@ -499,12 +599,10 @@ public function webcomic_collection_title( $atts, $content, $name ) {
/** Handle webcomic_collection_description shortcode.
*
* @param array $atts Shortcode attributes.
- * @param string $content Shortcode content.
- * @param string $name Shortcode name.
* @return string
* @uses WebcomicTag::webcomic_collection_description()
*/
- public function webcomic_collection_description( $atts, $content, $name ) {
+ public function webcomic_collection_description( $atts ) {
extract( shortcode_atts( array(
'collection' => ''
), $atts ) );
@@ -544,6 +642,25 @@ public function webcomic_collection_print_amount( $atts ) {
return WebcomicTag::webcomic_collection_print_amount( $type, $dec, $sep, $collection );
}
+ /** Handle webcomic_collection_crossovers shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @return string
+ * @uses WebcomicTag::webcomic_term_crossovers()
+ */
+ public function webcomic_collection_crossovers( $atts ) {
+ extract( shortcode_atts( array(
+ 'before' => '',
+ 'sep' => ', ',
+ 'after' => '',
+ 'target' => 'archive',
+ 'image' => '',
+ 'collection' => ''
+ ), $atts ) );
+
+ return WebcomicTag::webcomic_collection_crossovers( $before, $sep, $after, $target, $image, $collection );
+ }
+
/** Handle webcomic_donation_amount shortcode.
*
* @param array $atts Shortcode attributes.
Oops, something went wrong.

0 comments on commit 1513129

Please sign in to comment.