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


PHP Config类代码示例

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


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

示例1: setValue

 /**
  * Creates or updates a key-value pair in the config table.
  *
  * @param string $name the key
  * @param string $value the value
  * @return void
  */
 public static function setValue($name, $value)
 {
     $model = new Config();
     $model->name = $name;
     $model->value = $value;
     $model->replace();
 }
开发者ID:nereliz,项目名称:ViMbAdmin,代码行数:14,代码来源:ConfigTable.php

示例2: getErrors

 public function getErrors(Config $cfg)
 {
     $i18n = Localization::getTranslator();
     $walletSettings = [];
     $emailSettings = [];
     $providerClass = '';
     try {
         $provider = $cfg->getWalletProvider();
         $providerClass = get_class($provider);
         $provider->verifyOwnership();
     } catch (Exception $e) {
         if (strpos($providerClass, 'CoinbaseWallet') !== false) {
             $walletSettings[] = ['id' => '#wallet-coinbaseApiKey-error', 'error' => $e->getMessage()];
         } else {
             $walletSettings[] = ['id' => '#wallet-id-error', 'error' => $e->getMessage()];
         }
     }
     try {
         $t = new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl');
         $t->setUsername($cfg->getEmailUsername())->setPassword($cfg->getEmailPassword())->start();
     } catch (Exception $e) {
         $emailSettings[] = ['id' => '#email-username-error', 'error' => $e->getMessage()];
     }
     $errors = [];
     if (!empty($pricingSettings)) {
         $errors['#pricing-settings'] = self::getPricingErrorsFromConfig($cfg);
     }
     if (!empty($walletSettings)) {
         $errors['#wallet-settings'] = $walletSettings;
     }
     if (!empty($emailSettings)) {
         $errors['#email-settings'] = $emailSettings;
     }
     return $errors;
 }
开发者ID:kryptoc,项目名称:skyhook,代码行数:35,代码来源:ConfigVerifier.php

示例3: parseFile

 /**
  * Read menu file. Parse xml and initializate menu.
  *
  * @param	menu		string 		Configuration file
  * @param	cacheFile	string		Name of file where parsed config will be stored for faster loading
  * @return	void
  */
 public function parseFile(RM_Account_iUser $obUser)
 {
     PROFILER_IN('Menu');
     $cacheFile = $this->_filepath . '.' . L(NULL) . '.cached';
     if ($this->_cache_enabled and file_exists($cacheFile) and filemtime($cacheFile) > filemtime($this->_filepath)) {
         $this->_rootArray = unserialize(file_get_contents($cacheFile));
     } else {
         #
         # Initializing PEAR config engine...
         #
         $old = error_reporting();
         error_reporting($old & ~E_STRICT);
         require_once 'Config.php';
         $conf = new Config();
         $this->_root = $conf->parseConfig($this->_filepath, 'XML');
         if (PEAR::isError($this->_root)) {
             error_reporting($old);
             throw new Exception(__METHOD__ . '(): Error while reading menu configuration: ' . $this->_root->getMessage());
         }
         $this->_rootArray = $this->_root->toArray();
         if ($this->_cache_enabled) {
             file_put_contents($cacheFile, serialize($this->_rootArray));
         }
     }
     $arr = array_shift($this->_rootArray);
     $arr = $arr['menu'];
     $this->_menuData['index'] = array();
     // index for branches
     $this->_menuData['default'] = array();
     // default selected block of menu
     $this->_menuData['tree'] = $this->formMenuArray($obUser, $arr['node']);
     $this->_menuData['branches'] = array();
     // tmp array, dont cached
     PROFILER_OUT('Menu');
 }
开发者ID:evilgeny,项目名称:bob,代码行数:42,代码来源:Facade.class.php

示例4: preload

 public function preload()
 {
     $this->mdata['objlang'] = $this->language;
     $this->mdata['objurl'] = $this->url;
     $this->load->model('tool/image');
     $this->load->language('module/pavblog');
     $this->load->model("pavblog/blog");
     $this->load->model("pavblog/comment");
     $mparams = $this->config->get('pavblog');
     $default = $this->model_pavblog_blog->getDefaultConfig();
     $mparams = !empty($mparams) ? $mparams : array();
     if ($mparams) {
         $mparams = array_merge($default, $mparams);
     } else {
         $mparams = $default;
     }
     $config = new Config();
     if ($mparams) {
         foreach ($mparams as $key => $value) {
             $config->set($key, $value);
         }
     }
     $this->mparams = $config;
     if (!defined("_PAVBLOG_MEDIA_")) {
         if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css')) {
             $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css');
         } else {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/pavblog.css');
         }
         define("_PAVBLOG_MEDIA_", true);
     }
 }
开发者ID:ravindram,项目名称:choco,代码行数:32,代码来源:blogs.php

示例5: __construct

 public function __construct(PricingProvider $p)
 {
     $cfg = new Config();
     $this->currencyMeta = $cfg->getCurrencyMeta();
     $this->pricingProvider = $p;
     $this->loadCache();
 }
开发者ID:oktoshi,项目名称:skyhook,代码行数:7,代码来源:PricePoller.php

