本文整理汇总了PHP中String::upper方法的典型用法代码示例。如果您正苦于以下问题:PHP String::upper方法的具体用法?PHP String::upper怎么用?PHP String::upper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::upper方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detectCase
protected function detectCase($msg)
{
if ($msg == String::lower($msg)) {
return 'lower';
}
if ($msg == String::upper($msg)) {
return 'upper';
}
if ($msg == String::capitalize($msg)) {
return 'capitalize';
}
return 'default';
}
示例2: elseif
$help_file = $fileroot . "/admin/locale/{$language}/help.xml";
$help_file_fallback = $fileroot . '/admin/locale/en_US/help.xml';
} else {
$fileroot = $registry->getParam('fileroot', $module);
$help_file = $fileroot . "/locale/{$language}/help.xml";
$help_file_fallback = $fileroot . '/locale/en_US/help.xml';
}
if ($show == 'index') {
require HORDE_TEMPLATES . '/help/index.inc';
} else {
require HORDE_TEMPLATES . '/common-header.inc';
if ($show == 'menu') {
require HORDE_TEMPLATES . '/help/menu.inc';
} elseif ($show == 'about') {
require $fileroot . '/lib/version.php';
eval('$version = "' . ucfirst($module) . ' " . ' . String::upper($module) . '_VERSION;');
$credits = Util::bufferOutput('include', $fileroot . '/docs/CREDITS');
$credits = String::convertCharset($credits, 'iso-8859-1', NLS::getCharset());
require HORDE_TEMPLATES . '/help/about.inc';
} else {
require HORDE_TEMPLATES . '/help/header.inc';
$help = new Help(HELP_SOURCE_FILE, array($help_file, $help_file_fallback));
if ($show == 'entry' && !empty($topic)) {
$help->lookup($topic);
$help->display();
} else {
$topics = $help->topics();
foreach ($topics as $id => $title) {
$link = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/');
$link = Util::addParameter($link, array('show' => 'entry', 'module' => $module, 'topic' => $id));
echo Horde::link($link, '', 'helpitem');
示例3: setAttribute
/**
* Set the value of an attribute.
*
* @param string $name
* The name of the attribute.
* @param string $value
* The value of the attribute.
* @param array $params
* Array containing any addition parameters for
* this attribute.
* @param boolean $append
* True to append the attribute, False to replace
* the first matching attribute found.
* @param array $values
* Array representation of $value. For
* comma/semicolon seperated lists of values. If
* not set use $value as single array element.
*/
function setAttribute($name, $value, $params = array(), $append = true, $values = false)
{
// Make sure we update the internal format version if
// setAttribute('VERSION', ...) is called.
if ($name == 'VERSION') {
$this->_version = $value;
if ($this->_container !== false) {
$this->_container->_version = $value;
}
}
if (!$values) {
$values = array($value);
}
$found = false;
if (!$append) {
$keys = array_keys($this->_attributes);
foreach ($keys as $key) {
if ($this->_attributes[$key]['name'] == String::upper($name)) {
$this->_attributes[$key]['params'] = $params;
$this->_attributes[$key]['value'] = $value;
$this->_attributes[$key]['values'] = $values;
$found = true;
break;
}
}
}
if ($append || !$found) {
$this->_attributes[] = array('name' => strtoupper($name), 'params' => $params, 'value' => $value, 'values' => $values);
}
}
示例4: sort
/**
* Sort the array on its keys
*
* @param Array $array The haystack
* @param string $way ASC or DESC
*
* @return Array the result array
*/
public static function sort($array, $way = 'ASC')
{
$way = String::upper($way);
asort($array);
if ($way == 'DESC') {
$array = static::reverse($array);
}
return $array;
}
示例5: _content
/**
* The content to go in this block.
*
* @return string The content
*/
function _content()
{
if (!@(include_once 'Services/Weather.php')) {
Horde::logMessage('The metar block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', __FILE__, __LINE__, PEAR_LOG_ERR);
return _("Metar block not available. Details have been logged for the administrator.");
}
global $conf;
static $metarLocs;
if (!isset($conf['sql'])) {
return _("A database backend is required for this block.");
}
if (empty($this->_params['location'])) {
return _("No location is set.");
}
if (!is_array($metarLocs)) {
$metarLocs = $this->getParams();
}
require_once 'Services/Weather.php';
$metar =& Services_Weather::service('METAR', array('debug' => 0));
$dbString = $conf['sql']['phptype'] . '://';
$dbString .= $conf['sql']['username'] . ':';
$dbString .= $conf['sql']['password'] . '@';
$dbString .= $conf['sql']['hostspec'] . '/';
$dbString .= $conf['sql']['database'];
$metar->setMetarDB($dbString);
$metar->setUnitsFormat($this->_params['units']);
$metar->setDateTimeFormat('M j, Y', 'H:i');
$metar->setMetarSource('http');
$units = $metar->getUnits(0, $this->_params['units']);
$weather = $metar->getWeather($this->_params['location']);
$html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">' . '<tr><td class="control"><b>' . sprintf('%s, %s (%s)', $metarLocs['location']['values'][$this->_params['__location']][$this->_params['location']], $this->_params['__location'], $this->_params['location']) . '</td></tr></table><b>' . _("Last Updated:") . '</b> ' . $weather['update'] . '<br /><br />';
// Wind.
if (isset($weather['wind'])) {
$html .= '<b>' . _("Wind:") . '</b> ';
if ($weather['windDirection'] == 'Variable') {
if (!empty($this->_params['knots'])) {
$html .= sprintf(_('%s at %s %s'), $weather['windDirection'], round($metar->convertSpeed($weather['wind'], $units['wind'], 'kt')), 'kt');
} else {
$html .= sprintf(_('%s at %s %s'), $weather['windDirection'], round($weather['wind']), $units['wind']);
}
} elseif ($weather['windDegrees'] == '000' && $weather['wind'] == '0') {
$html .= sprintf(_("calm"));
} else {
$html .= sprintf(_("from the %s (%s) at %s %s"), $weather['windDirection'], $weather['windDegrees'], empty($this->_params['knots']) ? round($weather['wind']) : round($metar->convertSpeed($weather['wind'], $units['wind'], 'kt')), empty($this->_params['knots']) ? $units['wind'] : 'kt');
}
}
if (isset($weather['windGust'])) {
if ($weather['windGust']) {
if (!empty($this->_params['knots'])) {
$html .= sprintf(_(", gusting %s %s"), round($metar->convertSpeed($weather['windGust'], $units['wind'], 'kt')), 'kt');
} else {
$html .= sprintf(_(", gusting %s %s"), round($weather['windGust']), $units['wind']);
}
}
}
if (isset($weather['windVariability'])) {
if ($weather['windVariability']['from']) {
$html .= sprintf(_(", variable from %s to %s"), $weather['windVariability']['from'], $weather['windVariability']['to']);
}
}
// Visibility.
if (isset($weather['visibility'])) {
$html .= $this->_row(_("Visibility"), $weather['visibility'] . ' ' . $units['vis']);
}
// Temperature/DewPoint.
if (isset($weather['temperature'])) {
$html .= $this->_row(_("Temperature"), round($weather['temperature']) . '°' . String::upper($units['temp']));
}
if (isset($weather['dewPoint'])) {
$html .= $this->_row(_("Dew Point"), round($weather['dewPoint']) . '°' . String::upper($units['temp']));
}
if (isset($weather['feltTemperature'])) {
$html .= $this->_row(_("Feels Like"), round($weather['feltTemperature']) . '°' . String::upper($units['temp']));
}
// Pressure.
if (isset($weather['pressure'])) {
$html .= $this->_row(_("Pressure"), $weather['pressure'] . ' ' . $units['pres']);
}
// Humidity.
if (isset($weather['humidity'])) {
$html .= $this->_row(_("Humidity"), round($weather['humidity']) . '%');
}
// Clouds.
if (isset($weather['clouds'])) {
$clouds = '';
foreach ($weather['clouds'] as $cloud) {
$clouds .= '<br />';
if (isset($cloud['height'])) {
$clouds .= sprintf(_("%s at %s ft"), $cloud['amount'], $cloud['height']);
} else {
$clouds .= $cloud['amount'];
}
}
$html .= $this->_row(_("Clouds"), $clouds);
}
//.........这里部分代码省略.........
示例6: __toString
public function __toString()
{
$label = $this->getText('title', $this->filename);
if (($pos = strrpos($this->filename, '.')) && $pos !== false) {
$label = substr($label, 0, $pos) . ' (' . String::upper(substr($this->filename, $pos + 1)) . ')';
}
return $label;
}
示例7: init
function init()
{
global $cmd_options, $apps, $dirs, $debug, $test, $c, $silence;
foreach ($cmd_options[0] as $option) {
switch ($option[0]) {
case 'h':
usage();
footer();
case 'l':
case '--locale':
$lang = $option[1];
break;
case 'm':
case '--module':
$module = $option[1];
break;
}
}
if (empty($lang)) {
$lang = getenv('LANG');
}
for ($i = 0; $i < count($dirs); $i++) {
if (!empty($module) && $module != $apps[$i]) {
continue;
}
$package = ucfirst($apps[$i]);
$package_u = String::upper($apps[$i]);
@(include $dirs[$i] . '/lib/version.php');
$version = eval('return(defined("' . $package_u . '_VERSION") ? ' . $package_u . '_VERSION : "???");');
echo sprintf(_("Initializing module %s... "), $apps[$i]);
if (!@file_exists($dirs[$i] . '/po/' . $apps[$i] . '.pot')) {
$c->writeln($c->red(_("failed")));
$c->writeln(sprintf(_("%s not found. Run 'translation extract' first."), $dirs[$i] . DS . 'po' . DS . $apps[$i] . '.pot'));
continue;
}
$dir = $dirs[$i] . DS . 'po' . DS;
$sh = $GLOBALS['msginit'] . ' --no-translator -i ' . $dir . $apps[$i] . '.pot ' . (!empty($lang) ? ' -o ' . $dir . $lang . '.po --locale=' . $lang : '') . ($debug ? '' : $silence);
if (!empty($lang) && !OS_WINDOWS) {
$pofile = $dirs[$i] . '/po/' . $lang . '.po';
$sh .= "; sed 's/PACKAGE package/{$package} package/' {$pofile} " . "| sed 's/PACKAGE VERSION/{$package} {$version}/' " . "| sed 's/messages for PACKAGE/messages for {$package}/' " . "| sed 's/Language-Team: none/Language-Team: i18n@lists.horde.org/' " . "> {$pofile}.tmp";
}
if ($debug || $test) {
$c->writeln(_("Executing:"));
$c->writeln($sh);
}
if ($test) {
$ret = 0;
} else {
exec($sh, $out, $ret);
}
rename($pofile . '.tmp', $pofile);
if ($ret == 0) {
$c->writeln($c->green(_("done")));
} else {
$c->writeln($c->red(_("failed")));
}
}
}
示例8: _content
/**
* The content to go in this block.
*
* @return string The content
*/
function _content()
{
if (!@(include_once 'Services/Weather.php')) {
Horde::logMessage('The weather.com block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', __FILE__, __LINE__, PEAR_LOG_ERR);
return _("The weather.com block is not available.");
}
global $conf;
$cacheDir = Horde::getTempDir();
$html = '';
if (empty($this->_params['location'])) {
return _("No location is set.");
}
$weatherDotCom =& Services_Weather::service("WeatherDotCom");
$weatherDotCom->setAccountData(isset($conf['weatherdotcom']['partner_id']) ? $conf['weatherdotcom']['partner_id'] : '', isset($conf['weatherdotcom']['license_key']) ? $conf['weatherdotcom']['license_key'] : '');
if (!$cacheDir) {
return PEAR::raiseError(_("No temporary directory available for cache."), 'horde.error');
} else {
$weatherDotCom->setCache("file", array("cache_dir" => $cacheDir . '/'));
}
$weatherDotCom->setDateTimeFormat("m.d.Y", "H:i");
$weatherDotCom->setUnitsFormat($this->_params['units']);
$units = $weatherDotCom->getUnitsFormat();
// If the user entered a zip code for the location, no need to
// search (weather.com accepts zip codes as location IDs).
// The location ID should already have been validated in
// getParams.
$search = preg_match('/\\b(?:\\d{5}(-\\d{5})?)|(?:[A-Z]{4}\\d{4})\\b/', $this->_params['location'], $matches) ? $matches[0] : $weatherDotCom->searchLocation($this->_params['location']);
if (is_a($search, 'PEAR_Error')) {
return $search->getmessage();
}
if (is_array($search)) {
// Several locations returned due to imprecise location parameter
$html = _("Several locations possible with the parameter: ");
$html .= $this->_params['location'];
$html .= "<br/><ul>";
foreach ($search as $id_weather => $real_location) {
$html .= "<li>{$real_location} ({$id_weather})</li>\n";
}
$html .= "</ul>";
return $html;
}
$location = $weatherDotCom->getLocation($search);
if (is_a($location, 'PEAR_Error')) {
return $location->getmessage();
}
$weather = $weatherDotCom->getWeather($search);
if (is_a($weather, 'PEAR_Error')) {
return $weather->getmessage();
}
$forecast = $weatherDotCom->getForecast($search, $this->_params['days']);
if (is_a($forecast, 'PEAR_Error')) {
return $forecast->getmessage();
}
// Location and local time.
$html .= "<table width=100%><tr><td class=control>";
$html .= '<b>' . $location['name'] . '</b>' . ' local time ' . $location['time'];
$html .= "</b></td></tr></table>";
// Sunrise/sunset.
$html .= '<b>' . _("Sunrise: ") . '</b>' . Horde::img('block/sunrise/sunrise.gif', _("Sunrise")) . $location['sunrise'];
$html .= ' <b>' . _("Sunset: ") . '</b>' . Horde::img('block/sunrise/sunset.gif', _("Sunset")) . $location['sunset'];
// Temperature.
$html .= '<br /><b>' . _("Temperature: ") . '</b>';
$html .= $weather['temperature'] . '°' . String::upper($units['temp']);
// Dew point.
$html .= ' <b>' . _("Dew point: ") . '</b>';
$html .= $weather['dewPoint'] . '°' . String::upper($units['temp']);
// Feels like temperature.
$html .= ' <b>' . _("Feels like: ") . '</b>';
$html .= $weather['feltTemperature'] . '°' . String::upper($units['temp']);
// Pressure and trend.
$html .= '<br /><b>' . _("Pressure: ") . '</b>';
$html .= number_format($weather['pressure'], 2) . ' ' . $units['pres'];
$html .= _(" and ") . $weather['pressureTrend'];
// Wind.
$html .= '<br /><b>' . _("Wind: ") . '</b>';
if ($weather['windDirection'] == 'VAR') {
$html .= _("Variable");
} elseif ($weather['windDirection'] == 'CALM') {
$html .= _("Calm");
} else {
$html .= _("From the ") . $weather['windDirection'];
$html .= ' (' . $weather['windDegrees'] . ')';
}
$html .= _(" at ") . $weather['wind'] . ' ' . $units['wind'];
// Humidity.
$html .= '<br /><b>' . _("Humidity: ") . '</b>';
$html .= $weather['humidity'] . '%';
// Visibility.
$html .= ' <b>' . _("Visibility: ") . '</b>';
$html .= $weather['visibility'] . (is_numeric($weather['visibility']) ? ' ' . $units['vis'] : '');
// UV index.
$html .= ' <b>' . _("U.V. index: ") . '</b>';
$html .= $weather['uvIndex'] . ' - ' . $weather['uvText'];
// Current condition.
$html .= '<br /><b>' . _("Current condition: ") . '</b>' . Horde::img('block/weatherdotcom/32x32/' . $weather['conditionIcon'] . '.png', _(String::lower($weather['condition'])), 'align="middle"');
//.........这里部分代码省略.........
示例9: coalesce
<?php
if (empty($MediaFile)) {
return false;
}
?>
<div class="thumb">
<?php
if ($MediaFile->file()) {
if ($MediaFile instanceof MediaImage) {
$icon = $HTML->image($MediaFile->src(coalesce(@$width, 160), coalesce(@$height, 120), coalesce(@$method, 'resize')));
} else {
$extension = $MediaFile->file()->extension();
$icon = $HTML->tag('span', String::upper($extension), array('class' => array($extension, 'filetype')));
}
} else {
$icon = $HTML->tag('span', __('?'), array('class' => 'filetype'));
}
if (!isset($link)) {
$link = $MediaFile->adminDetailPageUri(array('action' => 'edit'));
}
if (!empty($link)) {
echo $HTML->link($link, $icon);
} else {
echo $icon;
}
?>
</div>