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


PHP str::lower方法代码示例

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


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

示例1: login

 public function login($welcome = null)
 {
     if ($user = panel()->site()->user()) {
         go(panel()->urls()->index());
     }
     $message = l('login.error');
     $error = false;
     $form = panel()->form('login');
     $form->cancel = false;
     $form->save = l('login.button');
     $form->centered = true;
     if (r::is('post') and get('_csfr') and csfr(get('_csfr'))) {
         $data = $form->serialize();
         $user = site()->user(str::lower($data['username']));
         if (!$user) {
             $error = true;
         } else {
             if (!$user->hasPanelAccess()) {
                 $error = true;
             } else {
                 if (!$user->login(get('password'))) {
                     $error = true;
                 } else {
                     go(panel()->urls()->index());
                 }
             }
         }
     }
     if ($username = s::get('username')) {
         $form->fields->username->value = html($username, false);
     }
     return layout('login', array('meta' => new Snippet('meta'), 'welcome' => $welcome ? l('login.welcome') : '', 'form' => $form, 'error' => $error ? $message : false));
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:33,代码来源:auth.php

示例2: plural

 /**
  * Return the plural of the input string if quantity is larger than one.
  *
  * NOTE: This function will not handle any special cases.
  *
  * @see     http://www.oxforddictionaries.com/words/plurals-of-nouns
  *
  * @param   string   $singular  Singular noun
  * @param   integer  $quantity  Quantity
  * @param   string   $plural    Plural form
  *
  * @return  string
  */
 public static function plural($singular, $quantity = 2, $plural = null)
 {
     if ($quantity <= 1 || empty($singular)) {
         return $singular;
     }
     if (!is_null($plural)) {
         return $plural;
     }
     $last = str::lower($singular[str::length($singular) - 1]);
     $lastTwo = str::lower(substr($singular, 0, -2));
     if ('y' === $last) {
         return substr($singular, 0, -1) . 'ies';
     } else {
         if ('f' === $last || 'fe' === $lastTwo) {
             return $singular . 'ves';
         } else {
             if (in_array($last, array('s', 'x', 'z'))) {
                 return substr($singular, 0, -1) . 'es';
             } else {
                 if (in_array($lastTwo, array('ch', 'sh'))) {
                     return substr($singular, 0, -2) . 'es';
                 } else {
                     return $singular . 's';
                 }
             }
         }
     }
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:41,代码来源:str.php

示例3: optionsFromQuery

 public function optionsFromQuery($query)
 {
     // default query parameters
     $defaults = array('page' => $this->field->page ? $this->field->page->id() : '', 'fetch' => 'children', 'value' => '{{uid}}', 'text' => '{{title}}', 'flip' => false, 'template' => false);
     // sanitize the query
     if (!is_array($query)) {
         $query = array();
     }
     // merge the default parameters with the actual query
     $query = array_merge($defaults, $query);
     // dynamic page option
     // ../
     // ../../ etc.
     $page = $this->page($query['page']);
     $items = $this->items($page, $query['fetch']);
     $options = array();
     if ($query['template']) {
         $items = $items->filter(function ($item) use($query) {
             return in_array(str::lower($item->intendedTemplate()), array_map('str::lower', (array) $query['template']));
         });
     }
     if ($query['flip']) {
         $items = $items->flip();
     }
     foreach ($items as $item) {
         $value = $this->tpl($query['value'], $item);
         $text = $this->tpl($query['text'], $item);
         $options[$value] = $text;
     }
     return $options;
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:31,代码来源:fieldoptions.php

示例4: login

 function login()
 {
     s::restart();
     $password = get('password');
     $username = get('username');
     if (empty($username) || empty($password)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     $account = self::load($username);
     if (!$account) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // check for matching usernames
     if (str::lower($account['username']) != str::lower($username)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // check for a matching password
     if (!self::checkPassword($account, $password)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // generate a random token
     $token = str::random();
     // add the username.
     // It's only the key of the array so far.
     $account['token'] = $token;
     // store the token in the cookie
     // and the user data in the session
     cookie::set('auth', $token, 60 * 60 * 24);
     s::set($token, $account);
     // assign the user data to this obj
     $this->_ = $account;
     return array('status' => 'success', 'msg' => l::get('login.success'));
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:33,代码来源:user.php

示例5: fields

 public function fields($fields = null)
 {
     if (is_null($fields)) {
         return $this->fields;
     }
     // get the site object
     $site = panel()->site();
     // check if untranslatable fields should be deactivated
     $translated = $site->multilang() && !$site->language()->default();
     foreach ($fields as $name => $field) {
         $name = str_replace('-', '_', str::lower($name));
         $field['name'] = $name;
         $field['default'] = a::get($field, 'default', null);
         $field['value'] = a::get($this->values(), $name, $field['default']);
         // Pass through parent field name (structureField)
         $field['parentField'] = $this->parentField;
         // Check for untranslatable fields
         if ($translated and isset($field['translate']) and $field['translate'] === false) {
             $field['readonly'] = true;
             $field['disabled'] = true;
         }
         $this->fields->append($name, static::field($field['type'], $field));
     }
     return $this;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:25,代码来源:form.php

示例6: __construct

 public function __construct($username)
 {
     $this->username = str::lower($username);
     // check if the account file exists
     if (!file_exists($this->file())) {
         throw new Exception('The user account could not be found');
     }
 }
开发者ID:robinandersen,项目名称:robin,代码行数:8,代码来源:user.php

示例7: to

 public function to()
 {
     $source = $this->source();
     $name = f::name($source['name']);
     $extension = f::extension($source['name']);
     $safeName = f::safeName($name);
     $safeExtension = str_replace('jpeg', 'jpg', str::lower($extension));
     return str::template($this->options['to'], array('name' => $name, 'filename' => $source['name'], 'safeName' => $safeName, 'safeFilename' => $safeName . '.' . $safeExtension, 'extension' => $extension, 'safeExtension' => $safeExtension));
 }
开发者ID:chrishiam,项目名称:LVSL,代码行数:9,代码来源:upload.php

示例8: to

 public function to()
 {
     if (!is_null($this->to)) {
         return $this->to;
     }
     $source = $this->source();
     $name = f::name($source['name']);
     $extension = f::extension($source['name']);
     $safeName = f::safeName($name);
     $safeExtension = str_replace('jpeg', 'jpg', str::lower($extension));
     if (empty($safeExtension)) {
         $safeExtension = f::mimeToExtension(f::mime($source['tmp_name']));
     }
     return $this->to = str::template($this->options['to'], array('name' => $name, 'filename' => $source['name'], 'safeName' => $safeName, 'safeFilename' => $safeName . r(!empty($safeExtension), '.' . $safeExtension), 'extension' => $extension, 'safeExtension' => $safeExtension));
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:15,代码来源:upload.php

示例9: __construct

 public function __construct($view, $input)
 {
     $this->view = $view;
     if (is_object($input) and method_exists($input, 'topbar')) {
         $input->topbar($this);
     } else {
         $class = is_object($input) ? str_replace('model', '', strtolower(get_class($input))) : (string) $input;
         $file = panel()->roots()->topbars() . DS . str::lower($class) . '.php';
         if (file_exists($file)) {
             $callback = (require $file);
             $callback($this, $input);
         } else {
             throw new Exception(l('topbar.error.class.definition') . $class);
         }
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:16,代码来源:topbar.php

示例10: login

 public function login()
 {
     $user = app::$site->users()->find(str::lower(get('username')));
     $message = l('login.error');
     if (!$user) {
         return response::error($message);
     }
     try {
         if (!$user->login(get('password'))) {
             throw new Exception($message);
         }
         return response::success(l('login.success'));
     } catch (Exception $e) {
         return response::error($e->getMessage());
     }
 }
开发者ID:kompuser,项目名称:panel,代码行数:16,代码来源:auth.php

示例11: fields

 public function fields($fields = null)
 {
     if (is_null($fields)) {
         return $this->fields;
     }
     foreach ($fields as $name => $field) {
         if ($name == 'title') {
             $field['type'] = 'title';
         }
         $field['name'] = $name;
         $field['default'] = a::get($field, 'default', null);
         $field['value'] = a::get($this->values(), str::lower($name), $field['default']);
         $this->fields->append($name, static::field($field['type'], $field));
     }
     return $this;
 }
开发者ID:kompuser,项目名称:panel,代码行数:16,代码来源:form.php

示例12: fields

 public function fields($fields = null)
 {
     if (is_null($fields)) {
         return $this->fields;
     }
     foreach ($fields as $name => $field) {
         $name = str_replace('-', '_', str::lower($name));
         $field['name'] = $name;
         $field['default'] = a::get($field, 'default', null);
         $field['value'] = a::get($this->values(), $name, $field['default']);
         // Pass through parent field name (structureField)
         $field['parentField'] = $this->parentField;
         $this->fields->append($name, static::field($field['type'], $field));
     }
     return $this;
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:16,代码来源:form.php

示例13: __construct

 public function __construct($fields = array(), $model)
 {
     if (empty($fields) or !is_array($fields)) {
         $fields = array();
     }
     foreach ($fields as $name => $field) {
         // sanitize the name
         $name = str_replace('-', '_', str::lower($name));
         // import a field by name
         if (is_string($field)) {
             $field = array('name' => $name, 'extends' => $field);
         }
         // add the name to the field
         $field['name'] = $name;
         // create the field object
         $field = new Field($field, $model);
         // append it to the collection
         $this->append($name, $field);
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:20,代码来源:fields.php

示例14: attempt

 /**
  * Run an attempt to login
  * 
  * @param string $username
  * @param string $password
  */
 public function attempt($username, $password)
 {
     $this->username = str::lower($username);
     $this->password = $password;
     try {
         if ($this->isInvalidUsername() || $this->isInvalidPassword()) {
             throw new Exception(l('login.error'));
         }
         $user = $this->user();
         if (!$user->login($this->password)) {
             throw new Exception(l('login.error'));
         }
         $this->clearLog($this->visitorId());
         return true;
     } catch (Exception $e) {
         $this->log();
         $this->pause();
         throw $e;
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:26,代码来源:login.php

示例15: fetch

 static function fetch($file)
 {
     if (!file_exists($file)) {
         return array('raw' => false, 'data' => array());
     }
     $content = f::read($file);
     $content = str_replace("", '', $content);
     $sections = preg_split('![\\r\\n]+[-]{4,}!i', $content);
     $data = array();
     foreach ($sections as $s) {
         $parts = explode(':', $s);
         if (count($parts) == 1 && count($sections) == 1) {
             return $content;
         }
         $key = str::lower(preg_replace('![^a-z0-9]+!i', '_', trim($parts[0])));
         if (empty($key)) {
             continue;
         }
         $value = trim(implode(':', array_slice($parts, 1)));
         $data[$key] = $value;
     }
     return array('raw' => $content, 'data' => $data);
 }
开发者ID:nilshendriks,项目名称:kirbycms,代码行数:23,代码来源:variables.php


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