本文整理汇总了PHP中PH7\Framework\Config\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateJoinCom
/**
* Update the Affiliate Commission.
*
* @param integer $iAffId Affiliate ID
* @param object \PH7\Framework\Config\Config $oConfig
* @param object \PH7\Framework\Registry\Registry $oRegistry
* @return void
*/
public static function updateJoinCom($iAffId, Config $oConfig, Registry $oRegistry)
{
if ($iAffId < 1) {
return;
}
// If there is no valid ID, we stop the method.
// Load the Affiliate config file
$oConfig->load(PH7_PATH_SYS_MOD . 'affiliate' . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE);
$sType = $oRegistry->module == 'newsletter' ? 'newsletter' : ($oRegistry->module == 'affiliate' ? 'affiliate' : 'user');
$iAffCom = $oConfig->values['module.setting']['commission.join_' . $sType . '_money'];
if ($iAffCom > 0) {
(new AffiliateCoreModel())->updateUserJoinCom($iAffId, $iAffCom);
}
}
示例2: display
public static function display()
{
if (isset($_POST['submit_msg'])) {
if (\PFBC\Form::isValid($_POST['submit_msg'])) {
new MsgFormProcess();
}
Framework\Url\Header::redirect();
}
$oForumsId = (new ForumModel())->getForum();
$aForumsName = array();
foreach ($oForumsId as $oId) {
$aForumsName[$oId->forumId] = $oId->name;
}
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
$oForm = new \PFBC\Form('form_msg', '100%');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_msg', 'form_msg'));
$oForm->addElement(new \PFBC\Element\Token('msg'));
$oForm->addElement(new \PFBC\Element\Select(t('Forum:'), 'forum', $aForumsName, array('value' => (new Http())->get('forum_id'))));
$oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>'));
$oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('required' => 1, 'validation' => new \PFBC\Validation\Str(4))));
if (DbConfig::getSetting('isCaptchaForum')) {
$oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:'))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>'));
}
$oForm->addElement(new \PFBC\Element\Button());
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
$oForm->render();
}
示例3: display
public static function display()
{
if (isset($_POST['submit_membership'])) {
if (\PFBC\Form::isValid($_POST['submit_membership'])) {
new MembershipFormProcess();
}
Framework\Url\Header::redirect();
}
$oForm = new \PFBC\Form('form_membership', 600);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_membership', 'form_membership'));
$oForm->addElement(new \PFBC\Element\Token('membership'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name:'), 'name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 64))));
$oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('required' => 1, 'validation' => new \PFBC\Validation\Str(5, 255))));
$aPerms = (include dirname(__DIR__) . PH7_DS . PH7_CONFIG . 'perms.inc.php');
foreach ($aPerms as $sKey => $sVal) {
$sLabel = (new Str())->upperFirstWords(str_replace('_', ' ', $sKey));
$oForm->addElement(new \PFBC\Element\Select($sLabel, 'perms[' . $sKey . ']', array(1 => t('Yes'), 0 => t('No')), array('value' => $sVal)));
}
unset($aPerms);
$oForm->addElement(new \PFBC\Element\Number(t('Price:'), 'price', array('description' => t('Currency: %0%. 0 = Free. To change the currency, please <a href="%1%">go to settings</a>.', Config::getInstance()->values['module.setting']['currency'], Uri::get('payment', 'admin', 'config')), 'step' => '0.01', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Number(t('Expiration Days:'), 'expiration_days', array('description' => t('0 = Unlimited'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Radio(t('Active:'), 'enable', array(1 => t('Enabled'), 0 => t('Disabled')), array('value' => 1, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button(t('Add')));
$oForm->render();
}
示例4: display
public static function display()
{
if (isset($_POST['submit_edit_membership'])) {
if (\PFBC\Form::isValid($_POST['submit_edit_membership'])) {
new EditMembershipFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oMembership = (new PaymentModel())->getMemberships((new Http())->get('group_id', 'int'));
$oForm = new \PFBC\Form('form_edit_membership', 600);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_edit_membership', 'form_edit_membership'));
$oForm->addElement(new \PFBC\Element\Token('membership'));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name:'), 'name', array('value' => $oMembership->name, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 64))));
$oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('value' => $oMembership->description, 'required' => 1, 'validation' => new \PFBC\Validation\Str(5, 255))));
$aDefPerms = (include dirname(__DIR__) . '/config/perms.inc.php');
$aDbPerms = unserialize($oMembership->permissions);
$aPerms = array_merge($aDefPerms, $aDbPerms);
// Update new permissions from perms.inc.php file
foreach ($aPerms as $sKey => $sVal) {
$sLabel = (new Str())->upperFirstWords(str_replace('_', ' ', $sKey));
$oForm->addElement(new \PFBC\Element\Select($sLabel, 'perms[' . $sKey . ']', array(1 => t('Yes'), 0 => t('No')), array('value' => $sVal)));
}
unset($aPerms);
$oForm->addElement(new \PFBC\Element\Number(t('Price:'), 'price', array('description' => t('Currency: %0%. 0 = Free. To change the currency, please <a href="%1%">go to settings</a>.', Config::getInstance()->values['module.setting']['currency'], Uri::get('payment', 'admin', 'config')), 'value' => $oMembership->price, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Number(t('Expiration Days:'), 'expiration_days', array('description' => t('0 = Unlimited'), 'value' => $oMembership->expirationDays, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Radio(t('Active:'), 'enable', array(1 => t('Enabled'), 0 => t('Disabled')), array('value' => $oMembership->enable, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button(t('Update')));
$oForm->render();
}
示例5: display
public static function display()
{
if (isset($_POST['submit_edit'])) {
if (\PFBC\Form::isValid($_POST['submit_edit'])) {
new AdminEditFormProcess();
}
Framework\Url\HeaderUrl::redirect();
}
$oHttpRequest = new Http();
$oGameModel = new GameModel();
$iGameId = $oHttpRequest->get('id', 'int');
$oGame = $oGameModel->get(strstr($oHttpRequest->get('title'), '-', true), $iGameId, 0, 1);
$oCategoriesData = $oGameModel->getCategory(null, 0, 500);
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->name;
}
unset($oHttpRequest, $oGameModel);
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
if (!empty($oGame) && (new Str())->equals($iGameId, $oGame->gameId)) {
$oForm = new \PFBC\Form('form_edit', 650);
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_edit', 'form_edit'));
$oForm->addElement(new \PFBC\Element\Token('edit'));
$oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('value' => $oGame->categoryId, 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('value' => $oGame->name, 'pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('value' => $oGame->title, 'validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('value' => $oGame->description, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('value' => $oGame->keywords, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
} else {
echo '<p class="center bold">' . t('Game Not Found!') . '</p>';
}
}
示例6: display
public static function display()
{
if (isset($_POST['submit_game'])) {
if (\PFBC\Form::isValid($_POST['submit_game'])) {
new AdminFormProcess();
}
Framework\Url\Header::redirect();
}
$oCategoriesData = (new GameModel())->getCategory(null, 0, 500);
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->name;
}
unset($oCategoriesData);
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
$oForm = new \PFBC\Form('form_game');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_game', 'form_game'));
$oForm->addElement(new \PFBC\Element\Token('game'));
$oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\File(t('Thumbnail of the Game:'), 'thumb', array('accept' => 'image/*', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\File(t('File of the Game:'), 'file', array('accept' => 'application/x-shockwave-flash', 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->render();
}
示例7: __construct
public function __construct()
{
$this->_sYuiCompressorPath = realpath(__DIR__) . '/Compiler/YUICompressor-2.4.7.jar';
$this->_sClosureCompilerPath = realpath(__DIR__) . '/Compiler/ClosureCompiler.jar';
$this->_sTmpFilePath = PH7_PATH_TMP . PH7_DS . uniqid() . '.tmp';
$this->_bJavaCompiler = (bool) Config::getInstance()->values['cache']['enable.static.minify_use_java_compiler'];
}
示例8: display
public static function display()
{
if (isset($_POST['submit_forum'])) {
if (\PFBC\Form::isValid($_POST['submit_forum'])) {
new ForumFormProcess();
}
Framework\Url\Header::redirect();
}
$oCategoriesData = (new ForumModel())->getCategory();
$aCategoriesName = array();
foreach ($oCategoriesData as $oId) {
$aCategoriesName[$oId->categoryId] = $oId->title;
}
unset($oCategoriesData);
$sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern'];
$oForm = new \PFBC\Form('form_forum', '100%');
$oForm->configure(array('action' => ''));
$oForm->addElement(new \PFBC\Element\Hidden('submit_forum', 'form_forum'));
$oForm->addElement(new \PFBC\Element\Token('forum'));
$oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('value' => (new Http())->get('category_id'), 'required' => 1)));
$oForm->addElement(new \PFBC\Element\Textbox(t('Forum Name:'), 'name', array('id' => 'str_name', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_name"></span>'));
$oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('id' => 'str_description', 'required' => 1, 'onblur' => 'CValid(this.value,this.id,4,255)', 'validation' => new \PFBC\Validation\Str(4, 255))));
$oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_description"></span>'));
$oForm->addElement(new \PFBC\Element\Button());
$oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>'));
$oForm->render();
}
示例9: render
public function render()
{
$this->attributes['type'] = 'tel';
// Phone type
$this->attributes['pattern'] = Config::getInstance()->values['validate']['phone.pattern'];
$this->validation[] = new \PFBC\Validation\Phone();
parent::render();
}
示例10: __construct
public function __construct()
{
$this->_oFile = new File();
$this->_oHttpRequest = new HttpRequest();
$this->_bCaching = (bool) Config::getInstance()->values['cache']['enable.static.caching'];
$this->_bCompressor = (bool) Config::getInstance()->values['cache']['enable.static.compressor'];
$this->_bGzipContent = (bool) Config::getInstance()->values['cache']['enable.static.gzip'];
$this->_bDataUri = (bool) Config::getInstance()->values['cache']['enable.static.data_uri'];
$this->_bIsGzip = $this->isGzip();
}
示例11: __construct
public function __construct()
{
$this->_oHttpRequest = new Http();
$this->_oFile = new F\File();
$this->_oConfig = Config::getInstance();
$this->_sHtml = '';
// Default HTML contents
$this->_sVerNumber = '...';
// Default value of the version number upgrade
$this->_prepare();
// Preparation and verification for software upgrade
}
示例12: __construct
/**
* @constructor
* @param array $aFile Example: $_FILES['video']
* @return void
* @throws \PH7\Framework\File\Exception If FFmpeg is not installed.
*/
public function __construct($aFile)
{
$this->oFile = new F\File();
$this->sFfmpegPath = Config::getInstance()->values['video']['handle.ffmpeg_path'];
if (!file_exists($this->sFfmpegPath)) {
throw new F\File\Exception('FFmpeg is not installed on your server, please install and configure the path in "~/YOUR-PROTECTED-FOLDER/app/configs/config.ini"');
}
$this->aFile = $aFile;
$this->sType = $this->oFile->getFileExt($this->aFile['name']);
/** Attributes for the PH7\Framework\File\Upload abstract class **/
$this->sMaxSize = Config::getInstance()->values['video']['upload.max_size'];
$this->iFileSize = (int) $this->aFile['size'];
}
示例13: __construct
/**
* @return void
*/
public function __construct()
{
parent::__construct();
// Import the library
Import::lib('Service.Twitter.tmhOAuth');
Import::lib('Service.Twitter.tmhUtilities');
$this->_oTwOAuth = new \tmhOAuth(Config::getInstance()->values['module.api']['twitter.consumer_key'], Config::getInstance()->values['module.api']['twitter.consumer_secret_key']);
// determine the authentication status
// default to 0
$this->_iState = 0;
if (isset($_COOKIE['access_token'], $_COOKIE['access_token_secret'])) {
// 2 (authenticated) if the cookies are set
$this->_iState = 2;
} elseif (isset($_SESSION['authstate'])) {
// otherwise use value stored in session
$this->_iState = (int) $_SESSION['authstate'];
}
if ($this->_iState == 1) {
// if we are in the process of authentication we continue
$this->auth();
} elseif ($this->_iState == 2 && !$this->auth()) {
// verify authentication, clearing cookies if it fails
$this->endSession();
}
if ($this->auth()) {
$aProfile = $this->_oTwOAuth->extract_params($this->_oTwOAuth->response['response']);
if (empty($aProfile['error'])) {
// User info is ok? Here we will be connect the user and/or adding the login and registering routines...
$oUserModel = new UserCoreModel();
if (!($iId = $oUserModel->getId($aProfile['email']))) {
// Add User if it does not exist in our database
$this->add(escape($aProfile, true), $oUserModel);
// Add User Avatar
$this->setAvatar($aProfile);
$this->oDesign->setFlashMsg(t('You have now been registered! %0%', (new Registration())->sendMail($this->_aUserInfo, true)->getMsg()));
$this->sUrl = Uri::get('connect', 'main', 'register');
} else {
// Login
$this->setLogin($iId, $oUserModel);
$this->sUrl = Uri::get('connect', 'main', 'home');
}
unset($oUserModel);
} else {
// For testing purposes, if there was an error, let's kill the script
$this->oDesign->setFlashMsg(t('Oops! An error has occurred. Please try again later.'));
$this->sUrl = Uri::get('connect', 'main', 'index');
}
} else {
$this->sUrl = Uri::get('connect', 'main', 'index');
}
}
示例14: back
/**
* Makes a SQL contents backup.
*
* @access public
* @return object this
*/
public function back()
{
$this->_sSql = "#################### Database Backup ####################\n" . '# ' . Kernel::SOFTWARE_NAME . ' ' . Kernel::SOFTWARE_VERSION . ', Build ' . Kernel::SOFTWARE_BUILD . "\r\n" . '# Database name: ' . Config::getInstance()->values['database']['name'] . "\r\n" . '# Created on ' . (new CDateTime())->get()->dateTime() . "\r\n" . "#########################################################\r\n\r\n";
$aTables = $aColumns = $aValues = array();
$oAllTables = Db::showTables();
while ($aRow = $oAllTables->fetch()) {
$aTables[] = $aRow[0];
}
unset($oAllTables);
$oDb = Db::getInstance();
// Loop through tables
foreach ($aTables as $sTable) {
$oResult = $oDb->query('SHOW CREATE TABLE ' . $sTable);
$iNum = (int) $oResult->rowCount();
if ($iNum > 0) {
$aRow = $oResult->fetch();
$this->_sSql .= "#\n# Table: {$sTable}\r\n#\r\n\r\n";
$this->_sSql .= "DROP TABLE IF EXISTS {$sTable};\r\n\r\n";
$sValue = $aRow[1];
/*** Clean up statement ***/
$sValue = str_replace('`', '', $sValue);
/*** Table structure ***/
$this->_sSql .= $sValue . ";\r\n\r\n";
unset($aRow);
}
unset($oResult);
$oResult = $oDb->query('SELECT * FROM ' . $sTable);
$iNum = (int) $oResult->rowCount();
if ($iNum > 0) {
while ($aRow = $oResult->fetch()) {
foreach ($aRow as $sColumn => $sValue) {
if (!is_numeric($sColumn)) {
if (!is_numeric($sValue) && !empty($sValue)) {
$sValue = Db::getInstance()->quote($sValue);
}
$sValue = str_replace(array("\r", "\n"), array('', '\\n'), $sValue);
$aColumns[] = $sColumn;
$aValues[] = $sValue;
}
}
$this->_sSql .= 'INSERT INTO ' . $sTable . ' (' . implode(', ', $aColumns) . ') VALUES(\'' . implode('\', \'', $aValues) . "');\n";
unset($aColumns, $aValues);
}
$this->_sSql .= "\r\n\r\n";
unset($aRow);
}
unset($oResult);
}
unset($oDb);
return $this;
}
示例15: __construct
public function __construct()
{
$this->_oConfig = Config::getInstance();
$oCookie = new Cookie();
// Check a template name has been entered and if it exceeds the maximum length (49 characters).
if (!empty($_REQUEST['tpl']) && strlen($_REQUEST['tpl']) < 50) {
$this->_sUserTpl = $_REQUEST['tpl'];
$oCookie->set('site_tpl', $this->_sUserTpl, 60 * 60 * 48);
} else {
if ($oCookie->exists('site_tpl')) {
$this->_sUserTpl = $oCookie->get('site_tpl');
}
}
unset($oCookie);
}