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


PHP ctype_alpha函数代码示例

本文整理汇总了PHP中ctype_alpha函数的典型用法代码示例。如果您正苦于以下问题:PHP ctype_alpha函数的具体用法?PHP ctype_alpha怎么用?PHP ctype_alpha使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: submitInfo

 public function submitInfo()
 {
     $this->load->model("settings_model");
     // Gather the values
     $values = array('nickname' => htmlspecialchars($this->input->post("nickname")), 'location' => htmlspecialchars($this->input->post("location")));
     // Change language
     if ($this->config->item('show_language_chooser')) {
         $values['language'] = $this->input->post("language");
         if (!is_dir("application/language/" . $values['language'])) {
             die("3");
         } else {
             $this->user->setLanguage($values['language']);
             $this->plugins->onSetLanguage($this->user->getId(), $values['language']);
         }
     }
     // Remove the nickname field if it wasn't changed
     if ($values['nickname'] == $this->user->getNickname()) {
         $values = array('location' => $this->input->post("location"));
     } elseif (strlen($values['nickname']) < 4 || strlen($values['nickname']) > 14 || !preg_match("/[A-Za-z0-9]*/", $values['nickname'])) {
         die(lang("nickname_error", "ucp"));
     } elseif ($this->internal_user_model->nicknameExists($values['nickname'])) {
         die("2");
     }
     if (strlen($values['location']) > 32 && !ctype_alpha($values['location'])) {
         die(lang("location_error", "ucp"));
     }
     $this->settings_model->saveSettings($values);
     $this->plugins->onSaveSettings($this->user->getId(), $values);
     die("1");
 }
开发者ID:saqar,项目名称:FusionCMS-themes-and-modules,代码行数:30,代码来源:settings.php

示例2: getExpressionPartsPattern

 private function getExpressionPartsPattern()
 {
     $signs = ' ';
     $patterns = ['\\$[a-zA-Z_]+[a-zA-Z_0-9]+' => 25, ':[a-zA-Z_\\-0-9]+' => 16, '"(?:\\\\.|[^"\\\\])*"' => 21, "'(?:\\\\.|[^'\\\\])*'" => 21, '(?<!\\w)\\d+(?:\\.\\d+)?' => 20];
     $iterator = new \AppendIterator();
     $iterator->append(new \CallbackFilterIterator(new \ArrayIterator(self::$operators), function ($operator) {
         return !ctype_alpha($operator);
     }));
     $iterator->append(new \ArrayIterator(self::$punctuation));
     foreach ($iterator as $symbol) {
         $length = strlen($symbol);
         if ($length === 1) {
             $signs .= $symbol;
         } else {
             if (strpos($symbol, ' ') !== false) {
                 $symbol = "(?<=^|\\W){$symbol}(?=[\\s()\\[\\]]|\$)";
             } else {
                 $symbol = preg_quote($symbol, '/');
             }
             $patterns[$symbol] = $length;
         }
     }
     arsort($patterns);
     $patterns = implode('|', array_keys($patterns));
     $signs = preg_quote($signs, '/');
     return "/({$patterns}|[{$signs}])/i";
 }
开发者ID:bugadani,项目名称:minty,代码行数:27,代码来源:ExpressionTokenizer.php

示例3: validateAlpha

 /**
  * 
  * Validates that the value is letters only (upper or lower case).
  * 
  * @param mixed $value The value to validate.
  * 
  * @return bool True if valid, false if not.
  * 
  */
 public function validateAlpha($value)
 {
     if ($this->_filter->validateBlank($value)) {
         return !$this->_filter->getRequire();
     }
     return ctype_alpha($value);
 }
开发者ID:btweedy,项目名称:foresmo,代码行数:16,代码来源:ValidateAlpha.php

示例4: nextToken

 /**
  * Tokenization stream API
  * Get next token
  * Returns null at the end of stream
  *
  * @return Zend_Search_Lucene_Analysis_Token|null
  */
 public function nextToken()
 {
     if ($this->_input === null) {
         return null;
     }
     while ($this->_position < strlen($this->_input)) {
         // skip white space
         while ($this->_position < strlen($this->_input) && !ctype_alpha($this->_input[$this->_position])) {
             $this->_position++;
         }
         $termStartPosition = $this->_position;
         // read token
         while ($this->_position < strlen($this->_input) && ctype_alpha($this->_input[$this->_position])) {
             $this->_position++;
         }
         // Empty token, end of stream.
         if ($this->_position == $termStartPosition) {
             return null;
         }
         $token = new Zend_Search_Lucene_Analysis_Token(substr($this->_input, $termStartPosition, $this->_position - $termStartPosition), $termStartPosition, $this->_position);
         $token = $this->normalize($token);
         if ($token !== null) {
             return $token;
         }
         // Continue if token is skipped
     }
     return null;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:35,代码来源:Text.php

示例5: StdDecodePeerId

function StdDecodePeerId($id_data, $id_name)
{
    $version_str = '';
    for ($i = 0; $i <= strlen($id_data); $i++) {
        $c = $id_data[$i];
        if ($id_name == 'BitTornado' || $id_name == 'ABC') {
            if ($c != '-' && ctype_digit($c)) {
                $version_str .= $c . '.';
            } elseif ($c != '-' && ctype_alpha($c)) {
                $version_str .= ord($c) - 55 . '.';
            } else {
                break;
            }
        } elseif ($id_name == 'BitComet' || $id_name == 'BitBuddy' || $id_name == 'Lphant' || $id_name == 'BitPump' || $id_name == 'BitTorrent Plus! v2') {
            if ($c != '-' && ctype_alnum($c)) {
                $version_str .= $c;
                if ($i == 0) {
                    $version_str = (int) $version_str . '.';
                }
            } else {
                $version_str .= '.';
                break;
            }
        } else {
            if ($c != '-' && ctype_alnum($c)) {
                $version_str .= $c . '.';
            } else {
                break;
            }
        }
    }
    $version_str = substr($version_str, 0, strlen($version_str) - 1);
    return $id_name . ' ' . $version_str;
}
开发者ID:Q8HMA,项目名称:BtiTracker-1.5.1,代码行数:34,代码来源:common.php

示例6: validate

 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (null === $value || '' === $value) {
         return;
     }
     $canonicalize = str_replace(' ', '', $value);
     // the bic must be either 8 or 11 characters long
     if (!in_array(strlen($canonicalize), array(8, 11))) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(Bic::INVALID_LENGTH_ERROR)->addViolation();
     }
     // must contain alphanumeric values only
     if (!ctype_alnum($canonicalize)) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(Bic::INVALID_CHARACTERS_ERROR)->addViolation();
     }
     // first 4 letters must be alphabetic (bank code)
     if (!ctype_alpha(substr($canonicalize, 0, 4))) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(Bic::INVALID_BANK_CODE_ERROR)->addViolation();
     }
     // next 2 letters must be alphabetic (country code)
     if (!ctype_alpha(substr($canonicalize, 4, 2))) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(Bic::INVALID_COUNTRY_CODE_ERROR)->addViolation();
     }
     // should contain uppercase characters only
     if (strtoupper($canonicalize) !== $canonicalize) {
         $this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(Bic::INVALID_CASE_ERROR)->addViolation();
     }
 }
开发者ID:bocharsky-bw,项目名称:symfony,代码行数:30,代码来源:BicValidator.php

示例7: isAbsolutePath

 /**
  * @param string $path
  *
  * @return boolean
  */
 private function isAbsolutePath($path)
 {
     if ($path[0] === '/' || $path[0] === '\\' || strlen($path) > 3 && ctype_alpha($path[0]) && $path[1] === ':' && ($path[2] === '\\' || $path[2] === '/') || null !== parse_url($path, PHP_URL_SCHEME)) {
         return true;
     }
     return false;
 }
开发者ID:liverbool,项目名称:dos-theme-bundle,代码行数:12,代码来源:RecursiveFileLocator.php

示例8: to

 public static function to($url = '', $scheme = false, $urlManager = null)
 {
     if (is_array($url)) {
         return static::toRoute($url, $scheme, $urlManager);
     }
     $url = Yii::getAlias($url);
     if ($url === '') {
         $url = Yii::$app->getRequest()->getUrl();
     }
     if (!$scheme) {
         return $url;
     }
     if (strncmp($url, '//', 2) === 0) {
         // e.g. //hostname/path/to/resource
         return is_string($scheme) ? "{$scheme}:{$url}" : $url;
     }
     if (($pos = strpos($url, ':')) == false || !ctype_alpha(substr($url, 0, $pos))) {
         // turn relative URL into absolute
         $url = Yii::$app->getUrlManager()->getHostInfo() . '/' . ltrim($url, '/');
     }
     if (is_string($scheme) && ($pos = strpos($url, ':')) !== false) {
         // replace the scheme with the specified one
         $url = $scheme . substr($url, $pos);
     }
     return $url;
 }
开发者ID:cdcchen,项目名称:yii-plus,代码行数:26,代码来源:Url.php

示例9: isValid

 public function isValid()
 {
     if (ctype_alpha($this->value)) {
         return true;
     }
     return false;
 }
开发者ID:joeldavuk,项目名称:framework,代码行数:7,代码来源:IsAlpha.php

示例10: isAbsolutePath

 /**
  * Returns true if the file is an existing absolute path.
  *
  * @param  string $file
  * @return boolean
  */
 protected static function isAbsolutePath($file)
 {
     if ($file[0] == '/' || $file[0] == '\\' || strlen($file) > 3 && ctype_alpha($file[0]) && $file[1] == ':' && ($file[2] == '\\' || $file[2] == '/') || null !== parse_url($file, PHP_URL_SCHEME)) {
         return true;
     }
     return false;
 }
