summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2016-04-04 18:31:02 +0200
committerctrlaltca <ctrlaltca@gmail.com>2016-04-04 18:31:02 +0200
commit7e255537404cb6ceb5465589c87897781358bc59 (patch)
treec6655e104b4be4ced6acaf914c2eee87452d3c4c
parent0ec0d073c120a2db371dfd4cd6f2a81fd9068676 (diff)
parentba0b0923f7520d6cd35373679aed963d1318074a (diff)
Merge pull request #578 from pradosoft/scrutinizer
Misc code fixes suggested by Scrutinizer
-rw-r--r--buildscripts/Benchmark/Iterate.php167
-rw-r--r--buildscripts/Benchmark/LICENSE22
-rw-r--r--buildscripts/Benchmark/Profiler.php447
-rw-r--r--buildscripts/Benchmark/Timer.php319
-rw-r--r--buildscripts/Benchmark/doc/timer_example.php18
-rw-r--r--buildscripts/classtree/DWExtension.php2
-rwxr-xr-xdemos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php11
-rwxr-xr-xdemos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php11
-rw-r--r--framework/Collections/TAttributeCollection.php4
-rw-r--r--framework/Collections/TList.php73
-rw-r--r--framework/Collections/TMap.php76
-rw-r--r--framework/Collections/TPagedList.php2
-rw-r--r--framework/I18N/core/TCache_Lite.php7
-rw-r--r--framework/TComponent.php4
-rw-r--r--framework/Util/TCallChain.php4
-rw-r--r--framework/Web/THttpRequest.php2
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientSide.php10
-rw-r--r--framework/Web/UI/TClientScriptManager.php6
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php2
-rw-r--r--framework/Web/UI/WebControls/TDataGridPagerStyle.php4
-rw-r--r--framework/Web/UI/WebControls/TFont.php4
-rw-r--r--framework/Web/UI/WebControls/TListItem.php4
-rw-r--r--framework/Web/UI/WebControls/TPanelStyle.php4
-rw-r--r--framework/Web/UI/WebControls/TStyle.php12
-rw-r--r--framework/Xml/TXmlDocument.php2
-rw-r--r--framework/pradolite.php173
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php1
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php1
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/Callback.php1
-rwxr-xr-xtests/FunctionalTests/tickets/protected/pages/Ticket719.php2
-rw-r--r--tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php1
-rw-r--r--tests/unit/Web/THttpRequestTest.php2
32 files changed, 156 insertions, 1242 deletions
diff --git a/buildscripts/Benchmark/Iterate.php b/buildscripts/Benchmark/Iterate.php
deleted file mode 100644
index f09dcb76..00000000
--- a/buildscripts/Benchmark/Iterate.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-//
-// +------------------------------------------------------------------------+
-// | PEAR :: Benchmark |
-// +------------------------------------------------------------------------+
-// | Copyright (c) 2001-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
-// +------------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled |
-// | with this package in the file LICENSE, and is available through |
-// | the world-wide-web at |
-// | http://www.opensource.org/licenses/bsd-license.php |
-// | If you did not receive a copy of the new BSDlicense and are unable |
-// | to obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +------------------------------------------------------------------------+
-//
-// $Id: Iterate.php,v 1.12 2006/02/17 16:29:44 toggg Exp $
-//
-
-require_once 'Benchmark/Timer.php';
-
-/**
- * Provides timing and profiling information.
- *
- * Example 1
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Iterate.php';
- *
- * $benchmark = new Benchmark_Iterate;
- *
- * function foo($string) {
- * print $string . '<br>';
- * }
- *
- * $benchmark->run(100, 'foo', 'test');
- * $result = $benchmark->get();
- * ?>
- * </code>
- *
- * Example 2
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Iterate.php';
- *
- * $benchmark = new Benchmark_Iterate;
- *
- * class MyClass {
- * function foo($string) {
- * print $string . '<br>';
- * }
- * }
- *
- * $benchmark->run(100, 'myclass::foo', 'test');
- * $result = $benchmark->get();
- * ?>
- * </code>
- *
- * Example 3
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Iterate.php';
- *
- * $benchmark = new Benchmark_Iterate;
- *
- * class MyClass {
- * function foo($string) {
- * print $string . '<br>';
- * }
- * }
- *
- * $o = new MyClass();
- *
- * $benchmark->run(100, 'o->foo', 'test');
- * $result = $benchmark->get();
- * ?>
- * </code>
- *
- * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
- * @copyright Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
- * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
- * @category Benchmarking
- * @package Benchmark
- */
-class Benchmark_Iterate extends Benchmark_Timer {
- /**
- * Benchmarks a function or method.
- *
- * @access public
- */
- function run() {
- $arguments = func_get_args();
- $iterations = array_shift($arguments);
- $function_name = array_shift($arguments);
-
- if (strstr($function_name, '::')) {
- $function_name = explode('::', $function_name);
- $objectmethod = $function_name[1];
- }
-
- if (strstr($function_name, '->')) {
- $function_name = explode('->', $function_name);
- $objectname = $function_name[0];
-
- $object = $GLOBALS[$objectname];
- $objectmethod = $function_name[1];
-
- for ($i = 1; $i <= $iterations; $i++) {
- $this->setMarker('start_' . $i);
- call_user_func_array(array($object, $function_name[1]), $arguments);
- $this->setMarker('end_' . $i);
- }
-
- return(0);
- }
-
- for ($i = 1; $i <= $iterations; $i++) {
- $this->setMarker('start_' . $i);
- call_user_func_array($function_name, $arguments);
- $this->setMarker('end_' . $i);
- }
- }
-
- /**
- * Returns benchmark result.
- *
- * $result[x ] = execution time of iteration x
- * $result['mean' ] = mean execution time
- * $result['iterations'] = number of iterations
- *
- * @return array
- * @access public
- */
- function get($simple_output = false) {
- $result = array();
- $total = 0;
-
- $iterations = count($this->markers)/2;
-
- for ($i = 1; $i <= $iterations; $i++) {
- $time = $this->timeElapsed('start_'.$i , 'end_'.$i);
-
- if (extension_loaded('bcmath')) {
- $total = bcadd($total, $time, 6);
- } else {
- $total = $total + $time;
- }
-
- if (!$simple_output) {
- $result[$i] = $time;
- }
- }
-
- if (extension_loaded('bcmath')) {
- $result['mean'] = bcdiv($total, $iterations, 6);
- } else {
- $result['mean'] = $total / $iterations;
- }
-
- $result['iterations'] = $iterations;
-
- return $result;
- }
-}
diff --git a/buildscripts/Benchmark/LICENSE b/buildscripts/Benchmark/LICENSE
deleted file mode 100644
index db25e880..00000000
--- a/buildscripts/Benchmark/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Redistribution and use in source and binary forms, with or without modification
-, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, th
- is list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/
- or other materials provided with the distribution.
-
-3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WA
-RRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABIL
-ITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR C
-ONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOW
-EVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILI
-TY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE U
-SE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/buildscripts/Benchmark/Profiler.php b/buildscripts/Benchmark/Profiler.php
deleted file mode 100644
index 001f1959..00000000
--- a/buildscripts/Benchmark/Profiler.php
+++ /dev/null
@@ -1,447 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PEAR :: Benchmark |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2002-2006 Matthias Englert <Matthias.Englert@gmx.de>. |
-// +----------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled |
-// | with this package in the file LICENSE, and is available through |
-// | the world-wide-web at |
-// | http://www.opensource.org/licenses/bsd-license.php |
-// | If you did not receive a copy of the new BSDlicense and are unable |
-// | to obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-//
-// $Id: Profiler.php,v 1.19 2006/03/01 19:26:09 anant Exp $
-//
-
-require_once 'PEAR.php';
-
-/**
- * Provides timing and profiling information.
- *
- * Example 1: Automatic profiling start, stop, and output.
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Profiler.php';
- *
- * $profiler = new Benchmark_Profiler(TRUE);
- *
- * function myFunction() {
- * global $profiler;
- * $profiler->enterSection('myFunction');
- * //do something
- * $profiler->leaveSection('myFunction');
- * return;
- * }
- *
- * //do something
- * myFunction();
- * //do more
- * ?>
- * </code>
- *
- * Example 2: Manual profiling start, stop, and output.
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Profiler.php';
- *
- * $profiler = new Benchmark_Profiler();
- *
- * function myFunction() {
- * global $profiler;
- * $profiler->enterSection('myFunction');
- * //do something
- * $profiler->leaveSection('myFunction');
- * return;
- * }
- *
- * $profiler->start();
- * //do something
- * myFunction();
- * //do more
- * $profiler->stop();
- * $profiler->display();
- * ?>
- * </code>
- *
- * @author Matthias Englert <Matthias.Englert@gmx.de>
- * @copyright Copyright &copy; 2002-2005 Matthias Englert <Matthias.Englert@gmx.de>
- * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
- * @category Benchmarking
- * @package Benchmark
- * @since 1.2.0
- */
-class Benchmark_Profiler extends PEAR {
- /**
- * Contains the total ex. time of each section
- *
- * @var array
- * @access private
- */
- var $_sections = array();
-
- /**
- * Calling stack
- *
- * @var array
- * @access private
- */
- var $_stack = array();
-
- /**
- * Notes how often a section was entered
- *
- * @var array
- * @access private
- */
- var $_numberOfCalls = array();
-
- /**
- * Notes for each section how much time is spend in sub-sections
- *
- * @var array
- * @access private
- */
- var $_subSectionsTime = array();
-
- /**
- * Notes for each section how often it calls which section
- *
- * @var array
- * @access private
- */
- var $_calls = array();
-
- /**
- * Notes for each section how often it was called by which section
- *
- * @var array
- * @access private
- */
- var $_callers = array();
-
- /**
- * Auto-starts and stops profiler
- *
- * @var boolean
- * @access private
- */
- var $_auto = FALSE;
-
- /**
- * Max marker name length for non-html output
- *
- * @var integer
- * @access private
- */
- var $_maxStringLength = 0;
-
- /**
- * Constructor, starts profiling recording
- *
- * @access public
- */
- function Benchmark_Profiler($auto = FALSE) {
- $this->_auto = $auto;
-
- if ($this->_auto) {
- $this->start();
- }
-
- $this->PEAR();
- }
-
- /**
- * Destructor, stops profiling recording
- *
- * @access private
- */
- function _Benchmark_Profiler() {
- if (isset($this->_auto) && $this->_auto) {
- $this->stop();
- $this->display();
- }
- }
-
- /**
- * Returns profiling informations for a given section.
- *
- * @param string $section
- * @return array
- * @access public
- */
- function getSectionInformations($section = 'Global') {
- if (isset($this->_sections[$section])) {
- $calls = array();
-
- if (isset($this->_calls[$section])) {
- $calls = $this->_calls[$section];
- }
-
- $callers = array();
-
- if (isset($this->_callers[$section])) {
- $callers = $this->_callers[$section];
- }
-
- $informations = array();
-
- $informations['time'] = $this->_sections[$section];
- if (isset($this->_sections['Global'])) {
- $informations['percentage'] = number_format(100 * $this->_sections[$section] / $this->_sections['Global'], 2, '.', '');
- } else {
- $informations['percentage'] = 'N/A';
- }
- $informations['calls'] = $calls;
- $informations['num_calls'] = $this->_numberOfCalls[$section];
- $informations['callers'] = $callers;
-
- if (isset($this->_subSectionsTime[$section])) {
- $informations['netto_time'] = $this->_sections[$section] - $this->_subSectionsTime[$section];
- } else {
- $informations['netto_time'] = $this->_sections[$section];
- }
-
- return $informations;
- } else {
- $this->raiseError("The section '$section' does not exists.\n", NULL, PEAR_ERROR_TRIGGER, E_USER_WARNING);
- }
- }
-
- /**
- * Returns profiling informations for all sections.
- *
- * @return array
- * @access public
- */
- function getAllSectionsInformations() {
- $informations = array();
-
- foreach($this->_sections as $section => $time) {
- $informations[$section] = $this->getSectionInformations($section);
- }
-
- return $informations;
- }
-
- /**
- * Returns formatted profiling information.
- *
- * @param string output format (auto, plain or html), default auto
- * @see display()
- * @access private
- */
- function _getOutput($format) {
-
- /* Quickly find out the maximun length: Ineffecient, but will do for now! */
- $informations = $this->getAllSectionsInformations();
- $names = array_keys($informations);
-
- $maxLength = 0;
- foreach ($names as $name)
- {
- if ($maxLength < strlen($name)) {
- $maxLength = strlen($name);
- }
- }
- $this->_maxStringLength = $maxLength;
-
- if ($format == 'auto') {
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge')) {
- $format = isset($_SERVER['SERVER_PROTOCOL']) ? 'html' : 'plain';
- } else {
- global $HTTP_SERVER_VARS;
- $format = isset($HTTP_SERVER_VARS['SERVER_PROTOCOL']) ? 'html' : 'plain';
- }
- }
-
- if ($format == 'html') {
- $out = '<table style="border: 1px solid #000000; ">'."\n";
- $out .=
- '<tr><td>&nbsp;</td><td align="center"><b>total ex. time</b></td>'.
- '<td align="center"><b>netto ex. time</b></td>'.
- '<td align="center"><b>#calls</b></td><td align="center"><b>%</b></td>'.
- '<td align="center"><b>calls</b></td><td align="center"><b>callers</b></td></tr>'.
- "\n";
- } else {
- $dashes = $out = str_pad("\n", ($this->_maxStringLength + 75), '-', STR_PAD_LEFT);
- $out .= str_pad('Section', $this->_maxStringLength + 10);
- $out .= str_pad("Total Ex Time", 22);
- $out .= str_pad("Netto Ex Time", 22);
- $out .= str_pad("#Calls", 10);
- $out .= "Percentage\n";
- $out .= $dashes;
- }
-
- foreach($informations as $name => $values) {
- $percentage = $values['percentage'];
- $calls_str = "";
-
- foreach($values['calls'] as $key => $val) {
- if ($calls_str) {
- $calls_str .= ", ";
- }
-
- $calls_str .= "$key ($val)";
- }
-
- $callers_str = "";
-
- foreach($values['callers'] as $key => $val) {
- if ($callers_str) {
- $callers_str .= ", ";
- }
-
- $callers_str .= "$key ($val)";
- }
-
- if ($format == 'html') {
- $out .= "<tr><td><b>$name</b></td><td>{$values['time']}</td><td>{$values['netto_time']}</td><td>{$values['num_calls']}</td>";
- if (is_numeric($values['percentage'])) {
- $out .= "<td align=\"right\">{$values['percentage']}%</td>\n";
- } else {
- $out .= "<td align=\"right\">{$values['percentage']}</td>\n";
- }
- $out .= "<td>$calls_str</td><td>$callers_str</td></tr>";
- } else {
- $out .= str_pad($name, $this->_maxStringLength + 10);
- $out .= str_pad($values['time'], 22);
- $out .= str_pad($values['netto_time'], 22);
- $out .= str_pad($values['num_calls'], 10);
- if (is_numeric($values['percentage'])) {
- $out .= str_pad($values['percentage']."%\n", 8, ' ', STR_PAD_LEFT);
- } else {
- $out .= str_pad($values['percentage']."\n", 8, ' ', STR_PAD_LEFT);
- }
- }
- }
-
- if ($format == 'html') {
- return $out . '</table>';
- } else {
- return $out;
- }
- }
-
- /**
- * Returns formatted profiling information.
- *
- * @param string output format (auto, plain or html), default auto
- * @access public
- */
- function display($format = 'auto') {
- echo $this->_getOutput($format);
- }
-
- /**
- * Enters "Global" section.
- *
- * @see enterSection(), stop()
- * @access public
- */
- function start() {
- $this->enterSection('Global');
- }
-
- /**
- * Leaves "Global" section.
- *
- * @see leaveSection(), start()
- * @access public
- */
- function stop() {
- $this->leaveSection('Global');
- }
-
- /**
- * Enters code section.
- *
- * @param string name of the code section
- * @see start(), leaveSection()
- * @access public
- */
- function enterSection($name) {
- if (count($this->_stack)) {
- if (isset($this->_callers[$name][$this->_stack[count($this->_stack) - 1]["name"]])) {
- $this->_callers[$name][$this->_stack[count($this->_stack) - 1]["name"]]++;
- } else {
- $this->_callers[$name][$this->_stack[count($this->_stack) - 1]["name"]] = 1;
- }
-
- if (isset($this->_calls[$this->_stack[count($this->_stack) - 1]["name"]][$name])) {
- $this->_calls[$this->_stack[count($this->_stack) - 1]["name"]][$name]++;
- } else {
- $this->_calls[$this->_stack[count($this->_stack) - 1]["name"]][$name] = 1;
- }
- } else {
- if ($name != 'Global') {
- $this->raiseError("tried to enter section ".$name." but profiling was not started\n", NULL, PEAR_ERROR_DIE);
- }
- }
-
- if (isset($this->_numberOfCalls[$name])) {
- $this->_numberOfCalls[$name]++;
- } else {
- $this->_numberOfCalls[$name] = 1;
- }
-
- array_push($this->_stack, array("name" => $name, "time" => $this->_getMicrotime()));
- }
-
- /**
- * Leaves code section.
- *
- * @param string name of the marker to be set
- * @see stop(), enterSection()
- * @access public
- */
- function leaveSection($name) {
- $microtime = $this->_getMicrotime();
-
- if (!count($this->_stack)) {
- $this->raiseError("tried to leave section ".$name." but profiling was not started\n", NULL, PEAR_ERROR_DIE);
- }
-
- $x = array_pop($this->_stack);
-
- if ($x["name"] != $name) {
- $this->raiseError("reached end of section $name but expecting end of " . $x["name"]."\n", NULL, PEAR_ERROR_DIE);
- }
-
- if (isset($this->_sections[$name])) {
- $this->_sections[$name] += $microtime - $x["time"];
- } else {
- $this->_sections[$name] = $microtime - $x["time"];
- }
-
- $parent = array_pop($this->_stack);
-
- if (isset($parent)) {
- if (isset($this->_subSectionsTime[$parent['name']])) {
- $this->_subSectionsTime[$parent['name']] += $microtime - $x['time'];
- } else {
- $this->_subSectionsTime[$parent['name']] = $microtime - $x['time'];
- }
-
- array_push($this->_stack, $parent);
- }
- }
-
- /**
- * Wrapper for microtime().
- *
- * @return float
- * @access private
- * @since 1.3.0
- */
- function _getMicrotime() {
- $microtime = explode(' ', microtime());
- return $microtime[1] . substr($microtime[0], 1);
- }
-}
diff --git a/buildscripts/Benchmark/Timer.php b/buildscripts/Benchmark/Timer.php
deleted file mode 100644
index feee38c2..00000000
--- a/buildscripts/Benchmark/Timer.php
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-//
-// +------------------------------------------------------------------------+
-// | PEAR :: Benchmark |
-// +------------------------------------------------------------------------+
-// | Copyright (c) 2001-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
-// +------------------------------------------------------------------------+
-// | This source file is subject to the New BSD license, That is bundled |
-// | with this package in the file LICENSE, and is available through |
-// | the world-wide-web at |
-// | http://www.opensource.org/licenses/bsd-license.php |
-// | If you did not receive a copy of the new BSDlicense and are unable |
-// | to obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +------------------------------------------------------------------------+
-//
-// $Id: Timer.php,v 1.16 2006/03/01 13:41:39 matthias Exp $
-//
-
-require_once 'PEAR.php';
-
-/**
- * Provides timing and profiling information.
- *
- * Example 1: Automatic profiling start, stop, and output.
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Timer.php';
- *
- * $timer = new Benchmark_Timer(TRUE);
- * $timer->setMarker('Marker 1');
- * ?>
- * </code>
- *
- * Example 2: Manual profiling start, stop, and output.
- *
- * <code>
- * <?php
- * require_once 'Benchmark/Timer.php';
- *
- * $timer = new Benchmark_Timer();
- * $timer->start();
- * $timer->setMarker('Marker 1');
- * $timer->stop();
- *
- * $timer->display(); // to output html formated
- * // AND/OR :
- * $profiling = $timer->getProfiling(); // get the profiler info as an associative array
- * ?>
- * </code>
- *
- * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
- * @author Ludovico Magnocavallo <ludo@sumatrasolutions.com>
- * @copyright Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
- * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
- * @category Benchmarking
- * @package Benchmark
- */
-class Benchmark_Timer extends PEAR {
- /**
- * Contains the markers.
- *
- * @var array
- * @access private
- */
- var $markers = array();
-
- /**
- * Auto-start and stop timer.
- *
- * @var boolean
- * @access private
- */
- var $auto = FALSE;
-
- /**
- * Max marker name length for non-html output.
- *
- * @var integer
- * @access private
- */
- var $maxStringLength = 0;
-
- /**
- * Constructor.
- *
- * @param boolean $auto
- * @access public
- */
- function Benchmark_Timer($auto = FALSE) {
- $this->auto = $auto;
-
- if ($this->auto) {
- $this->start();
- }
-
- $this->PEAR();
- }
-
- /**
- * Destructor.
- *
- * @access private
- */
- function _Benchmark_Timer() {
- if ($this->auto) {
- $this->stop();
- $this->display();
- }
- }
-
- /**
- * Set "Start" marker.
- *
- * @see setMarker(), stop()
- * @access public
- */
- function start() {
- $this->setMarker('Start');
- }
-
- /**
- * Set "Stop" marker.
- *
- * @see setMarker(), start()
- * @access public
- */
- function stop() {
- $this->setMarker('Stop');
- }
-
- /**
- * Set marker.
- *
- * @param string $name Name of the marker to be set.
- * @see start(), stop()
- * @access public
- */
- function setMarker($name) {
- $this->markers[$name] = $this->_getMicrotime();
- }
-
- /**
- * Returns the time elapsed betweens two markers.
- *
- * @param string $start start marker, defaults to "Start"
- * @param string $end end marker, defaults to "Stop"
- * @return double $time_elapsed time elapsed between $start and $end
- * @access public
- */
- function timeElapsed($start = 'Start', $end = 'Stop') {
- if ($end == 'Stop' && !isset($this->markers['Stop'])) {
- $this->markers['Stop'] = $this->_getMicrotime();
- }
-
- if (extension_loaded('bcmath')) {
- return bcsub($this->markers[$end], $this->markers[$start], 6);
- } else {
- return $this->markers[$end] - $this->markers[$start];
- }
- }
-
- /**
- * Returns profiling information.
- *
- * $profiling[x]['name'] = name of marker x
- * $profiling[x]['time'] = time index of marker x
- * $profiling[x]['diff'] = execution time from marker x-1 to this marker x
- * $profiling[x]['total'] = total execution time up to marker x
- *
- * @return array
- * @access public
- */
- function getProfiling() {
- $i = $total = 0;
- $result = array();
- $temp = reset($this->markers);
- $this->maxStringLength = 0;
-
- foreach ($this->markers as $marker => $time) {
- if (extension_loaded('bcmath')) {
- $diff = bcsub($time, $temp, 6);
- $total = bcadd($total, $diff, 6);
- } else {
- $diff = $time - $temp;
- $total = $total + $diff;
- }
-
- $result[$i]['name'] = $marker;
- $result[$i]['time'] = $time;
- $result[$i]['diff'] = $diff;
- $result[$i]['total'] = $total;
-
- $this->maxStringLength = (strlen($marker) > $this->maxStringLength ? strlen($marker) + 1 : $this->maxStringLength);
-
- $temp = $time;
- $i++;
- }
-
- $result[0]['diff'] = '-';
- $result[0]['total'] = '-';
- $this->maxStringLength = (strlen('total') > $this->maxStringLength ? strlen('total') : $this->maxStringLength);
- $this->maxStringLength += 2;
-
- return $result;
- }
-
- /**
- * Return formatted profiling information.
- *
- * @param boolean $showTotal Optionnaly includes total in output, default no
- * @param string $format output format (auto, plain or html), default auto
- * @return string
- * @see getProfiling()
- * @access public
- */
- function getOutput($showTotal = FALSE, $format = 'auto') {
- if ($format == 'auto') {
- if (function_exists('version_compare') &&
- version_compare(phpversion(), '4.1', 'ge'))
- {
- $format = isset($_SERVER['SERVER_PROTOCOL']) ? 'html' : 'plain';
- } else {
- global $HTTP_SERVER_VARS;
- $format = isset($HTTP_SERVER_VARS['SERVER_PROTOCOL']) ? 'html' : 'plain';
- }
- }
-
- $total = $this->TimeElapsed();
- $result = $this->getProfiling();
- $dashes = '';
-
- if ($format == 'html') {
- $out = '<table border="1">'."\n";
- $out .= '<tr><td>&nbsp;</td><td align="center"><b>time index</b></td><td align="center"><b>ex time</b></td><td align="center"><b>%</b></td>'.
- ($showTotal ?
- '<td align="center"><b>elapsed</b></td><td align="center"><b>%</b></td>'
- : '')."</tr>\n";
- } else {
- $dashes = $out = str_pad("\n",
- $this->maxStringLength + ($showTotal ? 70 : 45), '-', STR_PAD_LEFT);
- $out .= str_pad('marker', $this->maxStringLength) .
- str_pad("time index", 22) .
- str_pad("ex time", 16) .
- str_pad("perct ", 8) .
- ($showTotal ? ' '.str_pad("elapsed", 16)."perct" : '')."\n" .
- $dashes;
- }
-
- foreach ($result as $k => $v) {
- $perc = (($v['diff'] * 100) / $total);
- $tperc = (($v['total'] * 100) / $total);
-
- if ($format == 'html') {
- $out .= "<tr><td><b>" . $v['name'] .
- "</b></td><td>" . $v['time'] .
- "</td><td>" . $v['diff'] .
- "</td><td align=\"right\">" . number_format($perc, 2, '.', '') .
- "%</td>".
- ($showTotal ?
- "<td>" . $v['total'] .
- "</td><td align=\"right\">" .
- number_format($tperc, 2, '.', '') .
- "%</td>" : '').
- "</tr>\n";
- } else {
- $out .= str_pad($v['name'], $this->maxStringLength, ' ') .
- str_pad($v['time'], 22) .
- str_pad($v['diff'], 14) .
- str_pad(number_format($perc, 2, '.', '')."%",8, ' ', STR_PAD_LEFT) .
- ($showTotal ? ' '.
- str_pad($v['total'], 14) .
- str_pad(number_format($tperc, 2, '.', '')."%",
- 8, ' ', STR_PAD_LEFT) : '').
- "\n";
- }
-
- $out .= $dashes;
- }
-
- if ($format == 'html') {
- $out .= "<tr style='background: silver;'><td><b>total</b></td><td>-</td><td>${total}</td><td>100.00%</td>".($showTotal ? "<td>-</td><td>-</td>" : "")."</tr>\n";
- $out .= "</table>\n";
- } else {
- $out .= str_pad('total', $this->maxStringLength);
- $out .= str_pad('-', 22);
- $out .= str_pad($total, 15);
- $out .= "100.00%\n";
- $out .= $dashes;
- }
-
- return $out;
- }
-
- /**
- * Prints the information returned by getOutput().
- *
- * @param boolean $showTotal Optionnaly includes total in output, default no
- * @param string $format output format (auto, plain or html), default auto
- * @see getOutput()
- * @access public
- */
- function display($showTotal = FALSE, $format = 'auto') {
- print $this->getOutput($showTotal, $format);
- }
-
- /**
- * Wrapper for microtime().
- *
- * @return float
- * @access private
- * @since 1.3.0
- */
- function _getMicrotime() {
- $microtime = explode(' ', microtime());
- return $microtime[1] . substr($microtime[0], 1);
- }
-}
diff --git a/buildscripts/Benchmark/doc/timer_example.php b/buildscripts/Benchmark/doc/timer_example.php
deleted file mode 100644
index ff9de936..00000000
--- a/buildscripts/Benchmark/doc/timer_example.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-require '../Timer.php';
-
-function wait($amount) {
- for ($i=0; $i < $amount; $i++) {
- for ($i=0; $i < 100; $i++);
- }
-}
-// Pass the param "true" to constructor to automatically display the results
-$timer = new Benchmark_Timer();
-$timer->start();
-wait(10);
-$timer->setMarker('Mark1');
-echo "Elapsed time between Start and Mark1: " .
- $timer->timeElapsed('Start', 'Mark1') . "\n";
-wait(50);
-$timer->stop();
-$timer->display();
diff --git a/buildscripts/classtree/DWExtension.php b/buildscripts/classtree/DWExtension.php
index a7a1ca30..8df8ed94 100644
--- a/buildscripts/classtree/DWExtension.php
+++ b/buildscripts/classtree/DWExtension.php
@@ -217,7 +217,7 @@ class PradoTagChooser
protected function prepareDocument()
{
- $this->_document->standalone = true;
+ $this->_document->xmlStandalone = true;
$this->_document->formatOutput = true;
$tclibrary = $this->_document->createElement('tclibrary');
$tclibrary->setAttribute('name','PRADO tags');
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
index aeb30609..827558b8 100755
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
@@ -6,9 +6,14 @@ class Sample4 extends Sample2
{
protected function sortData($data,$key)
{
- $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
- usort($data,$compare) ;
- return $data ;
+ usort($data, function($a, $b) use ($key) {
+ if ($a[$key] == $b[$key]) {
+ return 0;
+ } else {
+ return ($a[$key] > $b[$key]) ? 1 : -1;
+ }
+ });
+ return $data;
}
public function sortDataGrid($sender,$param)
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
index 201fc5f9..766e4d55 100755
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
@@ -6,9 +6,14 @@ class Sample4 extends Sample2
{
protected function sortData($data,$key)
{
- $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
- usort($data,$compare) ;
- return $data ;
+ usort($data, function($a, $b) use ($key) {
+ if ($a[$key] == $b[$key]) {
+ return 0;
+ } else {
+ return ($a[$key] > $b[$key]) ? 1 : -1;
+ }
+ });
+ return $data;
}
public function sortDataGrid($sender,$param)
diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php
index 00d82a41..eb3cb29e 100644
--- a/framework/Collections/TAttributeCollection.php
+++ b/framework/Collections/TAttributeCollection.php
@@ -50,9 +50,9 @@ class TAttributeCollection extends TMap
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_caseSensitive===false)
$exprops[] = "\0TAttributeCollection\0_caseSensitive";
}
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index 14fc1c03..6e9e16f9 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.php
@@ -406,78 +406,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
* @package System.Collections
* @since 3.0
*/
-class TListIterator implements Iterator
+class TListIterator extends ArrayIterator
{
- /**
- * @var array the data to be iterated through
- */
- private $_d;
- /**
- * @var integer index of the current item
- */
- private $_i;
- /**
- * @var integer count of the data items
- */
- private $_c;
-
- /**
- * Constructor.
- * @param array the data to be iterated through
- */
- public function __construct(&$data)
- {
- $this->_d=&$data;
- $this->_i=0;
- $this->_c=count($this->_d);
- }
-
- /**
- * Rewinds internal array pointer.
- * This method is required by the interface Iterator.
- */
- public function rewind()
- {
- $this->_i=0;
- }
-
- /**
- * Returns the key of the current array item.
- * This method is required by the interface Iterator.
- * @return integer the key of the current array item
- */
- public function key()
- {
- return $this->_i;
- }
-
- /**
- * Returns the current array item.
- * This method is required by the interface Iterator.
- * @return mixed the current array item
- */
- public function current()
- {
- return $this->_d[$this->_i];
- }
-
- /**
- * Moves the internal pointer to the next array item.
- * This method is required by the interface Iterator.
- */
- public function next()
- {
- $this->_i++;
- }
-
- /**
- * Returns whether there is an item at current position.
- * This method is required by the interface Iterator.
- * @return boolean
- */
- public function valid()
- {
- return $this->_i<$this->_c;
- }
}
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index 2a18b87d..017f70b8 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.php
@@ -47,9 +47,9 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_d===array())
$exprops[] = "\0TMap\0_d";
if ($this->_r===false)
@@ -290,76 +290,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
* @package System.Collections
* @since 3.0
*/
-class TMapIterator implements Iterator
+class TMapIterator extends ArrayIterator
{
- /**
- * @var array the data to be iterated through
- */
- private $_d;
- /**
- * @var array list of keys in the map
- */
- private $_keys;
- /**
- * @var mixed current key
- */
- private $_key;
-
- /**
- * Constructor.
- * @param array the data to be iterated through
- */
- public function __construct(&$data)
- {
- $this->_d=&$data;
- $this->_keys=array_keys($data);
- }
-
- /**
- * Rewinds internal array pointer.
- * This method is required by the interface Iterator.
- */
- public function rewind()
- {
- $this->_key=reset($this->_keys);
- }
-
- /**
- * Returns the key of the current array element.
- * This method is required by the interface Iterator.
- * @return mixed the key of the current array element
- */
- public function key()
- {
- return $this->_key;
- }
-
- /**
- * Returns the current array element.
- * This method is required by the interface Iterator.
- * @return mixed the current array element
- */
- public function current()
- {
- return $this->_d[$this->_key];
- }
-
- /**
- * Moves the internal pointer to the next array element.
- * This method is required by the interface Iterator.
- */
- public function next()
- {
- $this->_key=next($this->_keys);
- }
-
- /**
- * Returns whether there is an element at current position.
- * This method is required by the interface Iterator.
- * @return boolean
- */
- public function valid()
- {
- return $this->_key!==false;
- }
}
diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php
index b7558002..a933b4e3 100644
--- a/framework/Collections/TPagedList.php
+++ b/framework/Collections/TPagedList.php
@@ -295,7 +295,7 @@ class TPagedList extends TList
else
{
$data=$this->toArray();
- return new TListIterator($data);
+ return new ArrayIterator($data);
}
}
diff --git a/framework/I18N/core/TCache_Lite.php b/framework/I18N/core/TCache_Lite.php
index 94061526..b42bf1f9 100644
--- a/framework/I18N/core/TCache_Lite.php
+++ b/framework/I18N/core/TCache_Lite.php
@@ -533,18 +533,11 @@ class TCache_Lite
// because the filesize can be cached by PHP itself...
clearstatcache();
$length = @filesize($this->_file);
- if(version_compare(PHP_VERSION, '5.3.0', 'lt'))
- {
- $mqr = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- }
if ($this->_readControl) {
$hashControl = @fread($fp, 32);
$length = $length - 32;
}
$data = @fread($fp, $length);
- if(isset($mqr))
- set_magic_quotes_runtime($mqr);
if ($this->_fileLocking) @flock($fp, LOCK_UN);
@fclose($fp);
if ($this->_readControl) {
diff --git a/framework/TComponent.php b/framework/TComponent.php
index fbf28a9d..127b68a3 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -1707,7 +1707,7 @@ class TComponent
$a = (array)$this;
$a = array_keys($a);
$exprops = array();
- $this->__getZappableSleepProps($exprops);
+ $this->_getZappableSleepProps($exprops);
return array_diff($a, $exprops);
}
@@ -1717,7 +1717,7 @@ class TComponent
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
if($this->_listeningenabled===false)
$exprops[] = "\0TComponent\0_listeningenabled";
diff --git a/framework/Util/TCallChain.php b/framework/Util/TCallChain.php
index 4e9e23f7..49891641 100644
--- a/framework/Util/TCallChain.php
+++ b/framework/Util/TCallChain.php
@@ -19,7 +19,7 @@
class TCallChain extends TList implements IDynamicMethods
{
/**
- * @var {@link TListIterator} for moving through the chained method calls
+ * @var {@link ArrayIterator} for moving through the chained method calls
*/
private $_iterator=null;
@@ -97,7 +97,7 @@ class TCallChain extends TList implements IDynamicMethods
if(!$this->_iterator)
{
$chain_array=array_reverse($this->toArray());
- $this->_iterator=new TListIterator($chain_array);
+ $this->_iterator=new ArrayIterator($chain_array);
}
if($this->_iterator->valid())
do {
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 2a5b812d..926cfa46 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -816,7 +816,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getIterator()
{
- return new TMapIterator($this->_items);
+ return new ArrayIterator($this->_items);
}
/**
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSide.php b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
index 113b35ce..4cb482ad 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientSide.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
@@ -240,8 +240,7 @@ class TCallbackClientSide extends TClientSideOptions
*/
public function getHasPriority()
{
- $option = $this->getOption('HasPriority');
- return ($option===null) ? true : $option;
+ return true;
}
/**
@@ -252,9 +251,8 @@ class TCallbackClientSide extends TClientSideOptions
*/
public function setHasPriority($value)
{
- $hasPriority = TPropertyValue::ensureBoolean($value);
- $this->setOption('HasPriority', $hasPriority);
- if(!$hasPriority)
+ // mimic the old behavior
+ if(!$value)
$this->setEnablePageStateUpdate(false);
}
@@ -268,8 +266,6 @@ class TCallbackClientSide extends TClientSideOptions
{
$enabled = TPropertyValue::ensureBoolean($value);
$this->setOption('EnablePageStateUpdate', $enabled);
- if($enabled)
- $this->setHasPriority(true);
}
/**
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 88e7bb62..5c4d9388 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -400,9 +400,9 @@ class TClientScriptManager extends TApplicationComponent
public function getStyleSheetUrls()
{
$stylesheets = array_values(
- array_map(
- create_function('$e', 'return is_array($e) ? $e[0] : $e;'),
- $this->_styleSheetFiles)
+ array_map(function($e) {
+ return is_array($e) ? $e[0] : $e;
+ }, $this->_styleSheetFiles)
);
foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index 9403fa45..2f338d22 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -1162,7 +1162,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$param=new TDataGridItemEventParameter($item);
if($dataBind)
{
- $item->setDataItem($dataItem);
+ $item->setData($dataItem);
$this->onItemCreated($param);
$this->getControls()->add($item);
$item->dataBind();
diff --git a/framework/Web/UI/WebControls/TDataGridPagerStyle.php b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
index c0e89edf..fc5b8480 100644
--- a/framework/Web/UI/WebControls/TDataGridPagerStyle.php
+++ b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
@@ -38,9 +38,9 @@ class TDataGridPagerStyle extends TPanelStyle
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_mode===null)
$exprops[] = "\0TDataGridPagerStyle\0_mode";
if ($this->_nextText===null)
diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php
index 7c1246d1..432532b3 100644
--- a/framework/Web/UI/WebControls/TFont.php
+++ b/framework/Web/UI/WebControls/TFont.php
@@ -59,9 +59,9 @@ class TFont extends TComponent
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_flags===0)
$exprops[] = "\0TFont\0_flags";
if ($this->_name==='')
diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php
index fbfff80a..0118a917 100644
--- a/framework/Web/UI/WebControls/TListItem.php
+++ b/framework/Web/UI/WebControls/TListItem.php
@@ -67,9 +67,9 @@ class TListItem extends TComponent
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_attributes===null)
$exprops[] = "\0TListItem\0_attributes";
if($this->_text==='')
diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php
index a7ec88c3..8bb1354b 100644
--- a/framework/Web/UI/WebControls/TPanelStyle.php
+++ b/framework/Web/UI/WebControls/TPanelStyle.php
@@ -51,9 +51,9 @@ class TPanelStyle extends TStyle
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_backImageUrl===null)
$exprops[] = "\0TPanelStyle\0_backImageUrl";
if ($this->_direction===null)
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index 3fec9b3d..f6d91e9b 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -52,9 +52,9 @@ class TStyle extends TComponent
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_fields===array())
$exprops[] = "\0TStyle\0_fields";
if($this->_font===null)
@@ -489,9 +489,9 @@ class TTableStyle extends TStyle
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_backImageUrl===null)
$exprops[] = "\0TTableStyle\0_backImageUrl";
if ($this->_horizontalAlign===null)
@@ -740,9 +740,9 @@ class TTableItemStyle extends TStyle
* Reimplement in derived classes to add new variables, but remember to also to call the parent
* implementation first.
*/
- protected function __getZappableSleepProps(&$exprops)
+ protected function _getZappableSleepProps(&$exprops)
{
- parent::__getZappableSleepProps($exprops);
+ parent::_getZappableSleepProps($exprops);
if ($this->_horizontalAlign===null)
$exprops[] = "\0TTableItemStyle\0_horizontalAlign";
if ($this->_verticalAlign===null)
diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php
index 75122986..92d8961b 100644
--- a/framework/Xml/TXmlDocument.php
+++ b/framework/Xml/TXmlDocument.php
@@ -384,7 +384,7 @@ class TXmlDocument extends TXmlElement
return false;
$this->setEncoding($doc->encoding);
- $this->setVersion($doc->version);
+ $this->setVersion($doc->xmlVersion);
$element=$doc->documentElement;
$this->setTagName($element->tagName);
diff --git a/framework/pradolite.php b/framework/pradolite.php
index bdbf1137..4a6de98d 100644
--- a/framework/pradolite.php
+++ b/framework/pradolite.php
@@ -1,7 +1,7 @@
<?php
/**
* File Name: pradolite.php
- * Last Update: 2015/12/07 15:35:09
+ * Last Update: 2016/03/09 11:34:32
* Generated By: buildscripts/phpbuilder/build.php
*
* This file is used in lieu of prado.php to boost PRADO application performance.
@@ -30,6 +30,7 @@ class PradoBase
public static function initErrorHandlers()
{
set_error_handler(array('PradoBase','phpErrorHandler'));
+ register_shutdown_function(array('PradoBase','phpFatalErrorHandler'));
set_exception_handler(array('PradoBase','exceptionHandler'));
}
public static function autoload($className)
@@ -55,6 +56,16 @@ class PradoBase
if(error_reporting() & $errno)
throw new TPhpErrorException($errno,$errstr,$errfile,$errline);
}
+ public static function phpFatalErrorHandler()
+ {
+ $error = error_get_last();
+ if($error &&
+ TPhpErrorException::isFatalError($error) &&
+ error_reporting() & $error['type'])
+ {
+ self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line']));
+ }
+ }
public static function exceptionHandler($exception)
{
if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
@@ -696,7 +707,12 @@ class TErrorHandler extends TModule
$trace=$exception->getTrace();
$result=null;
if($exception instanceof TPhpErrorException)
- $result=isset($trace[0]['file'])?$trace[0]:$trace[1];
+ {
+ if(isset($trace[0]['file']))
+ $result=$trace[0];
+ elseif(isset($trace[1]))
+ $result=$trace[1];
+ }
else if($exception instanceof TInvalidOperationException)
{
if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
@@ -738,7 +754,7 @@ class TErrorHandler extends TModule
private function addLink($message)
{
$baseUrl='http://pradosoft.github.io/docs/manual/class-';
- return preg_replace('/\b(T[A-Z]\w+)\b/',"<a href=\"$baseUrl/\${1}\" target=\"_blank\">\${1}</a>",$message);
+ return preg_replace('/\b(T[A-Z]\w+)\b/',"<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>",$message);
}
}
class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable
@@ -927,37 +943,8 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl
$this->removeAt($offset);
}
}
-class TListIterator implements Iterator
+class TListIterator extends ArrayIterator
{
- private $_d;
- private $_i;
- private $_c;
- public function __construct(&$data)
- {
- $this->_d=&$data;
- $this->_i=0;
- $this->_c=count($this->_d);
- }
- public function rewind()
- {
- $this->_i=0;
- }
- public function key()
- {
- return $this->_i;
- }
- public function current()
- {
- return $this->_d[$this->_i];
- }
- public function next()
- {
- $this->_i++;
- }
- public function valid()
- {
- return $this->_i<$this->_c;
- }
}
abstract class TCache extends TModule implements ICache, ArrayAccess
{
@@ -1604,6 +1591,14 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
{
private $_d=array();
private $_r=false;
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_d===array())
+ $exprops[] = "\0TMap\0_d";
+ if ($this->_r===false)
+ $exprops[] = "\0TMap\0_r";
+ }
public function __construct($data=null,$readOnly=false)
{
if($data!==null)
@@ -1713,36 +1708,8 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
$this->remove($offset);
}
}
-class TMapIterator implements Iterator
+class TMapIterator extends ArrayIterator
{
- private $_d;
- private $_keys;
- private $_key;
- public function __construct(&$data)
- {
- $this->_d=&$data;
- $this->_keys=array_keys($data);
- }
- public function rewind()
- {
- $this->_key=reset($this->_keys);
- }
- public function key()
- {
- return $this->_key;
- }
- public function current()
- {
- return $this->_d[$this->_key];
- }
- public function next()
- {
- $this->_key=next($this->_keys);
- }
- public function valid()
- {
- return $this->_key!==false;
- }
}
class TPriorityMap extends TMap
{
@@ -2321,7 +2288,7 @@ class TXmlDocument extends TXmlElement
if($doc->loadXML($string)===false)
return false;
$this->setEncoding($doc->encoding);
- $this->setVersion($doc->version);
+ $this->setVersion($doc->xmlVersion);
$element=$doc->documentElement;
$this->setTagName($element->tagName);
$this->setValue($element->nodeValue);
@@ -3424,7 +3391,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
}
public function getIterator()
{
- return new TMapIterator($this->_items);
+ return new ArrayIterator($this->_items);
}
public function getCount()
{
@@ -4410,6 +4377,12 @@ Prado::using('System.Web.UI.WebControls.*');
class TAttributeCollection extends TMap
{
private $_caseSensitive=false;
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_caseSensitive===false)
+ $exprops[] = "\0TAttributeCollection\0_caseSensitive";
+ }
public function __get($name)
{
return $this->contains($name)?$this->itemAt($name):parent::__get($name);
@@ -4845,13 +4818,19 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
{
if($this->_trackViewState)
{
- $this->_viewState[$key]=$value;
unset($this->_tempState[$key]);
+ if($value===$defaultValue)
+ unset($this->_viewState[$key]);
+ else
+ $this->_viewState[$key]=$value;
}
else
{
unset($this->_viewState[$key]);
- $this->_tempState[$key]=$value;
+ if($value===$defaultValue)
+ unset($this->_tempState[$key]);
+ else
+ $this->_tempState[$key]=$value;
}
}
public function clearViewState($key)
@@ -5369,7 +5348,10 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
foreach($this->_rf[self::RF_CONTROLS] as $control)
{
if($control instanceof TControl)
- $state[$control->_id]=&$control->saveStateRecursive($needViewState);
+ {
+ if(count($tmp = &$control->saveStateRecursive($needViewState)))
+ $state[$control->_id]=$tmp;
+ }
}
}
if($needViewState && !empty($this->_viewState))
@@ -5658,6 +5640,16 @@ class TFont extends TComponent
private $_flags=0;
private $_name='';
private $_size='';
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_flags===0)
+ $exprops[] = "\0TFont\0_flags";
+ if ($this->_name==='')
+ $exprops[] = "\0TFont\0_name";
+ if ($this->_size==='')
+ $exprops[] = "\0TFont\0_size";
+ }
public function getBold()
{
return ($this->_flags & self::IS_BOLD)!==0;
@@ -5840,6 +5832,20 @@ class TStyle extends TComponent
private $_class=null;
private $_customStyle=null;
private $_displayStyle='Fixed';
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_fields===array())
+ $exprops[] = "\0TStyle\0_fields";
+ if($this->_font===null)
+ $exprops[] = "\0TStyle\0_font";
+ if($this->_class===null)
+ $exprops[] = "\0TStyle\0_class";
+ if ($this->_customStyle===null)
+ $exprops[] = "\0TStyle\0_customStyle";
+ if ($this->_displayStyle==='Fixed')
+ $exprops[] = "\0TStyle\0_displayStyle";
+ }
public function __construct($style=null)
{
if($style!==null)
@@ -6062,6 +6068,22 @@ class TTableStyle extends TStyle
private $_cellSpacing=null;
private $_gridLines=null;
private $_borderCollapse=null;
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_backImageUrl===null)
+ $exprops[] = "\0TTableStyle\0_backImageUrl";
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TTableStyle\0_horizontalAlign";
+ if ($this->_cellPadding===null)
+ $exprops[] = "\0TTableStyle\0_cellPadding";
+ if ($this->_cellSpacing===null)
+ $exprops[] = "\0TTableStyle\0_cellSpacing";
+ if ($this->_gridLines===null)
+ $exprops[] = "\0TTableStyle\0_gridLines";
+ if ($this->_borderCollapse===null)
+ $exprops[] = "\0TTableStyle\0_borderCollapse";
+ }
public function reset()
{
$this->_backImageUrl=null;
@@ -6185,6 +6207,16 @@ class TTableItemStyle extends TStyle
private $_horizontalAlign=null;
private $_verticalAlign=null;
private $_wrap=null;
+ protected function _getZappableSleepProps(&$exprops)
+ {
+ parent::_getZappableSleepProps($exprops);
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_horizontalAlign";
+ if ($this->_verticalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_verticalAlign";
+ if ($this->_wrap===null)
+ $exprops[] = "\0TTableItemStyle\0_wrap";
+ }
public function reset()
{
parent::reset();
@@ -7172,9 +7204,9 @@ class TClientScriptManager extends TApplicationComponent
public function getStyleSheetUrls()
{
$stylesheets = array_values(
- array_map(
- create_function('$e', 'return is_array($e) ? $e[0] : $e;'),
- $this->_styleSheetFiles)
+ array_map(function($e) {
+ return is_array($e) ? $e[0] : $e;
+ }, $this->_styleSheetFiles)
);
foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
if (substr($url,strlen($url)-4)=='.css')
@@ -7535,6 +7567,7 @@ class TPage extends TTemplateControl
protected function processCallbackRequest($writer)
{
Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
+ Prado::using('System.Web.UI.JuiControls.TJuiControlOptions');
$this->setAdapter(new TActivePageAdapter($this));
$callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
if(strlen($callbackEventParameter) > 0)
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
index 74113cc8..3657c2a6 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonListTest.php
@@ -5,7 +5,6 @@ class ActiveRadioButtonListTest extends TPage
function list1_callback($sender, $param)
{
$values = $sender->getSelectedValues();
- var_dump($values);
$this->label1->setText("Selection: ".implode(', ', $values));
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
index 1a767b79..ba1b04b2 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
@@ -37,6 +37,5 @@ class AutoCompleteTest extends TPage
function suggestion_selected($sender, $param)
{
- var_dump($param->selectedIndex);
}
}
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Callback.php b/tests/FunctionalTests/active-controls/protected/pages/Callback.php
index 8a85f50d..85c93f10 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/Callback.php
+++ b/tests/FunctionalTests/active-controls/protected/pages/Callback.php
@@ -6,6 +6,5 @@ class Callback extends TPage
{
function callback1_Requested()
{
- var_dump("ok!");
}
}
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket719.php b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
index 376eecdd..64f8acb2 100755
--- a/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
@@ -24,8 +24,8 @@ class Ticket719 extends TPage
function suggestion_selected($sender, $param)
{
- var_dump($param->selectedIndex);
}
+
public function suggestCountries($sender, $param)
{
$sender->setDataSource($this->matchCountries($param->Token));
diff --git a/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
index 8c6b9789..a472e546 100644
--- a/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
+++ b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
@@ -74,6 +74,5 @@ class ActiveRecordDynamicCallTest extends PHPUnit_Framework_TestCase
function assertDeleteSql($sender, $param)
{
- var_dump($param);
}
}
diff --git a/tests/unit/Web/THttpRequestTest.php b/tests/unit/Web/THttpRequestTest.php
index 314cce0a..a4e679d8 100644
--- a/tests/unit/Web/THttpRequestTest.php
+++ b/tests/unit/Web/THttpRequestTest.php
@@ -328,7 +328,7 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
public function testGetIterator() {
$request = new THttpRequest ();
$request->init(null);
- self::assertInstanceOf ('TMapIterator', $request->getIterator());
+ self::assertInstanceOf ('ArrayIterator', $request->getIterator());
}
public function testGetCount() {