_n( '%s post updated.', '%s posts updated.', 0 ), 'locked' => _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', 0 ), 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', 0 ), 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', 0 ), 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', 0 ), ); return $bulk_update_messages_default; } public static function mywp_wp_loaded() { if( ! is_admin() ) { return false; } if( is_network_admin() ) { return false; } if( ! self::is_do_controller() ) { return false; } add_action( 'mywp_ajax' , array( __CLASS__ , 'mywp_ajax' ) , 1000 ); add_action( 'load-edit.php' , array( __CLASS__ , 'load_edit' ) , 1000 ); } public static function mywp_get_option_key( $option_key ) { if( empty( self::$post_type ) ) { return $option_key; } $option_key .= '_' . self::$post_type; return $option_key; } public static function mywp_ajax() { if( empty( $_POST['action'] ) or $_POST['action'] != 'inline-save' ) { return false; } if( empty( $_POST['screen'] ) or $_POST['screen'] != 'edit-post' ) { return false; } if( empty( $_POST['post_type'] ) ) { return false; } self::$post_type = strip_tags( $_POST['post_type'] ); add_filter( 'mywp_get_option_key_mywp_admin_posts' , array( __CLASS__ , 'mywp_get_option_key' ) ); } public static function load_edit() { global $typenow; if( empty( $typenow ) ) { return false; } self::$post_type = $typenow; add_filter( 'mywp_get_option_key_mywp_admin_posts' , array( __CLASS__ , 'mywp_get_option_key' ) ); add_filter( 'bulk_post_updated_messages' , array( __CLASS__ , 'change_bulk_post_updated_messages' ) ); add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_add_new' ) ); add_action( 'admin_print_styles' , array( __CLASS__ , 'hide_search_box' ) ); add_filter( "edit_{$typenow}_per_page" , array( __CLASS__ , 'edit_per_page' ) ); } public static function change_bulk_post_updated_messages( $bulk_post_updated_messages ) { if( ! self::is_do_function( __FUNCTION__ ) ) { return $bulk_post_updated_messages; } $setting_data = self::get_setting_data(); if( empty( $setting_data['bulk_post_updated_messages'] ) ) { return $bulk_post_updated_messages; } $bulk_post_updated_messages_default = self::get_bulk_update_messages_default(); foreach( $bulk_post_updated_messages_default as $key => $v ) { if( ! empty( $setting_data['bulk_post_updated_messages'][ $key ] ) ) { $bulk_post_updated_messages[ self::$post_type ][ $key ] = $setting_data['bulk_post_updated_messages'][ $key ]; } } self::after_do_function( __FUNCTION__ ); return $bulk_post_updated_messages; } public static function hide_add_new() { if( ! self::is_do_function( __FUNCTION__ ) ) { return false; } $setting_data = self::get_setting_data(); if( empty( $setting_data['hide_add_new'] ) ) { return false; } echo ''; self::after_do_function( __FUNCTION__ ); } public static function hide_search_box() { if( ! self::is_do_function( __FUNCTION__ ) ) { return false; } $setting_data = self::get_setting_data(); if( empty( $setting_data['hide_search_box'] ) ) { return false; } echo ''; self::after_do_function( __FUNCTION__ ); } public static function edit_per_page( $per_page ) { if( ! self::is_do_function( __FUNCTION__ ) ) { return $per_page; } $setting_data = self::get_setting_data(); if( empty( $setting_data['per_page_num'] ) ) { return $per_page; } $per_page = $setting_data['per_page_num']; self::after_do_function( __FUNCTION__ ); return $per_page; } } MywpControllerModuleAdminPosts::init(); endif;