Esempio n. 1
0
 /**
  * @param Hyperlink $hyperLink
  */
 public function RenderHyperLink($hyperLink)
 {
     $this->result = sprintf('<a href="%s">%s</a>%s', $hyperLink->GetLink(), $hyperLink->GetInnerText(), $hyperLink->GetAfterLinkText());
 }
Esempio n. 2
0
 /**
  * @param Widget $target the element to be shown or hidden when this link is clicked
  * @param string $show_desc the description to use when clicking this link will show the target
  * @param string $hide_desc the description to use when clicking this link will hide the target
  * @param boolean $initially_hidden is the target hidden when the page loads?
  */
 public function __construct($id, $unique, $target, $show_desc = 'Show', $hide_desc = 'Hide', $initially_hidden = true)
 {
     parent::__construct($id, $unique, 'javascript:void(0)', $initially_hidden ? $show_desc : $hide_desc);
     if (!$target->identifier) {
         //STUB
         throw new Exception('You may only link a display toggle to a widget with a unique identifier.');
     }
     $this->target_id = $target->identifier;
     $this->show_desc = $show_desc;
     $this->hide_desc = $hide_desc;
     $this->initially_hidden = $initially_hidden;
 }
Esempio n. 3
0
/**
 * Turns the provided link data into a proper, escaped HTML hyperlink.
 * 
 * $link : the URL as a string, or a Linkable object that provides URL and text information
 * $text : the raw text, of the URL is a string
 * $class : optional CSS class to add to the link
 * $charLimit : optional character limit to truncate the text to
 */
function urlize($link, $text = null, $class = null, $charLimit = null)
{
    if (is_string($link)) {
        assert($text !== null);
        $linkObject = new Hyperlink(new LinkData($link, $text));
    } else {
        assert($link instanceof Linkable);
        $linkObject = new Hyperlink($link, $text);
    }
    return $linkObject->getLinkHTML($class, $charLimit);
}