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


PHP ctype_alnum函数代码示例

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


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

示例1: isAlphaNumerical

 /**
  * Is the file name alpha numerical minus the allowed asciis
  */
 private function isAlphaNumerical()
 {
     if (ctype_alnum(str_replace($this->rules['FileName']['allowed'], '', $this->fileName))) {
         return true;
     }
     return false;
 }
开发者ID:motters,项目名称:image-safe,代码行数:10,代码来源:FileName.php

示例2: videopress_is_valid_guid

/**
 * Validate user-supplied guid values against expected inputs
 *
 * @since 1.1
 * @param string $guid video identifier
 * @return bool true if passes validation test
 */
function videopress_is_valid_guid($guid)
{
    if (!empty($guid) && strlen($guid) === 8 && ctype_alnum($guid)) {
        return true;
    }
    return false;
}
开发者ID:automattic,项目名称:jetpack,代码行数:14,代码来源:utility-functions.php

示例3: post_xhr

 function post_xhr()
 {
     if ($this->checkAuth()) {
         $usernameOrEmail = mb_strtolower($_POST['usernameOrEmail']);
         if (mb_strlen($usernameOrEmail) >= 8 && preg_match('/^[a-zA-Z0-9_\\-]+$/', $usernameOrEmail) || filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
             $secondFactor = mb_strtolower($_POST['secondFactor']);
             if (ctype_alnum($secondFactor) || empty($secondFactor)) {
                 $answer = mb_strtolower($_POST['answer']);
                 if (mb_strlen($answer) >= 6 || empty($answer)) {
                     $newPassword = $_POST['passwordForgot'];
                     $newRetypedPassword = $_POST['passwordRetypedForgot'];
                     if ($newPassword == $newRetypedPassword) {
                         $userForgot = new AuthUser();
                         $responseArr = $userForgot->forgotPassword($usernameOrEmail, $secondFactor, $answer, $newPassword);
                         if ($responseArr['continue'] == true) {
                             echo json_encode(StatusReturn::S200($responseArr));
                         } else {
                             echo json_encode(StatusReturn::E400('Unknown Error 5'));
                         }
                     } else {
                         echo json_encode(StatusReturn::E400('Unknown Error 4'));
                     }
                 } else {
                     echo json_encode(StatusReturn::E400('Unknown Error'));
                 }
             } else {
                 echo json_encode(StatusReturn::E400('Unknown Error'));
             }
         } else {
             echo json_encode(StatusReturn::E400('Unknown Error'));
         }
     }
 }
开发者ID:rapidDevGroup,项目名称:PHP-REST-API,代码行数:33,代码来源:ForgotPassword.php

示例4: generate_data_file

function generate_data_file($filename, $content)
{
    if (!assert(ctype_alnum(str_replace(array('-', '_', '.'), '', $filename)))) {
        return FALSE;
    }
    return file_put_contents(config_path('dataDirectory', $filename), $content, LOCK_EX);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:7,代码来源:db.php

示例5: validate_bk_username

 public function validate_bk_username($username)
 {
     if (!ctype_alnum($username)) {
         return array(_t('Your Brightkite username is not valid.', $this->class_name));
     }
     return array();
 }
开发者ID:habari-extras,项目名称:brightkite,代码行数:7,代码来源:brightkite.plugin.php

示例6: createController

 /**
  * Creates the required controller specified by the given path of controller names.
  *
  * Controllers are created by providing only the domain name, e.g.
  * "basket" for the Controller_Frontend_Basket_Default or a path of names to
  * retrieve a specific sub-controller if available.
  * Please note, that only the default controllers can be created. If you need
  * a specific implementation, you need to use the factory class of the
  * controller to hand over specifc implementation names.
  *
  * @param MShop_Context_Item_Interface $context Context object required by managers
  * @param string $path Name of the domain (and sub-managers) separated by slashes, e.g "basket"
  * @throws Controller_Frontend_Exception If the given path is invalid or the manager wasn't found
  */
 public static function createController(MShop_Context_Item_Interface $context, $path)
 {
     if (empty($path)) {
         throw new Controller_Frontend_Exception(sprintf('Controller path is empty'));
     }
     $id = (string) $context;
     if (self::$_cache === false || !isset(self::$_controllers[$id][$path])) {
         $parts = explode('/', $path);
         foreach ($parts as $key => $part) {
             if (ctype_alnum($part) === false) {
                 throw new Controller_Frontend_Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path));
             }
             $parts[$key] = ucwords($part);
         }
         $factory = 'Controller_Frontend_' . join('_', $parts) . '_Factory';
         if (class_exists($factory) === false) {
             throw new Controller_Frontend_Exception(sprintf('Class "%1$s" not available', $factory));
         }
         $manager = call_user_func_array(array($factory, 'createController'), array($context));
         if ($manager === false) {
             throw new Controller_Frontend_Exception(sprintf('Invalid factory "%1$s"', $factory));
         }
         self::$_controllers[$id][$path] = $manager;
     }
     return self::$_controllers[$id][$path];
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:40,代码来源:Factory.php

