function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $url = $instance['url']; $width = $instance['width']; $width = $width ? $width : 250; $rows = $instance['rows']; $rows = $rows ? $rows : 4; $url = $url ? $url : rawurlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); $locale = wdfb_get_locale(); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<iframe src="' . WDFB_PROTOCOL . 'www.facebook.com/plugins/facepile.php?href=' . $url . '&width=' . $width . '&locale=' . $locale . '&max_rows=' . $rows . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px;" allowTransparency="true"></iframe>'; echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $width = $instance['width']; $width = $width ? $width : 250; $height = $instance['height']; $height = $height ? $height : 250; $show_header = (int) @$instance['show_header']; $show_header = $show_header ? 'true' : 'false'; $color_scheme = $instance['color_scheme']; $color_scheme = $color_scheme ? $color_scheme : 'light'; $url = get_option('siteurl'); $locale = wdfb_get_locale(); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<iframe src="' . WDFB_PROTOCOL . 'www.facebook.com/plugins/recommendations.php?site=' . $url . '&width=' . $width . '&height=' . $height . '&locale=' . $locale . '&header=' . $show_header . '&colorscheme=' . $color_scheme . '&font&border_color" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px; height:' . $height . 'px;" allowTransparency="true"></iframe>'; echo $after_widget; }
function js_load_scripts() { wp_enqueue_script('jquery'); $locale = wdfb_get_locale(); if (function_exists('get_current_screen')) { $screen = get_current_screen(); if (is_object($screen) && isset($screen->id) && in_array($screen->id, apply_filters('wdfb-scripts-prevent_inclusion_ids', array()))) { return false; } } define('WDFB_ROOT_SCRIPT_ADDED', true, true); wp_enqueue_script('facebook-all', WDFB_PROTOCOL . 'connect.facebook.net/' . $locale . '/all.js'); //wp_enqueue_script('wdfb_post_as_page', WDFB_PLUGIN_URL . '/js/wdfb_post_as_page.js'); // Deprecated }
echo is_ssl() ? 'http:' : 'https:'; ?> //www.facebook.com/plugins/registration.php?<?php echo $force; ?> client_id=<?php echo $this->data->get_option('wdfb_api', 'app_key'); ?> &redirect_uri=<?php echo urlencode($redirect_url); ?> &fields=<?php echo wdfb_get_registration_fields(); ?> &locale=<?php echo wdfb_get_locale(); ?> " scrolling="auto" frameborder="no" style="border:none" allowTransparency="true" width="100%" height="530"> </iframe> </div> <?php //if ($this->data->get_option('wdfb_connect', 'force_facebook_registration')) get_footer(); get_footer();
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $width = $instance['width']; $width = $width ? $width : 250; $height = $instance['height']; $url = rawurlencode($instance['url']); $show_header = (int) @$instance['show_header']; $show_header = $show_header ? 'true' : 'false'; $show_faces = (int) @$instance['show_faces']; $show_faces = $show_faces ? 'true' : 'false'; $show_stream = (int) @$instance['show_stream']; $show_stream = $show_stream ? 'true' : 'false'; $hide_if_logged_out = (int) @$instance['hide_if_logged_out']; $color_scheme = $instance['color_scheme']; $color_scheme = $color_scheme ? $color_scheme : 'light'; $height = $height ? $height : ('true' == $show_stream || 'true' == $show_faces ? 427 : 62); $locale = wdfb_get_locale(); $id = "wdfb-likebox-" . md5(microtime()); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<iframe id="' . $id . '" src="' . WDFB_PROTOCOL . 'www.facebook.com/plugins/likebox.php?href=' . $url . '&width=' . $width . '&locale=' . $locale . '&colorscheme=' . $color_scheme . '&show_faces=' . $show_faces . '&stream=' . $show_stream . '&header=' . $show_header . '&height=' . $height . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px; height:' . $height . 'px;" allowTransparency="true"></iframe>'; if ($hide_if_logged_out) { $hide_js = <<<EOWdfbLikeBoxHidingJs <script type="text/javascript"> (function (\$) { \$(function () { FB.getLoginStatus(function(response) { if (response.status != 'connected') \$('#{$id}').parents(".widget").remove(); }); }); })(jQuery); </script> EOWdfbLikeBoxHidingJs; echo apply_filters('wdfb-widgets-likebox-hide_js', $hide_js, $id); } echo $after_widget; }
/** * Dashboard permissions widget function. */ function wdfb_dashboard_permissions_widget() { echo '<div class="wdfb_perms_root" style="display:none">' . '<p class="wdfb_perms_granted">' . '<span class="wdfb_message">' . __('You already granted extended permissions', 'wdfb') . '</span> ' . '</p>' . '<p class="wdfb_perms_not_granted">' . '<a href="#" class="wdfb_grant_perms" data-wdfb_locale="' . wdfb_get_locale() . '" data-wdfb_perms="' . Wdfb_Permissions::get_permissions() . '">' . __('Grant extended permissions', 'wdfb') . '</a>' . '</p>' . '</div>'; echo '<script type="text/javascript" src="' . WDFB_PLUGIN_URL . '/js/check_permissions.js"></script>'; }
function inject_fb_init_js() { if (defined('WDFB_FB_ASYNC_INIT') && WDFB_FB_ASYNC_INIT) { $locale = wdfb_get_locale(); echo '<script> window.fbAsyncInit = function() { FB.init({ appId: "' . trim($this->data->get_option('wdfb_api', 'app_key')) . '", status: true, cookie: true, xfbml: true, oauth: true }); }; (function(d, debug){ var js, id = "facebook-jssdk", ref = d.getElementsByTagName("script")[0]; if (d.getElementById(id)) {return;} js = d.createElement("script"); js.id = id; js.async = true; js.src = "//connect.facebook.net/' . $locale . '/all" + (debug ? "/debug" : "") + ".js"; ref.parentNode.insertBefore(js, ref); }(document, /*debug*/ false)); </script>'; } else { if (!defined('WDFB_INTERNAL_FLAG_FB_SCRIPT_INCLUDED')) { $this->js_load_scripts(); } echo "<script type='text/javascript'>\r\n\t FB.init({\r\n\t appId: '" . trim($this->data->get_option('wdfb_api', 'app_key')) . "',\r\n\t status: true,\r\n\t cookie: true,\r\n\t xfbml: true,\r\n\t oauth: true\r\n\t });\r\n\t </script>"; } }
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?&href=" . rawurlencode($href) . "&send=false&layout={$layout}&show_faces=false&action=like&colorscheme={$scheme}&font&height={$height}&width={$width}&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>'; }
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 facebook_publishing_metabox() { global $post; $opt = $this->_get_option('wdfb_autopost'); $is_published = get_post_meta($post->ID, 'wdfb_published_on_fb', true); if ($is_published) { echo '<div style="margin: 5px 0 15px; background-color: #FFFFE0; border-color: #E6DB55; border-radius: 3px 3px 3px 3px; border-style: solid; border-width: 1px; padding: 0 0.6em;">' . '<p>' . __("This post has already been published on Facebook", 'wdfb') . '</p>' . '</div>'; } $stored = get_post_meta($post->ID, 'wdfb_scheduled_publish', true); $stored = is_array($stored) ? $stored : array(); $title = !empty($stored['wdfb_metabox_publishing_title']) ? $stored['wdfb_metabox_publishing_title'] : ''; $stored_publish = !empty($stored['wdfb_metabox_publishing_publish']); $stored_publishing_user = !empty($stored['wdfb_metabox_publishing_account']) ? $stored['wdfb_metabox_publishing_account'] : ''; echo '<div>'; echo '<label for="">' . __('Publish on Facebook with different title:', 'wdfb') . '</label>'; echo '<input type="text" class="widefat" name="wdfb_metabox_publishing_title" id="wdfb_metabox_publishing_title" value="' . esc_attr($title) . '" />'; echo __('<p><small>Leave this value blank to use the post title.</small></p>', 'wdfb'); echo '</div>'; if (!@$opt['allow_autopost']) { echo '<div>'; echo ' <input type="checkbox" name="wdfb_metabox_publishing_publish" id="wdfb_metabox_publishing_publish" value="1" ' . checked($stored_publish, true, false) . ' />'; echo ' <label for="wdfb_metabox_publishing_publish">' . __('I want to publish this post to Facebook', 'wdfb') . '</label>'; echo __('<p><small>If checked, the post will be unconditionally published on Facebook</small></p>', 'wdfb'); echo '</div>'; echo '<div class="wdfb_perms_not_granted" style="display:none">' . '<div class="error below-h2">' . '<p>' . __("Your app doesn't have enough permissions to publish on Facebook", 'wdfb') . '<br />' . '<a class="wdfb_grant_perms" href="#" data-wdfb_perms="' . Wdfb_Permissions::get_publisher_permissions() . '" data-wdfb_locale="' . wdfb_get_locale() . '" >' . __('Grant needed permissions now', 'wdfb') . '</a>' . '</p>' . '</div>' . '</div>'; $user = wp_get_current_user(); $fb_accounts = $this->_get_api_accounts($user->ID); /* $fb_accounts = get_user_meta($user->ID, 'wdfb_api_accounts', true); $fb_accounts = isset($fb_accounts['auth_accounts']) ? $fb_accounts['auth_accounts'] : array(); */ if ($fb_accounts) { echo '<div>'; echo ' <label for="wdfb_metabox_publishing_account">' . __('Publish to wall of this Facebook account:', 'wdfb') . '</label>'; echo ' <select name="wdfb_metabox_publishing_account" id="wdfb_metabox_publishing_account">'; foreach ($fb_accounts as $aid => $aval) { $selected = selected($stored_publishing_user, $aid, false); echo "<option value='{$aid}' {$selected}>{$aval}</option>"; } echo ' </select>'; echo '<br />'; echo '<label for="post_as_page">' . __("If posting to a page, post <b>AS</b> page", "wdfb") . '</label> ' . '<input type="checkbox" name="wdfb_post_as_page" id="post_as_page" value="1" />'; echo '</div>'; echo '<p class="wdfb_perms_not_granted"><small>' . __('Please make sure that you granted extended permissions to your Facebook App', 'wdfb') . '</small></p>'; } } echo '<script type="text/javascript" src="' . WDFB_PLUGIN_URL . '/js/check_permissions.js"></script>'; }
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}&app_id={$key}&site={$url}&width={$width}&height={$height}&header={$show_header}&colorscheme={$color_scheme}&linktarget={$links}&locale={$locale}&border_color&font&recommendations={$recommendations}&appId={$key}' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:{$width}px; height:{$height}px;' allowTransparency='true'></iframe>"; } echo $after_widget; }