• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_tag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ungarh_tag_list

/**
 * News child tags
 */
function ungarh_tag_list()
{
    //get all the options that we want to show
    global $wpdb;
    $tagsToShow = $wpdb->get_results("\n    SELECT SUBSTR(option_name,11) as id\n    FROM wp_options\n    WHERE option_name LIKE 'filter_tag%' and option_value = 'on' and length(option_name) > 10");
    $tagLinks = array();
    foreach ($tagsToShow as $tag) {
        $name = get_tag($tag->id);
        $tagLinks['Alla nyheter'] = home_url('/nyheter');
        $tagLinks[$name->name] = get_tag_link($tag->id);
    }
    if (!is_home() || is_tag()) {
        ?>
    <nav class="sub-pages-nav" role="navigation">
      <ul class="nav sub-pages">
        <?php 
        foreach ($tagLinks as $key => $value) {
            echo '<li><a href="' . $value . '">' . $key . '</a></li>';
        }
        ?>
      </ul>
    </nav>
  <?php 
    }
}
开发者ID:ungarh,项目名称:ungarh-tema,代码行数:28,代码来源:theme.php


示例2: upgrade_terms

 function upgrade_terms()
 {
     global $wpdb;
     $table = $wpdb->prefix . $this->terms_table;
     if ($wpdb->get_var("SHOW TABLES LIKE '{$table}'") == $table) {
         if (is_array($this->categories)) {
             foreach ($this->categories as $id => $category) {
                 $object =& get_category($id);
                 if ($object && is_array($category['head'])) {
                     $robots = is_array($category['head']['meta']['robots']) ? serialize($category['head']['meta']['robots']) : '';
                     $query = "INSERT INTO {$table} (term_id, name, taxonomy, title, description, keywords, robots, headline, content) VALUES ('{$id}', '{$object->name}', '{$object->taxonomy}', '" . urldecode($category['head']['title']) . "', '" . urldecode($category['head']['meta']['description']) . "', '" . urldecode($category['head']['meta']['keywords']) . "', '{$robots}', '', '')";
                     $wpdb->query($query);
                 }
             }
         }
         if (is_array($this->tags)) {
             foreach ($this->tags as $id => $tag) {
                 $object =& get_tag($id);
                 if ($object && is_array($tag['head'])) {
                     $robots = is_array($tag['head']['meta']['robots']) ? serialize($tag['head']['meta']['robots']) : '';
                     $query = "INSERT INTO {$table} (term_id, name, taxonomy, title, description, keywords, robots, headline, content) VALUES ('{$id}', '{$object->name}', '{$object->taxonomy}', '" . urldecode($tag['head']['title']) . "', '" . urldecode($tag['head']['meta']['description']) . "', '" . urldecode($tag['head']['meta']['keywords']) . "', '{$robots}', '', '')";
                     $wpdb->query($query);
                 }
             }
         }
     }
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:27,代码来源:options_page.php


示例3: my_rest_prepare_post

function my_rest_prepare_post($data, $post, $request)
{
    $_data = $data->data;
    $thumbnail_id = get_post_thumbnail_id($post->ID);
    $thumbnail = wp_get_attachment_image_src($thumbnail_id);
    $_data['featured_image_thumbnail_url'] = $thumbnail[0];
    $categories = get_categories();
    $_data['all_categories'] = $categories;
    unset($_data['author']);
    unset($_data['comment_status']);
    unset($_data['ping_status']);
    unset($_data['modified']);
    unset($_data['modified_gmt']);
    unset($_data['date_gmt']);
    unset($_data['guid']);
    unset($_data['slug']);
    unset($_data['sticky']);
    $tags_arr = array();
    foreach ($_data['tags'] as $tagID) {
        $tag = get_tag($tagID);
        // add name field to the array
        $tags_arr[] = array('ID' => $tagID, 'name' => $tag->name);
    }
    $_data['tags'] = $tags_arr;
    // assign the new tags array to the JSON field
    $categories_arr = array();
    foreach ($_data['categories'] as $catID) {
        // add name field to the array
        $categories_arr[] = array('ID' => $catID, 'name' => get_cat_name($catID));
    }
    $_data['categories'] = $categories_arr;
    // assign the new tags array to the JSON field
    $data->data = $_data;
    return $data;
}
开发者ID:bgauchan,项目名称:sourgems-wp-theme,代码行数:35,代码来源:functions.php


示例4: getCurrentTagObj

 public static function getCurrentTagObj()
 {
     static $cache = null;
     if ($cache !== null) {
         return $cache;
     }
     $cache = \get_tag(static::getCurrentTagID());
     return $cache;
 }
开发者ID:kmvan,项目名称:poil10n,代码行数:9,代码来源:Api.php


示例5: ls

function ls($arg = 'all')
{
    global $src_dir;
    global $src_url;
    if ($arg != 'all') {
        if (eregi("[1-9]+[0-9]*", $arg)) {
            $number_of_releases = $arg;
        } elseif (substr($arg, 0, 1) == '.') {
            $allowed_extention = $arg;
        }
    }
    $src_array = read_dir($src_dir);
    for ($i = 0; $i < sizeof($src_array); $i++) {
        $_ = explode('.', $src_array[$i]);
        $src_unique[$_[0]] .= $src_array[$i] . "\n";
    }
    $release = array_keys($src_unique);
    if (!isset($number_of_releases)) {
        $number_of_releases = sizeof($release);
    }
    for ($i = 0; $i < $number_of_releases; $i++) {
        $_ = trim($src_unique[$release[$i]]);
        $file = explode("\n", $_);
        for ($j = 0; $j < sizeof($file); $j++) {
            $offset = strlen($release[$i]) - strlen($file[$j]);
            $ext = substr($file[$j], $offset);
            if ($ext == '.xml') {
                // release changes >>
                $changes = trim(get_tag(read_file($src_dir . $file[$j]), 'changes'));
            } else {
                // downloadable files >>
                if (isset($allowed_extention)) {
                    if ($ext == $allowed_extention) {
                        $link[] = '<a href="/get/' . $file[$j] . '">' . $file[$j] . '</a>';
                    }
                } else {
                    $link[] = '<a href="/get/' . $file[$j] . '">' . $file[$j] . '</a>';
                }
            }
        }
        if (sizeof($link) > 0) {
            sort($link);
            reset($link);
            if ($changes != '') {
                $changes = "<p>Changes:</p>\n" . $changes . "\n";
            }
            $ls[] = "<p><strong>" . $release[$i] . "</strong></p>\n" . $changes . "<p>Download:</p>\n<ul>\n<li>" . implode("<br></li>\n<li>", $link) . "<br></li>\n</ul>\n";
        }
        unset($changes);
        unset($link);
    }
    if (sizeof($ls) > 0) {
        $out = "<!-- downloadable files >> -->\n" . implode('', $ls) . "<!-- downloadable files << -->\n";
    }
    return $out;
}
开发者ID:JerkWisdom,项目名称:zpublic,代码行数:56,代码来源:get.php


示例6: parse_xml

function parse_xml($file)
{
    global $xml_tags;
    $in = read_file($file);
    $in = trim($in);
    for ($i = 0; $i < sizeof($xml_tags); $i++) {
        $out[$xml_tags[$i]] = get_tag($in, $xml_tags[$i]);
    }
    return $out;
}
开发者ID:JerkWisdom,项目名称:zpublic,代码行数:10,代码来源:xml.php


示例7: index

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $packages = $this->object->getList(array('type' => 'package', 'with' => array('tag', 'meta')));
     $price_levels = array();
     foreach ($packages['data'] as $package) {
         $price_levels[get_tag($package, '价格档次')] = get_meta($package, '价格');
     }
     $products = $this->object->getList(array('type' => 'product', 'meta' => array('首页推荐' => true), 'with_meta' => true));
     $this->load->view('home', compact('price_levels', 'products'));
 }
