Exemple #1
0
 protected function addSlideLink()
 {
     list($url, $target) = (array) N2Parse::parse($this->parameters->getIfEmpty('link', '|*|'));
     if (!empty($url) && $url != '#') {
         if (empty($target)) {
             $target = '_self';
         }
         $url = $this->fill($url);
         $this->containerAttributes['onclick'] = '';
         if (strpos($url, 'javascript:') === 0) {
             $this->containerAttributes['onclick'] = $url;
         } else {
             N2Loader::import('libraries.link.link');
             $url = N2LinkParser::parse($url, $this->containerAttributes);
             $this->containerAttributes['data-href'] = N2Platform::$isJoomla ? JRoute::_($url, false) : $url;
             if (empty($this->containerAttributes['onclick'])) {
                 if ($target == '_blank') {
                     $this->containerAttributes['n2click'] = "window.open(this.getAttribute('data-href'),'_blank');";
                 } else {
                     $this->containerAttributes['n2click'] = "window.location=this.getAttribute('data-href')";
                 }
                 $this->containerAttributes['n2middleclick'] = "window.open(this.getAttribute('data-href'),'_blank');";
             }
         }
         $this->containerAttributes['style'] .= 'cursor:pointer;';
     }
 }
 protected function getLink($slide, $data, $content, $attributes = array(), $renderEmpty = false)
 {
     N2Loader::import('libraries.link.link');
     list($link, $target) = (array) N2Parse::parse($data->get('link', '#|*|'));
     if (!$target) {
         $target = '';
     }
     if ($link != '#' || $renderEmpty === true) {
         $link = N2LinkParser::parse($slide->fill($link), $attributes, $this->isEditor);
         return N2Html::link($content, $link, $attributes + array("target" => $target));
     }
     return $content;
 }