本文整理汇总了PHP中Tools::getMediaServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::getMediaServer方法的具体用法?PHP Tools::getMediaServer怎么用?PHP Tools::getMediaServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::getMediaServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImageLink
public function getImageLink($name, $ids, $type = null)
{
global $protocol_content;
if (empty($protocol_content)) {
$protocol_content = _PS_SSL_ENABLED_ ? 'https://' : 'http://';
}
// legacy mode or default image
if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '.jpg') || strpos($ids, 'default') !== false) {
// if ($this->allow == 1)
// $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').'/'.$name.'.jpg';
// else
// $uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').'.jpg';
$uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . '.jpg';
} else {
// if ids if of the form id_product-id_image, we want to extract the id_image part
$split_ids = explode('-', $ids);
$id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
// if ($this->allow == 1)
// $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').'/'.$name.'.jpg';
// else
// $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'.jpg';
$uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '.jpg';
}
return $protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例2: getImageLink
public function getImageLink($name, $ids, $type = null)
{
$context = Context::getContext();
// check if WebP support is enabled.
if ($context->cookie->exists() && $context->cookie->WebPSupport) {
$extension = '.webp';
} else {
$extension = '.jpg';
}
$not_default = false;
// Check if module is installed, enabled, customer is logged in and watermark logged option is on
if (Configuration::get('WATERMARK_LOGGED') && (Module::isInstalled('watermark') && Module::isEnabled('watermark')) && isset(Context::getContext()->customer->id)) {
$type .= '-' . Configuration::get('WATERMARK_HASH');
}
// legacy mode or default image
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension) || ($not_default = strpos($ids, 'default') !== false)) {
if ($this->allow == 1 && !$not_default) {
$uri_path = __PS_BASE_URI__ . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
} else {
$uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension;
}
} else {
// if ids if of the form id_product-id_image, we want to extract the id_image part
$split_ids = explode('-', $ids);
$id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
if ($this->allow == 1) {
$uri_path = __PS_BASE_URI__ . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
} else {
$uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . $theme . $extension;
}
}
return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例3: getImageLink
public function getImageLink($name, $ids, $type = null, $overimage = null)
{
$not_default = false;
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : '';
if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg') || ($not_default = strpos($ids, 'default') !== false)) {
if ($this->allow == 1 && !$not_default) {
$uri_path = __PS_BASE_URI__ . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg';
} else {
$uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg';
}
} else {
$split_ids = explode('-', $ids);
$id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : '';
if (isset($overimage)) {
$sql = "SELECT id_image FROM `" . _DB_PREFIX_ . "image` WHERE `id_product` = '{$overimage}' AND position = 2";
$getoverimage = Db::getInstance()->getRow($sql);
if ($getoverimage) {
$id_image = array_shift($getoverimage);
} else {
return false;
}
}
if ($this->allow == 1) {
$uri_path = __PS_BASE_URI__ . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg';
} else {
$uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . $theme . '.jpg';
}
}
return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例4: init
public function init()
{
if (parent::$initialized) {
return;
}
$ret = parent::init();
// This override is part of the cloudcache module, so the cloudcache.php file exists
require_once dirname(__FILE__) . '/../../modules/cloudcache/cloudcache.php';
// As parent::init() set the parent::$initialized flag, all below will be done only once.
$module = new CloudCache();
if (!$module->active || !Configuration::get('CLOUDCACHE_API_ACTIVE')) {
return $ret;
}
// Use global because 1.4 only, 1.5 is in an other file
global $smarty;
$assignArray = array('img_ps_dir' => _PS_IMG_, 'img_cat_dir' => _THEME_CAT_DIR_, 'img_lang_dir' => _THEME_LANG_DIR_, 'img_prod_dir' => _THEME_PROD_DIR_, 'img_manu_dir' => _THEME_MANU_DIR_, 'img_sup_dir' => _THEME_SUP_DIR_, 'img_ship_dir' => _THEME_SHIP_DIR_, 'img_store_dir' => _THEME_STORE_DIR_, 'img_col_dir' => _THEME_COL_DIR_, 'img_dir' => _THEME_IMG_DIR_, 'css_dir' => _THEME_CSS_DIR_, 'js_dir' => _THEME_JS_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_);
$httHost = Tools::getHttpHost();
$useSSL = isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED') && Tools::usingSecureMode() ? true : false;
$protocol_content = $useSSL ? 'https://' : 'http://';
foreach ($assignArray as $assignKey => $assignValue) {
if (substr($assignValue, 0, 1) == '/' || $protocol_content == 'https://') {
$smarty->assign($assignKey, $protocol_content . Tools::getMediaServer($assignValue) . $assignValue);
} else {
$smarty->assign($assignKey, $assignValue);
}
}
return $ret;
}
示例5: hookDisplayTop
public function hookDisplayTop($params)
{
if (!$this->isCached('blockbanner.tpl', $this->getCacheId())) {
$imgname = Configuration::get('BLOCKBANNER_IMG', $this->context->language->id);
if ($imgname && file_exists(_PS_MODULE_DIR_ . $this->name . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . $imgname)) {
$this->smarty->assign('banner_img', $this->context->link->protocol_content . Tools::getMediaServer($imgname) . $this->_path . 'img/' . $imgname);
}
$this->smarty->assign(array('banner_link' => Configuration::get('BLOCKBANNER_LINK', $this->context->language->id), 'banner_desc' => Configuration::get('BLOCKBANNER_DESC', $this->context->language->id)));
}
return $this->display(__FILE__, 'blockbanner.tpl', $this->getCacheId());
}
示例6: getHeader
/**
* Returns the template's HTML header
* @return string HTML header
*/
public function getHeader()
{
$shop_name = Configuration::get('PS_SHOP_NAME');
$path_logo = $this->getLogo();
$width = 0;
$height = 0;
if (!empty($path_logo)) {
list($width, $height) = getimagesize($path_logo);
}
$this->smarty->assign(array('logo_path' => $path_logo, 'img_ps_dir' => 'http://' . Tools::getMediaServer(_PS_IMG_) . _PS_IMG_, 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'title' => $this->title, 'date' => $this->date, 'shop_name' => $shop_name, 'width_logo' => $width, 'height_logo' => $height));
return $this->smarty->fetch($this->getTemplate('header'));
}
示例7: initialize
protected function initialize()
{
$this->adv_imgname = 'advertising';
if ((Shop::getContext() == Shop::CONTEXT_GROUP || Shop::getContext() == Shop::CONTEXT_SHOP) && file_exists(_PS_MODULE_DIR_ . $this->name . '/' . $this->adv_imgname . '-g' . $this->context->shop->getContextShopGroupID() . '.' . Configuration::get('BLOCKADVERT_IMG_EXT'))) {
$this->adv_imgname .= '-g' . $this->context->shop->getContextShopGroupID();
}
if (Shop::getContext() == Shop::CONTEXT_SHOP && file_exists(_PS_MODULE_DIR_ . $this->name . '/' . $this->adv_imgname . '-s' . $this->context->shop->getContextShopID() . '.' . Configuration::get('BLOCKADVERT_IMG_EXT'))) {
$this->adv_imgname .= '-s' . $this->context->shop->getContextShopID();
}
$this->adv_img = Tools::getMediaServer($this->name) . _MODULE_DIR_ . $this->name . '/' . $this->adv_imgname . '.' . Configuration::get('BLOCKADVERT_IMG_EXT');
$this->adv_link = htmlentities(Configuration::get('BLOCKADVERT_LINK'), ENT_QUOTES, 'UTF-8');
$this->adv_title = htmlentities(Configuration::get('BLOCKADVERT_TITLE'), ENT_QUOTES, 'UTF-8');
}
示例8: getContent
public function getContent()
{
$output = $this->postProcess() . '
<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" enctype="multipart/form-data">
<fieldset>
<legend>' . $this->l('Store block configuration') . '</legend>';
if (Configuration::get('BLOCKSTORE_IMG')) {
$output .= '<div class="margin-form"><img src="' . Tools::getProtocol() . Tools::getMediaServer($this->name) . _MODULE_DIR_ . $this->name . '/' . Configuration::get('BLOCKSTORE_IMG') . '" alt="' . $this->l('Store image') . '" style="height:115px;margin-left: 100px;width:174px"/></div>';
}
$output .= '
<label for="store_img">' . $this->l('Change image') . '</label>
<div class="margin-form">
<input id="store_img" type="file" name="store_img" /> ( ' . $this->l('image will be displayed as 174x115') . ' )
</div>
<p class="center">
<input class="button" type="submit" name="submitStoreConf" value="' . $this->l('Save') . '"/>
</p>
</fieldset>
</form>
';
return $output;
}
示例9: init
//.........这里部分代码省略.........
}
if (Validate::isLoadedObject($ps_language = new Language((int) $cookie->id_lang))) {
$smarty->ps_language = $ps_language;
}
/* get page name to display it in body id */
$pathinfo = pathinfo(__FILE__);
$page_name = basename($_SERVER['PHP_SELF'], '.' . $pathinfo['extension']);
$page_name = preg_match('/^[0-9]/', $page_name) ? 'page_' . $page_name : $page_name;
$smarty->assign(Tools::getMetaTags($cookie->id_lang, $page_name));
$smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
/* Breadcrumb */
$navigationPipe = Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>';
$smarty->assign('navigationPipe', $navigationPipe);
$protocol_link = (Configuration::get('PS_SSL_ENABLED') or !empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED') or !empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' : 'http://';
if (!defined('_PS_BASE_URL_')) {
define('_PS_BASE_URL_', Tools::getShopDomain(true));
}
if (!defined('_PS_BASE_URL_SSL_')) {
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
}
$link->preloadPageLinks();
$this->canonicalRedirection();
Product::initPricesComputation();
$display_tax_label = $defaultCountry->display_tax_label;
if ($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) {
$infos = Address::getCountryAndState((int) $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$country = new Country((int) $infos['id_country']);
if (Validate::isLoadedObject($country)) {
$display_tax_label = $country->display_tax_label;
}
}
global $isBetaUser, $conversion_rate_inr;
$conversion_rate_inr = 55;
if (!$cookie->isLogged()) {
$this->initFacebook();
} else {
$customer_groups = Customer::getGroupsStatic((int) $cookie->id_customer);
if (in_array(2, $customer_groups)) {
$smarty->assign('internal_vb_user', 1);
}
if (in_array(3, $customer_groups)) {
$isBetaUser = true;
} else {
$isBetaUser = false;
}
/*$reward_points = VBRewards::getCustomerPoints($cookie->id_customer);
$can_redeem = VBRewards::checkPointsValidity($cookie->id_customer, 0);
if($can_redeem)
$smarty->assign('can_redeem_points', 1);
$smarty->assign('balance_points', $reward_points);*/
}
$smarty->assign('img_version', IMG_VERSION);
$this->setRecaptchaHTML();
if ($page_name === "index") {
$sql = "select title,image_path,url from ps_banner where is_active = 1 order by display_order asc";
$home_banners = Db::getInstance()->ExecuteS($sql);
$smarty->assign("home_banners", $home_banners);
}
$smarty->assign(array('lazy' => 1, 'link' => $link, 'cart' => $cart, 'currency' => $currency, 'cookie' => $cookie, 'page_name' => $page_name, 'base_dir' => _PS_BASE_URL_ . __PS_BASE_URI__, 'base_dir_ssl' => $protocol_link . Tools::getShopDomainSsl() . __PS_BASE_URI__, 'content_dir' => $protocol_content . Tools::getShopDomain() . __PS_BASE_URI__, 'tpl_dir' => _PS_THEME_DIR_, 'modules_dir' => _MODULE_DIR_, 'mail_dir' => _MAIL_DIR_, 'lang_iso' => $ps_language->iso_code, 'come_from' => Tools::getHttpHost(true, true) . Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))), 'cart_qties' => (int) $cart->nbProducts(), 'currencies' => Currency::getCurrencies(), 'languages' => Language::getLanguages(), 'priceDisplay' => Product::getTaxCalculationMethod(), 'add_prod_display' => (int) Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'roundMode' => (int) Configuration::get('PS_PRICE_ROUND_MODE'), 'use_taxes' => (int) Configuration::get('PS_TAX'), 'display_tax_label' => (bool) $display_tax_label, 'vat_management' => (int) Configuration::get('VATNUMBER_MANAGEMENT'), 'opc' => (bool) Configuration::get('PS_ORDER_PROCESS_TYPE'), 'PS_CATALOG_MODE' => (bool) Configuration::get('PS_CATALOG_MODE'), 'conversion_rate' => $conversion_rate_inr));
// Deprecated
$smarty->assign(array('id_currency_cookie' => (int) $currency->id, 'logged' => $cookie->isLogged(), 'customerName' => $cookie->logged ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : false));
// TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
$assignArray = array('img_ps_dir' => _PS_IMG_, 'img_cat_dir' => _THEME_CAT_DIR_, 'img_lang_dir' => _THEME_LANG_DIR_, 'img_prod_dir' => _THEME_PROD_DIR_, 'img_manu_dir' => _THEME_MANU_DIR_, 'img_sup_dir' => _THEME_SUP_DIR_, 'img_ship_dir' => _THEME_SHIP_DIR_, 'img_store_dir' => _THEME_STORE_DIR_, 'img_col_dir' => _THEME_COL_DIR_, 'img_dir' => _THEME_IMG_DIR_, 'css_dir' => _THEME_CSS_DIR_, 'js_dir' => _THEME_JS_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_);
foreach ($assignArray as $assignKey => $assignValue) {
if (substr($assignValue, 0, 1) == '/' or $protocol_content == 'https://') {
$smarty->assign($assignKey, $protocol_content . Tools::getMediaServer($assignValue) . $assignValue);
} else {
$smarty->assign($assignKey, $assignValue);
}
}
// setting properties from global var
self::$cookie = $cookie;
self::$cart = $cart;
self::$smarty = $smarty;
self::$link = $link;
if ($this->maintenance) {
$this->displayMaintenancePage();
}
if ($this->restrictedCountry) {
$this->displayRestrictedCountryPage();
}
//live edit
if (Tools::isSubmit('live_edit') and $ad = Tools::getValue('ad') and Tools::getValue('liveToken') == sha1(Tools::getValue('ad') . _COOKIE_KEY_)) {
if (!is_dir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . $ad)) {
die(Tools::displayError());
}
}
$this->iso = $iso;
$this->setMedia();
//For sokrati pixel
self::$smarty->assign("new_customer_regd", false);
if ((int) self::$cookie->new_reg === 1) {
self::$smarty->assign("new_customer_regd", true);
unset(self::$cookie->new_reg);
}
if (self::$cookie->id_customer) {
self::$smarty->assign("balance_points", VBRewards::getCustomerPoints(self::$cookie->id_customer));
}
}
示例10: getImageLink
public function getImageLink($name, $ids, $type = NULL)
{
global $protocol_content;
// legacy mode or default image
if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '.jpg') || strpos($ids, 'default') !== false) {
$uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . '.jpg';
} else {
// if ids if of the form id_product-id_image, we want to extract the id_image part
$split_ids = explode('-', $ids);
$id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
$uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '.jpg';
}
return $protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例11: cccJS
/**
* Combine Compress and Cache (ccc) JS calls
*/
public static function cccJS()
{
global $js_files, $protocol_link;
//inits
$compressed_js_files_not_found = array();
$js_files_infos = array();
$js_files_date = 0;
$compressed_js_file_date = 0;
$compressed_js_filename = '';
$js_external_files = array();
// get js files infos
foreach ($js_files as $filename) {
$expr = explode(':', $filename);
if ($expr[0] == 'http') {
$js_external_files[] = $filename;
} else {
$infos = array();
$infos['uri'] = $filename;
$url_data = parse_url($filename);
$infos['path'] = _PS_ROOT_DIR_ . Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']);
$js_files_infos[] = $infos;
$js_files_date = max(file_exists($infos['path']) ? filemtime($infos['path']) : 0, $js_files_date);
$compressed_js_filename .= $filename;
}
}
// get compressed js file infos
$compressed_js_filename = md5($compressed_js_filename);
$compressed_js_path = _PS_THEME_DIR_ . 'cache/' . $compressed_js_filename . '.js';
$compressed_js_file_date = file_exists($compressed_js_path) ? filemtime($compressed_js_path) : 0;
// aggregate and compress js files content, write new caches files
if ($js_files_date > $compressed_js_file_date) {
$content = '';
foreach ($js_files_infos as $file_infos) {
if (file_exists($file_infos['path'])) {
$content .= file_get_contents($file_infos['path']) . ';';
} else {
$compressed_js_files_not_found[] = $file_infos['path'];
}
}
$content = Tools::packJS($content);
if (!empty($compressed_js_files_not_found)) {
$content = '/* WARNING ! file(s) not found : "' . implode(',', $compressed_js_files_not_found) . '" */' . "\n" . $content;
}
file_put_contents($compressed_js_path, $content);
chmod($compressed_js_path, 0777);
}
// rebuild the original js_files array
$url = str_replace(_PS_ROOT_DIR_ . '/', __PS_BASE_URI__, $compressed_js_path);
$js_files = array_merge(array($protocol_link . Tools::getMediaServer($url) . $url), $js_external_files);
}
示例12: getCatImageLink
public function getCatImageLink($name, $id_category, $type = null)
{
if ($this->allow == 1 && $type) {
$uri_path = __PS_BASE_URI__ . 'c/' . $id_category . '-' . $type . '/' . $name . '.jpg';
} else {
$uri_path = _THEME_CAT_DIR_ . $id_category . ($type ? '-' . $type : '') . '.jpg';
}
return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例13: replaceByAbsoluteURL
public static function replaceByAbsoluteURL($matches)
{
global $current_css_file;
$protocol_link = Tools::getCurrentUrlProtocolPrefix();
if (array_key_exists(1, $matches) && array_key_exists(2, $matches)) {
if (!preg_match('/^(?:https?:)?\\/\\//iUs', $matches[2])) {
$tmp = dirname($current_css_file) . '/' . $matches[2];
return $matches[1] . $protocol_link . Tools::getMediaServer($tmp) . $tmp;
} else {
return $matches[0];
}
}
return false;
}
示例14: postProcess
/**
* postProcess update configuration
* @TODO adding alt and title attributes for <img> and <a>
* @var string
* @return void
*/
public function postProcess()
{
global $currentIndex;
$errors = '';
if (Tools::isSubmit('submitDeleteImgConf')) {
$this->_deleteCurrentImg();
}
if (Tools::isSubmit('submitAdvConf')) {
$file = false;
if (isset($_FILES['adv_img']) and isset($_FILES['adv_img']['tmp_name']) and !empty($_FILES['adv_img']['tmp_name'])) {
if ($error = checkImage($_FILES['adv_img'], Tools::convertBytes(ini_get('upload_max_filesize')))) {
$errors .= $error;
} elseif ($dot_pos = strrpos($_FILES['adv_img']['name'], '.')) {
// as checkImage tell us it's a good image, we'll just copy the extension
$this->_deleteCurrentImg();
$this->adv_imgname = 'advertising';
$ext = substr($_FILES['adv_img']['name'], $dot_pos + 1);
$newname = 'advertising_custom';
if (!move_uploaded_file($_FILES['adv_img']['tmp_name'], _PS_MODULE_DIR_ . $this->name . '/' . $newname . '.' . $ext)) {
$errors .= $this->l('Error move uploaded file');
} else {
$this->adv_imgname = $newname;
}
Configuration::updateValue('BLOCKADVERT_IMG_EXT', $ext);
$this->adv_img = Tools::getMediaServer($this->name) . _MODULE_DIR_ . $this->name . '/' . $this->adv_imgname . '.' . Configuration::get('BLOCKADVERT_IMG_EXT');
}
}
if ($link = Tools::getValue('adv_link')) {
Configuration::updateValue('BLOCKADVERT_LINK', $link);
$this->adv_link = htmlentities($link, ENT_QUOTES, 'UTF-8');
}
if ($title = Tools::getValue('adv_title')) {
Configuration::updateValue('BLOCKADVERT_TITLE', $title);
$this->adv_title = htmlentities($title, ENT_QUOTES, 'UTF-8');
}
}
if ($errors) {
echo $this->displayError($errors);
}
}
示例15: getHeader
/**
* @see HTMLTemplate::getHeader()
*/
public function getHeader()
{
$shop_name = Configuration::get('PS_SHOP_NAME');
$this->smarty->assign(array('logo_path' => $this->getLogo(), 'img_ps_dir' => 'http://' . Tools::getMediaServer(_PS_IMG_) . _PS_IMG_, 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'title' => $this->title, 'reference' => $this->supply_order->reference, 'date' => $this->date, 'shop_name' => $shop_name));
return $this->smarty->fetch($this->getTemplate('supply-order-header'));
}