protected function startup() { parent::startup(); if ($this->getParameter('debug', FALSE)) { \Nette\Diagnostics\Debugger::$productionMode = FALSE; } }
/** * Nette\Diagnostics\Debugger::dump shortcut. */ function dump($var) { foreach (func_get_args() as $arg) { Nette\Diagnostics\Debugger::dump($arg); } return $var; }
/** * @param WebsiteManager $websiteManager * @param PageListener $pageListener * @param LanguageRepository $languageRepository * @param PageRepository $pageRepository * @param RouteRepository $routeRepository */ public function __construct(WebsiteManager $websiteManager, PageListener $pageListener, LanguageRepository $languageRepository, PageRepository $pageRepository, RouteRepository $routeRepository) { parent::__construct(); $this->websiteManager = $websiteManager; $this->languageRepository = $languageRepository; $this->pageRepository = $pageRepository; $this->routeRepository = $routeRepository; $this->pageListener = $pageListener; $this->absoluteUrls = true; \Nette\Diagnostics\Debugger::$bar = false; }
protected function jobFailed($jobScript, $stdoutHandle, $stderrHandle) { $output = stream_get_contents($stdoutHandle); if ($output != "") { echo "\n\n{$output}\n[0;31m!!! Job FAILED[0m\n"; } else { echo " [0;31mFailed[0m\n"; } // Log error (and notify by e-mail if set) Nette\Diagnostics\Debugger::log('Job ' . $jobScript . ' failed', 'error'); // Call parent return call_user_func_array(array('parent', __FUNCTION__), func_get_args()); }
public static function register(\Nette\Http\IRequest $httpRequest, $storageDir, $expire = 3600) { if (static::$httpRequest) { throw new \Nette\InvalidStateException("Multiple file uploader allready registered"); } elseif (!file_exists($storageDir) || !is_writable($storageDir)) { throw new \Nette\InvalidStateException("Storage dir must be writable"); } static::$httpRequest = $httpRequest; static::$storageDir = $storageDir; static::$expire = $expire; // process uploaded file if ($httpRequest->getHeader('X-Nella-MFU-Token') && $httpRequest->getHeader('X-Uploader')) { $files = $httpRequest->files; if (isset($files['file']) && $files['file']->ok) { $token = $httpRequest->getHeader('X-Nella-MFU-Token'); $path = static::$storageDir . "/"; $path .= $token . "_" . time() . "_" . Strings::random(16); $path .= "." . pathinfo($files['file']->name, PATHINFO_EXTENSION); $path .= ".tmp"; $files['file']->move($path); } echo "{success:true}"; \Nette\Diagnostics\Debugger::$bar = NULL; exit; } // clean expired files $files = Finder::findFiles("*.tmp")->from(static::$storageDir); $expire = time() + static::$expire; foreach ($files as $file) { if ($file->getMTime() > $expire) { @unlink($file->getRealPath()); // prevents error } } }
public function beforeRender() { parent::beforeRender(); \Nette\Diagnostics\Debugger::$bar = FALSE; }
public function setup() { $file = "_file_action_logger_test_" . time() . ".log"; $this->file = (\Nette\Diagnostics\Debugger::$logDirectory = __DIR__ . "/..") . "/" . $file; $this->logger = new FileStorage(new \Nette\Security\Identity(1), $file); }
/** * @param mixed * @param string * @return void */ function barDump($var, $title = NULL) { Nette\Diagnostics\Debugger::barDump($var, $title); }
/** * @return Nette\Database\Connection */ public function createServiceNette__database__default() { $service = new Nette\Database\Connection('mysql:host=127.0.0.1;dbname=pixwarecz27;port=8889', 'root', 'root', array('lazy' => TRUE)); $service->setContext(new Nette\Database\Context($service, new Nette\Database\Reflection\DiscoveredReflection($service, $this->getService('cacheStorage')), $this->getService('cacheStorage'))); Nette\Diagnostics\Debugger::getBlueScreen()->addPanel('Nette\\Database\\Diagnostics\\ConnectionPanel::renderException'); return $service; }
@header('Content-Type: text/html; charset=utf-8'); // @ - headers may be sent /** * Load and configure Nette Framework. */ define('NETTE', TRUE); define('NETTE_DIR', __DIR__); define('NETTE_VERSION_ID', 20100); // v2.1.0 define('NETTE_PACKAGE', '5.3'); require_once __DIR__ . '/common/exceptions.php'; require_once __DIR__ . '/common/Object.php'; require_once __DIR__ . '/Utils/LimitedScope.php'; require_once __DIR__ . '/Loaders/AutoLoader.php'; require_once __DIR__ . '/Loaders/NetteLoader.php'; Nette\Loaders\NetteLoader::getInstance()->register(); require_once __DIR__ . '/Diagnostics/Helpers.php'; require_once __DIR__ . '/Diagnostics/shortcuts.php'; require_once __DIR__ . '/Utils/Html.php'; Nette\Diagnostics\Debugger::_init(); Nette\Utils\SafeStream::register(); /** * Nette\Callback factory. * @param mixed class, object, callable * @param string method * @return Nette\Callback */ function callback($callback, $m = NULL) { return new Nette\Callback($callback, $m); }
<?php require __DIR__ . '/../vendor/autoload.php'; $configurator = new Nette\Configurator(); $configurator->setDebugMode('77.78.82.122'); // enable for your remote IP $configurator->enableDebugger(__DIR__ . '/../log'); Nette\Diagnostics\Debugger::$maxDepth = 10; $configurator->setTempDirectory(__DIR__ . '/../temp'); $configurator->createRobotLoader()->addDirectory(__DIR__)->register(); $configurator->addConfig(__DIR__ . '/config/config.neon', Nette\Configurator::AUTO); $container = $configurator->createContainer(); $container->parameters['test_param'] = 'test param'; return $container;
<?php require __DIR__ . '/../vendor/nette/tester/Tester/bootstrap.php'; require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../src/interfaces/IApiUser.php'; require __DIR__ . '/../src/interfaces/IApiAuthenticator.php'; require __DIR__ . '/../src/interfaces/IApiLogger.php'; require __DIR__ . '/../src/RestRoute.php'; require __DIR__ . '/../src/ApiResponse.php'; require __DIR__ . '/../src/ApiPresenter.php'; require __DIR__ . '/../src/JsonSchemaValidator.php'; Nette\Diagnostics\Debugger::$logDirectory = __DIR__ . '/output'; function d($v) { echo \Tester\Dumper::toPhp($v) . "\n"; }
<?php require __DIR__ . '/../vendor/autoload.php'; $configurator = new Nette\Configurator(); //$configurator->setDebugMode(TRUE); // debug mode MUST NOT be enabled on production server $configurator->enableDebugger(__DIR__ . '/../log'); \Nette\Diagnostics\Debugger::$strictMode = false; $configurator->setTempDirectory(__DIR__ . '/../temp'); $configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../vendor/others')->register(); //Load configuration mode $modeFile = __DIR__ . '/../.mode'; $mode = file_exists($modeFile) ? file_get_contents($modeFile) : 'local'; //Check if Songator is configured if (!file_exists(__DIR__ . '/config/config.' . $mode . '.neon')) { die('Songator is not configured yet! Please make a configuration file config.' . $mode . '.neon ;-)'); } //Load configuration $configurator->addConfig(__DIR__ . '/config/config.neon'); $configurator->addConfig(__DIR__ . '/config/config.' . $mode . '.neon'); $container = $configurator->createContainer(); //$container->application->catchExceptions = true; //Send songator identify header @header('X-Powered-By: Songator 3'); @header('X-Version: ' . Songator::VERSION_ID); @header('X-Runtime: Nette Framework'); return $container;
<?php include __DIR__ . '/../../libs/autoload.php'; if (!class_exists('Tester\\Assert')) { echo "Install Nette Tester using `composer update --dev`\n"; exit(1); } if (extension_loaded('xdebug')) { xdebug_disable(); Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat'); } function run(Tester\TestCase $testCase) { $testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL); } // configure environment Tester\Helpers::setup(); date_default_timezone_set('Europe/Prague'); define('APP_DIR', __DIR__ . '/../../app'); // create temporary directory define('TEMP_DIR', __DIR__ . '/../temp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid())); Tester\Helpers::purge(TEMP_DIR); $_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv'))); $_SERVER['REQUEST_TIME'] = 1234567890; $_ENV = $_GET = $_POST = array(); $logDir = __DIR__ . '/../log'; \Nette\Diagnostics\Debugger::$logDirectory = $logDir; \Nette\Diagnostics\Debugger::$productionMode = false;
public function initialize() { date_default_timezone_set('Europe/Prague'); Nette\Bridges\Framework\TracyBridge::initialize(); $this->getService('events.manager')->createEvent(array('Nette\\DI\\Container', 'onInitialize'))->dispatch($this); Tracy\Debugger::$email = '*****@*****.**'; Tracy\Debugger::$editor = 'sublime'; Tracy\Debugger::$browser = 'chromium-browser'; Tracy\Debugger::$strictMode = TRUE; Nette\Caching\Storages\FileStorage::$useDirectories = TRUE; $this->getByType("Nette\\Http\\Session")->exists() && $this->getByType("Nette\\Http\\Session")->start(); header('X-Frame-Options: SAMEORIGIN'); $this->getService('systemModule.initializer'); $this->getService('usersModule.initializer'); $this->getService('securityModule.initializer'); header('X-Powered-By: Nette Framework'); header('Content-Type: text/html; charset=utf-8'); Nette\Utils\SafeStream::register(); Nette\Reflection\AnnotationsParser::setCacheStorage($this->getByType("Nette\\Caching\\IStorage")); Nette\Reflection\AnnotationsParser::$autoRefresh = FALSE; Doctrine\Common\Annotations\AnnotationRegistry::registerLoader("class_exists"); Kdyby\Doctrine\Diagnostics\Panel::registerBluescreen($this); Kdyby\Doctrine\Proxy\ProxyAutoloader::create('/home/fuca/Projects/www/sportsclub/tests/tmp/proxies', 'Kdyby\\GeneratedProxy')->register(); Nette\Diagnostics\Debugger::getBlueScreen()->collapsePaths[] = '/home/fuca/Projects/www/sportsclub/vendor/kdyby/doctrine/src/Kdyby/Doctrine'; Nette\Diagnostics\Debugger::getBlueScreen()->collapsePaths[] = '/home/fuca/Projects/www/sportsclub/vendor/doctrine'; Nette\Diagnostics\Debugger::getBlueScreen()->collapsePaths[] = '/home/fuca/Projects/www/sportsclub/tests/tmp/proxies'; Kdyby\Translation\Diagnostics\Panel::registerBluescreen(); \Tracy\Debugger::setLogger($this->getService('monolog.adapter')); }
} $loader->add('JedenWeb', __DIR__ . '/../../libs'); require_once __DIR__ . '/../../src/JedenWeb/common/Configurator.php'; // configure environment Tester\Helpers::setup(); class_alias('Tester\\Assert', 'Assert'); date_default_timezone_set('Europe/Prague'); // create temporary directory define('TEMP_DIR', __DIR__ . '/../temp/' . getmypid()); @mkdir(dirname(TEMP_DIR)); // @ - directory may already exist Tester\Helpers::purge(TEMP_DIR); define('LOG_DIR', __DIR__ . '/../log/'); @mkdir(dirname(LOG_DIR)); // @ - directory may already exist Nette\Diagnostics\Debugger::$logDirectory = LOG_DIR; $_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv'))); $_SERVER['REQUEST_TIME'] = 1234567890; $_ENV = $_GET = $_POST = array(); if (extension_loaded('xdebug')) { xdebug_disable(); Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat'); } function id($val) { return $val; } if (!class_exists('Notes')) { class Notes { public static $notes = array();
isNumericInt($value){return is_int($value)||is_string($value)&&preg_match('#^-?[0-9]+$#',$value);}static function isNumeric($value){return is_float($value)||is_int($value)||is_string($value)&&preg_match('#^-?[0-9]*[.]?[0-9]+$#',$value);}static function isCallable($value){return$value&&is_callable($value,TRUE);}static function isUnicode($value){return is_string($value)&&preg_match('##u',$value);}static function isNone($value){return$value==NULL;}static function isList($value){return is_array($value)&&(!$value||array_keys($value)===range(0,count($value)-1));}static function isInRange($value,$range){return(!isset($range[0])||$value>=$range[0])&&(!isset($range[1])||$value<=$range[1]);}static function isEmail($value){$atom="[-a-z0-9!#$%&'*+/=?^_`{|}~]";$localPart="(?:\"(?:[ !\\x23-\\x5B\\x5D-\\x7E]*|\\\\[ -~])+\"|$atom+(?:\\.$atom+)*)";$chars="a-z0-9\x80-\xFF";$domain="[$chars](?:[-$chars]{0,61}[$chars])";return(bool)preg_match("(^$localPart@(?:$domain?\\.)+[-$chars]{2,19}\\z)i",$value);}static function isUrl($value){$chars="a-z0-9\x80-\xFF";return(bool)preg_match("#^https?://(?:[$chars](?:[-$chars]{0,61}[$chars])?\\.)+[-$chars]{2,19}(/\S*)?$#i",$value);}}class AssertionException extends\Exception{}}namespace {Nette\Diagnostics\Debugger::_init();Nette\Utils\SafeStream::register();function callback($callback,$m=NULL){if($m===NULL){return$callback instanceof Nette\Callback?$callback:new Nette\Callback($callback);}return new Nette\Callback(array($callback,$m));}use Nette\Diagnostics\Debugger;function dump($var){foreach(func_get_args()as$arg){Debugger::dump($arg);}return$var;}}
/** * Test initialization and helpers. * * @author Petr Bugyík * @package Grido\Tests */ if (@(!(include __DIR__ . '/../vendor/autoload.php'))) { echo 'Install Nette Tester using `composer update --dev`'; exit(1); } // configure environment Tester\Environment::setup(); date_default_timezone_set('Europe/Prague'); Nette\Diagnostics\Debugger::$maxDepth = 5; Nette\Diagnostics\Debugger::$maxLen = 500; // create temporary directory define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid()); @mkdir(dirname(TEMP_DIR)); // @ - directory may already exist Tester\Helpers::purge(TEMP_DIR); ini_set('session.save_path', TEMP_DIR); function id($val) { return $val; } function before(\Closure $function = NULL) { static $val; if (!func_num_args()) { return $val ? $val() : NULL;
//netteCache[01]000373a:2:{s:4:"time";s:21:"0.30553000 1427452281";s:9:"callbacks";a:2:{i:0;a:3:{i:0;a:2:{i:0;s:19:"Nette\Caching\Cache";i:1;s:9:"checkFile";}i:1;s:59:"C:\xampp\htdocs\stim\app\templates\Homepage\dayReport.latte";i:2;i:1427452276;}i:1;a:3:{i:0;a:2:{i:0;s:19:"Nette\Caching\Cache";i:1;s:10:"checkConst";}i:1;s:25:"Nette\Framework::REVISION";i:2;s:22:"released on 2014-02-08";}}} // source file: C:\xampp\htdocs\stim\app\templates\Homepage\dayReport.latte // prolog Nette\Latte\Macros\CoreMacros list($_l, $_g) = Nette\Latte\Macros\CoreMacros::initRuntime($template, 'b0w0y95n2d'); // prolog Nette\Latte\Macros\UIMacros // snippets support if (!empty($_control->snippetMode)) { return Nette\Latte\Macros\UIMacros::renderSnippets($_control, $_l, get_defined_vars()); } // // main template // ?> <div class="rezervace report_modal"> <?php Nette\Diagnostics\Debugger::barDump(array('$rezervace' => $rezervace), "Template " . str_replace(dirname(dirname($template->getFile())), "…", $template->getFile())); ?> <form ng-submit="editTermin(termin)"> <div class="form-group"> <div class="col-sm-4 text-left"><label>Datum od</label> <input type="text" ng-model="termin.from"></div> <div class="col-sm-4 text-left"><label>Datum do</label> <input type="text" ng-model="termin.to"></div> <div class="col-sm-4"> <button type="submit" class="btn btn-primary" style="margin-top: 35px;">Změnit</button> </div> </div> <div class="clearfix"></div> </form>
} else { $logdir = __DIR__ . "/../log/web"; } } $cachedir = "{$tmpdir}/cache"; $sqlcachedir = "{$cachedir}/sql"; $apicachedir = "{$cachedir}/api"; if (!getenv("MONDA_TMP")) { putenv("MONDA_TMP={$tmpdir}"); } if (!getenv("MONDA_LOG")) { putenv("MONDA_LOG={$logdir}"); } if (getenv("MONDARC")) { $cfgf = getenv("MONDARC"); } else { $cfgf = __DIR__ . "/../app/config/monda.rc"; } putenv("MONDARC={$cfgf}"); putenv("MONDA_CACHEDIR={$cachedir}"); putenv("MONDA_SQLCACHEDIR={$sqlcachedir}"); putenv("MONDA_APICACHEDIR={$apicachedir}"); if (!file_exists($sqlcachedir)) { mkdir($sqlcachedir, 0700, true); } if (!file_exists($apicachedir)) { mkdir($apicachedir, 0700, true); } $container = (require __DIR__ . '/../app/bootstrap.php'); Nette\Diagnostics\Debugger::$strictMode = true; $container->getService('application')->run();
<?php /** * My Application bootstrap file. */ use Nette\Application\Routers\Route; // Load Nette Framework require LIBS_DIR . '/autoload.php'; // Configure application $configurator = new Nette\Config\Configurator(); // Enable Nette Debugger for error visualisation & logging $configurator->setDebugMode($configurator::AUTO); $configurator->enableDebugger(__DIR__ . '/../log'); \Nette\Diagnostics\Debugger::$email = 'no-reply@***.cz'; // Enable RobotLoader - this will load all classes automatically $configurator->setTempDirectory(__DIR__ . '/../temp'); $configurator->createRobotLoader()->addDirectory(APP_DIR)->register(); \Nella\Console\Config\Extension::register($configurator); \Nella\Doctrine\Config\Extension::register($configurator); \Nella\Doctrine\Config\MigrationsExtension::register($configurator); \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', LIBS_DIR . "/jms/serializer/src"); Kdyby\Replicator\Container::register(); if (CLIDatabaseRemoteSync::isCLI() && !CLIDatabaseRemoteSync::syncWithRemoteDatabase()) { $configurator->addConfig(__DIR__ . '/config/config.neon', "development"); $configurator->setProductionMode(FALSE); $configurator->setDebugMode(TRUE); } else { $configurator->addConfig(__DIR__ . '/config/config.neon'); } // Create Dependency Injection container from config.neon file $container = $configurator->createContainer();
/** * @return Nette\Security\User */ public function createServiceUser() { $service = new Nette\Security\User($this->getService('nette.userStorage'), $this->getService('userManager')); Nette\Diagnostics\Debugger::getBar()->addPanel(new Nette\Security\Diagnostics\UserPanel($service)); return $service; }
/** * {link destination [,] [params]} * {plink destination [,] [params]} * n:href="destination [,] [params]" */ public function macroPlink(MacroNode $node, $writer) { \Nette\Diagnostics\Debugger::$maxDepth = 8; return $writer->write('echo %escape($presenter->link(%node.word, %node.array?))'); }