コード例 #1
0
ファイル: tags.php プロジェクト: mercime/wp-idea-stream
/**
 * Gets the excerpt of an idea
 *
 * @package WP Idea Stream
 * @subpackage ideas/tags
 *
 * @since 2.0.0
 * @since 2.3.0 Use the $post global to make sure Theme filtering the excerpt_more will display the right link
 *
 * @global  WP_Post $post the current post
 * @uses   wp_idea_stream() to get plugin's main instance
 * @uses   post_password_required() to check if the idea requires a password
 * @uses   wp_idea_stream_user_can() to check for user's capability
 * @uses   strip_shortcodes() to strip the shortcodes in case the excerpt field was used in Edit screen
 * @uses   wp_idea_stream_create_excerpt() to build the excerpt
 * @uses   apply_filters() call 'wp_idea_stream_create_excerpt_text' to override the output
 * @return string  output for the excerpt
 */
function wp_idea_stream_ideas_get_excerpt()
{
    global $post;
    $reset_post = $post;
    $idea = wp_idea_stream()->query_loop->idea;
    // Password protected
    if (post_password_required($idea)) {
        $excerpt = __('This idea is password protected, you will need it to view its content.', 'wp-idea-stream');
        // Private
    } else {
        if (!empty($idea->post_status) && 'private' == $idea->post_status && !wp_idea_stream_user_can('read_idea', $idea->ID)) {
            $excerpt = __('This idea is private, you cannot view its content.', 'wp-idea-stream');
            // Public
        } else {
            $excerpt = strip_shortcodes($idea->post_excerpt);
        }
    }
    if (empty($excerpt)) {
        // This is temporary!
        $post = $idea;
        $excerpt = wp_idea_stream_create_excerpt($idea->post_content, 20);
        // Reset the post
        $post = $reset_post;
    } else {
        /**
         * @param  string  $excerpt the excerpt to output
         * @param  WP_Post $idea the idea object
         */
        $excerpt = apply_filters('wp_idea_stream_create_excerpt_text', $excerpt, $idea);
    }
    return $excerpt;
}
コード例 #2
0
ファイル: tags.php プロジェクト: mrjarbenne/wp-idea-stream
/**
 * Get the user's embed profile description
 *
 * @since 2.3.0
 *
 * @return string HTML Output
 */
function wp_idea_stream_users_get_embed_user_profile_description()
{
    $description = wp_idea_stream_users_get_displayed_user_description();
    if (!empty($description)) {
        $more = ' &hellip; ' . sprintf('<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>', esc_url(wp_idea_stream_users_get_embed_user_profile_link()), sprintf(esc_html__("View %s full profile", 'wp-idea-stream'), '<span class="screen-reader-text">' . sprintf(_x('%s&#39;s', 'Screen reader text for embed user display name for the more link', 'wp-idea-stream'), wp_idea_stream_users_get_embed_user_profile_display_name()) . '</span>'));
        $description = wp_idea_stream_create_excerpt($description, 20, $more, true);
    }
    return apply_filters('wp_idea_stream_users_get_embed_user_profile_description', $description);
}