Custom Facebook Feed - Version 1.12.1

Version Description

Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 1.12.1
Comparing to
See all releases

Code changes from version 2.12 to 1.12.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook page
4
Requires at least: 3.0
5
Requires PHP: 5.2
6
Tested up to: 5.3
7
- Stable tag: 2.12
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -255,6 +255,12 @@ The most common reason for this is that an add-on or extension you have installe
255
9. It's super easy to display your Facebook feed in any page or post
256
257
== Changelog ==
258
= 2.12 =
259
* New: Added a backup cache so the feed will still display even if there's an error from the Facebook API.
260
* New: You can now easily manage multiple page or group accounts on the plugin settings page allowing you to easily add them to other feeds on your site. When you connect a page or group you will now see it listed in the "Connected Accounts" section. You can add it to the primary feed or to another feed by using the new `account` shortcode option.
4
Requires at least: 3.0
5
Requires PHP: 5.2
6
Tested up to: 5.3
7
+ Stable tag: 2.12.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
255
9. It's super easy to display your Facebook feed in any page or post
256
257
== Changelog ==
258
+ = 2.12.1 =
259
+ * Fix: Fixed a rare issue where a JavaScript error would occur in the WordPress admin if a Facebook account was manually connected and the Page ID used was the full URL
260
+ * Fix: Fixed a JavaScript error in the admin when using older web browsers
261
+ * Tweak: Improved the manual account connection process
262
+ * Tweak: Some minor UI tweaks to match the new WordPress 5.3 UI style
263
+
264
= 2.12 =
265
* New: Added a backup cache so the feed will still display even if there's an error from the Facebook API.
266
* New: You can now easily manage multiple page or group accounts on the plugin settings page allowing you to easily add them to other feeds on your site. When you connect a page or group you will now see it listed in the "Connected Accounts" section. You can add it to the primary feed or to another feed by using the new `account` shortcode option.
css/cff-admin-style.css CHANGED
@@ -1470,6 +1470,8 @@
1470
width: 80%;
1471
display: inline-block;
1472
margin-left: 0;
1473
}
1474
#cff-admin a.cff_ca_token_shortcode,
1475
#cff-admin .cff_make_primary,
@@ -1646,9 +1648,15 @@
1646
border: 1px solid #ddd;
1647
border-radius: 5px;
1648
}
1649
- #cff-admin #cff_manual_account p.submit{
1650
padding: 0;
1651
- margin: 20px 0 0 0;
1652
}
1653
#cff-admin .cff_account_type_page .cff_group,
1654
#cff-admin .cff_account_type_group .cff_page{
@@ -1661,6 +1669,14 @@
1661
#cff-admin #cff_manual_account_step_2 input[type=text] {
1662
width: 300px;
1663
}
1664
1665
@media all and (max-width: 1200px){
1666
#cff-admin .cff_delete_account .cff_remove_text{
1470
width: 80%;
1471
display: inline-block;
1472
margin-left: 0;
1473
+ min-height: 10px;
1474
+ line-height: 1.4;
1475
}
1476
#cff-admin a.cff_ca_token_shortcode,
1477
#cff-admin .cff_make_primary,
1648
border: 1px solid #ddd;
1649
border-radius: 5px;
1650
}
1651
+ #cff-admin #cff_manual_account p.submit,
1652
+ #cff-admin .cff_manual_back{
1653
+ float: left;
1654
padding: 0;
1655
+ margin: 20px 5px 0 0;
1656
+ }
1657
+ #cff-admin .cff_manual_back{
1658
+ display: block;
1659
+ padding: 0 10px;
1660
}
1661
#cff-admin .cff_account_type_page .cff_group,
1662
#cff-admin .cff_account_type_group .cff_page{
1669
#cff-admin #cff_manual_account_step_2 input[type=text] {
1670
width: 300px;
1671
}
1672
+ #cff-admin .cff_manual_forward{
1673
+ position: relative;
1674
+ top: 2px;
1675
+ }
1676
+ #cff-admin .cff_error{
1677
+ border: 1px solid #e37177;
1678
+ background: #ffebec;
1679
+ }
1680
1681
@media all and (max-width: 1200px){
1682
#cff-admin .cff_delete_account .cff_remove_text{
custom-facebook-feed-admin.php CHANGED
@@ -408,21 +408,22 @@ function cff_settings_page() {
408
<option value="page"><?php _e('Page'); ?></option>
409
<option value="group"><?php _e('Group'); ?></option>
410
</select>
411
</div>
412
413
<div id="cff_manual_account_step_2" class="cff_account_type_page">
414
<div>
415
<label for="cff_manual_account_name"><span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('Name'); ?> <span style="font-size: 11px;"><?php _e('(optional)'); ?></span></label>
416
- <input name="cff_manual_account_name" id="cff_manual_account_name" type="text" value="" />
417
<a class="cff-tooltip-link" href="JavaScript:void(0);"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
418
<p class="cff-tooltip cff-more-info"><?php _e('This is just for labeling the account here on this settings page'); ?></p>
419
</div>
420
421
<div>
422
<label for="cff_manual_account_id"><span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('ID'); ?></label>
423
- <input name="cff_manual_account_id" id="cff_manual_account_id" type="text" value="" />
424
<a class="cff-tooltip-link" href="JavaScript:void(0);"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
425
- <p class="cff-tooltip cff-more-info"><?php _e('The ID of the Facebook'); ?> <span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('you want to add'); ?></p>
426
</div>
427
428
<div>
@@ -436,6 +437,7 @@ function cff_settings_page() {
436
$cff_submit_btn_atts = array( 'disabled' => 'true' );
437
submit_button('Connect Account', 'primary', 'submit', true, $cff_submit_btn_atts);
438
?>
439
</div>
440
441
</div>
408
<option value="page"><?php _e('Page'); ?></option>
409
<option value="group"><?php _e('Group'); ?></option>
410
</select>
411
+ <a href="javascript:void(0);" class="cff_manual_forward button-primary"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>
412
</div>
413
414
<div id="cff_manual_account_step_2" class="cff_account_type_page">
415
<div>
416
<label for="cff_manual_account_name"><span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('Name'); ?> <span style="font-size: 11px;"><?php _e('(optional)'); ?></span></label>
417
+ <input name="cff_manual_account_name" id="cff_manual_account_name" type="text" value="" placeholder="Eg: John's Facebook Page" />
418
<a class="cff-tooltip-link" href="JavaScript:void(0);"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
419
<p class="cff-tooltip cff-more-info"><?php _e('This is just for labeling the account here on this settings page'); ?></p>
420
</div>
421
422
<div>
423
<label for="cff_manual_account_id"><span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('ID'); ?></label>
424
+ <input name="cff_manual_account_id" id="cff_manual_account_id" type="text" value="" placeholder="Eg: 1234567890123 or smashballoon" />
425
<a class="cff-tooltip-link" href="JavaScript:void(0);"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
426
+ <p class="cff-tooltip cff-more-info"><?php _e('The ID of the Facebook'); ?> <span class="cff_page"><?php _e('Page'); ?></span><span class="cff_group"><?php _e('Group'); ?></span> <?php _e('you want to add.'); ?> &nbsp;<a href='https://smashballoon.com/custom-facebook-feed/id/'><?php _e("How do I find my Page ID?"); ?></a></p>
427
</div>
428
429
<div>
437
$cff_submit_btn_atts = array( 'disabled' => 'true' );
438
submit_button('Connect Account', 'primary', 'submit', true, $cff_submit_btn_atts);
439
?>
440
+ <a href="javascript:void(0);" class="cff_manual_back button-secondary">Back</a>
441
</div>
442
443
</div>
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Smash Balloon Custom Facebook Feed
4
Plugin URI: https://smashballoon.com/custom-facebook-feed
5
Description: Add completely customizable Facebook feeds to your WordPress site
6
- Version: 2.12
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
@@ -24,7 +24,7 @@ along with this program; if not, write to the Free Software
24
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
26
27
- define('CFFVER', '2.12');
28
29
// Db version.
30
if ( ! defined( 'CFF_DBVERSION' ) ) {
3
Plugin Name: Smash Balloon Custom Facebook Feed
4
Plugin URI: https://smashballoon.com/custom-facebook-feed
5
Description: Add completely customizable Facebook feeds to your WordPress site
6
+ Version: 2.12.1
7
Author: Smash Balloon
8
Author URI: http://smashballoon.com/
9
License: GPLv2 or later
24
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
26
27
+ define('CFFVER', '2.12.1');
28
29
// Db version.
30
if ( ! defined( 'CFF_DBVERSION' ) ) {
js/cff-admin-scripts.js CHANGED
@@ -316,21 +316,33 @@ jQuery(document).ready(function($) {
316
317
//Manually connect account
318
//Step 1
319
- $('#cff_manual_account_button').on('click', function(e){
320
e.preventDefault();
321
- $('#cff_manual_account').toggle();
322
$('#cff_manual_account_step_1').show();
323
$('#cff_manual_account_step_2').hide();
324
});
325
//Step 2
326
jQuery("#cff_manual_account_type").change(function() {
327
$('#cff_manual_account_step_2').attr('class', 'cff_account_type_'+jQuery("#cff_manual_account_type option:selected").val() );
328
329
$('#cff_manual_account_step_1').hide();
330
$('#cff_manual_account_step_2').show();
331
- });
332
//Add account
333
- $('#cff_manual_account_step_2 input[type=submit').on('click', function(e){
334
e.preventDefault();
335
336
var $cff_manual_account = $('#cff_manual_account');
@@ -364,6 +376,8 @@ jQuery(document).ready(function($) {
364
365
if( pagetype == 'page' ) avatar = '';
366
367
//Add to connected accounts array
368
cff_connected_accounts[id] = {
369
id: id,
@@ -394,6 +408,21 @@ jQuery(document).ready(function($) {
394
$account.remove();
395
}
396
397
function createAccountHTML(cff_connected_accounts){
398
399
var accountsHTML = '';
@@ -402,7 +431,7 @@ jQuery(document).ready(function($) {
402
for (var key in cff_connected_accounts) {
403
if (cff_connected_accounts.hasOwnProperty(key)) {
404
405
- var id = cff_connected_accounts[key]['id'],
406
name = decodeURI(cff_connected_accounts[key]['name']),
407
pagetype = cff_connected_accounts[key]['pagetype'],
408
accesstoken = cff_connected_accounts[key]['accesstoken'],
@@ -605,16 +634,12 @@ jQuery(document).ready(function($) {
605
606
if( cff_current_page_id_arr.length > 1 ){
607
for (var i = 0; i < cff_current_page_id_arr.length; i++) {
608
- cffLabelAsPrimary( $('#cff_connected_account_' + cff_current_page_id_arr[i].trim() ), true );
609
}
610
} else {
611
- cffLabelAsPrimary( $('#cff_connected_account_' + cff_current_page_id ), true );
612
}
613
614
-
615
-
616
-
617
-
618
//Show the modal by default, but hide if the "cffnomodal" class is added to prevent it showing after saving settings
619
if( location.hash !== '#cffnomodal' ){
620
$('.cff_modal_tokens').removeClass('cffnomodal');
316
317
//Manually connect account
318
//Step 1
319
+ $('#cff_manual_account_button, #cff-admin .cff_manual_back').on('click', function(e){
320
e.preventDefault();
321
+ if( !$(this).hasClass('cff_manual_back') ) $('#cff_manual_account').toggle();
322
$('#cff_manual_account_step_1').show();
323
$('#cff_manual_account_step_2').hide();
324
});
325
//Step 2
326
jQuery("#cff_manual_account_type").change(function() {
327
+ cff_go_to_step_2();
328
+ });
329
+ $('#cff-admin .cff_manual_forward').on('click', function(){
330
+ if( $("#cff_manual_account_type option:selected").val() ){
331
+ cff_go_to_step_2();
332
+ } else {
333
+ $("#cff_manual_account_type").addClass('cff_error');
334
+ setTimeout(function(){ $("#cff_manual_account_type").removeClass('cff_error'); }, 500);
335
+ }
336
+ });
337
+ function cff_go_to_step_2(){
338
$('#cff_manual_account_step_2').attr('class', 'cff_account_type_'+jQuery("#cff_manual_account_type option:selected").val() );
339
340
$('#cff_manual_account_step_1').hide();
341
$('#cff_manual_account_step_2').show();
342
+ }
343
+
344
//Add account
345
+ $('#cff_manual_account_step_2 input[type=submit]').on('click', function(e){
346
e.preventDefault();
347
348
var $cff_manual_account = $('#cff_manual_account');
376
377
if( pagetype == 'page' ) avatar = '';
378
379
+ id = cffStripURLParts(id);
380
+
381
//Add to connected accounts array
382
cff_connected_accounts[id] = {
383
id: id,
408
$account.remove();
409
}
410
411
+ function cffStripURLParts(string){
412
+ if (typeof string === 'undefined') {
413
+ return '';
414
+ }
415
+ //If user pastes their full URL into the Page ID field then strip it out
416
+ var cff_facebook_string = 'facebook.com',
417
+ hasURL = (string.indexOf(cff_facebook_string) > -1);
418
+ if (hasURL) {
419
+ var stringArr = string.split('?')[0].replace(/\/#x2F;, '').split('/');
420
+ string = stringArr[stringArr.length-1].replace(/[\.\/]/,'');
421
+ }
422
+
423
+ return string;
424
+ }
425
+
426
function createAccountHTML(cff_connected_accounts){
427
428
var accountsHTML = '';
431
for (var key in cff_connected_accounts) {
432
if (cff_connected_accounts.hasOwnProperty(key)) {
433
434
+ var id = cffStripURLParts(cff_connected_accounts[key]['id']),
435
name = decodeURI(cff_connected_accounts[key]['name']),
436
pagetype = cff_connected_accounts[key]['pagetype'],
437
accesstoken = cff_connected_accounts[key]['accesstoken'],
634
635
if( cff_current_page_id_arr.length > 1 ){
636
for (var i = 0; i < cff_current_page_id_arr.length; i++) {
637
+ cffLabelAsPrimary( $('#cff_connected_account_' + cffStripURLParts(cff_current_page_id_arr[i].trim()) ), true );
638
}
639
} else {
640
+ cffLabelAsPrimary( $('#cff_connected_account_' + cffStripURLParts(cff_current_page_id) ), true );
641
}
642
643
//Show the modal by default, but hide if the "cffnomodal" class is added to prevent it showing after saving settings
644
if( location.hash !== '#cffnomodal' ){
645
$('.cff_modal_tokens').removeClass('cffnomodal');