• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP floatval函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中floatval函数的典型用法代码示例。如果您正苦于以下问题:PHP floatval函数的具体用法?PHP floatval怎么用?PHP floatval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: addRegistro

 function addRegistro($data)
 {
     $querys = new Querys();
     // Data cadastro atual
     $data[$this->tabela_data_entrada] = date('Y-m-d H:i:s');
     // Retorna todos os campos da tabela
     $result = $this->getCampos();
     // Monta sql
     $sql = "INSERT INTO " . $this->tabela . " SET ";
     foreach ($result['nome'] as $key => $campo) {
         if (isset($data[$result['nome'][$key]]) && !empty($data[$result['nome'][$key]])) {
             if ($result['tipo'][$key] == 'int') {
                 $sql .= $result['nome'][$key] . " = '" . (int) $data[$result['nome'][$key]] . "', ";
             } else {
                 if ($result['tipo'][$key] == 'real') {
                     $sql .= $result['nome'][$key] . " = " . floatval($data[$result['nome'][$key]]) . ", ";
                 } else {
                     $sql .= $result['nome'][$key] . " = '" . $querys->escape($data[$result['nome'][$key]]) . "', ";
                 }
             }
         }
     }
     $sql = substr(trim($sql), 0, -1);
     $result = $querys->query($sql);
     return $result;
 }
开发者ID:ExtraProgrammers,项目名称:PrivateGSIASorteios,代码行数:26,代码来源:Participantes.php


示例2: getData

 /**
  * @see OptionType::getData()
  */
 public function getData($optionData, $newValue)
 {
     $newValue = str_replace(' ', '', $newValue);
     $newValue = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
     $newValue = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $newValue);
     return floatval($newValue);
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:10,代码来源:OptionTypeFloat.class.php


