コード例 #1
0
ファイル: Dump.php プロジェクト: jmcclenon/Osclass
 public static function newInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: example.php プロジェクト: dazag/dump
function baz($a, $b)
{
    echo '<h2>Class inhertance</h2>';
    $foo = new Foo();
    dump($foo);
    echo '<h2>PHP Global variables</h2>';
    dump(array('$_SERVER' => $_SERVER, '$_REQUEST' => $_REQUEST));
    echo '<h2>Exception</h2>';
    dump(new ErrorException('Dummy exception'));
    echo '<h2>Debug backtrace</h2>';
    dump(debug_backtrace());
    echo '<h2>Debug backtrace (processed)</h2>';
    dump(Dump::backtrace(debug_backtrace()));
    echo '<h2>Recursion</h2>';
    //array
    $a = array('a', 'b');
    $a['c'] =& $a;
    //objects
    $b = new DummyClass();
    $b->field = $b;
    $b->field->field =& $b;
    dump($a, $b);
    echo '<h2>Test source code</h2>';
    echo Dump::source(file_get_contents(__FILE__));
}
コード例 #3
0
ファイル: Dump.php プロジェクト: ideatic/dump
 public static function config($static_url = '/dump-static', $special_paths = [], $nesting_level = 5)
 {
     if (func_num_args() == 0) {
         return ['static_url' => self::$_static_url, 'special_paths' => self::$_special_paths, 'nesting_level' => self::$_nesting_level];
     }
     self::$_static_url = $static_url;
     self::$_special_paths = $special_paths;
     self::$_nesting_level = $nesting_level;
 }
コード例 #4
0
ファイル: SchemaObject.php プロジェクト: mover-io/belt
 /**
  * @throws InvalidArgumentException When an invalid value is written.
  * @throws UnexpectedValueException When an unspecified attribute is
  * read or written.
  */
 public function __set($attribute, $value)
 {
     if (!$this->isValidAttribute($attribute)) {
         throw new \UnexpectedValueException("Unknown attribute: {$attribute}");
     }
     if (!$this->isValidValue($attribute, $value)) {
         throw new \InvalidArgumentException("Invalid value for {$attribute} provided " . Dump::pretty($value, 1));
     }
     $this->attribute_data[$attribute] = $value;
 }
コード例 #5
0
$list['md5'] = 'd75feef3f177e1b003c10cb965765952';
$lists[] = $list;
//	image
$list['file'] = 'image';
$list['md5'] = '81b7662ba8c5c4606d0f6e37ea07b049';
$lists[] = $list;
//	code
$list['file'] = 'code';
$list['md5'] = '23ca378e03ed3c8e47548d19ddc48da7';
$lists[] = $list;
//	blockquote
$list['file'] = 'blockquote';
$list['md5'] = 'f614ec4a88acd449205b93fbdafea398';
$lists[] = $list;
//	Markdown
$md = OnePiece5::Unit('Markdown');
//	Diagnosis
foreach ($lists as $list) {
    $file = $list['file'];
    $html = $md->toHtml(__DIR__ . "/testcase/{$file}.md");
    $md5 = md5($html);
    if ($list['md5'] === $md5) {
        $md->p("![color:blue[{$file} was successful!!]]");
    } else {
        $md->p("![color:red[{$file}, {$md5}]]");
        $md->AdminNotice("{$file}\\,\\ {$md5}");
        //	Diff
        $save = file_get_contents(__DIR__ . "/testcase/{$file}.html");
        Dump::D(array_diff(explode("\n", $save), explode("\n", $html)));
    }
}
コード例 #6
0
ファイル: namespace.php プロジェクト: neel/php-dump
include "ns.php";
include "dump.lib.php";
?>
<html>
	<head>
		<title>Page Title Goes Here</title>
		<style>
			<?php 
Dump::css();
?>
		</style>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript">
			<?php 
Dump::js();
?>
		</script>
	</head>
	<body>
