|
1 <?php |
|
2 |
|
3 class A2A_SHARE_SAVE_Widget extends WP_Widget { |
|
4 /** constructor */ |
|
5 function A2A_SHARE_SAVE_Widget() { |
|
6 parent::WP_Widget('', 'AddToAny Sharing', array('description' => 'Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, StumbleUpon, Digg and many more.'), array('width' => 400)); |
|
7 } |
|
8 |
|
9 /** Backwards compatibility for A2A_SHARE_SAVE_Widget::display(); usage */ |
|
10 function display( $args = false ) { |
|
11 self::widget($args, NULL); |
|
12 } |
|
13 |
|
14 /** @see WP_Widget::widget */ |
|
15 function widget($args = array(), $instance) { |
|
16 |
|
17 global $A2A_SHARE_SAVE_plugin_url_path; |
|
18 |
|
19 $defaults = array( |
|
20 'before_widget' => '', |
|
21 'after_widget' => '', |
|
22 'before_title' => '', |
|
23 'after_title' => '', |
|
24 ); |
|
25 |
|
26 $args = wp_parse_args( $args, $defaults ); |
|
27 extract( $args ); |
|
28 $title = apply_filters('widget_title', $instance['title']); |
|
29 |
|
30 echo $before_widget; |
|
31 |
|
32 if ($title) { |
|
33 echo $before_title . $title . $after_title; |
|
34 } |
|
35 |
|
36 ADDTOANY_SHARE_SAVE_KIT(array( |
|
37 "use_current_page" => TRUE |
|
38 )); |
|
39 |
|
40 echo $after_widget; |
|
41 } |
|
42 |
|
43 /** @see WP_Widget::update */ |
|
44 function update($new_instance, $old_instance) { |
|
45 $instance = $old_instance; |
|
46 $instance['title'] = strip_tags($new_instance['title']); |
|
47 return $instance; |
|
48 } |
|
49 |
|
50 /** @see WP_Widget::form */ |
|
51 function form($instance) { |
|
52 $title = (isset($instance) && isset($instance['title'])) ? esc_attr($instance['title']) : ''; |
|
53 ?> |
|
54 <p> |
|
55 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> |
|
56 <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; ?>" /> |
|
57 </p> |
|
58 <p> |
|
59 <a href="options-general.php?page=add-to-any.php"><?php _e("Settings", "add-to-any"); ?>...</a> |
|
60 </p> |
|
61 <?php |
|
62 } |
|
63 |
|
64 } |
|
65 |