/svn-externals.txt -text
templates/.htaccess -text
templates/_compiled/.htaccess -text
+templates/images/.htaccess -text
+templates/images/_cache/.htaccess -text
tests/ConfigTest.php -text
tests/RegistryTest.php -text
tests/RequestTest.php -text
} // END - if
} // END - if
- // Generate FQFN for all application templates
- $fqfn = sprintf("%s%s/%s",
- $this->getConfigInstance()->readConfig('application_path'),
- strtolower($appInstance->getAppShortName()),
- $this->getConfigInstance()->readConfig('tpl_base_path')
- );
-
// Are both instances set?
if ($appInstance->getLanguageInstance() === null) {
// Invalid language instance
}
// Initialize the template engine
- $templateInstance = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
+ $templateInstance = ObjectFactory::createObjectByConfiguredName('template_class', array($appInstance));
// Return the prepared instance
return $templateInstance;
* Create a directory pointer based on the given path. The path will also
* be verified here.
*
- * @param $pathName The path name we shall pass
- * to opendir()
- * @param $inConstructor If we are in de/con-structor
- * or from somewhere else
- * @throws PathIsEmptyException If the provided path name
+ * @param $pathName The path name we shall pass to opendir()
+ * @param $inConstructor If we are in de/con-structor or from somewhere
+ * else
+ * @return $pointerInstance A prepared instance of
+ * FrameworkDirectoryPointer
+ * @throws PathIsEmptyException If the provided path name
* is empty
* @throws InvalidPathStringException If the provided path name is
- * not a string
+ * not a string
* @throws PathIsNoDirectoryException If the provided path name is
- * not valid
+ * not valid
* @throws PathReadProtectedException If the provided path name is
- * read-protected
+ * read-protected
* @throws DirPointerNotOpened If opendir() returns not a
- * directory resource
- * @return $pointerInstance A prepared instance of
- * FrameworkDirectoryPointer
+ * directory resource
*/
public final static function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) {
// Some pre-sanity checks...
/**
* The full-qualified base path for the language include files
*/
- private $basePath = '';
+ private $languageBasePath = '';
/**
* The 2-char language code
/**
* Creates an instance of the class LanguageSystem and prepares it for usage
*
- * @param $basePath The local base path for all language strings
+ * @param $languageBasePath The local base path for all language strings
* @return $langInstance An instance of LanguageSystem
- * @throws LanguagePathIsEmptyException If the provided $basePath is empty
- * @throws InvalidLanguagePathStringException If $basePath is no string
- * @throws LanguagePathIsNoDirectoryException If $basePath is no
+ * @throws LanguagePathIsEmptyException If the provided $languageBasePath is empty
+ * @throws InvalidLanguagePathStringException If $languageBasePath is no string
+ * @throws LanguagePathIsNoDirectoryException If $languageBasePath is no
* directory or not found
- * @throws LanguagePathReadProtectedException If $basePath is
+ * @throws LanguagePathReadProtectedException If $languageBasePath is
* read-protected
*/
- public final static function createLanguageSystem ($basePath) {
+ public final static function createLanguageSystem ($languageBasePath) {
// Get a new instance
$langInstance = new LanguageSystem();
// Is the base path valid?
- if (empty($basePath)) {
+ if (empty($languageBasePath)) {
// Language path is empty
throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($basePath)) {
+ } elseif (!is_string($languageBasePath)) {
// Is not a string
- throw new InvalidLanguagePathStringException(array($langInstance, $basePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($basePath)) {
+ throw new InvalidLanguagePathStringException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($languageBasePath)) {
// Is not a path
- throw new LanguagePathIsNoDirectoryException(array($langInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($basePath)) {
+ throw new LanguagePathIsNoDirectoryException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($languageBasePath)) {
// Is not readable
- throw new LanguagePathReadProtectedException(array($langInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new LanguagePathReadProtectedException(array($langInstance, $languageBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Set the base path
- $langInstance->setBasePath($basePath);
+ $langInstance->setLanguageBasePath($languageBasePath);
// Initialize the variable stack
$langInstance->initLanguageStrings();
/**
* Singleton getter for this instance
*
- * @return $thisInstance An instance of this class
+ * @return $thisInstance An instance of this class
*/
public final static function getInstance () {
return self::$thisInstance;
/**
* Setter for base path
*
- * @param $basePath The local base path for all templates
+ * @param $languageBasePath The relative base path for all language files
* @return void
*/
- protected final function setBasePath ($basePath) {
+ protected final function setLanguageBasePath ($languageBasePath) {
// And set it
- $this->basePath = (string) $basePath;
+ $this->languageBasePath = (string) $languageBasePath;
}
/**
* Setter for language code
*
- * @param $langCode The language code for the current application
+ * @param $langCode The language code for the current application
* @return void
*/
protected final function setLanguageCode ($langCode) {
/**
* Getter for language code
*
- * @return $langCode The language code for the current application
+ * @return $langCode The language code for the current application
*/
public final function getLanguageCode () {
return $this->langCode;
* templates are stored. We will internally determine the language plus
* "html" for web templates or "emails" for email templates
*/
- private $basePath = '';
+ private $templateBasePath = '';
/**
* Template type
private $codeExtension = '.ctp';
/**
- * Path relative to $basePath and language code for compiled code-templates
+ * Path relative to $templateBasePath and language code for compiled code-templates
*/
- private $compileOutputPath = 'templates/_compiled';
+ private $compileOutputPath = 'templates/_compiled/';
+
+ /**
+ * The path name for all templates
+ */
+ private $genericBasePath = 'templates/';
/**
* The raw (maybe uncompiled) template
/**
* Setter for base path
*
- * @param $basePath The local base path for all templates
+ * @param $templateBasePath The relative base path for all templates
* @return void
*/
- public final function setBasePath ($basePath) {
+ public final function setTemplateBasePath ($templateBasePath) {
// And set it
- $this->basePath = (string) $basePath;
+ $this->templateBasePath = (string) $templateBasePath;
}
/**
* Getter for base path
*
- * @return $basePath The local base path for all templates
+ * @return $templateBasePath The relative base path for all templates
*/
- public final function getBasePath () {
+ public final function getTemplateBasePath () {
// And set it
- return $this->basePath;
+ return $this->templateBasePath;
}
/**
} // END - if
// Construct the FQFN for the template by honoring the current language
- $fqfn = sprintf("%s%s/%s%s/%s/%s%s",
- $this->getConfigInstance()->readConfig('application_path'),
- Registry::getRegistry()->getInstance('application')->getAppShortName(),
- $this->getBasePath(),
+ $fqfn = sprintf("%s%s%s%s/%s/%s%s",
+ $this->getConfigInstance()->readConfig('base_path'),
+ $this->getTemplateBasePath(),
+ $this->genericBasePath,
$this->getLanguageInstance()->getLanguageCode(),
$this->getTemplateType(),
(string) $template,
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
- * @param $basePath The local base path for all templates
- * @param $langInstance An instance of LanguageSystem (default)
- * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @param $appInstance A manageable application
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $basePath is empty
- * @throws InvalidBasePathStringException If $basePath is no string
- * @throws BasePathIsNoDirectoryException If $basePath is no
+ * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
+ * @throws InvalidBasePathStringException If $templateBasePath is no string
+ * @throws BasePathIsNoDirectoryException If $templateBasePath is no
* directory or not found
- * @throws BasePathReadProtectedException If $basePath is
+ * @throws BasePathReadProtectedException If $templateBasePath is
* read-protected
*/
- public final static function createImageTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ public final static function createImageTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
$tplInstance = new ImageTemplateEngine();
+ // Get language and file I/O instances from application
+ $langInstance = $appInstance->getLanguageInstance();
+ $ioInstance = $appInstance->getFileIoInstance();
+
+ // Determine base path
+ $templateBasePath = $tplInstance->getConfigInstance()->readConfig('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+
// Is the base path valid?
- if (empty($basePath)) {
+ if (empty($templateBasePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($basePath)) {
+ } elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($basePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($basePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setBasePath($basePath);
+ $tplInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
*/
public function getImageCacheFqfn () {
// Get the FQFN ready
- $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().':'.$this->__toString().':'.$this->imageInstance->__toString()) . '.' . $this->imageInstance->getImageType();
+ $fqfn = $this->getTemplateBasePath().'_cache/' . md5($this->imageInstance->getImageName().':'.$this->__toString().':'.$this->imageInstance->__toString()) . '.' . $this->imageInstance->getImageType();
// Return it
return $fqfn;
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
- * @param $basePath The local base path for all templates
- * @param $langInstance An instance of LanguageSystem (default)
- * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @param $appInstance A manageable application
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $basePath is empty
- * @throws InvalidBasePathStringException If $basePath is no string
- * @throws BasePathIsNoDirectoryException If $basePath is no
+ * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
+ * @throws InvalidBasePathStringException If $templateBasePath is no string
+ * @throws BasePathIsNoDirectoryException If $templateBasePath is no
* directory or not found
- * @throws BasePathReadProtectedException If $basePath is
+ * @throws BasePathReadProtectedException If $templateBasePath is
* read-protected
*/
- public final static function createMailTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ public final static function createMailTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
$tplInstance = new MailTemplateEngine();
+ // Get language and file I/O instances from application
+ $langInstance = $appInstance->getLanguageInstance();
+ $ioInstance = $appInstance->getFileIoInstance();
+
+ // Determine base path
+ $templateBasePath = $tplInstance->getConfigInstance()->readConfig('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+
// Is the base path valid?
- if (empty($basePath)) {
+ if (empty($templateBasePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($basePath)) {
+ } elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($basePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($basePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setBasePath($basePath);
+ $tplInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
- * @param $basePath The local base path for all templates
- * @param $langInstance An instance of LanguageSystem (default)
- * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @param $appInstance A manageable application
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $basePath is empty
- * @throws InvalidBasePathStringException If $basePath is no string
- * @throws BasePathIsNoDirectoryException If $basePath is no
+ * @throws BasePathIsEmptyException If the provided $templateBasePath is empty
+ * @throws InvalidBasePathStringException If $templateBasePath is no string
+ * @throws BasePathIsNoDirectoryException If $templateBasePath is no
* directory or not found
- * @throws BasePathReadProtectedException If $basePath is
+ * @throws BasePathReadProtectedException If $templateBasePath is
* read-protected
*/
- public final static function createWebTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ public final static function createWebTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
$tplInstance = new WebTemplateEngine();
+ // Get language and file I/O instances from application
+ $langInstance = $appInstance->getLanguageInstance();
+ $ioInstance = $appInstance->getFileIoInstance();
+
+ // Determine base path
+ $templateBasePath = $tplInstance->getConfigInstance()->readConfig('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+
// Is the base path valid?
- if (empty($basePath)) {
+ if (empty($templateBasePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($basePath)) {
+ } elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($basePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($basePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setBasePath($basePath);
+ $tplInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
// CFG: COMPRESSOR-BASE-PATH
$cfg->setConfigEntry('compressor_base_path', "inc/classes/main/compressor/");
+// CFG: APPLICATION-BASE-PATH
+$cfg->setConfigEntry('application_base_path', "application/");
+
// CFG: APPLICATION-PATH
-$cfg->setConfigEntry('application_path', $cfg->readConfig('base_path') . "application/");
+$cfg->setConfigEntry('application_path', $cfg->readConfig('base_path') . $cfg->readConfig('application_base_path'));
// CFG: COMPILE-OUTPUT-PATH
$cfg->setConfigEntry('compile_output_path', "templates/_compiled/");
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all