<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[705] sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook: Handbook plugin: abstract post-type handling to allow for multiple post-type usage, namely for Devhub.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://meta.trac.wordpress.org/changeset/705">705</a></dd>
<dt>Author</dt> <dd>coffee2code</dd>
<dt>Date</dt> <dd>2014-06-16 23:56:42 +0000 (Mon, 16 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Handbook plugin: abstract post-type handling to allow for multiple post-type usage, namely for Devhub. props nicolealleyinteractivecom. See <a href="http://meta.trac.wordpress.org/ticket/250">#250</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookfunctionalityforpagesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/functionality-for-pages.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookhandbookphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookincemailpostchangesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/email-post-changes.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookinctableofcontentsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookincwidgetsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/widgets.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookfunctionalityforpagesphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/functionality-for-pages.php (704 => 705)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/functionality-for-pages.php    2014-06-13 17:34:07 UTC (rev 704)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/functionality-for-pages.php       2014-06-16 23:56:42 UTC (rev 705)
</span><span class="lines">@@ -8,10 +8,7 @@
</span><span class="cx"> require_once dirname( __FILE__ ) . '/inc/table-of-contents.php';
</span><span class="cx"> require_once dirname( __FILE__ ) . '/inc/email-post-changes.php';
</span><span class="cx"> 
</span><del>-class WPorg_Handbook_TOC_Pages extends WPorg_Handbook_TOC {
-       protected $post_type = 'page';
-}
-new WPorg_Handbook_TOC_Pages;
</del><ins>+new WPorg_Handbook_TOC( array( 'page' ) );
</ins><span class="cx"> 
</span><span class="cx"> add_action( 'widgets_init', 'wporg_handbook_functionality_for_pages_widget', 12 );
</span><span class="cx"> function wporg_handbook_functionality_for_pages_widget() {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookhandbookphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php (704 => 705)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php   2014-06-13 17:34:07 UTC (rev 704)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/handbook.php      2014-06-16 23:56:42 UTC (rev 705)
</span><span class="lines">@@ -9,11 +9,40 @@
</span><span class="cx"> require_once dirname( __FILE__ ) . '/inc/table-of-contents.php';
</span><span class="cx"> require_once dirname( __FILE__ ) . '/inc/email-post-changes.php';
</span><span class="cx"> 
</span><del>-WPorg_Handbook_Glossary::init();
-new WPorg_Handbook_TOC;
</del><ins>+//WPorg_Handbook_Glossary::init();
</ins><span class="cx"> 
</span><ins>+/**
+ * Initialize our handbooks
+ *
+ */
+class WPorg_Handbook_Init {
+
+       static function init() {
+
+               $post_types = 'handbook';
+
+               $post_types = apply_filters( 'handbook_post_types', $post_types );
+
+               if ( ! is_array( $post_types ) ) {
+                       $post_types = (array) $post_types;
+               }
+
+               new WPorg_Handbook_TOC( $post_types );
+
+               foreach ( $post_types as $type ) {
+                       new WPorg_Handbook( $type );
+
+               }
+       }
+}
+add_action( 'after_setup_theme', array( 'WPorg_Handbook_Init', 'init' ) );
+
</ins><span class="cx"> class WPorg_Handbook {
</span><span class="cx"> 
</span><ins>+       public $post_type = '';
+
+       protected $label = '';
+
</ins><span class="cx">   static function caps() {
</span><span class="cx">          return array(
</span><span class="cx">                  'edit_handbook_pages', 'edit_others_handbook_pages',
</span><span class="lines">@@ -30,7 +59,11 @@
</span><span class="cx">          );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       function __construct() {
</del><ins>+        function __construct( $type ) {
+               if ( 'handbook' != $type )
+                       $this->post_type = $type . '-handbook';
+
+               $this->label = ucwords( str_replace( array( '-', '_' ), ' ', $this->post_type ) );
</ins><span class="cx">           add_filter( 'user_has_cap', array( $this, 'grant_handbook_caps' ) );
</span><span class="cx">          add_filter( 'init', array( $this, 'register_post_type' ) );
</span><span class="cx">          add_action( 'admin_page_access_denied', array( $this, 'admin_page_access_denied' ) );
</span><span class="lines">@@ -55,11 +88,17 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function register_post_type() {
</span><del>-               register_post_type( 'handbook', array(
</del><ins>+                if ( 'handbook' != $this->post_type ) {
+                       $slug = 'handbook/' . substr( $this->post_type, 0, -9 );
+               } else {
+                       $slug = 'handbook';
+               }
+               register_post_type( $this->post_type, array(
</ins><span class="cx">                   'labels' => array(
</span><del>-                               'name' => 'Handbook Pages',
-                               'singular_name' => 'Handbook Page',
-                               'menu_name' => 'Handbook',
</del><ins>+                                'name' => "{$this->label} Pages",
+                               'singular_name' => "{$this->label} Page",
+                               'menu_name' => "{$this->label}",
+                               'all_items' => "{$this->label} Pages",
</ins><span class="cx">                   ),
</span><span class="cx">                  'public' => true,
</span><span class="cx">                  'show_ui' => true,
</span><span class="lines">@@ -68,7 +107,11 @@
</span><span class="cx">                  'has_archive' => true,
</span><span class="cx">                  'hierarchical' => true,
</span><span class="cx">                  'menu_position' => 11,
</span><del>-                       'rewrite' => true,
</del><ins>+                        'rewrite'     => array(
+                               'feeds'      => false,
+                               'slug'       => $slug,
+                               'with_front' => false,
+                       ),
</ins><span class="cx">                   'delete_with_user' => false,
</span><span class="cx">                  'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
</span><span class="cx">          ) );
</span><span class="lines">@@ -76,38 +119,32 @@
</span><span class="cx"> 
</span><span class="cx">  function admin_page_access_denied() {
</span><span class="cx">          if ( ! current_user_can( 'read' ) ) {
</span><del>-                       wp_redirect( admin_url( 'edit.php?post_type=handbook' ) );
</del><ins>+                        wp_redirect( admin_url( "edit.php?post_type={$this->post_type}" ) );
</ins><span class="cx">                   exit;
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function post_type_link( $link, $post ) {
</span><del>-               if ( $post->post_type === 'handbook' && $post->post_name === 'handbook' )
-                       return get_post_type_archive_link( 'handbook' );
</del><ins>+                if ( $post->post_type === $this->post_type && $post->post_name === $this->post_type )
+                       return get_post_type_archive_link( $this->post_type );
</ins><span class="cx">           return $link;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function pre_get_posts( $query ) {
</span><del>-               if ( $query->is_main_query() && ! $query->is_admin && $query->is_post_type_archive( 'handbook' ) ) {
-                       $query->set( 'handbook', 'handbook' );
</del><ins>+                if ( $query->is_main_query() && ! $query->is_admin && $query->is_post_type_archive( $this->post_type ) ) {
+                       $query->set( 'handbook', $this->post_type );
</ins><span class="cx">           }
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function handbook_sidebar() {
</span><del>-               if ( ! class_exists( 'P2' ) )
-                       return;
-
-               register_sidebar( array( 'id' => 'handbook', 'name' => 'Handbook', 'description' => 'Used on handbook pages' ) );
-
</del><ins>+                register_sidebar( array( 'id' => $this->post_type, 'name' => $this->label, 'description' => "Used on {$this->label} pages" ) );
</ins><span class="cx">           require_once dirname( __FILE__ ) . '/inc/widgets.php';
</span><span class="cx">          register_widget( 'WPorg_Handbook_Pages_Widget' );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function wporg_email_changes_for_post_types( $post_types ) {
</span><del>-               if ( ! in_array( 'handbook', $post_types ) )
-                       $post_types[] = 'handbook';
</del><ins>+                if ( ! in_array( $this->post_type, $post_types ) )
+                       $post_types[] = $this->post_type;
</ins><span class="cx">           return $post_types;
</span><span class="cx">  }
</span><del>-}
-
-new WPorg_Handbook;
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookincemailpostchangesphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/email-post-changes.php (704 => 705)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/email-post-changes.php     2014-06-13 17:34:07 UTC (rev 704)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/email-post-changes.php        2014-06-16 23:56:42 UTC (rev 705)
</span><span class="lines">@@ -14,8 +14,6 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function handbook_sidebar() {
</span><del>-               if ( ! class_exists( 'P2' ) || ! class_exists( 'Email_Post_Changes' ) )
-                       return;
</del><span class="cx"> 
</span><span class="cx">          require_once dirname( __FILE__ ) . '/widgets.php';
</span><span class="cx">          register_widget( 'WPorg_Handbook_Widget' );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookinctableofcontentsphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php (704 => 705)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php      2014-06-13 17:34:07 UTC (rev 704)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php 2014-06-16 23:56:42 UTC (rev 705)
</span><span class="lines">@@ -5,19 +5,29 @@
</span><span class="cx">  * @author Automattic, modifed by Nacin
</span><span class="cx">  */
</span><span class="cx"> class WPorg_Handbook_TOC {
</span><del>-       protected $post_type = 'handbook';
</del><ins>+        protected $post_types = array();
</ins><span class="cx"> 
</span><span class="cx">  protected $styles = '<style> .toc-jump { text-align: right; font-size: 12px; } .page .toc-heading { margin-top: -50px; padding-top: 50px !important; }</style>';
</span><span class="cx"> 
</span><del>-       function __construct() {
</del><ins>+        function __construct( $post_types ) {
+               $this->post_types = $post_types;
</ins><span class="cx">           add_action( 'template_redirect', array( $this, 'load_filters' ) );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function load_filters() {
</span><del>-               if ( is_singular( $this->post_type ) )
</del><ins>+                $this->post_types = array_map( array( $this, 'append_suffix' ), $this->post_types );
+
+               if ( is_singular( $this->post_types ) )
</ins><span class="cx">                   add_filter( 'the_content', array( $this, 'add_toc' ) );
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       function append_suffix( $t ) {
+               if ( 'handbook' == $t )
+                       return $t;
+
+               return $t . '-handbook';
+       }
+
</ins><span class="cx">   function add_toc( $content ) {
</span><span class="cx">          $toc = '';
</span><span class="cx"> 
</span><span class="lines">@@ -31,13 +41,13 @@
</span><span class="cx">          else
</span><span class="cx">                  $pages_header = 'h3';
</span><span class="cx"> 
</span><del>-               if ( $pages = wp_list_pages( array( 'child_of' => get_the_ID(), 'echo' => false, 'title_li' => false, 'post_type' => $this->post_type ) ) ) 
-            $toc .= "<$pages_header>Pages</$pages_header><ul class=\"items\">$pages</ul>"; 
</del><ins>+                if ( $pages = wp_list_pages( array( 'child_of' => get_the_ID(), 'echo' => false, 'title_li' => false, 'post_type' => $this->post_type ) ) )
+                       $toc .= "<$pages_header>Pages</$pages_header><ul class=\"items\">$pages</ul>";
</ins><span class="cx"> 
</span><span class="cx">          if ( $items ) {
</span><span class="cx">                  $toc .= $this->styles;
</span><span class="cx">                  $toc .= '<div class="table-of-contents">';
</span><del>-                       $toc .= "<$contents_header>Topics</$contents_header><ul class=\"items\">";
</del><ins>+                        $toc .= "<$contents_header>Contents</$contents_header><ul class=\"items\">";
</ins><span class="cx">                   $last_item = false;
</span><span class="cx">                  foreach ( $items as $item ) {
</span><span class="cx">                          if ( $last_item ) {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginshandbookincwidgetsphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/widgets.php (704 => 705)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/widgets.php        2014-06-13 17:34:07 UTC (rev 704)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/widgets.php   2014-06-16 23:56:42 UTC (rev 705)
</span><span class="lines">@@ -1,39 +1,48 @@
</span><span class="cx"> <?php
</span><span class="cx"> 
</span><span class="cx"> class WPorg_Handbook_Widget extends WP_Widget {
</span><del>-       protected $post_type = 'handbook';
</del><span class="cx"> 
</span><ins>+       protected $post_types = 'handbook';
+
</ins><span class="cx">   function __construct() {
</span><ins>+               $this->post_types = apply_filters( 'handbook_post_types', $this->post_types );
+               if ( ! is_array( $this->post_types ) ) {
+                       $this->post_types = (array) $this->post_types;
+               }
+               $this->post_types = array_map( array( $this, 'append_suffix' ), $this->post_types );
</ins><span class="cx">           parent::__construct( 'handbook', 'Handbook Tools', array( 'classname' => 'widget_wporg_handbook', 'description' => 'Shows watch/unwatch links for handbook pages.' ) );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function widget() {
</span><span class="cx">          if ( ! is_user_logged_in() )
</span><span class="cx">                  return;
</span><ins>+
</ins><span class="cx">           $post = get_post();
</span><del>-
-               switch ( $this->post_type ) {
-                       case 'page' :
-                               if ( $post->post_type !== 'page' )
-                                       return;
-                               break;
-                       default :
-                               if ( $post->post_type !== $this->post_type && ! is_post_type_archive( $this->post_type ) )
-                                       return;
-                               break;
</del><ins>+                if ( $post->post_type == 'page' || ( in_array( $post->post_type, $this->post_types ) && ! is_post_type_archive( $this->post_types ) ) ) {
+                       $watchlist = get_post_meta( $post->ID, '_wporg_watchlist', true );
+                       if ( $watchlist && in_array( get_current_user_id(), $watchlist ) ) {
+                               printf( '<p>You are watching this page. <a href="%s">Unwatch</a></p>',
+                               wp_nonce_url( admin_url( 'admin-post.php?action=wporg_watchlist&post_id=' . $post->ID ), 'unwatch-' . $post->ID ) );
+                       } else {
+                               printf( '<p><a href="%s">Watch this page</a></p>',
+                               wp_nonce_url( admin_url( 'admin-post.php?action=wporg_watchlist&watch=1&post_id=' . $post->ID ), 'watch-' . $post->ID ) );
+                       }
+               } else {
+                       return;
</ins><span class="cx">           }
</span><span class="cx"> 
</span><del>-               $watchlist = get_post_meta( $post->ID, '_wporg_watchlist', true );
-               if ( $watchlist && in_array( get_current_user_id(), $watchlist ) )
-                       printf( '<p class="handbook-watch">You are watching this page. <a href="%s">Unwatch</a></p>',
-                               wp_nonce_url( admin_url( 'admin-post.php?action=wporg_watchlist&post_id=' . $post->ID ), 'unwatch-' . $post->ID ) );
-               else
-                       printf( '<p class="handbook-watch"><a href="%s">Watch this page</a></p>',
-                               wp_nonce_url( admin_url( 'admin-post.php?action=wporg_watchlist&watch=1&post_id=' . $post->ID ), 'watch-' . $post->ID ) );
</del><span class="cx">   }
</span><ins>+
+       function append_suffix( $t ) {
+               if ( 'handbook' == $t )
+                       return $t;
+
+               return $t . '-handbook';
+       }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class WPorg_Handbook_Widget_for_Pages extends WPorg_Handbook_Widget {
</span><ins>+
</ins><span class="cx">   protected $post_type = 'page';
</span><span class="cx"> 
</span><span class="cx">  function __construct() {
</span><span class="lines">@@ -42,8 +51,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class WPorg_Handbook_Pages_Widget extends WP_Widget_Pages {
</span><del>-       protected $post_type = 'handbook';
</del><span class="cx"> 
</span><ins>+       protected $post_types = 'handbook';
+
</ins><span class="cx">   function __construct() {
</span><span class="cx">          $widget_ops = array('classname' => 'widget_wporg_handbook_pages', 'description' => __( 'Your site&#8217;s Handbook Pages') );
</span><span class="cx">          WP_Widget::__construct('handbook_pages', __('Handbook Pages'), $widget_ops);
</span><span class="lines">@@ -56,8 +66,24 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function handbook_post_type( $args ) {
</span><del>-               $args['post_type'] = $this->post_type;
</del><ins>+                $post = get_post();
+
+               $this->post_types = apply_filters( 'handbook_post_types', $this->post_types );
+               if ( ! is_array( $this->post_types ) ) {
+                       $this->post_types = (array) $this->post_types;
+               }
+               $this->post_types = array_map( array( $this, 'append_suffix' ), $this->post_types );
+
+               if ( in_array( $post->post_type, $this->post_types ) ) {
+                       $args['post_type'] = $post->post_type;
+               }
</ins><span class="cx">           return $args;
</span><span class="cx">  }
</span><del>-}
</del><span class="cx"> 
</span><ins>+       function append_suffix( $t ) {
+               if ( 'handbook' == $t )
+                       return $t;
+
+               return $t . '-handbook';
+       }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>