Exemplo n.º 1
0
function abspath($path, $basepath = "", $resolve = true)
{
    if ($basepath == "") {
        $basepath = dirname(dirname(__FILE__));
    }
    $cpath = str_replace('//', '/', $basepath . "/" . $path);
    if ($resolve && !is_remote_path($cpath)) {
        $abs = realpath($cpath);
    } else {
        $inparts = explode("/", $cpath);
        $outparts = array();
        $cinparts = count($inparts);
        for ($i = 0; $i < $cinparts; $i++) {
            if ($inparts[$i] == '..') {
                array_pop($outparts);
            } else {
                if ($inparts[$i] != '.') {
                    $outparts[] = $inparts[$i];
                }
            }
        }
        $abs = implode("/", $outparts);
    }
    return $abs;
}
 public function initialize($params)
 {
     $mbdir = Magmi_Config::getInstance()->get('MAGENTO', 'basedir');
     if (is_remote_path($mbdir)) {
         $this->_raproxy = new Magmi_RemoteAgent_Proxy($mbdir, $this->getParam("MRAGENT:baseurl"));
     }
     if (isset($this->_raproxy)) {
         $this->log("Remote agent activated for remote magento path : {$mbdir}", "startup");
     }
 }
Exemplo n.º 3
0
function abspath($path, $basepath = "", $resolve = true)
{
    if ($basepath == "") {
        $basepath = dirname(dirname(__FILE__));
    }
    $cpath = str_replace('//', '/', $basepath . "/" . $path);
    if ($resolve && !is_remote_path($cpath)) {
        $abs = realpath($cpath);
    } else {
        $abs = preg_replace('|\\w+/\\.\\.\\/|', '', $cpath);
        $abs = preg_replace('|\\./|', '', $abs);
    }
    return $abs;
}
 public function handleVarcharAttribute($pid, &$item, $storeid, $attrcode, $attrdesc, $ivalue)
 {
     if (trim($ivalue) == "") {
         return trim($ivalue);
     }
     // trimming
     $ivalue = trim($ivalue);
     // If not already a remote image & force remote root, set it & set authentication
     if (!is_remote_path($ivalue)) {
         if ($this->_remoteroot != "") {
             $ivalue = $this->_remoteroot . str_replace("//", "/", "/{$ivalue}");
         }
     }
     if (is_remote_path($ivalue)) {
         // Amazon images patch , remove SLXXXX part
         if (strpos($ivalue, 'amazon.com/images/I') !== false) {
             $pattern = '/\\bSL[0-9]+\\./i';
             $ivalue = preg_replace($pattern, '', $ivalue);
         }
     }
     // if it's a gallery
     switch ($attrdesc["frontend_input"]) {
         case "gallery":
             $ovalue = $this->handleGalleryTypeAttribute($pid, $item, $storeid, $attrcode, $attrdesc, $ivalue);
             break;
         case "media_image":
             $ovalue = $this->handleImageTypeAttribute($pid, $item, $storeid, $attrcode, $attrdesc, $ivalue);
             break;
         default:
             $ovalue = "__MAGMI_UNHANDLED__";
     }
     return $ovalue;
 }
 public function findImageFile($ivalue)
 {
     //do no try to find remote image
     if (is_remote_path($ivalue)) {
         return $ivalue;
     }
     //if existing, return it directly
     if (realpath($ivalue)) {
         return $ivalue;
     }
     //ok , so it's a relative path
     $imgfile = false;
     $scandirs = explode(";", $this->getParam("IMG:sourcedir"));
     //iterate on image sourcedirs, trying to resolve file name based on input value and current source dir
     for ($i = 0; $i < count($scandirs) && $imgfile === false; $i++) {
         $sd = $scandirs[$i];
         //scandir is relative, use mdh
         if ($sd[0] != "/") {
             $sd = $this->_mdh->getMagentoDir() . "/" . $sd;
         }
         $imgfile = abspath($ivalue, $sd);
     }
     return $imgfile;
 }
 /**
  * copy image file from source directory to
  * product media directory
  *
  * @param $imgfile :
  *            name of image file name in source directory
  * @return : name of image file name relative to magento catalog media dir,including leading
  *         directories made of first char & second char of image file name.
  */
 public function copyImageFile($imgfile, &$item, $extra)
 {
     if ($imgfile == "__NULL__" || $imgfile == null) {
         return false;
     }
     // check for source image in error
     if ($this->isErrorImage($imgfile)) {
         if ($this->_newitem) {
             $this->fillErrorAttributes($item);
         }
         return false;
     }
     //handle remote root per image
     if (!is_remote_path($imgfile)) {
         if ($this->_remoteroot != "") {
             $imgfile = $this->_remoteroot . str_replace("//", "/", "/{$imgfile}");
         }
     }
     //handle amazon specific
     if (is_remote_path($imgfile)) {
         // Amazon images patch , remove SLXXXX part
         if (preg_match('|amazon\\..*?/images/I|', $imgfile)) {
             $pattern = '/\\bSL[0-9]+\\./i';
             $imgfile = preg_replace($pattern, '', $imgfile);
         }
     }
     $source = $this->findImageFile($imgfile);
     if ($source == false) {
         $this->log("{$imgfile} cannot be found in images path", "warning");
         // last image in error,add it to error cache
         $this->setErrorImg($imgfile);
         return false;
     }
     $imgfile = $source;
     $checkexist = $this->getParam("IMG:existingonly") == "yes";
     $curlh = false;
     $bimgfile = $this->getTargetName($imgfile, $item, $extra);
     // source file exists
     $i1 = $bimgfile[0];
     $i2 = $bimgfile[1];
     // magento image value (relative to media catalog)
     $impath = "/{$i1}/{$i2}/{$bimgfile}";
     // target directory;
     $l2d = "media/catalog/product/{$i1}/{$i2}";
     // test for existence
     $targetpath = "{$l2d}/{$bimgfile}";
     /* test for same image (without problem) */
     if ($impath == $this->_lastimage) {
         return $impath;
     }
     /* test if imagefile comes from export */
     if (!$this->_mdh->file_exists($targetpath) || $this->getParam("IMG:writemode") == "override") {
         // if we already had problems with this target,assume we'll get others.
         if ($this->isErrorImage($impath)) {
             return false;
         }
         /* try to recursively create target dir */
         if (!$this->_mdh->file_exists($l2d)) {
             $tst = $this->_mdh->mkdir($l2d, Magmi_Config::getInstance()->getDirMask(), true);
             if (!$tst) {
                 // if we had problem creating target directory,add target to error cache
                 $errors = $this->_mdh->getLastError();
                 $this->log("error creating {$l2d}: {$errors["type"]},{$errors["message"]}", "warning");
                 unset($errors);
                 $this->setErrorImg($impath);
                 return false;
             }
         }
         if (!$this->saveImage($imgfile, $targetpath)) {
             $errors = $this->_mdh->getLastError();
             $this->fillErrorAttributes($item);
             $this->log("error copying {$l2d}/{$bimgfile} : {$errors["type"]},{$errors["message"]}", "warning");
             unset($errors);
             $this->setErrorImg($impath);
             return false;
         } else {
             @$this->_mdh->chmod("{$l2d}/{$bimgfile}", Magmi_Config::getInstance()->getFileMask());
             if ($this->getParam("IMG:storeindb", "no") == "yes") {
                 /* create target dirs if they don't exist */
                 $dir_table = $this->tablename('core_directory_storage');
                 // get "catalog/product" path ID
                 $sql = "SELECT directory_id from {$dir_table} where name='product' and path='catalog'";
                 $parent_id = $this->selectone($sql, null, 'directory_id');
                 // check if i1 dir exists
                 $i1_dir = "catalog/product/{$i1}";
                 $sql = "SELECT directory_id FROM {$dir_table} WHERE name=? and parent_id=?";
                 $i1_dir_id = $this->selectone($sql, array($i1, $parent_id), 'directory_id');
                 // insert if it doesn't exist
                 if ($i1_dir_id == null) {
                     $sql = "INSERT INTO {$dir_table} (name, path, upload_time, parent_id)\n                                    VALUES (?, 'catalog/product', NOW(), ?);";
                     $i1_dir_id = $this->insert($sql, array($i1, $parent_id));
                 }
                 // check if i2 dir exists
                 $i2_dir = "{$i1_dir}/{$i2}";
                 $sql = "SELECT directory_id FROM {$dir_table} WHERE name=? and parent_id=?";
                 $i2_dir_id = $this->selectone($sql, array($i2, $i1_dir_id), 'directory_id');
                 // insert second level if it doesn't exist
                 if ($i2_dir_id == null) {
                     $sql = "INSERT INTO {$dir_table} (name, path, upload_time, parent_id)\n                                    VALUES (?, ?, NOW(), ?);";
                     $i2_dir_id = $this->insert($sql, array($i2, $i1_dir, $i1_dir_id));
                 }
                 /* insert the image */
                 $media_table = $this->tablename('core_file_storage');
                 $sql = "SELECT file_id FROM {$media_table} WHERE filename=? and directory_id=?";
                 $existing_file_id = $this->selectone($sql, array($bimgfile, $i2_dir_id), 'file_id');
                 if ($existing_file_id == null || $this->getParam("IMG:writemode") == "override") {
                     $image_path = $this->magdir . '/' . $targetpath;
                     $image_content = file_get_contents($image_path);
                     $sql = "INSERT INTO {$media_table} (content, upload_time, filename, directory_id, directory)\n                                    VALUES (?, NOW(), ?, ?, ?)\n                                    ON DUPLICATE KEY UPDATE content=VALUES(content), upload_time=VALUES(upload_time);";
                     $file_id = $this->insert($sql, array($image_content, $bimgfile, $i2_dir_id, $i2_dir));
                 }
             }
         }
     }
     $this->_lastimage = $impath;
     /* return image file name relative to media dir (with leading / ) */
     return $impath;
 }