<?php 
$sample = array('hello' => "world", 'one' => 1, 'two' => 2, 'three' => array('four' => 4, 'ram' => 'Hello World', 'int' => array('li' => 'long int', 'si' => 'short int', 'number' => '89', 'man' => array('fm' => 'Female', 'm' => 'Male', 'fm' => array('sfm' => 'shortFemale'), 'm' => array('tm' => 'tall Man')))));
$o = new stdClass();
$o->v = new stdClass();
$o->v->v = new stdClass();
print_r($o);
Dump::r($o);
?>
	</body>
</html>
コード例 #7
0
ファイル: Dump.php プロジェクト: RobBickel/las
 /**
  * Returns an HTML string of information about a single variable.
  *
  * @param   mixed    variable to dump
  * @param   string   name of variable
  * @return  string
  */
 public static function one($var, $name = '')
 {
     $style = Dump::get_style(self::$style);
     return '<pre style="' . $style['pre'] . '">' . ($name != '' ? "{$name} : " : '') . Dump::_get_info_var($var, $name) . '</pre>';
 }
コード例 #8
0
ファイル: wrapper.php プロジェクト: neel/php-dump
<?php

include "dump.lib.php";
?>
<html>
	<head>
		<title>Page Title Goes Here</title>
		<style>
			<?php 
Dump::css();
?>
		</style>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript">
			<?php 
Dump::js();
?>
		</script>
	</head>
	<body>
<?php 
$sample = array('hello' => "world", 'one' => 1, 'two' => 2, 'three' => array('four' => 4, 'ram' => 'Hello World', 'int' => array('li' => 'long int', 'si' => 'short int', 'number' => '89', 'man' => array('fm' => 'Female', 'm' => 'Male', 'fm' => array('sfm' => 'shortFemale'), 'm' => array('tm' => 'tall Man')))));
Dump::r($sample);
Dump::r($sample);
?>
	</body>
</html>
コード例 #9
0
ファイル: Console.php プロジェクト: ideatic/eureka_profiler
function render_db(EurekaProfiler_Session $session)
{
    $queries = $session->events_of_type('db');
    $colors = get_theme_colors();
    if (empty($queries)) {
        echo '<h2>This panel has no log items.</h2>';
        return;
    }
    ?>
    <table class="summary">
        <tr>
            <td style="background: #953FA1;">
                <h3><?php 
    echo EurekaProfiler_Tools::readable_interval($session->total_query_time());
    ?>
</h3>
                <h4>Total time</h4>
            </td>
        </tr>
        <tr>
            <td style="background: #7B3384;padding-top:0" class="border">
                <?php 
    $chart_rows = array();
    $i = 0;
    foreach ($queries as $query) {
        $i++;
        $chart_rows[] = array($i . ': ' . (empty($query->text) ? $query->query : $query->text), $query->duration);
    }
    echo render_chart($chart_rows, 'Query');
    ?>
                <h4>Time chart</h4>
            </td>
        </tr>
    </table>

    <!-- Query Data-->
    <div class="data-wrapper">
        <table class="data data-db">
            <?php 
    $i = 0;
    foreach ($queries as $query) {
        /* @var $query ProfilerQuery */
        //EXPLAIN info
        if (empty($query->explain)) {
            $explain_html = 'No EXPLAIN info';
        } else {
            $explain_html = array();
            foreach ($query->explain as $key => $value) {
                $name = ucwords(str_replace('_', ' ', $key));
                $explain_html[] = "{$name}: <strong>{$value}</strong>";
            }
            $explain_html = implode(' &middot ', $explain_html);
        }
        //Query Info
        if (empty($query->text)) {
            $query_html = htmlspecialchars($query->query);
        } else {
            $query_html = $query->text;
            $original_query = $query->query;
            if (class_exists('Dump') && method_exists('Dump', 'source')) {
                $original_query = Dump::source($original_query, 'mysql');
            }
            $explain_html = '<a class="show-original-query" title="Show full original query" href="#" onclick="app_show_popup(' . htmlspecialchars(json_encode($original_query)) . ', \'Original query\');return false;">[SHOW]</a>&nbsp;' . $explain_html;
        }
        $html = '<div class="query">' . $query_html . '</div>' . '<div class="query-explain">' . $explain_html . '</div>';
        basic_row($i + 1, $html, EurekaProfiler_Tools::readable_interval($query->duration), $colors[$i % count($colors)]);
        $i++;
    }
    ?>
        </table>
    </div>
<?php 
}
コード例 #10
0
$tab = "admin";
$nav = "dump";
/**
 * Checking permissions
 */