开发者ID:Christopher-Rains-Milliken,项目名称:PhoenixWebPHP1,代码行数:13,代码来源:FilesystemLoader.php

示例11: isAbsolutePath

 /**
  * @param $file
  *
  * @return bool
  */
 private function isAbsolutePath($file)
 {
     if (strspn($file, '/\\', 0, 1) || strlen($file) > 3 && ctype_alpha($file[0]) && substr($file, 1, 1) === ':' && strspn($file, '/\\', 2, 1) || null !== parse_url($file, PHP_URL_SCHEME)) {
         return true;
     }
     return false;
 }
开发者ID:PierreCharles,项目名称:uFramework-PHP,代码行数:12,代码来源:TemplateEngine.php

示例12: parse

 public function parse($stream)
 {
     $stream->forward();
     $stream->skipSpaces();
     if ($stream->getFirstCharacters(4) == 'true') {
         $value = true;
         $stream->forward(4);
     } elseif ($stream->getFirstCharacters(5) == 'false') {
         $value = false;
         $stream->forward(5);
     } else {
         $char = $stream->getFirstCharacter();
         if (ctype_digit($char) || $char == '-') {
             $parser = new AnnotationNumericParser();
         } elseif ($char == '"' || $char == '\'') {
             $parser = new AnnotationStringParser();
         } elseif (ctype_alpha($char)) {
             $parser = new AnnotationHashPairsParser();
         } else {
             $parser = new AnnotationDummyParser();
         }
         $value = $parser->parse($stream);
     }
     $stream->skipSpaces();
     if ($stream->shift() != ')') {
         trigger_error("Error parsing annotation '" . $stream->getString() . "' at position " . $stream->getPosition());
     }
     return $value;
 }
开发者ID:rafaelss,项目名称:php-codes,代码行数:29,代码来源:annotation_parser.php

示例13: isAbsolutePath

 public static function isAbsolutePath($file)
 {
     if (strspn($file, '/\\', 0, 1) || strlen($file) > 3 && ctype_alpha($file[0]) && substr($file, 1, 1) === ':' && strspn($file, '/\\', 2, 1) || false !== strpos($file, '://')) {
         return true;
     }
     return false;
 }
开发者ID:webuni,项目名称:assetic-bundle,代码行数:7,代码来源:PathUtils.php

示例14: load

 public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
 {
     $langfile = str_replace('.php', '', $langfile);
     if ($add_suffix === TRUE) {
         $langfile = str_replace('_lang', '', $langfile) . '_lang';
     }
     $langfile .= '.php';
     if (empty($idiom) or !ctype_alpha($idiom)) {
         $config =& get_config();
         $idiom = empty($config['language']) ? 'english' : $config['language'];
     }
     if ($return === FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom) {
         return;
     }
     // Load the base file, so any others found can override it
     $basepath = BASEPATH . 'language/' . $idiom . '/' . $langfile;
     if (($found = file_exists($basepath)) === TRUE) {
         include $basepath;
     }
     // Do we have an alternative path to look in?
     if ($alt_path !== '') {
         $alt_path .= 'language/' . $idiom . '/' . $langfile;
         if (file_exists($alt_path)) {
             include $alt_path;
             $found = TRUE;
         }
     } else {
         // Added by Ivan Tcholakov, 18-APR-2013.
         if (is_object(get_instance())) {
             //
             foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) {
                 $package_path .= 'language/' . $idiom . '/' . $langfile;
                 if ($basepath !== $package_path && file_exists($package_path)) {
                     include $package_path;
                     $found = TRUE;
                     break;
                 }
             }
             //
         }
         //
     }
     if ($found !== TRUE) {
         show_error('Unable to load the requested language file: language/' . $idiom . '/' . $langfile);
     }
     if (!isset($lang) or !is_array($lang)) {
         log_message('error', 'Language file contains no data: language/' . $idiom . '/' . $langfile);
         if ($return === TRUE) {
             return array();
         }
         return;
     }
     if ($return === TRUE) {
         return $lang;
     }
     $this->is_loaded[$langfile] = $idiom;
     $this->language = array_merge($this->language, $lang);
     log_message('debug', 'Language file loaded: language/' . $idiom . '/' . $langfile);
     return TRUE;
 }
开发者ID:ishawge,项目名称:No-CMS,代码行数:60,代码来源:MY_Lang.php

示例15: testSaltedFieldnameFirstCharIsLetter

 function testSaltedFieldnameFirstCharIsLetter()
 {
     $input = new T_Form_Upload('myalias', 'mylabel');
     $input->setFieldnameSalt('mysalt', new T_Filter_RepeatableHash());
     $field = $input->getFieldname();
     $this->assertTrue(ctype_alpha($field[0]));
 }
开发者ID:robtuley,项目名称:knotwerk,代码行数:7,代码来源:Upload.php


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