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


PHP Flash::getFlash方法代码示例

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


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

示例1: validate

 private function validate($aLinkCategoryData)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aLinkCategoryData);
     $oFlash->checkForValue('name', 'name_required');
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:7,代码来源:LinkCategoryDetailWidgetModule.php

示例2: renderFrontend

 /**
  * The render method for the login page type. When on a login page type, this is given the login action as determined by the page type. Can be either null (default), 'password_forgotten', or 'password_reset' (or any other string of which a template "$sLoginType_action_$sAction" exists).
  *
  */
 public function renderFrontend($sAction = 'login')
 {
     $aOptions = @unserialize($this->getData());
     $sLoginType = isset($aOptions[self::MODE_SELECT_KEY]) ? $aOptions[self::MODE_SELECT_KEY] : 'login';
     $this->oUser = Session::getSession()->getUser();
     if ($this->oUser) {
         $sAction = 'logout';
     }
     $oTemplate = $this->constructTemplate($sLoginType);
     if ($oTemplate->hasIdentifier('function_template')) {
         $oFunctionTemplate = null;
         try {
             $oFunctionTemplate = $this->constructTemplate("{$sLoginType}_action_{$sAction}");
         } catch (Exception $e) {
             //Fallback to the default function template for the specified action
             $oFunctionTemplate = $this->constructTemplate("login_action_{$sAction}");
         }
         $oTemplate->replaceIdentifier('function_template', $oFunctionTemplate, null, Template::LEAVE_IDENTIFIERS);
     }
     if ($this->oUser && $this->oPage) {
         $oPage = $this->oPage;
         if (Session::getSession()->hasAttribute('login_referrer_page')) {
             $oPage = Session::getSession()->getAttribute('login_referrer_page');
             Session::getSession()->resetAttribute('login_referrer_page');
         }
         if (!$this->oPage->getIsProtected() || Session::getSession()->getUser()->mayViewPage($this->oPage)) {
             $oTemplate->replaceIdentifier('fullname', Session::getSession()->getUser()->getFullName());
             $oTemplate->replaceIdentifier('name', Session::getSession()->getUser()->getUsername());
             $oTemplate->replaceIdentifier('action', LinkUtil::link(FrontendManager::$CURRENT_NAVIGATION_ITEM->getLink(), null, array('logout' => 'true')));
         } else {
             $oFlash = Flash::getFlash();
             $oFlash->addMessage('login.logged_in_no_access');
         }
     }
     $oTemplate->replaceIdentifier('login_title', TranslationPeer::getString($sAction == 'password_forgotten' ? 'wns.login.password_reset' : 'wns.login'));
     $sOrigin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : LinkUtil::linkToSelf();
     $oTemplate->replaceIdentifier('origin', $sOrigin);
     if ($sAction !== 'logout') {
         $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null;
         $sLink = null;
         if ($oLoginPage === null) {
             $sLink = LinkUtil::link('', 'LoginManager');
         } else {
             $sLink = LinkUtil::link($oLoginPage->getFullPathArray());
         }
         $oTemplate->replaceIdentifier('action', $sLink);
     }
     if ($sAction === 'login') {
         $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null;
         $sLink = null;
         if ($oLoginPage === null) {
             $sLink = LinkUtil::link(array(), 'LoginManager', array('password_forgotten' => 'true'));
         } else {
             $sLink = LinkUtil::link($oLoginPage->getFullPathArray(), null, array('password_forgotten' => 'true'));
         }
         $oTemplate->replaceIdentifier('password_forgotten_action', $sLink);
     }
     return $oTemplate;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:63,代码来源:LoginFrontendModule.php

示例3: validate

 public function validate($aDocumentData, $oDocument)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aDocumentData);
     if ($this->iDocumentId === null) {
         $oFlash->addMessage('document.requires_file');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:9,代码来源:DocumentDetailWidgetModule.php

示例4: uploadFile

 public function uploadFile($sFileKey = 'file', $aOptions = null, $bCreateType = false)
 {
     $oFlash = Flash::getFlash();
     $oFlash->checkForFileUpload($sFileKey);
     $oFlash->finishReporting();
     if (!Flash::noErrors()) {
         throw new ValidationException();
     }
     $aFileInfo = $_FILES[$sFileKey];
     if ($aOptions['document_id']) {
         $oDocument = DocumentQuery::create()->findPk($aOptions['document_id']);
     } else {
         $oDocument = new Document();
     }
     if ($oDocument === null) {
         throw new LocalizedException("wns.file_upload.document_not_found");
     }
     $sFileName = $aOptions['name'];
     $aName = explode('.', $sFileName);
     if (count($aName) > 1) {
         array_pop($aName);
     }
     $sFileName = implode('.', $aName);
     $iDocumentTypeId = null;
     try {
         $iDocumentTypeId = $this->accepts($aOptions['name'], $aOptions['type']);
     } catch (Exception $e) {
         if ($bCreateType) {
             $aName = explode('.', $aOptions['name']);
             $sExtension = null;
             if (count($aName) > 1) {
                 $sExtension = array_pop($aName);
             }
             $aMimeType = explode('/', $aOptions['type']);
             if ($sExtension === null) {
                 $sExtension = $aMimeType[1];
             }
             if ($sExtension === null) {
                 throw new LocalizedException("wns.file_upload.unknown_document_type");
             }
             $oDocumentType = new DocumentType();
             $oDocumentType->setExtension($sExtension);
             $oDocumentType->setMimetype(implode('/', $aMimeType));
             $oDocumentType->save();
             $iDocumentTypeId = $oDocumentType->getId();
         } else {
             throw $e;
         }
     }
     $oDocument->setData(fopen($aFileInfo['tmp_name'], "r"));
     $this->updateDocument($oDocument, $aOptions, $sFileName, $iDocumentTypeId);
     $oDocument->save();
     return $oDocument->getId();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:54,代码来源:FileUploadWidgetModule.php

示例5: validate

 private function validate($aSubscriberData, $oSubscriber)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aSubscriberData);
     $oFlash->checkForValue('name', 'name_required');
     $oFlash->checkForEmail('email', 'valid_email');
     if (SubscriberQuery::create()->exclude($oSubscriber)->filterByEmail($aSubscriberData['email'])->count() > 0) {
         $oFlash->addMessage('duplicate_email');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:11,代码来源:SubscriberDetailWidgetModule.php

示例6: validate

 private function validate($aDocumentTypeData, $oType)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aDocumentTypeData);
     if ($oFlash->checkForValue('extension', 'extension_required') & $oFlash->checkForValue('mimetype', 'mimetype_required')) {
         if (($oType->getExtension() !== $aDocumentTypeData['extension'] || $oType->getMimetype() !== $aDocumentTypeData['mimetype']) && DocumentTypeQuery::create()->filterByExtension($aDocumentTypeData['extension'])->filterByMimetype($aDocumentTypeData['mimetype'])->count() > 0) {
             $oFlash->addMessage('document_type_duplicate');
         }
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:11,代码来源:DocumentTypeDetailWidgetModule.php

示例7: validate

 private function validate($aDocumentationPartData)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aDocumentationPartData);
     $oFlash->checkForValue('name', 'documentation_part_name_required');
     $oFlash->checkForValue('documentation_id', 'documentation_required');
     if ($aDocumentationPartData['is_published']) {
         $oFlash->checkForValue('body', 'documentation_part_body_required');
         $oFlash->checkForValue('key', 'key_required');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:plugin-documentation,代码行数:12,代码来源:DocumentationPartDetailWidgetModule.php

示例8: validate

 private function validate($aStringData)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aStringData);
     $oFlash->checkForValue('string_key', 'string.key_required');
     // if string is new, or string_key has changed, then the existence of the string_key has to be checked
     if ($this->sStringId === null || $this->sStringId !== $aStringData['string_key']) {
         if (TranslationQuery::create()->filterByStringKey($aStringData['string_key'])->count() > 0) {
             $oFlash->addMessage('string.key_exists');
         }
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:StringDetailWidgetModule.php

示例9: validate

 private function validate($aLanguageData, $oLanguage)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aLanguageData);
     $oFlash->checkForLength('language_id', 2, 5, 'language_id_required');
     if ($oFlash->checkForValue('path_prefix', 'path_prefix_required')) {
         $oFlash->checkForValue('path_prefix', 'path_prefix_unique');
     }
     if (LanguageQuery::create()->filterByPathPrefix($aLanguageData['path_prefix'])->filterById($aLanguageData['language_id'], Criteria::NOT_EQUAL)->count() > 0) {
         $oFlash->addMessage('path_prefix_unique');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:LanguageDetailWidgetModule.php

示例10: validate

 private function validate($aRoleData, $oRole)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aRoleData);
     if ($oFlash->checkForValue('role_key', 'role_key_required')) {
         if ($oCheckRole = RoleQuery::create()->filterByRoleKey($aRoleData['role_key'])->findOne()) {
             if (!Util::equals($oCheckRole, $oRole)) {
                 $oFlash->addMessage('role_key_exists');
             }
         }
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:RoleDetailWidgetModule.php

示例11: validate

 private function validate($aTagData)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aTagData);
     $oFlash->checkForValue('name', 'tag_name_required');
     $oCriteria = TagQuery::create()->filterByName($aTagData['name']);
     if ($this->iTagId !== null) {
         $oCriteria->exclude($this->iTagId);
     }
     if ($oCriteria->count() > 0) {
         $oFlash->addMessage('tag_name_exists');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:14,代码来源:TagDetailWidgetModule.php

示例12: __construct

 public function __construct($oFlash = null)
 {
     $aParameters = array();
     if ($oFlash === null) {
         $oFlash = Flash::getFlash();
     }
     if (is_array($oFlash)) {
         $aParameters = $oFlash;
     } else {
         $oFlash->finishReporting();
         foreach ($oFlash->getMessages() as $sMessageKey) {
             $aParameters[$sMessageKey] = $oFlash->getMessageProperties($sMessageKey);
         }
     }
     parent::__construct('wns.exception_validation', $aParameters, get_class($this));
 }
开发者ID:rapila,项目名称:cms-base,代码行数:16,代码来源:ValidationException.php

示例13: validate

 private function validate($aDocumentationData, $oDocumentation)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aDocumentationData);
     $oFlash->checkForValue('name', 'name_required');
     $oFlash->checkForValue('key', 'key_required');
     if (!LanguageInputWidgetModule::isMonolingual()) {
         $oDocumentation->setLanguageId($aDocumentationData['language_id']);
         $oFlash->checkForValue('language_id', 'language_required');
     } else {
         $oLanguage = LanguageQuery::create()->findOne();
         $oDocumentation->setLanguageId($oLanguage->getId());
     }
     $oCheckDocumentation = DocumentationQuery::create()->filterByLanguageId($oDocumentation->getLanguageId())->filterByKey($aDocumentationData['key'])->findOne();
     if ($oCheckDocumentation && !Util::equals($oDocumentation, $oCheckDocumentation)) {
         $oFlash->addMessage('documentation_unique_required');
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:plugin-documentation,代码行数:19,代码来源:DocumentationDetailWidgetModule.php

示例14: validate

 private function validate($aUserData, $oUser)
 {
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aUserData);
     $oFlash->checkForValue('username', 'username_required');
     $oFlash->checkForValue('first_name', 'first_name_required');
     $oFlash->checkForValue('last_name', 'last_name_required');
     $oFlash->checkForEmail('email', 'valid_email');
     if ($oUser->isNew() || $aUserData['username'] !== $oUser->getUsername()) {
         $oCheckedUser = UserQuery::create()->filterByUsername($aUserData['username'])->findOne();
         if ($oCheckedUser !== null && $oCheckedUser->getId() !== $oUser->getId()) {
             $oFlash->addMessage('username_exists');
         }
     }
     if ($aUserData['force_password_reset']) {
         // Nothing to validate, pass
     } else {
         if ($aUserData['password'] !== '') {
             if ($oUser->isSessionUser() && $oUser->getPassword() != null) {
                 if ($aUserData['old_password'] == '') {
                     $oFlash->addMessage('old_password_required');
                 } else {
                     if (!PasswordHash::comparePassword($aUserData['old_password'], $oUser->getPassword())) {
                         $oFlash->addMessage('old_password_invalid');
                     }
                 }
             }
             if ($aUserData['password'] !== $aUserData['password_confirm']) {
                 $oFlash->addMessage('password_confirm');
             }
             PasswordHash::checkPasswordValidity($aUserData['password'], $oFlash);
         } else {
             if ($oUser->isNew()) {
                 $oFlash->addMessage('password_new');
             }
         }
     }
     $oFlash->finishReporting();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:39,代码来源:UserDetailWidgetModule.php

示例15: renderFile

 public function renderFile()
 {
     $aCurrentValues = $this->oFormStorage->saveCurrentValuesToSession();
     $oFlash = Flash::getFlash();
     $oFlash->setArrayToCheck($aCurrentValues);
     $bHasCaptcha = false;
     foreach ($this->oFormStorage->getFormObjects() as $oFormObject) {
         if ($oFormObject instanceof CaptchaObject) {
             $bHasCaptcha = true;
         }
         if ($oFormObject->shouldExcludeFromReport()) {
             continue;
         }
         if ($oFormObject->isRequired()) {
             $oFlash->checkForValue($oFormObject->getName());
         }
         $oEmailItemTemplateInstance = clone $this->oEmailItemTemplate;
         $oEmailItemTemplateInstance->replaceIdentifier('name', $oFormObject->getName());
         $oEmailItemTemplateInstance->replaceIdentifier('label', $oFormObject->getLabel());
         $oEmailItemTemplateInstance->replaceIdentifier('value', $oFormObject->getCurrentValue());
         $this->oEmailTemplate->replaceIdentifierMultiple('form_content', $oEmailItemTemplateInstance);
     }
     if ($bHasCaptcha && !FormFrontendModule::validateRecaptchaInput()) {
         $oFlash->addMessage('captcha_code_required');
     }
     $oFlash->finishReporting();
     if (Flash::noErrors()) {
         $oEmail = new EMail(TranslationPeer::getString('wns.form_module.email_subject', null, null, array('page' => $this->sPageName)), $this->oEmailTemplate);
         $oEmail->addRecipient($this->sEmailAddress);
         $oEmail->send();
         $this->oFormStorage->deleteCurrentValuesFromSession();
         LinkUtil::redirect($_REQUEST['origin'] . '?form_success=true');
     } else {
         $oFlash->stick();
         LinkUtil::redirect($_REQUEST['origin']);
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:37,代码来源:FormFileModule.php


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