__( 'The Send Button allows users to easily send content to their friends.', 'facebook' ), ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @since 1.0 * * @param array $args Widget arguments. * @param array $instance Saved values from database. * @return void */ public function widget( $args, $instance ) { extract( $args ); if ( ! isset( $instance['ref'] ) ) $instance['ref'] = 'widget'; if ( ! function_exists( 'facebook_get_send_button' ) ) require_once( dirname( dirname(__FILE__) ) . '/social-plugins.php' ); $send_button_html = facebook_get_send_button( $instance ); if ( ! ( is_string( $send_button_html ) && $send_button_html ) ) return; echo $before_widget; $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); if ( $title ) echo $before_title . $title . $after_title; echo $send_button_html; echo $after_widget; } /** * Sanitize widget form values as they are saved. * * @see WP_Widget::update() * * @since 1.0 * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * * @return array Updated safe values to be saved. */ public function update( $new_instance, $old_instance ) { $instance = array(); $new_instance = (array) $new_instance; if ( ! empty( $new_instance['title'] ) ) $instance['title'] = strip_tags( $new_instance['title'] ); if ( ! class_exists( 'Facebook_Send_Button' ) ) require_once( dirname( dirname(__FILE__) ) . '/class-facebook-send-button.php' ); $send_button = Facebook_Send_Button::fromArray( $new_instance ); if ( $send_button ) { return array_merge( $instance, $send_button->toHTMLDataArray() ); } return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @since 1.0 * * @param array $instance Previously saved values from database. * @return void */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'href' => '', 'font' => '', 'colorscheme' => 'light' ) ); $this->display_title( $instance['title'] ); $this->display_href( $instance['href'] ); if ( ! class_exists( 'Facebook_Send_Button_Settings' ) ) require_once( dirname( dirname( dirname(__FILE__) ) ) . '/admin/settings-send-button.php' ); $send_button_settings = new Facebook_Send_Button_Settings( $instance ); echo '
' . esc_html( __( 'Default: URL of the displayed page', 'facebook' ) ) . '
'; } } ?>