Changeset 3020628
- Timestamp:
- 01/11/2024 08:27:58 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
repeat-order-for-woocommerce/trunk/repeat-order-for-woocommerce.php
r2999554 r3020628 4 4 * Plugin URI: https://poly-res.com/plugins/repeat-order-for-woocommerce/ 5 5 * Description: Add an "order again" button in Recent Orders list 6 * Version: 1.3. 16 * Version: 1.3.2 7 7 * Author: polyres 8 8 * Author URI: https://poly-res.com/ … … 15 15 * Requires WP: 4.8 16 16 * Requires PHP: 5.3 17 * Tested up to: 6.4. 117 * Tested up to: 6.4.2 18 18 * WC requires at least: 3.4.0 19 * WC tested up to: 8. 3.019 * WC tested up to: 8.4.0 20 20 * 21 21 * @link https://poly-res.com … … 30 30 } 31 31 32 define( 'PRRO_VERSION', '1.3. 1' );32 define( 'PRRO_VERSION', '1.3.2' ); 33 33 34 34 … … 84 84 * @access public 85 85 * @param obj $upgrader_object Upgrader object. 86 * @param array $options Options.86 * @param array $options Options. 87 87 * @return void 88 88 */ … … 90 90 $our_plugin = plugin_basename( __FILE__ ); 91 91 // If an update has taken place and the updated type is plugins and the plugins element exists. 92 if ( 'update' === $options['action'] && 'plugin' === $options['type'] && isset( $options['plugins'] ) ) { 93 // Iterate through the plugins being updated and check if ours is there. 94 foreach ( $options['plugins'] as $plugin ) { 95 if ( $plugin === $our_plugin ) { 96 switch ( PRRO_VERSION ) { 97 case '1.2.0': 98 // Version 1.3.0 99 // Add default stat settings and plugin version. 100 foreach ( wc_get_order_statuses() as $key => $name ) { 101 if ( false === get_option( 'prro_order_status_' . $key ) ) { 102 if ( 'wc-completed' === $key ) { 103 add_option( 'prro_order_status_' . $key, 'yes' ); 104 } else { 105 add_option( 'prro_order_status_' . $key, 'no' ); 106 } 107 } 108 } 109 if ( false === get_option( 'prro_version' ) ) { 110 add_option( 'prro_version', PRRO_VERSION ); 111 } 112 break; 92 if ( 'update' === $options['action'] && 'plugin' === $options['type'] && in_array( $our_plugin, $options['plugins'], true ) ) { 93 // Retrieve the current version from the database. 94 $current_version = get_option( 'prro_version' ); 95 // Compare the current version with the new version. 96 // If the current version is less than the new version, run the update logic. 97 if ( version_compare( $current_version, PRRO_VERSION, '<' ) ) { 98 // Specific update logic for version 1.2.0 to the new version. 99 if ( version_compare( $current_version, '1.2.0', '<=' ) ) { 100 // Perform operations for the new version here. 101 foreach ( wc_get_order_statuses() as $key => $name ) { 102 if ( false === get_option( 'prro_order_status_' . $key ) ) { 103 add_option( 'prro_order_status_' . $key, 'wc-completed' === $key ? 'yes' : 'no' ); 104 } 113 105 } 114 106 } 107 // Update the stored version to the new version after all updates are completed. 108 update_option( 'prro_version', PRRO_VERSION ); 115 109 } 116 110 } … … 494 488 if ( function_exists( 'wc_get_page_screen_id' ) ) { 495 489 $cs = wc_get_page_screen_id('shop-order'); 496 if ( $cs === 'woocommerce_page_wc-orders' ) {490 if ( $cs === 'woocommerce_page_wc-orders' || $cs === 'shop_order' ) { 497 491 add_action( 'admin_footer', array( $this, 'order_preview_template' ) ); 498 492 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
Note: See TracChangeset
for help on using the changeset viewer.