mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merging the Limesurvey 1.91+ branch of queXS in to the trunk
This commit is contained in:
@@ -40,7 +40,7 @@ define('PEAR_ERROR_CALLBACK', 16);
|
||||
define('PEAR_ERROR_EXCEPTION', 32);
|
||||
/**#@-*/
|
||||
define('PEAR_ZE2', (function_exists('version_compare') &&
|
||||
version_compare(zend_version(), "2-dev", "ge")));
|
||||
version_compare(zend_version(), "2-dev", "ge")));
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
define('OS_WINDOWS', true);
|
||||
@@ -216,17 +216,17 @@ class PEAR
|
||||
// {{{ getStaticProperty()
|
||||
|
||||
/**
|
||||
* If you have a class that's mostly/entirely static, and you need static
|
||||
* properties, you can use this method to simulate them. Eg. in your method(s)
|
||||
* do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
|
||||
* You MUST use a reference, or they will not persist!
|
||||
*
|
||||
* @access public
|
||||
* @param string $class The calling classname, to prevent clashes
|
||||
* @param string $var The variable to retrieve.
|
||||
* @return mixed A reference to the variable. If not set it will be
|
||||
* auto initialised to NULL.
|
||||
*/
|
||||
* If you have a class that's mostly/entirely static, and you need static
|
||||
* properties, you can use this method to simulate them. Eg. in your method(s)
|
||||
* do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
|
||||
* You MUST use a reference, or they will not persist!
|
||||
*
|
||||
* @access public
|
||||
* @param string $class The calling classname, to prevent clashes
|
||||
* @param string $var The variable to retrieve.
|
||||
* @return mixed A reference to the variable. If not set it will be
|
||||
* auto initialised to NULL.
|
||||
*/
|
||||
function &getStaticProperty($class, $var)
|
||||
{
|
||||
static $properties;
|
||||
@@ -237,14 +237,14 @@ class PEAR
|
||||
// {{{ registerShutdownFunc()
|
||||
|
||||
/**
|
||||
* Use this function to register a shutdown method for static
|
||||
* classes.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $func The function name (or array of class/method) to call
|
||||
* @param mixed $args The arguments to pass to the function
|
||||
* @return void
|
||||
*/
|
||||
* Use this function to register a shutdown method for static
|
||||
* classes.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $func The function name (or array of class/method) to call
|
||||
* @param mixed $args The arguments to pass to the function
|
||||
* @return void
|
||||
*/
|
||||
function registerShutdownFunc($func, $args = array())
|
||||
{
|
||||
$GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
|
||||
@@ -263,7 +263,7 @@ class PEAR
|
||||
* $code is an integer and $obj->getCode() == $code
|
||||
* @access public
|
||||
* @return bool true if parameter is an error
|
||||
*/
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if ($data instanceof PEAR_Error) {
|
||||
@@ -510,12 +510,12 @@ class PEAR
|
||||
* @since PHP 4.0.5
|
||||
*/
|
||||
function &raiseError($message = null,
|
||||
$code = null,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
$userinfo = null,
|
||||
$error_class = null,
|
||||
$skipmsg = false)
|
||||
$code = null,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
$userinfo = null,
|
||||
$error_class = null,
|
||||
$skipmsg = false)
|
||||
{
|
||||
// The error is yet a PEAR error object
|
||||
if (is_object($message)) {
|
||||
@@ -528,8 +528,8 @@ class PEAR
|
||||
|
||||
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
|
||||
if ($exp[0] == "*" ||
|
||||
(is_int(reset($exp)) && in_array($code, $exp)) ||
|
||||
(is_string(reset($exp)) && in_array($message, $exp))) {
|
||||
(is_int(reset($exp)) && in_array($code, $exp)) ||
|
||||
(is_string(reset($exp)) && in_array($message, $exp))) {
|
||||
$mode = PEAR_ERROR_RETURN;
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,7 @@ class PEAR
|
||||
if (isset($this) && isset($this->_default_error_mode)) {
|
||||
$mode = $this->_default_error_mode;
|
||||
$options = $this->_default_error_options;
|
||||
// Global error handler
|
||||
// Global error handler
|
||||
} elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
|
||||
$mode = $GLOBALS['_PEAR_default_error_mode'];
|
||||
$options = $GLOBALS['_PEAR_default_error_options'];
|
||||
@@ -573,8 +573,8 @@ class PEAR
|
||||
*
|
||||
*/
|
||||
function &throwError($message = null,
|
||||
$code = null,
|
||||
$userinfo = null)
|
||||
$code = null,
|
||||
$userinfo = null)
|
||||
{
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
$a = &$this->raiseError($message, $code, null, null, $userinfo);
|
||||
@@ -696,12 +696,12 @@ class PEAR
|
||||
// {{{ popErrorHandling()
|
||||
|
||||
/**
|
||||
* Pop the last error handler used
|
||||
*
|
||||
* @return bool Always true
|
||||
*
|
||||
* @see PEAR::pushErrorHandling
|
||||
*/
|
||||
* Pop the last error handler used
|
||||
*
|
||||
* @return bool Always true
|
||||
*
|
||||
* @see PEAR::pushErrorHandling
|
||||
*/
|
||||
function popErrorHandling()
|
||||
{
|
||||
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
|
||||
@@ -720,12 +720,12 @@ class PEAR
|
||||
// {{{ loadExtension()
|
||||
|
||||
/**
|
||||
* OS independant PHP extension load. Remember to take care
|
||||
* on the correct extension name for case sensitive OSes.
|
||||
*
|
||||
* @param string $ext The extension name
|
||||
* @return bool Success or not on the dl() call
|
||||
*/
|
||||
* OS independant PHP extension load. Remember to take care
|
||||
* on the correct extension name for case sensitive OSes.
|
||||
*
|
||||
* @param string $ext The extension name
|
||||
* @return bool Success or not on the dl() call
|
||||
*/
|
||||
function loadExtension($ext)
|
||||
{
|
||||
if (!extension_loaded($ext)) {
|
||||
@@ -758,7 +758,7 @@ function _PEAR_call_destructors()
|
||||
{
|
||||
global $_PEAR_destructor_object_list;
|
||||
if (is_array($_PEAR_destructor_object_list) &&
|
||||
sizeof($_PEAR_destructor_object_list))
|
||||
sizeof($_PEAR_destructor_object_list))
|
||||
{
|
||||
reset($_PEAR_destructor_object_list);
|
||||
if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) {
|
||||
@@ -843,7 +843,7 @@ class PEAR_Error
|
||||
*
|
||||
*/
|
||||
function PEAR_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
if ($mode === null) {
|
||||
$mode = PEAR_ERROR_RETURN;
|
||||
@@ -952,10 +952,10 @@ class PEAR_Error
|
||||
* @return int error code
|
||||
* @access public
|
||||
*/
|
||||
function getCode()
|
||||
{
|
||||
function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getType()
|
||||
@@ -1045,22 +1045,22 @@ class PEAR_Error
|
||||
function toString() {
|
||||
$modes = array();
|
||||
$levels = array(E_USER_NOTICE => 'notice',
|
||||
E_USER_WARNING => 'warning',
|
||||
E_USER_ERROR => 'error');
|
||||
E_USER_WARNING => 'warning',
|
||||
E_USER_ERROR => 'error');
|
||||
if ($this->mode & PEAR_ERROR_CALLBACK) {
|
||||
if (is_array($this->callback)) {
|
||||
$callback = (is_object($this->callback[0]) ?
|
||||
strtolower(get_class($this->callback[0])) :
|
||||
$this->callback[0]) . '::' .
|
||||
$this->callback[1];
|
||||
strtolower(get_class($this->callback[0])) :
|
||||
$this->callback[0]) . '::' .
|
||||
$this->callback[1];
|
||||
} else {
|
||||
$callback = $this->callback;
|
||||
}
|
||||
return sprintf('[%s: message="%s" code=%d mode=callback '.
|
||||
'callback=%s prefix="%s" info="%s"]',
|
||||
strtolower(get_class($this)), $this->message, $this->code,
|
||||
$callback, $this->error_message_prefix,
|
||||
$this->userinfo);
|
||||
strtolower(get_class($this)), $this->message, $this->code,
|
||||
$callback, $this->error_message_prefix,
|
||||
$this->userinfo);
|
||||
}
|
||||
if ($this->mode & PEAR_ERROR_PRINT) {
|
||||
$modes[] = 'print';
|
||||
@@ -1076,10 +1076,10 @@ class PEAR_Error
|
||||
}
|
||||
return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
|
||||
'prefix="%s" info="%s"]',
|
||||
strtolower(get_class($this)), $this->message, $this->code,
|
||||
implode("|", $modes), $levels[$this->level],
|
||||
$this->error_message_prefix,
|
||||
$this->userinfo);
|
||||
strtolower(get_class($this)), $this->message, $this->code,
|
||||
implode("|", $modes), $levels[$this->level],
|
||||
$this->error_message_prefix,
|
||||
$this->userinfo);
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
Reference in New Issue
Block a user