Skip to content
This repository was archived by the owner on Mar 29, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@
}
],
"require": {
"nette/nette": "~2.1@dev",
"nette/application": "~2.3@dev",
"nette/di": "~2.3@dev",
"nette/http": "~2.3@dev",
"nette/utils": "~2.3@dev",
"tracy/tracy": "~2.3@dev",

"ext-curl": "*",
"ext-json": "*",
"google/apiclient": "~1.1"
},
"require-dev": {
"nette/tester": "@dev",
"nette/bootstrap": "~2.3@dev",
"jakub-onderka/php-parallel-lint": "~0.7"
},
"support": {
Expand All @@ -45,7 +50,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
"dev-master": "0.2-dev"
}
}
}
12 changes: 0 additions & 12 deletions src/Kdyby/Google/DI/GoogleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,4 @@ protected function isPresenterName($value)
return (bool) preg_match('~^(?:\\/\\/)?\\:?[a-z0-9][a-z0-9:]+$~i', $value);
}



/**
* @param \Nette\Configurator $configurator
*/
public static function register(Nette\Configurator $configurator)
{
$configurator->onCompile[] = function ($config, Nette\DI\Compiler $compiler) {
$compiler->addExtension('google', new GoogleExtension());
};
}

}
1 change: 1 addition & 0 deletions src/Kdyby/Google/Diagnostics/Google_Developers_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 21 additions & 24 deletions src/Kdyby/Google/Diagnostics/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use Google_Exception;
use Google_Http_Request;
use Kdyby\Google\IO\Curl;
use Nette\Utils\Html;
use Nette;
use Nette\Utils\Html;
use Tracy\Debugger;
use Tracy\IBarPanel;

Expand Down Expand Up @@ -56,7 +56,7 @@ class Panel extends Nette\Object implements IBarPanel
/**
* @var array
*/
private $calls = array();
private $calls = [];

/**
* @var \stdClass
Expand All @@ -70,16 +70,21 @@ class Panel extends Nette\Object implements IBarPanel
*/
public function getTab()
{
$img = Html::el('img')->height('16')->src('data:image/png;base64,' . base64_encode(file_get_contents(__DIR__ . '/developers-logo.png')));
$tab = Html::el('span')->title('Google')->addHtml($img);
$title = Html::el()->setText('Google');
$logo = Html::el()->setHtml(file_get_contents(__DIR__ . '/Google_Developers_logo.svg'));
$tab = Html::el()->addHtml($logo);
$title = Html::el('span', ['class' => 'tracy-label'])->title('Google');

if ($this->calls) {
$title->setText(
count($this->calls) . ' call' . (count($this->calls) > 1 ? 's' : '') .
' / ' . sprintf('%0.2f', $this->totalTime) . ' s'
);

} else {
$title->setText('Google');
}
return (string) $tab->addText($title);

return (string)$tab->addHtml($title);
}


Expand All @@ -94,14 +99,16 @@ public function getPanel()
}

ob_start();
$esc = array('Nette\Templating\Helpers', 'escapeHtml');
$click = class_exists('\Tracy\Dumper')
? function ($o, $c = FALSE) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c));
}
: array('\Tracy\Helpers', 'clickableDump');
$totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
if (class_exists('Latte\Runtime\Filters')) {
$esc = Nette\Utils\Callback::closure('Latte\Runtime\Filters::escapeHtml');
} else {
$esc = 'Nette\Templating\Helpers::escapeHtml';
}

$click = class_exists('\Tracy\Dumper')
? function ($o, $c = FALSE) { return \Tracy\Dumper::toHtml($o, ['collapse' => $c]); }
: '\Tracy\Helpers::clickableDump';
$totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}
Expand Down Expand Up @@ -182,17 +189,7 @@ public function register(Curl $client)
$client->onError[] = $this->error;
$client->onSuccess[] = $this->success;

self::getDebuggerBar()->addPanel($this);
}



/**
* @return \Tracy\Bar
*/
private static function getDebuggerBar()
{
return method_exists('Tracy\Debugger', 'getBar') ? Debugger::getBar() : Debugger::$bar;
Debugger::getBar()->addPanel($this);
}

}
4 changes: 0 additions & 4 deletions src/Kdyby/Google/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@



if (!class_exists('Tracy\Debugger')) {
class_alias('Nette\Diagnostics\Debugger', 'Tracy\Debugger');
}

/**
* @author Mikulas Dite <rullaf@gmail.com>
* @author Filip Procházka <filip@prochazka.su>
Expand Down
6 changes: 1 addition & 5 deletions src/Kdyby/Google/IO/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@
use Google_Exception;
use Google_Http_Request;
use Google_IO_Curl;
use Nette\Diagnostics\Debugger;
use Nette\MemberAccessException;
use Nette\Utils\ObjectMixin;
use Tracy\Debugger;



if (!class_exists('Nette\Utils\ObjectMixin')) {
class_alias('Nette\ObjectMixin', 'Nette\Utils\ObjectMixin');
}

/**
* @author Mikulas Dite <rullaf@gmail.com>
* @author Filip Procházka <filip@prochazka.su>
Expand Down
1 change: 0 additions & 1 deletion src/Kdyby/Google/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Kdyby\Google;

use Nette;
use Nette\Diagnostics\Debugger;



Expand Down
1 change: 0 additions & 1 deletion tests/KdybyTests/Google/Extension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class ExtensionTest extends Tester\TestCase
{
$config = new Nette\Configurator();
$config->setTempDirectory(TEMP_DIR);
Kdyby\Google\DI\GoogleExtension::register($config);
$config->addConfig(__DIR__ . '/files/config.neon');

return $config->createContainer();
Expand Down
6 changes: 6 additions & 0 deletions tests/KdybyTests/Google/files/config.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
extensions:
google: Kdyby\Google\DI\GoogleExtension

application:
scanDirs: false

google:
clientId: "93fc0e0480a89a6140e2"
clientSecret: "da40b6ff5902d57f44368934"
Expand Down
3 changes: 2 additions & 1 deletion tests/KdybyTests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Kdyby;
use Nette;
use Tester;
use Tracy;

if (@!include __DIR__ . '/../../vendor/autoload.php') {
echo 'Install Nette Tester using `composer update --dev`';
Expand All @@ -27,7 +28,7 @@ class_alias('Tester\Assert', 'Assert');
// create temporary directory
define('TEMP_DIR', __DIR__ . '/../tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
Tester\Helpers::purge(TEMP_DIR);
Nette\Diagnostics\Debugger::$logDirectory = TEMP_DIR;
Tracy\Debugger::$logDirectory = TEMP_DIR;


$_SERVER = array_intersect_key($_SERVER, array_flip(array(
Expand Down
46 changes: 0 additions & 46 deletions tests/composer-nette-2.1.json

This file was deleted.