5fa52241aeafe58a20f35e50b7510a7f3d674cc0

Author: chawbacca

Date: 2009-02-24 05:39:41 -0600

Initial Project Commit

diff --git a/README b/README deleted file mode 100644 index 4f31f67..0000000 --- a/README +++ /dev/null @@ -1,5 +0,0 @@ -To install copy the debug_kit directory to the plugins folder and include the toolbar component in your app_controller.php: - -$components = array('DebugKit.Toolbar'); - -+ Set debug mode to at least 1. \ No newline at end of file diff --git a/controllers/components/toolbar.php b/controllers/components/toolbar.php deleted file mode 100644 index a7de51d..0000000 --- a/controllers/components/toolbar.php +++ /dev/null @@ -1,588 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugKit DebugToolbar Component - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.controllers.components - * @since DebugKit 0.1 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class ToolbarComponent extends Object { -/** - * Controller instance reference - * - * @var object - */ - var $controller; -/** - * Components used by DebugToolbar - * - * @var array - */ - var $components = array('RequestHandler'); -/** - * The default panels the toolbar uses. - * which panels are used can be configured when attaching the component - * - * @var array - */ - var $_defaultPanels = array('history', 'session', 'request', 'sqlLog', 'timer', 'log', 'variables'); -/** - * Loaded panel objects. - * - * @var array - */ - var $panels = array(); -/** - * fallback for javascript settings - * - * @var array - **/ - var $_defaultJavascript = array( - 'behavior' => '/debug_kit/js/js_debug_toolbar' - ); -/** - * javascript files component will be using. - * - * @var array - **/ - var $javascript = array(); -/** - * CacheKey used for the cache file. - * - * @var string - **/ - var $cacheKey = 'toolbar_cache'; -/** - * Duration of the debug kit history cache - * - * @var string - **/ - var $cacheDuration = '+4 hours'; -/** - * initialize - * - * If debug is off the component will be disabled and not do any further time tracking - * or load the toolbar helper. - * - * @return bool - **/ - function initialize(&$controller, $settings) { - if (Configure::read('debug') == 0) { - $this->enabled = false; - return false; - } - App::import('Vendor', 'DebugKit.DebugKitDebugger'); - - DebugKitDebugger::startTimer('componentInit', __('Component initialization and startup', true)); - - $panels = $this->_defaultPanels; - if (isset($settings['panels'])) { - $panels = $settings['panels']; - unset($settings['panels']); - } - $this->cacheKey .= $controller->Session->read('Config.userAgent'); - if (!isset($settings['history']) || (isset($settings['history']) && $settings['history'] !== false)) { - $this->_createCacheConfig(); - } - - if (isset($settings['javascript'])) { - $settings['javascript'] = $this->_setJavascript($settings['javascript']); - } else { - $settings['javascript'] = $this->_defaultJavascript; - } - $this->_loadPanels($panels, $settings); - - $this->_set($settings); - $this->controller =& $controller; - return false; - } - -/** - * Component Startup - * - * @return bool - **/ - function startup(&$controller) { - $currentViewClass = $controller->view; - $this->_makeViewClass($currentViewClass); - $controller->view = 'DebugKit.Debug'; - $isHtml = ( - !isset($controller->params['url']['ext']) || - (isset($controller->params['url']['ext']) && $controller->params['url']['ext'] == 'html') - ); - - if (!$this->RequestHandler->isAjax() && $isHtml) { - $format = 'Html'; - } else { - $format = 'FirePhp'; - } - $controller->helpers['DebugKit.Toolbar'] = array( - 'output' => sprintf('DebugKit.%sToolbar', $format), - 'cacheKey' => $this->cacheKey, - 'cacheConfig' => 'debug_kit', - ); - $panels = array_keys($this->panels); - foreach ($panels as $panelName) { - $this->panels[$panelName]->startup($controller); - } - DebugKitDebugger::stopTimer('componentInit'); - DebugKitDebugger::startTimer('controllerAction', __('Controller Action', true)); - } -/** - * beforeRedirect callback - * - * @return void - **/ - function beforeRedirect(&$controller) { - DebugKitDebugger::stopTimer('controllerAction'); - $vars = $this->_gatherVars($controller); - $this->_saveState($controller, $vars); - } -/** - * beforeRender callback - * - * Calls beforeRender on all the panels and set the aggregate to the controller. - * - * @return void - **/ - function beforeRender(&$controller) { - DebugKitDebugger::stopTimer('controllerAction'); - $vars = $this->_gatherVars($controller); - $this->_saveState($controller, $vars); - - $controller->set(array('debugToolbarPanels' => $vars, 'debugToolbarJavascript' => $this->javascript)); - DebugKitDebugger::startTimer('controllerRender', __('Render Controller Action', true)); - } -/** - * Load a toolbar state from cache - * - * @param int $key - * @return array - **/ - function loadState($key) { - $history = Cache::read($this->cacheKey, 'debug_kit'); - if (isset($history[$key])) { - return $history[$key]; - } - return array(); - } -/** - * Create the cache config for the history - * - * @return void - * @access protected - **/ - function _createCacheConfig() { - Cache::config('debug_kit', array('duration' => $this->cacheDuration, 'engine' => 'File')); - } -/** - * collects the panel contents - * - * @return array Array of all panel beforeRender() - * @access protected - **/ - function _gatherVars(&$controller) { - $vars = array(); - $panels = array_keys($this->panels); - - foreach ($panels as $panelName) { - $panel =& $this->panels[$panelName]; - $vars[$panelName]['content'] = $panel->beforeRender($controller); - $elementName = Inflector::underscore($panelName) . '_panel'; - if (isset($panel->elementName)) { - $elementName = $panel->elementName; - } - $vars[$panelName]['elementName'] = $elementName; - $vars[$panelName]['plugin'] = $panel->plugin; - $vars[$panelName]['disableTimer'] = true; - } - return $vars; - } -/** - * Load Panels used in the debug toolbar - * - * @return void - * @access protected - **/ - function _loadPanels($panels, $settings) { - foreach ($panels as $panel) { - $className = $panel . 'Panel'; - if (!class_exists($className) && !App::import('Vendor', $className)) { - trigger_error(sprintf(__('Could not load DebugToolbar panel %s', true), $panel), E_USER_WARNING); - continue; - } - $panelObj =& new $className($settings); - if (is_subclass_of($panelObj, 'DebugPanel') || is_subclass_of($panelObj, 'debugpanel')) { - $this->panels[$panel] =& $panelObj; - } - } - } - -/** - * Set the javascript to user scripts. - * - * Set either script key to false to exclude it from the rendered layout. - * - * @param array $scripts Javascript config information - * @return array - * @access protected - **/ - function _setJavascript($scripts) { - $behavior = false; - if (!is_array($scripts)) { - $scripts = (array)$scripts; - } - if (isset($scripts[0])) { - $behavior = $scripts[0]; - } - if (isset($scripts['behavior'])) { - $behavior = $scripts['behavior']; - } - if (!$behavior) { - return array(); - } elseif ($behavior === true) { - $behavior = 'js'; - } - if (strpos($behavior, '/') !== 0) { - $behavior .= '_debug_toolbar'; - } - $pluginFile = APP . 'plugins' . DS . 'debug_kit' . DS . 'vendors' . DS . 'js' . DS . $behavior . '.js'; - if (file_exists($pluginFile)) { - $behavior = '/debug_kit/js/' . $behavior . '.js'; - } - return compact('behavior'); - } -/** - * Makes the DoppleGangerView class if it doesn't already exist. - * This allows DebugView to be compatible with all view classes. - * - * @param string $baseClassName - * @access protected - * @return void - */ - function _makeViewClass($baseClassName) { - if (!class_exists('DoppelGangerView')) { - App::import('View', $baseClassName); - if (strpos('View', $baseClassName) === false) { - $baseClassName .= 'View'; - } - $class = "class DoppelGangerView extends $baseClassName {}"; - eval($class); - } - } -/** - * Save the current state of the toolbar varibles to the cache file. - * - * @param object $controller Controller instance - * @param array $vars Vars to save. - * @access protected - * @return void - **/ - function _saveState(&$controller, $vars) { - $config = Cache::config('debug_kit'); - if (empty($config) || !isset($this->panels['history'])) { - return; - } - $history = Cache::read($this->cacheKey, 'debug_kit'); - if (empty($history)) { - $history = array(); - } - if (count($history) == $this->panels['history']->history) { - array_pop($history); - } - unset($vars['history']); - array_unshift($history, $vars); - Cache::write($this->cacheKey, $history, 'debug_kit'); - } -} - -/** - * Debug Panel - * - * Abstract class for debug panels. - * - * @package cake.debug_kit - */ -class DebugPanel extends Object { -/** - * Defines which plugin this panel is from so the element can be located. - * - * @var string - */ - var $plugin = null; -/** - * startup the panel - * - * Pull information from the controller / request - * - * @param object $controller Controller reference. - * @return void - **/ - function startup(&$controller) { } - -/** - * Prepare output vars before Controller Rendering. - * - * @param object $controller Controller reference. - * @return void - **/ - function beforeRender(&$controller) { } -} - -/** - * History Panel - * - * Provides debug information on previous requests. - * - * @package cake.debug_kit.panels - **/ -class HistoryPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Number of history elements to keep - * - * @var string - **/ - var $history = 5; -/** - * Constructor - * - * @param array $settings Array of settings. - * @return void - **/ - function __construct($settings) { - if (isset($settings['history'])) { - $this->history = $settings['history']; - } - } -/** - * beforeRender callback function - * - * @return array contents for panel - **/ - function beforeRender(&$controller) { - $cacheKey = $controller->Toolbar->cacheKey; - $toolbarHistory = Cache::read($cacheKey, 'debug_kit'); - $historyStates = array(); - if (is_array($toolbarHistory) && !empty($toolbarHistory)) { - foreach ($toolbarHistory as $i => $state) { - $historyStates[] = array( - 'title' => $state['request']['content']['params']['url']['url'], - 'url' => array('plugin' => 'debug_kit', 'controller' => 'toolbar_access', 'action' => 'history_state', $i + 1) - ); - } - } - if (count($historyStates) >= $this->history) { - array_pop($historyStates); - } - return $historyStates; - } -} - -/** - * Variables Panel - * - * Provides debug information on the View variables. - * - * @package cake.debug_kit.panels - **/ -class VariablesPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - * - * @return array - **/ - function beforeRender(&$controller) { - return array_merge($controller->viewVars, array('$this->data' => $controller->data)); - } -} - -/** - * Session Panel - * - * Provides debug information on the Session contents. - * - * @package cake.debug_kit.panels - **/ -class SessionPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - * - * @param object $controller - * @access public - * @return array - */ - function beforeRender(&$controller) { - $sessions = $controller->Session->read(); - return $sessions; - } -} - -/** - * Request Panel - * - * Provides debug information on the Current request params. - * - * @package cake.debug_kit.panels - **/ -class RequestPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * beforeRender callback - grabs request params - * - * @return array - **/ - function beforeRender(&$controller) { - $out = array(); - $out['params'] = $controller->params; - if (isset($controller->Cookie)) { - $out['cookie'] = $controller->Cookie->read(); - } - $out['get'] = $_GET; - $out['currentRoute'] = Router::currentRoute(); - return $out; - } -} - -/** - * Timer Panel - * - * Provides debug information on all timers used in a request. - * - * @package cake.debug_kit.panels - **/ -class TimerPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * startup - add in necessary helpers - * - * @return void - **/ - function startup(&$controller) { - if (!in_array('Number', $controller->helpers)) { - $controller->helpers[] = 'Number'; - } - if (!in_array('SimpleGraph', $controller->helpers)) { - $controller->helpers[] = 'DebugKit.SimpleGraph'; - } - } -} - -/** - * sqlLog Panel - * - * Provides debug information on the SQL logs and provides links to an ajax explain interface. - * - * @package cake.debug_kit.panels - **/ -class sqlLogPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Get Sql Logs for each DB config - * - * @param string $controller - * @access public - * @return void - */ - function beforeRender(&$controller) { - $queryLogs = array(); - if (!class_exists('ConnectionManager')) { - return array(); - } - $dbConfigs = ConnectionManager::sourceList(); - foreach ($dbConfigs as $configName) { - $db =& ConnectionManager::getDataSource($configName); - if ($db->isInterfaceSupported('showLog')) { - ob_start(); - $db->showLog(); - $queryLogs[$configName] = ob_get_clean(); - } - } - return $queryLogs; - } -} - -/** - * Log Panel - Reads log entries made this request. - * - * @package cake.debug_kit.panels - */ -class LogPanel extends DebugPanel { - var $plugin = 'debug_kit'; -/** - * Log files to scan - * - * @var array - */ - var $logFiles = array('error.log', 'debug.log'); -/** - * startup - * - * @return void - **/ - function startup(&$controller) { - if (!class_exists('CakeLog')) { - App::import('Core', 'Log'); - } - } -/** - * beforeRender Callback - * - * @return array - **/ - function beforeRender(&$controller) { - $this->startTime = DebugKitDebugger::requestStartTime(); - $this->currentTime = DebugKitDebugger::requestTime(); - $out = array(); - foreach ($this->logFiles as $log) { - $file = LOGS . $log; - if (!file_exists($file)) { - continue; - } - $out[$log] = $this->_parseFile($file); - } - return $out; - } -/** - * parse a log file and find the relevant entries - * - * @param string $filename Name of file to read - * @access protected - * @return array - */ - function _parseFile($filename) { - $file =& new File($filename); - $contents = $file->read(); - $timePattern = '/(\d{4}-\d{2}\-\d{2}\s\d{1,2}\:\d{1,2}\:\d{1,2})/'; - $chunks = preg_split($timePattern, $contents, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - for ($i = 0, $len = count($chunks); $i < $len; $i += 2) { - if (strtotime($chunks[$i]) < $this->startTime) { - unset($chunks[$i], $chunks[$i + 1]); - } - } - return array_values($chunks); - } -} -?> \ No newline at end of file diff --git a/controllers/toolbar_access_controller.php b/controllers/toolbar_access_controller.php deleted file mode 100644 index 2085470..0000000 --- a/controllers/toolbar_access_controller.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugKit DebugToolbar Component - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.controllers.components - * @since DebugKit 0.1 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class ToolbarAccessController extends DebugKitAppController { -/** - * name - * - * @var string - */ - var $name = 'ToolbarAccess'; -/** - * uses array - * - * @var array - **/ - var $uses = array(); -/** - * Helpers - * - * @var array - **/ - var $helpers = array( - 'DebugKit.Toolbar' => array('output' => 'DebugKit.HtmlToolbar'), - 'Javascript', 'Number', 'DebugKit.SimpleGraph' - ); -/** - * components - * - * @var array - **/ - var $components = array('RequestHandler'); -/** - * beforeFilter callback - * - * @return void - **/ - function beforeFilter() { - if (isset($this->Toolbar)) { - $this->Toolbar->enabled = false; - } - $this->helpers['DebugKit.Toolbar']['cacheKey'] = $this->Toolbar->cacheKey; - $this->helpers['DebugKit.Toolbar']['cacheConfig'] = 'debug_kit'; - } -/** - * Get a stored history state from the toolbar cache. - * - * @return void - **/ - function history_state($key = null) { - $oldState = $this->Toolbar->loadState($key); - $this->set('toolbarState', $oldState); - $this->set('debugKitInHistoryMode', true); - } -} \ No newline at end of file diff --git a/debug_kit_app_controller.php b/debug_kit_app_controller.php deleted file mode 100644 index 0a63efb..0000000 --- a/debug_kit_app_controller.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Debug Kit App Controller - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class DebugKitAppController extends AppController { - -} -?> \ No newline at end of file diff --git a/debug_kit_app_model.php b/debug_kit_app_model.php deleted file mode 100644 index ee7af0b..0000000 --- a/debug_kit_app_model.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Debug Kit App Model - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class DebugKitAppModel extends AppModel { - -} -?> \ No newline at end of file diff --git a/tests/cases/controllers/components/toolbar.test.php b/tests/cases/controllers/components/toolbar.test.php deleted file mode 100644 index ae7dfb7..0000000 --- a/tests/cases/controllers/components/toolbar.test.php +++ /dev/null @@ -1,370 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugToolbar Test - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Component', 'DebugKit.Toolbar'); - -class TestToolbarComponent extends ToolbarComponent { - function loadPanels($panels, $settings = array()) { - $this->_loadPanels($panels, $settings); - } -} - -Mock::generate('DebugPanel'); - -/** -* DebugToolbar Test case -*/ -class DebugToolbarTestCase extends CakeTestCase { - - function setUp() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - $this->Controller =& ClassRegistry::init('Controller'); - $this->Controller->params = Router::parse('/'); - $this->Controller->params['url']['url'] = '/'; - $this->Controller->Component =& ClassRegistry::init('Component'); - $this->Controller->Toolbar =& ClassRegistry::init('TestToolBarComponent', 'Component'); - } - -/** - * test Loading of panel classes - * - * @return void - **/ - function testLoadPanels() { - $this->Controller->Toolbar->loadPanels(array('session', 'request')); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['session'], 'SessionPanel')); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['request'], 'RequestPanel')); - - $this->expectError(); - $this->Controller->Toolbar->loadPanels(array('randomNonExisting', 'request')); - } - -/** - * test loading of vendor panels from test_app folder - * - * @access public - * @return void - */ - function testVendorPanels() { - $_back = Configure::read('vendorPaths'); - Configure::write('vendorPaths', array(APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'test_app' . DS . 'vendors' . DS)); - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('test'), - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->assertTrue(isset($this->Controller->Toolbar->panels['test'])); - $this->assertTrue(is_a($this->Controller->Toolbar->panels['test'], 'TestPanel')); - - Configure::write('vendorPaths', $_back); - } - -/** - * test initialize - * - * @return void - * @access public - **/ - function testInitialize() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - - $this->assertFalse(empty($this->Controller->Toolbar->panels)); - - $timers = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($timers['componentInit'])); - } - -/** - * test startup - * - * @return void - **/ - function testStartup() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('MockDebug') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Toolbar->panels['MockDebug']->expectOnce('startup'); - $this->Controller->Toolbar->startup($this->Controller); - - $this->assertEqual(count($this->Controller->Toolbar->panels), 1); - $this->assertTrue(isset($this->Controller->helpers['DebugKit.Toolbar'])); - - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['output'], 'DebugKit.HtmlToolbar'); - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['cacheConfig'], 'debug_kit'); - $this->assertTrue(isset($this->Controller->helpers['DebugKit.Toolbar']['cacheKey'])); - - $timers = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($timers['controllerAction'])); - } -/** - * Test that cache config generation works. - * - * @return void - **/ - function testCacheConfigGeneration() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - - $results = Cache::config('debug_kit'); - $this->assertTrue(is_array($results)); - } -/** - * test state saving of toolbar - * - * @return void - **/ - function testStateSaving() { - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $configName = 'debug_kit'; - $this->Controller->Toolbar->cacheKey = 'toolbar_history'; - - $this->Controller->Component->startup($this->Controller); - $this->Controller->set('test', 'testing'); - $this->Controller->Component->beforeRender($this->Controller); - - $result = Cache::read('toolbar_history', $configName); - $this->assertEqual($result[0]['variables']['content']['test'], 'testing'); - Cache::delete('toolbar_history', $configName); - } -/** - * Test Before Render callback - * - * @return void - **/ - function testBeforeRender() { - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('MockDebug', 'session') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Toolbar->panels['MockDebug']->expectOnce('beforeRender'); - $this->Controller->Toolbar->beforeRender($this->Controller); - - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarPanels'])); - $vars = $this->Controller->viewVars['debugToolbarPanels']; - - $expected = array( - 'plugin' => 'debug_kit', - 'elementName' => 'session_panel', - 'content' => $this->Controller->Session->read(), - 'disableTimer' => true, - ); - $this->assertEqual($expected, $vars['session']); - } - -/** - * test alternate javascript library use - * - * @return void - **/ - function testAlternateJavascript() { - $this->Controller->components = array( - 'DebugKit.Toolbar' - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => '/debug_kit/js/js_debug_toolbar', - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => 'jquery', - ), - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => '/debug_kit/js/jquery_debug_toolbar.js', - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => false - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array(); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => array('my_library'), - ), - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => 'my_library_debug_toolbar' - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => array('/my/path/to/file') - ), - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => '/my/path/to/file', - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => '/js/custom_behavior', - ), - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => '/js/custom_behavior', - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - } -/** - * Test alternate javascript existing in the plugin. - * - * @return void - **/ - function testExistingAlterateJavascript() { - $filename = APP . 'plugins' . DS . 'debug_kit' . DS . 'vendors' . DS . 'js' . DS . 'test_alternate_debug_toolbar.js'; - $this->skipIf(!is_writable(dirname($filename)), 'Skipping existing javascript test, debug_kit/vendors/js must be writable'); - - @touch($filename); - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'javascript' => 'test_alternate', - ), - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $this->assertTrue(isset($this->Controller->viewVars['debugToolbarJavascript'])); - $expected = array( - 'behavior' => '/debug_kit/js/test_alternate_debug_toolbar.js', - ); - $this->assertEqual($this->Controller->viewVars['debugToolbarJavascript'], $expected); - @unlink($filename); - } -/** - * test the Log panel log reading. - * - * @return void - **/ - function testLogPanel() { - usleep(20); - $this->Controller->log('This is a log I made this request'); - $this->Controller->log('This is the second log I made this request'); - $this->Controller->log('This time in the debug log!', LOG_DEBUG); - - $this->Controller->components = array( - 'DebugKit.Toolbar' => array( - 'panels' => array('log', 'session') - ) - ); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->viewVars['debugToolbarPanels']['log']; - - $this->assertEqual(count($result['content']), 2); - $this->assertEqual(count($result['content']['error.log']), 4); - $this->assertEqual(count($result['content']['debug.log']), 2); - - $this->assertEqual(trim($result['content']['debug.log'][1]), 'Debug: This time in the debug log!'); - $this->assertEqual(trim($result['content']['error.log'][1]), 'Error: This is a log I made this request'); - } -/** - * Test that the FireCake toolbar is used on AJAX requests - * - * @return void - **/ - function testAjaxToolbar() { - $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->Component->init($this->Controller); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->assertEqual($this->Controller->helpers['DebugKit.Toolbar']['output'], 'DebugKit.FirePhpToolbar'); - } - -/** - * teardown - * - * @return void - **/ - function tearDown() { - unset($this->Controller); - if (class_exists('DebugKitDebugger')) { - DebugKitDebugger::clearTimers(); - } - } -} -?> \ No newline at end of file diff --git a/tests/cases/test_objects.php b/tests/cases/test_objects.php deleted file mode 100644 index d7a91dc..0000000 --- a/tests/cases/test_objects.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Common test objects used in DebugKit tests - * - * Long description for file - * - * PHP versions 4 and 5 - * - * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The Open Group Test Suite License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests - * @package cake.tests - * @subpackage cake.tests.cases.libs - * @since CakePHP(tm) v 1.2.0.5432 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License - */ -/** - * TestFireCake class allows for testing of FireCake - * - * @package debug_kit.tests. - */ -class TestFireCake extends FireCake { - var $sentHeaders = array(); - - function _sendHeader($name, $value) { - $_this = FireCake::getInstance(); - $_this->sentHeaders[$name] = $value; - } -/** - * skip client detection as headers are not being sent. - * - * @access public - * @return void - */ - function detectClientExtension() { - return true; - } -/** - * Reset the fireCake - * - * @return void - **/ - function reset() { - $_this = FireCake::getInstance(); - $_this->sentHeaders = array(); - $_this->_messageIndex = 1; - } -} - -?> diff --git a/tests/cases/vendors/debug_kit_debugger.test.php b/tests/cases/vendors/debug_kit_debugger.test.php deleted file mode 100644 index 79bbe8b..0000000 --- a/tests/cases/vendors/debug_kit_debugger.test.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugKit Debugger Test Case File - * - * Long description for file - * - * PHP versions 4 and 5 - * - * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The Open Group Test Suite License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests - * @package cake.tests - * @subpackage cake.tests.cases.libs - * @since CakePHP(tm) v 1.2.0.5432 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License - */ -App::import('Core', 'Debugger'); -App::import('Vendor', 'DebugKit.DebugKitDebugger'); - -require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php'; - -/** - * Short description for class. - * - * @package cake.tests - * @subpackage cake.tests.cases.libs - */ -class DebugKitDebuggerTest extends CakeTestCase { -/** - * setUp method - * - * @access public - * @return void - */ - function setUp() { - Configure::write('log', false); - if (!defined('SIMPLETESTVENDORPATH')) { - if (file_exists(APP . DS . 'vendors' . DS . 'simpletest' . DS . 'reporter.php')) { - define('SIMPLETESTVENDORPATH', 'APP' . DS . 'vendors'); - } else { - define('SIMPLETESTVENDORPATH', 'CORE' . DS . 'vendors'); - } - } - } - -/** - * Start Timer test - * - * @return void - **/ - function testTimers() { - $this->assertTrue(DebugKitDebugger::startTimer('test1', 'this is my first test')); - usleep(5000); - $this->assertTrue(DebugKitDebugger::stopTimer('test1')); - $elapsed = DebugKitDebugger::elapsedTime('test1'); - $this->assertTrue($elapsed > 0.0050); - - $this->assertTrue(DebugKitDebugger::startTimer('test2', 'this is my second test')); - sleep(1); - $this->assertTrue(DebugKitDebugger::stopTimer('test2')); - $elapsed = DebugKitDebugger::elapsedTime('test2'); - $this->assertTrue($elapsed > 1); - - DebugKitDebugger::startTimer('test3'); - $this->assertFalse(DebugKitDebugger::elapsedTime('test3')); - $this->assertFalse(DebugKitDebugger::stopTimer('wrong')); - } - -/** - * testRequestTime - * - * @access public - * @return void - */ - function testRequestTime() { - $result1 = DebugKitDebugger::requestTime(); - usleep(50); - $result2 = DebugKitDebugger::requestTime(); - $this->assertTrue($result1 < $result2); - } - -/** - * test getting all the set timers. - * - * @return void - **/ - function testGetTimers() { - DebugKitDebugger::clearTimers(); - DebugKitDebugger::startTimer('test1', 'this is my first test'); - DebugKitDebugger::stopTimer('test1'); - usleep(50); - DebugKitDebugger::startTimer('test2'); - DebugKitDebugger::stopTimer('test2'); - $timers = DebugKitDebugger::getTimers(); - - $this->assertEqual(count($timers), 2); - $this->assertTrue(is_float($timers['test1']['time'])); - $this->assertTrue(isset($timers['test1']['message'])); - $this->assertTrue(isset($timers['test2']['message'])); - } - -/** - * test memory usage - * - * @return void - **/ - function testMemoryUsage() { - $result = DebugKitDebugger::getMemoryUse(); - $this->assertTrue(is_int($result)); - - $result = DebugKitDebugger::getPeakMemoryUse(); - $this->assertTrue(is_int($result)); - } -/** - * test _output switch to firePHP - * - * @return void - */ - function testOutput() { - $firecake =& FireCake::getInstance('TestFireCake'); - Debugger::invoke(DebugKitDebugger::getInstance('DebugKitDebugger')); - Debugger::output('fb'); - $foo .= ''; - $result = $firecake->sentHeaders; - - $this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']); - $this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']); - $this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-5']); - - Debugger::invoke(Debugger::getInstance('Debugger')); - Debugger::output(); - } - -/** - * tearDown method - * - * @access public - * @return void - */ - function tearDown() { - Configure::write('log', true); - } - -} -?> \ No newline at end of file diff --git a/tests/cases/vendors/fire_cake.test.php b/tests/cases/vendors/fire_cake.test.php deleted file mode 100644 index 513fb96..0000000 --- a/tests/cases/vendors/fire_cake.test.php +++ /dev/null @@ -1,336 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * CakeFirePHP test case - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage cake.debug_kit.tests - * @since CakePHP v 1.2.0.4487 - * @version - * @modifiedby - * @lastmodified - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Vendor', 'DebugKit.FireCake'); - -require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php'; -/** - * Test Case For FireCake - * - * @package debug_kit.tests - */ -class FireCakeTestCase extends CakeTestCase { -/** - * setup test - * - * Fill FireCake with TestFireCake instance. - * - * @access public - * @return void - */ - function setUp() { - $this->firecake =& FireCake::getInstance('TestFireCake'); - } -/** - * test getInstance cheat. - * - * If this fails the rest of the test is going to fail too. - * - * @return void - **/ - function testGetInstanceOverride() { - $instance =& FireCake::getInstance(); - $instance2 =& FireCake::getInstance(); - $this->assertReference($instance, $instance2); - $this->assertIsA($instance, 'FireCake'); - $this->assertIsA($instance, 'TestFireCake', 'Stored instance is not a copy of TestFireCake, test case is broken.'); - } -/** - * testsetoption - * - * @return void - **/ - function testSetOptions() { - FireCake::setOptions(array('includeLineNumbers' => false)); - $this->assertEqual($this->firecake->options['includeLineNumbers'], false); - } -/** - * test Log() - * - * @access public - * @return void - */ - function testLog() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::log('Testing'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '26|[{"Type":"LOG"},"Testing"]|'); - - FireCake::log('Testing', 'log-info'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"LOG","Label":"log-info"},"Testing"]|'); - } -/** - * test info() - * - * @access public - * @return void - */ - function testInfo() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::info('I have information'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '38|[{"Type":"INFO"},"I have information"]|'); - - FireCake::info('I have information', 'info-label'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '59|[{"Type":"INFO","Label":"info-label"},"I have information"]|'); - } -/** - * test info() - * - * @access public - * @return void - */ - function testWarn() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::warn('A Warning'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"WARN"},"A Warning"]|'); - - FireCake::warn('A Warning', 'Bzzz'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '44|[{"Type":"WARN","Label":"Bzzz"},"A Warning"]|'); - } -/** - * test error() - * - * @access public - * @return void - **/ - function testError() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::error('An error'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 1); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '29|[{"Type":"ERROR"},"An error"]|'); - - FireCake::error('An error', 'wonky'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '45|[{"Type":"ERROR","Label":"wonky"},"An error"]|'); - } -/** - * test dump() - * - * @return void - **/ - function testDump() { - FireCake::dump('mydump', array('one' => 1, 'two' => 2)); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-2-1-1'], '28|{"mydump":{"one":1,"two":2}}|'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-2'])); - } -/** - * test table() generation - * - * @return void - **/ - function testTable() { - $table[] = array('Col 1 Heading','Col 2 Heading'); - $table[] = array('Row 1 Col 1','Row 1 Col 2'); - $table[] = array('Row 2 Col 1','Row 2 Col 2'); - $table[] = array('Row 3 Col 1','Row 3 Col 2'); - FireCake::table('myTrace', $table); - $expected = '162|[{"Type":"TABLE","Label":"myTrace"},[["Col 1 Heading","Col 2 Heading"],["Row 1 Col 1","Row 1 Col 2"],["Row 2 Col 1","Row 2 Col 2"],["Row 3 Col 1","Row 3 Col 2"]]]|'; - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], $expected); - } -/** - * testStringEncoding - * - * @return void - **/ - function testStringEncode() { - $result = $this->firecake->stringEncode(array(1,2,3)); - $this->assertEqual($result, array(1,2,3)); - - $this->firecake->setOptions(array('maxArrayDepth' => 3)); - $deep = array(1 => array(2 => array(3))); - $result = $this->firecake->stringEncode($deep); - $this->assertEqual($result, array(1 => array(2 => '** Max Array Depth (3) **'))); - - $obj =& FireCake::getInstance(); - $result = $this->firecake->stringEncode($obj); - $this->assertTrue(is_array($result)); - $this->assertEqual($result['_defaultOptions']['useNativeJsonEncode'], true); - $this->assertEqual($result['_log'], null); - $this->assertEqual($result['_encodedObjects'][0], '** Recursion (TestFireCake) **'); - } -/** - * test trace() - * - * @return void - **/ - function testTrace() { - FireCake::trace('myTrace'); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-Protocol-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Plugin-1'])); - $this->assertTrue(isset($this->firecake->sentHeaders['X-Wf-1-Structure-1'])); - $dump = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertPattern('/"Message":"myTrace"/', $dump); - $this->assertPattern('/"Trace":\[/', $dump); - } -/** - * test enabling and disabling of FireCake output - * - * @return void - **/ - function testEnableDisable() { - FireCake::disable(); - FireCake::trace('myTrace'); - $this->assertTrue(empty($this->firecake->sentHeaders)); - - FireCake::enable(); - FireCake::trace('myTrace'); - $this->assertFalse(empty($this->firecake->sentHeaders)); - } -/** - * test correct line continuation markers on multi line headers. - * - * @access public - * @return void - */ - function testMultiLineOutput() { - FireCake::trace('myTrace'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertEqual(substr($header, -2), '|\\'); - - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-2']; - $this->assertEqual(substr($header, -2), '|\\'); - - $header = $this->firecake->sentHeaders['X-Wf-1-1-1-3']; - $this->assertEqual(substr($header, -1), '|'); - } - -/** - * test inclusion of line numbers - * - * @return void - **/ - function testIncludeLineNumbers() { - FireCake::setOptions(array('includeLineNumbers' => true)); - FireCake::info('Testing'); - $result = $this->firecake->sentHeaders['X-Wf-1-1-1-1']; - $this->assertPattern('/"File"\:"APP.*fire_cake.test.php/', $result); - $this->assertPattern('/"Line"\:\d+/', $result); - } -/** - * test Group messages - * - * @return void - **/ - function testGroup() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::group('test'); - FireCake::info('my info'); - FireCake::groupEnd(); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '44|[{"Type":"GROUP_START","Label":"test"},null]|'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '27|[{"Type":"GROUP_END"},null]|'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - } -/** - * test fb() parameter parsing - * - * @return void - **/ - function testFbParameterParsing() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::fb('Test'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '23|[{"Type":"LOG"},"Test"]|'); - - FireCake::fb('Test', 'warn'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-2'], '24|[{"Type":"WARN"},"Test"]|'); - - FireCake::fb('Test', 'Custom label', 'warn'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-3'], '47|[{"Type":"WARN","Label":"Custom label"},"Test"]|'); - - $this->expectError(); - $this->assertFalse(FireCake::fb('Test', 'Custom label', 'warn', 'more parameters')); - - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-Index'], 3); - } -/** - * Test defaulting to log if incorrect message type is used - * - * @return void - **/ - function testIncorrectMessageType() { - FireCake::setOptions(array('includeLineNumbers' => false)); - FireCake::fb('Hello World', 'foobared'); - $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], '30|[{"Type":"LOG"},"Hello World"]|'); - } -/** - * testClientExtensionDetection. - * - * @return void - **/ - function testDetectClientExtension() { - $back = env('HTTP_USER_AGENT'); - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.2.1'; - $this->assertTrue(FireCake::detectClientExtension()); - - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 FirePHP/0.0.4'; - $this->assertFalse(FireCake::detectClientExtension()); - - $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4'; - $this->assertFalse(FireCake::detectClientExtension()); - $_SERVER['HTTP_USER_AGENT'] = $back; - } -/** - * test of Non Native JSON encoding. - * - * @return void - **/ - function testNonNativeEncoding() { - FireCake::setOptions(array('useNativeJsonEncode' => false)); - $json = FireCake::jsonEncode(array('one' => 1, 'two' => 2)); - $this->assertEqual($json, '{"one":1,"two":2}'); - - $json = FireCake::jsonEncode(array(1,2,3)); - $this->assertEqual($json, '[1,2,3]'); - - $json = FireCake::jsonEncode(FireCake::getInstance()); - $this->assertPattern('/"options"\:\{"maxObjectDepth"\:\d*,/', $json); - } -/** - * reset the FireCake counters and headers. - * - * @access public - * @return void - */ - function tearDown() { - TestFireCake::reset(); - } -} -?> \ No newline at end of file diff --git a/tests/cases/views/debug.test.php b/tests/cases/views/debug.test.php deleted file mode 100644 index 916a67d..0000000 --- a/tests/cases/views/debug.test.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugView test Case - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Core', 'View'); - -if (!class_exists('DoppelGangerView')) { - class DoppelGangerView extends View {} -} - -App::import('View', 'DebugKit.Debug'); -App::import('Vendor', 'DebugKit.DebugKitDebugger'); -/** - * Debug View Test Case - * - * @package debug_kit.tests - */ -class DebugViewTestCase extends CakeTestCase { -/** - * set Up test case - * - * @return void - **/ - function setUp() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - $this->Controller =& ClassRegistry::init('Controller'); - $this->View =& new DebugView($this->Controller, false); - $this->_debug = Configure::read('debug'); - } - -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - } - -/** - * test that element timers are working - * - * @return void - **/ - function testElementTimers() { - $result = $this->View->element('test_element'); - $this->assertPattern('/^this is the test element$/', $result); - - $result = DebugKitDebugger::getTimers(); - $this->assertTrue(isset($result['render_test_element.ctp'])); - } - -/** - * test rendering and ensure that timers are being set. - * - * @access public - * @return void - */ - function testRenderTimers() { - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->layout = 'default'; - $View =& new DebugView($this->Controller, false); - $View->render('index'); - - $result = DebugKitDebugger::getTimers(); - $this->assertEqual(count($result), 3); - $this->assertTrue(isset($result['viewRender'])); - $this->assertTrue(isset($result['render_default.ctp'])); - $this->assertTrue(isset($result['render_index.ctp'])); - } - -/** - * Test for correct loading of helpers into custom view - * - * @return void - */ - function testLoadHelpers() { - $loaded = array(); - $result = $this->View->_loadHelpers($loaded, array('Html', 'Javascript', 'Number')); - $this->assertTrue(is_object($result['Html'])); - $this->assertTrue(is_object($result['Javascript'])); - $this->assertTrue(is_object($result['Number'])); - } - -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - } - -/** - * tear down function - * - * @return void - **/ - function tearDown() { - unset($this->View, $this->Controller); - DebugKitDebugger::clearTimers(); - Configure::write('debug', $this->_debug); - } -} -?> \ No newline at end of file diff --git a/tests/cases/views/helpers/fire_php_toobar.test.php b/tests/cases/views/helpers/fire_php_toobar.test.php deleted file mode 100644 index 60206dc..0000000 --- a/tests/cases/views/helpers/fire_php_toobar.test.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Toolbar Abstract Helper Test Case - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage debug_kit.tests.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Helper', 'DebugKit.FirePhpToolbar'); -App::import('Core', array('View', 'Controller')); -require_once APP . 'plugins' . DS . 'debug_kit' . DS . 'tests' . DS . 'cases' . DS . 'test_objects.php'; - -FireCake::getInstance('TestFireCake'); - -class FirePhpToolbarHelperTestCase extends CakeTestCase { -/** - * setUp - * - * @return void - **/ - function setUp() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.FirePhpToolbar')); - $this->Toolbar->FirePhpToolbar =& new FirePhpToolbarHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - $this->firecake =& FireCake::getInstance(); - } -/** - * test neat array (dump)creation - * - * @return void - */ - function testMakeNeatArray() { - $this->Toolbar->makeNeatArray(array(1,2,3)); - $result = $this->firecake->sentHeaders; - $this->assertTrue(isset($result['X-Wf-1-1-1-1'])); - $this->assertPattern('/\[1,2,3\]/', $result['X-Wf-1-1-1-1']); - } -/** - * testAfterlayout element rendering - * - * @return void - */ - function testAfterLayout(){ - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index', 'ext' => 'xml'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->layout = 'default'; - $this->Controller->uses = null; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $this->assertNoPattern('/debug-toolbar/', $result); - $result = $this->firecake->sentHeaders; - $this->assertTrue(is_array($result)); - - } -/** - * endTest() - * - * @return void - */ - function endTest() { - TestFireCake::reset(); - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - } - -/** - * tearDown - * - * @access public - * @return void - */ - function tearDown() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - Router::reload(); - } -} -?> \ No newline at end of file diff --git a/tests/cases/views/helpers/html_toolbar.test.php b/tests/cases/views/helpers/html_toolbar.test.php deleted file mode 100644 index d924c9e..0000000 --- a/tests/cases/views/helpers/html_toolbar.test.php +++ /dev/null @@ -1,358 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Toolbar HTML Helper Test Case - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage debug_kit.tests.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Helper', array('DebugKit.HtmlToolbar', 'Html', 'Javascript')); -App::import('Core', array('View', 'Controller')); - -class HtmlToolbarHelperTestCase extends CakeTestCase { -/** - * setUp - * - * @return void - **/ - function setUp() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array('output' => 'DebugKit.HtmlToolbar')); - $this->Toolbar->HtmlToolbar =& new HtmlToolbarHelper(); - $this->Toolbar->HtmlToolbar->Html =& new HtmlHelper(); - $this->Toolbar->HtmlToolbar->Javascript =& new JavascriptHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } - -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - } - -/** - * test Neat Array formatting - * - * @return void - **/ - function testMakeNeatArray() { - $in = false; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', '0' , '/strong', '(false)', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = null; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', '0' , '/strong', '(null)', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = true; - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', '0' , '/strong', '(true)', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array('key' => 'value'); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array('key' => null); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', 'key', '/strong', '(null)', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array('key' => 'value', 'foo' => 'bar'); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '<li', '<strong', 'foo', '/strong', 'bar', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array( - 'key' => 'value', - 'foo' => array( - 'this' => 'deep', - 'another' => 'value' - ) - ); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '<li', '<strong', 'foo', '/strong', - array('ul' => array('class' => 'neat-array depth-1')), - '<li', '<strong', 'this', '/strong', 'deep', '/li', - '<li', '<strong', 'another', '/strong', 'value', '/li', - '/ul', - '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array( - 'key' => 'value', - 'foo' => array( - 'this' => 'deep', - 'another' => 'value' - ), - 'lotr' => array( - 'gandalf' => 'wizard', - 'bilbo' => 'hobbit' - ) - ); - $result = $this->Toolbar->makeNeatArray($in, 1); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0 expanded'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '<li', '<strong', 'foo', '/strong', - array('ul' => array('class' => 'neat-array depth-1')), - '<li', '<strong', 'this', '/strong', 'deep', '/li', - '<li', '<strong', 'another', '/strong', 'value', '/li', - '/ul', - '/li', - '<li', '<strong', 'lotr', '/strong', - array('ul' => array('class' => 'neat-array depth-1')), - '<li', '<strong', 'gandalf', '/strong', 'wizard', '/li', - '<li', '<strong', 'bilbo', '/strong', 'hobbit', '/li', - '/ul', - '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $result = $this->Toolbar->makeNeatArray($in, 2); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0 expanded'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '<li', '<strong', 'foo', '/strong', - array('ul' => array('class' => 'neat-array depth-1 expanded')), - '<li', '<strong', 'this', '/strong', 'deep', '/li', - '<li', '<strong', 'another', '/strong', 'value', '/li', - '/ul', - '/li', - '<li', '<strong', 'lotr', '/strong', - array('ul' => array('class' => 'neat-array depth-1 expanded')), - '<li', '<strong', 'gandalf', '/strong', 'wizard', '/li', - '<li', '<strong', 'bilbo', '/strong', 'hobbit', '/li', - '/ul', - '/li', - '/ul' - ); - $this->assertTags($result, $expected); - - $in = array('key' => 'value', 'array' => array()); - $result = $this->Toolbar->makeNeatArray($in); - $expected = array( - 'ul' => array('class' => 'neat-array depth-0'), - '<li', '<strong', 'key', '/strong', 'value', '/li', - '<li', '<strong', 'array', '/strong', '(empty)', '/li', - '/ul' - ); - $this->assertTags($result, $expected); - } - -/** - * Test injection of toolbar - * - * @return void - **/ - function testInjectToolbar() { - $this->Controller->viewPath = 'posts'; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => null, - 'here' => '/posts/index', - ); - $this->Controller->helpers = array('Html', 'Javascript', 'DebugKit.Toolbar'); - $this->Controller->layout = 'default'; - $this->Controller->uses = null; - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $result = str_replace(array("\n", "\r"), '', $result); - $this->assertPattern('#<div id\="debug-kit-toolbar">.+</div></body>#', $result); - } - -/** - * test injection of javascript - * - * @return void - **/ - function testJavascriptInjection() { - $this->Controller->viewPath = 'posts'; - $this->Controller->uses = null; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => '/', - 'here' => '/posts/index', - ); - $this->Controller->helpers = array('Javascript', 'Html'); - $this->Controller->components = array('DebugKit.Toolbar'); - $this->Controller->layout = 'default'; - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $result = str_replace(array("\n", "\r"), '', $result); - $this->assertPattern('#<script\s*type="text/javascript"\s*src="/debug_kit/js/js_debug_toolbar.js"\s*>\s?</script>#', $result); - } - -/** - * test Injection of user defined javascript - * - * @return void - **/ - function testCustomJavascriptInjection() { - $this->Controller->viewPath = 'posts'; - $this->Controller->uses = null; - $this->Controller->action = 'index'; - $this->Controller->params = array( - 'action' => 'index', - 'controller' => 'posts', - 'plugin' => null, - 'url' => array('url' => 'posts/index'), - 'base' => '/', - 'here' => '/posts/index', - ); - $this->Controller->helpers = array('Javascript', 'Html'); - $this->Controller->components = array('DebugKit.Toolbar' => array('javascript' => array('my_custom'))); - $this->Controller->layout = 'default'; - $this->Controller->constructClasses(); - $this->Controller->Component->initialize($this->Controller); - $this->Controller->Component->startup($this->Controller); - $this->Controller->Component->beforeRender($this->Controller); - $result = $this->Controller->render(); - $result = str_replace(array("\n", "\r"), '', $result); - $this->assertPattern('#<script\s*type="text/javascript"\s*src="js/my_custom_debug_toolbar.js"\s*>\s?</script>#', $result); - } -/** - * test message creation - * - * @return void - */ - function testMessage() { - $result = $this->Toolbar->message('test', 'one, two'); - $expected = array( - '<p', - '<strong', 'test', '/strong', - ' one, two', - '/p', - ); - $this->assertTags($result, $expected); - } -/** - * Test Table generation - * - * @return void - */ - function testTable() { - $rows = array( - array(1,2), - array(3,4), - ); - $result = $this->Toolbar->table($rows); - $expected = array( - 'table' => array('class' =>'debug-table'), - array('tr' => array('class' => 'odd')), - '<td', '1', '/td', - '<td', '2', '/td', - '/tr', - array('tr' => array('class' => 'even')), - '<td', '3', '/td', - '<td', '4', '/td', - '/tr', - '/table' - ); - $this->assertTags($result, $expected); - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - } - -/** - * tearDown - * - * @access public - * @return void - */ - function tearDown() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - } -} -?> \ No newline at end of file diff --git a/tests/cases/views/helpers/toolbar.test.php b/tests/cases/views/helpers/toolbar.test.php deleted file mode 100644 index 56a4ff5..0000000 --- a/tests/cases/views/helpers/toolbar.test.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Toolbar facade tests. - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage debug_kit.tests.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Helper', array('DebugKit.Toolbar')); -App::import('Core', array('View', 'Controller')); - -Mock::generate('Helper', 'MockBackendHelper', array('testMethod')); - -class ToolbarHelperTestCase extends CakeTestCase { -/** - * setUp - * - * @return void - **/ - function setUp() { - Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - Router::parse('/'); - - $this->Toolbar =& new ToolbarHelper(array( - 'output' => 'MockBackendHelper', - 'cacheKey' => 'debug_kit_toolbar_test_case', - 'cacheConfig' => 'default' - )); - $this->Toolbar->MockBackend = new MockBackendHelper(); - - $this->Controller =& ClassRegistry::init('Controller'); - if (isset($this->_debug)) { - Configure::write('debug', $this->_debug); - } - } - -/** - * start Case - switch view paths - * - * @return void - **/ - function startCase() { - $this->_viewPaths = Configure::read('viewPaths'); - Configure::write('viewPaths', array( - TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, - APP . 'plugins' . DS . 'debug_kit' . DS . 'views'. DS, - ROOT . DS . LIBS . 'view' . DS - )); - $this->_debug = Configure::read('debug'); - } -/** - * test cache writing for views. - * - * @return void - **/ - function testCacheWrite() { - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertTrue($result); - } -/** - * Ensure that the cache writing only affects the - * top most level of the history stack. As this is where the current request is stored. - * - * @return void - **/ - function testOnlyWritingToFirstElement() { - $values = array( - array('test' => array('content' => array('first', 'values'))), - array('test' => array('content' => array('second', 'values'))), - ); - Cache::write('debug_kit_toolbar_test_case', $values); - $this->Toolbar->writeCache('test', array('new', 'values')); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('new', 'values')); - - $result = $this->Toolbar->readCache('test', 1); - $this->assertEqual($result, array('second', 'values')); - } -/** - * test cache reading for views - * - * @return void - **/ - function testCacheRead() { - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertTrue($result, 'Cache write failed %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('stuff', 'to', 'cache'), 'Cache value is wrong %s'); - - $result = $this->Toolbar->writeCache('test', array('new', 'stuff')); - $this->assertTrue($result, 'Cache write failed %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertEqual($result, array('new', 'stuff'), 'Cache value is wrong %s'); - } -/** - * Test that reading/writing doesn't work with no cache config. - * - * @return void - **/ - function testNoCacheConfigPresent() { - $this->Toolbar = new ToolbarHelper(array('output' => 'MockBackendHelper')); - - $result = $this->Toolbar->writeCache('test', array('stuff', 'to', 'cache')); - $this->assertFalse($result, 'Writing to cache succeeded with no cache config %s'); - - $result = $this->Toolbar->readCache('test'); - $this->assertFalse($result, 'Reading cache succeeded with no cache config %s'); - } -/** - * reset the view paths - * - * @return void - **/ - function endCase() { - Configure::write('viewPaths', $this->_viewPaths); - Cache::delete('debug_kit_toolbar_test_case', 'default'); - } -/** - * tearDown - * - * @access public - * @return void - */ - function tearDown() { - unset($this->Toolbar, $this->Controller); - ClassRegistry::removeObject('view'); - ClassRegistry::flush(); - } -} -?> \ No newline at end of file diff --git a/tests/fixtures/empty b/tests/fixtures/empty deleted file mode 100644 index e69de29..0000000 diff --git a/tests/groups/empty b/tests/groups/empty deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_app/vendors/test_panel.php b/tests/test_app/vendors/test_panel.php deleted file mode 100644 index 26a3de9..0000000 --- a/tests/test_app/vendors/test_panel.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Test Panel - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake.debug_kit - * @subpackage cake.debug_kit.tests - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class TestPanel extends DebugPanel { - function startup(&$controller) { - $controller->testPanel = true; - } -} -?> \ No newline at end of file diff --git a/vendors/css/debug_toolbar.css b/vendors/css/debug_toolbar.css deleted file mode 100644 index 8e6258c..0000000 --- a/vendors/css/debug_toolbar.css +++ /dev/null @@ -1,219 +0,0 @@ -/* @override http://localhost/cake_debug_kit/debug_kit/css/debug_toolbar.css */ -#debug-kit-toolbar { - position: fixed; - top: 0px; - right:0px; - width: 100%; - height: 1%; - overflow: visible; - z-index:10000; - font-family: helvetica, arial, sans-serif; -} -/* panel tabs */ -#debug-kit-toolbar #panel-tabs { - float: right; - list-style: none; - margin: 0; -} -#debug-kit-toolbar .panel-tab { - clear: none; - float: left; - margin: 0; - padding: 0; - list-style: none; -} - -#debug-kit-toolbar .panel-tab a { - float: left; - clear: none; - background: #efefef; - color: #222; - padding: 6px; - border-right: 1px solid #ccc; - font-size: 12px; - line-height: 16px; - margin: 0; - display: block; -} -#debug-kit-toolbar .panel-tab .active, -#debug-kit-toolbar .panel-tab a:hover { - background: #fff; -} -#debug-kit-toolbar .panel-tab.icon a { - padding: 4px; -} - -/* Hovering over link shows tab, useful for no js */ -#debug-kit-toolbar .panel-tab a:hover + .panel-content, -#debug-kit-toolbar .panel-tab a + .panel-content:hover { - display: block; -} - -/* panel content */ -#debug-kit-toolbar .panel-content { - position: absolute; - text-align: left; - width: auto; - top:28px; - right:0px; - background: #fff; - color: #000; - width:96%; - padding:20px 2%; - max-height: 550px; - overflow:auto; - border-bottom: 3px solid #333; -} - -/* Hide panel content by default */ -.panel-content { - display: none; -} - -.panel-content p { - margin: 1em 0; -} -.panel-content h2 { - padding: 0; - margin-top:0; -} -.panel-content h3 { - padding: 0; - margin-top: 1em; -} -.panel-content .info { - padding: 4px; - border-top: 1px dashed #6c6cff; - border-bottom: 1px dashed #6c6cff; -} -#debug-kit-toolbar h1, -#debug-kit-toolbar h2, -#debug-kit-toolbar h3, -#debug-kit-toolbar h4, -#debug-kit-toolbar h5, -#debug-kit-toolbar th { - font-family: "Trebuchet MS", trebuchet, helvetica, arial, sans-serif; - margin-bottom:0.6em; - background:none; -} - -/* panel tables */ -#debug-kit-toolbar table.debug-table { - width: auto; - border: 0; -} -#debug-kit-toolbar table.debug-table td, -#debug-kit-toolbar table.debug-table th { - text-align: left; - border: 0; - padding: 3px; -} -#debug-kit-toolbar table.debug-table th { - border-bottom: 1px solid #222; - background: 0;; -} -#debug-kit-toolbar table.debug-table tr:nth-child(2n+1) td { - background:#f6f6f6; -} -#debug-kit-toolbar table.debug-table tr.even td { - background:#f7f7f7; -} - - -/** code tables **/ -#debug-kit-toolbar .code-table td { - white-space: pre; - font-family: monaco, corsiva, "courier new", courier, monospaced; -} -#debug-kit-toolbar .code-table td:first-child { - width: 15%; -} -#debug-kit-toolbar .code-table td:last-child { - width: 80%; -} - -#debug-kit-toolbar .panel-content.request { - display: block; -} - - -/** Neat Array styles **/ -#debug-kit-toolbar .neat-array, -#debug-kit-toolbar .neat-array li { - list-style:none; - list-style-image:none; -} -.neat-array { - padding: 1px 2px 1px 20px; - background: #CE9E23; - list-style: none; - margin: 0 0 1em 0; -} -.neat-array .neat-array { - padding: 0 0 0 20px; - margin:0; - border-top:1px solid #CE9E23; -} -.neat-array li { - background: #FEF6E5; - border-top: 1px solid #CE9E23; - border-bottom: 1px solid #CE9E23; - margin: 0; - line-height: 1.5em; -} -.neat-array li:hover { - background: #fff; -} -.neat-array li strong { - padding: 0 8px; -} - -/* expandable sections */ -.neat-array li.expandable { - cursor: pointer; -} -.neat-array .expanded { - border-bottom:0; -} -.neat-array li.expandable.expanded > strong:before { - content: 'v '; -} -.neat-array li.expandable.collapsed > strong:before, -.neat-array li.expandable.expanded .expandable.collapsed > strong:before { - content: '> '; -} -.neat-array li { - cursor: default; -} - -#debug-kit-toolbar .debug-kit-graph-bar, -#debug-kit-toolbar .debug-kit-graph-bar-value { - margin: 0; - padding: 0px; - border: none; - overflow: hidden; - height: 10px; -} -#debug-kit-toolbar .debug-kit-graph-bar { - background-color: #ddd; - padding:2px; -} -#debug-kit-toolbar .debug-kit-graph-bar-value { - background-color: #CE9E23; -} - -/* previous panels */ -#debug-kit-toolbar .panel-content-history { - display: none; - background:#eeffff; -} -#debug-kit-toolbar #history-tab a { - float: none; -} -#debug-kit-toolbar #history-tab a.active { - background: #FEF6E5; -} -#debug-kit-toolbar #history-tab a.loading:after { - content : ' Loading...'; - font-style:italic; -} \ No newline at end of file diff --git a/vendors/debug_kit_debugger.php b/vendors/debug_kit_debugger.php deleted file mode 100644 index a1d111f..0000000 --- a/vendors/debug_kit_debugger.php +++ /dev/null @@ -1,226 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * DebugKit Debugger class. Extends and enhances core - * debugger. Adds benchmarking and timing functionality. - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Core', 'Debugger'); -App::import('Vendor', 'DebugKit.FireCake'); -/** - * Debug Kit Temporary Debugger Class - * - * Provides the future features that are planned. Yet not implemented in the 1.2 code base - * - * This file will not be needed in future version of CakePHP. - * @todo merge these changes with core Debugger - */ -class DebugKitDebugger extends Debugger { - -/** - * Start an benchmarking timer. - * - * @param string $name The name of the timer to start. - * @param string $message A message for your timer - * @return bool true - * @static - **/ - function startTimer($name = 'default', $message = '') { - $now = getMicrotime(); - $_this = DebugKitDebugger::getInstance(); - $_this->__benchmarks[$name] = array( - 'start' => $now, - 'message' => $message, - ); - return true; - } - -/** - * Stop a benchmarking timer. - * - * $name should be the same as the $name used in startTimer(). - * - * @param string $name The name of the timer to end. - * @access public - * @return boolean true if timer was ended, false if timer was not started. - * @static - */ - function stopTimer($name = 'default') { - $now = getMicrotime(); - $_this = DebugKitDebugger::getInstance(); - if (!isset($_this->__benchmarks[$name])) { - return false; - } - $_this->__benchmarks[$name]['end'] = $now; - return true; - } - -/** - * Get all timers that have been started and stopped. - * Calculates elapsed time for each timer. - * - * @return array - **/ - function getTimers() { - $_this =& DebugKitDebugger::getInstance(); - $times = array(); - foreach ($_this->__benchmarks as $name => $timer) { - $times[$name]['time'] = DebugKitDebugger::elapsedTime($name); - $times[$name]['message'] = $timer['message']; - } - return $times; - } - -/** - * Clear all existing timers - * - * @return bool true - **/ - function clearTimers() { - $_this =& DebugKitDebugger::getInstance(); - $_this->__benchmarks = array(); - return true; - } - -/** - * Get the difference in time between the timer start and timer end. - * - * @param $name string the name of the timer you want elapsed time for. - * @param $precision int the number of decimal places to return, defaults to 5. - * @return float number of seconds elapsed for timer name, 0 on missing key - * @static - **/ - function elapsedTime($name = 'default', $precision = 5) { - $_this =& DebugKitDebugger::getInstance(); - if (!isset($_this->__benchmarks[$name]['start']) || !isset($_this->__benchmarks[$name]['end'])) { - return 0; - } - return round($_this->__benchmarks[$name]['end'] - $_this->__benchmarks[$name]['start'], $precision); - } - -/** - * Get the total execution time until this point - * - * @access public - * @return float elapsed time in seconds since script start. - * @static - */ - function requestTime() { - $start = DebugKitDebugger::requestStartTime(); - $now = getMicroTime(); - return ($now - $start); - } -/** - * get the time the current request started. - * - * @access public - * @return float time of request start - * @static - */ - function requestStartTime() { - if (defined('TIME_START')) { - $startTime = TIME_START; - } else if (isset($_GLOBALS['TIME_START'])) { - $startTime = $_GLOBALS['TIME_START']; - } else { - $startTime = env('REQUEST_TIME'); - } - return $startTime; - } - -/** - * get current memory usage - * - * @return integer number of bytes ram currently in use. 0 if memory_get_usage() is not available. - * @static - **/ - function getMemoryUse() { - if (!function_exists('memory_get_usage')) { - return 0; - } - return memory_get_usage(); - } - -/** - * Get peak memory use - * - * @return integer peak memory use (in bytes). Returns 0 if memory_get_peak_usage() is not available - * @static - **/ - function getPeakMemoryUse() { - if (!function_exists('memory_get_peak_usage')) { - return 0; - } - return memory_get_peak_usage(); - } - -/** - * Handles object conversion to debug string. - * - * @param string $var Object to convert - * @access protected - */ - function _output($level, $error, $code, $helpCode, $description, $file, $line, $kontext) { - $files = $this->trace(array('start' => 2, 'format' => 'points')); - $listing = $this->excerpt($files[0]['file'], $files[0]['line'] - 1, 1); - $trace = $this->trace(array('start' => 2, 'depth' => '20')); - $context = array(); - - foreach ((array)$kontext as $var => $value) { - $context[] = "\${$var}\t=\t" . $this->exportVar($value, 1); - } - if ($this->_outputFormat == 'fb') { - $this->_fireError($error, $code, $description, $file, $line, $trace, $context); - } else { - echo parent::_output($level, $error, $code, $helpCode, $description, $file, $line, $kontext); - } - } -/** - * Create a FirePHP error message - * - * @param string $error Name of error - * @param string $code Code of error - * @param string $description Description of error - * @param string $file File error occured in - * @param string $line Line error occured on - * @param string $trace Stack trace at time of error - * @param string $context context of error - * @return void - * @access protected - */ - function _fireError($error, $code, $description, $file, $line, $trace, $context) { - $name = $error . ' - ' . $description; - $message = "$error $code $description on line: $line in file: $file"; - FireCake::group($name); - FireCake::error($message, $name); - FireCake::log($context, 'Context'); - FireCake::log($trace, 'Trace'); - FireCake::groupEnd(); - } -} - - -Debugger::invoke(DebugKitDebugger::getInstance()); -Debugger::getInstance('DebugKitDebugger'); -?> \ No newline at end of file diff --git a/vendors/fire_cake.php b/vendors/fire_cake.php deleted file mode 100644 index 5d8faf4..0000000 --- a/vendors/fire_cake.php +++ /dev/null @@ -1,545 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * FirePHP Class for CakePHP - * - * Provides most of the functionality offered by FirePHPCore - * Interoperates with FirePHP extension for firefox - * - * For more information see: http://www.firephp.org/ - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit. - * @subpackage debug_kit.vendors - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Core', 'Debugger'); - -if (!function_exists('firecake')) { - function firecake($message, $label = null) { - FireCake::fb($message, $label, 'log'); - } -} - -class FireCake extends Object { -/** - * Options for FireCake. - * - * @see _defaultOptions and setOptions(); - * @var string - */ - var $options = array(); -/** - * Default Options used in CakeFirePhp - * - * @var string - * @access protected - */ - var $_defaultOptions = array( - 'maxObjectDepth' => 10, - 'maxArrayDepth' => 20, - 'useNativeJsonEncode' => true, - 'includeLineNumbers' => true, - ); -/** - * Message Levels for messages sent via FirePHP - * - * @var array - */ - var $_levels = array( - 'log' => 'LOG', - 'info' => 'INFO', - 'warn' => 'WARN', - 'error' => 'ERROR', - 'dump' => 'DUMP', - 'trace' => 'TRACE', - 'exception' => 'EXCEPTION', - 'table' => 'TABLE', - 'groupStart' => 'GROUP_START', - 'groupEnd' => 'GROUP_END', - ); - - var $_version = '0.2.1'; -/** - * internal messageIndex counter - * - * @var int - * @access protected - */ - var $_messageIndex = 1; -/** - * stack of objects encoded by stringEncode() - * - * @var array - **/ - var $_encodedObjects = array(); -/** - * methodIndex to include in tracebacks when using includeLineNumbers - * - * @var array - **/ - var $_methodIndex = array('info', 'log', 'warn', 'error', 'table', 'trace'); -/** - * FireCake output status - * - * @var bool - **/ - var $_enabled = true; -/** - * get Instance of the singleton - * - * @param string $class Class instance to store in the singleton. Used with subclasses and Tests. - * @access public - * @static - * @return void - */ - function &getInstance($class = null) { - static $instance = array(); - if (!empty($class)) { - if (!$instance || strtolower($class) != strtolower(get_class($instance[0]))) { - $instance[0] = new $class(); - $instance[0]->setOptions(); - } - } - if (!isset($instance[0]) || !$instance[0]) { - $instance[0] = new FireCake(); - $instance[0]->setOptions(); - } - return $instance[0]; - } -/** - * setOptions - * - * @param array $options Array of options to set. - * @access public - * @static - * @return void - */ - function setOptions($options = array()) { - $_this = FireCake::getInstance(); - if (empty($_this->options)) { - $_this->options = array_merge($_this->_defaultOptions, $options); - } else { - $_this->options = array_merge($_this->options, $options); - } - } -/** - * Return boolean based on presence of FirePHP extension - * - * @access public - * @return boolean - **/ - function detectClientExtension() { - $ua = FireCake::getUserAgent(); - if (!preg_match('/\sFirePHP\/([\.|\d]*)\s?/si', $ua, $match) || !version_compare($match[1], '0.0.6', '>=')) { - return false; - } - return true; - } -/** - * Get the Current UserAgent - * - * @access public - * @static - * @return string UserAgent string of active client connection - **/ - function getUserAgent() { - return env('HTTP_USER_AGENT'); - } -/** - * Disable FireCake output - * All subsequent output calls will not be run. - * - * @return void - **/ - function disable() { - $_this = FireCake::getInstance(); - $_this->_enabled = false; - } -/** - * Enable FireCake output - * - * @return void - **/ - function enable() { - $_this = FireCake::getInstance(); - $_this->_enabled = true; - } -/** - * Convenience wrapper for LOG messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function log($message, $label = null) { - FireCake::fb($message, $label, 'log'); - } -/** - * Convenience wrapper for WARN messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function warn($message, $label = null) { - FireCake::fb($message, $label, 'warn'); - } -/** - * Convenience wrapper for INFO messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function info($message, $label = null) { - FireCake::fb($message, $label, 'info'); - } -/** - * Convenience wrapper for ERROR messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function error($message, $label = null) { - FireCake::fb($message, $label, 'error'); - } -/** - * Convenience wrapper for TABLE messages - * - * @param string $message Message to log - * @param string $label Label for message (optional) - * @access public - * @static - * @return void - */ - function table($label, $message) { - FireCake::fb($message, $label, 'table'); - } -/** - * Convenience wrapper for DUMP messages - * - * @param string $message Message to log - * @param string $label Unique label for message - * @access public - * @static - * @return void - */ - function dump($label, $message) { - FireCake::fb($message, $label, 'dump'); - } -/** - * Convenience wrapper for TRACE messages - * - * @param string $label Label for message (optional) - * @access public - * @return void - */ - function trace($label) { - FireCake::fb($label, 'trace'); - } -/** - * Convenience wrapper for GROUP messages - * Messages following the group call will be nested in a group block - * - * @param string $label Label for group (optional) - * @access public - * @return void - */ - function group($label) { - FireCake::fb(null, $label, 'groupStart'); - } -/** - * Convenience wrapper for GROUPEND messages - * Closes a group block - * - * @param string $label Label for group (optional) - * @access public - * @return void - */ - function groupEnd() { - FireCake::fb(null, null, 'groupEnd'); - } -/** - * fb - Send messages with FireCake to FirePHP - * - * Much like FirePHP's fb() this method can be called with various parameter counts - * fb($message) - Just send a message defaults to LOG type - * fb($message, $type) - Send a message with a specific type - * fb($message, $label, $type) - Send a message with a custom label and type. - * - * @param mixed $message Message to output. For other parameters see usage above. - * @static - * @return void - **/ - function fb($message) { - $_this = FireCake::getInstance(); - - if (headers_sent($filename, $linenum)) { - trigger_error(sprintf(__('Headers already sent in %s on line %s. Cannot send log data to FirePHP.', true), $filename, $linenum), E_USER_WARNING); - return false; - } - if (!$_this->_enabled || !$_this->detectClientExtension()) { - return false; - } - - $args = func_get_args(); - $type = $label = null; - switch (count($args)) { - case 1: - $type = $_this->_levels['log']; - break; - case 2: - $type = $args[1]; - break; - case 3: - $type = $args[2]; - $label = $args[1]; - break; - default: - trigger_error(__('Incorrect parameter count for FireCake::fb()', true), E_USER_WARNING); - return false; - } - if (isset($_this->_levels[$type])) { - $type = $_this->_levels[$type]; - } else { - $type = $_this->_levels['log']; - } - - $meta = array(); - $skipFinalObjectEncode = false; - if ($type == $_this->_levels['trace']) { - $trace = debug_backtrace(); - if (!$trace) { - return false; - } - $message = $_this->_parseTrace($trace, $args[0]); - $skipFinalObjectEncode = true; - } - - if ($_this->options['includeLineNumbers']) { - if (!isset($meta['file']) || !isset($meta['line'])) { - $trace = debug_backtrace(); - for ($i = 0, $len = count($trace); $i < $len ; $i++) { - $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); - $selfCall = ($keySet && $trace[$i]['class'] == 'FireCake' && in_array($trace[$i]['function'], $_this->_methodIndex)); - if ($selfCall) { - $meta['File'] = isset($trace[$i]['file']) ? Debugger::trimPath($trace[$i]['file']) : ''; - $meta['Line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : ''; - break; - } - } - } - } - - $structureIndex = 1; - if ($type == $_this->_levels['dump']) { - $structureIndex = 2; - $_this->_sendHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); - } else { - $_this->_sendHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); - } - - $_this->_sendHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); - $_this->_sendHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'. $_this->_version); - - if ($type == $_this->_levels['dump']) { - $dump = $_this->jsonEncode($message); - $msg = '{"' . $label .'":' . $dump .'}'; - } else { - $meta['Type'] = $type; - if ($label !== null) { - $meta['Label'] = $label; - } - $msg = '[' . $_this->jsonEncode($meta) . ',' . $_this->jsonEncode($message, $skipFinalObjectEncode).']'; - } - - $lines = explode("\n", chunk_split($msg, 5000, "\n")); - foreach ($lines as $i => $line) { - if (empty($line)) { - continue; - } - $header = 'X-Wf-1-' . $structureIndex . '-1-' . $_this->_messageIndex; - if (count($lines) > 2) { - $first = ($i == 0) ? strlen($msg) : ''; - $end = ($i < count($lines) - 2) ? '\\' : ''; - $message = $first . '|' . $line . '|' . $end; - $_this->_sendHeader($header, $message); - } else { - $_this->_sendHeader($header, strlen($line) . '|' . $line . '|'); - } - $_this->_messageIndex++; - if ($_this->_messageIndex > 99999) { - trigger_error(__('Maximum number (99,999) of messages reached!', true), E_USER_WARNING); - } - } - $_this->_sendHeader('X-Wf-1-Index', $_this->_messageIndex - 1); - return true; - } -/** - * Parse a debug backtrace - * - * @param array $trace Debug backtrace output - * @access protected - * @return array - **/ - function _parseTrace($trace, $messageName) { - $message = array(); - for ($i = 0, $len = count($trace); $i < $len ; $i++) { - $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); - $selfCall = ($keySet && $trace[$i]['class'] == 'FireCake'); - if (!$selfCall) { - $message = array( - 'Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', - 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '', - 'Function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : '', - 'Message' => $messageName, - 'File' => isset($trace[$i]['file']) ? Debugger::trimPath($trace[$i]['file']) : '', - 'Line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : '', - 'Args' => isset($trace[$i]['args']) ? $this->stringEncode($trace[$i]['args']) : '', - 'Trace' => $this->_escapeTrace(array_splice($trace, $i + 1)) - ); - break; - } - } - return $message; - } -/** - * Fix a trace for use in output - * - * @param mixed $trace Trace to fix - * @access protected - * @static - * @return string - **/ - function _escapeTrace($trace) { - for ($i = 0, $len = count($trace); $i < $len; $i++) { - if (isset($trace[$i]['file'])) { - $trace[$i]['file'] = Debugger::trimPath($trace[$i]['file']); - } - if (isset($trace[$i]['args'])) { - $trace[$i]['args'] = $this->stringEncode($trace[$i]['args']); - } - } - return $trace; - } -/** - * Encode non string objects to string. - * Filter out recursion, so no errors are raised by json_encode or $javascript->object() - * - * @param mixed $object Object or variable to encode to string. - * @param int $objectDepth Current Depth in object chains. - * @param int $arrayDepth Current Depth in array chains. - * @static - * @return void - **/ - function stringEncode($object, $objectDepth = 1, $arrayDepth = 1) { - $_this = FireCake::getInstance(); - $return = array(); - if (is_resource($object)) { - return '** ' . (string)$object . '**'; - } - if (is_object($object)) { - if ($objectDepth == $_this->options['maxObjectDepth']) { - return '** Max Object Depth (' . $_this->options['maxObjectDepth'] . ') **'; - } - foreach ($_this->_encodedObjects as $encoded) { - if ($encoded === $object) { - return '** Recursion (' . get_class($object) . ') **'; - } - } - $_this->_encodedObjects[] = $object; - - $return['__className'] = $class = get_class($object); - $properties = (array) $object; - foreach ($properties as $name => $property) { - $return[$name] = FireCake::stringEncode($property, 1, $objectDepth + 1); - } - array_pop($_this->_encodedObjects); - } - if (is_array($object)) { - if ($arrayDepth == $_this->options['maxArrayDepth']) { - return '** Max Array Depth ('. $_this->options['maxArrayDepth'] . ') **'; - } - foreach ($object as $key => $value) { - $return[$key] = FireCake::stringEncode($value, 1, $arrayDepth + 1); - } - } - if (is_string($object) || is_numeric($object) || is_bool($object) || is_null($object)) { - return $object; - } - return $return; - } -/** - * Encode an object into JSON - * - * @param mixed $object Object or array to json encode - * @param boolean $doIt - * @access public - * @static - * @return string - **/ - function jsonEncode($object, $skipEncode = false) { - $_this = FireCake::getInstance(); - if (!$skipEncode) { - $object = FireCake::stringEncode($object); - } - - if (function_exists('json_encode') && $_this->options['useNativeJsonEncode']) { - return json_encode($object); - } else { - return FireCake::_jsonEncode($object); - } - } -/** - * jsonEncode Helper method for PHP4 compatibility - * - * @param mixed $object Something to encode - * @access protected - * @static - * @return string - **/ - function _jsonEncode($object) { - if (!class_exists('JavascriptHelper')) { - App::import('Helper', 'Javascript'); - } - $javascript = new JavascriptHelper(); - $javascript->useNative = false; - return $javascript->object($object); - } -/** - * Send Headers - write headers. - * - * @access protected - * @return void - **/ - function _sendHeader($name, $value) { - header($name . ': ' . $value); - } -} -?> \ No newline at end of file diff --git a/vendors/img/cake.icon.png b/vendors/img/cake.icon.png deleted file mode 100644 index f56f321..0000000 Binary files a/vendors/img/cake.icon.png and /dev/null differ diff --git a/vendors/js/jquery_debug_toolbar.js b/vendors/js/jquery_debug_toolbar.js deleted file mode 100755 index 436657b..0000000 --- a/vendors/js/jquery_debug_toolbar.js +++ /dev/null @@ -1,102 +0,0 @@ -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Javascript. jQuery 1.2.x compatible. - * - * Long description here. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -(function($) { -$(document).ready(function(){ - DebugKit.Toolbar(); - DebugKit.NeatArray(); - DebugKit.History(); -}); - -var DebugKit = {}; -/** - * Create all behaviors for neat array elements - * - */ -DebugKit.NeatArray = function() { - $('.neat-array').find('li:has(ul)').toggle( - function() { - $(this).toggleClass('expanded').removeClass('collapsed').find('ul:first').show(); - }, - function() { - $(this).toggleClass('expanded').addClass('collapsed').find('ul:first').hide(); - } - ).addClass('expandable').addClass('collapsed').find('ul').hide(); -} -/** - * Add behavior for toolbar buttons - * - */ -DebugKit.Toolbar = function() { - var tabCollection = $('#debug-kit-toolbar li > div'); - - $('#debug-kit-toolbar .panel-tab > a').click( - function(e){ - e.preventDefault(); - var targetPanel = $(this.hash + '-tab'); - if (targetPanel.hasClass('active')) { - tabCollection.hide().removeClass('active'); - } else { - tabCollection - .hide().removeClass('active') - .filter(this.hash + '-tab').show().addClass('active'); - } - $('#debug-kit-toolbar .panel-tab > a').removeClass('active'); - $(this).addClass('active'); - } - ); - - //enable hiding of toolbar. - var panelButtons = $('#debug-kit-toolbar .panel-tab:not(.panel-tab.icon)'); - $('#debug-kit-toolbar #hide-toolbar').toggle( - function() { - panelButtons.hide(); - }, - function() { - panelButtons.show(); - } - ); -} -/** - * Handle hiding/displaying panels from previous requests - * - */ -DebugKit.History = function() { - $('.history-link').click(function() { - var id = $(this).attr('href').replace('#', ''); - - $('.history-link').removeClass('active'); - $(this).addClass('active'); - - $('.panel-content-data').hide(); - $('.panel-content' + id).show(); - - return false; - }); -} -})(jQuery); \ No newline at end of file diff --git a/vendors/js/js_debug_toolbar.js b/vendors/js/js_debug_toolbar.js deleted file mode 100755 index ee7695f..0000000 --- a/vendors/js/js_debug_toolbar.js +++ /dev/null @@ -1,583 +0,0 @@ -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Javascript. - * - * Long description here. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -var DebugKit = function (id) { - var elements = {}, - panels = {}, - toolbarHidden = false, - Cookie = new DebugKit.Util.Cookie(), - Util = DebugKit.Util, - Request = DebugKit.prototype.Request, - Element = DebugKit.Util.Element; - - this.initialize = function (id) { - var i, element, lists, index; - elements.toolbar = document.getElementById(id || 'debug-kit-toolbar'); - - if (elements.toolbar === undefined) { - throw('Toolbar not found, make sure you loaded it.'); - } - - - for (i in elements.toolbar.childNodes) { - element = elements.toolbar.childNodes[i]; - if (element.nodeName && element.id === 'panel-tabs') { - elements.panel = element; - break; - } - } - - for (i in elements.panel.childNodes) { - element = elements.panel.childNodes[i]; - if (Element.hasClass(element, 'panel-tab')) { - this.addPanel(element); - } - } - - lists = document.getElementsByTagName('ul'); - this.makeNeatArray(lists); - - this.deactivatePanel(true); - var toolbarState = Cookie.read('toolbarDisplay'); - if (toolbarState != 'block') { - toolbarHidden = false; - this.toggleToolbar(); - } - return this; - }; -/** - * Add a panel to the toolbar - */ - this.addPanel = function (tab, callback) { - if (!tab.nodeName || tab.nodeName.toUpperCase() !== 'LI') { - throw('Toolbar not found, make sure you loaded it.'); - } - var panel = { - id : false, - element : tab, - callback : callback, - button : undefined, - content : undefined, - active : false - }; - for (var i in tab.childNodes) { - var element = tab.childNodes[i], - tag = element.nodeName ? element.nodeName.toUpperCase() : false; - if (tag === 'A') { - panel.id = element.hash.replace(/^#/, ''); - panel.button = element; - } else if (tag === 'DIV') { - panel.content = element; - } - } - if (!panel.id) { - throw('invalid element'); - } - - if (panel.button.id && panel.button.id === 'hide-toolbar') { - panel.callback = this.toggleToolbar; - } - - var callbackName = "activate" + panel.id.replace('-tab', ''); - if (this[callbackName] !== undefined) { - this[callbackName](panel); - } - - if (panel.callback !== undefined) { - Util.addEvent(panel.button, 'click', function(event) { - event = event || window.event; - event.preventDefault(); - return panel.callback(); - }); - } else { - Util.addEvent(panel.button, 'click', function(event) { - event = event || window.event; - event.preventDefault(); - return DebugKit.togglePanel(panel.id); - }); - } - panels[panel.id] = panel; - return panel.id; - }; -/** - * Hide/show the toolbar (minimize cake) - */ - this.toggleToolbar = function () { - var display = toolbarHidden ? 'block' : 'none'; - for (var i in panels) { - var panel = panels[i]; - if (panel.content !== undefined) { - panel.element.style.display = display; - Cookie.write('toolbarDisplay', display); - } - } - toolbarHidden = !toolbarHidden; - return false; - }; -/** - * Toggle a panel - */ - this.togglePanel = function (id) { - if (panels[id] && panels[id].active) { - this.deactivatePanel(true); - } else { - this.deactivatePanel(true); - this.activatePanel(id); - } - }; -/** - * Make a panel active. - */ - this.activatePanel = function (id, unique) { - if (panels[id] !== undefined && !panels[id].active) { - var panel = panels[id]; - if (panel.content !== undefined) { - Element.show(panel.content); - } - Element.addClass(panel.button, 'active'); - panel.active = true; - return true; - } - return false; - }; -/** - * Deactivate a panel. use true to hide all panels. - */ - this.deactivatePanel = function (id) { - if (id === true) { - for (var i in panels) { - this.deactivatePanel(i); - } - return true; - } - if (panels[id] !== undefined) { - var panel = panels[id]; - if (panel.content !== undefined) { - Element.hide(panel.content); - } - Element.removeClass(panel.button, 'active'); - panel.active = false; - return true; - } - return false; - }; -/** - * Activate history panel. - * adds events to all the button - */ - this.activatehistory = function (panel) { - var anchors = panel.element.getElementsByTagName('A'), - historyLinks = [], - i = 0, j =0, - button, self = this; - - for (i in anchors) { - button = anchors[i]; - if (Element.hasClass(button, 'history-link')) { - historyLinks.push(button); - } - } - - /** - * Private methods to handle JSON response and insertion of - * new content. - */ - var switchHistory = function (response) { - try { - var responseJson = eval( '(' + response.response.text + ')'); - } catch (e) { - alert('Could not convert JSON response'); - return false; - } - - for (var i in historyLinks) { - Element.removeClass(historyLinks[i], 'loading'); - } - - for (var id in panels) { - var panel = panels[id]; - if (panel.content === undefined || responseJson[id] === undefined) { - continue; - } - var panelDivs = panel.content.childNodes; - for (var i in panelDivs) { - - //toggle history element, hide current request one. - var panelContent = panelDivs[i], - tag = panelContent.nodeName ? panelContent.nodeName.toUpperCase() : false; - if (tag === 'DIV' && Element.hasClass(panelContent, 'panel-content-history')) { - var panelId = panelContent.id.replace('-history', ''); - if (responseJson[panelId]) { - panelContent.innerHTML = responseJson[panelId]; - var lists = panelContent.getElementsByTagName('UL'); - self.makeNeatArray(lists); - } - Element.show(panelContent); - } else if (tag === 'DIV') { - Element.hide(panelContent); - } - } - } - }; - - /** - * Private method to handle restoration to current request. - */ - var restoreCurrentState = function () { - var id, i, panelContent, tag; - - for (i in historyLinks) { - Element.removeClass(historyLinks[i], 'loading'); - } - - for (id in panels) { - panel = panels[id]; - if (panel.content === undefined) { - continue; - } - var panelDivs = panel.content.childNodes; - for (i in panelDivs) { - panelContent = panelDivs[i]; - tag = panelContent.nodeName ? panelContent.nodeName.toUpperCase() : false; - if (tag === 'DIV' && Element.hasClass(panelContent, 'panel-content-history')) { - Element.hide(panelContent); - } else if (tag === 'DIV') { - Element.show(panelContent); - } - } - } - }; - - var handleHistoryLink = function (event) { - event.preventDefault(); - - for (i in historyLinks) { - Element.removeClass(historyLinks[i], 'active'); - } - Element.addClass(this, 'active loading'); - - if (this.id === 'history-restore-current') { - restoreCurrentState(); - return false; - } - - var remote = new Request({ - onComplete : switchHistory, - onFail : function () { - alert('History retrieval failed'); - } - }); - remote.send(this.href); - }; - - for (i in historyLinks) { - button = historyLinks[i]; - Util.addEvent(button, 'click', handleHistoryLink); - } - }; - - this.makeNeatArray = function (lists) { - i = 0; - while (lists[i] !== undefined) { - var element = lists[i]; - if (Element.hasClass(element, 'neat-array')) { - neatArray(element); - } - ++i; - } - }; -/** - * Add neat array functionality. - */ - var neatArray = function (list) { - if (!list.className.match(/depth-0/)) { - var item = list.parentNode; - Element.hide(list); - Element.addClass(item, 'expandable collapsed'); - Util.addEvent(item, 'click', function (event) { - var element = this, - event = event || window.event, - act = Boolean(item === element), - hide = Boolean(list.style.display === 'block'); - if (act && hide) { - Element.hide(list); - item.className = item.className.replace(/expanded|$/, 'collapsed'); - } else if (act) { - Element.show(list); - item.className = item.className.replace('collapsed', 'expanded'); - } - - if (event.cancelBubble !== undefined) { - event.cancelBubble = true; - } - return false; - }); - } - }; - - this.initialize(id); -}; - -/** - * Utility functions for debugKit Js - */ -DebugKit.Util = {}; - -DebugKit.Util.Cookie = function() { - var cookieLife = 60; -/** - * Write to cookie - * @param [string] name Name of cookie to write. - * @param [mixed] value Value to write to cookie. - */ - this.write = function (name, value) { - var date = new Date(); - date.setTime(date.getTime() + (cookieLife * 24 * 60 * 60 * 1000)); - var expires = "; expires=" + date.toGMTString(); - document.cookie = name + "=" + value + expires + "; path=/"; - return true; - }; -/** - * Read from the cookie - * @param [string] name Name of cookie to read. - */ - this.read = function (name) { - name = name + '='; - var cookieJar = document.cookie.split(';'); - for (var i = 0; i < cookieJar.length; i++) { - var chips = cookieJar[i]; - //trim leading spaces - while (chips.charAt(0) == ' ') { - chips = chips.substring(1, chips.length); - } - if (chips.indexOf(name) == 0) { - return chips.substring(name.length, chips.length); - } - } - return false; - }; -/** - * Delete a cookie by name. - */ - this.del = function (name) { - var date = new Date(); - date.setFullYear(2000,0,1); - var expires = " ; expires=" + date.toGMTString(); - document.cookie = name + "=" + expires + "; path=/"; - }; -}; - -/** - * Cross browser domready handler. - */ -DebugKit.Util.domready = function(callback) { - if (document.addEventListener) { - return document.addEventListener("DOMContentLoaded", callback, false); - } - - if (document.all && !window.opera) { - //Define a "blank" external JavaScript tag - document.write('<script type="text/javascript" id="domreadywatcher" defer="defer" src="javascript:void(0)"><\/script>'); - var contentloadtag = document.getElementById("domreadywatcher"); - contentloadtag.onreadystatechange = function (){ - if (this.readyState == "complete") { - callback(); - } - }; - return; - } - - if (/Webkit/i.test(navigator.userAgent)){ - var _timer = setInterval(function (){ - if (/loaded|complete/.test(document.readyState)) { - clearInterval(_timer); - callback(); - } - }, 10); - } -}; - -/** - * Cross browser event registration. - */ -DebugKit.Util.addEvent = function(element, type, handler, capture) { - capture = (capture === undefined) ? false : capture; - if (element.addEventListener) { - element.addEventListener(type, handler, capture); - } else if (element.attachEvent) { - type = 'on' + type; - element.attachEvent(type, handler); - } else { - type = 'on' + type; - element[type] = handler; - } -}; - -/** - * Simple Element manipulation shortcuts. - */ -DebugKit.Util.Element = { - hasClass : function (element, className) { - if (!element.className) { - return false; - } - return element.className.match(new RegExp(className)); - }, - addClass : function (element, className) { - if (!element.className) { - element.className = ''; - } - element.className = element.className.replace(/^(.*)$/, '$1 ' + className); - }, - removeClass : function (element, className) { - if (!element.className) { - return false; - } - element.className = element.className.replace(new RegExp(' ?(' + className +') ?'), ''); - }, - show : function (element) { - element.style.display = 'block'; - }, - hide : function (element) { - element.style.display = 'none'; - } -}; -/** - * Object merge takes any number of arguments and glues them together - * @param [Object] one first object - * @return object - */ -DebugKit.prototype.merge = function() { - var out = {}; - for (var i = 0; i < arguments.length; i++) { - var current = arguments[i]; - for (prop in current) { - if (current[prop] !== undefined){ - out[prop] = current[prop]; - } - } - } - return out; -}; - -/** - * Simple wrapper for XmlHttpRequest objects. - */ -DebugKit.prototype.Request = function (options) { - var _defaults = { - onComplete : function (){}, - onRequest : function (){}, - onFail : function (){}, - method : 'GET', - async : true, - headers : { - 'X-Requested-With': 'XMLHttpRequest', - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - } - }; - - var self = this; - this.options = DebugKit.merge(_defaults, options); - this.options.method = this.options.method.toUpperCase(); - - var ajax = this.createObj(); - this.transport = ajax; - - //event assignment - this.onComplete = this.options.onComplete; - this.onRequest = this.options.onRequest; - this.onFail = this.options.onFail; - - this.send = function (url, data) { - if (this.options.method == 'GET' && data) { - url = url + ( (url.charAt(url.length -1) == '?') ? '&' : '?') + data; //check for ? at the end of the string - data = null; - } - //open connection - this.transport.open(this.options.method, url, this.options.async); - - //set statechange and pass the active XHR object to it. From here it handles all status changes. - this.transport.onreadystatechange = function () { - self.onReadyStateChange.apply(self, arguments); - }; - for (var key in this.options.headers) { - this.transport.setRequestHeader(key, this.options.headers[key]); - } - this.onRequest(); - this.transport.send(data); - }; -}; - -DebugKit.prototype.Request.prototype.onReadyStateChange = function (){ - if (this.transport.readyState !== 4) { - return; - } - if (this.transport.status == 200 || this.transport.status > 300 && this.transport.status < 400 ) { - this.response = { - xml: this.transport.responseXML, - text: this.transport.responseText - }; - - if (typeof this.onComplete == 'function') { - this.onComplete.apply(this, [this, this.response]); - } else { - return this.response; - } - } else if (this.transport.status > 400) { - if (typeof this.onFail == 'function') { - this.onFail.apply(this, []); - } else { - console.error('request failed'); - } - } -}; -/** - * Creates cross-broswer XHR object used for requests - */ -DebugKit.prototype.Request.prototype.createObj = function(){ - var request = null; - try { - request = new XMLHttpRequest(); - } catch (MS) { - try { - request = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (old_MS) { - try { - request = new ActiveXObject("Microsoft.XMLHTTP"); - } catch(failure) { - request = null; - } - } - } - return request; -}; - - -DebugKit.Util.domready(function() { - window.DebugKit = new DebugKit(); -}); diff --git a/vendors/js/mootools_debug_toolbar.js b/vendors/js/mootools_debug_toolbar.js deleted file mode 100755 index 2f858c6..0000000 --- a/vendors/js/mootools_debug_toolbar.js +++ /dev/null @@ -1,95 +0,0 @@ -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Javascript. Mootools 1.2 compatible. - * - * Requires Class, Event, Element, and Selectors - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -window.addEvent('domready', function() { - new DebugKit(); -}); -var DebugKit = new Class({ - initialize : function() { - this.neatArray(); - this.toolbar(); - }, -/** - * Create all behaviors for neat array elements - */ - neatArray : function() { - $$('#debug-kit-toolbar .neat-array li').each(function(listItem) { - var subUl = listItem.getElement('ul'); - if (subUl) { - listItem.addClass('expandable').addClass('collapsed'); - subUl.setStyle('display', 'none').set('state', 'closed'); - listItem.addEvent('click', function(event) { - event.stop(); - this.toggleClass('expanded').toggleClass('collapsed'); - if (subUl.get('state') == 'closed') { - subUl.setStyle('display', 'block').set('state', 'open'); - } else { - subUl.setStyle('display', 'none').set('state', 'closed'); - } - }) - } - }); - }, - - /** - * Add behavior for toolbar buttons - */ - toolbar : function() { - var tabCollection = $$('#debug-kit-toolbar li > div'); - - $$('#debug-kit-toolbar .panel-tab > a').addEvent('click', function(event) { - event.stop(); - var buttonId = this.hash.substring(1, this.hash.length) + '-tab'; - var targetPanel = $(buttonId); - if (!targetPanel) return; - $$('#debug-kit-toolbar .panel-tab > a').removeClass('active'); - if (targetPanel.hasClass('active')) { - tabCollection.removeClass('active').setStyle('display', 'none'); - } else { - tabCollection.setStyle('display', 'none').removeClass('active'); - targetPanel.addClass('active').setStyle('display', 'block'); - this.addClass('active'); - } - }); - - //enable hiding of toolbar. - var panelButtons = $$('#debug-kit-toolbar .panel-tab:not(.panel-tab.icon)'); - var toolbarHide = $('hide-toolbar').set('state', 'open'); - toolbarHide.addEvent('click', function(event) { - event.stop(); - var state = this.get('state'); - if (state == 'open') { - panelButtons.setStyle('display', 'none'); - this.set('state', 'closed') - } else { - panelButtons.setStyle('display'); - this.set('state', 'open'); - } - }); - } -}); \ No newline at end of file diff --git a/vendors/js/prototype_debug_toolbar.js b/vendors/js/prototype_debug_toolbar.js deleted file mode 100755 index 8e1e63f..0000000 --- a/vendors/js/prototype_debug_toolbar.js +++ /dev/null @@ -1,95 +0,0 @@ -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Javascript. Prototype 1.6.x compatible. - * - * Long description here. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -document.observe('dom:loaded', function() { - new DebugKit(); -}); - -var DebugKit = Class.create({ - - initialize: function(){ - this.toolbar(); - this.neatArray(); - }, - - toolbar: function(){ - var tabCollection = $('debug-kit-toolbar').select('li > div'); - - $('debug-kit-toolbar').select('.panel-tab > a').invoke('observe', 'click', function(e){ - e.stop(); - var targetPanel = $(e.element().hash.replace(/#/, '') + '-tab'); - if (targetPanel.hasClassName('active')) { - tabCollection.each(function(ele){ - ele.hide().removeClassName('active'); - }); - } else { - tabCollection.each(function(ele){ - ele.hide().removeClassName('active'); - if (targetPanel.id == ele.id) { - ele.setStyle({display: 'block'}).addClassName('active'); - } - }); - } - $('debug-kit-toolbar').select('.panel-tab > a').invoke('removeClassName', 'active'); - e.element().addClassName('active'); - }); - - // enable hiding of toolbar. - var panelButtons = $('debug-kit-toolbar').select('.panel-tab'); - $('hide-toolbar').observe('click', function(eve){ - eve.stop(); - panelButtons.each(function(panel){ - if (!panel.hasClassName('icon')) { - panel.toggle(); - }; - }); - }); - }, - -/** - * Create all behaviors for neat array elements - */ - neatArray: function() { - $('debug-kit-toolbar').select('.neat-array li').each(function(ele){ - var sub = ele.select('ul'); - if (sub.length > 0) { - ele.addClassName('collapsed').addClassName('expandable'); - sub.invoke('hide'); - ele.observe('click', function(eve){ - if (eve.element() == ele || eve.element().up() == ele) { - if (sub.length > 0) { - ele.toggleClassName('expanded').toggleClassName('collapsed'); - sub[0].toggle(); - } - } - }); - }; - }); - } - -}); diff --git a/vendors/js/yui_debug_toolbar.js b/vendors/js/yui_debug_toolbar.js deleted file mode 100755 index 91571a1..0000000 --- a/vendors/js/yui_debug_toolbar.js +++ /dev/null @@ -1,126 +0,0 @@ -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Javascript. YUI 2.6 compatible. - * - * Long description here. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -YAHOO.namespace('CakePHP.DebugKit'); - -YAHOO.CakePHP.DebugKit = function() { - - var Event = YAHOO.util.Event; - var Dom = YAHOO.util.Dom; - var Selector = YAHOO.util.Selector; - - - var toggle = function(el) { - Dom.setStyle(el, 'display', ((Dom.getStyle(el, 'display') == 'none') ? '' : 'none')); - }; - - var toggleClass = function(element, className) { - (Dom.hasClass(element, className)) ? Dom.removeClass(element, className) : Dom.addClass(element, className); - }; - - - - var toolbar = function() { - var tabCollection = Selector.query('#debug-kit-toolbar li > div'); - - Dom.batch(Selector.query('#debug-kit-toolbar .panel-tab > a'), function(el) { - Event.on(el, 'click', function(ev) { - Event.preventDefault(ev); - targetPanel =Dom.get(el.hash.replace(/#/, '') + '-tab'); - - if (Dom.hasClass(targetPanel, 'active')) { - Dom.batch(tabCollection, function(ele) { - toggle(ele); - Dom.removeClass(ele, 'active'); - Dom.setStyle(ele, 'display', ''); - }); - } else { - Dom.batch(tabCollection, function(ele) { - toggle(ele); - Dom.removeClass(ele, 'active'); - - if (targetPanel && targetPanel.id == ele.id) { - Dom.setStyle(ele, 'display', 'block'); - Dom.addClass(ele, 'active'); - } - }); - } - - Dom.removeClass(Selector.query('#debug-kit-toolbar .panel-tab > a'), 'active'); - Dom.addClass(el, 'active'); - }); - }); - - }; - - - - var neatArray = function() { - nodes = Selector.query('#debug-kit-toolbar .panel-content > ul.neat-array li > ul'); - - if (nodes.length > 0) { - Dom.batch(nodes, function(el) { - - var parent = el.parentNode; - - Dom.addClass(parent, 'collapsed'); - Dom.addClass(parent, 'expandable'); - toggle(nodes); - - Event.on(parent, 'click', function(ev) { - sub = Selector.query('ul', parent); - toggleClass(parent, 'expanded'); - toggleClass(parent, 'collapsed'); - toggle(sub); - }); - }); - } - }; - - var panelButtons = function() { - Event.on('hide-toolbar', 'click', function(ev) { - Event.preventDefault(ev); - - Dom.getElementsByClassName('panel-tab', 'li', 'debug-kit-toolbar', function (el) { - if (!Dom.hasClass(el, 'icon')) { - toggle(el); - } - }); - }); - }; - - return { - initialize: function() { - neatArray(); - toolbar(); - panelButtons(); - } - }; -}(); // Execute annonymous closure & return results - -YAHOO.util.Event.onDOMReady(YAHOO.CakePHP.DebugKit.initialize); \ No newline at end of file diff --git a/vendors/shells/benchmark.php b/vendors/shells/benchmark.php deleted file mode 100644 index 09d73f9..0000000 --- a/vendors/shells/benchmark.php +++ /dev/null @@ -1,182 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Benchmark Shell. - * - * Provides basic benchmarking of application requests - * functionally similar to Apache AB - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.vendors.shells - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ - -/** - * Benchmark Shell Class - * - * @package cake - * @subpackage cake.debug_kit.vendors.shells - * @todo Print/export time detail information - * @todo Export/graphing of data to .dot format for graphviz visualization - * @todo Make calculated results round to leading significant digit position of std dev. - */ -class BenchmarkShell extends Shell { - - /** - * Main execution of shell - * - * @return void - * @access public - */ - function main() { - if (empty($this->args) || count($this->args) > 1) { - return $this->help(); - } - - $url = $this->args[0]; - $defaults = array('t' => 100, 'n' => 10); - $options = array_merge($defaults, $this->params); - $times = array(); - - $this->out(String::insert(__('-> Testing :url', true), compact('url'))); - $this->out(""); - for ($i = 0; $i < $options['n']; $i++) { - if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) { - break; - } - - $start = microtime(true); - file_get_contents($url); - $stop = microtime(true); - - $times[] = $stop - $start; - } - - $this->_results($times); - } - - - /** - * Prints calculated results - * - * @param array $times Array of time values - * @return void - * @access protected - */ - function _results($times) { - $duration = array_sum($times); - $requests = count($times); - - $this->out(String::insert(__('Total Requests made: :requests', true), compact('requests'))); - $this->out(String::insert(__('Total Time elapsed: :duration (seconds)', true), compact('duration'))); - - $this->out(""); - - $this->out(String::insert(__('Requests/Second: :rps req/sec', true), array( - 'rps' => round($requests / $duration, 3) - ))); - - $this->out(String::insert(__('Average request time: :average-time seconds', true), array( - 'average-time' => round($duration / $requests, 3) - ))); - - $this->out(String::insert(__('Standard deviation of average request time: :std-dev', true), array( - 'std-dev' => round($this->_deviation($times, true), 3) - ))); - - $this->out(String::insert(__('Longest/shortest request: :longest sec/:shortest sec', true), array( - 'longest' => round(max($times), 3), - 'shortest' => round(min($times), 3) - ))); - - $this->out(""); - - } - - - /** - * One-pass, numerically stable calculation of population variance. - * - * Donald E. Knuth (1998). - * The Art of Computer Programming, volume 2: Seminumerical Algorithms, 3rd edn., - * p. 232. Boston: Addison-Wesley. - * - * @param array $times Array of values - * @param boolean $sample If true, calculates an unbiased estimate of the population - * variance from a finite sample. - * @return float Variance - * @access protected - */ - function _variance($times, $sample = true) { - $n = $mean = $M2 = 0; - - foreach($times as $time){ - $n += 1; - $delta = $time - $mean; - $mean = $mean + $delta/$n; - $M2 = $M2 + $delta*($time - $mean); - } - - if ($sample) $n -= 1; - - return $M2/$n; - } - - /** - * Calculate the standard deviation. - * - * @param array $times Array of values - * @return float Standard deviation - * @access protected - */ - function _deviation($times, $sample = true) { - return sqrt($this->_variance($times, $sample)); - } - - /** - * Help for Benchmark shell - * - * @return void - * @access public - */ - function help() { - $this->out(__("DebugKit Benchmark Shell", true)); - $this->out(""); - $this->out(__("\tAllows you to obtain some rough benchmarking statistics \n\tabout a fully qualified URL.", true)); - $this->out(""); - $this->out(__("\tUse:", true)); - $this->out(__("\t\tcake benchmark [-n iterations] [-t timeout] url", true)); - $this->out(""); - $this->out(__("\tParams:", true)); - $this->out(__("\t\t-n Number of iterations to perform. Defaults to 10. \n\t\t Must be an integer.", true)); - $this->out(__("\t\t-t Maximum total time for all iterations, in seconds. \n\t\t Defaults to 100. Must be an integer.", true)); - $this->out(""); - $this->out(__("\tIf a single iteration takes more than the \n\ttimeout specified, only one request will be made.", true)); - $this->out(""); - $this->out(__("\tExample Use:", true)); - $this->out(__("\t\tcake benchmark -n 10 -t 100 http://localhost/testsite", true)); - $this->out(""); - $this->out(__("\tNote that this benchmark does not include browser render time", true)); - $this->out(""); - $this->hr(); - $this->out(""); - } -} - -?> diff --git a/views/debug.php b/views/debug.php deleted file mode 100644 index d296bc6..0000000 --- a/views/debug.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Debug View - * - * Custom Debug View class, helps with development. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.cake.libs. - * @since CakePHP v 1.2.0.4487 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Vendor', 'DebugKit.DebugKitDebugger'); -App::import('Component', 'DebugKit.Toolbar'); -/** - * DebugView used by DebugKit - * - * @package debug_kit.views - * @todo Remove workarounds. - */ -class DebugView extends DoppelGangerView { -/** - * The old extension of the current template. - * - * @var string - */ - var $_oldExtension = null; -/** - * Overload _render to capture filenames and time actual rendering of each view file - * - * @param string $___viewFn Filename of the view - * @param array $___dataForView Data to include in rendered view - * @return string Rendered output - * @access protected - */ - function _render($___viewFn, $___dataForView, $loadHelpers = true, $cached = false) { - if (isset($this->_oldExtension) && strstr($___viewFn, '.debug_view')) { - $___viewFn = substr($___viewFn, 0, -10) . $this->_oldExtension; - } - if (!isset($___dataForView['disableTimer'])) { - DebugKitDebugger::startTimer('render_' . basename($___viewFn), sprintf(__('Rendering %s', true), Debugger::trimPath($___viewFn))); - } - - $out = parent::_render($___viewFn, $___dataForView, $loadHelpers, $cached); - - if (!isset($___dataForView['disableTimer'])) { - DebugKitDebugger::stopTimer('render_' . basename($___viewFn)); - } - return $out; - } - -/** - * Renders view for given action and layout. If $file is given, that is used - * for a view filename (e.g. customFunkyView.ctp). - * Adds timers, for all subsequent rendering, and injects the debugKit toolbar. - * - * @param string $action Name of action to render for - * @param string $layout Layout to use - * @param string $file Custom filename for view - * @return string Rendered Element - */ - function render($action = null, $layout = null, $file = null) { - DebugKitDebugger::startTimer('viewRender', __('Rendering View', true)); - $out = parent::render($action, $layout, $file); - DebugKitDebugger::stopTimer('viewRender'); - DebugKitDebugger::stopTimer('controllerRender'); - - if (isset($this->loaded['toolbar'])) { - $this->loaded['toolbar']->postRender(); - } - //Temporary work around to hide the SQL dump at page bottom - Configure::write('debug', 0); - return $this->output; - } - -/** - * Workaround _render() limitation in core. Which forces View::_render() for .ctp and .thtml templates - * Creates temporary extension to trick View::render() & View::renderLayout() - * - * @param string $name Action name. - * @return string - **/ - function _getViewFileName($name = null) { - $filename = parent::_getViewFileName($name); - return $this->_replaceExtension($filename); - } - -/** - * Workaround _render() limitation in core. Which forces View::_render() for .ctp and .thtml templates - * Creates temporary extension to trick View::render() & View::renderLayout() - * - * @param string $name Layout Name - * @return string - **/ - function _getLayoutFileName($name = null) { - $filename = parent::_getLayoutFileName($name); - return $this->_replaceExtension($filename); - } - -/** - * replace the Extension on a filename and set the temporary workaround extension. - * - * @param string $filename Filename to replace extension for. - * @return string - **/ - function _replaceExtension($filename) { - if (substr($filename, -3) == 'ctp') { - $this->_oldExtension = 'ctp'; - $filename = substr($filename, 0, strlen($filename) -3) . 'debug_view'; - } elseif (substr($filename, -5) == 'thtml') { - $this->_oldExtension = 'thtml'; - $filename = substr($filename, 0, strlen($filename) -5) . 'debug_view'; - } - return $filename; - } -} -?> \ No newline at end of file diff --git a/views/elements/debug_toolbar.ctp b/views/elements/debug_toolbar.ctp deleted file mode 100644 index 3d59571..0000000 --- a/views/elements/debug_toolbar.ctp +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Debug Toolbar Element - * - * Renders all of the other panel elements. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<div id="debug-kit-toolbar"> - <?php if (empty($debugToolbarPanels)) :?> - <p class="warning"><?php __('There are no active panels. You must enable a panel to see its output.'); ?></p> - <?php else: ?> - <ul id="panel-tabs"> - <li class="panel-tab icon"> - <a href="#hide" id="hide-toolbar"> - <?php echo $html->image('/debug_kit/img/cake.icon.png', array('alt' => 'CakePHP')); ?> - </a> - </li> - <?php foreach ($debugToolbarPanels as $panelName => $panelInfo): ?> - <?php $panelUnderscore = Inflector::underscore($panelName);?> - <li class="panel-tab"> - <a href="#<?php echo $panelUnderscore; ?>"> - <?php echo Inflector::humanize($panelUnderscore); ?> - </a> - <div class="panel-content" id="<?php echo $panelUnderscore ?>-tab"> - <div class="panel-content-data"> - <?php echo $this->element($panelInfo['elementName'], $panelInfo); ?> - </div> - <div class="panel-content-data panel-content-history" id="<?php echo $panelUnderscore; ?>-history"> - <!-- content here --> - </div> - </div> - </li> - <?php endforeach ?> - </ul> - <?php endif; ?> -</div> \ No newline at end of file diff --git a/views/elements/history_panel.ctp b/views/elements/history_panel.ctp deleted file mode 100644 index 4b2a38f..0000000 --- a/views/elements/history_panel.ctp +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * View Variables Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2> <?php __('Request History'); ?></h2> -<?php if (empty($content)): ?> - <p class="warning"><?php __('No previous requests logged.'); ?></p> -<?php else: ?> - <?php echo count($content); ?> <?php __('previous requests available') ?> - <ul class="history-list"> - <li><?php echo $html->link(__('Restore to current request', true), - '#', array('class' => 'history-link', 'id' => 'history-restore-current')); ?> - </li> - <?php foreach ($content as $previous): ?> - <li><?php echo $html->link($previous['title'], $previous['url'], array('class' => 'history-link')); ?></li> - <?php endforeach; ?> - </ul> -<?php endif; ?> diff --git a/views/elements/log_panel.ctp b/views/elements/log_panel.ctp deleted file mode 100644 index 0a075ce..0000000 --- a/views/elements/log_panel.ctp +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Log Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2><?php __('Logs') ?></h2> -<div class="code-table"> -<?php foreach ($content as $logName => $logs): ?> - <h3><?php echo $logName ?></h3> - <?php - $len = count($logs); - if ($len > 0): - $headers = array(__('Time', true), __('Message', true)); - $rows = array(); - for ($i = 0; $i < $len; $i += 2): - $rows[] = array( - $logs[$i], $logs[$i + 1] - ); - endfor; - echo $toolbar->table($rows, $headers, array('title' => $logName)); - else: ?> - <p class="info"><?php __('There were no log entries made this request'); ?></p> - <?php endif; ?> -<?php endforeach; ?> -</div> \ No newline at end of file diff --git a/views/elements/request_panel.ctp b/views/elements/request_panel.ctp deleted file mode 100644 index a2ff53b..0000000 --- a/views/elements/request_panel.ctp +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Request Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2> <?php __('Request'); ?></h2> -<h4>Cake Params</h4> -<?php echo $toolbar->makeNeatArray($content['params']); ?> - -<h4>$_GET</h4> -<?php echo $toolbar->makeNeatArray($content['get']); ?> - -<h4>Cookie</h4> -<?php if (isset($content['cookie'])): ?> - <?php echo $toolbar->makeNeatArray($content['cookie']); ?> -<?php else: ?> - <p class="warning">To view Cookies, add CookieComponent to Controller</p> -<?php endif; ?> - -<h4><?php __('Current Route') ?></h4> -<?php echo $toolbar->makeNeatArray($content['currentRoute']); ?> \ No newline at end of file diff --git a/views/elements/session_panel.ctp b/views/elements/session_panel.ctp deleted file mode 100644 index 003032a..0000000 --- a/views/elements/session_panel.ctp +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Session Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2><?php __('Session'); ?></h2> -<?php echo $toolbar->makeNeatArray($content); ?> \ No newline at end of file diff --git a/views/elements/sql_log_panel.ctp b/views/elements/sql_log_panel.ctp deleted file mode 100644 index 56c20fa..0000000 --- a/views/elements/sql_log_panel.ctp +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Session Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2><?php __('Sql Logs')?></h2> -<?php if (!empty($content)) : ?> - <?php foreach ($content as $dbName => $queryLog) : ?> - <div class="sql-log-panel-query-log"> - <h4><?php echo $dbName ?></h4> - <?php echo $queryLog; ?> - </div> - <?php endforeach; ?> -<?php else: ?> - <p class="warning"><?php __('No active database connections'); ?></p> -<?php endif; ?> \ No newline at end of file diff --git a/views/elements/timer_panel.ctp b/views/elements/timer_panel.ctp deleted file mode 100644 index 66f60cf..0000000 --- a/views/elements/timer_panel.ctp +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Timer Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -if (!isset($debugKitInHistoryMode)): - $timers = DebugKitDebugger::getTimers(); - $currentMemory = DebugKitDebugger::getMemoryUse(); - $peakMemory = DebugKitDebugger::getPeakMemoryUse(); - $requestTime = DebugKitDebugger::requestTime(); -else: - $content = $toolbar->readCache('timer', $this->params['pass'][0]); - if (is_array($content)): - extract($content); - endif; -endif; -?> -<h2><?php __('Memory'); ?></h2> -<div class="current-mem-use"> - <?php echo $toolbar->message(__('Current Memory Use',true), $number->toReadableSize($currentMemory)); ?> -</div> -<div class="peak-mem-use"> -<?php - echo $toolbar->message(__('Peak Memory Use', true), $number->toReadableSize($peakMemory)); ?> -</div> - -<h2><?php __('Timers'); ?></h2> -<div class="request-time"> - <?php $totalTime = sprintf(__('%s (seconds)', true), $number->precision($requestTime, 6)); ?> - <?php echo $toolbar->message(__('Total Request Time:', true), $totalTime)?> -</div> - -<?php -$maxTime = 0; -foreach ($timers as $timerName => $timeInfo): - $maxTime += $timeInfo['time']; -endforeach; - -foreach ($timers as $timerName => $timeInfo): - $rows[] = array( - $timeInfo['message'], - $number->precision($timeInfo['time'], 6), - $simpleGraph->bar($number->precision($timeInfo['time'], 6), array('max' => $maxTime)) - ); - $headers = array(__('Message', true), __('Time in seconds', true), __('Graph', true)); -endforeach; - -echo $toolbar->table($rows, $headers, array('title' => 'Timers')); - -if (!isset($debugKitInHistoryMode)): - $toolbar->writeCache('timer', compact('timers', 'currentMemory', 'peakMemory', 'requestTime')); -endif; -?> diff --git a/views/elements/variables_panel.ctp b/views/elements/variables_panel.ctp deleted file mode 100644 index ade264c..0000000 --- a/views/elements/variables_panel.ctp +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * View Variables Panel Element - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake - * @subpackage cake.debug_kit.views.elements - * @since - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -?> -<h2> <?php __('View Variables'); ?></h2> -<?php echo $toolbar->makeNeatArray($content); ?> diff --git a/views/helpers/fire_php_toolbar.php b/views/helpers/fire_php_toolbar.php deleted file mode 100644 index 630a707..0000000 --- a/views/helpers/fire_php_toolbar.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * FirePHP Toolbar Helper - * - * Injects the toolbar elements into non-HTML layouts via FireCake. - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('helper', 'DebugKit.Toolbar'); -App::import('Vendor', 'DebugKit.FireCake'); - -class FirePhpToolbarHelper extends ToolbarHelper { -/** - * send method - * - * @return void - * @access protected - */ - function _send() { - $view =& ClassRegistry::getObject('view'); - $view->element('debug_toolbar', array('plugin' => 'debug_kit', 'disableTimer' => true)); - Configure::write('debug', 1); - } -/** - * makeNeatArray. - * - * wraps FireCake::dump() allowing panel elements to continue functioning - * - * @param string $values - * @return void - */ - function makeNeatArray($values) { - FireCake::info($values); - } -/** - * Create a simple message - * - * @param string $label Label of message - * @param string $message Message content - * @return void - */ - function message($label, $message) { - FireCake::log($message, $label); - } -/** - * Generate a table with FireCake - * - * @param array $rows Rows to print - * @param array $headers Headers for table - * @param array $options Additional options and params - * @return void - */ - function table($rows, $headers, $options = array()) { - $title = $headers[0]; - if (isset($options['title'])) { - $title = $options['title']; - } - array_unshift($rows, $headers); - FireCake::table($title, $rows); - } -} -?> \ No newline at end of file diff --git a/views/helpers/html_toolbar.php b/views/helpers/html_toolbar.php deleted file mode 100644 index fc58014..0000000 --- a/views/helpers/html_toolbar.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Html Toolbar Helper - * - * Injects the toolbar elements into HTML layouts. - * Contains helper methods for - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('helper', 'DebugKit.Toolbar'); - -class HtmlToolbarHelper extends ToolbarHelper { -/** - * helpers property - * - * @var array - * @access public - */ - var $helpers = array('Html', 'Javascript'); -/** - * settings property - * - * @var array - * @access public - */ - var $settings = array('format' => 'html'); -/** - * Recursively goes through an array and makes neat HTML out of it. - * - * @param mixed $values Array to make pretty. - * @param int $openDepth Depth to add open class - * @param int $currentDepth current depth. - * @return string - **/ - function makeNeatArray($values, $openDepth = 0, $currentDepth = 0) { - $className ="neat-array depth-$currentDepth"; - if ($openDepth > $currentDepth) { - $className .= ' expanded'; - } - $nextDepth = $currentDepth + 1; - $out = "<ul class=\"$className\">"; - if (!is_array($values)) { - if (is_bool($values)) { - $values = array($values); - } - if (is_null($values)) { - $values = array(null); - } - } - foreach ($values as $key => $value) { - $out .= '<li><strong>' . $key . '</strong>'; - if ($value === null) { - $value = '(null)'; - } - if ($value === false) { - $value = '(false)'; - } - if ($value === true) { - $value = '(true)'; - } - if (empty($value) && $value != 0) { - $value = '(empty)'; - } - - if (is_object($value)) { - $value = Set::reverse($value, true); - } - - if (is_array($value) && !empty($value)) { - $out .= $this->makeNeatArray($value, $openDepth, $nextDepth); - } else { - $out .= $value; - } - $out .= '</li>'; - } - $out .= '</ul>'; - return $out; - } -/** - * Create an HTML message - * - * @param string $label label content - * @param string $message message content - * @return string - */ - function message($label, $message) { - return sprintf('<p><strong>%s</strong> %s</p>', $label, $message); - } -/** - * Create a table. - * - * @param array $rows Rows to make. - * @param array $headers Optional header row. - * @return string - */ - function table($rows, $headers = array()) { - $out = '<table class="debug-table">'; - if (!empty($headers)) { - $out .= $this->Html->tableHeaders($headers); - } - $out .= $this->Html->tableCells($rows, array('class' => 'odd'), array('class' => 'even')); - $out .= '</table>'; - return $out; - } -/** - * send method - * - * @return void - * @access protected - */ - function _send() { - if (Configure::read('debug') == 0) { - return; - } - $view =& ClassRegistry::getObject('view'); - $head = $this->Html->css('/debug_kit/css/debug_toolbar'); - if (isset($view->viewVars['debugToolbarJavascript'])) { - foreach ($view->viewVars['debugToolbarJavascript'] as $script) { - if ($script) { - $head .= $this->Javascript->link($script); - } - } - } - if (preg_match('#</head>#', $view->output)) { - $view->output = preg_replace('#</head>#', $head . "\n</head>", $view->output, 1); - } - $toolbar = $view->element('debug_toolbar', array('plugin' => 'debug_kit', 'disableTimer' => true)); - if (preg_match('#</body>#', $view->output)) { - $view->output = preg_replace('#</body>#', $toolbar . "\n</body>", $view->output, 1); - } - } -} -?> \ No newline at end of file diff --git a/views/helpers/simple_graph.php b/views/helpers/simple_graph.php deleted file mode 100644 index 6ea4580..0000000 --- a/views/helpers/simple_graph.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Simple Graph Helper - * - * Allows creation and display of extremely simple graphing elements - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.views.helpers - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Helper', 'Html'); - -class SimpleGraphHelper extends AppHelper { -/** - * Helpers - * - * @var array - */ - var $helpers = array('Html'); -/** - * Default settings to be applied to each Simple Graph - * - * Allowed options: - * max => int - * width => int - * valueType => string (value, percentage) - * style => array - * - * @var array - */ - var $__defaultSettings = array( - 'max' => 100, - 'width' => 150, - 'valueType' => 'value', - ); -/** - * - * @param $value Value to be graphed - * @param $options Graph options - * @return string Html graph - */ - function bar($value, $options = array()) { - $settings = array_merge($this->__defaultSettings, $options); - extract($settings); - - if ($valueType == 'percentage') { - $value = $value / $width; - } else { - $value = $value / $max * $width; - } - $value = round($value); - - return $this->Html->div( - 'debug-kit-graph-bar', - $this->Html->div( - 'debug-kit-graph-bar-value', - ' ', - array('style' => "width: {$value}px")), - array('style' => "width: {$width}px;"), - false); - } -} -?> \ No newline at end of file diff --git a/views/helpers/toolbar.php b/views/helpers/toolbar.php deleted file mode 100644 index 0396944..0000000 --- a/views/helpers/toolbar.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Abstract Toolbar helper. Provides Base methods for content - * specific debug toolbar helpers. Acts as a facade for other toolbars helpers as well. - * - * helps with development. - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package debug_kit - * @subpackage debug_kit.views.helpers - * @since v 1.0 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -App::import('Vendor', 'DebugKit.DebugKitDebugger'); - -class ToolbarHelper extends AppHelper { -/** - * settings property to be overloaded. Subclasses should specify a format - * - * @var array - * @access public - */ - var $settings = array(); -/** - * flag for whether or not cache is enabled. - * - * @var boolean - **/ - var $_cacheEnabled = false; -/** - * Construct the helper and make the backend helper. - * - * @param string $options - * @access public - * @return void - */ - function __construct($options = array()) { - $this->_myName = strtolower(get_class($this)); - if ($this->_myName !== 'toolbarhelper') { - return; - } - if (!isset($options['output'])) { - $options['output'] = 'DebugKit.HtmlToolbar'; - } - App::import('Helper', $options['output']); - $className = $options['output']; - if (strpos($options['output'], '.') !== false) { - list($plugin, $className) = explode('.', $options['output']); - } - $this->_backEndClassName = $className; - $this->helpers = array($options['output']); - if (isset($options['cacheKey']) && isset($options['cacheConfig'])) { - $this->_cacheKey = $options['cacheKey']; - $this->_cacheConfig = $options['cacheConfig']; - $this->_cacheEnabled = true; - } - } - -/** - * Get the name of the backend Helper - * used to conditionally trigger toolbar output - * - * @return string - **/ - function getName() { - return $this->_backEndClassName; - } -/** - * call__ - * - * Allows method calls on backend helper - * - * @param string $method - * @param mixed $params - * @access public - * @return void - */ - function call__($method, $params) { - if (method_exists($this->{$this->_backEndClassName}, $method)) { - return $this->{$this->_backEndClassName}->dispatchMethod($method, $params); - } - } -/** - * Allows for writing to panel cache from view. - * Some panels generate all variables in the view by - * necessity ie. Timer. Using this method, will allow you to replace in full - * the content for a panel. - * - * @param string $name Name of the panel you are replacing. - * @param string $content Content to write to the panel. - * @return boolean Sucess of write. - **/ - function writeCache($name, $content) { - if (!$this->_cacheEnabled) { - return false; - } - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); - $existing[0][$name]['content'] = $content; - return Cache::write($this->_cacheKey, $existing, $this->_cacheConfig); - } -/** - * Read the toolbar - * - * @param string $name Name of the panel you want cached data for - * @return mixed Boolean false on failure, array of data otherwise. - **/ - function readCache($name, $index = 0) { - if (!$this->_cacheEnabled) { - return false; - } - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); - if (!isset($existing[$index][$name]['content'])) { - return false; - } - return $existing[$index][$name]['content']; - } -/** - * postRender method - * - * Custom Callback defined in DebugView to allow helpers to modify - * View output after all rendering is complete. - * - * @return void - * @access public - */ - function postRender() { - $this->_send(); - } -} \ No newline at end of file diff --git a/views/toolbar_access/history_state.ctp b/views/toolbar_access/history_state.ctp deleted file mode 100644 index 1b6d773..0000000 --- a/views/toolbar_access/history_state.ctp +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/* SVN FILE: $Id$ */ -/** - * Toolbar history state view. - * - * - * - * PHP versions 4 and 5 - * - * CakePHP : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2006-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project - * @package cake.debug_kit - * @subpackage cake.debug_kit.views - * @version - * @modifiedby - * @lastmodified - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -$panels = array(); -foreach ($toolbarState as $panelName => $panel) { - $panels[$panelName] = $this->element($panel['elementName'], array( - 'content' => $panel['content'], - 'plugin' => $panel['plugin'] - )); -} -echo $javascript->object($panels); -Configure::write('debug', 0); -?> \ No newline at end of file