home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / Progress2 / Generator / Dump.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  4.6 KB  |  129 lines

  1. <?php
  2. /**
  3.  * Copyright (c) 2006-2008, Laurent Laville <pear@laurent-laville.org>
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  *     * Redistributions of source code must retain the above copyright
  12.  *       notice, this list of conditions and the following disclaimer.
  13.  *     * Redistributions in binary form must reproduce the above copyright
  14.  *       notice, this list of conditions and the following disclaimer in the
  15.  *       documentation and/or other materials provided with the distribution.
  16.  *     * Neither the name of the authors nor the names of its contributors
  17.  *       may be used to endorse or promote products derived from this software
  18.  *       without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * PHP versions 4 and 5
  33.  *
  34.  * @category  HTML
  35.  * @package   HTML_Progress2
  36.  * @author    Laurent Laville <pear@laurent-laville.org>
  37.  * @copyright 2006-2008 Laurent Laville
  38.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  39.  * @version   CVS: $Id: Dump.php,v 1.6 2008/03/20 21:27:55 farell Exp $
  40.  * @link      http://pear.php.net/package/HTML_Progress2
  41.  * @since     File available since Release 2.1.0
  42.  */
  43.  
  44. require_once 'HTML/QuickForm/Action.php';
  45.  
  46. /**
  47.  * Provides methods for dumping structured information about a variable
  48.  *
  49.  * @param mixed $var the variable to dump
  50.  *
  51.  * @return void
  52.  */
  53. function varDump($var)
  54. {
  55.     $available = HTML_Progress2_Generator::isIncludeable('Var_Dump.php');
  56.     if ($available) {
  57.         include_once 'Var_Dump.php';
  58.         Var_Dump::display($var, false, array('display_mode' => 'HTML4_Table'));
  59.     } else {
  60.         echo '<pre style="background-color:#eee; color:#000; padding:1em;">';
  61.         var_dump($var);
  62.         echo '</pre>';
  63.     }
  64. }
  65.  
  66. /**
  67.  * Interactive memory debugging tool.
  68.  *
  69.  * You can display contents of :
  70.  * - default PEAR_PackageFileManager2 class options
  71.  * - this frontend options
  72.  * - all forms values, defaults and validation states
  73.  * - the Warnings/Errors stack
  74.  *
  75.  * @category  HTML
  76.  * @package   HTML_Progress2
  77.  * @author    Laurent Laville <pear@laurent-laville.org>
  78.  * @copyright 2006-2008 Laurent Laville
  79.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  80.  * @version   Release: 2.4.0
  81.  * @link      http://pear.php.net/package/HTML_Progress2
  82.  * @since     Class available since Release 2.1.0
  83.  */
  84.  
  85. class ActionDump extends HTML_QuickForm_Action
  86. {
  87.     /**
  88.      * Processes the request.
  89.      *
  90.      * @param object &$page      the current form-page
  91.      * @param string $actionName Current action name,
  92.      *                           as one Action object can serve multiple actions
  93.      *
  94.      * @return void
  95.      * @since  version 2.1.0 (2006-08-12)
  96.      * @access public
  97.      */
  98.     function perform(&$page, $actionName)
  99.     {
  100.         $page->isFormBuilt() or $page->buildForm();
  101.         $page->handle('display');
  102.  
  103.         $sess =& $page->controller->container();
  104.  
  105.         $opt = $page->getSubmitValue('dumpOption');
  106.         switch ($opt) {
  107.         case '1':   // Progress2 dump info
  108.             $arr = $page->controller->_progress->toArray();
  109.             varDump($arr);
  110.             break;
  111.         case '2':   // Forms values container
  112.             varDump($sess);
  113.             break;
  114.         case '3':   // Included files
  115.             $includes = get_included_files();
  116.             varDump($includes);
  117.             break;
  118.         case '4':   // declared classes
  119.             $classes = get_declared_classes();
  120.             varDump($classes);
  121.             break;
  122.         case '5':   // declared actions
  123.             $actions = $page->controller->_actions;
  124.             varDump($actions);
  125.             break;
  126.         }
  127.     }
  128. }
  129. ?>