示例6: create

 /**
  * Attempt to create a user, given a user email and a password
  */
 function create($email, $password, $idSession)
 {
     $user = new User();
     $userRow = $user->findByEmail($email);
     $config = new Config();
     $configRow = $config->fetchAll()->current();
     // Does this user exist?
     if ($userRow) {
         // Check the password
         if ($userRow->password == md5($password)) {
             // Delete a possibly existing session. Safer.
             $db = Zend_Db_Table::getDefaultAdapter();
             $db->query("DELETE FROM Session WHERE idSession = '{$idSession}'");
             // Insert in Session, for 2 hours
             $sessionRow = $this->createRow();
             $sessionRow->idSession = $idSession;
             $sessionRow->id_user = $userRow->id;
             $this->tempsLimite = date("U") + 7200;
             $sessionRow->roles = $userRow->roles;
             $sessionRow->save();
             return true;
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:30,代码来源:Session.php

示例7: view

 public function view($term, $pageID)
 {
     //require_once  'JsonClientUtil.php';
     require_once 'ServiceUtil.php';
     require_once 'Config.php';
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $util = new ServiceUtil();
     $data['test'] = NULL;
     $term = str_replace("_", "%20", $term);
     //$term = str_replace("/", "%2F", $term);
     $startPoint = ($pageID - 1) * 20;
     $result = $util->expandTerm($term);
     $terms = $util->parseExpandedTerm($result, $term);
     //$litResult = searchLiteratureByYearUsingSolr($terms,$startPoint,20,"*",$year);
     $litResult = $util->searchLatestLiterature($terms, $startPoint, 20, "*", "*");
     $data['publications'] = $litResult;
     $data['term'] = $term;
     $data['pageID'] = $pageID;
     $data['page_title'] = "Literature:" . str_replace("%20", " ", $term);
     $data['enable_config'] = true;
     $this->load->view('templates/header2', $data);
     $this->load->view('pages/latestPublicationDisplay', $data);
     $this->load->view('templates/footer2', $data);
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:25,代码来源:LatestPublications.php

示例8: table

 public static function table($name)
 {
     $file = new Config();
     $file->name = $name;
     $file->setType('config');
     return $file;
 }
开发者ID:alexismartin,项目名称:photo-contest,代码行数:7,代码来源:Config.php

示例9: __construct

 /**
  * Class constructor
  *
  * @param string $readOnly If readOnly is true, don't refresh the user's expire time.
  */
 public function __construct($readOnly = false)
 {
     session_start();
     $config = new Config();
     $this->_config = $config;
     // Users are always authorized if the configuration tells us to skip authentication.
     if ($config->getSkipAuth()) {
         return;
     }
     self::$_userId = $config->getUserId();
     self::$_password = $config->getUserPassword();
     if ($this->isAuthorized($readOnly)) {
         if (isset($_POST['auth_username']) && isset($_POST['auth_password']) && !$readOnly) {
             // User is logging in.
             $authTicket = bin2hex(openssl_random_pseudo_bytes(32));
             $atc = new AuthTicketController();
             $atm = new AuthTicketModel();
             $atm->setAuthTicket($authTicket);
             $atc->add($atm);
             $userId = self::$_userId;
             $now = date("Y-m-d H:i:s");
             $out = "{$now}: Login detected for {$userId} with {$authTicket}." . PHP_EOL;
             file_put_contents("login.log", $out, FILE_APPEND);
             self::$_authTicket = $authTicket;
             $_SESSION['auth_ticket'] = self::$_authTicket;
         }
     }
 }
开发者ID:kbcmdba,项目名称:pjs2,代码行数:33,代码来源:Auth.php

示例10: __construct

 public function __construct($site_config = null)
 {
     if ($site_config == null) {
         $siteConfigObj = new Config("site_config");
         $site_config = $siteConfigObj->getInfo();
         $this->config = $site_config;
     } else {
         $this->config = $site_config;
     }
     if ($this->checkEmailConf($site_config)) {
         $phpMailerDir = IWEB_PATH . 'core/util/phpmailer/PHPMailerAutoload.php';
         include_once $phpMailerDir;
         //创建实例
         $this->smtp = new PHPMailer();
         $this->smtp->Timeout = 60;
         $this->smtp->SMTPSecure = $site_config['email_safe'];
         $this->smtp->isHTML();
         //使用系统mail函数发送
         if (isset($site_config['email_type']) && $site_config['email_type'] == '2') {
             $this->smtp->isMail();
         } else {
             $this->smtp->isSMTP();
             $this->smtp->SMTPAuth = true;
             $this->smtp->Host = $site_config['smtp'];
             $this->smtp->Port = $site_config['smtp_port'];
             $this->smtp->Username = $site_config['smtp_user'];
             $this->smtp->Password = $site_config['smtp_pwd'];
         }
     } else {
         $this->error = '配置参数填写不完整';
     }
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:32,代码来源:sendmail.php

示例11: common

 public function common($uid)
 {
     $result = array();
     $menuModel = new Menu();
     //顶部菜单/底部菜单
     for ($i = 1; $i < 7; $i++) {
         $sql = "select * from {{menu}} where sort = {$i} and position = 1 and userid = {$uid} and pid = 0 ";
         $data["upmenu_{$i}"] = $menuModel->findBySql($sql);
         $sql = "select * from {{menu}} where sort = {$i} and position = 2 and userid = {$uid} and pid = 0";
         $data["downmenu_{$i}"] = $menuModel->findBySql($sql);
     }
     //下拉菜单
     $sql = "select * from {{menu}} where pid = (select id from {{menu}} where position = 1 and userid = {$uid} and sort = 3 and pid = 0) and position = 1 and userid = {$uid} order by sort asc ";
     $data["uplistmenu_3"] = $menuModel->findAllBySql($sql);
     //视频列表
     $mvModel = new Mv();
     $sql = "select * from {{mv}} where userid = {$uid} order by sort asc ";
     $data['mvlist'] = $mvModel->findAllBySql($sql);
     //音乐列表
     //			$songModel = new Song();
     //			$sql = "select * from {{song}} where userid = $uid order by sort asc ";
     //			$data['musiclist'] = $songModel->findAllBySql($sql);
     //网站个性配置
     $webModel = new Config();
     $sql = "select * from {{webconfig}} where userid = {$uid} ";
     $data['webconfig'] = $webModel->findBySql($sql);
     $data['url'] = "http://" . Yii::app()->params['bucket'] . "." . Yii::app()->params['domain'] . "/";
     $data['uid'] = $uid;
     return $data;
 }
开发者ID:biggtfish,项目名称:A-Simple-CMS,代码行数:30,代码来源:Blog.php

示例12: callTimedEvents

 /**
  * Will call events as close as it gets to one hour. Event handlers
  * which use this MUST be as quick as possible, maybe only adding a
  * queue item to be handled later or something. Otherwise execution
  * will timeout for PHP - or at least cause unnecessary delays for
  * the unlucky user who visits the site exactly at one of these events.
  */
 public function callTimedEvents()
 {
     $timers = array('minutely' => 60, 'hourly' => 3600, 'daily' => 86400, 'weekly' => 604800);
     foreach ($timers as $name => $interval) {
         $run = false;
         $lastrun = new Config();
         $lastrun->section = 'cron';
         $lastrun->setting = 'last_' . $name;
         $found = $lastrun->find(true);
         if (!$found) {
             $lastrun->value = time();
             if ($lastrun->insert() === false) {
                 common_log(LOG_WARNING, "Could not save 'cron' setting '{$name}'");
                 continue;
             }
             $run = true;
         } elseif ($lastrun->value < time() - $interval) {
             $orig = clone $lastrun;
             $lastrun->value = time();
             $lastrun->update($orig);
             $run = true;
         }
         if ($run === true) {
             // such as CronHourly, CronDaily, CronWeekly
             Event::handle('Cron' . ucfirst($name));
         }
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:35,代码来源:cronish.php

示例13: Run

 function Run()
 {
     //Load config
     $config = new Config();
     $config->Load();
     $displayManager = new DisplayManager();
     //Create Login Manager
     $loginManager = new LoginManager();
     $loginManager->Load();
     $loginFail = false;
     if ($loginManager->WantLogin()) {
         $loginFail = !$loginManager->TryLogin();
         if (!$loginFail) {
             header('location: index.php');
         }
     }
     if ($loginManager->WantLogout()) {
         $loginManager->Logout();
     }
     if (isset($_GET['want']) and $_GET['want'] == 'logo') {
         $logo = new Logo();
         $logo->Generate();
         return;
     } elseif (isset($_GET['want']) and $_GET['want'] == 'source') {
         $displayManager->DisplaySource();
     } else {
         if ($loginManager->IsLogged()) {
             $imageManager = new ImageManager();
             $images = $imageManager->GetImages();
             $displayManager->DisplayImagesPage($images);
         } else {
             $displayManager->DisplayLoginPage($loginFail);
         }
     }
 }
开发者ID:niavok,项目名称:shrew-gallery,代码行数:35,代码来源:shrew.php

示例14: preload

 /**
  *
  */
 public function preload()
 {
     $this->load->model('pavblog/blog');
     $this->load->model('pavblog/comment');
     $this->load->model('tool/image');
     $mparams = $this->config->get('pavblog');
     $config = new Config();
     if ($mparams) {
         foreach ($mparams as $key => $value) {
             $config->set($key, $value);
         }
     }
     $this->mparams = $config;
     if ($this->mparams->get('comment_engine') == '' || $this->mparams->get('comment_engine') == 'local') {
     } else {
         $this->mparams->set('blog_show_comment_counter', 0);
         $this->mparams->set('cat_show_comment_counter', 0);
     }
     $this->language->load('module/pavblog');
     $this->load->model("pavblog/category");
     if (!defined("_PAVBLOG_MEDIA_")) {
         if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css')) {
             $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css');
         } else {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/pavblog.css');
         }
         define("_PAVBLOG_MEDIA_", true);
     }
 }
开发者ID:trunghieu11,项目名称:pavo_opencart,代码行数:32,代码来源:category.php

示例15: indexAction

 function indexAction()
 {
     $config_table = new Config();
     $modules_table = new Modules("core");
     $request = new Bolts_Request($this->getRequest());
     if ($request->has('modid')) {
         $modid = $request->modid;
     } else {
         $modid = 'bolts';
     }
     if ($this->_request->isPost()) {
         //we are posting
         $config_params = $this->_request->getParams();
         foreach ($config_params as $ckey => $value) {
             $data = array('value' => $value);
             $config_table->update($data, "ckey = '" . $ckey . "' and module='" . $modid . "'");
         }
         $this->view->success = $this->_T('Configuration Updated.');
         $config_table->cache();
         $params = array();
         $this->_Bolts_plugin->doAction($this->_mca . '_post_save', $params);
         // ACTION HOOK
     }
     $config = $config_table->fetchAll($config_table->select()->where('module = ?', $modid));
     if (count($config) > 0) {
         $config = $config->toArray();
         sort($config);
         $this->view->config = $config;
     }
     $modules = $modules_table->getEnabledModules();
     sort($modules);
     $this->view->modules = $modules;
     $this->view->current = $modid;
     $this->view->modid = $modid;
 }
开发者ID:jaybill,项目名称:Bolts,代码行数:35,代码来源:ConfigController.php


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