/**
  * @param array $aParams
  * @return mixed|string
  */
 public function get($aParams = null)
 {
     $sFile = '';
     $oCacheKey = $this->createCacheKey($aParams);
     $cache = PhpCache::getInstance()->create();
     try {
         if (!$cache->check($oCacheKey)) {
             $sFile = $this->loadData($this->getUrl());
             $cache->set($oCacheKey, $sFile, $this->cacheTime);
         } else {
             $sFile = $cache->get($oCacheKey);
         }
     } catch (\Exception $e) {
         Debug::cThrow(null, $e, array());
     }
     return $sFile;
 }
 public function connect()
 {
     try {
         $this->dbHandle = new \SQLite3($this->dbConfig['db']);
         if (empty($this->dbHandle)) {
             throw new Exception('No connection');
         }
         $this->connected = true;
         $this->dbConfig['handle'] = $this->dbHandle;
     } catch (Exception $e) {
         Debug::halt('Brak połączenia z bazą danych', $e, array('display' => false));
     }
 }
Пример #3
0
 /**
  * @return string
  */
 public function get()
 {
     \General\Environment::setContentHtml();
     \General\Session::start();
     \General\Environment::set();
     /**
      * @var \General\Templater
      */
     $template = new \General\Templater('index.html');
     try {
         \Database\Factory::getInstance()->quoteAll($this->aParams);
         /*
          * Rejestracja listenerów
          */
         \Listeners\Message::getInstance()->register($this->aParams, $template);
         if (empty($this->aParams['class'])) {
             $this->aParams['class'] = 'Overview';
         }
         if (empty($this->aParams['method'])) {
             $this->aParams['method'] = 'render';
         }
         switch ($this->aParams['class']) {
             default:
                 $className = '\\Controller\\' . $this->aParams['class'];
                 break;
         }
         switch ($this->aParams['method']) {
             default:
                 $methodName = $this->aParams['method'];
                 break;
         }
         if (class_exists($className)) {
             /** @noinspection PhpUndefinedMethodInspection */
             $tObject = $className::getInstance();
             if (method_exists($tObject, $methodName)) {
                 $tObject->{$methodName}($this->aParams, $template);
             }
         }
         \Listeners\LowLevelMessage::getInstance()->register($this->aParams, $template);
     } catch (CustomException $e) {
         $template->add('mainContent', Debug::cThrow($e->getMessage(), $e, array('send' => false, 'display' => false)));
     } catch (Exception $e) {
         $template->add('mainContent', Debug::cThrow(null, $e));
     }
     $template->add('chartHead', '');
     $template->add('listeners', '');
     $template->add('menu', '');
     $template->add('mainContent', '');
     $template->add('titleSecond', '');
     $template->add('pageTitle', '{T:Product Name}');
     $sHtml = (string) $template;
     /*
      * Remove all menu-active-* occurences
      */
     $sHtml = preg_replace('!({submenu-active-[^}]*})!', '', $sHtml);
     $sHtml = preg_replace('!({menu-active-[^}]*})!', '', $sHtml);
     /*
      * Add params
      */
     $sHtml = preg_replace_callback('!({params:[^}]*})!', array($this, 'paramsInjecter'), $sHtml);
     return $sHtml;
 }
Пример #4
0
<?php

use psDebug\Debug;
require_once 'common.php';
$aProxies = array('Forecast', 'Current');
$proxyFactory = new \Factory\Proxy();
foreach ($aProxies as $sProxy) {
    try {
        $proxyFactory->create($sProxy)->forceReload();
    } catch (\Exception $e) {
        Debug::cThrow(null, $e, array());
    }
}
Пример #5
0
<?php

require_once 'classes/General/Autoloader.php';
\General\Autoloader::register();
require_once "../vendor/autoload.php";
\psDebug\Debug::$displayErrors = true;
\psDebug\Debug::$displayTrace = true;
\psDebug\Debug::$sendTrace = false;
\psDebug\Debug::$errorHoldsExecution = true;
\psDebug\Debug::$writeTrace = true;
\psDebug\Debug::$writeFile = 'logs/error.log';
\psDebug\Debug::create();