Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionFormModel
  • ArrayUtil
  • ArrayValidator
  • AssociatedMediaBehavior
  • AuxLib
  • Changelog
  • DetailView
  • EncryptUtilTmp
  • EventsWidgetFieldFormatter
  • FailedLogins
  • FieldFormatter
  • FieldFormatterBase
  • FieldInputRenderer
  • FileFieldBehavior
  • FiltersForm
  • FilterUtil
  • FineDiff
  • FineDiffCopyOp
  • FineDiffDeleteOp
  • FineDiffInsertOp
  • FineDiffOp
  • FineDiffOps
  • FineDiffReplaceOp
  • GlobalCSSFormModel
  • GlobalImportFormModel
  • GoogleAuthenticator
  • HTML5
  • HTML5TreeConstructer
  • HTMLPurifier
  • HTMLPurifier_Arborize
  • HTMLPurifier_AttrCollections
  • HTMLPurifier_AttrDef
  • HTMLPurifier_AttrDef_Clone
  • HTMLPurifier_AttrDef_CSS
  • HTMLPurifier_AttrDef_CSS_AlphaValue
  • HTMLPurifier_AttrDef_CSS_Background
  • HTMLPurifier_AttrDef_CSS_BackgroundPosition
  • HTMLPurifier_AttrDef_CSS_Border
  • HTMLPurifier_AttrDef_CSS_Color
  • HTMLPurifier_AttrDef_CSS_Composite
  • HTMLPurifier_AttrDef_CSS_DenyElementDecorator
  • HTMLPurifier_AttrDef_CSS_Filter
  • HTMLPurifier_AttrDef_CSS_Font
  • HTMLPurifier_AttrDef_CSS_FontFamily
  • HTMLPurifier_AttrDef_CSS_Ident
  • HTMLPurifier_AttrDef_CSS_ImportantDecorator
  • HTMLPurifier_AttrDef_CSS_Length
  • HTMLPurifier_AttrDef_CSS_ListStyle
  • HTMLPurifier_AttrDef_CSS_Multiple
  • HTMLPurifier_AttrDef_CSS_Number
  • HTMLPurifier_AttrDef_CSS_Percentage
  • HTMLPurifier_AttrDef_CSS_TextDecoration
  • HTMLPurifier_AttrDef_CSS_URI
  • HTMLPurifier_AttrDef_Enum
  • HTMLPurifier_AttrDef_HTML_Bool
  • HTMLPurifier_AttrDef_HTML_Class
  • HTMLPurifier_AttrDef_HTML_Color
  • HTMLPurifier_AttrDef_HTML_FrameTarget
  • HTMLPurifier_AttrDef_HTML_ID
  • HTMLPurifier_AttrDef_HTML_Length
  • HTMLPurifier_AttrDef_HTML_LinkTypes
  • HTMLPurifier_AttrDef_HTML_MultiLength
  • HTMLPurifier_AttrDef_HTML_Nmtokens
  • HTMLPurifier_AttrDef_HTML_Pixels
  • HTMLPurifier_AttrDef_Integer
  • HTMLPurifier_AttrDef_Lang
  • HTMLPurifier_AttrDef_Switch
  • HTMLPurifier_AttrDef_Text
  • HTMLPurifier_AttrDef_URI
  • HTMLPurifier_AttrDef_URI_Email
  • HTMLPurifier_AttrDef_URI_Email_SimpleCheck
  • HTMLPurifier_AttrDef_URI_Host
  • HTMLPurifier_AttrDef_URI_IPv4
  • HTMLPurifier_AttrDef_URI_IPv6
  • HTMLPurifier_AttrTransform
  • HTMLPurifier_AttrTransform_Background
  • HTMLPurifier_AttrTransform_BdoDir
  • HTMLPurifier_AttrTransform_BgColor
  • HTMLPurifier_AttrTransform_BoolToCSS
  • HTMLPurifier_AttrTransform_Border
  • HTMLPurifier_AttrTransform_EnumToCSS
  • HTMLPurifier_AttrTransform_ImgRequired
  • HTMLPurifier_AttrTransform_ImgSpace
  • HTMLPurifier_AttrTransform_Input
  • HTMLPurifier_AttrTransform_Lang
  • HTMLPurifier_AttrTransform_Length
  • HTMLPurifier_AttrTransform_Name
  • HTMLPurifier_AttrTransform_NameSync
  • HTMLPurifier_AttrTransform_Nofollow
  • HTMLPurifier_AttrTransform_SafeEmbed
  • HTMLPurifier_AttrTransform_SafeObject
  • HTMLPurifier_AttrTransform_SafeParam
  • HTMLPurifier_AttrTransform_ScriptRequired
  • HTMLPurifier_AttrTransform_TargetBlank
  • HTMLPurifier_AttrTransform_Textarea
  • HTMLPurifier_AttrTypes
  • HTMLPurifier_AttrValidator
  • HTMLPurifier_Bootstrap
  • HTMLPurifier_ChildDef
  • HTMLPurifier_ChildDef_Chameleon
  • HTMLPurifier_ChildDef_Custom
  • HTMLPurifier_ChildDef_Empty
  • HTMLPurifier_ChildDef_List
  • HTMLPurifier_ChildDef_Optional
  • HTMLPurifier_ChildDef_Required
  • HTMLPurifier_ChildDef_StrictBlockquote
  • HTMLPurifier_ChildDef_Table
  • HTMLPurifier_Config
  • HTMLPurifier_ConfigSchema
  • HTMLPurifier_ConfigSchema_Builder_ConfigSchema
  • HTMLPurifier_ConfigSchema_Builder_Xml
  • HTMLPurifier_ConfigSchema_Interchange
  • HTMLPurifier_ConfigSchema_Interchange_Directive
  • HTMLPurifier_ConfigSchema_Interchange_Id
  • HTMLPurifier_ConfigSchema_InterchangeBuilder
  • HTMLPurifier_ConfigSchema_Validator
  • HTMLPurifier_ConfigSchema_ValidatorAtom
  • HTMLPurifier_ContentSets
  • HTMLPurifier_Context
  • HTMLPurifier_CSSDefinition
  • HTMLPurifier_Definition
  • HTMLPurifier_DefinitionCache
  • HTMLPurifier_DefinitionCache_Decorator
  • HTMLPurifier_DefinitionCache_Decorator_Cleanup
  • HTMLPurifier_DefinitionCache_Decorator_Memory
  • HTMLPurifier_DefinitionCache_Null
  • HTMLPurifier_DefinitionCache_Serializer
  • HTMLPurifier_DefinitionCacheFactory
  • HTMLPurifier_Doctype
  • HTMLPurifier_DoctypeRegistry
  • HTMLPurifier_ElementDef
  • HTMLPurifier_Encoder
  • HTMLPurifier_EntityLookup
  • HTMLPurifier_EntityParser
  • HTMLPurifier_ErrorCollector
  • HTMLPurifier_ErrorStruct
  • HTMLPurifier_Filter
  • HTMLPurifier_Filter_ExtractStyleBlocks
  • HTMLPurifier_Filter_YouTube
  • HTMLPurifier_Generator
  • HTMLPurifier_HTMLDefinition
  • HTMLPurifier_HTMLModule
  • HTMLPurifier_HTMLModule_Bdo
  • HTMLPurifier_HTMLModule_CommonAttributes
  • HTMLPurifier_HTMLModule_Edit
  • HTMLPurifier_HTMLModule_Forms
  • HTMLPurifier_HTMLModule_Hypertext
  • HTMLPurifier_HTMLModule_Iframe
  • HTMLPurifier_HTMLModule_Image
  • HTMLPurifier_HTMLModule_Legacy
  • HTMLPurifier_HTMLModule_List
  • HTMLPurifier_HTMLModule_Name
  • HTMLPurifier_HTMLModule_Nofollow
  • HTMLPurifier_HTMLModule_NonXMLCommonAttributes
  • HTMLPurifier_HTMLModule_Object
  • HTMLPurifier_HTMLModule_Presentation
  • HTMLPurifier_HTMLModule_Proprietary
  • HTMLPurifier_HTMLModule_Ruby
  • HTMLPurifier_HTMLModule_SafeEmbed
  • HTMLPurifier_HTMLModule_SafeObject
  • HTMLPurifier_HTMLModule_SafeScripting
  • HTMLPurifier_HTMLModule_Scripting
  • HTMLPurifier_HTMLModule_StyleAttribute
  • HTMLPurifier_HTMLModule_Tables
  • HTMLPurifier_HTMLModule_Target
  • HTMLPurifier_HTMLModule_TargetBlank
  • HTMLPurifier_HTMLModule_Text
  • HTMLPurifier_HTMLModule_Tidy
  • HTMLPurifier_HTMLModule_Tidy_Name
  • HTMLPurifier_HTMLModule_Tidy_Proprietary
  • HTMLPurifier_HTMLModule_Tidy_Strict
  • HTMLPurifier_HTMLModule_Tidy_Transitional
  • HTMLPurifier_HTMLModule_Tidy_XHTML
  • HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4
  • HTMLPurifier_HTMLModule_XMLCommonAttributes
  • HTMLPurifier_HTMLModuleManager
  • HTMLPurifier_IDAccumulator
  • HTMLPurifier_Injector
  • HTMLPurifier_Injector_AutoParagraph
  • HTMLPurifier_Injector_DisplayLinkURI
  • HTMLPurifier_Injector_Linkify
  • HTMLPurifier_Injector_PurifierLinkify
  • HTMLPurifier_Injector_RemoveEmpty
  • HTMLPurifier_Injector_RemoveSpansWithoutAttributes
  • HTMLPurifier_Injector_SafeObject
  • HTMLPurifier_Language
  • HTMLPurifier_Language_en_x_test
  • HTMLPurifier_LanguageFactory
  • HTMLPurifier_Length
  • HTMLPurifier_Lexer
  • HTMLPurifier_Lexer_DirectLex
  • HTMLPurifier_Lexer_DOMLex
  • HTMLPurifier_Lexer_PH5P
  • HTMLPurifier_Node
  • HTMLPurifier_Node_Comment
  • HTMLPurifier_Node_Element
  • HTMLPurifier_Node_Text
  • HTMLPurifier_PercentEncoder
  • HTMLPurifier_Printer
  • HTMLPurifier_Printer_ConfigForm
  • HTMLPurifier_Printer_ConfigForm_bool
  • HTMLPurifier_Printer_ConfigForm_default
  • HTMLPurifier_Printer_ConfigForm_NullDecorator
  • HTMLPurifier_Printer_CSSDefinition
  • HTMLPurifier_Printer_HTMLDefinition
  • HTMLPurifier_PropertyList
  • HTMLPurifier_PropertyListIterator
  • HTMLPurifier_Queue
  • HTMLPurifier_Strategy
  • HTMLPurifier_Strategy_Composite
  • HTMLPurifier_Strategy_Core
  • HTMLPurifier_Strategy_FixNesting
  • HTMLPurifier_Strategy_MakeWellFormed
  • HTMLPurifier_Strategy_RemoveForeignElements
  • HTMLPurifier_Strategy_ValidateAttributes
  • HTMLPurifier_StringHash
  • HTMLPurifier_StringHashParser
  • HTMLPurifier_TagTransform
  • HTMLPurifier_TagTransform_Font
  • HTMLPurifier_TagTransform_Simple
  • HTMLPurifier_Token
  • HTMLPurifier_Token_Comment
  • HTMLPurifier_Token_Empty
  • HTMLPurifier_Token_End
  • HTMLPurifier_Token_Start
  • HTMLPurifier_Token_Tag
  • HTMLPurifier_Token_Text
  • HTMLPurifier_TokenFactory
  • HTMLPurifier_UnitConverter
  • HTMLPurifier_URI
  • HTMLPurifier_URIDefinition
  • HTMLPurifier_URIFilter
  • HTMLPurifier_URIFilter_DisableExternal
  • HTMLPurifier_URIFilter_DisableExternalResources
  • HTMLPurifier_URIFilter_DisableResources
  • HTMLPurifier_URIFilter_HostBlacklist
  • HTMLPurifier_URIFilter_MakeAbsolute
  • HTMLPurifier_URIFilter_Munge
  • HTMLPurifier_URIFilter_SafeIframe
  • HTMLPurifier_URIParser
  • HTMLPurifier_URIScheme
  • HTMLPurifier_URIScheme_data
  • HTMLPurifier_URIScheme_file
  • HTMLPurifier_URIScheme_ftp
  • HTMLPurifier_URIScheme_http
  • HTMLPurifier_URIScheme_https
  • HTMLPurifier_URIScheme_mailto
  • HTMLPurifier_URIScheme_news
  • HTMLPurifier_URIScheme_nntp
  • HTMLPurifier_URISchemeRegistry
  • HTMLPurifier_VarParser
  • HTMLPurifier_VarParser_Flexible
  • HTMLPurifier_VarParser_Native
  • HTMLPurifier_Zipper
  • JSONFieldsBehavior
  • JSONResponse
  • Markdown_Parser
  • MarkdownExtra_Parser
  • MediaFieldFormatter
  • MediaSelector
  • MobileActiveRecordFieldFormatter
  • MobileActivityFeed
  • MobileChartDashboard
  • MobileFieldFormatter
  • MobileFieldInputRenderer
  • ModuleModelNameValidator
  • MultiChildNode
  • MultiTypeAutocomplete
  • PasswordUtil
  • ProductFeature
  • ProfileWidgetLayout
  • QueryParamGenerator
  • RecordLimitBehavior
  • RecordView
  • RecordViewWidgetLayout
  • RelationshipsGridModel
  • RelationshipsJoin
  • RepairUserDataCommand
  • RequestUtil
  • RequiredIfNotSetValidator
  • ResponseUtil
  • RunMigrationScriptCommand
  • ServiceWebFormDesigner
  • Settings
  • StringUtil
  • TestEmailAction
  • TestEmailActionForm
  • ThemeGenerator
  • TimerUtil
  • TopicsFieldFormatter
  • TopicsWidgetLayout
  • TransactionalViewFieldFormatter
  • UrlUtil
  • ValidLinkValidator
  • WebFormDesigner
  • WebLeadFormDesigner
  • X2ActiveRecordBehavior
  • X2ActiveRecordFieldFormatter
  • X2ButtonColumn
  • X2ConditionList
  • X2ConsoleCommand
  • X2ControllerBehavior
  • X2DataColumn
  • X2DuplicateBehavior
  • X2Flashes
  • X2GridViewFieldFormatter
  • X2IPAddress
  • X2LeadsDataColumn
  • X2MergeableBehavior
  • X2MessageSource
  • X2MobileControllerBehavior
  • X2MobileProfileControllerBehavior
  • X2MobileQuotesControllerBehavior
  • X2MobileSiteControllerBehavior
  • X2MobileTopicsControllerBehavior
  • X2ModelConversionBehavior
  • X2ModelConversionWidget
  • X2ModelForeignKeyValidator
  • X2ModelUniqueIndexValidator
  • X2NonWebUser
  • X2StaticDropdown
  • X2StaticField
  • X2StaticFieldsBehavior
  • X2UrlManager
  • X2Validator
  • X2WidgetBehavior

