本文整理汇总了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>';
}
示例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;
}
示例3: smarty_block_h5
function smarty_block_h5($params, $content, Smarty_Internal_Template &$smarty)
{
if (isEmpty($content)) {
return;
}
echo "<h5 class=\"colored\">{$content}</h5>";
}
示例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);
}
示例5: smarty_block_strike
function smarty_block_strike($params, $content, Smarty_Internal_Template &$smarty)
{
if (isEmpty($content)) {
return;
}
echo "<span class=\"strike\">{$content}</span>";
}
示例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;
}
示例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;
}
示例8: smarty_block_nl2br
function smarty_block_nl2br($params, $content, Smarty_Internal_Template &$smarty)
{
if (isEmpty($content)) {
return;
}
echo nl2br(trim($content));
}
示例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;
}
示例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);
}
示例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>";
}
示例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);
}
}
示例13: validateOldPass
public static function validateOldPass($oldPass)
{
if (isEmpty($oldPass)) {
return 'required';
}
if (!PsUser::inst()->checkPassword($oldPass)) {
return 'remote';
}
return false;
}
示例14: min
function min($collection)
{
if (isEmpty($collection)) {
return null;
}
$min = reduce($collection, function ($min, $value) {
return \min($min, $value);
}, +INF);
return $min;
}
示例15: max
function max($collection)
{
if (isEmpty($collection)) {
return null;
}
$max = reduce($collection, function ($max, $value) {
return \max($max, $value);
}, -INF);
return $max;
}