本文整理汇总了PHP中str::isURL方法的典型用法代码示例。如果您正苦于以下问题:PHP str::isURL方法的具体用法?PHP str::isURL怎么用?PHP str::isURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str
的用法示例。
在下文中一共展示了str::isURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
$figure->append('<figcaption>' . html($caption) . '</figcaption>');
}
return $figure;
} else {
$class = trim($tag->attr('class') . ' ' . $tag->attr('imgclass'));
return $_link($_image($class));
}
});
// link tag
kirbytext::$tags['link'] = array('attr' => array('text', 'class', 'title', 'rel', 'target', 'popup'), 'html' => function ($tag) {
$link = url($tag->attr('link'));
$text = $tag->attr('text');
if (empty($text)) {
$text = escape::attr($link);
} else {
if (str::isURL($text)) {
$text = escape::attr($text);
}
}
return html::a($link, $text, array('rel' => $tag->attr('rel'), 'class' => $tag->attr('class'), 'title' => $tag->attr('title'), 'target' => $tag->target()));
});
// tel tag
kirbytext::$tags['tel'] = array('attr' => array('text', 'class', 'title'), 'html' => function ($tag) {
$text = $tag->attr('text');
$tel = str_replace(array('/', ' ', '-'), '', $tag->attr('tel'));
if (empty($text)) {
$text = $tag->attr('tel');
}
return html::a('tel:' . $tel, html($text), array('rel' => $tag->attr('rel'), 'class' => $tag->attr('class'), 'title' => html($tag->attr('title'))));
});
// twitter tag
示例2: array
<?php
// override to target="_blank" if external link
kirbytext::$tags['link'] = ['attr' => array('text', 'class', 'title', 'rel', 'lang', 'target', 'popup'), 'html' => function ($tag) {
$link = url($tag->attr('link'), $tag->attr('lang'));
$text = $tag->attr('text');
if (empty($text)) {
$text = $link;
}
if (str::isURL($text)) {
$text = url::short($text);
}
return html::a($link, $text, ['rel' => $tag->attr('rel'), 'class' => $tag->attr('class'), 'title' => $tag->attr('title'), 'target' => str::isURL($tag->attr('link')) ? "_blank" : $tag->target()]);
}];