]> git.mxchange.org Git - core.git/commitdiff
Some code-cosmetics applied:
authorRoland Häder <roland@mxchange.org>
Tue, 18 May 2010 19:44:22 +0000 (19:44 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 18 May 2010 19:44:22 +0000 (19:44 +0000)
- No longer gettings a $configInstance, lets use
  $templateInstance->getConfigInstance() instead.
- Some other minor costemical changes

14 files changed:
inc/classes/interfaces/template/class_CompileableTemplate.php
inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
inc/classes/main/discovery/class_
inc/classes/main/parser/xml/class_XmlParser.php
inc/classes/main/registry/class_
inc/classes/main/registry/class_BaseRegistry.php
inc/classes/main/template/class_BaseTemplateEngine.php
inc/classes/main/template/console/class_ConsoleTemplateEngine.php
inc/classes/main/template/image/class_ImageTemplateEngine.php
inc/classes/main/template/mail/class_MailTemplateEngine.php
inc/classes/main/template/menu/class_MenuTemplateEngine.php
inc/classes/main/template/web/class_WebTemplateEngine.php
inc/loader/class_ClassLoader.php
setup-repos.sh

index c6b1a1a8a87d5a9b3fe5f6596844773a03720f6b..1e7f82fd68e87c95d0f70d8c867ead1c6eda07a4 100644 (file)
@@ -184,10 +184,10 @@ interface CompileableTemplate extends FrameworkInterface {
        /**
         * Removes all comments, tabs and new-line charcters to compact the content
         *
-        * @param       $content        The uncompacted content
-        * @return      $content        The compacted content
+        * @param       $uncompactedContent             The uncompacted content
+        * @return      $compactedContent               The compacted content
         */
-       function compactContent ($content);
+       function compactContent ($uncompactedContent);
 }
 
 // [EOF]
index c849ef1351eb9f746ccc25d36086179d7ff09eba..2cddb8cfe4eb0c41d730110cae7f5cfd33c0f0ce 100644 (file)
@@ -433,11 +433,15 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT
        /**
         * Removes all comments, tabs and new-line charcters to compact the content
         *
-        * @param       $content        The uncompacted content
-        * @return      $content        The compacted content
+        * @param       $uncompactedContent             The uncompacted content
+        * @return      $compactedContent               The compacted content
         */
-       public function compactContent ($content) {
-               $this->getTemplateInstance()->compactContent($content);
+       public function compactContent ($uncompactedContent) {
+               // Compact it ...
+               $compactedContent = $this->getTemplateInstance()->compactContent($uncompactedContent);
+
+               // ... and return it
+               return $compactedContent;
        }
 }
 
index 4f6d851254d44c11f88465e6afe2afac8b0cea6d..61327dd3c72b6d3aaf371bca529dab3075c26793 100644 (file)
@@ -1,8 +1,6 @@
 <?php
 /**
- * A local payment discovery class. This class looks in local database for
- * registered payment types and like all the others it at least returns the
- * money bank transfer type.
+ * A ??? discovery class.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 76c39879e3efc28241e00c0e4996700248235477..63d508a594a31ae39059441aee7f914f7562b839 100644 (file)
@@ -63,7 +63,13 @@ class XmlParser extends BaseParser implements Parseable {
         */
        public function parseXmlContent ($content) {
                // Convert all to UTF8
-               if (function_exists('recode')) {
+               if (empty($content)) {
+                       // No empty content!
+                       $this->debugOuput('Empty content! Backtrace: <pre>');
+                       debug_print_backtrace();
+                       $this->debugOuput('</pre>');
+                       die();
+               } elseif (function_exists('recode')) {
                        // Recode found, so use it
                        $content = recode('html..utf8', $content);
                } else {
index e86c16537d145e70ad6d182afc45fd7024cc9b74..c2a1b7cf907f6cf229bee9ef95e7edc7412181d2 100644 (file)
@@ -57,4 +57,3 @@ class ???Registry extends BaseRegistry implements Register {
 
 // [EOF]
 ?>
-
index 33111286289bfa7de5001d5149dc53a3d082833f..ca01a2a2a75abcbb479361fea5b5593e5d47c9a2 100644 (file)
@@ -32,6 +32,11 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
         */
        private $instanceRegistry = array();
 
+       /**
+        * Raw data entries (non-objects)
+        */
+       private $rawEntries = array();
+
        /**
         * Protected constructor
         *
@@ -68,6 +73,70 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
                $this->instanceRegistry[$instanceKey] = $objectInstance;
        }
 
+       /**
+        * Adds a new entry to the given list name. If you want to add objects
+        * please use addInstance() and getInstance() instead.
+        *
+        * @param       $key    The key to identify the whole list
+        * @param       $value  The value to be stored
+        * @return      void
+        */
+       public final function addEntry ($key, $value) {
+               // Simply add it
+               $this->rawEntries[$key][] = $value;
+       }
+
+       /**
+        * Getter for entries or "sub entries"
+        *
+        * @return      $entries        An array with entries from this registry
+        */
+       public final function getEntries ($key = null) {
+               // Default is whole array
+               $entries = $this->rawEntries;
+
+               // Is $key set?
+               if (!is_null($key)) {
+                       // Then use this entry
+                       $entries = $this->rawEntries[$key];
+               } // END - if
+
+               // Return the array
+               return $entries;
+       }
+
+       /**
+        * "Getter" for an array of all entries for given key
+        *
+        * @param       $lookFor        The key to look for
+        * @return      $entry          An array with all keys
+        */
+       public function getArrayFromKey ($lookFor) {
+               // Init array
+               $entry = array();
+
+               // "Walk" over all entries
+               foreach ($this->getEntries('object-name') as $key=>$value) {
+                       // If $value matches the $lookFor, we need to look for more entries for this!
+                       if ($lookFor == $value) {
+                               // Look for more entries
+                               foreach ($this->getEntries() as $key2=>$value2) {
+                                       // Both keys must match!
+                                       if ($key == $key2) {
+                                               // Then add it
+                                               $entry[$key2] = $value2[$key];
+                                       } // END - if
+                               } // END - foreach
+
+                               // Skip further lookups
+                               break;
+                       } // END - if
+               } // END - foreach
+
+               // Return it
+               return $entry;
+       }
+
        /**
         * Gets a registered instance or null if not found
         *
index b64477c4f10b41704cfbe582ba49b11ef1cfbfde..c1aa4f8fc22f1be5be4675005f75ea9c5b1e617b 100644 (file)
@@ -1496,27 +1496,27 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * Removes all commentd, tabs and new-line characters to compact the content
         *
-        * @param       $content        The uncompacted content
-        * @return      $content        The compacted content
+        * @param       $uncompactedContent             The uncompacted content
+        * @return      $compactedContent               The compacted content
         */
-       public function compactContent ($content) {
+       public function compactContent ($uncompactedContent) {
                // First, remove all tab/new-line/revert characters
-               $content = str_replace("\t", '', str_replace("\n", '', str_replace("\r", '', $content)));
+               $compactedContent = str_replace("\t", '', str_replace("\n", '', str_replace("\r", '', $uncompactedContent)));
 
                // Then regex all comments like <!-- //--> away
-               preg_match_all('/<!--[\w\W]*?(\/\/){0,1}-->/', $content, $matches);
+               preg_match_all('/<!--[\w\W]*?(\/\/){0,1}-->/', $compactedContent, $matches);
 
                // Do we have entries?
                if (isset($matches[0][0])) {
                        // Remove all
                        foreach ($matches[0] as $match) {
                                // Remove the match
-                               $content = str_replace($match, '', $content);
+                               $compactedContent = str_replace($match, '', $compactedContent);
                        } // END - foreach
                } // END - if
 
                // Return compacted content
-               return $content;
+               return $compactedContent;
        }
 }
 
index 330545a244284a91ee9c18179d72b85c32a31c30..83fc014ad9f3df4fca9d60408ec6f8598e6a362a 100644 (file)
@@ -71,9 +71,6 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem
                        throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
                }
 
-               // Get configuration instance
-               $configInstance = FrameworkConfiguration::getInstance();
-
                // Set the base path
                $templateInstance->setTemplateBasePath($templateBasePath);
 
@@ -82,11 +79,11 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem
                $templateInstance->setFileIoInstance($ioInstance);
 
                // Set template extensions
-               $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+               $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
 
                // Absolute output path for compiled templates
-               $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+               $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Return the prepared instance
                return $templateInstance;
index bc0e8021181339d7116c6cb36c06c04351368313..2c6cb376638bcf68150bda46032cf601f04c4dc6 100644 (file)
@@ -104,9 +104,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                        throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
                }
 
-               // Get configuration instance
-               $configInstance = FrameworkConfiguration::getInstance();
-
                // Set the base path
                $templateInstance->setTemplateBasePath($templateBasePath);
 
@@ -115,11 +112,11 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                $templateInstance->setFileIoInstance($ioInstance);
 
                // Set template extensions
-               $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+               $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
 
                // Absolute output path for compiled templates
-               $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+               $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Return the prepared instance
                return $templateInstance;
index 99072276eefb33f9dd3fd33ed3b6bad31f2cc118..4230ac6b035e097b6140afec31419d1ec905c909 100644 (file)
@@ -98,9 +98,6 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                        throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
                }
 
-               // Get configuration instance
-               $configInstance = FrameworkConfiguration::getInstance();
-
                // Set the base path
                $templateInstance->setTemplateBasePath($templateBasePath);
 
@@ -109,11 +106,11 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                $templateInstance->setFileIoInstance($ioInstance);
 
                // Set template extensions
-               $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+               $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
 
                // Absolute output path for compiled templates
-               $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+               $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Return the prepared instance
                return $templateInstance;
index 59d1eeef2492e67db63051978e4aa31ab88e3bed..af9a375667a7a21a00c588544c8db5cb74f80167 100644 (file)
@@ -121,9 +121,6 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                        throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
                }
 
-               // Get configuration instance
-               $configInstance = FrameworkConfiguration::getInstance();
-
                // Set the base path
                $templateInstance->setTemplateBasePath($templateBasePath);
 
@@ -132,11 +129,11 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
                $templateInstance->setFileIoInstance($ioInstance);
 
                // Set template extensions
-               $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('menu_template_extension'));
+               $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('menu_template_extension'));
 
                // Absolute output path for compiled templates
