当前位置: 首页>>代码示例>>PHP>>正文


PHP wptexturize函数代码示例

本文整理汇总了PHP中wptexturize函数的典型用法代码示例。如果您正苦于以下问题:PHP wptexturize函数的具体用法?PHP wptexturize怎么用?PHP wptexturize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wptexturize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: woo_add_order_notes_to_email

function woo_add_order_notes_to_email()
{
    global $woocommerce, $post;
    $args = array('post_id' => $post->ID, 'approve' => 'approve', 'type' => 'order_note');
    $notes = get_comments($args);
    echo '<h2>' . __('Order Notes', 'woocommerce') . '</h2>';
    echo '<ul class="order_notes">';
    if ($notes) {
        foreach ($notes as $note) {
            $note_classes = get_comment_meta($note->comment_ID, 'is_customer_note', true) ? array('customer-note', 'note') : array('note');
            ?>
			<li rel="<?php 
            echo absint($note->comment_ID);
            ?>
" class="<?php 
            echo implode(' ', $note_classes);
            ?>
">
				<div class="note_content">
					(<?php 
            printf(__('added %s ago', 'woocommerce'), human_time_diff(strtotime($note->comment_date_gmt), current_time('timestamp', 1)));
            ?>
) <?php 
            echo wpautop(wptexturize(wp_kses_post($note->comment_content)));
            ?>
				</div>
			</li>
			<?php 
        }
    } else {
        echo '<li>' . __('There are no notes for this order yet.', 'woocommerce') . '</li>';
    }
    echo '</ul>';
}
开发者ID:douglaswebdesigns,项目名称:woocommerce-get-card-fields,代码行数:34,代码来源:woocommerce-order-notes-card-fields-master.php

示例2: widget

 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     // before and after widget arguments are defined by themes
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // This is where you run the code and display the output
     // Get other recent posts
     global $post;
     $cat_ID = array();
     $categories = get_the_category();
     //get all categories for this post
     foreach ($categories as $category) {
         array_push($cat_ID, $category->cat_ID);
     }
     $args = array('orderby' => 'date', 'order' => 'DESC', 'post__not_in' => array($post->ID), 'category__in' => $cat_ID);
     // post__not_in will exclude the post we are displaying
     $otherposts = get_posts($args);
     if (sizeof($otherposts) > 0) {
         $out = '';
         foreach ($otherposts as $otherpost) {
             $out .= '<li>';
             $out .= '<a href="' . get_permalink($otherpost->ID) . '" title="' . wptexturize($otherpost->post_title) . '">' . wptexturize($otherpost->post_title) . '</a></li>';
         }
         $out = '<ul class="otherpost">' . $out . '</ul>';
         echo $out;
     } else {
         echo "<li>Não existem outras publicações.</li>";
     }
     echo $args['after_widget'];
 }
开发者ID:luisfbmelo,项目名称:saudacorwebsite,代码行数:33,代码来源:recentposts_saudacor.php

示例3: ubik_seo_meta_description

function ubik_seo_meta_description($desc = '')
{
    // Generate a meta description
    if (empty($desc)) {
        // Single posts, pages, and attachments
        if (is_singular()) {
            $post = get_post();
            if (empty($post)) {
                $desc = '';
            }
            $desc = wptexturize($post->post_content);
            // Get the entire contents, not the excerpt, so as to not duplicate Ubik Excerpt
        }
        // Check to see if we have a description for this category, tag, or taxonomy
        if (is_category() || is_tag() || is_tax()) {
            $desc = term_description();
        }
        // Now match other possibilities...
        if (is_author()) {
            $desc = get_the_author_meta('description');
        }
        // Front or home page
        if (is_front_page() || is_home()) {
            $desc = get_bloginfo('description');
        }
        // No excerpt to return
        if (is_404() || is_search()) {
            $desc = '';
        }
        $desc = ubik_seo_meta_description_sanitize($desc);
    }
    return apply_filters('ubik_seo_meta_description', $desc);
}
开发者ID:synapticism,项目名称:ubik-seo,代码行数:33,代码来源:ubik-seo-meta-description.php

