protected function url2link_callback($matches) { $url = str_replace('&', '&', $matches[0]); $items = parse_url($url); $length = $this->options['url2link_truncate_width']; $truncated_marker = $this->options['url2link_trimmarker']; if (!$this->url2link_site_summary_url) { $this->url2link_site_summary_url = $url; } if (strlen($url) > $length) { $length -= strlen($truncated_marker); $urlstr = substr($url, 0, $length) . $truncated_marker; } else { $urlstr = $url; } $attr = array(); if (Site_Util::check_ext_uri($url)) { $attr['target'] = '_blank'; } else { //TODO: add album image view. } $url = Security::htmlentities($url); $urlstr = Security::htmlentities($urlstr); return Html::anchor($url, $urlstr, $attr); }
<?php if (!empty($list)) { ?> <ul class="nav nav-pills nav-stacked well"> <?php if (!empty($header)) { ?> <li class="nav-header disabled"><a><?php echo $header; ?> </a></li> <?php } foreach ($list as $name => $path) { if (IS_ADMIN && !Site_Util::check_ext_uri($path, IS_ADMIN) && Auth::check() && !\Admin\Site_Util::check_exists_accessible_uri($path)) { continue; } ?> <li<?php if (check_current_uri($path)) { ?> class="active"<?php } ?> ><?php echo anchor_icon($path, $name, null, null, false, null, IS_ADMIN); ?> </li> <?php }
function anchor($href, $text, $is_admin = false, $attr = array(), $is_absolute_ext_uri = false, $acl_method = 'GET') { if (is_null($attr)) { $attr = array(); } if ($is_absolute_ext_uri || ($is_ext_url = Site_Util::check_ext_uri($href, $is_admin))) { $attr['target'] = '_blank'; $text .= ' ' . icon('new-window'); } if ($is_admin && !$is_ext_url) { if (Auth::check() && !Auth::has_access(Site_Util::get_acl_path($href) . '.' . $acl_method)) { $attr['class'] = empty($attr['class']) ? '' : $attr['class'] . ' '; $attr['class'] .= 'disabled'; return html_tag('span', $attr, $text); } } return Html::anchor($href, $text, $attr); }