开发者ID:srsman,项目名称:89jian,代码行数:25,代码来源:Welcome.php


示例8: index

 /**
  * 产品选项
  */
 function index()
 {
     if (!is_null($this->input->post('next'))) {
         // TODO 应当对次数做验证,这个表单需要验证
         $package = $this->object->fetch($this->input->post('package'));
         //生成订单
         $order_id = $this->object->add(array('type' => 'order', 'name' => $package['name'] . ' (' . get_tag($package, '内容分类') . ' ' . get_tag($package, '价格档次') . ') ' . $this->input->post('次数') . '周', 'meta' => array('套餐' => $package['name'] . ' (' . get_tag($package, '内容分类') . ' ' . get_tag($package, '价格档次') . ')', '内容分类' => get_tag($package, '内容分类'), '价格档次' => get_tag($package, '价格档次'), '次数' => $this->input->post('次数'), '金额' => $this->input->post('次数') * get_meta($package, '价格'), '是否卡片' => $this->input->post('是否卡片'), '首次送货日期' => $this->input->post('首次送货日期')), 'relative' => array('package' => $this->input->post('package'), 'purchaser' => $this->user->session_id)));
         redirect('buy/logistic/' . $order_id);
     }
     $packages = $this->object->getList(array_merge(array('type' => 'package', 'with' => array('tag', 'meta')), $this->input->get('package') ? array('tag' => array('价格档次' => $this->input->get('package'))) : array()));
     $this->load->view('buy/product_option', compact('packages'));
 }
