本文整理汇总了PHP中appthemes_get_price函数的典型用法代码示例。如果您正苦于以下问题:PHP appthemes_get_price函数的具体用法?PHP appthemes_get_price怎么用?PHP appthemes_get_price使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了appthemes_get_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_the_order_total
public function test_get_the_order_total()
{
$total = get_the_order_total(self::$order->get_id());
$this->assertEquals($total, appthemes_get_price(self::$order->get_total(), self::$order->get_currency()));
$this->expectOutputString($total);
the_order_total(self::$order->get_id());
}
示例2: appthemes_display_mixed_price
function appthemes_display_mixed_price($mixed_prices)
{
$strings = array();
foreach ($mixed_prices as $currency => $amount) {
$strings[] = appthemes_get_price($amount, $currency, 'code');
}
echo join('</br> ', $strings);
}
示例3: row
protected function row($item)
{
if (!APP_Item_Registry::is_registered($item['type'])) {
return html('tr', array(), html('td', array('colspan' => '3', 'style' => 'font-style: italic;'), __('This item could not be recognized. It might be from another theme or an uninstalled plugin.', APP_TD)));
}
$ptype_obj = get_post_type_object($item['post']->post_type);
$item_link = $ptype_obj->public ? html_link(get_permalink($item['post_id']), $item['post']->post_title) : '';
$cells = array(APP_Item_Registry::get_title($item['type']), appthemes_get_price($item['price'], $this->currency), $item_link);
return html('tr', array(), $this->cells($cells));
}
示例4: cp_other_fields
/**
* Displays the non-custom fields below the main listing submission form.
*
* @param int $listing_id
*
* @return void
*/
function cp_other_fields($listing_id)
{
global $cp_options;
// are images on ads allowed
if ($cp_options->ad_images) {
if (appthemes_plupload_is_enabled()) {
echo html('div class="ad-details-images-sep"', ' ');
appthemes_plupload_form($listing_id);
} else {
$images_count = cp_get_ad_images($listing_id);
cp_ad_edit_image_input_fields($images_count);
}
}
// show the chargeable options if enabled
if (cp_payments_is_enabled()) {
// show the featured ad box if enabled
if ($cp_options->sys_feat_price) {
?>
<div class="ad-details-featured-sep"></div>
<li id="list_featured_ad" class="withborder">
<div class="labelwrapper">
<label><?php
printf(__('Featured Listing %s', APP_TD), appthemes_get_price($cp_options->sys_feat_price));
?>
</label>
</div>
<div class="clr"></div>
<input name="featured_ad" value="1" type="checkbox" <?php
checked(is_sticky($listing_id));
?>
/>
<?php
_e('Your listing will appear in the featured slider section at the top of the front page.', APP_TD);
?>
<div class="clr"></div>
</li>
<?php
}
if ($cp_options->price_scheme == 'single') {
?>
<li>
<div class="labelwrapper">
<label><?php
_e('Ad Package:', APP_TD);
?>
</label>
</div>
<?php
// go get all the active ad packs and create a drop-down of options
$packages = cp_get_listing_packages();
if ($packages) {
?>
<select name="ad_pack_id" class="dropdownlist required">
<?php
foreach ($packages as $package) {
// external plugins can modify or disable field
$result = apply_filters('cp_package_field', $package, 'ad');
if (!$package) {
continue;
}
?>
<option value="<?php
echo esc_attr($package->ID);
?>
"><?php
echo esc_attr($package->pack_name);
?>
</option>
<?php
}
?>
</select>
<?php
} else {
_e('Error: no ad pack has been defined. Please contact the site administrator.', APP_TD);
}
?>
<div class="clr"></div>
</li>
<?php
}
?>
//.........这里部分代码省略.........
示例5: stripslashes
echo $rowclass . ' ' . $requiredClass;
?>
">
<td><strong><?php
echo stripslashes($result->pack_name);
?>
</strong><a class="tip" tip="<?php
echo $result->pack_desc;
?>
" tabindex="99"><div class="helpico"></div></a></td>
<td><?php
echo $benefit;
?>
</td>
<td><?php
printf(__('%1$s / %2$s days', APP_TD), appthemes_get_price($result->pack_membership_price), $result->pack_duration);
?>
</td>
<td><input type="submit" name="step1" id="step1" class="btn_orange" onclick="document.getElementById('pack').value=<?php
echo $result->pack_id;
?>
;" value="<?php
_e('Buy Now ››', APP_TD);
?>
" style="margin-left: 5px; margin-bottom: 5px;" /></td>
</tr>
<?php
}
// end for each
?>
示例6: _e
<input type="submit" name="getcat" id="getcat" class="btn_orange" value="<?php
_e('Go ››', APP_TD);
?>
" />
<div id="chosenCategory"><input id="ad_cat_id" name="cat" type="hidden" value="15" /></div>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
</li>
<?php
} else {
if ($cp_options->price_scheme == 'category' && cp_payments_is_enabled()) {
$prices = $cp_options->price_per_cat;
$cat_fee = isset($prices[$category->term_id]) ? (double) $prices[$category->term_id] : 0;
$cat_fee = ' - ' . appthemes_get_price($cat_fee);
} else {
$cat_fee = '';
}
?>
<li>
<div class="labelwrapper"><label><?php
_e('Category:', APP_TD);
?>
</label></div>
<strong><?php
echo $category->name;
?>
</strong><?php
echo $cat_fee;
示例7: cp_get_membership_package_benefit_text
/**
* Returns membership package benefit text.
*
* @param int $pack_id
*
* @return string
*/
function cp_get_membership_package_benefit_text($pack_id)
{
global $cp_options;
if (!current_theme_supports('app-price-format')) {
return '';
}
$package = cp_get_membership_package($pack_id);
if (!$package) {
return '';
}
$benefit = '';
if (!$cp_options->charge_ads) {
$benefit .= __('Free Posting', APP_TD);
} else {
if ($package->pack_type == 'percentage') {
//$benefit .= sprintf( __( '%s%% of price', APP_TD ), preg_replace( '/.00$/', '', $package->price_modifier ) ); //remove decimal when decimal is .00
$benefit .= sprintf(__('%s%% of price', APP_TD), (double) $package->price_modifier);
} else {
if ($package->pack_type == 'discount') {
$benefit .= sprintf(__('%s\'s less per ad', APP_TD), appthemes_get_price($package->price_modifier));
} else {
if ($package->pack_type == 'static') {
if ($package->price_modifier == 0) {
$benefit .= __('Free Posting', APP_TD);
} else {
$benefit .= sprintf(__('%s per ad', APP_TD), appthemes_get_price($package->price_modifier));
}
}
}
}
}
if (!empty($benefit) && $package->pack_satisfies_required) {
$benefit .= ' (' . __('required to post', APP_TD) . ')';
}
return $benefit;
}
示例8: cp_ad_packs
//.........这里部分代码省略.........
<?php
foreach ($results as $result) {
if ($result->pack_status == 'active_membership' || $result->pack_status == 'inactive_membership') {
$rowclass = 'even' == $rowclass ? 'alt' : 'even';
?>
<tr class="<?php
echo $rowclass;
?>
">
<td style="padding-left:10px;"><?php
echo $i++;
?>
.</td>
<td><a href="?page=packages&action=editpack&type=membership&id=<?php
echo $result->pack_id;
?>
"><strong><?php
echo stripslashes($result->pack_name);
?>
</strong></a></td>
<td><?php
echo $result->pack_desc;
?>
</td>
<td>
<?php
switch ($result->pack_type) {
case 'percentage':
echo preg_replace('/.00$/', '', $result->pack_price) . '% ' . __('of price', APP_TD);
//remove decimal when decimal is .00
break;
case 'discount':
printf(__('%s\'s less per ad', APP_TD), appthemes_get_price($result->pack_price));
break;
case 'required_static':
if ((double) $result->pack_price == 0) {
_e('Free', APP_TD);
} else {
printf(__('%s per ad', APP_TD), appthemes_get_price($result->pack_price));
}
echo ' (' . __('required to post', APP_TD) . ')';
break;
case 'required_discount':
printf(__('%s\'s less per ad', APP_TD), appthemes_get_price($result->pack_price));
echo ' (' . __('required to post', APP_TD) . ')';
break;
case 'required_percentage':
echo preg_replace('/.00$/', '', $result->pack_price) . '% ' . __('of price', APP_TD);
//remove decimal when decimal is .00
echo ' (' . __('required to post', APP_TD) . ')';
break;
default:
//likely 'static'
if ((double) $result->pack_price == 0) {
_e('Free', APP_TD);
} else {
printf(__('%s per ad', APP_TD), appthemes_get_price($result->pack_price));
}
}
?>
</td>
<td><?php
printf(__('%1$s / %2$s days', APP_TD), appthemes_get_price($result->pack_membership_price), $result->pack_duration);
?>
</td>
示例9: appthemes_order_add_column_data
/**
* Outputs column data for orders
* @param string $column_index Name of the column being processed
* @param int $post_id ID of order being dispalyed
* @return void
*/
function appthemes_order_add_column_data($column_index, $post_id)
{
$order = appthemes_get_order($post_id);
switch ($column_index) {
case 'order':
echo '<a href="' . get_edit_post_link($post_id) . '">' . $order->get_ID() . '</a>';
break;
case 'order_author':
$user = get_userdata($order->get_author());
echo $user->display_name;
echo '<br>';
echo $order->get_ip_address();
break;
case 'item':
$count = count($order->get_items());
$string = _n('Purchased %s item', 'Purchased %s items', $count, APP_TD);
printf($string, $count);
break;
case 'price':
$currency = $order->get_currency();
if (!empty($currency)) {
echo appthemes_get_price($order->get_total(), $order->get_currency());
} else {
echo appthemes_get_price($order->get_total());
}
break;
case 'payment':
$gateway_id = $order->get_gateway();
if (!empty($gateway_id)) {
$gateway = APP_Gateway_Registry::get_gateway($gateway_id);
if ($gateway) {
echo $gateway->display_name('admin');
} else {
_e('Unknown', APP_TD);
}
} else {
_e('Undecided', APP_TD);
}
echo '</br>';
$status = $order->get_display_status();
if ($order->get_status() == APPTHEMES_ORDER_PENDING) {
echo '<strong>' . ucfirst($status) . '</strong>';
} else {
echo ucfirst($status);
}
break;
case 'status':
echo ucfirst($order->get_status());
break;
case 'order_date':
$order_post = get_post($order->get_ID());
if ('0000-00-00 00:00:00' == $order_post->post_date) {
$t_time = $h_time = __('Unpublished', APP_TD);
$time_diff = 0;
} else {
$t_time = get_the_time(_x('Y/m/d g:i:s A', 'Order Date Format', APP_TD));
$m_time = $order_post->post_date;
$time = get_post_time('G', true, $order_post);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
$h_time = sprintf(__('%s ago', APP_TD), human_time_diff($time));
} else {
$h_time = mysql2date(_x('Y/m/d', 'Order Date Format', APP_TD), $m_time);
}
}
echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
break;
}
}
示例10: get_category_fee
/**
* Returns listing category fee.
*
* @param int $category_id
*
* return string
*/
protected function get_category_fee($category_id)
{
global $cp_options;
if ($cp_options->price_scheme == 'category' && cp_payments_is_enabled()) {
$prices = $cp_options->price_per_cat;
$category_fee = isset($prices[$category_id]) ? (double) $prices[$category_id] : 0;
$category_fee = ' - ' . appthemes_get_price($category_fee);
} else {
$category_fee = '';
}
return $category_fee;
}
示例11: printf
echo $rowclass . ' ' . $requiredClass;
?>
">
<td><strong><?php
echo $package->pack_name;
?>
</strong><a class="tip" tip="<?php
echo $package->description;
?>
" tabindex="99"><div class="dashicons-before helpico"></div></a></td>
<td><?php
echo $benefit;
?>
</td>
<td><?php
printf(__('%1$s / %2$s days', APP_TD), appthemes_get_price($package->price), $package->duration);
?>
</td>
<td><input type="submit" name="step1" id="step1" class="btn_orange" onclick="document.getElementById('pack').value=<?php
echo $package->ID;
?>
;" value="<?php
echo esc_attr_e('Buy Now ››', APP_TD);
?>
" style="margin-left: 5px; margin-bottom: 5px;" /></td>
</tr>
<?php
}
// end for each
?>
示例12: cp_custom_fields_meta_box
function cp_custom_fields_meta_box()
{
global $wpdb, $post, $meta_boxes;
// use nonce for verification
wp_nonce_field(basename(__FILE__), 'ad_meta_wpnonce', false, true);
// get the ad category id
$ad_cat_id = appthemes_get_custom_taxonomy($post->ID, APP_TAX_CAT, 'term_id');
// get the form id
$fid = cp_get_form_id($ad_cat_id);
// if there's no form id it must mean the default form is being used so let's go grab those fields
if (!$fid) {
// use this if there's no custom form being used and give us the default form
$sql = "SELECT field_label, field_name, field_type, field_values, field_tooltip, field_req FROM {$wpdb->cp_ad_fields} WHERE field_core = '1' ORDER BY field_id asc";
} else {
// now we should have the formid so show the form layout based on the category selected
$sql = $wpdb->prepare("SELECT f.field_label, f.field_name, f.field_type, f.field_values, f.field_perm, f.field_tooltip, m.meta_id, m.field_pos, m.field_req, m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $fid);
}
$results = $wpdb->get_results($sql);
// display the write panel for the custom fields
if ($results) {
?>
<script type="text/javascript">
//<![CDATA[
/* initialize the datepicker feature */
jQuery(document).ready(function($) {
$('table input#datepicker').datetimepicker({
showSecond: true,
timeFormat: 'hh:mm:ss',
showOn: 'button',
dateFormat: 'yy-mm-dd',
minDate: 0,
buttonImageOnly: true,
buttonText: '',
buttonImage: '../wp-includes/images/blank.gif' // calling the real calendar image in the admin.css. need a blank placeholder image b/c of IE.
});
});
//]]>
</script>
<table class="form-table ad-meta-table">
<tr>
<th style="width:20%"><label for="cp_sys_ad_conf_id"><?php
_e('Ad Info', APP_TD);
?>
:</label></th>
<td class="ad-conf-id">
<div id="ad-id"><div id="keyico"></div><?php
_e('Ad ID', APP_TD);
?>
: <span><?php
echo esc_html(get_post_meta($post->ID, 'cp_sys_ad_conf_id', true));
?>
</span></div>
<div id="ad-stats"><div id="statsico"></div><?php
_e('Views Today', APP_TD);
?>
: <strong><?php
echo esc_html(get_post_meta($post->ID, 'cp_daily_count', true));
?>
</strong> | <?php
_e('Views Total:', APP_TD);
?>
<strong><?php
echo esc_html(get_post_meta($post->ID, 'cp_total_count', true));
?>
</strong></div>
</td>
</tr>
<tr>
<th style="width:20%"><label for="cp_sys_ad_conf_id"><?php
_e('Submitted By', APP_TD);
?>
:</label></th>
<td style="line-height:3.4em;">
<?php
// show the gravatar for the author
echo get_avatar($post->post_author, $size = '48', $default = '');
// show the author drop-down box
wp_dropdown_users(array('who' => 'authors', 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author, 'include_selected' => true));
// display the author display name
$author = get_userdata($post->post_author);
echo '<br/><a href="user-edit.php?user_id=' . $author->ID . '">' . $author->display_name . '</a>';
?>
</td>
</tr>
<?php
if (cp_payments_is_enabled()) {
?>
<tr>
<th style="width:20%"><label for="cp_sys_total_ad_cost"><?php
_e('Ad Terms', APP_TD);
?>
:</label></th>
<td><?php
printf(__('%1$s for %2$s days', APP_TD), appthemes_get_price(get_post_meta($post->ID, 'cp_sys_total_ad_cost', true)), get_post_meta($post->ID, 'cp_sys_ad_duration', true));
?>
//.........这里部分代码省略.........
示例13: cp_other_fields
function cp_other_fields($renew_id = false)
{
global $wpdb, $cp_options;
// are images on ads allowed
if ($cp_options->ad_images) {
if (appthemes_plupload_is_enabled()) {
echo appthemes_plupload_form($renew_id);
} else {
if ($renew_id) {
$imagecount = cp_get_ad_images($renew_id);
echo cp_ad_edit_image_input_fields($imagecount);
} else {
echo cp_image_input_fields();
}
}
}
// show the chargeable options if enabled
if (cp_payments_is_enabled()) {
// show the featured ad box if enabled
if ($cp_options->sys_feat_price) {
?>
<li id="list_featured_ad" class="withborder">
<div class="labelwrapper">
<label><?php
printf(__('Featured Listing %s', APP_TD), appthemes_get_price($cp_options->sys_feat_price));
?>
</label>
</div>
<div class="clr"></div>
<input name="featured_ad" value="1" type="checkbox" <?php
checked(isset($_POST['featured_ad']));
?>
/>
<?php
_e('Your listing will appear in the featured slider section at the top of the front page.', APP_TD);
?>
<div class="clr"></div>
</li>
<?php
}
if ($cp_options->price_scheme == 'single') {
?>
<li>
<div class="labelwrapper">
<label><?php
_e('Ad Package:', APP_TD);
?>
</label>
</div>
<?php
// go get all the active ad packs and create a drop-down of options
$results = $wpdb->get_results("SELECT * FROM {$wpdb->cp_ad_packs} WHERE pack_status = 'active' ORDER BY pack_id asc");
if ($results) {
?>
<select name="ad_pack_id" class="dropdownlist required">
<?php
foreach ($results as $result) {
// external plugins can modify or disable field
$result = apply_filters('cp_package_field', $result, 'ad');
if (!$result) {
continue;
}
?>
<option value="<?php
echo esc_attr($result->pack_id);
?>
"><?php
echo esc_attr(stripslashes($result->pack_name));
?>
</option>
<?php
}
?>
</select>
<?php
} else {
_e('Error: no ad pack has been defined. Please contact the site administrator.', APP_TD);
}
?>
<div class="clr"></div>
</li>
<?php
}
?>
<?php
}
// end charge for ads check
}
示例14: cp_category_dropdown_price
/**
* Helper function for generating dropdown list of categories with prices.
* Determines when the price should be displayed.
*
* @param object $category
* @param array $args
*
* @return string
*/
function cp_category_dropdown_price($category, $args)
{
global $cp_options;
if ($cp_options->price_scheme != 'category' || !cp_payments_is_enabled()) {
return '';
}
if ($cp_options->ad_parent_posting == 'no' && $category->parent == 0) {
return '';
}
if ($cp_options->ad_parent_posting == 'whenEmpty' && $category->parent == 0) {
$child_terms = get_terms($args['taxonomy'], array('parent' => $category->term_id, 'number' => 1, 'hide_empty' => 0));
if (!empty($child_terms)) {
return '';
}
}
$prices = $cp_options->price_per_cat;
$cat_price = isset($prices[$category->term_id]) ? (double) $prices[$category->term_id] : 0;
return ' - ' . appthemes_get_price($cat_price);
}
示例15: test_output
public function test_output()
{
$string = appthemes_get_price(1);
$this->expectOutputString($string);
appthemes_display_price(1);
}