本文整理汇总了PHP中currency函数的典型用法代码示例。如果您正苦于以下问题:PHP currency函数的具体用法?PHP currency怎么用?PHP currency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasicConversions
public function testBasicConversions()
{
$currency = currency(1, 'EUR');
$this->assertNotEquals($currency->to('USD')->plain(), 1, '', static::FLOAT_PRECISION);
$this->assertNotEquals($currency->toUSD()->plain(), 1, '', static::FLOAT_PRECISION);
$this->assertEquals($currency->toUSD()->getCurrency()->getCode(), 'USD');
}
示例2: checkUsernameAvailability
public function checkUsernameAvailability()
{
$username = Request::input('username');
$errors = Auth::user()->validateUsernameChangeTo($username);
$available = count($errors) === 0;
$message = $available ? "Username '" . e($username) . "' is available!" : implode(' ', $errors);
$cost = $available ? Auth::user()->usernameChangeCost() : 0;
return ['username' => Request::input('username'), 'available' => $available, 'message' => $message, 'cost' => $cost, 'costString' => currency($cost)];
}
示例3: form_mercado_pago
function form_mercado_pago()
{
if (get_option('mercadopago_url_sucess') != '') {
$url_sucess = get_option('mercadopago_url_sucess');
} else {
$url_sucess = get_site_url();
}
if (get_option('mercadopago_url_pending') != '') {
$url_pending = get_option('mercadopago_url_pending');
} else {
$url_pending = get_site_url();
}
$output = '<br /><tr><td>';
$output .= 'Client Id</td>';
$output .= '<td><input name="mercadopago_client_id" type="text" value="' . get_option('mercadopago_client_id') . '"/></td></tr>';
$output .= '<tr><td>Client Secret</td>';
$output .= '<td><input name="mercadopago_client_secret" type="text" value="' . get_option('mercadopago_client_secret') . '"/></td></tr>';
$output .= '<tr><td></td><td><small>To get fields above, follow:
<a href="https://www.mercadopago.com/mla/herramientas/aplicaciones" target="_blank">Argentina</a> or
<a href="https://www.mercadopago.com/mlb/ferramentas/aplicacoes" target="_blank">Brasil</a> or <a href="https://www.mercadopago.com/mlm/herramientas/aplicaciones" target="_blank">Mexico</a> or <a href="https://www.mercadopago.com/mlv/herramientas/aplicaciones" target="_blank">Venezuela</a> <br /><br /></small></td></tr>';
$output .= '<tr><td>Store Category</td>';
$output .= '<td>' . category() . '</td></tr>';
$output .= '<tr><td>Type Checkout</td>';
$output .= '<td>' . type_checkout() . '</td></tr>';
$output .= '<tr><td>Sandbox</td>';
$output .= '<td>' . sandbox() . '</td></tr>';
$output .= '<tr><td>Url Sucess Payment</td>';
$output .= '<td><input name="mercadopago_url_sucess" type="text" value="' . $url_sucess . '"/></td></tr>';
$output .= '<tr><td>Url Peding Payment</td>';
$output .= '<td><input name="mercadopago_url_pending" type="text" value="' . $url_pending . '"/></td></tr>';
$output .= '<tr><td></td><td><small>This is just the url where the custumer is redirect after his payment is done, you can set in both fields above any url of your site, but needs to be a <b>valid URL.</b>.<br /><br /> Please set your <b>instant payment notification</b> to receive your automatic order status changes at:
<a href="https://www.mercadopago.com/mla/herramientas/notificaciones" target="_blank">Argentina</a> or
<a href="https://www.mercadopago.com/mlb/ferramentas/notificacoes" target="_blank">Brasil</a> or <a href="https://www.mercadopago.com/mlm/herramientas/notificaciones" target="_blank">Mexico</a> or <a href="https://www.mercadopago.com/mlv/herramientas/notificaciones" target="_blank">Venezuela</a><br />
Set your url follwing this exemple: http://yourstore.com</b></small></td></tr>';
$output .= '<tr><td>Store Country</td>';
$output .= '<td>' . country() . '</td></tr>';
$output .= '<tr><td>Currency</td>';
$output .= '<td>' . currency() . '</td></tr>';
$output .= '<tr><td></td><td><small>Select Real to Brasil, or Pesos or Dollar to Argentina</small></td></tr>';
$output .= '<tr><td>Excluded methods</td>';
$output .= '<td>' . methods(get_option('mercadopago_country')) . '</td></tr>';
$output .= '<tr><td></td><td><small>SELECT only the methods that you <b>DO NOT</b>want to accept by MercadoPago<br />
<br /><b>Attention: </b> Payment methods depends on what country your account was created, if you change the country,<b> save the module first</b> and just after that select the Exclude Payment Methods!
<br /><br /><b>DO NOT</b> exclude All methods<br /><br /></small></td></tr>';
$output .= '<tr><td>Limit Payments</td>';
$output .= '<td>' . instalments() . '</td></tr>';
$output .= '<tr><td></td><td><small>This option allow you to limit the maximum number of instalments of MercadoPago</small></td></tr>';
$output .= '<tr><td>Debug mode</td>';
$output .= '<td>' . debugs() . '</td></tr>';
$output .= '<tr><td></td><td><small>Turn debug mode on to see erro log with your getting error on checkout</small></td></tr>';
return $output;
}
示例4: search
public function search($offset = 0)
{
$options = $this->m_places->array_from_post(array('title_s', 'type', 'city', 'minbed', 'maxbed', 'minbath', 'maxbath', 'minprice', 'maxprice', 'minfloor', 'maxfloor'));
if ($this->form_validation->run('search')) {
$count = $this->m_places->search($options, $status = FALSE);
$perpage = getOptions('paging');
if (count($count) > $perpage) {
$this->load->library('pagination');
$config['base_url'] = site_url('admin/places/search');
$config['total_rows'] = count($count);
$config['per_page'] = $perpage;
$config['uri_segment'] = 4;
$q = $this->pagination->initialize($config);
$offset = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
} else {
$this->data['pagination'] = '';
$offset = 0;
}
$status = $this->m_places->status_place;
$telo = $this->m_places->search($options, $status = FALSE, $perpage, $offset);
$str = '';
if ($telo) {
$str .= '<section class="col-xs-12 col-sm-6 col-md-12">';
foreach ($telo as $s) {
$str .= '<article class="search-result row">';
$str .= $s->image ? '<div class="col-xs-12 col-sm-12 col-md-3"><img class="img-responsive thumbnail" src="' . base_url('assets/img/timthumb.php') . '?src=' . base_url($s->image) . '&zc=0&h=140&w=180"></div>' : '<div class="col-xs-12 col-sm-12 col-md-3"><img class="img-responsive thumbnail" src="http://placehold.it/250x140&text=no+primary+image"></div>';
$str .= '<div class="col-xs-12 col-sm-12 col-md-2"><ul class="meta-search">';
$str .= '<ul><i class="fa fa-money"></i><span> ' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</span></li>';
$str .= '<ul><li><i class="glyphicon glyphicon-home"></i> <span>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</span></li>';
$str .= '<ul><li><i class="fa fa-arrows"></i> <span>' . ($s->floor_dim === null ? 'Not Set' : $s->floor_dim . ' ' . $this->data['floor'][getOptions('floor_metric')]) . '</span></li>';
$str .= '<ul><li><i class="fa fa-table"></i> <span>' . ($s->bedrooms === null ? 'Not Set' : $s->bedrooms . ' bedrooms') . '</span></li>';
$str .= '<ul><li><a href=' . site_url('front/places/details') . '/' . $s->id_places . ' class="btn btn-primary btn-xs">View Details</a></li>';
$str .= '</ul></div>';
$str .= '<div class="col-xs-12 col-sm-12 col-md-7 excerpet">';
$str .= '<h3>' . $s->title_places . ' / ' . $this->data['status'][$s->status] . '</h3>';
$str .= '<p>' . limit_to_numwords(strip_tags($s->desc), 50) . '</p></div>';
// $str .= '<td>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</td>';
// $str .= '<td>' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</td>';
$str .= '<span class="clearfix borda"></span></article>';
}
$str .= '<div>' . $this->pagination->create_links() . '</div>';
$str .= '</section>';
} else {
$str .= 'No Data Found';
}
echo $str;
}
}
示例5: currency
<input type="text" name="job_task[new][description]" id="task_desc_new" class="edit_task_description" value=""><?php
if (class_exists('module_product', false)) {
module_product::print_job_task_dropdown('new');
}
?>
<a href="#" class="task_toggle_long_description ui-icon ui-icon-plus">»</a>
<div class="task_long_description">
<textarea name="job_task[new][long_description]" id="task_long_desc_new" class="edit_task_long_description"></textarea>
</div>
</td>
<td valign="top">
<input type="text" name="job_task[new][hours]" value="" size="3" style="width:25px;" onchange="setamount(this.value,'new');" onkeyup="setamount(this.value,'new');" id="task_hours_new">
</td>
<td valign="top" nowrap="">
<?php
echo currency('<input type="text" name="job_task[new][amount]" value="" id="newtaskamount" class="currency">');
?>
</td>
<td valign="top">
<input type="text" name="job_task[new][date_due]" value="<?php
echo print_date($job['date_due']);
?>
" class="date_field">
</td>
<?php
if (module_config::c('job_allow_staff_assignment', 1)) {
?>
<td valign="top">
<?php
示例6: business_settings
function business_settings($para1 = "", $para2 = "")
{
if (!$this->crud_model->vendor_permission('business_settings')) {
redirect(base_url() . 'index.php/vendor');
}
if ($para1 == "cash_set") {
$val = '';
if ($para2 == 'true') {
$val = 'ok';
} else {
if ($para2 == 'false') {
$val = 'no';
}
}
echo $val;
$this->db->where('vendor_id', $this->session->userdata('vendor_id'));
$this->db->update('vendor', array('cash_set' => $val));
} else {
if ($para1 == "paypal_set") {
$val = '';
if ($para2 == 'true') {
$val = 'ok';
} else {
if ($para2 == 'false') {
$val = 'no';
}
}
echo $val;
$this->db->where('vendor_id', $this->session->userdata('vendor_id'));
$this->db->update('vendor', array('paypal_set' => $val));
} else {
if ($para1 == "stripe_set") {
$val = '';
if ($para2 == 'true') {
$val = 'ok';
} else {
if ($para2 == 'false') {
$val = 'no';
}
}
echo $val;
$this->db->where('vendor_id', $this->session->userdata('vendor_id'));
$this->db->update('vendor', array('stripe_set' => $val));
} else {
if ($para1 == "membership_price") {
echo $this->db->get_where('membership', array('membership_id' => $para2))->row()->price;
} else {
if ($para1 == "membership_info") {
$return = '<div class="table-responsive"><table class="table table-striped">';
if ($para2 !== '0') {
$results = $this->db->get_where('membership', array('membership_id' => $para2))->result_array();
foreach ($results as $row) {
$return .= '<tr>';
$return .= '<td>' . translate('title') . '</td>';
$return .= '<td>' . $row['title'] . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('price') . '</td>';
$return .= '<td>' . currency() . $row['price'] . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('timespan') . '</td>';
$return .= '<td>' . $row['timespan'] . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('maximum_product') . '</td>';
$return .= '<td>' . $row['product_limit'] . '</td>';
$return .= '</tr>';
}
} else {
if ($para2 == '0') {
$return .= '<tr>';
$return .= '<td>' . translate('title') . '</td>';
$return .= '<td>' . translate('default') . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('price') . '</td>';
$return .= '<td>' . translate('free') . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('timespan') . '</td>';
$return .= '<td>' . translate('lifetime') . '</td>';
$return .= '</tr>';
$return .= '<tr>';
$return .= '<td>' . translate('maximum_product') . '</td>';
$return .= '<td>' . $this->db->get_where('general_settings', array('type' => 'default_member_product_limit'))->row()->value . '</td>';
$return .= '</tr>';
}
}
$return .= '</table></div>';
echo $return;
} else {
if ($para1 == 'set') {
$publishable = $this->input->post('stripe_publishable');
$secret = $this->input->post('stripe_secret');
$stripe = json_encode(array('publishable' => $publishable, 'secret' => $secret));
$this->db->where('vendor_id', $this->session->userdata('vendor_id'));
$this->db->update('vendor', array('paypal_email' => $this->input->post('paypal_email')));
$this->db->where('vendor_id', $this->session->userdata('vendor_id'));
$this->db->update('vendor', array('stripe_details' => $stripe));
//.........这里部分代码省略.........
示例7: translate
<small><?php
echo translate('total');
?>
: <?php
echo currency();
echo $this->cart->format_number($items['subtotal'] + $shipping_n + $tax_n);
?>
</small>
<?php
} else {
?>
<small><?php
echo translate('total');
?>
: <?php
echo currency();
echo $this->cart->format_number($items['subtotal'] + $tax_n);
?>
</small>
<?php
}
?>
</div>
</li>
<?php
}
?>
<li class="subtotal" id="subtotal">
<div class="overflow-h margin-bottom-10">
<div>
<span><?php
示例8: currency
invoice_itemqty').val(),<?php
echo $invoice_item_id;
?>
);" onkeyup="setamount($('#<?php
echo $invoice_item_id;
?>
invoice_itemqty').val(),<?php
echo $invoice_item_id;
?>
);">
</td>
<td nowrap="">
<span class="currency">
<?php
//name="invoice_invoice_item[new][amount]"
echo currency('<span value="" id="' . $invoice_item_id . 'invoice_itemamount" class="">' . $invoice_item_data['invoice_item_amount'] . '</span>', true, $invoice['currency_id']);
?>
</span>
<?php
//echo currency('<input type="text" name="invoice_invoice_item['.$invoice_item_id.'][amount]" value="'.$invoice_item_data['invoice_item_amount'].'" id="'.$invoice_item_id.'invoice_itemamount" class="currency">',true,$invoice['currency_id']);
?>
</td>
<td nowrap="nowrap" align="center">
<input type="submit" name="ts" class="save_invoice_item small_button" value="<?php
_e('Save');
?>
">
</td>
示例9: get_finance_summary
//.........这里部分代码省略.........
}
if ($finance_record['debit'] > 0) {
if ($multiplyer > 1) {
$week_day = date('w', strtotime($finance_record['transaction_date'])) - 1;
$finance_record['transaction_date'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($finance_record['transaction_date'])));
}
$key = date("Ymd", strtotime($finance_record['transaction_date']));
if (isset($data[$key])) {
$data[$key]['amount_spent'] += $finance_record['amount'];
$data['total']['amount_spent'] += $finance_record['amount'];
}
}
}
module_debug::log(array('title' => 'Finance Dashboard DONE!', 'data' => ''));
/*$sql = "SELECT p.* ";
$sql .= " FROM `"._DB_PREFIX."invoice_payment` p ";
$sql .= " WHERE (p.date_paid >= '$week_start' AND p.date_paid <= '$week_end')";
// todo - sql in here to limit what they can see.
$payments = query($sql);
// group invoices into days of the week.
while($payment = mysql_fetch_assoc($payments)){
//$invoice_data = module_invoice::get_invoice($i['invoice_id']);
if($multiplyer > 1){
$week_day = date('w',strtotime($payment['date_paid'])) - 1;
$payment['date_paid'] = date('Y-m-d',strtotime('-'.$week_day.' days',strtotime($payment['date_paid'])));
}
$key = date("Ymd",strtotime($payment['date_paid']));
if(isset($data[$key])){
$data[$key]['amount_paid'] += $payment['amount'];
$data['total']['amount_paid'] += $payment['amount'];
}
}*/
if (class_exists('module_envato', false)) {
$envato_currency = "USD";
$envato = new envato_api();
$local_currency = $envato->read_setting("local_currency", "AUD");
$currency_convert_multiplier = $envato->currency_convert($envato_currency, $local_currency);
// find summary of earnings between these dates in the envato statement.
$week_start_time = strtotime($week_start);
$week_end_time = strtotime($week_end);
$sql = "SELECT * FROM `" . _DB_PREFIX . "envato_statement` s WHERE `time` >= '{$week_start_time}' AND `time` <= {$week_end_time}";
$sql .= " AND ( `type` = 'sale' OR `type` = 'referral_cut' )";
foreach (qa($sql) as $sale) {
$sale_time = $sale['time'];
if ($multiplyer > 1) {
$week_day = date('w', $sale_time) - 1;
$sale_time = strtotime('-' . $week_day . ' days', $sale_time);
}
$key = date("Ymd", $sale_time);
if (!isset($data[$key])) {
continue;
}
$data[$key]['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
$data['total']['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
/*if($sale['type']=='sale'){
$sales_count++;
}
$sales_amount+= $sale['earnt'];*/
}
}
if ($multiplyer > 1) {
// dont want totals on previous weeks listing
unset($data['total']);
}
foreach ($data as $data_id => $row) {
//$row['amount'] = dollar($row['amount']);
示例10: currency_output
/**
* Returns unformatted currency string
* Or unformatted if payments is not installed
*
* @param int $params['cur_id'] currency id
* @param string $params['cur_gid'] currency gid
* @param int $params['value'] amount
* @param string $params['template'] [abbr][value|dec_part:2|dec_sep:.|gr_sep: ]
* @return string
*/
function currency_output($params = array())
{
$CI =& get_instance();
if ($CI->pg_module->is_module_installed('payments')) {
$CI->load->helper('payments');
return currency($params);
} else {
return '<span dir="ltr">' . $params['value'] . ' USD</span>';
}
}
示例11: foreach
if ($keranjang != null) {
foreach ($keranjang as $key => $val) {
if ($val['type'] == 'retail') {
$harga = get_post_meta($val['id'], 'mtb_harga_satuan_retail', true);
} else {
if ($val['jumlah'] < 10) {
$harga = get_post_meta($val['id'], 'mtb_harga_grossir_5_item', true);
} else {
$harga = get_post_meta($val['id'], 'mtb_harga_grossir_10_item', true);
}
}
$url = wp_get_attachment_url(get_post_thumbnail_id($val['id']));
if ($url != "") {
echo '<li><img style="width: 25%;" src="' . $url . '"><span>' . get_the_title($val['id'], 'thumbnail') . ' <br/>' . currency($harga) . '</span></li>';
} else {
echo '<li><span>' . get_the_title($val['id'], 'thumbnail') . ' <br/>' . currency($harga) . '</span></li>';
}
}
?>
<li class="for-link">
<a title="<?php
_e('View Cart', 'ferina');
?>
" href="<?php
get_the_permalink(get_option('cart_pages'));
?>
"><?php
_e('View Cart', 'ferina');
?>
</a>
<a title="<?php
示例12: loadImgProduk
"><?php
echo loadImgProduk($lsrate->id . '/' . $lsrate->idgbr . '/' . $gb);
?>
</a><? }?><br />
<? if($hb==0){?>
<span class="rp">Rp. <?php
echo currency($ha);
?>
</span>
<? }else{?>
<span class="rpline">Rp. <?php
echo currency($ha);
?>
</span><br />
<span class="rp">Rp. <?php
echo currency($hb);
?>
</span>
<? }?>
<? //------ rating bintang
$def_width_star3=11; // artinya 11px
$total_width_star3=0;
if($lsrate->rate!=0){
$res_rate3=$lsrate->rate/$lsrate->cust;
$total_width_star3=ceil($def_width_star3*$res_rate3);
}
?>
<ul style="margin-left:80px;margin-top:5px;">
<li style="text-align:right;float:left;padding-top:3px">
<div id="staroff" style="float:right"><div id="staron" style="width:<?php
示例13: get_ajax
public function get_ajax($offset = 0)
{
$count = $this->m_places->get_place();
$perpage = getOptions('paging');
if (count($count) > $perpage) {
$this->load->library('pagination');
$config['base_url'] = site_url('admin/places/get_ajax');
$config['total_rows'] = count($count);
$config['per_page'] = $perpage;
$config['uri_segment'] = 4;
$q = $this->pagination->initialize($config);
$offset = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
} else {
$this->data['pagination'] = '';
$offset = 0;
}
$telo = $this->m_places->get_place($perpage, $offset);
$str = '';
if ($telo) {
$str .= '<table class="table table-bordered table-condensed"">
<thead>
<tr class="active">
<th class="text-center">Image</th>
<th class="text-center">Title</th>
<th class="text-center">Type</th>
<th class="text-center">Price</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>';
foreach ($telo as $s) {
$str .= '<tr class="text-center">';
$str .= $s->image ? '<td class="col-md-1"><img src="' . base_url('assets/img/timthumb.php') . '?src=' . base_url($s->image) . '&zc=0&h=140&w=180"></td>' : '<td class="col-md-1"><img class="img-responsive" src="http://placehold.it/100x100&text=no+primary+image"></td>';
$str .= '<td>' . $s->title_places . '</td>';
$str .= '<td>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</td>';
$str .= '<td>' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</td>';
$str .= '<td><a href="' . site_url('admin/places/edit') . '/' . $s->id_places . '" class="btn btn-default">Edit</a>';
$str .= '<a id="del-' . $s->id_places . '" href="' . site_url('admin/places/del_places') . '/' . $s->id_places . '" class="btn btn-default del-in">Delete</a></td>';
$str .= '</tr>';
}
$str .= '<tbody></table>';
$str .= '<div>' . $this->pagination->create_links() . '</div>';
} else {
$str .= 'No Data Found';
}
echo $str;
}
示例14: currency
// no hour input
} else {
echo $hours_value;
}
}
?>
</td>
<?php
if (module_invoice::can_i('view', 'Invoices')) {
?>
<td nowrap="">
<?php
if ($task_editable) {
?>
<?php
echo currency('<input type="text" name="job_task[' . $task_id . '][staff_amount]" value="' . ($task_data['staff_amount'] != 0 ? number_out($task_data['staff_amount']) : number_out($task_data['staff_hours'] * $job['staff_hourly_rate'])) . '" id="' . $task_id . 'staff_taskamount" class="currency" tabindex="15">');
?>
<?php
} else {
?>
<?php
echo $task_data['staff_amount'] != 0 ? dollar($task_data['staff_amount'], true, $job['currency_id']) : dollar($task_data['staff_hours'] * $job['staff_hourly_rate'], true, $job['currency_id']);
?>
<?php
}
?>
</td>
<?php
}
?>
<td colspan="<?php
示例15: wordvar
PV
</h4>
</td>
</tr>
<tr>
<td class="text-right" colspan="5">
<h4 class="text-primary">
<?php
echo wordvar('Net Total');
?>
</h4>
</td>
<td>
<h4 class="text-primary">
<?php
echo currency($order['order_total']);
?>
</h4>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="well">
<strong><?php
echo wordvar('Notes');