开发者ID:srsman,项目名称:89jian,代码行数:15,代码来源:Buy.php


示例9: get_by_user

function get_by_user($user, $db)
{
    $exercises = array();
    $exercises["data"] = '';
    $exercises["status"] = 'failed';
    $exercises["error_message"] = '';
    if ($db->connect_errno) {
        $exercises["status"] = 'failed';
        $exercises["error_message"] = $db->connect_error;
    } else {
        if ($sql_cmd = $db->prepare("SELECT DISTINCT(e.`id`), e.`title`, e.`content`,\n\t\t\t\t\t\t\t\t\t\t\te.`user_create`, e.`created_time`,\n\t\t\t\t\t\t\t\t\t\t\ted.`rating`, ed.`difficulty`, ed.`view_count`,\n\t\t\t\t\t\t\t\t\t\t\tc.`name`\n\t\t\t\t\t\t\t\t\t FROM `exercise` e\n\t\t\t\t\t\t\t\t\t INNER JOIN `exercise_detail` ed ON ed.`id` = e.`id`\n\t\t\t\t\t\t\t\t\t INNER JOIN `category` c ON c.`id` = e.`cat_id`\n\t\t\t\t\t\t\t\t\t WHERE e.`user_create` = ?\n\t\t\t\t\t\t\t\t\t ORDER BY ed.`view_count`\n\t\t\t\t\t\t\t\t\t LIMIT 10")) {
            $sql_cmd->bind_param("s", $user);
            if ($sql_cmd->execute()) {
                $sql_cmd->bind_result($id, $title, $content, $user_create, $created_time, $rating, $difficulty, $view_count, $cat_name);
                while ($sql_cmd->fetch()) {
                    $exercise = array();
                    $exercise["id"] = $id;
                    $exercise["title"] = $title;
                    $exercise["content"] = $content;
                    $exercise["user_create"] = $user_create;
                    $exercise["created_time"] = $created_time;
                    $exercise["rating"] = $rating;
                    $exercise["difficulty"] = $difficulty;
                    $exercise["view_count"] = $view_count;
                    $exercise["cat_name"] = $cat_name;
                    $exercises["data"][] = $exercise;
                }
            } else {
                $exercises["status"] = 'failed';
                $exercises["error_message"] = $sql_cmd->error;
            }
            $sql_cmd->close();
        } else {
            $exercises["status"] = 'failed';
            $exercises["error_message"] = $db->error;
        }
        get_tag($exercises, $db);
        $exercises["status"] = $exercises["error_message"] == '' ? 'success' : 'failed';
        echo json_encode(utf8ize($exercises['data']), JSON_PRETTY_PRINT);
        // printf("<pre>%s</pre>", $json);
        $db->close();
    }
}
开发者ID:hazemalsaied,项目名称:ExerceraApp,代码行数:43,代码来源:exercise_get_by_userid.php


