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


PHP Tools::isEmpty方法代码示例

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


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

示例1: initContent

 public function initContent()
 {
     $log = null;
     $this->display_header = false;
     $this->display_footer = false;
     parent::initContent();
     $transaction = Tools::getValue('transaction');
     if (Tools::isEmpty($transaction)) {
         die(Tools::displayError('Wrong use of the HTTP notifications. Please set up your sofortüberweisung.de notification to call this URL only with POST method.'));
     }
     $orderState = _PS_OS_PAYMENT_;
     $baseDir = dirname(__FILE__);
     $useSSL = true;
     // Get class instance
     $su = new Sofortueberweisung();
     // Set order state to "awaiting payment"
     $orderState = Configuration::get('_SU_OS_OK_');
     $cartId = 0;
     // Check incoming response
     if ($su->checkResponse($_POST, $log)) {
         // Get cartId from the response
         $cartId = (int) Tools::getValue('user_variable_0');
         // Get the cart object
         $cart = new Cart($cartId);
         // Get the customer object
         $customer = new Customer((int) $cart->id_customer);
         // Get order sum
         $orderSum = (double) Tools::getValue('amount');
         $currency_special = $cart->id_currency;
         $message = 'Payment through Sofortüberweisung.de - Transaction-ID: ' . $transaction . ' ';
         $secure_key = $customer->secure_key;
         // Create order
         $su->updateOrder($cartId, $orderState, $orderSum, $message, $currency_special, $secure_key);
     }
 }
开发者ID:pedalracer,项目名称:free_modules_1.5,代码行数:35,代码来源:notify.php

示例2: getView

 public function getView($params, $synchrone)
 {
     $form = new Form($this->fields, $params);
     $title = '';
     if ($form->isSubmitting() && Tools::isEmpty($form->getErrors())) {
         $access_key = isset($params['access_key']) && !empty($params['access_key']) ? Tools::saltHash($params['access_key']) : 'NULL';
         // Create Game
         $game = Game::create(F::i('Session')->getMid(), $params['name'], $access_key);
         Tools::redirect('?action=wait_game&game=' . $game->g_id);
     } else {
         // Generate form
         $view = View::setFile('formular', View::HTML_FILE);
         $errors = $form->getErrors();
         // Errors in the filling
         if (!empty($errors)) {
             $view->setSwitch('form_errors', TRUE);
             foreach ($errors as $field => $error) {
                 $view->setGroupValues('form_errors', array('error' => F::i('Lang')->getKey('error_' . $field . '_' . $error)));
             }
         }
         $view->setValue('form', $form->getHTML(F::i('Lang')->getKey('Create'), '#', 'POST', 'tabbed_form'));
         $title = F::i('Lang')->getKey('title_new_game');
     }
     return parent::setBody($view, $title);
 }
开发者ID:Korko,项目名称:RiskOnline,代码行数:25,代码来源:new_game.php

示例3: initContent

 public function initContent()
 {
     parent::initContent();
     //EJEMPLO;APELLIDO2-EJEMPLO&COTITULAR=033333333P;COTITU-EJEMPLO;COTITU-APE1-
     //EJEMPLO;COTITU-APE2-EJEMPLO
     //$code =
     $cart = $this->context->cart;
     include dirname(__FILE__) . '/cripto.php';
     //		$url= 'http://prufrc.ebiosphere.com/WebComercios/Online/index.jsp?';
     $url = 'https://comercios.fracciona.com/Online/index.jsp?';
     $url .= encriptar('NPEDIDO') . '=' . encriptar($this->context->cookie->cod_frac) . '&';
     $url .= encriptar('IMPORTE') . '=';
     $url .= encriptar($cart->getOrderTotal(true, Cart::BOTH)) . '&';
     $url .= encriptar('CODVENDEDOR') . '=';
     $url .= encriptar(Configuration::get('FRACC_CODE')) . '&';
     $url .= encriptar('TITULAR') . '=' . encriptar(Tools::getValue('dni')) . ';';
     $url .= encriptar(Tools::getValue('nombre')) . ';' . encriptar(Tools::getValue('apellidoFirst')) . ';';
     $url .= encriptar(Tools::getValue('apellidoLast')) . '&';
     $url .= encriptar('EMAIL') . '=' . encriptar(Tools::getValue('email'));
     if (!Tools::isEmpty(Tools::getValue('nombre2'))) {
         $url .= encriptar('&COTITULAR') . '=' . encriptar(Tools::getValue('dni2')) . ';';
         $url .= encriptar(Tools::getValue('nombre2')) . ';' . encriptar(Tools::getValue('apellidoFirst2')) . ';';
         $url .= encriptar(Tools::getValue('apellidoLast2')) . '&' . encriptar(Tools::getValue('email2'));
     }
     //echo $url;
     Tools::redirect($url);
 }
