当前位置: 首页>>代码示例>>PHP>>正文


PHP Environment::getConfig方法代码示例

本文整理汇总了PHP中Environment::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getConfig方法的具体用法?PHP Environment::getConfig怎么用?PHP Environment::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Environment的用法示例。


在下文中一共展示了Environment::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

    /**
     * Constractor creates connection and checks/creates tables stucture
     */
    public function __construct()
    {
        $dibiConfig = dibi::getConnection()->getConfig();
        $dbname = isset($dibiConfig['dbname']) ? $dibiConfig['dbname'] : $dibiConfig['database'];
        $config = array('driver' => 'sqlite', 'profiler' => Environment::getConfig('perform')->storage_profiler, 'database' => realpath(Environment::getConfig('perform')->modelCache) . '/' . $dbname . '-storage.sdb');
        parent::__construct($config, 'storage');
        if (!$this->getDatabaseInfo()->hasTable('fields')) {
            $this->query('CREATE TABLE [fields] ([id] INTEGER NOT NULL PRIMARY KEY,
		[name] VARCHAR(100) NOT NULL, [table] VARCHAR(50) NOT NULL,
		[hash] VARCHAR(32) NOT NULL, [type] VARCHAR(50));
		CREATE UNIQUE INDEX [fields_idx] on [fields] ( [name], [table]);');
        }
        if (!$this->getDatabaseInfo()->hasTable('tables')) {
            $this->query('CREATE TABLE [tables] ( [id] INTEGER NOT NULL PRIMARY KEY,
		[name] VARCHAR(100) NOT NULL UNIQUE, [hash] VARCHAR(32) NOT NULL);');
        }
        if (!$this->getDatabaseInfo()->hasTable('views')) {
            $this->query('CREATE TABLE [views] ( [id] INTEGER NOT NULL PRIMARY KEY,
		[name] VARCHAR(100) NOT NULL UNIQUE, [hash] VARCHAR(32) NOT NULL);');
        }
        if (!$this->getDatabaseInfo()->hasTable('indexes')) {
            $this->query('CREATE TABLE [indexes] ([id] INTEGER NOT NULL PRIMARY KEY,
		[name] VARCHAR(100) NOT NULL, [table] VARCHAR(50) NOT NULL,
		[hash] VARCHAR(32) NOT NULL, [unique] BOOLEAN);
		CREATE UNIQUE INDEX [indexes_idx] on [indexes] ( [name], [table]);');
        }
    }
开发者ID:Edke,项目名称:PerfORM,代码行数:30,代码来源:PerfORMStorage.php