示例10: test_empty_category__in

 /**
  * @ticket 28099
  * @group taxonomy
  */
 function test_empty_category__in()
 {
     $cat_id = $this->factory->category->create();
     $post_id = $this->factory->post->create();
     wp_set_post_categories($post_id, $cat_id);
     $q1 = get_posts(array('category__in' => array($cat_id)));
     $this->assertNotEmpty($q1);
     $q2 = get_posts(array('category__in' => array()));
     $this->assertNotEmpty($q2);
     $tag = wp_insert_term('woo', 'post_tag');
     $tag_id = $tag['term_id'];
     $slug = get_tag($tag_id)->slug;
     wp_set_post_tags($post_id, $slug);
     $q3 = get_posts(array('tag__in' => array($tag_id)));
     $this->assertNotEmpty($q3);
     $q4 = get_posts(array('tag__in' => array()));
     $this->assertNotEmpty($q4);
     $q5 = get_posts(array('tag_slug__in' => array($slug)));
     $this->assertNotEmpty($q5);
     $q6 = get_posts(array('tag_slug__in' => array()));
     $this->assertNotEmpty($q6);
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:26,代码来源:query.php


示例11: postTagline

 public function postTagline()
 {
     $post = get_post();
     if (get_class($post) !== 'WP_Post') {
         return "";
     }
     $date = apply_filters('the_date', $post->post_date);
     $dateString = date('M j, Y', strtotime($date));
     $author = get_the_author();
     $tags = wp_get_post_tags($post->ID);
     $taglist = "";
     if (count($tags) > 0) {
         $taglist = "| ";
         foreach ($tags as $tag) {
             $tag = get_tag($tag->term_id);
             $l = get_tag_link($tag->term_id);
             $taglink = '<a href=" ' . $l . '">' . $tag->name . '</a>';
             $taglist .= $taglink . " ";
         }
     }
     $val = "<h6>by {$author} | {$dateString} {$taglist}</h6>";
     return $val;
 }
开发者ID:eggmatters,项目名称:monsoon-responsive,代码行数:23,代码来源:ThemeControls.php


示例12: filter_widget

 /**
  * Determine whether the widget should be displayed based on conditions set by the user.
  *
  * @param array $instance The widget settings.
  * @return array Settings to display or bool false to hide.
  */
 public static function filter_widget($instance)
 {
     global $wp_query;
     if (empty($instance['conditions']) || empty($instance['conditions']['rules'])) {
         return $instance;
     }
     // Store the results of all in-page condition lookups so that multiple widgets with
     // the same visibility conditions don't result in duplicate DB queries.
     static $condition_result_cache = array();
     $condition_result = false;
     foreach ($instance['conditions']['rules'] as $rule) {
         $condition_key = self::generate_condition_key($rule);
         if (isset($condition_result_cache[$condition_key])) {
             $condition_result = $condition_result_cache[$condition_key];
         } else {
             switch ($rule['major']) {
                 case 'date':
                     switch ($rule['minor']) {
                         case '':
                             $condition_result = is_date();
                             break;
                         case 'month':
                             $condition_result = is_month();
                             break;
                         case 'day':
                             $condition_result = is_day();
                             break;
                         case 'year':
                             $condition_result = is_year();
                             break;
                     }
                     break;
                 case 'page':
                     // Previously hardcoded post type options.
                     if ('post' == $rule['minor']) {
                         $rule['minor'] = 'post_type-post';
                     } else {
                         if (!$rule['minor']) {
                             $rule['minor'] = 'post_type-page';
                         }
                     }
                     switch ($rule['minor']) {
                         case '404':
                             $condition_result = is_404();
                             break;
                         case 'search':
                             $condition_result = is_search();
                             break;
                         case 'archive':
                             $condition_result = is_archive();
                             break;
                         case 'posts':
                             $condition_result = $wp_query->is_posts_page;
                             break;
                         case 'home':
                             $condition_result = is_home();
                             break;
                         case 'front':
                             if (current_theme_supports('infinite-scroll')) {
                                 $condition_result = is_front_page();
                             } else {
                                 $condition_result = is_front_page() && !is_paged();
                             }
                             break;
                         default:
                             if (substr($rule['minor'], 0, 10) == 'post_type-') {
                                 $condition_result = is_singular(substr($rule['minor'], 10));
                             } elseif ($rule['minor'] == get_option('page_for_posts')) {
                                 // If $rule['minor'] is a page ID which is also the posts page
                                 $condition_result = $wp_query->is_posts_page;
                             } else {
                                 // $rule['minor'] is a page ID
                                 $condition_result = is_page($rule['minor']);
                                 // Check if $rule['minor'] is parent of page ID
                                 if (!$condition_result && isset($rule['has_children']) && $rule['has_children']) {
                                     $condition_result = wp_get_post_parent_id(get_the_ID()) == $rule['minor'];
                                 }
                             }
                             break;
                     }
                     break;
                 case 'tag':
                     if (!$rule['minor'] && is_tag()) {
                         $condition_result = true;
                     } else {
                         $rule['minor'] = self::maybe_get_split_term($rule['minor'], $rule['major']);
                         if (is_singular() && $rule['minor'] && has_tag($rule['minor'])) {
                             $condition_result = true;
                         } else {
                             $tag = get_tag($rule['minor']);
                             if ($tag && !is_wp_error($tag) && is_tag($tag->slug)) {
                                 $condition_result = true;
                             }
                         }
//.........这里部分代码省略.........
开发者ID:originallurch,项目名称:elderfinlayson.com,代码行数:101,代码来源:widget-conditions.php


示例13: Process

 function Process($template)
 {
     global $wp_query;
     if (!$wp_query->post->ID) {
         if (is_tag()) {
             // get the tag if there appears to be no post and it's a tag page
             $xxx = get_tag($wp_query->query_vars['tag_id']);
         } else {
             //Check if the the category is really empty or not then redirect the user to error pages
             // if it's a category, check if the category has posts in it...
             if (is_category()) {
                 $cat = $GLOBALS['wp_query']->query_vars['cat'];
                 if ($cat) {
                     $args = array('category' => $cat);
                     $cat_posts = get_posts($args);
                     //get the posts for the category
                     if (empty($cat_posts)) {
                         //if its empty, lets check if the category is really empty or WishList Member hides it
                         $cat = get_category($cat);
                         if ($cat->count > 0) {
                             //if theres a post in this cat, redirect to non member page
                             $redirect = is_user_logged_in() ? $this->WrongLevelURL() : $this->NonMembersURL();
                             header("Location:" . $redirect);
                             exit;
                         }
                     }
                 }
             }
             // return $template if there's no post
             return $template;
         }
         if ($xxx->count) {
             // we really have at least a post in this tag but it's being hidden
             // so we redirect to the correct error page
             $redirect = is_user_logged_in() ? $this->WrongLevelURL() : $this->NonMembersURL();
             // and redirect
             header("Location:" . $redirect);
             exit;
         }
         // return $template if there's no post and it's not a tag page
         return $template;
     }
     // just return the template if it's a tag page
     if (is_tag()) {
         return $template;
     }
     // get current user
     $wpm_current_user = wp_get_current_user();
     // give everything is user is admin
     if ($wpm_current_user->caps['administrator']) {
         return $template;
     }
     // Construct Full Request URL
     $wpm_request_url = $this->RequestURL();
     // get all levels
     $wpm_levels = (array) $this->GetOption('wpm_levels');
     // check if the requested URL is a special URL
     $specialurl = false;
     $regurl = get_bloginfo('url') . '/register/';
     foreach ((array) $wpm_levels as $wpml) {
         $specialurl = $specialurl | (bool) ($regurl . $wpml['url'] == $wpm_request_url);
     }
     if ($specialurl) {
         return $template;
     }
     // process attachments
     if (is_attachment()) {
         $aid = $wp_query->query_vars['attachment_id'];
         if (!$aid && $wp_query->post->post_type == 'attachment') {
             $aid = $wp_query->post->ID;
         }
         $attachment = get_post($aid);
         // no parent post? return template as-is
         if (!$attachment->post_parent) {
             return $template;
         }
         // we clone the protection information from the parent
         $type = get_post_type($attachment->post_parent) == 'page' ? 'pages' : 'posts';
         $this->CloneProtection($attachment->post_parent, $aid, $type, 'posts');
     }
     // process pages and posts
     if (is_page() or is_single()) {
         /* page/post becomes protected if a more tag is located and wpm_protect_after_more==1 */
         if ($this->GetOption('protect_after_more') && strpos($wp_query->post->post_content, '<!--more-->') !== false) {
             $protectmore = true;
         } else {
             $protectmore = false;
         }
         // is page or post protected?
         $protect = $protectmore || $this->Protect($wp_query->post->ID);
         /*
          // post is protected if category is protected
          $cats=wp_get_post_categories($wp_query->post->ID);
          $protectcat=false;
          foreach((array)$cats AS $cat) $protectcat=$protectcat|$this->CatProtected($cat);
         */
         // page / post not protected so give them all
         if (!$protect) {
             return $template;
         }
//.........这里部分代码省略.........
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:101,代码来源:wpm.php


示例14: feed_links_extra

/**
 * Display the links to the extra feeds such as category feeds.
 *
 * @since 2.8.0
 *
 * @param array $args Optional arguments.
 */
function feed_links_extra($args)
{
    $defaults = array('separator' => _x('&raquo;', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'));
    $args = wp_parse_args($args, $defaults);
    if (is_single() || is_page()) {
        $post =& get_post($id = 0);
        if (comments_open() || pings_open() || $post->comment_count > 0) {
            $title = esc_attr(sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html(get_the_title())));
            $href = get_post_comments_feed_link($post->ID);
        }
    } elseif (is_category()) {
        $cat_id = intval(get_query_var('cat'));
        $title = esc_attr(sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name($cat_id)));
        $href = get_category_feed_link($cat_id);
    } elseif (is_tag()) {
        $tag_id = intval(get_query_var('tag_id'));
        $tag = get_tag($tag_id);
        $title = esc_attr(sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name));
        $href = get_tag_feed_link($tag_id);
    } elseif (is_author()) {
        $author_id = intval(get_query_var('author'));
        $title = esc_attr(sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id)));
        $href = get_author_feed_link($author_id);
    } elseif (is_search()) {
        $title = esc_attr(sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query()));
        $href = get_search_feed_link();
    }
    if (isset($title) && isset($href)) {
        echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . $title . '" href="' . $href . '" />' . "\n";
    }
}
开发者ID:hoonio,项目名称:wordpress,代码行数:38,代码来源:general-template+backup.php


示例15: unserialize

                ?>
</td>
                                            <td><?php 
                echo $v->theme_name;
                ?>
</td>
                                            <td><?php 
                echo $v->subtheme_name;
                ?>
</td>
                                            <td><?php 
                $tags = unserialize($v->tag);
                $array = array();
                if (!empty($tags)) {
                    foreach ($tags as $t) {
                        $array[] = get_tag($t);
                    }
                    echo implode(', ', $array);
                } else {
                    echo "";
                }
                ?>
</td>
                                            <td><?php 
                $tags_items = unserialize($v->tag_item);
                $array = array();
                if (!empty($tags_items)) {
                    foreach ($tags_items as $t) {
                        $array[] = get_tag_item($t);
                    }
                    echo implode(', ', $array);
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:31,代码来源:view_print_sow.php


示例16: buildWhereClause


//.........这里部分代码省略.........
             if (!empty($customTerms)) {
                 $wcct_0 = '';
                 $wcxct_0 = '';
                 $wcct .= " AND IF(sa.view_type < 2 AND sa.ad_custom_tax_terms AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE),";
                 $wcxct .= " AND IF(sa.view_type < 2 AND sa.x_ad_custom_tax_terms AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE),";
                 foreach ($customTerms as $cTerm) {
                     if (empty($wcct_0)) {
                         $wcct_0 = " FIND_IN_SET(\"{$cTerm}\", sa.view_custom_tax_terms)";
                     } else {
                         $wcct_0 .= " OR FIND_IN_SET(\"{$cTerm}\", sa.view_custom_tax_terms)";
                     }
                     if (empty($wcxct_0)) {
                         $wcxct_0 = " (NOT FIND_IN_SET(\"{$cTerm}\", sa.x_view_custom_tax_terms))";
                     } else {
                         $wcxct_0 .= " AND (NOT FIND_IN_SET(\"{$cTerm}\", sa.x_view_custom_tax_terms))";
                     }
                 }
                 $wcct .= $wcct_0 . ", TRUE)";
                 $wcxct .= $wcxct_0 . ", TRUE)";
             }
             $wci = " OR (sa.view_type = 2 AND FIND_IN_SET({$postID}, sa.view_id))";
             $wcx = " AND IF(sa.x_id, NOT FIND_IN_SET({$postID}, sa.x_view_id), TRUE)";
             $author = get_userdata($post->post_author);
             $wca = " AND IF(sa.view_type < 2 AND sa.ad_authors AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET(\"{$author->user_nicename}\", sa.view_authors), TRUE)";
             $wcxa = " AND IF(sa.view_type < 2 AND sa.x_authors AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET(\"{$author->user_nicename}\", sa.x_view_authors), TRUE)";
         }
         if (is_page()) {
             global $post;
             $postID = !empty($post->ID) ? $post->ID : 0;
             $viewPages |= SAM_IS_PAGE;
             $wci = " OR (sa.view_type = 2 AND FIND_IN_SET({$postID}, sa.view_id))";
             $wcx = " AND IF(sa.x_id, NOT FIND_IN_SET({$postID}, sa.x_view_id), TRUE)";
         }
         if (is_attachment()) {
             $viewPages |= SAM_IS_ATTACHMENT;
         }
     }
     if (is_search()) {
         $viewPages |= SAM_IS_SEARCH;
     }
     if (is_404()) {
         $viewPages |= SAM_IS_404;
     }
     if (is_archive()) {
         $viewPages |= SAM_IS_ARCHIVE;
         if (is_tax()) {
             $viewPages |= SAM_IS_TAX;
             $term = get_query_var('term');
             $wcct = " AND IF(sa.view_type < 2 AND sa.ad_custom_tax_terms AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET('{$term}', sa.view_custom_tax_terms), TRUE)";
             $wcxct = " AND IF(sa.view_type < 2 AND sa.x_ad_custom_tax_terms AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET('{$term}', sa.x_view_custom_tax_terms), TRUE)";
         }
         if (is_category()) {
             $viewPages |= SAM_IS_CATEGORY;
             $cat = get_category(get_query_var('cat'), false);
             $wcc = " AND IF(sa.view_type < 2 AND sa.ad_cats AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET(\"{$cat->category_nicename}\", sa.view_cats), TRUE)";
             $wcxc = " AND IF(sa.view_type < 2 AND sa.x_cats AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET(\"{$cat->category_nicename}\", sa.x_view_cats), TRUE)";
         }
         if (is_tag()) {
             $viewPages |= SAM_IS_TAG;
             $tag = get_tag(get_query_var('tag_id'));
             $wct = " AND IF(sa.view_type < 2 AND sa.ad_tags AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET('{$tag->slug}', sa.view_tags), TRUE)";
             $wcxt = " AND IF(sa.view_type < 2 AND sa.x_tags AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET('{$tag->slug}', sa.x_view_tags), TRUE)";
         }
         if (is_author()) {
             global $wp_query;
             $viewPages |= SAM_IS_AUTHOR;
             $author = $wp_query->get_queried_object();
             $wca = " AND IF(sa.view_type < 2 AND sa.ad_authors = 1 AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET('{$author->user_nicename}', sa.view_authors), TRUE)";
             $wcxa = " AND IF(sa.view_type < 2 AND sa.x_authors AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET('{$author->user_nicename}', sa.x_view_authors), TRUE)";
         }
         if (is_post_type_archive()) {
             $viewPages |= SAM_IS_POST_TYPE_ARCHIVE;
             //$postType = post_type_archive_title( '', false );
             $postType = get_post_type();
             $wct = " AND IF(sa.view_type < 2 AND sa.ad_custom AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), FIND_IN_SET('{$postType}', sa.view_custom), TRUE)";
             $wcxt = " AND IF(sa.view_type < 2 AND sa.x_custom AND IF(sa.view_type = 0, sa.view_pages+0 & {$viewPages}, TRUE), NOT FIND_IN_SET('{$postType}', sa.x_view_custom), TRUE)";
         }
         if (is_date()) {
             $viewPages |= SAM_IS_DATE;
         }
     }
     if (empty($wcc)) {
         $wcc = " AND (sa.ad_cats = 0)";
     }
     if (empty($wca)) {
         $wca = " AND (sa.ad_authors = 0)";
     }
     $whereClause = "{$wcu} ((sa.view_type = 1)";
     $whereClause .= " OR (sa.view_type = 0 AND (sa.view_pages+0 & {$viewPages}))";
     $whereClause .= "{$wci})";
     $whereClause .= "{$wcc} {$wca} {$wct} {$wcct} {$wcx} {$wcxc} {$wcxa} {$wcxt} {$wcxct}";
     $hits = "SELECT IFNULL(COUNT(*), 0) FROM {$sTable} ss WHERE ss.id = sa.id AND ss.event_type = 0";
     $clicks = "SELECT IFNULL(COUNT(*), 0) FROM {$sTable} ss WHERE ss.id = sa.id AND ss.event_type = 1";
     $whereClauseT = " AND IF(sa.ad_schedule, CURDATE() BETWEEN sa.ad_start_date AND sa.ad_end_date, TRUE)";
     $whereClauseT .= " AND IF(sa.limit_hits, sa.hits_limit > ({$hits}), TRUE)";
     $whereClauseT .= " AND IF(sa.limit_clicks, sa.clicks_limit > ({$clicks}), TRUE)";
     $whereClauseW = " AND IF(sa.ad_weight > 0, (sa.ad_weight_hits*10/(sa.ad_weight*{$cycle})) < 1, FALSE)";
     $whereClause2W = "AND (sa.ad_weight > 0)";
     return array('WC' => $whereClause, 'WCT' => $whereClauseT, 'WCW' => $whereClauseW, 'WC2W' => $whereClause2W);
 }
开发者ID:gitter-badger,项目名称:KVSun,代码行数:101,代码来源:sam.class.php


示例17: get_bread_crumb_array

 private function get_bread_crumb_array($args)
 {
     global $post;
     $bread_crumb_arr = array();
     $bread_crumb_arr[] = array('title' => $args['home_label'], 'link' => get_bloginfo('url') . '/');
     $bread_crumb_arr = $this->add_posts_page_array($bread_crumb_arr);
     if (is_404()) {
         $bread_crumb_arr[] = array('title' => $args['404_label'], 'link' => false);
     } elseif (is_search()) {
         $bread_crumb_arr[] = array('title' => sprintf($args['search_label'], get_search_query()), 'link' => false);
     } elseif (is_tax()) {
         $taxonomy = get_query_var('taxonomy');
         if ($this->site_structure['post']['page'] != 0) {
             // TODO 投稿タイプの判別
             $parent_page = get_post($this->site_structure['post']['page']);
             $singular_bread_crumb_arr = $this->get_singular_bread_crumb_array($parent_page, $args);
             $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         }
         $term = get_term_by('slug', get_query_var('term'), $taxonomy);
         if (is_taxonomy_hierarchical($taxonomy) && $term->parent != 0) {
             $ancestors = array_reverse(get_ancestors($term->term_id, $taxonomy));
             foreach ($ancestors as $ancestor_id) {
                 $ancestor = get_term($ancestor_id, $taxonomy);
                 $bread_crumb_arr[] = array('title' => $ancestor->name, 'link' => get_term_link($ancestor, $term->slug));
             }
         }
         $bread_crumb_arr[] = array('title' => sprintf($args['taxonomy_label'], $term->name), 'link' => get_term_link($term->term_id, $term->slug));
     } elseif (is_attachment()) {
         if ($post->post_parent) {
             if ($parent_post = get_post($post->post_parent)) {
                 $singular_bread_crumb_arr = $this->get_singular_bread_crumb_array($parent_post, $args);
                 $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
             }
         }
         $bread_crumb_arr[] = array('title' => sprintf($args['attachment_label'], $post->post_title), 'link' => get_permalink($post->ID));
     } elseif (is_singular() && !is_front_page()) {
         $singular_bread_crumb_arr = $this->get_singular_bread_crumb_array($post, $args);
         $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         $bread_crumb_arr[] = array('title' => $post->post_title, 'link' => get_permalink($post->ID));
     } elseif (is_category()) {
         global $cat;
         if ($this->site_structure['post']['page'] != 0) {
             $singular_bread_crumb_arr = $this->get_parent_page_array('post', $args);
             $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         }
         $category = get_category($cat);
         if ($category->parent != 0) {
             $ancestors = array_reverse(get_ancestors($category->term_id, 'category'));
             foreach ($ancestors as $ancestor_id) {
                 $ancestor = get_category($ancestor_id);
                 $bread_crumb_arr[] = array('title' => $ancestor->name, 'link' => get_category_link($ancestor->term_id));
             }
         }
         $bread_crumb_arr[] = array('title' => sprintf($args['category_label'], $category->name), 'link' => get_category_link($cat));
     } elseif (is_tag()) {
         global $tag_id;
         if ($this->site_structure['post']['page'] != 0) {
             $singular_bread_crumb_arr = $this->get_parent_page_array('post', $args);
             $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         }
         $tag = get_tag($tag_id);
         $bread_crumb_arr[] = array('title' => sprintf($args['tag_label'], $tag->name), 'link' => get_tag_link($tag_id));
     } elseif (is_author()) {
         $author = get_query_var('author');
         $bread_crumb_arr[] = array('title' => sprintf($args['author_label'], get_the_author_meta('display_name', get_query_var('author'))), 'link' => get_author_posts_url($author));
     } elseif (is_day()) {
         $post_type = get_query_var('post_type') ? get_query_var('post_type') : 'post';
         if (isset($this->site_structure[$post_type]['page']) && $this->site_structure[$post_type]['page'] != 0) {
             $singular_bread_crumb_arr = $this->get_parent_page_array($post_type, $args);
             $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         }
         if ($m = get_query_var('m')) {
             $year = substr($m, 0, 4);
             $month = substr($m, 4, 2);
             $day = substr($m, 6, 2);
         } else {
             $year = get_query_var('year');
             $month = get_query_var('monthnum');
             $day = get_query_var('day');
         }
         $month_title = $this->get_month_title($month);
         $bread_crumb_arr[] = array('title' => sprintf($args['year_label'], $year), 'link' => get_year_link($year));
         $bread_crumb_arr[] = array('title' => sprintf($args['month_label'], $month_title), 'link' => get_month_link($year, $month));
         $bread_crumb_arr[] = array('title' => sprintf($args['day_label'], $day), 'link' => get_day_link($year, $month, $day));
     } elseif (is_month()) {
         $post_type = get_query_var('post_type') ? get_query_var('post_type') : 'post';
         if (isset($this->site_structure[$post_type]['page']) && $this->site_structure[$post_type]['page'] != 0) {
             $singular_bread_crumb_arr = $this->get_parent_page_array($post_type, $args);
             $bread_crumb_arr = array_merge($bread_crumb_arr, $singular_bread_crumb_arr);
         }
         if ($m = get_query_var('m')) {
             $year = substr($m, 0, 4);
             $month = substr($m, 4, 2);
         } else {
             $year = get_query_var('year');
             $month = get_query_var('monthnum');
         }
         $month_title = $this->get_month_title($month);
         $bread_crumb_arr[] = array('title' => sprintf($args['year_label'], $year), 'link' => get_year_link($year));
         $bread_crumb_arr[] = array('title' => sprintf($args['month_label'], $month_title), 'link' => get_month_link($year, $month));
//.........这里部分代码省略.........
开发者ID:nobu222,项目名称:Wordpress1DayTraning,代码行数:101,代码来源:bread-crumb.php


示例18: query_selected_taxonomies

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_tag_feed_link函数代码示例发布时间:2022-05-15
下一篇:
PHP get_tabs函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap