当前位置: 首页>>代码示例>>PHP>>正文


PHP Configuration::hasContext方法代码示例

本文整理汇总了PHP中Configuration::hasContext方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::hasContext方法的具体用法?PHP Configuration::hasContext怎么用?PHP Configuration::hasContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration::hasContext方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitStoreConf')) {
         if (isset($_FILES['store_img']) && isset($_FILES['store_img']['tmp_name']) && !empty($_FILES['store_img']['tmp_name'])) {
             if ($error = ImageManager::validateUpload($_FILES['store_img'], 4000000)) {
                 return $this->displayError($this->l('invalid image'));
             } else {
                 if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__) . '/' . $_FILES['store_img']['name'])) {
                     return $this->displayError($this->l('an error occurred on uploading file'));
                 } else {
                     if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) {
                         @unlink(dirname(__FILE__) . '/' . Configuration::get('BLOCKSTORE_IMG'));
                     }
                     Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
                     return $this->displayConfirmation($this->l('Settings are updated'));
                 }
             }
         }
     }
     return '';
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:21,代码来源:blockstore.php

示例2: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitStoreConf')) {
         if (isset($_FILES['store_img']) && isset($_FILES['store_img']['tmp_name']) && !empty($_FILES['store_img']['tmp_name'])) {
             if ($error = ImageManager::validateUpload($_FILES['store_img'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__) . '/' . $_FILES['store_img']['name'])) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) {
                         @unlink(dirname(__FILE__) . '/' . Configuration::get('BLOCKSTORE_IMG'));
                     }
                     Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
                     $this->_clearCache('blockstore.tpl');
                     return $this->displayConfirmation($this->l('The settings have been updated.'));
                 }
             }
         }
     }
     return '';
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:22,代码来源:blockstore.php

示例3: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitStoreConf')) {
         if (!($languages = Language::getLanguages(true))) {
             return false;
         }
         $text = array();
         foreach ($languages as $lang) {
             $text[$lang['id_lang']] = Tools::getValue('BLOCKSTORE_TEXT_' . $lang['id_lang']);
         }
         Configuration::updateValue('BLOCKSTORE_TEXT', $text);
         if (isset($_FILES['BLOCKSTORE_IMG']) && isset($_FILES['BLOCKSTORE_IMG']['tmp_name']) && !empty($_FILES['BLOCKSTORE_IMG']['tmp_name'])) {
             if ($error = ImageManager::validateUpload($_FILES['BLOCKSTORE_IMG'], 4000000)) {
                 return $this->displayError($this->l('Invalid image.'));
             } else {
                 $ext = substr($_FILES['BLOCKSTORE_IMG']['name'], strrpos($_FILES['BLOCKSTORE_IMG']['name'], '.') + 1);
                 $file_name = md5($_FILES['BLOCKSTORE_IMG']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['BLOCKSTORE_IMG']['tmp_name'], dirname(__FILE__) . '/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $file_name) {
                         @unlink(dirname(__FILE__) . '/' . Configuration::get('BLOCKSTORE_IMG'));
                     }
                     Configuration::updateValue('BLOCKSTORE_IMG', $file_name);
                     $this->_clearCache('blockstore.tpl');
                     return $this->displayConfirmation($this->l('The settings have been updated.'));
                 }
             }
         }
         $this->_clearCache('blockstore.tpl');
     }
     return '';
 }
开发者ID:evgrishin,项目名称:mh16014,代码行数:33,代码来源:blockstore.php

