本文整理汇总了PHP中url::short方法的典型用法代码示例。如果您正苦于以下问题:PHP url::short方法的具体用法?PHP url::short怎么用?PHP url::short使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::short方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($mention)
{
$this->mention = $mention;
$this->data = $mention->data['author'];
$this->page = $mention->page;
if (empty($this->data['url'])) {
$this->data['url'] = $this->mention->data['url'];
}
if (empty($this->data['name'])) {
$this->data['name'] = url::short(url::base($this->data['url']));
}
$this->field('url');
$this->field('name');
}
示例2: shorturl
/**
* Shortens an URL
* It removes http:// or https:// and uses str::short afterwards
*
* @param string $url The URL to be shortened
* @param int $chars The final number of characters the URL should have
* @param boolean $base True: only take the base of the URL.
* @param string $rep The element, which should be added if the string is too long. Ellipsis is the default.
* @return string The shortened URL
*/
static function shorturl($url, $chars = false, $base = false, $rep = '…')
{
return url::short($url, $chars, $base, $rep);
}
示例3: html
?>
<div class="screen-refl"><a class="btn-white" href="<?php
echo $reference->link();
?>
">visit</a></div>
</div>
<a href="<?php
echo $reference->link();
?>
">
<h2 class="gamma truncate"><?php
echo html($reference->title());
?>
</h2>
<p><?php
echo url::short($reference->link());
?>
</p>
</a>
</li><!--
--><?php
}
?>
</ul>
<?php
$pagination = $references->pagination();
?>
<?php
if ($references->pagination()->hasPages()) {
?>
示例4: url
<div class="dashboard-box">
<a class="dashboard-item" target="_blank" href="<?php
echo url();
?>
">
<figure>
<span class="dashboard-item-icon dashboard-item-icon-with-border"><i class="fa fa-chain"></i></span>
<figcaption class="dashboard-item-text"><?php
e(url::isAbsolute(url()), url::short(url()), url());
?>
</figcaption>
</figure>
</a>
</div>
示例5: _l
?>
"><?php
_l('dashboard.index.site.title');
?>
</a>
</span>
</h2>
<div class="field field-is-readonly">
<div class="field-content">
<div class="input input-is-readonly">
<a target="_blank" href="<?php
echo url();
?>
"><?php
echo url::short(url());
?>
</a>
</div>
<div class="field-icon">
<i class="icon fa fa-chain"></i>
</div>
</div>
</div>
</div>
<div class="section white dashboard-section">
<h2 class="hgroup hgroup-single-line cf">
<span class="hgroup-title">
示例6: trim
}
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', '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, 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
kirbytext::$tags['twitter'] = array('attr' => array('class', 'title', 'text', 'rel', 'target', 'popup'), 'html' => function ($tag) {
// get and sanitize the username