function currency_code() { $project_settings = self::get_project_settings(); if (empty($project_settings)) { $project_settings = self::get_project_defaults(); } if (!empty($project_settings)) { $currencyCodeValue = $project_settings->currency_code; } else { $currencyCodeValue = 'USD'; } $cCode = setCurrencyCode($currencyCodeValue); return $cCode; }
function hDeck() { //$the_project = parent::the_project(); $prod_settings = parent::get_project_settings(); if (empty($prod_settings)) { $prod_settings = getProductDefaultSettings(); } $post_id = parent::get_project_postid(); $end_type = get_post_meta($post_id, 'ign_end_type', true); $item_fund_goal = apply_filters('id_project_goal', parent::the_goal(), $post_id); $p_current_sale = apply_filters('id_funds_raised', parent::get_project_raised(), $post_id); // $item_fund_end = parent::end_date(); $end_day = parent::end_day(); $end_month = parent::end_month(); $end_year = parent::end_year(); $days_left = parent::days_left(); // $rating_per = apply_filters('id_percentage_raised', parent::percent(), apply_filters('id_funds_raised', parent::get_project_raised(), $post_id, true), $post_id, apply_filters('id_project_goal', parent::the_goal(), $post_id, true)); //$p_count = new stdClass; //$p_count->p_number = parent::get_project_orders(); $p_number = apply_filters('id_number_pledges', parent::get_project_orders(), $post_id); $currencyCodeValue = $prod_settings->currency_code; $cCode = setCurrencyCode($currencyCodeValue); $hDeck = new stdClass(); $hDeck->end_type = $end_type; $hDeck->goal = $item_fund_goal; $hDeck->total = $p_current_sale; // what is this for? //$hDeck->show_dates = $show_dates; $hDeck->end = $item_fund_end; $hDeck->day = $end_day; $hDeck->month = apply_filters('id_end_month', $end_month); $hDeck->year = $end_year; $hDeck->days_left = apply_filters('id_project_days_left', $days_left, $post_id); // $hDeck->percentage = $rating_per; $hDeck->pledges = $p_number; $hDeck->currency_code = $cCode; return $hDeck; }
function id_purchase_form() { $project = new ID_Project($this->project_id); $the_project = $project->the_project(); $project_id = $this->project_id; $post_id = $project->get_project_postid(); $project_settings = $project->get_project_settings(); if (empty($prod_settings)) { $defaults = $project->get_project_defaults(); $project_settings = $defaults; } $no_levels = get_post_meta($post_id, "ign_product_level_count", true); $project_type = get_post_meta($post_id, 'ign_project_type', true); $project_desc = get_post_meta($post_id, "ign_product_level_1_desc", true); $level_data = $project->get_level_data($post_id, $no_levels); // level one stuff $level_one_data = new stdClass(); $is_level_invalid = getLevelLimitReached($this->project_id, $post_id, 1); $meta_title = $the_project->ign_product_title; $meta_price = get_post_meta($post_id, "ign_product_price", true); $meta_desc = $the_project->product_details; $meta_order = get_post_meta($post_id, 'ign_projectmeta_level_order', true); $level_one_data->is_level_invalid = $is_level_invalid; $level_one_data->meta_title = $meta_title; $level_one_data->meta_price = $meta_price; $level_one_data->meta_desc = $meta_desc; $level_one_data->meta_order = $meta_order; $level_one_data->id = 1; // add level one to object array_unshift($level_data, $level_one_data); $custom_level_order = get_post_meta($post_id, 'custom_level_order', true); if ($custom_level_order) { usort($level_data, 'ID_Project::level_sort'); } //GETTING the currency symbols $currencyCodeValue = $project_settings->currency_code; $cCode = setCurrencyCode($currencyCodeValue); //GETTING the form settings $form_settings = getProductFormSettings($project_id); if (!isset($form_settings)) { $form_settings = $project_settings->form_settings; $form_settings = unserialize($form_settings); } else { $form_settings = unserialize($form_settings); } $form_id = rand(21927391, 92817275); // Getting the Payment method first, to load the appropriate URLs if needed and // submit button name // this is paypal code that could be removed if disabled $payment_method = getDefaultPaymentMethod(); if (isset($payment_method) && $payment_method->payment_gateway == "adaptive_paypal") { $adaptive_pay_settings = getAdaptivePayPalSettings(); if (isset($adaptive_pay_settings)) { if ($adaptive_pay_settings->paypal_mode == "sandbox") { $paypal_address = "https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay"; } else { $paypal_address = "https://www.paypal.com/webapps/adaptivepayment/flow/pay"; } if ($adaptive_pay_settings->fund_type == 'fixed') { $submit_btn_name = 'btnSubmitPreapproval'; } else { $submit_btn_name = "submitPaymentAdaptive"; } } } else { $submit_btn_name = "submitPaymentPopup"; //will be caught by standard payments function for Paypal } $purchase_form = new stdClass(); $purchase_form->project_id = $project_id; $purchase_form->post_id = $post_id; $purchase_form->the_project = $the_project; $purchase_form->project_settings = $project_settings; $purchase_form->no_levels = $no_levels; $purchase_form->level_data = $level_data; $purchase_form->project_type = $project_type; $purchase_form->project_desc = $project_desc; $purchase_form->currencyCodeValue = $currencyCodeValue; $purchase_form->cCode = $cCode; $purchase_form->form_settings = $form_settings; $purchase_form->form_id = $form_id; if (isset($paypal_address)) { $purchase_form->paypal_address = $paypal_address; } $purchase_form->submit_btn_name = $submit_btn_name; if (isset($adaptive_pay_settings)) { $purchase_form->adaptive_pay_settings = $adaptive_pay_settings; } return $purchase_form; }
/** This function is now deprecated -> now pulled from the IgnitionDeck Deck class the_deck method */ function the_levels($id) { global $wpdb; $project_id = get_post_meta($id, 'ign_project_id', true); $level_count = get_post_meta($id, 'ign_product_level_count', true); // GETTING product default settings $default_prod_settings = getProductDefaultSettings(); // Getting product settings and if they are not present, set the default settings as product settings $prod_settings = getProductSettings($project_id); if (empty($prod_settings)) { $prod_settings = $default_prod_settings; } $currency_code = $prod_settings->currency_code; //GETTING the currency symbols $cCode = setCurrencyCode($currency_code); $level_data = array(); for ($i = 1; $i <= $level_count; $i++) { $level_sales = $wpdb->prepare('SELECT COUNT(*) as count FROM ' . $wpdb->prefix . 'ign_pay_info WHERE product_id=%d AND product_level = %d', $project_id, $i); $return_sales = $wpdb->get_row($level_sales); $level_sales = $return_sales->count; if ($i == 1) { $level_title = html_entity_decode(get_post_meta($id, 'ign_product_title', true)); $level_desc = html_entity_decode(get_post_meta($id, 'ign_product_details', true)); $level_price = get_post_meta($id, 'ign_product_price', true); if ($level_price > 0) { $level_price = number_format($level_price, 0, '.', ','); } $level_limit = get_post_meta($id, 'ign_product_limit', true); $level_order = get_post_meta($id, 'ign_projectmeta_level_order', true); $level_data[] = array('id' => $i, 'title' => $level_title, 'description' => $level_desc, 'price' => $level_price, 'sold' => $level_sales, 'limit' => $level_limit, 'currency_code' => $cCode, 'order' => $level_order); } else { $level_title = html_entity_decode(get_post_meta($id, 'ign_product_level_' . $i . '_title', true)); $level_desc = html_entity_decode(get_post_meta($id, 'ign_product_level_' . $i . '_desc', true)); $level_price = get_post_meta($id, 'ign_product_level_' . $i . '_price', true); if ($level_price > 0) { $level_price = number_format($level_price, 0, '.', ','); } $level_limit = get_post_meta($id, 'ign_product_level_' . $i . '_limit', true); $level_order = get_post_meta($id, 'ign_product_level_' . $i . '_order', true); $level_data[] = array('id' => $i, 'title' => $level_title, 'description' => $level_desc, 'price' => $level_price, 'limit' => $level_limit, 'sold' => $level_sales, 'currency_code' => $cCode, 'order' => $level_order); } } return $level_data; }
function get_product_levels_callback() { global $wpdb; require 'languages/text_variables.php'; if (isset($_POST['Project'])) { $project_id = absint($_POST['Project']); $project = new ID_Project($project_id); $product_settings = $project->get_project_settings(); if (empty($product_settings)) { $product_settings = $project->get_project_defaults(); } //GETTING the currency symbol if (isset($product_settings)) { $currencyCodeValue = $product_settings->currency_code; $cCode = setCurrencyCode($currencyCodeValue); } else { $currencyCodeValue = 'USD'; $cCode = '$'; } $post_id = $project->get_project_postid(); $level_count = get_post_meta($post_id, 'ign_product_level_count', true); $meta_price_1 = get_post_meta($post_id, "ign_product_price", true); $options = "<option data-price='" . number_format($meta_price_1, 2, '.', '') . "' value=\"1\">" . $tr_Level . " 1: " . $tr_Price . " " . apply_filters('id_display_currency', apply_filters('id_price_format', absint($meta_price_1), $post_id), absint($meta_price_1), $post_id) . "</option>"; if (isset($level_count) && $level_count > 0) { for ($i = 1; $i <= $level_count; $i++) { $meta_price = get_post_meta($post_id, $name = "ign_product_level_" . $i . "_price", true); if ($meta_price !== "") { $options .= "<option data-price='" . number_format($meta_price, 2, '.', '') . "' value=\"" . $i . "\">" . $tr_Level . " " . $i . ": " . $tr_Price . " " . apply_filters('id_display_currency', apply_filters('id_price_format', $meta_price, $post_id), $meta_price, $post_id) . "</option>"; } } } echo $options; } exit; }