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


PHP tag::alias方法代码示例

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


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

示例1: COUNT

     if (strpos($current, 'parent:') !== false) {
         $parent = str_replace("parent:", "", $current);
         if (!is_numeric($parent)) {
             $parent = '';
         }
         $query = "SELECT COUNT(*) FROM {$post_table} WHERE id='{$parent}'";
         $result = $db->query($query);
         $row = $result->fetch_assoc();
         if ($row['COUNT(*)'] < 1) {
             $parent = '';
         }
         $current = '';
     }
     if ($current != "") {
         $ttags = $tclass->filter_tags($tags, $current, $ttags);
         $alias = $tclass->alias($current);
         if ($alias !== false) {
             $key_array = array_keys($ttags, $current);
             foreach ($key_array as $key) {
                 $ttags[$key] = $alias;
             }
         }
     }
 }
 $tags = implode(" ", $ttags);
 foreach ($ttags as $current) {
     if ($current != "" && $current != " ") {
         $ttags = $tclass->filter_tags($tags, $current, $ttags);
         if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $misc->windows_filename_fix($current) . "/")) {
             $cache->destroy_page_cache("search_cache/" . $misc->windows_filename_fix($current) . "/");
         } else {
开发者ID:logtcn,项目名称:gelbooru-fork,代码行数:31,代码来源:edit_post.php

示例2: explode

 function prepare_tags($search)
 {
     global $db, $post_table;
     $search = $db->real_escape_string($search);
     $tags = '';
     $aliased_tags = '';
     $original_tags = '';
     $parent = '';
     $ttags = explode(" ", $search);
     $g_rating = '';
     $g_owner = '';
     $g_tags = '';
     $g_parent = '';
     foreach ($ttags as $current) {
         if (strpos(strtolower($current), 'parent:') !== false) {
             $g_parent = str_replace("parent:", "", $current);
             $parent = " AND id='{$g_parent}'";
             if (!is_numeric($g_parent)) {
                 $g_parent = '';
             } else {
                 $g_parent = " AND parent='{$g_parent}'";
             }
             $current = '';
         }
         if ($current != "" && $current != " ") {
             $len = strlen($current);
             $count = substr_count($current, '*', 0, $len);
             if ($len - $count >= 2) {
                 if (strpos(strtolower($current), 'rating:') !== false) {
                     $rating = str_replace('rating:', '', $current);
                     if (substr($current, 0, 1) == "-") {
                         $rating = substr($rating, 1, strlen($rating) - 1);
                         $rating = ucfirst(strtolower($rating));
                         $g_rating .= " AND rating != '{$rating}'";
                     } else {
                         $rating = ucfirst(strtolower($rating));
                         $g_rating .= " AND rating = '{$rating}'";
                     }
                 } else {
                     if (strpos(strtolower($current), 'user:') !== false) {
                         $owner = str_replace('user:', '', $current);
                         if (substr($current, 0, 1) == "-") {
                             $owner = substr($owner, 1, strlen($owner) - 1);
                             $g_owner = " AND owner != '{$owner}'";
                         } else {
                             $g_owner = " AND owner = '{$owner}'";
                         }
                     } else {
                         $tclass = new tag();
                         if (substr($current, 0, 1) == "-") {
                             $current = substr($current, 1, strlen($current) - 1);
                             $wildcard = strpos($current, "*");
                             $alias = $tclass->alias($current);
                             if ($alias !== false) {
                                 if ($wildcard === false) {
                                     $g_tags2 .= " AND tags NOT LIKE '% {$alias} %'";
                                     $g_tags2 .= " AND tags NOT LIKE '% {$current} %'";
                                 } else {
                                     $g_tags2 .= " AND tags NOT LIKE '% {$alias} %'";
                                     $g_tags2 .= " AND tags NOT LIKE '% {$current} %'";
                                 }
                             } else {
                                 if ($wildcard == false) {
                                     $g_tags2 .= " AND tags NOT LIKE '% {$current} %'";
                                 } else {
                                     $g_tags2 .= " AND tags NOT LIKE '% {$current} %'";
                                 }
                             }
                         } else {
                             if (substr($current, 0, 1) == "~") {
                                 $current = substr($current, 1, strlen($current) - 1);
                                 $alias = $tclass->alias($current);
                                 if ($alias !== false) {
                                     $g_tags .= $alias;
                                     $g_tags .= $current;
                                 } else {
                                     $g_tags .= $current;
                                 }
                             } else {
                                 $wildcard = strpos($current, "*");
                                 $alias = $tclass->alias($current);
                                 if ($alias !== false) {
                                     $g_tags .= $alias;
                                 } else {
                                     $g_tags .= str_replace("*", "%", $current);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($g_tags != "") {
         if ($g_parent != "") {
             $parent_patch = "OR tags LIKE '% {$g_tags} %' {$parent} {$g_owner} {$g_rating}";
         } else {
             $parent_patch = " AND parent='0'";
         }
         $query = "SELECT id, image, directory, score, rating, tags, owner FROM {$post_table} WHERE tags LIKE '% {$g_tags} %' {$g_tags2} {$g_parent} {$g_owner} {$g_rating} {$parent_patch} ORDER BY id DESC";
//.........这里部分代码省略.........
开发者ID:logtcn,项目名称:gelbooru-fork,代码行数:101,代码来源:innodb.search.class.php

示例3: tag

 function parse_tag($tag)
 {
     $tclass = new tag();
     if (substr($tag, 0, 1) == "-") {
         $tag = substr($tag, 1, strlen($tag) - 1);
         $wildcard = strpos($tag, "*");
         $alias = $tclass->alias($tag);
         if ($alias !== false) {
             if ($wildcard === false) {
                 return ' -" ' . $alias . ' "' . ' -" ' . $tag . ' "';
             } else {
                 return ' - ' . $alias . ' ' . ' - ' . $tag . ' ';
             }
         } else {
             if ($wildcard == false) {
                 return ' -" ' . $tag . ' "';
             } else {
                 return ' - ' . $tag . ' ';
             }
         }
     } else {
         if (substr($tag, 0, 1) == "~") {
             $tag = substr($tag, 1, strlen($tag) - 1);
             $alias = $tclass->alias($tag);
             if ($alias !== false) {
                 return " {$alias} {$tag}";
             } else {
                 return " {$tag}";
             }
         } else {
             $wildcard = strpos($tag, "*");
             $alias = $tclass->alias($tag);
             if ($alias !== false) {
                 if ($wildcard == false) {
                     return ' +" ' . $alias . ' "';
                 } else {
                     return ' + ' . $alias . ' ';
                 }
             } else {
                 if ($wildcard === false) {
                     return ' +" ' . $tag . ' "';
                 } else {
                     return ' + ' . $tag . ' ';
                 }
             }
         }
     }
 }
开发者ID:logtcn,项目名称:gelbooru-fork,代码行数:48,代码来源:search.class.php


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