version 2.5.4 released

This commit is contained in:
magepeopleteam 2019-04-07 11:15:31 +00:00
parent 62faed086d
commit 220d6f09d1
7 changed files with 215 additions and 127 deletions

View File

@ -1,11 +1,9 @@
<?php
add_action( 'admin_notices', 'export_btn' );
function export_btn() {
global $typenow;
if ($typenow == 'mep_events_attendees') {
?>
<div class="wrap alignright">
<form method='get' action="edit.php">
<input type="hidden" name='post_type' value="mep_events_attendees"/>
@ -15,7 +13,7 @@ function export_btn() {
?>
<input type="hidden" name='meta_value' value="<?php echo $_GET['meta_value']; ?>"/>
<?php } ?>
<input style="display:none" type="radio" name='format' id="formatCSV" value="csv" checked="checked"/>
<input type="hidden" name='action' value="download_csv"/>
<input type="submit" name='export' id="csvExport" value="<?php _e('Export to CSV','mage-eventpress'); ?>"/>
</form>
</div>
@ -25,38 +23,104 @@ function export_btn() {
}
spee_dashboard();
function spee_dashboard() {
global $wpdb;
if ( isset( $_GET['export'] )) {
function mep_get_event_user_fields($post_id){
$row = array(
'Order ID',
'Event',
'Ticket',
'Full Name',
'Email',
'Phone',
'Addresss',
'Tee Size'
);
$crow = array();
$mep_form_builder_data = get_post_meta($post_id, 'mep_form_builder_data', true);
if ( $mep_form_builder_data ) {
foreach ( $mep_form_builder_data as $_field ) {
$crow[] = $_field['mep_fbc_label'];
}
}
return array_merge($row, $crow);
}
function mep_get_event_user_fields_data($post_id,$event){
$values = get_post_custom( $post_id );
$row = array(
get_post_meta( $post_id, 'ea_order_id', true ),
get_post_meta( $post_id, 'ea_event_name', true ),
get_post_meta( $post_id, 'ea_ticket_type', true ),
get_post_meta( $post_id, 'ea_name', true ),
get_post_meta( $post_id, 'ea_email', true ),
get_post_meta( $post_id, 'ea_phone', true ),
get_post_meta( $post_id, 'ea_address_1', true ),
get_post_meta( $post_id, 'ea_tshirtsize', true )
);
$crow = array();
$mep_form_builder_data = get_post_meta($event, 'mep_form_builder_data', true);
if ( $mep_form_builder_data ) {
foreach ( $mep_form_builder_data as $_field ) {
$vname = "ea_".$_field['mep_fbc_id'];
if(array_key_exists($vname, $values)){
$crow[] = get_post_meta( $post_id, $vname , true );
}
}
}
return array_merge($row, $crow);
}
// Add action hook only if action=download_csv
if ( isset($_GET['action'] ) && $_GET['action'] == 'download_csv' ) {
// Handle CSV Export
add_action( 'admin_init', 'csv_export') ;
}
function csv_export() {
// Check for current user privileges
if( !current_user_can( 'manage_options' ) ){ return false; }
// Check if we are in WP-Admin
if( !is_admin() ){ return false; }
// Nonce Check
// $nonce = isset( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : '';
// if ( ! wp_verify_nonce( $nonce, 'download_csv' ) ) {
// die( 'Security check error' );
// }
ob_start();
$domain = $_SERVER['SERVER_NAME'];
$filename = 'Event_Manager_Export_' . $domain . '_' . time() . '.csv';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
// Add some data
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Unique ID');
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Full Name');
$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Email');
$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Phone');
$objPHPExcel->getActiveSheet()->setCellValue('E1', 'Addresss');
$objPHPExcel->getActiveSheet()->setCellValue('F1', 'Tee Size');
$objPHPExcel->getActiveSheet()->setCellValue('G1', 'Ticket');
$objPHPExcel->getActiveSheet()->setCellValue('H1', 'Event');
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('A:H')->setAutoSize(true);
if(isset($_GET['meta_value'])){
$post_id = strip_tags($_GET['meta_value']);
$header_row = mep_get_event_user_fields($post_id);
}else{
$header_row = array(
'Order ID',
'Event',
'Ticket',
'Full Name',
'Email',
'Phone',
'Addresss',
'Tee Size'
);
}
$data_rows = array();
global $wpdb;
if(isset($_GET['meta_value'])){
$meta = $_GET['meta_value'];
$query = "SELECT post_id
$query = "SELECT post_id
FROM {$wpdb->prefix}postmeta
WHERE meta_value = $meta
ORDER BY meta_id ASC";
@ -67,67 +131,46 @@ $meta = $_GET['meta_value'];
ORDER BY ID ASC";
}
$posts = $wpdb->get_results($query);
if ( $posts ) {
foreach ( $posts as $i=>$post ) {
if(isset($_GET['meta_value'])){
$post_id = $post->post_id;
$posts = $wpdb->get_results($query);
foreach ( $posts as $i=>$post ) {
if(isset($_GET['meta_value'])){
$post_id = $post->post_id;
$event = strip_tags($_GET['meta_value']);
$row = mep_get_event_user_fields_data($post_id,$event);
}else{
$post_id = $post->ID;
$row = array(
get_post_meta( $post_id, 'ea_order_id', true ),
get_post_meta( $post_id, 'ea_event_name', true ),
get_post_meta( $post_id, 'ea_ticket_type', true ),
get_post_meta( $post_id, 'ea_name', true ),
get_post_meta( $post_id, 'ea_email', true ),
get_post_meta( $post_id, 'ea_phone', true ),
get_post_meta( $post_id, 'ea_address_1', true ),
get_post_meta( $post_id, 'ea_tshirtsize', true )
);
}
$objPHPExcel->getActiveSheet()->setCellValue('A'.($i+2), get_post_meta( $post_id, 'ea_user_id', true ).get_post_meta( $post_id, 'ea_order_id', true ).$post_id);
$objPHPExcel->getActiveSheet()->setCellValue('B'.($i+2), get_post_meta( $post_id, 'ea_name', true ));
$objPHPExcel->getActiveSheet()->setCellValue('C'.($i+2), get_post_meta( $post_id, 'ea_email', true ));
$objPHPExcel->getActiveSheet()->setCellValue('D'.($i+2), get_post_meta( $post_id, 'ea_phone', true ));
$objPHPExcel->getActiveSheet()->setCellValue('E'.($i+2), get_post_meta( $post_id, 'ea_address_1', true )."<br/>".get_post_meta( $post_id, 'ea_address_2', true )."<br/>".get_post_meta( $post_id, 'ea_state', true ).", ".get_post_meta( $post_id, 'ea_city', true ).", ".get_post_meta( $post_id, 'ea_country', true ));
$objPHPExcel->getActiveSheet()->setCellValue('F'.($i+2), get_post_meta( $post_id, 'ea_tshirtsize', true ));
$objPHPExcel->getActiveSheet()->setCellValue('G'.($i+2), get_post_meta( $post_id, 'ea_ticket_type', true ));
$objPHPExcel->getActiveSheet()->setCellValue('H'.($i+2), get_post_meta( $post_id, 'ea_event_name', true ));
}
}
// Rename worksheet
//$objPHPExcel->getActiveSheet()->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a clients web browser
ob_clean();
ob_start();
switch ( $_GET['format'] ) {
case 'csv':
// Redirect output to a clients web browser (CSV)
header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; filename="export.csv"');
$objWriter = new PHPExcel_Writer_CSV($objPHPExcel);
$objWriter->setDelimiter(',');
$objWriter->setEnclosure('"');
$objWriter->setLineEnding("\r\n");
//$objWriter->setUseBOM(true);
$objWriter->setSheetIndex(0);
$objWriter->save('php://output');
break;
case 'xls':
// Redirect output to a clients web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="export.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
break;
case 'xlsx':
// Redirect output to a clients web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="export.xlsx"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
break;
}
exit;
$data_rows[] = $row;
}
}
$fh = @fopen( 'php://output', 'w' );
fprintf( $fh, chr(0xEF) . chr(0xBB) . chr(0xBF) );
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
header( 'Content-Description: File Transfer' );
header( 'Content-type: text/csv' );
header( "Content-Disposition: attachment; filename={$filename}" );
header( 'Expires: 0' );
header( 'Pragma: public' );
fputcsv( $fh, $header_row );
foreach ( $data_rows as $data_row ) {
fputcsv( $fh, $data_row );
}
fclose( $fh );
ob_end_flush();
die();
}

View File

@ -701,7 +701,7 @@ function mep_event_extra_price_option() {
<!-- empty hidden one for jQuery -->
<tr class="empty-row screen-reader-text">
<td><input type="text" class="widefat" name="option_name[]" /></td>
<td><input type="number" class="widefat" name="option_price[]" value="" /></td>
<td><input type="number" class="widefat" step="0.01" name="option_price[]" value="" /></td>
<td><input type="number" class="widefat" name="option_qty[]" value="" /></td>
<td><select name="option_qty_type[]" id="mep_ev_9800kj8" class=''>
@ -797,7 +797,7 @@ function mep_event_ticket_type() {
<!-- empty hidden one for jQuery -->
<tr class="empty-row-t screen-reader-text">
<td><input type="text" class="widefat" name="option_name_t[]" /></td>
<td><input type="number" class="widefat" name="option_price_t[]" value="" /></td>
<td><input type="number" class="widefat" step="0.01" name="option_price_t[]" value="" /></td>
<td><input type="number" class="widefat" name="option_qty_t[]" value="" /></td>
<td><input type="number" class="widefat" name="option_rsv_t[]" value="" /></td>
<td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''><option value=""><?php _e('Please Select Type','mage-eventpress'); ?></option><option value="inputbox"><?php _e('Input Box','mage-eventpress'); ?></option><option value="dropdown"><?php _e('Dropdown List','mage-eventpress'); ?></option></select></td>

View File

@ -26,11 +26,12 @@ if($current_template){
}else{
$_current_template = $global_template;
}
$currency_pos = get_option( 'woocommerce_currency_pos' );
?>
<div class="mep-events-wrapper">
<?php require_once(dirname(__FILE__) . "/themes/$_current_template"); ?>
<?php
require_once(dirname(__FILE__) . "/themes/$_current_template"); ?>
</div>
<script>
jQuery('#quantity_5a7abbd1bff73').click(function() {
@ -41,7 +42,7 @@ jQuery('#quantity_5a7abbd1bff73', $form).change(calculateTotal);
function calculateTotal() {
var sum = jQuery('#rowtotal').val();
jQuery('#usertotal').html('<?php echo get_woocommerce_currency_symbol(); ?>' + sum * parseInt( $totalQuant.val() || 0, 10));
jQuery('#usertotal').html('<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>' + sum * parseInt( $totalQuant.val() || 0, 10) + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
}
});
@ -114,7 +115,7 @@ jQuery(".extra-qty-box").on('change', function() {
});
jQuery('#usertotal').html("<?php echo get_woocommerce_currency_symbol(); ?>" + total);
jQuery('#usertotal').html("<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>" + total + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
jQuery('#rowtotal').val(total);
}).change(); //trigger change event on page load
@ -135,7 +136,7 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
var inputs = jQuery("#ttyttl").html() || 0;
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
var input = parseInt(inputs);
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').size() || 0;
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
//alert(inputs);
if(inputs==0){
//jQuery('.btn-mep-event-cart').hide();
@ -165,16 +166,14 @@ $count++;
}else{
?>
jQuery('#mep_btn_notice').hide();
jQuery('#quantity_5a7abbd1bff73').on('change', function () {
jQuery('#quantity_5a7abbd1bff73').on('change', function () {
var input = jQuery('#quantity_5a7abbd1bff73').val() || 0;
var children=jQuery('#divParent > div').size() || 0;
var children=jQuery('#divParent > div').length || 0;
if(input < children){
jQuery('#divParent').empty();
children=0;
}
}
for (var i = children+1; i <= input; i++) {
jQuery('#divParent').append(
jQuery('<div/>')
@ -182,8 +181,6 @@ jQuery('#quantity_5a7abbd1bff73').on('change', function () {
.html("<?php do_action('mep_reg_fields'); ?>")
);
}
});
<?php
}

View File

@ -44,7 +44,7 @@ if($qty_type=='dropdown'){ ?>
<input id="eventpx" <?php //if($ext_left<=0){ echo "disabled"; } ?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box' name='option_qty[]' data-price='<?php echo $field['option_price']; ?>' value='0' min="0" max="<?php echo $ext_left; ?>">
<?php } }else{ _e('Not Available','mage-eventpress'); }?>
</td>
<td><?php echo get_woocommerce_currency_symbol().$field['option_price']; if($ext_left>0){ ?>
<td><?php echo wc_price($field['option_price']); if($ext_left>0){ ?>
<p style="display: none;" class="price_jq"><?php echo $field['option_price']; ?></p>
<input type="hidden" name='option_name[]' value='<?php echo $field['option_name']; ?>'>
<input type="hidden" name='option_price[]' value='<?php echo $field['option_price']; ?>'>

View File

@ -55,7 +55,7 @@ if($qty_t_type=='dropdown'){ ?>
<td class="ticket-price"><span class="tkt-pric">
<?php echo mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') ? mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') : _e('Per Ticket Price:','mage-eventpress'); ?>
</span> <strong><?php echo get_woocommerce_currency_symbol().$field['option_price_t']; ?></strong>
</span> <strong><?php echo wc_price($field['option_price_t']); ?></strong>
<?php if($llft>0){ ?>
<p style="display: none;" class="price_jq"><?php echo $field['option_price_t']; ?></p>
<input type="hidden" name='option_name[]' value='<?php echo $field['option_name_t']; ?>'>

View File

@ -8,6 +8,9 @@ if($event_meta['_price'][0]>0){
if($event_meta['mep_price_label'][0]){
?>
<h3><?php echo $event_meta['mep_price_label'][0]; ?>: </h3>
<?php } echo get_woocommerce_currency_symbol().$event_meta['_price'][0]; ?>
<?php }
echo wc_price($event_meta['_price'][0]);
?>
<?php } else{ echo ''; }
}

View File

@ -3,13 +3,15 @@
* Plugin Name: Woocommerce Events Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 2.5.3
* Version: 2.5.4
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress
* Domain Path: /languages/
*/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
require_once(dirname(__FILE__) . "/inc/class/mep_settings_api.php");
@ -21,7 +23,6 @@ require_once(dirname(__FILE__) . "/inc/mep_shortcode.php");
require_once(dirname(__FILE__) . "/inc/admin_setting_panel.php");
require_once(dirname(__FILE__) . "/inc/mep_enque.php");
require_once(dirname(__FILE__) . "/templates/template-prts/templating.php");
require_once(dirname(__FILE__) . "/lib/PHPExcel.php");
require_once(dirname(__FILE__) . "/inc/mep_csv_export.php");
require_once(dirname(__FILE__) . "/inc/mep_user_custom_style.php");
require_once(dirname(__FILE__) . "/inc/mep_tax_meta.php");
@ -96,9 +97,13 @@ function mep_load_wc_class() {
function mep_get_order_info($info,$id){
if($info){
$stock_msg = $info;
$koba = explode("_", $stock_msg);
return $koba[$id];
}else{
return null;
}
}
@ -112,10 +117,14 @@ function mep_woocommerce_data_stores ( $stores ) {
} else {
add_action('admin_notices', 'wc_not_loaded');
}
function wc_not_loaded() {
printf(
'<div class="error" style="background:red; color:#fff;"><p>%s</p></div>',
__('You Must Install WooCommerce Plugin before activating WooCommerce Event Manager, Becuase It is dependent on Woocommerce Plugin')
);
}
add_action('woocommerce_before_checkout_form', 'mep_displays_cart_products_feature_image');
@ -183,10 +192,6 @@ global $wpdb;
return $value;
}
add_action( 'woocommerce_thankyou','mep_set_first_order_sts');
function mep_set_first_order_sts($order_id ){
@ -204,13 +209,6 @@ update_post_meta( $event_id, $mep_atnd, "a1");
}
add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4);
function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) {
global $wpdb;
@ -818,7 +816,7 @@ global $post;
if($n_price==0){
$gn_price = "Free";
}else{
$gn_price =$cur.$n_price;
$gn_price = wc_price($n_price);
}
// if($mep_events_extra_prices){
@ -892,13 +890,7 @@ $org_id = $org_arr[0]->term_id;
function mep_get_total_available_seat($event_id, $event_meta){
$book_count = get_post_meta(get_the_id(),'total_booking', true);
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
if(array_key_exists('mep_rsv_seat', $event_meta)){
$simple_rsv = $event_meta['mep_rsv_seat'][0];
}else{
$simple_rsv = '';
}
if($simple_rsv){
$simple_rsv = $simple_rsv;
}else{
@ -922,7 +914,7 @@ $leftt = ($leftt+$llft);
}
$leftt = $leftt-$res;
}else{
$leftt = (int) $event_meta['mep_total_seat'][0]- (int) $total_book;
$leftt = (int) $event_meta['mep_total_seat'][0]- (int) $total_book;
}
return $leftt;
}
@ -1149,3 +1141,56 @@ function mep_save_attendee_info_into_cart($product_id){
function mep_wc_price( $price, $args = array() ) {
$args = apply_filters(
'wc_price_args', wp_parse_args(
$args, array(
'ex_tax_label' => false,
'currency' => '',
'decimal_separator' => wc_get_price_decimal_separator(),
'thousand_separator' => wc_get_price_thousand_separator(),
'decimals' => wc_get_price_decimals(),
'price_format' => get_woocommerce_price_format(),
)
)
);
$unformatted_price = $price;
$negative = $price < 0;
$price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * -1 : $price ) );
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] ), $price, $args['decimals'], $args['decimal_separator'], $args['thousand_separator'] );
if ( apply_filters( 'woocommerce_price_trim_zeros', false ) && $args['decimals'] > 0 ) {
$price = wc_trim_zeros( $price );
}
$formatted_price = ( $negative ? '-' : '' ) . sprintf( $args['price_format'], '' . '' . '', $price );
$return = '' . $formatted_price . '';
if ( $args['ex_tax_label'] && wc_tax_enabled() ) {
$return .= '' . WC()->countries->ex_tax_or_vat() . '';
}
/**
* Filters the string of price markup.
*
* @param string $return Price HTML markup.
* @param string $price Formatted price.
* @param array $args Pass on the args.
* @param float $unformatted_price Price as float to allow plugins custom formatting. Since 3.2.0.
*/
return apply_filters( 'mep_wc_price', $return, $price, $args, $unformatted_price );
}
}else{
function mep_admin_notice_wc_not_active() {
$class = 'notice notice-error';
printf(
'<div class="error" style="background:red; color:#fff;"><p>%s</p></div>',
__('You Must Install WooCommerce Plugin before activating WooCommerce Event Manager, Becuase It is dependent on Woocommerce Plugin')
);
}
add_action( 'admin_notices', 'mep_admin_notice_wc_not_active' );
}