require_once "../auth/login_check.php";
loginCheck(OPEN_PROFILE_ADMINISTRATOR, false);
// Not in DEMO to prevent users' malice
require_once "../lib/Dump.php";
@set_time_limit(OPEN_EXEC_TIME_LIMIT);
$auxConn = new DbConnection();
if (!$auxConn->connect()) {
    $auxConn->close();
    Error::connection($auxConn);
}
$localQuery = 'SHOW TABLE STATUS FROM ' . Dump::backQuote(OPEN_DATABASE);
if (!$auxConn->exec($localQuery)) {
    $auxConn->close();
    Error::connection($auxConn);
}
/**
 * Show page
 */
$title = _("Optimize Database");
require_once "../layout/header.php";
/**
 * Breadcrumb
 */
$links = array(_("Admin") => "../admin/index.php", _("Dumps") => "../admin/dump_view_form.php", $title => "");
echo HTML::breadcrumb($links, "icon icon_dump");
unset($links);
コード例 #11
0
ファイル: Trace.php プロジェクト: mover-io/belt
 public function _debug($value, $depth = 1)
 {
     $result = $this->_generateLine(Dump::pretty($value, $this->options['inspect']['depth'], array(), array(), 1, $this->options['inspect']['color']));
     if ($this->options['tint']) {
         $result = Text::tint($this->options['tint'], $result);
     }
     $this->writeLn($result);
 }
コード例 #12
0
ファイル: utils.php プロジェクト: ricktaylord/OSClass
/**
 * Dump osclass database into path file
 *
 * @param type $path
 * @param type $file
 * @return type 
 */
function osc_dbdump($path, $file)
{
    require_once LIB_PATH . 'osclass/model/Dump.php';
    if (!is_writable($path)) {
        return -4;
    }
    if ($path == '') {
        return -1;
    }
    //checking connection
    $dump = Dump::newInstance();
    if (!$dump) {
        return -2;
    }
    $path .= $file;
    $result = $dump->showTables();
    if (!$result) {
        $_str = '';
        $_str .= '/* no tables in ' . DB_NAME . ' */';
        $_str .= "\n";
        $f = fopen($path, "a");
        fwrite($f, $_str);
        fclose($f);
        return -3;
    }
    $_str = '';
    $_str .= '/* OSCLASS MYSQL Autobackup (' . date('Y-m-d H:i:s') . ') */';
    $_str .= "\n";
    $f = fopen($path, "a");
    fwrite($f, $_str);
    fclose($f);
    $tables = array();
    foreach ($result as $_table) {
        $tableName = current($_table);
        $tables[$tableName] = $tableName;
    }
    $tables_order = array('t_locale', 't_country', 't_currency', 't_region', 't_city', 't_city_area', 't_widget', 't_admin', 't_user', 't_user_description', 't_category', 't_category_description', 't_category_stats', 't_item', 't_item_description', 't_item_location', 't_item_stats', 't_item_resource', 't_item_comment', 't_preference', 't_user_preferences', 't_pages', 't_pages_description', 't_plugin_category', 't_cron', 't_alerts', 't_keywords', 't_meta_fields', 't_meta_categories', 't_item_meta');
    // Backup default OSClass tables in order, so no problem when importing them back
    foreach ($tables_order as $table) {
        if (array_key_exists(DB_TABLE_PREFIX . $table, $tables)) {
            $dump->table_structure($path, DB_TABLE_PREFIX . $table);
            $dump->table_data($path, DB_TABLE_PREFIX . $table);
            unset($tables[DB_TABLE_PREFIX . $table]);
        }
    }
    // Backup the rest of tables
    foreach ($tables as $table) {
        $dump->table_structure($path, $table);
        $dump->table_data($path, $table);
    }
    return 1;
}
コード例 #13
0
ファイル: Logger.php プロジェクト: chrismcmacken/phptools
 /**
  * Helper function that logs the actual message. If it can't log a message to the
  * database we trigger an error in the apache log.
  *
  * @static
  * @param $type
  * @param $message
  * @param $detail
  * @throws Exception
  */
 protected static function writeLog($type, $message, $detail)
 {
     $db = call_user_func(static::$dbObjectCallback);
     if (!$db instanceof DB_Base) {
         throw new Exception("The database object returned by the dbObjectCallback must return an instance of the DB class");
     }
     //get caller
     $source = static::getCaller();
     $data = array('type' => $type, 'scriptName' => $_SERVER['SCRIPT_NAME'], 'uri' => $_SERVER['REQUEST_URI'], 'message' => $message, 'serverHost' => $_SERVER['SERVER_NAME'], 'logSource' => $source, 'logCreated' => date("Y-m-d h:i:s"));
     //if it's an object or an array make sure we dump it so we get everything output
     if (is_object($detail) || is_array($detail)) {
         $detail = Dump::out($detail)->returned();
     }
     if (null !== $detail) {
         $data['messageDetail'] = $detail;
     }
     $result = $db->insert(static::$tableName, $data);
     if (false == $result) {
         trigger_error("Unable to write to the log table.", E_WARNING);
     }
 }