示例4: get_archives_link

 /**
  * @internal
  * @param string $url
  * @param string $text
  * @return mixed
  */
 protected function get_archives_link($url, $text)
 {
     $ret = array();
     $ret['text'] = $ret['title'] = $ret['name'] = wptexturize($text);
     $ret['url'] = $ret['link'] = esc_url(TimberURLHelper::prepend_to_url($url, $this->base));
     return $ret;
 }
开发者ID:sdunham,项目名称:sustainable,代码行数:13,代码来源:timber-archives.php

示例5: sanitizeString

 /**
  * Sanitize the input string. HTML tags can be permitted.
  * The permitted tags can be supplied in an array.
  *
  * @TODO: Finish the code needed to support the $permittedTags array.
  *
  * @param string $string
  * @param bool $allowHTML [optional]
  * @param array $permittedTags [optional]
  * @return string
  */
 public function sanitizeString($string, $allowHTML = FALSE, $permittedTags = array())
 {
     // Strip all tags except the permitted.
     if (!$allowHTML) {
         // Ensure all tags are closed. Uses WordPress method balanceTags().
         $balancedText = balanceTags($string, TRUE);
         $strippedText = strip_tags($balancedText);
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $strippedText);
         // Escape text using the WordPress method and then strip slashes.
         $escapedText = stripslashes(esc_attr($strippedText));
         // Remove line breaks and trim white space.
         $escapedText = preg_replace('/[\\r\\n\\t ]+/', ' ', $escapedText);
         return trim($escapedText);
     } else {
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
         $strippedText = preg_replace('/&lt;(script|style).*?&gt;.*?&lt;\\/\\1&gt;/si', '', stripslashes($strippedText));
         /*
          * Use WordPress method make_clickable() to make links clickable and
          * use kses for filtering.
          *
          * http://ottopress.com/2010/wp-quickie-kses/
          */
         return wptexturize(wpautop(make_clickable(wp_kses_post($strippedText))));
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:38,代码来源:class.utility.php

示例6: custom_gallery

function custom_gallery($attr)
{
    $post = get_post();
    static $instance = 0;
    $instance++;
    # hard-coding these values so that they can't be broken
    $attr['columns'] = 1;
    $attr['size'] = 'full';
    $attr['link'] = 'none';
    $attr['orderby'] = 'post__in';
    $attr['include'] = $attr['ids'];
    #Allow plugins/themes to override the default gallery template.
    $output = apply_filters('post_gallery', '', $attr);
    if ($output != '') {
        return $output;
    }
    # We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'div', 'icontag' => 'div', 'captiontag' => 'p', 'columns' => 4, 'size' => 'gallery-thumbnail', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    $gallery_style = $gallery_div = '';
    if (apply_filters('use_default_gallery_style', true)) {
        $gallery_style = "<!-- see gallery_shortcode() in functions.php -->";
    }
    $gallery_div = "<ul class='clearing-thumbs small-block-grid-2 large-block-grid-4' data-clearing>";
    $output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div);
    foreach ($attachments as $id => $attachment) {
        $link = wp_get_attachment_link($id, 'full', false, false);
        $output .= "<li>";
        $output .= "{$link}";
        if ($captiontag && trim($attachment->post_excerpt)) {
            $output .= "\n\t\t\t\t<p class='wp-caption-text homepage-gallery-caption hide'>\n\t\t\t\t" . wptexturize($attachment->post_excerpt) . "\n\t\t\t\t</p>";
        }
        $output .= "</li>";
    }
    $output .= "</ul>\n";
    return $output;
}
开发者ID:juan88ac,项目名称:foundation_s,代码行数:60,代码来源:custom-gallery-markup.php

