Enable Widget | Settings] Version: .9.9.1 Author: AddToAny Author URI: http://www.addtoany.com/ */ if( !isset($A2A_locale) ) $A2A_locale = ''; // WordPress MU? if ( basename(dirname(__FILE__)) == "mu-plugins" ) $A2A_wpmu = TRUE; else $A2A_wpmu = FALSE; // Pre-2.6 compatibility if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); if ( ! defined( 'WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' ); $A2A_SUBSCRIBE_plugin_basename = plugin_basename(dirname(__FILE__)); if ( $A2A_wpmu ) $A2A_SUBSCRIBE_plugin_url_path = WPMU_PLUGIN_URL.'/add-to-any-subscribe'; else $A2A_SUBSCRIBE_plugin_url_path = WP_PLUGIN_URL.'/'.$A2A_SUBSCRIBE_plugin_basename; // /wp-content/plugins/add-to-any-subscribe // Fix SSL if (function_exists('is_ssl') && is_ssl()) // @since 2.6.0 $A2A_SUBSCRIBE_plugin_url_path = str_replace('http:', 'https:', $A2A_SUBSCRIBE_plugin_url_path); function A2A_SUBSCRIBE_textdomain() { global $A2A_SUBSCRIBE_plugin_url_path, $A2A_SUBSCRIBE_plugin_basename; load_plugin_textdomain('add-to-any-subscribe', $A2A_SUBSCRIBE_plugin_url_path.'/languages', $A2A_SUBSCRIBE_plugin_basename.'/languages'); } add_action('init', 'A2A_SUBSCRIBE_textdomain'); class Add_to_Any_Subscribe_Widget extends WP_Widget { /** constructor */ function Add_to_Any_Subscribe_Widget() { parent::WP_Widget('', 'AddToAny Subscribe Button', array('description' => 'A button to help people subscribe to your blog using any service'), array('width' => 400)); } /** Backwards compatibility for Add_to_Any_Subscribe_Widget::display(); usage */ function display( $args = false ) { self::widget($args, NULL); } /** @see WP_Widget::widget */ function widget($args = array(), $instance) { global $A2A_SUBSCRIBE_plugin_url_path; $defaults = array( 'feedname' => get_bloginfo('name'), 'feedname_enc' => '', 'feedurl' => get_bloginfo('rss2_url'), '$feedurl_enc' => '', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ); $args = wp_parse_args( $args, $defaults ); extract( $args ); $feedname = ($feedname=='') ? 'Blog' : $feedname ; // Blog name cannot be blank for A2A $feedname_enc = rawurlencode( $feedname ); $feedurl_enc = rawurlencode( $feedurl ); $style = ''; $button_target = (get_option('A2A_SUBSCRIBE_button_opens_new_window')=='1' && (get_option('A2A_SUBSCRIBE_onclick')!='1')) ? ' target="_blank"' : ''; if( !get_option('A2A_SUBSCRIBE_button') ) { $button_fname = 'subscribe_120_16.png'; $button_width = ' width="120"'; $button_height = ' height="16"'; $button_src = $A2A_SUBSCRIBE_plugin_url_path.'/'.$button_fname; } else if( get_option('A2A_SUBSCRIBE_button') == 'CUSTOM' ) { $button_src = get_option('A2A_SUBSCRIBE_button_custom'); $button_width = ''; $button_height = ''; } else if( get_option('A2A_SUBSCRIBE_button') == 'TEXT' ) { $button_text = stripslashes(get_option('A2A_SUBSCRIBE_button_text')); } else { $button_attrs = explode( '|', get_option('A2A_SUBSCRIBE_button') ); $button_fname = $button_attrs[0]; $button_width = ' width="'.$button_attrs[1].'"'; $button_height = ' height="'.$button_attrs[2].'"'; $button_src = $A2A_SUBSCRIBE_plugin_url_path.'/'.$button_fname; $button_text = stripslashes(get_option('A2A_SUBSCRIBE_button_text')); } if( isset($button_fname) && $button_fname == 'subscribe_16_16.png' ) { if( !is_feed() ) { $style_bg = 'background:url('.$A2A_SUBSCRIBE_plugin_url_path.'/'.$button_fname.') no-repeat scroll 9px 0px'; // padding-left:9 (9=other icons padding) $style_bg = ';' . $style_bg . ' !important;'; $style = ' style="'.$style_bg.'padding:0 0 0 30px;display:inline-block;height:16px;line-height:16px;vertical-align:middle;"'; // padding-left:30+9 (9=other icons padding) } } if( isset($button_text) && ( ! isset($button_fname) || $button_fname == 'subscribe_16_16.png') ) { $button = $button_text; } else { $style = ''; $button = 'Subscribe'; } echo $before_widget; if( trim(get_option('A2A_SUBSCRIBE_widget_title')) != "" ) { echo $before_title . stripslashes(get_option('A2A_SUBSCRIBE_widget_title')) . $after_title; } ?> > " . ''; $A2A_SUBSCRIBE_external_script_called = true; } else { $external_script_call = 'a2a.init("feed");\n//]]>'; $initial_js = ''; } $button_javascript = "\n" . '