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


PHP String::lower方法代码示例

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


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

示例1: translate

 public function translate($message, $count = NULL)
 {
     $case = $this->detectCase($message);
     $args = func_get_args();
     if (is_string($count)) {
         if (isset($args[2]) && is_numeric($args[2])) {
             $count = $args[2];
         }
     }
     $counter = $count;
     if (is_numeric($count)) {
         $counter = $this->inflexion($count);
     }
     $node = String::lower($message . $counter);
     if (isset($this->dict[$node])) {
         $message = $this->dict[$node];
     } else {
         $message = implode(' ', explode('_', $message));
     }
     if (count($args) > 1) {
         array_shift($args);
         $message = vsprintf($message, $args);
     }
     if ($case == 'default') {
         return $message;
     } elseif ($case == 'firstUpper') {
         return ucfirst($message);
     } else {
         return call_user_func(array('String', $case), $message);
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:31,代码来源:Translator.php

示例2: authenticate

 public function authenticate(array $credentials)
 {
     $email = $credentials['username'];
     $password = $credentials['password'];
     $role = String::lower($credentials['extra']);
     switch ($role) {
         case 'student':
             $student = new Student();
             $student->email = $email;
             $student->password = $password;
             $student = StudentRegistry::verifyStudent($student);
             $student->courses = StudentRegistry::getStudentCourses($student);
             foreach ($student->courses as $course) {
                 $student->allowed_courses[] = (int) $course->id;
             }
             $identity = new Identity($student->id, $role, $student);
             $identity->student = $student;
             break;
         case 'teacher':
             $teacher = new Teacher();
             $teacher->email = $email;
             $teacher->password = $password;
             $teacher = TeacherRegistry::verifyTeacher($teacher);
             $teacher->courses = TeacherRegistry::getTeacherCourses($teacher);
             $identity = new Identity($teacher->id, $role, $teacher);
             $identity->teacher = $teacher;
             break;
         case 'admin':
             $identity = new Identity('admin', $role);
             break;
     }
     return $identity;
     // vrátíme identitu
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:34,代码来源:Authenticator.php

示例3: gatherActions

 private function gatherActions()
 {
     $service = Environment::getService('Nette\\Loaders\\RobotLoader');
     $class_list = $service->list;
     $actions = array();
     foreach ($class_list as $class => $file) {
         //zachtime annotation exception lebo nette si generuje nejake annotation claasy do robotloodera
         try {
             $r = new ReflectionClass($class);
             if ($r->isSubclassOf('Admin_SecurePresenter') && $r->getName() != 'BaseModulePresenter') {
                 $methods = $r->getMethods(ReflectionMethod::IS_PUBLIC);
                 foreach ($methods as $method) {
                     if (String::lower($method->class) == $class) {
                         if (strpos($method->getName(), 'action') !== false || strpos($method->getName(), 'handle') !== false) {
                             $actions[$class][] = $method->getName();
                         }
                     }
                 }
             }
         } catch (ReflectionException $e) {
         }
     }
     $actions = array_merge($actions, Environment::getApplication()->getModulesPermissions());
     $model = new UsersModuleModel();
     $model->saveActions($actions);
     return $actions;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:27,代码来源:UsersUsersPresenter.php

示例4: save

 public function save($values)
 {
     $this->_prepare();
     $values['email'] = String::lower($values['name'] . '.' . $values['surname'] . '@st.fm.uniba.sk');
     if (!isset($values['id'])) {
         $values['password'] = String::lower($values['name'] . $values['surname']);
     }
     if (isset($values['id'])) {
         $id = $values['id'];
         unset($values['id']);
         db::update(':table:', $values)->where('id = %i', $id)->execute();
     } else {
         $sql = 'INSERT INTO [:table:]';
         $result = db::query($sql, $values);
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:16,代码来源:StudentsModel.php

示例5: checkAuthorization

 private function checkAuthorization()
 {
     $presenter = String::lower($this->getReflection()->getName());
     $user = Environment::getUser();
     $user->setAuthorizationHandler(MokujiServiceLocator::getService('UserAuthorizator'));
     //if(Environment::getServiceLocator()->hasService('UserAuthorizator')) $user->setAuthorizationHandler(Environment::getService('UserAuthorizator'));
     //else $user->setAuthorizationHandler(new Admin_UserModel());
     if ($this->formatActionMethod($this->action) == 'actiondeny') {
         return;
     }
     if ($user->isAllowed($presenter, $this->formatActionMethod($this->action)) === true) {
         if ($user->isAllowed($presenter, $this->formatSignalMethod($this->signal)) === false) {
             throw new AuthenticationException('This action is not allowed');
         }
     } else {
         throw new AuthenticationException('This action is not allowed');
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:18,代码来源:AdminSecurePresenter.php

示例6: __call

 public function __call($method_name, $args)
 {
     $method_name = '_' . $method_name;
     $tags = array('tags' => array('Models' . $this->getReflection()->getName()));
     if ($this->reflection->hasMethod($method_name)) {
         $method = $this->reflection->getMethod($method_name);
         if ($method->getAnnotation('cache') == 'update' || $method->getAnnotation('cache') == 'insert' || strpos(String::lower($method_name), 'update') > 0 || strpos(String::lower($method_name), 'insert') > 0 || strpos(String::lower($method_name), 'delete') > 0 || strpos(String::lower($method_name), 'edit') > 0 || strpos(String::lower($method_name), 'save') > 0 || strpos(String::lower($method_name), 'create') > 0) {
             fd('cache cleaned');
             if (!empty($args)) {
                 $method->invokeArgs($this, $args);
             } else {
                 $this->{$method_name}();
             }
             //WORKAROUND
             $cache_folder = Environment::getVariable('tempDir') . '/c-' . $this->cache->namespace;
             if (file_exists($cache_folder)) {
                 $files = glob($cache_folder . '/*');
                 if ($files != false) {
                     foreach ($files as $file) {
                         if (file_exists($file)) {
                             unlink($file);
                         }
                     }
                 }
             }
             //$this->cache->clean();
         } else {
             if (!empty($args)) {
                 $ckey = sha1($method_name . serialize($args));
                 if (!isset($this->cache[$ckey])) {
                     $this->cache->save($ckey, $method->invokeArgs($this, $args));
                 }
             } else {
                 $ckey = sha1($method_name);
                 if (!isset($this->cache[$ckey])) {
                     $this->cache->save($ckey, $this->{$method_name}());
                 }
             }
             return $this->cache[$ckey];
         }
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:42,代码来源:Model.php

示例7: isAllowed

 public function isAllowed($role = self::ALL, $resource = self::ALL, $privilege = self::ALL)
 {
     if ($privilege == 'actionDeny') {
         return true;
     }
     $data = Environment::getUser()->getIdentity()->permissions;
     if (isset($data[String::lower($resource)])) {
         if ($privilege == null) {
             return true;
         }
         foreach ($data[String::lower($resource)] as $user_privilege) {
             if (String::lower($privilege) == String::lower($user_privilege)) {
                 return true;
             }
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:20,代码来源:UsersModuleModel.php

示例8: dirname

<?php

/**
 * $Horde: horde/services/help/index.php,v 2.72 2004/02/14 01:36:27 chuck Exp $
 *
 * Copyright 1999-2004 Jon Parise <jon@horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 */
@define('HORDE_BASE', dirname(__FILE__) . '/../..');
require_once HORDE_BASE . '/lib/base.php';
require_once HORDE_LIBS . 'Horde/Help.php';
$title = _("Help");
$show = String::lower(Util::getFormData('show', 'index'));
$module = String::lower(basename(Util::getFormData('module', 'horde')));
$topic = Util::getFormData('topic');
if ($module == 'admin') {
    $fileroot = $registry->getParam('fileroot');
    $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') {
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:index.php

示例9: checkAction

 protected function checkAction()
 {
     if (($action = $this->Url['action']) === false) {
         $change = ($action = $this->defaultAction) !== null;
     }
     $tmp = array();
     foreach ($this->abstractClasses as $class) {
         $tmp = array_merge($tmp, get_class_methods($class));
     }
     $tmp = array_diff(get_class_methods($this), get_class_methods(__CLASS__), $tmp, $this->disabledActions);
     foreach ($tmp as $method) {
         $methods[String::lower($method)] = $method;
     }
     if (isset($methods[String::lower($action)])) {
         $this->Url->setVar('action', $methods[String::lower($action)]);
     } else {
         if ($this->defaultActionForUnknown && !empty($this->defaultAction)) {
             $change = $this->Url['action'] = $this->defaultAction;
         } else {
             self::error404();
         }
     }
     if (!empty($change) && $this->reloadForDefaultAction) {
         $this->redirect($this->Url['controller'] . '/' . $this->Url['action']);
     }
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:26,代码来源:Controller.class.php

示例10: inIArray

 public static function inIArray($needle, array $haystack)
 {
     return in_array(String::lower($needle), array_map(array('String', 'lower'), $haystack));
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:4,代码来源:Arrays.class.php

示例11: compareLabel

 /**
  * Helper for usort, compares labels alphabetically
  * Compares translations of labels if a translator is set
  * @param NavigationNode $item1
  * @param NavigationNode $item2
  * @return int
  */
 public function compareLabel(NavigationNode $item1, NavigationNode $item2)
 {
     $translator = $this->getBuilder()->getTranslator();
     if ($translator instanceof ITranslator) {
         $label1 = $translator->translate($item1->label);
         $label2 = $translator->translate($item2->label);
     } else {
         $label1 = $item1->label;
         $label2 = $item2->label;
     }
     $sortable = array(String::lower((string) $label1), String::lower((string) $label2));
     if ($sortable[0] == $sortable[1]) {
         return 0;
     }
     $sorted = $sortable;
     sort($sorted);
     return $sorted[0] == $sortable[0] ? -1 : 1;
 }
开发者ID:karelklima,项目名称:nette-navigation-builder,代码行数:25,代码来源:NavigationBuilder.php

示例12: hideAction

 /**
  * hides action
  * @param string $action
  * @return DibiDatagrid_ActionColumn
  */
 public function hideAction($action)
 {
     $action = String::lower($action);
     $this->removeComponent($this->getComponent($action));
     return $this;
 }
开发者ID:bazo,项目名称:Tatami,代码行数:11,代码来源:ActionColumn.php

示例13: makeAutologin

 public function makeAutologin($password, $uname)
 {
     if ($this->isLogged() && $this->autolog) {
         $pref = Config::read('cookie.prefix');
         $c_id = $pref . Config::read('modules.Session.User.Autologin.cookie.uid');
         $c_key = $pref . Config::read('modules.Session.User.Autologin.cookie.key');
         $lifetime = Config::read('modules.Session.User.Autologin.lifetime');
         if (Config::read('security.check.uagent')) {
             $uagent = $this->Session->read('config.uagent');
         } else {
             $uagent = null;
         }
         $info = array($password, String::lower($uname), $uagent);
         $hash = Security::hash('sha1', $info);
         Misc::makeCookie($pref . 'rand', $hash[0], $lifetime);
         Misc::makeCookie($c_key, $hash[1], $lifetime);
         Misc::makeCookie($c_id, $this->uid, $lifetime);
     }
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:19,代码来源:UserSession.class.php

示例14: _acceptMIMEType

 /**
  * Determines if a browser accepts a given MIME type.
  *
  * @access private
  *
  * @param string $mimetype  The MIME type to check.
  *
  * @return boolean  True if the browser accepts the MIME type.
  */
 function _acceptMIMEType($mimetype)
 {
     if (strstr('*/*', $this->_accept)) {
         return true;
     }
     if (strstr($this->_accept, String::lower($mimetype))) {
         return true;
     }
     /* image/jpeg and image/pjpeg *appear* to be the same entity, but
        mozilla don't seem to want to accept the latter.  For our
        purposes, we will treat them the same. */
     if ($this->isBrowser('mozilla') && String::lower($mimetype) == 'image/pjpeg' && strstr($this->_accept, 'image/jpeg')) {
         return true;
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:migueloo,代码行数:25,代码来源:browser.class.php

示例15: _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'] . '&deg;' . String::upper($units['temp']);
     // Dew point.
     $html .= ' <b>' . _("Dew point: ") . '</b>';
     $html .= $weather['dewPoint'] . '&deg;' . String::upper($units['temp']);
     // Feels like temperature.
     $html .= ' <b>' . _("Feels like: ") . '</b>';
     $html .= $weather['feltTemperature'] . '&deg;' . 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"');
//.........这里部分代码省略.........
开发者ID:Artea,项目名称:freebeer,代码行数:101,代码来源:weatherdotcom.php


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