示例7: get_post_title

 private function get_post_title($single, $tag = null, $css_class = null)
 {
     $info = '<a href="' . get_permalink($single->ID);
     $lcp_post_title = apply_filters('the_title', $single->post_title, $single->ID);
     if (!empty($this->params['title_limit']) && $this->params['title_limit'] != "0") {
         $lcp_post_title = substr($lcp_post_title, 0, intval($this->params['title_limit']));
         if (strlen($lcp_post_title) >= intval($this->params['title_limit'])) {
             $lcp_post_title .= "&hellip;";
         }
     }
     $info .= '" title="' . wptexturize($single->post_title) . '"';
     if (!empty($this->params['link_target'])) {
         $info .= ' target="' . $this->params['link_target'] . '" ';
     }
     if (!empty($this->params['title_class']) && empty($this->params['title_tag'])) {
         $info .= ' class="' . $this->params['title_class'] . '"';
     }
     $info .= '>' . $lcp_post_title . '</a>';
     if (!empty($this->params['post_suffix'])) {
         $info .= " " . $this->params['post_suffix'];
     }
     if (!empty($this->params['title_tag'])) {
         $pre = "<" . $this->params['title_tag'];
         if (!empty($this->params['title_class'])) {
             $pre .= ' class="' . $this->params['title_class'] . '"';
         }
         $pre .= '>';
         $post = "</" . $this->params['title_tag'] . ">";
         $info = $pre . $info . $post;
     }
     if ($tag !== null || $css_class !== null) {
         $info = $this->assign_style($info, $tag, $css_class);
     }
     return $info;
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:35,代码来源:lcp-post-builder.php

示例8: meta_description

 /**
  * add meta_description
  *
  * hook after post has loaded to add a unique meta-description
  *
  */
 public static function meta_description()
 {
     $post = new \TimberPost();
     // check for custom field
     $description = wptexturize($post->get_field('meta_description'));
     if (is_tax()) {
         if ($temp = term_description(get_queried_object(), get_query_var('taxonomy'))) {
             $description = $temp;
         }
     } elseif (is_post_type_archive()) {
         if ($temp = get_the_archive_description()) {
             $description = $temp;
         }
     }
     // else use preview
     if (empty($description)) {
         $description = str_replace('', "'", $post->get_preview(40, true, false, true));
     }
     // finally use the blog description
     if (empty($description)) {
         $description = get_bloginfo('description', 'raw');
     }
     $description = esc_attr(wp_strip_all_tags($description));
     // limit to SEO recommended length
     if (strlen($description) > 155) {
         $description = substr($description, 0, 155);
         $description = \TimberHelper::trim_words($description, str_word_count($description) - 1);
     }
     return $description;
 }
开发者ID:benedict-w,项目名称:pressgang,代码行数:36,代码来源:site.php

示例9: admin_page_warning

    function admin_page_warning()
    {
        $jetpack = Jetpack::init();
        $blog_name = get_bloginfo('blogname');
        if (empty($blog_name)) {
            $blog_name = home_url('/');
        }
        ?>
		<div id="message" class="updated jetpack-message jp-connect">
			<div class="jetpack-wrap-container">
				<div class="jetpack-text-container">
					<h4>
					<p><?php 
        printf(esc_html(wptexturize(__("To use Publicize, you'll need to link your %s account to your WordPress.com account using the button to the right.", 'jetpack'))), '<strong>' . esc_html($blog_name) . '</strong>');
        ?>
</p>
					<p><?php 
        echo esc_html(wptexturize(__("If you don't have a WordPress.com account yet, you can sign up for free in just a few seconds.", 'jetpack')));
        ?>
</p>
					</h4>
				</div>
				<div class="jetpack-install-container">
					<p class="submit"><a href="<?php 
        echo $jetpack->build_connect_url(false, menu_page_url('sharing', false));
        ?>
" class="button-connector" id="wpcom-connect"><?php 
        esc_html_e('Link account with WordPress.com', 'jetpack');
        ?>
</a></p>
				</div>
			</div>
		</div>
		<?php 
    }
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:35,代码来源:publicize-jetpack.php

示例10: credits_text

 /**
  * Update the credits text.
  *
  * @since 1.0.0
  *
  * @param string $text Credits text.
  * @return string
  */
 public function credits_text($text)
 {
     $settings = wp_parse_args((array) get_option('footer_credits'), array('placement' => '', 'text' => ''));
     switch ($settings['placement']) {
         case 'after':
             $text .= ' ' . $settings['text'];
             break;
         case 'before':
             $text = $settings['text'] . ' ' . $text;
             break;
         case 'remove':
             $text = '';
             break;
         case 'replace':
             $text = $settings['text'];
             break;
     }
     $search = array('{{year}}');
     $replace = array(date('Y'));
     $text = str_replace($search, $replace, $text);
     $text = wptexturize(trim($text));
     $text = convert_chars($text);
     $text = $this->allowed_tags($text);
     return $text;
 }
开发者ID:hexagone-io,项目名称:footer-credits,代码行数:33,代码来源:class-footer-credits.php

示例11: roots_gallery

/**
 * Clean up gallery_shortcode()
 *
 * Re-create the [gallery] shortcode and use thumbnails styling from Bootstrap
 *
 * @link http://twitter.github.com/bootstrap/components.html#thumbnails
 */
function roots_gallery($attr)
{
    $post = get_post();
    static $instance = 0;
    $instance++;
    if (!empty($attr['ids'])) {
        if (empty($attr['orderby'])) {
            $attr['orderby'] = 'post__in';
        }
        $attr['include'] = $attr['ids'];
    }
    $output = apply_filters('post_gallery', '', $attr);
    if ($output != '') {
        return $output;
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => '', 'icontag' => '', 'captiontag' => '', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'link' => 'file'), $attr));
    $id = intval($id);
    if ($order === 'RAND') {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $output = '<ul class="thumbnails gallery">';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $image = 'file' == $link ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
        $output .= '<li>' . $image;
        if (trim($attachment->post_excerpt)) {
            $output .= '<div class="caption hidden">' . wptexturize($attachment->post_excerpt) . '</div>';
        }
        $output .= '</li>';
    }
    $output .= '</ul>';
    return $output;
}
开发者ID:NaszvadiG,项目名称:roots,代码行数:67,代码来源:gallery.php