示例3: formatPriceToUS

 /**
  * Returns the first found number from an string
  * Parsing depends on given locale (grouping and decimal)
  *
  * Examples for input:
  * '  2345.4356,1234' = 23455456.1234
  * '+23,3452.123' = 233452.123
  * ' 12343 ' = 12343
  * '-9456km' = -9456
  * '0' = 0
  * '2 054,10' = 2054.1
  * '2'054.52' = 2054.52
  * '2,46 GB' = 2.46
  *
  * @param string|int $value
  * @return float
  */
 public static function formatPriceToUS($value)
 {
     if (is_null($value)) {
         return null;
     }
     if (!is_string($value)) {
         return floatval($value);
     }
     //trim space and apos
     $value = str_replace('\'', '', $value);
     $value = str_replace(' ', '', $value);
     $separatorComa = strpos($value, ',');
     $separatorDot = strpos($value, '.');
     if ($separatorComa !== false && $separatorDot !== false) {
         if ($separatorComa > $separatorDot) {
             $value = str_replace('.', '', $value);
             $value = str_replace(',', '.', $value);
         } else {
             $value = str_replace(',', '', $value);
         }
     } elseif ($separatorComa !== false) {
         $value = str_replace(',', '.', $value);
     }
     return floatval($value);
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:42,代码来源:Math.php


示例4: upload

 public function upload()
 {
     /** import upload library **/
     _wpl_import('assets.packages.ajax_uploader.UploadHandler');
     $kind = wpl_request::getVar('kind', 0);
     $params = array();
     $params['accept_ext'] = wpl_flex::get_field_options(301);
     $extentions = explode(',', $params['accept_ext']['ext_file']);
     $ext_str = '';
     foreach ($extentions as $extention) {
         $ext_str .= $extention . '|';
     }
     // remove last |
     $ext_str = substr($ext_str, 0, -1);
     $ext_str = rtrim($ext_str, ';');
     $custom_op = array('upload_dir' => wpl_global::get_upload_base_path(), 'upload_url' => wpl_global::get_upload_base_url(), 'accept_file_types' => '/\\.(' . $ext_str . ')$/i', 'max_file_size' => $params['accept_ext']['file_size'] * 1000, 'min_file_size' => 1, 'max_number_of_files' => null);
     $upload_handler = new UploadHandler($custom_op);
     $response = json_decode($upload_handler->json_response);
     if (isset($response->files[0]->error)) {
         return;
     }
     $attachment_categories = wpl_items::get_item_categories('attachment', $kind);
     // get item category with first index
     $item_cat = reset($attachment_categories)->category_name;
     $index = floatval(wpl_items::get_maximum_index(wpl_request::getVar('pid'), wpl_request::getVar('type'), $kind, $item_cat)) + 1.0;
     $item = array('parent_id' => wpl_request::getVar('pid'), 'parent_kind' => $kind, 'item_type' => wpl_request::getVar('type'), 'item_cat' => $item_cat, 'item_name' => $response->files[0]->name, 'creation_date' => date("Y-m-d H:i:s"), 'index' => $index);
     wpl_items::save($item);
 }
开发者ID:gvh1993,项目名称:project-vvvh,代码行数:28,代码来源:wpl_attachments.php


示例5: indexOp

 public function indexOp()
 {
     //查询会员及其附属信息
     $result = parent::pointshopMInfo(true);
     $member_info = $result['member_info'];
     unset($result);
     $model_member = Model('member');
     //获得会员升级进度
     $membergrade_arr = $model_member->getMemberGradeArr(true, $member_info['member_exppoints'], $member_info['level']);
     Tpl::output('membergrade_arr', $membergrade_arr);
     //处理经验值计算说明文字
     $exppoints_rule = C("exppoints_rule") ? unserialize(C("exppoints_rule")) : array();
     $ruleexplain_arr = array();
     $exppoints_rule['exp_orderrate'] = floatval($exppoints_rule['exp_orderrate']);
     if ($exppoints_rule['exp_orderrate'] > 0) {
         $ruleexplain_arr['exp_order'] = "经验值以有效购物金额作为计算标准,有效购物金额{$exppoints_rule['exp_orderrate']}元=1经验值;";
         $exp_ordermax = intval($exppoints_rule['exp_ordermax']);
         if ($exp_ordermax > 0) {
             $ruleexplain_arr['exp_order'] .= "单个订单最多获得{$exppoints_rule['exp_ordermax']}经验值;";
         }
     }
     $exppoints_rule['exp_login'] = intval($exppoints_rule['exp_login']);
     if ($exppoints_rule['exp_login'] > 0) {
         $ruleexplain_arr['exp_login'] = "会员每天第一次登录获得{$exppoints_rule['exp_login']}经验值;";
     }
     $exppoints_rule['exp_comments'] = intval($exppoints_rule['exp_comments']);
     if ($exppoints_rule['exp_comments'] > 0) {
         $ruleexplain_arr['exp_comments'] = "进行一次订单商品评价将获得{$exppoints_rule['exp_comments']}经验值;";
     }
     Tpl::output('ruleexplain_arr', $ruleexplain_arr);
     //分类导航
     $nav_link = array(0 => array('title' => L('homepage'), 'link' => SHOP_SITE_URL), 1 => array('title' => L('nc_pointprod'), 'link' => urlShop('pointshop', 'index')), 2 => array('title' => '我的成长进度'));
     Tpl::output('nav_link_list', $nav_link);
     Tpl::showpage('pointgrade');
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:35,代码来源:pointgrade.php


示例6: perform

 function perform(&$page, $actionName)
 {
     // like in Action_Next
     $page->isFormBuilt() or $page->buildForm();
     $page->handle('display');
     $strings = $page->controller->exportValue('page4', 'strings');
     $bar = $page->controller->createProgressBar();
     do {
         $percent = $bar->getPercentComplete();
         if ($bar->isStringPainted()) {
             if (substr($strings, -1) == ";") {
                 $str = explode(";", $strings);
             } else {
                 $str = explode(";", $strings . ";");
             }
             for ($i = 0; $i < count($str) - 1; $i++) {
                 list($p, $s) = explode(",", $str[$i]);
                 if ($percent == floatval($p) / 100) {
                     $bar->setString(trim($s));
                 }
             }
         }
         $bar->display();
         if ($percent == 1) {
             break;
             // the progress bar has reached 100%
         }
         $bar->sleep();
         $bar->incValue();
     } while (1);
 }
开发者ID:Ogwang,项目名称:sainp,代码行数:31,代码来源:preview.php


示例7: smarty_modifier_currency

/**
 * Formats a given decimal value to a local aware currency value
 *
 *
 * @link http://framework.zend.com/manual/de/zend.currency.options.html
 * @param float  $value Value can have a coma as a decimal separator
 * @param array  $config
 * @param string $position where the currency symbol should be displayed
 * @return float|string
 */
function smarty_modifier_currency($value, $config = null, $position = null)
{
    if (!Enlight_Application::Instance()->Bootstrap()->hasResource('Currency')) {
        return $value;
    }
    if (!empty($config) && is_string($config)) {
        $config = strtoupper($config);
        if (defined('Zend_Currency::' . $config)) {
            $config = array('display' => constant('Zend_Currency::' . $config));
        } else {
            $config = array();
        }
    } else {
        $config = array();
    }
    if (!empty($position) && is_string($position)) {
        $position = strtoupper($position);
        if (defined('Zend_Currency::' . $position)) {
            $config['position'] = constant('Zend_Currency::' . $position);
        }
    }
    $currency = Enlight_Application::Instance()->Currency();
    $value = floatval(str_replace(',', '.', $value));
    $value = $currency->toCurrency($value, $config);
    if (function_exists('mb_convert_encoding')) {
        $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
    }
    $value = htmlentities($value, ENT_COMPAT, 'UTF-8', false);
    return $value;
}
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:40,代码来源:modifier.currency.php


示例8: postToLaybuy

 public function postToLaybuy()
 {
     $this->load->model('extension/payment/laybuy');
     $this->model_extension_payment_laybuy->log('Posting to Laybuy');
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $this->load->model('checkout/order');
         $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
         if ($order_info) {
             $this->model_extension_payment_laybuy->log('Order ID: ' . $order_info['order_id']);
             $data = array();
             $data['VERSION'] = '0.2';
             $data['MEMBER'] = $this->config->get('laybuys_membership_id');
             $data['RETURNURL'] = $this->url->link('extension/payment/laybuy/callback', '', true);
             $data['CANCELURL'] = $this->url->link('extension/payment/laybuy/cancel', '', true);
             $data['AMOUNT'] = round(floatval($order_info['total']), 2, PHP_ROUND_HALF_DOWN);
             $data['CURRENCY'] = $order_info['currency_code'];
             $data['INIT'] = (int) $this->request->post['INIT'];
             $data['MONTHS'] = (int) $this->request->post['MONTHS'];
             $data['MIND'] = (int) $this->config->get('laybuy_min_deposit') ? (int) $this->config->get('laybuy_min_deposit') : 20;
             $data['MAXD'] = (int) $this->config->get('laybuy_max_deposit') ? (int) $this->config->get('laybuy_max_deposit') : 50;
             $data['CUSTOM'] = $order_info['order_id'] . ':' . md5($this->config->get('laybuy_token'));
             $data['EMAIL'] = $order_info['email'];
             $data_string = '';
             foreach ($data as $param => $value) {
                 $data_string .= $param . '=' . $value . '&';
             }
             $data_string = rtrim($data_string, '&');
             $this->model_extension_payment_laybuy->log('Data String: ' . $data_string);
             $this->model_extension_payment_laybuy->log('Gateway URL: ' . $this->config->get('laybuy_gateway_url'));
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $this->config->get('laybuy_gateway_url'));
             curl_setopt($ch, CURLOPT_POST, true);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_HEADER, false);
             curl_setopt($ch, CURLOPT_TIMEOUT, 30);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
             $result = curl_exec($ch);
             if (curl_errno($ch)) {
                 $this->model_extension_payment_laybuy->log('cURL error: ' . curl_errno($ch));
             }
             curl_close($ch);
             $result = json_decode($result, true);
             $this->model_extension_payment_laybuy->log('Response: ' . print_r($result, true));
             if (isset($result['ACK']) && isset($result['TOKEN']) && $result['ACK'] == 'SUCCESS') {
                 $this->model_extension_payment_laybuy->log('Success response. Redirecting to PayPal.');
                 $this->response->redirect($this->config->get('laybuy_gateway_url') . '?TOKEN=' . $result['TOKEN']);
             } else {
                 $this->model_extension_payment_laybuy->log('Failure response. Redirecting to checkout/failure.');
                 $this->response->redirect($this->url->link('checkout/failure', '', true));
             }
         } else {
             $this->model_extension_payment_laybuy->log('No matching order. Redirecting to checkout/failure.');
             $this->response->redirect($this->url->link('checkout/failure', '', true));
         }
     } else {
         $this->model_extension_payment_laybuy->log('No $_POST data. Redirecting to checkout/failure.');
         $this->response->redirect($this->url->link('checkout/failure', '', true));
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:60,代码来源:laybuy.php


示例9: realFilesize

function realFilesize($filename)
{
    $fp = fopen($filename, 'r');
    $return = false;
    if (is_resource($fp)) {
        if (PHP_INT_SIZE < 8) {
            if (0 === fseek($fp, 0, SEEK_END)) {
                $return = 0.0;
                $step = 0x7fffffff;
                while ($step > 0) {
                    if (0 === fseek($fp, -$step, SEEK_CUR)) {
                        $return += floatval($step);
                    } else {
                        $step >>= 1;
                    }
                }
            }
        } else {
            if (0 === fseek($fp, 0, SEEK_END)) {
                $return = ftell($fp);
            }
        }
    }
    return $return;
}
开发者ID:GvarimAZA,项目名称:website,代码行数:25,代码来源:functions.php


示例10: __construct

 /**
  * @brief Checks whether our assumptions hold on the PHP platform we are on.
  *
  * @throws \RunTimeException if our assumptions do not hold on the current
  *                           PHP platform.
  */
 public function __construct()
 {
     $pow_2_53 = floatval(self::POW_2_53_MINUS_1) + 1.0;
     if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) {
         throw new \RunTimeException('This class assumes floats to be double precision or "better".');
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:13,代码来源:LargeFileHelper.php


示例11: index

 public function index()
 {
     $modules = $this->read_modules();
     $db_modules = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "collocation");
     foreach ($modules as $k => $v) {
         foreach ($db_modules as $kk => $vv) {
             if ($v['class_name'] == $vv['class_name']) {
                 //已安装
                 $modules[$k]['name'] = $vv['name'];
                 $modules[$k]['id'] = $vv['id'];
                 $modules[$k]['total_amount'] = $vv['total_amount'];
                 $modules[$k]['installed'] = $vv['is_effect'];
                 $modules[$k]['is_effect'] = $vv['is_effect'];
                 $modules[$k]['sort'] = $vv['sort'];
                 break;
             }
         }
         if ($modules[$k]['installed'] != 1) {
             $modules[$k]['installed'] = 0;
         }
         $modules[$k]['is_effect'] = intval($modules[$k]['is_effect']);
         $modules[$k]['sort'] = intval($modules[$k]['sort']);
         $modules[$k]['total_amount'] = floatval($modules[$k]['total_amount']);
         $modules[$k]['reg_url'] = $v['reg_url'] ? $v['reg_url'] : '';
     }
     $this->assign("collocation_list", $modules);
     $this->display();
 }
开发者ID:eliu03,项目名称:fanweP2P,代码行数:28,代码来源:CollocationAction.class.php


示例12: getNonCancelledPaymentOrdersByCurrency

 public function getNonCancelledPaymentOrdersByCurrency($date, $currencyId)
 {
     $sql = "SELECT SUM(amount) AS amount FROM `%s` WHERE `cancelled` = 0 AND `paid` = 1 AND currency_id=:id AND `date`<=DATE_ADD('%s' ,INTERVAL 1 DAY)";
     $sqlQuery = sprintf($sql, $this->getTableName(), $date);
     $qty = $this->fetchField($sqlQuery, 'amount', array("id" => $currencyId));
     return isset($qty) ? floatval($qty) : 0;
 }
开发者ID:pars5555,项目名称:crm,代码行数:7,代码来源:PaymentTransactionMapper.class.php


示例13: to_money

 public function to_money($number, $do_encode = false)
 {
     if (!is_numeric($number)) {
         $number = $this->to_number($number);
     }
     if ($number === false) {
         return '';
     }
     $negative = '';
     if (strpos(strval($number), '-') !== false) {
         $negative = '-';
         $number = floatval(substr($number, 1));
     }
     $money = number_format($number, $this->currency['decimals'], $this->currency['decimal_separator'], $this->currency['thousand_separator']);
     if ($money == '0.00') {
         $negative = '';
     }
     $symbol_left = !empty($this->currency['symbol_left']) ? $this->currency['symbol_left'] . $this->currency['symbol_padding'] : '';
     $symbol_right = !empty($this->currency['symbol_right']) ? $this->currency['symbol_padding'] . $this->currency['symbol_right'] : '';
     if ($do_encode) {
         $symbol_left = html_entity_decode($symbol_left);
         $symbol_right = html_entity_decode($symbol_right);
     }
     return $negative . $symbol_left . $money . $symbol_right;
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:25,代码来源:currency.php


示例14: getPrice

 function getPrice()
 {
     //echo '<pre>';print_r($this->price_filter);exit;
     $str = $this->getReplaceResult($this->price_filter, $this->html_content, 'price');
     if (empty($str)) {
         for ($i = 0, $len = count($this->price_filter['discount']); $i < $len; $i++) {
             $str = $this->getReplaceResult($this->price_filter['discount'][$i], $this->html_content);
             if (strlen($str) > 0) {
                 break;
             }
         }
         if (empty($str)) {
             $this->error_msg['price_error'] = 'error: empty product price and discount price';
         }
     }
     if (!isset($this->error_msg['price_error'])) {
         $str = preg_replace("/^\\D+|\\D+\$/", '', $str);
         $str = floatval($str);
         $this->reduce_price_num = floatval($this->reduce_price_num);
         if ($str - $this->reduce_price_num > 0) {
             $str = $str - $this->reduce_price_num;
         }
         $this->product_info['price'] = $str;
     }
 }
开发者ID:andychang88,项目名称:daddy-store.com,代码行数:25,代码来源:add_product_model.php


示例15: index

 /**
  * index method
  *
  * @return void
  * @access public
  */
 public function index($type = null, $lat = null, $long = null, $opt1 = null, $opt2 = null)
 {
     $params = array('limit' => 35, 'page' => 1);
     if (!empty($type) && !empty($lat) && !empty($long)) {
         $lat = floatval($lat);
         $long = floatval($long);
         $opt1 = floatval($opt1);
         $opt2 = floatval($opt2);
         switch ($type) {
             case 'near':
                 if (!empty($opt1)) {
                     $cond = array('loc' => array('$near' => array($lat, $long), '$maxDistance' => $opt1));
                 } else {
                     $cond = array('loc' => array('$near' => array($lat, $long)));
                 }
                 break;
             case 'box':
                 $lowerLeft = array($lat, $long);
                 $upperRight = array($opt1, $opt2);
                 $cond = array('loc' => array('$within' => array('$box' => array($lowerLeft, $upperRight))));
                 break;
             case 'circle':
                 $center = array($lat, $long);
                 $radius = $opt1;
                 $cond = array('loc' => array('$within' => array('$center' => array($center, $radius))));
                 break;
         }
         $params['conditions'] = $cond;
     } else {
         $params['order'] = array('_id' => -1);
     }
     $results = $this->Geo->find('all', $params);
     $this->set(compact('results'));
 }
开发者ID:ThemisB,项目名称:mongoDB-Datasource,代码行数:40,代码来源:geos_controller.php


示例16: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $pId = empty($p['id']) ? Tool_Fnc::ajaxMsg('请选择食物') : intval($p['id']);
     $pFid = empty($p['fid']) ? Tool_Fnc::ajaxMsg('食物ID不能为空') : intval($p['fid']);
     $pUnit = empty($p['unit']) ? Tool_Fnc::ajaxMsg('单位不能为空') : Tool_Fnc::safe_string($p['unit']);
     $pAmount = empty($p['amount']) ? Tool_Fnc::ajaxMsg('数量不能为空') : floatval($p['amount']);
     $pWeight = empty($p['weight']) ? Tool_Fnc::ajaxMsg('重量不能为空') : floatval($p['weight']);
     $pMtid = empty($p['mt_id']) ? Tool_Fnc::ajaxMsg('餐类型不能为空') : intval($p['mt_id']);
     $tTime = time();
     $tFMO = new FoodModel();
     $tFRow = $tFMO->field('title,protein,thumb_img')->where('id = ' . $pFid)->fRow();
     if (!count($tFRow)) {
         Tool_Fnc::ajaxMsg('食物不存在');
     }
     $tMTMO = new MealtypeModel();
     $tMTRow = $tMTMO->field('name')->where('id = ' . $pMtid)->fRow();
     if (!count($tMTRow)) {
         Tool_Fnc::ajaxMsg('餐类型不存在');
     }
     $tRFDMO = new R_FoodaddModel();
     $tRFRow = $tRFDMO->field('count(*) c')->where(' id =' . $pId)->fRow();
     if (empty($tRFRow['c'])) {
         Tool_Fnc::ajaxMsg('操作异常');
     }
     $tData = array('id' => $pId, 'title' => $tFRow['title'], 'unit' => $pUnit, 'amount' => $pAmount, 'weight' => $pWeight, 'mt_id' => $pMtid, 'mt_name' => $tMTRow['name'], 'created' => $tTime, 'fid' => $pFid, 'uid' => $this->tUid, 'thumb_img' => $tFRow['thumb_img'], 'protein' => $tFRow['protein'] / 100 * $pWeight);
     if (!$tRFDMO->update($tData)) {
         Tool_Fnc::ajaxMsg('更新失败');
     }
     Tool_Fnc::ajaxMsg('更新成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:31,代码来源:Food.php


示例17: __construct

 /**
  * @param int $id
  * @param float $x
  * @param float $y
  */
 public function __construct($id, $x, $y)
 {
     $this->id = intval($id);
     $this->x = floatval($x);
     $this->y = floatval($y);
     $this->data = array();
 }
开发者ID:tvswe,项目名称:astar,代码行数:12,代码来源:Node.php


示例18: filter_http_request_args

 /**
  * Filter the arguments for HTTP requests. If the request is to a URL that's part of
  * something we're handling then filter the arguments accordingly.
  *
  * @author John Blackbourn
  * @param  array  $args HTTP request arguments.
  * @param  string $url  HTTP request URL.
  * @return array        Updated array of arguments.
  */
 public function filter_http_request_args(array $args, $url)
 {
     if (preg_match('#://api\\.wordpress\\.org/(?P<type>plugins|themes)/update-check/(?P<version>[0-9\\.]+)/#', $url, $matches)) {
         switch ($matches['type']) {
             case 'plugins':
                 return $this->plugin_request($args, floatval($matches['version']));
                 break;
             case 'themes':
                 return $this->theme_request($args, floatval($matches['version']));
                 break;
         }
     }
     $query = parse_url($url, PHP_URL_QUERY);
     if (empty($query)) {
         return $args;
     }
     parse_str($query, $query);
     if (!isset($query['_euapi_type']) or !isset($query['_euapi_file'])) {
         return $args;
     }
     if (!($handler = $this->get_handler($query['_euapi_type'], $query['_euapi_file']))) {
         return $args;
     }
     $args = array_merge($args, $handler->config['http']);
     return $args;
 }
开发者ID:DrewAPicture,项目名称:babble,代码行数:35,代码来源:euapi.php


示例19: updateBudgetPrediction

 public function updateBudgetPrediction($event)
 {
     $event->name = Crypt::decrypt($event->name);
     // remove all budget prediction points, if any
     $event->budgetpredictionpoints()->delete();
     $similar = array();
     // get all similar budgets from the past:
     $budgets = Auth::user()->budgets()->where('date', '<=', $event->date)->get();
     foreach ($budgets as $budget) {
         $budget->name = Crypt::decrypt($budget->name);
         if ($budget->name == $event->name) {
             $similar[] = $budget->id;
         }
     }
     if (count($similar) > 0) {
         // get all transactions for these budgets:
         $amounts = array();
         $transactions = Auth::user()->transactions()->orderBy('date', 'DESC')->where('onetime', '=', 0)->whereIn('budget_id', $similar)->get();
         foreach ($transactions as $t) {
             $date = new Carbon($t->date);
             $day = intval($date->format('d'));
             $amounts[$day] = isset($amounts[$day]) ? $amounts[$day] + floatval($t->amount) * -1 : floatval($t->amount) * -1;
         }
         // then make sure it's "average".
         foreach ($amounts as $day => $amount) {
             // save as budget prediction point.
             $bpp = new Budgetpredictionpoint();
             $bpp->budget_id = $event->id;
             $bpp->amount = $amount / count($similar);
             $bpp->day = $day;
             $bpp->save();
         }
     }
 }
开发者ID:jcyh,项目名称:nder-firefly,代码行数:34,代码来源:BudgetEventHandler.php


示例20: assignData

 /**
  * Assign data to info model instance
  *
  * @param   mixed $data
  * @return  Mage_Payment_Model_Info
  */
 public function assignData($data)
 {
     if (!$data instanceof Varien_Object) {
         $data = new Varien_Object($data);
     }
     // salva a bandeira, o numero de parcelas e o token
     $info = $this->getInfoInstance();
     $additionaldata = array('parcels_number' => $data->getParcelsNumber());
     if ($data->getToken()) {
         $tokenData = $this->_getTokenById($data->getToken());
         $additionaldata['token'] = $tokenData['token'];
         $data->setCcType($tokenData['ccType']);
     }
     $info->setCcType($data->getCcType())->setCcNumber(Mage::helper('core')->encrypt($data->getCcNumber()))->setCcOwner($data->getCcOwner())->setCcExpMonth($data->getCcExpMonth())->setCcExpYear($data->getCcExpYear())->setCcCid(Mage::helper('core')->encrypt($data->getCcCid()))->setAdditionalData(serialize($additionaldata));
     // pega dados de juros
     $withoutInterest = intval($this->getConfigData('installment_without_interest', $this->getStoreId()));
     $interestValue = floatval($this->getConfigData('installment_interest_value', $this->getStoreId()));
     // verifica se há juros
     if ($data->getParcelsNumber() > $withoutInterest) {
         $installmentValue = Mage::helper('Query_Cielo')->calcInstallmentValue($info->getQuote()->getGrandTotal(), $interestValue / 100, $data->getParcelsNumber());
         $installmentValue = round($installmentValue, 2);
         $interest = $installmentValue * $data->getParcelsNumber() - $info->getQuote()->getGrandTotal();
         $info->getQuote()->setInterest($info->getQuote()->getStore()->convertPrice($interest, false));
         $info->getQuote()->setBaseInterest($interest);
         $info->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
         $info->getQuote()->save();
     } else {
         $info->getQuote()->setInterest(0.0);
         $info->getQuote()->setBaseInterest(0.0);
         $info->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
         $info->getQuote()->save();
     }
     return $this;
 }
开发者ID:brunowd,项目名称:magento-cielo,代码行数:40,代码来源:Cc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP flock函数代码示例发布时间:2022-05-15
下一篇:
PHP floattostring函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap