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


PHP App::getConfig方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->app = App::getInstance();
     $this->view = View::getInstance();
     $this->config = $this->app->getConfig();
     $this->input = InputData::getInstance();
 }
开发者ID:KonstantinKirchev,项目名称:WebDevelopment,代码行数:7,代码来源:DefaultController.php

示例2: getLinkByPostId

 /**
  * getLinkByPostId
  *
  * Return redirection link value
  *
  * @param  int    $postID Identification number of post
  * @return string         Redirection link
  */
 public static function getLinkByPostId($postID)
 {
     $conn = \DBI::getConnection('slave');
     // try get post data
     $postData = $conn->sendQuery('SELECT
                 fp.id post_id,
                 ft.id topic_id
             FROM forum_posts fp
             INNER JOIN forum_topics ft
                 ON ft.id = fp.topic_id
             WHERE fp.id = :post_id', array(':post_id' => $postID))->fetch(\PDO::FETCH_OBJ);
     if (!$postData) {
         throw new \SystemErrorException(array('title' => \View::$language->forum_to_post_error, 'description' => \View::$language->forum_to_post_post_not_found));
     }
     // try get post offset
     $postsOffset = $conn->sendQuery('SELECT
                 COUNT(1) cnt
             FROM forum_posts
             WHERE topic_id = :topic_id
                 AND id <= :post_id', array('topic_id' => $postData->topic_id, 'post_id' => $postData->post_id))->fetch(\PDO::FETCH_COLUMN);
     // calculate page number
     $pageNumber = $postsOffset / \App::getConfig('forum')->posts_per_page;
     // TODO posts per page from member custom settings
     $pageNumber = ceil($pageNumber);
     // build link
     $link = '/forum/topic?id=' . $postData->topic_id;
     if ($pageNumber > 1) {
         $link .= '&page=' . $pageNumber;
     }
     $link .= '#topic-post-' . $postData->post_id;
     return $link;
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:40,代码来源:ToPostHelper.php

示例3: writeItem

 /**
  * writeItem
  *
  * Write into log file one report line
  *
  * @param  array $item Loggable report data
  * @return null
  */
 public static function writeItem(array $item)
 {
     $existsLog = false;
     $logDir = APPLICATION . 'logs';
     $logFile = $logDir . '/main.log';
     if (!is_dir($logDir)) {
         exit('Log path ' . $logDir . ' is not directory or not exists!');
     } else {
         if (!is_writable($logDir)) {
             exit('Log path ' . $logDir . ' don\'t have writable permissions!');
         }
     }
     if (is_file($logFile)) {
         if (!is_writable($logFile)) {
             exit('Log file ' . $logFile . ' don\'t have writable permission!');
         }
         $existsLog = true;
         $maxLogSize = App::getConfig('main')->system->log_file_max_size;
         if (filesize($logFile) > $maxLogSize) {
             $logName = date('Y-m-d_H.i.s');
             $archLog = $logDir . '/main_' . $logName . '.log';
             rename($logFile, $archLog);
             $existsLog = false;
         }
     }
     $item['url'] = Request::getRawUrl();
     $item = ($existsLog ? ",\n" : '') . json_encode($item);
     file_put_contents($logFile, $item, LOCK_EX | FILE_APPEND);
     if (!$existsLog) {
         chmod($logFile, 0666);
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:40,代码来源:Logger.php

示例4: index

 /**
  * Default action
  * @param $args array
  */
 public function index(array $args = array())
 {
     \App::setVariable('pageTitle', 'Hello, World.');
     \App::setVariable('helloWorld', 'This does work.<br>');
     \App::setConfig('hello', 'Hello World');
     echo \App::getConfig('hello');
 }
开发者ID:uaktags,项目名称:lyraEngine,代码行数:11,代码来源:Index.php

示例5: processAction

 /**
  * processAction
  *
  * Member registration process
  *
  * @return null
  */
 public function processAction()
 {
     // set json context
     \View::setOutputContext('json');
     \View::lockOutputContext();
     // validate form
     $registerForm = new forms\RegisterForm();
     $registerForm->validate();
     if (!$registerForm->isValid()) {
         throw new \MemberErrorException(array('title' => \View::$language->register_error, 'description' => \View::$language->register_proc_err_descr, 'form_messages' => $registerForm->getMessages()));
     }
     $userData = $registerForm->getData();
     // set new user defaults
     $hCnf = \App::getConfig('hosts');
     $mCnf = \App::getConfig('member-defaults');
     $pass = \common\CryptHelper::generateHash($userData->password);
     $userData->group_id = $mCnf->group_id;
     $userData->cookie = \common\HashHelper::getUniqueKey();
     $userData->password = $pass;
     $userData->time_zone = $mCnf->time_zone;
     $userData->status = $mCnf->status;
     $userData->activation_hash = \common\HashHelper::getUniqueKey();
     $userData->avatar = '//' . $hCnf->st . $mCnf->avatar;
     // create a new user
     $UserModel = \App::getInstance('common\\UserModel');
     $UserModel->createUser($userData);
     // TODO send email notification of account activation
     \App::dump($userData);
     // redirect to complete page
     \Storage::write('__register_complete', true);
     throw new \MemberSuccessException(array('redirection' => '/user/register/complete'));
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:39,代码来源:registerController.php

示例6: run

 public function run()
 {
     $data = $this->_context->get("data", '');
     // Log::Write('【加密数据】Remote Accept:' . $data, Log::DEBUG);
     if ($this->_context->isPOST()) {
         $de_data = Crypt::decrypt($data, App::getConfig('YUC_SECURE_KEY'));
         //  Log::Write('解析的加密数据:' . $de_data, Log::DEBUG);
         $post = json_decode($de_data, TRUE);
         if ($post != '' && is_array($post) && $post['site_key'] == md5(App::getConfig('YUC_SITE_KEY'))) {
             $mod = $post['mod'];
             $act = $post['act'];
             $class = 'Remote_' . $mod;
             if ($act == 'show' && $mod == 'Logs') {
                 $name = $post['name'];
                 $obj = new $class();
                 //self::$_string[' $name']=$name;
                 $ret = $obj->{$act}($name);
             } else {
                 $obj = new $class();
                 $ret = $obj->{$act}();
             }
             Log::Write('Remote Run:' . $mod . ',' . $act . ',' . $ret, Log::DEBUG);
             _returnCryptAjax($ret);
         } else {
             Log::Write('安全认证错误!', Log::DEBUG);
             _returnCryptAjax(array('result' => 0, 'content' => '安全认证比对错误错误!'));
         }
     } else {
         Log::Write('远程控制错误!数据并非POST交互!', Log::DEBUG);
         _returnCryptAjax(array('result' => 0, 'content' => '远程控制错误!数据并非POST交互!'));
     }
 }
开发者ID:saintho,项目名称:phpdisk,代码行数:32,代码来源:execute.php

示例7: parse

 /**
  * 解析请求
  *
  * @param string $url 链接地址
  * @return Request
  */
 public static function parse($url = null)
 {
     $request = Request::getInstance();
     if (is_null($url)) {
         $path = $request->getPath();
     } else {
         $request->setUrl($url);
         $path = $request->getPath();
     }
     $path = trim($path, '/');
     $mode = App::getConfig()->getURLMode();
     switch ($mode) {
         case 1:
             $Url = self::parseQuery($path);
             break;
         case 2:
             $Url = self::parsePathInfo($path);
             break;
         case 3:
             $Url = self::parseRewrite($path);
             break;
         default:
             $Url = self::parseQuery($path);
     }
     return $Url;
 }
开发者ID:qazzhoubin,项目名称:emptyphp,代码行数:32,代码来源:URL.php

示例8: config

/**
 * Get / set the specified configuration value.
 *
 * If an array is passed as the key, we will assume you want to set an array of values.
 *
 * @param  array|string  $key
 * @param  mixed  $default
 * @return mixed
 */
function config($key, $default = null)
{
    if (is_array($key)) {
        return App::setConfig($key, $default);
    }
    return App::getConfig($key, $default);
}
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:16,代码来源:index.php

示例9: execute

 public static function execute()
 {
     Header('X-Accel-Buffering: no');
     // nginx-1.5.6 及其以上版本支持
     $config = App::getConfig();
     self::checkRateLimit($config['site']['rateLimit']);
     $commands = $config['site']['commands'];
     $param = $_GET + $_POST;
     $host = isset($param['host']) ? $param['host'] : '';
     $cmd = isset($param['cmd']) ? $param['cmd'] : '';
     if (stripos($host, 'localhost') !== FALSE) {
         echo "<script>parent.alert('请输入正确的IP地址或域名');</script>";
         echo '<script>parent.req_complete()</script>';
         exit;
     }
     $ip = gethostbyname($host);
     if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE || $ip == '127.0.0.1') {
         echo "<script>parent.alert('请输入正确的IP地址或域名');</script>";
         echo '<script>parent.req_complete()</script>';
         exit;
     }
     if (isset($commands[$cmd])) {
         call_user_func(array(__CLASS__, $cmd), $ip, $commands[$cmd]);
         echo '<script>parent.req_complete()</script>';
     } else {
         echo "<script>parent.alert('无效命令');</script>";
         echo '<script>parent.req_complete()</script>';
         exit;
     }
 }
开发者ID:UncleThree,项目名称:LookingGlass,代码行数:30,代码来源:actions.php

示例10: validate

 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     $availableFilters = \App::getConfig('forum')->tracker_filters;
     if (!in_array($this->_data->by, $availableFilters, true)) {
         $this->_isValid = false;
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:15,代码来源:GetTrackerFilter.php

示例11: init

 /**
  * init
  *
  * Initialization of session storage
  *
  * php.ini used to have session.gc_probability=0 with the comment:
  *
  * "This is disabled in the Debian packages,
  * due to the strict permissions on /var/lib/php5".
  * The strict permissions remain, but session.gc_probability is now enabled.
  *
  * By default there's a 0.1% chance that a call to session_start()
  * will trigger this, but setting session.gc_divisor=1
  * makes this easily reproducible.
  *
  * http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage
  *
  * And this use: @ session_start();
  *
  * @return null
  */
 public static function init()
 {
     if (!App::isCLI()) {
         session_name(App::getConfig('main')->system->session_name);
         @session_start();
         self::_setSessionPointer($_SESSION);
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:29,代码来源:Storage.php

示例12: __construct

 public function __construct($path)
 {
     if (($config = App::getConfig()->get("path.{$path}", false)) === false) {
         throw new \Exception("No defined path found on config for the route '{$path}'");
     }
     $this->path = $path;
     $this->page = new Page($path, $config);
 }
开发者ID:brainsum,项目名称:minit.cz,代码行数:8,代码来源:Router.php

示例13: __construct

 public function __construct(App $app)
 {
     $this->app = $app;
     $dbConfig = $app->getConfig()['db'];
     $provider = strtolower($dbConfig['provider']);
     $provider[0] = strtoupper($provider[0]);
     $connectionClass = __NAMESPACE__ . '\\' . $provider . 'Connection';
     $this->conn = new $connectionClass($dbConfig['host'], $dbConfig['user'], $dbConfig['password'], $dbConfig['name']);
 }
开发者ID:boggad,项目名称:waddle-mvc,代码行数:9,代码来源:QueryBuilder.php

示例14: getLinks

 /**
  * getLinks
  *
  * Return array of available filter links
  *
  * @param  string $currentFilter Current active filter name
  * @return array                 Array of available filter links
  */
 public static function getLinks($currentFilter)
 {
     $links = array();
     foreach (\App::getConfig('forum')->tracker_filters as $k => $name) {
         $title = \View::$language->{'forum_tracker_by_' . $name . '_title'};
         $url = '/forum/tracker' . ($k ? '?by=' . $name : '');
         $links[] = (object) array('current' => $currentFilter == $name, 'url' => $url, 'title' => $title);
     }
     return $links;
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:18,代码来源:TrackerFilterLinksHelper.php

示例15: getConnection

 /**
  * getConnection
  *
  * Return connection object (instance of self)
  *
  * @param  string $key Key of connection instance
  * @return DBC             Database connection object
  */
 public static function getConnection($key = null)
 {
     if (!$key || sizeof(self::$_connections) == 1) {
         reset(self::$_connections);
         $key = key(self::$_connections);
     }
     if (!array_key_exists($key, self::$_connections)) {
         self::$_connections[$key] = new DBC(App::getConfig('main')->db);
     }
     return self::$_connections[$key];
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:19,代码来源:DBI.php


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