inc/classes/main/extended/.htaccess -text
inc/classes/main/extended/class_ObjectLimits.php -text
inc/classes/main/extended/class_SerializationContainer.php -text
+inc/classes/main/factories/.htaccess -text
+inc/classes/main/factories/class_BaseFactory.php -text
+inc/classes/main/factories/web/.htaccess -text
+inc/classes/main/factories/web/class_NewsFactory.php -text
inc/classes/main/io/.htaccess -text
inc/classes/main/io/class_FileIOStream.php -text
inc/classes/main/io/class_FrameworkDirectoryPointer.php -text
*
* @return $cfhInstance - Configuration instance
*/
- public final function getConfigInstance () {
+ protected final function getConfigInstance () {
return self::$cfgInstance;
}
$commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
// Load the news here
- $this->loadNews($requestInstance);
+ $this->loadNewsByRequest($requestInstance);
// Execute the command
$commandInstance->execute($requestInstance, $responseInstance);
}
/**
- * Loads news from the connected database for later usage
+ * Loads news by a given request
*
* @param $requestInstance An instance of a request class
* @return void
*/
- private function loadNews (Requestable $requestInstance) {
- // Get the news page variable from the request instance
- $newsPage = $requestInstance->getRequestElement("news_page");
+ private function loadNewsByRequest (Requestable $requestInstance) {
+ // Generate a new news object but not carring about which concrete we have
+ $newsInstance = NewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general (base) factory
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseFactory extends BaseFrameworkSystem {
+ /**
+ * Private constructor
+ *
+ * @param $class Name of the real class (not BaseFactory)
+ * @return void
+ */
+ protected function __construct ($class) {
+ // Call parent constructor
+ parent::__construct($class);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A news factory for web pages
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NewsFactory extends BaseFactory {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("News-Fabrik für Webseiten");
+
+ // Create unique ID number
+ $this->createUniqueID();
+ }
+
+ /**
+ * Singleton getter for a special factory instance depending on the given
+ * request
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $factoryInstance An instance of a NewsFactory class
+ */
+ public final static function createFactoryByRequest (Requestable $requestInstance) {
+ // Generate the new instance
+ $factoryInstance = new NewsFactory();
+
+ // Get the element name
+ $element = FrameworkConfiguration::getInstance()->readConfig("app_selector_get");
+
+ // Analyze the request, first get the Uni* application name (short one from URL)
+ $appVariable = $requestInstance->getRequestElement($element);
+
+ // Add more code here...
+
+ // Return the prepared factory instance
+ return $factoryInstance;
+ }
+}
+
+// [EOF]
+?>
$langInstance->initLanguageStrings();
// Set language code from default config
- $langInstance->setLanguageCode($langInstance->getConfigInstance()->readConfig("default_lang"));
+ $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->readConfig("default_lang"));
// Remember this instance
self::$thisInstance = $langInstance;
}
// Get configuration instance
- $cfgInstance = $tplInstance->getConfigInstance();
+ $cfgInstance = FrameworkConfiguration::getInstance();
// Set the base path
$tplInstance->setBasePath($basePath);
// Read all directories but no sub directories
while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) {
// Is this a class file?
- if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == $cInstance->getConfigInstance()->readConfig("php_extension"))) {
+ if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == FrameworkConfiguration::getInstance()->readConfig("php_extension"))) {
// 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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
$content[title]