本文整理汇总了PHP中Debug::vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::vars方法的具体用法?PHP Debug::vars怎么用?PHP Debug::vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::vars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
public function action_index()
{
if (!file_exists(DOCROOT . $this->sitemap_directory_base)) {
throw new HTTP_Exception_404();
}
$this->site_code = ORM::factory('site', $this->request->site_id)->code;
$this->sitemap_directory = $this->sitemap_directory_base . DIRECTORY_SEPARATOR . $this->site_code;
$this->response->headers('Content-Type', 'text/xml')->headers('cache-control', 'max-age=0, must-revalidate, public')->headers('expires', gmdate('D, d M Y H:i:s', time()) . ' GMT');
try {
$dir = new DirectoryIterator(DOCROOT . $this->sitemap_directory);
$xml = new DOMDocument('1.0', Kohana::$charset);
$xml->formatOutput = TRUE;
$root = $xml->createElement('sitemapindex');
$root->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$xml->appendChild($root);
foreach ($dir as $fileinfo) {
if ($fileinfo->isDot() or $fileinfo->isDir()) {
continue;
}
$_file_path = str_replace(DOCROOT, '', $fileinfo->getPathName());
$_file_url = $this->domain . '/' . str_replace(DIRECTORY_SEPARATOR, '/', $_file_path);
$sitemap = $xml->createElement('sitemap');
$root->appendChild($sitemap);
$sitemap->appendChild(new DOMElement('loc', $_file_url));
$_last_mod = Sitemap::date_format($fileinfo->getCTime());
$sitemap->appendChild(new DOMElement('lastmod', $_last_mod));
}
} catch (Exception $e) {
echo Debug::vars($e->getMessage());
die;
}
echo $xml->saveXML();
}
示例2: __construct
/**
* Loads a class and uses [reflection](http://php.net/reflection) to parse
* the class. Reads the class modifiers, constants and comment. Parses the
* comment to find the description and tags.
*
* @param string class name
* @return void
*/
public function __construct($class)
{
$this->class = new ReflectionClass($class);
if ($modifiers = $this->class->getModifiers()) {
$this->modifiers = '<small>' . implode(' ', Reflection::getModifierNames($modifiers)) . '</small> ';
}
if ($constants = $this->class->getConstants()) {
foreach ($constants as $name => $value) {
$this->constants[$name] = Debug::vars($value);
}
}
$parent = $this->class;
do {
if ($comment = $parent->getDocComment()) {
// Found a description for this class
break;
}
} while ($parent = $parent->getParentClass());
list($this->description, $this->tags) = Kodoc::parse($comment);
// If this class extends Kodoc_Missing, add a warning about possible
// incomplete documentation
$parent = $this->class;
while ($parent = $parent->getParentClass()) {
if ($parent->name == 'Kodoc_Missing') {
$warning = "[!!] **This class, or a class parent, could not be\n\t\t\t\t found or loaded. This could be caused by a missing\n\t\t\t\t\t\t module or other dependancy. The documentation for\n\t\t\t\t\t\t class may not be complete!**";
$this->description = Markdown($warning) . $this->description;
}
}
}
示例3: __construct
public function __construct($class, $property)
{
$property = new ReflectionProperty($class, $property);
list($description, $tags) = Kodoc::parse($property->getDocComment());
$this->description = $description;
if ($modifiers = $property->getModifiers()) {
$this->modifiers = '<small>' . implode(' ', Reflection::getModifierNames($modifiers)) . '</small> ';
}
if (isset($tags['var'])) {
if (preg_match('/^(\\S*)(?:\\s*(.+?))?$/', $tags['var'][0], $matches)) {
$this->type = $matches[1];
if (isset($matches[2])) {
$this->description = Markdown($matches[2]);
}
}
}
$this->property = $property;
// Show the value of static properties, but only if they are public or we are php 5.3 or higher and can force them to be accessible
if ($property->isStatic() and ($property->isPublic() or version_compare(PHP_VERSION, '5.3', '>='))) {
// Force the property to be accessible
if (version_compare(PHP_VERSION, '5.3', '>=')) {
$property->setAccessible(TRUE);
}
// Don't debug the entire object, just say what kind of object it is
if (is_object($property->getValue($class))) {
$this->value = '<pre>object ' . get_class($property->getValue($class)) . '()</pre>';
} else {
$this->value = Debug::vars($property->getValue($class));
}
}
}
示例4: find_product_url
public function find_product_url($product_name)
{
$url = 'http://ek.ua/';
$data = array('search_' => $product_name);
$response = Request::factory($url)->query($data)->execute();
//echo Debug::vars($response->body());
//echo Debug::vars($response->headers());
$response = $response->body();
try {
$doc = phpQuery::newDocument($response);
} catch (Exception $ex) {
$errors[] = $ex->getMessage();
echo Debug::vars($errors);
}
if (!isset($errors)) {
/* Нужно взять заголовок и найти в нем слово найдено */
/*
* что я заметил, удивительно но на разных машинах этот заголовои идет с разным классом
* на данный момент этот класс oth
*/
$str = $doc->find('h1.oth')->html();
if (preg_match('/найдено/', $str)) {
echo Debug::vars('алилуя !!!');
die;
}
return $str;
}
}
示例5: validate_authorize_params
/**
*
* @return array
*/
public function validate_authorize_params()
{
$request_params = $this->_get_authorize_params();
$validation = Validation::factory($request_params)->rule('client_id', 'not_empty')->rule('client_id', 'uuid::valid')->rule('response_type', 'not_empty')->rule('response_type', 'in_array', array(':value', OAuth2::$supported_response_types))->rule('scope', 'in_array', array(':value', OAuth2::$supported_scopes))->rule('redirect_uri', 'url');
if (!$validation->check()) {
throw new OAuth2_Exception_InvalidRequest("Invalid Request: " . Debug::vars($validation->errors()));
}
// Check we have a valid client
$client = Model_OAuth2_Client::find_client($request_params['client_id']);
if (!$client->loaded()) {
throw new OAuth2_Exception_InvalidClient('Invalid client');
}
// Lookup the redirect_uri if none was supplied in the URL
if (!Valid::url($request_params['redirect_uri'])) {
$request_params['redirect_uri'] = $client->redirect_uri;
// Is the redirect_uri still empty? Error if so..
if (!Valid::url($request_params['redirect_uri'])) {
throw new OAuth2_Exception_InvalidRequest('\'redirect_uri\' is required');
}
} else {
if ($client->redirect_uri != $request_params['redirect_uri']) {
throw new OAuth2_Exception_InvalidGrant('redirect_uri mismatch');
}
}
// Check if this client is allowed use this response_type
if (!in_array($request_params['response_type'], $client->allowed_response_types())) {
throw new OAuth2_Exception_UnauthorizedClient('You are not allowed use the \':response_type\' response_type', array(':response_type' => $request_params['response_type']));
}
return $request_params;
}
示例6: constants
/**
* Gets the constants of this class as HTML.
*
* @return array
*/
public function constants()
{
$result = array();
foreach ($this->constants as $name => $value) {
$result[$name] = Debug::vars($value);
}
return $result;
}
示例7: sort_array_by_keys
function sort_array_by_keys(array $unsorted, array $sortKeys)
{
if (count($unsorted) != count($sortKeys)) {
echo Debug::vars($unsorted);
exit;
}
$sorted = [];
foreach ($sortKeys as $key => $value) {
$sorted[$key] = str_replace(",", ";", $unsorted[$key]);
}
return $sorted;
}
示例8: _get_from_files
private function _get_from_files()
{
$validation = Validation::factory($_FILES, 'uploads');
$validation->rule('file', 'Upload::not_empty')->rule('file', 'Upload::type', array(':value', array('csv')));
if ($validation->check()) {
$this->hash = md5(time());
Upload::save($_FILES['file'], $this->hash, sys_get_temp_dir());
} else {
foreach ($validation->errors() as $err) {
switch ($err[0]) {
case 'Upload::not_empty':
throw new Kohana_Exception('You did not choose a file to upload!');
case 'Upload::type':
throw new Kohana_Exception('You can only import CSV files.');
default:
throw new Kohana_Exception('An error occured.<br />' . Debug::vars($err));
}
}
}
}
示例9: action_registration
public function action_registration()
{
if ($post = $this->request->post()) {
try {
// Сохраняем пользователя в БД
$user = ORM::factory('user');
$user->values($this->request->post(), array('username', 'password', 'email'));
$extra_rules = Validation::factory($this->request->post())->rule('password_confirm', 'matches', array(':validation', ':field', 'password'));
$user->save($extra_rules);
// Выставляем ему роль, роль login означает что пользователь может авторизоваться
$user->add('roles', ORM::factory('role', array('name' => 'login')));
// Отправляем письмо пользователю с логином и паролем
mail($post['email'], 'Регистрация на сайте SiteName', 'Вы были зерегестрированы на сайте SiteName, ваш логин: ' . $post['username'] . ' Ваш пароль: ' . $post['password']);
// Делаем редирект на страницу авторизации
$this->redirect("/users/login");
} catch (ORM_Validtion_Exception $e) {
// $errors = $e->errors('models');
echo Debug::vars($errors);
}
}
// Выводим шаблон регистрации
$this->template->title = 'Регистраця';
$this->template->content = View::factory('elements/registration_form');
}
示例10: action_test
public function action_test()
{
echo Debug::vars(gd_info());
}
示例11: action_checkdupes
public function action_checkdupes()
{
$events = ORM::factory("game_EventLog")->where('event_id', '=', 14)->find_all();
$used = array();
$this->template->content = "<h3>Possible Duplicates</h3>";
foreach ($events as $event) {
$search = array_search($event->id, $used);
if ($search === false) {
$used[] = $event->id;
} else {
$this->template->content .= print_r($search, true) . " " . $event->id . "<br />";
}
}
echo Debug::vars("---------Users Checked-------", $used);
}
示例12: render_field
protected static function render_field(Jam_Model $item, Jam_Field $field)
{
$value = $item->{$field->name};
if ($field instanceof Jam_Field_Integer) {
return HTML::chars(number_format($value));
} elseif ($field instanceof Jam_Field_Float) {
return HTML::chars(number_format($value, 2));
} elseif ($field instanceof Jam_Field_Boolean) {
return $value ? '<i class="icon-ok"></i>' : '';
} elseif ($field instanceof Jam_Field_Serialized) {
return Debug::vars($value);
} elseif ($field instanceof Jam_Field_Timestamp) {
if (!$value) {
return '-';
}
$time = is_numeric($value) ? $value : strtotime($value);
return '<span title="' . date('j M Y H:i:s', $time) . '">' . Tart_Html::date_span($time) . '</span>';
} elseif ($field instanceof Jam_Field_Weblink) {
return Text::limit_chars(HTML::chars($value), 30) . ' ' . HTML::anchor($value, '<i class="icon-share-alt"></i>');
} elseif ($field instanceof Jam_Field_Text) {
return Text::widont(Text::limit_chars(HTML::chars($value), 40));
} elseif ($field instanceof Jam_Field_Upload) {
return HTML::image($value->url(TRUE), array('class' => 'img-polaroid', 'alt' => $item->name()));
} else {
return HTML::chars($value);
}
}
示例13: action_demo13
public function action_demo13()
{
$user = Mango::factory('user', array('role' => 'viewer', 'email' => 'a@b.nl'))->create();
$group = Mango::factory('group', array('name' => 'wouter'))->create();
$user->add($group, 'circle');
echo Debug::vars($user->changed(TRUE), $group->changed(TRUE));
$user->update();
$group->update();
$group->reload();
$user->reload();
foreach ($group->users as $user) {
echo Debug::vars($user->as_array(FALSE));
}
foreach ($user->circles as $circle) {
echo Debug::vars($circle->as_array(FALSE));
}
$group->remove($user);
echo Debug::vars($user->changed(TRUE), $group->changed(TRUE));
$user->delete();
$group->delete();
}
示例14: foreach
<h1>I18n Dump</h1>
<?php
foreach ($i18n as $path => $name) {
echo "<h3>{$path}</h3>";
try {
echo Debug::vars(I18n::load($name));
} catch (exception $e) {
echo "Something went terribly wrong. Error message: " . Kohana::exception_text($e);
}
}
示例15: debug
public static function debug($value)
{
return Debug::vars($value);
}