删除缓存标签
@access public
@param  string $tag 缓存标签名
@return void
180712
public function clearTag(string $tag): void
    {
        $keys = $this->getTagItems($tag);

        foreach ($keys as $key) {
            $this->unlink($key);
        }

        $this->rm($this->getTagKey($tag));
    }
454986
private function tag_has_name(string $tag){
    return in_array('name', array_values(
      \is_array($this->tags[$tag]) ?
        $this->tags[$tag] :
        $this->tags[$this->tags[$tag]]
    ));
  }
488227
public function taggedAs($tag)
    {
        if (empty($this->current_node)) {
            return;
        }

        $this->current_node->tags = $tag;
        $this->current_node->save();
    }
1294474
public function hasTag($tag)
    {
        // check if all tags exist
        if (is_array($tag)) {
            foreach ($tag as $t) {
                if (!$this->hasTag($t)) {
                    return false;
                }
            }

            return true;
        }

        // check if tag exist
        $a = explode('#', $tag);
        $tag = array_shift($a);
        //$ref = array_shift($a); // unused

        return isset($this->tags[$tag]) || $this->isTopTag($tag);
    }
66184
public function checkTag(Tag $tag)
	{
		if (isset($tag->template) && !($tag->template instanceof UnsafeTemplate))
		{
			$template = (string) $tag->template;
			$this->checkTemplate($template, $tag);
		}
	}
108725
public static function remove(Tag &$Tag)
    {
        if (Config::get('store') == 'global' && isset(self::$_tagStore[$Tag->ID])) {
            unset(self::$_tagStore[$Tag->ID]);
        } elseif (Config::get('store') == 'internal'
            && isset(Config::getHTMLInstance()->tagStore[$Tag->ID])
        ) {
            unset(Config::getHTMLInstance()->tagStore[$Tag->ID]);
        }
    }
1005857
public function purgeTag(string $tag)
    {
        if ($this->useLocalTags) {
             return $this->purgeUrlsByTag($tag);
        }

        return $this->sendRequest('DELETE', 'purge_cache', [
                'tags' => [$tag]
            ]
        );
    }
95155
public function delete($tag)
    {
        $this->clearAll();

        $name = $tag;
        if ($tag instanceof Tag) {
            $name = $tag->getName();
        }

        $this->addCommandName(self::TAG_COMMAND);
        $this->addCommandArgument('-d');
        $this->addCommandSubject($name);

        return $this->getCommand();
    }
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
222883
public function mark($tag = NULL) {
        if (!\PhalApi\DI()->debug) {
            return;
        }

        $backTrace = debug_backtrace();
        if (empty($this->timeline)) {
            array_shift($backTrace);
        }
        // TODO 关于追踪，看下如何追踪更合适

        $this->timeline[] = array(
            'tag' => $tag, 
            'time' => $this->getCurMicroTime(),
            'file' => isset($backTrace[0]['file']) ? $backTrace[0]['file'] : '',
            'line' => isset($backTrace[0]['line']) ? $backTrace[0]['line'] : 0,
        );
    }
523460
public function removeTag($tag)
    {
        if (is_array($tag))
        {
            foreach ($tag as $t)
            {
                if (isset($this->allowed_tags[$t]))
                    unset($this->allowed_tags[$t]);
                $this->remove_tags[$t] = true;
            }
        }
        else
        {
            if (isset($this->allowed_tags[$tag]))
                unset($this->allowed_tags[$tag]);
            $this->remove_tags[$tag] = true;
        }
        return $this;
    }
934674
public function clearTag(string $tag): void
    {
        // 指定标签清除
        $keys = $this->getTagItems($tag);

        $this->handler->deleteMulti($keys);

        $tagName = $this->getTagKey($tag);
        $this->rm($tagName);
    }
160137
public function addTag($tag)
    {
        $tags = $this->getTags();
        array_push($tags, $tag);
        $this->setTags($tags);
    }
1004747
public function tagLoad($tag, $content)
    {
        $file = isset($tag['file']) ? $tag['file'] : $tag['href'];
        $type = isset($tag['type']) ? strtolower($tag['type']) : '';

        $parseStr = '';
        $endStr   = '';

        // 判断是否存在加载条件 允许使用函数判断(默认为isset)
        if (isset($tag['value'])) {
            $name = $tag['value'];
            $name = $this->autoBuildVar($name);
            $name = 'isset(' . $name . ')';
            $parseStr .= '<?php if(' . $name . '): ?>';
            $endStr = '<?php endif; ?>';
        }

        // 文件方式导入
        $array = explode(',', $file);

        foreach ($array as $val) {
            $type = strtolower(substr(strrchr($val, '.'), 1));
            switch ($type) {
                case 'js':
                    $parseStr .= '<script type="text/javascript" src="' . $val . '"></script>';
                    break;
                case 'css':
                    $parseStr .= '<link rel="stylesheet" type="text/css" href="' . $val . '" />';
                    break;
                case 'php':
                    $parseStr .= '<?php include "' . $val . '"; ?>';
                    break;
            }
        }

        return $parseStr . $endStr;
    }
770877
public function removeTag($tag)
    {
        $this->tag = $tag;
        $this->getLogger()->info('Removing tag: ' . $tag . ' from layout ID ' . $this->layoutId);
        $this->doPost('/layout/' . $this->layoutId . '/untag', [
            'tag' => [$tag]
        ]);

        return $this;
    }
952376
public function _imageBtn($tag) {
        $name       = $tag['name'];                //名称
        $value      = $tag['value'];                //文字
        $id         = isset($tag['id'])?$tag['id']:'';                //ID
        $style      = isset($tag['style'])?$tag['style']:'';                //样式名
        $click      = isset($tag['click'])?$tag['click']:'';                //点击
        $type       = empty($tag['type'])?'button':$tag['type'];                //按钮类型

        if(!empty($name)) {
            $parseStr   = '<div class="'.$style.'" ><input type="'.$type.'" id="'.$id.'" name="'.$name.'" value="'.$value.'" onclick="'.$click.'" class="'.$name.' imgButton"></div>';
        }else {
        	$parseStr   = '<div class="'.$style.'" ><input type="'.$type.'" id="'.$id.'"  name="'.$name.'" value="'.$value.'" onclick="'.$click.'" class="button"></div>';
        }

        return $parseStr;
    }
1073833
public function removeByTag($tag)
    {
        $tags = (is_array($tag) ? $tag : array($tag));
        try {
            foreach ($tags as $tag) {
                $this->removeTag($tag);
            }
        } catch (\Exception $e) {
            $this->log('warning', \sprintf('Unable to delete cache for tag(s) %s : %s', \implode(',', $tags), $e->getMessage()));

            return false;
        }

        return true;
    }