当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::getSetting方法代码示例

本文整理汇总了PHP中Setting::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getSetting方法的具体用法?PHP Setting::getSetting怎么用?PHP Setting::getSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPointsTrade

 public function addPointsTrade($user_id, $amount_fee, $trade_id, $wallet_init)
 {
     $logFile = 'points.log';
     Log::useDailyFiles(storage_path() . '/logs/points/' . $logFile);
     $setting = new Setting();
     $balance = new Balance();
     $wallet = wallet::where('type', 'POINTS')->first();
     $user = User::find($user_id);
     Log::info("\n" . '------------------------- Add Point Trade -----------------------------');
     Log::info("\n" . 'amount_fee ' . $amount_fee . ' . trade_id: ' . $trade_id . " -- wallet_init: " . $wallet_init);
     if (isset($wallet->id)) {
         $point_per_btc = $setting->getSetting('point_per_btc', 1);
         $percent_point_reward_trade = $setting->getSetting('percent_point_reward_trade', 0);
         $percent_point_reward_referred_trade = $setting->getSetting('percent_point_reward_referred_trade', 0);
         Log::info("\n" . 'Setting -- point_per_btc: ' . $point_per_btc . ' . percent_point_reward_trade: ' . $percent_point_reward_trade . " % -- percent_point_reward_referred_trade: " . $percent_point_reward_referred_trade . " %");
         //cong point cho $user_id
         if ($percent_point_reward_trade > 0) {
             $amount_reward = $amount_fee * $percent_point_reward_trade / 100;
             $point_reward = $amount_reward / $point_per_btc;
             Log::info("\n" . 'Add point for ' . $user->username . ' . amount_reward: ' . $amount_reward . " BTC -- point_reward: " . $point_reward . " POINTS");
             if ($point_reward > 0) {
                 $balance->addMoney($point_reward, $wallet->id, $user->id);
                 $deposit = new Deposit();
                 $deposit->user_id = $user->id;
                 $deposit->wallet_id = $wallet->id;
                 $deposit->amount = $point_reward;
                 $deposit->paid = 1;
                 $deposit->transaction_id = "Points earned from trade " . $trade_id;
                 $deposit->save();
             }
         }
         //cong point cho nguoi da gioi thieu $user_id nay neu co
         if (!empty($user->referral) && $percent_point_reward_referred_trade > 0) {
             $user_referred = User::where('username', $user->referral)->first();
             if (!empty($user_referred)) {
                 $amount_reward = $amount_fee * $percent_point_reward_referred_trade / 100;
                 $point_reward = $amount_reward / $point_per_btc;
                 Log::info("user_referred AAAAAAAAA: ", $user_referred);
                 Log::info("\n" . 'Add point for user referred: ' . $user_referred->username . ' . amount_reward: ' . $amount_reward . " BTC -- point_reward: " . $point_reward . " POINTS");
                 if ($point_reward > 0) {
                     $balance->addMoney($point_reward, $wallet->id, $user_referred->id);
                     $deposit = new Deposit();
                     $deposit->user_id = $user_referred->id;
                     $deposit->wallet_id = $wallet->id;
                     $deposit->amount = $point_reward;
                     $deposit->paid = 1;
                     $deposit->transaction_id = "Points earned from User " . $user->username . "( Trade: " . $trade_id . ")";
                     $deposit->save();
                 }
             }
         }
     } else {
         Log::info("\n" . 'No wallet POINTS');
     }
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:55,代码来源:PointsController.php

示例2: compare

 public function compare()
 {
     // get a list of all months:
     $months = array();
     $first = BaseController::getFirst();
     $first->modify('first day of this month midnight');
     $today = new Carbon('now');
     $today->modify('first day of this month midnight');
     $prev = clone $today;
     $prev->sub(new DateInterval('P2D'));
     $prev->modify('first day of this month midnight');
     while ($first <= $today) {
         $index = $first->format('Y-m-d');
         $months[$index] = $first->format('F Y');
         $first->add(new DateInterval('P1M'));
     }
     // account list:
     $accs = Auth::user()->accounts()->get();
     $accounts = array(0 => '(all accounts)');
     foreach ($accs as $acc) {
         $accounts[intval($acc->id)] = Crypt::decrypt($acc->name);
     }
     $account = Setting::getSetting('defaultCheckingAccount');
     return View::make('pages.compare')->with('months', $months)->with('thisMonth', $today)->with('prevMonth', $prev)->with('account', $account)->with('accounts', $accounts);
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:25,代码来源:PageController.php

示例3: getHome

 public function getHome()
 {
     $key = cacheKey('home', Session::get('period'));
     if (Cache::has($key)) {
         $data = Cache::get($key);
     } else {
         $max = 0;
         $min = 1000000;
         $data = array('accounts' => array(), 'budgets' => array(), 'targets' => array());
         // we need this list:
         $accounts = Auth::user()->accounts()->get();
         foreach ($accounts as $a) {
             $account = array('id' => intval($a->id), 'name' => Crypt::decrypt($a->name), 'currentbalance' => $a->balance());
             $account['header'] = $account['currentbalance'] < 0 ? array('style' => 'color:red;', 'class' => 'tt', 'title' => $account['name'] . ' has a balance below zero. Try to fix this.') : array();
             $min = $account['currentbalance'] < $min ? $account['currentbalance'] : $min;
             $max = $account['currentbalance'] > $max ? $account['currentbalance'] : $max;
             $data['accounts'][] = $account;
         }
         $min = $min > 0 ? 0 : $min;
         $max = $max < 0 ? 0 : $max;
         $min = floor($min / 1000) * 1000;
         $max = ceil($max / 1000) * 1000;
         $sum = 0;
         foreach ($data['accounts'] as $index => $account) {
             $sum += $account['currentbalance'];
         }
         $data['acc_data']['sum'] = $sum;
         // now everything for budgets:
         $data['budgets'] = Budget::getHomeOverview();
         // some extra budget data:
         $monthlyAmount = Setting::getSetting('monthlyAmount', Session::get('period')->format('Y-m-') . '01');
         if (is_null($monthlyAmount)) {
             $monthlyAmount = intval(Setting::getSetting('defaultAmount'));
         }
         $data['budget_data']['amount'] = $monthlyAmount;
         $data['budget_data']['spent_outside'] = floatval(Auth::user()->transactions()->where('amount', '<', 0)->whereNull('budget_id')->where(DB::Raw('DATE_FORMAT(`date`,"%m-%Y")'), '=', Session::get('period')->format('m-Y'))->sum('amount')) * -1;
         // targets, cant make it better im afraid.
         $data['targets'] = Target::getHomeOverview();
         Cache::put($key, $data, 2440);
     }
     // flash some warnings:
     if (Auth::user()->transactions()->count() == 0) {
         Session::flash('warning', 'There are no transactions saved yet. Create some to make this overview less boring (Create &rarr; New transaction).');
     }
     if (count($data['budgets']) == 0) {
         Session::flash('warning', 'You don\'t have any budgets defined.');
     }
     if (count($data['accounts']) == 0) {
         Session::flash('warning', 'You do not have any accounts added. You should do this first (Create &rarr; New account)');
     }
     if (Holmes::isMobile()) {
         return View::make('mobile.home.home')->with('data', $data);
     } else {
         return View::make('home.home')->with('data', $data);
     }
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:56,代码来源:HomeController.php

示例4: connect

 /**
  * connect to the remote server
  * @return bool|\Net_SSH2
  */
 private function connect()
 {
     $ssh = new \Net_SSH2(Setting::getSetting('remote:host'));
     $key = new Crypt_RSA();
     $key->loadKey(file_get_contents(Setting::getSetting('ssh:priv_key')));
     if (!$ssh->login(Setting::getSetting('remote:user'), $key)) {
         $cli = new CLImate();
         $cli->error("Could not connect to server");
         return false;
     }
     return $ssh;
 }
开发者ID:VonUniGE,项目名称:consh,代码行数:16,代码来源:SSHConnection.php

示例5: exportDB

 /**
  * dumps the contents of the local database out to a file
  *
  * @param string $file_name the name of the file to save the data to. This should be the full path name
  *
  * @return the result of the shell_exec command
  */
 public function exportDB($file_name)
 {
     $host = Setting::getSetting('local-mysql:host');
     $user = Setting::getSetting('local-mysql:user');
     $pass = Setting::getSetting('local-mysql:pass');
     $db = Setting::getSetting('local-mysql:db');
     if (!empty($pass)) {
         $pass = " -p" . $pass;
     }
     $command = 'mysqldump -h ' . $host . ' -u ' . $user . $pass . ' ' . $db . " > " . $file_name;
     return shell_exec($command);
 }
开发者ID:VonUniGE,项目名称:consh,代码行数:19,代码来源:LocalDB.php

示例6: postAddTarget

 /**
  * Handles adding a new target to an existing rule.
  * @param int $id The ID of the rule of which to add the new target too.
  */
 public function postAddTarget($id)
 {
     // we'll first validate the data before continueing...
     $validator = Validator::make(array('target address' => Input::get('target'), 'max fails' => Input::get('maxfails'), 'fail timeout' => Input::get('failtimeout'), 'weight' => Input::get('weight')), array('target address' => array('required'), 'max fails' => array('integer', 'required'), 'fail timeout' => array('alpha_num', 'required'), 'weight' => array('numeric', 'between:1, 100')));
     if ($validator->passes()) {
         $rule = Rule::find($id);
         if ($rule) {
             $config = new NginxConfig();
             $config->setHostheaders($rule->hostheader);
             $config->readConfig(Setting::getSetting('nginxconfpath') . '/' . $config->serverNameToFileName() . '.enabled.conf');
             $config->addServerToNLB(array(strtolower(Input::get('target')), array('max_fails' => Input::get('maxfails'), 'fail_timeout' => Input::get('failtimeout'), 'weight' => Input::get('weight'))));
             $config->writeConfig()->toFile(Setting::getSetting('nginxconfpath') . '/' . $config->serverNameToFileName() . '.enabled.conf');
             $config->reloadConfig();
         }
         return Redirect::back()->with('flash_success', 'New target ' . strtolower(Input::get('target')) . ' has been added!');
     } else {
         $errors = $validator->messages();
         return Redirect::back()->withInput()->with('flash_error', 'The following validation errors occured, please correct them and try again:<br /><br /> * ' . implode('<br /> * ', $errors->all()));
     }
 }
开发者ID:Thomvh,项目名称:turbine,代码行数:24,代码来源:UtilController.php

示例7: listSetting

function listSetting()
{
    global $lang;
    $page_lang = scandir('inc/lang/' . $_SESSION['language']);
    foreach ($page_lang as $file) {
        if ($file != '.' && $file != '..') {
            $parts = explode(".", $file);
            $page = $parts[0];
            if ($page == 'setting') {
                $page_file = $file;
            }
        }
    }
    include_once 'inc/lang/' . $_SESSION['language'] . '/' . $page_file;
    if ($_SESSION['access']->settings > 0) {
        $results = array();
        $data = Setting::getSetting();
        $results['settings'] = $data['results'];
        $results['totalRows'] = $data['totalRows'];
        $results['pageTitle'] = "Site Settings";
        if (isset($_GET['success'])) {
            if ($_GET['success'] == "settingCreated") {
                $results['successMessage'] = "Your new setting has been created successully.";
            }
            if ($_GET['success'] == "changesSaved") {
                $results['successMessage'] = "Your setting changes have been saved.";
            }
            if ($_GET['attention'] == "locked") {
                $results['attentionMessage'] = "The previously created setting has been set as <strong>Locked!</strong> It will only be partialy editable to preserve system functionality.";
            }
        }
        require "inc/layout/listSettings.php";
    } else {
        require "inc/layout/noAccess.php";
    }
}
开发者ID:sabasco,项目名称:gnscms,代码行数:36,代码来源:listSetting.php

示例8: session_start

// admin header
session_start();
require_once 'lib/php/DOLib.php';
if (!swValidate('s_username')) {
    header("location: index.php");
}
connect();
// save new value and redirect to the page to view the change
$save = $_POST['save'];
if ($save) {
    Setting::setSetting($save, $_POST['value']);
}
//get default value for the textarea (either from selecting an item in the history, or from the current active record)
$id = $_GET['id'];
$row = Setting::getSetting($id);
if ($row) {
    $initValue = restoreValue($row[2]);
    $initName = restoreValue($row[1]);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>standupweb CMS - Edit settings mode</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="images/favicon.ico" />

</head>
<body>
开发者ID:standup75,项目名称:standupweb-cms,代码行数:30,代码来源:editsetting.php

示例9: getIntSetting

 public static function getIntSetting($id)
 {
     $row = Setting::getSetting($id);
     return intval($row[2]);
 }
开发者ID:standup75,项目名称:standupweb-cms,代码行数:5,代码来源:Setting.php

示例10: Setting

| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    //echo "<pre>user: "; print_r($user); echo "</pre>";
    if (!Request::is('maintenance') && !Request::is('login') && !Request::is('first_auth') && !Request::is('user/login') && !Request::is('user/logout')) {
        $maintenance_check = true;
        if (!Auth::guest()) {
            $user = Confide::user();
            if (User::find($user->id)->hasRole('Admin')) {
                $maintenance_check = false;
            }
        }
        $setting = new Setting();
        $site_mode = $setting->getSetting('site_mode', 0);
        if ($site_mode == 1 && $maintenance_check) {
            return Redirect::to('/maintenance');
        }
    }
    if (!Auth::guest()) {
        $user = Confide::user();
        $timeout = trim($user->timeout);
        if (empty($timeout)) {
            $timeout = "45 minutes";
        }
        $lastest_login = $user->lastest_login;
        $new_date = date("Y-m-d H:i:s", strtotime($lastest_login . " +" . $timeout));
        $cur_date = date("Y-m-d H:i:s");
        if (strtotime($cur_date) >= strtotime($new_date)) {
            Confide::logout();
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:31,代码来源:filters.php

示例11: function

<?php

View::composer('*', function ($view) {
    if (Auth::user()) {
        $view->with('useraccount', $useraccount = \User::find(\Auth::user()));
    }
    // Make the current system version avaliable to all pages.
    $view->with('turbineversion', Setting::getSetting('version'));
});
开发者ID:Thomvh,项目名称:turbine,代码行数:9,代码来源:view_composer.php

示例12: getFromFile

 /**
  * @codeCoverageIgnore
  */
 public static function getFromFile($setting = null)
 {
     $output = array();
     $filename = "settings.ini";
     if (isset($GLOBALS['depth']) && !empty($GLOBALS['depth']) && is_numeric($GLOBALS['depth'])) {
         for ($i = 0; $i < $GLOBALS['depth']; $i++) {
             $filename = '../' . $filename;
         }
     }
     $handle = @fopen($filename, "r");
     if ($handle) {
         while (($line = fgets($handle, 4096)) !== false) {
             $arr = Setting::getSetting($line);
             foreach ($arr as $key => $value) {
                 if (empty($key)) {
                     continue;
                 }
                 $output[trim($key)] = $value;
                 if ($setting != null && strToLower(trim($key)) == strToLower(trim($setting))) {
                     return $value;
                 }
             }
         }
         if (!feof($handle)) {
             echo "Error: unexpected fgets() fail\n";
         }
         fclose($handle);
     }
     if ($setting != null) {
         return null;
     }
     return $output;
 }
开发者ID:picolino0,项目名称:BreezedCMS,代码行数:36,代码来源:core.php

示例13: intval

        $defaultSavings = intval(Crypt::decrypt($setting->value));
    }
    echo Form::select('defaultSavingsAccount', $acc, $defaultSavings);
    ?>
    <?php 
}
?>
    <h4>Correct the prediction chart</h4>
    <p>
      Since average amounts just don't cut it (they tend to "flat out") the prediction chart
      is usually predicting a way higher balance than it should. By checking this checkbox,
      it will always correct itself to your current balance instead of sticking to the current
      month's start amount.
    </p>
    <?php 
$setting = Setting::getSetting('correctPredictionChart');
$checked = $setting == 'true' ? true : false;
echo Form::checkbox('correctPredictionChart', 'true', $checked);
?>

    <p>
      &nbsp;
    </p>
    <p>
      <input type="submit" class="btn btn-primary" value="Save settings" />
    </p>
    <?php 
echo Form::close();
?>

开发者ID:jcyh,项目名称:nder-firefly,代码行数:29,代码来源:index.php

示例14: getDatasChart

 public function getDatasChart($market_id, $timeSpan = '1 day')
 {
     //use google Candlesticks chart
     //$timeSpan='7 day';
     $setting = new Setting();
     $time_frame = $setting->getSetting('time_frame_chart', 30);
     $time_step_frame = '30 minutes';
     //1 cay nen trong chart lay trong khoang thoi gian la $time_step_frame (30 phut, 4 gio,...)
     if ($timeSpan == "7 day") {
         $time_step_frame = "4 hours";
     }
     if ($timeSpan == "1 month") {
         $time_step_frame = "6 hours";
     }
     if ($timeSpan == "3 month") {
         $time_step_frame = "8 hours";
     }
     if ($timeSpan == "6 month") {
         $time_step_frame = "10 hours";
     }
     if ($timeSpan == "12 month") {
         $time_step_frame = "12 hours";
     }
     //else get new data for chart
     $get_date = $this->getStartTimeChart($time_frame, $timeSpan);
     $start_time = $get_date['start_time'];
     $start_date = $get_date['start_date'];
     $closeprice = $this->getPreviousDataChart($market_id, $start_date);
     //$open_previous = $prior_perior['open_price'];
     $close_previous = $closeprice;
     //echo "date: ".date("Y-m-d H:i:s")."<br>";
     //echo "<pre>get_date: "; print_r($get_date); echo "</pre>";
     //echo "<pre>start_date: "; print_r($start_date); echo "</pre>";
     $trade_history = Trade::where('market_id', '=', $market_id)->where('created_at', '>=', $start_date)->orderBy('price', 'desc')->get();
     $data = $trade_history->toArray();
     //echo "<pre>trade_history: "; print_r($data); echo "</pre>";
     $temp_time = 0;
     $temp = 0;
     $datas_chart = array();
     $new_date = $start_date;
     //$date_ = strtotime(date("Y-m-d")." ".date('H',strtotime($start_date)).":".date('i',strtotime($start_date)));
     $date_ = strtotime(date("Y-m-d H:i:s"));
     $end_date = date("Y-m-d H:i", $date_);
     $str = "\n" . "new_date: " . $new_date . "\n" . "end_date: " . $end_date;
     //echo "new_date: ".$new_date."<br>";
     //echo "end_date: ".$end_date."<br>";
     //echo "str: ".$str;
     //echo "<pre>data 1: "; print_r($data); echo "</pre>";
     while (strtotime($new_date) <= strtotime($end_date)) {
         if ($temp == 0) {
             $temp_time = $start_time;
         }
         //$add_minute = strtotime($temp_time . " +30 minute");
         //echo "<br>temp_time: ".$temp_time;
         $add_minute = strtotime($temp_time . " +" . $time_step_frame);
         $temp_time_new = strftime("%H:%M", $add_minute);
         $old_date = $new_date;
         $date_temp_time = date("Y/m/d H:i", strtotime($old_date));
         $str .= "\n" . $date_temp_time;
         //$new_date = date("Y-m-d H:i", strtotime($new_date." +30 minutes"));// condition for while
         $new_date = date("Y-m-d H:i", strtotime($new_date . " +" . $time_step_frame));
         //echo "<br>------------------------------------------";
         //echo "<br>temp_time: ".$temp_time;
         //echo "<br>Old date: ".$old_date;
         //echo "<br>new_date : ".$new_date;
         //lay du lieu chart trong khung gio hien tai, du lieu nay dc sap xep theo gia tu cao den thap
         $data_chart_this_time = array_filter($data, function ($el) use($old_date, $new_date) {
             $created_at_time = strtotime($el['created_at']);
             return $created_at_time >= strtotime($old_date) && $created_at_time <= strtotime($new_date);
         });
         //echo "<pre>filtered 1: "; print_r($data_chart_this_time); echo "</pre>";
         if (count($data_chart_this_time > 0)) {
             $data_chart_this_time = array_values($data_chart_this_time);
             //get high & low ($data_chart_this_time is sort with price desc)
             $high = isset($data_chart_this_time[0]['price']) ? $data_chart_this_time[0]['price'] : 0;
             $low = isset($data_chart_this_time[count($data_chart_this_time) - 1]['price']) ? $data_chart_this_time[count($data_chart_this_time) - 1]['price'] : 0;
             $volumn = array_sum(array_fetch($data_chart_this_time, 'amount'));
             //get close_price, open_price (sort array with created desc)
             $cmp = function ($a, $b) {
                 return $b['created_at'] > $a['created_at'];
             };
             usort($data_chart_this_time, $cmp);
             //echo "<pre>filtered eee: "; print_r($data_chart_this_time); echo "</pre>";
             $open_price = isset($data_chart_this_time[count($data_chart_this_time) - 1]['price']) ? $data_chart_this_time[count($data_chart_this_time) - 1]['price'] : 0;
             $close_price = isset($data_chart_this_time[0]['price']) ? $data_chart_this_time[0]['price'] : 0;
             if ($close_previous == 0) {
                 $close_previous = $close_price;
             }
             $ha_data = $this->getDataHACandlesticks(array('high' => $high, 'low' => $low, 'open' => $open_price, 'close' => $close_price), $close_previous);
             //add data to chart
             $datas_chart[] = array($date_temp_time, (double) $ha_data['ha_low'], (double) $ha_data['ha_open'], (double) $ha_data['ha_close'], (double) $ha_data['ha_high'], $volumn);
         } else {
             $datas_chart[] = array($date_temp_time, 0, 0, 0, 0, 0);
         }
         $temp_time = $temp_time_new;
         $close_previous = $ha_data['ha_close'];
         $temp++;
     }
     //echo $str;
     //$datas_chart[] = array('date'=>date("Y-m-d H:i"),'low'=>$close_previous,'open'=>$close_previous,'close'=>$close_previous,'high'=>$close_previous, 'exchange_volume'=>0,'temp'=>$str);
//.........这里部分代码省略.........
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:101,代码来源:Trade.php

示例15: formTransfer

 public function formTransfer($wallet_id = '')
 {
     $user = Confide::user();
     $user_id = $user->id;
     $data = array();
     if ($wallet_id == '') {
         $wallet = Wallet::first();
     } else {
         $wallet = Wallet::find($wallet_id);
     }
     $balance = new Balance();
     $data['page'] = 'transfercoin';
     $data['current_coin'] = $wallet->getType($wallet->id);
     $balance_amount = $balance->getBalance($wallet->id);
     $data['balance'] = sprintf('%.8f', $balance_amount);
     $data['wallet_id'] = $wallet->id;
     $setting = new Setting();
     $data['recaptcha_publickey'] = $setting->getSetting('recaptcha_publickey', '');
     return View::make('user.profile', $data);
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:20,代码来源:UserController.php


注:本文中的Setting::getSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。