Permalink
Browse files

Changing from pages to posts, since I can use post "templates" with t…

…he template_redirect action hook.

fk-box-episode.php
* Added: int cast to make === comparison work.
  • Loading branch information...
1 parent a3d83d7 commit 9df9551767eadbe8b56af535a9b121035c2c71d7 @gabebw committed Jul 4, 2009
Showing with 120 additions and 120 deletions.
  1. +13 −13 fk-admin-menu.php
  2. +9 −9 fk-box-cast.php
  3. +7 −7 fk-box-character.php
  4. +9 −9 fk-box-episode.php
  5. +29 −29 fk-boxes.php
  6. +3 −3 fk-install.php
  7. +6 −6 fk-lib-cast.php
  8. +1 −1 fk-lib-character.php
  9. +4 −4 fk-lib-episode.php
  10. +21 −21 fk-lib.php
  11. +3 −3 fk-options-page.php
  12. +6 −6 fk-settings.php
  13. +6 −6 fk-theme.php
  14. +3 −3 tv-fankit.php
View
@@ -14,8 +14,8 @@
add_action('wp_print_scripts', 'fk_admin_scripts');
add_action('wp_print_styles', 'fk_admin_css');
// Many thanks to http://scompt.com/archives/2007/10/20/adding-custom-columns-to-the-wordpress-manage-posts-screen
-add_filter('manage_pages_columns', 'add_custom_column_hook');
-add_action('manage_pages_custom_column', 'fill_custom_column', 10, 2);
+add_filter('manage_posts_columns', 'add_custom_column_hook');
+add_action('manage_posts_custom_column', 'fill_custom_column', 10, 2);
$fk_plugin_url = trailingslashit( WP_PLUGIN_URL . '/' . dirname( plugin_basename(__FILE__) ) );
/**
@@ -65,25 +65,25 @@ function fk_admin_register_scripts(){
*/
function fk_generate_menu(){
global $fk_settings;
- add_pages_page(__('Add New Episode'), __('Add New Episode'), 'edit_pages', $fk_settings->new_episode_link);
- add_pages_page(__('Add New Cast Member'), __('Add New Cast Member'), 'edit_pages', $fk_settings->new_cast_link);
- add_pages_page(__('Add New Character'), __('Add New Character'), 'edit_pages', $fk_settings->new_character_link);
- add_options_page(__('TV Fan Kit Options'), __('TV Fan Kit'), 'edit_pages', $fk_settings->plugin_path . 'fk-options-page.php');
+ add_posts_page(__('Add New Episode'), __('Add New Episode'), 'edit_posts', $fk_settings->new_episode_link);
+ add_posts_page(__('Add New Cast Member'), __('Add New Cast Member'), 'edit_posts', $fk_settings->new_cast_link);
+ add_posts_page(__('Add New Character'), __('Add New Character'), 'edit_posts', $fk_settings->new_character_link);
+ add_options_page(__('TV Fan Kit Options'), __('TV Fan Kit'), 'edit_posts', $fk_settings->plugin_path . 'fk-options-page.php');
}
function fk_change_title(){
global $editing, $fk_settings, $action, $title;
- if( ! $editing // only change title if we're editing (eg not just looking at list of pages) - this is only set in post/page context
+ if( ! $editing // only change title if we're editing (eg not just looking at list of posts) - this is only set in post/page context
|| $fk_settings->type === 'none' // don't change title for normal pages
- || ! $fk_settings->on_page_page ){ // Only change title for pages.
+ || ! $fk_settings->on_post_page ){ // Only change title for posts.
return false;
}
if( $action === 'edit' ){
- $prefix = _c('Edit|page');
+ $prefix = _c('Edit|post');
} else {
- $prefix = _c('Add New|page');
+ $prefix = _c('Add New|post');
}
$title = "$prefix " . $fk_settings->get_pretty_type($fk_settings->type);
}
@@ -94,17 +94,17 @@ function fk_change_title(){
* @see _page_row()
*/
function add_custom_column_hook($defaults) {
- $defaults['fk_type'] = __('TV Fan Kit Page Type');
+ $defaults['fk_type'] = __('TV Fan Kit Post Type');
return $defaults;
}
/**
* Provides the content for our custom column.
*/
-function fill_custom_column($column_name, $page_id){
+function fill_custom_column($column_name, $post_id){
global $fk_settings;
if( $column_name === 'fk_type' ) {
- $type = fk_get_page_type($page_id);
+ $type = fk_get_post_type($post_id);
$pretty_type = $fk_settings->get_pretty_type($type);
echo $pretty_type;
}
View
@@ -13,7 +13,7 @@ function fk_add_cast_boxes(){
}
function fk_cast_notices(){
- $txt = __("The page title is the actor or actress's name, and the page content is a description of them. To add characters that this character has played or other information, check out the boxes below the writing area.");
+ $txt = __("The post title is the actor or actress's name, and the post content is a description of them. To add characters that this character has played or other information, check out the boxes below the writing area.");
fk_show_basic_notice($txt);
}
@@ -22,7 +22,7 @@ function fk_cast_notices(){
*/
function fk_box_link_cast_to_character(){
if( function_exists( 'add_meta_box' )){
- add_meta_box('fk_character_name_id', __("Add Characters Played By This Actor/Actress"), 'fk_box_cb_link_cast_to_character', 'page', 'normal');
+ add_meta_box('fk_character_name_id', __("Add Characters Played By This Actor/Actress"), 'fk_box_cb_link_cast_to_character', 'post', 'normal');
} else {
// FIXME
}
@@ -33,18 +33,18 @@ function fk_box_link_cast_to_character(){
*/
function fk_box_cb_link_cast_to_character(){
global $fk_settings, $post;
- $all_character_pages = fk_character_get_all();
+ $all_character_posts = fk_character_get_all();
// Use nonce for verification
wp_nonce_field('fk_set_character_name', 'fk_set_character_name_nonce');
- echo '<p>' . __('Note: if a character is not listed, you can <a href="'.$fk_settings->new_character_link.'">add it</a> then come back to this page.') . '</p>';
+ echo '<p>' . __('Note: if a character is not listed, you can <a href="'.$fk_settings->new_character_link.'">add it</a> then come back to this post.') . '</p>';
// FIXME: i think a table would work well - that way we only have to write the header text ("All" etc) once, plus probs easier to parse for user
echo '<p>';
- if( empty($all_character_pages) ){
+ if( empty($all_character_posts) ){
printf(__('No characters exist. Maybe you want to <a href="%s">add one</a>?'),
$fk_settings->new_character_link);
} else {
- foreach( (array) $all_character_pages as $character ){
+ foreach( (array) $all_character_posts as $character ){
// TODO: Sort by name
// TODO:JS accordion (jquery) list of available characters "or manually add character"
$id = $character->character_id;
@@ -67,7 +67,7 @@ function fk_box_cb_link_cast_to_character(){
}
}
-function fk_save_page_cast($page_id){
+function fk_save_post_cast($page_id){
if( $_POST['action'] === 'inline-save' ){
return;
}
@@ -76,7 +76,7 @@ function fk_save_page_cast($page_id){
fk_cast_add($page_id, $characters);
}
-function fk_delete_page_cast($post_id){
- fk_cast_delete($post_id);
+function fk_delete_post_cast($page_id){
+ fk_cast_delete($page_id);
}
?>
View
@@ -1,6 +1,6 @@
<?php
/**
- * Add metaboxes for an character page.
+ * Add metaboxes for an character post.
* @package FanKit
*/
@@ -36,7 +36,7 @@ function fk_character_notices(){
} else {
$pre_character_txt = __("You are editing a character.");
}
- $txt = $pre_character_txt . ' ' . __("The page title is the character's name, and the page content is a description of this character. To mark which actor or actress plays this character, which episodes this character appears in, and more, see the boxes below.");
+ $txt = $pre_character_txt . ' ' . __("The post title is the character's name, and the post content is a description of this character. To mark which actor or actress plays this character, which episodes this character appears in, and more, see the boxes below.");
fk_show_basic_notice($txt);
}
@@ -45,7 +45,7 @@ function fk_character_notices(){
*/
function fk_box_add_character_appearances(){
if( function_exists( 'add_meta_box' )){
- add_meta_box('fk_episode_id', __("TV Fan Kit - Episode Appearances"), 'fk_box_cb_character_appearances', 'page', 'normal');
+ add_meta_box('fk_episode_id', __("TV Fan Kit - Episode Appearances"), 'fk_box_cb_character_appearances', 'post', 'normal');
}
}
@@ -91,7 +91,7 @@ function fk_box_cb_character_appearances(){
function fk_box_add_actor_for_character(){
if( function_exists( 'add_meta_box' )){
- add_meta_box('fk_character_actor_id', __("Mark the Actor/Actress Who Plays This Character"), 'fk_box_cb_add_actor_for_character', 'page', 'normal');
+ add_meta_box('fk_character_actor_id', __("Mark the Actor/Actress Who Plays This Character"), 'fk_box_cb_add_actor_for_character', 'post', 'normal');
} else {
// FIXME
}
@@ -114,7 +114,7 @@ function fk_box_cb_add_actor_for_character(){
_e("After you've added a cast member, you can come back here and mark which actor or actress plays this character.");
} else {
foreach( (array) $all_cast as $cm ){
- $id = $cm->cast_id;
+ $id = (int)$cm->cast_id;
$css_id = "actor-$id"; // "actor-21"
$checked = ($played_by === $id) ? ' checked="checked"' : '';
echo "<label for=\"$css_id\">";
@@ -129,7 +129,7 @@ function fk_box_cb_add_actor_for_character(){
echo '</p>';
}
-function fk_save_page_character($post_id){
+function fk_save_post_character($post_id){
if( $_POST['action'] === 'inline-save' ){
return;
}
@@ -146,7 +146,7 @@ function fk_save_page_character($post_id){
return true;
}
-function fk_delete_page_character($post_id){
+function fk_delete_post_character($post_id){
fk_character_delete($post_id);
}
?>
View
@@ -1,6 +1,6 @@
<?php
/**
- * Add metaboxes for an episode page.
+ * Add metaboxes for an episode post.
* @package FanKit
*/
@@ -16,7 +16,7 @@
// 2 things, 2 boxes
/**
- * Add all metaboxes for an episode page.
+ * Add all metaboxes for an episode post.
* @todo mark characters that are in this episode (checkboxes)
*/
function fk_add_episode_boxes(){
@@ -34,18 +34,18 @@ function fk_episode_notices(){
} else {
$pre_ep_txt = __('You are editing an episode.');
}
- $txt = $pre_ep_txt . ' ' . __("The page title is the episode title, and the page content is the episode description. To add more information, including a transcript, use the boxes below the writing area. To add an autogenerated quote page, do BLAHHH"); // FIXME
+ $txt = $pre_ep_txt . ' ' . __("The post title is the episode title, and the post content is the episode description. To add more information, including a transcript, use the boxes below the writing area. To add an autogenerated quote post, do BLAHHH"); // FIXME
fk_show_basic_notice($txt);
}
function _fk_episode_boxes(){
if( function_exists('add_meta_box')){
// Add a box where user specifies the season and episode number
- add_meta_box('fk_episode_box_season_ep_num_id', __("TV Fan Kit - Season/Episode Number"), 'fk_episode_season_ep_num_box_cb', 'page', 'normal');
+ add_meta_box('fk_episode_box_season_ep_num_id', __("TV Fan Kit - Season/Episode Number"), 'fk_episode_season_ep_num_box_cb', 'post', 'normal');
// Box for marking which characters appear in this episode
- add_meta_box('fk_episode_box_characters_id', __("TV Fan Kit - Characters In This Episode"), 'fk_episode_characters_box_cb', 'page', 'normal');
+ add_meta_box('fk_episode_box_characters_id', __("TV Fan Kit - Characters In This Episode"), 'fk_episode_characters_box_cb', 'post', 'normal');
// Add separate box for transcript, since it can be huge and user may want to drag it out of the way.
- add_meta_box('fk_episode_box_transcript_id', __("TV Fan Kit - Episode Transcript"), 'fk_episode_transcript_box_cb', 'page', 'normal');
+ add_meta_box('fk_episode_box_transcript_id', __("TV Fan Kit - Episode Transcript"), 'fk_episode_transcript_box_cb', 'post', 'normal');
}
}
@@ -58,7 +58,7 @@ function fk_episode_season_ep_num_box_cb(){
$default_ep_num = '';
}
- // Note that we may have episodes w/o season or ep_num, eg a page
+ // Note that we may have episodes w/o season or ep_num, eg a post
// that was switched to episode from another type.
wp_nonce_field('fk_set_episode_info', 'fk_episode_info_nonce');
echo '<div class="form-wrap">';
@@ -111,7 +111,7 @@ function fk_episode_transcript_box_cb(){
wp_nonce_field('fk_set_episode_transcript', 'fk_episode_transcript_nonce');
}
-function fk_save_page_episode($post_id){
+function fk_save_post_episode($post_id){
if( $_POST['action'] === 'inline-save' ){
// TODO: episodes actually do parse post content, so somehow check if transcript has changed, and if it has
// do stuff - wp supplies the nonce
@@ -140,7 +140,7 @@ function fk_save_page_episode($post_id){
}
}
-function fk_delete_page_episode($post_id){
+function fk_delete_post_episode($post_id){
fk_episode_delete($post_id);
}
?>
Oops, something went wrong.

0 comments on commit 9df9551

Please sign in to comment.