예제 #1
0
파일: make_link.php 프로젝트: nouphet/rata
 function setParam($page, $name, $body, $type = '', $alias = '')
 {
     static $converter = NULL;
     $this->page = $page;
     $this->name = $name;
     $this->body = $body;
     $this->type = $type;
     $this->is_image = FALSE;
     $this->use_lightbox = FALSE;
     if ($this->type === 'url' && !$this->cont['PKWK_DISABLE_INLINE_IMAGE_FROM_URI'] && $this->func->is_url($alias) && preg_match('/\\.(gif|png|jpe?g)$/i', $alias)) {
         $this->is_image = TRUE;
         if ($this->cont['SHOW_EXTIMG_BY_REF'] && !$this->func->refcheck(0, $alias) && !preg_match($this->cont['NO_REF_EXTIMG_REG'], $alias)) {
             $alias = $this->func->do_plugin_inline('ref', $alias);
             $alias = preg_replace('#</?a[^>]*?>#i', '', $alias);
             $alias = preg_replace('/\\s*title="[^"]*"/', '', $alias);
             $this->use_lightbox = FALSE;
         } else {
             $alias = '<img src="' . htmlspecialchars($alias) . '" alt="' . $name . '" />';
             $this->use_lightbox = TRUE;
         }
         //if ($alias === $name) {
         //	$this->is_image = TRUE;
         //} else {
         //	$alias = preg_replace('/\s*title="[^"]*"/', '', $alias);
         //}
     } else {
         if ($alias !== '') {
             if ($converter === NULL) {
                 $converter = new XpWikiInlineConverter($this->xpwiki, array('plugin'));
             }
             $alias = $this->func->make_line_rules($converter->convert($alias, $page));
             // BugTrack/669: A hack removing anchor tags added by AutoLink
             $alias = preg_replace('#</?a[^>]*>#i', '', $alias);
             // Is image only? (on render mode)
             if ($this->root->render_mode === 'render' || $this->root->use_root_image_manager) {
                 if (strpos($this->name, $this->root->siteinfo['rooturl']) === 0 && preg_match('/^<img[^>]+>$/s', trim($alias)) && preg_match('/(?:jpe?g|png|gif)$/i', $this->name)) {
                     $this->is_image = TRUE;
                     $this->use_lightbox = TRUE;
                     $alias = preg_replace('/\\s*title="[^"]*"/', '', $alias);
                 }
             }
         }
     }
     $this->alias = $alias;
     return TRUE;
 }