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


PHP Essential_Grid_Base::strip_essential_shortcode方法代码示例

本文整理汇总了PHP中Essential_Grid_Base::strip_essential_shortcode方法的典型用法代码示例。如果您正苦于以下问题:PHP Essential_Grid_Base::strip_essential_shortcode方法的具体用法?PHP Essential_Grid_Base::strip_essential_shortcode怎么用?PHP Essential_Grid_Base::strip_essential_shortcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Essential_Grid_Base的用法示例。


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

示例1: get_post_value

 /**
  * Retrieve the value of post elements
  */
 public function get_post_value($handle, $separator, $function, $meta)
 {
     $base = new Essential_Grid_Base();
     $text = '';
     switch ($handle) {
         //Post elements
         case 'post_id':
             $text = $base->getVar($this->post, 'ID', '');
             break;
         case 'post_url':
             $post_id = $base->getVar($this->post, 'ID', '');
             $text = get_permalink($post_id);
             break;
         case 'title':
             $text = $base->getVar($this->post, 'post_title', '');
             break;
         case 'excerpt':
             $text = trim($base->getVar($this->post, 'post_excerpt'));
             if (empty($text)) {
                 //strip essential grid shortcode here
                 $text = do_shortcode($base->strip_essential_shortcode($base->getVar($this->post, 'post_content')));
                 $text = preg_replace("/<style\\b[^>]*>(.*?)<\\/style>/s", "", $text);
                 $text = preg_replace("/<script\\b[^>]*>(.*?)<\\/script>/s", "", $text);
             }
             $text = strip_tags($text);
             //,"<b><br><br/><i><strong><small>"
             break;
         case 'meta':
             $m = new Essential_Grid_Meta();
             $text = $m->get_meta_value_by_handle($this->post['ID'], $meta);
             break;
         case 'alias':
             $text = $base->getVar($this->post, 'post_name');
             break;
         case 'content':
             $text = apply_filters('the_content', $base->getVar($this->post, 'post_content'));
             break;
         case 'link':
             $text = get_permalink($this->post['ID']);
             break;
         case 'date':
             $postDate = $base->getVar($this->post, "post_date_gmt");
             $text = $base->convert_post_date($postDate);
             break;
         case 'date_modified':
             $dateModified = $base->getVar($this->post, "post_modified");
             $text = $base->convert_post_date($dateModified);
             break;
         case 'author_name':
             $authorID = $base->getVar($this->post, 'post_author');
             $text = get_the_author_meta('display_name', $authorID);
             break;
         case 'num_comments':
             $text = $base->getVar($this->post, 'comment_count');
             break;
         case 'cat_list':
             $use_taxonomies = false;
             $postCatsIDs = $base->getVar($this->post, 'post_category');
             if (empty($postCatsIDs) && isset($this->post['post_type'])) {
                 $postCatsIDs = array();
                 $obj = get_object_taxonomies($this->post['post_type']);
                 if (!empty($obj) && is_array($obj)) {
                     foreach ($obj as $tax) {
                         $use_taxonomies[] = $tax;
                         $new_terms = get_the_terms($this->post['ID'], $tax);
                         if (is_array($new_terms) && !empty($new_terms)) {
                             foreach ($new_terms as $term) {
                                 $postCatsIDs[$term->term_id] = $term->term_id;
                             }
                         }
                     }
                 }
             }
             $text = $base->get_categories_html_list($postCatsIDs, $function, $separator, $use_taxonomies);
             break;
         case 'tag_list':
             $text = $base->get_tags_html_list($this->post['ID'], $separator, $function);
             break;
     }
     return $text;
 }
开发者ID:NgocSon2412,项目名称:website_banhang,代码行数:84,代码来源:item-skin.class.php


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