Exemplo n.º 7
0
 /**
  * Generates image previews with alternate text, title and lightbox pop-up activation on mouse click.
  * @param string $body Data associated with the gallery.
  * @param string $paramstring A whitespace-separated list of name="value" parameter values.
  */
 private function getImageGalleryHtml($body, $params = array())
 {
     // set gallery parameters
     $this->curparams = clone $this->defparams;
     // parameters set in back-end
     if (is_array($params)) {
         $this->curparams->setArray($params);
     } else {
         $paramstring = htmlspecialchars_decode((string) $params);
         $this->curparams->setString($paramstring);
         // parameters set inline
     }
     if (!isset($body)) {
         // path is set via parameter with compact activation syntax
         $body = $this->curparams->path;
     }
     $engineservices = SIGPlusEngineServices::instance();
     // generate link to an existing gallery
     if ($this->curparams->link !== false) {
         $lightbox = $engineservices->getLightboxEngine($this->curparams->lightbox);
         // get selected lightbox engine if any or use default
         if ($lightbox && ($linkscript = $lightbox->getLinkScript($this->curparams->link, $this->curparams->index)) !== false) {
             return '<a href="javascript:void(' . htmlspecialchars($linkscript) . ')">' . $body . '</a>';
         } else {
             // engine does not support programmatic activation
             return $body;
         }
     }
     // set gallery folders
     $imageref = $body;
     // a relative path to an image folder or an image, or an absolute URL to an image to display
     if ($isremote = is_remote_path($imageref)) {
         $imageurl = $imageref;
         $iswebalbum = (bool) preg_match('"^https?://picasaweb.google.com/data/feed/(?:api|base)/user/([^/?#]+)/albumid/([^/?#]+)"', $imageurl);
         // test for Picasa galleries
         $imagehashbase = $imageurl;
     } else {
         $imageref = trim($imageref, '/');
         // remove leading and trailing backslash
         // verify validity of relative path
         $imagepath = $this->imageservices->getImagePath($imageref);
         if (!file_exists($imagepath)) {
             throw new SIGPlusImageGalleryFolderException($imageref);
         }
         $imagehashbase = $imagepath;
         // base in computing hash for content caching
     }
     // set gallery identifier
     if ($this->curparams->id) {
         // use user-supplied identifier
         $galleryid = $this->curparams->id;
     } else {
         // automatically generate identifier for thumbnail gallery
         $galleryid = 'sigplus_' . md5($imagehashbase);
     }
     $galleryid = $this->getUniqueGalleryId($galleryid);
     // force meaningful settings for single-image view (disable slider and activate flow layout)
     if ($this->curparams->layout != 'hidden' && ($isremote && !$iswebalbum || isset($imagepath) && is_file($imagepath))) {
         $this->curparams->layout = 'flow';
         $this->curparams->rows = false;
         $this->curparams->cols = false;
         $this->curparams->slider = false;
     }
     // substitute proper left or right alignment depending on whether language is LTR or RTL
     $language = JFactory::getLanguage();
     $this->curparams->alignment = str_replace(array('after', 'before'), $language->isRTL() ? array('left', 'right') : array('right', 'left'), $this->curparams->alignment);
     // get selected slider engine if any, or use default
     $slider = $engineservices->getSliderEngine($this->curparams->slider);
     if (!$slider) {
         $this->curparams->progressive = false;
         // progressive loading is not supported unless a slider is enabled
     }
     // *** cannot update $this->curparams, which is used in content caching, beyond this point *** //
     // initialize logging
     if (SIGPLUS_LOGGING) {
         $logging = SIGPlusLogging::instance();
         if ($isremote) {
             $logging->append('Generating gallery "' . $galleryid . '" from URL: <kbd>' . $imageurl . '</kbd>');
         } else {
             $logging->append('Generating gallery "' . $galleryid . '" from file/directory: <kbd>' . $imagepath . '</kbd>');
         }
         $logging->appendblock('Local parameters for "' . $galleryid . '" are:', print_r($this->curparams, true));
     }
     // verify if content is available in cache folder
     if (!SIGPLUS_CONTENT_CACHING || $engineservices->debug || $this->curparams->hasRandom()) {
         $cachekey = false;
         // galleries that involve a random element cannot be cached
     } elseif (($cachekey = $this->imageservices->getCachedContent($imagehashbase, $this->curparams)) !== false) {
         if (SIGPLUS_LOGGING) {
             $logging->append('Retrieving cached content with key <kbd>' . $cachekey . '</kbd>.');
         }
     }
     // generate gallery HTML code or setup script
     if ($cachekey === false) {
         // save default title and description, which might be overridden in labels file, affecting hash key used in caching
         $deftitle = $this->curparams->deftitle;
         $defdescription = $this->curparams->defdescription;
         if ($isremote) {
             // access images remote domain
             if ($iswebalbum) {
                 $htmlorscript = $this->getPicasaImageGallery($imageurl, $galleryid);
             } else {
                 $extension = strtolower(pathinfo(parse_url($imageurl, PHP_URL_PATH), PATHINFO_EXTENSION));
                 switch ($extension) {
                     case 'gif':
                     case 'jpg':
                     case 'jpeg':
                     case 'png':
                         // plug-in syntax {gallery}http://example.com/image.jpg{/gallery}
                         $labels = array(new SIGPlusImageLabel($imageurl, false, false));
                         // artificial single-entry labels file
                         $htmlorscript = $this->getUserDefinedRemoteImageGallery($labels, $galleryid);
                         break;
                     default:
                         // plug-in syntax {gallery}http://example.com{/gallery}
                         throw new SIGPlusNotSupportedException();
                         $labels = $this->imageservices->getLabels($imageurl, $this->curparams->labels, $this->curparams->deftitle, $this->curparams->defdescription);
                         switch ($this->curparams->sortcriterion) {
                             case SIGPLUS_SORT_RANDOMLABELS:
                                 shuffle($labels);
                                 // fall through
                             // fall through
                             case SIGPLUS_SORT_LABELS_OR_FILENAME:
                             case SIGPLUS_SORT_LABELS_OR_MTIME:
                                 $htmlorscript = $this->getUserDefinedRemoteImageGallery($labels, $galleryid);
                         }
                 }
             }
         } else {
             if (is_file($imagepath)) {
                 // syntax {gallery}folder/subfolder/file.jpg{/gallery}
                 $htmlorscript = $this->getUnlabeledImageGallery(dirname($imagepath), array(basename($imagepath)), $galleryid);
             } else {
                 // syntax {gallery}folder/subfolder{/gallery}
                 // fetch image labels
                 switch ($this->curparams->labels) {
                     case 'filename':
                         $labels = $this->imageservices->getLabelsFromFilenames($imagepath);
                         break;
                     default:
                         $labels = $this->imageservices->getLabels($imagepath, $this->curparams->labels, $this->curparams->deftitle, $this->curparams->defdescription);
                 }
                 switch ($this->curparams->sortcriterion) {
                     case SIGPLUS_SORT_LABELS_OR_FILENAME:
                         if (empty($labels)) {
                             // there is no labels file to use
                             $files = $this->imageservices->getListing($imagepath, SIGPLUS_FILENAME, $this->curparams->sortorder, $this->curparams->depth);
                             $htmlorscript = $this->getUnlabeledImageGallery($imagepath, $files, $galleryid);
                         } else {
                             $htmlorscript = $this->getUserDefinedImageGallery($imagepath, $labels, $galleryid);
                         }
                         break;
                     case SIGPLUS_SORT_LABELS_OR_MTIME:
                         if (empty($labels)) {
                             $files = $this->imageservices->getListing($imagepath, SIGPLUS_MTIME, $this->curparams->sortorder, $this->curparams->depth);
                             $htmlorscript = $this->getUnlabeledImageGallery($imagepath, $files, $galleryid);
                         } else {
                             $htmlorscript = $this->getUserDefinedImageGallery($imagepath, $labels, $galleryid);
                         }
                         break;
                     case SIGPLUS_SORT_MTIME:
                         $files = $this->imageservices->getListing($imagepath, SIGPLUS_MTIME, $this->curparams->sortorder, $this->curparams->depth);
                         $htmlorscript = $this->getLabeledImageGallery($imagepath, $files, $labels, $galleryid);
                         break;
                     case SIGPLUS_SORT_RANDOM:
                         $files = $this->imageservices->getListing($imagepath, SIGPLUS_RANDOM, $this->curparams->sortorder, $this->curparams->depth);
                         $htmlorscript = $this->getLabeledImageGallery($imagepath, $files, $labels, $galleryid);
                         break;
                     case SIGPLUS_SORT_RANDOMLABELS:
                         if (empty($labels)) {
                             // there is no labels file to use
                             $files = $this->imageservices->getListing($imagepath, SIGPLUS_RANDOM, $this->curparams->sortorder, $this->curparams->depth);
                             $htmlorscript = $this->getUnlabeledImageGallery($imagepath, $files, $galleryid);
                         } else {
                             shuffle($labels);
                             $htmlorscript = $this->getUserDefinedImageGallery($imagepath, $labels, $galleryid);
                         }
                         break;
                     default:
                         // case SIGPLUS_SORT_FILENAME:
                         $files = $this->imageservices->getListing($imagepath, SIGPLUS_FILENAME, $this->curparams->sortorder, $this->curparams->depth);
                         $htmlorscript = $this->getLabeledImageGallery($imagepath, $files, $labels, $galleryid);
                         break;
                 }
             }
         }
         if (!empty($htmlorscript)) {
             switch ($this->curparams->linkage) {
                 case 'inline':
                     $cachedata = ($slider !== false ? '<ul style="visibility:hidden;">' : '<ul>') . implode($htmlorscript) . '</ul>';
                     break;
                 case 'head':
                     // put generated content in HTML head (does not allow HTML body with bloating size, which would cause preg_replace in System - SEF to fail)
                     $cachedata = $this->getGalleryScript($galleryid, $htmlorscript);
                     break;
                 case 'external':
                     $cachedata = '__jQuery__(function () { ' . $this->getGalleryScript($galleryid, $htmlorscript) . ' });';
                     break;
             }
         } else {
             $cachedata = false;
         }
         // restore default title and description, which might have been overridden in labels file
         $this->curparams->deftitle = $deftitle;
         $this->curparams->defdescription = $defdescription;
         if (SIGPLUS_CONTENT_CACHING && !$this->curparams->hasRandom()) {
             // save generated content for future re-use in a temporary file in the cache folder
             $this->imageservices->cleanCachedContent();
             $cachekey = $this->imageservices->saveCachedContent($imagehashbase, $this->curparams, $cachedata);
             if (SIGPLUS_LOGGING) {
                 if ($cachekey !== false) {
                     $logging->append('Saved cached content with key <kbd>' . $cachekey . '</kbd>.');
                 } else {
                     $logging->append('Failed to persist content in cache folder.');
                 }
             }
         }
     } elseif ($this->curparams->linkage != 'external') {
         // retrieve content from cache but no need to fetch content for linking external .js file
         $cachefile = $this->imageservices->getCachedContentPath($cachekey, $this->curparams->linkage == 'inline' ? '.html' : '.js');
         if (filesize($cachefile) > 0) {
             $cachedata = file_get_contents($cachefile);
         } else {
             $cachedata = false;
             // empty gallery
         }
     } else {
         $cachedata = true;
     }
     if ($cachedata === false) {
         // no content
         $html = JText::_('SIGPLUS_EMPTY');
     } else {
         switch ($this->curparams->linkage) {
             case 'inline':
                 $html = $cachedata;
                 // content produced as HTML only in inline linkage mode
                 break;
             case 'head':
                 $this->addGalleryScript();
                 // add gallery population script
                 $engineservices->addOnReadyScript($cachedata);
                 // add gallery data
                 $html = '';
                 // no content produced in HTML except for placeholder
                 break;
             case 'external':
                 $this->addGalleryScript();
                 if ($cachekey !== false) {
                     // include reference to generated script in external .js file
                     $document = JFactory::getDocument();
                     $document->addScript($this->imageservices->getCachedContentUrl($cachekey, '.js'));
                 } else {
                     // add script to document head as a fall-back if could not save to external .js file in cache folder
                     $engineservices->addOnReadyScript($cachedata);
                 }
                 $html = '';
                 break;
         }
     }
     // set image gallery alignment (left, center or right) and style
     $gallerystyle = 'sigplus-gallery';
     switch ($this->curparams->alignment) {
         case 'left':
         case 'left-clear':
         case 'left-float':
             $gallerystyle .= ' sigplus-left';
             break;
         case 'center':
             $gallerystyle .= ' sigplus-center';
             break;
         case 'right':
         case 'right-clear':
         case 'right-float':
             $gallerystyle .= ' sigplus-right';
             break;
     }
     switch ($this->curparams->alignment) {
         case 'left':
         case 'left-float':
         case 'right':
         case 'right-float':
             $gallerystyle .= ' sigplus-float';
             break;
         case 'left-clear':
         case 'right-clear':
             $gallerystyle .= ' sigplus-clear';
             break;
     }
     switch ($this->curparams->imagecaptions) {
         case 'above':
             $gallerystyle .= ' sigplus-captionsabove';
             break;
         case 'below':
             $gallerystyle .= ' sigplus-captionsbelow';
             break;
     }
     // output image gallery or gallery placeholder
     $div_attrs = array('id' => $galleryid, 'class' => $gallerystyle);
     if ($this->curparams->layout == 'hidden') {
         $div_attrs['style'] = 'display:none !important;';
     }
     $html = make_html('div', $div_attrs, $html);
     // add style and script declarations
     $this->addStylesAndScripts($galleryid);
     $this->curparams = false;
     return $html;
 }
