function woo_ce_products_filter_by_product_tag() {

		$args = array(
			'hide_empty' => 1
		);
		$product_tags = woo_ce_get_product_tags( $args );

		ob_start(); ?>
<p><label><input type="checkbox" id="products-filters-tags" /> <?php _e( 'Filter Products by Product Tag', 'woo_ce' ); ?></label></p>
<div id="export-products-filters-tags" class="separator">
	<ul>
		<li>
<?php if( !empty( $product_tags ) ) { ?>
			<select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woo_ce' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $product_tags as $product_tag ) { ?>
				<option value="<?php echo $product_tag->term_id; ?>"<?php disabled( $product_tag->count, 0 ); ?>><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>)</option>
	<?php } ?>
			</select>
<?php } else { ?>
			<?php _e( 'No Product Tags were found.', 'woo_ce' ); ?></li>
<?php } ?>
		</li>
	</ul>
	<p class="description"><?php _e( 'Select the Product Tags you want to filter exported Products by. Product Tags not assigned to Products are hidden from view. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
</div>
<!-- #export-products-filters-tags -->
<?php
		ob_end_flush();

	}
function woo_ce_export_dataset( $export_type = null, &$output = null ) {

	global $export;

	$separator = $export->delimiter;
	$line_ending = woo_ce_get_line_ending();
	$export->columns = array();
	$export->total_rows = 0;
	$export->total_columns = 0;

	$troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';

	set_transient( WOO_CD_PREFIX . '_running', time(), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );

	// Load up the fatal error notice if we 500 Internal Server Error (memory), hit a server timeout or encounter a fatal PHP error
	add_action( 'shutdown', 'woo_ce_fatal_error' );

	// Drop in our content filters here
	add_filter( 'sanitize_key', 'woo_ce_sanitize_key' );

	switch( $export_type ) {

		// Products
		case 'product':
			$fields = woo_ce_get_product_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_product_field( $key );
			}
			if( $export->gallery_unique ) {
				$export->fields = woo_ce_unique_product_gallery_fields( $export->fields );
				$export->columns = woo_ce_unique_product_gallery_columns( $export->columns, $export->fields );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $products = woo_ce_get_products( $export->args ) ) {
				$export->total_rows = count( $products );
				// XML export
				if( $export->export_format == 'xml' ) {
					if( !empty( $export->fields ) ) {
						foreach( $products as $product ) {
							$child = $output->addChild( apply_filters( 'woo_ce_export_xml_product_node', sanitize_key( $export_type ) ) );
							$product = woo_ce_get_product_data( $product, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $product->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $product->$field, $export_type, $field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( woo_ce_sanitize_xml_string( $product->$field ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $product->$field ) ) );
									}
								}
							}
						}
					}
				} else if( $export->export_format == 'rss' ) {
					// RSS export
					if( !empty( $export->fields ) ) {
						foreach( $products as $product ) {
							$child = $output->addChild( 'item' );
							$product = woo_ce_get_product_data( $product, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $field ) {
								if( isset( $product->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $product->$field ) )
											$child->addChild( sanitize_key( $field ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $product->$field ) ) );
										else
											$child->addChild( sanitize_key( $field ), esc_html( woo_ce_sanitize_xml_string( $product->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					foreach( $products as $key => $product ) {
						$products[$key] = woo_ce_get_product_data( $product, $export->args, array_keys( $export->fields ) );
					}
					$output = $products;
				}
				unset( $products, $product );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Categories
		case 'category':
			$fields = woo_ce_get_category_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_category_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			$category_args = array(
				'orderby' => ( isset( $export->args['category_orderby'] ) ? $export->args['category_orderby'] : 'ID' ),
				'order' => ( isset( $export->args['category_order'] ) ? $export->args['category_order'] : 'ASC' ),
			);
			if( $categories = woo_ce_get_product_categories( $category_args ) ) {
				$export->total_rows = count( $categories );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $categories as $category ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_category_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $category->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $category->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $category->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $category->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $categories;
				}
				unset( $categories, $category );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Tags
		case 'tag':
			$fields = woo_ce_get_tag_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_tag_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			$tag_args = array(
				'orderby' => ( isset( $export->args['tag_orderby'] ) ? $export->args['tag_orderby'] : 'ID' ),
				'order' => ( isset( $export->args['tag_order'] ) ? $export->args['tag_order'] : 'ASC' ),
			);
			if( $tags = woo_ce_get_product_tags( $tag_args ) ) {
				$export->total_rows = count( $tags );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $tags as $tag ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_tag_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $tag->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $tag->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $tag->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $tag->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $tags;
				}
				unset( $tags, $tag );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Brands
		case 'brand':
			$fields = woo_ce_get_brand_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_brand_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			$brand_args = array(
				'orderby' => ( isset( $export->args['brand_orderby'] ) ? $export->args['brand_orderby'] : 'ID' ),
				'order' => ( isset( $export->args['brand_order'] ) ? $export->args['brand_order'] : 'ASC' ),
			);
			if( $brands = woo_ce_get_product_brands( $brand_args ) ) {
				$export->total_rows = count( $brands );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $brands as $brand ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_brand_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $brand->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $brand->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $brand->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $brand->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $brands;
				}
				unset( $brands, $brand );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Orders
		case 'order':
			$fields = woo_ce_get_order_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				// Do not apply Field Editor changes to the unique Order Items Formatting rule
				if( $export->args['order_items'] == 'unique' )
					remove_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_order_field( $key );
				// Do not apply Field Editor changes to the unique Order Items Formatting rule
				if( $export->args['order_items'] == 'unique' )
					add_filter( 'woo_ce_order_fields', 'woo_ce_override_order_field_labels', 11 );
			}
			if( $export->args['order_items'] == 'unique' ) {
				$export->fields = woo_ce_unique_order_item_fields( $export->fields );
				$export->columns = woo_ce_unique_order_item_columns( $export->columns, $export->fields );
			}
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $orders = woo_ce_get_orders( 'order', $export->args ) ) {
				$export->total_columns = $size = count( $export->columns );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $orders as $order ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_order_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							$child->addAttribute( 'id', $order );
							$order = woo_ce_get_order_data( $order, 'order', $export->args, array_keys( $export->fields ) );
							if( in_array( $export->args['order_items'], array( 'combined', 'unique' ) ) ) {
								// Order items formatting: SPECK-IPHONE|INCASE-NANO|-
								foreach( array_keys( $export->fields ) as $key => $field ) {
									if( isset( $order->$field ) ) {
										if( !is_array( $field ) ) {
											if( woo_ce_is_xml_cdata( $order->$field ) )
												$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $order->$field ) ) );
											else
												$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $order->$field ) ) );
										}
									}
								}
							} else if( $export->args['order_items'] == 'individual' ) {
								// Order items formatting: SPECK-IPHONE<br />INCASE-NANO<br />-
								if( !empty( $order->order_items ) ) {
									$order->order_items_product_id = '';
									$order->order_items_variation_id = '';
									$order->order_items_sku = '';
									$order->order_items_name = '';
									$order->order_items_variation = '';
									$order->order_items_description = '';
									$order->order_items_excerpt = '';
									$order->order_items_tax_class = '';
									$order->order_items_quantity = '';
									$order->order_items_total = '';
									$order->order_items_subtotal = '';
									$order->order_items_rrp = '';
									$order->order_items_stock = '';
									$order->order_items_tax = '';
									$order->order_items_tax_subtotal = '';
									$order->order_items_type = '';
									$order->order_items_category = '';
									$order->order_items_tag = '';
									$order->order_items_total_sales = '';
									$order->order_items_weight = '';
									$order->order_items_total_weight = '';
									foreach( $order->order_items as $order_item ) {
										// Add Order Item weight to Shipping Weight
										if( $order_item->total_weight != '' )
											$order->shipping_weight = $order->shipping_weight + $order_item->total_weight;
										$order->order_items_product_id = $order_item->product_id;
										$order->order_items_variation_id = $order_item->variation_id;
										if( empty( $order_item->sku ) )
											$order_item->sku = '';
										$order->order_items_sku = $order_item->sku;
										$order->order_items_name = $order_item->name;
										$order->order_items_variation = $order_item->variation;
										$order->order_items_description = woo_ce_format_description_excerpt( $order_item->description );
										$order->order_items_excerpt = woo_ce_format_description_excerpt( $order_item->excerpt );
										$order->order_items_tax_class = $order_item->tax_class;
										$order->total_quantity += $order_item->quantity;
										$order->order_items_quantity = $order_item->quantity;
										$order->order_items_total = $order_item->total;
										$order->order_items_subtotal = $order_item->subtotal;
										$order->order_items_rrp = $order_item->rrp;
										$order->order_items_stock = $order_item->stock;
										$order->order_items_tax = $order_item->tax;
										$order->order_items_tax_subtotal = $order_item->tax_subtotal;
										$order->order_items_type = $order_item->type;
										$order->order_items_category = $order_item->category;
										$order->order_items_tag = $order_item->tag;
										$order->order_items_total_sales = $order_item->total_sales;
										$order->order_items_weight = $order_item->weight;
										$order->order_items_total_weight = $order_item->total_weight;
										$order = apply_filters( 'woo_ce_order_items_individual', $order, $order_item );
										foreach( array_keys( $export->fields ) as $key => $field ) {
											if( isset( $order->$field ) ) {
												if( !is_array( $field ) ) {
													if( woo_ce_is_xml_cdata( $order->$field ) )
														$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $order->$field ) ) );
													else
														$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $order->$field ) ) );
												}
											}
										}
									}
									unset( $order->order_items );
								}
							}
						}
					}
				} else {
					// PHPExcel export
					if( $export->args['order_items'] == 'individual' )
						$output = array();
					foreach( $orders as $order ) {
						if( in_array( $export->args['order_items'], array( 'combined', 'unique' ) ) ) {
							// Order items formatting: SPECK-IPHONE|INCASE-NANO|-
							$output[] = woo_ce_get_order_data( $order, 'order', $export->args, array_keys( $export->fields ) );
						} else if( $export->args['order_items'] == 'individual' ) {
							// Order items formatting: SPECK-IPHONE<br />INCASE-NANO<br />-
							$order = woo_ce_get_order_data( $order, 'order', $export->args, array_keys( $export->fields ) );
							if( !empty( $order->order_items ) ) {
								foreach( $order->order_items as $order_item ) {
									// Add Order Item weight to Shipping Weight
									if( $order_item->total_weight != '' )
										$order->shipping_weight = $order->shipping_weight + $order_item->total_weight;
									$order->order_items_product_id = $order_item->product_id;
									$order->order_items_variation_id = $order_item->variation_id;
									if( empty( $order_item->sku ) )
										$order_item->sku = '';
									$order->order_items_sku = $order_item->sku;
									$order->order_items_name = $order_item->name;
									$order->order_items_variation = $order_item->variation;
									$order->order_items_description = $order_item->description;
									$order->order_items_excerpt = $order_item->excerpt;
									$order->order_items_tax_class = $order_item->tax_class;
									$order->total_quantity += $order_item->quantity;
									$order->order_items_quantity = $order_item->quantity;
									$order->order_items_total = $order_item->total;
									$order->order_items_subtotal = $order_item->subtotal;
									$order->order_items_rrp = $order_item->rrp;
									$order->order_items_stock = $order_item->stock;
									$order->order_items_tax = $order_item->tax;
									$order->order_items_tax_subtotal = $order_item->tax_subtotal;
									$order->order_items_type = $order_item->type;
									$order->order_items_category = $order_item->category;
									$order->order_items_tag = $order_item->tag;
									$order->order_items_total_sales = $order_item->total_sales;
									$order->order_items_weight = $order_item->weight;
									$order->order_items_total_weight = $order_item->total_weight;
									$order = apply_filters( 'woo_ce_order_items_individual', $order, $order_item );
									// This fixes the Order Items for this Order Items Formatting rule
									$output[] = (object)(array)$order;
								}
							}
						}
					}
				}
				unset( $orders, $order );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Customers
		case 'customer':
			$fields = woo_ce_get_customer_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_customer_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $customers = woo_ce_get_orders( 'customer', $export->args ) ) {
				$export->total_rows = count( $customers );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $customers as $customer ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_customer_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $customer->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $customer->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $customer->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $customer->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $customers;
				}
				unset( $customers, $customer );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Users
		case 'user':
			$fields = woo_ce_get_user_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_user_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $users = woo_ce_get_users( $export->args ) ) {
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					$export->total_rows = count( $users );
					if( !empty( $export->fields ) ) {
						foreach( $users as $user ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_user_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							$user = woo_ce_get_user_data( $user, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $user->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $user->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $user->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $user->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					foreach( $users as $key => $user )
						$users[$key] = woo_ce_get_user_data( $user, $export->args, array_keys( $export->fields ) );
					$output = $users;
				}
				unset( $users, $user );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Coupons
		case 'coupon':
			$fields = woo_ce_get_coupon_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_coupon_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $coupons = woo_ce_get_coupons( $export->args ) ) {
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					$export->total_rows = count( $coupons );
					if( !empty( $export->fields ) ) {
						foreach( $coupons as $coupon ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_coupon_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							$coupon = woo_ce_get_coupon_data( $coupon, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $coupon->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $coupon->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $coupon->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $coupon->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					foreach( $coupons as $key => $coupon ) {
						$coupons[$key] = woo_ce_get_coupon_data( $coupon, $export->args, array_keys( $export->fields ) );
					}
					$output = $coupons;
				}
				unset( $coupons, $coupon );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Subscriptions
		case 'subscription':
			$fields = woo_ce_get_subscription_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_subscription_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $subscriptions = woo_ce_get_subscriptions( $export->args ) ) {
				$export->total_rows = count( $subscriptions );
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					if( !empty( $export->fields ) ) {
						foreach( $subscriptions as $subscription ) {
							if( $export->export_format == 'xml' )
							$child = $output->addChild( apply_filters( 'woo_ce_export_xml_subscription_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $subscription->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $subscription->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $subscription->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $subscription->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $subscriptions;
				}
				unset( $subscriptions, $subscription );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Product Vendors
		case 'product_vendor':
			$fields = woo_ce_get_product_vendor_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_product_vendor_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $product_vendors = woo_ce_get_product_vendors( $export->args ) ) {
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					$export->total_rows = count( $product_vendors );
					if( !empty( $export->fields ) ) {
						foreach( $product_vendors as $product_vendor ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_product_vendor_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							$product_vendor = woo_ce_get_product_vendor_data( $product_vendor, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $product_vendor->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $product_vendor->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $product_vendor->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $product_vendor->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					foreach( $product_vendors as $key => $product_vendor ) {
						$product_vendors[$key] = woo_ce_get_product_vendor_data( $product_vendor, $export->args, array_keys( $export->fields ) );
					}
					$output = $product_vendors;
				}
				unset( $product_vendors, $product_vendor );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Commissions
		case 'commission':
			$fields = woo_ce_get_commission_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_commission_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $commissions = woo_ce_get_commissions( $export->args ) ) {
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					$export->total_rows = count( $commissions );
					if( !empty( $export->fields ) ) {
						foreach( $commissions as $commission ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_commission_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							$commission = woo_ce_get_commission_data( $commission, $export->args, array_keys( $export->fields ) );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $commission->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $commission->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $commission->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $commission->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					foreach( $commissions as $key => $commission ) {
						$commissions[$key] = woo_ce_get_commission_data( $commission, $export->args, array_keys( $export->fields ) );
					}
					$output = $commissions;
				}
				unset( $commissions, $commission );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

		// Shipping Classes
		case 'shipping_class':
			$fields = woo_ce_get_shipping_class_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_shipping_class_field( $key );
			}
			$export->total_columns = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $shipping_classes = woo_ce_get_shipping_classes( $export->args ) ) {
				// XML, RSS export
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {
					$export->total_rows = count( $shipping_classes );
					if( !empty( $export->fields ) ) {
						foreach( $shipping_classes as $shipping_class ) {
							if( $export->export_format == 'xml' )
								$child = $output->addChild( apply_filters( 'woo_ce_export_xml_shipping_class_node', sanitize_key( $export_type ) ) );
							else if( $export->export_format == 'rss' )
								$child = $output->addChild( 'item' );
							foreach( array_keys( $export->fields ) as $key => $field ) {
								if( isset( $shipping_class->$field ) ) {
									if( !is_array( $field ) ) {
										if( woo_ce_is_xml_cdata( $shipping_class->$field ) )
											$child->addChild( sanitize_key( $export->columns[$key] ) )->addCData( esc_html( woo_ce_sanitize_xml_string( $shipping_class->$field ) ) );
										else
											$child->addChild( sanitize_key( $export->columns[$key] ), esc_html( woo_ce_sanitize_xml_string( $shipping_class->$field ) ) );
									}
								}
							}
						}
					}
				} else {
					// PHPExcel export
					$output = $shipping_classes;
				}
				unset( $shipping_classes, $shipping_class );
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			break;

/*
		// Attributes
		case 'attribute':
			$fields = woo_ce_get_attribute_fields( 'summary' );
			if( $export->fields = array_intersect_assoc( (array)$export->fields, $fields ) ) {
				foreach( $export->fields as $key => $field )
					$export->columns[] = woo_ce_get_attribute_field( $key );
			}
			$export->total_columns = $size = count( $export->columns );
			$export->data_memory_start = woo_ce_current_memory_usage();
			if( $attributes = woo_ce_get_attributes( $export->args ) ) {
				$export->total_rows = count( $attributes );
				// Generate the export headers
				if( $export->header_formatting && in_array( $export->export_format, array( 'csv', 'xls' ) ) ) {
					for( $i = 0; $i < $size; $i++ ) {
						if( $i == ( $size - 1 ) )
							$output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $line_ending;
						else
							$output .= woo_ce_escape_csv_value( $export->columns[$i], $export->delimiter, $export->escape_formatting ) . $separator;
					}
				}
				if( !empty( $export->fields ) ) {
					foreach( $atributes as $attribute ) {

						if( $export->export_format == 'xml' )
							$child = $output->addChild( $export->type, 0, -1 );

					}
				}
			}
			$export->data_memory_end = woo_ce_current_memory_usage();
			unset( $export->fields );
			break;
*/

	}

	// Remove our content filters here to play nice with other Plugins
	remove_filter( 'sanitize_key', 'woo_ce_sanitize_key' );

	// Remove our fatal error notice so not to conflict with the CRON or scheduled export engine	
	remove_action( 'shutdown', 'woo_ce_fatal_error' );

	// Export completed successfully
	delete_transient( WOO_CD_PREFIX . '_running' );

	// Check if we're using PHPExcel or generic export engine
	if( WOO_CD_DEBUG || in_array( $export->export_format, array( 'xml', 'rss' ) ) ) {

		// Check that the export file is populated, export columns have been assigned and rows counted
		if( !empty( $output ) && $export->total_rows && $export->total_columns ) {
			if( WOO_CD_DEBUG && !in_array( $export->export_format, array( 'csv', 'xls', 'xlsx' ) ) && ( !$export->cron && !$export->scheduled_export ) ) {
				if( in_array( $export->export_format, array( 'xml', 'rss' ) ) )
					$output = woo_ce_format_xml( $output );
				$response = set_transient( WOO_CD_PREFIX . '_debug_log', base64_encode( $output ), woo_ce_get_option( 'timeout', MINUTE_IN_SECONDS ) );
				if( $response !== true ) {
					$message = __( 'The export contents were too large to store in a single WordPress transient, use the Volume offset / Limit volume options to reduce the size of your export and try again.', 'woo_ce' ) . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __( 'Need help?', 'woo_ce' ) . '</a>)';
					if( function_exists( 'woo_cd_admin_notice' ) )
						woo_cd_admin_notice( $message, 'error' );
					else
						error_log( sprintf( '[store-exporter-deluxe] woo_ce_export_dataset() - %s', $message ) );
					return;
				} else {
					return true;
				}
			} else {
				return $output;
			}
		}

	} else {
		return $output;
	}

}
Beispiel #3
0
    function woo_ce_orders_filter_by_product_tag()
    {
        $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
        $woo_cd_link = sprintf('<a href="%s" target="_blank">' . __('Store Exporter Deluxe', 'woo_ce') . '</a>', $woo_cd_url);
        $args = array('hide_empty' => 1);
        $product_tags = woo_ce_get_product_tags($args);
        ob_start();
        ?>
<p><label><input type="checkbox" id="orders-filters-tag" /> <?php 
        _e('Filter Orders by Product Tag', 'woo_ce');
        ?>
<span class="description"> - <?php 
        printf(__('available in %s', 'woo_ce'), $woo_cd_link);
        ?>
</span></label></p>
<div id="export-orders-filters-tag" class="separator">
	<ul>
		<li>
<?php 
        if (!empty($product_tags)) {
            ?>
			<select data-placeholder="<?php 
            _e('Choose a Product Tag...', 'woo_ce');
            ?>
" name="order_filter_tag[]" multiple class="chzn-select" style="width:95%;">
	<?php 
            foreach ($product_tags as $product_tag) {
                ?>
				<option value="<?php 
                echo $product_tag->term_id;
                ?>
"><?php 
                echo $product_tag->name;
                ?>
 (<?php 
                printf(__('Term ID: %d', 'woo_ce'), $product_tag->term_id);
                ?>
)</option>
	<?php 
            }
            ?>
			</select>
<?php 
        } else {
            ?>
			<?php 
            _e('No Product Tags were found.', 'woo_ce');
        }
        ?>
		</li>
	</ul>
	<p class="description"><?php 
        _e('Select the Product Tags you want to filter exported Orders by. Default is to include all Product Tags.', 'woo_ce');
        ?>
</p>
</div>
<!-- #export-orders-filters-tag -->
<?php 
        ob_end_flush();
    }
Beispiel #4
0
function woo_ce_export_dataset($export_type = null, &$output = null)
{
    global $export;
    $separator = $export->delimiter;
    $export->columns = array();
    $export->total_rows = 0;
    $export->total_columns = 0;
    $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
    set_transient(WOO_CE_PREFIX . '_running', time(), woo_ce_get_option('timeout', MINUTE_IN_SECONDS));
    // Load up the fatal error notice if we 500 Internal Server Error (memory), hit a server timeout or encounter a fatal PHP error
    add_action('shutdown', 'woo_ce_fatal_error');
    // Drop in our content filters here
    add_filter('sanitize_key', 'woo_ce_sanitize_key');
    switch ($export_type) {
        // Products
        case 'product':
            $fields = woo_ce_get_product_fields('summary');
            if ($export->fields = array_intersect_assoc((array) $export->fields, $fields)) {
                foreach ($export->fields as $key => $field) {
                    $export->columns[] = woo_ce_get_product_field($key);
                }
            }
            $export->total_columns = $size = count($export->columns);
            $export->data_memory_start = woo_ce_current_memory_usage();
            if ($products = woo_ce_get_products($export->args)) {
                $export->total_rows = count($products);
                // Generate the export headers
                if (in_array($export->export_format, array('csv'))) {
                    for ($i = 0; $i < $size; $i++) {
                        if ($i == $size - 1) {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . "\n";
                        } else {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . $separator;
                        }
                    }
                }
                $weight_unit = get_option('woocommerce_weight_unit');
                $dimension_unit = get_option('woocommerce_dimension_unit');
                $height_unit = $dimension_unit;
                $width_unit = $dimension_unit;
                $length_unit = $dimension_unit;
                if (!empty($export->fields)) {
                    foreach ($products as $product) {
                        $product = woo_ce_get_product_data($product, $export->args);
                        foreach ($export->fields as $key => $field) {
                            if (isset($product->{$key})) {
                                if (is_array($field)) {
                                    foreach ($field as $array_key => $array_value) {
                                        if (!is_array($array_value)) {
                                            if (in_array($export->export_format, array('csv'))) {
                                                $output .= woo_ce_escape_csv_value($array_value, $export->delimiter, $export->escape_formatting);
                                            }
                                        }
                                    }
                                } else {
                                    if (in_array($export->export_format, array('csv'))) {
                                        $output .= woo_ce_escape_csv_value($product->{$key}, $export->delimiter, $export->escape_formatting);
                                    }
                                }
                            }
                            if (in_array($export->export_format, array('csv'))) {
                                $output .= $separator;
                            }
                        }
                        if (in_array($export->export_format, array('csv'))) {
                            $output = substr($output, 0, -1) . "\n";
                        }
                    }
                }
                unset($products, $product);
            }
            $export->data_memory_end = woo_ce_current_memory_usage();
            break;
            // Categories
        // Categories
        case 'category':
            $fields = woo_ce_get_category_fields('summary');
            if ($export->fields = array_intersect_assoc((array) $export->fields, $fields)) {
                foreach ($export->fields as $key => $field) {
                    $export->columns[] = woo_ce_get_category_field($key);
                }
            }
            $export->total_columns = $size = count($export->columns);
            $export->data_memory_start = woo_ce_current_memory_usage();
            $category_args = array('orderby' => isset($export->args['category_orderby']) ? $export->args['category_orderby'] : 'ID', 'order' => isset($export->args['category_order']) ? $export->args['category_order'] : 'ASC');
            if ($categories = woo_ce_get_product_categories($category_args)) {
                $export->total_rows = count($categories);
                // Generate the export headers
                if (in_array($export->export_format, array('csv'))) {
                    for ($i = 0; $i < $size; $i++) {
                        if ($i == $size - 1) {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . "\n";
                        } else {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . $separator;
                        }
                    }
                }
                if (!empty($export->fields)) {
                    foreach ($categories as $category) {
                        foreach ($export->fields as $key => $field) {
                            if (isset($category->{$key})) {
                                if (in_array($export->export_format, array('csv'))) {
                                    $output .= woo_ce_escape_csv_value($category->{$key}, $export->delimiter, $export->escape_formatting);
                                }
                            }
                            if (in_array($export->export_format, array('csv'))) {
                                $output .= $separator;
                            }
                        }
                        if (in_array($export->export_format, array('csv'))) {
                            $output = substr($output, 0, -1) . "\n";
                        }
                    }
                }
                unset($categories, $category);
            }
            $export->data_memory_end = woo_ce_current_memory_usage();
            break;
            // Tags
        // Tags
        case 'tag':
            $fields = woo_ce_get_tag_fields('summary');
            if ($export->fields = array_intersect_assoc((array) $export->fields, $fields)) {
                foreach ($export->fields as $key => $field) {
                    $export->columns[] = woo_ce_get_tag_field($key);
                }
            }
            $export->total_columns = $size = count($export->columns);
            $export->data_memory_start = woo_ce_current_memory_usage();
            $tag_args = array('orderby' => isset($export->args['tag_orderby']) ? $export->args['tag_orderby'] : 'ID', 'order' => isset($export->args['tag_order']) ? $export->args['tag_order'] : 'ASC');
            if ($tags = woo_ce_get_product_tags($tag_args)) {
                $export->total_rows = count($tags);
                // Generate the export headers
                if (in_array($export->export_format, array('csv'))) {
                    for ($i = 0; $i < $size; $i++) {
                        if ($i == $size - 1) {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . "\n";
                        } else {
                            $output .= woo_ce_escape_csv_value($export->columns[$i], $export->delimiter, $export->escape_formatting) . $separator;
                        }
                    }
                }
                if (!empty($export->fields)) {
                    foreach ($tags as $tag) {
                        foreach ($export->fields as $key => $field) {
                            if (isset($tag->{$key})) {
                                if (in_array($export->export_format, array('csv'))) {
                                    $output .= woo_ce_escape_csv_value($tag->{$key}, $export->delimiter, $export->escape_formatting);
                                }
                            }
                            if (in_array($export->export_format, array('csv'))) {
                                $output .= $separator;
                            }
                        }
                        if (in_array($export->export_format, array('csv'))) {
                            $output = substr($output, 0, -1) . "\n";
                        }
                    }
                }
                unset($tags, $tag);
            }
            $export->data_memory_end = woo_ce_current_memory_usage();
            break;
            // Users
        // Users
        case 'user':
            $fields = woo_ce_get_user_fields('summary');
            if ($export->fields = array_intersect_assoc((array) $export->fields, $fields)) {
                foreach ($export->fields as $key => $field) {
                    $export->columns[] = woo_ce_get_user_field($key);
                }
            }
            $export->total_columns = $size = count($export->columns);
            $export->data_memory_start = woo_ce_current_memory_usage();
            if ($users = woo_ce_get_users($export->args)) {
                // Generate the export headers
                if (in_array($export->export_format, array('csv'))) {
                    $i = 0;
                    foreach ($export->columns as $column) {
                        if ($i == $size - 1) {
                            $output .= woo_ce_escape_csv_value($column, $export->delimiter, $export->escape_formatting) . "\n";
                        } else {
                            $output .= woo_ce_escape_csv_value($column, $export->delimiter, $export->escape_formatting) . $separator;
                        }
                        $i++;
                    }
                }
                if (!empty($export->fields)) {
                    foreach ($users as $user) {
                        $user = woo_ce_get_user_data($user, $export->args);
                        foreach ($export->fields as $key => $field) {
                            if (isset($user->{$key})) {
                                if (in_array($export->export_format, array('csv'))) {
                                    $output .= woo_ce_escape_csv_value($user->{$key}, $export->delimiter, $export->escape_formatting);
                                }
                            }
                            if (in_array($export->export_format, array('csv'))) {
                                $output .= $separator;
                            }
                        }
                        if (in_array($export->export_format, array('csv'))) {
                            $output = substr($output, 0, -1) . "\n";
                        }
                    }
                }
                unset($users, $user);
            }
            $export->data_memory_end = woo_ce_current_memory_usage();
            break;
    }
    // Remove our content filters here to play nice with other Plugins
    remove_filter('sanitize_key', 'woo_ce_sanitize_key');
    // Remove our fatal error notice so not to conflict with the CRON or scheduled export engine
    remove_action('shutdown', 'woo_ce_fatal_error');
    // Export completed successfully
    delete_transient(WOO_CE_PREFIX . '_running');
    // Check that the export file is populated, export columns have been assigned and rows counted
    if ($output && $export->total_rows && $export->total_columns) {
        if (in_array($export->export_format, array('csv'))) {
            $output = woo_ce_file_encoding($output);
            if ($export->export_format == 'csv' && $export->bom && WOO_CE_DEBUG == false) {
                $output = "" . $output;
            }
        }
        if (WOO_CE_DEBUG && !$export->cron) {
            $response = set_transient(WOO_CE_PREFIX . '_debug_log', base64_encode($output), woo_ce_get_option('timeout', MINUTE_IN_SECONDS));
            if ($response !== true) {
                $message = __('The export contents were too large to store in a single WordPress transient, use the Volume offset / Limit volume options to reduce the size of your export and try again.', 'woo_ce') . ' (<a href="' . $troubleshooting_url . '" target="_blank">' . __('Need help?', 'woo_ce') . '</a>)';
                if (function_exists('woo_ce_admin_notice')) {
                    woo_ce_admin_notice($message, 'error');
                } else {
                    error_log(sprintf('[store-exporter] woo_ce_export_dataset() - %s', $message));
                }
            }
        } else {
            return $output;
        }
    }
}
Beispiel #5
0
function woo_ce_export_settings_cron()
{
    $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
    $woo_cd_link = sprintf('<a href="%s" target="_blank">' . __('Store Exporter Deluxe', 'woocommerce-exporter') . '</a>', $woo_cd_url);
    // RSS settings
    $rss_title = __('Title of your RSS feed', 'woocommerce-exporter');
    $rss_link = __('URL to your RSS feed', 'woocommerce-exporter');
    $rss_description = __('Summary description of your RSS feed', 'woocommerce-exporter');
    // Scheduled exports
    $auto_commence_date = date('d/m/Y H:i', current_time('timestamp', 1));
    // Override to enable the Export Type to include all export types
    $types = array('product' => __('Products', 'woocommerce-exporter'), 'category' => __('Categories', 'woocommerce-exporter'), 'tag' => __('Tags', 'woocommerce-exporter'), 'brand' => __('Brands', 'woocommerce-exporter'), 'order' => __('Orders', 'woocommerce-exporter'), 'customer' => __('Customers', 'woocommerce-exporter'), 'user' => __('Users', 'woocommerce-exporter'), 'coupon' => __('Coupons', 'woocommerce-exporter'), 'subscription' => __('Subscriptions', 'woocommerce-exporter'), 'product_vendor' => __('Product Vendors', 'woocommerce-exporter'), 'shipping_class' => __('Shipping Classes', 'woocommerce-exporter'));
    $order_statuses = woo_ce_get_order_statuses();
    $product_types = woo_ce_get_product_types();
    $args = array('hide_empty' => 1);
    $product_categories = woo_ce_get_product_categories($args);
    $product_tags = woo_ce_get_product_tags($args);
    $auto_interval = 1440;
    $auto_format = 'csv';
    $order_filter_date_variable = '';
    // Send to e-mail
    $email_to = get_option('admin_email', '');
    $email_subject = __('[%store_name%] Export: %export_type% (%export_filename%)', 'woocommerce-exporter');
    // Post to remote URL
    $post_to = 'http://www.domain.com/custom-post-form-processor.php';
    // Export to FTP
    $ftp_method_host = 'ftp.domain.com';
    $ftp_method_port = '';
    $ftp_method_protocol = 'ftp';
    $ftp_method_user = '******';
    $ftp_method_pass = '';
    $ftp_method_path = 'wp-content/uploads/export/';
    $ftp_method_filename = 'fixed-filename';
    $ftp_method_passive = 'auto';
    $ftp_method_timeout = '';
    $scheduled_fields = 'all';
    // CRON exports
    $secret_key = '-';
    $cron_fields = 'all';
    $cron_fields = 'all';
    // Orders Screen
    $order_actions_csv = 1;
    $order_actions_xml = 0;
    $order_actions_xls = 1;
    $order_actions_xlsx = 1;
    $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';
    ob_start();
    ?>
<tr id="xml-settings">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php 
    _e('XML Settings', 'woocommerce-exporter');
    ?>
</h3>
	</td>
</tr>
<tr>
	<th>
		<label><?php 
    _e('Attribute display', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul>
			<li><label><input type="checkbox" name="xml_attribute_url" value="1" disabled="disabled" /> <?php 
    _e('Site Address', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_title" value="1" disabled="disabled" /> <?php 
    _e('Site Title', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_date" value="1" disabled="disabled" /> <?php 
    _e('Export Date', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_time" value="1" disabled="disabled" /> <?php 
    _e('Export Time', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_export" value="1" disabled="disabled" /> <?php 
    _e('Export Type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_orderby" value="1" disabled="disabled" /> <?php 
    _e('Export Order By', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_order" value="1" disabled="disabled" /> <?php 
    _e('Export Order', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_limit" value="1" disabled="disabled" /> <?php 
    _e('Limit Volume', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="xml_attribute_offset" value="1" disabled="disabled" /> <?php 
    _e('Volume Offset', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		</ul>
		<p class="description"><?php 
    _e('Control the visibility of different attributes in the XML export.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>

<tr id="rss-settings">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php 
    _e('RSS Settings', 'woocommerce-exporter');
    ?>
</h3>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_title"><?php 
    _e('Title element', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<input name="rss_title" type="text" id="rss_title" value="<?php 
    echo esc_attr($rss_title);
    ?>
" class="regular-text" disabled="disabled" /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		<p class="description"><?php 
    _e('Defines the title of the data feed (e.g. Product export for WordPress Shop).', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_link"><?php 
    _e('Link element', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<input name="rss_link" type="text" id="rss_link" value="<?php 
    echo esc_attr($rss_link);
    ?>
" class="regular-text" disabled="disabled" /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		<p class="description"><?php 
    _e('A link to your website, this doesn\'t have to be the location of the RSS feed.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_description"><?php 
    _e('Description element', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<input name="rss_description" type="text" id="rss_description" value="<?php 
    echo esc_attr($rss_description);
    ?>
" class="large-text" disabled="disabled" /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		<p class="description"><?php 
    _e('A description of your data feed.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>

<tr id="scheduled-exports">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3>
			<div class="dashicons dashicons-calendar"></div>&nbsp;<?php 
    _e('Scheduled Exports', 'woocommerce-exporter');
    ?>
		</h3>
		<p class="description"><?php 
    _e('Configure Store Exporter Deluxe to automatically generate exports, apply filters to export just what you need.<br />Adjusting options within the Scheduling sub-section will after clicking Save Changes refresh the scheduled export engine, editing filters, formats, methods, etc. will not affect the scheduling of the current scheduled export.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="enable_auto"><?php 
    _e('Enable scheduled exports', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<select id="enable_auto" name="enable_auto">
			<option value="1" disabled="disabled"><?php 
    _e('Yes', 'woocommerce-exporter');
    ?>
</option>
			<option value="0" selected="selected"><?php 
    _e('No', 'woocommerce-exporter');
    ?>
</option>
		</select>
		<p class="description"><?php 
    _e('Enabling Scheduled Exports will trigger automated exports at the interval specified under Once every (minutes).', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="auto_type"><?php 
    _e('Export type', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<select id="auto_type" name="auto_type">
<?php 
    if (!empty($types)) {
        ?>
	<?php 
        foreach ($types as $key => $type) {
            ?>
			<option value="<?php 
            echo $key;
            ?>
"><?php 
            echo $type;
            ?>
</option>
	<?php 
        }
    } else {
        ?>
			<option value=""><?php 
        _e('No export types were found.', 'woocommerce-exporter');
        ?>
</option>
<?php 
    }
    ?>
		</select>
		<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
		<p class="description"><?php 
    _e('Select the data type you want to export.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr class="auto_type_options">
	<th>
		<label><?php 
    _e('Export filters', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul>

			<li class="export-options product-options">
				<p class="label"><?php 
    _e('Product category', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></p>
<?php 
    if (!empty($product_categories)) {
        ?>
				<select data-placeholder="<?php 
        _e('Choose a Product Category...', 'woocommerce-exporter');
        ?>
" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
	<?php 
        foreach ($product_categories as $product_category) {
            ?>
					<option><?php 
            echo woo_ce_format_product_category_label($product_category->name, $product_category->parent_name);
            ?>
 (<?php 
            printf(__('Term ID: %d', 'woocommerce-exporter'), $product_category->term_id);
            ?>
)</option>
	<?php 
        }
        ?>
				</select>
<?php 
    } else {
        ?>
				<?php 
        _e('No Product Categories were found.', 'woocommerce-exporter');
    }
    ?>
				<p class="description"><?php 
    _e('Select the Product Category\'s you want to filter exported Products by. Default is to include all Product Categories.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php 
    _e('Product tag', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></p>
<?php 
    if (!empty($product_tags)) {
        ?>
				<select data-placeholder="<?php 
        _e('Choose a Product Tag...', 'woocommerce-exporter');
        ?>
" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
	<?php 
        foreach ($product_tags as $product_tag) {
            ?>
					<option><?php 
            echo $product_tag->name;
            ?>
 (<?php 
            printf(__('Term ID: %d', 'woocommerce-exporter'), $product_tag->term_id);
            ?>
)</option>
	<?php 
        }
        ?>
				</select>
<?php 
    } else {
        ?>
				<?php 
        _e('No Product Tags were found.', 'woocommerce-exporter');
    }
    ?>
				<p class="description"><?php 
    _e('Select the Product Tag\'s you want to filter exported Products by. Default is to include all Product Tags.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php 
    _e('Product type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></p>
<?php 
    if (!empty($product_types)) {
        ?>
				<select data-placeholder="<?php 
        _e('Choose a Product Type...', 'woocommerce-exporter');
        ?>
" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
	<?php 
        foreach ($product_types as $key => $product_type) {
            ?>
					<option><?php 
            echo woo_ce_format_product_type($product_type['name']);
            ?>
 (<?php 
            echo $product_type['count'];
            ?>
)</option>
	<?php 
        }
        ?>
				</select>
<?php 
    } else {
        ?>
				<?php 
        _e('No Product Types were found.', 'woocommerce-exporter');
    }
    ?>
				<p class="description"><?php 
    _e('Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types and Variations.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php 
    _e('Stock status', 'woocommerce-exporter');
    ?>
</p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" name="product_filter_stock" value="" disabled="disabled" /> <?php 
    _e('Include both', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="product_filter_stock" value="instock" disabled="disabled" /> <?php 
    _e('In stock', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="product_filter_stock" value="outofstock" disabled="disabled" /> <?php 
    _e('Out of stock', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
				</ul>
				<p class="description"><?php 
    _e('Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woocommerce-exporter');
    ?>
</p>
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Order date', 'woocommerce-exporter');
    ?>
</p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" name="order_dates_filter" value="" disabled="disabled" /><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="today" disabled="disabled" /><?php 
    _e('Today', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="yesterday" disabled="disabled" /><?php 
    _e('Yesterday', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="current_week" disabled="disabled" /><?php 
    _e('Current week', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="last_week" disabled="disabled" /><?php 
    _e('Last week', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="current_month" disabled="disabled" /><?php 
    _e('Current month', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li><label><input type="radio" name="order_dates_filter" value="last_month" disabled="disabled" /><?php 
    _e('Last month', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
					<li>
						<label><input type="radio" name="order_dates_filter" value="variable" disabled="disabled" /><?php 
    _e('Variable date', 'woocommerce-exporter');
    ?>
</label>
						<div style="margin-top:0.2em;">
							<?php 
    _e('Last', 'woocommerce-exporter');
    ?>
							<input type="text" name="order_dates_filter_variable" class="text" size="4" value="<?php 
    echo $order_filter_date_variable;
    ?>
" disabled="disabled" />
							<select name="order_dates_filter_variable_length">
								<option value="">&nbsp;</option>
								<option value="second" disabled="disabled"><?php 
    _e('second(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="minute" disabled="disabled"><?php 
    _e('minute(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="hour" disabled="disabled"><?php 
    _e('hour(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="day" disabled="disabled"><?php 
    _e('day(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="week" disabled="disabled"><?php 
    _e('week(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="month" disabled="disabled"><?php 
    _e('month(s)', 'woocommerce-exporter');
    ?>
</option>
								<option value="year" disabled="disabled"><?php 
    _e('year(s)', 'woocommerce-exporter');
    ?>
</option>
							</select>
							<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
						</div>
					</li>
					<li>
						<label><input type="radio" name="order_dates_filter" value="manual" disabled="disabled" /><?php 
    _e('Fixed date', 'woocommerce-exporter');
    ?>
</label>
						<div style="margin-top:0.2em;">
							<input type="text" size="10" maxlength="10" class="text datepicker" /> to <input type="text" size="10" maxlength="10" class="text datepicker" /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
						</div>
					</li>
				</ul>
				<p class="description"><?php 
    _e('Filter the dates of Orders to be included in the export. If manually selecting dates ensure the Fixed date radio field is checked, likewise for variable dates. Default is to include all Orders made.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Order status', 'woocommerce-exporter');
    ?>
</p>
				<select data-placeholder="<?php 
    _e('Choose a Order Status...', 'woocommerce-exporter');
    ?>
" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
					<option value="" selected="selected"><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</option>
<?php 
    if (!empty($order_statuses)) {
        ?>
	<?php 
        foreach ($order_statuses as $order_status) {
            ?>
					<option value="<?php 
            echo $order_status->name;
            ?>
" disabled="disabled"><?php 
            echo ucfirst($order_status->name);
            ?>
</option>
	<?php 
        }
    }
    ?>
				</select>
				<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				<p class="description"><?php 
    _e('Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Payment gateway', 'woocommerce-exporter');
    ?>
</p>
				<select data-placeholder="<?php 
    _e('Choose a Payment Gateway...', 'woocommerce-exporter');
    ?>
" name="order_filter_payment[]" multiple class="chzn-select" style="width:95%;">
					<option value="" selected="selected"><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</option>
				</select>
				<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				<p class="description"><?php 
    _e('Select the Payment Gateways you want to filter exported Orders by. Default is to include all Payment Gateways.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Shipping method', 'woocommerce-exporter');
    ?>
</p>
				<select data-placeholder="<?php 
    _e('Choose a Shipping Method...', 'woocommerce-exporter');
    ?>
" name="order_filter_shipping[]" multiple class="chzn-select" style="width:95%;">
					<option value="" selected="selected"><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</option>
				</select>
				<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				<p class="description"><?php 
    _e('Select the Shipping Methods you want to filter exported Orders by. Default is to include all Shipping Methods.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Billing country', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></p>
				<select data-placeholder="<?php 
    _e('Choose a Billing Country...', 'woocommerce-exporter');
    ?>
" name="order_filter_billing_country[]" multiple class="chzn-select" style="width:95%;">
					<option value="" selected="selected"><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</option>
				</select>
				<p class="description"><?php 
    _e('Filter Orders by Billing Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter');
    ?>
</p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php 
    _e('Shipping country', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></p>
				<select data-placeholder="<?php 
    _e('Choose a Shipping Country...', 'woocommerce-exporter');
    ?>
" id="order_filter_shipping_country" name="order_filter_shipping_country" class="chzn-select">
					<option value="" selected="selected"><?php 
    _e('All', 'woocommerce-exporter');
    ?>
</option>
				</select>
				<p class="description"><?php 
    _e('Filter Orders by Shipping Country to be included in the export. Default is to include all Countries.', 'woocommerce-exporter');
    ?>
</p>
			</li>

			<li class="export-options category-options tag-options brand-options customer-options user-options coupon-options subscription-options product_vendor-options commission-options shipping_class-options">
				<p><?php 
    _e('No export filter options are available for this export type.', 'woocommerce-exporter');
    ?>
</p>
			</li>

		</ul>
	</td>
</tr>

<tr>
	<th>
		<label><?php 
    _e('Scheduling', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<p><?php 
    _e('How often do you want the export to run?', 'woocommerce-exporter');
    ?>
</p>
		<ul>
			<li>
				<label><input type="radio" name="auto_schedule" value="custom" disabled="disabled" /> <?php 
    _e('Once every ', 'woocommerce-exporter');
    ?>
</label>
				<input name="auto_interval" type="text" id="auto_interval" value="<?php 
    echo esc_attr($auto_interval);
    ?>
" size="6" maxlength="6" class="text" disabled="disabled" />
				<?php 
    _e('minutes', 'woocommerce-exporter');
    ?>
				<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
			</li>
			<li><label><input type="radio" name="auto_schedule" value="daily" disabled="disabled" /> <?php 
    _e('Daily', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
			<li><label><input type="radio" name="auto_schedule" value="weekly" disabled="disabled" /> <?php 
    _e('Weekly', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
			<li><label><input type="radio" name="auto_schedule" value="monthly" disabled="disabled" /> <?php 
    _e('Monthly', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
			<li><label><input type="radio" name="auto_schedule" value="one-time" disabled="disabled" /> <?php 
    _e('One time', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
		</ul>
		<p class="description"><?php 
    _e('Choose how often Store Exporter Deluxe generates new exports. Default is every 1440 minutes (once every 24 hours).', 'woocommerce-exporter');
    ?>
</p>
		<hr />
		<p><?php 
    _e('When do you want scheduled exports to start?', 'woocommerce-exporter');
    ?>
</p>
		<ul>
			<li><label><input type="radio" name="auto_commence" value="now" disabled="disabled" /><?php 
    _e('From now', 'woocommerce-exporter');
    ?>
</label><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
			<li><label><input type="radio" name="auto_commence" value="future" disabled="disabled" /><?php 
    _e('From the following', 'woocommerce-exporter');
    ?>
</label>: <input type="text" name="auto_commence_date" size="20" maxlength="20" class="text datetimepicker" value="<?php 
    echo $auto_commence_date;
    ?>
" /><!--, <?php 
    _e('at this time', 'woocommerce-exporter');
    ?>
: <input type="text" name="auto_interval_time" size="10" maxlength="10" class="text timepicker" />--><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></li>
		</ul>
	</td>
</tr>

<tr>
	<th>
		<label><?php 
    _e('Export format', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" name="auto_format" value="csv" disabled="disabled" /> <?php 
    _e('CSV', 'woocommerce-exporter');
    ?>
 <span class="description"><?php 
    _e('(Comma Separated Values)', 'woocommerce-exporter');
    ?>
 - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="radio" name="auto_format" value="xml" disabled="disabled" /> <?php 
    _e('XML', 'woocommerce-exporter');
    ?>
 <span class="description"><?php 
    _e('(EXtensible Markup Language)', 'woocommerce-exporter');
    ?>
 - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="radio" name="auto_format" value="xls" disabled="disabled" /> <?php 
    _e('Excel (XLS)', 'woocommerce-exporter');
    ?>
 <span class="description"><?php 
    _e('(Excel 97-2003)', 'woocommerce-exporter');
    ?>
 - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="radio" name="auto_format" value="xlsx" disabled="disabled" /> <?php 
    _e('Excel (XLSX)', 'woocommerce-exporter');
    ?>
 <span class="description"><?php 
    _e('(Excel 2007-2013)', 'woocommerce-exporter');
    ?>
 - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		</ul>
		<p class="description"><?php 
    _e('Adjust the export format to generate different export file formats. Default is CSV.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="auto_method"><?php 
    _e('Export method', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<select id="auto_method" name="auto_method">
			<option value="archive"><?php 
    _e('Archive to WordPress Media', 'woocommerce-exporter');
    ?>
</option>
			<option value="email"><?php 
    _e('Send as e-mail', 'woocommerce-exporter');
    ?>
</option>
			<option value="post"><?php 
    _e('POST to remote URL', 'woocommerce-exporter');
    ?>
</option>
			<option value="ftp"><?php 
    _e('Upload to remote FTP', 'woocommerce-exporter');
    ?>
</option>
		</select>
		<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
		<p class="description"><?php 
    _e('Choose what Store Exporter Deluxe does with the generated export. Default is to archive the export to the WordPress Media for archival purposes.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr class="auto_method_options">
	<th>
		<label><?php 
    _e('Export method options', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul>

			<li class="export-options email-options">
				<p>
					<label for="email_to"><?php 
    _e('Default e-mail recipient', 'woocommerce-exporter');
    ?>
</label><br />
					<input name="email_to" type="text" id="email_to" value="<?php 
    echo esc_attr($email_to);
    ?>
" class="regular-text code" disabled="disabled" /><br /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				</p>
				<p class="description"><?php 
    _e('Set the default recipient of scheduled export e-mails, multiple recipients can be added using the <code><attr title="comma">,</attr></code> separator. This option can be overriden via CRON using the <code>to</code> argument.<br />Default is the Blog Administrator e-mail address set on the WordPress &raquo; Settings screen.', 'woocommerce-exporter');
    ?>
</p>

				<p>
					<label for="email_subject"><?php 
    _e('Default e-mail subject', 'woocommerce-exporter');
    ?>
</label><br />
					<input name="email_subject" type="text" id="email_subject" value="<?php 
    echo esc_attr($email_subject);
    ?>
" class="large-text code" disabled="disabled" /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				</p>
				<p class="description"><?php 
    _e('Set the default subject of scheduled export e-mails, can be overriden via CRON using the <code>subject</code> argument. Tags can be used: <code>%store_name%</code>, <code>%export_type%</code>, <code>%export_filename%</code>.', 'woocommerce-exporter');
    ?>
</p>
			</li>

			<li class="export-options post-options">
				<p>
					<label for="post_to"><?php 
    _e('Default remote POST URL', 'woocommerce-exporter');
    ?>
</label><br />
					<input name="post_to" type="text" id="post_to" value="<?php 
    echo esc_url($post_to);
    ?>
" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
				</p>
				<p class="description"><?php 
    printf(__('Set the default remote POST address for scheduled exports, can be overriden via CRON using the <code>to</code> argument. Default is empty. See our <a href="%s" target="_blank">Usage</a> document for more information on Default remote POST URL.', 'woocommerce-exporter'), $troubleshooting_url);
    ?>
</p>
			</li>

			<li class="export-options ftp-options">
				<label for="ftp_method_host"><?php 
    _e('Host', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_host" name="ftp_method_host" size="15" class="regular-text code" value="<?php 
    echo sanitize_text_field($ftp_method_host);
    ?>
" disabled="disabled" />&nbsp;
				<label for="ftp_method_port" style="width:auto;"><?php 
    _e('Port', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_port" name="ftp_method_port" size="5" class="short-text code" value="<?php 
    echo sanitize_text_field($ftp_method_port);
    ?>
" disabled="disabled" maxlength="5" /><br />
				<label for="ftp_method_protocol"><?php 
    _e('Protocol', 'woocommerce-exporter');
    ?>
</label>
				<select name="ftp_method_protocol">
					<option><?php 
    _e('FTP - File Transfer Protocol', 'woocommerce-exporter');
    ?>
</option>
					<option disabled="disabled"><?php 
    _e('SFTP - SSH File Transfer Protocol', 'woocommerce-exporter');
    ?>
</option>
				</select><br />
				<label for="ftp_method_user"><?php 
    _e('Username', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_user" name="ftp_method_user" size="15" class="regular-text code" value="<?php 
    echo sanitize_text_field($ftp_method_user);
    ?>
" disabled="disabled" /><br />
				<label for="ftp_method_pass"><?php 
    _e('Password', 'woocommerce-exporter');
    ?>
:</label> <input type="password" id="ftp_method_pass" name="ftp_method_pass" size="15" class="regular-text code" value="" disabled="disabled" /><?php 
    if (!empty($ftp_method_pass)) {
        echo ' ' . __('(password is saved)', 'woocommerce-exporter');
    }
    ?>
<br />
				<label for="ftp_method_file_path"><?php 
    _e('File path', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_file_path" name="ftp_method_path" size="25" class="regular-text code" value="<?php 
    echo sanitize_text_field($ftp_method_path);
    ?>
" disabled="disabled" /><br />
				<label for="ftp_method_filename"><?php 
    _e('Fixed filename', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_filename" name="ftp_method_filename" size="25" class="regular-text code" value="<?php 
    echo sanitize_text_field($ftp_method_filename);
    ?>
" disabled="disabled" /><br />
				<label for="ftp_method_passive"><?php 
    _e('Transfer mode', 'woocommerce-exporter');
    ?>
:</label> 
				<select id="ftp_method_passive" name="ftp_method_passive">
					<option value="auto"><?php 
    _e('Auto', 'woocommerce-exporter');
    ?>
</option>
					<option value="active" disabled="disabled"><?php 
    _e('Active', 'woocommerce-exporter');
    ?>
</option>
					<option value="passive" disabled="disabled"><?php 
    _e('Passive', 'woocommerce-exporter');
    ?>
</option>
				</select><br />
				<label for="ftp_method_timeout"><?php 
    _e('Timeout', 'woocommerce-exporter');
    ?>
:</label> <input type="text" id="ftp_method_timeout" name="ftp_method_timeout" size="5" class="short-text code" value="<?php 
    echo sanitize_text_field($ftp_method_timeout);
    ?>
" disabled="disabled" /><br />
				<p class="description"><?php 
    _e('Enter the FTP host (minus <code>ftp://</code>), login details and path of where to save the export file, do not provide the filename, the export filename can be set on General Settings above. For file path example: <code>wp-content/uploads/exports/</code>', 'woocommerce-exporter');
    ?>
</p>
			</li>

			<li class="export-options archive-options">
				<p><?php 
    _e('No export method options are available for this export method.', 'woocommerce-exporter');
    ?>
</p>
			</li>

		</ul>
	</td>
</tr>
<tr>
	<th>
		<label for="scheduled_fields"><?php 
    _e('Export fields', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" id="scheduled_fields" name="scheduled_fields" value="all"<?php 
    checked($scheduled_fields, 'all');
    ?>
 /> <?php 
    _e('Include all Export Fields for the requested Export Type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="radio" name="scheduled_fields" value="saved"<?php 
    checked($scheduled_fields, 'saved');
    ?>
 disabled="disabled" /> <?php 
    _e('Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		</ul>
		<p class="description"><?php 
    _e('Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>

<tr id="cron-exports">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php 
    _e('CRON Exports', 'woocommerce-exporter');
    ?>
</h3>
		<p class="description"><?php 
    printf(__('Store Exporter Deluxe supports exporting via a command line request. For sample CRON requests and supported arguments consult our <a href="%s" target="_blank">online documentation</a>.', 'woocommerce-exporter'), $troubleshooting_url);
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="enable_cron"><?php 
    _e('Enable CRON', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<select id="enable_cron" name="enable_cron">
			<option value="1" disabled="disabled"><?php 
    _e('Yes', 'woocommerce-exporter');
    ?>
</option>
			<option value="0" selected="selected"><?php 
    _e('No', 'woocommerce-exporter');
    ?>
</option>
		</select>
		<p class="description"><?php 
    _e('Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="secret_key"><?php 
    _e('Export secret key', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<input name="secret_key" type="text" id="secret_key" value="<?php 
    echo esc_attr($secret_key);
    ?>
" class="large-text code" disabled="disabled" /><br /><span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span>
		<p class="description"><?php 
    _e('This secret key (can be left empty to allow unrestricted access) limits access to authorised developers who provide a matching key when working with Store Exporter Deluxe.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<tr>
	<th>
		<label for="cron_fields"><?php 
    _e('Export fields', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" id="cron_fields" name="cron_fields" value="all"<?php 
    checked($cron_fields, 'all');
    ?>
 /> <?php 
    _e('Include all Export Fields for the requested Export Type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="radio" name="cron_fields" value="saved"<?php 
    checked($cron_fields, 'saved');
    ?>
 disabled="disabled" /> <?php 
    _e('Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		</ul>
		<p class="description"><?php 
    _e('Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>

<tr id="orders-screen">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php 
    _e('Orders Screen', 'woocommerce-exporter');
    ?>
</h3>
	</td>
</tr>
<tr>
	<th>
		<label><?php 
    _e('Actions display', 'woocommerce-exporter');
    ?>
</label>
	</th>
	<td>
		<ul>
			<li><label><input type="checkbox" name="order_actions_csv" value="1"<?php 
    checked($order_actions_csv);
    ?>
 /> <?php 
    _e('Export to CSV', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="order_actions_xml" value="1"<?php 
    checked($order_actions_xml);
    ?>
 /> <?php 
    _e('Export to XML', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="order_actions_xls" value="1"<?php 
    checked($order_actions_xls);
    ?>
 /> <?php 
    _e('Export to XLS', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
			<li><label><input type="checkbox" name="order_actions_xlsx" value="1"<?php 
    checked($order_actions_xlsx);
    ?>
 /> <?php 
    _e('Export to XLSX', 'woocommerce-exporter');
    ?>
<span class="description"> - <?php 
    printf(__('available in %s', 'woocommerce-exporter'), $woo_cd_link);
    ?>
</span></label></li>
		</ul>
		<p class="description"><?php 
    _e('Control the visibility of different Order actions on the WooCommerce &raquo; Orders screen.', 'woocommerce-exporter');
    ?>
</p>
	</td>
</tr>
<?php 
    ob_end_flush();
}
function woo_ce_export_settings_extend() {

	// XML settings
	$xml_attribute_url = woo_ce_get_option( 'xml_attribute_url', 1 );
	$xml_attribute_title = woo_ce_get_option( 'xml_attribute_title', 1 );
	$xml_attribute_date = woo_ce_get_option( 'xml_attribute_date', 1 );
	$xml_attribute_time = woo_ce_get_option( 'xml_attribute_time', 0 );
	$xml_attribute_export = woo_ce_get_option( 'xml_attribute_export', 1 );
	$xml_attribute_orderby = woo_ce_get_option( 'xml_attribute_orderby', 0 );
	$xml_attribute_order = woo_ce_get_option( 'xml_attribute_order', 0 );
	$xml_attribute_limit = woo_ce_get_option( 'xml_attribute_limit', 0 );
	$xml_attribute_offset = woo_ce_get_option( 'xml_attribute_offset', 0 );

	// RSS settings
	$rss_title = woo_ce_get_option( 'rss_title', '' );
	$rss_link = woo_ce_get_option( 'rss_link', '' );
	$rss_description = woo_ce_get_option( 'rss_description', '' );

	// Scheduled exports
	$enable_auto = woo_ce_get_option( 'enable_auto', 0 );
	$auto_schedule = woo_ce_get_option( 'auto_schedule', 'custom' );
	$auto_interval = woo_ce_get_option( 'auto_interval', 1440 );
	$auto_commence = woo_ce_get_option( 'auto_commence', 'now' );
	$auto_commence_date = woo_ce_get_option( 'auto_commence_date', date( 'd/m/Y H:i', current_time( 'timestamp', 1 ) ) );
	// Legacy update of Comment Date to support time
	if( strlen( $auto_commence_date ) <= 10 ) {
		$auto_commence_date .= sprintf( ' %s', date( 'H:i', current_time( 'timestamp', 1 ) ) );
	}
	if( $enable_auto == 1 ) {
		if( ( $next_export = woo_ce_next_scheduled_export() ) == false )
			$next_export = __( 'a little while... just waiting on WP-CRON to refresh its task list', 'woo_ce' );
		if( $auto_schedule <> 'custom' )
			$next_export = sprintf( __( '%s (in %s)', 'woo_ce' ), $auto_schedule, $next_export );
	}
	$auto_type = woo_ce_get_option( 'auto_type', 'product' );
	$types = woo_ce_return_export_types();
	$order_statuses = woo_ce_get_order_statuses();
	$product_types = woo_ce_get_product_types();
	$args = array(
		'hide_empty' => 1
	);
	$product_categories = woo_ce_get_product_categories( $args );
	$product_tags = woo_ce_get_product_tags( $args );
	$product_statuses = get_post_statuses();
	if( !isset( $product_statuses['trash'] ) )
		$product_statuses['trash'] = __( 'Trash', 'woo_ce' );

	$product_filter_type = woo_ce_get_option( 'auto_product_type', array() );
	$product_filter_status = woo_ce_get_option( 'auto_product_status', array() );
	$product_filter_stock = woo_ce_get_option( 'auto_product_stock', false );
	$product_filter_category = woo_ce_get_option( 'auto_product_category', array() );
	$product_filter_tag = woo_ce_get_option( 'auto_product_tag', array() );

	$order_filter_status = woo_ce_get_option( 'auto_order_status', array() );
	if( empty( $order_filter_status ) )
		$order_filter_status = array();
	$order_filter_product = woo_ce_get_option( 'auto_order_product', array() );
	if( empty( $order_filter_product ) )
		$order_filter_product = array();
	$order_filter_date = woo_ce_get_option( 'auto_order_date', false );
	$order_filter_dates_from = woo_ce_get_option( 'auto_order_dates_from', '' );
	$order_filter_dates_to = woo_ce_get_option( 'auto_order_dates_to', '' );
	$order_filter_date_variable = woo_ce_get_option( 'auto_order_date_variable', '' );
	$order_filter_date_variable_length = woo_ce_get_option( 'auto_order_date_variable_length', '' );
	$countries = woo_ce_allowed_countries();
	$order_filter_billing_country = woo_ce_get_option( 'auto_order_billing_country', array() );
	$order_filter_shipping_country = woo_ce_get_option( 'auto_order_shipping_country', array() );
	$payment_gateways = woo_ce_get_order_payment_gateways();
	$order_filter_payment = woo_ce_get_option( 'auto_order_payment', array() );
	$shipping_methods = woo_ce_get_order_shipping_methods();
	$order_filter_shipping = woo_ce_get_option( 'auto_order_shipping', array() );

	$auto_format = woo_ce_get_option( 'auto_format', 'csv' );
	$auto_method = woo_ce_get_option( 'auto_method', 'archive' );

	// Send to e-mail
	$email_to = woo_ce_get_option( 'email_to', get_option( 'admin_email', '' ) );
	$email_subject = woo_ce_get_option( 'email_subject', '' );
	// Default subject
	if( empty( $email_subject ) )
		$email_subject = __( '[%store_name%] Export: %export_type% (%export_filename%)', 'woo_ce' );

	// Post to remote URL
	$post_to = woo_ce_get_option( 'post_to', '' );

	// Export to FTP
	$ftp_method_host = woo_ce_get_option( 'auto_ftp_method_host', '' );
	$ftp_method_port = woo_ce_get_option( 'auto_ftp_method_port', '' );
	$ftp_method_protocol = woo_ce_get_option( 'auto_ftp_method_protocol', 'ftp' );
	$ftp_method_user = woo_ce_get_option( 'auto_ftp_method_user', '' );
	$ftp_method_pass = woo_ce_get_option( 'auto_ftp_method_pass', '' );
	$ftp_method_path = woo_ce_get_option( 'auto_ftp_method_path', '' );
	$ftp_method_filename = woo_ce_get_option( 'auto_ftp_method_filename', '' );
	$ftp_method_passive = woo_ce_get_option( 'auto_ftp_method_passive', '' );
	$ftp_method_timeout = woo_ce_get_option( 'auto_ftp_method_timeout', '' );

	$scheduled_fields = woo_ce_get_option( 'scheduled_fields', 'all' );

	// CRON exports
	$enable_cron = woo_ce_get_option( 'enable_cron', 0 );
	$secret_key = woo_ce_get_option( 'secret_key', '' );

	$cron_fields = woo_ce_get_option( 'cron_fields', 'all' );

	// Orders Screen
	$order_actions_csv = woo_ce_get_option( 'order_actions_csv', 1 );
	$order_actions_xml = woo_ce_get_option( 'order_actions_xml', 0 );
	$order_actions_xls = woo_ce_get_option( 'order_actions_xls', 1 );
	$order_actions_xlsx = woo_ce_get_option( 'order_actions_xlsx', 1 );

	// Export Triggers
	$enable_trigger_new_order = woo_ce_get_option( 'enable_trigger_new_order', 0 );
	$trigger_new_order_format = woo_ce_get_option( 'trigger_new_order_format', 'csv' );
	$trigger_new_order_method = woo_ce_get_option( 'trigger_new_order_format', 'archive' );
	$trigger_new_order_fields = woo_ce_get_option( 'trigger_new_order_fields', 'all' );

	$troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/usage/';

	ob_start(); ?>
<tr id="xml-settings">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'XML Settings', 'woo_ce' ); ?></h3>
	</td>
</tr>
<tr>
	<th>
		<label><?php _e( 'Attribute display', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul>
			<li><label><input type="checkbox" name="xml_attribute_url" value="1"<?php checked( $xml_attribute_url ); ?> /> <?php _e( 'Site Address', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_title" value="1"<?php checked( $xml_attribute_title ); ?> /> <?php _e( 'Site Title', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_date" value="1"<?php checked( $xml_attribute_date ); ?> /> <?php _e( 'Export Date', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_time" value="1"<?php checked( $xml_attribute_time ); ?> /> <?php _e( 'Export Time', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_export" value="1"<?php checked( $xml_attribute_export ); ?> /> <?php _e( 'Export Type', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_orderby" value="1"<?php checked( $xml_attribute_orderby ); ?> /> <?php _e( 'Export Order By', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_order" value="1"<?php checked( $xml_attribute_order ); ?> /> <?php _e( 'Export Order', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_limit" value="1"<?php checked( $xml_attribute_limit ); ?> /> <?php _e( 'Limit Volume', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="xml_attribute_offset" value="1"<?php checked( $xml_attribute_offset ); ?> /> <?php _e( 'Volume Offset', 'woo_ce' ); ?></label></li>
		</ul>
		<p class="description"><?php _e( 'Control the visibility of different attributes in the XML export.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr id="rss-settings">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-media-code"></div>&nbsp;<?php _e( 'RSS Settings', 'woo_ce' ); ?></h3>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_title"><?php _e( 'Title element', 'woo_ce' ); ?></label>
	</th>
	<td>
		<input name="rss_title" type="text" id="rss_title" value="<?php echo esc_attr( $rss_title ); ?>" class="large-text" />
		<p class="description"><?php _e( 'Defines the title of the data feed (e.g. Product export for WordPress Shop).', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_link"><?php _e( 'Link element', 'woo_ce' ); ?></label>
	</th>
	<td>
		<input name="rss_link" type="text" id="rss_link" value="<?php echo esc_attr( $rss_link ); ?>" class="large-text" />
		<p class="description"><?php _e( 'A link to your website, this doesn\'t have to be the location of the RSS feed.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="rss_description"><?php _e( 'Description element', 'woo_ce' ); ?></label>
	</th>
	<td>
		<input name="rss_description" type="text" id="rss_description" value="<?php echo esc_attr( $rss_description ); ?>" class="large-text" />
		<p class="description"><?php _e( 'A description of your data feed.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr id="scheduled-exports">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3>
			<div class="dashicons dashicons-calendar"></div>&nbsp;<?php _e( 'Scheduled Exports', 'woo_ce' ); ?>
			<!-- <a href="/woocommerce/wp-admin/admin.php?page=woo_ce&amp;tab=export" class="add-new-h2">Add New</a> -->
		</h3>
<?php if( $enable_auto == 1 ) { ?>
		<p style="font-size:0.8em;"><div class="dashicons dashicons-yes"></div>&nbsp;<strong><?php printf( __( 'Scheduled Exports is enabled, next scheduled export will run %s.', 'woo_ce' ), $next_export ); ?></strong></p>
<?php } ?>
		<p class="description"><?php _e( 'Configure Store Exporter Deluxe to automatically generate exports, apply filters to export just what you need.<br />Adjusting options within the Scheduling sub-section will after clicking Save Changes refresh the scheduled export engine, editing filters, formats, methods, etc. will not affect the scheduling of the current scheduled export.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="enable_auto"><?php _e( 'Enable scheduled exports', 'woo_ce' ); ?></label>
	</th>
	<td>
		<select id="enable_auto" name="enable_auto">
			<option value="1"<?php selected( $enable_auto, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
			<option value="0"<?php selected( $enable_auto, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
		</select>
		<p class="description"><?php _e( 'Enabling Scheduled Exports will trigger automated exports at the interval specified under Scheduling.', 'woo_ce' ); ?></p>
	</td>
</tr>
<!--
<tr>
	<th>&nbsp;</th>
	<td style="padding:1em 0 1em 0.8em;">

		<table class="widefat page fixed scheduled-exports">
			<thead>
				<tr>
					<th scope="col" id="cb" class="manage-column column-cb check-column">
						<label class="screen-reader-text" for="cb-select-all-1"><?php _e( 'Select All', 'woo_ce' ); ?></label><input id="cb-select-all-1" type="checkbox" />
					</th>
					<th class="manage-column"><?php _e( 'Name', 'woo_ce' ); ?></th>
					<th class="manage-column"><?php _e( 'Type', 'woo_ce' ); ?></th>
					<th class="manage-column"><?php _e( 'Format', 'woo_ce' ); ?></th>
					<th class="manage-column"><?php _e( 'Status', 'woo_ce' ); ?></th>
					<th class="manage-column"><?php _e( 'Date', 'woo_ce' ); ?></th>
					<th class="manage-column separator">&nbsp;</th>
				</tr>
			</thead>
			<tbody>

<?php if( !empty( $posts ) ) { ?>
				<tr>
					<th scope="row" class="check-column">
						<label class="screen-reader-text" for="cb-select-18619"><?php printf( __( 'Select %s', 'woo_ce' ), get_the_title( $post ) ); ?></label>
						<input id="cb-select-<?php echo $post; ?>" type="checkbox" name="post[]" value="<?php echo $post; ?>">
					</th>
					<td>My Daily Product Export</td>
					<td>Product</td>
					<td>CSV</td>
					<td>Enabled</td>
					<td>30 days ago</td>
					<td class="edit"><a href="#">Edit</a></td>
				</tr>
<?php } else { ?>
				<tr>
						<td class="colspanchange" colspan="6"><?php _e( 'No scheduled exports found.', 'woo_ce' ); ?></td>
				</tr>
<?php } ?>

			</tbody>
		</table>

	</td>
</tr>
-->
<tr>
	<th>
		<label for="auto_type"><?php _e( 'Export type', 'woo_ce' ); ?></label>
	</th>
	<td>
		<select id="auto_type" name="auto_type">
<?php if( !empty( $types ) ) { ?>
	<?php foreach( $types as $key => $type ) { ?>
			<option value="<?php echo $key; ?>"<?php selected( $auto_type, $key ); ?>><?php echo $type; ?></option>
	<?php } ?>
<?php } else { ?>
			<option value=""><?php _e( 'No export types were found.', 'woo_ce' ); ?></option>
<?php } ?>
		</select>
		<p class="description"><?php _e( 'Select the data type you want to export.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr class="auto_type_options">
	<th>
		<label><?php _e( 'Export filters', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul>

			<li class="export-options product-options">
				<p class="label"><?php _e( 'Product category', 'woo_ce' ); ?></p>
<?php if( !empty( $product_categories ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Product Category...', 'woo_ce' ); ?>" name="product_filter_category[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $product_categories as $product_category ) { ?>
					<option value="<?php echo $product_category->term_id; ?>"<?php checked( in_array( $product_category->term_id, $product_filter_category ), true ); ?><?php disabled( $product_category->count, 0 ); ?>><?php echo woo_ce_format_product_category_label( $product_category->name, $product_category->parent_name ); ?> (<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_category->term_id ); ?>)</option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Product Categories were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Product Category\'s you want to filter exported Products by. Default is to include all Product Categories.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php _e( 'Product tag', 'woo_ce' ); ?></p>
<?php if( !empty( $product_tags ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Product Tag...', 'woo_ce' ); ?>" name="product_filter_tag[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $product_tags as $product_tag ) { ?>
					<option value="<?php echo $product_tag->term_id; ?>"<?php selected( in_array( $product_tag->term_id, $product_filter_tag ), true ); ?><?php disabled( $product_category->count, 0 ); ?>><?php echo $product_tag->name; ?> (<?php printf( __( 'Term ID: %d', 'woo_ce' ), $product_tag->term_id ); ?>)</option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Product Tags were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Product Tag\'s you want to filter exported Products by. Default is to include all Product Tags.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php _e( 'Product status', 'woo_ce' ); ?></p>
<?php if( !empty( $product_statuses ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Product Status...', 'woo_ce' ); ?>" name="product_filter_status[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $product_statuses as $key => $product_status ) { ?>
					<option value="<?php echo $key; ?>"<?php selected( in_array( $key, $product_filter_status ), true ); ?>><?php echo $product_status; ?></option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Product Status were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Product Status\'s you want to filter exported Products by. Default is to include all Product Status\'s.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php _e( 'Product type', 'woo_ce' ); ?></p>
<?php if( !empty( $product_types ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Product Type...', 'woo_ce' ); ?>" name="product_filter_type[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $product_types as $key => $product_type ) { ?>
					<option value="<?php echo $key; ?>"<?php selected( in_array( $key, $product_filter_type ), true ); ?>><?php echo woo_ce_format_product_type( $product_type['name'] ); ?> (<?php echo $product_type['count']; ?>)</option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Product Types were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Product Type\'s you want to filter exported Products by. Default is to include all Product Types except Variations.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options product-options">
				<p class="label"><?php _e( 'Stock status', 'woo_ce' ); ?></p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" name="product_filter_stock" value=""<?php checked( $product_filter_stock, false ); ?> /> <?php _e( 'Include both', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="product_filter_stock" value="instock"<?php checked( $product_filter_stock, 'instock' ); ?> /> <?php _e( 'In stock', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="product_filter_stock" value="outofstock"<?php checked( $product_filter_stock, 'outofstock' ); ?> /> <?php _e( 'Out of stock', 'woo_ce' ); ?></label></li>
				</ul>
				<p class="description"><?php _e( 'Select the Stock Status\'s you want to filter exported Products by. Default is to include all Stock Status\'s.', 'woo_ce' ); ?></p>
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Order date', 'woo_ce' ); ?></p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" name="order_dates_filter" value=""<?php checked( $order_filter_date, false ); ?> /><?php _e( 'All', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="today"<?php checked( $order_filter_date, 'today' ); ?> /><?php _e( 'Today', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="yesterday"<?php checked( $order_filter_date, 'yesterday' ); ?> /><?php _e( 'Yesterday', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="current_week"<?php checked( $order_filter_date, 'current_week' ); ?> /><?php _e( 'Current week', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="last_week"<?php checked( $order_filter_date, 'last_week' ); ?> /><?php _e( 'Last week', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="current_month"<?php checked( $order_filter_date, 'current_month' ); ?> /><?php _e( 'Current month', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="order_dates_filter" value="last_month"<?php checked( $order_filter_date, 'last_month' ); ?> /><?php _e( 'Last month', 'woo_ce' ); ?></label></li>
					<li>
						<label><input type="radio" name="order_dates_filter" value="variable"<?php checked( $order_filter_date, 'variable' ); ?> /><?php _e( 'Variable date', 'woo_ce' ); ?></label>
						<div style="margin-top:0.2em;">
							<?php _e( 'Last', 'woo_ce' ); ?>
							<input type="text" name="order_dates_filter_variable" class="text" size="4" value="<?php echo $order_filter_date_variable; ?>" />
							<select name="order_dates_filter_variable_length">
								<option value=""<?php selected( $order_filter_date_variable_length, '' ); ?>>&nbsp;</option>
								<option value="second"<?php selected( $order_filter_date_variable_length, 'second' ); ?>><?php _e( 'second(s)', 'woo_ce' ); ?></option>
								<option value="minute"<?php selected( $order_filter_date_variable_length, 'minute' ); ?>><?php _e( 'minute(s)', 'woo_ce' ); ?></option>
								<option value="hour"<?php selected( $order_filter_date_variable_length, 'hour' ); ?>><?php _e( 'hour(s)', 'woo_ce' ); ?></option>
								<option value="day"<?php selected( $order_filter_date_variable_length, 'day' ); ?>><?php _e( 'day(s)', 'woo_ce' ); ?></option>
								<option value="week"<?php selected( $order_filter_date_variable_length, 'week' ); ?>><?php _e( 'week(s)', 'woo_ce' ); ?></option>
								<option value="month"<?php selected( $order_filter_date_variable_length, 'month' ); ?>><?php _e( 'month(s)', 'woo_ce' ); ?></option>
								<option value="year"<?php selected( $order_filter_date_variable_length, 'year' ); ?>><?php _e( 'year(s)', 'woo_ce' ); ?></option>
							</select>
						</div>
					</li>
					<li>
						<label><input type="radio" name="order_dates_filter" value="manual"<?php checked( $order_filter_date, 'manual' ); ?> /><?php _e( 'Fixed date', 'woo_ce' ); ?></label>
						<div style="margin-top:0.2em;">
							<input type="text" name="order_dates_from" value="<?php echo $order_filter_dates_from; ?>" size="10" maxlength="10" class="text datepicker" /> to <input type="text" name="order_dates_to" value="<?php echo $order_filter_dates_to; ?>" size="10" maxlength="10" class="text datepicker" />
						</div>
					</li>
					<li>
						<label><input type="radio" name="order_dates_filter" value="last_export"<?php checked( $order_filter_date, 'last_export' ); ?> /> <?php _e( 'Since last export', 'woo_ce' ); ?></label>
						<p class="description"><?php _e( 'Export Orders which have not previously been included in an export. Decided by whether the <code>_woo_cd_exported</code> custom Post meta key has not been assigned to an Order.', 'woo_ce' ); ?></p>
					</li>
				</ul>
				<p class="description"><?php _e( 'Filter the dates of Orders to be included in the export. If manually selecting dates ensure the Fixed date radio field is checked, likewise for variable dates. Default is to include all Orders made in the date format <code>DD/MM/YYYY</code>.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Order status', 'woo_ce' ); ?></p>
<?php if( !empty( $order_statuses ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Order Status...', 'woo_ce' ); ?>" name="order_filter_status[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $order_statuses as $order_status ) { ?>
					<option value="<?php echo $order_status->slug; ?>"<?php selected( in_array( $order_status->slug, $order_filter_status ), true ); ?>><?php echo ucfirst( $order_status->name ); ?> (<?php echo $order_status->count; ?>)</option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Order Status were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Order Status you want to filter exported Orders by. Default is to include all Order Status options.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Product', 'woo_ce' ); ?></p>
<?php if( wp_script_is( 'wc-enhanced-select', 'enqueued' ) ) { ?>
			<p><input type="hidden" id="order_filter_product" name="order_filter_product[]" class="multiselect wc-product-search" data-multiple="true" style="width:95;" data-placeholder="<?php _e( 'Search for a Product&hellip;', 'woo_ce' ); ?>" data-action="woocommerce_json_search_products_and_variations" data-selected="
<?php
	$json_ids = array();
?>
<?php if( !empty( $order_filter_product ) ) { ?>
<?php
	foreach( $order_filter_product as $product_id ) {
		$product = wc_get_product( $product_id );
		if( is_object( $product ) ) {
			$json_ids[$product_id] = wp_kses_post( $product->get_formatted_name() );
		}
	}
	echo esc_attr( json_encode( $json_ids ) ); ?>
<?php } ?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /></p>
<?php } else { ?>
<?php
	$products = woo_ce_get_products();
	add_filter( 'the_title', 'woo_ce_get_product_title', 10, 2 );
?>
	<?php if( !empty( $products ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Product...', 'woo_ce' ); ?>" name="order_filter_product[]" multiple class="chzn-select" style="width:95%;">
		<?php foreach( $products as $product ) { ?>
					<option value="<?php echo $product; ?>"<?php selected( in_array( $product, $order_filter_product ), true ); ?>><?php echo get_the_title( $product ); ?></option>
		<?php } ?>
				</select>
	<?php } else { ?>
				<?php _e( 'No Products were found.', 'woo_ce' ); ?>
	<?php } ?>
<?php
	remove_filter( 'the_title', 'woo_ce_get_product_title' );
?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Products you want to filter exported Orders by. Default is to include all Products.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Billing country', 'woo_ce' ); ?></p>
<?php if( !empty( $countries ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Billing Country...', 'woo_ce' ); ?>" name="order_filter_billing_country[]" multiple class="chzn-select" style="width:95%;">
					<option value=""><?php _e( 'Show all Countries', 'woo_ce' ); ?></option>
	<?php foreach( $countries as $country_prefix => $country ) { ?>
					<option value="<?php echo $country_prefix; ?>"<?php selected( in_array( $country_prefix, $order_filter_billing_country ), true ); ?>><?php printf( '%s (%s)', $country, $country_prefix ); ?></option>
	<?php } ?>
				</select>
<?php } else { ?>
				<p><?php _e( 'No Countries were found.', 'woo_ce' ); ?></p>
<?php } ?>
				<p class="description"><?php _e( 'Filter Orders by Billing Country to be included in the export. Default is to include all Countries.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Shipping country', 'woo_ce' ); ?></p>
<?php if( !empty( $countries ) ) { ?>
				<select id="order_filter_shipping_country" data-placeholder="<?php _e( 'Choose a Shipping Country...', 'woo_ce' ); ?>" name="order_filter_shipping_country[]" multiple class="chzn-select" style="width:95%;">
					<option value=""><?php _e( 'Show all Countries', 'woo_ce' ); ?></option>
	<?php foreach( $countries as $country_prefix => $country ) { ?>
					<option value="<?php echo $country_prefix; ?>"<?php selected( in_array( $country_prefix, $order_filter_shipping_country ), true ); ?>><?php printf( '%s (%s)', $country, $country_prefix ); ?></option>
	<?php } ?>
				</select>
<?php } else { ?>
				<p><?php _e( 'No Countries were found.', 'woo_ce' ); ?></p>
<?php } ?>
				<p class="description"><?php _e( 'Filter Orders by Shipping Country to be included in the export. Default is to include all Countries.', 'woo_ce' ); ?></p>
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Payment gateway', 'woo_ce' ); ?></p>
<?php if( !empty( $payment_gateways ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Payment Gateway...', 'woo_ce' ); ?>" name="order_filter_payment[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $payment_gateways as $payment_gateway ) { ?>
					<option value="<?php echo $payment_gateway->id; ?>"<?php selected( in_array( $payment_gateway->id, $order_filter_payment ), true ); ?>><?php echo ucfirst( woo_ce_format_order_payment_gateway( $payment_gateway->id ) ); ?></option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Payment Gateways were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Payment Gateways you want to filter exported Orders by. Default is to include all Payment Gateways.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options order-options">
				<p class="label"><?php _e( 'Shipping method', 'woo_ce' ); ?></p>
<?php if( !empty( $shipping_methods ) ) { ?>
				<select data-placeholder="<?php _e( 'Choose a Shipping Method...', 'woo_ce' ); ?>" name="order_filter_shipping[]" multiple class="chzn-select" style="width:95%;">
	<?php foreach( $shipping_methods as $shipping_method ) { ?>
					<option value="<?php echo $shipping_method->id; ?>"<?php selected( in_array( $shipping_method->id, $order_filter_shipping ), true ); ?>><?php echo ucfirst( woo_ce_format_order_shipping_method( $shipping_method->id ) ); ?></option>
	<?php } ?>
				</select>
<?php } else { ?>
				<?php _e( 'No Shipping Methods were found.', 'woo_ce' ); ?>
<?php } ?>
				<p class="description"><?php _e( 'Select the Shipping Methods you want to filter exported Orders by. Default is to include all Shipping Methods.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li class="export-options category-options tag-options brand-options customer-options user-options coupon-options subscription-options product_vendor-options commission-options shipping_class-options">
				<p><?php _e( 'No export filter options are available for this export type.', 'woo_ce' ); ?></p>
			</li>

		</ul>
	</td>
</tr>

<tr>
	<th>
		<label><?php _e( 'Scheduling', 'woo_ce' ); ?></label>
	</th>
	<td>
		<p><?php _e( 'How often do you want the export to run?', 'woo_ce' ); ?></p>
		<ul>
			<li>
				<label><input type="radio" name="auto_schedule" value="custom"<?php checked( $auto_schedule, 'custom' ); ?> /> <?php _e( 'Once every ', 'woo_ce' ); ?></label>
				<input name="auto_interval" type="text" id="auto_interval" value="<?php echo esc_attr( $auto_interval ); ?>" size="6" maxlength="6" class="text" />
				<?php _e( 'minutes', 'woo_ce' ); ?>
			</li>
			<li><label><input type="radio" name="auto_schedule" value="daily"<?php checked( $auto_schedule, 'daily' ); ?> /> <?php _e( 'Daily', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="auto_schedule" value="weekly"<?php checked( $auto_schedule, 'weekly' ); ?> /> <?php _e( 'Weekly', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="auto_schedule" value="monthly"<?php checked( $auto_schedule, 'monthly' ); ?> /> <?php _e( 'Monthly', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="auto_schedule" value="one-time" /> <?php _e( 'One time', 'woo_ce' ); ?></label></li>
		</ul>
		<p class="description"><?php _e( 'Choose how often Store Exporter Deluxe generates new exports. Default is every 1440 minutes (once every 24 hours).', 'woo_ce' ); ?></p>
		<hr />
		<p><?php _e( 'When do you want scheduled exports to start?', 'woo_ce' ); ?></p>
		<ul>
			<li><label><input type="radio" name="auto_commence" value="now"<?php checked( $auto_commence, 'now' ); ?> /><?php _e( 'From now', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="auto_commence" value="future"<?php checked( $auto_commence, 'future' ); ?> /><?php _e( 'From the following', 'woo_ce' ); ?></label>: <input type="text" name="auto_commence_date" size="20" maxlength="20" class="text datetimepicker" value="<?php echo $auto_commence_date; ?>" /><!--, <?php _e( 'at this time', 'woo_ce' ); ?>: <input type="text" name="auto_interval_time" size="10" maxlength="10" class="text timepicker" />--></li>
		</ul>
	</td>
</tr>

<tr>
	<th>
		<label><?php _e( 'Export format', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" name="auto_format" value="csv"<?php checked( $auto_format, 'csv' ); ?> /> <?php _e( 'CSV', 'woo_ce' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woo_ce' ); ?></span></label></li>
			<li><label><input type="radio" name="auto_format" value="xml"<?php checked( $auto_format, 'xml' ); ?> /> <?php _e( 'XML', 'woo_ce' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woo_ce' ); ?></span></label></li>
			<li><label><input type="radio" name="auto_format" value="xls"<?php checked( $auto_format, 'xls' ); ?> /> <?php _e( 'Excel (XLS)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Excel 97-2003)', 'woo_ce' ); ?></span></label></li>
			<li><label><input type="radio" name="auto_format" value="xlsx"<?php checked( $auto_format, 'xlsx' ); ?> /> <?php _e( 'Excel (XLSX)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Excel 2007-2013)', 'woo_ce' ); ?></span></label></li>
		</ul>
		<p class="description"><?php _e( 'Adjust the export format to generate different export file formats. Default is CSV.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr>
	<th>
		<label for="auto_method"><?php _e( 'Export method', 'woo_ce' ); ?></label>
	</th>
	<td>
		<select id="auto_method" name="auto_method">
			<option value="archive"<?php selected( $auto_method, 'archive' ); ?>><?php _e( 'Archive to WordPress Media', 'woo_ce' ); ?></option>
			<option value="email"<?php selected( $auto_method, 'email' ); ?>><?php _e( 'Send as e-mail', 'woo_ce' ); ?></option>
			<option value="post"<?php selected( $auto_method, 'post' ); ?>><?php _e( 'POST to remote URL', 'woo_ce' ); ?></option>
			<option value="ftp"<?php selected( $auto_method, 'ftp' ); ?>><?php _e( 'Upload to remote FTP/SFTP', 'woo_ce' ); ?></option>
		</select>
		<p class="description"><?php _e( 'Choose what Store Exporter Deluxe does with the generated export. Default is to archive the export to the WordPress Media for archival purposes.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr class="auto_method_options">
	<th>
		<label><?php _e( 'Export method options', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul>

			<li class="export-options email-options">
				<p>
					<label for="email_to"><?php _e( 'Default e-mail recipient', 'woo_ce' ); ?></label><br />
					<input name="email_to" type="text" id="email_to" value="<?php echo esc_attr( $email_to ); ?>" class="large-text code" />
				</p>
				<p class="description"><?php _e( 'Set the default recipient of scheduled export e-mails, multiple recipients can be added using the <code><attr title="comma">,</attr></code> separator. This option can be overriden via CRON using the <code>to</code> argument.<br />Default is the Blog Administrator e-mail address set on the WordPress &raquo; Settings screen.', 'woo_ce' ); ?></p>

				<p>
					<label for="email_subject"><?php _e( 'Default e-mail subject', 'woo_ce' ); ?></label><br />
					<input name="email_subject" type="text" id="email_subject" value="<?php echo esc_attr( $email_subject ); ?>" class="large-text code" />
				</p>
				<p class="description"><?php _e( 'Set the default subject of scheduled export e-mails, can be overriden via CRON using the <code>subject</code> argument. Tags can be used: <code>%store_name%</code>, <code>%export_type%</code>, <code>%export_filename%</code>.', 'woo_ce' ); ?></p>
			</li>

			<li class="export-options post-options">
				<p>
					<label for="post_to"><?php _e( 'Default remote POST URL', 'woo_ce' ); ?></label><br />
					<input name="post_to" type="text" id="post_to" value="<?php echo esc_url( $post_to ); ?>" class="large-text code" />
				</p>
				<p class="description"><?php printf( __( 'Set the default remote POST address for scheduled exports, can be overriden via CRON using the <code>to</code> argument. Default is empty. See our <a href="%s" target="_blank">Usage</a> document for more information on Default remote POST URL.', 'woo_ce' ), $troubleshooting_url ); ?></p>
			</li>

			<li class="export-options ftp-options">
				<label for="ftp_method_host"><?php _e( 'Host', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_host" name="ftp_method_host" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_host ); ?>" />&nbsp;
				<label for="ftp_method_port" style="width:auto;"><?php _e( 'Port', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_port" name="ftp_method_port" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_port ); ?>" maxlength="5" /><br />
				<label for="ftp_method_protocol"><?php _e( 'Protocol', 'woo_ce' ); ?>:</label>
				<select name="ftp_method_protocol">
					<option value="ftp"<?php selected( $ftp_method_protocol, 'ftp' ); ?>><?php _e( 'FTP - File Transfer Protocol', 'woo_ce' ); ?></option>
					<option value="sftp"<?php selected( $ftp_method_protocol, 'sftp' ); ?><?php disabled( ( !function_exists( 'ssh2_connect' ) ? true : false ), true ); ?>><?php _e( 'SFTP - SSH File Transfer Protocol', 'woo_ce' ); ?></option>
				</select><br />
				<label for="ftp_method_user"><?php _e( 'Username', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_user" name="ftp_method_user" size="15" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_user ); ?>" /><br />
				<label for="ftp_method_pass"><?php _e( 'Password', 'woo_ce' ); ?>:</label> <input type="password" id="ftp_method_pass" name="ftp_method_pass" size="15" class="regular-text code" value="" /><?php if( !empty( $ftp_method_pass ) ) { echo ' ' . __( '(password is saved, fill this field to change it)', 'woo_ce' ); } ?><br />
				<label for="ftp_method_file_path"><?php _e( 'File path', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_file_path" name="ftp_method_path" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_path ); ?>" /><br />
				<label for="ftp_method_filename"><?php _e( 'Fixed filename', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_filename" name="ftp_method_filename" size="25" class="regular-text code" value="<?php echo sanitize_text_field( $ftp_method_filename ); ?>" /><br />
				<label for="ftp_method_passive"><?php _e( 'Transfer mode', 'woo_ce' ); ?>:</label> 
				<select id="ftp_method_passive" name="ftp_method_passive">
					<option value="auto"<?php selected( $ftp_method_passive, '' ); ?>><?php _e( 'Auto', 'woo_ce' ); ?></option>
					<option value="active"<?php selected( $ftp_method_passive, 'active' ); ?>><?php _e( 'Active', 'woo_ce' ); ?></option>
					<option value="passive"<?php selected( $ftp_method_passive, 'passive' ); ?>><?php _e( 'Passive', 'woo_ce' ); ?></option>
				</select><br />
				<label for="ftp_method_timeout"><?php _e( 'Timeout', 'woo_ce' ); ?>:</label> <input type="text" id="ftp_method_timeout" name="ftp_method_timeout" size="5" class="short-text code" value="<?php echo sanitize_text_field( $ftp_method_timeout ); ?>" /><br />
				<p class="description">
					<?php _e( 'Enter the FTP host (minus <code>ftp://</code>), login details and path of where to save the export file, do not provide the filename within File path. For file path example: <code>wp-content/uploads/exports/</code><br />The export filename can be set within the Fixed filename field otherwise it defaults to the Export filename provided within General Settings above. Tags can be used: ', 'woo_ce' ); ?> <code>%dataset%</code>, <code>%date%</code>, <code>%time%</code>, <code>%store_name%</code>.
<?php if( !function_exists( 'ssh2_connect' ) ) { ?>
					<br /><?php _e( 'The SFTP - SSH File Transfer Protocol option is not available as the required function ssh2_connect() is disabled within your WordPress site.', 'woo_ce' ); ?></p>
<?php } ?>
				</p>
			</li>

			<li class="export-options archive-options">
				<p><?php _e( 'No export method options are available for this export method.', 'woo_ce' ); ?></p>
			</li>

		</ul>
	</td>
</tr>
<tr>
	<th>
		<label for="scheduled_fields"><?php _e( 'Export fields', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" id="scheduled_fields" name="scheduled_fields" value="all"<?php checked( $scheduled_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="scheduled_fields" value="saved"<?php checked( $scheduled_fields, 'saved' ); ?> /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woo_ce' ); ?></label></li>
		</ul>
		<p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr id="cron-exports">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-clock"></div>&nbsp;<?php _e( 'CRON Exports', 'woo_ce' ); ?></h3>
<?php if( $enable_cron == 1 ) { ?>
		<p style="font-size:0.8em;"><div class="dashicons dashicons-yes"></div>&nbsp;<strong><?php _e( 'CRON Exports is enabled', 'woo_ce' ); ?></strong></p>
<?php } ?>
		<p class="description"><?php printf( __( 'Store Exporter Deluxe supports exporting via a command line request, to do this you need to prepare a specific URL and pass it the following required inline parameters. For sample CRON requests and supported arguments consult our <a href="%s" target="_blank">online documentation</a>.', 'woo_ce' ), $troubleshooting_url ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="enable_cron"><?php _e( 'Enable CRON', 'woo_ce' ); ?></label>
	</th>
	<td>
		<select id="enable_cron" name="enable_cron">
			<option value="1"<?php selected( $enable_cron, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
			<option value="0"<?php selected( $enable_cron, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
		</select>
		<p class="description"><?php _e( 'Enabling CRON allows developers to schedule automated exports and connect with Store Exporter Deluxe remotely.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="secret_key"><?php _e( 'Export secret key', 'woo_ce' ); ?></label>
	</th>
	<td>
		<input name="secret_key" type="text" id="secret_key" value="<?php echo esc_attr( $secret_key ); ?>" class="large-text code" />
		<p class="description"><?php _e( 'This secret key (can be left empty to allow unrestricted access) limits access to authorised developers who provide a matching key when working with Store Exporter Deluxe.', 'woo_ce' ); ?></p>
	</td>
</tr>
<tr>
	<th>
		<label for="cron_fields"><?php _e( 'Export fields', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul style="margin-top:0.2em;">
			<li><label><input type="radio" id="cron_fields" name="cron_fields" value="all"<?php checked( $cron_fields, 'all' ); ?> /> <?php _e( 'Include all Export Fields for the requested Export Type', 'woo_ce' ); ?></label></li>
			<li><label><input type="radio" name="cron_fields" value="saved"<?php checked( $cron_fields, 'saved' ); ?> /> <?php _e( 'Use the saved Export Fields preference set on the Export screen for the requested Export Type', 'woo_ce' ); ?></label></li>
		</ul>
		<p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for each Export Type. Default is to include all export fields.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr id="orders-screen">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'Orders Screen', 'woo_ce' ); ?></h3>
	</td>
</tr>
<tr>
	<th>
		<label><?php _e( 'Actions display', 'woo_ce' ); ?></label>
	</th>
	<td>
		<ul>
			<li><label><input type="checkbox" name="order_actions_csv" value="1"<?php checked( $order_actions_csv ); ?> /> <?php _e( 'Export to CSV', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="order_actions_xml" value="1"<?php checked( $order_actions_xml ); ?> /> <?php _e( 'Export to XML', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="order_actions_xls" value="1"<?php checked( $order_actions_xls ); ?> /> <?php _e( 'Export to XLS', 'woo_ce' ); ?></label></li>
			<li><label><input type="checkbox" name="order_actions_xlsx" value="1"<?php checked( $order_actions_xlsx ); ?> /> <?php _e( 'Export to XLSX', 'woo_ce' ); ?></label></li>
		</ul>
		<p class="description"><?php _e( 'Control the visibility of different Order actions on the WooCommerce &raquo; Orders screen.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr id="export-triggers">
	<td colspan="2" style="padding:0;">
		<hr />
		<h3><div class="dashicons dashicons-admin-settings"></div>&nbsp;<?php _e( 'Export Triggers', 'woo_ce' ); ?></h3>
		<p class="description"><?php _e( 'Configure Store Exporter Deluxe to run exports on specific triggers within your WooCommerce store.', 'woo_ce' ); ?></p>
	</td>
</tr>

<tr>
	<th>
		<label><?php _e( 'New Order', 'woo_ce' ); ?></label>
	</th>
	<td>
<?php if( $enable_trigger_new_order == 1 ) { ?>
		<p style="font-size:0.8em;"><div class="dashicons dashicons-yes"></div>&nbsp;<strong><?php _e( 'Export on New Order is enabled, this will run for each new Order received.', 'woo_ce' ); ?></strong></p>
<?php } ?>
		<p class="description"><?php _e( 'Trigger an export of each new Order that is generated after successful Checkout.', 'woo_ce' ); ?></p>
		<ul>

			<li>
				<p>
					<label for="enable_trigger_new_order"><?php _e( 'Enable trigger', 'woo_ce' ); ?></label><br />
					<select id="enable_trigger_new_order" name="enable_trigger_new_order">
						<option value="1"<?php selected( $enable_trigger_new_order, 1 ); ?>><?php _e( 'Yes', 'woo_ce' ); ?></option>
						<option value="0"<?php selected( $enable_trigger_new_order, 0 ); ?>><?php _e( 'No', 'woo_ce' ); ?></option>
					</select>
				</p>
				<hr />
			</li>

			<li>
				<p><label><?php _e( 'Export format', 'woo_ce' ); ?></label></p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" name="trigger_new_order_format" value="csv"<?php checked( $trigger_new_order_format, 'csv' ); ?> /> <?php _e( 'CSV', 'woo_ce' ); ?> <span class="description"><?php _e( '(Comma Separated Values)', 'woo_ce' ); ?></span></label></li>
					<li><label><input type="radio" name="trigger_new_order_format" value="xml"<?php checked( $trigger_new_order_format, 'xml' ); ?> /> <?php _e( 'XML', 'woo_ce' ); ?> <span class="description"><?php _e( '(EXtensible Markup Language)', 'woo_ce' ); ?></span></label></li>
					<li><label><input type="radio" name="trigger_new_order_format" value="xls"<?php checked( $trigger_new_order_format, 'xls' ); ?> /> <?php _e( 'Excel (XLS)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Excel 97-2003)', 'woo_ce' ); ?></span></label></li>
					<li><label><input type="radio" name="trigger_new_order_format" value="xlsx"<?php checked( $trigger_new_order_format, 'xlsx' ); ?> /> <?php _e( 'Excel (XLSX)', 'woo_ce' ); ?> <span class="description"><?php _e( '(Excel 2007-2013)', 'woo_ce' ); ?></span></label></li>
				</ul>
				<hr />
			</li>

			<li>
				<p><label><?php _e( 'Export method', 'woo_ce' ); ?></label></p>
				<select id="trigger_new_order_method" name="trigger_new_order_method">
					<option value="archive"<?php selected( $trigger_new_order_method, 'archive' ); ?>><?php _e( 'Archive to WordPress Media', 'woo_ce' ); ?></option>
<!--
					<option value="email"<?php selected( $trigger_new_order_method, 'email' ); ?>><?php _e( 'Send as e-mail', 'woo_ce' ); ?></option>
					<option value="post"<?php selected( $trigger_new_order_method, 'post' ); ?>><?php _e( 'POST to remote URL', 'woo_ce' ); ?></option>
					<option value="ftp"<?php selected( $trigger_new_order_method, 'ftp' ); ?>><?php _e( 'Upload to remote FTP/SFTP', 'woo_ce' ); ?></option>
-->
				</select>
				<hr />
			</li>

			<li>
				<p><label><?php _e( 'Export method options', 'woo_ce' ); ?></label></p>
				<p><?php _e( 'No export method options are available for this export method.', 'woo_ce' ); ?></p>
				<hr />
			</li>

			<li>
				<p><label><?php _e( 'Export fields', 'woo_ce' ); ?></label></p>
				<ul style="margin-top:0.2em;">
					<li><label><input type="radio" id="trigger_new_order_fields" name="trigger_new_order_fields" value="all"<?php checked( $trigger_new_order_fields, 'all' ); ?> /> <?php _e( 'Include all Order Fields', 'woo_ce' ); ?></label></li>
					<li><label><input type="radio" name="trigger_new_order_fields" value="saved"<?php checked( $trigger_new_order_fields, 'saved' ); ?> /> <?php _e( 'Use the saved Export Fields preference for Orders set on the Export screen', 'woo_ce' ); ?></label></li>
				</ul>
				<p class="description"><?php _e( 'Control whether all known export fields are included or only checked fields from the Export Fields section on the Export screen for Orders. Default is to include all export fields.', 'woo_ce' ); ?></p>
			</li>

		</ul>
	</td>
</tr>

<?php
	ob_end_flush();

}
Beispiel #7
0
 function woo_ce_tab_template($tab = '')
 {
     global $woo_ce;
     if (!$tab) {
         $tab = 'overview';
     }
     /* Store Exporter Deluxe */
     $woo_cd_exists = false;
     if (!function_exists('woo_cd_admin_init')) {
         $woo_cd_url = 'http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/';
         $woo_cd_link = sprintf('<a href="%s" target="_blank">' . __('Store Exporter Deluxe', 'woo_ce') . '</a>', $woo_cd_url);
     } else {
         $woo_cd_exists = true;
     }
     $troubleshooting_url = 'http://www.visser.com.au/documentation/store-exporter-deluxe/';
     switch ($tab) {
         case 'export':
             $dataset = 'products';
             if (isset($_POST['dataset'])) {
                 $dataset = $_POST['dataset'];
             }
             $products = woo_ce_return_count('products');
             $categories = woo_ce_return_count('categories');
             $tags = woo_ce_return_count('tags');
             $orders = woo_ce_return_count('orders');
             $coupons = woo_ce_return_count('coupons');
             $customers = woo_ce_return_count('customers');
             $product_fields = woo_ce_get_product_fields();
             if ($product_fields) {
                 foreach ($product_fields as $key => $product_field) {
                     if (!isset($product_fields[$key]['disabled'])) {
                         $product_fields[$key]['disabled'] = 0;
                     }
                 }
                 $product_categories = woo_ce_get_product_categories();
                 $product_tags = woo_ce_get_product_tags();
                 $product_statuses = get_post_statuses();
                 $product_statuses['trash'] = __('Trash', 'woo_ce');
                 $product_types = woo_ce_get_product_types();
             }
             $order_fields = woo_ce_get_order_fields();
             $customer_fields = woo_ce_get_customer_fields();
             $coupon_fields = woo_ce_get_coupon_fields();
             $delimiter = woo_ce_get_option('delimiter', ',');
             $category_separator = woo_ce_get_option('category_separator', '|');
             $bom = woo_ce_get_option('bom', 1);
             $escape_formatting = woo_ce_get_option('escape_formatting', 'all');
             $limit_volume = woo_ce_get_option('limit_volume');
             $offset = woo_ce_get_option('offset');
             $timeout = woo_ce_get_option('timeout', 0);
             $delete_csv = woo_ce_get_option('delete_csv', 0);
             $file_encodings = mb_list_encodings();
             break;
         case 'tools':
             /* Product Importer Deluxe */
             if (function_exists('woo_pd_init')) {
                 $woo_pd_url = add_query_arg('page', 'woo_pd');
                 $woo_pd_target = false;
             } else {
                 $woo_pd_url = 'http://www.visser.com.au/woocommerce/plugins/product-importer-deluxe/';
                 $woo_pd_target = ' target="_blank"';
             }
             break;
         case 'archive':
             $files = woo_ce_get_archive_files();
             if ($files) {
                 foreach ($files as $key => $file) {
                     $files[$key] = woo_ce_get_archive_file($file);
                 }
             }
             break;
     }
     if ($tab) {
         include_once $woo_ce['abspath'] . '/templates/admin/woo-admin_ce-export_' . $tab . '.php';
     }
 }