本文整理汇总了PHP中Tools::strtoupper方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::strtoupper方法的具体用法?PHP Tools::strtoupper怎么用?PHP Tools::strtoupper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::strtoupper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFields
public function getFields()
{
parent::validateFields();
if (isset($this->id)) {
$fields['id_customer'] = intval($this->id);
}
$fields['secure_key'] = pSQL($this->secure_key);
$fields['id_gender'] = intval($this->id_gender);
$fields['lastname'] = pSQL(Tools::strtoupper($this->lastname));
$fields['firstname'] = pSQL($this->firstname);
$fields['birthday'] = pSQL($this->birthday);
$fields['email'] = pSQL($this->email);
$fields['dni'] = pSQL($this->dni);
$fields['newsletter'] = intval($this->newsletter);
$fields['newsletter_date_add'] = pSQL($this->newsletter_date_add);
$fields['ip_registration_newsletter'] = pSQL($this->ip_registration_newsletter);
$fields['optin'] = intval($this->optin);
$fields['passwd'] = pSQL($this->passwd);
$fields['last_passwd_gen'] = pSQL($this->last_passwd_gen);
$fields['active'] = intval($this->active);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['deleted'] = intval($this->deleted);
return $fields;
}
示例2: getData
public function getData()
{
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate,2) as ca
FROM ' . _DB_PREFIX_ . 'order_cart_rule ocr
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON o.id_order = ocr.id_order
LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule
WHERE o.valid = 1
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
AND o.invoice_date BETWEEN ' . $this->getDate() . '
GROUP BY ocr.id_cart_rule';
if (Validate::IsName($this->_sort)) {
$this->query .= ' ORDER BY `' . bqSQL($this->_sort) . '`';
if (isset($this->_direction) && (Tools::strtoupper($this->_direction) == 'ASC' || Tools::strtoupper($this->_direction) == 'DESC')) {
$this->query .= ' ' . pSQL($this->_direction);
}
}
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
$this->query .= ' LIMIT ' . (int) $this->_start . ', ' . (int) $this->_limit;
}
$values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query);
foreach ($values as &$value) {
$value['ca'] = Tools::displayPrice($value['ca'], $currency);
}
$this->_values = $values;
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
}
示例3: executeCronTask
public static function executeCronTask()
{
$ts_module = new TrustedShops();
$ts_common = new TSCommon();
$common_count = 0;
if (is_array(TSCommon::$available_languages)) {
$to_remove = array();
foreach (array_keys(TSCommon::$available_languages) as $iso) {
$alerts_infos = RatingAlert::getAlertsInformations($iso);
///print_r($alerts_infos);
if ($alerts_infos != false) {
$common_count += count($alerts_infos);
foreach ($alerts_infos as $infos) {
$cert = Configuration::get(TSCommon::PREFIX_TABLE . 'CERTIFICATE_' . Tools::strtoupper($infos['iso']));
$certificate = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8($cert));
$subject = $ts_module->l('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->l('title_part_2');
$template_vars = array('{ts_id}' => $certificate['tsID'], '{button_url}' => TSCommon::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/views/img', '{rating_url}' => $ts_common->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
$result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], null, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/../mails/');
if ($result) {
$to_remove[] = (int) $infos['id_alert'];
}
}
}
}
if (count($to_remove) > 0) {
self::removeAlerts($to_remove);
}
}
return count($to_remove) == $common_count;
}
示例4: ignoreRow
public static function ignoreRow($row)
{
if (count($row) == 1 && empty($row[0])) {
return true;
}
return isset($row['id']) && is_string($row['id']) && Tools::strtoupper($row['id']) == 'ID' || isset($row['id_product']) && is_string($row['id_product']) && Tools::strtoupper($row['id_product']) == 'PRODUCT ID*';
}
示例5: curlConnection
private function curlConnection($method, $url, $timeout, $charset, array $data = null)
{
if (Tools::strtoupper($method) === 'POST') {
$postFields = $data ? http_build_query($data, '', '&') : "";
$contentLength = "Content-length: " . Tools::strlen($postFields);
$methodOptions = array(CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postFields);
} else {
$contentLength = null;
$methodOptions = array(CURLOPT_HTTPGET => true);
}
$options = array(CURLOPT_HTTPHEADER => array("Content-Type: application/x-www-form-urlencoded; charset=" . $charset, $contentLength, 'lib-description: php:' . PagSeguroLibrary::getVersion(), 'language-engine-description: php:' . PagSeguroLibrary::getPHPVersion()), CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CONNECTTIMEOUT => $timeout);
if (!is_null(PagSeguroLibrary::getModuleVersion())) {
array_push($options[CURLOPT_HTTPHEADER], 'module-description: ' . PagSeguroLibrary::getModuleVersion());
}
if (!is_null(PagSeguroLibrary::getCMSVersion())) {
array_push($options[CURLOPT_HTTPHEADER], 'cms-description: ' . PagSeguroLibrary::getCMSVersion());
}
$options = $options + $methodOptions;
$curl = curl_init();
curl_setopt_array($curl, $options);
$resp = curl_exec($curl);
$info = curl_getinfo($curl);
$error = curl_errno($curl);
$errorMessage = curl_error($curl);
curl_close($curl);
$this->setStatus((int) $info['http_code']);
$this->setResponse((string) $resp);
if ($error) {
throw new Exception("CURL can't connect: {$errorMessage}");
} else {
return true;
}
}
示例6: 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');
}
示例7: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitDatabase' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
foreach ($this->_fieldsDatabase as $field => $values) {
if (isset($values['required']) and $values['required']) {
if (($value = Tools::getValue($field)) == false and (string) $value != '0') {
$this->_errors[] = Tools::displayError('field') . ' <b>' . $values['title'] . '</b> ' . Tools::displayError('is required');
}
}
}
if (!sizeof($this->_errors)) {
/* Datas are not saved in database but in config/settings.inc.php */
$settings = array();
foreach ($_POST as $k => $value) {
if ($value) {
$settings['_' . Tools::strtoupper($k) . '_'] = $value;
}
}
rewriteSettingsFile(NULL, NULL, $settings);
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
}
}
}
示例8: getItemDescriptionByKey
public static function getItemDescriptionByKey($itemKey)
{
$itemKey = Tools::strtoupper($itemKey);
if (isset(self::$availableItemKeysList[$itemKey])) {
return self::$availableItemKeysList[$itemKey];
} else {
return false;
}
}
示例9: getDocumentByType
public static function getDocumentByType($documentType)
{
$documentType = Tools::strtoupper($documentType);
if (isset(self::$availableDocumentList[$documentType])) {
return self::$availableDocumentList[$documentType];
} else {
return false;
}
}
示例10: setCurrencyIso
protected function setCurrencyIso()
{
$this->currency_iso = Tools::strtoupper(Db::getInstance()->getValue('
SELECT
`iso_code`
FROM
`' . _DB_PREFIX_ . 'currency`
WHERE
`id_currency` = ' . (int) $this->id_currency));
}
示例11: request
/**
* Make a request to the Syspay API
* @param Syspay_Merchant_Request $request The request to send to the API
* @return mixed The response to the request
* @throws Syspay_Merchant_RequestException If the request could not be processed by the API
*/
public function request(Syspay_Merchant_Request $request)
{
$this->body = $this->headers = $this->data = null;
$headers = array('Accept: application/json', 'X-Wsse: ' . $this->generateAuthHeader($this->username, $this->secret));
$url = rtrim($this->baseUrl, '/') . '/' . ltrim($request->getPath(), '/');
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
// TODO: verify ssl and provide certificate in package
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$method = Tools::strtoupper($request->getMethod());
// Per-method special handling
switch ($method) {
case 'PUT':
case 'POST':
$body = Tools::jsonEncode($request->getData());
array_push($headers, 'Content-Type: application/json');
array_push($headers, 'Content-Length: ' . Tools::strlen($body));
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
break;
case 'GET':
$queryParams = $request->getData();
if (is_array($queryParams)) {
$url .= '?' . http_build_query($queryParams);
}
break;
case 'DELETE':
break;
default:
throw new Exception('Unsupported method given: ' . $method);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch), curl_errno($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
list($headers, $body) = explode("\r\n\r\n", $response, 2);
$this->headers = $headers;
$this->body = $body;
if (!in_array($httpCode, array(200, 201))) {
throw new Syspay_Merchant_RequestException($httpCode, $headers, $body);
}
$decoded = Tools::jsonDecode($body);
if ($decoded instanceof stdClass && isset($decoded->data) && $decoded->data instanceof stdClass) {
$this->data = $decoded->data;
return $request->buildResponse($decoded->data);
} else {
throw new Syspay_Merchant_UnexpectedResponseException('Unable to decode response from json', $body);
}
return false;
}
示例12: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitDatabase' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
foreach ($this->_fieldsDatabase as $field => $values) {
if (isset($values['required']) and $values['required']) {
if (($value = Tools::getValue($field)) == false and (string) $value != '0') {
$this->_errors[] = Tools::displayError('field') . ' <b>' . $values['title'] . '</b> ' . Tools::displayError('is required.');
}
}
}
if (!sizeof($this->_errors)) {
/* Datas are not saved in database but in config/settings.inc.php */
$settings = array();
foreach ($_POST as $k => $value) {
if ($value) {
$settings['_' . Tools::strtoupper($k) . '_'] = $value;
}
}
rewriteSettingsFile(NULL, NULL, $settings);
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if (Tools::isSubmit('submitEngine')) {
if (!isset($_POST['tablesBox']) or !sizeof($_POST['tablesBox'])) {
$this->_errors[] = Tools::displayError('You did not select any tables');
} else {
$available_engines = $this->_getEngines();
$tables_status = $this->_getTablesStatus();
$tables_engine = array();
foreach ($tables_status as $table) {
$tables_engine[$table['Name']] = $table['Engine'];
}
$engineType = pSQL(Tools::getValue('engineType'));
/* Datas are not saved in database but in config/settings.inc.php */
$settings = array('_MYSQL_ENGINE_' => $engineType);
rewriteSettingsFile(NULL, NULL, $settings);
foreach ($_POST['tablesBox'] as $table) {
if ($engineType == $tables_engine[$table]) {
$this->_errors[] = $table . ' ' . $this->l('is already in') . ' ' . $engineType;
} else {
if (!Db::getInstance()->Execute('ALTER TABLE `' . bqSQL($table) . '` ENGINE=`' . bqSQL($engineType) . '`')) {
$this->_errors[] = $this->l('Can\'t change engine for') . ' ' . $table;
} else {
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Engine change of') . ' ' . $table . ' ' . $this->l('to') . ' ' . $engineType . '</div>';
}
}
}
}
}
}
示例13: addCurrency
public function addCurrency($id, $rate = 'CBRF', $plus = 0)
{
$rate = Tools::strtoupper($rate);
$plus = str_replace(',', '.', $plus);
if ($rate == 'CBRF' && $plus > 0) {
$this->currencies[] = array('id' => $this->prepareField(Tools::strtoupper($id)), 'rate' => 'CBRF', 'plus' => (double) $plus);
} else {
$rate = str_replace(',', '.', $rate);
$this->currencies[] = array('id' => $this->prepareField(Tools::strtoupper($id)), 'rate' => (double) $rate);
}
return true;
}
示例14: renderForm
public function renderForm($data)
{
$helper = $this->getFormHelper();
$fields = array();
foreach (self::$networks as $network) {
$fields[] = array('type' => 'switch', 'label' => $network, 'name' => 'PS_SC_' . Tools::strtoupper($network), 'values' => array(array('id' => Tools::strtolower($network) . '_active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => Tools::strtolower($network) . '_active_off', 'value' => 0, 'label' => $this->l('Disabled'))));
}
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Separator Form.')), 'input' => $fields, 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
$default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
return $helper->generateForm($this->fields_form);
}
示例15: ajaxProcessInfoQuery
public function ajaxProcessInfoQuery()
{
$this->content_only = true;
$result = array('status' => false);
if (time() > (int) Configuration::get('PP_INFO_CHECK_TIME')) {
$protocol = Tools::getCurrentUrlProtocolPrefix();
$iso_lang = Context::getContext()->language->iso_code;
$iso_country = Context::getContext()->country->iso_code;
$stream_context = @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 3)));
$old_content = $this->getInfo();
$msg = $old_content === false ? 0 : $old_content[0];
$shop_url = ShopUrl::getShopUrls($this->context->shop->id)->where('main', '=', 1)->getFirst();
$shop = $shop_url ? $shop_url->getURL() : Tools::getShopDomain();
$date = Db::getInstance()->getValue('SELECT `date_add` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PSM_ID_' . Tools::strtoupper($this->module->name) . '\'');
$psm_date = $date ? urlencode(date('Y-m-d H:i:s', strtotime($date))) : '';
$plugins_string = '';
$plugins = $this->module->plugins();
foreach ($plugins as $name => $api_version) {
if (Module::isInstalled($name)) {
$plugins_string .= '&' . $name . '=' . $this->moduleVersion($name);
}
}
$url = $protocol . 'store.psandmore.com/query/?key=' . $this->module->name . '&ver=' . $this->module->version . '&psm=' . PSM::getPSMId($this->module) . '&psm_date=' . $psm_date . $plugins_string . '&msg=' . $msg . '&iso_country=' . $iso_country . '&iso_lang=' . $iso_lang . '&shop=' . urlencode($shop);
$contents = Tools::file_get_contents($url, false, $stream_context);
$check_info_offset = 3600;
if ($contents !== false) {
$content = explode('|', $contents);
if (is_numeric($content[0])) {
if (!$this->infoIgnore(false, $content[0])) {
if (Validate::isCleanHtml($content[1])) {
$this->putInfo($contents);
$check_info_offset = 86400;
}
}
} else {
if ($content[0] == 'hide') {
Configuration::deleteByName('PP_INFO_CONTENT');
}
}
}
Configuration::updateValue('PP_INFO_CHECK_TIME', time() + $check_info_offset);
}
$content = $this->getInfo();
if ($content !== false) {
if (!$this->infoIgnore($content)) {
if (Validate::isCleanHtml($content[1])) {
$result['status'] = 'success';
$result['content'] = $content[1];
}
}
}
$this->content = Tools::jsonEncode($result);
}