Ejemplo n.º 1
0
 public function Simple($linkUrl, $linkText)
 {
     if (is_null($linkUrl) || empty($linkUrl)) {
         throw new \InvalidArgumentException('$linkUrl must be provided.', 0, null);
     }
     if (is_null($linkText) || empty($linkText)) {
         throw new \InvalidArgumentException('$linkText must be provided.', 0, null);
     }
     if (!\Puzzlout\Framework\Helpers\RegexHelper::Init($linkUrl)->IsMatch("`\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]`")) {
         throw new \InvalidArgumentException('$linkUrl ' . $linkUrl . ' is not valid.', 0, null);
     }
     array_push($this->Attributes, HtmlAttribute::Instanciate(HtmlAttributeConstants::Href, $linkUrl));
     array_push($this->Attributes, HtmlAttribute::Instanciate(LinkAttributeConstants::Target, "_BLANK"));
     $this->HtmlOutput = '<a {0} {1}>' . $linkText . '</a>';
     HtmlControlBuildHelper::Init()->GenerateAttributes($this);
     return $this->HtmlOutput;
 }
 /**
  * Generates a link html tag to include a stylesheet in the DOM
  * @param string $href The link to load as a stylesheet.
  */
 private function GenerateOutput($href)
 {
     array_push($this->Attributes, HtmlAttribute::Instanciate(HtmlAttributeConstants::Href, $href));
     $this->HtmlOutput = '<link rel="stylesheet" type="text/css" {0} />';
     HtmlControlBuildHelper::Init()->GenerateAttributes($this);
 }
Ejemplo n.º 3
0
 /**
  * Generates a script html tag to include a script in the DOM
  * @param string $source The source to load as a script.
  */
 private function GenerateOutput($source)
 {
     array_push($this->Attributes, HtmlAttribute::Instanciate(HtmlAttributeConstants::Src, $source));
     $this->HtmlOutput = '<script type="application/javascript" {0}></script>';
     HtmlControlBuildHelper::Init()->GenerateAttributes($this);
 }