2018-12-18
@used-by \Dfe\Vantiv\API\Client::_construct()
@param string $tag
@param array(string => mixed) $p [optional]
438502
final protected function reqXml($tag, array $p = []) {$this->addFilterReq(
		function(array $a) use($tag, $p) {return df_xml_g($tag, $a, $p);}
	);}
757334
public function addTag(Tag $tag)
    {
        $tag->setBlog($this);
        $this->tags->add($tag);

        return $tag;
    }
251088
protected function checkNode(DOMNode $node, Tag $tag)
	{
		if ($node instanceof DOMAttr)
		{
			$this->checkAttributeNode($node, $tag);
		}
		elseif ($node instanceof DOMElement)
		{
			if ($node->namespaceURI === self::XMLNS_XSL && $node->localName === 'copy-of')
			{
				$this->checkCopyOfNode($node, $tag);
			}
			else
			{
				$this->checkElementNode($node, $tag);
			}
		}
	}
536866
private static void appendTag(String tag, StringBuilder buffer) {
        if (buffer.length() != 0) {
            buffer.append(UNDERSCORE);
        }

        buffer.append(tag);
    }
99086
public function addTag($id, $tag, $fromAdminId = null, $botName = 'Bot', $randomId = 0)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$tag) {
            throw new InvalidArgumentException;
        }

        $tag = str_replace(',', '', $tag);

        $params = [
            'action' => 'add',
            'tag' => $tag
        ];

        $fromAdminId = (int)$fromAdminId;
        if ($fromAdminId) {
            $params['from_admin'] = $fromAdminId;
        } else {
            $params['bot_name'] = $botName;
        }

        $randomId = (int)$randomId;
        if ($randomId) {
            $params['random_id'] = $randomId;
        }

        $res = $this->call('conversations/' . $id . '/tag', $params, 'post');

        if ($res) {
            return true;
        }

        return false;
    }
1215211
public static function listen($tag, $params = null, $extra = null)
    {
        $result = true;

        if (isset(self::$tags[$tag])) {
            foreach (self::$tags[$tag] as $behaviors) {
                $result = self::exec($behaviors, $params, $extra);

                if ($result === false) {
                    return $result;
                }
            }
        }

        return $result;
    }
728608
private static function buildHtml(&$html, $tag_object, $options, $tab = 0)
    {
        self::checkBuildOptions($options);

        $tag_is_special = in_array($tag_object->getTag(), self::$special_tags);
        $tag_is_ignored = in_array($tag_object->getTag(), array_get($options, 'ignore_tags', []));

        $ignore_tag = true;
        if (!isset($options['ignore_tags']) || !$tag_is_ignored) {
            $ignore_tag = false;
        } elseif (isset($options['ignore_tags']) && $tag_is_ignored) {
            $tab--;
        }

        $pad = '';
        if ($tab > 0) {
            $pad = str_pad($pad, $tab * 2, ' ', STR_PAD_LEFT);
        }

        if (!$ignore_tag) {
            if ($tag_is_special) {
                $html .= $pad.trim((string) $tag_object)."\n";
            } elseif (!$tag_is_special) {
                $html .= $pad;
                $html .= '<'.$tag_object->tag.''.self::buildHtmlAttribute($tag_object->getAttributes()).'>';
                $html .= ($tag_object->use_whitespace) ? "\n" : '';
                if (strlen($tag_object->getText())) {
                    $html .= ($tag_object->use_whitespace) ? $pad.'  ' : '';
                    $html .= $tag_object->getText();
                }
                $html .= ($tag_object->use_whitespace && strlen($tag_object->getText())) ? "\n" : '';
            }
        }

        if (!$tag_is_special && $tag_object->hasChildNodes()) {
            foreach ($tag_object->getChildNodes() as $child_tag_object) {
                self::buildHtml($html, $child_tag_object, $options, $tab + 1);
            }
        }

        $pad = '';
        if ($tab > 0) {
            $pad = str_pad($pad, $tab * 2, ' ', STR_PAD_LEFT);
        }

        if (!$ignore_tag && !$tag_is_special) {
            $html .= ($tag_object->use_whitespace) ? $pad : '';
            $html .= '</'.$tag_object->tag.'>'."\n";
        }
    }
663563
public function scopeWithTag($query, $tag)
    {
        $tag = Tag::where('tag', $tag)->first();

        return $query->whereHas('tagged', function($q) use($tag) {
                            $q->where('tag_id', $tag->id);
                        });
    }
1307830
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setTag(final String tag) {
        pathBuilder.setTag(tag);
        return (T) this;
    }
66184
public function checkTag(Tag $tag)
	{
		if (isset($tag->template) && !($tag->template instanceof UnsafeTemplate))
		{
			$template = (string) $tag->template;
			$this->checkTemplate($template, $tag);
		}
	}
829854
public function addTag(Tag $tag)
    {
        if (!$this->tags->contains($tag)) {
            $this->tags->add($tag);
            return true;
        }
        return false;
    }
985278
public static function addDefaultAttributes(Tag &$Tag)
    {
        if (isset(TagInfo::$defaultAttributes[$Tag->name])) {
            $Tag->attributes = array_merge(
                TagInfo::$defaultAttributes[$Tag->name],
                $Tag->attributes
            );
        }
    }
676822
protected function checkExpression(DOMNode $node, $expr, Tag $tag)
	{
		$this->checkContext($node);

		if (preg_match('/^\\$(\\w+)$/', $expr, $m))
		{
			// Either this expression came from a variable that is considered safe, or it's a
			// stylesheet parameters, which are considered safe by default
			$this->checkVariable($node, $tag, $m[1]);
		}
		elseif (preg_match('/^@[-\\w]+(?:\\s*\\|\\s*@[-\\w]+)*$/', $expr))
		{
			$this->checkAttributeExpression($node, $tag, $expr);
		}
		elseif (!$this->isExpressionSafe($expr))
		{
			throw new UnsafeTemplateException("Cannot assess the safety of expression '" . $expr . "'", $node);
		}
	}
653863
protected function reserveTag($content, $tag)
    {
        if (stripos($content, '<' . $tag) !== false) {

            if (in_array(strtolower($tag), array('img'))) {
                $pattern = '~(<' . preg_quote($tag, '~') . '[^>]+\>)~i';
            } else {
                $pattern = '~(<' . preg_quote($tag, '~') . '\\b[^>]*?>[\\s\\S]*?<\\/' . preg_quote($tag, '~') . '>)~i';
            }

            return preg_replace_callback($pattern, array($this, 'placeHolder'), $content);
        }

        return $content;
    }
264756
public static function wrapOnDemand($condition, $tag, $content)
    {
        if ($condition) {
            echo sprintf('<%s>%s</%s>', $tag, $content, $tag);
        } else {
            echo $content;
        }
    }
4483
public function tag($tag, $attr = null, $content = null, $close = false)
    {
        $tag = strtolower($tag);

        if (! empty($attr) && is_array($attr)) {
            $attr = $this->Attr->attr($attr);
        }

        if ($close) {
            return sprintf('<%s%s>%s</%1$s>', $tag, $attr, $content);
        } else {
            return sprintf('<%s%s>', $tag, $attr);
        }
    }
488227
public function taggedAs($tag)
    {
        if (empty($this->current_node)) {
            return;
        }

        $this->current_node->tags = $tag;
        $this->current_node->save();
    }