| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Welcart_calendar Class |
| 5 |
*/ |
| 6 |
class Welcart_calendar extends WP_Widget { |
| 7 |
/** constructor */ |
| 8 |
function Welcart_calendar() { |
| 9 |
parent::WP_Widget(false, $name = 'Welcart '.__('Calendar', 'usces')); |
| 10 |
} |
| 11 |
|
| 12 |
/** @see WP_Widget::widget */ |
| 13 |
function widget($args, $instance) { |
| 14 |
extract( $args ); |
| 15 |
$title = ( !isset($instance['title']) || WCUtils::is_blank($instance['title']) ) ? 'Welcart '.__('Business Calendar', 'usces') : $instance['title']; |
| 16 |
$icon = ( !isset($instance['icon']) || WCUtils::is_blank($instance['icon']) ) ? 1 : (int)$instance['icon']; |
| 17 |
//if($icon == 1) $before_title = '<div class="widget_title"><img src="' . USCES_PLUGIN_URL . '/images/calendar.png" alt="' . $title . '" width="24" height="24" />'; |
| 18 |
$img_path = file_exists(get_stylesheet_directory().'/images/calendar.png') ? get_stylesheet_directory_uri().'/images/calendar.png' : USCES_FRONT_PLUGIN_URL . '/images/calendar.png'; |
| 19 |
if($icon == 1) $before_title .= '<img src="' . $img_path . '" alt="' . $title . '" />'; |
| 20 |
?> |
| 21 |
<?php echo $before_widget; ?> |
| 22 |
<?php echo $before_title |
| 23 |
. esc_html($title) |
| 24 |
. $after_title; ?> |
| 25 |
|
| 26 |
<ul class="ucart_calendar_body ucart_widget_body"><li> |
| 27 |
<?php usces_the_calendar(); ?> |
| 28 |
</li></ul> |
| 29 |
|
| 30 |
<?php echo $after_widget; ?> |
| 31 |
<?php |
| 32 |
} |
| 33 |
|
| 34 |
/** @see WP_Widget::update */ |
| 35 |
function update($new_instance, $old_instance) { |
| 36 |
return $new_instance; |
| 37 |
} |
| 38 |
|
| 39 |
/** @see WP_Widget::form */ |
| 40 |
function form($instance) { |
| 41 |
$title = ( !isset($instance['title']) || WCUtils::is_blank($instance['title']) ) ? 'Welcart '.__('Business Calendar', 'usces') : esc_attr($instance['title']); |
| 42 |
$icon = ( !isset($instance['icon']) || WCUtils::is_blank($instance['icon']) ) ? 1 : (int)$instance['icon']; |
| 43 |
?> |
| 44 |
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p> |
| 45 |
<p><label for="<?php echo $this->get_field_id('icon'); ?>"><?php _e('display of icon', 'usces'); ?>: <select class="widefat" id="<?php echo $this->get_field_id('icon'); ?>" name="<?php echo $this->get_field_name('icon'); ?>"><option value="1"<?php if($icon == 1){echo ' selected="selected"';} ?>><?php _e('Indication', 'usces'); ?></option><option value="2"<?php if($icon == 2){echo ' selected="selected"';} ?>><?php _e('Non-indication', 'usces'); ?></option></select></label></p> |
| 46 |
<p><?php _e("The setting of the business day, In a 'business day setting' page of the admin screen.", 'usces'); ?></p> |
| 47 |
<?php |
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
?> |