示例4: processImageCategory

 public function processImageCategory($FILES, $id)
 {
     if (isset($FILES['category_image']) && isset($FILES['category_image']['tmp_name']) && !empty($FILES['category_image']['tmp_name'])) {
         if ($error = ImageManager::validateUpload($FILES['category_image'], 4000000)) {
             return $this->displayError($this->l('Invalid image'));
         } else {
             $ext = substr($FILES['category_image']['name'], strrpos($FILES['category_image']['name'], '.') + 1);
             $file_name = $id . '.' . $ext;
             $path = _PS_MODULE_DIR_ . 'smartblog/images/category/' . $file_name;
             if (!move_uploaded_file($FILES['category_image']['tmp_name'], $path)) {
                 return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
             } else {
                 if (Configuration::hasContext('category_image', null, Shop::getContext()) && Configuration::get('BLOCKBANNER_IMG') != $file_name) {
                     @unlink(dirname(__FILE__) . '/' . Configuration::get('BLOCKBANNER_IMG'));
                 }
                 $images_types = BlogImageType::GetImageAllType('category');
                 foreach ($images_types as $image_type) {
                     $dir = _PS_MODULE_DIR_ . 'smartblog/images/category/' . $id . '-' . stripslashes($image_type['type_name']) . '.jpg';
                     if (file_exists($dir)) {
                         unlink($dir);
                     }
                 }
                 foreach ($images_types as $image_type) {
                     ImageManager::resize($path, _PS_MODULE_DIR_ . 'smartblog/images/category/' . $id . '-' . stripslashes($image_type['type_name']) . '.jpg', (int) $image_type['width'], (int) $image_type['height']);
                 }
             }
         }
     }
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:29,代码来源:AdminBlogCategoryController.php

示例5: hasContext

 public static function hasContext($key, $id_lang, $context)
 {
     ConfigurationKPI::setKpiDefinition();
     $r = parent::hasContext($key, $id_lang, $context);
     ConfigurationKPI::unsetKpiDefinition();
     return $r;
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:7,代码来源:ConfigurationKPI.php

示例6: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitStoreConf')) {
         $languages = Language::getLanguages(false);
         $values = array();
         $update_images_values = false;
         foreach ($languages as $lang) {
             if (isset($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]) && isset($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['tmp_name']) && !empty($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['tmp_name'])) {
                 if ($error = ImageManager::validateUpload($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']], 4000000)) {
                     return $this->displayError($this->l('Invalid image'));
                 } else {
                     $ext = substr($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['name'], strrpos($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['name'], '.') + 1);
                     $file_name = md5($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['name']) . '.' . $ext;
                     if (!move_uploaded_file($_FILES['BLOCKBANNER_IMG_' . $lang['id_lang']]['tmp_name'], dirname(__FILE__) . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . $file_name)) {
                         return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                     } else {
                         if (Configuration::hasContext('BLOCKBANNER_IMG', $lang['id_lang'], Shop::getContext()) && Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']) != $file_name) {
                             @unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']));
                         }
                         $values['BLOCKBANNER_IMG'][$lang['id_lang']] = $file_name;
                     }
                 }
                 $update_images_values = true;
             }
             $values['BLOCKBANNER_LINK'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_LINK_' . $lang['id_lang']);
             $values['BLOCKBANNER_DESC'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_DESC_' . $lang['id_lang']);
         }
         if ($update_images_values) {
             Configuration::updateValue('BLOCKBANNER_IMG', $values['BLOCKBANNER_IMG']);
         }
         Configuration::updateValue('BLOCKBANNER_LINK', $values['BLOCKBANNER_LINK']);
         Configuration::updateValue('BLOCKBANNER_DESC', $values['BLOCKBANNER_DESC']);
         $this->_clearCache('blockbanner.tpl');
         return $this->displayConfirmation($this->l('The settings have been updated.'));
     }
     return '';
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:37,代码来源:blockbanner.php

示例7: isOverridenByCurrentContext

 public static function isOverridenByCurrentContext($key)
 {
     if (Configuration::isLangKey($key)) {
         $testContext = false;
         foreach (Language::getLanguages(false) as $lang) {
             if (Shop::getContext() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_SHOP) || Shop::getContext() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_GROUP)) {
                 $testContext = true;
             }
         }
     } else {
         $testContext = Shop::getContext() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, null, Shop::CONTEXT_SHOP) || Shop::getContext() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, null, Shop::CONTEXT_GROUP) ? true : false;
     }
     return Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && $testContext;
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:14,代码来源:Configuration.php

