示例#1
0
 public function getContent()
 {
     $cntattr = count($this->attribute);
     $cnt = $this->separatorCount + 1 > $cntattr ? $cntattr : $this->separatorCount + 1;
     list($href, $label) = $this->config->processLink($this->wikiContentArr[0], $this->name);
     if ($cnt == 1) {
         return '<a href="' . htmlspecialchars(trim($href)) . '">' . htmlspecialchars($label) . '</a>';
     }
     $this->wikiContentArr[0] = $href;
     return parent::getContent();
 }
示例#2
0
 public function getContent()
 {
     // management of single parameter
     if ($this->separatorCount == 0) {
         $this->separatorCount = 1;
         $href = $this->wikiContentArr[0];
         list($href, $label, $targetBlank, $nofollow) = $this->config->processLink($href, $this->name);
         $this->contents[0] = $label;
     } else {
         $href = $this->wikiContentArr[1];
         list($href, $label, $targetBlank, $nofollow) = $this->config->processLink($href, $this->name);
     }
     $this->contents[0] = trim($this->contents[0]);
     $this->wikiContentArr[1] = $href;
     // management of the target
     $targetBlank = isset($targetBlank) ? $targetBlank : $this->config->getParam('targetBlank');
     $nofollow = isset($nofollow) ? $nofollow : $this->config->getParam('nofollow');
     if (!isset($targetBlank) || !isset($nofollow)) {
         // no targetBlank behaviour defined, check the link
         if (isset($href[0]) && isset($href[1]) && $href[0] === '/' && $href[1] === '/' || strpos($href, '://') !== false) {
             if (!isset($targetBlank)) {
                 $targetBlank = true;
             }
             if (!isset($nofollow)) {
                 $nofollow = true;
             }
         }
     }
     if ($targetBlank) {
         $this->additionnalAttributes['target'] = '_blank';
     } else {
         unset($this->additionnalAttributes['target']);
     }
     if ($nofollow) {
         $this->additionnalAttributes['rel'] = 'nofollow';
     } else {
         unset($this->additionnalAttributes['rel']);
     }
     // link generation
     return parent::getContent();
 }