/**
* 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]
/**
* 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;
}
}
<?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
*/
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 {
*/
private $instanceRegistry = array();
+ /**
+ * Raw data entries (non-objects)
+ */
+ private $rawEntries = array();
+
/**
* Protected constructor
*
$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
*
/**
* 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;
}
}
throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
- // Get configuration instance
- $configInstance = FrameworkConfiguration::getInstance();
-
// Set the base path
$templateInstance->setTemplateBasePath($templateBasePath);
$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;
throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
- // Get configuration instance
- $configInstance = FrameworkConfiguration::getInstance();
-
// Set the base path
$templateInstance->setTemplateBasePath($templateBasePath);
$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;
throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
- // Get configuration instance
- $configInstance = FrameworkConfiguration::getInstance();
-
// Set the base path
$templateInstance->setTemplateBasePath($templateBasePath);
$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;
throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
- // Get configuration instance
- $configInstance = FrameworkConfiguration::getInstance();
-
// Set the base path
$templateInstance->setTemplateBasePath($templateBasePath);
$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);
throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
- // Get configuration instance
- $configInstance = FrameworkConfiguration::getInstance();
-
// Set the base path
$templateInstance->setTemplateBasePath($templateBasePath);
$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;
/**
* 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
// 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
// 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;
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 ..."