本文整理汇总了PHP中ParserOutput::addExternalLink方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::addExternalLink方法的具体用法?PHP ParserOutput::addExternalLink怎么用?PHP ParserOutput::addExternalLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::addExternalLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetExternalLinks
public function testGetExternalLinks()
{
$parserOutput = new ParserOutput();
$parserOutput->addExternalLink('https://foo');
$parserOutput->addExternalLink('https://bar');
$searchDataExtractor = new ParserOutputSearchDataExtractor();
$this->assertEquals(['https://foo', 'https://bar'], $searchDataExtractor->getExternalLinks($parserOutput));
}
示例2: makeImage
//.........这里部分代码省略.........
$height = $parsedWidthParam['height'];
if ($handler->validateParam('height', $height)) {
$params[$type]['height'] = $height;
$validated = true;
}
}
# else no validation -- bug 13436
} else {
if ($type === 'handler') {
# Validate handler parameter
$validated = $handler->validateParam($paramName, $value);
} else {
# Validate internal parameters
switch ($paramName) {
case 'manualthumb':
case 'alt':
case 'class':
# @todo FIXME: Possibly check validity here for
# manualthumb? downstream behavior seems odd with
# missing manual thumbs.
$validated = true;
$value = $this->stripAltText($value, $holders);
break;
case 'link':
$chars = self::EXT_LINK_URL_CLASS;
$prots = $this->mUrlProtocols;
if ($value === '') {
$paramName = 'no-link';
$value = true;
$validated = true;
} elseif (preg_match("/^(?i){$prots}/", $value)) {
if (preg_match("/^((?i){$prots}){$chars}+\$/u", $value, $m)) {
$paramName = 'link-url';
$this->mOutput->addExternalLink($value);
if ($this->mOptions->getExternalLinkTarget()) {
$params[$type]['link-target'] = $this->mOptions->getExternalLinkTarget();
}
$validated = true;
}
} else {
$linkTitle = Title::newFromText($value);
if ($linkTitle) {
$paramName = 'link-title';
$value = $linkTitle;
$this->mOutput->addLink($linkTitle);
$validated = true;
}
}
break;
default:
# Most other things appear to be empty or numeric...
$validated = $value === false || is_numeric(trim($value));
}
}
if ($validated) {
$params[$type][$paramName] = $value;
}
}
}
if (!$validated) {
$caption = $part;
}
}
# Process alignment parameters
if ($params['horizAlign']) {
$params['frame']['align'] = key($params['horizAlign']);