public function getRequest($type = 'json', $return_array = array()) { if (!empty($this->params)) { $data_class = \TeoPHP\lib\Security::getInstance($_REQUEST, $this->params, $this->isXSS)->verifyParam($this->request); if ($data_class->getErrorCode()) { Application::getLogger(__CLASS__ . ':' . __LINE__)->addError('Parameter error', $data_class->getErrorData()); if ($type == 'html') { Application::getTemplate($this->address)->display($return_array[0], $return_array[1]); } else { Application::getJson(array($data_class->getErrorParam()), $data_class->getErrorCode(), 'Parameter error')->returnJson(); } } } return $this->request; }
<?php /** * ownCloud - News * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Alessandro Cosentino <*****@*****.**> * @author Bernhard Posselt <*****@*****.**> * @copyright Alessandro Cosentino 2012 * @copyright Bernhard Posselt 2012, 2014 */ namespace OCA\News\AppInfo; $container = new Application(); $config = $container->getAppConfig(); $config->loadConfig(__DIR__ . '/app.json'); $config->registerNavigation(); $config->registerBackgroundJobs(); $config->registerHooks(); // check for correct app dependencies try { $config->testDependencies(); } catch (\OCA\News\Config\DependencyException $e) { $container->getLogger()->log($e->getMessage()); }
$logger1 = new Gelembjuk\Logger\FileLogger(array('logfile' => $logfile, 'groupfilter' => 'all')); // pass created logger as argument // after object created and the method called you will see logs in your log file // at this moment all logs are written $application1 = new Application($logger1); $application1->doSomething(); // now wee loggeing from the class B $b1 = new B($logger1); $b1->doSomething(); // this shows how to use logger from other class where the trite is used // object of this class must be set to $this->application property $c1 = new C($application1); $c1->doSomething(); unset($application1); unset($b1); unset($c1); // ****** TEST 2 ****** // don't use existent logger, but create it inside $application2 = new Application(null); // we set filtering to `construct`. So only logs from constructors will be saved $application2->initLogger(array('logfile' => $logfile, 'groupfilter' => 'construct')); $application2->doSomething(); // get logger object reference from application $b2 = new B($application2->getLogger()); $b2->doSomething(); // this usage is same as above. Doesn't mapper how application created logger // this class will just reuse it $c2 = new C($application2); $c2->doSomething(); $logger = $application2->getLogger(); echo "Now see to your log file!";