示例12: wpmtst_the_content

/**
 * Display the testimonial content.
 *
 * @param null $length
 *
 * @since 1.24.0
 * @since 2.4.0 Run content through selected filters only, instead
 *              of all filters added to the_excerpt() or the_content().
 *
 * @todo Use native auto-excerpt and trim_words instead.
 */
function wpmtst_the_content($length = null)
{
    if ($length) {
        $excerpt = false;
    } else {
        $excerpt = WPMST()->atts('excerpt');
        $length = WPMST()->atts('length');
    }
    // In View settings, {excerpt} overrides {length} overrides {full content}.
    if ($excerpt) {
        $content = get_the_excerpt();
        $content = apply_filters('the_excerpt', $content);
    } else {
        if ($length) {
            $content = wpmtst_get_field('truncated', array('char_limit' => $length));
        } else {
            $content = get_the_content();
        }
        // Applying all content filters breaks POS NextGEN Gallery.
        // So need to find a way to select which additional filters, if any, to apply.
        // For instance, All In One Rich Snippets.
        //$content = apply_filters( 'the_content', $content );
        $content = wptexturize($content);
        $content = convert_smilies($content);
        $content = wpautop($content);
        $content = shortcode_unautop($content);
        $content = do_shortcode($content);
    }
    echo $content;
}
开发者ID:serker72,项目名称:T3S,代码行数:41,代码来源:template-functions.php