Interfaces

  • AdminOwnedCredentials

Exceptions

  • CampaignMailingException
  • CodeExchangeException
  • GetCredentialsException
  • HTMLPurifier_ConfigSchema_Exception
  • HTMLPurifier_Exception
  • HTMLPurifier_VarParserException
  • Net_IDNA2_Exception
  • Net_IDNA2_Exception_Nameprep
  • NoRefreshTokenException
  • NoUserIdException
  • StringUtilException

Functions

  • checkCurrency
  • checkDNS
  • checkServerVar
  • checkTimezone
  • decodeQuotes
  • echoIcons
  • encodeQuotes
  • exceptionForError
  • getField
  • getLanguageName
  • getModuleTitle
  • handleReqError
  • handleReqException
  • htmlpurifier_filter_extractstyleblocks_muteerrorhandler
  • installer_t
  • installer_tr
  • isAllowedDir
  • mediaMigrationRrmdir
  • migrateMediaDir
  • printGraph
  • printR
  • renderFields
  • reqShutdown
  • RIP
  • translateOptions
  • tryGetRemote
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Performs validations on HTMLPurifier_ConfigSchema_Interchange
  5:  *
  6:  * @note If you see '// handled by InterchangeBuilder', that means a
  7:  *       design decision in that class would prevent this validation from
  8:  *       ever being necessary. We have them anyway, however, for
  9:  *       redundancy.
 10:  */
 11: class HTMLPurifier_ConfigSchema_Validator
 12: {
 13: 
 14:     /**
 15:      * @type HTMLPurifier_ConfigSchema_Interchange
 16:      */
 17:     protected $interchange;
 18: 
 19:     /**
 20:      * @type array
 21:      */
 22:     protected $aliases;
 23: 
 24:     /**
 25:      * Context-stack to provide easy to read error messages.
 26:      * @type array
 27:      */
 28:     protected $context = array();
 29: 
 30:     /**
 31:      * to test default's type.
 32:      * @type HTMLPurifier_VarParser
 33:      */
 34:     protected $parser;
 35: 
 36:     public function __construct()
 37:     {
 38:         $this->parser = new HTMLPurifier_VarParser();
 39:     }
 40: 
 41:     /**
 42:      * Validates a fully-formed interchange object.
 43:      * @param HTMLPurifier_ConfigSchema_Interchange $interchange
 44:      * @return bool
 45:      */
 46:     public function validate($interchange)
 47:     {
 48:         $this->interchange = $interchange;
 49:         $this->aliases = array();
 50:         // PHP is a bit lax with integer <=> string conversions in
 51:         // arrays, so we don't use the identical !== comparison
 52:         foreach ($interchange->directives as $i => $directive) {
 53:             $id = $directive->id->toString();
 54:             if ($i != $id) {
 55:                 $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
 56:             }
 57:             $this->validateDirective($directive);
 58:         }
 59:         return true;
 60:     }
 61: 
 62:     /**
 63:      * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
 64:      * @param HTMLPurifier_ConfigSchema_Interchange_Id $id
 65:      */
 66:     public function validateId($id)
 67:     {
 68:         $id_string = $id->toString();
 69:         $this->context[] = "id '$id_string'";
 70:         if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
 71:             // handled by InterchangeBuilder
 72:             $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
 73:         }
 74:         // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
 75:         // we probably should check that it has at least one namespace
 76:         $this->with($id, 'key')
 77:             ->assertNotEmpty()
 78:             ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
 79:         array_pop($this->context);
 80:     }
 81: 
 82:     /**
 83:      * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
 84:      * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
 85:      */
 86:     public function validateDirective($d)
 87:     {
 88:         $id = $d->id->toString();
 89:         $this->context[] = "directive '$id'";
 90:         $this->validateId($d->id);
 91: 
 92:         $this->with($d, 'description')
 93:             ->assertNotEmpty();
 94: 
 95:         // BEGIN - handled by InterchangeBuilder
 96:         $this->with($d, 'type')
 97:             ->assertNotEmpty();
 98:         $this->with($d, 'typeAllowsNull')
 99:             ->assertIsBool();
100:         try {
101:             // This also tests validity of $d->type
102:             $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
103:         } catch (HTMLPurifier_VarParserException $e) {
104:             $this->error('default', 'had error: ' . $e->getMessage());
105:         }
106:         // END - handled by InterchangeBuilder
107: 
108:         if (!is_null($d->allowed) || !empty($d->valueAliases)) {
109:             // allowed and valueAliases require that we be dealing with
110:             // strings, so check for that early.
111:             $d_int = HTMLPurifier_VarParser::$types[$d->type];
112:             if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
113:                 $this->error('type', 'must be a string type when used with allowed or value aliases');
114:             }
115:         }
116: 
117:         $this->validateDirectiveAllowed($d);
118:         $this->validateDirectiveValueAliases($d);
119:         $this->validateDirectiveAliases($d);
120: 
121:         array_pop($this->context);
122:     }
123: 
124:     /**
125:      * Extra validation if $allowed member variable of
126:      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
127:      * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
128:      */
129:     public function validateDirectiveAllowed($d)
130:     {
131:         if (is_null($d->allowed)) {
132:             return;
133:         }
134:         $this->with($d, 'allowed')
135:             ->assertNotEmpty()
136:             ->assertIsLookup(); // handled by InterchangeBuilder
137:         if (is_string($d->default) && !isset($d->allowed[$d->default])) {
138:             $this->error('default', 'must be an allowed value');
139:         }
140:         $this->context[] = 'allowed';
141:         foreach ($d->allowed as $val => $x) {
142:             if (!is_string($val)) {
143:                 $this->error("value $val", 'must be a string');
144:             }
145:         }
146:         array_pop($this->context);
147:     }
148: 
149:     /**
150:      * Extra validation if $valueAliases member variable of
151:      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
152:      * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
153:      */
154:     public function validateDirectiveValueAliases($d)
155:     {
156:         if (is_null($d->valueAliases)) {
157:             return;
158:         }
159:         $this->with($d, 'valueAliases')
160:             ->assertIsArray(); // handled by InterchangeBuilder
161:         $this->context[] = 'valueAliases';
162:         foreach ($d->valueAliases as $alias => $real) {
163:             if (!is_string($alias)) {
164:                 $this->error("alias $alias", 'must be a string');
165:             }
166:             if (!is_string($real)) {
167:                 $this->error("alias target $real from alias '$alias'", 'must be a string');
168:             }
169:             if ($alias === $real) {
170:                 $this->error("alias '$alias'", "must not be an alias to itself");
171:             }
172:         }
173:         if (!is_null($d->allowed)) {
174:             foreach ($d->valueAliases as $alias => $real) {
175:                 if (isset($d->allowed[$alias])) {
176:                     $this->error("alias '$alias'", 'must not be an allowed value');
177:                 } elseif (!isset($d->allowed[$real])) {
178:                     $this->error("alias '$alias'", 'must be an alias to an allowed value');
179:                 }
180:             }
181:         }
182:         array_pop($this->context);
183:     }
184: 
185:     /**
186:      * Extra validation if $aliases member variable of
187:      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
188:      * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
189:      */
190:     public function validateDirectiveAliases($d)
191:     {
192:         $this->with($d, 'aliases')
193:             ->assertIsArray(); // handled by InterchangeBuilder
194:         $this->context[] = 'aliases';
195:         foreach ($d->aliases as $alias) {
196:             $this->validateId($alias);
197:             $s = $alias->toString();
198:             if (isset($this->interchange->directives[$s])) {
199:                 $this->error("alias '$s'", 'collides with another directive');
200:             }
201:             if (isset($this->aliases[$s])) {
202:                 $other_directive = $this->aliases[$s];
203:                 $this->error("alias '$s'", "collides with alias for directive '$other_directive'");
204:             }
205:             $this->aliases[$s] = $d->id->toString();
206:         }
207:         array_pop($this->context);
208:     }
209: 
210:     // protected helper functions
211: 
212:     /**
213:      * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
214:      * for validating simple member variables of objects.
215:      * @param $obj
216:      * @param $member
217:      * @return HTMLPurifier_ConfigSchema_ValidatorAtom
218:      */
219:     protected function with($obj, $member)
220:     {
221:         return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
222:     }
223: 
224:     /**
225:      * Emits an error, providing helpful context.
226:      * @throws HTMLPurifier_ConfigSchema_Exception
227:      */
228:     protected function error($target, $msg)
229:     {
230:         if ($target !== false) {
231:             $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext();
232:         } else {
233:             $prefix = ucfirst($this->getFormattedContext());
234:         }
235:         throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
236:     }
237: 
238:     /**
239:      * Returns a formatted context string.
240:      * @return string
241:      */
242:     protected function getFormattedContext()
243:     {
244:         return implode(' in ', array_reverse($this->context));
245:     }
246: }
247: 
248: // vim: et sw=4 sts=4
249: 
API documentation generated by ApiGen 2.8.0