Overview

Namespaces

  • None
  • PHP

Classes

  • Breadcrumb
  • Breadcrumbs
  • CacheFile
  • Comment
  • CommentArray
  • CommentFilter
  • CommentForm
  • CommentList
  • Config
  • Database
  • DatabaseQuery
  • DatabaseQuerySelect
  • DatabaseQuerySelectFulltext
  • DatabaseStopwords
  • Debug
  • Field
  • Fieldgroup
  • Fieldgroups
  • FieldgroupsArray
  • Fields
  • FieldsArray
  • Fieldtype
  • FieldtypeMulti
  • Fieldtypes
  • FileLog
  • FilenameArray
  • Fuel
  • HookEvent
  • ImageSizer
  • Inputfield
  • InputfieldsArray
  • InputfieldWrapper
  • Language
  • LanguageParser
  • Languages
  • LanguagesPageFieldValue
  • LanguageSupportInstall
  • LanguageTranslator
  • Markdown_Parser
  • MarkdownExtra_Parser
  • ModuleJS
  • ModulePlaceholder
  • Modules
  • Notice
  • NoticeError
  • NoticeMessage
  • Notices
  • NullPage
  • Page
  • PageArray
  • Pagefile
  • Pagefiles
  • PagefilesManager
  • PageFinder
  • Pageimage
  • Pageimages
  • PagerNav
  • PagerNavItem
  • Pages
  • PagesAccess
  • PagesSortfields
  • PagesType
  • Paths
  • Permission
  • Permissions
  • Process
  • ProcessController
  • ProcessWire
  • Role
  • Roles
  • Sanitizer
  • Selector
  • SelectorBitwiseAnd
  • SelectorContains
  • SelectorContainsLike
  • SelectorContainsWords
  • SelectorEnds
  • SelectorEqual
  • SelectorGreaterThan
  • SelectorGreaterThanEqual
  • SelectorLessThan
  • SelectorLessThanEqual
  • SelectorNotEqual
  • Selectors
  • SelectorStarts
  • Session
  • SessionCSRF
  • SmartyPants_Parser
  • SmartyPantsTypographer_Parser
  • SystemUpdate1
  • Template
  • TemplateFile
  • Templates
  • TemplatesArray
  • Textformatter
  • Textile
  • User
  • Users
  • Wire
  • WireArray
  • WireData
  • WireInput
  • WireInputData
  • WireSaveableItems
  • WireSaveableItemsLookup
  • WireUpload

Interfaces

  • CommentFormInterface
  • CommentListInterface
  • ConfigurableModule
  • FieldtypeLanguageInterface
  • FieldtypePageTitleCompatible
  • HasLookupItems
  • HasRoles
  • InputfieldHasArrayValue
  • Module
  • Saveable
  • TrackChanges

Exceptions

  • ProcessController404Exception
  • ProcessControllerPermissionException
  • Wire404Exception
  • WireDatabaseException
  • WireException
  • WirePermissionException

Functions

  • __
  • _n
  • _x
  • fuel
  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • ProcessWireClassLoader
  • ProcessWireHostSiteConfig
  • ProcessWireShutdown
  • removeNewlines
  • SmartDashes
  • SmartEllipsis
  • SmartQuotes
  • smarty_modifier_markdown
  • smarty_modifier_smartypants
  • SmartyPants
  • tabIndent
  • unregisterGLOBALS
  • wire
  • wireDecodeJSON
  • wireEncodeJSON
  • wireMkdir
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: 
 3: /**
 4:  * ProcessWire Notices
 5:  *
 6:  * Contains notices/messages used by the application to the user. 
 7:  * 
 8:  * ProcessWire 2.x 
 9:  * Copyright (C) 2010 by Ryan Cramer 
10:  * Licensed under GNU/GPL v2, see LICENSE.TXT
11:  * 
12:  * http://www.processwire.com
13:  * http://www.ryancramer.com
14:  *
15:  */
16: 
17: /**
18:  * Base class that holds a message, source class, and timestamp
19:  *
20:  */
21: abstract class Notice extends WireData {
22: 
23:     /**
24:      * Flag indicates the notice is for when debug mode is on only
25:      *
26:      */
27:     const debug = 2;
28:     const warning = 4; 
29: 
30:     public function __construct($text, $flags = 0) {
31:         $this->set('text', $text); 
32:         $this->set('class', ''); 
33:         $this->set('timestamp', time()); 
34:         $this->set('flags', $flags); 
35:     }
36: }
37: 
38: /**
39:  * A notice that's indicated to be informational
40:  *
41:  */
42: class NoticeMessage extends Notice { }
43: 
44: /**
45:  * A notice that's indicated to be an error
46:  *
47:  */
48: class NoticeError extends Notice { }
49: 
50: /**
51:  * A class to contain multiple Notice instances, whether messages or errors
52:  *
53:  */
54: class Notices extends WireArray {
55:     
56:     public function isValidItem($item) {
57:         return $item instanceof Notice; 
58:     }   
59: 
60:     public function makeBlankItem() {
61:         return new NoticeMessage(''); 
62:     }
63: 
64:     public function add($item) {
65:         if($item->flags & Notice::debug) {
66:             if(!$this->fuel('config')->debug) return $this;
67:         }
68:         return parent::add($item); 
69:     }
70: 
71:     public function hasErrors() {
72:         $numErrors = 0;
73:         foreach($this as $notice) {
74:             if($notice instanceof NoticeError) $numErrors++;
75:         }
76:         return $numErrors > 0;
77:     }
78: }
79: 
ProcessWire API documentation generated by ApiGen 2.6.0