Permalink
Browse files

Clean up transcripts.php.

  • Loading branch information...
1 parent 35f76fb commit fb8e12b79fc527a0263c677301a1247aaea3fa09 Michael Sisk committed Jan 28, 2013
Showing with 34 additions and 34 deletions.
  1. +34 −34 -/php/transcripts.php
View
68 -/php/transcripts.php
@@ -331,6 +331,35 @@ public function posts_where( $where ) {
return $where;
}
+ /** Add Orphaned view for webcomic posts.
+ *
+ * @param array $views Array of view links.
+ * @return array
+ * @hook views_edit-(webcomic\d+)
+ */
+ public function view_orphans( $views ) {
+ global $wpdb;
+
+ if ( $orphans = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'webcomic_transcript' AND post_parent = 0" ) ) {
+ $posts = wp_count_posts( 'webcomic_transcript', 'readable' );
+
+ foreach ( get_post_stati( array( 'show_in_admin_all_list' => false) ) as $state ) {
+ $orphans -= $posts->$state;
+ }
+
+ if ( $orphans >= 1 ) {
+ $views[ 'webcomic_orphans' ] = sprintf( '<a href="%s"%s>%s <span class="count">(%d)</span></a>',
+ esc_url( add_query_arg( array( 'post_type' => 'webcomic_transcript', 'post_status' => 'all', 'webcomic_orphaned' => true ), admin_url( 'edit.php' ) ) ),
+ isset( $_GET[ 'webcomic_orphaned' ] ) ? ' class="current"' : '',
+ __( 'Orphaned', 'webcomic' ),
+ $orphans
+ );
+ }
+ }
+
+ return $views;
+ }
+
/** Add transcript languages, parent, and custom author columns.
*
* @param array $columns An array of post columns.
@@ -349,16 +378,6 @@ public function manage_columns( $columns ) {
return array_merge( $pre, $columns );
}
- /** Add sortable parent and author columns.
- *
- * @param array $columns An array of sortable columns.
- * @return array
- * @hook manage_edit-webcomic_transcript_sortable_columns
- */
- public function manage_sortable_columns( $columns ) {
- return array_merge( array( 'webcomic_author' => 'webcomic_author', 'webcomic_parent' => 'webcomic_parent' ), $columns );
- }
-
/** Rename the language 'Posts' column.
*
* @param array $columns An array of term columns.
@@ -371,33 +390,14 @@ public function manage_language_columns( $columns ) {
return $columns;
}
- /** Add Orphaned view for webcomic posts.
+ /** Add sortable parent and author columns.
*
- * @param array $views Array of view links.
+ * @param array $columns An array of sortable columns.
* @return array
- * @hook views_edit-(webcomic\d+)
+ * @hook manage_edit-webcomic_transcript_sortable_columns
*/
- public function view_orphans( $views ) {
- global $wpdb;
-
- if ( $orphans = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'webcomic_transcript' AND post_parent = 0" ) ) {
- $posts = wp_count_posts( 'webcomic_transcript', 'readable' );
-
- foreach ( get_post_stati( array( 'show_in_admin_all_list' => false) ) as $state ) {
- $orphans -= $posts->$state;
- }
-
- if ( $orphans >= 1 ) {
- $views[ 'webcomic_orphans' ] = sprintf( '<a href="%s"%s>%s <span class="count">(%d)</span></a>',
- esc_url( add_query_arg( array( 'post_type' => 'webcomic_transcript', 'post_status' => 'all', 'webcomic_orphaned' => true ), admin_url( 'edit.php' ) ) ),
- isset( $_GET[ 'webcomic_orphaned' ] ) ? ' class="current"' : '',
- __( 'Orphaned', 'webcomic' ),
- $orphans
- );
- }
- }
-
- return $views;
+ public function manage_sortable_columns( $columns ) {
+ return array_merge( array( 'webcomic_author' => 'webcomic_author', 'webcomic_parent' => 'webcomic_parent' ), $columns );
}
/** Render the transcript parent meta box.

0 comments on commit fb8e12b

Please sign in to comment.