Location: PHPKode > scripts > PAX > pax/config.php
<?php

///////////////////////////////////////////////////////////////////////////////////////////////////
// PREREQUISITES //////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the configuration object
$Prerequisites = new Config();

// set the name of the simpleXML object to check
$Prerequisites->set('simpleXMLModuleName', 'SimpleXML');

// minimal PHP version
$Prerequisites->set('minPHPVersion', '5.2.0');

// XML Parser module name
$Prerequisites->set('xmlParserModuleName', 'xml');



///////////////////////////////////////////////////////////////////////////////////////////////////
// VALIDATIONS ////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the validations object
$Validations = new Config();

// check simpleXML module load status at start-up
$Validations->set("checkSimpleXML", true);

// validate PHP version
$Validations->set("checkPHPVersion", true);

// check the XML Parser module at start-up
$Validations->set("checkXMLParser", true);

// check to see if the model disabled
$Validations->set("checkDisabledModels", true);


///////////////////////////////////////////////////////////////////////////////////////////////////
// DIRECTORIES ////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the directories object
$Directories = new Config();

// get the current directory
$currentDirectory = @getcwd();

// check the current directory
if ($currentDirectory === false)
	$currentDirectory = ".";
	
	
// models directory
$Directories->set("models", $currentDirectory.DIRECTORY_SEPARATOR."models".DIRECTORY_SEPARATOR);	

// namespaces directory
$Directories->set("namespaces", $currentDirectory.DIRECTORY_SEPARATOR."namespaces".DIRECTORY_SEPARATOR);

// name of definitions directory 
$Directories->set("definitions", "definitions");

// implementations directory
$Directories->set("implementations", "implementations");

// libraries directory
$Directories->set("libraries", "libraries");

// extra directory
$Directories->set("extra", "extra");

// clear the memory
unset($currentDirectory);




///////////////////////////////////////////////////////////////////////////////////////////////////
// FILENAMES //////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the filenames object
$Filenames = new Config();

// attributes
$Filenames->set("attributes", "attributes.xml");

// tags XML file name
$Filenames->set("tags", "tags.xml");

// attributes values XML file name
$Filenames->set("attributesValues", "attributesValues.xml");

// node file format in the model directory
// the [CLASS] literal will be replaced with the actually node name
$Filenames->set("modelClassFileFormat", "[CLASS].class.php");

// node file format in the namespace directory
// the [CLASS] literal will be replaced with the actually node name
$Filenames->set("namespaceClassFileFormat", "[CLASS].class.php");

// libraries loader for the model
// this file includes all the libraries needed for the model
$Filenames->set("modelLibrariesLoader", "_addLibraries.php");

// extra loader for the model
// this file includes all the extra classes/functions needed for the model
$Filenames->set("modelExtraLoader", "_addExtra.php");


///////////////////////////////////////////////////////////////////////////////////////////////////
// ELEMENTS CONFIG ////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the elements config
$Elements = new Config();

// the root element for the tags file
$Elements->set("tagsRoot", "tags");

// the root element for the attributes file
$Elements->set("attributesRoot", "attributes");

// the root element for the attributes values file
$Elements->set("attributesValuesRoot", "attributesValues");

// the text that indicates that an attribute for a tag is mandatory
$Elements->set("mandatoryText", "mandatory");

// the text that indicates the default value for an attribute 
$Elements->set("defaultValueText", "defaultValue");

// the namespace url used in attributes files
// using this namespace you can set attributes for nodes in namespaces
$Elements->set("namespaceURL", "http://pax.org/");

// the name of the method in the node implementation that will validate the attribute value
// the [ATTRIBUTE] will be replaced with the name of the attribute
$Elements->set("attrbuteValueValidationMethodName", "validateAttributeValue_[ATTRIBUTE]");

// the name of the method in the node implementation that will validate the tag content
// the [ATTRIBUTE] will be replaced with the name of the attribute
$Elements->set("tagContentValidationMethodName", "validateContent");


// "true" values, used in different contexts
// can be either an array or a single value
// the comparison is done in case sensitive manner
$Elements->set("trueTexts", array("true", "yes", "da", "1"));

// "false" values, used in different contexts
// can be either an array or a single value
// the comparison is done in case sensitive manner
$Elements->set("falseTexts", array("false", "no", "nu", "0"));

// general name of the pax namespace
$Elements->set("paxNs", "paxns");

// separator used in namespace definition
$Elements->set("paxNsSeparator", ":");


///////////////////////////////////////////////////////////////////////////////////////////////////
// PAX CONFIG /////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// init the pax config object
$PAXConfig = new Config();

// set the kinds of the documents that are not allowed to be processed
// the value can be array with the disabled kinds
// or empty array / null to ignore
$PAXConfig->set("disabledModels", NULL);

// flag indicating if should ignore empty attributes file
$PAXConfig->set("allowNoAttributes", false);

// flag indicating if should ignore empty tags file
$PAXConfig->set("allowNoTags", false);

// flag indicating if should ignore empty attributes values file
$PAXConfig->set("allowNoAttributesValues", false);

// XML parser options
$PAXConfig->set("XMLParserOptions", array(XML_OPTION_CASE_FOLDING => 0,  XML_OPTION_SKIP_WHITE => 1));

// root attribute to overwrite the tag filtering
// its value must be in either true or false dictionaries
$PAXConfig->set("filterTagsAttributeName", "filterTags");

// root attribute to overwrite the tag attributes filtering
// its value must be in either true or false dictionaries
$PAXConfig->set("filterAttributesAttributeName", "filterAttributes");

// root attribute to overwrite the tag attributes values filtering
// its value must be in either true or false dictionaries
$PAXConfig->set("filterAttributesValueAttributeName", "filterAttributesValue");

// root attribute to overwrite the tag content filtering
// its value must be in either true or false dictionaries
$PAXConfig->set("filterTagContentAttributeName", "filterTagContent");

// root attribute to overwrite the instructions compilations
// its value must be in either true or false dictionaries
$PAXConfig->set("compileInstructionsAttributeName", "compileInstructions");

// filter the tags
$PAXConfig->set("filterTags", true);

// filter the tags attributes
$PAXConfig->set("filterTagAttributes", true);

// filter the tags attributes values
$PAXConfig->set("filterTagAttributesValues", true);

// filter the tags content
$PAXConfig->set("filterTagContent", true);

// interpret PHP instructions
$PAXConfig->set("compileInstructions", true);



///////////////////////////////////////////////////////////////////////////////////////////////////
// INSTRUCTIONS RELATED ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

$Instructions = new Config();

// instruction start delimiter
$Instructions->set("startDelimiter", "!#");

// instruction end delimiter
$Instructions->set("endDelimiter", "#!");


///////////////////////////////////////////////////////////////////////////////////////////////////
// CUSTOM VARIABLES ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

/*
 * The following variables are already available:
 *  
 * _NODE_NAME_ : the name of the node (like "say")
 * _NODE_TYPE_: the type of the node ("open", "close", "complete")
 * _NODE_LEVEL_: the level of the node
 * _NODE_VALUE_: the content of the node
 * _NODE_IS_ROOT_: 1 or 0 if the node is the root or not
 * _NODE_HAS_ATTRIBUTES_: 1 or 0 if the node has or not attributes
 * _NODE_ATTRIBUTES_COUNT_: the count of the attributes
 * _NODE_ATTRIBUTE_X_ : the value of attribute X
 */
$Variables = new Config();
$Variables->set("_PAX_VERSION_", "6");

?>
Return current item: PAX