示例8: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $line1 = strval(Tools::getValue('BANNER_TEXT_LINE1'));
         if (!isset($line1)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('BANNER_TEXT_LINE1', $line1);
             Configuration::updateValue('BANNER_TEXT_LINE2', Tools::getValue('BANNER_TEXT_LINE2'));
             Configuration::updateValue('SEARCH_LEFT_COLUMN', Tools::getValue('SEARCH_LEFT_COLUMN'));
             Configuration::updateValue('UNDER_LEFT_COLUMN', Tools::getValue('UNDER_LEFT_COLUMN'));
             Configuration::updateValue('SEARCH_RIGHT_COLUMN', Tools::getValue('SEARCH_RIGHT_COLUMN'));
             Configuration::updateValue('UNDER_PRODUCTS_HEAD', Tools::getValue('UNDER_PRODUCTS_HEAD'));
             Configuration::updateValue('UNDER_PRODUCTS_TEXT', Tools::getValue('UNDER_PRODUCTS_TEXT'));
             Configuration::updateValue('UNDER_BUTTONS_LINE1', Tools::getValue('UNDER_BUTTONS_LINE1'));
             Configuration::updateValue('UNDER_BUTTONS_LINE2', Tools::getValue('UNDER_BUTTONS_LINE2'));
             Configuration::updateValue('UNDER_BUTTONS_TEXT', Tools::getValue('UNDER_BUTTONS_TEXT'));
             Configuration::updateValue('UNDER_BUTTONS_SMALL_TEXT', Tools::getValue('UNDER_BUTTONS_SMALL_TEXT'));
             Configuration::updateValue('UNDER_SLIDER_HEAD1', Tools::getValue('UNDER_SLIDER_HEAD1'));
             Configuration::updateValue('UNDER_SLIDER_HEAD2', Tools::getValue('UNDER_SLIDER_HEAD2'));
             Configuration::updateValue('LEFT_COLUMN_FACT1', Tools::getValue('LEFT_COLUMN_FACT1'));
             Configuration::updateValue('LEFT_COLUMN_FACT2', Tools::getValue('LEFT_COLUMN_FACT2'));
             Configuration::updateValue('LEFT_COLUMN_FACT3', Tools::getValue('LEFT_COLUMN_FACT3'));
             Configuration::updateValue('LEFT_COLUMN_FACT4', Tools::getValue('LEFT_COLUMN_FACT4'));
             Configuration::updateValue('LEFT_COLUMN_SMALL_TEXT', Tools::getValue('LEFT_COLUMN_SMALL_TEXT'));
             Configuration::updateValue('LEFT_COLUMN_TEXT', Tools::getValue('LEFT_COLUMN_TEXT'));
             Configuration::updateValue('RIGHT_COLUMN_FACT1', Tools::getValue('RIGHT_COLUMN_FACT1'));
             Configuration::updateValue('RIGHT_COLUMN_FACT2', Tools::getValue('RIGHT_COLUMN_FACT2'));
             Configuration::updateValue('RIGHT_COLUMN_FACT3', Tools::getValue('RIGHT_COLUMN_FACT3'));
             Configuration::updateValue('RIGHT_COLUMN_SMALL_TEXT', Tools::getValue('RIGHT_COLUMN_SMALL_TEXT'));
             Configuration::updateValue('RIGHT_COLUMN_TEXT', Tools::getValue('RIGHT_COLUMN_TEXT'));
             Configuration::updateValue('REVIEWS', Tools::getValue('REVIEWS'));
             if (isset($_FILES['ASK_IMG']) && isset($_FILES['ASK_IMG']['tmp_name']) && !empty($_FILES['ASK_IMG']['tmp_name'])) {
                 if ($error = ImageManager::validateUpload($_FILES['ASK_IMG'], 4000000)) {
                     $this->displayError($this->l('Invalid image.'));
                 } else {
                     $ext = substr($_FILES['ASK_IMG']['name'], strrpos($_FILES['ASK_IMG']['name'], '.') + 1);
                     $file_name = md5($_FILES['ASK_IMG']['name']) . '.' . $ext;
                     if (!move_uploaded_file($_FILES['ASK_IMG']['tmp_name'], dirname(__FILE__) . '/' . $file_name)) {
                         $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                     } else {
                         if (Configuration::hasContext('ASK_IMG', null, Shop::getContext()) && Configuration::get('ASK_IMG') != $file_name) {
                             @unlink(dirname(__FILE__) . '/' . Configuration::get('ASK_IMG'));
                         }
                         Configuration::updateValue('ASK_IMG', $file_name);
                         $this->_clearCache('homepagecontent.tpl');
                         $this->displayConfirmation($this->l('The settings have been updated.'));
                     }
                 }
             }
             if (isset($_FILES['UNDER_CONTENT_IMG']) && isset($_FILES['UNDER_CONTENT_IMG']['tmp_name']) && !empty($_FILES['UNDER_CONTENT_IMG']['tmp_name'])) {
                 if ($error = ImageManager::validateUpload($_FILES['UNDER_CONTENT_IMG'], 4000000)) {
                     $this->displayError($this->l('Invalid image.'));
                 } else {
                     $ext = substr($_FILES['UNDER_CONTENT_IMG']['name'], strrpos($_FILES['UNDER_CONTENT_IMG']['name'], '.') + 1);
                     $file_name = md5($_FILES['UNDER_CONTENT_IMG']['name']) . '.' . $ext;
                     if (!move_uploaded_file($_FILES['UNDER_CONTENT_IMG']['tmp_name'], dirname(__FILE__) . '/' . $file_name)) {
                         $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                     } else {
                         if (Configuration::hasContext('UNDER_CONTENT_IMG', null, Shop::getContext()) && Configuration::get('UNDER_CONTENT_IMG') != $file_name) {
                             @unlink(dirname(__FILE__) . '/' . Configuration::get('UNDER_CONTENT_IMG'));
                         }
                         Configuration::updateValue('UNDER_CONTENT_IMG', $file_name);
                         $this->_clearCache('homepagecontent.tpl');
                         $this->displayConfirmation($this->l('The settings have been updated.'));
                     }
                 }
             }
             $this->_clearCache('homepagecontent.tpl');
         }
     }
     return $output . $this->renderForm();
 }