开发者ID:hesselek,项目名称:modulo_integrated,代码行数:27,代码来源:validation.php

示例4: getView

 public function getView($params, $synchrone)
 {
     $form = new Form(self::getFields(), $params);
     $view = View::setFile('chatbox', View::JSON_FILE);
     $fields = Chatbox::getFields();
     if (F::i('Session')->isConnected()) {
         $fields['name']['disabled'] = TRUE;
     }
     $errors = $form->getErrors();
     if (!Tools::isEmpty($errors)) {
         foreach ($errors as $field => $msg) {
             $view->setGroupValues('error', array('field' => $field, 'errmsg' => $msg));
         }
     }
     // If Submitting
     if ($form->isSubmitting() && Tools::isEmpty($form->getErrors())) {
         // TODO Sauvegarde du pseudo en cookie
         // Enregistrement des données
         if (F::i('Session')->isConnected()) {
             $m_name = '';
         } else {
             $m_name = $params['name'];
             self::setNickname($m_name);
         }
         F::i(_DBMS_SYS)->exec('INSERT INTO !prefix_chatbox_messages (m_id, m_name, mes_content) VALUES (?, ?, ?)', array(F::i('Session')->getMid(), $m_name, $params['content']));
         // Et sortie
         return;
     }
     // Recuperation des derniers messages
     $sql = 'SELECT mes.m_name, m.m_login, mes.m_id, mes_content, UNIX_TIMESTAMP(mes_date) AS mes_date FROM !prefix_chatbox_messages mes, !prefix_members m WHERE m.m_id = mes.m_id';
     $array = array();
     // si une date est donnée, tous les messages depuis cette date
     if (isset($params['since'])) {
         $sql .= ' AND mes_date > FROM_UNIXTIME(?)';
         $array[] = $params['since'];
     }
     // sinon, limiter à _LIMIT_LAST_CHATBOX messages
     $sql .= ' ORDER BY mes_date DESC';
     if (!isset($params['since'])) {
         $sql .= ' LIMIT ?';
         $array[] = _LIMIT_LAST_CHATBOX;
     }
     // Generation d'un pseudo si non connecté et pseudo non fourni
     // Si connecté, verouiller le pseudo
     $result = F::i(_DBMS_SYS)->query($sql, $array);
     // Recover messages and switch the order to get the last _LIMIT_LAST_CHATBOX messages but the last at the end.
     $messages = array();
     for ($i = 0; $i < $result->getNumRows(); $i++) {
         $obj = $result->getObject();
         $messages[] = array('author_mid' => $obj->m_id, 'author_name' => $obj->m_id == _ID_VISITOR ? $obj->m_name : $obj->m_login, 'content' => htmlentities($obj->mes_content, ENT_QUOTES, 'UTF-8', TRUE), 'date' => $obj->mes_date);
     }
     $messages = array_reverse($messages);
     for ($i = 0; $i < count($messages); $i++) {
         $view->setGroupValues('message', $messages[$i]);
     }
     return $view->getContent();
 }
开发者ID:Korko,项目名称:RiskOnline,代码行数:57,代码来源:chatbox.php

