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


PHP Tools::substr方法代码示例

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


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

示例1: renderContent

 public function renderContent($args, $setting)
 {
     $t = array('name' => '', 'image_folder_path' => '', 'limit' => 12, 'columns' => 4);
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $setting = array_merge($t, $setting);
     $oimages = array();
     if ($setting['image_folder_path']) {
         $path = _PS_ROOT_DIR_ . '/' . trim($setting['image_folder_path']) . '/';
         $path = str_replace("//", "/", $path);
         if (is_dir($path)) {
             $images = glob($path . '*.*');
             $exts = array('jpg', 'gif', 'png');
             foreach ($images as $cnt => $image) {
                 $ext = Tools::substr($image, Tools::strlen($image) - 3, Tools::strlen($image));
                 if (in_array(Tools::strtolower($ext), $exts)) {
                     if ($cnt < (int) $setting['limit']) {
                         $i = str_replace("\\", "/", '' . $setting['image_folder_path'] . "/" . basename($image));
                         $i = str_replace("//", "/", $i);
                         $oimages[] = $url . $i;
                     }
                 }
             }
         }
     }
     $images = array();
     $setting['images'] = $oimages;
     $output = array('type' => 'image', 'data' => $setting);
     return $output;
 }
开发者ID:ekachandrasetiawan,项目名称:BeltcareCom,代码行数:30,代码来源:image.php

示例2: 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:evgrishin,项目名称:mh16014,代码行数:28,代码来源:productpaymentlogos.php

示例3: getContent

 function getContent()
 {
     // Check if the module is configured
     if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
         return '<p class="error"><b>' . $this->ebay->l('Please configure the \'General settings\' tab before using this tab') . '</b></p><br /><script type="text/javascript">$("#menuTab4").addClass("wrong")</script>';
     }
     $iso = $this->context->language->iso_code;
     $iso_tiny_mce = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     // Display Form
     $url_vars = array('id_tab' => '4', 'section' => 'template');
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         $url_vars['controller'] = Tools::getValue('controller');
     } else {
         $url_vars['tab'] = Tools::getValue('tab');
     }
     $action_url = $this->_getUrl($url_vars);
     if (Tools::getValue('reset_template')) {
         $ebay_product_template = EbayProductTemplate::getContent($this->ebay, $this->smarty);
     } else {
         $ebay_product_template = Tools::getValue('ebay_product_template', $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE'));
     }
     $ebay_product_template_title = $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE');
     $smarty_vars = array('action_url' => $action_url, 'ebay_product_template' => $ebay_product_template, 'ebay_product_template_title' => $ebay_product_template_title, 'features_product' => Feature::getFeatures($this->context->language->id), 'ad' => dirname($_SERVER['PHP_SELF']), 'base_uri' => __PS_BASE_URI__, 'is_one_dot_three' => Tools::substr(_PS_VERSION_, 0, 3) == '1.3', 'is_one_dot_five' => version_compare(_PS_VERSION_, '1.5', '>'), 'theme_css_dir' => _THEME_CSS_DIR_);
     if (Tools::substr(_PS_VERSION_, 0, 3) == '1.3') {
         $smarty_vars['theme_name'] = _THEME_NAME_;
         $smarty_vars['language'] = file_exists(_PS_ROOT_DIR_ . '/js/tinymce/jscripts/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } elseif (version_compare(_PS_VERSION_, '1.5', '>')) {
         $smarty_vars['iso'] = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } else {
         $smarty_vars['iso_type_mce'] = $iso_tiny_mce;
         $smarty_vars['ps_js_dir'] = _PS_JS_DIR_;
     }
     return $this->display('formTemplateManager.tpl', $smarty_vars);
 }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:34,代码来源:EbayFormTemplateManagerTab.php

示例4: setShop

 public function setShop($name, $company, $url)
 {
     $this->shop['name'] = $this->prepareField($name);
     $this->shop['name'] = Tools::substr($this->shop['name'], 0, 20);
     $this->shop['company'] = $this->prepareField($company);
     $this->shop['url'] = $this->prepareField($url);
 }
开发者ID:V1dun,项目名称:yandex-money-cms-prestashop,代码行数:7,代码来源:ymlclass.php

示例5: getFilterQuery

 protected function getFilterQuery($keys_array = array(), $table)
 {
     $sql = '';
     foreach ($keys_array as $key) {
         if ($this->context->cookie->{$table . 'Filter_' . $key} !== '' && $this->context->cookie->{$table . 'Filter_' . $key} !== false) {
             $value = $this->context->cookie->{$table . 'Filter_' . $key};
             if ($key == 'id_manifest') {
                 $sql .= '`id_manifest` ' . ($value ? '!=' : '=') . ' "0" AND ';
             } elseif (is_array(Tools::jsonDecode($value))) {
                 $date = Tools::jsonDecode($value);
                 $date = array_filter($date);
                 if (!$date) {
                     continue;
                 }
                 if (!empty($date[0])) {
                     $sql .= '`' . bqSQL($key) . '` > "' . pSQL($date[0]) . '" AND ';
                 }
                 if (!empty($date[1])) {
                     $sql .= '`' . bqSQL($key) . '` < "' . pSQL($date[1]) . '" AND ';
                 }
             } else {
                 $sql .= '`' . bqSQL($key) . '` LIKE "%' . pSQL($value) . '%" AND ';
             }
         }
     }
     if ($sql) {
         $sql = ' HAVING ' . Tools::substr($sql, 0, -4);
     }
     // remove 'AND ' from the end of query
     return $sql;
 }
开发者ID:remixaz,项目名称:dpdgroup,代码行数:31,代码来源:Controller.php

示例6: WebServiceCheck

 public static function WebServiceCheck($vat_number)
 {
     if (empty($vat_number)) {
         return array();
     }
     $vat_number = str_replace(' ', '', $vat_number);
     $prefix = Tools::substr($vat_number, 0, 2);
     if (array_search($prefix, self::getPrefixIntracomVAT()) === false) {
         return array(Tools::displayError('Invalid VAT number'));
     }
     $vat = Tools::substr($vat_number, 2);
     $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . urlencode($prefix) . '&iso=' . urlencode($prefix) . '&vat=' . urlencode($vat);
     @ini_set('default_socket_timeout', 2);
     for ($i = 0; $i < 3; $i++) {
         if ($page_res = Tools::file_get_contents($url)) {
             if (preg_match('/invalid VAT number/i', $page_res)) {
                 @ini_restore('default_socket_timeout');
                 return array(Tools::displayError('VAT number not found'));
             } else {
                 if (preg_match('/valid VAT number/i', $page_res)) {
                     @ini_restore('default_socket_timeout');
                     return array();
                 } else {
                     ++$i;
                 }
             }
         } else {
             sleep(1);
         }
     }
     @ini_restore('default_socket_timeout');
     return array(Tools::displayError('VAT number validation service unavailable'));
 }
开发者ID:informaticapb,项目名称:Prestashop,代码行数:33,代码来源:vatnumber.php

示例7: getFilterQuery

 protected function getFilterQuery($keys_array = array(), $table)
 {
     $sql = '';
     foreach ($keys_array as $key) {
         if ($this->context->cookie->__isset($table . 'Filter_' . $key)) {
             $value = $this->context->cookie->{$table . 'Filter_' . $key};
             if (Validate::isSerializedArray($value)) {
                 $date = $this->module_instance->unSerialize($value);
                 if (!empty($date[0])) {
                     $sql .= '`' . bqSQL($key) . '` > "' . pSQL($date[0]) . '" AND ';
                 }
                 if (!empty($date[1])) {
                     $sql .= '`' . bqSQL($key) . '` < "' . pSQL($date[1]) . '" AND ';
                 }
             } else {
                 if ($value != '') {
                     $sql .= '`' . bqSQL($key) . '` LIKE "%' . pSQL($value) . '%" AND ';
                 }
             }
         }
     }
     if ($sql) {
         $sql = ' HAVING ' . Tools::substr($sql, 0, -4);
     }
     // remove 'AND ' from the end of query
     return $sql;
 }
开发者ID:rokaszygmantas,项目名称:dpdpoland,代码行数:27,代码来源:controller.php

示例8: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     //parent::initContent();
     $so = new SCfields('API');
     $fields = $so->getFields();
     /* Build back the fields list for SoColissimo, gift infos are send using the JS */
     $inputs = array();
     foreach ($_GET as $key => $value) {
         if (in_array($key, $fields)) {
             $inputs[$key] = trim(Tools::getValue($key));
         }
     }
     /* for belgium number specific format */
     if (Tools::getValue('cePays') == 'BE') {
         if (isset($inputs['cePhoneNumber']) && strpos($inputs['cePhoneNumber'], '324') === 0) {
             $inputs['cePhoneNumber'] = '+324' . Tools::substr($inputs['cePhoneNumber'], 3);
         }
     }
     $param_plus = array(Tools::getValue('trParamPlus'), Tools::getValue('gift'), $so->replaceAccentedChars(Tools::getValue('gift_message')));
     $inputs['trParamPlus'] = implode('|', $param_plus);
     /* Add signature to get the gift and gift message in the trParamPlus */
     $inputs['signature'] = $so->generateKey($inputs);
     // automatic settings api protocol for ssl
     $protocol = 'http://';
     if (Configuration::get('PS_SSL_ENABLED')) {
         $protocol = 'https://';
     }
     $socolissimo_url = $protocol . Configuration::get('SOCOLISSIMO_URL_MOBILE');
     Context::getContext()->smarty->assign(array('inputs' => $inputs, 'socolissimo_url' => $socolissimo_url, 'logo' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/socolissimo/logo.gif', 'loader' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/socolissimo/img/ajax-loader.gif'));
     $this->setTemplate('redirect.tpl');
 }
开发者ID:GthrDrllx,项目名称:GMShop,代码行数:34,代码来源:redirectmobile.php

示例9: __construct

 public function __construct()
 {
     $this->name = 'payplug';
     $this->tab = 'payments_gateways';
     $this->version = '1.0.1';
     $this->author = 'PayPlug';
     $this->module_key = '1ee28a8fb5e555e274bd8c2e1c45e31a';
     parent::__construct();
     // For 1.6
     $this->bootstrap = true;
     // Backward compatibility
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php';
     }
     // Add warning if prestashop is an older version than 1.4
     if (version_compare(_PS_VERSION_, '1.4', '<')) {
         $this->warning = $this->l('Sorry Payplug is not compatible with Prestashop for versions < 1.4. Please delete the payplug directory in the Prestashop modules directory for your Prestashop system to get back to normal.');
     }
     $this->currencies = true;
     $this->currencies_mode = 'checkbox';
     // Change descriptionn and display name
     $this->displayName = $this->l('PayPlug – Simple and secure online payments');
     $this->description = $this->l('The simplest online payment solution: no setup fees, no fixed fees, and no merchant account required!');
     $this->confirmUninstall = $this->l('Are you sure you wish to uninstall this module and delete your settings?');
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         $cookie_admin = new Cookie('psAdmin', Tools::substr($_SERVER['PHP_SELF'], Tools::strlen(__PS_BASE_URI__), -10));
         if (Tools::getValue('tab') == 'AdminPayment' && Tools::getValue('token') != Tools::getAdminTokenLite('AdminPayment')) {
             // Force admin status
             $this->context->cookie->profile = $cookie_admin->profile;
             $url = 'index.php?tab=AdminPayment';
             $url .= '&token=' . Tools::getAdminTokenLite('AdminPayment');
             Tools::redirectAdmin($url);
         }
     }
 }
开发者ID:202-ecommerce,项目名称:payplug,代码行数:35,代码来源:payplug.php

示例10: psmFindSignature

 function psmFindSignature($content, $start_signature, $end_signature)
 {
     if (($start = strpos($content, $start_signature)) !== false && ($end = strpos($content, $end_signature, $start)) !== false) {
         $length = Tools::strlen($start_signature);
         return Tools::substr($content, $start + $length, $end - $start - $length);
     }
     return false;
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:8,代码来源:psm_helper.php

示例11: createAccount

 /**
  * create a new user account
  * --
  */
 public function createAccount()
 {
     //user
     $gender = 1;
     $id_default_group = (int) Configuration::get('PS_CUSTOMER_GROUP');
     $firstname = pSQL($this->auth_user->givenName);
     $lastname = pSQL($this->auth_user->familyName);
     $email = $this->auth_user->email;
     // generate passwd
     srand((double) microtime() * 1000000);
     $passwd = Tools::substr(uniqid(rand()), 0, 12);
     $real_passwd = $passwd;
     $passwd = md5(pSQL(_COOKIE_KEY_ . $passwd));
     //dates
     $last_passwd_gen = date('Y-m-d H:i:s', strtotime('-' . Configuration::get('PS_PASSWD_TIME_FRONT') . 'minutes'));
     $secure_key = md5(uniqid(rand(), true));
     $active = 1;
     $date_add = date('Y-m-d H:i:s');
     //'2011-04-04 18:29:15';
     $date_upd = $date_add;
     //gen sql
     $sql = 'insert into `' . _DB_PREFIX_ . 'customer` SET 
     id_gender = ' . (int) $gender . ', id_default_group = ' . (int) $id_default_group . ',
     firstname = \'' . pSQL($firstname) . '\', lastname = \'' . pSQL($lastname) . '\',
     email = \'' . pSQL($email) . '\', passwd = \'' . pSQL($passwd) . '\',
     last_passwd_gen = \'' . pSQL($last_passwd_gen) . '\',
     secure_key = \'' . pSQL($secure_key) . '\', active = ' . (int) $active . ',
     date_add = \'' . pSQL($date_add) . '\', date_upd = \'' . pSQL($date_upd) . '\', optin = 1 ';
     //make the insert and return the last id
     Db::getInstance()->Execute($sql);
     $insert_id = Db::getInstance()->Insert_ID();
     $sql = 'INSERT into `' . _DB_PREFIX_ . 'customer_group` SET ' . 'id_customer = ' . (int) $insert_id . ', id_group = ' . (int) $id_default_group . ' ';
     Db::getInstance()->Execute($sql);
     // auth customer
     $cookie = $this->context->cookie;
     $customer = new Customer();
     //atempt
     $authentication = $customer->getByEmail(trim($email), trim($real_passwd));
     if (!$authentication || !$customer->id) {
         $this->authenticationFailed();
     } else {
         $cookie->id_customer = (int) $customer->id;
         $cookie->customer_lastname = $customer->lastname;
         $cookie->customer_firstname = $customer->firstname;
         $cookie->logged = 1;
         $cookie->passwd = $customer->passwd;
         $cookie->email = $customer->email;
         if (Configuration::get('PS_CART_FOLLOWING') && (empty($cookie->id_cart) || Cart::getNbProducts($cookie->id_cart) == 0)) {
             $cookie->id_cart = (int) Cart::lastNoneOrderedCart((int) $customer->id);
         }
         Hook::exec('actionAuthentication');
         //check if the wecome email exists
         if (Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) {
             Mail::Send($this->context->language->id, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => trim($real_passwd)), $customer->email, $customer->firstname . ' ' . $customer->lastname);
         }
         $this->login($customer->id);
     }
 }
开发者ID:garyconstable,项目名称:prestashop-google-connect,代码行数:62,代码来源:connect_customer.php

示例12: __construct

 public function __construct()
 {
     $this->name = 'adminmarketingestep1';
     $this->bootstrap = true;
     $this->module = 'expressmailing';
     $this->context = Context::getContext();
     $this->lang = true;
     $this->default_form_language = $this->context->language->id;
     $this->campaign_id = (int) Tools::getValue('campaign_id');
     if (empty($this->campaign_id)) {
         Tools::redirectAdmin('index.php?controller=AdminMarketingX&token=' . Tools::getAdminTokenLite('AdminMarketingX'));
         exit;
     }
     parent::__construct();
     $online = true;
     $ip_string = (string) Tools::getRemoteAddr();
     $ip_long = ip2long($ip_string);
     if (Tools::substr(Configuration::get('PS_SHOP_DOMAIN'), 0, 9) == 'localhost') {
         $online = false;
     }
     if ($ip_long >= ip2long('10.0.0.0') && $ip_long <= ip2long('10.255.255.255')) {
         $online = false;
     }
     if ($ip_long >= ip2long('127.0.0.0') && $ip_long <= ip2long('127.255.255.255')) {
         $online = false;
     }
     if ($ip_long >= ip2long('172.16.0.0') && $ip_long <= ip2long('172.31.255.255')) {
         $online = false;
     }
     if ($ip_long >= ip2long('192.168.0.0') && $ip_long <= ip2long('192.168.255.255')) {
         $online = false;
     } elseif ($ip_string == '::1') {
         $online = false;
     }
     /* IPv6 */
     if (!$online) {
         $a = $this->module->l('You are currently testing your Prestashop on a local server :', 'adminmarketingestep1');
         $b = $this->module->l('To enjoy the full IMAGE & TRACKING features, you need use a Prestashop online server !', 'adminmarketingestep1');
         $this->warnings[] = $a . ' ' . Tools::getRemoteAddr();
         $this->warnings[] = $b;
     }
     // API initialization
     // ------------------
     include _PS_MODULE_DIR_ . $this->module->name . '/controllers/admin/session_api.php';
     $this->session_api = new SessionApi();
     if ($this->session_api->connectFromCredentials('email')) {
         // On retrouve le max_daily depuis l'API Express-Mailing
         // -----------------------------------------------------
         $parameters = array('account_id' => $this->session_api->account_id);
         $response_array = array();
         if ($this->session_api->call('email', 'account', 'get_formula', $parameters, $response_array)) {
             if ((int) $response_array['broadcast_max_campaign'] > 0) {
                 $this->default_max_daily = $response_array['broadcast_max_campaign'];
             }
         }
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:57,代码来源:adminmarketingestep1.php

示例13: decrypt

 public static function decrypt($plaintext)
 {
     $token = Tools::substr($plaintext, 0, 5);
     $id = Configuration::get('PAGSEGURO_ID');
     if (strcmp($id, $token) == 0) {
         return Tools::substr($plaintext, 5);
     }
     return $plaintext;
 }
开发者ID:kennedimalheiros,项目名称:prestashop,代码行数:9,代码来源:encryptionIdPagSeguro.php

示例14: init

 public function init()
 {
     parent::init();
     if (Tools::isSubmit('storedelivery') && (int) Tools::getValue('storedelivery') != 0) {
         //Save cookie only if previous id_adress wasn't a store
         $cookie = new Cookie('storedelivery');
         $cookie->__set('id_address_delivery', $this->context->cart->id_address_delivery);
         $store = new Store(Tools::getValue('storedelivery'));
         //Test if store address exist in address table
         Tools::strlen($store->name) > 32 ? $storeName = Tools::substr(preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name), 0, 29) . '...' : ($storeName = preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name));
         $sql = 'SELECT id_address FROM ' . _DB_PREFIX_ . 'address WHERE alias=\'' . addslashes($storeName) . '\' AND address1=\'' . addslashes($store->address1) . '\' AND address2=\'' . addslashes($store->address2) . '\' AND postcode=\'' . $store->postcode . '\' AND city=\'' . addslashes($store->city) . '\' AND id_country=\'' . addslashes($store->id_country) . '\' AND active=1 AND deleted=0';
         $id_address = Db::getInstance()->getValue($sql);
         //Create store adress if not exist for this user
         if (empty($id_address)) {
             $country = new Country($store->id_country, $this->context->language->id);
             $address = new Address();
             $address->id_country = $store->id_country;
             $address->id_state = $store->id_state;
             $address->country = $country->name;
             Tools::strlen($store->name) > 32 ? $address->alias = Tools::substr(preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name), 0, 29) . '...' : ($address->alias = preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name));
             Tools::strlen($store->name) > 32 ? $address->lastname = Tools::substr(preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name), 0, 29) . '...' : ($address->lastname = preg_replace("/[^a-zA-Zěščřžýáíéèêàô ]+/", '', $store->name));
             $address->firstname = " ";
             $address->address1 = $store->address1;
             $address->address2 = $store->address2;
             $address->postcode = $store->postcode;
             $address->city = $store->city;
             $address->phone = $store->phone;
             $address->deleted = 0;
             //create an address non deleted to register them in order
             $address->add();
             $id_address = $address->id;
         }
         //Update cart info
         $cart = $this->context->cart;
         $cart->id_address_delivery = $id_address;
         $cart->update();
         //Change address of all product in cart else we are redirect on step Carrier because of function autostep or OrderController
         Db::getInstance()->update('cart_product', array('id_address_delivery' => (int) $id_address), $where = 'id_cart = ' . $this->context->cart->id);
         //Change post carrier option else bad default carrier is saved by fonction processCarrier of ParentOrderController
         $array = array_values(Tools::getValue('delivery_option'));
         $_POST['delivery_option'] = array($id_address => $array[0]);
     } else {
         $cookie = new Cookie('storedelivery');
         $id_address_delivery = $cookie->__get('id_address_delivery');
         if ($id_address_delivery != false && $this->context->cart->id_address_delivery != $id_address_delivery && Tools::isSubmit('storedelivery')) {
             $this->context->cart->id_address_delivery = $cookie->__get('id_address_delivery');
             $this->context->cart->update();
             //Change address of all product in cart else we are redirect on step Carrier because of function autostep or OrderController
             Db::getInstance()->update('cart_product', array('id_address_delivery' => (int) $cookie->__get('id_address_delivery')), $where = 'id_cart = ' . $this->context->cart->id);
             //Change post carrier option else bad default carrier is saved by fonction processCarrier of ParentOrderController
             $array = array_values(Tools::getValue('delivery_option'));
             $_POST['delivery_option'] = array($cookie->__get('id_address_delivery') => $array[0]);
             $cookie->__unset('id_address_delivery');
         }
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:56,代码来源:OrderController.php

示例15: getallheaders

 private function getallheaders()
 {
     $headers = '';
     foreach ($_SERVER as $name => $value) {
         if (Tools::substr($name, 0, 5) == 'HTTP_') {
             $headers[str_replace(' ', '-', ucwords(Tools::strtolower(str_replace('_', ' ', Tools::substr($name, 5)))))] = $value;
         }
     }
     return $headers;
 }
开发者ID:aplazame,项目名称:prestashop,代码行数:10,代码来源:history.php


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