better it gets renamed to something else.
);
// Cache loader instance
-$loaderInstance = ClassLoader::getInstance();
+$loaderInstance = ClassLoader::getSelfInstance();
// Load all classes
foreach ($lowerClasses as $className) {
// Set configuration instance if no registry ...
if (!$this instanceof Register) {
// ... because registries doesn't need to be configured
- $this->setConfigInstance(FrameworkConfiguration::getInstance());
+ $this->setConfigInstance(FrameworkConfiguration::getSelfInstance());
} // END - if
// Is the startup time set? (0 cannot be true anymore)
ApplicationEntryPoint::app_die(sprintf("<div class=\"debug_header\">%s debug output:</div><div class=\"debug_content\">%s</div>\nLoaded includes: <div class=\"debug_include_list\">%s</div>",
$this->__toString(),
$content,
- ClassLoader::getInstance()->getPrintableIncludeList()
+ ClassLoader::getSelfInstance()->getPrintableIncludeList()
));
}
}
// Set it in configuration
- FrameworkConfiguration::getInstance()->setServerAddress($ip);
+ FrameworkConfiguration::getSelfInstance()->setServerAddress($ip);
}
/**
*
* @return $selfInstance An instance of this crypto helper class
*/
- public static final function getInstance () {
+ public static final function getSelfInstance () {
// Is no instance there?
if (is_null(self::$selfInstance)) {
// Then get a new one
*/
public static final function createObjectByConfiguredName ($configEntry, array $args=array()) {
// Read the configuration entry
- $className = FrameworkConfiguration::getInstance()->getConfigEntry($configEntry);
+ $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($configEntry);
// Send this to the other factory...
$objectInstance = self::createObjectByName($className, $args);
$langInstance->initLanguageStrings();
// Set language code from default config
- $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->getConfigEntry('default_lang'));
+ $langInstance->setLanguageCode(FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_lang'));
// Remember this instance
self::$thisInstance = $langInstance;
*
* @return $thisInstance An instance of this class
*/
- public static final function getInstance () {
+ public static final function getSelfInstance () {
return self::$thisInstance;
}
public static final function getInstance() {
// Is the self-instance already set?
if (is_null(self::$consoleInstance)) {
- $contentType = FrameworkConfiguration::getInstance()->getConfigEntry('web_content_type');
+ $contentType = FrameworkConfiguration::getSelfInstance()->getConfigEntry('web_content_type');
self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType);
} // END - if
}
/**
- * Getter for whole instanceregistry
+ * Getter for whole instance registry
*
* @return $instanceRegistry The whole instance registry array
*/
}
// Get an instance of this class
- public static final function getInstance () {
+ public static final function getSelfInstance () {
return self::$thisInstance;
}
*
* @return $thisInstance An instance of this class
*/
- public static final function getInstance() {
+ public static final function getSelfInstance() {
return self::$thisInstance;
}
*
* @return $thisInstance An instance of this class
*/
- public static final function getInstance () {
+ public static final function getSelfInstance () {
return self::$thisInstance;
}
require(ApplicationEntryPoint::detectCorePath() . '/inc/config/class_FrameworkConfiguration.php');
// Get a new configuration instance
-$cfg = FrameworkConfiguration::getInstance();
+$cfg = FrameworkConfiguration::getSelfInstance();
// CFG: SERVER-PATH
$cfg->setConfigEntry('base_path', ApplicationEntryPoint::detectCorePath() . '/');
*
* @return $configInstance An instance of this class
*/
- public static final function getInstance () {
+ public static final function getSelfInstance () {
// is the instance there?
if (is_null(self::$configInstance)) {
// Create a config instance
*/
// Get the configuration instance
-$cfg = FrameworkConfiguration::getInstance();
+$cfg = FrameworkConfiguration::getSelfInstance();
// CFG: HUB-BOOTSTRAP-NODES
$cfg->setConfigEntry('hub_bootstrap_nodes', '188.138.90.169:9060');
$databaseInstance = NULL;
// Generate FQFN for the database layer
-$fqfn = FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/database/lib-' . FrameworkConfiguration::getInstance()->getConfigEntry('db_type') . '.php';
+$fqfn = FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/database/lib-' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('db_type') . '.php';
// Load the database layer include
if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
} else {
// Layer is missing!
ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.",
- FrameworkConfiguration::getInstance()->getConfigEntry('db_type')
+ FrameworkConfiguration::getSelfInstance()->getConfigEntry('db_type')
));
}
unset($fqfn);
// Prepare database instance
-$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $databaseInstance);
+$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance);
// Is the app variable there and valid?
// @TODO Rewrite this
*/
// Include the class loader function
-require(FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/loader/class_ClassLoader.php');
+require(FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/loader/class_ClassLoader.php');
// Shall we include additional configs where you can configure some things? Then
// Load matching config
-ClassLoader::getInstance()->loadExtraConfigs();
+ClassLoader::getSelfInstance()->loadExtraConfigs();
// Register hooks here
-require(FrameworkConfiguration::getInstance()->getConfigEntry('base_path') . 'inc/hooks.php');
+require(FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path') . 'inc/hooks.php');
// Does the user has an application specified?
// @TODO Find a nicer OOP-ed way for this
$application = trim($app[1]);
} else {
// Invalid entry found, first must be "app"!
- $application = FrameworkConfiguration::getInstance()->getConfigEntry('default_application');
+ $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application');
}
} else {
// Set the "application selector" application
- $application = FrameworkConfiguration::getInstance()->getConfigEntry('default_application');
+ $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application');
}
// Secure it, by keeping out tags
$application = preg_replace('/([^a-z0-9_-])+/i', '', $application);
// Set the application name for later usage
-FrameworkConfiguration::getInstance()->setConfigEntry('app_name', $application);
+FrameworkConfiguration::getSelfInstance()->setConfigEntry('app_name', $application);
// [EOF]
?>
* 1.3
* - Constructor is now empty and factory method 'createClassLoader' is created
* - renamed loadClasses to scanClassPath
- * - Added initLoader(), $configInstance renamed to $configInstance
+ * - Added initLoader()
* 1.2
* - ClassLoader rewritten to PHP SPL's own RecursiveIteratorIterator class
* 1.1
/**
* The protected constructor. Please use the factory method below, or use
- * getInstance() for singleton
+ * getSelfInstance() for singleton
*
* @return void
*/
protected function __construct () {
- // Is Currently empty
+ // Is currently empty
}
/**
self::$selfInstance = $this;
// Skip here if no dev-mode
- if (defined('DEVELOPER')) return;
+ if (defined('DEVELOPER')) {
+ return;
+ } // END - if
// IS the cache there?
if (file_exists($this->listCacheFQFN)) {
*/
public static function autoLoad ($className) {
// Try to include this class
- self::getInstance()->includeClass($className);
+ self::getSelfInstance()->includeClass($className);
}
/**
- * Getter for an instance of this class
+ * Singleton getter for an instance of this class
*
- * @return $selfInstance An instance of this class
+ * @return $selfInstance A singleton instance of this class
*/
- public static final function getInstance () {
+ public static final function getSelfInstance () {
// Is the instance there?
if (is_null(self::$selfInstance)) {
// Get a new one
- self::$selfInstance = ClassLoader::createClassLoader(FrameworkConfiguration::getInstance());
+ self::$selfInstance = ClassLoader::createClassLoader(FrameworkConfiguration::getSelfInstance());
} // END - if
// Return the instance
*/
// Get a debugger instance
-$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->getConfigEntry('debug_class'));
+$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_class'));
// Empty string should be ignored and used for testing the middleware
-DebugMiddleware::getInstance()->output('');
+DebugMiddleware::getSelfInstance()->output('');
// [EOF]
?>
// Try to load these includes in the given order
$configAppIncludes = array(
- 'class_' . FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
+ 'class_' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
'debug', // Some debugging stuff
'exceptions', // The application's own exception handler
'loader', // The application's class loader
);
// Cache base path/file here
-$basePathFile = FrameworkConfiguration::getInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getInstance()->getConfigEntry('app_name');
+$basePathFile = FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name');
// Is the directory there?
if (!is_dir($basePathFile)) {
// Not found.
- trigger_error('Application ' . FrameworkConfiguration::getInstance()->getConfigEntry('app_name') . ' not found.');
+ trigger_error('Application ' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name') . ' not found.');
} // END - if
// Load them all (try only)
//* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n";
require($appFqFn);
//* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n";
- } elseif (FrameworkConfiguration::getInstance()->getConfigEntry('verbose_level') > 0) {
+ } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) {
// File is missing
trigger_error(sprintf("Cannot load application script %s.php! File is missing or read-protected.",
$appInc