示例5: processGetContent

 protected function processGetContent()
 {
     $id = Tools::getValue('PromotionId');
     if ($id == '0' || Tools::isEmpty($id)) {
         exit;
     }
     $promotion = new Promotion();
     $promotion->getById($id);
     $fields = $promotion->getAsArray();
     echo json_encode($fields);
     exit;
 }
开发者ID:khuyennd,项目名称:dev-tasagent,代码行数:12,代码来源:PromotionListController.php

示例6: returnPaymentConfiguration

 public function returnPaymentConfiguration($params)
 {
     $this->context = Context::getContext();
     if (!Tools::isEmpty($params['objOrder']) && $params['objOrder']->module === 'pagseguro') {
         $this->context->smarty->assign(array('total_to_pay' => Tools::displayPrice($params['objOrder']->total_paid, $this->context->currency->id, false), 'status' => 'ok', 'id_order' => (int) $params['objOrder']->id));
         if (isset($params['objOrder']->reference) && !Tools::isEmpty($params['objOrder']->reference)) {
             $this->context->smarty->assign('reference', $params['objOrder']->reference);
         }
     } else {
         $this->context->smarty->assign('status', 'failed');
     }
 }
开发者ID:kennedimalheiros,项目名称:prestashop,代码行数:12,代码来源:pagseguroPS1501toPS1503.php

示例7: __construct

 public function __construct($id_service, $filename = false)
 {
     $this->name = Tools::isEmpty($this->name) ? 'Unknown Export Engine' : $this->name;
     if (Validate::isUnsignedId($id_service)) {
         $this->service_id = (int) $id_service;
         if (!$filename) {
             $filename = sha1($this->getServiceName() . _COOKIE_KEY_);
         }
         $this->filename = _PS_ROOT_DIR_ . '/modules/moussiqfree/export/' . $filename . '.' . $this->extension;
         self::$_link = new Link();
         self::$_serviceData = self::getCsvDefaults((int) $id_service);
     }
 }
开发者ID:pedalracer,项目名称:free_modules_1.5,代码行数:13,代码来源:Export.php

示例8: widgetShow

 public function widgetShow($params)
 {
     global $smarty, $cookie;
     $linkTpl = '
     <a href="%1$s" class="widgetctooltip%4$s" rel="cms_%3$d">%2$s</a>';
     $additionalParams = '';
     foreach (self::$_additionalParams as $prefix => $param) {
         if (isset($params[$param])) {
             $additionalParams .= ' ' . $prefix . $params[$param];
         }
     }
     $cms = self::getShortCMSInfo($params['id'], $cookie->id_lang);
     if (!Tools::isEmpty($cms['meta_title'])) {
         $widgetPath = $this->widgetUri();
         $this->setCss($widgetPath . 'css/style.css');
         $this->setJs($widgetPath . 'js/tooltip.js');
         $link = new Link();
         return sprintf($linkTpl, $link->getCMSLink($params['id'], $cms['link_rewrite']), $cms['meta_title'], $params['id'], $additionalParams);
     }
 }
开发者ID:pedalracer,项目名称:free_modules_1.5,代码行数:20,代码来源:widgetcmstooltip.php

示例9: preProcess

 public function preProcess()
 {
     //parent::preProcess();
     $id = Tools::getValue('PromotionId');
     if ($id == '0' || Tools::isEmpty($id)) {
         exit;
     }
     $promotion = new Promotion();
     $promotion->getById($id);
     //promotion list navigation
     $navi_url = "promotionlist.php?type=" . $promotion->Type;
     $navi_name = $promotion->Type == Promotion::$TYPE_PROMOTION ? 'Promotion List' : 'Event List';
     $this->brandNavi[] = array("name" => $navi_name, "url" => $navi_url);
     //promotoin detail navigation
     $navi_url = $this->php_self . "?PromotionId=" . $id;
     $navi_name = $promotion->Title;
     $this->brandNavi[] = array("name" => $promotion->Title, "url" => $navi_url, "nolang" => 1);
     $fields = $promotion->getAsArray();
     $fields['Content'] = urldecode($fields['Content']);
     self::$smarty->assign("data", $fields);
 }
开发者ID:khuyennd,项目名称:dev-tasagent,代码行数:21,代码来源:PromotionDetailController.php

示例10: getView

 public function getView($params, $synchrone)
 {
     $form = new Form($this->fields, $params);
     if ($form->isSubmitting() && Tools::isEmpty($form->getErrors())) {
         // Register
         $salt = Tools::generateSalt();
         $password = Tools::saltHash($params['password'], $salt);
         $error = FALSE;
         try {
             F::i(_DBMS_SYS)->exec('INSERT INTO !prefix_members (m_login, m_password, m_email, m_salt, m_auth) VALUES (?, ?, ?, ?, ?)', array($params['login'], $password, $params['email'], $salt, _AUTH_MEMBER));
         } catch (DBMSError $e) {
             // Login already given
             $error = TRUE;
         }
         if (!$error) {
             $view = View::setFile('info', View::HTML_FILE);
             $view->setValue('L_message', F::i('Lang')->getKey('register_successful'));
             $view->setValue('U_ok', '?');
             F::i('Session')->connect($params['login'], $params['password']);
         } else {
             $view = View::setFile('error', View::HTML_FILE);
             $view->setValue('l_message', F::i('Lang')->getKey('login_taken'));
             $view->setValue('u_ok', '?');
         }
     } else {
         $view = View::setFile('formular', View::HTML_FILE);
         $errors = $form->getErrors();
         // Errors in the filling
         if (!empty($errors)) {
             $view->setSwitch('form_errors', TRUE);
             foreach ($errors as $field => $error) {
                 $view->setGroupValues('form_errors', array('error' => F::i('Lang')->getKey('error_' . $field . '_' . $error)));
             }
         }
         $view->setValue('form', $form->getHTML(F::i('Lang')->getKey('register'), '#', 'POST', 'tabbed_form'));
     }
     return parent::setBody($view);
 }
开发者ID:Korko,项目名称:RiskOnline,代码行数:38,代码来源:register.php

示例11: processProductAttribute

 public function processProductAttribute()
 {
     // Don't process if the combination fields have not been submitted
     if (!Combination::isFeatureActive() || !Tools::getValue('attribute_combination_list')) {
         return;
     }
     if (Validate::isLoadedObject($product = $this->object)) {
         if ($this->isProductFieldUpdated('attribute_price') && (!Tools::getIsset('attribute_price') || Tools::getIsset('attribute_price') == null)) {
             $this->errors[] = Tools::displayError('Attribute price required.');
         }
         if (!Tools::getIsset('attribute_combination_list') || Tools::isEmpty(Tools::getValue('attribute_combination_list'))) {
             $this->errors[] = Tools::displayError('You must add at least one attribute.');
         }
         if (!count($this->errors)) {
             if (!isset($_POST['attribute_wholesale_price'])) {
                 $_POST['attribute_wholesale_price'] = 0;
             }
             if (!isset($_POST['attribute_price_impact'])) {
                 $_POST['attribute_price_impact'] = 0;
             }
             if (!isset($_POST['attribute_weight_impact'])) {
                 $_POST['attribute_weight_impact'] = 0;
             }
             if (!isset($_POST['attribute_ecotax'])) {
                 $_POST['attribute_ecotax'] = 0;
             }
             if (Tools::getValue('attribute_default')) {
                 $product->deleteDefaultAttributes();
             }
             // Change existing one
             if (($id_product_attribute = (int) Tools::getValue('id_product_attribute')) || ($id_product_attribute = $product->productAttributeExists(Tools::getValue('attribute_combination_list'), false, null, true, true))) {
                 if ($this->tabAccess['edit'] === '1') {
                     if ($this->isProductFieldUpdated('available_date_attribute') && !Validate::isDateFormat(Tools::getValue('available_date_attribute'))) {
                         $this->errors[] = Tools::displayError('Invalid date format.');
                     } else {
                         $product->updateAttribute((int) $id_product_attribute, $this->isProductFieldUpdated('attribute_wholesale_price') ? Tools::getValue('attribute_wholesale_price') : null, $this->isProductFieldUpdated('attribute_price_impact') ? Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact') : null, $this->isProductFieldUpdated('attribute_weight_impact') ? Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact') : null, $this->isProductFieldUpdated('attribute_unit_impact') ? Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact') : null, $this->isProductFieldUpdated('attribute_ecotax') ? Tools::getValue('attribute_ecotax') : null, Tools::getValue('id_image_attr'), Tools::getValue('attribute_reference'), Tools::getValue('attribute_ean13'), $this->isProductFieldUpdated('attribute_default') ? Tools::getValue('attribute_default') : null, Tools::getValue('attribute_location'), Tools::getValue('attribute_upc'), $this->isProductFieldUpdated('attribute_minimal_quantity') ? Tools::getValue('attribute_minimal_quantity') : null, $this->isProductFieldUpdated('available_date_attribute') ? Tools::getValue('available_date_attribute') : null, false);
                         StockAvailable::setProductDependsOnStock((int) $product->id, $product->depends_on_stock, null, (int) $id_product_attribute);
                         StockAvailable::setProductOutOfStock((int) $product->id, $product->out_of_stock, null, (int) $id_product_attribute);
                     }
                 } else {
                     $this->errors[] = Tools::displayError('You do not have permission to add here.');
                 }
             } else {
                 if ($this->tabAccess['add'] === '1') {
                     if ($product->productAttributeExists(Tools::getValue('attribute_combination_list'))) {
                         $this->errors[] = Tools::displayError('This combination already exists.');
                     } else {
                         $id_product_attribute = $product->addCombinationEntity(Tools::getValue('attribute_wholesale_price'), Tools::getValue('attribute_price') * Tools::getValue('attribute_price_impact'), Tools::getValue('attribute_weight') * Tools::getValue('attribute_weight_impact'), Tools::getValue('attribute_unity') * Tools::getValue('attribute_unit_impact'), Tools::getValue('attribute_ecotax'), 0, Tools::getValue('id_image_attr'), Tools::getValue('attribute_reference'), null, Tools::getValue('attribute_ean13'), Tools::getValue('attribute_default'), Tools::getValue('attribute_location'), Tools::getValue('attribute_upc'), Tools::getValue('attribute_minimal_quantity'));
                         StockAvailable::setProductDependsOnStock((int) $product->id, $product->depends_on_stock, null, (int) $id_product_attribute);
                         StockAvailable::setProductOutOfStock((int) $product->id, $product->out_of_stock, null, (int) $id_product_attribute);
                     }
                 } else {
                     $this->errors[] = Tools::displayError('You do not have permission to') . '<hr>' . Tools::displayError('Edit here.');
                 }
             }
             if (!count($this->errors)) {
                 $combination = new Combination((int) $id_product_attribute);
                 $combination->setAttributes(Tools::getValue('attribute_combination_list'));
                 $product->checkDefaultAttributes();
             }
             if (!count($this->errors)) {
                 if (!$product->cache_default_attribute) {
                     Product::updateDefaultAttribute($product->id);
                 }
             }
         }
     }
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:68,代码来源:AdminProductsController.php

示例12: _checkIfOrderStatusExists

 /**
  * Check if PagSeguro order status already exists on database
  * @param String $status
  * @return boolean
  */
 private function _checkIfOrderStatusExists($id_lang, $status_name)
 {
     if (Tools::isEmpty($this->list_states)) {
         return true;
     }
     $save = true;
     foreach ($this->list_states as $state) {
         if ($state['id_lang'] == $id_lang && $state['name'] == $status_name) {
             $save = false;
         }
     }
     return $save;
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:18,代码来源:pagseguro.php

示例13: addItem

    protected function addItem()
    {
        $title = Tools::getValue('item_title');
        $content = Tools::getValue('item_html');
        if (!Validate::isCleanHtml($title, (int) Configuration::get('PS_ALLOW_HTML_IFRAME')) || !Validate::isCleanHtml($content, (int) Configuration::get('PS_ALLOW_HTML_IFRAME'))) {
            $this->context->smarty->assign('error', $this->l('Invalid content'));
            return false;
        }
        if (!($current_order = (int) Db::getInstance()->getValue('
			SELECT item_order + 1
			FROM `' . _DB_PREFIX_ . 'themeconfigurator`
			WHERE
				id_shop = ' . (int) $this->context->shop->id . '
				AND id_lang = ' . (int) Tools::getValue('id_lang') . '
				AND hook = \'' . pSQL(Tools::getValue('item_hook')) . '\'
				ORDER BY item_order DESC'))) {
            $current_order = 1;
        }
        $image_w = is_numeric(Tools::getValue('item_img_w')) ? (int) Tools::getValue('item_img_w') : '';
        $image_h = is_numeric(Tools::getValue('item_img_h')) ? (int) Tools::getValue('item_img_h') : '';
        if (!empty($_FILES['item_img']['name'])) {
            if (!($image = $this->uploadImage($_FILES['item_img'], $image_w, $image_h))) {
                return false;
            }
        } else {
            $image = '';
            $image_w = '';
            $image_h = '';
        }
        if (!Db::getInstance()->Execute('
			INSERT INTO `' . _DB_PREFIX_ . 'themeconfigurator` (
					`id_shop`, `id_lang`, `item_order`, `title`, `title_use`, `hook`, `url`, `target`, `image`, `image_w`, `image_h`, `html`, `active`
			) VALUES (
					\'' . (int) $this->context->shop->id . '\',
					\'' . (int) Tools::getValue('id_lang') . '\',
					\'' . (int) $current_order . '\',
					\'' . pSQL($title) . '\',
					\'' . (int) Tools::getValue('item_title_use') . '\',
					\'' . pSQL(Tools::getValue('item_hook')) . '\',
					\'' . pSQL(Tools::getValue('item_url')) . '\',
					\'' . (int) Tools::getValue('item_target') . '\',
					\'' . pSQL($image) . '\',
					\'' . pSQL($image_w) . '\',
					\'' . pSQL($image_h) . '\',
					\'' . pSQL($this->filterVar($content), true) . '\',
					1)')) {
            if (!Tools::isEmpty($image)) {
                $this->deleteImage($image);
            }
            $this->context->smarty->assign('error', $this->l('An error occurred while saving data.'));
            return false;
        }
        $this->context->smarty->assign('confirmation', $this->l('New item successfully added.'));
        return true;
    }
开发者ID:AlexEven,项目名称:themeconfigurator,代码行数:55,代码来源:themeconfigurator.php

示例14: validateField

 /**
  * Validate a single field
  *
  * @since 1.5.0.1
  * @param string   $field        Field name
  * @param mixed    $value        Field value
  * @param int|null $id_lang      Language ID
  * @param array    $skip         Array of fields to skip.
  * @param bool     $human_errors If true, uses more descriptive, translatable error strings.
  *
  * @return true|string True or error message string.
  * @throws PrestaShopException
  */
 public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
 {
     static $ps_lang_default = null;
     static $ps_allow_html_iframe = null;
     if ($ps_lang_default === null) {
         $ps_lang_default = Configuration::get('PS_LANG_DEFAULT');
     }
     if ($ps_allow_html_iframe === null) {
         $ps_allow_html_iframe = (int) Configuration::get('PS_ALLOW_HTML_IFRAME');
     }
     $this->cacheFieldsRequiredDatabase();
     $data = $this->def['fields'][$field];
     // Check if field is required
     $required_fields = isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
     if (!$id_lang || $id_lang == $ps_lang_default) {
         if (!in_array('required', $skip) && (!empty($data['required']) || in_array($field, $required_fields))) {
             if (Tools::isEmpty($value)) {
                 if ($human_errors) {
                     return sprintf(Tools::displayError('The %s field is required.'), $this->displayFieldName($field, get_class($this)));
                 } else {
                     return 'Property ' . get_class($this) . '->' . $field . ' is empty';
                 }
             }
         }
     }
     // Default value
     if (!$value && !empty($data['default'])) {
         $value = $data['default'];
         $this->{$field} = $value;
     }
     // Check field values
     if (!in_array('values', $skip) && !empty($data['values']) && is_array($data['values']) && !in_array($value, $data['values'])) {
         return 'Property ' . get_class($this) . '->' . $field . ' has bad value (allowed values are: ' . implode(', ', $data['values']) . ')';
     }
     // Check field size
     if (!in_array('size', $skip) && !empty($data['size'])) {
         $size = $data['size'];
         if (!is_array($data['size'])) {
             $size = array('min' => 0, 'max' => $data['size']);
         }
         $length = Tools::strlen($value);
         if ($length < $size['min'] || $length > $size['max']) {
             if ($human_errors) {
                 if (isset($data['lang']) && $data['lang']) {
                     $language = new Language((int) $id_lang);
                     return sprintf(Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), $this->displayFieldName($field, get_class($this)), $language->name, $size['max']);
                 } else {
                     return sprintf(Tools::displayError('The %1$s field is too long (%2$d chars max).'), $this->displayFieldName($field, get_class($this)), $size['max']);
                 }
             } else {
                 return 'Property ' . get_class($this) . '->' . $field . ' length (' . $length . ') must be between ' . $size['min'] . ' and ' . $size['max'];
             }
         }
     }
     // Check field validator
     if (!in_array('validate', $skip) && !empty($data['validate'])) {
         if (!method_exists('Validate', $data['validate'])) {
             throw new PrestaShopException('Validation function not found. ' . $data['validate']);
         }
         if (!empty($value)) {
             $res = true;
             if (Tools::strtolower($data['validate']) == 'iscleanhtml') {
                 if (!call_user_func(array('Validate', $data['validate']), $value, $ps_allow_html_iframe)) {
                     $res = false;
                 }
             } else {
                 if (!call_user_func(array('Validate', $data['validate']), $value)) {
                     $res = false;
                 }
             }
             if (!$res) {
                 if ($human_errors) {
                     return sprintf(Tools::displayError('The %s field is invalid.'), $this->displayFieldName($field, get_class($this)));
                 } else {
                     return 'Property ' . get_class($this) . '->' . $field . ' is not valid';
                 }
             }
         }
     }
     return true;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:94,代码来源:ObjectModel.php

示例15: Theme

            if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
            }
        }
    }
}
/* Trying to redefine HTTP_HOST if empty (on some webservers...) */
if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST'])) {
    $_SERVER['HTTP_HOST'] = @getenv('HTTP_HOST');
}
$context = Context::getContext();
/* Initialize the current Shop */
try {
    $context->shop = Shop::initialize();
    $context->theme = new Theme((int) $context->shop->id_theme);
    if ((Tools::isEmpty($theme_name = $context->shop->getTheme()) || !Validate::isLoadedObject($context->theme)) && !defined('_PS_ADMIN_DIR_')) {
        throw new PrestaShopException(Tools::displayError('Current theme unselected. Please check your theme configuration.'));
    }
} catch (PrestaShopException $e) {
    $e->displayMessage();
}
define('_THEME_NAME_', $theme_name);
define('__PS_BASE_URI__', $context->shop->getBaseURI());
/* Include all defines related to base uri and theme name */
require_once dirname(__FILE__) . '/defines_uri.inc.php';
global $_MODULES;
$_MODULES = array();
define('_PS_PRICE_DISPLAY_PRECISION_', Configuration::get('PS_PRICE_DISPLAY_PRECISION'));
define('_PS_PRICE_COMPUTE_PRECISION_', _PS_PRICE_DISPLAY_PRECISION_);
if (Configuration::get('PS_USE_HTMLPURIFIER')) {
    require_once _PS_TOOL_DIR_ . 'htmlpurifier/HTMLPurifier.standalone.php';
开发者ID:evgrishin,项目名称:mh16014,代码行数:31,代码来源:config.inc.php


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