本文整理汇总了PHP中strtoupper函数的典型用法代码示例。如果您正苦于以下问题:PHP strtoupper函数的具体用法?PHP strtoupper怎么用?PHP strtoupper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strtoupper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRandomBytes
private function getRandomBytes($count)
{
$bytes = '';
if (function_exists('openssl_random_pseudo_bytes') && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
// OpenSSL slow on Win
$bytes = openssl_random_pseudo_bytes($count);
}
if ($bytes === '' && @is_readable('/dev/urandom') && ($hRand = @fopen('/dev/urandom', 'rb')) !== FALSE) {
$bytes = fread($hRand, $count);
fclose($hRand);
}
if (strlen($bytes) < $count) {
$bytes = '';
if ($this->randomState === null) {
$this->randomState = microtime();
if (function_exists('getmypid')) {
$this->randomState .= getmypid();
}
}
for ($i = 0; $i < $count; $i += 16) {
$this->randomState = md5(microtime() . $this->randomState);
if (PHP_VERSION >= '5') {
$bytes .= md5($this->randomState, true);
} else {
$bytes .= pack('H*', md5($this->randomState));
}
}
$bytes = substr($bytes, 0, $count);
}
return $bytes;
}
示例2: writeInfo
/**
* Render the information header for the view
*
* @param string $title
* @param string $title
*/
public function writeInfo($title, $subtitle, $description = false)
{
echo wordwrap(strtoupper($title), 100) . "\n";
echo wordwrap($subtitle, 100) . "\n";
echo str_repeat('-', min(100, max(strlen($title), strlen($subtitle)))) . "\n";
echo wordwrap($description, 100) . "\n\n";
}
示例3: getMethod
public function getMethod($address, $total)
{
$this->load->language('payment/alipay_direct');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('pp_standard_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
if ($this->config->get('alipay_direct_total') > $total) {
$status = false;
} elseif (!$this->config->get('alipay_direct_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
//判断是否移动设备访问
$this->load->helper('mobile');
if (is_mobile()) {
$status = false;
}
$currencies = array('CNY');
if (!in_array(strtoupper($this->currency->getCode()), $currencies)) {
$status = false;
}
$method_data = array();
if ($status) {
$method_data = array('code' => 'alipay_direct', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('alipay_direct_sort_order'));
}
return $method_data;
}
示例4: smarty_block_form
function smarty_block_form($params, $content, &$smarty, $repeat)
{
if (!empty($content)) {
// set default output vars
$data = array('search_id' => FALSE, 'submit_token_id' => FALSE, 'class' => '', 'content' => $content, 'method' => 'post');
$modules = $smarty->getTemplateVars('modules');
if (!empty($modules)) {
$module = '';
$prefix = 'module=';
foreach ($modules as $mod) {
$module .= $prefix . $mod . '&';
$prefix = 'sub' . $prefix;
}
}
if (isset($params['target'])) {
$data['action'] = $params['target'];
} else {
$access = AccessObject::Instance();
$pid = $access->getPermission($modules, $params['controller'], $params['action']);
$data['action'] = '/?pid=' . $pid . '&' . $module . 'controller=' . $params['controller'] . '&action=' . $params['action'];
}
if (isset($params['subfunction'])) {
$data['action'] .= '&subfunction=' . $params['subfunction'];
if (isset($params['subfunctionaction'])) {
$data['action'] .= '&subfunctionaction=' . $params['subfunctionaction'];
}
}
if (isset($params['id'])) {
$data['action'] .= '&id=' . $params['id'];
}
foreach ($params as $name => $value) {
if ($name[0] === '_') {
$data['action'] .= '&' . substr($name, 1) . '=' . $value;
}
}
if (isset($params['additional_data'])) {
foreach ($params['additional_data'] as $name => $value) {
$data['action'] .= '&' . $name . '=' . $value;
}
}
if (isset($params['class'])) {
$data['class'] = $params['class'];
}
$data['original_action'] = $smarty->getTemplateVars('action');
if (isset($_GET['search_id'])) {
$data['search_id'] = $_GET['search_id'];
}
// there are some instances where we don't want the submit token
if (strtoupper($params['submit_token']) !== 'FALSE') {
$data['submit_token_id'] = uniqid();
$_SESSION['submit_token'][$data['submit_token_id']] = TRUE;
}
$data['display_tags'] = !isset($params['notags']);
if (isset($params['form_id'])) {
$data['form_id'] = $params['form_id'];
}
// fetch smarty plugin template
return smarty_plugin_template($smarty, $data, 'block.form');
}
}
示例5: get_group_names
function get_group_names()
{
if (!isset($GLOBALS['TT2_GNAMES'])) {
$sql = "SELECT `groups` FROM `user` WHERE `is_closed` = 0 ";
$groupstring = '|';
if ($data = get_data($sql)) {
foreach ($data as $item) {
if (strlen(trim($item['groups'])) > 1) {
$groupstring = $groupstring . strtoupper($item['groups']) . '|';
}
}
}
if ($groupstring == '|') {
$groups = null;
} else {
$groups = explode('|', trim($groupstring, '|'));
}
$groups = array_unique($groups);
foreach ($groups as $k => $v) {
if (strlen(trim($v)) < 1) {
unset($groups[$k]);
}
}
$GLOBALS['TT2_GNAMES'] = $groups;
}
return $GLOBALS['TT2_GNAMES'];
}
示例6: execute
public function execute(CommandSender $sender, array $args)
{
if (count($args) !== 1) {
return false;
}
$player = $sender->getServer()->getPlayer($sender->getName());
$biome = strtoupper($args[0]);
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . "You are not standing on an island");
return true;
}
if ($plot->owner !== $sender->getName()) {
$sender->sendMessage(TextFormat::RED . "You are not the owner of this island");
return true;
}
if (!isset($this->biomes[$biome])) {
$sender->sendMessage(TextFormat::RED . "That biome doesn't exist");
$biomes = implode(", ", array_keys($this->biomes));
$sender->sendMessage(TextFormat::RED . "The possible biomes are: {$biomes}");
return true;
}
$biome = Biome::getBiome($this->biomes[$biome]);
if ($this->getPlugin()->setPlotBiome($plot, $biome)) {
$sender->sendMessage(TextFormat::GREEN . "Changed the island biome");
} else {
$sender->sendMessage(TextFormat::RED . "Could not change the island biome");
}
return true;
}
示例7: MetaType
function MetaType($t, $len = -1)
{
if (is_object($t)) {
$fieldobj = $t;
$t = $fieldobj->type;
$len = $fieldobj->max_length;
}
switch (strtoupper($t)) {
case 'C':
if ($len <= $this->blobSize) {
return 'C';
}
case 'M':
return 'X';
case 'D':
return 'D';
case 'T':
return 'T';
case 'L':
return 'L';
case 'I':
return 'I';
default:
return 'N';
}
}
示例8: calculate
private function calculate($complexity, $bgst)
{
//THE FORMULA STEP BY STEP CALCULATION
//1) Material Expense
//already submitted when declaring object
//2) Indirect Material Expense
$this->indirect_material_expense = $bgst['cogs_matexp_indirect'] / 100 * $this->material_expense;
//3) Cost based on Products Complexity
if (strlen($complexity) > 1) {
$complexity = substr($complexity, 0, 1);
}
$complexity = strtoupper($complexity);
$this->cost_based_on_complexity = $bgst['cogs_complexity_' . $complexity];
//4) Variable Cost
$this->cost_variable = $bgst['cogs_variable'];
//5) Fixed Cost
$this->cost_fixed = $bgst['cogs_fixed'];
//Sum Point 1-5
$sum_1to5 = $this->material_expense + $this->indirect_material_expense + $this->cost_based_on_complexity + $this->cost_variable + $this->cost_fixed;
//6) Handling Cost
$this->cost_handling = $bgst['cogs_handling'] / 100 * $sum_1to5;
//FINALLY, COGS
$cogs = $sum_1to5 + $this->cost_handling;
$this->value = round($cogs, 2);
//Purchase Price from cogs
$this->purchase_price = $this->value * $bgst['cogs_purchase_price_multiplier'];
}
示例9: __construct
public function __construct()
{
global $cookie;
$lang = strtoupper(Language::getIsoById($cookie->id_lang));
$this->className = 'Configuration';
$this->table = 'configuration';
/* Collect all font files and build array for combo box */
$fontFiles = scandir(_PS_FPDF_PATH_ . 'font');
$fontList = array();
$arr = array();
foreach ($fontFiles as $file) {
if (substr($file, -4) == '.php' and $file != 'index.php') {
$arr['mode'] = substr($file, 0, -4);
$arr['name'] = substr($file, 0, -4);
array_push($fontList, $arr);
}
}
/* Collect all encoding map files and build array for combo box */
$encodingFiles = scandir(_PS_FPDF_PATH_ . 'font/makefont');
$encodingList = array();
$arr = array();
foreach ($encodingFiles as $file) {
if (substr($file, -4) == '.map') {
$arr['mode'] = substr($file, 0, -4);
$arr['name'] = substr($file, 0, -4);
array_push($encodingList, $arr);
}
}
$this->_fieldsPDF = array('PS_PDF_ENCODING_' . $lang => array('title' => $this->l('Encoding:'), 'desc' => $this->l('Encoding for PDF invoice'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => $encodingList), 'PS_PDF_FONT_' . $lang => array('title' => $this->l('Font:'), 'desc' => $this->l('Font for PDF invoice'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => $fontList));
parent::__construct();
}
示例10: __construct
/**
* Constructor.
*
* @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
*/
public function __construct($classLoader)
{
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
if ($this->wasFinder) {
@trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
$this->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true;
} else {
$this->classLoader = $classLoader;
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
}
if (!isset(self::$caseCheck)) {
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
$i = strrpos($file, DIRECTORY_SEPARATOR);
$dir = substr($file, 0, 1 + $i);
$file = substr($file, 1 + $i);
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
$test = realpath($dir . $test);
if (false === $test || false === $i) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif (substr($test, -strlen($file)) === $file) {
// filesystem is case insensitive and realpath() normalizes the case of characters
self::$caseCheck = 1;
} elseif (false !== stripos(PHP_OS, 'darwin')) {
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
self::$caseCheck = 2;
} else {
// filesystem case checks failed, fallback to disabling them
self::$caseCheck = 0;
}
}
}
示例11: IsSupported
/**
* @param string $sIncCapa
* @param bool $bForce = false
* @return bool
*/
public function IsSupported($sIncCapa, $bForce = false)
{
if (null === $this->aCapa || $bForce) {
$sTag = $this->getNextTag();
if ($this->WriteLine($sTag . ' CAPABILITY')) {
$sResponse = $this->GetResponse($sTag);
if ($this->CheckResponse($sTag, $sResponse)) {
$this->aCapa = array();
$aCapasLineArray = explode("\n", $sResponse);
foreach ($aCapasLineArray as $sCapasLine) {
$sCapa = strtoupper(trim($sCapasLine));
if (substr($sCapa, 0, 12) === '* CAPABILITY') {
$sCapa = substr($sCapa, 12);
$aArray = explode(' ', $sCapa);
foreach ($aArray as $sSubLine) {
if (strlen($sSubLine) > 0) {
$this->aCapa[] = $sSubLine;
}
}
}
}
}
}
}
return is_array($this->aCapa) && in_array($sIncCapa, $this->aCapa);
}
示例12: name_case
function name_case($name)
{
$newname = strtoupper($name[0]);
for ($i = 1; $i < strlen($name); $i++) {
$subed = substr($name, $i, 1);
if (ord($subed) > 64 && ord($subed) < 123 || ord($subed) > 48 && ord($subed) < 58) {
$word_check = substr($name, $i - 2, 2);
if (!strcasecmp($word_check, 'Mc') || !strcasecmp($word_check, "O'")) {
$newname .= strtoupper($subed);
} else {
if ($break) {
$newname .= strtoupper($subed);
} else {
$newname .= strtolower($subed);
}
}
$break = 0;
} else {
// not a letter - a boundary
$newname .= $subed;
$break = 1;
}
}
return $newname;
}
示例13: testAutomaticCapitalCasing
/**
* @param $test
* @param $expected
*
* @dataProvider providerPlurals
*/
public function testAutomaticCapitalCasing($test, $expected)
{
$test = strtoupper($test);
$expected = strtoupper($expected);
$pluralize = new Pluralize();
$this->assertEquals($expected, $pluralize->fix($test));
}
示例14: checkSign
public function checkSign($callbackParams)
{
$string = $callbackParams['action'] . ';' . $callbackParams['orderSumAmount'] . ';' . $callbackParams['orderSumCurrencyPaycash'] . ';' . $callbackParams['orderSumBankPaycash'] . ';' . $callbackParams['shopId'] . ';' . $callbackParams['invoiceId'] . ';' . $callbackParams['customerNumber'] . ';' . $this->password;
$md5 = strtoupper(md5($string));
$this->log_save('kassa: sign ' . ($callbackParams['md5'] == $md5) . ' ' . $callbackParams['md5'] . ' ' . $md5);
return $callbackParams['md5'] == $md5;
}
示例15: actionRedeem
public function actionRedeem()
{
$cart = $this->getCart();
$promocode = strtoupper(Yii::app()->request->getPost("coupon", null));
if (!$promocode || $promocode === "") {
throw new CHttpException(400, 'The request is invalid.');
}
$coupon_array = array();
if ($promocode === "FALL14") {
Yii::app()->session['applicable_rebate'] = 0.15;
Yii::app()->session['promocode'] = "FALL14";
// Apply the coupon to items already in the cart
$itemsInCart = OrderHasProduct::model()->findAll("order_id=:order_id", array(":order_id" => $cart->id));
foreach ($itemsInCart as $relationship) {
$relationship->price_paid = $relationship->product->getCurrentPrice();
$relationship->save();
}
// Build a json array that could be used by our
$coupon_array["valid"] = true;
$coupon_array["code"] = Yii::app()->session['promocode'];
$coupon_array["expired"] = false;
$coupon_array["type"] = "percent";
$coupon_array["details"] = array("rebate" => Yii::app()->session['applicable_rebate'] * 100);
} else {
$coupon_array["valid"] = false;
}
$this->renderJSON($coupon_array);
}