From: Roland Häder Date: Wed, 31 Aug 2011 19:27:22 +0000 (+0000) Subject: Some cleanups, more usage of ObjectFactory: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3e1fbf30a631cf1cd64562b69228452c49e0033f;p=core.git Some cleanups, more usage of ObjectFactory: - Used more ObjectFactory to instance a new class (in local file database) - The class LocalFileDatabase and CompressorChannel can now be instanced without any paramters - Renamed 'null' to 'NULL' --- diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php index c5ccc0ae..e32bdefb 100644 --- a/inc/classes/exceptions/class_FrameworkException.php +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -172,7 +172,7 @@ abstract class FrameworkException extends ReflectionException { * @param $code Integer code to encode in hex * @return $hexCode The exception code in hex-decimal format */ - public final function getHexCode ($code = null) { + public final function getHexCode ($code = NULL) { // Get the decimal code if (is_null($code)) $code = $this->getCode(); diff --git a/inc/classes/interfaces/crypto/class_Cryptable.php b/inc/classes/interfaces/crypto/class_Cryptable.php index 613f5057..14533c3d 100644 --- a/inc/classes/interfaces/crypto/class_Cryptable.php +++ b/inc/classes/interfaces/crypto/class_Cryptable.php @@ -41,7 +41,7 @@ interface Cryptable extends FrameworkInterface { * @param $key Optional key, if none provided, a random key will be generated * @return $encrypted Encrypted string */ - function encryptString ($str, $key = null); + function encryptString ($str, $key = NULL); /** * Decrypt the string with fixed salt diff --git a/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php b/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php index d40e1915..d4256fe0 100644 --- a/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php +++ b/inc/classes/interfaces/streams/crypto/class_EncryptableStream.php @@ -29,7 +29,7 @@ interface EncryptableStream extends Streamable { * @param $key Optional key, if none provided, a random key will be generated * @return $encrypted Encrypted string */ - function encryptStream ($str, $key = null); + function encryptStream ($str, $key = NULL); /** * Decrypt the string with fixed salt diff --git a/inc/classes/interfaces/template/class_CompileableTemplate.php b/inc/classes/interfaces/template/class_CompileableTemplate.php index ebef14a1..e1070c9d 100644 --- a/inc/classes/interfaces/template/class_CompileableTemplate.php +++ b/inc/classes/interfaces/template/class_CompileableTemplate.php @@ -149,7 +149,7 @@ interface CompileableTemplate extends FrameworkInterface { * @return void * @throws XmlParserException If an XML error was found */ - function renderXmlContent ($content = null); + function renderXmlContent ($content = NULL); /** * Enables or disables language support diff --git a/inc/classes/interfaces/template/view/class_ViewHelper.php b/inc/classes/interfaces/template/view/class_ViewHelper.php index 8b7b6fa5..7278a0f6 100644 --- a/inc/classes/interfaces/template/view/class_ViewHelper.php +++ b/inc/classes/interfaces/template/view/class_ViewHelper.php @@ -28,7 +28,7 @@ interface ViewHelper extends FrameworkInterface { * @param $args Arguments to send to the view helper * @return mixed Unknown return arguments, or void */ - function execute (array $args = null); + function execute (array $args = NULL); } // [EOF] diff --git a/inc/classes/main/cache/class_MemoryCache.php b/inc/classes/main/cache/class_MemoryCache.php index d7d78864..a38a65ba 100644 --- a/inc/classes/main/cache/class_MemoryCache.php +++ b/inc/classes/main/cache/class_MemoryCache.php @@ -25,7 +25,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { /** * The "memory cache" is simply a wrapped object array */ - private $dataCache = null; + private $dataCache = NULL; /** * Protected constructor @@ -93,7 +93,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { */ public final function offsetGet ($offset) { // Default is offset not found - $data = null; + $data = NULL; // Is the offset there? if ($this->offsetExists($offset)) { diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index fef51b5e..f9474ca7 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -26,137 +26,137 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Instance of a request class */ - private $requestInstance = null; + private $requestInstance = NULL; /** * Instance of a response class */ - private $responseInstance = null; + private $responseInstance = NULL; /** * Search criteria instance */ - private $searchInstance = null; + private $searchInstance = NULL; /** * Update criteria instance */ - private $updateInstance = null; + private $updateInstance = NULL; /** * The file I/O instance for the template loader */ - private $fileIoInstance = null; + private $fileIoInstance = NULL; /** * Resolver instance */ - private $resolverInstance = null; + private $resolverInstance = NULL; /** * Template engine instance */ - private $templateInstance = null; + private $templateInstance = NULL; /** * Database result instance */ - private $resultInstance = null; + private $resultInstance = NULL; /** * Instance for user class */ - private $userInstance = null; + private $userInstance = NULL; /** * A controller instance */ - private $controllerInstance = null; + private $controllerInstance = NULL; /** * Instance of a RNG */ - private $rngInstance = null; + private $rngInstance = NULL; /** * Instance of a crypto helper */ - private $cryptoInstance = null; + private $cryptoInstance = NULL; /** * Instance of an Iterator class */ - private $iteratorInstance = null; + private $iteratorInstance = NULL; /** * Instance of the list */ - private $listInstance = null; + private $listInstance = NULL; /** * Instance of a menu */ - private $menuInstance = null; + private $menuInstance = NULL; /** * Instance of the image */ - private $imageInstance = null; + private $imageInstance = NULL; /** * Instance of the stacker */ - private $stackerInstance = null; + private $stackerInstance = NULL; /** * A Compressor instance */ - private $compressorInstance = null; + private $compressorInstance = NULL; /** * A Parseable instance */ - private $parserInstance = null; + private $parserInstance = NULL; /** * A ProtocolHandler instance */ - private $protocolInstance = null; + private $protocolInstance = NULL; /** * A database wrapper instance */ - private $databaseInstance = null; + private $databaseInstance = NULL; /** * A helper instance for the form */ - private $helperInstance = null; + private $helperInstance = NULL; /** * An instance of a Sourceable class */ - private $sourceInstance = null; + private $sourceInstance = NULL; /** * An instance of a InputStreamable class */ - private $inputStreamInstance = null; + private $inputStreamInstance = NULL; /** * An instance of a OutputStreamable class */ - private $outputStreamInstance = null; + private $outputStreamInstance = NULL; /** * Networkable handler instance */ - private $handlerInstance = null; + private $handlerInstance = NULL; /** * Visitor handler instance */ - private $visitorInstance = null; + private $visitorInstance = NULL; /** * The real class name @@ -166,7 +166,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * An instance of a database wrapper class */ - private $wrapperInstance = null; + private $wrapperInstance = NULL; /** * Thousands seperator @@ -589,24 +589,24 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Setter for database instance * - * @param $dbInstance The instance for the database connection (forced DatabaseConnection) + * @param $databaseInstance The instance for the database connection (forced DatabaseConnection) * @return void */ - public final function setDatabaseInstance (DatabaseConnection $dbInstance) { - Registry::getRegistry()->addInstance('db_instance', $dbInstance); + public final function setDatabaseInstance (DatabaseConnection $databaseInstance) { + Registry::getRegistry()->addInstance('db_instance', $databaseInstance); } /** * Getter for database layer * - * @return $dbInstance The database layer instance + * @return $databaseInstance The database layer instance */ public final function getDatabaseInstance () { // Get instance - $dbInstance = Registry::getRegistry()->getInstance('db_instance'); + $databaseInstance = Registry::getRegistry()->getInstance('db_instance'); // Return instance - return $dbInstance; + return $databaseInstance; } /** @@ -826,7 +826,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @throws NullPointerException If the discovered application * instance is still null */ - protected function prepareTemplateInstance (ManageableApplication $applicationInstance = null) { + protected function prepareTemplateInstance (ManageableApplication $applicationInstance = NULL) { // Is the application instance set? if (is_null($applicationInstance)) { // Get the current instance @@ -1170,7 +1170,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public final function getField ($fieldName) { // Default field value - $fieldValue = null; + $fieldValue = NULL; // Get result instance $resultInstance = $this->getResultInstance(); diff --git a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php index 54aa15b6..5720d535 100644 --- a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php +++ b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php @@ -160,7 +160,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Default is no action - $actionInstance = null; + $actionInstance = NULL; // Get registry $registryInstance = Registry::getRegistry(); diff --git a/inc/classes/main/compressor/class_Bzip2Compressor.php b/inc/classes/main/compressor/class_Bzip2Compressor.php index 1b3824f8..55ab63a9 100644 --- a/inc/classes/main/compressor/class_Bzip2Compressor.php +++ b/inc/classes/main/compressor/class_Bzip2Compressor.php @@ -39,7 +39,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { */ public static final function createBzip2Compressor () { // Routines not found by default - $compressorInstance = null; + $compressorInstance = NULL; // Get new instance if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { diff --git a/inc/classes/main/compressor/class_GzipCompressor.php b/inc/classes/main/compressor/class_GzipCompressor.php index f69f4260..000fc844 100644 --- a/inc/classes/main/compressor/class_GzipCompressor.php +++ b/inc/classes/main/compressor/class_GzipCompressor.php @@ -39,7 +39,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { */ public static final function createGzipCompressor () { // Routines not found by default - $compressorInstance = null; + $compressorInstance = NULL; // Get new instance if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { diff --git a/inc/classes/main/criteria/search/class_SearchCriteria.php b/inc/classes/main/criteria/search/class_SearchCriteria.php index c85d2441..9692b713 100644 --- a/inc/classes/main/criteria/search/class_SearchCriteria.php +++ b/inc/classes/main/criteria/search/class_SearchCriteria.php @@ -174,7 +174,7 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { */ public function getCriteriaElemnent ($criteria) { // Default is not found - $value = null; + $value = NULL; // Is the criteria there? if (isset($this->searchCriteria[$criteria])) { diff --git a/inc/classes/main/crypto/class_CryptoHelper.php b/inc/classes/main/crypto/class_CryptoHelper.php index f377a575..0c626bba 100644 --- a/inc/classes/main/crypto/class_CryptoHelper.php +++ b/inc/classes/main/crypto/class_CryptoHelper.php @@ -29,12 +29,12 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { /** * An instance of this own clas */ - private static $selfInstance = null; + private static $selfInstance = NULL; /** * Instance of the crypto stream */ - private $cryptoStreamInstance = null; + private $cryptoStreamInstance = NULL; /** * Salt for hashing operations @@ -177,7 +177,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { * @param $key Optional key, if none provided, a random key will be generated * @return $encrypted Encrypted string */ - public function encryptString ($str, $key = null) { + public function encryptString ($str, $key = NULL) { // Encrypt the string through the stream $encrypted = $this->cryptoStreamInstance->encryptStream($str, $key); diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php index f55aafbb..2001a11f 100644 --- a/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -29,7 +29,7 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab /** * The limiter instance */ - private $limitInstance = null; + private $limitInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/database/class_BaseDatabaseWrapper.php b/inc/classes/main/database/class_BaseDatabaseWrapper.php index 5096bb6e..76d486e2 100644 --- a/inc/classes/main/database/class_BaseDatabaseWrapper.php +++ b/inc/classes/main/database/class_BaseDatabaseWrapper.php @@ -25,7 +25,7 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { /** * Cache instance */ - private $cacheInstance = null; + private $cacheInstance = NULL; /** * Current table name to use diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 407aa0d7..083729ef 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -32,11 +32,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend // Status results const RESULT_OKAY = 'ok'; - /** - * Save path for "file database" - */ - private $savePath = ''; - /** * The file's extension */ @@ -65,7 +60,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend /** * Last exception */ - private $lastException = null; + private $lastException = NULL; /** * Table information array @@ -89,24 +84,20 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend } /** - * Create an object of LocalFileDatabase and set the save path for local files. - * This method also validates the given file path. + * Create an object of LocalFileDatabase and set the save path from + * configuration for local files. * - * @param $savePath The local file path string - * @return $dbInstance An instance of LocalFileDatabase + * @return $databaseInstance An instance of LocalFileDatabase */ - public static final function createLocalFileDatabase ($savePath) { + public static final function createLocalFileDatabase () { // Get an instance $databaseInstance = new LocalFileDatabase(); - // Set save path and IO instance - $databaseInstance->setSavePath($savePath); + // Get a new compressor channel instance + $compressorInstance = ObjectFactory::createObjectByConfiguredName('compressor_channel_class'); // Set the compressor channel - $databaseInstance->setCompressorChannel(CompressorChannel::createCompressorChannel( - $databaseInstance->getConfigInstance()->getConfigEntry('base_path'). - $databaseInstance->getConfigInstance()->getConfigEntry('compressor_base_path') - )); + $databaseInstance->setCompressorChannel($compressorInstance); // "Connect" to the database $databaseInstance->connectToDatabase(); @@ -115,26 +106,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend return $databaseInstance; } - /** - * Setter for save path - * - * @param $savePath The local save path where we shall put our serialized classes - * @return void - */ - public final function setSavePath ($savePath) { - // Set save path - $this->savePath = (string) $savePath; - } - - /** - * Getter for save path - * - * @return $savePath The local save path where we shall put our serialized classes - */ - public final function getSavePath () { - return $this->savePath; - } - /** * Getter for last error message * @@ -172,7 +143,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend */ private final function resetLastError () { $this->lastError = ''; - $this->lastException = null; + $this->lastException = NULL; } /** @@ -303,7 +274,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend */ private function generateFqfnFromDataSet (Criteria $dataSetInstance, $rowName) { // This is the FQFN - $fqfn = $this->getSavePath() . $dataSetInstance->getTableName() . '/' . $rowName . '.' . $this->getFileExtension(); + $fqfn = $this->getConfigInstance()->getConfigEntry('local_db_path') . $dataSetInstance->getTableName() . '/' . $rowName . '.' . $this->getFileExtension(); // Return it return $fqfn; @@ -375,10 +346,10 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend */ public function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance) { // The result is null by any errors - $resultData = null; + $resultData = NULL; // Create full path name - $pathName = $this->getSavePath() . $tableName . '/'; + $pathName = $this->getConfigInstance()->getConfigEntry('local_db_path') . $tableName . '/'; // A 'select' query is not that easy on local files, so first try to // find the 'table' which is in fact a directory on the server @@ -511,7 +482,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend */ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) { // Create full path name - $pathName = $this->getSavePath() . $dataSetInstance->getTableName() . '/'; + $pathName = $this->getConfigInstance()->getConfigEntry('local_db_path') . $dataSetInstance->getTableName() . '/'; // Try all the requests try { @@ -602,7 +573,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend */ public function getPrimaryKeyOfTable ($tableName) { // Default key is null - $primaryKey = null; + $primaryKey = NULL; // Does the table information exist? if (isset($this->tableInfo[$tableName])) { diff --git a/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php b/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php index 0af47d42..1f109a41 100644 --- a/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php +++ b/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php @@ -343,7 +343,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT * @return void * @throws XmlParserException If an XML error was found */ - public function renderXmlContent ($content = null) { + public function renderXmlContent ($content = NULL) { // Call the inner class' method $this->getTemplateInstance()->renderXmlContent($content); } diff --git a/inc/classes/main/factories/cache/class_CacheFactory.php b/inc/classes/main/factories/cache/class_CacheFactory.php index 04f634c1..029b6cd6 100644 --- a/inc/classes/main/factories/cache/class_CacheFactory.php +++ b/inc/classes/main/factories/cache/class_CacheFactory.php @@ -25,7 +25,7 @@ class CacheFactory extends BaseFactory { /** * Singleton instance */ - private static $selfInstance = null; + private static $selfInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/factories/web/class_WebNewsFactory.php b/inc/classes/main/factories/web/class_WebNewsFactory.php index 7019b8e9..19fcce76 100644 --- a/inc/classes/main/factories/web/class_WebNewsFactory.php +++ b/inc/classes/main/factories/web/class_WebNewsFactory.php @@ -25,7 +25,7 @@ class WebNewsFactory extends BaseFactory { /** * Instance of a request class */ - private $requestInstance = null; + private $requestInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/filter/class_BaseFilterDecorator.php b/inc/classes/main/filter/class_BaseFilterDecorator.php index f5056a03..a3a23693 100644 --- a/inc/classes/main/filter/class_BaseFilterDecorator.php +++ b/inc/classes/main/filter/class_BaseFilterDecorator.php @@ -25,7 +25,7 @@ abstract class BaseFilterDecorator extends BaseFrameworkSystem implements Filter /** * The decorated filter instance */ - private $filterInstance = null; + private $filterInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php index 8782f163..26da852b 100644 --- a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php @@ -136,7 +136,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { $alreadyTaken = true; // Initialize instance - $userInstance = null; + $userInstance = NULL; // Get a registry instance $registry = Registry::getRegistry(); diff --git a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php index d00b7ccd..c6fa4b2c 100644 --- a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php @@ -101,7 +101,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { $alreadyTaken = true; // Initialize instance - $userInstance = null; + $userInstance = NULL; // Get a registry instance $registry = Registry::getRegistry(); diff --git a/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php index 7e9efc8c..70aa47b6 100644 --- a/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php @@ -104,7 +104,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { $alreadyTaken = true; // Initialize instance - $userInstance = null; + $userInstance = NULL; // Get a registry instance $registry = Registry::getRegistry(); diff --git a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php index f24b0bc4..e4685727 100644 --- a/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php @@ -101,7 +101,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { $alreadyTaken = true; // Initialize instance - $userInstance = null; + $userInstance = NULL; // Get a registry instance $registry = Registry::getRegistry(); diff --git a/inc/classes/main/helper/captcha/class_BaseCaptcha.php b/inc/classes/main/helper/captcha/class_BaseCaptcha.php index 313ef4c6..3ef952b7 100644 --- a/inc/classes/main/helper/captcha/class_BaseCaptcha.php +++ b/inc/classes/main/helper/captcha/class_BaseCaptcha.php @@ -39,7 +39,7 @@ class BaseCaptcha extends BaseHelper { * @param $extraInstance An extra instance, just for better hash data * @return void */ - protected final function initializeRandomNumberGenerator (FrameworkInterface $extraInstance = null) { + protected final function initializeRandomNumberGenerator (FrameworkInterface $extraInstance = NULL) { // Get an RNG from factory $this->setRngInstance(ObjectFactory::createObjectByConfiguredName('rng_class', array($extraInstance))); } diff --git a/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php b/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php index aa676768..6583e392 100644 --- a/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php +++ b/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php @@ -49,7 +49,7 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha { * @param $extraInstance An extra instance, just for better hash data * @return $captchaInstance An instance of this captcha class */ - public static final function createGraphicalCodeCaptcha (HelpableTemplate $helperInstance, FrameworkInterface $extraInstance = null) { + public static final function createGraphicalCodeCaptcha (HelpableTemplate $helperInstance, FrameworkInterface $extraInstance = NULL) { // Get a new instance $captchaInstance = new GraphicalCodeCaptcha(); diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php index eaaf08fa..e360adc6 100644 --- a/inc/classes/main/helper/class_BaseHelper.php +++ b/inc/classes/main/helper/class_BaseHelper.php @@ -25,12 +25,12 @@ class BaseHelper extends BaseFrameworkSystem { /** * Instance to the class which provides field values */ - private $valueInstance = null; + private $valueInstance = NULL; /** * Extra instance to the class which provides field values */ - private $extraInstance = null; + private $extraInstance = NULL; /** * Rendered content created by the helper class @@ -192,7 +192,7 @@ class BaseHelper extends BaseFrameworkSystem { * @return void * @throws NullPointerException If recovery of requested value instance failed */ - public function prefetchValueInstance ($registryKey, $extraKey = null) { + public function prefetchValueInstance ($registryKey, $extraKey = NULL) { //* DEBUG: */ $this->debugOutput('O:'.$registryKey.'/'.$extraKey); try { // Get the required instance diff --git a/inc/classes/main/helper/web/forms/class_WebFormHelper.php b/inc/classes/main/helper/web/forms/class_WebFormHelper.php index 5e396a03..7c3e29df 100644 --- a/inc/classes/main/helper/web/forms/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/forms/class_WebFormHelper.php @@ -673,7 +673,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate { */ public function addCaptcha () { // Init instance - $extraInstance = null; + $extraInstance = NULL; try { // Get last executed pre filter diff --git a/inc/classes/main/helper/web/links/class_WebLinkHelper.php b/inc/classes/main/helper/web/links/class_WebLinkHelper.php index 8c4d0aa4..8ff8e54c 100644 --- a/inc/classes/main/helper/web/links/class_WebLinkHelper.php +++ b/inc/classes/main/helper/web/links/class_WebLinkHelper.php @@ -61,7 +61,7 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate { * @return $helperInstance A prepared instance of this helper * @throws NoConfigEntryException A deprecated exception at this point */ - public static final function createWebLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase = null) { + public static final function createWebLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase = NULL) { // Get new instance $helperInstance = new WebLinkHelper(); diff --git a/inc/classes/main/images/class_BaseImage.php b/inc/classes/main/images/class_BaseImage.php index d2c2dd92..f5aebb36 100644 --- a/inc/classes/main/images/class_BaseImage.php +++ b/inc/classes/main/images/class_BaseImage.php @@ -63,7 +63,7 @@ class BaseImage extends BaseFrameworkSystem implements Registerable { /** * Image resource */ - private $imageResource = null; + private $imageResource = NULL; /** * Image name diff --git a/inc/classes/main/io/class_FileIoStream.php b/inc/classes/main/io/class_FileIoStream.php index d95f339f..66eeb668 100644 --- a/inc/classes/main/io/class_FileIoStream.php +++ b/inc/classes/main/io/class_FileIoStream.php @@ -75,7 +75,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil */ public final function saveFile ($fileName, $dataArray) { // Try it five times - $dirName = ''; $fileInstance = null; + $dirName = ''; $fileInstance = NULL; for ($idx = 0; $idx < 5; $idx++) { // Get a file output pointer try { diff --git a/inc/classes/main/io/class_FrameworkDirectoryPointer.php b/inc/classes/main/io/class_FrameworkDirectoryPointer.php index 782d51f3..c0728738 100644 --- a/inc/classes/main/io/class_FrameworkDirectoryPointer.php +++ b/inc/classes/main/io/class_FrameworkDirectoryPointer.php @@ -30,7 +30,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { /** * The directory pointer */ - private $dirPointer = null; + private $dirPointer = NULL; /** * Protected constructor diff --git a/inc/classes/main/io/class_FrameworkFileInputPointer.php b/inc/classes/main/io/class_FrameworkFileInputPointer.php index ebac49d4..f1d0b9e4 100644 --- a/inc/classes/main/io/class_FrameworkFileInputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileInputPointer.php @@ -30,7 +30,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem { /** * The file pointer */ - private $filePointer = null; + private $filePointer = NULL; /** * Protected constructor diff --git a/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/inc/classes/main/io/class_FrameworkFileOutputPointer.php index b76281b5..5fb5e751 100644 --- a/inc/classes/main/io/class_FrameworkFileOutputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileOutputPointer.php @@ -30,7 +30,7 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem { /** * The file pointer */ - private $filePointer = null; + private $filePointer = NULL; /** * Protected constructor diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php index 71492617..df1fe429 100644 --- a/inc/classes/main/language/class_LanguageSystem.php +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -36,12 +36,12 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage, /** * The array-object for all language strings */ - private $langStrings = null; + private $langStrings = NULL; /** * An instance of this class */ - private static $thisInstance = null; + private static $thisInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/mailer/class_BaseMailer.php b/inc/classes/main/mailer/class_BaseMailer.php index 5a6602d2..5a18f410 100644 --- a/inc/classes/main/mailer/class_BaseMailer.php +++ b/inc/classes/main/mailer/class_BaseMailer.php @@ -173,7 +173,7 @@ class BaseMailer extends BaseFrameworkSystem { */ public final function getSubjectLine () { // Default subject is null - $subjectLine = null; + $subjectLine = NULL; // Get template name $templateName = $this->getTemplateName(); @@ -195,7 +195,7 @@ class BaseMailer extends BaseFrameworkSystem { */ public function useSubjectFromTemplate () { // Set the subject line - $this->setSubjectLine("{?subject?}"); + $this->setSubjectLine('{?subject?}'); } /** diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php index 38379b28..6a3e88f7 100644 --- a/inc/classes/main/output/class_ConsoleOutput.php +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -26,7 +26,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { /** * The instance for the singleton design pattern */ - private static $consoleInstance = null; + private static $consoleInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php index ff175d0b..835d18e4 100644 --- a/inc/classes/main/output/class_WebOutput.php +++ b/inc/classes/main/output/class_WebOutput.php @@ -26,7 +26,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera /** * The instance for the singleton design pattern */ - private static $webInstance = null; + private static $webInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/registration/class_BaseRegistration.php b/inc/classes/main/registration/class_BaseRegistration.php index e90e0db7..e0cf3699 100644 --- a/inc/classes/main/registration/class_BaseRegistration.php +++ b/inc/classes/main/registration/class_BaseRegistration.php @@ -25,12 +25,12 @@ class BaseRegistration extends BaseFrameworkSystem { /** * Pre-registration filter chain */ - private $preRegistrationFilter = null; + private $preRegistrationFilter = NULL; /** * Pre-registration filter chain */ - private $postRegistrationFilter = null; + private $postRegistrationFilter = NULL; /** * Protected constructor diff --git a/inc/classes/main/registry/class_BaseRegistry.php b/inc/classes/main/registry/class_BaseRegistry.php index 6330331d..390d2c67 100644 --- a/inc/classes/main/registry/class_BaseRegistry.php +++ b/inc/classes/main/registry/class_BaseRegistry.php @@ -25,7 +25,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { /** * Instance of this class */ - private static $registryInstance = null; + private static $registryInstance = NULL; /** * Instance registry @@ -100,7 +100,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { * * @return $entries An array with entries from this registry */ - public final function getEntries ($key = null) { + public final function getEntries ($key = NULL) { // Default is whole array $entries = $this->rawEntries; @@ -164,7 +164,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { */ public function getInstance ($instanceKey) { // By default the instance is not in registry - $objectInstance = null; + $objectInstance = NULL; // Is the instance there? if ($this->instanceExists($instanceKey)) { diff --git a/inc/classes/main/registry/generic/class_Registry.php b/inc/classes/main/registry/generic/class_Registry.php index 91a27f73..359e4be0 100644 --- a/inc/classes/main/registry/generic/class_Registry.php +++ b/inc/classes/main/registry/generic/class_Registry.php @@ -26,7 +26,7 @@ class Registry extends BaseRegistry implements Register { /** * Instance of this class */ - private static $registryInstance = null; + private static $registryInstance = NULL; /** * Protected constructor diff --git a/inc/classes/main/request/class_BaseRequest.php b/inc/classes/main/request/class_BaseRequest.php index 4eca9e2b..3757607d 100644 --- a/inc/classes/main/request/class_BaseRequest.php +++ b/inc/classes/main/request/class_BaseRequest.php @@ -67,7 +67,7 @@ class BaseRequest extends BaseFrameworkSystem { */ public function getRequestElement ($element) { // Initialize value - $value = null; + $value = NULL; // Is the element set? if ($this->isRequestElementSet($element)) { diff --git a/inc/classes/main/request/web/class_HttpRequest.php b/inc/classes/main/request/web/class_HttpRequest.php index 2688f5fb..97065380 100644 --- a/inc/classes/main/request/web/class_HttpRequest.php +++ b/inc/classes/main/request/web/class_HttpRequest.php @@ -69,7 +69,7 @@ class HttpRequest extends BaseRequest implements Requestable { */ public function getHeader ($headerName) { // Default return value on error - $headerValue = null; + $headerValue = NULL; // Construct the name $name = 'HTTP_' . strtolower($this->convertDashesToUnderscores($headerName)); @@ -100,7 +100,7 @@ class HttpRequest extends BaseRequest implements Requestable { */ public final function readCookie ($cookieName) { // Default is no cookie with that name found - $cookieValue = null; + $cookieValue = NULL; // Is the cookie set? if (isset($_COOKIE[$cookieName])) { diff --git a/inc/classes/main/resolver/action/class_BaseActionResolver.php b/inc/classes/main/resolver/action/class_BaseActionResolver.php index 37e605be..d7d309cd 100644 --- a/inc/classes/main/resolver/action/class_BaseActionResolver.php +++ b/inc/classes/main/resolver/action/class_BaseActionResolver.php @@ -100,7 +100,7 @@ class BaseActionResolver extends BaseResolver { */ protected function loadAction () { // Init action instance - $actionInstance = null; + $actionInstance = NULL; // Create action class name $className = $this->getClassPrefix() . $this->convertToClassName($this->getActionName()) . 'Action'; diff --git a/inc/classes/main/resolver/action/web/class_WebActionResolver.php b/inc/classes/main/resolver/action/web/class_WebActionResolver.php index dff629d9..97b1a230 100644 --- a/inc/classes/main/resolver/action/web/class_WebActionResolver.php +++ b/inc/classes/main/resolver/action/web/class_WebActionResolver.php @@ -25,7 +25,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver { /** * Last successfull resolved action */ - private $lastActionInstance = null; + private $lastActionInstance = NULL; /** * Protected constructor @@ -83,7 +83,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver { public function resolveActionByRequest (Requestable $requestInstance) { // Init variables $actionName = ''; - $actionInstance = null; + $actionInstance = NULL; // This goes fine so let's resolve the action $actionName = $requestInstance->getRequestElement('action'); @@ -123,7 +123,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver { */ public function resolveAction () { // Initiate the instance variable - $actionInstance = null; + $actionInstance = NULL; // Get action name $actionName = $this->getActionName(); diff --git a/inc/classes/main/resolver/class_BaseResolver.php b/inc/classes/main/resolver/class_BaseResolver.php index 06b34403..875ab39a 100644 --- a/inc/classes/main/resolver/class_BaseResolver.php +++ b/inc/classes/main/resolver/class_BaseResolver.php @@ -35,7 +35,7 @@ class BaseResolver extends BaseFrameworkSystem { /** * (Last) resolved instance */ - private $resolvedInstance = null; + private $resolvedInstance = NULL; // Exception constants const EXCEPTION_INVALID_COMMAND = 0x1d0; diff --git a/inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php b/inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php index 9f9cdde7..572b9c0f 100644 --- a/inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php +++ b/inc/classes/main/resolver/command/console/class_ConsoleCommandResolver.php @@ -78,7 +78,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol public function resolveCommandByRequest (Requestable $requestInstance) { // Init variables $commandName = ''; - $commandInstance = null; + $commandInstance = NULL; // This goes fine so let's resolve the command $commandName = $requestInstance->getRequestElement('command'); @@ -119,7 +119,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol */ public function resolveCommand ($commandName) { // Initiate the instance variable - $commandInstance = null; + $commandInstance = NULL; // Is the command empty? Then fall back to default command if (empty($commandName)) { @@ -149,7 +149,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol */ private function loadCommand ($commandName) { // Init command instance - $commandInstance = null; + $commandInstance = NULL; // Create class name $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command'; diff --git a/inc/classes/main/resolver/command/image/class_ImageCommandResolver.php b/inc/classes/main/resolver/command/image/class_ImageCommandResolver.php index 204aebb5..d62b3b19 100644 --- a/inc/classes/main/resolver/command/image/class_ImageCommandResolver.php +++ b/inc/classes/main/resolver/command/image/class_ImageCommandResolver.php @@ -25,7 +25,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve /** * Last successfull resolved command */ - private $lastCommandInstance = null; + private $lastCommandInstance = NULL; /** * Protected constructor @@ -83,7 +83,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve public function resolveCommandByRequest (Requestable $requestInstance) { // Init variables $commandName = ''; - $commandInstance = null; + $commandInstance = NULL; // This goes fine so let's resolve the command $commandName = $requestInstance->getRequestElement('page'); @@ -124,7 +124,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve */ public function resolveCommand ($commandName) { // Initiate the instance variable - $commandInstance = null; + $commandInstance = NULL; // Is the command empty? Then fall back to default command if (empty($commandName)) { @@ -154,7 +154,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve */ private function loadCommand ($commandName) { // Init command instance - $commandInstance = null; + $commandInstance = NULL; // Create class name $className = $this->getClassPrefix() . $this->convertToClassName($commandName) . 'Command'; diff --git a/inc/classes/main/resolver/command/web/class_WebCommandResolver.php b/inc/classes/main/resolver/command/web/class_WebCommandResolver.php index 103ea14e..a404e955 100644 --- a/inc/classes/main/resolver/command/web/class_WebCommandResolver.php +++ b/inc/classes/main/resolver/command/web/class_WebCommandResolver.php @@ -25,7 +25,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver /** * Last successfull resolved command */ - private $lastCommandInstance = null; + private $lastCommandInstance = NULL; /** * Protected constructor @@ -83,7 +83,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver public function resolveCommandByRequest (Requestable $requestInstance) { // Init variables $commandName = ''; - $commandInstance = null; + $commandInstance = NULL; // This goes fine so let's resolve the command $commandName = $requestInstance->getRequestElement('page'); @@ -124,7 +124,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver */ public function resolveCommand ($commandName) { // Initiate the instance variable - $commandInstance = null; + $commandInstance = NULL; // Is the command empty? Then fall back to default command if (empty($commandName)) { @@ -154,7 +154,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver */ private function loadCommand ($commandName) { // Init command instance - $commandInstance = null; + $commandInstance = NULL; // Is this class loaded? if (!class_exists($this->getClassName())) { diff --git a/inc/classes/main/resolver/controller/class_BaseControllerResolver.php b/inc/classes/main/resolver/controller/class_BaseControllerResolver.php index 62f02bbe..176fa793 100644 --- a/inc/classes/main/resolver/controller/class_BaseControllerResolver.php +++ b/inc/classes/main/resolver/controller/class_BaseControllerResolver.php @@ -72,7 +72,7 @@ class BaseControllerResolver extends BaseResolver { $defaultController = $this->getConfigInstance()->getConfigEntry('default_' . strtolower($this->getClassPrefix()) . '_command'); // Init controller instance - $controllerInstance = null; + $controllerInstance = NULL; // Default controller $this->setClassName($this->getClassPrefix() . 'DefaultNewsController'); diff --git a/inc/classes/main/resolver/controller/console/class_ConsoleControllerResolver.php b/inc/classes/main/resolver/controller/console/class_ConsoleControllerResolver.php index 36e1fb68..b6d61c99 100644 --- a/inc/classes/main/resolver/controller/console/class_ConsoleControllerResolver.php +++ b/inc/classes/main/resolver/controller/console/class_ConsoleControllerResolver.php @@ -30,7 +30,7 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro /** * Last successfull resolved controller (instance) */ - private $lastControllerInstance = null; + private $lastControllerInstance = NULL; /** * Protected constructor @@ -88,7 +88,7 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro public function resolveController () { // Init variables $controllerName = ''; - $controllerInstance = null; + $controllerInstance = NULL; // Get the command name $controllerName = $this->getControllerName(); diff --git a/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php b/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php index 1d8e2426..92dd5406 100644 --- a/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php +++ b/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php @@ -30,7 +30,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll /** * Last successfull resolved controller (instance) */ - private $lastControllerInstance = null; + private $lastControllerInstance = NULL; /** * Protected constructor @@ -88,7 +88,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll public function resolveController () { // Init variables $controllerName = ''; - $controllerInstance = null; + $controllerInstance = NULL; // Get the command name $controllerName = $this->getControllerName(); diff --git a/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php b/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php index 403f31ac..23799874 100644 --- a/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php @@ -30,7 +30,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller /** * Last successfull resolved controller (instance) */ - private $lastControllerInstance = null; + private $lastControllerInstance = NULL; /** * Protected constructor @@ -88,7 +88,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller public function resolveController () { // Init variables $controllerName = ''; - $controllerInstance = null; + $controllerInstance = NULL; // Get the command name $controllerName = $this->getControllerName(); diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index 986ef5cc..fbaa85a7 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -48,7 +48,7 @@ class BaseResponse extends BaseFrameworkSystem { /** * Instance of the template engine */ - private $templateInstance = null; + private $templateInstance = NULL; /** * Fatal resolved messages from filters and so on diff --git a/inc/classes/main/response/console/class_ConsoleResponse.php b/inc/classes/main/response/console/class_ConsoleResponse.php index 32e0cbd5..1469bd32 100644 --- a/inc/classes/main/response/console/class_ConsoleResponse.php +++ b/inc/classes/main/response/console/class_ConsoleResponse.php @@ -75,7 +75,7 @@ class ConsoleResponse extends BaseResponse implements Responseable { * @return void * @throws ResponseHeadersAlreadySentException If headers are already sent */ - public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { //* DEBUG: */ echo $cookieName.'='.$cookieValue."
\n"; $this->partialStub('Naturally unimplemented in console response.'); } diff --git a/inc/classes/main/response/http/class_HttpResponse.php b/inc/classes/main/response/http/class_HttpResponse.php index 57a37e2f..0378bdaf 100644 --- a/inc/classes/main/response/http/class_HttpResponse.php +++ b/inc/classes/main/response/http/class_HttpResponse.php @@ -79,7 +79,7 @@ class HttpResponse extends BaseResponse implements Responseable { * @todo If the return statement is removed and setcookie() commented out, * @todo this will send only one cookie out, the first one. */ - public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { //* DEBUG: */ echo $cookieName.'='.$cookieValue."
\n"; // Are headers already sent? if (headers_sent()) { diff --git a/inc/classes/main/response/image/class_ImageResponse.php b/inc/classes/main/response/image/class_ImageResponse.php index 8e018d7c..b1f08a25 100644 --- a/inc/classes/main/response/image/class_ImageResponse.php +++ b/inc/classes/main/response/image/class_ImageResponse.php @@ -90,7 +90,7 @@ class ImageResponse extends BaseResponse implements Responseable { * @todo If the return statement is removed and setcookie() commented out, * @todo this will send only one cookie out, the first one. */ - public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { // Are headers already sent? if (headers_sent()) { // Throw an exception here diff --git a/inc/classes/main/result/class_DatabaseResult.php b/inc/classes/main/result/class_DatabaseResult.php index dcbcf5e6..e2505df0 100644 --- a/inc/classes/main/result/class_DatabaseResult.php +++ b/inc/classes/main/result/class_DatabaseResult.php @@ -34,7 +34,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up /** * Current row */ - private $currentRow = null; + private $currentRow = NULL; /** * Result array @@ -159,7 +159,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up */ public function current () { // Default is not found - $current = null; + $current = NULL; // Does the current enty exist? if (isset($this->resultArray['rows'][$this->currentPos])) { diff --git a/inc/classes/main/rng/class_RandomNumberGenerator.php b/inc/classes/main/rng/class_RandomNumberGenerator.php index f6564322..c92c6bcc 100644 --- a/inc/classes/main/rng/class_RandomNumberGenerator.php +++ b/inc/classes/main/rng/class_RandomNumberGenerator.php @@ -64,7 +64,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem { * @param $extraInstance An extra instance for more salt (default: null) * @return $rngInstance An instance of this random number generator */ - public static final function createRandomNumberGenerator (FrameworkInterface $extraInstance = null) { + public static final function createRandomNumberGenerator (FrameworkInterface $extraInstance = NULL) { // Get a new instance $rngInstance = new RandomNumberGenerator(); diff --git a/inc/classes/main/streams/crypto/class_McryptStream.php b/inc/classes/main/streams/crypto/class_McryptStream.php index 1c3eeeb2..5bab4ef5 100644 --- a/inc/classes/main/streams/crypto/class_McryptStream.php +++ b/inc/classes/main/streams/crypto/class_McryptStream.php @@ -61,7 +61,7 @@ class McryptStream extends BaseStream implements EncryptableStream { * @param $key Optional key, if none provided, a random key will be generated * @return $encrypted Encrypted string */ - public function encryptStream ($str, $key = null) { + public function encryptStream ($str, $key = NULL) { // Init crypto module $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); @@ -125,7 +125,7 @@ class McryptStream extends BaseStream implements EncryptableStream { * @param $key Optional key, if none provided, a random key will be generated * @return $str The unencrypted string */ - public function decryptStream ($encrypted, $key = null) { + public function decryptStream ($encrypted, $key = NULL) { // Init crypto module $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index 65152544..3e265df6 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -87,12 +87,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem { /** * Loaded raw template data */ - private $loadedRawData = null; + private $loadedRawData = NULL; /** * Raw templates which are linked in code templates */ - private $rawTemplates = null; + private $rawTemplates = NULL; /** * A regular expression for variable=value pairs @@ -171,7 +171,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $stack Optional variable stack to look in * @return $index FALSE means not found, >=0 means found on a specific index */ - private function getVariableIndex ($var, $stack = null) { + private function getVariableIndex ($var, $stack = NULL) { // First everything is not found $found = false; @@ -239,9 +239,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $stack Optional variable stack to look in * @return $content Content of the variable or null if not found */ - protected function readVariable ($var, $stack = null) { + protected function readVariable ($var, $stack = NULL) { // First everything is not found - $content = null; + $content = NULL; // If the stack is null, use the current group if (is_null($stack)) $stack = $this->currGroup; @@ -1168,7 +1168,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $$validVar = $dummy; // Prepare all configuration variables - $config = null; + $config = NULL; if ($this->isVarStackSet('config')) { $config = $this->getVarStack('config'); } // END - if @@ -1444,7 +1444,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @return void * @throws XmlParserException If an XML error was found */ - public function renderXmlContent ($content = null) { + public function renderXmlContent ($content = NULL) { // Is the content set? if (is_null($content)) { // Get current content diff --git a/inc/classes/main/template/mail/class_MailTemplateEngine.php b/inc/classes/main/template/mail/class_MailTemplateEngine.php index c4e49b22..898aa2f3 100644 --- a/inc/classes/main/template/mail/class_MailTemplateEngine.php +++ b/inc/classes/main/template/mail/class_MailTemplateEngine.php @@ -43,7 +43,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla /** * Mailer instance */ - private $mailerInstance = null; + private $mailerInstance = NULL; /** * Current main node diff --git a/inc/classes/main/template/menu/class_MenuTemplateEngine.php b/inc/classes/main/template/menu/class_MenuTemplateEngine.php index 1438c914..ea98d819 100644 --- a/inc/classes/main/template/menu/class_MenuTemplateEngine.php +++ b/inc/classes/main/template/menu/class_MenuTemplateEngine.php @@ -60,7 +60,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla /** * Menu instance */ - private $menuInstance = null; + private $menuInstance = NULL; /** * Current main node diff --git a/inc/classes/main/user/class_BaseUser.php b/inc/classes/main/user/class_BaseUser.php index 6b0ddef3..a26da5d5 100644 --- a/inc/classes/main/user/class_BaseUser.php +++ b/inc/classes/main/user/class_BaseUser.php @@ -265,7 +265,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { */ public final function getPasswordHash () { // Default is missing password hash - $passHash = null; + $passHash = NULL; // Get a database entry $entry = $this->getDatabaseEntry(); diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index 71ea3577..0aa8205b 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -25,7 +25,7 @@ class CompressorChannel extends BaseMiddleware implements Registerable { /** * Real compressor instance */ - private $compressor = null; + private $compressor = NULL; /** * Protected constructor @@ -38,40 +38,43 @@ class CompressorChannel extends BaseMiddleware implements Registerable { } /** - * Create a new compressor channel based a given base directory where - * we shall look for compressor classes + * Create a new compressor channel. * - * @param $baseDir Directory which holds our compressor classes - * @return $cInstance A prepared instance of this class + * @return $compressorInstance A prepared instance of this class */ - public static final function createCompressorChannel ($baseDir) { + public static final function createCompressorChannel () { // Get new instance - $cInstance = new CompressorChannel(); + $compressorInstance = new CompressorChannel(); // Is the compressor handler set? if ( - (is_null($cInstance->getCompressor())) - || (!is_object($cInstance->getCompressor())) - || (!method_exists($cInstance->getCompressor(), 'compressStream')) - || (!method_exists($cInstance->getCompressor(), 'decompressStream')) + (is_null($compressorInstance->getCompressor())) + || (!is_object($compressorInstance->getCompressor())) + || (!method_exists($compressorInstance->getCompressor(), 'compressStream')) + || (!method_exists($compressorInstance->getCompressor(), 'decompressStream')) ) { + // Init base directory + $baseDir = + $compressorInstance->getConfigInstance()->getConfigEntry('base_path') . + $compressorInstance->getConfigInstance()->getConfigEntry('compressor_base_path'); + // Get a directory pointer $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); // Read all directories but no sub directories - while ($dir = $dirPointer->readDirectoryExcept(array('..', '.', '.htaccess', '.svn'))) { + while ($directoryEntry = $dirPointer->readDirectoryExcept(array('..', '.', '.htaccess', '.svn'))) { // Is this a class file? - if ((substr($dir, 0, 6) == 'class_') && (substr($dir, -4, 4) == '.php')) { + if ((substr($directoryEntry, 0, 6) == 'class_') && (substr($directoryEntry, -4, 4) == '.php')) { // Get the compressor's name. That's why you must name // your files like your classes and also that's why you // must keep on class in one file. - $className = substr($dir, 6, -4); + $className = substr($directoryEntry, 6, -4); // Get an instance from our object factory $tempInstance = ObjectFactory::createObjectByName($className); // Set the compressor - $cInstance->setCompressor($tempInstance); + $compressorInstance->setCompressor($tempInstance); // No more searches required because we have found a valid compressor stream break; @@ -84,17 +87,17 @@ class CompressorChannel extends BaseMiddleware implements Registerable { // Check again if there is a compressor if ( - (is_null($cInstance->getCompressor())) - || (!is_object($cInstance->getCompressor())) - || (!method_exists($cInstance->getCompressor(), 'compressStream')) - || (!method_exists($cInstance->getCompressor(), 'decompressStream')) + (is_null($compressorInstance->getCompressor())) + || (!is_object($compressorInstance->getCompressor())) + || (!method_exists($compressorInstance->getCompressor(), 'compressStream')) + || (!method_exists($compressorInstance->getCompressor(), 'decompressStream')) ) { // Set the null compressor handler. This should not be configureable! - $cInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor')); + $compressorInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor')); } // END - if // Return the compressor instance - return $cInstance; + return $compressorInstance; } /** @@ -112,7 +115,7 @@ class CompressorChannel extends BaseMiddleware implements Registerable { * @param $compressorInstance The compressor instance we shall use * @return void */ - public final function setCompressor (Compressor $compressorInstance = null) { + public final function setCompressor (Compressor $compressorInstance = NULL) { $this->compressor = $compressorInstance; } diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php index a175f861..c55c7515 100644 --- a/inc/classes/middleware/database/class_DatabaseConnection.php +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -33,10 +33,10 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re ); // The real database layer - private $dbLayer = null; + private $dbLayer = NULL; // An instance of this class - private static $thisInstance = null; + private static $thisInstance = NULL; /** * Protected constructor @@ -51,19 +51,19 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // Create new database connection layer public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) { // Get instance - $dbInstance = new DatabaseConnection(); + $databaseInstance = new DatabaseConnection(); // Set debug output handler - $dbInstance->setDebugInstance($debugInstance); + $databaseInstance->setDebugInstance($debugInstance); // Set database layer - $dbInstance->setDatabaseLayer($dbLayer); + $databaseInstance->setDatabaseLayer($dbLayer); // Set db instance - self::$thisInstance = $dbInstance; + self::$thisInstance = $databaseInstance; // Return instance - return $dbInstance; + return $databaseInstance; } // Get an instance of this class diff --git a/inc/classes/middleware/debug/class_DebugMiddleware.php b/inc/classes/middleware/debug/class_DebugMiddleware.php index 2a010b69..4d70703b 100644 --- a/inc/classes/middleware/debug/class_DebugMiddleware.php +++ b/inc/classes/middleware/debug/class_DebugMiddleware.php @@ -27,12 +27,12 @@ class DebugMiddleware extends BaseMiddleware implements Registerable { /** * The concrete output instance */ - private $outputInstance = null; + private $outputInstance = NULL; /** * An instance of this class */ - private static $thisInstance = null; + private static $thisInstance = NULL; /** * Protected constructor diff --git a/inc/classes/middleware/io/class_FileIoHandler.php b/inc/classes/middleware/io/class_FileIoHandler.php index 7d8b8cc8..22dff803 100644 --- a/inc/classes/middleware/io/class_FileIoHandler.php +++ b/inc/classes/middleware/io/class_FileIoHandler.php @@ -26,17 +26,17 @@ class FileIoHandler extends BaseMiddleware { /** * The *real* file input class we shall use for reading data */ - private $inputStream = null; + private $inputStream = NULL; /** * The *real* file output class we shall use for reading data */ - private $outputStream = null; + private $outputStream = NULL; /** * An instance of this class */ - private static $thisInstance = null; + private static $thisInstance = NULL; /** * Protected constructor diff --git a/inc/config.php b/inc/config.php index 73dc3942..feb9eb68 100644 --- a/inc/config.php +++ b/inc/config.php @@ -320,5 +320,11 @@ $cfg->setConfigEntry('stacker_generic_max_size', 100); // CFG: STACKER-CURRENT-NODE-MAX-SIZE $cfg->setConfigEntry('stacker_current_node_max_size', 20); +// CFG: LOCAL-FILE-DATABASE-CLASS +$cfg->setConfigEntry('local_file_database_class', 'LocalFileDatabase'); + +// CFG: COMPRESSOR-CHANNEL-CLASS +$cfg->setConfigEntry('compressor_channel_class', 'CompressorChannel'); + // [EOF] ?> diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index 1a809e07..938b67ba 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -36,7 +36,7 @@ class FrameworkConfiguration implements Registerable { /** * The configuration instance itself */ - private static $configInstance = null; + private static $configInstance = NULL; // Some constants for the configuration system const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x130; @@ -217,7 +217,7 @@ class FrameworkConfiguration implements Registerable { */ public function detectHttpSecured () { // Default is null - $https = null; + $https = NULL; // Is HTTPS set? if ($this->isHttpSecured()) { diff --git a/inc/database.php b/inc/database.php index 6a644877..54329fde 100644 --- a/inc/database.php +++ b/inc/database.php @@ -25,7 +25,7 @@ */ // Initialize database layer -$databaseInstance = null; +$databaseInstance = NULL; // Generate FQFN for the database layer $fqfn = FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/database/lib-' . FrameworkConfiguration::getInstance()->getConfigEntry('db_type') . '.php'; diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php index 7ca9530c..9ee55076 100644 --- a/inc/database/lib-local.php +++ b/inc/database/lib-local.php @@ -23,9 +23,7 @@ */ // For testing purposes we use a local file database -$databaseInstance = LocalFileDatabase::createLocalFileDatabase( - FrameworkConfiguration::getInstance()->getConfigEntry('local_db_path') -); +$databaseInstance = ObjectFactory::createObjectByConfiguredName('local_file_database_class'); // [EOF] ?> diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index eef05549..3645bf17 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -38,7 +38,7 @@ class ClassLoader { /** * Instance of this class */ - private static $selfInstance = null; + private static $selfInstance = NULL; /** * Array with all classes