| @@ -1,92 +1,114 @@ | ||
| 1 | -<?php | |
| 2 | -require_once(USCES_PLUGIN_DIR . '/classes/calendar.class.php'); | |
| 3 | - | |
| 4 | -//cur | |
| 5 | -list($todayyy, $todaymm, $todaydd) = getToday(); | |
| 6 | -$cal1 = new calendarData(); | |
| 7 | -$cal1->setToday($todayyy, $todaymm, $todaydd); | |
| 8 | -$cal1->setCalendarData(); | |
| 9 | -//next | |
| 10 | -list($nextyy, $nextmm, $nextdd) = getAfterMonth($todayyy, $todaymm, 1, 1); | |
| 11 | -$cal2 = new calendarData(); | |
| 12 | -$cal2->setToday($nextyy, $nextmm, $nextdd); | |
| 13 | -$cal2->setCalendarData(); | |
| 14 | -$caption1 = __('This month', 'usces') . '(' . sprintf(__('%2$s/%1$s', 'usces'),$todayyy,$todaymm) . ')'; | |
| 15 | -$caption2 = __('Next month', 'usces') . '(' . sprintf(__('%2$s/%1$s', 'usces'),$nextyy,$nextmm) . ')'; | |
| 16 | -?> | |
| 17 | -<table cellspacing="0" id="wp-calendar" class="usces_calendar"> | |
| 18 | -<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap1', $caption1, $todayyy, $todaymm); ?></caption> | |
| 19 | -<thead> | |
| 20 | - <tr> | |
| 21 | - <th><?php _e('Sun', 'usces'); ?></th> | |
| 22 | - <th><?php _e('Mon', 'usces'); ?></th> | |
| 23 | - <th><?php _e('Tue', 'usces'); ?></th> | |
| 24 | - <th><?php _e('Wed', 'usces'); ?></th> | |
| 25 | - <th><?php _e('Thu', 'usces'); ?></th> | |
| 26 | - <th><?php _e('Fri', 'usces'); ?></th> | |
| 27 | - <th><?php _e('Sat', 'usces'); ?></th> | |
| 28 | - </tr> | |
| 29 | -</thead> | |
| 30 | -<tbody> | |
| 31 | -<?php for ($i = 0; $i < $cal1->getRow(); $i++) : ?> | |
| 32 | - <tr> | |
| 33 | -<?php for ($d = 0; $d <= 6; $d++) : | |
| 34 | - $mday = $cal1->getDateText($i, $d); | |
| 35 | - if ($mday != "") { | |
| 36 | - $business = $usces->options['business_days'][$todayyy][$todaymm][$mday]; | |
| 37 | - //$style = ($business == 1) ? "" : ' style="background-color:#FFECCE; color:#ff0000;"'; | |
| 38 | - if($mday == $todaydd){ | |
| 39 | - $tostyle = 'businesstoday'; | |
| 40 | - }else{ | |
| 41 | - $tostyle = ''; | |
| 42 | - } | |
| 43 | - if($business == 0){ | |
| 44 | - $style = 'businessday '; | |
| 45 | - }else{ | |
| 46 | - $style = ''; | |
| 47 | - } | |
| 48 | -?> | |
| 49 | - <td class="<?php echo $style . $tostyle; ?>"><?php echo $mday; ?></td> | |
| 50 | -<?php } else { ?> | |
| 51 | - <td> </td> | |
| 52 | -<?php } ?> | |
| 53 | -<?php endfor; ?> | |
| 54 | - </tr> | |
| 55 | -<?php endfor; ?> | |
| 56 | -</tbody> | |
| 57 | -</table> | |
| 58 | -<table cellspacing="0" id="wp-calendar" class="usces_calendar"> | |
| 59 | -<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap2', $caption2, $nextyy, $nextmm); ?></caption> | |
| 60 | -<thead> | |
| 61 | - <tr> | |
| 62 | - <th><?php _e('Sun', 'usces'); ?></th> | |
| 63 | - <th><?php _e('Mon', 'usces'); ?></th> | |
| 64 | - <th><?php _e('Tue', 'usces'); ?></th> | |
| 65 | - <th><?php _e('Wed', 'usces'); ?></th> | |
| 66 | - <th><?php _e('Thu', 'usces'); ?></th> | |
| 67 | - <th><?php _e('Fri', 'usces'); ?></th> | |
| 68 | - <th><?php _e('Sat', 'usces'); ?></th> | |
| 69 | - </tr> | |
| 70 | -</thead> | |
| 71 | -<tbody> | |
| 72 | -<?php for ($i = 0; $i < $cal2->getRow(); $i++) : ?> | |
| 73 | - <tr> | |
| 74 | -<?php for ($d = 0; $d <= 6; $d++) : | |
| 75 | - $mday = $cal2->getDateText($i, $d); | |
| 76 | - if ($mday != "") { | |
| 77 | - $business = $usces->options['business_days'][$nextyy][$nextmm][$mday]; | |
| 78 | - //$style = ($business == 1) ? "" : ' style="background-color:#FFECCE; color:#ff0000;"'; | |
| 79 | - $style = ($business == 1) ? "" : ' class="businessday"'; ?> | |
| 80 | - <td<?php echo $style; ?>><?php echo $mday; ?></td> | |
| 81 | -<?php } else { ?> | |
| 82 | - <td> </td> | |
| 83 | -<?php } ?> | |
| 84 | -<?php endfor; ?> | |
| 85 | - </tr> | |
| 86 | -<?php endfor; ?> | |
| 87 | -</tbody> | |
| 88 | -</table> | |
| 89 | -<?php | |
| 90 | -$afterword = '(<span class="business_days_exp_box businessday"> </span> ' . __('Holiday for Shipping Operations', 'usces') . ')'."\n"; | |
| 91 | -echo apply_filters( 'usces_filter_widget_calendar', $afterword); | |
| 92 | -?> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Welcart Calendar Widget | |
| 4 | + * | |
| 5 | + * @package Welcart | |
| 6 | + */ | |
| 7 | + | |
| 8 | +require_once USCES_PLUGIN_DIR . '/classes/calendar.class.php'; | |
| 9 | + | |
| 10 | +/* This month */ | |
| 11 | +list( $todayyy, $todaymm, $todaydd ) = getToday(); | |
| 12 | +$cal1 = new calendarData(); | |
| 13 | +$cal1->setToday( $todayyy, $todaymm, $todaydd ); | |
| 14 | +$cal1->setCalendarData(); | |
| 15 | +$caption1 = __( 'This month', 'usces' ) . '(' . sprintf( __( '%2$s/%1$s', 'usces' ), $todayyy, $todaymm ) . ')'; | |
| 16 | +/* Next month */ | |
| 17 | +list( $nextyy, $nextmm, $nextdd ) = getAfterMonth( $todayyy, $todaymm, 1, 1 ); | |
| 18 | +$cal2 = new calendarData(); | |
| 19 | +$cal2->setToday( $nextyy, $nextmm, $nextdd ); | |
| 20 | +$cal2->setCalendarData(); | |
| 21 | +$caption2 = __( 'Next month', 'usces' ) . '(' . sprintf( __( '%2$s/%1$s', 'usces' ), $nextyy, $nextmm ) . ')'; | |
| 22 | +ob_start(); | |
| 23 | +?> | |
| 24 | +<div class="this-month"> | |
| 25 | +<table cellspacing="0" class="usces_calendar"> | |
| 26 | +<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap1', $caption1, $todayyy, $todaymm ); ?></caption> | |
| 27 | +<thead> | |
| 28 | + <tr> | |
| 29 | + <th><?php esc_html_e( 'Sun', 'usces' ); ?></th> | |
| 30 | + <th><?php esc_html_e( 'Mon', 'usces' ); ?></th> | |
| 31 | + <th><?php esc_html_e( 'Tue', 'usces' ); ?></th> | |
| 32 | + <th><?php esc_html_e( 'Wed', 'usces' ); ?></th> | |
| 33 | + <th><?php esc_html_e( 'Thu', 'usces' ); ?></th> | |
| 34 | + <th><?php esc_html_e( 'Fri', 'usces' ); ?></th> | |
| 35 | + <th><?php esc_html_e( 'Sat', 'usces' ); ?></th> | |
| 36 | + </tr> | |
| 37 | +</thead> | |
| 38 | +<tbody> | |
| 39 | +<?php | |
| 40 | +$cal1_row = $cal1->getRow(); | |
| 41 | +for ( $i = 0; $i < $cal1_row; $i++ ) : | |
| 42 | + ?> | |
| 43 | + <tr> | |
| 44 | + <?php | |
| 45 | + for ( $d = 0; $d <= 6; $d++ ) : | |
| 46 | + $mday = $cal1->getDateText( $i, $d ); | |
| 47 | + if ( '' != $mday ) : | |
| 48 | + $business = ( isset( $usces->options['business_days'][ $todayyy ][ $todaymm ][ $mday ] ) ) ? (int) $usces->options['business_days'][ $todayyy ][ $todaymm ][ $mday ] : 1; | |
| 49 | + if ( $mday == $todaydd ) { | |
| 50 | + if ( 1 === $business ) { | |
| 51 | + $style = ' class="businesstoday"'; | |
| 52 | + } else { | |
| 53 | + $style = ' class="businessday businesstoday"'; | |
| 54 | + } | |
| 55 | + } else { | |
| 56 | + $style = ( 1 === $business ) ? '' : ' class="businessday"'; | |
| 57 | + } | |
| 58 | + ?> | |
| 59 | + <td <?php wel_esc_script_e( $style ); ?>><?php echo esc_html( $mday ); ?></td> | |
| 60 | + <?php else : ?> | |
| 61 | + <td> </td> | |
| 62 | + <?php endif; ?> | |
| 63 | + <?php endfor; ?> | |
| 64 | + </tr> | |
| 65 | +<?php endfor; ?> | |
| 66 | +</tbody> | |
| 67 | +</table> | |
| 68 | +</div> | |
| 69 | +<div class="next-month"> | |
| 70 | +<table cellspacing="0" class="usces_calendar"> | |
| 71 | +<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap2', $caption2, $nextyy, $nextmm ); ?></caption> | |
| 72 | +<thead> | |
| 73 | + <tr> | |
| 74 | + <th><?php esc_html_e( 'Sun', 'usces' ); ?></th> | |
| 75 | + <th><?php esc_html_e( 'Mon', 'usces' ); ?></th> | |
| 76 | + <th><?php esc_html_e( 'Tue', 'usces' ); ?></th> | |
| 77 | + <th><?php esc_html_e( 'Wed', 'usces' ); ?></th> | |
| 78 | + <th><?php esc_html_e( 'Thu', 'usces' ); ?></th> | |
| 79 | + <th><?php esc_html_e( 'Fri', 'usces' ); ?></th> | |
| 80 | + <th><?php esc_html_e( 'Sat', 'usces' ); ?></th> | |
| 81 | + </tr> | |
| 82 | +</thead> | |
| 83 | +<tbody> | |
| 84 | +<?php | |
| 85 | +$cal2_row = $cal2->getRow(); | |
| 86 | +for ( $i = 0; $i < $cal2_row; $i++ ) : | |
| 87 | + ?> | |
| 88 | + <tr> | |
| 89 | + <?php | |
| 90 | + for ( $d = 0; $d <= 6; $d++ ) : | |
| 91 | + $mday = $cal2->getDateText( $i, $d ); | |
| 92 | + if ( '' != $mday ) : | |
| 93 | + $business = ( isset( $usces->options['business_days'][ $nextyy ][ $nextmm ][ $mday ] ) ) ? (int) $usces->options['business_days'][ $nextyy ][ $nextmm ][ $mday ] : 1; | |
| 94 | + $style = ( 1 === $business ) ? '' : ' class="businessday"'; | |
| 95 | + ?> | |
| 96 | + <td <?php wel_esc_script_e( $style ); ?>><?php echo esc_html( $mday ); ?></td> | |
| 97 | + <?php else : ?> | |
| 98 | + <td> </td> | |
| 99 | + <?php endif; ?> | |
| 100 | + <?php endfor; ?> | |
| 101 | + </tr> | |
| 102 | +<?php endfor; ?> | |
| 103 | +</tbody> | |
| 104 | +</table> | |
| 105 | +</div> | |
| 106 | +<?php | |
| 107 | +$html = ob_get_contents(); | |
| 108 | +ob_end_clean(); | |
| 109 | +$html = apply_filters( 'usces_filter_widget_calendar_form', $html ); | |
| 110 | +echo $html; | |
| 111 | +?> | |
| 112 | +<?php | |
| 113 | +$afterword = '(<span class="business_days_exp_box businessday"> </span> ' . __( 'Holiday for Shipping Operations', 'usces' ) . ')' . "\n"; | |
| 114 | +echo apply_filters( 'usces_filter_widget_calendar', $afterword ); | |