Plugin Directory

Changeset 3001840


Ignore:
Timestamp:
11/26/2023 03:52:05 PM (2 years ago)
Author:
pluginbazar
Message:

Bug Fixed

Location:
woc-open-close
Files:
228 added
4 edited

Legend:

Unmodified
Added
Removed
  • woc-open-close/trunk/includes/classes/class-functions.php

    r2896128 r3001840  
    169169    function get_current_day_id() {
    170170
    171         switch ( strtolower( current_time('D') ) ) {
     171        switch ( strtolower( current_time( 'D' ) ) ) {
    172172            case 'sat' :
    173173                return 10001;
     
    253253    function get_next_time( $time_for = '', $format = 'M j Y G:i:s', $return_utc = false ) {
    254254
    255         $current_day = $this->get_current_day_id();
    256         $times       = $this->calculate_times( $this->todays_schedule_details( 'schedules' ), $time_for );
    257 
     255        // get today's time
     256        $times = $this->calculate_times( $this->todays_schedule_details( 'schedules' ), $time_for );
     257
     258        // today is blank
    258259        if ( empty( $times ) ) {
    259             foreach ( $this->get_all_schedules() as $day_id => $schedules ) {
    260                 if ( $current_day >= $day_id || ! empty( $times ) ) {
    261                     continue;
     260
     261            $current_day        = $this->get_current_day_id();
     262            $current_day_index  = array_search( $current_day, array_keys( $this->get_all_schedules() ) );
     263            $after_current_day  = array_slice( $this->get_all_schedules(), $current_day_index, null, true );
     264            $before_current_day = array_diff_recursive( $this->get_all_schedules(), $after_current_day );
     265            $new_schedules      = $after_current_day + $before_current_day;
     266
     267            $_next_time = [];
     268            foreach ( $new_schedules as $day_id => $schedules ) {
     269                if ( ! empty( $schedules[0]['open'] ) && ! empty( $schedules[0]['close'] ) ) {
     270                    $_next_time[ $day_id ] = $schedules;
     271                    break;
    262272                }
    263                 $times = $this->calculate_times( $schedules, $time_for, $this->get_day_name( $day_id ) );
    264             }
     273            }
     274
     275            $day_id    = array_key_first( $_next_time ) ?: '';
     276            $schedules = $_next_time[ $day_id ];
     277            $times     = $this->calculate_times( $schedules, $time_for, $this->get_day_name( $day_id ) );
    265278        }
    266279
  • woc-open-close/trunk/includes/functions.php

    r2869626 r3001840  
    503503    }
    504504}
     505
     506
     507if ( ! function_exists( 'array_diff_recursive' ) ) {
     508    /**
     509     * array diff between two associative array.
     510     *
     511     * @param $array1
     512     * @param $array2
     513     *
     514     * @return array
     515     */
     516    function array_diff_recursive( $array1, $array2 ) {
     517        $diff = array();
     518
     519        foreach ( $array1 as $key => $value ) {
     520            if ( is_array( $value ) ) {
     521                if ( ! isset( $array2[ $key ] ) || ! is_array( $array2[ $key ] ) ) {
     522                    $diff[ $key ] = $value;
     523                } else {
     524                    $recursiveDiff = array_diff_recursive( $value, $array2[ $key ] );
     525                    if ( ! empty( $recursiveDiff ) ) {
     526                        $diff[ $key ] = $recursiveDiff;
     527                    }
     528                }
     529            } else {
     530                if ( ! isset( $array2[ $key ] ) || $array2[ $key ] !== $value ) {
     531                    $diff[ $key ] = $value;
     532                }
     533            }
     534        }
     535
     536        return $diff;
     537    }
     538}
  • woc-open-close/trunk/readme.txt

    r2994279 r3001840  
    55   Requires at least: 4.6
    66   Tested up to: 6.4.1
    7    Tested up to WooCommerce: 8.2.2
    8    Stable tag: 4.7.9
     7   Tested up to WooCommerce: 8.3.1
     8   Stable tag: 4.8.0
    99   Requires PHP: 5.6
    1010   Requires WooCommerce: 3.0
     
    301301      * 11/11/2023 - FIX - Bug fixed.
    302302
     303    = 4.8.0 =
     304    * 26/11/2023 - FIX - Bug fixed.
     305
    303306
    304307== Upgrade Notice == 
  • woc-open-close/trunk/woc-open-close.php

    r2994279 r3001840  
    44    Plugin URI: https://pluginbazar.com/plugin/woocommerce-open-close/
    55    Description: Open Close WooCommerce store automatically with predefined schedules. Stop getting orders when your store is closed.
    6     Version: 4.7.9
     6    Version: 4.8.0
    77    Text Domain: woc-open-close
    88    Author: Jaed Mosharraf & Pluginbazar Team
     
    2020defined( 'WOOOPENCLOSE_DOCS_URL' ) || define( 'WOOOPENCLOSE_DOCS_URL', 'https://docs.pluginbazar.com/plugin/open-close-woocommerce-store/' );
    2121defined( 'WOOOPENCLOSE_WP_REVIEW_URL' ) || define( 'WOOOPENCLOSE_WP_REVIEW_URL', 'https://wordpress.org/support/plugin/woc-open-close/reviews/' );
    22 defined( 'WOOOPENCLOSE_VERSION' ) || define( 'WOOOPENCLOSE_VERSION', '4.7.9' );
     22defined( 'WOOOPENCLOSE_VERSION' ) || define( 'WOOOPENCLOSE_VERSION', '4.8.0' );
    2323
    2424
Note: See TracChangeset for help on using the changeset viewer.