'Amazon Master Buttons', 'description' => __('Sell even more by linking your wordpress to your Amazon Profile. ', 'amazon_master') );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'amazon_master_widget_buttons' );
parent::__construct( 'amazon_master_widget_buttons', __('Amazon Master Deals', 'amazon_master'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
//Our variables from the widget settings.
$amazon_title = isset( $instance['amazon_title'] ) ? $instance['amazon_title'] :false;
$amazon_title_new = isset( $instance['amazon_title_new'] ) ? $instance['amazon_title_new'] :false;
$amazonspacer ="'";
$url_loc = plugins_url();
$show_amazonbutton = isset( $instance['show_amazonbutton'] ) ? $instance['show_amazonbutton'] :false;
$amazonbutton_page = $instance['amazonbutton_page'];
echo $before_widget;
// Display the widget title
if ( $amazon_title ){
if (empty ($amazon_title_new)){
if(is_multisite()){
$amazon_title_new = get_site_option('amazon_master_name');
}
else{
$amazon_title_new = get_option('amazon_master_name');
}
echo $before_title . $amazon_title_new . $after_title;
}
else{
echo $before_title . $amazon_title_new . $after_title;
}
}
else{
}
//Display Amazon Profile Button
if ( $show_amazonbutton ){
echo '
';
}
else{
}
echo $after_widget;
}
//Update the widget
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['amazon_title'] = strip_tags( $new_instance['amazon_title'] );
$instance['amazon_title_new'] = $new_instance['amazon_title_new'];
$instance['show_amazonbutton'] = $new_instance['show_amazonbutton'];
$instance['amazonbutton_page'] = $new_instance['amazonbutton_page'];
return $instance;
}
function form( $instance ) {
//Set up some default widget settings.
$defaults = array( 'amazon_title_new' => __('Amazon Master', 'amazon_master'), 'amazon_title' => true, 'amazon_title_new' => false, 'show_amazonbutton' => false, 'amazonbutton_page' => false );
$instance = wp_parse_args( (array) $instance, $defaults );
?>
Check the buttons to be displayed:
id="get_field_id( 'amazon_title' ); ?>" name="get_field_name( 'amazon_title' ); ?>" />
id="get_field_id( 'show_amazonbutton' ); ?>" name="get_field_name( 'show_amazonbutton' ); ?>" />
Amazon Master Website