Inheritance: extends Gc\Db\AbstractTable
示例#1
0
文件: Cdn.php 项目: gotcms/gotcms
 /**
  * Generates an url with the given path.
  *
  * @param string $path Path
  *
  * @return string  Url
  */
 public function __invoke($path)
 {
     if ($this->basePath === null) {
         $scheme = $this->request->getUri()->getScheme();
         if ($this->config->getValue('force_frontend_ssl') or $scheme === 'https') {
             $basePath = $this->config->getValue('secure_cdn_base_path');
         } else {
             $basePath = $this->config->getValue('unsecure_cdn_base_path');
         }
         $this->basePath = rtrim($basePath, '/');
     }
     return $this->basePath . '/' . ltrim($path, '/');
 }
示例#2
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $coreConfig = new CoreConfig();
     $coreConfig->setValue('stream_wrapper_is_active', 1);
     $this->object = new Partial($coreConfig);
     $coreConfig->setValue('stream_wrapper_is_active', 0);
     $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'view-identifier', 'description' => 'View Description', 'content' => 'View Content'));
     $this->view->save();
     $view = new View();
     $templatePathStack = new TemplatePathStack();
     $templatePathStack->addPath(GC_TEMPLATE_PATH);
     $view->setResolver($templatePathStack);
     $this->object->setView($view);
 }
示例#3
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $oldAdapter = GlobalAdapterFeature::getStaticAdapter();
     $this->config->setValue('debug_is_active', 1);
     $this->config->setValue('session_lifetime', 3600);
     $this->config->setValue('cookie_domain', 'got-cms.com');
     $this->config->setValue('session_handler', CoreConfig::SESSION_DATABASE);
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     GlobalAdapterFeature::setStaticAdapter($oldAdapter);
 }
示例#4
0
 /**
  * Test
  *
  * @return void
  */
 public function testIndexActionWithOfflineWebsite()
 {
     $this->config->insert(array('identifier' => 'site_is_offline', 'value' => 1));
     $this->dispatch('/404Page');
     $this->assertResponseStatusCode(200);
     $this->assertModuleName('GcFrontend');
     $this->assertControllerName('IndexController');
     $this->assertControllerClass('IndexController');
     $this->assertMatchedRouteName('cms');
     $this->config->setValue('site_is_offline', 0);
 }
示例#5
0
文件: Config.php 项目: gotcms/gotcms
 /**
  * Get data
  *
  * @param string $identifier Identifier
  *
  * @return string
  */
 public function get($identifier)
 {
     return $this->config->getValue($identifier);
 }
示例#6
0
文件: AddThis.php 项目: gotcms/gotcms
 /**
  * Save configuration to core_config_data table
  *
  * @return boolean
  */
 public function saveConfig()
 {
     return $this->configTable->setValue('module_addthis', serialize($this->config));
 }