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


PHP Misc::isEmpty方法代码示例

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


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

示例1: validation

 public function validation($value)
 {
     if (!empty($this->options['callback']) && is_array($this->options['callback'])) {
         foreach ($this->options['callback'] as $callback) {
             $value = call_user_func($callback, $value);
         }
     }
     if (!is_array($value)) {
         $value = trim($value);
     }
     if (Misc::isEmpty($value)) {
         if ($this->options['allowEmpty']) {
             return $value;
         } else {
             $this->errors[] = _("This field must be filled-in.");
         }
     } else {
         if ($value === null && $this->options['required']) {
             $this->errors[] = _("This field is required.");
         } else {
             $value = $this->execute($value);
         }
     }
     return $value;
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:25,代码来源:Validate.class.php

示例2: moveTableClasses

 private function moveTableClasses()
 {
     if ($this->getOptionsValue('generate-table') === true) {
         if (!Misc::isEmpty($to = $this->getOptionsValue('table-dir'))) {
             $from = $this->getOptionsValue('models-path');
             $to = $from . '/' . $to;
             $opt = array('suffix' => 'Table' . self::getOptionsValue('suffix'));
             Ftp::moveFiles($from, $to, false, false, $opt);
         }
     }
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:11,代码来源:GenerateModels.class.php

示例3: countCharOccurrence

 static function countCharOccurrence($char, $string)
 {
     if (Misc::isEmpty($char) || Misc::isEmpty($string)) {
         return false;
     }
     $len = self::lenght($string);
     $occ = 0;
     for ($i = 0; $i < $len; ++$i) {
         if ($string[$i] == $char) {
             ++$occ;
         }
     }
     return $occ;
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:14,代码来源:String.class.php

示例4: execute

 protected function execute($value)
 {
     //var_dump($value);
     $true = array('1', 'on', 'true', 'yes');
     $false = array('0', 'off', 'false', 'no');
     if (Misc::isEmpty($value) || in_array($value, $false)) {
         $value = false;
     } else {
         if (in_array($value, $true)) {
             $value = true;
         } else {
             $this->errors[] = _("This field must be a boolean.");
         }
     }
     //var_dump($value);
     return $value;
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:17,代码来源:ValidateBool.class.php

示例5: hasDescription

 public function hasDescription()
 {
     return !Misc::isEmpty($this->description);
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:4,代码来源:Task.class.php

示例6: getDirs

 public static function getDirs($dir, array $except = array('.', '..'))
 {
     if (Misc::isEmpty($dir) || !@($directory = opendir($dir))) {
         return false;
     }
     $dirs = array();
     while ($file = readdir($directory)) {
         if (is_dir($dir . '/' . $file) && !in_array($file, $except)) {
             $dirs[] = $file;
         }
     }
     closedir($directory);
     return $dirs;
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:14,代码来源:Ftp.class.php

示例7: getValue

 public function getValue($protect = false)
 {
     if (is_array($this->value)) {
         if ($protect) {
             return array_map(array('Security', 'noHTML'), $this->value);
         } else {
             return $this->value;
         }
     } else {
         if (!Misc::isEmpty($this->value)) {
             return $protect ? Security::noHTML($this->value) : $this->value;
         } else {
             if ($this->bound && !Misc::isEmpty($this->def_value)) {
                 return $protect ? Security::noHTML($this->def_value) : $this->def_value;
             }
         }
     }
     return '';
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:19,代码来源:FormField.class.php


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