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


PHP Alert::hasErrors方法代码示例

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


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

示例1: pass

 public static function pass($key = "")
 {
     return Alert::hasErrors($key) ? false : true;
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:4,代码来源:Validate.php

示例2: validate

 public function validate()
 {
     // Check if the uploaded file is actually an image
     if (!in_array($this->mimeType, $this->allowedMimes)) {
         Alert::error("Image Type", "You may not upload that type of image.", 8);
     }
     // Check the file size of the image
     if ($this->filesize <= 0 or $this->filesize > $this->maxFileSize) {
         Alert::error("Image File Size", "The file size must be smaller than " . $this->maxFileSize . " bytes.", 3);
     }
     // Check the minimum and maximum width of the image
     if ($this->minWidth == $this->maxWidth and $this->width != $this->minWidth) {
         Alert::error("Image Width", "The image must be " . $this->minWidth . " pixels in width.");
     } else {
         if ($this->width < $this->minWidth) {
             Alert::error("Image Width", "The image must be " . $this->minWidth . " pixels or greater in width.");
         } else {
             if ($this->width > $this->maxWidth) {
                 Alert::error("Image Width", "The image must be " . $this->maxWidth . " pixels or less in width.");
             }
         }
     }
     // Check the minimum and maximum height of the image
     if ($this->minHeight == $this->maxHeight and $this->height != $this->minHeight) {
         Alert::error("Image Height", "The image must be " . $this->minHeight . " pixels in height.");
     } else {
         if ($this->height < $this->minHeight) {
             Alert::error("Image Height", "The image must be " . $this->minHeight . " pixels or greater in height.");
         } else {
             if ($this->height > $this->maxHeight) {
                 Alert::error("Image Height", "The image must be " . $this->maxHeight . " pixels or less in height.");
             }
         }
     }
     // Set invalid if there are any errors
     if (Alert::hasErrors()) {
         $this->valid = false;
         return false;
     }
     return true;
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:41,代码来源:Upload_Image.php

示例3: htmlspecialchars

    if (empty($_POST['location'])) {
        $alertClass->addAlert('Kuitin sijainti oli tyhjä', 'error');
    }
    if (empty($_POST['date'])) {
        $alertClass->addAlert('Kuitin päivämäärä oli tyhjä', 'error');
    }
    if (empty($_POST['sum'])) {
        $alertClass->addAlert('Kuitin summa oli tyhjä', 'error');
    }
    if (!is_numeric($_POST['id'])) {
        $alertClass->addAlert('Virheellinen kuitin tunnus', 'error');
    }
    if (!is_float($_POST['sum'])) {
        $alertClass->addAlert('Virheellinen kuitin summa', 'error');
    }
    if ($alertClass->hasErrors()) {
        $alertClass->redirect('/list_receipts.php');
    }
    $receipt = $receiptClass->getReceipt($_POST['id']);
    if ($receipt == null) {
        $alertClass->addAlert('Kuittia ei löytynyt', 'error');
        $alertClass->redirect('/list_receipts.php');
    }
    if ($receipt['userID'] !== $user['id']) {
        $alertClass->addAlert('Sinulla ei ole oikeuksia tähän kuittiin', 'error');
        $alertClass->redirect('/list_receipts.php');
    }
    $receipt->updateReceipt($_POST['id'], htmlspecialchars($_POST['location']), htmlspecialchars($_POST['date']), $_POST['sum']);
    $alertClass->addAlert('Kuitin päivittäminen onnistui!', 'success');
    $alertClass->redirect("/view_receipt.php?id={$_POST['id']}");
}
开发者ID:AntiPaste,项目名称:kuitinseuranta,代码行数:31,代码来源:edit_receipt.php


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