projects
/
core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
af9c1b5
)
Now all base paths are relative and constructed in BaseTemplateEngine genericly,...
author
Roland Häder
<roland@mxchange.org>
Sat, 14 Mar 2009 03:35:31 +0000
(
03:35
+0000)
committer
Roland Häder
<roland@mxchange.org>
Sat, 14 Mar 2009 03:35:31 +0000
(
03:35
+0000)
.gitattributes
patch
|
blob
|
history
inc/classes/main/class_BaseFrameworkSystem.php
patch
|
blob
|
history
inc/classes/main/io/class_FrameworkDirectoryPointer.php
patch
|
blob
|
history
inc/classes/main/language/class_LanguageSystem.php
patch
|
blob
|
history
inc/classes/main/template/class_BaseTemplateEngine.php
patch
|
blob
|
history
inc/classes/main/template/image/class_ImageTemplateEngine.php
patch
|
blob
|
history
inc/classes/main/template/mail/class_MailTemplateEngine.php
patch
|
blob
|
history
inc/classes/main/template/web/class_WebTemplateEngine.php
patch
|
blob
|
history
inc/config.php
patch
|
blob
|
history
templates/images/.htaccess
[new file with mode: 0644]
patch
|
blob
templates/images/_cache/.htaccess
[new file with mode: 0644]
patch
|
blob
diff --git
a/.gitattributes
b/.gitattributes
index d27ef43b139c03987bde3c7fbf3b168f63b33109..34429048609f38247725691200a12623812fa91d 100644
(file)
--- a/
.gitattributes
+++ b/
.gitattributes
@@
-507,6
+507,8
@@
inc/selector.php -text
/svn-externals.txt -text
templates/.htaccess -text
templates/_compiled/.htaccess -text
/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
tests/ConfigTest.php -text
tests/RegistryTest.php -text
tests/RequestTest.php -text
diff --git
a/inc/classes/main/class_BaseFrameworkSystem.php
b/inc/classes/main/class_BaseFrameworkSystem.php
index ade1a13689ac103c78ec8f242eb438a343fcf9d5..48ab38c3c2554eaacb91ee16f6fd7c9a072c2061 100644
(file)
--- a/
inc/classes/main/class_BaseFrameworkSystem.php
+++ b/
inc/classes/main/class_BaseFrameworkSystem.php
@@
-740,13
+740,6
@@
class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
} // END - if
} // END - if
} // 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
// Are both instances set?
if ($appInstance->getLanguageInstance() === null) {
// Invalid language instance
@@
-757,7
+750,7
@@
class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
}
// Initialize the template engine
}
// 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;
// Return the prepared instance
return $templateInstance;
diff --git
a/inc/classes/main/io/class_FrameworkDirectoryPointer.php
b/inc/classes/main/io/class_FrameworkDirectoryPointer.php
index e0a0c4e5bfcae51f016229ba1e1d758302787ad7..fbd45cf5b561f5c6abba91b1926090c8945f1aec 100644
(file)
--- a/
inc/classes/main/io/class_FrameworkDirectoryPointer.php
+++ b/
inc/classes/main/io/class_FrameworkDirectoryPointer.php
@@
-62,22
+62,21
@@
class FrameworkDirectoryPointer extends BaseFrameworkSystem {
* Create a directory pointer based on the given path. The path will also
* be verified here.
*
* 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
* is empty
* @throws InvalidPathStringException If the provided path name is
- * not a string
+ *
not a string
* @throws PathIsNoDirectoryException If the provided path name is
* @throws PathIsNoDirectoryException If the provided path name is
- * not valid
+ *
not valid
* @throws PathReadProtectedException If the provided path name is
* @throws PathReadProtectedException If the provided path name is
- * read-protected
+ *
read-protected
* @throws DirPointerNotOpened If opendir() returns not a
* @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...
*/
public final static function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) {
// Some pre-sanity checks...
diff --git
a/inc/classes/main/language/class_LanguageSystem.php
b/inc/classes/main/language/class_LanguageSystem.php
index fe66586aadaae8a5240595705bc910090b8259c4..9174badb31ef745a44f7d1ae3b820dd319459047 100644
(file)
--- a/
inc/classes/main/language/class_LanguageSystem.php
+++ b/
inc/classes/main/language/class_LanguageSystem.php
@@
-26,7
+26,7
@@
class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
/**
* The full-qualified base path for the language include files
*/
/**
* The full-qualified base path for the language include files
*/
- private $
b
asePath = '';
+ private $
languageB
asePath = '';
/**
* The 2-char language code
/**
* The 2-char language code
@@
-60,36
+60,36
@@
class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
/**
* Creates an instance of the class LanguageSystem and prepares it for usage
*
/**
* 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
* @return $langInstance An instance of LanguageSystem
- * @throws LanguagePathIsEmptyException
If the provided $b
asePath is empty
- * @throws InvalidLanguagePathStringException If $
b
asePath is no string
- * @throws LanguagePathIsNoDirectoryException If $
b
asePath is no
+ * @throws LanguagePathIsEmptyException
If the provided $languageB
asePath is empty
+ * @throws InvalidLanguagePathStringException If $
languageB
asePath is no string
+ * @throws LanguagePathIsNoDirectoryException If $
languageB
asePath is no
* directory or not found
* directory or not found
- * @throws LanguagePathReadProtectedException If $
b
asePath is
+ * @throws LanguagePathReadProtectedException If $
languageB
asePath is
* read-protected
*/
* read-protected
*/
- public final static function createLanguageSystem ($
b
asePath) {
+ public final static function createLanguageSystem ($
languageB
asePath) {
// Get a new instance
$langInstance = new LanguageSystem();
// Is the base path valid?
// Get a new instance
$langInstance = new LanguageSystem();
// Is the base path valid?
- if (empty($
b
asePath)) {
+ if (empty($
languageB
asePath)) {
// Language path is empty
throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
// Language path is empty
throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($
b
asePath)) {
+ } elseif (!is_string($
languageB
asePath)) {
// Is not a string
// Is not a string
- throw new InvalidLanguagePathStringException(array($langInstance, $
b
asePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($
b
asePath)) {
+ throw new InvalidLanguagePathStringException(array($langInstance, $
languageB
asePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($
languageB
asePath)) {
// Is not a path
// Is not a path
- throw new LanguagePathIsNoDirectoryException(array($langInstance, $
b
asePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($
b
asePath)) {
+ throw new LanguagePathIsNoDirectoryException(array($langInstance, $
languageB
asePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($
languageB
asePath)) {
// Is not readable
// Is not readable
- throw new LanguagePathReadProtectedException(array($langInstance, $
b
asePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new LanguagePathReadProtectedException(array($langInstance, $
languageB
asePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Set the base path
}
// Set the base path
- $langInstance->set
BasePath($b
asePath);
+ $langInstance->set
LanguageBasePath($languageB
asePath);
// Initialize the variable stack
$langInstance->initLanguageStrings();
// Initialize the variable stack
$langInstance->initLanguageStrings();
@@
-107,7
+107,7
@@
class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
/**
* Singleton getter for this instance
*
/**
* 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;
*/
public final static function getInstance () {
return self::$thisInstance;
@@
-116,18
+116,18
@@
class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
/**
* Setter for base path
*
/**
* Setter for base path
*
- * @param
$basePath The local base path for all templat
es
+ * @param
$languageBasePath The relative base path for all language fil
es
* @return void
*/
* @return void
*/
- protected final function set
BasePath ($b
asePath) {
+ protected final function set
LanguageBasePath ($languageB
asePath) {
// And set it
// And set it
- $this->
basePath = (string) $b
asePath;
+ $this->
languageBasePath = (string) $languageB
asePath;
}
/**
* Setter for language code
*
}
/**
* 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) {
* @return void
*/
protected final function setLanguageCode ($langCode) {
@@
-150,7
+150,7
@@
class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
/**
* Getter for language code
*
/**
* 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;
*/
public final function getLanguageCode () {
return $this->langCode;
diff --git
a/inc/classes/main/template/class_BaseTemplateEngine.php
b/inc/classes/main/template/class_BaseTemplateEngine.php
index 21234b81e8295b2e6eac43680f543a7068202fb8..60fa5f54e3c9fc997af5ce9f906ba71598c6379d 100644
(file)
--- a/
inc/classes/main/template/class_BaseTemplateEngine.php
+++ b/
inc/classes/main/template/class_BaseTemplateEngine.php
@@
-27,7
+27,7
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
* templates are stored. We will internally determine the language plus
* "html" for web templates or "emails" for email templates
*/
* templates are stored. We will internally determine the language plus
* "html" for web templates or "emails" for email templates
*/
- private $
b
asePath = '';
+ private $
templateB
asePath = '';
/**
* Template type
/**
* Template type
@@
-45,9
+45,14
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
private $codeExtension = '.ctp';
/**
private $codeExtension = '.ctp';
/**
- * Path relative to $
b
asePath and language code for compiled code-templates
+ * Path relative to $
templateB
asePath 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
/**
* The raw (maybe uncompiled) template
@@
-327,22
+332,22
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Setter for base path
*
/**
* Setter for base path
*
- * @param $
basePath The local
base path for all templates
+ * @param $
templateBasePath The relative
base path for all templates
* @return void
*/
* @return void
*/
- public final function set
BasePath ($b
asePath) {
+ public final function set
TemplateBasePath ($templateB
asePath) {
// And set it
// And set it
- $this->
basePath = (string) $b
asePath;
+ $this->
templateBasePath = (string) $templateB
asePath;
}
/**
* Getter for base path
*
}
/**
* 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 get
Template
BasePath () {
// And set it
// And set it
- return $this->
b
asePath;
+ return $this->
templateB
asePath;
}
/**
}
/**
@@
-523,10
+528,10
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
} // END - if
// Construct the FQFN for the template by honoring the current language
} // 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->ge
tBasePath()
,
+ $fqfn = sprintf("%s%s%s%s/%s/%s%s",
+ $this->getConfigInstance()->readConfig('
base
_path'),
+
$this->getTemplateBasePath
(),
+ $this->ge
nericBasePath
,
$this->getLanguageInstance()->getLanguageCode(),
$this->getTemplateType(),
(string) $template,
$this->getLanguageInstance()->getLanguageCode(),
$this->getTemplateType(),
(string) $template,
diff --git
a/inc/classes/main/template/image/class_ImageTemplateEngine.php
b/inc/classes/main/template/image/class_ImageTemplateEngine.php
index f20dc1b6732ee529174fefb49c02639b19f5a0e1..21e1490f5bc5e7ea0d809e34b2a467bf026d3815 100644
(file)
--- a/
inc/classes/main/template/image/class_ImageTemplateEngine.php
+++ b/
inc/classes/main/template/image/class_ImageTemplateEngine.php
@@
-74,41
+74,46
@@
class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
/**
* 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
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $
b
asePath is empty
- * @throws InvalidBasePathStringException If $
b
asePath is no string
- * @throws BasePathIsNoDirectoryException If $
b
asePath is no
+ * @throws BasePathIsEmptyException If the provided $
templateB
asePath is empty
+ * @throws InvalidBasePathStringException If $
templateB
asePath is no string
+ * @throws BasePathIsNoDirectoryException If $
templateB
asePath is no
* directory or not found
* directory or not found
- * @throws BasePathReadProtectedException If $
b
asePath is
+ * @throws BasePathReadProtectedException If $
templateB
asePath is
* read-protected
*/
* read-protected
*/
- public final static function createImageTemplateEngine (
$basePath, ManageableLanguage $langInstance, FileIoHandler $io
Instance) {
+ public final static function createImageTemplateEngine (
ManageableApplication $app
Instance) {
// Get a new instance
$tplInstance = new ImageTemplateEngine();
// 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?
// Is the base path valid?
- if (empty($
b
asePath)) {
+ if (empty($
templateB
asePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($
b
asePath)) {
+ } elseif (!is_string($
templateB
asePath)) {
// Is not a string
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($
b
asePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($
templateB
asePath)) {
// Is not a path
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($
b
asePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($
templateB
asePath)) {
// Is not readable
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $
b
asePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->set
BasePath($b
asePath);
+ $tplInstance->set
TemplateBasePath($templateB
asePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
@@
-469,7
+474,7
@@
class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
*/
public function getImageCacheFqfn () {
// Get the FQFN ready
*/
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->get
Template
BasePath().'_cache/' . md5($this->imageInstance->getImageName().':'.$this->__toString().':'.$this->imageInstance->__toString()) . '.' . $this->imageInstance->getImageType();
// Return it
return $fqfn;
// Return it
return $fqfn;
diff --git
a/inc/classes/main/template/mail/class_MailTemplateEngine.php
b/inc/classes/main/template/mail/class_MailTemplateEngine.php
index 64811c5e5104eb7e05cdb5ad5a5875b1dc349d98..c7c6d11bca52eea6037e5ec6afbf3f449f23bdc8 100644
(file)
--- a/
inc/classes/main/template/mail/class_MailTemplateEngine.php
+++ b/
inc/classes/main/template/mail/class_MailTemplateEngine.php
@@
-60,41
+60,46
@@
class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
/**
* 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
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $
b
asePath is empty
- * @throws InvalidBasePathStringException If $
b
asePath is no string
- * @throws BasePathIsNoDirectoryException If $
b
asePath is no
+ * @throws BasePathIsEmptyException If the provided $
templateB
asePath is empty
+ * @throws InvalidBasePathStringException If $
templateB
asePath is no string
+ * @throws BasePathIsNoDirectoryException If $
templateB
asePath is no
* directory or not found
* directory or not found
- * @throws BasePathReadProtectedException If $
b
asePath is
+ * @throws BasePathReadProtectedException If $
templateB
asePath is
* read-protected
*/
* read-protected
*/
- public final static function createMailTemplateEngine (
$basePath, ManageableLanguage $langInstance, FileIoHandler $io
Instance) {
+ public final static function createMailTemplateEngine (
ManageableApplication $app
Instance) {
// Get a new instance
$tplInstance = new MailTemplateEngine();
// 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?
// Is the base path valid?
- if (empty($
b
asePath)) {
+ if (empty($
templateB
asePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($
b
asePath)) {
+ } elseif (!is_string($
templateB
asePath)) {
// Is not a string
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($
b
asePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($
templateB
asePath)) {
// Is not a path
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($
b
asePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($
templateB
asePath)) {
// Is not readable
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $
b
asePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->set
BasePath($b
asePath);
+ $tplInstance->set
TemplateBasePath($templateB
asePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
diff --git
a/inc/classes/main/template/web/class_WebTemplateEngine.php
b/inc/classes/main/template/web/class_WebTemplateEngine.php
index fbd5d5724c7515270b28e310f8f25b71610ef666..855a2a0297e29f7f7beab12420f999fb9df411ea 100644
(file)
--- a/
inc/classes/main/template/web/class_WebTemplateEngine.php
+++ b/
inc/classes/main/template/web/class_WebTemplateEngine.php
@@
-36,41
+36,46
@@
class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
/**
* 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
* @return $tplInstance An instance of TemplateEngine
- * @throws BasePathIsEmptyException If the provided $
b
asePath is empty
- * @throws InvalidBasePathStringException If $
b
asePath is no string
- * @throws BasePathIsNoDirectoryException If $
b
asePath is no
+ * @throws BasePathIsEmptyException If the provided $
templateB
asePath is empty
+ * @throws InvalidBasePathStringException If $
templateB
asePath is no string
+ * @throws BasePathIsNoDirectoryException If $
templateB
asePath is no
* directory or not found
* directory or not found
- * @throws BasePathReadProtectedException If $
b
asePath is
+ * @throws BasePathReadProtectedException If $
templateB
asePath is
* read-protected
*/
* read-protected
*/
- public final static function createWebTemplateEngine (
$basePath, ManageableLanguage $langInstance, FileIoHandler $io
Instance) {
+ public final static function createWebTemplateEngine (
ManageableApplication $app
Instance) {
// Get a new instance
$tplInstance = new WebTemplateEngine();
// 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?
// Is the base path valid?
- if (empty($
b
asePath)) {
+ if (empty($
templateB
asePath)) {
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
// Base path is empty
throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($
b
asePath)) {
+ } elseif (!is_string($
templateB
asePath)) {
// Is not a string
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_STRING);
- } elseif (!is_dir($
b
asePath)) {
+ throw new InvalidBasePathStringException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($
templateB
asePath)) {
// Is not a path
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $
b
asePath), self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($
b
asePath)) {
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($
templateB
asePath)) {
// Is not readable
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $
b
asePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($tplInstance, $
templateB
asePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->set
BasePath($b
asePath);
+ $tplInstance->set
TemplateBasePath($templateB
asePath);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
diff --git
a/inc/config.php
b/inc/config.php
index d46207331f9b536d02bdaa54a389cb10994f1438..72d5f9868c550393803fa138d6a6e67a371fd671 100644
(file)
--- a/
inc/config.php
+++ b/
inc/config.php
@@
-80,8
+80,11
@@
$cfg->setConfigEntry('lang_base_path', "inc/language/");
// CFG: COMPRESSOR-BASE-PATH
$cfg->setConfigEntry('compressor_base_path', "inc/classes/main/compressor/");
// 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: 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/");
// CFG: COMPILE-OUTPUT-PATH
$cfg->setConfigEntry('compile_output_path', "templates/_compiled/");
diff --git a/templates/images/.htaccess
b/templates/images/.htaccess
new file mode 100644
(file)
index 0000000..
3a42882
--- /dev/null
+++ b/
templates/images/.htaccess
@@ -0,0
+1
@@
+Deny from all
diff --git a/templates/images/_cache/.htaccess
b/templates/images/_cache/.htaccess
new file mode 100644
(file)
index 0000000..
3a42882
--- /dev/null
+++ b/
templates/images/_cache/.htaccess
@@ -0,0
+1
@@
+Deny from all