コード例 #1
0
ファイル: Home.php プロジェクト: genonbeta/GFramework
 public function onCreate(array $methods)
 {
     $log = new Log(self::TAG);
     $res = ResourceManager::getResource(MainConfig::DB_INDEX_NAME);
     $listPattern = new LogList($this);
     $queuedString = new \genonbeta\util\QueuedString();
     $queuedString->put("my");
     $queuedString->put("name");
     $queuedString->put("is");
     $queuedString->put("veli");
     $queuedString->useSeperator(" ");
     $log->d($queuedString->getString());
     try {
         $sdbLoader = new SQLite3Loader($res->findByName("tr_en"));
         $sdb = $sdbLoader->getDbInstance();
         $result = $sdb->query("SELECT * FROM `tr_en`");
         $cursor = $result->getCursor();
         $log->i("Veritabanında " . $cursor->getCount() . " adet kelime bulunuyor");
     } catch (\Exception $e) {
     }
     $this->loadLanguage(new Turkish());
     $this->setUrlResolver(new UrlResolver(EnvironmentVariables::get("workerAddress"), CurrentManifest::getViewIndex()));
     $log->d($this->getString("t", ["naber lan"]));
     $dbLoader = new MySQLLoader();
     $db = $dbLoader->getDbInstance();
     $log->i("<a href=\"" . $this->getUri("about", "?isOkay=true") . "\">Goto about page</a>");
     $this->drawPattern(new GBasicSkeleton($this), "system_html", array(GBasicSkeleton::TITLE => "Home", GBasicSkeleton::BODY => $listPattern->drawAsAdapter(Log::getLogs())));
 }
コード例 #2
0
ファイル: Loader.php プロジェクト: genonbeta/GFramework
 function onLoad()
 {
     $this->onCreate();
     if (count(CurrentManifest::getViewIndex()) > 0) {
         $viewIndex = CurrentManifest::getViewIndex();
         $pathIndex = NativeUrl::pathResolver();
         $pathCount = count($pathIndex);
         $leftPath = [];
         $currentView = $viewIndex[self::VIEW_DEFAULT];
         for ($wayNumber = $pathCount; $wayNumber > 0; $wayNumber--) {
             $try = implode("/", $pathIndex);
             if (isset($viewIndex[$try]) && class_exists($viewIndex[$try])) {
                 $currentView = $viewIndex[$try];
                 $leftPath = array_splice(NativeUrl::pathResolver(), $wayNumber);
             } else {
                 array_pop($pathIndex);
             }
         }
         if (class_exists($currentView)) {
             $this->getLogger()->d("{$currentView} view is loaded");
             $class = new $currentView();
             if (!$class instanceof ViewSkeleton) {
                 throw new \InvalidArgumentException("{$currentView} isn't instance of ViewSkeleton");
             }
             EnvironmentVariables::define("currentSkeleton", $currentView);
             $class->onCreate($leftPath);
             $this->onSkeletonLoaded($class);
         } else {
             throw new \InvalidArgumentException("System couldn't find any view handling definition");
         }
     } else {
         throw new \InvalidArgumentException("No view was defined");
     }
     $this->onDestroy();
 }
コード例 #3
0
 protected function onLoad()
 {
     EnvironmentVariables::define("resourceAddress", G_WORKER_PATH . "/" . Configuration::RESOURCE_PATH);
     EnvironmentVariables::define("documentRoot", G_DOCUMENT_ROOT);
     EnvironmentVariables::define("frameworkRoot", G_FRAMEWORK_ROOT);
     EnvironmentVariables::define("workerAddress", G_WORKER_URL);
     UniversalMessageFilter::registerFilter(new \genonbeta\view\filter\ProviderFilter());
     SourceProvider::registerProvider(new \genonbeta\view\provider\EnvironmentVariablesProvider());
     SourceProvider::registerProvider(new \genonbeta\view\provider\ViewProvider());
 }
コード例 #4
0
 public function onRequest($request)
 {
     return EnvironmentVariables::get($request);
 }