Created
January 19, 2026 10:01
-
-
Save rajeshsingh520/db495a979edfaf64fa5b83ff00eb9a14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class pisol_custom_code_20260119{ | |
| static $instance = null; | |
| static function get_instance() { | |
| if ( null === self::$instance ) { | |
| self::$instance = new self(); | |
| } | |
| return self::$instance; | |
| } | |
| function __construct() { | |
| add_filter('pisol_dtt_date_sort', [$this, 'dates'], PHP_INT_MAX); | |
| } | |
| function dates($dates) { | |
| $dates = self::removeNonWorkingDays($dates); | |
| return $dates; | |
| } | |
| static function removeNonWorkingDays($dates){ | |
| $type = pi_dtt_delivery_type::getType(); | |
| $var_name = 'pi_'.$type.'_days'; | |
| $allowed_days = pisol_dtt_get_setting($var_name, array()); | |
| if(empty($allowed_days)) return $dates; | |
| foreach($dates as $key => $date){ | |
| $day_of_week = date('w', strtotime($date)); | |
| if(!in_array((string)$day_of_week, $allowed_days)){ | |
| unset($dates[$key]); | |
| } | |
| } | |
| return $dates; | |
| } | |
| } | |
| pisol_custom_code_20260119::get_instance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment