Пример #1
0
 public function item_column($item, $column)
 {
     switch ($column) {
         case 'name':
             if ($item->description) {
                 $description = sprintf('%s<p>%s</p>', esc_html($item->get_name()), esc_html($item->description));
             } else {
                 $description = esc_html($item->get_name());
             }
             return $description;
         case 'ads':
             return esc_html($item->get_allowed_ads_count());
         case 'images':
             return esc_html($item->images);
         case 'title_characters':
             $characters = $item->get_characters_allowed_in_title();
             $characters = empty($characters) ? _x('No Limit', 'payment term duration', 'AWPCP') : $characters;
             return esc_html($characters);
         case 'characters':
             $characters = $item->get_characters_allowed();
             $characters = empty($characters) ? _x('No Limit', 'payment term duration', 'AWPCP') : $characters;
             return esc_html($characters);
         case 'duration':
             return esc_html($item->get_duration());
         case 'price':
             return $this->render_payment_option($this->item_id($item, AWPCP_Payment_Transaction::PAYMENT_TYPE_MONEY), awpcp_format_money($item->price), $this->selected);
         case 'credits':
             return $this->render_payment_option($this->item_id($item, AWPCP_Payment_Transaction::PAYMENT_TYPE_CREDITS), number_format($item->credits, 0), $this->selected);
     }
 }
 /**
  * Renders a single value of the given Extra Field applying
  * proper format depending on the fields validator.
  *
  * Only URL validator is supported so far.
  *
  * @since  2.0.5
  */
 function awpcp_extra_fields_render_field_single_value($field, $value)
 {
     $v = stripslashes_deep(trim($value));
     if ($field->field_validation == 'url') {
         return sprintf('<a href="%s" target="_blank">%s</a>', esc_attr($value), esc_html($value));
     } else {
         if ($field->field_validation == 'email') {
             return sprintf('<a href="mailto:%s" target="_blank">%s</a>', esc_attr($value), esc_html($value));
         } else {
             if ($field->field_validation == 'currency') {
                 return awpcp_format_money($v);
             } else {
                 if ($field->field_input_type == 'DatePicker') {
                     return awpcp_datetime('awpcp-date', $v);
                 } else {
                     return nl2br(esc_html($v));
                 }
             }
         }
     }
 }
Пример #3
0
/**
 * @since 3.0
 */
function awpcp_do_placeholder_price($ad, $placeholder)
{
    $price = empty($ad->ad_item_price) ? 0 : $ad->ad_item_price / 100;
    $show_price_field = get_awpcp_option('displaypricefield') == 1;
    $user_can_see_price_field = is_user_logged_in() || get_awpcp_option('price-field-is-restricted') == 0;
    if (get_awpcp_option('hide-price-field-if-empty') && $price <= 0) {
        $show_price_field = false;
    }
    $replacements = array();
    if ($show_price_field && $user_can_see_price_field && $price >= 0) {
        $escaped_label = esc_html(__('Price', 'AWPCP'));
        $escaped_currency = esc_html(awpcp_format_money($price));
        // single ad
        $content = '<div class="showawpcpadpage"><label>%s</label>: <strong>%s</strong></div>';
        $replacements['aditemprice'] = sprintf($content, $escaped_label, $escaped_currency);
        // listings
        $replacements['awpcp_display_price'] = sprintf('%s: %s', $escaped_label, $escaped_currency);
        $replacements['price'] = $escaped_currency;
    }
    return awpcp_array_data($placeholder, '', $replacements);
}
    ?>
        <tr>
            <td class="row-header"><?php 
    _ex('Total Amount (credit)', 'transaction items', 'AWPCP');
    ?>
</td>
            <td class="amount"><?php 
    echo esc_html(number_format($totals['credits'], 0));
    ?>
</td>
        </tr>
        <?php 
}
?>

        <tr>
            <?php 
$label = sprintf('%s (%s)', _x('Total Amount', 'transaction items', 'AWPCP'), awpcp_get_currency_symbol());
?>
            <td class="row-header"><?php 
echo esc_html($label);
?>
</td>
            <td class="amount"><?php 
echo esc_html(awpcp_format_money($totals['money']));
?>
</td>
        </tr>
    </tfoot>
</table>
        _e("Payment Transaction", "AWPCP");
        ?>
: <?php 
        echo $transaction->get('txn-id');
        ?>
 
<?php 
    }
    if ($show_total_amount) {
        echo esc_html(__('Order Total', 'AWPCP'));
        ?>
 (<?php 
        echo esc_html($currency_code);
        ?>
): <?php 
        echo esc_html(awpcp_format_money($total_amount));
        ?>
 
<?php 
    }
    if ($show_total_credits) {
        echo esc_html(__('Order Total (credits)', 'AWPCP'));
        ?>
: <?php 
        echo esc_html($total_credits);
        ?>
 
<?php 
    }
    ?>