示例2: __construct

 public function __construct()
 {
     $this->config['useAcl'] = Environment::getConfig('global')->useAcl;
     // init hasher
     $this->config['hasher'] = Environment::getConfig('hasher');
     $this->hasher = BaseHasher::create($this->config['hasher']->type, $this->config['hasher']);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:7,代码来源:UsersModel.php

示例3: sendPassFormSubmitted

 public function sendPassFormSubmitted($form)
 {
     $values = $form->getValues();
     $user = $this->model->findByEmail($values['email']);
     if (!$user->id) {
         //			$this->flashMessage('Účet so zadaným e-mailom neexistuje', self::FLASH_MESSAGE_ERROR);
         $this->flashMessage('Provided email does not exist in the system', self::FLASH_MESSAGE_ERROR);
         $this->redirect('this');
     } else {
         $token = $this->model->allowTemporaryLogin($user->id, $values['email'], $this->tempLoginTokenExpiration);
         // send email with url for temporary login
         try {
             $email_template = $this->createTemplate();
             $email_template->setFile(__DIR__ . '/../templates/email.phtml');
             $email_template->completeName = $user->completeName;
             $email_template->tempLoginUri = $this->link('//tempLogin', array('tempLoginToken' => $token));
             $mail = new Mail();
             $mail->setFrom(Environment::getConfig("contact")->forgottenPassEmail);
             $mail->addTo($values['email']);
             $mail->setSubject('Password Assistance');
             $mail->setHtmlBody($email_template);
             $mail->send();
         } catch (DibiDriverException $e) {
             $this->flashMessage(OPERATION_FAILED, self::FLASH_MESSAGE_ERROR);
             $this->redirect('this');
         } catch (InvalidStateException $e) {
             //				$this->flashMessage('Email sa nepodarilo odoslať, skúste znova o pár sekúnd', self::FLASH_MESSAGE_ERROR);
             $this->flashMessage('Email could NOT be sent. Please try again in a moment', self::FLASH_MESSAGE_ERROR);
             $this->redirect('this');
         }
         //			$this->flashMessage('Na zadaný e-mail boli odoslané prihlasovacie údaje', self::FLASH_MESSAGE_SUCCESS);
         $this->flashMessage('E-mail with detailed information has been sent to ' . $values['email'], self::FLASH_MESSAGE_SUCCESS);
         $this->redirect('this');
     }
 }
开发者ID:radypala,项目名称:maga-website,代码行数:35,代码来源:ForgottenPassPresenter.php

示例4: convert

 /**
  * Convert
  *
  * Loads HTML and passes to getMarkdown()
  *
  * @param $html
  *
  * @return string The Markdown version of the html
  */
 public function convert($html)
 {
     if ($html === '' && $this->environment->getConfig()->getOption('suppress_errors')) {
         return '';
     }
     $document = $this->createDOMDocument($html);
     // Work on the entire DOM tree (including head and body)
     if (!($root = $document->getElementsByTagName('html')->item(0))) {
         throw new \InvalidArgumentException('Invalid HTML was provided');
     }
     $rootElement = new Element($root);
     $this->convertChildren($rootElement);
     // Store the now-modified DOMDocument as a string
     $markdown = $document->saveHTML();
     $markdown = $this->sanitize($markdown);
     return $markdown;
 }
开发者ID:jarnix,项目名称:html-to-markdown,代码行数:26,代码来源:HtmlConverter.php

示例5: __construct

 public function __construct()
 {
     //db::connect();
     $config = Environment::getConfig();
     $this->prefix = '';
     $this->startup();
     $this->__after_startup();
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:8,代码来源:Model.php

示例6: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     /* check if modelCacheDir valid */
     $this->modelCacheDir = realpath(Environment::getConfig('perform')->modelCache);
     if (!file_exists($this->modelCacheDir) and !mkdir($this->modelCacheDir, 0777, true)) {
         throw new Exception("Unable to create model cache directory '{$this->modelCacheDir}'.");
     }
     if (!is_writable($this->modelCacheDir)) {
         throw new Exception("Model cache directory '{$this->modelCacheDir}' is not writable.");
     }
 }
开发者ID:Edke,项目名称:PerfORM,代码行数:14,代码来源:PerfORMModelCacheBuilder.php

示例7: connect

 public static function connect($settings = array(), $connection_name = null)
 {
     $config = Environment::getConfig();
     foreach ($config['database'] as $connection_name => $settings) {
         try {
             dibi::connect($settings, $connection_name);
             if ($settings['profiler'] == true) {
                 dibi::getProfiler()->setFile(APP_DIR . '/log/db.txt');
             }
         } catch (DibiException $e) {
             echo get_class($e), ': ', $e->getMessage(), "\n";
         }
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:14,代码来源:db.php

示例8: initialize

 public static function initialize()
 {
     $conf = Environment::getConfig('database');
     $connection = dibi::connect($conf[$conf->engine]);
     if ($conf->engine == 'sqlite') {
         $connection->getDriver()->registerFunction('regexp', 'Sqlite::regexp', 2);
     } elseif ($conf->engine == 'postgre') {
         dibi::addSubst('', '::');
     }
     if ($conf->profiler) {
         $profiler = is_numeric($conf->profiler) || is_bool($conf->profiler) ? new DibiProfiler(array()) : new $conf->profiler();
         $profiler->setFile(Environment::expand('%logDir%') . '/sql.log');
         $connection->setProfiler($profiler);
     }
 }
开发者ID:romansklenar,项目名称:nette-datagrid,代码行数:15,代码来源:BaseModel.php

示例9: setupHooks

 protected static function setupHooks()
 {
     $db_config = Environment::getConfig('database');
     define('TABLE_ACL', $db_config->tables->acl);
     define('TABLE_PRIVILEGES', $db_config->tables->acl_privileges);
     define('TABLE_ASSERTIONS', $db_config->tables->acl_assertions);
     define('TABLE_RESOURCES', $db_config->tables->acl_resources);
     define('TABLE_ROLES', $db_config->tables->acl_roles);
     define('TABLE_USERS', $db_config->tables->users);
     define('TABLE_USERS_ROLES', $db_config->tables->users_2_roles);
     $acl_config = Environment::getConfig('acl');
     define('ACL_RESOURCE', $acl_config->resource);
     define('ACL_PRIVILEGE', $acl_config->privilege);
     define('ACL_CACHING', $acl_config->cache);
     define('ACL_PROG_MODE', $acl_config->programmer_mode);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:16,代码来源:AclModule.php

示例10: createHttpRequestService

 function createHttpRequestService()
 {
     $config = Environment::getConfig('httpRequest');
     // params can be taken from config or command line if needed
     $uri = new UriScript();
     $uri->scheme = 'http';
     $uri->port = Uri::$defaultPorts['http'];
     $uri->host = $config->host;
     $uri->path = $config->path;
     //	    $uri->path = '/';
     $uri->canonicalize();
     $uri->path = String::fixEncoding($uri->path);
     $uri->scriptPath = '/';
     $req = new HttpRequest();
     $req->setUri($uri);
     return $req;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:17,代码来源:bootstrap.php

示例11: okClicked

 public function okClicked($button)
 {
     $arr = $button->getForm()->getValues();
     $username = $arr['userName'];
     $password = $arr['password'];
     $user = Environment::getUser();
     // zaregistrujeme autentizační handler
     $credits = (array) Environment::getConfig('admin');
     $user->setAuthenticationHandler(new SimpleAuthenticator(array($credits['username'] => $credits['password'])));
     try {
         // pokusíme se přihlásit uživatele...
         $user->authenticate($username, $password);
         $this->redirect(':Admin:Default:');
     } catch (AuthenticationException $e) {
         $this->error = $e->getMessage();
         $this->redirect('this');
     }
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:18,代码来源:LoginPresenter.php

示例12: run

 public function run()
 {
     $this->cache = Environment::getCache('Application');
     $modules = Environment::getConfig('modules');
     if (!empty($modules)) {
         foreach ($modules as $module) {
             $this->loadModule($module);
         }
     }
     $this->setupRouter();
     //        $this->setupHooks();
     // Requires database connection
     $this->onRequest[] = array($this, 'setupPermission');
     // ...
     // Run the application!
     parent::run();
     $this->cache->release();
 }
开发者ID:radypala,项目名称:maga-website,代码行数:18,代码来源:MyApplication.php

示例13: factory

 /**
  * Autoloader factory.
  * @return Acl
  */
 public static function factory()
 {
     $expire = 24 * 60 * 60;
     // 1 den
     $driver = Environment::getConfig('database')->driver;
     try {
         $key = 'acl';
         $cache = Environment::getCache('application/acl');
         if (isset($cache[$key])) {
             // serving from cache
             return $cache[$key];
         } else {
             $acl = new self();
             $cache->save($key, $acl, array('expire' => $expire, 'tags' => array('system', 'acl')));
             return $acl;
         }
     } catch (Exception $e) {
         $acl = new self();
         //$cache->save($key, $acl, array('expire' => $expire));
         return $acl;
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:26,代码来源:Acl.php

示例14: authenticate

 public function authenticate(array $credentials)
 {
     $login = $credentials['username'];
     $password = $this->phash($credentials['password']);
     $super_admin = Environment::getConfig('admin');
     if ($login == $super_admin['login']) {
         if ($password == $super_admin['password']) {
             $super_admin_info['name'] = 'super admin';
             $row = new DibiRow($super_admin_info);
         } else {
             throw new AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
         }
     } else {
         $row = db::select('*')->from('[:admin:users]')->where('login = %s', $login)->fetch();
         if (!$row) {
             throw new AuthenticationException("Login '{$login}' not found.", self::IDENTITY_NOT_FOUND);
         }
         if ($row->password !== $password) {
             throw new AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
         }
     }
     return new Identity($row->name);
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:23,代码来源:FrontUserModel.php

示例15: createService

<h1>Nette\Environment config test</h1>

<pre>
<?php 
require_once '../../Nette/loader.php';
/*use Nette\Debug;*/
/*use Nette\Environment;*/
class Factory
{
    static function createService($options)
    {
        Debug::dump(__METHOD__);
        Debug::dump($options);
        return (object) NULL;
    }
}
echo "Loading config:\n";
Environment::setName(Environment::PRODUCTION);
Environment::loadConfig('config.ini');
echo "Variable foo:\n";
Debug::dump(Environment::getVariable('foo'));
echo "Constant HELLO_WORLD:\n";
Debug::dump(constant('HELLO_WORLD'));
echo "php.ini config:\n";
Debug::dump(Environment::getConfig('php'));
echo "Database config:\n";
Debug::dump(Environment::getConfig('database'));
echo "is production mode?\n";
Debug::dump(Environment::isProduction());
开发者ID:vrana,项目名称:nette,代码行数:29,代码来源:test.config.php


注:本文中的Environment::getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。