<?php

$project = new ID_Project(null);
/*
1. Currency Code and Value
*/
$cCode = $project->currency_code();
Пример #2
0
/**
 * Filter function to display formatted currency only with currency symbol
 */
function id_display_currency_filter($amount, $post_id)
{
    // Getting the currency of the project, first getting project id if currency code is not coming in the arguments
    $project_id = get_post_meta($post_id, 'ign_project_id', true);
    // Now getting currency
    $project = new ID_Project($project_id);
    $currency_code = $project->currency_code();
    if ("right" == apply_filters('id_currency_symbol_position', 'left', $post_id)) {
        $amount = $amount . " " . $currency_code;
    } else {
        $amount = $currency_code . $amount;
    }
    return $amount;
}
Пример #3
0
function manage_ign_product_columns($column_name, $id)
{
    global $post;
    require 'languages/text_variables.php';
    $post_id = $post->ID;
    $project_id = get_post_meta($id, 'ign_project_id', true);
    $project = new ID_Project($project_id);
    $cCode = $project->currency_code();
    switch ($column_name) {
        // display goal amount with currency formatting
        case 'author':
            echo !empty($post->post_author) ? $post->post_author : __('None', 'ignitiondeck');
            break;
        case 'type':
            $type = get_post_meta($post_id, 'ign_project_type', true);
            if (isset($type)) {
                if ($type == 'pwyw') {
                    $type = __('Pledge What You Want', 'Ignitiondeck');
                } else {
                    if ($type == 'level-based') {
                        $type = __('Level-Based', 'ignitiondeck');
                    }
                }
            }
            $type = apply_filters('id_project_type', $type);
            echo isset($type) ? $type : '';
            break;
        case 'goal':
            if (get_post_meta($post->ID, 'ign_fund_goal', true)) {
                $goal_amt = number_format(get_post_meta($post->ID, 'ign_fund_goal', true), 2, '.', ',');
                setlocale(LC_MONETARY, 'en_US');
                echo $cCode . $goal_amt;
            } else {
                echo '<em>' . $tr_No_Goal_set . '</em>';
            }
            break;
        case 'raised':
            if (isset($project_id)) {
                $project = new ID_Project($project_id);
                $post_id = $project->get_project_postid();
                $raised = apply_filters('id_funds_raised', $project->get_project_raised(), $post_id);
                echo $raised;
            }
            break;
            // display end date
        // display end date
        case 'enddate':
            if (get_post_meta($post->ID, 'ign_fund_end', true)) {
                echo get_post_meta($post->ID, 'ign_fund_end', true);
            } else {
                echo '<em>' . $tr_No_Date_set . '</em>';
            }
            break;
            // calculate days remaining
        // calculate days remaining
        case 'daysleft':
            if (get_post_meta($post->ID, 'ign_fund_end', true)) {
                $days_left = $project->days_left();
                //$ending = get_post_meta( $post->ID, 'ign_fund_end', true);
                //$daysleft = ID_Project::days_left($ending);
                echo $days_left;
            } else {
                echo '<em>' . $tr_No_Date_set . '</em>';
            }
            break;
            // return standard post columns
        // return standard post columns
        default:
            break;
    }
    // end switch
}