本文整理汇总了PHP中settings函数的典型用法代码示例。如果您正苦于以下问题:PHP settings函数的具体用法?PHP settings怎么用?PHP settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update(Requests\Auth\UpdateUser $request)
{
// Update Password
if ($request->has('new_password')) {
// Check if user has an existing password - GitHub users will not
if (auth()->user()->getAuthPassword() && !$request->has('current_password')) {
session()->flash('error', 'You must supply your current password!');
return redirect()->back()->withInput();
}
// Check if existing password is correct
if (auth()->user()->getAuthPassword() && !Hash::check($request->input('current_password'), auth()->user()->getAuthPassword())) {
session()->flash('error', 'Your current password is incorrect!');
return redirect()->back()->withInput();
}
}
$website = $request->has('website') && trim($request->input('website')) != '' ? $request->input('website') : null;
$github_username = $request->has('github_username') && trim($request->input('github_username')) != '' ? $request->input('github_username') : null;
$twitter_username = $request->has('twitter_username') && trim($request->input('twitter_username')) != '' ? $request->input('twitter_username') : null;
$user = User::find(auth()->user()->getAuthIdentifier());
$user->name = $request->input('name');
$user->username = $request->input('username');
$user->email = $request->input('email');
if ($request->has('new_password')) {
$user->password = bcrypt($request->input('new_password'));
}
$user->save();
settings()->setMany(['website' => $website, 'github_username' => $github_username, 'twitter_username' => $twitter_username]);
session()->flash('success', 'Account updated successfully!');
return redirect()->back();
}
示例2: showGeneralForm
protected function showGeneralForm()
{
$model = new SettingGeneralForm();
settings()->deleteCache();
//Set Value for the Settings
$model->site_name = Yii::app()->settings->get('general', 'site_name');
$model->site_title = Yii::app()->settings->get('general', 'site_title');
$model->site_description = Yii::app()->settings->get('general', 'site_description');
$model->slogan = Yii::app()->settings->get('general', 'slogan');
$model->homepage = Yii::app()->settings->get('general', 'homepage');
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'settings-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['SettingGeneralForm'])) {
$model->attributes = $_POST['SettingGeneralForm'];
if ($model->validate()) {
settings()->deleteCache();
foreach ($model->attributes as $key => $value) {
Yii::app()->settings->set('general', $key, $value);
}
user()->setFlash('success', t('General Settings Updated Successfully!'));
}
}
$this->render('cmswidgets.views.settings.settings_general_widget', array('model' => $model));
}
示例3: __init
protected function __init()
{
parent::__init();
// TODO: Change the autogenerated stub
$this->mainCurrencyCode = settings()->getCurrency();
$this->exchangeRates = defPr($this->getProperty('exchange_rates'), ['USD' => 1, 'VND' => 22270]);
}
示例4: getPaymentWall
/**
* Process the PaymentWall payment
*
* @param Request $request
*/
public function getPaymentWall(Request $request)
{
$pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
if ($pingback->validate()) {
$virtualCurrency = $pingback->getVirtualCurrencyAmount();
$user = User::find($request->uid);
if (settings('paymentwall_double')) {
$n_credits = $virtualCurrency * 2;
} else {
$n_credits = $virtualCurrency;
}
if ($pingback->isDeliverable()) {
// Give credits to user
$user->money = $user->money + $n_credits;
$user->save();
Payment::create(['user_id' => $user->ID, 'transaction_id' => $request->ref, 'amount' => $n_credits]);
} elseif ($pingback->isCancelable()) {
// Remove credits from user
$user->money = $user->money + $n_credits;
$user->save();
$payment = Payment::find($request->ref);
$payment->delete();
}
echo 'OK';
// Paymentwall expects response to be OK, otherwise the pingback will be resent
} else {
echo $pingback->getErrorSummary();
}
}
示例5: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
view()->composer(['front.header', 'admin.header'], function ($view) {
$languages = [];
$folders = File::directories(base_path('resources/lang/'));
foreach ($folders as $folder) {
$languages[] = str_replace('\\', '', last(explode('/', $folder)));
}
$view->with('languages', $languages);
});
view()->composer('front.header', function ($view) {
$apps = Application::all();
$view->with('apps', $apps);
});
view()->composer('admin.news.form', function ($view) {
$categories = ['update' => trans('news.category.update'), 'maintenance' => trans('news.category.maintenance'), 'event' => trans('news.category.event'), 'contest' => trans('news.category.contest'), 'other' => trans('news.category.other')];
$view->with('categories', $categories);
});
view()->composer('front.widgets', function ($view) {
$client_status = @fsockopen(settings('server_ip', '127.0.0.1'), 6543, $errCode, $errStr, 1) ? TRUE : FALSE;
$worlds = DB::connection('account')->table('worlds')->get();
$view->with('client_status', $client_status)->with('worlds', $worlds);
});
view()->composer('admin.donate.settings', function ($view) {
$view->with('currencies', trans('donate.currency'));
});
}
示例6: theme_url
function theme_url($path = null)
{
if (null == $path) {
return url(settings('theme_folder'));
}
return url(settings('theme_folder') . $path);
}
示例7: sendMail
/**
* Sending the actual email
*
* @param array $data
*/
public function sendMail(array $data)
{
SendMailService::send($data['view'], ['pass' => $data['mailData']['pass'], 'user' => $data['mailData']['user']], function ($m) use($data) {
$m->from('amitav.roy@focalworks.in', 'Amitav Roy');
$m->to($data['mailData']['user']->email)->subject('Welcome to ' . settings('site_name'));
});
}
示例8: __construct
public function __construct()
{
parent::__construct();
$db_config = settings('db_config');
$this->_table_prefix = $db_config['table_prefix'];
$this->load->database($db_config);
}
示例9: get
public function get($key)
{
if (!isset($settings[$key])) {
return null;
}
return settings($key);
}
示例10: acp_run
function acp_run()
{
global $logged;
switch ($_GET['action']) {
case "test":
return "\n\t\t\t\t\t<table width='100%' cellspacing='3' cellpadding='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='80%'><strong>Category Name</strong></td>\n\t\t\t\t\t\t\t<td width='20%'><a href='#'>Edit</a> <a href='#'>Delete</a></td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a>, <a href='#'>Forum 1</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='80%'><strong>Category Name</strong></td>\n\t\t\t\t\t\t\t<td width='20%'><a href='#'>Edit</a> <a href='#'>Delete</a></td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><a href='#'>Forum 1</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t";
break;
case "editusergroup":
return edit_groups();
break;
case "boards":
return manageboards();
break;
case "edituser":
return editusers();
break;
case "adduser":
return adduser();
break;
case "newcat":
return addcat();
break;
case "newforum":
return newforum();
break;
case "config":
return settings();
break;
default:
return acp_home();
break;
}
}
示例11: renderContent
protected function renderContent()
{
$settings = GxcHelpers::getAvailableSettings();
$type = isset($_GET['type']) ? strtolower(plaintext($_GET['type'])) : 'general';
if (array_key_exists($type, $settings)) {
//Import the Setting Class
Yii::import('common.settings.' . $type . '.' . $settings[$type]['class']);
$model = new $settings[$type]['class']();
foreach ($model->attributes as $attr => $value) {
$model->{$attr} = Yii::app()->settings->get($type, $attr);
}
settings()->deleteCache();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === $type . '-settings-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST[$settings[$type]['class']])) {
settings()->deleteCache();
$model->attributes = $_POST[$settings[$type]['class']];
if ($model->validate()) {
foreach ($model->attributes as $key => $value) {
Yii::app()->settings->set($type, $key, $value);
}
user()->setFlash('success', t('cms', 'Settings Updated Successfully!'));
}
}
$this->render('common.settings.' . $type . '.' . $settings[$type]['layout'], array('model' => $model));
} else {
throw new CHttpException(404, t('cms', 'The requested page does not exist.'));
}
}
示例12: postIndex
public function postIndex()
{
//Get all the data and store it inside Store Variable
$data = Input::all();
//Validation rules
$rules = array('name' => 'required', 'email' => 'required|email', 'message' => 'required|min:5');
//Validate data
$validator = Validator::make($data, $rules);
//If everything is correct than run passes.
if ($validator->fails()) {
return Redirect::route('contact')->with('error', 'Feedback must contain more than 5 characters. Try Again.');
//return View::make('contact');
} else {
//return contact form with errors
$name = Input::get('name');
$email = Input::get('email');
$phone = Input::get('phone');
$subject = Input::get('subject');
$messages = Input::get('message');
$data = array('name' => $name, 'email' => $email, 'phone' => $phone, 'subject' => $subject, 'messages' => $messages);
Mail::send('frontend.contact.contact', $data, function ($message) use($data) {
$message->from('postmaster@sandbox13034b6f6e54467692ea98652f27e85d.mailgun.org', 'Spice Island Charter');
//$message->from('feedback@gmail.com', 'feedback contact form');
//email 'To' field: cahnge this to emails that you want to be notified.
$message->to(settings('email'), 'Spice Island Charter')->subject('Inquiry');
});
// Redirect to page
return Redirect::route('contact')->with('message', 'Your message has been sent. Thank You!');
}
}
示例13: action_index
/**
* Question management page.
*/
public function action_index()
{
// Set page title
$this->title(l('security_questions'));
// Extract questions
$questions = json_decode(settings('security_questions'), true);
// Add an empty question
if (!count($questions)) {
$questions[] = array('question' => '', 'answers' => '');
}
// Check if the form has been submitted
$errors = array();
if (Request::method() == 'post') {
// Process questions
$updated_questions = array();
foreach (Request::$post['questions'] as $id => $question) {
// Check fields
foreach ($question as $field => $value) {
if (empty($value)) {
$errors[$id][$field] = true;
}
}
// Add if no errors
if (!isset($errors[$id])) {
$updated_questions[] = $question;
}
}
// Save and redirect
if (!count($errors)) {
$this->db->update('settings')->set(array('value' => json_encode($updated_questions)))->where('setting', 'security_questions')->exec();
Request::redirect(Request::requestUri());
}
}
View::set(compact('questions', 'errors'));
}
示例14: userRegistration
/**
* This function is beign used to change the users emailaddress info.
* It will first check if the user who executed this function is the person of whom the emailaddress is or if it's a mod/admin. If this is not the case the page will be redirected to an error page.
* The emailaddress will be validated first. If the checking was successful the email will be updated and the settings template will be reloaded. Errors made by invalid data will be shown
* also after reloading the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function userRegistration()
{
try {
//if logged in
if (WebUsers::isLoggedIn()) {
$dbl = new DBLayer("lib");
$dbl->update("settings", array('Value' => $_POST['userRegistration']), "`Setting` = 'userRegistration'");
$result['target_id'] = $_GET['id'];
global $SITEBASE;
require_once $SITEBASE . '/inc/settings.php';
$pageElements = settings();
$pageElements = array_merge(settings(), $result);
$pageElements['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
// pass error and reload template accordingly
helpers::loadtemplate('settings', $pageElements);
throw new SystemExit();
} else {
//ERROR: user is not logged in
header("Location: index.php");
throw new SystemExit();
}
} catch (PDOException $e) {
//go to error page or something, because can't access website db
print_r($e);
throw new SystemExit();
}
}
示例15: __construct
private function __construct()
{
$settings = settings();
$this->type = $settings->getNumberFormat();
$this->currencyCode = $settings->getCurrency();
$this->modeNormal();
}