Commit 607f0caf authored by Taddeus Kroes's avatar Taddeus Kroes

Updated config constant names and locations.

parent 8808bee9
<?php
/**
* Base and plugin config for pQuery utility framework.
*
* @package pQuery
*/
/**
* Indicates whether the framework is in debug mode, which right
* now only means that occuring errors will be displayed or not.
*
* @var bool
*/
define('DEBUG', true);
/**
* The root location of the pQuery framework folder, used for file
* inclusions. The path is absolute and should end with a slash ('/').
*
* @var string
*/
define('PQUERY_ROOT', 'D:/xampp/htdocs/pquery/');
/**
* Abstract class containing plugin configs.
*/
abstract class pQueryConfig {
/**
* Indicates whether errors occuring in the framework will
* terminate the script.
*
* @var bool
*/
const ERROR_IS_FATAL = true;
/**
* Name of the utilities folder
*
* @var string
*/
const UTILS_FOLDER = 'utils/';
/**
* Config for MySQL plugin.
*
* @var array
*/
static $sql = array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'tcms2'
);
}
?>
\ No newline at end of file
...@@ -112,7 +112,7 @@ class pQuery { ...@@ -112,7 +112,7 @@ class pQuery {
} }
/** /**
* Display an error message if in {@link DEBUG} mode. * Display an error message if in debug mode.
* *
* The optional arguments are passed to {@link printf}, along with $error. * The optional arguments are passed to {@link printf}, along with $error.
* *
...@@ -314,7 +314,7 @@ function _p($variable, $plugin=null) { ...@@ -314,7 +314,7 @@ function _p($variable, $plugin=null) {
// Use custom plugin class // Use custom plugin class
if( isset(pQuery::$plugins[$plugin]) ) if( isset(pQuery::$plugins[$plugin]) )
$class_name = pQuery::$plugins[$plugin]; $class_name = pQuery::$plugins[$plugin];
else if( DEBUG ) else if( PQUERY_DEBUG )
pQuery::error('Plugin "%s" does not exist.', $plugin); pQuery::error('Plugin "%s" does not exist.', $plugin);
} }
......
...@@ -271,14 +271,14 @@ class pQuerySql extends pQuery implements pQueryExtension { ...@@ -271,14 +271,14 @@ class pQuerySql extends pQuery implements pQueryExtension {
/** /**
* Extention of {@link pQuery::error}, returning FALSE (useful in result loops). * Extention of {@link pQuery::error}, returning FALSE (useful in result loops).
* Also, the current query is printed in DEBUG mode. * Also, the current query is printed in debug mode.
* *
* @returns bool FALSE * @returns bool FALSE
*/ */
static function error() { static function error() {
parent::error('MySQL error %d: %s.', mysql_errno(), mysql_error()); parent::error('MySQL error %d: %s.', mysql_errno(), mysql_error());
if( DEBUG ) if( PQUERY_DEBUG )
echo $this->query; echo $this->query;
return false; return false;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* @var bool * @var bool
*/ */
define('DEBUG', true); define('PQUERY_DEBUG', true);
/** /**
* The root location of the pQuery framework folder, used for file * The root location of the pQuery framework folder, used for file
...@@ -21,17 +21,4 @@ define('DEBUG', true); ...@@ -21,17 +21,4 @@ define('DEBUG', true);
*/ */
define('PQUERY_ROOT', 'D:/xampp/htdocs/pquery/'); define('PQUERY_ROOT', 'D:/xampp/htdocs/pquery/');
/**
* Abstract class containing plugin configs.
*/
abstract class pQueryConfig {
/**
* Indicates whether errors occuring in the framework will
* terminate the script.
*
* @var bool
*/
const ERROR_IS_FATAL = true;
}
?> ?>
\ No newline at end of file
<?php <?php
__p::load_plugin('sql'); __p::load_plugin('sql');
include '../../debug.php';
class pQuerySqlTest extends UnitTestCase { class pQuerySqlTest extends UnitTestCase {
function __construct() { function __construct() {
......
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