當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。