开发者ID:vadia007,项目名称:paintings,代码行数:74,代码来源:homepagecontent.php

示例9: postProcess

 public function postProcess()
 {
     if (!isset($this->fields_form)) {
         return parent::postProcess();
     }
     $values = $this->fields_form;
     if (!($languages = Language::getLanguages(true))) {
         return false;
     }
     if (Tools::isSubmit('submit' . Tools::ucfirst($this->name))) {
         foreach ($values as $value) {
             if (isset($value['lang']) && $value['lang'] == true) {
                 switch ($value['type']) {
                     case 'text':
                     case 'textarea':
                     case 'select':
                         $text = array();
                         foreach ($languages as $lang) {
                             $text[$lang['id_lang']] = Tools::getValue($value['name'] . '_' . $lang['id_lang']);
                         }
                         if (isset($value['validate']) && !empty($value['validate'])) {
                             foreach ($text as $k => $v) {
                                 if ($value['validate'] == 'isInt') {
                                     $text[$k] = (int) $text[$k];
                                 } elseif ($value['validate'] == 'isFloat') {
                                     $text[$k] = (double) $text[$k];
                                 } elseif ($value['validate'] == 'isBool') {
                                     $text[$k] = (bool) $text[$k];
                                 }
                             }
                         }
                         Configuration::updateValue($value['name'], $text, isset($value['html']) ? $value['html'] : false);
                         break;
                     case 'file':
                         foreach ($languages as $lang) {
                             if (isset($_FILES[$value['name'] . '_' . $lang['id_lang']]) && isset($_FILES[$value['name'] . '_' . $lang['id_lang']]['tmp_name']) && !empty($_FILES[$value['name'] . '_' . $lang['id_lang']]['tmp_name'])) {
                                 if (ImageManager::validateUpload($_FILES[$value['name'] . '_' . $lang['id_lang']], 4000000)) {
                                     return $this->displayError($this->l('Invalid image.'));
                                 } else {
                                     $ext = Tools::substr($_FILES[$value['name'] . '_' . $lang['id_lang']]['name'], strrpos($_FILES[$value['name'] . '_' . $lang['id_lang']]['name'], '.') + 1);
                                     $file_name = md5($_FILES[$value['name'] . '_' . $lang['id_lang']]['name']) . '.' . $ext;
                                     if (!move_uploaded_file($_FILES[$value['name'] . '_' . $lang['id_lang']]['tmp_name'], dirname(__FILE__) . '/public/img/' . $file_name)) {
                                         return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                                     } else {
                                         if (Configuration::hasContext($value['name'] . '_' . $lang['id_lang'], null, Shop::getContext()) && Configuration::get($value['name'] . '_' . $lang['id_lang']) != $file_name) {
                                             @unlink(dirname(__FILE__) . '/public/imgs/' . Configuration::get($value['name'] . '_' . $lang['id_lang']));
                                         }
                                         $text[$lang['id_lang']] = '/modules/' . $this->name . '/public/img/' . $file_name;
                                     }
                                 }
                             }
                             if (count($text) > 0) {
                                 Configuration::updateValue($value['name'], $text);
                             }
                         }
                         break;
                     case 'switch':
                         Configuration::updateValue($value['name'], Tools::getValue($value['name'] . '_' . $lang['id_lang']));
                         break;
                     default:
                         Configuration::updateValue($value['name'], Tools::getValue($value['name'] . '_' . $lang['id_lang']), isset($value['html']) ? $value['html'] : false);
                         break;
                 }
             } else {
                 switch ($value['type']) {
                     case 'text':
                     case 'textarea':
                     case 'select':
                         $v = Tools::getValue($value['name']);
                         if (isset($value['validate']) && !empty($value['validate'])) {
                             if ($value['validate'] == 'isInt') {
                                 $v = (int) $v;
                             } elseif ($value['validate'] == 'isFloat') {
                                 $v = (double) $v;
                             } elseif ($value['validate'] == 'isBool') {
                                 $v = (bool) $v;
                             }
                         }
                         Configuration::updateValue($value['name'], $v, isset($value['html']) ? $value['html'] : false);
                         break;
                     case 'file':
                         if (isset($_FILES[$value['name']]) && isset($_FILES[$value['name']]['tmp_name']) && !empty($_FILES[$value['name']]['tmp_name'])) {
                             if (ImageManager::validateUpload($_FILES[$value['name']], 4000000)) {
                                 return $this->displayError($this->l('Invalid image.'));
                             } else {
                                 $ext = Tools::substr($_FILES[$value['name']]['name'], strrpos($_FILES[$value['name']]['name'], '.') + 1);
                                 $file_name = md5($_FILES[$value['name']]['name']) . '.' . $ext;
                                 if (!move_uploaded_file($_FILES[$value['name']]['tmp_name'], dirname(__FILE__) . '/public/imgs/' . $file_name)) {
                                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                                 } else {
                                     if (Configuration::hasContext($value['name'], null, Shop::getContext()) && Configuration::get($value['name']) != $file_name) {
                                         @unlink(dirname(__FILE__) . '/' . Configuration::get($value['name']));
                                     }
                                     Configuration::updateValue($value['name'], '/modules/' . $this->name . '/public/imgs/' . $file_name);
                                 }
                             }
                         }
                         break;
                     case 'switch':
                         Configuration::updateValue($value['name'], Tools::getValue($value['name']));
//.........这里部分代码省略.........
开发者ID:acreno,项目名称:pm-ps,代码行数:101,代码来源:magicredirect.php

示例10: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('cmsSubmit' . $this->name)) {
         $cms_shop_name = Tools::getValue('cms_shop_name');
         $cms_address_name = Tools::getValue('cms_address_name');
         $cms_shipping_name = Tools::getValue('cms_shipping_name');
         $cms_payment_name = Tools::getValue('cms_payment_name');
         $cms_shop_icon = Tools::getValue('cms_shop_icon');
         $cms_address_icon = Tools::getValue('cms_address_icon');
         $cms_shipping_icon = Tools::getValue('cms_shipping_icon');
         $cms_payment_icon = Tools::getValue('cms_payment_icon');
         $cms_shop_link = Tools::getValue('cms_shop_link');
         $cms_shopaddress_link = Tools::getValue('cms_shopaddress_link');
         $cms_shipping_link = Tools::getValue('cms_shipping_link');
         $cms_payment_link = Tools::getValue('cms_payment_link');
         if (!$cms_address_name && empty($cms_address_name) || !$cms_shipping_name && empty($cms_shipping_name) || !$cms_shop_name && empty($cms_shop_name) || !$cms_payment_name && empty($cms_payment_name) || !$cms_shop_link && empty($cms_shop_link) || !$cms_shopaddress_link && empty($cms_shopaddress_link) || !$cms_shipping_link && empty($cms_shipping_link) || !$cms_payment_link && empty($cms_payment_link)) {
             return $this->displayError($this->l('The required fields can not be blank.'));
         } elseif (isset($_FILES['cms_shop_icon']) && isset($_FILES['cms_shop_icon']['tmp_name']) && !empty($_FILES['cms_shop_icon']['tmp_name'])) {
             if (ImageManager::validateUpload($_FILES['cms_shop_icon'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 $ext = Tools::substr($_FILES['cms_shop_icon']['name'], Tools::strrpos($_FILES['cms_shop_icon']['name'], '.') + 1);
                 $file_name = md5($_FILES['cms_shop_icon']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['cms_shop_icon']['tmp_name'], dirname(__FILE__) . '/views/img/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     $file_path = dirname(__FILE__) . '/views/img/' . Configuration::get('cms_shop_icon');
                     if (Configuration::hasContext('cms_shop_icon', null, Shop::getContext()) && Configuration::get('cms_shop_icon') != $file_name && file_exists($file_path)) {
                         unlink($file_path);
                     }
                     Configuration::updateValue('cms_shop_icon', $file_name);
                     $this->_clearCache('topfootercms.tpl');
                     Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
                 }
             }
         } elseif (isset($_FILES['cms_address_icon']) && isset($_FILES['cms_address_icon']['tmp_name']) && !empty($_FILES['cms_address_icon']['tmp_name'])) {
             if (ImageManager::validateUpload($_FILES['cms_address_icon'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 $ext = Tools::substr($_FILES['cms_address_icon']['name'], Tools::strrpos($_FILES['cms_address_icon']['name'], '.') + 1);
                 $file_name = md5($_FILES['cms_address_icon']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['cms_address_icon']['tmp_name'], dirname(__FILE__) . '/views/img/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     $file_path = dirname(__FILE__) . '/views/img/' . Configuration::get('cms_address_icon');
                     if (Configuration::hasContext('cms_address_icon', null, Shop::getContext()) && Configuration::get('cms_address_icon') != $file_name && file_exists($file_path)) {
                         unlink($file_path);
                     }
                     Configuration::updateValue('cms_address_icon', $file_name);
                     $this->_clearCache('topfootercms.tpl');
                     Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
                 }
             }
         } elseif (isset($_FILES['cms_shipping_icon']) && isset($_FILES['cms_shipping_icon']['tmp_name']) && !empty($_FILES['cms_shipping_icon']['tmp_name'])) {
             if (ImageManager::validateUpload($_FILES['cms_shipping_icon'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 $ext = Tools::substr($_FILES['cms_shipping_icon']['name'], Tools::strrpos($_FILES['cms_shipping_icon']['name'], '.') + 1);
                 $file_name = md5($_FILES['cms_shipping_icon']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['cms_shipping_icon']['tmp_name'], dirname(__FILE__) . '/views/img/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     $file_path = dirname(__FILE__) . '/views/img/' . Configuration::get('cms_shipping_icon');
                     if (Configuration::hasContext('cms_shipping_icon', null, Shop::getContext()) && Configuration::get('cms_shipping_icon') != $file_name && file_exists($file_path)) {
                         unlink($file_path);
                     }
                     Configuration::updateValue('cms_shipping_icon', $file_name);
                     $this->_clearCache('topfootercms.tpl');
                     Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
                 }
             }
         } elseif (isset($_FILES['cms_payment_icon']) && isset($_FILES['cms_payment_icon']['tmp_name']) && !empty($_FILES['cms_payment_icon']['tmp_name'])) {
             if (ImageManager::validateUpload($_FILES['cms_payment_icon'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 $ext = Tools::substr($_FILES['cms_payment_icon']['name'], Tools::strrpos($_FILES['cms_payment_icon']['name'], '.') + 1);
                 $file_name = md5($_FILES['cms_payment_icon']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['cms_payment_icon']['tmp_name'], dirname(__FILE__) . '/views/img/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     $file_path = dirname(__FILE__) . '/views/img/' . Configuration::get('cms_payment_icon');
                     if (Configuration::hasContext('cms_payment_icon', null, Shop::getContext()) && Configuration::get('cms_payment_icon') != $file_name && file_exists($file_path)) {
                         unlink($file_path);
                     }
                     Configuration::updateValue('cms_payment_icon', $file_name);
                     $this->_clearCache('topfootercms.tpl');
                     Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
                 }
             }
         } else {
             Configuration::updateValue('cms_shop_name', $cms_shop_name);
             Configuration::updateValue('cms_address_name', $cms_address_name);
             Configuration::updateValue('cms_shipping_name', $cms_shipping_name);
             Configuration::updateValue('cms_payment_name', $cms_payment_name);
             Configuration::updateValue('cms_shop_link', $cms_shop_link);
             Configuration::updateValue('cms_shopaddress_link', $cms_shopaddress_link);
             Configuration::updateValue('cms_shipping_link', $cms_shipping_link);
             Configuration::updateValue('cms_payment_link', $cms_payment_link);
         }
         return $this->displayConfirmation($this->l('The settings has been successfully updated !'));
//.........这里部分代码省略.........
开发者ID:Chantouch,项目名称:topfootercms,代码行数:101,代码来源:topfootercms.php

示例11: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitStoreConf')) {
         Configuration::updateValue('PRODUCTPAYMENTLOGOS_LINK', Tools::getValue('PRODUCTPAYMENTLOGOS_LINK'));
         Configuration::updateValue('PRODUCTPAYMENTLOGOS_TITLE', Tools::getValue('PRODUCTPAYMENTLOGOS_TITLE'));
         if (isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']) && isset($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name']) && !empty($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name'])) {
             if (ImageManager::validateUpload($_FILES['PRODUCTPAYMENTLOGOS_IMG'], 4000000)) {
                 return $this->displayError($this->l('Invalid image'));
             } else {
                 $ext = Tools::substr($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], Tools::strrpos($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name'], '.') + 1);
                 $file_name = md5($_FILES['PRODUCTPAYMENTLOGOS_IMG']['name']) . '.' . $ext;
                 if (!move_uploaded_file($_FILES['PRODUCTPAYMENTLOGOS_IMG']['tmp_name'], dirname(__FILE__) . '/img/' . $file_name)) {
                     return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
                 } else {
                     $file_path = dirname(__FILE__) . '/img/' . Configuration::get('PRODUCTPAYMENTLOGOS_IMG');
                     if (Configuration::hasContext('PRODUCTPAYMENTLOGOS_IMG', null, Shop::getContext()) && Configuration::get('PRODUCTPAYMENTLOGOS_IMG') != $file_name && file_exists($file_path)) {
                         unlink($file_path);
                     }
                     Configuration::updateValue('PRODUCTPAYMENTLOGOS_IMG', $file_name);
                     $this->_clearCache('productpaymentlogos.tpl');
                     Tools::redirectAdmin('index.php?tab=AdminModules&conf=6&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'));
                 }
             }
         }
         $this->_clearCache('productpaymentlogos.tpl');
     }
     return '';
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:28,代码来源:productpaymentlogos.php


注:本文中的Configuration::hasContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。