'', // Unused. Messages start at index 1. 1 => sprintf( Ai1ec_I18n::__( 'Event updated. View event' ), esc_url( get_permalink( $post_ID ) ) ), 2 => Ai1ec_I18n::__( 'Custom field updated.' ), 3 => Ai1ec_I18n::__( 'Custom field deleted.' ), 4 => Ai1ec_I18n::__( 'Event updated.' ), /* translators: %s: date and time of the revision */ 5 => isset( $_GET['revision'] ) ? sprintf( Ai1ec_I18n::__( 'Event restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( Ai1ec_I18n::__( 'Event published. View event' ), esc_url( get_permalink($post_ID) ) ), 7 => Ai1ec_I18n::__( 'Event saved.' ), 8 => sprintf( Ai1ec_I18n::__( 'Event submitted. Preview event' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), 9 => sprintf( Ai1ec_I18n::__( 'Event scheduled for: %1$s. Preview event' ), // translators: Publish box date format, see http://php.net/date $this->_registry->get( 'date.time', $post->post_date )->format_i18n( Ai1ec_I18n::__( 'M j, Y @ G:i' ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( Ai1ec_I18n::__( 'Event draft updated. Preview event' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), ); return $messages; } /** * Generates an excerpt from the given content string. * * Adapted from WordPress's `wp_trim_excerpt' function that is not useful * for applying to custom content. * * @param string $text The content to trim. * * @return string The excerpt. */ public function trim_excerpt( Ai1ec_Event $event, $length = 35, $more = '[...]' ) { global $post; $original_post = $post; $post = $event->get( 'post' ); $raw_excerpt = $event->get( 'post' )->post_content; if ( ! isset( $raw_excerpt{0} ) ) { $raw_excerpt = ' '; } $text = preg_replace( '#<\s*script[^>]*>.+<\s*/\s*script\s*>#x', '', apply_filters( 'the_excerpt', $raw_excerpt ) ); $text = strip_shortcodes( $text ); $text = str_replace( ']]>', ']]>', $text ); $text = strip_tags( $text ); $excerpt_length = apply_filters( 'excerpt_length', $length ); $excerpt_more = apply_filters( 'excerpt_more', $more ); $words = preg_split( '/\s+/', $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY ); if ( count( $words ) > $excerpt_length ) { array_pop( $words ); $text = implode( ' ', $words ); $text = $text . $excerpt_more; } else { $text = implode( ' ', $words ); } $post = $original_post; return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt ); } }