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


PHP Zend_Validate_StringLength::isValid方法代码示例

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


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

示例1: updateGroupsRows

 public function updateGroupsRows($text, $id, $sportId)
 {
     if ($this->conn->checkAdmin()) {
         $int = new Zend_Validate_Int();
         if (!$int->isValid($id)) {
             return $this->test;
         }
         if (!$int->isValid($sportId)) {
             return $this->test;
         }
         $validator = new Zend_Validate_StringLength(2, 100);
         if (!$validator->isValid($text)) {
             return $this->test;
         }
         $query = "CALL updateGroups('" . $text . "','" . $id . "');";
         $result = $this->conn->insert($query);
         $query = "CALL selectGroups( '" . $sportId . "');CALL selectSports( )";
         $result->message = $this->conn->multiresultbackArray($query);
         return $result;
     } else {
         $this->test->type = "error";
         $this->test->info = "nologin";
         return $this->test;
     }
 }
开发者ID:anhvn,项目名称:bet-script,代码行数:25,代码来源:Groups.php

示例2: _isValid

    /**
     * @param array $value
     * @return boolean indicating is any valid data of interest was passed
     */
    protected function _isValid($value)
    {
        $partialHappened = false;

        $isPost = 'post' == $this->getMethodContext();

        // comment is set optional for put, required for post
        if (isset($value['comment'])) {
            $partialHappened = true;

            $validate = new Zend_Validate_StringLength(array(1, 1000));
            if (!$validate->isValid($value['comment'])) {
                $this->_addValidateMessagesAndErrors($validate);
            }
        } elseif ($isPost) {
            $this->_error(self::COMMENT_REQUIRED);
        }

        // creator_user_id required for post
        // creator can't be changed for put, so if not post, then don't bother
        // checking this, it will be ignored later
        if (isset($value['creator_user_id']) && $isPost) {
            $userTable = new Default_Model_DbTable_User();
            if (false === current($userTable->find($value['creator_user_id']))) {
                $this->_error(self::CREATOR_USER_ID_INVALID, $value['creator_user_id']);
            }
        } elseif ($isPost) {
            $this->_error(self::CREATOR_USER_ID_REQUIRED);
        }

        return $partialHappened;
    }
开发者ID:nestorfabian,项目名称:REST-Example-App-for-Zend-Framework,代码行数:36,代码来源:Entry.php

示例3: _isValid

    /**
     * @param array $value
     * @return boolean indicating is any valid data of interest was passed
     */
    protected function _isValid($value)
    {
        $partialHappened = false;

        $isPost = 'post' == $this->getMethodContext();

        // validate that the title is set
        if (isset($value['title'])) {
            $partialHappened = true;

            $validate = new Zend_Validate_StringLength(array(1, 100));
            if (!$validate->isValid($value['title'])) {
                $this->_addValidateMessagesAndErrors($validate);
            }

            $communityTable = new Default_Model_DbTable_Community();
            if ($communityTable->fetchRow(array('title = ?' => $value['title']))) {
                $this->_error(self::TITLE_ALREADY_EXISTS, $value['title']);
            }
        } elseif ($isPost) {
            $this->_error(self::TITLE_REQUIRED);
        }

        // validate that the pic value is reasonable
        if (isset($value['pic'])) {
            $partialHappened = true;

            $validate = new Zend_Validate_StringLength(array(0, 2083));
            if (!$validate->isValid($value['pic'])) {
                $this->_addValidateMessagesAndErrors($validate);
            }
        }

        return $partialHappened;
    }
开发者ID:nestorfabian,项目名称:REST-Example-App-for-Zend-Framework,代码行数:39,代码来源:Community.php

示例4: testGetErrors

 /**
  * Ensures that the getError() function returns an array of
  * message key values corresponding to the messages.
  *
  * @return void
  */
 public function testGetErrors()
 {
     $this->assertFalse($this->_validator->isValid('abcdefghij'));
     $messages = $this->_validator->getMessages();
     $this->assertEquals("'abcdefghij' is greater than 8 characters long", $messages[0]);
     $errors = $this->_validator->getErrors();
     $this->assertEquals(Zend_Validate_StringLength::TOO_LONG, $errors[0]);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:MessageTest.php

示例5: validate

 public function validate($excludeFromValidation = array())
 {
     if (!in_array('house_name', $excludeFromValidation)) {
         $bookhouseSizeValidator = new Zend_Validate_StringLength(3, 20);
         if (!$bookhouseSizeValidator->isValid($this->getHouseName())) {
             $this->setValidationError('house_name', "Bookhouse name size must bee between 3-20");
         }
     }
 }
开发者ID:berksonj,项目名称:bet,代码行数:9,代码来源:BookhouseModel.php

示例6: validatePrepare

 /**
  * @param mixed|string $prepare
  * @param string       $requestKey
  *
  * @return bool
  */
 protected function validatePrepare($prepare, $requestKey)
 {
     $stringLengthValidator = new StringLengthValidator(array('min' => 1, 'max' => 255));
     if (!$stringLengthValidator->isValid(trim($prepare))) {
         $messages = array_values($stringLengthValidator->getMessages());
         $this->addError(new Error($requestKey, $prepare, $messages));
         return false;
     }
     return true;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:16,代码来源:Creator.php

示例7: validatePassword

 public function validatePassword($text, $name = 'example', $tab = 'common')
 {
     $validator = new Zend_Validate_StringLength(6, 32);
     if ($validator->isValid($text)) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance($this->_namespace);
     $msg->addMessage($name, $validator->getMessages(), $tab);
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:10,代码来源:Validator.php

示例8: validateType

 public function validateType($type)
 {
     $validator = new Zend_Validate_StringLength(2, 255);
     if ($validator->isValid($type)) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance($this->_messagestack_name());
     $msg->addMessage('pf_type', $validator->getMessages(), 'common');
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:10,代码来源:Validator.php

示例9: _validateIdentifier

 protected function _validateIdentifier()
 {
     $validator = new Zend_Validate_StringLength(2, 255);
     if ($validator->isValid($this->_group->getIdentifier())) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance('SxCms_Group');
     $msg->addMessage('identifier', $validator->getMessages());
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:10,代码来源:BaseValidator.php

示例10: _validateDescription

 /**
  * Validates job description
  *
  * @return boolean
  */
 protected function _validateDescription()
 {
     $validator = new Zend_Validate_StringLength(2);
     if ($validator->isValid($this->category->getDescription())) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance('SxCms_Job_Category');
     $msg->addMessage('description', $validator->getMessages());
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:15,代码来源:BaseValidator.php

示例11: validateGroup

 public function validateGroup()
 {
     $validator = new Zend_Validate_StringLength(2, 255);
     $validator->setMessage($this->_tmx->_('error.verplicht.min'), Zend_Validate_StringLength::TOO_SHORT);
     $validator->setMessage($this->_tmx->_('error.verplicht.max'), Zend_Validate_StringLength::TOO_LONG);
     if ($validator->isValid($this->_group)) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance('SxModule_Securedocs_Group');
     $msg->addMessage('group', $validator->getMessages(), 'settings');
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:12,代码来源:Group.php

示例12: validateName

 /**
  * @param  string $name
  * @return boolean
  */
 private function validateName($name)
 {
     $stringLengthValidator = new StringLengthValidator(array('min' => 2, 'max' => 255));
     $stringLengthValidator->setMessage('Album name zu kurz', StringLengthValidator::TOO_SHORT);
     $stringLengthValidator->setMessage('Album name zu lang', StringLengthValidator::TOO_LONG);
     if (!$stringLengthValidator->isValid(trim($name))) {
         $messages = array_values($stringLengthValidator->getMessages());
         $this->addError(new Error('name', $name, $messages));
         return false;
     }
     return true;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:16,代码来源:Album.php

示例13: setSettings

 public function setSettings($nImageId, $sUserName, $sDescr)
 {
     if (is_numeric($nImageId)) {
         $aImageSettings = array();
         $oStringLenght = new Zend_Validate_StringLength();
         $oStringLenght->setMin(0);
         $oStringLenght->setMax(50);
         if ($oStringLenght->isValid($sUserName)) {
             $aImageSettings["user_name"] = $sUserName;
         }
         $oStringLenght->setMax(100);
         if ($oStringLenght->isValid($sDescr)) {
             $aImageSettings["descr"] = $sDescr;
         }
         $oModelImage = new Admin_Model_Image();
         if ($oModelImage->saveSettings($nImageId, $aImageSettings)) {
             return true;
         }
     }
     return null;
 }
开发者ID:lstaszak,项目名称:zf_zk_aleph,代码行数:21,代码来源:ImageSettings.php

示例14: validateComment

 /**
  * @param  string $comment
  * @return boolean
  */
 private function validateComment($comment)
 {
     $stringLengthValidator = new StringLengthValidator(array('min' => 0, 'max' => self::MAX_ZIP_COMMENT_LENGTH));
     $stringLengthValidator->setMessage('Build Kommentar zu kurz', StringLengthValidator::TOO_SHORT);
     $stringLengthValidator->setMessage('Build Kommentar zu lang', StringLengthValidator::TOO_LONG);
     if (!$stringLengthValidator->isValid(trim($comment))) {
         $messages = array_values($stringLengthValidator->getMessages());
         $this->addError(new Error('comment', $comment, $messages));
         return false;
     }
     return true;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:16,代码来源:Builder.php

示例15: isValid

 public function isValid($value)
 {
     if (!parent::isValid($value)) {
         return false;
     }
     $validator = new \Zend_Validate_StringLength();
     $validator->setMax(128);
     if (!$validator->isValid($value)) {
         $this->_messages = $validator->getMessages();
         return false;
     }
     return true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:13,代码来源:EmailAddress.php


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