Exemplo n.º 8
0
 /**
  * Fetches cached content for the specified directory and parameters.
  * @param string $imagebase
  *    Base for computing image folder hash, typically an absolute file system path to the image or the directory where the images reside.
  * @param $params
  *    Parameters that affect how the gallery is to be displayed.
  */
 public function getCachedContent($imagebase, SIGPlusGalleryParameters $params)
 {
     if ($this->config->contentcache) {
         // use cache folder
         $cachekey = $this->getCacheKey($imagebase, $params);
         $cachefile = $this->getCachedContentPath($cachekey, $params->linkage == 'inline' ? '.html' : '.js');
         if (is_file($cachefile)) {
             // content available in cache only if cache file exists
             if (is_remote_path($imagebase)) {
                 return $cachekey;
             } elseif (is_dir($imagebase)) {
                 // check if directory or labels file has changed
                 $labelsfile = $this->getLabelsFilePath($imagebase, $params->labels);
                 if (filemtime($cachefile) >= get_folder_last_modified($imagebase, $params->depth) && ($labelsfile === false || filemtime($cachefile) >= filemtime($labelsfile))) {
                     return $cachekey;
                 }
             } elseif (is_file($imagebase)) {
                 // check if file has changed
                 if (filemtime($cachefile) >= filemtime($imagebase)) {
                     return $cachekey;
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 9
0
 /**
  * Generates image thumbnails with alternate text, title and lightbox pop-up activation on mouse click.
  * This method is to be called as a regular expression replace callback.
  * Any error messages are printed to screen.
  * @param $match A regular expression match.
  */
 public function getGalleryRegexReplacementExpanded($match)
 {
     $imagereference = $match[2];
     if (is_remote_path($imagereference)) {
         $imagereference = safeurlencode($imagereference);
     }
     return $this->core->getGalleryHtml($imagereference, $match[1]);
 }