Version Description
- Fixed bug where plugin wouldn't rerender
- Fixed bug with languages XML file not loading on installs where the admin is not wp-admin
Download this release
Release Info
Developer | cameronjonesweb |
Plugin | Responsive Facebook Page Plugin |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.2 to 1.5.1
- facebook-page-feed-graph-api.php +207 -152
- js/responsive.js +36 -0
- js/responsive.min.js +1 -0
- readme.txt +13 -2
facebook-page-feed-graph-api.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Facebook Page Plugin
|
4 |
* Plugin URI: https://cameronjones.x10.mx/projects/facebook-page-plugin
|
5 |
* Description: It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 95 different languages
|
6 |
-
* Version: 1.
|
7 |
* Author: Cameron Jones
|
8 |
* Author URI: http://cameronjones.x10.mx
|
9 |
* License: GPLv2
|
@@ -22,136 +22,159 @@
|
|
22 |
|
23 |
defined( 'ABSPATH' ) or die();
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
'
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$return .= ' data-width="' . $a['width'] . '"';
|
58 |
-
}
|
59 |
-
if(isset($a['height']) && !empty($a['height'])){
|
60 |
-
$return .= ' data-height="' . $a['height'] . '"';
|
61 |
-
}
|
62 |
-
if(isset($a['cover']) && !empty($a['cover'])){
|
63 |
-
if($a['cover'] == "false"){
|
64 |
-
$return .= ' data-hide-cover="true"';
|
65 |
-
} else if($a['cover'] == "true"){
|
66 |
-
$return .= ' data-hide-cover="false"';
|
67 |
-
}
|
68 |
-
}
|
69 |
-
if(isset($a['facepile']) && !empty($a['facepile'])){
|
70 |
-
$return .= ' data-show-facepile="' . $a['facepile'] . '"';
|
71 |
-
}
|
72 |
-
if(isset($a['tabs']) && !empty($a['tabs'])){
|
73 |
-
$return .= ' data-tabs="' . $a['tabs'] . '"';
|
74 |
-
} else if(isset($a['posts']) && !empty($a['posts'])){
|
75 |
-
if($a['posts'] == 'true'){
|
76 |
-
$return .= ' data-tabs="timeline"';
|
77 |
-
} else {
|
78 |
-
$return .= ' data-tabs="false"';
|
79 |
}
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
} else {
|
90 |
-
$return .= ' data-adapt-container-width="false"';
|
91 |
-
}
|
92 |
-
$return .= '><div class="fb-xfbml-parse-ignore">';
|
93 |
-
if( $a['link'] == 'true' ){
|
94 |
-
$return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
|
95 |
-
$return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
|
96 |
-
if( empty( $a['linktext'] ) ) {
|
97 |
-
$return .= 'https://www.facebook.com/' . $a['href'];
|
98 |
-
} else {
|
99 |
-
$return .= $a['linktext'];
|
100 |
-
}
|
101 |
-
$return .= '</a>';
|
102 |
-
$return .= '</blockquote>';
|
103 |
}
|
104 |
-
$return .= '</div></div>';
|
105 |
}
|
106 |
-
return $return;
|
107 |
-
}
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
}catch(Exception $ex){
|
118 |
-
$lang_xml = NULL;
|
119 |
}
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
$
|
124 |
}
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
-
|
145 |
-
|
146 |
-
echo '</form>';
|
147 |
-
}
|
148 |
|
149 |
-
function facebook_page_plugin_admin_resources() {
|
150 |
-
wp_enqueue_script( 'Facebook Page Plugin Admin Scripts', plugin_dir_url( __FILE__ ) . '/js/facebook-page-plugin-admin.js' );
|
151 |
-
wp_enqueue_style( 'Facebook Page Plugin Admin Styles', plugin_dir_url( __FILE__ ) . '/css/facebook-page-plugin-admin.css' );
|
152 |
}
|
153 |
|
154 |
-
class
|
155 |
|
156 |
private $facebookURLs = array('https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/');
|
157 |
|
@@ -337,17 +360,9 @@ class facebook_page_plugin_widget extends WP_Widget {
|
|
337 |
} else {
|
338 |
$language = '';
|
339 |
}
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
} catch( Exception $ex ) {
|
344 |
-
$lang_xml = NULL;
|
345 |
-
}
|
346 |
-
if(isset($lang_xml) && !empty($lang_xml)){
|
347 |
-
$langs = new SimpleXMLElement($lang_xml);
|
348 |
-
} else {
|
349 |
-
$langs = NULL;
|
350 |
-
}
|
351 |
echo '<p>';
|
352 |
echo '<label for="' . $this->get_field_id( 'title' ) . '">';
|
353 |
_e( 'Title:', 'facebook-page-feed-graph-api' );
|
@@ -456,34 +471,74 @@ class facebook_page_plugin_widget extends WP_Widget {
|
|
456 |
}
|
457 |
} // Class wpb_widget ends here
|
458 |
|
459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
function facebook_page_plugin_load_widget() {
|
461 |
-
register_widget( '
|
462 |
}
|
|
|
463 |
|
464 |
-
function
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
475 |
}
|
476 |
-
}
|
477 |
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
update_user_meta($user_id, 'facebook_page_plugin_admin_notice_ignore', 'true', true);
|
483 |
}
|
|
|
|
|
484 |
}
|
485 |
|
486 |
-
|
487 |
-
$links[] = '<a href="https://profiles.wordpress.org/cameronjonesweb/#content-plugins" target="_blank">More plugins by cameronjonesweb</a>';
|
488 |
-
return $links;
|
489 |
-
}
|
3 |
* Plugin Name: Facebook Page Plugin
|
4 |
* Plugin URI: https://cameronjones.x10.mx/projects/facebook-page-plugin
|
5 |
* Description: It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 95 different languages
|
6 |
+
* Version: 1.5.1
|
7 |
* Author: Cameron Jones
|
8 |
* Author URI: http://cameronjones.x10.mx
|
9 |
* License: GPLv2
|
22 |
|
23 |
defined( 'ABSPATH' ) or die();
|
24 |
|
25 |
+
class cameronjonesweb_facebook_page_plugin {
|
26 |
+
|
27 |
+
public function __construct() {
|
28 |
+
|
29 |
+
define( 'CJW_FBPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
30 |
+
define( 'CJW_FBPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
31 |
+
define( 'CJW_FBPP_PLUGIN_VER', '1.5.0' );
|
32 |
+
|
33 |
+
//Add all the hooks and actions
|
34 |
+
add_shortcode( 'facebook-page-plugin', array( $this, 'facebook_page_plugin' ) );
|
35 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
36 |
+
add_action( 'wp_dashboard_setup', array( $this, 'facebook_page_plugin_dashboard_widget' ) );
|
37 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'facebook_page_plugin_admin_resources' ) );
|
38 |
+
add_action( 'admin_notices', array( $this, 'facebook_page_plugin_admin_notice' ) );
|
39 |
+
add_action( 'admin_init', array( $this, 'facebook_page_plugin_admin_notice_ignore' ) );
|
40 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'facebook_page_plugin_action_links' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
//Admin functions
|
45 |
+
//Display review notice
|
46 |
+
public function facebook_page_plugin_admin_notice() {
|
47 |
+
$screen = get_current_screen();
|
48 |
+
//Only display on the dashboard, widgets and plugins pages
|
49 |
+
if( $screen->base === 'widgets' || $screen->base === 'dashboard' || $screen->base === 'plugins' ){
|
50 |
+
global $current_user ;
|
51 |
+
$user_id = $current_user->ID;
|
52 |
+
//Don't show if they have hidden it
|
53 |
+
if ( !get_user_meta( $user_id, 'facebook_page_plugin_admin_notice_ignore' ) || get_user_meta( $user_id, 'facebook_page_plugin_admin_notice_ignore' ) === false ) {
|
54 |
+
echo '<div class="updated" id="facebook-page-plugin-review"><p>';
|
55 |
+
echo __( 'Thank you for using the Facebook Page Plugin. If you enjoy using it, please take the time to', 'facebook-page-feed-graph-api' ) . ' <a href="https://wordpress.org/support/view/plugin-reviews/facebook-page-feed-graph-api?rate=5#postform" target="_blank">' . __( 'leave a review', 'facebook-page-feed-graph-api' ) . '</a>. ' . __( 'Thanks', 'facebook-page-feed-graph-api' );
|
56 |
+
echo '<a href="?facebook_page_plugin_admin_notice_ignore=0" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss this notice', 'facebook-page-feed-graph-api' ) . '.</span></a></p></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
59 |
+
}
|
60 |
+
|
61 |
+
//Handler function for when review notice is hidden
|
62 |
+
public function facebook_page_plugin_admin_notice_ignore() {
|
63 |
+
global $current_user;
|
64 |
+
$user_id = $current_user->ID;
|
65 |
+
if ( isset($_GET['facebook_page_plugin_admin_notice_ignore']) && '0' == $_GET['facebook_page_plugin_admin_notice_ignore'] ) {
|
66 |
+
update_user_meta($user_id, 'facebook_page_plugin_admin_notice_ignore', 'true', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
|
|
68 |
}
|
|
|
|
|
69 |
|
70 |
+
//Add link on plugins page to my plugins directory
|
71 |
+
public function facebook_page_plugin_action_links( $links ) {
|
72 |
+
$links[] = '<a href="https://profiles.wordpress.org/cameronjonesweb/#content-plugins" target="_blank">More plugins by cameronjonesweb</a>';
|
73 |
+
return $links;
|
74 |
+
}
|
75 |
|
76 |
+
//Enqueue CSS and JS for admin
|
77 |
+
public function facebook_page_plugin_admin_resources() {
|
78 |
+
wp_enqueue_script( 'facebook-page-plugin-admin-scripts', CJW_FBPP_PLUGIN_URL . 'js/facebook-page-plugin-admin.js' );
|
79 |
+
wp_enqueue_style( 'facebook-page-plugin-admin-styles', CJW_FBPP_PLUGIN_URL . 'css/facebook-page-plugin-admin.css' );
|
|
|
|
|
80 |
}
|
81 |
+
|
82 |
+
//Register the dashboard widget
|
83 |
+
public function facebook_page_plugin_dashboard_widget() {
|
84 |
+
wp_add_dashboard_widget( 'facebook-page-plugin-shortcode-generator', __( 'Facebook Page Plugin Shortcode Generator', 'facebook-page-feed-graph-api' ), array( $this, 'facebook_page_plugin_dashboard_widget_callback' ) );
|
85 |
}
|
86 |
+
|
87 |
+
//Load the dashboard widget
|
88 |
+
function facebook_page_plugin_dashboard_widget_callback() {
|
89 |
+
|
90 |
+
$generator = new cameronjonesweb_facebook_page_plugin_shortcode_generator;
|
91 |
+
$generator->generate();
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
//Client side stuff
|
96 |
+
//Parse shortcode
|
97 |
+
function facebook_page_plugin( $filter ) {
|
98 |
+
wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', NULL, true );
|
99 |
+
$return = NULL;
|
100 |
+
$a = shortcode_atts( array(
|
101 |
+
'href' => NULL,
|
102 |
+
'width' => 340,
|
103 |
+
'height' => 130,
|
104 |
+
'cover' => NULL,
|
105 |
+
'facepile' => NULL,
|
106 |
+
'posts' => NULL,
|
107 |
+
'tabs' => array(),
|
108 |
+
'language' => get_bloginfo('language'),
|
109 |
+
'cta' => NULL,
|
110 |
+
'small' => NULL,
|
111 |
+
'adapt' => NULL,
|
112 |
+
'link' => true,
|
113 |
+
'linktext' => NULL,
|
114 |
+
'standard' => 'html5',
|
115 |
+
), $filter );
|
116 |
+
if(isset($a['href']) && !empty($a['href'])){
|
117 |
+
$a['language'] = str_replace("-", "_", $a['language']);
|
118 |
+
$return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" id="' . preg_replace("/[^a-zA-Z]+/", "",substr(md5(rand()), 0, 15)) . '">';
|
119 |
+
$return .= '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/' . $a['language'] . '/sdk.js#xfbml=1&version=v2.4";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
|
120 |
+
$return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
|
121 |
+
if(isset($a['width']) && !empty($a['width'])){
|
122 |
+
$return .= ' data-width="' . $a['width'] . '"';
|
123 |
+
$return .= ' data-max-width="' . $a['width'] . '"';
|
124 |
+
}
|
125 |
+
if(isset($a['height']) && !empty($a['height'])){
|
126 |
+
$return .= ' data-height="' . $a['height'] . '"';
|
127 |
+
}
|
128 |
+
if(isset($a['cover']) && !empty($a['cover'])){
|
129 |
+
if($a['cover'] == "false"){
|
130 |
+
$return .= ' data-hide-cover="true"';
|
131 |
+
} else if($a['cover'] == "true"){
|
132 |
+
$return .= ' data-hide-cover="false"';
|
133 |
+
}
|
134 |
+
}
|
135 |
+
if(isset($a['facepile']) && !empty($a['facepile'])){
|
136 |
+
$return .= ' data-show-facepile="' . $a['facepile'] . '"';
|
137 |
+
}
|
138 |
+
if(isset($a['tabs']) && !empty($a['tabs'])){
|
139 |
+
$return .= ' data-tabs="' . $a['tabs'] . '"';
|
140 |
+
} else if(isset($a['posts']) && !empty($a['posts'])){
|
141 |
+
if($a['posts'] == 'true'){
|
142 |
+
$return .= ' data-tabs="timeline"';
|
143 |
+
} else {
|
144 |
+
$return .= ' data-tabs="false"';
|
145 |
+
}
|
146 |
}
|
147 |
+
if(isset($a['cta']) && !empty($a['cta'])){
|
148 |
+
$return .= ' data-hide-cta="' . $a['cta'] . '"';
|
149 |
+
}
|
150 |
+
if(isset($a['small']) && !empty($a['small'])){
|
151 |
+
$return .= ' data-small-header="' . $a['small'] . '"';
|
152 |
+
}
|
153 |
+
if(isset($a['adapt']) && !empty($a['adapt'])){
|
154 |
+
$return .= ' data-adapt-container-width="' . $a['adapt'] . '"';
|
155 |
+
} else {
|
156 |
+
$return .= ' data-adapt-container-width="false"';
|
157 |
+
}
|
158 |
+
$return .= '><div class="fb-xfbml-parse-ignore">';
|
159 |
+
if( $a['link'] == 'true' ){
|
160 |
+
$return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
|
161 |
+
$return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
|
162 |
+
if( empty( $a['linktext'] ) ) {
|
163 |
+
$return .= 'https://www.facebook.com/' . $a['href'];
|
164 |
+
} else {
|
165 |
+
$return .= $a['linktext'];
|
166 |
+
}
|
167 |
+
$return .= '</a>';
|
168 |
+
$return .= '</blockquote>';
|
169 |
+
}
|
170 |
+
$return .= '</div></div></div>';
|
171 |
}
|
172 |
+
return $return;
|
173 |
+
}
|
|
|
|
|
174 |
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
+
class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
|
178 |
|
179 |
private $facebookURLs = array('https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/');
|
180 |
|
360 |
} else {
|
361 |
$language = '';
|
362 |
}
|
363 |
+
|
364 |
+
$langs = get_locale_xml();
|
365 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
echo '<p>';
|
367 |
echo '<label for="' . $this->get_field_id( 'title' ) . '">';
|
368 |
_e( 'Title:', 'facebook-page-feed-graph-api' );
|
471 |
}
|
472 |
} // Class wpb_widget ends here
|
473 |
|
474 |
+
class cameronjonesweb_facebook_page_plugin_shortcode_generator {
|
475 |
+
|
476 |
+
private $langs;
|
477 |
+
|
478 |
+
function __construct() {
|
479 |
+
|
480 |
+
$this->langs = get_locale_xml();
|
481 |
+
}
|
482 |
+
|
483 |
+
function generate() {
|
484 |
+
|
485 |
+
$return = NULL;
|
486 |
+
|
487 |
+
$return .= '<form>';
|
488 |
+
$return .= '<p><label>' . __( 'Facebook Page URL', 'facebook-page-feed-graph-api' ) . ': <input type="url" id="fbpp-href" /></label></p>';
|
489 |
+
$return .= '<p><label>' . __( 'Width (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" max="500" min="180" id="fbpp-width" /></label></p>';
|
490 |
+
$return .= '<p><label>' . __( 'Height (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" min="70" id="fbpp-height" /></label></p>';
|
491 |
+
$return .= '<p><label>' . __( 'Show Cover Photo', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cover" /></label></p>';
|
492 |
+
$return .= '<p><label>' . __( 'Show Facepile', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
|
493 |
+
$return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-tabs"><option value="">None</option><option value="timeline">Timeline</option><option value="messages">Messages</option><option value="timeline,messages">Timeline, Messages</option><option value="messages,timeline">Messages, Timeline</option></select></label></p>';
|
494 |
+
$return .= '<p><label>' . __( 'Hide Call To Action', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cta" /></label></p>';
|
495 |
+
$return .= '<p><label>' . __( 'Small Header', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-small" /></label></p>';
|
496 |
+
$return .= '<p><label>' . __( 'Adaptive Width', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-adapt" checked /></label></p>';
|
497 |
+
$return .= '<p><label>' . __( 'Display link while loading', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-link" checked /></label></p>';
|
498 |
+
$return .= '<p id="linktext-label"><label>' . __( 'Link text', 'facebook-page-feed-graph-api' ) . ': <input type="text" id="fbpp-linktext" /></label></p>';
|
499 |
+
$return .= '<p><label>' . __( 'Language', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-lang"><option value="">' . __( 'Site Language', 'facebook-page-feed-graph-api' ) . '</option>';
|
500 |
+
if(isset($this->langs) && !empty($this->langs)){
|
501 |
+
foreach($this->langs as $lang){
|
502 |
+
$return .= '<option value="' . $lang->standard->representation . '">' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
|
503 |
+
}
|
504 |
+
}
|
505 |
+
$return .= '</select></label></p>';
|
506 |
+
$return .= '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
|
507 |
+
$return .= '</form>';
|
508 |
+
|
509 |
+
echo $return;
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
//Register the widget
|
514 |
function facebook_page_plugin_load_widget() {
|
515 |
+
register_widget( 'cameronjonesweb_facebook_page_plugin_widget' );
|
516 |
}
|
517 |
+
add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
|
518 |
|
519 |
+
function get_locale_xml() {
|
520 |
+
|
521 |
+
$admin_abspath = str_replace( site_url(), ABSPATH, admin_url() );
|
522 |
+
|
523 |
+
include_once( $admin_abspath . '/includes/class-wp-filesystem-base.php' );
|
524 |
+
include_once( $admin_abspath . '/includes/class-wp-filesystem-direct.php' );
|
525 |
+
$wp_filesystem = new WP_Filesystem_Direct( null );
|
526 |
+
|
527 |
+
try {
|
528 |
+
//$xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
|
529 |
+
//$xml = file_get_contents( CJW_FBPP_PLUGIN_URL ) . 'lang.xml');
|
530 |
+
$lang_xml = $wp_filesystem->get_contents( CJW_FBPP_PLUGIN_DIR . '/lang.xml');
|
531 |
+
} catch( Exception $ex ){
|
532 |
+
$lang_xml = NULL;
|
533 |
}
|
|
|
534 |
|
535 |
+
if(isset($lang_xml) && !empty($lang_xml)){
|
536 |
+
$langs = new SimpleXMLElement($lang_xml);
|
537 |
+
} else {
|
538 |
+
$langs = NULL;
|
|
|
539 |
}
|
540 |
+
|
541 |
+
return $langs;
|
542 |
}
|
543 |
|
544 |
+
$cameronjonesweb_facebook_page_plugin = new cameronjonesweb_facebook_page_plugin;
|
|
|
|
|
|
js/responsive.js
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(window).resize(function() {
|
2 |
+
if(this.resizeTO) clearTimeout(this.resizeTO);
|
3 |
+
this.resizeTO = setTimeout(function() {
|
4 |
+
jQuery(this).trigger('resizeEnd');
|
5 |
+
}, 500);
|
6 |
+
});
|
7 |
+
|
8 |
+
jQuery(window).bind('resizeEnd', function() {
|
9 |
+
rerenderFB();
|
10 |
+
});
|
11 |
+
|
12 |
+
function rerenderFB(){
|
13 |
+
jQuery('.cameronjonesweb_facebook_page_plugin').each(function(){
|
14 |
+
var container = jQuery(this).children('.fb-page');
|
15 |
+
var wrapper = jQuery(this);
|
16 |
+
var url = container.data('href');
|
17 |
+
var width = wrapper.width();
|
18 |
+
var max_width = container.data('max-width');
|
19 |
+
var containerId = jQuery(this).attr('id');
|
20 |
+
if( jQuery(container).data('adapt-container-width') == true ) {
|
21 |
+
container.fadeOut("slow", function() {
|
22 |
+
if( width <= max_width ) {
|
23 |
+
container.attr("data-width", width);
|
24 |
+
} else {
|
25 |
+
container.attr("data-width", max_width);
|
26 |
+
}
|
27 |
+
container.load(url, function() {
|
28 |
+
FB.XFBML.parse(document.getElementById(containerId),
|
29 |
+
function() {
|
30 |
+
container.fadeIn("slow");
|
31 |
+
});
|
32 |
+
})
|
33 |
+
});
|
34 |
+
}
|
35 |
+
});
|
36 |
+
}
|
js/responsive.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function rerenderFB(){jQuery(".cameronjonesweb_facebook_page_plugin").each(function(){var e=jQuery(this).children(".fb-page"),t=jQuery(this),i=e.data("href"),n=t.width(),r=e.data("max-width"),a=jQuery(this).attr("id");1==jQuery(e).data("adapt-container-width")&&e.fadeOut("slow",function(){r>=n?e.attr("data-width",n):e.attr("data-width",r),e.load(i,function(){FB.XFBML.parse(document.getElementById(a),function(){e.fadeIn("slow")})})})})}jQuery(window).resize(function(){this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){jQuery(this).trigger("resizeEnd")},500)}),jQuery(window).bind("resizeEnd",function(){rerenderFB()});
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: facebook,social,like,facepile,activity feed,recommendations,shortcode,widg
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=WLV5HPHSPM2BG&lc=AU&item_name=Cameron%20Jones%20Web%20Development�cy_code=AUD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.3.1
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
|
@@ -84,7 +84,7 @@ Example: `[facebook-page-plugin href="facebook" width="300" height="500" cover="
|
|
84 |
This will display a Facebook page feed that loads in the page `facebook.com/facebook` that is 300px wide but adapts to it's container, 500px high, displaying the page's cover photo, facepile and recent posts in the same language as the site. See the screenshots tab for a demonstration of how it will appear
|
85 |
|
86 |
= What languages are available? =
|
87 |
-
As of version 1.2.0, the plugin is available in all languages provided by Facebook ( full list availabe [here](https://www.facebook.com/translations/FacebookLocales.xml) ). By default it uses the same language as the site, but alternatively you can specify the language in the shortcode. The dashboard widget is only available in English.
|
88 |
|
89 |
= My Facebook page isn't loading =
|
90 |
If the URL for your page is http://facebook.com/ABC123 then when you use the shortcode don't include the domain, instead use like so: `[facebook-page-plugin href="ABC123"]`
|
@@ -106,6 +106,17 @@ Chances are your plugin isn't tall enough to display the facepile properly. The
|
|
106 |
|
107 |
== Changelog ==
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
= 1.4.2 =
|
110 |
* Fixing shortcode not being updated when tabs change in the shortcode generator
|
111 |
* Removing link text parameter and option when `Show Link` is false
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=WLV5HPHSPM2BG&lc=AU&item_name=Cameron%20Jones%20Web%20Development�cy_code=AUD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.3.1
|
7 |
+
Stable tag: 1.5.1
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
10 |
|
84 |
This will display a Facebook page feed that loads in the page `facebook.com/facebook` that is 300px wide but adapts to it's container, 500px high, displaying the page's cover photo, facepile and recent posts in the same language as the site. See the screenshots tab for a demonstration of how it will appear
|
85 |
|
86 |
= What languages are available? =
|
87 |
+
As of version 1.2.0, the plugin is available in all languages provided by Facebook ( full list availabe [here](https://www.facebook.com/translations/FacebookLocales.xml) ). By default it uses the same language as the site, but alternatively you can specify the language in the shortcode. The dashboard widget is currently only available in English but is multilingual ready.
|
88 |
|
89 |
= My Facebook page isn't loading =
|
90 |
If the URL for your page is http://facebook.com/ABC123 then when you use the shortcode don't include the domain, instead use like so: `[facebook-page-plugin href="ABC123"]`
|
106 |
|
107 |
== Changelog ==
|
108 |
|
109 |
+
= 1.5.1 =
|
110 |
+
* Fixed bug where plugin wouldn't rerender
|
111 |
+
* Fixed bug with languages XML file not loading on installs where the admin is not wp-admin
|
112 |
+
|
113 |
+
= 1.5.0 =
|
114 |
+
* Migrated to object oriented
|
115 |
+
* Fixed languages XML file being blocked by iThemes Security
|
116 |
+
* Added option for switching between HTML5/XHTML
|
117 |
+
* Fixed HTML issue with dashboard widget
|
118 |
+
* Added script that makes the plugin fully responsive
|
119 |
+
|
120 |
= 1.4.2 =
|
121 |
* Fixing shortcode not being updated when tabs change in the shortcode generator
|
122 |
* Removing link text parameter and option when `Show Link` is false
|