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


PHP Strings::upper方法代码示例

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


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

示例1: generateHash

 /**
  * Generuje hash hesla i se solicim retezcem
  * @return string
  */
 public function generateHash($password, $salt = NULL)
 {
     if ($password === Strings::upper($password)) {
         // v pripade zapleho capslocku
         $password = Strings::lower($password);
     }
     return crypt($password, $salt ?: $this->user_salt . Strings::random(23));
 }
开发者ID:prcharom,项目名称:dp-auction-system,代码行数:12,代码来源:UserManager.php

示例2: generateHash

 /**
  * Generuje hash hesla i se solicim retezcem
  * @return string
  */
 public function generateHash($heslo, $salt = NULL)
 {
     if ($heslo === Strings::upper($heslo)) {
         // v pripade zapleho capslocku
         $heslo = Strings::lower($heslo);
     }
     return crypt($heslo, $salt ?: '$2a$07$' . Strings::random(23));
 }
开发者ID:prcharom,项目名称:w-pps-reality,代码行数:12,代码来源:Authenticator.php

示例3: calculateHash

 /**
  * Computes password hash.
  *
  * @param string
  * @param string|NULL
  * @return string
  */
 public static function calculateHash($password, $salt = NULL)
 {
     if ($password === Strings::upper($password)) {
         // perhaps caps lock is on
         $password = Strings::lower($password);
     }
     return crypt($password, $salt ?: '$2a$07$' . Strings::random(22));
 }
开发者ID:newPOPE,项目名称:web-addons.nette.org,代码行数:15,代码来源:Authenticator.php

示例4: calculateAddonsPortalPasswordHash

 /**
  * @param string
  * @param string|NULL
  * @return string
  */
 private function calculateAddonsPortalPasswordHash($password, $salt = NULL)
 {
     if ($password === Strings::upper($password)) {
         // perhaps caps lock is on
         $password = Strings::lower($password);
     }
     return crypt($password, $salt ?: '$2a$07$' . Strings::random(22));
 }
开发者ID:newPOPE,项目名称:web-addons.nette.org,代码行数:13,代码来源:NetteOrgAuthenticator.php

示例5: calculateHash

 /**
  * Computes salted password hash.
  * @param  string
  * @return string
  */
 public static function calculateHash($password, $salt = NULL)
 {
     if ($password === Strings::upper($password)) {
         // perhaps caps lock is on
         $password = Strings::lower($password);
     }
     $password = substr($password, 0, self::PASSWORD_MAX_LENGTH);
     return crypt($password, $salt ?: '$2a$07$' . Strings::random(22));
 }
开发者ID:erwin32,项目名称:nette-foundation-sandbox,代码行数:14,代码来源:Authenticator.php

示例6: decode

 public static function decode($string)
 {
     $digits = ['I' => 1, 'V' => 5, 'X' => 10, 'L' => 50, 'C' => 100, 'D' => 500, 'M' => 1000];
     $string = Strings::upper($string);
     if (!Strings::match($string, '#[IVXLCDMN]+#')) {
         throw new \InvalidArgumentException('Malformed symbol detected. Allowed symbols are: IVXLCDMN');
     }
     if (count(explode('V', $string)) > 2 || count(explode('L', $string)) > 2 || count(explode('D', $string)) > 2) {
         throw new \InvalidArgumentException('Multiple occurencies of V, L or D symbols');
     }
     if ($string === 'N') {
         return 0;
     }
     $count = 1;
     $last = 'Z';
     foreach (str_split($string) as $char) {
         if ($char === $last) {
             $count++;
             if ($count === 4) {
                 throw new \InvalidArgumentException('Malformed Roman number');
             }
         } else {
             $count = 1;
             $last = $char;
         }
     }
     $ptr = 0;
     $values = [];
     $maxDigit = 1000;
     while ($ptr < strlen($string)) {
         $numeral = $string[$ptr];
         $digit = $digits[$numeral];
         if ($digit > $maxDigit) {
             throw new \InvalidArgumentException('Rule 3');
         }
         if ($ptr < strlen($string) - 1) {
             $nextNumeral = $string[$ptr + 1];
             $nextDigit = $digits[$nextNumeral];
             if ($nextDigit > $digit) {
                 if (!in_array($numeral, ['I', 'X', 'C']) || $nextDigit > $digit * 10 || count(explode($numeral, $string)) > 2) {
                     throw new \InvalidArgumentException('Rule 3');
                 }
                 $maxDigit = $digit - 1;
                 $digit = $nextDigit - $digit;
                 $ptr++;
             }
         }
         $values[] = $digit;
         $ptr++;
     }
     for ($i = 0; $i < count($values) - 1; $i++) {
         if ($values[$i] < $values[$i + 1]) {
             throw new \InvalidArgumentException('Rule 5');
         }
     }
     return array_sum($values);
 }