コード例 #14
0
ファイル: dump_process.php プロジェクト: edubort/openclinic-1
            // end if
        }
        // end for
        $dumpBuffer .= '</database>' . DUMP_CRLF;
    } else {
        if (isset($_POST['table_select'])) {
            $tmpSelect = implode($_POST['table_select'], OPEN_SEPARATOR);
            $tmpSelect = OPEN_SEPARATOR . $tmpSelect . OPEN_SEPARATOR;
        }
        if (!isset($limitFrom) || !isset($limitTo)) {
            $limitFrom = $limitTo = 0;
        }
        for ($i = 0; $i < $numTables; $i++) {
            $table = $single ? $_POST['table_select'][$i] : $auxConn->tableName($i);
            if (isset($tmpSelect) && strpos(' ' . $tmpSelect, OPEN_SEPARATOR . $table . OPEN_SEPARATOR) || !isset($tmpSelect) && !empty($table)) {
                $dumpBuffer .= Dump::CSVData(OPEN_DATABASE, $table, array('from' => $limitFrom, 'to' => $limitTo, 'what' => isset($_POST['what']) ? $_POST['what'] : null));
            }
            // end if
        }
        // end for
    }
    // end 'csv' case
}
// end building the dump
// Free memory if is necessary
if (!$single) {
    $auxConn->close();
    unset($auxConn);
}
/**
 * "Displays" the dump...
コード例 #15
0
ファイル: Order.php プロジェクト: HotAttack/btcbot
 public function cancel()
 {
     $bot = Bot::get_Instance();
     $res = $bot->api->CancelOrder($this);
     if ($res['success'] == 1) {
         $bot->setBalance($res['return']['funds']['rur']);
         $bot->setBalanceBtc($res['return']['funds']['btc']);
         $this->status = 'cancel';
         $this->close_dtm = $bot->current_exchange->dtm;
         $this->save();
         Dump::d($this->errors);
     }
 }
コード例 #16
0
ファイル: order.php プロジェクト: HotAttack/btcbot
<?php

Dump::d($data->description);
コード例 #17
0
ファイル: view.php プロジェクト: neel/bong
	font-style: bold;
	display: block;
	padding: 8px;
	margin-top: 8px;
	margin-left: 5px;
	margin-bottom: 0px;
	color: #FFFFFF;
	clear: right;
	height: 50px;
	font-weight:bold;
	padding-left: 50px;
	background: #627BAD url(/bong/sys/rc/img/icons/warning.png) no-repeat left;
}
</style>
<p class="info">
No View Created for Method <?php 
echo $meta->method;
?>
 of <?php 
echo $meta->controller;
?>
 Controller in Project <?php 
echo $meta->project->name;
?>
.<br />
XDO and Meta is opened to You for the ease of Development.
</p><br /><br />
<?php 
Dump::r($xdo);
Dump::r($meta);
コード例 #18
0
ファイル: dumpTest.php プロジェクト: chrismcmacken/phptools
 /**
  * @dataProvider dataFunctionalStringFormatting
  * @param string $in Input string to format
  * @param string $out Expected result as the secondary format of the string
  */
 public function testFunctionalStringFormatting($in, $out)
 {
     $html = Dump::out($in)->asHtml()->returned();
     $result = preg_match('~\\<span style\\=\\"display\\: none\\"\\>(.*)\\<\\/span\\>~ms', $html, $matches);
     $this->assertTrue((bool) $result, 'Did not find match in HTML: ' . $html);
     // Reformat the result back into text
     $string = $matches[1];
     $string = str_replace("&nbsp; &nbsp; &nbsp; &nbsp; ", "\t", $string);
     $string = str_replace("<br />\n", "\n", $string);
     $string = html_entity_decode($string);
     $this->assertEquals($out, $string, 'Specially formatted string does not match');
 }
