public function output($depth = 0) { $output = ''; foreach ($this->getChildren() as $child) { $output .= $child->output($depth); } see(trim($output)); }
/** * Show variables with good style. */ function see() { $cnt = func_num_args(); $values = func_get_args(); if ($cnt > 1) { foreach ($values as $k => $v) { see($v); } return; } else { $value = $values[0]; } $echo = function ($value, $color, $type) { $len = ''; if (extension_loaded('mbstring') && $type === 'string') { $len = '(' . mb_strlen($value, 'UTF-8') . ')'; } echo '<font color="', $color, '" style="font-family: arial;word-wrap: break-word;word-break: normal;"><b>', $type, $len, '</b> : ', $value, '</font><br>'; }; switch (true) { case is_string($value): $echo($value, 'red', 'string'); break; case is_float($value): $echo($value, 'BlueViolet', 'float'); break; case is_int($value): $echo($value, 'blue', 'int'); break; case is_null($value): $echo('null', 'Coral ', 'null'); break; case is_bool($value): $v = $value ? 'true' : 'false'; $echo($v, 'green', 'bool'); break; case is_array($value): echo '<b style="font-family:arial">array</b>(', count($value); echo ')<div style="margin:10px 20px;font-family:arial">'; foreach ($value as $kk => $vv) { echo '<font color="#555">', $kk, '</font> => ', see($vv); } echo '</div>'; break; } }
public function handle() { $aData['data'] = $this->run(); $sOutputType = $this->getOutputType(); if ($this->get('gm_type') === Output::TYPE_PJAX) { $this->setOutputType(Output::TYPE_PJAX); } if ($sOutputType === Output::TYPE_HTML) { $aData[Output::TYPE_HTML] = ['header' => $this->getHeader(), 'body' => $this->getBody(), 'footer' => $this->getFooter()]; } if ($sOutputType === Output::TYPE_PJAX) { $aData[Output::TYPE_PJAX] = $this->getBody(); } if ($this->get('debug')) { see($aData); die; } return $aData; }
private function recursiveTouch($new, $time = null) { if (is_null($time)) { $time = time(); } if ($new[0] != '/' && $new[0] != '.') { $new = realpath('.') . '/' . $new; } $dirs = explode('/', $new); array_pop($dirs); $path = ''; array_filter($dirs); foreach ($dirs as $dir) { $path .= '/' . $dir; if (!is_dir($path)) { see($path); if (!mkdir($path)) { return false; } } } return touch($new, $time); }
public function handle_request() { if ($_GET['dbg'] === '1') { $debug = TRUE; } else { $debug = FALSE; } $p = $this->request->get_parameters(); if ($p and !$debug) { $this->handle_form($p); } $id = $this->get_topic_id_from_url(); $info = Bll_Topic::get_topic_info_api($id); foreach ($info['sort'] as $key => $value) { $method = 'get_' . $value['fangyuantype'] . '_fields'; $fields = Const_Prop::$method(); $info['sort'][$key]['prop_fields'] = $fields; } if ($debug) { see($info); exit; } $this->request->set_attribute('info', $info); $uploader = APF::get_instance()->get_config('uploader'); $img_host = APF::get_instance()->get_config('img_host'); $prop_types = Const_Prop::get_prop_types(); foreach ($prop_types as $k => $v) { $method = 'get_' . $k . '_fields'; $fields = Const_Prop::$method(); $this->request->set_attribute($k, $fields); } $this->request->set_attribute('prop_types', $prop_types); $this->request->set_attribute('uploader', $uploader); $this->request->set_attribute('img_host', $img_host); $this->request->set_attribute('topic_id', $id); return 'Topic_Edit'; }
function see() { header('Conten-Type: text/html;charset=utf-8;'); $cnt = func_num_args(); $values = func_get_args(); if ($cnt > 1) { foreach ($values as $k => $v) { see($v); } return; } else { $value = $values[0]; } $echo = function ($value, $color, $type) { $len = ''; if ($type === 'string') { $len = '(' . mb_strlen($value, 'UTF-8') . ')'; } echo '<font color="', $color, '" style="font-family: arial;word-wrap: break-word;word-break: normal;"><b>', $type, $len, '</b> : ', $value, '</font><br>'; }; switch (TRUE) { case is_string($value): $echo($value, 'red', 'string'); break; case is_float($value): $echo($value, 'BlueViolet', 'float'); break; case is_int($value): $echo($value, 'blue', 'int'); break; case is_null($value): $echo('null', 'Coral ', 'null'); break; case is_bool($value): $v = $value ? 'TRUE' : 'FALSE'; $echo($v, 'green', 'bool'); break; case is_array($value): echo '<b style="font-family:arial">array</b>(', count($value), ')<div style="margin:10px 20px;font-family:arial">'; foreach ($value as $kk => $vv) { echo '<font color="#555">', $kk, '</font> => ', see($vv); } echo '</div>'; break; default: echo "<pre>"; var_export($value); echo "</pre>"; break; } }
/** * It manages the actions which an element can do * * @return array|void It depends on the type of action to do */ function actionManager(...$args) { switch ($args[1]) { case 'see': if (canAct($args[0], $args[1])) { $see = see($args[0]); useAction($args[0], 'see'); return $see; } else { writeFileCSV('Log', array(getTime(), 'It can\'t see, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'see', '')); } break; case 'move': if (canAct($args[0], $args[1])) { move($args[0], $args[2]); useAction($args[0], 'move'); } else { writeFileCSV('Log', array(getTime(), 'It can\'t move, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'move', '')); } break; case 'sleep': if (canAct($args[0], $args[1])) { toSleep($args[0]); useAction($args[0], 'sleep'); } else { writeFileCSV('Log', array(getTime(), 'It can\'t sleep, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'sleep', '')); } break; case 'smell': if (canAct($args[0], $args[1])) { $smell = smell($args[0]); useAction($args[0], 'smell'); return $smell; } else { writeFileCSV('Log', array(getTime(), 'It can\'t smell, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'smell', '')); } break; case 'hear': if (canAct($args[0], $args[1])) { $hear = hear($args[0]); useAction($args[0], 'hear'); return $hear; } else { writeFileCSV('Log', array(getTime(), 'It can\'t hear, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'hear', '')); } break; case 'breed': if (canAct($args[0], $args[1])) { breed($args[0]); useAction($args[0], 'breed'); } else { writeFileCSV('Log', array(getTime(), 'It can\'t breed, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'breed', '')); } break; } }
<?php // includes composer and debugging tools include_once __DIR__ . '/bootstrap.php'; $reader = new Nbt\Stream\StreamReader(); $smallOut = $reader->readFromPath(DIR_DATA . '/smalltest.nbt'); $largeOut = $reader->readFromPath(DIR_DATA . '/bigtest.nbt'); see($smallOut, $largeOut);
$list_1 .= "</graph>"; } adminTemplate('vote_see'); require_once adminTemplate('vote_see'); } //下面代码为控制层代码!!!!!!!!!!!!!!!!!!!!! if ($_REQUEST['act'] == 'edit') { edit($_REQUEST[vid]); } else { if ($_REQUEST['act'] == 'delect') { dele($_REQUEST[vid]); } else { if ($_REQUEST['act'] == 'edit_sub') { update($_REQUEST); } else { if ($_REQUEST['act'] == 'see') { see($_REQUEST[vid]); } else { if ($_REQUEST['act'] == 'view') { view($_REQUEST); } else { if ($_REQUEST['act'] == 'update_view') { update_view($_REQUEST); } else { lister(); } } } } } }