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


PHP Validation::notEmpty方法代码示例

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


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

示例1: testNotEmpty

 /**
  * testNotEmpty method
  *
  * @access public
  * @return void
  */
 function testNotEmpty()
 {
     $this->assertTrue(Validation::notEmpty('abcdefg'));
     $this->assertTrue(Validation::notEmpty('fasdf '));
     $this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
     $this->assertFalse(Validation::notEmpty("\t "));
     $this->assertFalse(Validation::notEmpty(""));
 }
开发者ID:BGCX067,项目名称:fambom-svn-to-git,代码行数:14,代码来源:validation.test.php

示例2: arrayNotEmpty

 public function arrayNotEmpty($check)
 {
     $value = current((array) $check);
     if (!is_array($value)) {
         return Validation::notEmpty($check);
     }
     return !empty($value);
 }
开发者ID:hiromi2424,项目名称:cake_app_base,代码行数:8,代码来源:app_model.php

示例3: notBlank

 /**
  * Custom validation for keeping BC to CakePHP version below 2.7
  *
  * @param array $check
  * @return bool
  */
 public function notBlank($check)
 {
     $value = array_values($check);
     $value = $value[0];
     if (method_exists('Validation', 'notBlank')) {
         return Validation::notBlank($value);
     } else {
         // below 2.7
         return Validation::notEmpty($value);
     }
 }
开发者ID:tnoi,项目名称:tags,代码行数:17,代码来源:Tag.php

示例4: notEmptyForWebApp

 public function notEmptyForWebApp($validationFields = array())
 {
     if (Validation::notEmpty(@$this->data[$this->alias]['type']) && $this->data[$this->alias]['type'] == 'web') {
         foreach ($validationFields as $key => $value) {
             if (!Validation::notEmpty($value)) {
                 return false;
             }
         }
         return true;
     } else {
         return true;
     }
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:13,代码来源:ApiApp.php

示例5: testNotEmptyISO88591AppEncoding

 /**
  * testNotEmptyISO88591Encoding method
  *
  * @return void
  */
 public function testNotEmptyISO88591AppEncoding()
 {
     Configure::write('App.encoding', 'ISO-8859-1');
     $this->assertTrue(Validation::notEmpty('abcdefg'));
     $this->assertTrue(Validation::notEmpty('fasdf '));
     $this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
     $this->assertTrue(Validation::notEmpty('abçďĕʑʘπй'));
     $this->assertTrue(Validation::notEmpty('José'));
     $this->assertTrue(Validation::notEmpty(utf8_decode('José')));
     $this->assertFalse(Validation::notEmpty("\t "));
     $this->assertFalse(Validation::notEmpty(""));
 }
开发者ID:alvaroziqar,项目名称:galei,代码行数:17,代码来源:ValidationTest.php

示例6: buy

 function buy()
 {
     try {
         if ($this->request->is('post')) {
             $store = $this->Store->findByStoreHash($this->data['Item']['store_hash']);
             if (!$store) {
                 throw new Exception('Invalid store hash.');
             }
             $this->Item->id = $this->data['Item']['id'];
             $item_is_active = $this->Item->field('is_active');
             if (!$item_is_active) {
                 throw new Exception('Item is sold out.');
             }
             if (!Validation::email($this->data['Item'][$this->_imap['email']])) {
                 $this->Item->invalidate($this->_imap['email'], __('Invalid email.'));
             }
             if (!Validation::notEmpty($this->data['Item']['message'])) {
                 $this->Item->invalidate('message', __('Cannot be left empty.'));
             }
             if ($this->Item->validates()) {
                 if ($this->Item->Save($this->data)) {
                     $this->Session->setFlash('Item purchased.', 'default', array('class' => 'message success'));
                     $message = array('Message' => array('store_id' => $store['Store']['id'], 'item_id' => $this->Item->id, 'sender_email' => $this->data['Item'][$this->_imap['email']], 'receiver_email' => $store['Store']['email'], 'body' => $this->data['Item']['message']));
                     if ($this->_logged_user) {
                         $message['Message']['sender_id'] = $this->_logged_user['id'];
                         $message['Message']['sender_email'] = $this->_logged_user['email'];
                     }
                     if (isset($store['Store']['user_id'])) {
                         $message['Message']['receiver_id'] = $store['Store']['user_id'];
                     }
                     if ($this->Message->save($message)) {
                         $subject = 'Someone bought your item';
                         $this->Email->send($message['Message']['sender_email'], $store['Store']['email'], $subject, $this->data['Item']['message']);
                     }
                 }
             }
             $this->_processIframeForm($this->Item->validationErrors, $this->data, $this->referer());
         }
     } catch (Exception $e) {
         $this->Session->setFlash($e->getMessage(), 'default', array('class' => 'message error'));
         $this->redirect($this->referer());
         exit;
     }
 }
开发者ID:xstation1021,项目名称:kdkitchen,代码行数:44,代码来源:ItemsController.php

示例7: testInvalidNotEmptyWithSpaces

 /**
  * @testdox notEmpty should return false to blank space string
  */
 public function testInvalidNotEmptyWithSpaces()
 {
     $value = '   ';
     $this->assertFalse(Validation::notEmpty($value));
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:8,代码来源:ValidationTest.php

示例8: add

 function add()
 {
     global $G;
     require CLASS_PATH . "validation.class.php";
     $validate = new Validation();
     uses("trade", "member", "tradefield", "tag");
     $tag = new Tags();
     $offer = $tradefield = new Tradefields();
     $member = new Members();
     $trade = new Trades();
     if (isset($_POST['visit_post'])) {
         capt_check("capt_post_free");
         pb_submit_check('visit_post');
         $_POST['data']['trade']['title'] = pb_lang_merge($_POST['data']['multi']);
         $trade->setParams();
         $tradefield->setParams();
         $if_title_exists = $trade->findByTitle($trade->params['data']['trade']['title']);
         if (!empty($if_title_exists)) {
             $trade->validationErrors[] = L("semilar_offer_post");
         }
         if (!$validate->notEmpty($trade->params['data']['trade']['title'])) {
             $trade->validationErrors[] = L("title_cant_be_empty");
         }
         $trade->params['expire_days'] = $_POST['expire_days'];
         $if_check = $G['setting']['vis_post_check'];
         $msg = null;
         $words = $trade->dbstuff->GetArray("SELECT * FROM {$trade->table_prefix}words");
         if (!empty($words)) {
             foreach ($words as $word_val) {
                 if (!empty($word_val['title'])) {
                     str_replace($word_val['title'], "***", $trade->params['data']['trade']['title']);
                     str_replace($word_val['title'], "***", $trade->params['data']['trade']['content']);
                 }
             }
             $item['forbid_word'] = implode("\r\n", $tmp_str);
         }
         if ($if_check) {
             $trade->params['data']['trade']['status'] = 0;
             $msg = 'pls_wait_for_check';
         } else {
             $trade->params['data']['trade']['status'] = 1;
             $msg = 'success';
         }
         if (!empty($trade->validationErrors)) {
             setvar("item", am($trade->params['data']['trade'], $tradefield->params['data']['tradefield']));
             setvar("Errors", $validate->show($trade));
             render("offer/post");
         } else {
             $trade->params['data']['trade']['industry_id'] = implode(",", $_POST['industry']['id']);
             $trade->params['data']['trade']['area_id'] = implode(",", $_POST['area']['id']);
             $result = $trade->Add();
             if ($result) {
                 flash($msg);
             } else {
                 flash();
             }
         }
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:59,代码来源:offer_controller.php

示例9: notBlank

 /**
  * Shim wrapper for 2.6 to allow 2.7 notBlank validation rule to work already.
  * This is only there to avoid the deprecation errors in 2.6 test runs.
  *
  * @param array $data
  * @return bool
  */
 public function notBlank($data)
 {
     $value = array_shift($data);
     if ((double) Configure::version() < 2.7) {
         return Validation::notEmpty($value);
     }
     return Validation::notBlank($value);
 }
开发者ID:ByMyHandsOnly,项目名称:BMHO_Web,代码行数:15,代码来源:MyModel.php

示例10: L

setvar("PhoneTypes", $typeoption->get_cache_type("phone_type"));
setvar("ImTypes", $typeoption->get_cache_type("im_type"));
$if_visit_post = $_PB_CACHE['setting']['vis_post'];
if (!$if_visit_post) {
    $smarty->flash('visitor_forbid', URL, 0);
}
capt_check("capt_post_free");
if (isset($_POST['visit_post'])) {
    pb_submit_check('visit_post');
    $trade->setParams();
    $tradefield->setParams();
    $if_title_exists = $trade->findByTitle($trade->params['data']['trade']['title']);
    if (!empty($if_title_exists)) {
        $trade->validationErrors[] = L("semilar_offer_post");
    }
    if (!$validate->notEmpty($trade->params['data']['trade']['title'])) {
        $trade->validationErrors[] = L("title_cant_be_empty");
    }
    $trade->params['expire_days'] = $_POST['expire_days'];
    //$trade->params['data']['trade']['tag_ids'] = $tag->setTagId($_POST['data']['tag']);;
    $if_check = $_PB_CACHE['setting']['vis_post_check'];
    $msg = null;
    $words = $pdb->GetArray("SELECT * FROM {$tb_prefix}words");
    if (!empty($words)) {
        foreach ($words as $word_val) {
            if (!empty($word_val['title'])) {
                str_replace($word_val['title'], "***", $trade->params['data']['trade']['title']);
                str_replace($word_val['title'], "***", $trade->params['data']['trade']['content']);
            }
        }
        $item['forbid_word'] = implode("\r\n", $tmp_str);
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:post.php

示例11: formatJson

 /**
  * formatJson
  * jpn: json形式の文字列かどうか
  *
  */
 public function formatJson(Model $model, $field)
 {
     $value = array_shift($field);
     if (!Validation::notEmpty($value)) {
         return true;
     }
     $result = json_decode($value);
     if ($result === null) {
         return false;
     }
     return true;
 }
开发者ID:k1low,项目名称:yav,代码行数:17,代码来源:AdditionalValidationRulesBehavior.php


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