开发者ID:joseki,项目名称:utils,代码行数:57,代码来源:Roman.php

示例7: spinalCase

 /**
  * Converts the given string to `spinal-case`
  * @param string $string
  * @return string
  */
 public static function spinalCase($string)
 {
     /** RegExp source http://stackoverflow.com/a/1993772 */
     preg_match_all('/([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)/', $string, $matches);
     $matches = $matches[0];
     foreach ($matches as &$match) {
         $match = $match == Strings::upper($match) ? Strings::lower($match) : Strings::firstLower($match);
     }
     return implode('-', $matches);
 }
开发者ID:TomasVotruba,项目名称:Nette-RestRoute,代码行数:15,代码来源:Inflector.php

示例8: hashPassword

 /**
  * Computes salted password hash.
  * @param  string
  * @return string
  */
 public static function hashPassword($password, $options = NULL)
 {
     if ($password === Strings::upper($password)) {
         // perhaps caps lock is on
         $password = Strings::lower($password);
     }
     $password = substr($password, 0, self::PASSWORD_MAX_LENGTH);
     $options = $options ?: implode('$', array('algo' => PHP_VERSION_ID < 50307 ? '$2a' : '$2y', 'cost' => '07', 'salt' => Strings::random(22)));
     return crypt($password, $options);
 }
开发者ID:cujan,项目名称:atlashornin,代码行数:15,代码来源:UserManager.php

示例9: hashPassword

 /**
  * Computes salted password hash.
  *
  * @param $password
  * @param null $options
  * @return string
  */
 public static function hashPassword($password, $options = NULL)
 {
     if ($password === Nette\Utils\Strings::upper($password)) {
         // perhaps caps lock is on
         $password = Nette\Utils\Strings::lower($password);
     }
     $password = substr($password, 0, 4096);
     $options = $options ?: implode('$', ['algo' => PHP_VERSION_ID < 50307 ? '$2a' : '$2y', 'cost' => '07', 'salt' => Nette\Utils\Strings::random(22)]);
     return crypt($password, $options);
 }
开发者ID:Kotys,项目名称:eventor.io,代码行数:17,代码来源:Authenticator.php

示例10: processCons

 public function processCons()
 {
     $arr = [];
     foreach (Arrays::get($this->data, 'constants', []) as $name => $cons) {
         if ($this->getDefault($cons) != ";") {
             $arr[] = "\$" . Strings::upper($name) . $this->getDefault($cons);
         }
     }
     $this->template->constants = $arr;
 }
开发者ID:f3l1x,项目名称:nette-plugins,代码行数:10,代码来源:Classgen.php

示例11: testRenderWithRenderer

 public function testRenderWithRenderer()
 {
     $test = $this;
     $this->column->setRenderer(function ($value, $rowData, $cell) use($test) {
         $test->assertTrue(is_string($value));
         $test->assertInstanceOf('stdClass', $rowData);
         $test->assertInstanceOf('Nette\\Utils\\Html', $cell);
         return \Nette\Utils\Strings::upper($value);
     });
     $result = $this->column->render(array('testing', 'is', 'awesome'), array());
     $this->assertEquals('TESTING, IS, AWESOME', $result);
 }
开发者ID:drahak,项目名称:tables,代码行数:12,代码来源:ColumnTest.php

示例12: actionGetData

 /**
  * Akce vracející data description a konfiguraci pro EasyMiner UI
  * @param int $id_dm
  * @param int $miner
  * @throws ForbiddenRequestException
  */
 public function actionGetData($id_dm, $miner)
 {
     if (empty($miner)) {
         $miner = $id_dm;
     }
     //------------------------------------------------------------------------------------------------------------------
     $miner = $this->findMinerWithCheckAccess($miner);
     $minerType = $miner->type;
     $FLPathElement = 'FLPath_' . Strings::upper($minerType);
     //------------------------------------------------------------------------------------------------------------------
     #region připravení informací pro UI - s odděleným připravením DataDictionary
     $dataDescriptionPMML = null;
     $dataParser = new DataParser($dataDescriptionPMML, $this->config->{$FLPathElement}, $this->config->FGCPath, null, null, $this->translator->getLang());
     $dataParser->loadData();
     $responseContent = $dataParser->parseData();
     $user = $this->getCurrentUser();
     $responseContent['DD'] = ['dataDictionary' => $this->datasourcesFacade->exportDataDictionaryArr($miner->datasource, $user, $rowsCount), 'transformationDictionary' => $this->metasourcesFacade->exportTransformationDictionaryArr($miner->metasource, $user), 'recordCount' => $rowsCount];
     #endregion připravení informací pro UI - s odděleným připravením DataDictionary
     uksort($responseContent['DD']['transformationDictionary'], function ($a, $b) {
         return strnatcasecmp($a, $b);
     });
     uksort($responseContent['DD']['dataDictionary'], function ($a, $b) {
         return strnatcasecmp($a, $b);
         //return strnatcasecmp(mb_strtolower($a,'utf-8'),mb_strtolower($b,'utf-8'));
     });
     $responseContent['status'] = 'ok';
     $responseContent['miner_type'] = $miner->type;
     $responseContent['miner_name'] = $miner->name;
     if ($miner->ruleSet) {
         $ruleSet = $miner->ruleSet;
     } else {
         $ruleSet = $this->ruleSetsFacade->saveNewRuleSetForUser($miner->name, $this->getCurrentUser());
         $miner->ruleSet = $ruleSet;
         $this->minersFacade->saveMiner($miner);
     }
     $responseContent['miner_ruleset'] = ['id' => $ruleSet->ruleSetId, 'name' => $ruleSet->name];
     $responseContent['miner_config'] = $miner->getExternalConfig();
     $this->sendJsonResponse($responseContent);
 }
