本文整理汇总了PHP中settings函数的典型用法代码示例。如果您正苦于以下问题:PHP settings函数的具体用法?PHP settings怎么用?PHP settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:bbashy,项目名称:LaraBin,代码行数:30,代码来源:SettingsController.php
示例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));
}
开发者ID:nganhtuan63,项目名称:gxc-cms,代码行数:28,代码来源:SettingsWidget.php
示例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]);
}
开发者ID:linhntaim,项目名称:katniss,代码行数:7,代码来源:Extension.php
示例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();
}
}
开发者ID:huludini,项目名称:pw-web,代码行数:34,代码来源:DonateController.php
示例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'));
});
}
开发者ID:huludini,项目名称:aura-kingdom-web,代码行数:32,代码来源:ViewServiceProvider.php
示例6: theme_url
function theme_url($path = null)
{
if (null == $path) {
return url(settings('theme_folder'));
}
return url(settings('theme_folder') . $path);
}
开发者ID:amitavroy,项目名称:mywall,代码行数:7,代码来源:helpers.php
示例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('[email protected]', 'Amitav Roy');
$m->to($data['mailData']['user']->email)->subject('Welcome to ' . settings('site_name'));
});
}
开发者ID:amitavroy,项目名称:mywall,代码行数:12,代码来源:EloquentMail.php
示例8: __construct
public function __construct()
{
parent::__construct();
$db_config = settings('db_config');
$this->_table_prefix = $db_config['table_prefix'];
$this->load->database($db_config);
}
开发者ID:guozanhua,项目名称:miniGameServer,代码行数:7,代码来源:MY_Model.php
示例9: get
public function get($key)
{
if (!isset($settings[$key])) {
return null;
}
return settings($key);
}
开发者ID:NerisFR,项目名称:portail,代码行数:7,代码来源:config.php
示例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;
}
}
开发者ID:exts,项目名称:nab145,代码行数:33,代码来源:ACP.php
示例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.'));
}
}
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:33,代码来源:SettingsWidget.php
示例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('[email protected]', 'Spice Island Charter');
//$message->from('[email protected]', '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!');
}
}
开发者ID:hilmysyarif,项目名称:sic,代码行数:30,代码来源:ContactController.php
示例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'));
}
开发者ID:dasklney,项目名称:traq,代码行数:38,代码来源:questions.php
示例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();
}
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:34,代码来源:userRegistration.php
示例15: __construct
private function __construct()
{
$settings = settings();
$this->type = $settings->getNumberFormat();
$this->currencyCode = $settings->getCurrency();
$this->modeNormal();
}
开发者ID:linhntaim,项目名称:katniss,代码行数:7,代码来源:NumberFormatHelper.php
示例16: __construct
public function __construct()
{
parent::__construct();
$login_check_url = settings('anysdk_login_url');
if ($login_check_url) {
$this->_loginCheckUrl = $login_check_url;
}
}
开发者ID:guozanhua,项目名称:miniGameServer,代码行数:8,代码来源:user.php
示例17: postBalance
public function postBalance(Request $request, User $user)
{
$this->validate($request, ['amount' => 'required|numeric']);
$user->money = $user->money + $request->amount;
$user->save();
flash()->success(trans('members.success', ['user' => $user->name, 'count' => $request->amount, 'currency' => strtolower(settings('currency_name'))]));
return redirect()->back();
}
开发者ID:huludini,项目名称:pw-web,代码行数:8,代码来源:MembersController.php
示例18: onCreate
/**
* Raising the event when a new user is created.
*
* @param Created $event
*/
public function onCreate(Created $event)
{
$this->logger->log('A new user was create');
if (settings('send_password_through_mail') == "true") {
$event->sendUserCreationEmail($this->mail);
$this->logger->log('User registration mail was sent.');
}
}
开发者ID:amitavroy,项目名称:mywall,代码行数:13,代码来源:UserEventSubscriber.php
示例19: yearOptions
public function yearOptions($emptyText = null)
{
$years = collect(array_combine($range = range(date('Y'), settings('app.min_year', 2000)), $range));
if ($emptyText) {
$years->prepend($emptyText, 0);
}
return $years;
}
开发者ID:javanlabs,项目名称:siparti,代码行数:8,代码来源:FaseRepositoryEloquent.php
示例20: getLogin
/**
* Show the application login form
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getLogin()
{
if (Auth::user()) {
return redirect()->route('dashboard');
}
$validator = JsValidator::make($this->loginValidationRules);
return view(settings('theme_folder') . 'user/login', compact('validator'));
}
开发者ID:amitavroy,项目名称:mywall,代码行数:13,代码来源:AuthController.php
注:本文中的settings函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论