示例7: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('email', 'email', array('label' => 'Email Of Owner', 'required' => true));
     // The rest of this is duplicated from index\forms\CreateForm
     $builder->add('title', 'text', array('label' => 'Title', 'required' => true, 'max_length' => VARCHAR_COLUMN_LENGTH_USED));
     $builder->add('slug', 'text', array('label' => 'Slug For Web Address', 'required' => true, 'max_length' => VARCHAR_COLUMN_LENGTH_USED));
     $myExtraFieldValidator = function (FormEvent $event) {
         global $CONFIG;
         $form = $event->getForm();
         $myExtraField = $form->get('slug')->getData();
         if (!ctype_alnum($myExtraField) || strlen($myExtraField) < 2) {
             $form['slug']->addError(new FormError("Numbers and letters only, at least 2."));
         } else {
             if (in_array($myExtraField, $CONFIG->siteSlugReserved)) {
                 $form['slug']->addError(new FormError("That is already taken."));
             }
         }
     };
     $builder->addEventListener(FormEvents::POST_BIND, $myExtraFieldValidator);
     $readChoices = array('public' => 'Public, and listed on search engines and our directory', 'protected' => 'Public, but not listed so only people who know about it can find it');
     $builder->add('read', 'choice', array('label' => 'Who can read?', 'required' => true, 'choices' => $readChoices, 'expanded' => true));
     $builder->get('read')->setData('public');
     $writeChoices = array('public' => 'Anyone can add data', 'protected' => 'Only people I say can add data');
     $builder->add('write', 'choice', array('label' => 'Who can write?', 'required' => true, 'choices' => $writeChoices, 'expanded' => true));
     $builder->get('write')->setData('public');
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:26,代码来源:NewSiteForm.php

示例8: createController

 /**
  * Creates the required controller specified by the given path of controller names.
  *
  * Controllers are created by providing only the domain name, e.g.
  * "product" for the \Aimeos\Controller\ExtJS\Product\Standard or a path of names to
  * retrieve a specific sub-controller, e.g. "product/type" for the
  * \Aimeos\Controller\ExtJS\Product\Type\Standard controller.
  * Please note, that only the default controllers can be created. If you need
  * a specific implementation, you need to use the factory class of the
  * controller to hand over specifc implementation names.
  *
  * @param \Aimeos\MShop\Context\Item\Iface $context Context object required by managers
  * @param string $path Name of the domain (and sub-managers) separated by slashes, e.g "product/list"
  * @throws \Aimeos\Controller\ExtJS\Exception If the given path is invalid or the manager wasn't found
  */
 public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $path)
 {
     $path = strtolower(trim($path, "/ \n\t\r\v"));
     if (empty($path)) {
         throw new \Aimeos\Controller\ExtJS\Exception(sprintf('Controller path is empty'));
     }
     $id = (string) $context;
     if (self::$cache === false || !isset(self::$controllers[$id][$path])) {
         $parts = explode('/', $path);
         foreach ($parts as $key => $part) {
             if (ctype_alnum($part) === false) {
                 throw new \Aimeos\Controller\ExtJS\Exception(sprintf('Invalid controller "%1$s" in "%2$s"', $part, $path));
             }
             $parts[$key] = ucwords($part);
         }
         $factory = '\\Aimeos\\Controller\\ExtJS\\' . join('\\', $parts) . '\\Factory';
         if (class_exists($factory) === false) {
             throw new \Aimeos\Controller\ExtJS\Exception(sprintf('Class "%1$s" not found', $factory));
         }
         $controller = @call_user_func_array(array($factory, 'createController'), array($context));
         if ($controller === false) {
             throw new \Aimeos\Controller\ExtJS\Exception(sprintf('Invalid factory "%1$s"', $factory));
         }
         self::$controllers[$id][$path] = $controller;
     }
     return self::$controllers[$id][$path];
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:42,代码来源:Factory.php

示例9: 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_alnum($this->_input[$this->_position])) {
             $this->_position++;
         }
         $termStartPosition = $this->_position;
         // read token
         while ($this->_position < strlen($this->_input) && ctype_alnum($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,代码来源:TextNum.php

示例10: check_alnum

function check_alnum($str, $permit = FALSE)
{
    if ($permit) {
        $str = str_replace($permit, '', $str);
    }
    return ctype_alnum($str);
}
开发者ID:nguyennm621992,项目名称:helppage,代码行数:7,代码来源:sso.php

示例11: classPrefix

 public static function classPrefix($v = null)
 {
     if (!is_null($v) && ctype_alnum($v)) {
         self::$_classPrefix = $v;
     }
     return self::$_classPrefix;
 }
开发者ID:vgrish,项目名称:xblib,代码行数:7,代码来源:lib.php

示例12: validateAlnum

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

示例13: isAlnum

 public function isAlnum($par)
 {
     if (ctype_alnum($par)) {
         return true;
     }
     return false;
 }
开发者ID:AstafievAndrey,项目名称:flf,代码行数:7,代码来源:Valid.php

示例14: renderResult

 private function renderResult()
 {
     $mat_no = $_POST['mat_no'];
     if (!ctype_alnum($mat_no)) {
         $this->renderError('Matriculation number contains non-alphanumerical characters');
         return;
     }
     $project_id = $_POST['project_id'];
     if (!ctype_digit($project_id)) {
         $this->renderError('Project-id invalid');
         return;
     }
     $pwd = $_POST['password'];
     if (!$pwd) {
         $this->renderError('Password empty');
         return;
     }
     $result_str = 'No results for this combination of matriculation number and password found.';
     if (preg_match(PasswordGenerator::$passwordCharacterRegExp, $pwd)) {
         //If not, we dont query the database, but we won't tell the intruder either
         $db = Database::getInstance();
         $data = $db->getResultDataByMatNo($project_id, $mat_no);
         $crypt = new CryptProxy($data['crypt_module'], $project_id, $data['member_id']);
         $decrypted_result = $crypt->decryptResult($data['result'], $data['crypt_data'], $pwd);
         if ($decrypted_result) {
             $result_str = sprintf('<div class="result">%s</div>', $decrypted_result);
         }
     }
     $this->renderNote($result_str, sprintf('Results for matriculation number %s:', $mat_no));
 }
开发者ID:BackupTheBerlios,项目名称:reson-svn,代码行数:30,代码来源:StartPage.php

示例15: identifyHtml

 /**
  * identify a line as the beginning of a HTML block.
  */
 protected function identifyHtml($line, $lines, $current)
 {
     if ($line[0] !== '<' || isset($line[1]) && $line[1] == ' ') {
         return false;
         // no html tag
     }
     if (strncmp($line, '<!--', 4) === 0) {
         return true;
         // a html comment
     }
     $gtPos = strpos($lines[$current], '>');
     $spacePos = strpos($lines[$current], ' ');
     if ($gtPos === false && $spacePos === false) {
         return false;
         // no html tag
     } elseif ($spacePos === false) {
         $tag = rtrim(substr($line, 1, $gtPos - 1), '/');
     } else {
         $tag = rtrim(substr($line, 1, min($gtPos, $spacePos) - 1), '/');
     }
     if (!ctype_alnum($tag) || in_array(strtolower($tag), $this->inlineHtmlElements)) {
         return false;
         // no html tag or inline html tag
     }
     return true;
 }
开发者ID:noorafree,项目名称:makmakan,代码行数:29,代码来源:HtmlTrait.php


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