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


PHP isEmpty函数代码示例

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


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

示例1: smarty_block_nobr

function smarty_block_nobr($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    echo '<span class="nowrap">' . $content . '</span>';
}
开发者ID:ilivanoff,项目名称:www,代码行数:7,代码来源:block.nobr.php

示例2: finalize

 public static final function finalize(PsLoggerInterface $LOGGER, $CONTENT)
 {
     //Проверим на пустоту
     if (isEmpty($CONTENT)) {
         return $CONTENT;
     }
     $call = ++self::$call;
     //Создадим экземпляр финализатора и вызовем его
     $class = get_called_class();
     $PROFILER = PsProfiler::inst($class);
     $inst = new $class($LOGGER, $PROFILER);
     $PROFILER->start(__FUNCTION__);
     $SECUNDOMER = Secundomer::startedInst();
     $LOGGER->infoBox(">>> CALLED {$call}. {$class}");
     try {
         $CONTENT = $inst->doFinalize($CONTENT);
         $PROFILER->stop();
         $SECUNDOMER->stop();
     } catch (Exception $ex) {
         $PROFILER->stop(false);
         $LOGGER->infoBox("Exception occured while calling {$class}::finalize. Message: " . $ex->getMessage());
         throw $ex;
     }
     $LOGGER->infoBox("<<< CALL {$call}. {$class} FINISHED IN " . $SECUNDOMER->getAverage() . ' seconds');
     return $CONTENT;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:26,代码来源:AbstractPageFinalizer.php

示例3: smarty_block_h5

function smarty_block_h5($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    echo "<h5 class=\"colored\">{$content}</h5>";
}
开发者ID:ilivanoff,项目名称:www,代码行数:7,代码来源:block.h5.php

示例4: Busca

 /**
  * Efetua uma busca complexa a partir dos parâmetros passados
  * @param array $Paranmetros
  * @param int $CurrentPage
  * @param int $PorPagina
  * @param string $OrderBy
  * @return Pagination
  */
 function Busca(array $Paranmetros = null, $CurrentPage = 1, $PorPagina = 10, $OrderBy = 'rand()')
 {
     $Termos = 'WHERE a.status != 99';
     $Places = [];
     if ($Paranmetros) {
         foreach ($Paranmetros as $key => $value) {
             if (!isEmpty($value) and !empty($key)) {
                 switch ($key) {
                     case 'data':
                         $Termos .= " AND ((a.inicio = a.fim  AND a.inicio = '0000-00-00') OR (:data BETWEEN a.inicio AND a.fim))";
                         $Places['data'] = Date::data($value);
                         break;
                     case 'dia':
                         $Termos .= ' AND (a.dias LIKE "%[*]%" OR a.dias LIKE CONCAT("%[",:dia,"]%"))';
                         $Places['dia'] = $value;
                         break;
                     case 'status':
                     case 'ref':
                         $Termos .= " AND a.{$key} = :{$key}";
                         $Places[$key] = $value;
                         break;
                     case 'title':
                         $Termos .= ' AND (a.title CONCAT("%",:title,"%"))';
                         $Places['title'] = $value;
                         break;
                 }
             }
         }
     }
     return $this->ListaPagination("{$Termos} ORDER BY {$OrderBy}", $Places, $CurrentPage, $PorPagina);
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:39,代码来源:BannersModel.class.php

示例5: smarty_block_strike

function smarty_block_strike($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    echo "<span class=\"strike\">{$content}</span>";
}
开发者ID:ilivanoff,项目名称:www,代码行数:7,代码来源:block.strike.php

示例6: validateSession

function validateSession()
{
    //$result = isset($_SESSION['user:id']) && strlen($_SESSION['user:id']) > 0
    //       && isset($_SESSION['user:loggedin']) && $_SESSION['user:loggedin'] > (date('YmdHi') - 30);
    $result = !isEmpty($_SESSION, 'user:id') && !isEmpty($_SESSION, 'user:loggedin') && $_SESSION['user:loggedin'] > date('YmdHi') - 30;
    return $result;
}
开发者ID:hofrichter,项目名称:pdadmin,代码行数:7,代码来源:utilities.incl.php

示例7: getResource

 protected function getResource($info)
 {
     $ret = array();
     $resources = DB::table("hot_resources")->skip((int) $info['base'])->take((int) $info['count'])->get();
     if (!$resources || isEmpty($resources)) {
         return $ret;
     }
     foreach ($resources as $resource) {
         if (Cache::has($resource->name)) {
             $ret[] = Cache::get($resource->name);
         } else {
             $info = array();
             $info['name'] = $resource->name;
             $info['type'] = $resource->type;
             $info['bt_url_720p'] = $resource->bt_url_720p;
             $info['bt_url_1080p'] = $resource->bt_url_1080p;
             $info['bt_url_720p_tc'] = $resource->bt_url_720p_tc;
             $info['bt_url_1080p_tc'] = $resource->bt_url_1080p_tc;
             $info['bt_url_other'] = $resource->bt_url_other;
             $info['netdisk_url'] = $resource->netdisk_url;
             $info['http_url'] = $resource->http_url;
             $info['cover'] = $resource->cover;
             //$this->getResourceinfo($info); TBD
             $ret[] = $info;
         }
     }
     return $ret;
 }
开发者ID:lemin9538,项目名称:laravel,代码行数:28,代码来源:HotDownloadHandler.php

示例8: smarty_block_nl2br

function smarty_block_nl2br($params, $content, Smarty_Internal_Template &$smarty)
{
    if (isEmpty($content)) {
        return;
    }
    echo nl2br(trim($content));
}
开发者ID:ilivanoff,项目名称:www,代码行数:7,代码来源:block.nl2br.php

示例9: getContent

 /**
  * Метод безопасно получает контент.
  * В случае возникновения ошибки возвращает её стек.
  */
 public static function getContent($objOrTpl, $method = 'buildContent')
 {
     $isCallable = is_callable($objOrTpl);
     $isTpl = $objOrTpl instanceof Smarty_Internal_Template;
     if (!$isCallable && !$isTpl) {
         check_condition(is_object($objOrTpl), 'Not object passed to ' . __FUNCTION__);
         PsUtil::assertMethodExists($objOrTpl, $method);
     }
     $returned = null;
     $flushed = null;
     ob_start();
     ob_implicit_flush(false);
     try {
         if ($isCallable) {
             $returned = call_user_func($objOrTpl);
         } else {
             if ($isTpl) {
                 $returned = $objOrTpl->fetch();
             } else {
                 $returned = $objOrTpl->{$method}();
             }
         }
     } catch (Exception $ex) {
         ob_end_clean();
         return ExceptionHandler::getHtml($ex);
     }
     $flushed = ob_get_contents();
     ob_end_clean();
     return isEmpty($returned) ? isEmpty($flushed) ? null : $flushed : $returned;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:34,代码来源:ContentHelper.php

示例10: post

/**
 * Function to handle HTTP-POST-requests.
 * @param Array, $requestData are the requested data
 */
function post(array $requestData)
{
    $logger = Logger::getLogger(basename(__FILE__));
    if (!isEmpty($requestData, 'username') && !isEmpty($requestData, 'password')) {
        sessionDestroy();
        if (__checkPassword('ADMINS', $requestData)) {
            $_SESSION['user:isAdmin'] = true;
        } elseif (__checkPassword('PASSWORDS', $requestData)) {
            $_SESSION['user:isAdmin'] = false;
        } else {
            header(HTTP_VERSION . ' ' . HTTP_401);
            return;
        }
        $_SESSION['user:id'] = $requestData['username'];
        $_SESSION['user:loggedin'] = date('YmdHi');
        session_write_close();
        $responseData = array('session_name' => session_name(), 'session_id' => session_id(), 'username' => $requestData['username']);
        if ($_SESSION['user:isAdmin']) {
            $responseData['isAdmin'] = true;
        }
        $logger->info("Login was successful for  " . $_SESSION['user:id'] . ". Current session: " . session_id());
        header(HTTP_VERSION . ' ' . HTTP_200);
        return $responseData;
    }
    header(HTTP_VERSION . ' ' . HTTP_401);
}
开发者ID:hofrichter,项目名称:pdadmin,代码行数:30,代码来源:login.incl.php

示例11: smarty_block_tooldescr

function smarty_block_tooldescr($params, $content, Smarty_Internal_Template &$template)
{
    if (isEmpty($content)) {
        return;
    }
    $content = trim($content);
    $content = nl2br($content);
    echo "<div class=\"tool_descr\">{$content}</div>";
}
开发者ID:ilivanoff,项目名称:www,代码行数:9,代码来源:block.tooldescr.php

示例12: isFieldsEmpty

function isFieldsEmpty($loginDetails, $errorMsg)
{
    if (isEmpty($loginDetails)) {
        userExists($loginDetails, $errorMsg);
    } else {
        $errorMsg = "Username and/or password fields cannot be left blank";
        errorMessage($errorMsg);
    }
}
开发者ID:azaeng04,项目名称:ip3shoppingcartazatra,代码行数:9,代码来源:validate-user.php

示例13: validateOldPass

 public static function validateOldPass($oldPass)
 {
     if (isEmpty($oldPass)) {
         return 'required';
     }
     if (!PsUser::inst()->checkPassword($oldPass)) {
         return 'remote';
     }
     return false;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:UserInputValidator.php

示例14: min

function min($collection)
{
    if (isEmpty($collection)) {
        return null;
    }
    $min = reduce($collection, function ($min, $value) {
        return \min($min, $value);
    }, +INF);
    return $min;
}
开发者ID:mpetrovich,项目名称:dash,代码行数:10,代码来源:min.php

示例15: max

function max($collection)
{
    if (isEmpty($collection)) {
        return null;
    }
    $max = reduce($collection, function ($max, $value) {
        return \max($max, $value);
    }, -INF);
    return $max;
}
开发者ID:mpetrovich,项目名称:dash,代码行数:10,代码来源:max.php


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