From fb9e1731f18393b13e634b0f3177cb36039cf364 Mon Sep 17 00:00:00 2001 From: Takumi Date: Thu, 25 Jul 2013 16:56:52 +1000 Subject: [PATCH] Move event gettext to globals --- event.php | 20 -------------------- globals.php | 15 +++++++++++++-- player.php | 6 ++++-- staff.php | 21 ++++++++++++++++++++- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/event.php b/event.php index d2ec3654..196fb611 100644 --- a/event.php +++ b/event.php @@ -25,26 +25,6 @@ function sp_event_display_scheduled( $posts ) { } add_filter( 'the_posts', 'sp_event_display_scheduled' ); -function sp_event_text_replace( $input, $text, $domain ) { - global $post; - if ( is_admin() && get_post_type( $post ) == 'sp_event' ) - switch ( $text ): - case 'Scheduled for: %1$s': - return __( 'Kick-off', 'sportspress' ) . ': %1$s'; - break; - case 'Published on: %1$s': - return __( 'Kick-off', 'sportspress' ) . ': %1$s'; - break; - case 'Publish immediately': - return __( 'Kick-off', 'sportspress' ) . ': %1$s'; - break; - default: - return $input; - endswitch; - return $input; -} -add_filter( 'gettext', 'sp_event_text_replace', 20, 3 ); - function sp_event_meta_init() { remove_meta_box( 'submitdiv', 'sp_event', 'side' ); add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' ); diff --git a/globals.php b/globals.php index dc97d9a0..c0c0d519 100644 --- a/globals.php +++ b/globals.php @@ -13,17 +13,28 @@ $sportspress_texts = array( 'Parent' => sprintf( __( 'Parent %s', 'sportspress' ), __( 'Team', 'sportspress' ) ), 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Logo', 'sportspress' ) ) ), + 'sp_event' => array( + 'Scheduled for: %1$s' => __( 'Kick-off', 'sportspress' ) . ': %1$s', + 'Published on: %1$s' => __( 'Kick-off', 'sportspress' ) . ': %1$s', + 'Publish immediately' => __( 'Kick-off', 'sportspress' ) . ': %1$s' + ), 'sp_player' => array( 'Enter title here' => __( 'Name', 'sportspress' ), 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Set Featured Image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), - 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) + 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Scheduled for: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', + 'Published on: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', + 'Publish immediately' => __( 'Joined', 'sportspress' ) . ': %1$s' ), 'sp_staff' => array( 'Enter title here' => __( 'Name', 'sportspress' ), 'Set featured image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), 'Set Featured Image' => sprintf( __( 'Add %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), - 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) + 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ), + 'Scheduled for: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', + 'Published on: %1$s' => __( 'Joined', 'sportspress' ) . ': %1$s', + 'Publish immediately' => __( 'Joined', 'sportspress' ) . ': %1$s' ) ); diff --git a/player.php b/player.php index a9232db3..f3d75e0e 100644 --- a/player.php +++ b/player.php @@ -17,12 +17,14 @@ function sp_player_cpt_init() { add_action( 'init', 'sp_player_cpt_init' ); function sp_player_meta_init() { + remove_meta_box( 'submitdiv', 'sp_player', 'side' ); + add_meta_box( 'submitdiv', __( 'Publish', 'sportspress' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' ); remove_meta_box( 'postimagediv', 'sp_player', 'side' ); add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' ); - add_meta_box( 'sp_playerdiv', __( 'Teams', 'sportspress' ), 'sp_player_basic_meta', 'sp_player', 'side', 'high' ); + add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' ); add_meta_box( 'sp_profilediv', __( 'Profile', 'sportspress' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' ); } -function sp_player_basic_meta( $post, $metabox ) { +function sp_player_team_meta( $post, $metabox ) { global $post_id; sp_team_select_html( $post_id ); sp_nonce(); diff --git a/staff.php b/staff.php index 515fb9c4..da5d8284 100644 --- a/staff.php +++ b/staff.php @@ -8,13 +8,32 @@ function sp_staff_cpt_init() { 'labels' => $labels, 'public' => true, 'hierarchical' => false, - 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ), + 'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes' ), + 'register_meta_box_cb' => 'sp_staff_meta_init', 'rewrite' => array( 'slug' => 'staff' ) ); register_post_type( 'sp_staff', $args ); } add_action( 'init', 'sp_staff_cpt_init' ); +function sp_staff_meta_init() { + remove_meta_box( 'submitdiv', 'sp_staff', 'side' ); + add_meta_box( 'submitdiv', __( 'Publish', 'sportspress' ), 'post_submit_meta_box', 'sp_staff', 'side', 'high' ); + remove_meta_box( 'postimagediv', 'sp_staff', 'side' ); + add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_staff', 'side', 'high' ); + add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_staff_team_meta', 'sp_staff', 'side', 'high' ); + add_meta_box( 'sp_profilediv', __( 'Profile', 'sportspress' ), 'sp_staff_profile_meta', 'sp_staff', 'normal', 'high' ); +} +function sp_staff_team_meta( $post, $metabox ) { + global $post_id; + sp_team_select_html( $post_id ); + sp_nonce(); +} + +function sp_staff_profile_meta( $post, $metabox ) { + wp_editor( $post->post_content, 'content' ); +} + function sp_staff_edit_columns( $columns ) { $columns = array( 'cb' => '',