function inject_fb_comments($defaults)
 {
     if (!comments_open() && !$this->data->get_option('wdfb_comments', 'override_wp_comments_settings')) {
         return $defaults;
     }
     $link = get_permalink();
     $xid = rawurlencode($link);
     $width = (int) $this->data->get_option('wdfb_comments', 'fb_comments_width');
     $width = $width ? $width : '550';
     $num_posts = (int) $this->data->get_option('wdfb_comments', 'fb_comments_number');
     $reverse = $this->data->get_option('wdfb_comments', 'fb_comments_reverse') ? 'true' : 'false';
     $scheme = $this->data->get_option('wdfb_comments', 'fb_color_scheme');
     $scheme = $scheme ? $scheme : 'light';
     echo wdfb_get_fb_plugin_markup('comments', compact(array('link', 'xid', 'num_posts', 'width', 'reverse', 'scheme')));
     return $defaults;
 }
 function process_like_button_code($atts, $content = '')
 {
     global $wp_current_filter;
     // Check allowed
     $allow = $this->data->get_option('wdfb_button', 'allow_facebook_button');
     if (!apply_filters('wdfb-show_facebook_button', $allow)) {
         return '';
     }
     // Check nesting (i.e. posts within post, reformatted with apply_filters)
     $filters = array_count_values($wp_current_filter);
     if (isset($filters['the_content']) && $filters['the_content'] > 1) {
         return '';
     }
     $atts = shortcode_atts(array('forced' => false), $atts);
     $forced = $atts['forced'] && 'no' != $atts['forced'] ? true : false;
     $in_types = $this->data->get_option('wdfb_button', 'not_in_post_types');
     $in_types = is_array($in_types) ? $in_types : array();
     $post_type = get_post_type();
     if ($post_type && in_array(get_post_type(), $in_types) && !$forced) {
         return '';
     }
     $is_activity = defined('BP_VERSION') && isset($filters['bp_get_activity_content_body']);
     if ($is_activity && !@in_array('_buddypress_activity', $in_types)) {
         return '';
     }
     // Reverse logic for BuddyPress Activity check.
     $send = $this->data->get_option('wdfb_button', 'show_send_button');
     $layout = $this->data->get_option('wdfb_button', 'button_appearance');
     $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     /*
     		$width = ("standard" == $layout) ? 300 : (
     			("button_count" == $layout) ? 150 : 60
     		);
     */
     $width = 450;
     $width = apply_filters('wdfb-like_button-width', $width);
     $scheme = $this->data->get_option('wdfb_button', 'color_scheme');
     $scheme = $scheme ? $scheme : 'light';
     if (is_home() && $this->data->get_option('wdfb_button', 'show_on_front_page') || is_archive() && $this->data->get_option('wdfb_button', 'show_on_archive_page') || defined('BP_VERSION') && $is_activity && !wdfb_is_single_bp_activity()) {
         $tmp_url = $is_activity && function_exists('bp_activity_get_permalink') ? bp_activity_get_permalink(bp_get_activity_id()) : (in_the_loop() ? get_permalink() : false);
         $href = !empty($tmp_url) ? $tmp_url : $url;
         $locale = wdfb_get_locale();
         $height = "box_count" == $layout ? 60 : 25;
         $height = apply_filters('wdfb-like_button-height', $height);
         $use_xfbml = false;
         if (defined('BP_VERSION') && $is_activity && !wdfb_is_single_bp_activity() && $this->data->get_option('wdfb_button', 'bp_activity_xfbml') || is_home() && $this->data->get_option('wdfb_button', 'show_on_front_page') && $this->data->get_option('wdfb_button', 'shared_pages_use_xfbml') || is_archive() && $this->data->get_option('wdfb_button', 'show_on_archive_page') && $this->data->get_option('wdfb_button', 'shared_pages_use_xfbml')) {
             $use_xfbml = true;
         }
         $href = apply_filters('wdfb-like_button-href_attribute', WDFB_PROTOCOL . preg_replace('/^https?:\\/\\//', '', $href));
         return $use_xfbml ? '<div class="wdfb_like_button">' . wdfb_get_fb_plugin_markup('like', compact(array('href', 'send', 'layout', 'width', 'scheme'))) . '</div>' : "<div class='wdfb_like_button'><iframe src='http://www.facebook.com/plugins/like.php?&amp;href=" . rawurlencode($href) . "&amp;send=false&amp;layout={$layout}&amp;show_faces=false&amp;action=like&amp;colorscheme={$scheme}&amp;font&amp;height={$height}&amp;width={$width}&amp;locale={$locale}' scrolling='no' frameborder='0' style='border:none; overflow:hidden; height:{$height}px; width:{$width}px;' allowTransparency='true'></iframe></div>";
     }
     $href = apply_filters('wdfb-like_button-href_attribute', WDFB_PROTOCOL . preg_replace('/^https?:\\/\\//', '', $url));
     return '<div class="wdfb_like_button">' . wdfb_get_fb_plugin_markup('like', compact(array('href', 'send', 'layout', 'width', 'scheme'))) . '</div>';
 }
/**
 * Template tag for FB comments.
 * @return string Facebook comments markup.
 * @example
 * <code>
 * // In e.g. single.php
 * if (function_exists('wdfb_get_fb_comments')) echo wdfb_get_fb_comments();
 * </code>
 */
