Plugin Directory

Changeset 2932985


Ignore:
Timestamp:
07/02/2023 08:09:41 AM (3 years ago)
Author:
cylas
Message:

version 1.0.1

Location:
admin-previous-and-next-order-edit-links-for-woocommerce
Files:
66 added
12 edited

Legend:

Unmodified
Added
Removed
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/README.txt

    r2882730 r2932985  
    55Tested up to:      6.2
    66Requires PHP:      5.6
    7 Stable tag:        1.0.0
     7Stable tag:        1.0.1
    88Donate link:       https://www.buymeacoffee.com/BELOCODES
    99License:           GPLv2 or later
     
    7272Initial release
    7373
     74= 1.0.1 =
     75Bug Fixes plus minor upgrades
    7476
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/admin/class-previous-next-edit-order-links-for-woocommerce-admin.php

    r2878036 r2932985  
    55 *
    66 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    7  * @since      1.0.0
     7 * @since      1.0.1
    88 *
    99 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    2626     * The ID of this plugin.
    2727     *
    28      * @since    1.0.0
     28     * @since    1.0.1
    2929     * @access   private
    3030     * @var      string    $plugin_name    The ID of this plugin.
     
    3535     * The version of this plugin.
    3636     *
    37      * @since    1.0.0
     37     * @since    1.0.1
    3838     * @access   private
    3939     * @var      string    $version    The current version of this plugin.
     
    4444     * Initialize the class and set its properties.
    4545     *
    46      * @since    1.0.0
     46     * @since    1.0.1
    4747     * @param      string    $plugin_name       The name of this plugin.
    4848     * @param      string    $version    The version of this plugin.
     
    5858     * Register the stylesheets for the admin area.
    5959     *
    60      * @since    1.0.0
     60     * @since    1.0.1
    6161     */
    6262    public function enqueue_styles() {
     
    8181     * Register the JavaScript for the admin area.
    8282     *
    83      * @since    1.0.0
     83     * @since    1.0.1
    8484     */
    8585    public function enqueue_scripts() {
     
    107107     $screen_id = isset( $screen, $screen->id ) ? $screen->id : '';
    108108     if ( $screen_id == 'shop_order' ) {
    109      //Import the orders' data---------
    110      $query = new WC_Order_Query( array(
    111          'limit' => -1,
    112          'orderby' => 'date',
    113          'order' => 'DESC',
    114          'return' => 'ids',
    115      ) );
    116      $orders_belo = $query->get_orders();
    117      $cur = 0;
    118      $prev = 0;
    119      $next = 0;
    120      for($i=0;$i<=count($orders_belo);$i++){
    121         if($post){
    122             if($orders_belo[$i] == $post->ID){
    123                 $cur = $i;
    124                 $prev = $cur - 1;
    125                 $next = $cur + 1;
    126                 break;
    127             }
     109       
     110     global $post, $wpdb, $theorder;
     111
     112        if ( ! is_object( $theorder ) ) {
     113             $theorder = wc_get_order( $post->ID );
    128114        }
    129          
    130      }
    131115
    132     //Filling the Output array---------     
    133      if($prev >= 0 ){
    134         if(!empty($orders_belo[$prev])){
    135             $final_prev_next_output["prev"] = admin_url( 'post.php?post='.$orders_belo[$prev].'&action=edit' );
    136         }
    137      }
    138      if($next > 0 ){
    139         if(!empty($orders_belo[$next])){
    140             $final_prev_next_output["next"] = admin_url( 'post.php?post='.$orders_belo[$next].'&action=edit' );
    141         }
    142      }
    143      
    144      //Enqueuing the Output JS scripts---------
    145    
    146         wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/previous-next-edit-order-links-for-woocommerce-admin.js', array( 'jquery' ), $this->version, false );
    147         wp_localize_script($this->plugin_name, 'prev_next_script_vars', array(
    148             "prev" => $final_prev_next_output["prev"],
    149             "prev_text" => __('Previous Order','belo_prev_next_domain'),
    150             "next" => $final_prev_next_output["next"],
    151             "next_text" => __('Next Order','belo_prev_next_domain')
    152             )
    153         );
    154     }
     116        $order_type_object = get_post_type_object( $post->post_type );
     117
     118        $order_navigation = $wpdb->get_row( $wpdb->prepare( "
     119            SELECT
     120                (SELECT ID FROM {$wpdb->prefix}posts
     121                WHERE ID < %d
     122                AND post_type = '%s'
     123                AND post_status <> 'trash'
     124                ORDER BY ID DESC LIMIT 1 )
     125                AS prev_order_id,
     126                (SELECT ID FROM {$wpdb->prefix}posts
     127                WHERE ID > %d
     128                AND post_type = '%s'
     129                AND post_status <> 'trash'
     130                ORDER BY ID ASC LIMIT 1 )
     131                AS next_order_id
     132        ", $post->ID, $post->post_type, $post->ID, $post->post_type ), ARRAY_A );
     133       
     134    //Filling the Output array---------   
     135      if ( array_filter( $order_navigation ) ) :
     136         
     137       endif;
     138
     139 
     140if(!empty($order_navigation[ 'prev_order_id' ])){
     141$final_prev_next_output["prev"] = admin_url( 'post.php?post='.$order_navigation[ 'prev_order_id' ].'&action=edit' );
     142}
     143if(!empty($order_navigation[ 'next_order_id' ])){
     144$final_prev_next_output["next"] = admin_url( 'post.php?post='.$order_navigation[ 'next_order_id' ].'&action=edit' );
     145}
     146 
     147//Enqueuing the Output JS scripts---------
     148
     149wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) .
     150'js/previous-next-edit-order-links-for-woocommerce-admin.js', array( 'jquery' ), $this->version, false );
     151wp_localize_script($this->plugin_name, 'prev_next_script_vars', array(
     152"prev" => $final_prev_next_output["prev"],
     153"prev_text" => __('Previous Order','belo_prev_next_domain'),
     154"next" => $final_prev_next_output["next"],
     155"next_text" => __('Next Order','belo_prev_next_domain')
     156)
     157);
     158}
    155159}
    156160
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/admin/partials/previous-next-edit-order-links-for-woocommerce-admin-display.php

    r2878036 r2932985  
    77 *
    88 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    9  * @since      1.0.0
     9 * @since      1.0.1
    1010 *
    1111 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/includes/class-previous-next-edit-order-links-for-woocommerce-activator.php

    r2878036 r2932985  
    55 *
    66 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    7  * @since      1.0.0
     7 * @since      1.0.1
    88 *
    99 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    1616 * This class defines all code necessary to run during the plugin's activation.
    1717 *
    18  * @since      1.0.0
     18 * @since      1.0.1
    1919 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
    2020 * @subpackage Previous_Next_Edit_Order_Links_For_Woocommerce/includes
     
    2828     * Long Description.
    2929     *
    30      * @since    1.0.0
     30     * @since    1.0.1
    3131     */
    3232    public static function activate() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/includes/class-previous-next-edit-order-links-for-woocommerce-deactivator.php

    r2878036 r2932985  
    55 *
    66 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    7  * @since      1.0.0
     7 * @since      1.0.1
    88 *
    99 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    1616 * This class defines all code necessary to run during the plugin's deactivation.
    1717 *
    18  * @since      1.0.0
     18 * @since      1.0.1
    1919 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
    2020 * @subpackage Previous_Next_Edit_Order_Links_For_Woocommerce/includes
     
    2828     * Long Description.
    2929     *
    30      * @since    1.0.0
     30     * @since    1.0.1
    3131     */
    3232    public static function deactivate() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/includes/class-previous-next-edit-order-links-for-woocommerce-i18n.php

    r2878036 r2932985  
    88 *
    99 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    10  * @since      1.0.0
     10 * @since      1.0.1
    1111 *
    1212 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    2020 * so that it is ready for translation.
    2121 *
    22  * @since      1.0.0
     22 * @since      1.0.1
    2323 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
    2424 * @subpackage Previous_Next_Edit_Order_Links_For_Woocommerce/includes
     
    3131     * Load the plugin text domain for translation.
    3232     *
    33      * @since    1.0.0
     33     * @since    1.0.1
    3434     */
    3535    public function load_plugin_textdomain() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/includes/class-previous-next-edit-order-links-for-woocommerce-loader.php

    r2878036 r2932985  
    55 *
    66 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    7  * @since      1.0.0
     7 * @since      1.0.1
    88 *
    99 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    2727     * The array of actions registered with WordPress.
    2828     *
    29      * @since    1.0.0
     29     * @since    1.0.1
    3030     * @access   protected
    3131     * @var      array    $actions    The actions registered with WordPress to fire when the plugin loads.
     
    3636     * The array of filters registered with WordPress.
    3737     *
    38      * @since    1.0.0
     38     * @since    1.0.1
    3939     * @access   protected
    4040     * @var      array    $filters    The filters registered with WordPress to fire when the plugin loads.
     
    4545     * Initialize the collections used to maintain the actions and filters.
    4646     *
    47      * @since    1.0.0
     47     * @since    1.0.1
    4848     */
    4949    public function __construct() {
     
    5757     * Add a new action to the collection to be registered with WordPress.
    5858     *
    59      * @since    1.0.0
     59     * @since    1.0.1
    6060     * @param    string               $hook             The name of the WordPress action that is being registered.
    6161     * @param    object               $component        A reference to the instance of the object on which the action is defined.
     
    7171     * Add a new filter to the collection to be registered with WordPress.
    7272     *
    73      * @since    1.0.0
     73     * @since    1.0.1
    7474     * @param    string               $hook             The name of the WordPress filter that is being registered.
    7575     * @param    object               $component        A reference to the instance of the object on which the filter is defined.
     
    8686     * collection.
    8787     *
    88      * @since    1.0.0
     88     * @since    1.0.1
    8989     * @access   private
    9090     * @param    array                $hooks            The collection of hooks that is being registered (that is, actions or filters).
     
    113113     * Register the filters and actions with WordPress.
    114114     *
    115      * @since    1.0.0
     115     * @since    1.0.1
    116116     */
    117117    public function run() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/includes/class-previous-next-edit-order-links-for-woocommerce.php

    r2878036 r2932985  
    88 *
    99 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    10  * @since      1.0.0
     10 * @since      1.0.1
    1111 *
    1212 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    2323 * version of the plugin.
    2424 *
    25  * @since      1.0.0
     25 * @since      1.0.1
    2626 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
    2727 * @subpackage Previous_Next_Edit_Order_Links_For_Woocommerce/includes
     
    3434     * the plugin.
    3535     *
    36      * @since    1.0.0
     36     * @since    1.0.1
    3737     * @access   protected
    3838     * @var      Previous_Next_Edit_Order_Links_For_Woocommerce_Loader    $loader    Maintains and registers all hooks for the plugin.
     
    4343     * The unique identifier of this plugin.
    4444     *
    45      * @since    1.0.0
     45     * @since    1.0.1
    4646     * @access   protected
    4747     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
     
    5252     * The current version of the plugin.
    5353     *
    54      * @since    1.0.0
     54     * @since    1.0.1
    5555     * @access   protected
    5656     * @var      string    $version    The current version of the plugin.
     
    6565     * the public-facing side of the site.
    6666     *
    67      * @since    1.0.0
     67     * @since    1.0.1
    6868     */
    6969    public function __construct() {
     
    7171            $this->version = PREVIOUS_NEXT_EDIT_ORDER_LINKS_FOR_WOOCOMMERCE_VERSION;
    7272        } else {
    73             $this->version = '1.0.0';
     73            $this->version = '1.0.1';
    7474        }
    7575        $this->plugin_name = 'previous-next-edit-order-links-for-woocommerce';
     
    9595     * with WordPress.
    9696     *
    97      * @since    1.0.0
     97     * @since    1.0.1
    9898     * @access   private
    9999     */
     
    133133     * with WordPress.
    134134     *
    135      * @since    1.0.0
     135     * @since    1.0.1
    136136     * @access   private
    137137     */
     
    148148     * of the plugin.
    149149     *
    150      * @since    1.0.0
     150     * @since    1.0.1
    151151     * @access   private
    152152     */
     
    164164     * of the plugin.
    165165     *
    166      * @since    1.0.0
     166     * @since    1.0.1
    167167     * @access   private
    168168     */
     
    179179     * Run the loader to execute all of the hooks with WordPress.
    180180     *
    181      * @since    1.0.0
     181     * @since    1.0.1
    182182     */
    183183    public function run() {
     
    189189     * WordPress and to define internationalization functionality.
    190190     *
    191      * @since     1.0.0
     191     * @since     1.0.1
    192192     * @return    string    The name of the plugin.
    193193     */
     
    199199     * The reference to the class that orchestrates the hooks with the plugin.
    200200     *
    201      * @since     1.0.0
     201     * @since     1.0.1
    202202     * @return    Previous_Next_Edit_Order_Links_For_Woocommerce_Loader    Orchestrates the hooks of the plugin.
    203203     */
     
    209209     * Retrieve the version number of the plugin.
    210210     *
    211      * @since     1.0.0
     211     * @since     1.0.1
    212212     * @return    string    The version number of the plugin.
    213213     */
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/previous-next-edit-order-links-for-woocommerce.php

    r2878036 r2932985  
    1010 *
    1111 * @link              https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    12  * @since             1.0.0
     12 * @since             1.0.1
    1313 * @package           Previous_Next_Edit_Order_Links_For_Woocommerce
    1414 *
     
    1717 * Plugin URI:        https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    1818 * Description:       This plugin enables you to quickly access and edit the next and previous orders. It saves times while processing orders in a sequence which boosts productivity.
    19   * Version:          1.0.0
    20  * Author:            Belo
     19  * Version:          1.0.1
     20 * Author:            Belo  
    2121 * Author URI:        https://profiles.wordpress.org/cylas/
    2222 * License:           GPL-2.0+
     
    4949/**
    5050 * Currently plugin version.
    51  * Start at version 1.0.0 and use SemVer - https://semver.org
     51 * Start at version 1.0.1 and use SemVer - https://semver.org
    5252 * Rename this for your plugin and update it as you release new versions.
    5353 */
    54 define( 'PREVIOUS_NEXT_EDIT_ORDER_LINKS_FOR_WOOCOMMERCE_VERSION', '1.0.0' );
     54define( 'PREVIOUS_NEXT_EDIT_ORDER_LINKS_FOR_WOOCOMMERCE_VERSION', '1.0.1' );
    5555
    5656/**
     
    8888 * not affect the page life cycle.
    8989 *
    90  * @since    1.0.0
     90 * @since    1.0.1
    9191 */
    9292function run_previous_next_edit_order_links_for_woocommerce() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/public/class-previous-next-edit-order-links-for-woocommerce-public.php

    r2878036 r2932985  
    55 *
    66 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    7  * @since      1.0.0
     7 * @since      1.0.1
    88 *
    99 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
     
    2626     * The ID of this plugin.
    2727     *
    28      * @since    1.0.0
     28     * @since    1.0.1
    2929     * @access   private
    3030     * @var      string    $plugin_name    The ID of this plugin.
     
    3535     * The version of this plugin.
    3636     *
    37      * @since    1.0.0
     37     * @since    1.0.1
    3838     * @access   private
    3939     * @var      string    $version    The current version of this plugin.
     
    4444     * Initialize the class and set its properties.
    4545     *
    46      * @since    1.0.0
     46     * @since    1.0.1
    4747     * @param      string    $plugin_name       The name of the plugin.
    4848     * @param      string    $version    The version of this plugin.
     
    5858     * Register the stylesheets for the public-facing side of the site.
    5959     *
    60      * @since    1.0.0
     60     * @since    1.0.1
    6161     */
    6262    public function enqueue_styles() {
     
    8181     * Register the JavaScript for the public-facing side of the site.
    8282     *
    83      * @since    1.0.0
     83     * @since    1.0.1
    8484     */
    8585    public function enqueue_scripts() {
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/public/partials/previous-next-edit-order-links-for-woocommerce-public-display.php

    r2878036 r2932985  
    77 *
    88 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    9  * @since      1.0.0
     9 * @since      1.0.1
    1010 *
    1111 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
  • admin-previous-and-next-order-edit-links-for-woocommerce/trunk/uninstall.php

    r2878036 r2932985  
    2020 *
    2121 * @link       https://github.com/CylasKiganda/previous-next-edit-order-links-for-woocommerce
    22  * @since      1.0.0
     22 * @since      1.0.1
    2323 *
    2424 * @package    Previous_Next_Edit_Order_Links_For_Woocommerce
Note: See TracChangeset for help on using the changeset viewer.