當前位置: 首頁>>代碼示例>>PHP>>正文


PHP settings函數代碼示例

本文整理匯總了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();
 }
開發者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('amitav.roy@focalworks.in', '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('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!');
     }
 }
開發者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


注:本文中的settings函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。