本文整理汇总了PHP中isempty函数的典型用法代码示例。如果您正苦于以下问题:PHP isempty函数的具体用法?PHP isempty怎么用?PHP isempty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isempty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_message
function output_message($message = "")
{
if (!isempty($message)) {
return "<p class=\"message\">{$message}</p>";
} else {
return "";
}
}
示例2: checkitem
private function checkitem($userdata, $param, $key)
{
if (get_item($userdata, $param) && !isempty($userdata[$param])) {
return 0;
}
$this->set_message(sprintf(lang('account.param.empty'), $param) . '<br />');
return 1;
}
示例3: validateData
public function validateData()
{
if (!is_string($this->AMT)) {
$this->AMT = sprintf("%01.2F", $this->AMT);
}
//echo "MID:";
if (isempty($this->MID)) {
return false;
}
if (strlen($this->MID) > 20) {
return false;
}
//echo "AMT:";
if (strlen((string) $this->AMT) > 13) {
return false;
}
if (strpos(',', (string) $this->AMT) !== false) {
return false;
}
//echo "VS:";
if (isempty($this->VS)) {
return false;
}
if (strlen($this->VS) > 10) {
return false;
}
if (!preg_match('/^[0-9]+$/', $this->VS)) {
return false;
}
//echo "CS:";
if (isempty($this->CS)) {
return false;
}
if (strlen($this->CS) > 4) {
return false;
}
if (!preg_match('/^[0-9]+$/', $this->CS)) {
return false;
}
//echo "RURL:";
if (isempty($this->RURL)) {
return false;
}
if (!preg_match("/^https?://.+\$/i", $this->RURL)) {
return false;
}
if (!isempty($this->SS)) {
//echo "SS:";
if (strlen($this->SS) > 10) {
return false;
}
if (!preg_match('/^[0-9]+$/', $this->SS)) {
return false;
}
}
return true;
}
示例4: validateData
protected function validateData()
{
if (isempty($this->VS)) {
return false;
}
if (!($this->RES == "OK" || $this->RES == "NO")) {
return false;
}
return true;
}
示例5: buildNumberAttributes
function buildNumberAttributes($field)
{
$output = "";
if (!isempty($field["format"]) && $field['format'] == 'value') {
$output .= !isempty($field["min"]) ? ' min="' . $field['min'] . '"' : "";
$output .= !isempty($field["max"]) ? ' max="' . $field['max'] . '"' : "";
$output .= !isempty($field["step"]) ? ' step="' . $field['step'] . '"' : "";
}
return $output;
}
示例6: update_user
public function update_user($user)
{
$password = '';
$args = array(':username' => $user->get_username(), ':email' => $user->get_email(), ':first_name' => $user->get_first_name(), ':last_name' => $user->get_last_name(), ':admin' => $user->get_admin(), ':active' => $user->get_active());
if (!isempty($user->get_password())) {
$args[':password'] = $this->encrypt->encrypt($user->get_password());
$password = ', password = :password';
}
$query = "UPDATE user_data SET\n\t\t\t\temail = :email, first_name = :first_name, last_name = :last_name, admin = :admin, active = :active {$password}\n\t\t\t\tWHERE username = :username";
$update = $this->db->query($query, $args);
return $update;
}
示例7: update
public function update($user)
{
$password = '';
$args = array(':email' => $user->get_email(), ':first_name' => $user->get_first_name(), ':last_name' => $user->get_last_name(), ':admin' => $user->get_admin(), ':status' => $user->get_status(), ':id' => $user->get_id());
if (!isempty($user->get_password())) {
$args[':password'] = $this->encrypt->encrypt($user->get_password());
$password = ', password = :password';
}
$query = "UPDATE user_admin SET\n\t\t\t\temail = :email, first_name = :first_name, last_name = :last_name, admin = :admin, status = :status {$password}\n\t\t\t\tWHERE id = :id";
$update = $this->db->query($query, $args);
return $update;
}
示例8: update_user
public function update_user($user)
{
$password = '';
$args = array(':user_name' => $user->get_user_name(), ':group' => $user->get_user_group(), ':email' => $user->get_user_email(), ':first_name' => $user->get_user_first_name(), ':last_name' => $user->get_user_last_name());
if (!isempty($user->get_user_password())) {
$args[':password'] = $user->get_user_password();
$args[':pwd'] = $this->encrypt->encrypt($user->get_user_password());
$password = ', user_password = encrypt(:password), user_pwd = :pwd';
}
$query = "UPDATE user_info SET\n\t\t\t\tuser_group = :group, user_email = :email, user_first_name = :first_name, user_last_name = :last_name {$password}\n\t\t\t\tWHERE user_name = :user_name";
$update = $this->db->query($query, $args);
return $update;
}
示例9: compare_user_admin
function compare_user_admin($user1, $user2)
{
if (isempty($user1['password'])) {
$user2['password'] = '';
}
if (!isset($user1['admin'])) {
$user1['admin'] = 0;
}
if (!isset($user1['status'])) {
$user1['status'] = 0;
}
return array_merge(array_diff_assoc($user1, $user2), array_diff_assoc($user2, $user1));
}
示例10: GetRedirectUrl
public function GetRedirectUrl()
{
$url = parent::GetRedirectUrl();
$url .= "&CID=" . urlencode($this->CID);
$url .= "&TPAY=" . urlencode($this->TPAY);
if (!isempty($this->TEM)) {
$url .= "&TEM=" . urlencode($this->TEM);
}
if (!isempty($this->TSMS)) {
$url .= "&TSMS={$this->TSMS}";
}
return $url;
}
示例11: process
public function process()
{
if (isempty($_POST['email'])) {
$_SESSION['message'] = lang('login.email.empty');
redirect('login');
} else {
if (isempty($_POST['password'])) {
$_SESSION['message'] = lang('login.password.empty');
redirect('login');
} else {
$this->check_login($_POST['email'], $_POST['password']);
}
}
}
示例12: mysql
function mysql($action, $args = '')
{
if ($action == 'dump') {
$postfix = 'mysqldump';
$io = '>';
} elseif ($action == 'restore') {
$postfix = 'mysql';
$io = '<';
} elseif (isempty($action)) {
$cmd = 'mysql connect 192.168.1.16 2>&1';
$op = `{$cmd}`;
return $op;
}
// $cmd = sprintf('%1s -uaxel_1 -pkakadax -h localhost todos_backbone %2s E:/Sites/php/mysql_backup/file.sql 2>&1', $postfix, $io);
$cmd = sprintf('%1s -uaxel_1 -pkakadax -h localhost todos_backbone %2s /var/www/vhosts/webpremiere.de/mysql_backup/file.sql 2>&1', $postfix, $io);
$op = `{$cmd}`;
return $op;
}
示例13: updateDupeTable
public static function updateDupeTable($formID, $objectID, $data)
{
// trans begin
$result = mfcs::$engine->openDB->transBegin("objects");
if ($result !== TRUE) {
errorHandle::newError(__METHOD__ . "() - unable to start database transactions", errorHandle::DEBUG);
return FALSE;
}
// wipe the old dupe information
$sql = sprintf("DELETE FROM `dupeMatching` WHERE `formID`='%s' AND `objectID`='%s'", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID));
$sqlResult = mfcs::$engine->openDB->query($sql);
if (!$sqlResult['result']) {
mfcs::$engine->openDB->transRollback();
mfcs::$engine->openDB->transEnd();
errorHandle::newError(__METHOD__ . "() - removing from duplicate table: " . $sqlResult['error'], errorHandle::DEBUG);
return FALSE;
}
//insert data
foreach ($data as $name => $raw) {
if (!isset(mfcs::$engine->cleanPost['MYSQL'][$name]) || isempty(mfcs::$engine->cleanPost['MYSQL'][$name])) {
if (!isempty($raw)) {
http::setPost($name, $raw);
$postSet = TRUE;
} else {
continue;
}
}
$sql = sprintf("INSERT INTO `dupeMatching` (`formID`,`objectID`,`field`,`value`) VALUES('%s','%s','%s','%s')", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID), mfcs::$engine->openDB->escape($name), mfcs::$engine->cleanPost['MYSQL'][$name]);
$sqlResult = mfcs::$engine->openDB->query($sql);
if (isset($postSet) && $postSet === TRUE) {
http::setPost($name, "");
}
if (!$sqlResult['result']) {
mfcs::$engine->openDB->transRollback();
mfcs::$engine->openDB->transEnd();
errorHandle::newError(__METHOD__ . "() - : " . $sqlResult['error'], errorHandle::DEBUG);
return FALSE;
}
}
// trans commit
mfcs::$engine->openDB->transCommit();
mfcs::$engine->openDB->transEnd();
return TRUE;
}
示例14: showNew
public static function showNew()
{
$reviews = array_key_exists('reviews', $_SESSION) ? $_SESSION['reviews'] : null;
$base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : "";
echo '<h1>Create a new ClassBash review</h1>';
if (is_null($reviews) || isempty($reviews) || is_null($reviews[0])) {
$review = null;
} else {
$review = $reviews[0];
}
echo '<h1>ClassBash review form</h1>';
echo '<section>';
if (!is_null($review) && $review->getErrors() > 0) {
$errors = $review->getErrors();
foreach ($errors as $key => $value) {
echo $value . "<br>";
}
}
echo '</section><form method="post" action="/' . $base . '/review/new">';
echo 'Reviewer name: <input type="text" name="reviewerName"';
if (!is_null($review)) {
echo 'value = "' . $review->getReviewerName() . '"';
}
echo 'required> <br>';
echo '<br> Submission Id: <input type="text" name="submissionId"';
if (!is_null($review)) {
echo 'value = "' . $review->getSubmissionId() . '"';
}
echo 'required> <br>';
echo '<br> Score: <input type="number" name="score"';
if (!is_null($review)) {
echo 'value = "' . $review->getScore() . '"';
}
echo 'required min="1" max="5"> <br>';
echo '<br> Review:<br>';
echo '<textarea name="review" placeholder="Write your review here"
rows="10" cols="80" required>';
if (!is_null($review)) {
echo $review->getReview();
}
echo '</textarea><br> <br>';
echo '<input type="submit" value="Submit">';
echo '</form></section>';
}
示例15: get
/**
* returns the database object for the project ID. If no projectID is provided,
* returns an array of all the projects, using getProject method defaults
* we need to add caching to this, once caching is moved from EngineCMS to EngineAPI
*
* @author Michael Bond
* @param integer $projectID MySQL ID of the project to get
* @return array
*/
public static function get($projectID = NULL)
{
if (isnull($projectID)) {
return self::getProjects();
}
$sql = sprintf("SELECT * FROM `projects` WHERE `ID`='%s'", mfcs::$engine->openDB->escape($projectID));
$sqlResult = mfcs::$engine->openDB->query($sql);
if (!$sqlResult['result']) {
errorHandle::newError(__METHOD__ . "() - " . $sqlResult['error'], errorHandle::DEBUG);
return FALSE;
}
$project = mysql_fetch_array($sqlResult['result'], MYSQL_ASSOC);
if (!isempty($project['forms']) && ($project['forms'] = decodeFields($project['forms'])) === FALSE) {
return FALSE;
}
if (!isempty($project['groupings']) && ($project['groupings'] = decodeFields($project['groupings'])) === FALSE) {
return FALSE;
}
return $project;
}