protected function _createCategoriesTree($categories, $itemPattern, $templatePattern, $selectedPattern, $maxlevel = 0, $selectedIDs = array()) { global $cms_language; static $level; $level++; $return = ""; //get all level categories object $categoriesObjects = array(); $subCats = array(); foreach ($categories as $catID => $subCategories) { $category = CMS_moduleCategories_catalog::getByID($catID); $categoriesObjects[$category->getAttribute('order')] = $category; $subCats[$catID] = $subCategories; } //sort categories by order ksort($categoriesObjects); ///then display it foreach ($categoriesObjects as $category) { $catID = $category->getID(); $subCategories = $subCats[$catID]; $subcats = ''; if (is_array($subCategories) && $subCategories && (!$maxlevel || $level < $maxlevel)) { //recurse on subcategories $subcats = $this->_createCategoriesTree($subCategories, $itemPattern, $templatePattern, $selectedPattern, $maxlevel, $selectedIDs); } $iconPathFS = $category->getIconPath(true, PATH_RELATIVETO_FILESYSTEM, true); if ($iconPathFS && file_exists($iconPathFS)) { $iconPathWR = CMS_websitesCatalog::getCurrentDomain() . $category->getIconPath(true, PATH_RELATIVETO_WEBROOT, true); $icon = '<img src="' . $iconPathWR . '" alt="" title="' . SensitiveIO::sanitizeHTMLString($category->getLabel($cms_language)) . '" />'; } else { $icon = ''; } $replace = array('{id}' => $catID, '{label}' => $category->getLabel($cms_language), '{description}' => $category->getDescription($cms_language), '{sublevel}' => $subcats, '{lvl}' => $level, '{icon}' => $icon); if ($selectedIDs && in_array($catID, $selectedIDs)) { $return .= str_replace(array_keys($replace), $replace, $selectedPattern); } else { $return .= str_replace(array_keys($replace), $replace, $itemPattern); } } $return = str_replace('{sublevel}', $return, $templatePattern); $level--; return $return; }
/** * Replace block definition vars. * * @param array data : the block datas * @param string html_attributes : html attributes * @param integer $location The location of the page * @param boolean $public The needed precision for USERSPACE location * @return string the HTML data * @access public */ function _replaceBlockVars($data, $html_attributes, $location, $public) { switch ($location) { case RESOURCE_DATA_LOCATION_PUBLIC: $folder = $public ? "public" : "edited"; break; case RESOURCE_DATA_LOCATION_ARCHIVED: $folder = "archived"; break; case RESOURCE_DATA_LOCATION_DELETED: $folder = "deleted"; break; case RESOURCE_DATA_LOCATION_EDITION: $folder = "edition"; break; } $currentLink = new CMS_href($data["externalLink"]); //must put the main website URL before $html_imgZoomHtml = ''; $html_imgZoomName = ''; $html_imageZoomHref = ''; $html_imageZoomPop = ''; if ($public && ALTERNATIVE_DOMAIN) { $domain = ALTERNATIVE_DOMAIN; } else { $domain = CMS_websitesCatalog::getCurrentDomain(@$this->_pageID); } if ($data["file"]) { $html_img = '<img src="' . $domain . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["file"] . '" alt="' . io::htmlspecialchars($data["label"]) . '" ' . $html_attributes . ' />'; } if ($data["enlargedFile"]) { $html_imgZoomName = $data["enlargedFile"]; $html_imgZoomHtml = '<img src="' . $domain . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["enlargedFile"] . '" alt="' . io::htmlspecialchars($data["label"]) . '" ' . $html_attributes . ' />'; } if ($data["enlargedFile"]) { $href = OPEN_ZOOMIMAGE_IN_POPUP ? CMS_websitesCatalog::getCurrentDomain(@$this->_pageID) . PATH_REALROOT_WR . "/" . CMS_block_image::BLOCK_IMAGE_POPUP . '?location=' . $folder . '&file=' . $data["enlargedFile"] . '&label=' . urlencode($data["label"]) : $domain . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["enlargedFile"]; $popup = OPEN_ZOOMIMAGE_IN_POPUP ? ' onclick="javascript:CMS_openPopUpImage(\'' . addslashes($href) . '\');return false;"' : ''; if ($html_img) { $html = '<a target="_blank" rel="atm-enlarge" href="' . $href . '"' . $popup . ' title="' . io::htmlspecialchars($data["label"]) . '">' . $html_img . '</a>'; } $html_imageZoomHref = $href; $linkLabel = '<a class="imagezoomlink" target="_blank" href="' . $href . '"' . $popup . ' title="' . io::htmlspecialchars($data["label"]) . '">' . io::htmlspecialchars($data["label"]) . '</a>'; } else { if ($currentLink->getHTML(false, MOD_STANDARD_CODENAME, $location)) { $html = $currentLink->getHTML($html_img, MOD_STANDARD_CODENAME, $location); $currentLink->setLabel(''); $linkLabel = $currentLink->getHTML($data['label'], MOD_STANDARD_CODENAME, $location); } else { $html = $html_img; $linkLabel = io::htmlspecialchars($data["label"]); } } $replace = array('{{data}}' => $html, '{{label}}' => io::htmlspecialchars($data["label"]), '{{jslabel}}' => io::htmlspecialchars($data["label"]), '{{linkLabel}}' => $linkLabel, '{{imageZoomHtml}}' => $html_imgZoomHtml, '{{imagePath}}' => $domain . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder, '{{imageName}}' => $data["file"], '{{imageZoomHref}}' => $html_imageZoomHref, '{{imageZoomName}}' => $html_imgZoomName); if (io::strpos($this->_definition, 'Width}}') !== false || io::strpos($this->_definition, 'Height}}') !== false) { list($sizeX, $sizeY) = @getimagesize(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data["file"]); if (isset($data["enlargedFile"])) { list($sizeZoomX, $sizeZoomY) = @getimagesize(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data["enlargedFile"]); } $replace['{{imageWidth}}'] = isset($sizeX) ? $sizeX : "0"; $replace['{{imageHeight}}'] = isset($sizeY) ? $sizeY : "0"; $replace['{{imageZoomWidth}}'] = isset($sizeZoomX) ? $sizeZoomX : "0"; $replace['{{imageZoomHeight}}'] = isset($sizeZoomY) ? $sizeZoomY : "0"; } return str_replace(array_keys($replace), $replace, $this->_definition); }
/** * get an object value * * @param string $name : the name of the value to get * @param string $parameters (optional) : parameters for the value to get * @return multidimentionnal array : the object values structure * @access public */ function getValue($name, $parameters = '') { switch ($name) { case 'label': return $this->getLabel(); break; case 'image': case 'imageZoom': if ($name == 'image') { $fieldIndex = 0; } else { $fieldIndex = 2; } if ($this->_subfieldValues[$fieldIndex]->getValue() && $parameters) { @(list($x, $y) = explode(',', str_replace(';', ',', $parameters))); if (io::isPositiveInteger($x) && $x < $this->getValue($name . 'Width') || io::isPositiveInteger($y) && $y < $this->getValue($name . 'Height')) { //get module codename $crop = $x && $y ? 1 : 0; //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; //resized image path $pathInfo = pathinfo($this->_subfieldValues[$fieldIndex]->getValue()); $resizedImage = $pathInfo['filename'] . '-' . $x . '-' . $y . ($crop ? '-c' : '') . '.' . $pathInfo['extension']; //resized image path $resizedImagepathFS = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location . '/' . $resizedImage; //if file already exists, no need to resize file send it if (file_exists($resizedImagepathFS)) { return $this->getValue('imagePath') . '/' . $resizedImage; } else { return CMS_websitesCatalog::getCurrentDomain() . PATH_REALROOT_WR . '/image-file' . (!STRIP_PHP_EXTENSION ? '.php' : '') . '?image=' . $this->_subfieldValues[$fieldIndex]->getValue() . '&module=' . $moduleCodename . '&x=' . $x . '&y=' . $y . '&crop=' . $crop . ($location != RESOURCE_DATA_LOCATION_PUBLIC ? '&location=' . $location : ''); } } } if ($this->_subfieldValues[$fieldIndex]->getValue()) { return $this->getValue('imagePath') . '/' . $this->_subfieldValues[$fieldIndex]->getValue(); } return ''; break; case 'imageHTML': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; //link content $img = ''; if ($parameters) { $img = $parameters; } elseif ($this->_subfieldValues[0]->getValue()) { //bug 1380 $img = '<img src="' . $this->getValue('image') . '" alt="' . $this->_subfieldValues[1]->getValue() . '" />'; } //add link to zoom if any if ($img && $this->_subfieldValues[2]->getValue()) { $href = CMS_websitesCatalog::getCurrentDomain() . PATH_REALROOT_WR . "/" . self::OBJECT_IMAGE_POPUP_FILE . '?' . ($location != RESOURCE_DATA_LOCATION_PUBLIC ? 'location=' . RESOURCE_DATA_LOCATION_EDITED . '&' : '') . 'file=' . $this->_subfieldValues[2]->getValue() . '&label=' . urlencode($this->_subfieldValues[1]->getValue()) . '&module=' . $moduleCodename; // file informations $popup = OPEN_ZOOMIMAGE_IN_POPUP ? ' onclick="javascript:CMS_openPopUpImage(\'' . addslashes($href) . '\');return false;"' : ''; $img = '<a target="_blank" rel="atm-enlarge" href="' . $href . '"' . $popup . ' title="' . $this->_subfieldValues[1]->getValue() . '">' . $img . '</a>'; } return $img; break; case 'imageLabel': return $this->_subfieldValues[1]->getValue(); break; case 'imageName': return $this->_subfieldValues[0]->getValue(); break; case 'imageZoomName': return $this->_subfieldValues[2]->getValue(); break; case 'imagePath': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $altDomain = $this->getAlternativeDomain(); // If we are serving a public file and there is an alternative domain set up, change the url if ($this->isPublic() && $altDomain) { return $altDomain . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . $location; } else { return CMS_websitesCatalog::getCurrentDomain() . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . $location; } break; case 'imageMaxWidth': //get field parameters $params = $this->getParamsValues(); return $params['maxWidth'] ? $params['maxWidth'] : ''; break; case 'imageMaxHeight': //get field parameters $params = $this->getParamsValues(); return $params['maxHeight'] ? $params['maxHeight'] : ''; break; case 'imageWidth': case 'imageHeight': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $imgPath = $path . "/" . $this->_subfieldValues[0]->getValue(); $sizeX = $sizeY = 0; if (file_exists($imgPath)) { list($sizeX, $sizeY) = @getimagesize($imgPath); } if ($name == 'imageWidth') { return (string) $sizeX; } else { return (string) $sizeY; } break; case 'imageZoomWidth': case 'imageZoomHeight': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $imgPath = $path . "/" . $this->_subfieldValues[2]->getValue(); $sizeX = $sizeY = 0; if (file_exists($imgPath)) { list($sizeX, $sizeY) = @getimagesize($imgPath); } if ($name == 'imageZoomWidth') { return (string) $sizeX; } else { return (string) $sizeY; } break; case 'imageSize': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $filesize = @filesize($path . "/" . $this->_subfieldValues[0]->getValue()); if ($filesize !== false && $filesize > 0) { //convert in MB $filesize = round($filesize / 1048576, 2) . ' M'; } else { $filesize = '0 M'; } return $filesize; break; case 'imageZoomSize': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $filesize = @filesize($path . "/" . $this->_subfieldValues[2]->getValue()); if ($filesize !== false && $filesize > 0) { //convert in MB $filesize = round($filesize / 1048576, 2) . ' M'; } else { $filesize = '0 M'; } return $filesize; break; case 'alternativeDomain': return $this->getAlternativeDomain(); default: return parent::getValue($name, $parameters); break; } }
/** * Replace block definition vars. * * @param array data : the block datas * @param string html_attributes : html attributes * @param integer $location The location of the page * @param boolean $public The needed precision for USERSPACE location * @return string the HTML data * @access public */ protected function _replaceBlockVars($data, $html_attributes, $location, $public) { //get folder for files $folder = $this->_getFolderName($location, $public); //must put the main website URL before if ($public && ALTERNATIVE_DOMAIN) { $mainurl = ALTERNATIVE_DOMAIN; } else { $mainurl = CMS_websitesCatalog::getCurrentDomain(@$this->_pageID); } $html = '<a href="' . $mainurl . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["file"] . '"' . $html_attributes . ' title="' . io::htmlspecialchars($data["label"]) . '">' . $data["label"] . '</a>'; $file = new CMS_file(PATH_MODULES_FILES_STANDARD_FS . '/' . $folder . '/' . $data["file"]); $filesize = $file->getFileSize(); $filesize = $filesize === false ? '0 M' : $filesize; $filesdatas = explode('_', $data["file"]); unset($filesdatas[0]); $originalFilename = io::substr(implode('_', $filesdatas), 32); $replace = array('{{data}}' => '<a href="' . $mainurl . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["file"] . '"' . $html_attributes . ' title="' . io::htmlspecialchars($data["label"]) . '" class="atm-file atm-filetype-' . $file->getExtension() . '">' . io::htmlspecialchars($data["label"]) . '</a>', '{{href}}' => $mainurl . PATH_MODULES_FILES_STANDARD_WR . '/' . $folder . '/' . $data["file"], '{{filename}}' => $data["file"], '{{originalfilename}}' => $originalFilename, '{{label}}' => io::htmlspecialchars($data["label"]), '{{jslabel}}' => io::htmlspecialchars($data["label"]), '{{size}}' => $filesize, '{{type}}' => $file->getExtension(), '{{icon}}' => $file->getFileIcon(CMS_file::WEBROOT) ? '<img src="' . $file->getFileIcon(CMS_file::WEBROOT) . '" title="' . $file->getExtension() . '" alt="' . $file->getExtension() . '" />' : ''); return str_replace(array_keys($replace), $replace, $this->_definition); }
/** * Get iframe code for current html embed code * * @param string $style the html style code to add * @param string $attr the html attributes code to add * @return string the html code * @access protected */ protected function _getIframe($style, $attr) { //load datas if (!($datas = $this->getDatas())) { return ''; } //already iframe embeded, no need to redo an iframe arround if (strtolower(substr(trim($datas['html']), 0, 8)) == '<iframe ') { return '<div' . $style . $attr . '>' . $datas['html'] . '</div>'; } //frame param $frameParam = base64_encode(serialize(array('url' => $this->_url, 'maxwidth' => io::isPositiveInteger($this->_maxwidth) ? $this->_maxwidth : '', 'maxheight' => io::isPositiveInteger($this->_maxheight) ? $this->_maxheight : ''))); //frame domain if (defined('APPLICATION_EMBED_DOMAIN') && APPLICATION_EMBED_DOMAIN) { $domain = strtolower(substr(APPLICATION_EMBED_DOMAIN, 0, 4)) == 'http' ? APPLICATION_EMBED_DOMAIN : 'http://' . APPLICATION_EMBED_DOMAIN; } else { $domain = CMS_websitesCatalog::getCurrentDomain(); } //iframe width/height $width = $height = ''; if (isset($datas['width']) && io::isPositiveInteger($datas['width'])) { $width = io::htmlspecialchars($datas['width']); } else { //try to guess width for iframe ... $matches = array(); if (preg_match('/^<[^>]* width="([0-9]+)"/i', trim($datas['html']), $matches) && isset($matches[1])) { $width = $matches[1]; } elseif (io::isPositiveInteger($this->_maxwidth)) { $width = $this->_maxwidth; } } if (isset($datas['height']) && io::isPositiveInteger($datas['height'])) { $height = io::htmlspecialchars($datas['height']); } else { //try to guess width for iframe ... $matches = array(); if (preg_match('/^<[^>]* height="([0-9]+)"/i', trim($datas['html']), $matches) && isset($matches[1])) { $height = $matches[1]; } elseif (io::isPositiveInteger($this->_maxheight)) { $height = $this->_maxheight; } } return '<iframe scrolling="no" frameBorder="0"' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . $domain . PATH_MAIN_WR . '/oembed/frame' . (!STRIP_PHP_EXTENSION ? '.php' : '') . '?params=' . $frameParam . '">' . ' <a href="' . $domain . PATH_MAIN_WR . '/oembed/frame' . (!STRIP_PHP_EXTENSION ? '.php' : '') . '?params=' . $frameParam . '" target="_blank">Click to view media</a>' . '</iframe>'; }
/** * get an object value * * @param string $name : the name of the value to get * @param string $parameters (optional) : parameters for the value to get * @return multidimentionnal array : the object values structure * @access public */ function getValue($name, $parameters = '') { switch ($name) { case 'file': case 'thumb': if ($name == 'file') { $fieldIndex = 4; $fielfPrefix = 'image'; } else { $fieldIndex = 1; $fielfPrefix = 'thumb'; } // If we have a value and there are additionnal cropping parameters if ($this->_subfieldValues[$fieldIndex]->getValue() && $parameters && in_array($this->getValue($name . 'Extension'), array('jpg', 'jpeg', 'png', 'gif'))) { @(list($x, $y) = explode(',', str_replace(';', ',', $parameters))); if (io::isPositiveInteger($x) && $x < $this->getValue($fielfPrefix . 'Width') || io::isPositiveInteger($y) && $y < $this->getValue($fielfPrefix . 'Height')) { $crop = $x && $y ? 1 : 0; //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; //resized image path $pathInfo = pathinfo($this->_subfieldValues[$fieldIndex]->getValue()); $resizedImage = $pathInfo['filename'] . '-' . $x . '-' . $y . ($crop ? '-c' : '') . '.' . $pathInfo['extension']; //resized image path $resizedImagepathFS = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location . '/' . $resizedImage; //if file already exists, no need to resize file send it if (file_exists($resizedImagepathFS)) { return $this->getValue('filePath') . '/' . $resizedImage; } else { return CMS_websitesCatalog::getCurrentDomain() . PATH_REALROOT_WR . '/image-file' . (!STRIP_PHP_EXTENSION ? '.php' : '') . '?image=' . $this->_subfieldValues[$fieldIndex]->getValue() . '&module=' . $moduleCodename . '&x=' . $x . '&y=' . $y . '&crop=' . $crop . ($location != RESOURCE_DATA_LOCATION_PUBLIC ? '&location=' . $location : ''); } } } if ($this->_subfieldValues[$fieldIndex]->getValue()) { // If we have a value but no cropping params return $this->getValue('filePath') . '/' . $this->_subfieldValues[$fieldIndex]->getValue(); } return ''; break; case 'fileHTML': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->_public ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $filepath = $this->_subfieldValues[3]->getValue() == self::OBJECT_FILE_TYPE_INTERNAL ? PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . $location . '/' . $this->_subfieldValues[4]->getValue() : $this->_subfieldValues[4]->getValue(); //append website url if missing if (io::substr($filepath, 0, 1) == '/') { $filepath = CMS_websitesCatalog::getCurrentDomain() . $filepath; } //link content $linkContent = $parameters ? $parameters : $this->_subfieldValues[0]->getValue(); $file = '<a href="' . $filepath . '" target="_blank" title="' . $this->_subfieldValues[0]->getValue() . '">' . $linkContent . '</a>'; return $file; break; case 'fileLabel': return $this->_subfieldValues[0]->getValue(); break; case 'filename': return $this->_subfieldValues[4]->getValue(); break; case 'thumbnail': case 'thumbname': return $this->_subfieldValues[1]->getValue(); break; case 'filePath': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $altDomain = $this->getAlternativeDomain(); // If we are serving a public file and there is an alternative domain set up, change the url if ($this->isPublic() && $altDomain) { return $altDomain . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . $location; } else { return CMS_websitesCatalog::getCurrentDomain() . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . $location; } break; case 'thumbMaxWidth': //get field parameters $params = $this->getParamsValues(); return $params['thumbMaxWidth'] ? $params['thumbMaxWidth'] : ''; break; case 'thumbMaxHeight': //get field parameters $params = $this->getParamsValues(); return $params['thumbMaxHeight'] ? $params['thumbMaxHeight'] : ''; break; case 'thumbWidth': case 'thumbHeight': //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $imgPath = $path . "/" . $this->_subfieldValues[1]->getValue(); $sizeX = $sizeY = 0; if (file_exists($imgPath)) { list($sizeX, $sizeY) = @getimagesize($imgPath); } if ($name == 'thumbWidth') { return (string) $sizeX; } else { return (string) $sizeY; } break; case 'imageWidth': case 'imageHeight': if ($this->_subfieldValues[4]->getValue() && in_array($this->getValue('fileExtension'), array('jpg', 'jpeg', 'png', 'gif'))) { //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); //set location $location = $this->isPublic() ? RESOURCE_DATA_LOCATION_PUBLIC : RESOURCE_DATA_LOCATION_EDITED; $path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . $location; $imgPath = $path . "/" . $this->_subfieldValues[4]->getValue(); $sizeX = $sizeY = 0; if (file_exists($imgPath)) { list($sizeX, $sizeY) = @getimagesize($imgPath); } if ($name == 'imageWidth') { return (string) $sizeX; } else { return (string) $sizeY; } } return 0; break; case 'fileSize': return $this->_subfieldValues[2]->getValue(); break; case 'fileIcon': return $this->_getFileIcon(); break; case 'fileExtension': return $this->_getFileExtension(); break; case 'thumbExtension': return $this->_getThumbExtension(); break; case 'alternativeDomain': return $this->getAlternativeDomain(); default: return parent::getValue($name, $parameters); break; } }
public static function getServiceUrl() { return CMS_websitesCatalog::getCurrentDomain() . '/embed/oembed' . (!STRIP_PHP_EXTENSION ? '.php' : '') . '?url=' . rawurlencode(CMS_websitesCatalog::getCurrentDomain() . $_SERVER['REQUEST_URI']); }