-               $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+               $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Set the menu instance
                $templateInstance->setMenuInstance($menuInstance);
index b2377a999e6f745718308df128ea9c2e0890ef30..043277a62cdfc6ba4463832101689211bd51e412 100644 (file)
@@ -71,9 +71,6 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat
                        throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
                }
 
-               // Get configuration instance
-               $configInstance = FrameworkConfiguration::getInstance();
-
                // Set the base path
                $templateInstance->setTemplateBasePath($templateBasePath);
 
@@ -82,11 +79,11 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat
                $templateInstance->setFileIoInstance($ioInstance);
 
                // Set template extensions
-               $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+               $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension'));
 
                // Absolute output path for compiled templates
-               $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+               $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Return the prepared instance
                return $templateInstance;
index 34fd3c3cfd1e64fce72775dbe1ab7db95055843e..79768fff9b3f196bc9df9b5ac8136a2611e3e25e 100644 (file)
@@ -53,12 +53,12 @@ class ClassLoader {
        /**
         * Suffix with extension for all class files
         */
-       private $prefix = "class_";
+       private $prefix = 'class_';
 
        /**
         * Suffix with extension for all class files
         */
-       private $suffix = ".php";
+       private $suffix = '.php';
 
        /**
         * A list for directory names (no leading/trailing slashes!) which not be scanned by the path scanner
@@ -135,8 +135,8 @@ class ClassLoader {
 
                // Construct the FQFN for the cache
                if (!defined('DEVELOPER')) {
-                       $this->listCacheFQFN  = $this->configInstance->getConfigEntry('local_db_path') . "list-" . $this->configInstance->getConfigEntry('app_name') . ".cache";
-                       $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_db_path') . "class-" . $this->configInstance->getConfigEntry('app_name') . ".cache";
+                       $this->listCacheFQFN  = $this->configInstance->getConfigEntry('local_db_path') . 'list-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
+                       $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_db_path') . 'class-' . $this->configInstance->getConfigEntry('app_name') . '.cache';
                } // END - if
 
                // Set suffix and prefix from configuration
@@ -260,7 +260,7 @@ class ClassLoader {
                // If the basePath is false it is invalid
                if ($basePath2 === false) {
                        /* @todo: Do not die here. */
-                       die("Cannot read {$basePath} !");
+                       die('Cannot read ' . $basePath . ' !');
                } else {
                        // Set base path
                        $basePath = $basePath2;
index b3d91640d5bdd0c6bff286fef2f84a6ccdb91d3c..60d1fb6b81f57e1a92135275e0208f8874cd24b1 100755 (executable)
@@ -42,7 +42,7 @@ install http://www.ship-simu.org/repos/install/trunk/application/install/" . ||
        fi
        cd .. # trunk
 else
-       echo "${0}: --- Not setting admin external source. ---"
+       echo "${0}: --- Not setting admin/install external source. ---"
 fi
 cd .. # root
 echo "${0}: Running commit ..."