function wdfb_get_fb_comments()
{
    $data = Wdfb_OptionsRegistry::get_instance();
    $link = get_permalink();
    $xid = rawurlencode($link);
    $width = (int) $data->get_option('wdfb_comments', 'fb_comments_width');
    $width = $width ? $width : '550';
    $num_posts = (int) $data->get_option('wdfb_comments', 'fb_comments_number');
    $reverse = $data->get_option('wdfb_comments', 'fb_comments_reverse') ? 'true' : 'false';
    $scheme = $data->get_option('wdfb_comments', 'fb_color_scheme');
    $scheme = $scheme ? $scheme : 'light';
    return wdfb_get_fb_plugin_markup('comments', compact(array('link', 'xid', 'num_posts', 'width', 'reverse', 'scheme')));
}
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $register = (int) @$instance['register'];
        $width = $instance['width'];
        $width = $width ? $width : 250;
        $avatar_size = $instance['avatar_size'];
        $avatar_size = $avatar_size ? $avatar_size : 32;
        $opts = Wdfb_OptionsRegistry::get_instance();
        $register = $register && get_option('users_can_register') ? $register : false;
        if ($opts->get_option('wdfb_connect', 'allow_facebook_registration')) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            $user = wp_get_current_user();
            if (!$user->ID) {
                if (!$register) {
                    // Do the simple thing first
                    echo '<p class="wdfb_login_button">' . wdfb_get_fb_plugin_markup('login-button', array('scope' => Wdfb_Permissions::get_permissions(), 'redirect-url' => wdfb_get_login_redirect(), 'content' => __("Login with Facebook", 'wdfb'))) . '</p>';
                } else {
                    $fields = wdfb_get_registration_fields();
                    $force = $opts->get_option('wdfb_connect', 'force_facebook_registration') && $opts->get_option('wdfb_connect', 'require_facebook_account') ? 'fb_only=true&' : '';
                    echo '<div class="wdfb_connect_widget_container">';
                    echo '	<div class="wdfb_connect_widget_tabs"><ul class="wdfb_connect_widget_action_links">';
                    echo '		<li><a href="#wdfb_connect_widget_login"><span>' . __("Login", 'wdfb') . '</span></a></li>';
                    echo '		<li><a href="#wdfb_connect_widget_register"><span>' . __("Register", 'wdfb') . '</span></a></li>';
                    echo '	</ul></div>';
                    echo '	<div style="clear:both"></div>';
                    echo '	<div class="wdfb_connect_target" id="wdfb_connect_widget_login">';
                    echo '		<p class="wdfb_login_button">' . wdfb_get_fb_plugin_markup('login-button', array('scope' => Wdfb_Permissions::get_permissions(), 'redirect-url' => wdfb_get_login_redirect(), 'content' => __("Login with Facebook", 'wdfb'))) . '</p>';
                    echo '	</div>';
                    echo '	<div class="wdfb_connect_target" id="wdfb_connect_widget_register">';
                    echo '	<iframe src="' . WDFB_PROTOCOL . 'www.facebook.com/plugins/registration.php?' . $force . 'client_id=' . trim($opts->get_option('wdfb_api', 'app_key')) . '&' . 'redirect_uri=' . urlencode(site_url('/wp-signup.php?action=register&fb_register=1')) . '&' . 'fields=' . $fields . '&width=' . $width . '&locale=' . wdfb_get_locale() . '"
						        scrolling="auto"
						        frameborder="no"
						        style="border:none; overflow:hidden; width:' . $width . 'px;"
						        allowTransparency="true"
						        width="' . $width . '"
						        height="650">
							</iframe>';
                    echo '	</div>';
                    echo '</div>';
                }
            } else {
                //$logout = site_url('wp-login.php?action=logout&redirect_to=' . rawurlencode(home_url()));
                $logout = wp_logout_url(home_url());
                // Props jmoore2026
                echo get_avatar($user->ID, $avatar_size);
                echo "<p><a href='{$logout}'>" . __('Log out', 'wdfb') . "</a></p>";
            }
            echo $after_widget;
        }
    }
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $width = (int) $instance['width'];
     $width = $width ? $width : 300;
     $height = (int) $instance['height'];
     $height = $height ? $height : 300;
     $url = $instance['url'];
     $url = $url ? $url : parse_url(site_url(), PHP_URL_HOST);
     $show_header = (int) @$instance['show_header'];
     $show_header = $show_header ? 'true' : 'false';
     $recommendations = (int) @$instance['recommendations'];
     $recommendations = $recommendations ? 'true' : 'false';
     $filter = @$instance['filter'];
     $color_scheme = $instance['color_scheme'];
     $color_scheme = $color_scheme ? $color_scheme : 'light';
     $links = $instance['links'];
     $links = $links ? $links : '_blank';
     $iframe = (int) $instance['iframe'];
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if (!$iframe) {
         echo wdfb_get_fb_plugin_markup('activity', compact(array('url', 'width', 'height', 'recommendations', 'links', 'color_scheme')));
     } else {
         $data = Wdfb_OptionsRegistry::get_instance();
         $key = $data->get_option('wdfb_api', 'app_key');
         $locale = wdfb_get_locale();
         echo "<iframe src='//www.facebook.com/plugins/activity.php?api_key={$key}&amp;app_id={$key}&amp;site={$url}&amp;width={$width}&amp;height={$height}&amp;header={$show_header}&amp;colorscheme={$color_scheme}&amp;linktarget={$links}&amp;locale={$locale}&amp;border_color&amp;font&amp;recommendations={$recommendations}&amp;appId={$key}' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:{$width}px; height:{$height}px;' allowTransparency='true'></iframe>";
     }
     echo $after_widget;
 }