當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。