本文整理汇总了PHP中Tools::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::strtolower方法的具体用法?PHP Tools::strtolower怎么用?PHP Tools::strtolower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::strtolower方法的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;
}
示例2: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
$origin_newsletter = (bool) $this->customer->newsletter;
if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
$this->customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
}
if (Tools::isSubmit('submitIdentity')) {
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
$this->errors[] = Tools::displayError('Invalid date of birth.');
} else {
$email = trim(Tools::getValue('email'));
$this->customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
if (isset($_POST['old_passwd'])) {
$_POST['old_passwd'] = trim($_POST['old_passwd']);
}
if (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('This email address is not valid');
} elseif ($this->customer->email != $email && Customer::customerExists($email, true)) {
$this->errors[] = Tools::displayError('An account using this email address has already been registered.');
} elseif (!isset($_POST['old_passwd']) || empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd) {
$this->errors[] = Tools::displayError('The password you entered is incorrect.');
} elseif ($_POST['passwd'] != $_POST['confirmation']) {
$this->errors[] = Tools::displayError('The password and confirmation do not match.');
} else {
$prev_id_default_group = $this->customer->id_default_group;
// Merge all errors of this file and of the Object Model
$this->errors = array_merge($this->errors, $this->customer->validateController());
}
if (!count($this->errors)) {
$this->customer->id_default_group = (int) $prev_id_default_group;
$this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
if (!isset($_POST['newsletter'])) {
$this->customer->newsletter = 0;
} elseif (!$origin_newsletter && isset($_POST['newsletter'])) {
if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) {
if ($module_newsletter->active) {
$module_newsletter->confirmSubscription($this->customer->email);
}
}
}
if (!isset($_POST['optin'])) {
$this->customer->optin = 0;
}
if (Tools::getValue('passwd')) {
$this->context->cookie->passwd = $this->customer->passwd;
}
if ($this->customer->update()) {
$this->context->cookie->customer_lastname = $this->customer->lastname;
$this->context->cookie->customer_firstname = $this->customer->firstname;
$this->context->smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('The information cannot be updated.');
}
}
}
} else {
$_POST = array_map('stripslashes', $this->customer->getFields());
}
return $this->customer;
}
示例3: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
$this->display_column_left = false;
parent::initContent();
if (!$this->isTokenValid()) {
die($this->module->l($this->module->displayName . ' Error: (invalid token)'));
}
$cart = $this->context->cart;
$address = new Address((int) $cart->id_address_invoice);
$customer = new Customer((int) $cart->id_customer);
$currency = $this->context->currency;
$country = new Country((int) $address->id_country);
if (!Configuration::get('SOFORTBANKING_USER_ID')) {
die($this->module->l($this->module->displayName . ' Error: (invalid or undefined userId)'));
}
if (!Configuration::get('SOFORTBANKING_PROJECT_ID')) {
die($this->module->l($this->module->displayName . ' Error: (invalid or undefined projectId)'));
}
if (!Validate::isLoadedObject($address) || !Validate::isLoadedObject($customer) || !Validate::isLoadedObject($currency)) {
die($this->module->l($this->module->displayName . ' Error: (invalid address or customer)'));
}
$parameters = array('user_id' => Configuration::get('SOFORTBANKING_USER_ID'), 'project_id' => Configuration::get('SOFORTBANKING_PROJECT_ID'), 'sender_holder' => '', '', '', 'sender_country_id' => $country->iso_code, 'amount' => number_format($cart->getOrderTotal(), 2, '.', ''), 'currency_id' => $currency->iso_code, 'reason_1' => time() . '-' . (int) $cart->id, 'reason_2' => $customer->firstname . ' ' . Tools::ucfirst(Tools::strtolower($customer->lastname)), 'user_variable_0' => $customer->secure_key, 'user_variable_1' => (int) $cart->id, 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'project_password' => Configuration::get('SOFORTBANKING_PROJECT_PW'));
$this->context->smarty->assign(array('this_path' => $this->module->getPathUri(), 'nbProducts' => $cart->nbProducts(), 'total' => $cart->getOrderTotal(), 'version' => _PS_VERSION_, 'hash' => sha1(implode('|', $parameters)), 'gateway' => 'https://www.sofortueberweisung.de/payment/start', 'cprotect' => Configuration::get('SOFORTBANKING_CPROTECT'), 'parameters' => $parameters, 'mod_lang' => $this->isSupportedLang()));
$this->setTemplate(Configuration::get('SOFORTBANKING_REDIRECT') == 'Y' ? 'payment_redirect.tpl' : 'payment_execution.tpl');
}
示例4: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
if (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('png', 'jpg', 'gif'))) {
$this->context->cookie->disallowWriting();
if ((bool) Configuration::get('PS_REWRITING_SETTINGS')) {
preg_match('#([0-9]+)(\\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/(.+)\\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
}
if ((!isset($matches[2]) || empty($matches[2])) && !(bool) Configuration::get('PS_REWRITING_SETTINGS')) {
preg_match('#/([0-9]+)(\\-[_a-zA-Z]*)\\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
}
if (is_array($matches) && !empty($matches[2]) && Tools::strtolower(substr($matches[2], -8)) != '_default' && is_numeric($matches[1])) {
$matches[2] = substr($matches[2], 1, Tools::strlen($matches[2])) . '_default';
if (!isset($matches[4])) {
$matches[4] = '';
}
header('Location: ' . $this->context->link->getImageLink($matches[4], $matches[1], $matches[2]), true, 302);
exit;
}
header('Content-Type: image/gif');
readfile(_PS_IMG_DIR_ . '404.gif');
exit;
} elseif (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('.js', 'css'))) {
$this->context->cookie->disallowWriting();
exit;
}
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_ . '404.tpl');
}
示例5: _showWidgetsSetting
public function _showWidgetsSetting()
{
$this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leomanagewidgets/assets/admin/jquery-validation-1.9.0/jquery.validate.js');
$this->context->controller->addCSS(__PS_BASE_URI__ . 'modules/leomanagewidgets/assets/admin/jquery-validation-1.9.0/screen.css');
$this->context->controller->addJS(__PS_BASE_URI__ . 'modules/leomanagewidgets/assets/admin/show.js');
$tpl = $this->createTemplate('widget.tpl');
$disabled = false;
$form = '';
$widget_selected = '';
$id = (int) Tools::getValue('id_leowidgets');
$key = (int) Tools::getValue('key');
if (Tools::getValue('id_leowidgets')) {
$model = new LeoTempcpWidget((int) Tools::getValue('id_leowidgets'));
} else {
$model = $this->widget;
}
$model->loadEngines();
$model->id_shop = Context::getContext()->shop->id;
$types = $model->getTypes();
if ($key) {
$widget_data = $model->getWidetByKey($key, Context::getContext()->shop->id);
} else {
$widget_data = $model->getWidetById($id);
}
$id = (int) $widget_data['id'];
$widget_selected = trim(Tools::strtolower(Tools::getValue('wtype')));
if ($widget_data['type']) {
$widget_selected = $widget_data['type'];
$disabled = true;
}
$form = $model->getForm($widget_selected, $widget_data);
$tpl->assign(array('types' => $types, 'form' => $form, 'widget_selected' => $widget_selected, 'table' => $this->table, 'max_size' => Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE'), 'PS_ALLOW_ACCENTED_CHARS_URL' => Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'), 'action' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token));
//echo "die"; die();
return $tpl->fetch();
}
示例6: renderList
public function renderList()
{
$this->toolbar_title = $this->l('Products list');
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
if (Tools::isSubmit('stockOrderby')) {
$stockOrderby = Tools::getValue('stockOrderby');
$_GET[$prefix . 'stockOrderby'] = $stockOrderby;
$_GET['stockOrderby'] = $stockOrderby;
}
if (Tools::isSubmit('stockOrderway')) {
$stockOrderway = Tools::getValue('stockOrderway');
$_GET[$prefix . 'stockOrderway'] = $stockOrderway;
$_GET['stockOrderway'] = $stockOrderway;
}
$this->processFilter();
$this->getCurrentValue('stockOrderway');
$this->getCurrentValue('stockOrderby');
//sidebar
require_once _PS_MODULE_DIR_ . 'erpillicopresta/models/ErpFeature.php';
$this->tpl_list_vars['erp_feature'] = ErpFeature::getFeaturesWithToken($this->context->language->iso_code);
$this->tpl_list_vars['template_path'] = $this->template_path;
$advanced_stock_token = Tools::getAdminToken('AdminAdvancedStock' . (int) Tab::getIdFromClassName('AdminAdvancedStock') . (int) $this->context->employee->id);
$this->tpl_list_vars['advanced_stock_token'] = $advanced_stock_token;
return parent::renderList();
}
示例7: copyFromPost
protected function copyFromPost(&$object, $table)
{
parent::copyFromPost($object, $table);
if (get_class($object) != 'Product') {
return;
}
/* Additional fields */
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
if (isset($_POST['meta_keywords_' . $language['id_lang']])) {
$_POST['meta_keywords_' . $language['id_lang']] = $this->_cleanMetaKeywords(Tools::strtolower($_POST['meta_keywords_' . $language['id_lang']]));
// preg_replace('/ *,? +,* /', ',', strtolower($_POST['meta_keywords_'.$language['id_lang']]));
$object->meta_keywords[$language['id_lang']] = $_POST['meta_keywords_' . $language['id_lang']];
}
}
$_POST['width'] = empty($_POST['width']) ? '0' : str_replace(',', '.', $_POST['width']);
$_POST['height'] = empty($_POST['height']) ? '0' : str_replace(',', '.', $_POST['height']);
$_POST['depth'] = empty($_POST['depth']) ? '0' : str_replace(',', '.', $_POST['depth']);
$_POST['weight'] = empty($_POST['weight']) ? '0' : str_replace(',', '.', $_POST['weight']);
if ($_POST['unit_price'] != NULL) {
$object->unit_price = str_replace(',', '.', $_POST['unit_price']);
}
if (array_key_exists('ecotax', $_POST) && $_POST['ecotax'] != NULL) {
$object->ecotax = str_replace(',', '.', $_POST['ecotax']);
}
$object->available_for_order = (int) Tools::isSubmit('available_for_order');
$object->show_price = $object->available_for_order ? 1 : (int) Tools::isSubmit('show_price');
$object->on_sale = Tools::isSubmit('on_sale');
$object->online_only = Tools::isSubmit('online_only');
}
示例8: hookHeader
function hookHeader($params)
{
global $smarty, $cookie;
$id_category = intval(Tools::getValue('id_category'));
if (!$id_category) {
if (isset($_SERVER['HTTP_REFERER']) and preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) and !strstr($_SERVER['HTTP_REFERER'], '.html')) {
if (isset($regs[2]) and is_numeric($regs[2])) {
$id_category = intval($regs[2]);
} elseif (isset($regs[5]) and is_numeric($regs[5])) {
$id_category = intval($regs[5]);
}
} elseif ($id_product = intval(Tools::getValue('id_product'))) {
$product = new Product($id_product);
$id_category = $product->id_category_default;
}
}
$category = new Category($id_category);
$orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$orderWayValues = array(0 => 'ASC', 1 => 'DESC');
$orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[intval(Configuration::get('PS_PRODUCTS_ORDER_BY'))]));
$orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[intval(Configuration::get('PS_PRODUCTS_ORDER_WAY'))]));
if (!in_array($orderBy, $orderByValues)) {
$orderBy = $orderByValues[0];
}
if (!in_array($orderWay, $orderWayValues)) {
$orderWay = $orderWayValues[0];
}
$smarty->assign(array('feedUrl' => 'http://' . Tools::getHttpHost(false, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/rss.php?id_category=' . $id_category . '&orderby=' . $orderBy . '&orderway=' . $orderWay));
return $this->display(__FILE__, 'feederHeader.tpl');
}
示例9: send
/**
* Send a mail
*
* @param string $subject
* @param string $content
* @return bool|string false is everything was fine, or error string
*/
public function send($subject, $content)
{
try {
// Test with custom SMTP connection
if ($this->smtp_checked) {
// Retrocompatibility
if (Tools::strtolower($this->encryption) === 'off') {
$this->encryption = false;
}
$smtp = Swift_SmtpTransport::newInstance($this->server, $this->port, $this->encryption);
$smtp->setUsername($this->login);
$smtp->setpassword($this->password);
$smtp->setTimeout(5);
$swift = Swift_Mailer::newInstance($smtp);
} else {
// Test with normal PHP mail() call
$swift = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());
}
$message = Swift_Message::newInstance();
$message->setFrom($this->email)->setTo('no-reply@' . Tools::getHttpHost(false, false, true))->setSubject($subject)->setBody($content);
$message = new Swift_Message($subject, $content, 'text/html');
if (@$swift->send($message)) {
$result = true;
} else {
$result = 'Could not send message';
}
$swift->disconnect();
} catch (Swift_SwiftException $e) {
$result = $e->getMessage();
}
return $result;
}
示例10: getPages
public static function getPages($exclude_filled = false, $add_page = false)
{
$selected_pages = array();
if (!($files = Tools::scandir(_PS_ROOT_DIR_ . '/controllers/front/', 'php', '', true))) {
die(Tools::displayError('Cannot scan root directory'));
}
// Exclude pages forbidden
$exlude_pages = array('category', 'changecurrency', 'cms', 'footer', 'header', 'pagination', 'product', 'product-sort', 'statistics');
foreach ($files as $file) {
if ($file != 'index.php' && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages)) {
$class_name = str_replace('.php', '', $file);
if (class_exists($class_name)) {
$reflection = new ReflectionClass(str_replace('.php', '', $file));
}
if (isset($reflection) && $reflection) {
$properties = $reflection->getDefaultProperties();
}
if (isset($properties['php_self'])) {
$selected_pages[$properties['php_self']] = $properties['php_self'];
} else {
if (preg_match('/^[a-z0-9_.-]*\\.php$/i', $file)) {
$selected_pages[strtolower(str_replace('Controller.php', '', $file))] = strtolower(str_replace('Controller.php', '', $file));
} else {
if (preg_match('/^([a-z0-9_.-]*\\/)?[a-z0-9_.-]*\\.php$/i', $file)) {
$selected_pages[strtolower(sprintf(Tools::displayError('%2$s (in %1$s)'), dirname($file), str_replace('Controller.php', '', basename($file))))] = strtolower(str_replace('Controller.php', '', basename($file)));
}
}
}
}
}
// Add modules controllers to list (this function is cool !)
foreach (glob(_PS_MODULE_DIR_ . '*/controllers/front/*.php') as $file) {
$filename = Tools::strtolower(basename($file, '.php'));
if ($filename == 'index') {
continue;
}
$module = Tools::strtolower(basename(dirname(dirname(dirname($file)))));
$selected_pages[$module . ' - ' . $filename] = 'module-' . $module . '-' . $filename;
}
// Exclude page already filled
if ($exclude_filled) {
$metas = Meta::getMetas();
foreach ($metas as $meta) {
if (in_array($meta['page'], $selected_pages)) {
unset($selected_pages[array_search($meta['page'], $selected_pages)]);
}
}
}
// Add selected page
if ($add_page) {
$name = $add_page;
if (preg_match('#module-([a-z0-9_-]+)-([a-z0-9]+)$#i', $add_page, $m)) {
$add_page = $m[1] . ' - ' . $m[2];
}
$selected_pages[$add_page] = $name;
asort($selected_pages);
}
return $selected_pages;
}
示例11: preProcess
public function preProcess()
{
parent::preProcess();
$customer = new Customer((int) self::$cookie->id_customer);
if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
$customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
}
if (Tools::isSubmit('submitIdentity')) {
if (Module::getInstanceByName('blocknewsletter')->active) {
if (!isset($_POST['optin'])) {
$customer->optin = 0;
}
if (!isset($_POST['newsletter'])) {
$customer->newsletter = 0;
}
}
if (!isset($_POST['id_gender'])) {
$_POST['id_gender'] = 9;
}
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
$this->errors[] = Tools::displayError('Invalid date of birth');
} else {
$customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
$id_customer_exists = (int) Customer::customerExists(Tools::getValue('email'), true, false);
if ($id_customer_exists && $id_customer_exists != (int) self::$cookie->id_customer) {
$this->errors[] = Tools::displayError('An account is already registered with this e-mail.');
}
$_POST['old_passwd'] = trim($_POST['old_passwd']);
if (empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) {
$this->errors[] = Tools::displayError('Your password is incorrect.');
} elseif ($_POST['passwd'] != $_POST['confirmation']) {
$this->errors[] = Tools::displayError('Password and confirmation do not match');
} else {
$prev_id_default_group = $customer->id_default_group;
$this->errors = array_unique(array_merge($this->errors, $customer->validateController(true, true)));
}
if (!count($this->errors)) {
$customer->id_default_group = (int) $prev_id_default_group;
$customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname));
if (Tools::getValue('passwd')) {
self::$cookie->passwd = $customer->passwd;
}
if ($customer->update()) {
self::$cookie->customer_lastname = $customer->lastname;
self::$cookie->customer_firstname = $customer->firstname;
self::$smarty->assign('confirmation', 1);
} else {
$this->errors[] = Tools::displayError('Cannot update information');
}
}
}
} else {
$_POST = array_map('stripslashes', $customer->getFields());
}
$birthday = $customer->birthday ? explode('-', $customer->birthday) : array('-', '-', '-');
/* Generate years, months and days */
self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors));
self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
}
示例12: testUninstall
public function testUninstall()
{
$module = Module::getInstanceByName(Tools::strtolower($this->getClass()));
if (!$module->id) {
$module->install();
}
$this->assertTrue($module->uninstall());
}
示例13: getContent
function getContent()
{
$ebay_country = EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT'));
$help_file = dirname(__FILE__) . '/../../help/help-' . Tools::strtolower($ebay_country->getDocumentationLang()) . '.html';
if (!file_exists($help_file)) {
$help_file = dirname(__FILE__) . '/../../help/help-en.html';
}
return Tools::file_get_contents($help_file);
}
示例14: webalize
public static function webalize($string)
{
$string = preg_replace('~[^\\pL0-9_]+~u', '-', $string);
$string = trim($string, '-');
$string = iconv('utf-8', 'us-ascii//TRANSLIT', $string);
$string = Tools::strtolower($string);
$string = preg_replace('~[^-a-z0-9_]+~', '', $string);
return $string;
}
示例15: __construct
public function __construct($params, $object)
{
$this->Expeditions = $params['Expeditions'];
$this->_mondialrelay = $object;
$this->_webServiceKey = $this->_mondialrelay->account_shop['MR_KEY_WEBSERVICE'];
$this->_markCode = $this->_mondialrelay->account_shop['MR_CODE_MARQUE'];
$this->class_name = Tools::strtolower($this->class_name);
$this->_webserviceURL = MondialRelay::MR_URL . 'webservice/Web_Services.asmx?WSDL';
}