Plugin Directory

Changeset 2745695

Timestamp:
06/21/2022 07:34:33 AM (2 years ago)
Author:
wpessential
Message:

2.0.1


WooCommerce compatibility and WordPress compatibility

Location:
woo-order-export
Files:
48 added
4 edited

Legend:

Unmodified
Added
Removed
  • woo-order-export/trunk/class-woo-order-export.php

    r2081193 r2745695  
    11<?php
    22
    3 class Woo_Order_Export {
    4     public function __construct() {
    5         add_action( 'admin_menu', array( $this, 'add_page_link' ) );
    6         add_action( 'wp_ajax_order_file_download', array( $this, 'order_file_download' ) );
    7         add_action( 'wp_ajax_nopriv_order_file_download', array( $this, 'order_file_download' ) );
    8         add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) );
    9 
    10     }
    11 
    12     public function add_page_link() {
    13         $page = add_submenu_page( 'woocommerce', esc_html__( 'Orders Export', 'woo-order-export' ), esc_html__( 'Orders Export', 'woo-order-export' ), 'edit_posts', 'order_exports', array(
     3class Woo_Order_Export
     4{
     5    public function __construct ()
     6    {
     7        add_action( 'admin_menu', [ $this, 'add_page_link' ] );
     8        add_action( 'wp_ajax_order_file_download', [ $this, 'order_file_download' ] );
     9        add_action( 'wp_ajax_nopriv_order_file_download', [ $this, 'order_file_download' ] );
     10        add_action( 'admin_print_scripts', [ $this, 'enqueue_scripts' ] );
     11
     12    }
     13
     14    public function add_page_link ()
     15    {
     16        $page = add_submenu_page( 'woocommerce', esc_html__( 'Orders Export', 'woo-order-export' ), esc_html__( 'Orders Export', 'woo-order-export' ), 'edit_posts', 'order_exports', [
    1417            $this,
    1518            'add_form'
    16         ) );
    17     }
    18 
    19     public function add_form() {
     19        ] );
     20    }
     21
     22    public function add_form ()
     23    {
    2024        ?>
    2125        <div class="container">
     
    2428                <div class="row">
    2529                    <div class="col-25">
    26                         <label for="fdate"><?php esc_html_e( 'Start Date', 'woo-order-export' ) ?>:</label>
     30                        <label for="fdate"><?php esc_html_e( 'Start Date', 'woo-order-export' ) ?>:</label>
    2731                    </div>
    2832                    <div class="col-75">
     
    3236                <div class="row">
    3337                    <div class="col-25">
    34                         <label for="tdate"><?php esc_html_e( 'End Date', 'woo-order-export' ) ?>:</label>
     38                        <label for="tdate"><?php esc_html_e( 'End Date', 'woo-order-export' ) ?>:</label>
    3539                    </div>
    3640                    <div class="col-75">
     
    4044                <div class="row">
    4145                    <div class="col-25">
    42                         <label for="country"><?php esc_html_e( 'Order Status', 'woo-order-export' ) ?>:</label>
     46                        <label for=""><?php esc_html_e( 'Order Status', 'woo-order-export' ) ?>:</label>
    4347                    </div>
    4448                    <div class="col-75">
     
    6367    }
    6468
    65     public function get_order_ids( $data_q = array() ) {
     69    public function get_order_ids ( $data_q = [] )
     70    {
    6671        $ids       = [];
    6772        $args      = [ 'date_created' => $data_q[ 0 ] . '...' . $data_q[ 1 ], 'status' => $data_q[ 2 ] ];
     
    7681    }
    7782
    78     public function get_orders_detail( $ids ) {
     83    public function get_orders_detail ( $ids )
     84    {
    7985        $data_array = [];
    8086        if ( ! empty( $ids ) ) {
     
    8894                }
    8995                $oder_date    = $order->get_date_created();
    90                 $data_array[] = array(
     96                $data_array[] =
    9197                    'order_id'            => $order->get_id(),
    9298                    'date'                => $oder_date->date( 'm/d/Y' ),
     
    118124                    'currency'            => html_entity_decode( $order->get_currency() ),
    119125                    'total_price'         => $order->get_total(),
    120                 );
     126                ;
    121127            }
    122128        }
     
    125131    }
    126132
    127     public function order_file_download() {
     133    public function order_file_download ()
     134    {
    128135        check_ajax_referer( 'order_file_download', 'export_orders_ref' );
    129136        $from_data    = sanitize_text_field( $_POST[ 'from_date' ] );
     
    132139        if ( empty( $from_data ) && empty( $to_date ) && empty( $order_status ) ) {
    133140            exit( esc_html__( 'Data is not verified...', 'woo-order-export' ) );
    134         } else {
    135             $ids    = $this->get_order_ids( [ $from_data, $to_date, $order_status ] );
    136             $orders = $this->get_orders_detail( $ids );
    137             if ( empty( $orders ) ) {
    138                 return;
    139             } else {
    140                 $url = $this->get_csv( $orders );
    141                 exit( $url );
    142             }
    143         }
    144 
    145     }
    146 
    147     public function get_csv( $report_data ) {
     141        }
     142
     143        $ids    = $this->get_order_ids( [ $from_data, $to_date, $order_status ] );
     144        $orders = $this->get_orders_detail( $ids );
     145        if ( empty( $orders ) ) {
     146            return;
     147        }
     148
     149        $url = $this->get_csv( $orders );
     150        exit( $url );
     151
     152    }
     153
     154    public function get_csv ( $report_data )
     155    {
    148156        $csv_file_name = 'order-report-' . time() . '.csv';
    149157        $dir           = wp_get_upload_dir()[ 'basedir' ] . '/woo-roder-export';
     
    171179    }
    172180
    173     public function enqueue_scripts() {
     181    public function enqueue_scripts ()
     182    {
    174183        $screen = get_current_screen();
    175184        if ( strpos( $screen->id, 'woocommerce_page_order_exports' ) === false ) {
  • woo-order-export/trunk/includes/front-end/classes/class-woo-order-export.php

    r2171144 r2745695  
    11<?php
    22
    3 class Woo_Order_Export {
    4     public function __construct() {
    5         add_action( 'admin_menu', array( $this, 'woe_add_page_link' ) );
    6         add_action( 'wp_ajax_woe_order_file_download', array( $this, 'woe_order_file_download' ) );
    7         add_action( 'wp_ajax_nopriv_woe_order_file_download', array( $this, 'woe_order_file_download' ) );
     3class Woo_Order_Export
     4{
     5    public function __construct ()
     6    {
     7        add_action( 'admin_menu', [ $this, 'woe_add_page_link' ] );
     8        add_action( 'wp_ajax_woe_order_file_download', [ $this, 'woe_order_file_download' ] );
     9        add_action( 'wp_ajax_nopriv_woe_order_file_download', [ $this, 'woe_order_file_download' ] );
    810        //add_action( 'admin_print_scripts', array( $this, 'woe_enqueue_scripts' ) );
    911
    1012    }
    1113
    12     public function woe_add_page_link() {
    13         $page = add_submenu_page( 'woocommerce', esc_html__( 'Orders Export', 'woo-order-export' ), esc_html__( 'Orders Export', 'woo-order-export' ), 'edit_posts', 'order_exports', array(
     14    public function woe_add_page_link ()
     15    {
     16        $page = add_submenu_page( 'woocommerce', esc_html__( 'Orders Export', 'woo-order-export' ), esc_html__( 'Orders Export', 'woo-order-export' ), 'edit_posts', 'order_exports', [
    1417            $this,
    1518            'woe_add_form',
    16         ) );
    17         add_action( "admin_print_scripts-$page", array( $this, 'woe_enqueue_scripts' )  );
    18     }
    19 
    20     public function woe_add_form() {
     19        ] );
     20        add_action( "admin_print_scripts-$page", [ $this, 'woe_enqueue_scripts' ] );
     21    }
     22
     23    public function woe_add_form ()
     24    {
    2125        ?>
    2226        <div class="container">
     
    99103    }
    100104
    101     public function woe_get_order_ids( $data_q = array() ) {
     105    public function woe_get_order_ids ( $data_q = [] )
     106    {
    102107        $ids  = [];
    103108        $args = [
    104             'date_created' => $data_q[0] . '...' . $data_q[1],
    105             'status'       => $data_q[2],
    106             'order'        => $data_q[3],
    107             'orderby'      => $data_q[4],
     109            'date_created' => $data_q[],
     110            'status'       => $data_q[],
     111            'order'        => $data_q[],
     112            'orderby'      => $data_q[],
    108113        ];
    109         if ( ! empty( $data_q[5] ) ) {
    110             $args['customer'] = $data_q[5];
     114        if ( ! empty( $data_q[] ) ) {
     115            $args[];
    111116        }
    112117        $order_get = wc_get_orders( $args );
     
    120125    }
    121126
    122     public function woe_get_orders_detail( $ids ) {
     127    public function woe_get_orders_detail ( $ids )
     128    {
    123129        $data_array = [];
    124130        if ( ! empty( $ids ) ) {
     
    132138                }
    133139                $oder_date    = $order->get_date_created();
    134                 $data_array[] = array(
     140                $data_array[] =
    135141                    'order_id'            => $order->get_id(),
    136142                    'date'                => $oder_date->date( 'm/d/Y' ),
     
    162168                    'currency'            => html_entity_decode( $order->get_currency() ),
    163169                    'total_price'         => $order->get_total(),
    164                 );
     170                ;
    165171            }
    166172        }
     
    169175    }
    170176
    171     public function woe_order_file_download() {
     177    public function woe_order_file_download ()
     178    {
    172179        check_ajax_referer( 'woe_order_file_download', 'export_orders_ref' );
    173         $from_data    = sanitize_text_field( $_POST['from_date'] );
    174         $to_date      = sanitize_text_field( $_POST['to_date'] );
    175         $order_status = sanitize_text_field( $_POST['order_status'] );
    176         $order        = sanitize_text_field( $_POST['order'] );
    177         $orderby      = sanitize_text_field( $_POST['orderby'] );
    178         $email        = sanitize_text_field( $_POST['custom_address'] );
     180        $from_data    = sanitize_text_field( $_POST[] );
     181        $to_date      = sanitize_text_field( $_POST[] );
     182        $order_status = sanitize_text_field( $_POST[] );
     183        $order        = sanitize_text_field( $_POST[] );
     184        $orderby      = sanitize_text_field( $_POST[] );
     185        $email        = sanitize_text_field( $_POST[] );
    179186        if ( empty( $from_data ) && empty( $to_date ) && empty( $order_status ) ) {
    180187            exit( esc_html__( 'Data is not verified...', 'woo-order-export' ) );
     
    192199    }
    193200
    194     public function woe_get_csv( $report_data ) {
     201    public function woe_get_csv ( $report_data )
     202    {
    195203        $csv_file_name = 'order-report-' . time() . '.csv';
    196         $dir           = wp_get_upload_dir()['basedir'] . '/woo-roder-export';
     204        $dir           = wp_get_upload_dir()[] . '/woo-roder-export';
    197205        $file_dir_set  = $dir . '/' . $csv_file_name;
    198206        $fop           = @fopen( $file_dir_set, 'w' );
     
    211219        fclose( $fop );
    212220
    213         if ( ! file_exists( wp_get_upload_dir()['basedir'] . '/woo-roder-export/' . $csv_file_name ) ) {
     221        if ( ! file_exists( wp_get_upload_dir()[] . '/woo-roder-export/' . $csv_file_name ) ) {
    214222            return;
    215223        }
    216224
    217         return wp_get_upload_dir()['baseurl'] . '/woo-roder-export/' . $csv_file_name;
    218     }
    219 
    220     public function woe_enqueue_scripts() {
    221 
    222         wp_enqueue_style( 'jquery-ui-datepicker-css', WOE_PLUGIN_FILE . 'assets/css/jquery-ui.min.css', '', WOE_PLUGIN_DETAIL['Version'], 'all' );
    223         wp_enqueue_style( 'woo-order-export', WOE_PLUGIN_FILE . 'assets/css/woo-order-export.css', '', WOE_PLUGIN_DETAIL['Version'], 'all' );
     225        return wp_get_upload_dir()[ 'baseurl' ] . '/woo-roder-export/' . $csv_file_name;
     226    }
     227
     228    public function woe_enqueue_scripts ()
     229    {
     230
     231        wp_enqueue_style( 'jquery-ui-datepicker-css', WOE_PLUGIN_FILE . 'assets/css/jquery-ui.min.css', '', WOE_PLUGIN_DETAIL[ 'Version' ], 'all' );
     232        wp_enqueue_style( 'woo-order-export', WOE_PLUGIN_FILE . 'assets/css/woo-order-export.css', '', WOE_PLUGIN_DETAIL[ 'Version' ], 'all' );
    224233
    225234        $script = 'jQuery(document).ready(function($){
     
    236245    }
    237246}
     247
     248
  • woo-order-export/trunk/index.php

    r2171144 r2745695  
    22/**
    33 * Plugin Name: Woo Order Export
    4  * Plugin URI: https://demo.themecat.org/woo-order-export
    5  * Description: Woo Order Export is used to export the WooCommerce orders with all details. It has the option to export the order from a selectable date range and order status base.
    6  * Version: 2.0
    7  * Author: Themecat_Info
    8  * Author URI: https://themecat.org/
     4 * Plugin URI: https://
     5 * Description: Woo Order Export used to export the WooCommerce orders with all details. It has the option to export the order from a selectable date range and order status base.
     6 * Version: 2.0
     7 * Author:
     8 * Author URI: https://.org/
    99 * Text Domain: woo-order-export
    1010 * Requires at least: 4.5
    11  * Tested up to: 5.2
     11 * Tested up to:
    1212 * License: GPLv2 or later
    1313 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1414 * Domain Path: /languages/
    1515 * WC requires at least: 3.0.0
    16  * WC tested up to: 3.6
     16 * WC tested up to:
    1717 */
    1818
     
    2323/**
    2424 * Define the plugin directory url in http:// or https:// base
     25
    2526 * @since 1.0.0
    2627 */
     
    3132/**
    3233 * Define the plugin directory path
     34
    3335 * @since 1.0.0
    3436 */
     
    3941/**
    4042 * Define the plugin data info
     43
    4144 * @since 1.0.0
    4245 */
     
    5053/**
    5154 * The notification html
     55
     56
    5257 * @since 1.0.0
    53  * @return string return the html of notifaction.
    5458 */
    5559if ( ! function_exists( 'woo_order_export_swatches_wc_notice' ) ) {
    56     function woo_order_export_swatches_wc_notice() {
     60    function woo_order_export_swatches_wc_notice ()
     61    {
    5762        ?>
    5863        <div class="error">
     
    6570/**
    6671 * Hook the notification
     72
     73
    6774 * @since 1.0.0
    68  * @return void.
    6975 */
    7076if ( ! function_exists( 'woo_order_export_swatches_constructor' ) ) {
    71     function woo_order_export_swatches_constructor() {
     77    function woo_order_export_swatches_constructor ()
     78    {
    7279        if ( ! function_exists( 'WC' ) ) {
    7380            add_action( 'admin_notices', 'woo_order_export_swatches_wc_notice' );
    7481        } else {
    7582            require_once WOE_PLUGIN_DIR . 'includes/front-end/classes/class-woo-order-export.php';
    76             new Woo_Order_Export();
    7783        }
    7884    }
     
    8187/**
    8288 * Hook the plugin language translation file
     89
     90
    8391 * @since 1.0.0
    84  * @return void.
    8592 */
    8693if ( ! function_exists( 'woo_order_export_language' ) ) {
    87     function woo_order_export_language() {
     94    function woo_order_export_language ()
     95    {
    8896        load_plugin_textdomain( 'woo-order-export', false, WOE_PLUGIN_DIR . 'language' );
    8997    }
     
    92100/**
    93101 * Create the plugin download files directory in the upload directory
     102
     103
    94104 * @since 1.0.0
    95  * @return void.
    96105 */
    97106if ( ! function_exists( 'create_dir' ) ) {
    98     function create_dir() {
     107    function create_dir ()
     108    {
    99109        $dir_check = wp_get_upload_dir()[ 'basedir' ] . '/woo-roder-export';
    100110        if ( ! is_dir( $dir_check ) ) {
  • woo-order-export/trunk/readme.txt

    r2171144 r2745695  
    11=== Woo Order Export ===
    22Plugin Name: Woo Order Export
    3 Plugin URI: https://demo.themecat.org/woo-order-export
    4 Description: Woo Order Export is used to export the WooCommerce orders with all details. It has the option to export the order from a selectable date range and order status base.
    5 Version: 2.0
    6 Author: Themecat_Info
    7 Author URI: https://themecat.org/
     3Plugin URI: https://
     4Description: Woo Order Export used to export the WooCommerce orders with all details. It has the option to export the order from a selectable date range and order status base.
     5Version: 2.0
     6Author:
     7Author URI: https://.org/
    88Text Domain: woo-order-export
    99Requires at least: 4.5
    10 Tested up to: 5.2
     10Tested up to:
    1111License: GPLv2 or later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1313Domain Path: /languages/
    1414WC requires at least: 3.0.0
    15 WC tested up to: 3.6
     15WC tested up to:
    1616
    17 An extension of WooCommerce that make products order downloadabel friendly to customers.
     17An extension of WooCommerce that make products order downloadab friendly to customers.
    1818
    1919== Description ==
Note: See TracChangeset for help on using the changeset viewer.