开发者ID:kizi,项目名称:easyminer-easyminercenter,代码行数:45,代码来源:MiningUiPresenter.php

示例13: createPresenterName

 private function createPresenterName($string)
 {
     $presenter = '';
     $enlarge = false;
     for ($i = 0; $i < \Nette\Utils\Strings::length($string); $i++) {
         $char = \Nette\Utils\Strings::substring($string, $i, 1);
         if ($char == '-') {
             $enlarge = true;
         }
         if (ord($char) >= 65 && ord($char) <= 90 || ord($char) >= 97 && ord($char) <= 122) {
             if ($i == 0 || $enlarge) {
                 $presenter .= \Nette\Utils\Strings::upper($char);
                 if ($enlarge) {
                     $enlarge = false;
                 }
             } else {
                 $presenter .= $char;
             }
         }
     }
     return $presenter;
 }
开发者ID:vsek,项目名称:cms,代码行数:22,代码来源:RouterFactory.php

示例14: doDecorate

 /**
  * @param PhpNamespace $namespace
  * @param ClassType $class
  * @param Column $column
  * @return void
  */
 public function doDecorate(Column $column, ClassType $class, PhpNamespace $namespace)
 {
     $column->setPhpDoc($doc = new PhpDoc());
     // Annotation
     $doc->setAnnotation('@property');
     // Type
     if ($column->isNullable()) {
         $doc->setType($this->getRealType($column) . '|NULL');
     } else {
         $doc->setType($this->getRealType($column));
     }
     // Variable
     $doc->setVariable(Helpers::camelCase($column->getName()));
     // Defaults
     if ($column->getDefault() !== NULL) {
         $doc->setDefault($this->getRealDefault($column));
     }
     // Enum
     if (!empty($enum = $column->getEnum())) {
         $doc->setEnum(Strings::upper($column->getName()));
     }
     // Relations
     if (($key = $column->getForeignKey()) !== NULL) {
         // Find foreign entity table
         $ftable = $column->getTable()->getDatabase()->getForeignTable($key->getReferenceTable());
         // Update type to Entity name
         $doc->setType($this->resolver->resolveEntityName($ftable));
         $doc->setRelation($relDoc = new PhpRelDoc());
         if ($use = $this->getRealUse($ftable, $namespace)) {
             $namespace->addUse($use);
         }
         $relDoc->setType('???');
         $relDoc->setEntity($this->resolver->resolveEntityName($ftable));
         $relDoc->setVariable('???');
     }
     // Append phpDoc to class
     $class->addDocument((string) $column->getPhpDoc());
 }
开发者ID:minetro,项目名称:normgen,代码行数:44,代码来源:ColumnDocumentor.php

示例15: doDecorate

 /**
  * @param PhpNamespace $namespace
  * @param ClassType $class
  * @param Column $column
  * @return void
  */
 public function doDecorate(Column $column, ClassType $class, PhpNamespace $namespace)
 {
     switch ($column->getType()) {
         // Map: DateTime
         case ColumnTypes::TYPE_DATETIME:
             $column->setType('DateTime');
             if ($column->getDefault() !== NULL) {
                 $column->setDefault('now');
             }
             $namespace->addUse('Nette\\Utils\\DateTime');
             break;
             // Map: Enum
         // Map: Enum
         case ColumnTypes::TYPE_ENUM:
             foreach ($column->getEnum() as $enum) {
                 $name = Strings::upper($column->getName()) . '_' . $enum;
                 $class->addConst($name, $enum);
             }
             if ($column->getDefault() !== NULL) {
                 $column->setDefault(Strings::upper($column->getName()) . '_' . $column->getDefault());
             }
             break;
     }
 }
开发者ID:minetro,项目名称:normgen,代码行数:30,代码来源:ColumnMapper.php


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