示例13: get

 public function get()
 {
     $license = $this->get_license();
     $downloads = $this->get_downloads();
     $config = ["alwaysShowHours" => true, "alwaysShowControls" => true, "chaptersVisible" => true, "permalink" => get_permalink($this->post->ID), "publicationDate" => mysql2date("c", $this->post->post_date), "title" => get_the_title($this->post->ID), "subtitle" => wptexturize(convert_chars(trim($this->episode->subtitle))), "summary" => nl2br(wptexturize(convert_chars(trim($this->episode->summary)))), "poster" => $this->episode->cover_art_with_fallback()->setWidth(500)->url(), "show" => ['title' => $this->podcast->title, 'subtitle' => $this->podcast->subtitle, 'summary' => $this->podcast->summary, 'poster' => $this->podcast->cover_art()->setWidth(500)->url(), 'url' => \Podlove\get_landing_page_url()], "license" => ["name" => $license['name'], "url" => $license['url']], "downloads" => $downloads, "duration" => $this->episode->get_duration(), "features" => ["current", "progress", "duration", "tracks", "fullscreen", "volume"], "chapters" => json_decode($this->episode->get_chapters('json')), "languageCode" => $this->podcast->language];
     return $config;
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:7,代码来源:player_config.php

示例14: newautop

function newautop($text)
{
    $newtext = "";
    $pos = 0;
    $tags = array('<!-- noformat on -->', '<!-- noformat off -->');
    $status = 0;
    while (!(($newpos = strpos($text, $tags[$status], $pos)) === FALSE)) {
        $sub = substr($text, $pos, $newpos - $pos);
        if ($status) {
            $newtext .= $sub;
        } else {
            $newtext .= convert_chars(wptexturize(wpautop($sub)));
        }
        //Apply both functions (faster)
        $pos = $newpos + strlen($tags[$status]);
        $status = $status ? 0 : 1;
    }
    $sub = substr($text, $pos, strlen($text) - $pos);
    if ($status) {
        $newtext .= $sub;
    } else {
        $newtext .= convert_chars(wptexturize(wpautop($sub)));
    }
    //Apply both functions (faster)
    //To remove the tags
    $newtext = str_replace($tags[0], "", $newtext);
    $newtext = str_replace($tags[1], "", $newtext);
    return $newtext;
}
开发者ID:Johnhex320,项目名称:hellohealth,代码行数:29,代码来源:wp-no-format.php

示例15: widget_untappd

function widget_untappd()
{
    require_once ABSPATH . 'wp-includes/rss-functions.php';
    $wp_untappd_rss = get_option('untappd_rss');
    $wp_untappd_title = get_option('untappd_title') == '' ? "Beers I'm Drinking" : get_option('untappd_title');
    $wp_untappd_userid = get_option('untappd_userid');
    echo wptexturize('<div id="widget_untappd">');
    echo wptexturize('<div id="widget_untappd_header">' . $wp_untappd_title . '</div>');
    echo wptexturize('<div id="widget_untappd_beer_list">');
    if ($wp_untappd_rss != '') {
        $rss = fetch_rss($wp_untappd_rss);
        if (count($rss->items) != 0) {
            $limit = 5;
            foreach ($rss->items as $item) {
                if ($limit == 0) {
                    break;
                }
                echo wptexturize('<div class="widget_untappd_beer"><a target="_blank" href="' . $item['link'] . '">' . $item['title'] . '</a></div>');
                $limit++;
            }
        } else {
            echo wptexturize('<div class="widget_untappd_beer">What?!?  No beers yet?!?<br /><br /></div>');
        }
    } else {
        echo wptexturize('<div class="widget_untappd_beer">Widget not setup yet<br /><br /></div>');
    }
    echo wptexturize('</div>');
    if ($wp_untappd_userid != '') {
        echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/user/' . $wp_untappd_userid . '">Follow me on Untappd!</a></div>');
    } else {
        echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/">Drink Socially at Untappd!</a></div>');
    }
    echo wptexturize('</div>');
    echo wptexturize('<div id="widget_untappd_logo"><a target="_blank" href="http://untappd.com"><span></span></a></div>');
}
开发者ID:jfaustin,项目名称:Untappd-WP-Widget,代码行数:35,代码来源:untappd.php


注:本文中的wptexturize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。