Commit 65b55aee authored by Taddeus Kroes's avatar Taddeus Kroes

Added SITE_ROOT constant for relative includes.

parent cf055ed4
...@@ -276,18 +276,14 @@ class pQuery { ...@@ -276,18 +276,14 @@ class pQuery {
/** /**
* Assert that the given constants have been defined. * Assert that the given constants have been defined.
* Add the prefix 'PQUERY_' to each constant name.
*/ */
static function assert_defined(/* $constant1 [ , $constant2, ... ] */) { static function assert_defined(/* $constant1 [ , $constant2, ... ] */) {
$constants = func_get_args(); $constants = func_get_args();
$undefined = array(); $undefined = array();
foreach( $constants as $constant ) { foreach( $constants as $constant )
$constant = 'PQUERY_'.$constant;
if( !defined($constant) ) if( !defined($constant) )
$undefined[] = $constant; $undefined[] = $constant;
}
count($undefined) && self::error('The following constants have' count($undefined) && self::error('The following constants have'
.' not been defined: %s', implode(', ', $undefined)); .' not been defined: %s', implode(', ', $undefined));
...@@ -338,6 +334,6 @@ class_alias('pQuery', '__p'); ...@@ -338,6 +334,6 @@ class_alias('pQuery', '__p');
*/ */
set_exception_handler('__p::exception_handler'); set_exception_handler('__p::exception_handler');
__p::assert_defined('DEBUG', 'ROOT'); __p::assert_defined('PQUERY_DEBUG', 'PQUERY_ROOT', 'SITE_ROOT');
?> ?>
\ No newline at end of file
...@@ -251,7 +251,7 @@ class pQueryTemplate extends pQuery { ...@@ -251,7 +251,7 @@ class pQueryTemplate extends pQuery {
* @param bool $relative Indicates whether the path is relative to the document root. * @param bool $relative Indicates whether the path is relative to the document root.
*/ */
static function add_root($path, $relative=true) { static function add_root($path, $relative=true) {
$relative && $path = PQUERY_ROOT.$path; $relative && $path = SITE_ROOT.$path;
preg_match('%/$%', $path) || $path .= '/'; preg_match('%/$%', $path) || $path .= '/';
if( !is_dir($path) ) if( !is_dir($path) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment