Check if tag is trusted.

@param  string $tag_name
@param  object $compiler compiler object

@return boolean                 true if tag is trusted
@throws SmartyCompilerException if modifier is not trusted
512594
public function isTrustedTag($tag_name, $compiler)
    {
        // check for internal always required tags
        if (in_array($tag_name, array('assign', 'call', 'private_filter', 'private_block_plugin',
                                      'private_function_plugin', 'private_object_block_function',
                                      'private_object_function', 'private_registered_function',
                                      'private_registered_block', 'private_special_variable',
                                      'private_print_expression', 'private_modifier'))) {
            return true;
        }
        // check security settings
        if (empty($this->allowed_tags)) {
            if (empty($this->disabled_tags) || !in_array($tag_name, $this->disabled_tags)) {
                return true;
            } else {
                $compiler->trigger_template_error("tag '{$tag_name}' disabled by security setting", null, true);
            }
        } elseif (in_array($tag_name, $this->allowed_tags) && !in_array($tag_name, $this->disabled_tags)) {
            return true;
        } else {
            $compiler->trigger_template_error("tag '{$tag_name}' not allowed by security setting", null, true);
        }

        return false; // should not, but who knows what happens to the compiler in the future?
    }
1236767
public function isTrustedSpecialSmartyVar($var_name, $compiler)
    {
        if (!in_array($var_name, $this->disabled_special_smarty_vars)) {
            return true;
        } else {
            $compiler->trigger_template_error("special variable '\$smarty.{$var_name}' not allowed by security setting", null, true);
        }

        return false; // should not, but who knows what happens to the compiler in the future?
    }
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]]
    ));
  }
948638
public static function hasName( $name, $module_id = null ): bool
	{
		if( !self::isValidName($name) )
		{
			return false;
		}

		$builder = \DB::table("events")->where("name", $name);
		if( is_numeric($module_id) )
		{
			$builder->where("module_id", (int) $module_id );
		}

		return $builder->count(["id"]) > 0;
	}
1004508
public function compile($args, $compiler)
    {
        $_attr = $this->getAttributes($compiler, $args);
        // reset variable filter to previous state
        if (count($compiler->variable_filter_stack)) {
            $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);
        } else {
            $compiler->template->variable_filters = array();
        }
        // this tag does not return compiled code
        $compiler->has_code = false;

        return true;
    }
1346487
boolean checkTag(long bucketIndex, int posInBucket, long tag) {
		long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
		final int bityPerTag = bitsPerTag;
		for (long i = 0; i < bityPerTag; i++) {
			if (memBlock.get(i + tagStartIdx) != ((tag & (1L << i)) != 0))
				return false;
		}
		return true;
	}
824587
def untag(name, tag_name):
    

    with LOCK:
        by_tag = TAGS.get(tag_name, None)
        if not by_tag:
            return False
        try:
            by_tag.remove(name)

            # remove the tag if no associations left
            if not by_tag:
                TAGS.pop(tag_name)

            return True
        except KeyError:
            return False
203810
public function isTrustedStream($stream_name)
    {
        if (isset($this->streams) && (empty($this->streams) || in_array($stream_name, $this->streams))) {
            return true;
        }

        throw new SmartyException("stream '{$stream_name}' not allowed by security setting");
    }
51104
public function check(DOMElement $template, Tag $tag)
	{
		$node = $template->getElementsByTagNameNS($this->namespaceURI, $this->elName)->item(0);

		if ($node)
		{
			throw new UnsafeTemplateException("Element '" . $node->nodeName . "' is disallowed", $node);
		}
	}
809857
public function check(DOMElement $template, Tag $tag)
	{
		$nodes = $template->getElementsByTagNameNS(self::XMLNS_XSL, 'element');
		foreach ($nodes as $node)
		{
			if (strpos($node->getAttribute('name'), '{') !== false)
			{
				throw new UnsafeTemplateException('Dynamic <xsl:element/> names are disallowed', $node);
			}
		}
	}
510367
public function check($provided, $name)
    {
        $provided = bindec($provided);
        return (bool)($provided & $this->getRight($name));
    }
794860
private boolean hasModifierNamed( String modifierName ) {
        for (ModifierMetadata modifier : modifiers) {
            if (modifierName.equalsIgnoreCase(modifier.getName())) {
                return true;
            }
        }

        return false;

    }
1105025
public function checkVarName($var_name)
    {
        if (empty($var_name)) {
            return;
        }
        if (array_key_exists($var_name, $this->var_blocks)) {
            $this->logger->warning("Found duplicate definition for $var_name.");
        }
    }
1114586
public function scopeByTagNames($query, $tag_names)
	{
		$normalize_tag_names = [];
		foreach ($tag_names as $tag_name) {
			// mormalize string
			$normalize_tag_names[] = app(TaggingUtility::class)->normalizeTagName(trim($tag_name));
		}
		return $query->whereIn('name', $normalize_tag_names);
	}
75868
private function getValue($tag_name) {
		return is_null($this->tag) ? $this->empty : $this->tag->getChildValue($tag_name);
	}
356106
protected function determineTagSupport()
    {
        // Laravel >= 5.1.28
        if (method_exists($this->cache, 'tags') || $this->cache instanceof PsrCacheInterface) {
            try {
                // Attempt the repository tags command, which throws exceptions when unsupported
                $this->cache->tags($this->tag);
                $this->supportsTags = true;
            } catch (BadMethodCallException $ex) {
                $this->supportsTags = false;
            }
        } else {
            // Laravel <= 5.1.27
            if (method_exists($this->cache, 'getStore')) {
                // Check for the tags function directly on the store
                $this->supportsTags = method_exists($this->cache->getStore(), 'tags');
            } else {
                // Must be using custom cache repository without getStore(), and all bets are off,
                // or we are mocking the cache contract (in testing), which will not create a getStore method
                $this->supportsTags = false;
            }
        }
    }
22136
public static function compile(Compiler $compiler, $value, $addspace = true, $allowable_tags = null)
    {
        if ($addspace === 'true') {
            if ("null" == $allowable_tags) {
                return "preg_replace('#<[^>]*>#', ' ', $value)";
            }

            return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
        }

        return "strip_tags($value, $allowable_tags)";
    }