コード例 #19
0
ファイル: helpers.php プロジェクト: nabble/ajde
/**
 * @param           $var
 * @param bool|true $expand
 */
function dump($var, $expand = true)
{
    Dump::dump($var, $expand);
}
コード例 #20
0
ファイル: DumpRender.php プロジェクト: ideatic/dump
 private function _render_exception($name, Exception $e, $level = 0)
 {
     $children = array();
     //Basic info about the exception
     $path = Dump::clean_path($e->getFile());
     $message = Dump::clean_path($e->getMessage());
     if ($this->html) {
         $children[] = $this->html_element('div', array('class' => 'dump-exception'), htmlspecialchars($message));
     }
     //Source code
     if ($this->html) {
         $backtrace = Dump::backtrace($e->getTrace());
         foreach ($backtrace as $step) {
             if ($step['file'] == $path && $step['line'] == $e->getLine()) {
                 $source = $step['source'];
                 break;
             }
         }
         if (!isset($source)) {
             $source = self::get_source($e->getFile(), $e->getLine());
         }
         if (!empty($source)) {
             $children[] = $this->_render_source_code('Source', $source, $path, $e->getLine());
         }
     } else {
         $children[] = $this->_render_item('Location', '', $path . ':' . $e->getLine(), $level + 1);
         $backtrace = Dump::backtrace_small($e->getTrace());
     }
     //Context and data
     if (method_exists($e, 'getContext')) {
         $context = $e->getContext();
         $children[] = $this->_render('Context', $context, $level + 1);
     }
     if (method_exists($e, 'getData')) {
         $data = $e->getData();
         $children[] = $this->_render('Data', $data, $level + 1);
     }
     //Backtrace (en modo texto)
     if (!is_array($backtrace)) {
         $children[] = $this->_render_item('Backtrace', '', $backtrace, $level + 1);
     }
     //Fields
     $children[] = $this->_render_vars('Fields', $e, $level + 1, '', ['message']);
     //Backtrace
     if (is_array($backtrace)) {
         $children[] = $this->_render_vars('Backtrace', $backtrace, $level);
     }
     if ($level == 0) {
         return $this->_render_item(get_class($e), '', strip_tags($message), $level, '', '', $children, 'exception');
     } else {
         return $this->_render_item($name, get_class($e), strip_tags($message), $level, '', '', $children, 'exception');
     }
 }