'product', 'posts_per_page' => '-1');
$getproducts = get_posts($args);
//var_dump($getproducts);
//$newarray = array();
foreach ($getproducts as $product) {
if (get_post_meta($product->ID, '_crowdfundingcheckboxvalue', true) == 'yes') {
$newarray[] = $product->ID;
$producttitle[] = $product->post_title;
}
}
if (is_array($newarray) && (is_array($producttitle))) {
$output = array_combine($newarray, $producttitle);
}
return apply_filters('woocommerce_crowdfunding_shortcode_settings', array(
array(
'name' => __('Shortcode Label', 'galaxyfunder'),
'type' => 'title',
'desc' => '',
'id' => '_cf_product_button_text_shortcode'
),
array(
'name' => __('Minimum Contribution Label', 'galaxyfunder'),
'desc' => __('Please Enter Minimum Contribution Label for Product Page', 'galaxyfunder'),
'tip' => '',
'id' => 'crowdfunding_min_price_shop_page_shortcode',
'css' => 'min-width:550px;',
'std' => 'Minimum Contribution',
'type' => 'text',
'newids' => 'crowdfunding_min_price_shop_page_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Maximum Contribution Label', 'galaxyfunder'),
'desc' => __('Please Enter Maximum Contribution Label for Campaign', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_maximum_price_shop_page_shortcode',
'std' => 'Maximum Contribution',
'type' => 'text',
'newids' => 'crowdfunding_maximum_price_shop_page_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Goal Label', 'galaxyfunder'),
'desc' => __('Please Enter Goal Label for Campaign', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_target_price_shop_page_shortcode',
'std' => 'Goal',
'type' => 'text',
'newids' => 'crowdfunding_target_price_shop_page_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Total Contribution Label', 'galaxyfunder'),
'desc' => __('Please Enter Total Contribution Label', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_totalprice_label_shop_page_shortcode',
'std' => 'Raised',
'type' => 'text',
'newids' => 'crowdfunding_totalprice_label_shop_page_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Total Contribution Percent Label', 'galaxyfunder'),
'desc' => __('Please Enter Total Contribution Percent Label', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_totalprice_percent_label_shop_page_shortcode',
'std' => 'Percent',
'type' => 'text',
'newids' => 'crowdfunding_totalprice_percent_label_shop_page_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Enable Title in Shortcode', 'galaxyfunder'),
'desc' => __('Enable this Option to show the Title in Shortcode', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_enable_title_for_shortcode',
'std' => 'yes',
'type' => 'checkbox',
'newids' => 'crowdfunding_enable_title_for_shortcode',
),
array(
'name' => __('Enable Description in Shortcode', 'galaxyfunder'),
'desc' => __('Enable this Option to show the Description in Shortcode', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;',
'id' => 'crowdfunding_enable_description_for_shortcode',
'std' => 'yes',
'type' => 'checkbox',
'newids' => 'crowdfunding_enable_description_for_shortcode',
),
array(
'name' => __('Enter Number of words to Trim from Description', 'galaxyfunder'),
'desc' => __('Enter Number of words to trim from description of product page', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;margin-bottom:80px;',
'id' => 'crowdfunding_number_of_words_to_trim',
'std' => '10',
'type' => 'text',
'newids' => 'crowdfunding_number_of_words_to_trim',
'desc_tip' => true,
),
array('type' => 'sectionend', 'id' => '_cf_product_button_text_shortcode'),
array(
'name' => __('Choose Inbuilt/Custom Design', 'galaxyfunder'),
'type' => 'title',
'desc' => '',
'id' => '_cf_product_inbuilt_text_shortcode'
),
array(
'name' => __('Inbuilt Design', 'galaxyfunder'),
'desc' => __('Please Select you want to load the Inbuilt Design', 'galaxyfunder'),
'tip' => '',
'id' => 'cf_inbuilt_shop_design_shortcode',
'css' => '',
'std' => '1',
'type' => 'radio',
'options' => array('1' => 'Inbuilt Design'),
'newids' => 'cf_inbuilt_shop_design_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Select Inbuilt Design', 'galaxyfunder'),
'desc' => __('This helps to load the inbuilt type', 'galaxyfunder'),
'id' => 'load_inbuilt_shop_design_shortcode',
'css' => 'min-width:150px;',
'std' => '2', // WooCommerce < 2.0
'default' => '2', // WooCommerce >= 2.0
'newids' => 'load_inbuilt_shop_design_shortcode',
'type' => 'select',
'options' => array(
'1' => __('Minimal Style', 'galaxyfunder'),
'2' => __('IGG Style', 'galaxyfunder'),
'3' => __('KS Style', 'galaxyfunder'),
),
),
array(
'name' => __('Inbuilt CSS (Non Editable)', 'galaxyfunder'),
'desc' => __('These are element IDs in the Shop Page ', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;min-height:260px;margin-bottom:80px;',
'id' => 'cf_shop_page_contribution_table_default_css_shortcode',
'std' => '#cf_min_price_label { display:none;
}
#cf_total_raised_in_percentage { display:none; }
#cf_total_price_raiser {display:none;}
#cf_days_remainings {display:none;}
#cf_max_price_label { display:none; }
#cf_target_price_label { display:none; }
#cf_total_price_raised {display:none;}
#cf_total_price_in_percentage_with_bar {display:none;}
#cf_total_price_in_percentage {display:none;} #single_product_contribution_table{
}
#cf_serial_number_label{
}
#cf_contributor_label{
}
#cf_contributor_email_label{
}
#cf_contribution_label{
}
#cf_date_label{
}
#serial_id{
}
#cf_billing_first_name{
}
#cf_billing_email{
}
#cf_order_total{
}
#cf_target_price_labels{ margin-bottom:0px;
}
#cf_total_price_raise{ float:left;
}
#cf_total_price_raise span {font-size:17px;
}
#cf_total_price_in_percent{
}
#cf_total_price_in_percent_with_bar{width: 100%;
height:12px;
background-color: #ffffff;
border-radius:10px;
border:1px solid #000000;
clear:both;
}
#cf_percent_bar{ height:10px;
border-radius:10px;
background-color: green;
}
#cf_price_new_date_remain small { font-style:italic; }
#cf_price_new_date_remain { margin-bottom:0px;
float:left; }
#singleproductinputfieldcrowdfunding{color:green;
}
#cf_target_price_labels {font-style:italic;
font-size:20px;
}
#cf_update_total_funders {margin-bottom:0px; float:right; }
#cf_total_raised_percentage {float:right;
font-size:16px !important;
margin-bottom:0px;
}
',
'type' => 'textarea',
'newids' => 'cf_shop_page_contribution_table_default_css_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Custom Design', 'galaxyfunder'),
'desc' => __('Please Select you want to load the Custom Design', 'galaxyfunder'),
'tip' => '',
'id' => 'cf_inbuilt_shop_design_shortcode',
'css' => '',
'std' => '1',
'type' => 'radio',
'options' => array('2' => 'Custom Design'),
'newids' => 'cf_inbuilt_shop_design_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Custom CSS', 'galaxyfunder'),
'desc' => __('Customize the following element IDs of Frontend Campaign Submission form', 'galaxyfunder'),
'tip' => '',
'css' => 'min-width:550px;min-height:260px;margin-bottom:80px;',
'id' => 'cf_shop_page_contribution_table_custom_css_shortcode',
'std' => '',
'type' => 'textarea',
'newids' => 'cf_shop_page_contribution_table_custom_css_shortcode',
'desc_tip' => true,
),
array(
'name' => __('Select Campaigns', 'galaxyfunder'),
'desc' => __('Select your Campaign in the List Box', 'galaxyfunder'),
'id' => 'load_inbuilt_shortcode_generators',
'css' => 'min-width:550px;',
'class' => 'chosen-style',
'std' => '', // WooCommerce < 2.0
'default' => '', // WooCommerce >= 2.0
'newids' => 'load_inbuilt_shortcode_generators',
'type' => 'multiselect',
'options' => $output,
),
array('type' => 'sectionend', 'id' => '_cf_product_inbuilt_text_shortcode'),
array(
'name' => __('Shortcode', 'woocommerce'),
'type' => 'title',
'class' => 'newh1tag',
'desc' => '
',
'id' => '_product_generated_shortcode'
),
array('type' => 'sectionend', 'id' => '_cf_generated_shortcode'),
));
}
public static function crowdfunding_process_shortcode_admin_settings() {
woocommerce_admin_fields(CFShortcodeGenerator::crowdfunding_shortcode_admin_options());
}
public static function crowdfunding_process_shortcode_update_settings() {
woocommerce_update_options(CFShortcodeGenerator::crowdfunding_shortcode_admin_options());
}
public static function crowdfunding_shortcode_default_settings() {
global $woocommerce;
foreach (CFShortcodeGenerator::crowdfunding_shortcode_admin_options() as $setting) {
if (isset($setting['newids']) && ($setting['std'])) {
if (get_option($setting['newids']) == FALSE) {
add_option($setting['newids'], $setting['std']);
}
}
}
}
public static function cf_shortcode_reset_values() {
global $woocommerce;
if (isset($_POST['reset'])) {
foreach (CFShortcodeGenerator::crowdfunding_shortcode_admin_options() as $setting)
if (isset($setting['newids']) && ($setting['std'])) {
delete_option($setting['newids']);
add_option($setting['newids'], $setting['std']);
}
}
}
public static function cf_shortcode_extract_code($atts) {
if (!is_shop()) {
$content = '';
extract(shortcode_atts(array(
'id' => '',
), $atts));
ob_start();
$order_total = get_post_meta($id, '_crowdfundingtotalprice', true);
$getdate = date("m/d/Y");
$fromdate = get_post_meta($id, '_crowdfundingfromdatepicker', true);
$todate = get_post_meta($id, '_crowdfundingtodatepicker', true);
if ($fromdate != '') {
$fromdate = $fromdate;
} else {
$fromdate = $getdate;
update_post_meta($id, '_crowdfundingfromdatepicker', $getdate);
}
// if ($todate != '') {
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
$content_post = get_post($id);
if (isset($content_post->post_conten)) {
$content = $content_post->post_content;
}
if (get_option('crowdfunding_enable_title_for_shortcode') == 'yes') {
$enabletitle = '' . get_the_title($id) . '
';
}
if (get_option('crowdfunding_enable_description_for_shortcode') == 'yes') {
$enabledescription = '' . wp_trim_words($content, get_option('crowdfunding_number_of_words_to_trim')) . '
';
}
$payyourpricelabel = '';
$count = '';
$count2 = '';
$counter = '';
$totalfield = '';
$totalfieldss = '';
$totalfielder = '';
$inbuilt_designs = '';
$checktotalfunders = get_post_meta($id, '_update_total_funders', true);
if ($checktotalfunders != '') {
$gettotalfunders = '' . get_post_meta($id, '_update_total_funders', true) . ' ' . __('Funders', 'galaxyfunder') . ' ';
} else {
$gettotalfunders = ' 0 ' . __('Funders', 'galaxyfunder') . ' ';
}
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
//Report
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
if ($days > 1) {
$new_date_remain = '' . $days . " " . __('days Left', 'galaxyfunder') . "" . '';
} else {
$new_date_remain = '' . $days . " " . __('day Left', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remain = ' 0 ' . __('day Left', 'galaxyfunder') . '';
}
?>
0)) {
$count1 = $order_total / $targetvalue;
$count2 = $count1 * 100;
$counter = number_format($count2, 0);
$count = $counter . "%";
} else {
$count = "0%";
}
if ($minpricelabel != '') {
$minpricecaption = $minpricelabel;
$colonmin = ":";
}
if ($maximumpricelabel != '') {
$maxpricecaption = $maximumpricelabel;
$colonmax = ":";
}
if ($targetpricelabel != '') {
$targetpricecaption = $targetpricelabel;
$colontarget = ":";
}
if ($totalpricelabel != '') {
$totalpricecaption = $totalpricelabel;
$colontotal = ":";
}
if ($totalpricepercentlabel != '') {
$totalpricepercentcaption = $totalpricepercentlabel;
$colontotalpercent = ":";
}
if ($payyourpricelabel != '') {
$payyourpricecaption = $payyourpricelabel;
$colonpay = ":";
}
if ($hideminimum != 'yes') {
if ($minimumvalue != '') {
$minimumfield = "" . CrowdFunding::get_woocommerce_formatted_price($minimumvalue) . "
";
} else {
$minimumfield = '';
}
} else {
$minimumfield = '';
}
if ($hidemaximum != 'yes') {
if ($maximumvalue != '') {
$maximumfield = " " . CrowdFunding::get_woocommerce_formatted_price($maximumvalue) . "
";
} else {
$maximumfield = '';
}
} else {
$maximumfield = '';
}
if ($hidetarget != 'yes') {
if ($targetvalue != '') {
$targetfield = " " . CrowdFunding::get_woocommerce_formatted_price($targetvalue) . "
";
} else {
$targetfield = '';
}
} else {
$targetfield = '';
}
if ($order_total != '') {
$totalfield = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "
";
}
if ($order_total != '') {
$totalfieldss = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "";
}
$totalpledgedpercent = "" . $count . "
";
if ($count2 > 0) {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
} else {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
}
if ($count2 > 0) {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
} else {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
}
if ($order_total != '') {
$totalfielder = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . " PLEDGED ";
}
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
$inbuilt_designs = get_option("cf_inbuilt_shop_design_shortcode");
$load_designs = get_option('load_inbuilt_shop_design_shortcode');
if ($days > 1) {
$new_date_remains = '' . $days . " " . __('DAYS TO GO', 'galaxyfunder') . "" . '';
} else {
$new_date_remains = '' . $days . " " . __('DAY TO GO', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remains = ' 0 ' . __('DAY TO GO', 'galaxyfunder') . '';
}
$cfcounter = '' . $count . '' . __('FUNDED', 'galaxyfunder') . '';
if ($count2 > 0) {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
} else {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
}
$countercf = '' . $count . '';
if ($checkvalue == 'yes') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
if ($thumbnail != false || $thumbnail != '') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
$width = "22.05%";
?>
' . $enabletitle . $enabledescription . '
' . $minimumfield . $maximumfield . $targetfield . $totalfield . $totalpledgedpercentage . $totalfieldss . $countercf . $totalpledgedpercentages . $new_date_remain . $gettotalfunders . $totalpledgedpercentageser . $cfcounter . $totalfielder . $new_date_remains . '
';
}
$newflush = ob_get_contents();
ob_end_clean();
return '' . $news . '
' . $newflush;
}
}
public static function admin_enqueue_script() {
global $woocommerce;
if (isset($_GET['tab'])) {
if ($_GET['tab'] == 'crowdfunding_shortcode') {
?>
'product', 'posts_per_page' => '-1', 'author' => $user_ID, 'post_status' => 'draft,publish');
$listmycampaign = new WP_Query($args);
if ($listmycampaign->have_posts()) {
while ($listmycampaign->have_posts()) {
$listmycampaign->the_post();
//echo get_the_ID() . "
";
$order_total = get_post_meta(get_the_ID(), '_crowdfundingtotalprice', true);
$getdate = date("m/d/Y");
$fromdate = get_post_meta(get_the_ID(), '_crowdfundingfromdatepicker', true);
$todate = get_post_meta(get_the_ID(), '_crowdfundingtodatepicker', true);
if ($fromdate != '') {
$fromdate = $fromdate;
} else {
$fromdate = $getdate;
update_post_meta(get_the_ID(), '_crowdfundingfromdatepicker', $getdate);
}
// if ($todate != '') {
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
// if (($fromdate == $getdate || $fromdate < $getdate) && ($date >= time())) {
$newid = get_the_ID();
$payyourpricelabel = '';
$count = '';
$count2 = '';
$counter = '';
$totalfield = '';
$totalfieldss = '';
$totalfielder = '';
$inbuilt_designs = '';
$news = '';
$id = '';
$checktotalfunders = get_post_meta(get_the_ID(), '_update_total_funders', true);
if ($checktotalfunders != '') {
$gettotalfunders = '' . get_post_meta(get_the_ID(), '_update_total_funders', true) . ' ' . __('Funders', 'galaxyfunder') . ' ';
} else {
$gettotalfunders = ' 0 ' . __('Funders', 'galaxyfunder') . ' ';
}
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
//Report
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
$inbuilt_designs = get_option("cf_inbuilt_shop_design");
$load_designs = get_option('load_inbuilt_shop_design');
if ($days > 1) {
$new_date_remain = '' . $days . " " . __('days Left', 'galaxyfunder') . "" . '';
} else {
$new_date_remain = '' . $days . " " . __('day Left', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remain = ' 0 ' . __('day Left', 'galaxyfunder') . '';
}
?>
0)) {
$count1 = $order_total / $targetvalue;
$count2 = $count1 * 100;
$counter = number_format($count2, 0);
$count = $counter . "%";
} else {
$count = "0%";
}
if ($minpricelabel != '') {
$minpricecaption = $minpricelabel;
$colonmin = ":";
}
if ($maximumpricelabel != '') {
$maxpricecaption = $maximumpricelabel;
$colonmax = ":";
}
if ($targetpricelabel != '') {
$targetpricecaption = $targetpricelabel;
$colontarget = ":";
}
if ($totalpricelabel != '') {
$totalpricecaption = $totalpricelabel;
$colontotal = ":";
}
if ($totalpricepercentlabel != '') {
$totalpricepercentcaption = $totalpricepercentlabel;
$colontotalpercent = ":";
}
if ($payyourpricelabel != '') {
$payyourpricecaption = $payyourpricelabel;
$colonpay = ":";
}
if ($hideminimum != 'yes') {
if ($minimumvalue != '') {
$minimumfield = "" . CrowdFunding::get_woocommerce_formatted_price($minimumvalue) . "
";
} else {
$minimumfield = '';
}
}
if ($hidemaximum != 'yes') {
if ($maximumvalue != '') {
$maximumfield = " " . CrowdFunding::get_woocommerce_formatted_price($maximumvalue) . "
";
} else {
$maximumfield = '';
}
}
if ($hidetarget != 'yes') {
if ($targetvalue != '') {
$targetfield = " " . CrowdFunding::get_woocommerce_formatted_price($targetvalue) . "
";
} else {
$targetfield = '';
}
}
if ($order_total != '') {
$totalfield = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "
";
}
if ($order_total != '') {
$totalfieldss = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "";
}
$totalpledgedpercent = "" . $count . "
";
if ($count2 > 0) {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
} else {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
}
if ($count2 > 0) {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
} else {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
}
if ($order_total != '') {
$totalfielder = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . " PLEDGED ";
}
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
$inbuilt_designs = get_option("cf_inbuilt_shop_design");
$load_designs = get_option('load_inbuilt_shop_design');
if ($days > 1) {
$new_date_remains = '' . $days . " " . __('DAYS TO GO', 'galaxyfunder') . "" . '';
} else {
$new_date_remains = '' . $days . " " . __('DAY TO GO', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remains = ' 0 ' . __('DAY TO GO', 'galaxyfunder') . '';
}
$cfcounter = '' . $count . '' . __('FUNDED', 'galaxyfunder') . '';
if ($count2 > 0) {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
} else {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
}
$countercf = '' . $count . '';
if ($checkvalue == 'yes') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
if ($thumbnail != false || $thumbnail != '') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
$width = "22.05%";
?>
' . get_the_title($newid) . '';
if ($checkvalue == 'yes') {
// $new = $minimumfield . $maximumfield . $targetfield . $totalfield . $totalpledgedpercentage . $totalfieldss . $countercf . $totalpledgedpercentages . $new_date_remain . $gettotalfunders . $totalpledgedpercentageser . $cfcounter . $totalfielder . $new_date_remains;
$news = '
' . $enabletitle . '
' . $minimumfield . $maximumfield . $targetfield . $totalfield . $totalpledgedpercentage . $totalfieldss . $countercf . $totalpledgedpercentages . $new_date_remain . $gettotalfunders . $totalpledgedpercentageser . $cfcounter . $totalfielder . $new_date_remains . '
';
echo $news;
}
}
}
} else {
echo "Sorry No Campaigns Found";
}
wp_reset_postdata();
} else {
echo "Please Login to see your Campaign";
}
$newflush = ob_get_contents();
ob_end_clean();
return '';
}
public static function list_all_users_campaign(){
ob_start();
if (is_user_logged_in()) {
$user_list = get_users();
//foreach ($user_list as $each_user){
// $user_id = $each_user -> ID;
$args = array('post_type' => 'product', 'posts_per_page' => '-1', 'post_status' => 'draft,publish');
$listmycampaign = new WP_Query($args);
if ($listmycampaign->have_posts()) {
while ($listmycampaign->have_posts()) {
$listmycampaign->the_post();
//echo get_the_ID() . "
";
$order_total = get_post_meta(get_the_ID(), '_crowdfundingtotalprice', true);
$getdate = date("m/d/Y");
$fromdate = get_post_meta(get_the_ID(), '_crowdfundingfromdatepicker', true);
$todate = get_post_meta(get_the_ID(), '_crowdfundingtodatepicker', true);
if ($fromdate != '') {
$fromdate = $fromdate;
} else {
$fromdate = $getdate;
update_post_meta(get_the_ID(), '_crowdfundingfromdatepicker', $getdate);
}
// if ($todate != '') {
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
// if (($fromdate == $getdate || $fromdate < $getdate) && ($date >= time())) {
$newid = get_the_ID();
$payyourpricelabel = '';
$count = '';
$count2 = '';
$counter = '';
$totalfield = '';
$totalfieldss = '';
$totalfielder = '';
$inbuilt_designs = '';
$news = '';
$id = '';
$checktotalfunders = get_post_meta(get_the_ID(), '_update_total_funders', true);
if ($checktotalfunders != '') {
$gettotalfunders = '' . get_post_meta(get_the_ID(), '_update_total_funders', true) . ' ' . __('Funders', 'galaxyfunder') . ' ';
} else {
$gettotalfunders = ' 0 ' . __('Funders', 'galaxyfunder') . ' ';
}
$datestr = $todate . " 23:59:59"; //Your date
$date = strtotime($datestr); //Converted to a PHP date (a second count)
//Calculate difference
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
//Report
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
$inbuilt_designs = get_option("cf_inbuilt_shop_design");
$load_designs = get_option('load_inbuilt_shop_design');
if ($days > 1) {
$new_date_remain = '' . $days . " " . __('days Left', 'galaxyfunder') . "" . '';
} else {
$new_date_remain = '' . $days . " " . __('day Left', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remain = ' 0 ' . __('day Left', 'galaxyfunder') . '';
}
?>
0)) {
$count1 = $order_total / $targetvalue;
$count2 = $count1 * 100;
$counter = number_format($count2, 0);
$count = $counter . "%";
} else {
$count = "0%";
}
if ($minpricelabel != '') {
$minpricecaption = $minpricelabel;
$colonmin = ":";
}
if ($maximumpricelabel != '') {
$maxpricecaption = $maximumpricelabel;
$colonmax = ":";
}
if ($targetpricelabel != '') {
$targetpricecaption = $targetpricelabel;
$colontarget = ":";
}
if ($totalpricelabel != '') {
$totalpricecaption = $totalpricelabel;
$colontotal = ":";
}
if ($totalpricepercentlabel != '') {
$totalpricepercentcaption = $totalpricepercentlabel;
$colontotalpercent = ":";
}
if ($payyourpricelabel != '') {
$payyourpricecaption = $payyourpricelabel;
$colonpay = ":";
}
if ($hideminimum != 'yes') {
if ($minimumvalue != '') {
$minimumfield = "" . CrowdFunding::get_woocommerce_formatted_price($minimumvalue) . "
";
} else {
$minimumfield = '';
}
}
if ($hidemaximum != 'yes') {
if ($maximumvalue != '') {
$maximumfield = " " . CrowdFunding::get_woocommerce_formatted_price($maximumvalue) . "
";
} else {
$maximumfield = '';
}
}
if ($hidetarget != 'yes') {
if ($targetvalue != '') {
$targetfield = " " . CrowdFunding::get_woocommerce_formatted_price($targetvalue) . "
";
} else {
$targetfield = '';
}
}
if ($order_total != '') {
$totalfield = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "
";
}
if ($order_total != '') {
$totalfieldss = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . "";
}
$totalpledgedpercent = "" . $count . "
";
if ($count2 > 0) {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
} else {
$totalpledgedpercents = $totalpledgedpercent . '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentage = $totalpledgedpercents . '
';
}
if ($count2 > 0) {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
} else {
$progress_bar_type = get_option('shop_page_prog_bar_type');
if($progress_bar_type == '1'){
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
} else {
$totalpledgedpercent = "" . $count . "
";
$totalpledgedpercentss = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentages = $totalpledgedpercentss . '
';
}
}
if ($order_total != '') {
$totalfielder = "" . CrowdFunding::get_woocommerce_formatted_price($order_total) . " PLEDGED ";
}
if ($date >= time()) {
$diff = $date - time(); //time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); //seconds/minute*minutes/hour*hours/day)
$hours = round(($diff - $days * 60 * 60 * 24) / (60 * 60));
if ($hours > 1) {
$hours = $hours . ' hours';
} else {
$hours = $hours . ' hour';
}
$inbuilt_designs = get_option("cf_inbuilt_shop_design");
$load_designs = get_option('load_inbuilt_shop_design');
if ($days > 1) {
$new_date_remains = '' . $days . " " . __('DAYS TO GO', 'galaxyfunder') . "" . '';
} else {
$new_date_remains = '' . $days . " " . __('DAY TO GO', 'galaxyfunder') . "" . '';
}
} else {
$new_date_remains = ' 0 ' . __('DAY TO GO', 'galaxyfunder') . '';
}
$cfcounter = '' . $count . '' . __('FUNDED', 'galaxyfunder') . '';
if ($count2 > 0) {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
} else {
$totalpledgedpercentsser = '';
if ($counter >= 100) {
$counter = 100;
}
$totalpledgedpercentageser = $totalpledgedpercentsser . '
';
}
$countercf = '' . $count . '';
if ($checkvalue == 'yes') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
if ($thumbnail != false || $thumbnail != '') {
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($id));
$width = "22.05%";
?>
' . get_the_title($newid) . '';
if ($checkvalue == 'yes') {
// $new = $minimumfield . $maximumfield . $targetfield . $totalfield . $totalpledgedpercentage . $totalfieldss . $countercf . $totalpledgedpercentages . $new_date_remain . $gettotalfunders . $totalpledgedpercentageser . $cfcounter . $totalfielder . $new_date_remains;
$news = '
' . $enabletitle . '
' . $minimumfield . $maximumfield . $targetfield . $totalfield . $totalpledgedpercentage . $totalfieldss . $countercf . $totalpledgedpercentages . $new_date_remain . $gettotalfunders . $totalpledgedpercentageser . $cfcounter . $totalfielder . $new_date_remains . '
';
echo $news;
}
}
}
} else {
echo "Sorry No Campaigns Found";
}
wp_reset_postdata();
//}
} else {
echo "Please Login to see your Campaign";
}
$newflush = ob_get_contents();
ob_end_clean();
return '';
}
}
add_shortcode('galaxyfunder_my_campaign', array('CFShortcodeGenerator', 'cf_list_user_campaigns'));
add_shortcode('galaxyfunder_all_campaign_list', array('CFShortcodeGenerator', 'list_all_users_campaign'));
add_shortcode('galaxyfunder_campaign', array('CFShortcodeGenerator', 'cf_shortcode_extract_code'));
add_filter('widget_text', 'do_shortcode');
new CFShortcodeGenerator();
add_action('woocommerce_update_options_crowdfunding_shortcode', array('CFShortcodeGenerator', 'crowdfunding_process_shortcode_update_settings'));
add_action('init', array('CFShortcodeGenerator', 'crowdfunding_shortcode_default_settings'));
add_action('woocommerce_cf_settings_tabs_crowdfunding_shortcode', array('CFShortcodeGenerator', 'crowdfunding_process_shortcode_admin_settings'));
add_filter('woocommerce_cf_settings_tabs_array', array('CFShortcodeGenerator', 'crowdfunding_admin_shortcode_tab'), 1500);
add_action('admin_init', array('CFShortcodeGenerator', 'cf_shortcode_reset_values'), 2);
add_action('admin_head', array('CFShortcodeGenerator', 'admin_enqueue_script'));
?>