Version Description
- Fixed: Bug on autoupdate
- Fixed: Event ordering
Download this release
Release Info
Developer | webdorado |
Plugin | WD Facebook Feed – Custom Facebook Feed Plugin |
Version | 1.0.21 |
Comparing to | |
See all releases |
Code changes from version 1.0.19 to 1.0.21
- facebook-feed-wd.php +3 -7
- framework/WDFacebookFeed.php +207 -1
- js/ffwd_frontend.js +1 -1
- readme.txt +6 -2
facebook-feed-wd.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Facebook Feed WD
|
5 |
* Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
|
6 |
* Description:Facebook Feed WD is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
|
7 |
-
* Version: 1.0.
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -806,11 +806,7 @@ function ffwd_front_end_scripts() {
|
|
806 |
}
|
807 |
wp_enqueue_script( 'jquery' );
|
808 |
wp_enqueue_script( 'ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version );
|
809 |
-
wp_localize_script('ffwd_frontend', 'wd_ffwd',
|
810 |
-
array(
|
811 |
-
'ajax_url' => admin_url('admin-ajax.php'),
|
812 |
|
813 |
-
));
|
814 |
|
815 |
|
816 |
|
@@ -848,7 +844,7 @@ function ffwd_front_end_scripts() {
|
|
848 |
'seconds' => __( 'seconds', 'ffwd' ),
|
849 |
'second' => __( 'second', 'ffwd' ),
|
850 |
'ago' => __( 'ago', 'ffwd' ),
|
851 |
-
|
852 |
'and' => __( 'and', 'ffwd' ),
|
853 |
'others' => __( 'others', 'ffwd' ),
|
854 |
|
@@ -918,7 +914,7 @@ add_action( 'init', 'ffwd_language_load' );
|
|
918 |
|
919 |
function ffwd_version() {
|
920 |
|
921 |
-
$version = '1.0.
|
922 |
|
923 |
if ( get_option( 'ffwd_version' ) === false ) {
|
924 |
add_option( 'ffwd_version', $version );
|
4 |
* Plugin Name: Facebook Feed WD
|
5 |
* Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
|
6 |
* Description:Facebook Feed WD is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
|
7 |
+
* Version: 1.0.21
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
806 |
}
|
807 |
wp_enqueue_script( 'jquery' );
|
808 |
wp_enqueue_script( 'ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version );
|
|
|
|
|
|
|
809 |
|
|
|
810 |
|
811 |
|
812 |
|
844 |
'seconds' => __( 'seconds', 'ffwd' ),
|
845 |
'second' => __( 'second', 'ffwd' ),
|
846 |
'ago' => __( 'ago', 'ffwd' ),
|
847 |
+
'ajax_url' => admin_url('admin-ajax.php'),
|
848 |
'and' => __( 'and', 'ffwd' ),
|
849 |
'others' => __( 'others', 'ffwd' ),
|
850 |
|
914 |
|
915 |
function ffwd_version() {
|
916 |
|
917 |
+
$version = '1.0.21';
|
918 |
|
919 |
if ( get_option( 'ffwd_version' ) === false ) {
|
920 |
add_option( 'ffwd_version', $version );
|
framework/WDFacebookFeed.php
CHANGED
@@ -716,6 +716,28 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
716 |
|
717 |
/*print_r($fb_graph_url);
|
718 |
wp_die();*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
$data['data'] = self::complite_timeline($fb_graph_url);
|
720 |
self::$data = $data;
|
721 |
|
@@ -734,7 +756,172 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
734 |
}
|
735 |
}
|
736 |
|
737 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
{
|
739 |
$date1 = strtotime($a['start_time']);
|
740 |
$date2 = strtotime($b['start_time']);
|
@@ -799,6 +986,25 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
799 |
|
800 |
// print_r($fb_graph_url);
|
801 |
// wp_die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
$data = self::decap_do_curl($fb_graph_url);
|
803 |
|
804 |
|
716 |
|
717 |
/*print_r($fb_graph_url);
|
718 |
wp_die();*/
|
719 |
+
|
720 |
+
if (self::$auto_update_feed == 1) {
|
721 |
+
global $wpdb;
|
722 |
+
|
723 |
+
$id = self::$fb_id;
|
724 |
+
$update_ids = array();
|
725 |
+
$rows = $wpdb->get_results($wpdb->prepare('SELECT object_id,id FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
|
726 |
+
foreach ($rows as $row) {
|
727 |
+
$update_ids[$row->object_id] = $row->id;
|
728 |
+
}
|
729 |
+
$fb_graph_url_update = str_replace(
|
730 |
+
array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
|
731 |
+
array('', '', 'ids=' . implode(array_keys($update_ids), ',') . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
|
732 |
+
self::$graph_url
|
733 |
+
);
|
734 |
+
|
735 |
+
$update_data = self::decap_do_curl($fb_graph_url_update);
|
736 |
+
self::update_wd_fb_data($update_data, $update_ids);
|
737 |
+
|
738 |
+
}
|
739 |
+
|
740 |
+
|
741 |
$data['data'] = self::complite_timeline($fb_graph_url);
|
742 |
self::$data = $data;
|
743 |
|
756 |
}
|
757 |
}
|
758 |
|
759 |
+
|
760 |
+
public static function update_wd_fb_data($data, $ids)
|
761 |
+
{
|
762 |
+
global $wpdb;
|
763 |
+
$content = implode(",", self::$content);
|
764 |
+
$success = 'no_data';
|
765 |
+
|
766 |
+
|
767 |
+
foreach ($data as $key => $next) {
|
768 |
+
|
769 |
+
|
770 |
+
/**
|
771 |
+
* check if content_type is timeline dont save wd_fb_data if
|
772 |
+
* $content string not contain $next['type']
|
773 |
+
*/
|
774 |
+
if (self::$content_type == 'timeline') {
|
775 |
+
if (strpos($content, $next['type']) === false)
|
776 |
+
continue;
|
777 |
+
$type = $next['type'];
|
778 |
+
|
779 |
+
if (self::$timeline_type == 'others')
|
780 |
+
if (self::$id == $next['from']['id'])
|
781 |
+
continue;
|
782 |
+
} else
|
783 |
+
$type = self::$content[0];
|
784 |
+
|
785 |
+
// Use this var for check if album imgs count not 0
|
786 |
+
$album_imgs_exists = true;
|
787 |
+
|
788 |
+
switch ($type) {
|
789 |
+
case 'photos': {
|
790 |
+
/**
|
791 |
+
* If object type is photo(photos, video, videos,
|
792 |
+
* album, event cover photo etc ) so trying to
|
793 |
+
* check the count of resolution types
|
794 |
+
* and store source for thumb and main size
|
795 |
+
*/
|
796 |
+
if (array_key_exists('images', $next)) {
|
797 |
+
$img_res_count = count($next['images']);
|
798 |
+
if ($img_res_count > 6) {
|
799 |
+
$thumb_url = $next['images'][$img_res_count - 1]['source'];
|
800 |
+
$main_url = $next['images'][0]['source'];
|
801 |
+
} else {
|
802 |
+
$thumb_url = $next['images'][0]['source'];
|
803 |
+
$main_url = $next['images'][0]['source'];
|
804 |
+
}
|
805 |
+
$width = $next['images'][0]['width'];
|
806 |
+
$height = $next['images'][0]['height'];
|
807 |
+
}
|
808 |
+
break;
|
809 |
+
}
|
810 |
+
case 'videos': {
|
811 |
+
if (array_key_exists('format', $next)) {
|
812 |
+
$img_res_count = count($next['format']);
|
813 |
+
if ($img_res_count > 2) {
|
814 |
+
$main_url = $next['format'][$img_res_count - 1]['picture'];
|
815 |
+
$thumb_url = $next['format'][1]['picture'];
|
816 |
+
} else {
|
817 |
+
$thumb_url = $next['format'][$img_res_count - 1]['picture'];
|
818 |
+
$main_url = $next['format'][$img_res_count - 1]['picture'];
|
819 |
+
}
|
820 |
+
$width = $next['format'][$img_res_count - 1]['width'];
|
821 |
+
$height = $next['format'][$img_res_count - 1]['height'];
|
822 |
+
}
|
823 |
+
break;
|
824 |
+
}
|
825 |
+
case 'albums': {
|
826 |
+
if (array_key_exists('count', $next)) {
|
827 |
+
$album_imgs_count = $next['count'];
|
828 |
+
if ($album_imgs_count == 0) {
|
829 |
+
$album_imgs_exists = false;
|
830 |
+
}
|
831 |
+
}
|
832 |
+
break;
|
833 |
+
}
|
834 |
+
default: {
|
835 |
+
$thumb_url = '';
|
836 |
+
$main_url = '';
|
837 |
+
}
|
838 |
+
}
|
839 |
+
if ($type == "albums" && !$album_imgs_exists)
|
840 |
+
continue;
|
841 |
+
// Check if exists such keys in $next array
|
842 |
+
$object_id = array_key_exists('id', $next) ? $next['id'] : '';
|
843 |
+
$name = array_key_exists('name', $next) ? addcslashes($next['name'], '\\') : '';
|
844 |
+
$description = array_key_exists('description', $next) ? addcslashes($next['description'], '\\') : '';
|
845 |
+
$link = array_key_exists('link', $next) ? $next['link'] : '';
|
846 |
+
$status_type = array_key_exists('status_type', $next) ? $next['status_type'] : '';
|
847 |
+
$message = array_key_exists('message', $next) ? addcslashes($next['message'], '\\') : '';
|
848 |
+
$story = array_key_exists('story', $next) ? $next['story'] : '';
|
849 |
+
$place = array_key_exists('place', $next) ? json_encode($next['place']) : '';
|
850 |
+
$message_tags = array_key_exists('message_tags', $next) ? json_encode($next['message_tags']) : '';
|
851 |
+
$with_tags = array_key_exists('with_tags', $next) ? json_encode($next['with_tags']) : '';
|
852 |
+
$story_tags = array_key_exists('story_tags', $next) ? json_encode($next['story_tags']) : '';
|
853 |
+
$reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
|
854 |
+
$comments = array_key_exists('comments', $next) ? json_encode($next['comments']) : '';
|
855 |
+
$shares = array_key_exists('shares', $next) ? json_encode($next['shares']) : '';
|
856 |
+
$attachments = array_key_exists('attachments', $next) ? json_encode($next['attachments']) : '';
|
857 |
+
$from_json = array_key_exists('from', $next) ? json_encode($next['from']) : '';
|
858 |
+
if ($type == "events")
|
859 |
+
$from_json = array_key_exists('owner', $next) ? json_encode($next['owner']) : '';
|
860 |
+
|
861 |
+
|
862 |
+
$reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
|
863 |
+
|
864 |
+
// When content is events some fields have different names, so check them.
|
865 |
+
if ($type == 'events') {
|
866 |
+
$source = array_key_exists('cover', $next) ? $next['cover']['source'] : '';
|
867 |
+
$created_time = array_key_exists('start_time', $next) ? $next['start_time'] : '';
|
868 |
+
$from = array_key_exists('owner', $next) ? $next['owner']['id'] : '';
|
869 |
+
|
870 |
+
$main_url = $source;
|
871 |
+
$thumb_url = $main_url;
|
872 |
+
// Store event end time in update_time field
|
873 |
+
$updated_time = array_key_exists('end_time', $next) ? $next['end_time'] : '';
|
874 |
+
} else {
|
875 |
+
$source = array_key_exists('source', $next) ? $next['source'] : '';
|
876 |
+
$created_time = array_key_exists('created_time', $next) ? $next['created_time'] : '';
|
877 |
+
$from = array_key_exists('from', $next) ? $next['from']['id'] : '';
|
878 |
+
|
879 |
+
//check if thumb and main urls is set (if no , so set them source )
|
880 |
+
$thumb_url = isset($thumb_url) ? $thumb_url : $source;
|
881 |
+
$main_url = isset($main_url) ? $main_url : $source;
|
882 |
+
$updated_time = array_key_exists('updated_time', $next) ? $next['updated_time'] : '';
|
883 |
+
}
|
884 |
+
$width = isset($width) ? $width : '';
|
885 |
+
$height = isset($height) ? $height : '';
|
886 |
+
$created_time_number = ($created_time != '') ? strtotime($created_time) : 0;
|
887 |
+
|
888 |
+
$save_fb_data = $wpdb->update($wpdb->prefix . 'wd_fb_data', array(
|
889 |
+
'fb_id' => self::$fb_id,
|
890 |
+
// 'object_id' => $object_id,
|
891 |
+
// 'from' => $from,
|
892 |
+
'name' => $name,
|
893 |
+
'description' => $description,
|
894 |
+
'type' => $type,
|
895 |
+
'message' => $message,
|
896 |
+
'story' => $story,
|
897 |
+
'place' => $place,
|
898 |
+
'message_tags' => $message_tags,
|
899 |
+
'with_tags' => $with_tags,
|
900 |
+
'story_tags' => $story_tags,
|
901 |
+
'status_type' => $status_type,
|
902 |
+
'link' => $link,
|
903 |
+
'source' => $source,
|
904 |
+
'thumb_url' => $thumb_url,
|
905 |
+
'main_url' => $main_url,
|
906 |
+
'width' => $width,
|
907 |
+
'height' => $height,
|
908 |
+
'created_time' => $created_time,
|
909 |
+
'updated_time' => $updated_time,
|
910 |
+
'created_time_number' => $created_time_number,
|
911 |
+
'comments' => $comments,
|
912 |
+
'shares' => $shares,
|
913 |
+
'attachments' => $attachments,
|
914 |
+
'who_post' => $from_json,
|
915 |
+
'reactions' => $reactions,
|
916 |
+
), array('id' => $ids[$key]));
|
917 |
+
|
918 |
+
}
|
919 |
+
|
920 |
+
}
|
921 |
+
|
922 |
+
|
923 |
+
|
924 |
+
public static function ffwd_event_data_sort($a, $b)
|
925 |
{
|
926 |
$date1 = strtotime($a['start_time']);
|
927 |
$date2 = strtotime($b['start_time']);
|
986 |
|
987 |
// print_r($fb_graph_url);
|
988 |
// wp_die();
|
989 |
+
if (self::$auto_update_feed == 1) {
|
990 |
+
global $wpdb;
|
991 |
+
|
992 |
+
$id = self::$fb_id;
|
993 |
+
$update_ids = array();
|
994 |
+
$rows = $wpdb->get_results($wpdb->prepare('SELECT object_id,id FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
|
995 |
+
foreach ($rows as $row) {
|
996 |
+
$update_ids[$row->object_id] = $row->id;
|
997 |
+
}
|
998 |
+
$fb_graph_url_update = str_replace(
|
999 |
+
array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
|
1000 |
+
array('', '', 'ids=' . implode(array_keys($update_ids), ',') . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
|
1001 |
+
self::$graph_url
|
1002 |
+
);
|
1003 |
+
|
1004 |
+
$update_data = self::decap_do_curl($fb_graph_url_update);
|
1005 |
+
self::update_wd_fb_data($update_data, $update_ids);
|
1006 |
+
|
1007 |
+
}
|
1008 |
$data = self::decap_do_curl($fb_graph_url);
|
1009 |
|
1010 |
|
js/ffwd_frontend.js
CHANGED
@@ -1068,7 +1068,7 @@ function ffwd_blog_style_resize(ffwd_params, ffwd) {
|
|
1068 |
|
1069 |
jQuery(window).ready(function () {
|
1070 |
jQuery.ajax({
|
1071 |
-
url:
|
1072 |
data: {
|
1073 |
'action': 'ffwd_autoupdate',
|
1074 |
},
|
1068 |
|
1069 |
jQuery(window).ready(function () {
|
1070 |
jQuery.ajax({
|
1071 |
+
url: ffwd_frontend_text.ajax_url,
|
1072 |
data: {
|
1073 |
'action': 'ffwd_autoupdate',
|
1074 |
},
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webdorado, wdsupport
|
|
3 |
Donate link: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
|
4 |
Tags: customizable facebook feed, facebook, facebook events, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, facebook likebox
|
5 |
Requires at least: 3.4
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -59,6 +59,10 @@ Upgrade to [Facebook Feed Pro](https://web-dorado.com/products/wordpress-faceboo
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
62 |
= 1.0.19 =
|
63 |
* Changed: Autoupdate
|
64 |
|
3 |
Donate link: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
|
4 |
Tags: customizable facebook feed, facebook, facebook events, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, facebook likebox
|
5 |
Requires at least: 3.4
|
6 |
+
Tested up to: 4.8
|
7 |
+
Stable tag: 1.0.21
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.0.21 =
|
63 |
+
* Fixed: Bug on autoupdate
|
64 |
+
* Fixed: Event ordering
|
65 |
+
|
66 |
= 1.0.19 =
|
67 |
* Changed: Autoupdate
|
68 |
|