public static function set_closed_meta() { $projects = self::get_all_projects(); foreach ($projects as $a_project) { $project = new ID_Project($a_project->id); $post_id = $project->get_project_postid(); $days_left = $project->days_left(); $end_type = $project->get_end_type(); if ($days_left <= 0 && $end_type == 'closed') { update_post_meta($post_id, 'ign_project_closed', true); do_action('idcf_project_closed', $post_id, $a_project->id); } else { update_post_meta($post_id, 'ign_project_closed', false); } } }
<?php /** * The default template for displaying IgnitionDeck projects. */ $project_id = get_post_meta($post->ID, 'ign_project_id', true); $project = new ID_Project($project_id); $post_id = $project->get_project_postid(); $raised = apply_filters('id_funds_raised', $project->get_project_raised(), $project->get_project_postid()); $percent = apply_filters('id_percentage_raised', $project->percent(), apply_filters('id_funds_raised', $project->get_project_raised(), $post_id, true), $post_id, apply_filters('id_project_goal', $project->the_goal(), $post_id, true)); $colors = get_option('krown_colors'); //$retina = krown_retina(); ?> <div class="col-md-4"> <article class="krown-id-item"> <?php if (has_post_thumbnail($post->ID)) { $image = aq_resize(wp_get_attachment_url(get_post_thumbnail_id(), 'full'), $retina === 'true' ? 510 : 255, null, false, false); $img_obj = '<a class="fancybox-thumb" href="' . get_permalink($post->ID) . '"><figure class="img"><img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . get_the_title() . '" /></figure><span></span></a>'; } else { if (get_post_meta($post->ID, 'ign_product_image1', true) != '') { $image = aq_resize(get_post_meta($post->ID, 'ign_product_image1', true), $retina === 'true' ? 510 : 255, null, false, false); $img_obj = '<a class="fancybox-thumb" href="' . get_permalink($post->ID) . '"><figure class="img"><img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . get_the_title() . '" /></figure><span></span></a>'; } else { $img_obj = ''; } } echo $img_obj; ?>
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 to get the level of a ID project from iT exchange product */ function get_paired_level_from_itexch_product($product_id) { $project_id = get_post_meta($product_id, '_itexch_project_pairing', true); // For level, getting the post id of ID Project $project = new ID_Project($project_id); $post_id = $project->get_project_postid(); // Getting all meta of this post, and getting level against iT Exchange product_id $post_meta = get_post_meta($post_id); foreach ($post_meta as $meta_key => $meta_value) { // If we are getting $product_id as value, check if the meta_key is similar to 'iditexch_level_pairing' if ($meta_value[0] == $product_id) { // Checking meta_key, if it's like 'iditexch_level_pairing', the get the level if (stristr($meta_key, 'iditexch_level_pairing') != false) { $level = str_replace('iditexch_level_pairing_', '', $meta_key); } } } return array($project_id, $level); }
function id_projectPageContentFull($attrs) { if (isset($attrs['product'])) { ob_start(); require 'languages/text_variables.php'; $project_id = $attrs['product']; $project = new ID_Project($project_id); $the_project = $project->the_project(); $post_id = $project->get_project_postid(); $settings = getSettings(); $social_settings = maybe_unserialize(get_option('idsocial_settings')); $project_long_desc = html_entity_decode(get_post_meta($post_id, "ign_project_long_description", true)); $float = 1; include 'templates/_projectContent.php'; $content = ob_get_contents(); ob_end_clean(); } else { $content = ''; } return apply_filters('id_project_content', $content, $project_id); }
<?php $options = get_option('fivehundred_theme_settings'); if (isset($options['home'])) { $project_id = $options['home']; $project = new ID_Project($project_id); $id = $project->get_project_postid(); $settings = getSettings(); } ?> <aside id="sidebar"> <h3 id="ign-levels-headline"><?php the_title(); ?> <?php _e('Support Levels', 'fivehundred'); ?> </h3> <div id="ign-product-levels" data-projectid="<?php echo $project_id; ?> "> <?php do_action('id_before_levels', $project_id); ?> <?php get_template_part('loop', 'levels-home'); ?> <?php do_action('id_after_levels', $project_id); ?>
function set_home_project_query($query) { if (is_home() && $query->is_main_query()) { $options = get_option('fivehundred_theme_settings'); if (!empty($options)) { $home = $options['home']; if (!empty($home) && $home > 0) { $project_id = $home; if (class_exists('ID_Project')) { $project = new ID_Project($project_id); $post_id = $project->get_project_postid(); if (isset($post_id) && $post_id > 0) { $query->set('p', $post_id); $query->set('post_type', 'ignition_product'); } } } } } return; }
function view_order() { $orderid = $_GET['orderid']; $order = new ID_Order($orderid); $order_data = $order->get_order(); $project = new ID_Project($order_data->product_id); $product_data = $project->the_project(); $post_id = $project->get_project_postid(); if ($order_data->product_level == 1) { $level_price = $product_data->product_price; $level_desc = $product_data->product_details; } else { $product_level = (int) $order_data->product_level; $level_price = get_post_meta($post_id, $name = "ign_product_level_" . $product_level . "_price", true); $level_desc = get_post_meta($post_id, $name = "ign_product_level_" . $product_level . "_desc", true); } require 'languages/text_variables.php'; echo '<div class="wrap"> ' . admin_menu_html(); include_once 'templates/admin/_orderView.php'; echo '</div>'; }
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; }
function adaptivePreapproval() { if (isset($_POST['btnSubmitPreapproval'])) { global $wpdb; $tz = get_option('timezone_string'); if (empty($tz)) { $tz = 'UTC'; } date_default_timezone_set($tz); //print_r($_POST); session_start(); $payment_variables = array("fname" => $_POST['first_name'], "lname" => $_POST['last_name'], "email" => $_POST['email'], "address" => $_POST['address'], "country" => $_POST['country'], "state" => $_POST['state'], "city" => $_POST['city'], "zip" => $_POST['zip'], "product_id" => absint($_POST['project_id']), "level" => absint($_POST['level']), "prod_price" => str_replace(',', '', $_POST['price'])); $preapproval_key = ""; $project = new ID_Project($variables['product_id']); $post_id = $project->get_project_postid(); $product_name = get_the_title($post_id); $_SESSION['ig_payment_variables'] = http_build_query($payment_variables); // Getting the Adaptive payment settings $adaptive_pay_settings = getAdaptivePayPalSettings(); require_once 'paypal/lib/AdaptivePayments.php'; // 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(absint(esc_attr($_POST['project_id']))); if (empty($prod_settings)) { $prod_settings = $default_prod_settings; } # Endpoint: this is the server URL which you have to connect for submitting your API request. //Chanege to https://svcs.paypal.com/ to go live */ if ($adaptive_pay_settings->paypal_mode == "sandbox") { define('API_BASE_ENDPOINT', 'https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval/'); define('PAYPAL_REDIRECT_URL', 'https://www.sandbox.paypal.com/webscr&cmd=_ap-preapproval&preapprovalkey=' . $preapproval_key); $app_id = "APP-80W284485P519543T"; } else { define('API_BASE_ENDPOINT', 'https://svcs.paypal.com/AdaptivePayments/Preapproval/'); define('PAYPAL_REDIRECT_URL', 'https://www.paypal.com/webscr&cmd=_ap-preapproval&preapprovalkey=' . $preapproval_key); $app_id = $adaptive_pay_settings->app_id; } /***** 3token API credentials *****************/ define('API_AUTHENTICATION_MODE', '3token'); define('API_USERNAME', $adaptive_pay_settings->api_username); define('API_PASSWORD', $adaptive_pay_settings->api_password); define('API_SIGNATURE', $adaptive_pay_settings->api_signature); define('X_PAYPAL_APPLICATION_ID', $app_id); require_once 'paypal/lib/Config/paypal_sdk_clientproperties.php'; $returnURL = site_url() . "/?payment_success=1&product_id=" . absint(esc_attr($_POST['project_id'])); $cancelURL = site_url() . "/?payment_cancel=1"; $notifyURL = esc_url(site_url()) . "/?ipn_handler=1&type=paypal_preauth&" . $_SESSION['ig_payment_variables']; $currencyCode = $prod_settings->currency_code; $senderEmail = esc_attr($_POST['email']); $preauth = new PreapprovalRequest(); $preauth->cancelUrl = $cancelURL; $preauth->ipnNotificationUrl = $notifyURL; $preauth->returnUrl = $returnURL; $preauth->currencyCode = $currencyCode; $preauth->maxNumberOfPayments = "1"; $preauth->maxNumberofPaymentsPerPeriod = 1; $preauth->endingDate = date("Y-m-d\\Z", strtotime("+ 364 day")); $preauth->startingDate = date('Y-m-d\\Z'); $preauth->maxTotalAmountOfAllPayments = esc_attr(str_replace(',', '', $_POST['price'])); $preauth->memo = $product_name . ' pledge of ' . number_format($_POST['price'], 2, '.', ',') . ' ' . $currencyCode; $preauth->clientDetails = new ClientDetailsType(); $preauth->clientDetails->applicationId = $app_id; //$preauth->clientDetails->deviceId = DEVICE_ID; //$preauth->clientDetails->ipAddress = "127.0.0.1"; //$preapprovalRequest->maxNumberOfPayments = $maxNumberOfPayments; //$preapprovalRequest->maxTotalAmountOfAllPayments = $maxTotalAmountOfAllPayments; $preauth->requestEnvelope = new RequestEnvelope(); $preauth->requestEnvelope->errorLanguage = "en_US"; $preauth->senderEmail = $senderEmail; $ap = new AdaptivePayments(); $response = $ap->Preapproval($preauth); //print_r($preauth); //print_r($response); //print_r($ap); if (strtoupper($ap->isSuccess) == 'FAILURE') { $fault = $ap->getLastError(); // For error handling if (is_array($fault->error)) { $errors_content = '<table width =\\"450px\\" align=\\"center\\">'; foreach ($fault->error as $err) { $errors_content .= '<tr>'; $errors_content .= '<td>'; $errors_content .= 'Error ID: ' . $err->errorId . '<br />'; $errors_content .= 'Domain: ' . $err->domain . '<br />'; $errors_content .= 'Severity: ' . $err->severity . '<br />'; $errors_content .= 'Category: ' . $err->category . '<br />'; $errors_content .= 'Message: ' . $err->message . '<br />'; if (empty($err->parameter)) { $errors_content .= '<br />'; } else { $errors_content .= 'Parameter: ' . $err->parameter . '<br /><br />'; } $errors_content .= '</td>'; $errors_content .= '</tr>'; } $errors_content .= '</table>'; } else { $errors_content = 'Error ID: ' . $fault->error->errorId . '<br />'; $errors_content .= 'Domain: ' . $fault->error->domain . '<br />'; $errors_content .= 'Severity: ' . $fault->error->severity . '<br />'; $errors_content .= 'Category: ' . $fault->error->category . '<br />'; $errors_content .= 'Message: ' . $fault->error->message . '<br />'; if (empty($fault->error->parameter)) { $errors_content .= '</br>'; } else { $errors_content .= 'Parameter: ' . $fault->error->parameter . '<br /><br />'; } } $_SESSION['paypal_errors_content'] = $errors_content; } else { // Redirect to paypal.com here $_SESSION['preapprovalKey'] = $response->preapprovalKey; $token = $response->preapprovalKey; $payPalURL = PAYPAL_REDIRECT_URL . '_ap-preapproval&preapprovalkey=' . $token; echo '<script type="text/javascript">window.location="' . $payPalURL . '";</script>'; } } }
function ide_add_project_order_thumbnail($thumbnail, $last_order) { $order_id = $last_order->id; $mdid_order = mdid_by_orderid($order_id); if (!empty($mdid_order)) { $pay_id = $mdid_order->pay_info_id; $id_order = new ID_Order($pay_id); $get_order = $id_order->get_order(); if (!empty($get_order)) { $project_id = $get_order->product_id; $project = new ID_Project($project_id); $post_id = $project->get_project_postid(); if ($post_id > 0) { $thumbnail = ID_Project::get_project_thumbnail($post_id); } } } return $thumbnail; }
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; }
</tr> <tr> <td> <label for="choose-featured"><?php _e('Featured Project on Home Page', 'fivehundred'); ?> </label><br/> <select id="choose-featured" name="choose-featured"> <option><?php _e('No Feature', 'fivehundred'); ?> </option> <?php foreach ($projects as $project) { $a_project = new ID_Project($project->id); $post_id = $a_project->get_project_postid(); $post = get_post($post_id); if (!empty($post)) { $selected = null; if (isset($project_id) && $project_id == $project->id) { $selected = 'selected="selected"'; } ?> <option value="<?php echo $project->id; ?> " <?php echo isset($selected) ? $selected : ''; ?> ><?php echo get_the_title($post_id);