Esempio n. 1
0
 function linkTo(&$controller, $text, $href, $html_options = null)
 {
     $href = urlHelper::urlFor($controller, $href);
     if (!$href) {
         return $text ? $text : '';
     }
     if (isset($html_options['confirm'])) {
         $confirm = $html_options['confirm'];
         $confirm = htmlspecialchars($confirm, ENT_NOQUOTES);
         $confirm = str_replace("'", "\\'", $confirm);
         $confirm = str_replace('"', '"', $confirm);
         $html_options['onclick'] = "return confirm('{$confirm}');";
         unset($html_options['confirm']);
     }
     if (isset($html_options['referer']) && $html_options['referer']) {
         $href .= (preg_match('|\\?|', $href) ? '&' : '?') . '_referer=' . urlencode($_SERVER['REQUEST_URI']);
     }
     $html_options['href'] = $href;
     return TagHelper::contentTag('a', $text, $html_options);
 }
 function linkToFunction(&$controller, $name, $function, $html_options = array())
 {
     $options = array_merge(array('href' => '#', 'onclick' => "{$function};return false;"), $html_options);
     return TagHelper::contentTag('a', $name, $options);
 }