/**
  * Escapes and beautifies title.
  *
  * @since 2.5.2
  *
  * @param string $title The title to escape and beautify.
  * @param bool $trim Whether to trim the title from whitespaces.
  * @return string Escaped and beautified title.
  */
 public function escape_title($title = '', $trim = true)
 {
     $title = wptexturize($title);
     $title = convert_chars($title);
     $title = esc_html($title);
     $title = capital_P_dangit($title);
     $title = $trim ? trim($title) : $title;
     return $title;
 }
 /**
  * Escapes and beautifies description.
  *
  * @since 2.5.2
  *
  * @param string $description The description to escape and beautify.
  * @return string Escaped and beautified description.
  */
 public function escape_description($description = '')
 {
     $description = wptexturize($description);
     $description = convert_chars($description);
     $description = esc_html($description);
     $description = capital_P_dangit($description);
     $description = trim($description);
     return $description;
 }
Beispiel #3
0
/**
 * Returns document title for the current page.
 *
 * @since 4.4.0
 *
 * @global int $page  Page number of a single post.
 * @global int $paged Page number of a list of posts.
 *
 * @return string Tag with the document title.
 */
function wp_get_document_title()
{
    /**
     * Filter the document title before it is generated.
     *
     * Passing a non-empty value will short-circuit wp_get_document_title(),
     * returning that value instead.
     *
     * @since 4.4.0
     *
     * @param string $title The document title. Default empty string.
     */
    $title = apply_filters('pre_get_document_title', '');
    if (!empty($title)) {
        return $title;
    }
    global $page, $paged;
    $title = array('title' => '');
    // If it's a 404 page, use a "Page not found" title.
    if (is_404()) {
        $title['title'] = __('Page not found');
        // If it's a search, use a dynamic search results title.
    } elseif (is_search()) {
        /* translators: %s: search phrase */
        $title['title'] = sprintf(__('Search Results for “%s”'), get_search_query());
        // If on the home or front page, use the site title.
    } elseif (is_home() && is_front_page()) {
        $title['title'] = get_bloginfo('name', 'display');
        // If on a post type archive, use the post type archive title.
    } elseif (is_post_type_archive()) {
        $title['title'] = post_type_archive_title('', false);
        // If on a taxonomy archive, use the term title.
    } elseif (is_tax()) {
        $title['title'] = single_term_title('', false);
        /*
         * If we're on the blog page and that page is not the homepage or a single
         * page that is designated as the homepage, use the container page's title.
         */
    } elseif (is_home() && !is_front_page() || !is_home() && is_front_page()) {
        $title['title'] = single_post_title('', false);
        // If on a single post of any post type, use the post title.
    } elseif (is_singular()) {
        $title['title'] = single_post_title('', false);
        // If on a category or tag archive, use the term title.
    } elseif (is_category() || is_tag()) {
        $title['title'] = single_term_title('', false);
        // If on an author archive, use the author's display name.
    } elseif (is_author() && ($author = get_queried_object())) {
        $title['title'] = $author->display_name;
        // If it's a date archive, use the date as the title.
    } elseif (is_year()) {
        $title['title'] = get_the_date(_x('Y', 'yearly archives date format'));
    } elseif (is_month()) {
        $title['title'] = get_the_date(_x('F Y', 'monthly archives date format'));
    } elseif (is_day()) {
        $title['title'] = get_the_date();
    }
    // Add a page number if necessary.
    if (($paged >= 2 || $page >= 2) && !is_404()) {
        $title['page'] = sprintf(__('Page %s'), max($paged, $page));
    }
    // Append the description or site title to give context.
    if (is_home() && is_front_page()) {
        $title['tagline'] = get_bloginfo('description', 'display');
    } else {
        $title['site'] = get_bloginfo('name', 'display');
    }
    /**
     * Filter the separator for the document title.
     *
     * @since 4.4.0
     *
     * @param string $sep Document title separator. Default '-'.
     */
    $sep = apply_filters('document_title_separator', '-');
    /**
     * Filter the parts of the document title.
     *
     * @since 4.4.0
     *
     * @param array $title {
     *     The document title parts.
     *
     *     @type string $title   Title of the viewed page.
     *     @type string $page    Optional. Page number if paginated.
     *     @type string $tagline Optional. Site description when on home page.
     *     @type string $site    Optional. Site title when not on home page.
     * }
     */
    $title = apply_filters('document_title_parts', $title);
    $title = implode(" {$sep} ", array_filter($title));
    $title = wptexturize($title);
    $title = convert_chars($title);
    $title = esc_html($title);
    $title = capital_P_dangit($title);
    return $title;
}
Beispiel #4
0
 public static function wpcf_access_do_shortcode_content($content, $raw)
 {
     if (function_exists('WPV_wpcf_record_post_relationship_belongs')) {
         $content = WPV_wpcf_record_post_relationship_belongs($content);
     }
     if (class_exists('WPV_template')) {
         global $WPV_templates;
         $content = $WPV_templates->the_content($content);
     }
     if (isset($GLOBALS['wp_embed'])) {
         global $wp_embed;
         $content = $wp_embed->run_shortcode($content);
         $content = $wp_embed->autoembed($content);
     }
     if (function_exists('wpv_resolve_internal_shortcodes')) {
         $content = wpv_resolve_internal_shortcodes($content);
     }
     if (function_exists('wpv_resolve_wpv_if_shortcodes')) {
         $content = wpv_resolve_wpv_if_shortcodes($content);
     }
     $content = convert_smilies($content);
     //Enable wpautop if raw = false
     if ($raw == 'false') {
         $content = wpautop($content);
     }
     $content = shortcode_unautop($content);
     $content = prepend_attachment($content);
     $content = do_shortcode($content);
     $content = capital_P_dangit($content);
     return $content;
 }