本文整理汇总了PHP中Kohana::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::debug方法的具体用法?PHP Kohana::debug怎么用?PHP Kohana::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_editImage
public function action_editImage()
{
// Load field, and the image-date field that connects to it
$fieldid = $_POST["fieldid"];
$field = Wi3::inst()->model->factory("site_field")->set("id", $fieldid)->load();
// Update e-mailaddress
$email = Wi3::inst()->model->factory("site_data")->setref($field)->setname("emailaddress")->load();
// If data does not exist, create it
if (!$email->loaded()) {
$email->create();
}
// Update data field with image-id
$emailaddress = $_POST["emailaddress"];
$email->data = $emailaddress;
$email->update();
echo Kohana::debug($email);
exit;
// Update folder
$data = Wi3::inst()->model->factory("site_data")->setref($field)->setname("folder")->load();
// If data does not exist, create it
if (!$data->loaded()) {
$data->create();
}
// Update data field with image-id
$fileid = $_POST["image"];
$data->data = $fileid;
$data->update();
//$file = Wi3::inst()->model->factory("site_file")->set("id", $fileid)->load();
echo json_encode(array("scriptsbefore" => array("0" => "\$('[type=field][fieldid=" . $fieldid . "] [type=fieldcontent]').html('" . $field->render() . "');")));
}
示例2: action_create_superadmin
public function action_create_superadmin()
{
try {
$m = Wi3::inst()->model->factory("user");
$m->username = "superadmin";
$m->email = "superadmin@example.com";
$m->load();
foreach ($m->roles as $role) {
$role->delete();
}
$m->delete();
// TODO: make sure Sprig understands that the columns with $_in_db == FALSE should NOT be added to the delete() clause
// Then, place the following line before the $m->password = "superadmin" above
$m->password = "superadmin";
$m->password_confirm = "superadmin";
$m->create();
// Now create roles
$role = Wi3::inst()->model->factory("role");
$role->name = "superadmin";
$role->description = "superadmin role";
$role->users = $m->id;
$role->create();
$role = Wi3::inst()->model->factory("role");
$role->name = "login";
$role->description = "login role";
$role->users = $m->id;
$role->create();
} catch (Exception $e) {
echo Kohana::debug($e);
return;
}
echo "<p>Superadminuser has been recreated.</p>";
echo "<p>Back to <a href='..'>setup</a></p>";
}
示例3: test_custom_validate
/**
* Tests User_Model::custom_validate
*
* @test
* @dataProvider provider_custom_validate
*/
public function test_custom_validate($valid, $invalid)
{
// set up mock, for prevent_superadmin_modification
$auth = $this->getMock('Auth', array('logged_in'));
$auth->expects($this->exactly(2))->method('logged_in')->with($this->equalTo('superadmin'))->will($this->returnValue(True));
// Save initial data
$initial_valid = $valid;
$initial_invalid = $invalid;
// Test with valid data
$response = User_Model::custom_validate($valid, $auth);
$this->assertEquals(TRUE, $valid instanceof Validation);
$this->assertTrue($response, Kohana::debug($valid->errors()));
// Test with invalid data
$response = User_Model::custom_validate($invalid, $auth);
$this->assertEquals(TRUE, $invalid instanceof Validation);
$this->assertFalse($response);
// restore valid, invalid
$valid = $initial_valid;
$invalid = $initial_invalid;
// Test modification to superadmin as admin
$auth = $this->getMock('Auth', array('logged_in'));
$auth->expects($this->once())->method('logged_in')->with($this->equalTo('superadmin'))->will($this->returnValue(False));
$response = User_Model::custom_validate($valid, $auth);
$this->assertTrue($valid instanceof Validation);
$this->assertFalse($response, Kohana::debug($valid->errors()));
}
示例4: __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] = Kohana::debug($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;
}
}
}
示例5: index
function index()
{
if ($_POST)
{
echo Kohana::debug($_POST);
}
}
示例6: action_index
public function action_index()
{
//$db = new Database;
$dbmanager = DBManager::instance();
//echo $dbmanager->get_version();
//echo $dbmanager->total_tables();
// List tables
//echo '==================<br />List tables<br />==================';
//$tables = $dbmanager->list_tables();
//echo Kohana::debug($tables);
// Only list name of tables
//echo '==================<br />Only list name of tables<br />==================';
//$table_name = $db->list_tables();
//echo Kohana::debug($table_name);
// List backup files
//echo '==================<br />List backup files<br />==================';
//echo Kohana::debug($dbmanager->list_backfiles());
// Optimize Tables
//echo '==================<br />Optimize Tables<br />==================<br />';
//$result = $dbmanager->optimize_tables($table_name);
//if ( !empty($result) )
// echo $result;
//else
// echo '全部优化完毕';
echo '==================<br />Backup Tables<br />==================<br />';
echo 'Next Backup time: ' . $dbmanager->next_backup_time() . '<br />';
echo Kohana::debug($dbmanager->backup_db());
// Download backup file. $filename = '1234567890_-_database.sql'
// $dbmanager->download_backup($filename);
// Delete backup file. $filename = '1234567890_-_database.sql'
// $dbmanager->delete_backup($filename);
// Display the demo page
//$this->template->title = 'Database Manager';
//$this->template->content = ;
}
示例7: edit
public function edit($id)
{
$user = User_Model::current();
$project = ORM::factory('project', $id);
if (!$user->loaded && $project->user_can($user, 'edit')) {
return $this->template->content = 'oh, come on!';
}
if ($post = $this->input->post('project')) {
$validation = Projects_utils::projects_edit_validation($post);
if (!$project->validate($validation, true)) {
return $this->template->content = Kohana::debug($validation->errors());
}
if ($additional_user_emails = $this->input->post('additional_user_emails')) {
$additional_user_roles = $this->input->post('additional_user_roles');
foreach ($additional_user_emails as $email) {
Profiles_utils::reserve_email_if_available($email);
}
$additional_users = array_combine($additional_user_emails, $additional_user_roles);
$project->add_user_roles($additional_users);
}
url::redirect($project->local_url);
} else {
HTMLPage::add_style('forms');
$this->template->content = View::factory('projects/edit')->bind('project_types', Projects_utils::get_project_types_dropdown_array())->bind('project', $project)->bind('user', $user);
}
}
示例8: demo_login
public function demo_login()
{
// Attempt to complete signin
if ($code = Arr::get($_REQUEST, 'code')) {
// Exchange the authorization code for an access token
$token = $this->provider->access_token($this->client, $code);
// Store the access token
$this->session->set($this->key('access'), $token);
// Refresh the page to prevent errors
$this->request->redirect($this->request->uri);
}
if ($this->token) {
// Login succesful
$this->content = Kohana::debug('Access token granted:', $this->token);
} else {
// We will need a callback URL for the user to return to
$callback = $this->request->url(NULL, TRUE);
// Add the callback URL to the consumer
$this->client->callback($callback);
// Get the login URL from the provider
$url = $this->provider->authorize_url($this->client);
// Redirect to the twitter login page
$this->content = HTML::anchor($url, "Login to {$this->api}");
}
}
示例9: __construct
public function __construct($e)
{
$this->message = $e->getMessage();
$this->code = $e->getCode();
$err = $e->getMessage() . "\n" . Kohana::debug($e->getTraceAsString());
Kohana::log('error', $err);
}
示例10: __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 = Kohana::debug($property->getValue($class));
}
}
}
示例11: __construct
public function __construct($file)
{
if ($filename = Kohana::find_file('config', $file)) {
$this->name = $file;
$source = file_get_contents($filename[0]);
$start_offset = 0;
// Find the config file comment first
if (preg_match('~(/\\*.*?\\*/)~s', $source, $config_comment)) {
$comment = Kodoc::parse($config_comment[0]);
$this->description = $comment[0];
$this->tags = $comment[1];
$start_offset = strlen($config_comment[0]);
}
preg_match_all('~(/\\*.*?\\*/)?\\s*(\\$config\\[([^\\]]+)]\\s*=\\s*([^;]*?);)~s', $source, $matches, PREG_SET_ORDER, $start_offset);
foreach ($matches as $item) {
$comment = Kodoc::parse($item[1]);
$default = isset($comment[1]['default'][0]) ? Kohana::debug($comment[1]['default'][0]) : NULL;
// Remove the @default tag
unset($comment[1]['default']);
$this->options[] = (object) array('description' => $comment[0], 'source' => $item[2], 'name' => trim($item[3], '\'"'), 'default' => $default, 'tags' => $comment[1]);
}
} else {
throw new Kohana_Exception('Error reading config file');
}
}
示例12: __set
public function __set($prop, $value)
{
Kohana::log('debug', $prop . ' -> ' . Kohana::debug($value));
if ('tags' == $prop && is_string($value)) {
return $this->set_tags($value);
}
return parent::__set($prop, $value);
}
示例13: unpublished
public function unpublished()
{
$documents = new Document_Model();
$documents = ORM::factory("Document")->where('viewable', 'n')->orderby(array('create_dt' => 'asc'))->find_all();
echo Kohana::debug($documents);
$this->template->title = "Listing unpublished uploads";
$this->template->content = new View('pages/doc_unpub');
$this->template->content->documents = $documents;
}
示例14: out
public function out()
{
$args = func_get_args();
$str = array_shift($args);
echo "<pre>{$str}</pre>";
foreach ($args as $arg) {
echo Kohana::debug($arg);
}
}
示例15: testValidate
/**
* Tests the validate() method in Form Field Data
*
* @test
* @dataProvider providerValidate
* @param array $valid Valid data for the test
* @param array $invalid Invalid data for the test
* @param array $save Saves the record when validation succeeds
*/
public function testValidate($valid, $invalid, $save)
{
// Model instance for the test
$form_field = new Form_Field_Model();
// Valid data test
$this->assertEquals(TRUE, $form_field->validate($valid, $save), Kohana::debug($valid->errors()));
// Invalid data test
$this->assertEquals(FALSE, $form_field->validate($invalid, $save), sprintf("Expected errors not found. Error count: %d", count($invalid->errors())));
}