コード例 #1
0
ファイル: manage.php プロジェクト: GarryVeles/Artibaltika
 /**
  * Bulk actions
  */
 public function bulk()
 {
     check_admin_referer('bulk-exports', '_wpnonce_bulk-exports');
     if ($this->input->post('doaction2')) {
         $this->data['action'] = $action = $this->input->post('bulk-action2');
     } else {
         $this->data['action'] = $action = $this->input->post('bulk-action');
     }
     $this->data['ids'] = $ids = $this->input->post('items');
     $this->data['items'] = $items = new PMXE_Export_List();
     if (empty($action) or !in_array($action, array('delete')) or empty($ids) or $items->getBy('id', $ids)->isEmpty()) {
         wp_redirect($this->baseUrl);
         die;
     }
     if ($this->input->post('is_confirmed')) {
         foreach ($items->convertRecords() as $item) {
             if ($item->attch_id) {
                 wp_delete_attachment($item->attch_id, true);
             }
             $item->delete();
         }
         wp_redirect(add_query_arg('pmxe_nt', urlencode(sprintf(__('%d %s deleted', 'pmxe_plugin'), $items->count(), _n('export', 'exports', $items->count(), 'pmxe_plugin'))), $this->baseUrl));
         die;
     }
     $this->render();
 }
コード例 #2
0
ファイル: record.php プロジェクト: soflyy/wp-all-export
 /**
  * Delete associated sub exports
  * @return PMXE_Export_Record
  * @chainable
  */
 public function deleteChildren()
 {
     $exportList = new PMXE_Export_List();
     foreach ($exportList->getBy('parent_id', $this->id)->convertRecords() as $i) {
         $i->delete();
     }
     return $this;
 }
コード例 #3
0
 public static function prepare_child_exports($export, $is_cron = false)
 {
     $queue_exports = array();
     $exportList = new PMXE_Export_List();
     global $wpdb;
     $table_prefix = $wpdb->prefix;
     $pmxe_prefix = PMXE_Plugin::getInstance()->getTablePrefix();
     $in_orders = $wpdb->prepare("SELECT DISTINCT post_id FROM {$pmxe_prefix}posts WHERE export_id = %d AND iteration = %d", $export->id, $export->iteration - 1);
     foreach ($exportList->getBy('parent_id', $export->id)->convertRecords() as $child_export) {
         $whereClause = "";
         switch ($child_export->export_post_type) {
             case 'product':
                 if ($export->options['order_include_poducts']) {
                     $queue_exports[] = $child_export->id;
                     if (!$export->options['order_include_all_poducts']) {
                         $in_products = $wpdb->prepare("SELECT order_item_meta.meta_value as product_id FROM {$table_prefix}posts as posts INNER JOIN {$pmxe_prefix}posts AS order_export ON posts.ID = post_id INNER JOIN {$table_prefix}woocommerce_order_items AS order_items ON posts.ID = order_id INNER JOIN {$table_prefix}woocommerce_order_itemmeta AS order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id WHERE order_export.export_id = %d AND order_export.iteration = %d AND order_items.order_item_type = 'line_item' AND order_item_meta.meta_key = '_product_id' GROUP BY product_id", $export->id, $export->iteration - 1);
                         $whereClause = " AND ({$table_prefix}posts.ID IN (" . $in_products . ") OR {$table_prefix}posts.post_parent IN (" . $in_products . "))";
                     }
                 }
                 break;
             case 'shop_coupon':
                 if ($export->options['order_include_coupons']) {
                     $queue_exports[] = $child_export->id;
                     if (!$export->options['order_include_all_coupons']) {
                         $whereClause = " AND {$table_prefix}posts.post_title IN (" . $wpdb->prepare("SELECT order_item_name FROM {$table_prefix}woocommerce_order_items \n\t\t\t\t\t\tWHERE {$table_prefix}woocommerce_order_items.order_item_type = %s AND {$table_prefix}woocommerce_order_items.order_id IN (" . $in_orders . ") GROUP BY order_item_name", 'coupon') . ")";
                     }
                 }
                 break;
             case 'shop_customer':
                 if ($export->options['order_include_customers']) {
                     $queue_exports[] = $child_export->id;
                     if (!$export->options['order_include_all_customers']) {
                         $whereClause = " AND {$table_prefix}users.ID IN (" . $wpdb->prepare("SELECT meta_value FROM {$table_prefix}postmeta WHERE meta_key = %s AND post_id IN (" . $in_orders . ") GROUP BY meta_value", "_customer_user") . ")";
                     }
                 }
                 break;
             default:
                 # code...
                 break;
         }
         $child_export_options = $child_export->options;
         $child_export_options['whereclause'] = $whereClause;
         $child_export->set(array('triggered' => $is_cron ? 1 : 0, 'processing' => 0, 'exported' => 0, 'executing' => $is_cron ? 0 : 1, 'canceled' => 0, 'options' => $child_export_options))->save();
     }
     return $queue_exports;
 }
コード例 #4
0
ファイル: process.php プロジェクト: soflyy/wp-all-export
_e('Time Elapsed', 'wp_all_export_plugin');
?>
 <span id="then">00:00:00</span></span>
					<span class="center_progress"><span class="percents_count">0</span>%</span>
					<span class="right_progress"><?php 
_e('Exported', 'wp_all_export_plugin');
?>
 <span class="created_count"><?php 
echo $update_previous->exported;
?>
</span></span>				
				</div>			
			</div>
			<?php 
if (XmlExportWooCommerceOrder::$is_active && $update_previous->options['export_type'] == 'specific') {
    $exportList = new PMXE_Export_List();
    foreach ($exportList->getBy('parent_id', $update_previous->id)->convertRecords() as $child_export) {
        $is_render_child_progress = true;
        switch ($child_export->export_post_type) {
            case 'product':
                if (!$update_previous->options['order_include_poducts']) {
                    $is_render_child_progress = false;
                }
                break;
            case 'shop_coupon':
                if (!$update_previous->options['order_include_coupons']) {
                    $is_render_child_progress = false;
                }
                break;
            case 'shop_customer':
                if (!$update_previous->options['order_include_customers']) {