WD Facebook Feed – Custom Facebook Feed Plugin - Version 1.0.2

Version Description

  • Minor bug fixed
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Facebook Feed – Custom Facebook Feed Plugin
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

admin/views/FFWDViewOptions_ffwd.php CHANGED
@@ -69,7 +69,7 @@ class FFWDViewOptions_ffwd
69
  return false;
70
  }" value="Reset all options"/>
71
  <input class="ffwd-button-primary ffwd-button-save" type="submit"
72
- onclick="if (spider_check_required('title', 'Title')) {return false;}; spider_set_input_value('task', 'save')"
73
  value="Save"/>
74
 
75
  </div>
@@ -100,7 +100,8 @@ class FFWDViewOptions_ffwd
100
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_app_secret"
101
  id="<?php echo WD_FB_PREFIX; ?>_app_secret" size="40"
102
  value="<?php echo $row->app_secret; ?>" class=""
103
- onchange="if(wd_fb_log_in) alert('Before change app id and secret please logout from curent app.'); else check_app('<?php echo WD_FB_PREFIX; ?>'); "/>
 
104
 
105
  </td>
106
  </tr>
69
  return false;
70
  }" value="Reset all options"/>
71
  <input class="ffwd-button-primary ffwd-button-save" type="submit"
72
+ onclick="if (spider_check_required('title', 'Title')) {return false;}; check_app('<?php echo WD_FB_PREFIX; ?>'); spider_set_input_value('task', 'save')"
73
  value="Save"/>
74
 
75
  </div>
100
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_app_secret"
101
  id="<?php echo WD_FB_PREFIX; ?>_app_secret" size="40"
102
  value="<?php echo $row->app_secret; ?>" class=""
103
+ onchange="if(wd_fb_log_in) alert('Before change app id and secret please logout from curent app.'); "/>
104
+ <div class="spider_description">App ID and App Secret are optional. You only need to fill in this fields if you want your application Access Token to be used instead of the default Access Token.</div>
105
 
106
  </td>
107
  </tr>
css/font-awesome/font-awesome.css CHANGED
@@ -1701,326 +1701,4 @@
1701
  .fa-dashcube:before {
1702
  content: "\f210";
1703
  }
1704
- .fa-forumbee:before {
1705
- content: "\f211";
1706
- }
1707
- .fa-leanpub:before {
1708
- content: "\f212";
1709
- }
1710
- .fa-sellsy:before {
1711
- content: "\f213";
1712
- }
1713
- .fa-shirtsinbulk:before {
1714
- content: "\f214";
1715
- }
1716
- .fa-simplybuilt:before {
1717
- content: "\f215";
1718
- }
1719
- .fa-skyatlas:before {
1720
- content: "\f216";
1721
- }
1722
- .fa-cart-plus:before {
1723
- content: "\f217";
1724
- }
1725
- .fa-cart-arrow-down:before {
1726
- content: "\f218";
1727
- }
1728
- .fa-diamond:before {
1729
- content: "\f219";
1730
- }
1731
- .fa-ship:before {
1732
- content: "\f21a";
1733
- }
1734
- .fa-user-secret:before {
1735
- content: "\f21b";
1736
- }
1737
- .fa-motorcycle:before {
1738
- content: "\f21c";
1739
- }
1740
- .fa-street-view:before {
1741
- content: "\f21d";
1742
- }
1743
- .fa-heartbeat:before {
1744
- content: "\f21e";
1745
- }
1746
- .fa-venus:before {
1747
- content: "\f221";
1748
- }
1749
- .fa-mars:before {
1750
- content: "\f222";
1751
- }
1752
- .fa-mercury:before {
1753
- content: "\f223";
1754
- }
1755
- .fa-intersex:before,
1756
- .fa-transgender:before {
1757
- content: "\f224";
1758
- }
1759
- .fa-transgender-alt:before {
1760
- content: "\f225";
1761
- }
1762
- .fa-venus-double:before {
1763
- content: "\f226";
1764
- }
1765
- .fa-mars-double:before {
1766
- content: "\f227";
1767
- }
1768
- .fa-venus-mars:before {
1769
- content: "\f228";
1770
- }
1771
- .fa-mars-stroke:before {
1772
- content: "\f229";
1773
- }
1774
- .fa-mars-stroke-v:before {
1775
- content: "\f22a";
1776
- }
1777
- .fa-mars-stroke-h:before {
1778
- content: "\f22b";
1779
- }
1780
- .fa-neuter:before {
1781
- content: "\f22c";
1782
- }
1783
- .fa-genderless:before {
1784
- content: "\f22d";
1785
- }
1786
- .fa-facebook-official:before {
1787
- content: "\f230";
1788
- }
1789
- .fa-pinterest-p:before {
1790
- content: "\f231";
1791
- }
1792
- .fa-whatsapp:before {
1793
- content: "\f232";
1794
- }
1795
- .fa-server:before {
1796
- content: "\f233";
1797
- }
1798
- .fa-user-plus:before {
1799
- content: "\f234";
1800
- }
1801
- .fa-user-times:before {
1802
- content: "\f235";
1803
- }
1804
- .fa-hotel:before,
1805
- .fa-bed:before {
1806
- content: "\f236";
1807
- }
1808
- .fa-viacoin:before {
1809
- content: "\f237";
1810
- }
1811
- .fa-train:before {
1812
- content: "\f238";
1813
- }
1814
- .fa-subway:before {
1815
- content: "\f239";
1816
- }
1817
- .fa-medium:before {
1818
- content: "\f23a";
1819
- }
1820
- .fa-yc:before,
1821
- .fa-y-combinator:before {
1822
- content: "\f23b";
1823
- }
1824
- .fa-optin-monster:before {
1825
- content: "\f23c";
1826
- }
1827
- .fa-opencart:before {
1828
- content: "\f23d";
1829
- }
1830
- .fa-expeditedssl:before {
1831
- content: "\f23e";
1832
- }
1833
- .fa-battery-4:before,
1834
- .fa-battery-full:before {
1835
- content: "\f240";
1836
- }
1837
- .fa-battery-3:before,
1838
- .fa-battery-three-quarters:before {
1839
- content: "\f241";
1840
- }
1841
- .fa-battery-2:before,
1842
- .fa-battery-half:before {
1843
- content: "\f242";
1844
- }
1845
- .fa-battery-1:before,
1846
- .fa-battery-quarter:before {
1847
- content: "\f243";
1848
- }
1849
- .fa-battery-0:before,
1850
- .fa-battery-empty:before {
1851
- content: "\f244";
1852
- }
1853
- .fa-mouse-pointer:before {
1854
- content: "\f245";
1855
- }
1856
- .fa-i-cursor:before {
1857
- content: "\f246";
1858
- }
1859
- .fa-object-group:before {
1860
- content: "\f247";
1861
- }
1862
- .fa-object-ungroup:before {
1863
- content: "\f248";
1864
- }
1865
- .fa-sticky-note:before {
1866
- content: "\f249";
1867
- }
1868
- .fa-sticky-note-o:before {
1869
- content: "\f24a";
1870
- }
1871
- .fa-cc-jcb:before {
1872
- content: "\f24b";
1873
- }
1874
- .fa-cc-diners-club:before {
1875
- content: "\f24c";
1876
- }
1877
- .fa-clone:before {
1878
- content: "\f24d";
1879
- }
1880
- .fa-balance-scale:before {
1881
- content: "\f24e";
1882
- }
1883
- .fa-hourglass-o:before {
1884
- content: "\f250";
1885
- }
1886
- .fa-hourglass-1:before,
1887
- .fa-hourglass-start:before {
1888
- content: "\f251";
1889
- }
1890
- .fa-hourglass-2:before,
1891
- .fa-hourglass-half:before {
1892
- content: "\f252";
1893
- }
1894
- .fa-hourglass-3:before,
1895
- .fa-hourglass-end:before {
1896
- content: "\f253";
1897
- }
1898
- .fa-hourglass:before {
1899
- content: "\f254";
1900
- }
1901
- .fa-hand-grab-o:before,
1902
- .fa-hand-rock-o:before {
1903
- content: "\f255";
1904
- }
1905
- .fa-hand-stop-o:before,
1906
- .fa-hand-paper-o:before {
1907
- content: "\f256";
1908
- }
1909
- .fa-hand-scissors-o:before {
1910
- content: "\f257";
1911
- }
1912
- .fa-hand-lizard-o:before {
1913
- content: "\f258";
1914
- }
1915
- .fa-hand-spock-o:before {
1916
- content: "\f259";
1917
- }
1918
- .fa-hand-pointer-o:before {
1919
- content: "\f25a";
1920
- }
1921
- .fa-hand-peace-o:before {
1922
- content: "\f25b";
1923
- }
1924
- .fa-trademark:before {
1925
- content: "\f25c";
1926
- }
1927
- .fa-registered:before {
1928
- content: "\f25d";
1929
- }
1930
- .fa-creative-commons:before {
1931
- content: "\f25e";
1932
- }
1933
- .fa-gg:before {
1934
- content: "\f260";
1935
- }
1936
- .fa-gg-circle:before {
1937
- content: "\f261";
1938
- }
1939
- .fa-tripadvisor:before {
1940
- content: "\f262";
1941
- }
1942
- .fa-odnoklassniki:before {
1943
- content: "\f263";
1944
- }
1945
- .fa-odnoklassniki-square:before {
1946
- content: "\f264";
1947
- }
1948
- .fa-get-pocket:before {
1949
- content: "\f265";
1950
- }
1951
- .fa-wikipedia-w:before {
1952
- content: "\f266";
1953
- }
1954
- .fa-safari:before {
1955
- content: "\f267";
1956
- }
1957
- .fa-chrome:before {
1958
- content: "\f268";
1959
- }
1960
- .fa-firefox:before {
1961
- content: "\f269";
1962
- }
1963
- .fa-opera:before {
1964
- content: "\f26a";
1965
- }
1966
- .fa-internet-explorer:before {
1967
- content: "\f26b";
1968
- }
1969
- .fa-tv:before,
1970
- .fa-television:before {
1971
- content: "\f26c";
1972
- }
1973
- .fa-contao:before {
1974
- content: "\f26d";
1975
- }
1976
- .fa-500px:before {
1977
- content: "\f26e";
1978
- }
1979
- .fa-amazon:before {
1980
- content: "\f270";
1981
- }
1982
- .fa-calendar-plus-o:before {
1983
- content: "\f271";
1984
- }
1985
- .fa-calendar-minus-o:before {
1986
- content: "\f272";
1987
- }
1988
- .fa-calendar-times-o:before {
1989
- content: "\f273";
1990
- }
1991
- .fa-calendar-check-o:before {
1992
- content: "\f274";
1993
- }
1994
- .fa-industry:before {
1995
- content: "\f275";
1996
- }
1997
- .fa-map-pin:before {
1998
- content: "\f276";
1999
- }
2000
- .fa-map-signs:before {
2001
- content: "\f277";
2002
- }
2003
- .fa-map-o:before {
2004
- content: "\f278";
2005
- }
2006
- .fa-map:before {
2007
- content: "\f279";
2008
- }
2009
- .fa-commenting:before {
2010
- content: "\f27a";
2011
- }
2012
- .fa-commenting-o:before {
2013
- content: "\f27b";
2014
- }
2015
- .fa-houzz:before {
2016
- content: "\f27c";
2017
- }
2018
- .fa-vimeo:before {
2019
- content: "\f27d";
2020
- }
2021
- .fa-black-tie:before {
2022
- content: "\f27e";
2023
- }
2024
- .fa-fonticons:before {
2025
- content: "\f280";
2026
- }
1701
  .fa-dashcube:before {
1702
  content: "\f210";
1703
  }
1704
+ .fa-forumbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -14,126 +14,130 @@ define('WD_FFWD_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
14
  define('WD_FFWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
15
  define('WD_FFWD_PRO', true);
16
  define('WD_FB_PREFIX', 'ffwd');
17
- if(session_id() == '')
18
- session_start();
19
-
20
- function ffwd_use_home_url() {
21
- $home_url = str_replace("http://", "", home_url());
22
- $home_url = str_replace("https://", "", $home_url);
23
- $pos = strpos($home_url, "/");
24
- if ($pos) {
25
- $home_url = substr($home_url, 0, $pos);
26
- }
27
-
28
- $site_url = str_replace("http://", "", WD_FFWD_URL);
29
- $site_url = str_replace("https://", "", $site_url);
30
- $pos = strpos($site_url, "/");
31
- if ($pos) {
32
- $site_url = substr($site_url, 0, $pos);
33
- }
34
- return $site_url != $home_url;
 
35
  }
36
 
37
  if (ffwd_use_home_url()) {
38
- define('WD_FFWD_FRONT_URL', home_url("wp-content/plugins/" . plugin_basename(dirname(__FILE__))));
39
- }
40
- else {
41
- define('WD_FFWD_FRONT_URL', WD_FFWD_URL);
42
  }
43
 
44
  // Plugin menu.
45
- function ffwd_menu_panel() {
46
- $galleries_page = add_menu_page('Facebook Feed WD', 'Facebook Feed WD', 'manage_options', 'info_ffwd', 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
 
47
 
48
- $galleries_page = add_submenu_page('info_ffwd', 'Feeds', 'Feeds', 'manage_options', 'info_ffwd', 'ffwd_menu');
49
- add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
50
- add_action('admin_print_scripts-' . $galleries_page, 'ffwd_scripts');
51
- add_action('load-' . $galleries_page, 'ffwd_add_ffwd_info_per_page_option');
52
 
53
- $options_page = add_submenu_page('info_ffwd', 'Options', 'Options', 'manage_options', 'options_ffwd', 'ffwd_menu');
54
- add_action('admin_print_styles-' . $options_page, 'ffwd_styles');
55
- add_action('admin_print_scripts-' . $options_page, 'ffwd_admin_scripts');
56
 
57
- $themes_page = add_submenu_page('info_ffwd', 'Themes', 'Themes', 'manage_options', 'themes_ffwd', 'ffwd_menu');
58
- add_action('admin_print_styles-' . $themes_page, 'ffwd_styles');
59
- add_action('admin_print_scripts-' . $themes_page, 'ffwd_admin_scripts');
60
- add_action('load-' . $themes_page, 'ffwd_add_themes_per_page_option');
61
 
62
- $licensing_page =add_submenu_page('info_ffwd', 'Buy Pro', 'Buy Pro', 'manage_options', 'ffwd_licensing', 'ffwd_licensing_page');
63
- add_action('admin_print_styles-' . $licensing_page, 'ffwd_styles');
64
 
65
 
66
- add_submenu_page('info_ffwd', 'Featured Plugins', 'Featured Plugins', 'manage_options', 'featured_plugins_ffwd', 'ffwd_featured');
67
- add_submenu_page('info_ffwd', 'Featured Themes', 'Featured Themes', 'manage_options', 'featured_themes_ffwd', 'ffwd_featured_themes');
68
 
69
 
70
- $uninstall_page = add_submenu_page('info_ffwd', 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
71
- add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
72
- add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
73
  }
 
74
  add_action('admin_menu', 'ffwd_menu_panel');
75
 
76
- function ffwd_menu() {
77
- global $wpdb;
78
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
79
- $page = WDW_FFWD_Library::get('page');
80
- if (($page != '') && (($page == 'info_ffwd') || ($page == 'options_ffwd') || ($page == 'themes_ffwd') || ($page == 'uninstall_ffwd') || ($page == 'FFWDShortcode'))) {
81
- require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . (($page == 'FFWDShortcode') ? $page : ucfirst(strtolower($page))) . '.php');
82
- $controller_class = 'FFWDController' . ucfirst(strtolower($page));
83
- $controller = new $controller_class();
84
- $controller->execute();
85
- }
 
86
  }
87
 
88
- function ffwd_featured() {
89
- if (function_exists('current_user_can')) {
90
- if (!current_user_can('manage_options')) {
91
- die('Access Denied');
92
- }
93
- }
94
- else {
95
- die('Access Denied');
96
- }
97
- require_once(WD_FFWD_DIR . '/featured/featured.php');
98
- wp_register_style('ffwd_featured', WD_FFWD_URL . '/featured/style.css', array(), ffwd_version());
99
- wp_print_styles('ffwd_featured');
100
- spider_featured('facebook-feed-wd');
101
- }
102
-
103
- function ffwd_featured_themes() {
104
- if (function_exists('current_user_can')) {
105
- if (!current_user_can('manage_options')) {
106
- die('Access Denied');
107
  }
108
- }
109
- else {
110
- die('Access Denied');
111
- }
112
- require_once(WD_FFWD_DIR . '/featured/featured_themes.php');
113
- wp_register_style('featured_themes', WD_FFWD_URL . '/featured/themes_style.css', array(), ffwd_version());
114
- wp_print_styles('featured_themes');
115
- spider_featured_themes('facebook-feed-wd');
116
  }
117
 
118
-
119
-
120
- function FFWD_licensing_page(){
121
- $controller_class = 'FFWDControllerLicensing_ffwd';
122
- require_once(WD_FFWD_DIR . '/admin/controllers/' . $controller_class . '.php');
123
- $controller = new $controller_class();
124
- $controller->execute();
 
 
 
 
 
 
125
  }
126
 
127
 
128
- function ffwd_ajax_frontend() {
129
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
130
- $page = WDW_FFWD_Library::get('action');
131
- if ($page != '' && $page == 'PopupBox') {
132
- require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDController' . ucfirst($page) . '.php');
133
- $controller_class = 'FFWDController' . ucfirst($page);
134
  $controller = new $controller_class();
135
  $controller->execute();
136
- }
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  add_action('wp_ajax_PopupBox', 'ffwd_ajax_frontend');
@@ -148,88 +152,91 @@ add_action('wp_ajax_check_app', 'ffwd_ajax');
148
  add_action('wp_ajax_nopriv_dropp_objects', 'ffwd_ajax');
149
  add_action('wp_ajax_dropp_objects', 'ffwd_ajax');
150
 
151
- function ffwd_ajax() {
152
- if (function_exists('current_user_can')) {
153
- if (!current_user_can('manage_options')) {
154
- die('Access Denied');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
- }
157
- else {
158
- die('Access Denied');
159
- }
160
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
161
- $page = WDW_FFWD_Library::get('action');
162
- $nonce = ($page == 'save_facebook_feed' || $page == 'dropp_objects') ? 'info_ffwd' : (($page == 'check_app') ? 'options_ffwd' : $page);
163
- if(($page != 'FFWDShortcode') && !WDW_FFWD_Library::verify_nonce($nonce)){
164
- die('Sorry, your nonce did not verify.');
165
- }
166
- if ($page == 'FFWDShortcode') {
167
- require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . ucfirst($page) . '.php');
168
- $controller_class = 'FFWDController' . ucfirst($page);
169
- $controller = new $controller_class();
170
- $controller->execute();
171
- }
172
- elseif($page == 'check_app' || $page == 'save_facebook_feed' || $page == 'dropp_objects') {
173
- require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
174
- WDFacebookFeed::execute();
175
- }
176
  }
177
 
178
  function ffwd_shortcode($params)
179
  {
180
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
181
 
182
 
183
- global $wpdb;
184
 
185
- $check_fb_feed = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $params['id']));
186
- if (!$check_fb_feed) {
187
- echo WDW_FFWD_Library::message(__('Feed Doesn\'t exists', 'bwg'), 'error');
188
- return;
189
- }
190
- $params['fb_id'] = $params['id'];
191
- ob_start();
192
- ffwd_front_end($params);
193
- return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
194
  }
195
 
196
  add_shortcode('WD_FB', 'ffwd_shortcode');
197
 
198
  $ffwd = 0;
199
- function ffwd_front_end($params) {
200
- global $ffwd;
201
- global $wpdb;
202
- require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php');
 
203
 
204
- $fb_view_type = $wpdb->get_var($wpdb->prepare("SELECT fb_view_type FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%s'", $params['fb_id']));
205
 
206
- $controller = new FFWDControllerMain($params, 1, $ffwd, ucfirst( $fb_view_type));
207
- $ffwd++;
208
- return;
209
  }
210
 
211
  // Add the Facebook Feed WD button.
212
- function ffwd_add_button($buttons) {
213
- array_push($buttons, "wd_fb_mce");
214
- return $buttons;
 
215
  }
216
 
217
  // Register Facebook Feed WD button.
218
- function ffwd_register($plugin_array) {
219
- $url = WD_FFWD_URL . '/js/ffwd_editor_button.js';
220
- $plugin_array["wd_fb_mce"] = $url;
221
- return $plugin_array;
 
222
  }
223
 
224
- function ffwd_admin_ajax() {
225
- $query_url = wp_nonce_url( admin_url('admin-ajax.php'), '', 'ffwd_nonce' );
226
- ?>
227
- <script>
228
- var ffwd_admin_ajax = '<?php echo add_query_arg(array('action' => 'FFWDShortcode'), admin_url('admin-ajax.php')); ?>';
229
- var ffwd_plugin_url = '<?php echo WD_FFWD_URL; ?>';
230
- var ajax_url = '<?php echo $query_url; ?>';
231
- </script>
232
- <?php
 
233
  }
234
 
235
  add_action('admin_head', 'ffwd_admin_ajax');
@@ -240,16 +247,17 @@ add_filter('mce_external_plugins', 'ffwd_register');
240
  add_filter('mce_buttons', 'ffwd_add_button', 0);
241
 
242
  // Activate plugin.
243
- function ffwd_activate() {
244
- global $wpdb;
245
- $wd_fb_shortcode = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_shortcode` (
 
246
  `id` bigint(20) NOT NULL,
247
  `tagtext` mediumtext NOT NULL,
248
  PRIMARY KEY (`id`)
249
  ) DEFAULT CHARSET=utf8;";
250
- $wpdb->query($wd_fb_shortcode);
251
 
252
- $wd_fb_info = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_info` (
253
  `id` int(10) NOT NULL AUTO_INCREMENT,
254
  `name` varchar(255) NOT NULL,
255
  `type` varchar(10) NOT NULL,
@@ -342,9 +350,9 @@ function ffwd_activate() {
342
  `image_onclick_action` varchar(32) NOT NULL,
343
  PRIMARY KEY (`id`)
344
  ) DEFAULT CHARSET=utf8;";
345
- $wpdb->query($wd_fb_info);
346
- //message-i , description , name encoding --> utf16_bin
347
- $wd_fb_data = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_data` (
348
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
349
  `fb_id` int NOT NULL,
350
  `from` varchar(32) NOT NULL,
@@ -370,22 +378,23 @@ function ffwd_activate() {
370
  `created_time_number` bigint(255) NOT NULL,
371
  PRIMARY KEY (`id`)
372
  ) DEFAULT CHARSET=utf8;";
373
- $wpdb->query($wd_fb_data);
374
 
375
- $wd_fb_option = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_option` (
376
  `id` bigint(20) NOT NULL,
377
  `autoupdate_interval` int(4) NOT NULL,
378
  `app_id` varchar(255) NOT NULL,
379
  `app_secret` varchar(255) NOT NULL,
 
380
  `date_timezone` varchar(64) NOT NULL,
381
  `post_date_format` varchar(64) NOT NULL,
382
  `event_date_format` varchar(64) NOT NULL
383
  ) DEFAULT CHARSET=utf8;";
384
- $wpdb->query($wd_fb_option);
385
 
386
- /*$ffwd_settings = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "ffwd_settings` (
387
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
388
- `autoupdate_interval` int(4) NOT NULL,
389
  `app_id` varchar(255) NOT NULL,
390
  `app_secret` varchar(255) NOT NULL,
391
  `date_timezone` varchar(64) NOT NULL,
@@ -393,67 +402,83 @@ function ffwd_activate() {
393
  ) DEFAULT CHARSET=utf8;";
394
  $wpdb->query($ffwd_settings);*/
395
 
396
- $wd_fb_theme = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_theme` (
397
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
398
  `name` varchar(255) NOT NULL,
399
  `params` longtext,
400
  `default_theme` tinyint(1) NOT NULL,
401
  PRIMARY KEY (`id`)
402
  ) DEFAULT CHARSET=utf8;";
403
- $wpdb->query($wd_fb_theme);
404
 
405
- $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_option');
406
- if (!$exists_default) {
407
- $save = $wpdb->insert($wpdb->prefix . 'wd_fb_option', array(
408
- 'id' => 1,
409
- 'autoupdate_interval' => 90,
410
- 'app_id' => '',
411
- 'date_timezone' => '',
412
- 'post_date_format' => 'ago',
413
- 'event_date_format' => 'F j, Y, g:i a',
 
414
 
415
 
416
- ));
417
- }
418
 
419
- $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_theme');
420
- if (!$exists_default) {
421
- $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
422
- 'name' => 'Theme 1',
423
- 'default_theme' => 1,
424
- 'params'=>'{"thumb_margin":"10","thumb_padding":"2","thumb_border_radius":"2px","thumb_border_width":"1","thumb_border_style":"none","thumb_border_color":"000000","thumb_bg_color":"FFFFFF","thumbs_bg_color":"FFFFFF","thumb_bg_transparent":"100","thumb_box_shadow":"0px 0px 1px #000000","thumb_transparent":"100","thumb_align":"center","thumb_hover_effect":"rotate","thumb_hover_effect_value":"2deg","thumb_transition":"1","thumb_title_font_color":"797979","thumb_title_font_style":"inherit","thumb_title_pos":"bottom","thumb_title_font_size":"14","thumb_title_font_weight":"normal","thumb_title_margin":"10","thumb_title_shadow":"","thumb_like_comm_pos":"bottom","thumb_like_comm_font_size":"14","thumb_like_comm_font_color":"FFFFFF","thumb_like_comm_font_style":"inherit","thumb_like_comm_font_weight":"normal","thumb_like_comm_shadow":"0px 0px 1px #000000","masonry_thumb_padding":"4","masonry_thumb_border_radius":"2px","masonry_thumb_border_width":"1","masonry_thumb_border_style":"solid","masonry_thumb_border_color":"FFFFFF","masonry_thumbs_bg_color":"FFFFFF","masonry_thumb_bg_transparent":"100","masonry_thumb_transparent":"100","masonry_thumb_align":"center","masonry_thumb_hover_effect":"scale","masonry_thumb_hover_effect_value":"1.1","masonry_thumb_transition":"1","masonry_description_font_size":"14","masonry_description_color":"A3A3A3","masonry_description_font_style":"inherit","masonry_like_comm_pos":"bottom","masonry_like_comm_font_size":"14","masonry_like_comm_font_color":"FFFFFF","masonry_like_comm_font_style":"inherit","masonry_like_comm_font_weight":"normal","masonry_like_comm_shadow":"0px 0px 1px #000000","blog_style_align":"left","blog_style_bg_color":"FFFFFF","blog_style_fd_name_bg_color":"000000","blog_style_fd_name_align":"center","blog_style_fd_name_padding":"10","blog_style_fd_name_color":"FFFFFF","blog_style_fd_name_size":"15","blog_style_fd_name_font_weight":"normal","blog_style_fd_icon":"","blog_style_fd_icon_color":"","blog_style_fd_icon_size":"","blog_style_transparent":"100","blog_style_obj_img_align":"center","blog_style_margin":"10","blog_style_box_shadow":"","blog_style_border_width":"1","blog_style_border_style":"solid","blog_style_border_color":"C9C9C9","blog_style_border_type":"top","blog_style_border_radius":"","blog_style_obj_icons_color":"gray","blog_style_obj_date_pos":"after","blog_style_obj_font_family":"inherit","blog_style_obj_info_bg_color":"FFFFFF","blog_style_page_name_color":"000000","blog_style_obj_page_name_size":"13","blog_style_obj_page_name_font_weight":"bold","blog_style_obj_story_color":"000000","blog_style_obj_story_size":"14","blog_style_obj_story_font_weight":"normal","blog_style_obj_place_color":"000000","blog_style_obj_place_size":"13","blog_style_obj_place_font_weight":"normal","blog_style_obj_name_color":"000000","blog_style_obj_name_size":"13","blog_style_obj_name_font_weight":"bold","blog_style_obj_message_color":"000000","blog_style_obj_message_size":"14","blog_style_obj_message_font_weight":"normal","blog_style_obj_hashtags_color":"000000","blog_style_obj_hashtags_size":"12","blog_style_obj_hashtags_font_weight":"normal","blog_style_obj_likes_social_bg_color":"EAEAEA","blog_style_obj_likes_social_color":"656565","blog_style_obj_likes_social_size":"14","blog_style_obj_likes_social_font_weight":"normal","blog_style_obj_comments_bg_color":"FFFFFF","blog_style_obj_comments_color":"000000","blog_style_obj_comments_font_family":"inherit","blog_style_obj_comments_font_size":"14","blog_style_obj_users_font_color":"000000","blog_style_obj_comments_social_font_weight":"normal","blog_style_obj_comment_border_width":"1","blog_style_obj_comment_border_style":"solid","blog_style_obj_comment_border_color":"C9C9C9","blog_style_obj_comment_border_type":"top","blog_style_evt_str_color":"000000","blog_style_evt_str_size":"14","blog_style_evt_str_font_weight":"normal","blog_style_evt_ctzpcn_color":"000000","blog_style_evt_ctzpcn_size":"14","blog_style_evt_ctzpcn_font_weight":"normal","blog_style_evt_map_color":"000000","blog_style_evt_map_size":"14","blog_style_evt_map_font_weight":"normal","blog_style_evt_date_color":"000000","blog_style_evt_date_size":"14","blog_style_evt_date_font_weight":"normal","blog_style_evt_info_font_family":"inherit","album_compact_back_font_color":"000000","album_compact_back_font_style":"inherit","album_compact_back_font_size":"16","album_compact_back_font_weight":"bold","album_compact_back_padding":"0","album_compact_title_font_color":"797979","album_compact_title_font_style":"inherit","album_compact_thumb_title_pos":"bottom","album_compact_title_font_size":"13","album_compact_title_font_weight":"normal","album_compact_title_margin":"2px","album_compact_title_shadow":"0px 0px 0px #888888","album_compact_thumb_margin":"4","album_compact_thumb_padding":"0","album_compact_thumb_border_radius":"0","album_compact_thumb_border_width":"0","album_compact_thumb_border_style":"none","album_compact_thumb_border_color":"CCCCCC","album_compact_thumb_bg_color":"FFFFFF","album_compact_thumbs_bg_color":"FFFFFF","album_compact_thumb_bg_transparent":"0","album_compact_thumb_box_shadow":"0px 0px 0px #888888","album_compact_thumb_transparent":"100","album_compact_thumb_align":"center","album_compact_thumb_hover_effect":"scale","album_compact_thumb_hover_effect_value":"1.1","album_compact_thumb_transition":"0","lightbox_overlay_bg_color":"000000","lightbox_overlay_bg_transparent":"70","lightbox_bg_color":"000000","lightbox_ctrl_btn_pos":"bottom","lightbox_ctrl_btn_align":"center","lightbox_ctrl_btn_height":"20","lightbox_ctrl_btn_margin_top":"10","lightbox_ctrl_btn_margin_left":"7","lightbox_ctrl_btn_transparent":"100","lightbox_ctrl_btn_color":"","lightbox_toggle_btn_height":"14","lightbox_toggle_btn_width":"100","lightbox_ctrl_cont_bg_color":"000000","lightbox_ctrl_cont_transparent":"65","lightbox_ctrl_cont_border_radius":"4","lightbox_close_btn_transparent":"100","lightbox_close_btn_bg_color":"000000","lightbox_close_btn_border_width":"2","lightbox_close_btn_border_radius":"16px","lightbox_close_btn_border_style":"none","lightbox_close_btn_border_color":"FFFFFF","lightbox_close_btn_box_shadow":"0","lightbox_close_btn_color":"","lightbox_close_btn_size":"10","lightbox_close_btn_width":"20","lightbox_close_btn_height":"20","lightbox_close_btn_top":"-10","lightbox_close_btn_right":"-10","lightbox_close_btn_full_color":"","lightbox_rl_btn_bg_color":"000000","lightbox_rl_btn_transparent":"80","lightbox_rl_btn_border_radius":"20px","lightbox_rl_btn_border_width":"0","lightbox_rl_btn_border_style":"none","lightbox_rl_btn_border_color":"FFFFFF","lightbox_rl_btn_box_shadow":"","lightbox_rl_btn_color":"","lightbox_rl_btn_height":"40","lightbox_rl_btn_width":"40","lightbox_rl_btn_size":"20","lightbox_close_rl_btn_hover_color":"","lightbox_obj_pos":"left","lightbox_obj_width":"350","lightbox_obj_icons_color":"gray","lightbox_obj_date_pos":"after","lightbox_obj_font_family":"inherit","lightbox_obj_info_bg_color":"E2E2E2","lightbox_page_name_color":"4B4B4B","lightbox_obj_page_name_size":"14","lightbox_obj_page_name_font_weight":"bold","lightbox_obj_story_color":"4B4B4B","lightbox_obj_story_size":"14","lightbox_obj_story_font_weight":"normal","lightbox_obj_place_color":"000000","lightbox_obj_place_size":"13","lightbox_obj_place_font_weight":"normal","lightbox_obj_name_color":"4B4B4B","lightbox_obj_name_size":"14","lightbox_obj_name_font_weight":"bold","lightbox_obj_message_color":"000000","lightbox_obj_message_size":"14","lightbox_obj_message_font_weight":"normal","lightbox_obj_hashtags_color":"000000","lightbox_obj_hashtags_size":"12","lightbox_obj_hashtags_font_weight":"normal","lightbox_obj_likes_social_bg_color":"878787","lightbox_obj_likes_social_color":"FFFFFF","lightbox_obj_likes_social_size":"14","lightbox_obj_likes_social_font_weight":"normal","lightbox_obj_comments_bg_color":"EAEAEA","lightbox_obj_comments_color":"4A4A4A","lightbox_obj_comments_font_family":"inherit","lightbox_obj_comments_font_size":"14","lightbox_obj_users_font_color":"4B4B4B","lightbox_obj_comments_social_font_weight":"normal","lightbox_obj_comment_border_width":"1","lightbox_obj_comment_border_style":"solid","lightbox_obj_comment_border_color":"C9C9C9","lightbox_obj_comment_border_type":"top","lightbox_filmstrip_pos":"top","lightbox_filmstrip_rl_bg_color":"3B3B3B","lightbox_filmstrip_rl_btn_size":"20","lightbox_filmstrip_rl_btn_color":"","lightbox_filmstrip_thumb_margin":"0 1px","lightbox_filmstrip_thumb_border_width":"1","lightbox_filmstrip_thumb_border_style":"solid","lightbox_filmstrip_thumb_border_color":"000000","lightbox_filmstrip_thumb_border_radius":"0","lightbox_filmstrip_thumb_deactive_transparent":"80","lightbox_filmstrip_thumb_active_border_width":"0","lightbox_filmstrip_thumb_active_border_color":"FFFFFF","lightbox_rl_btn_style":"","lightbox_evt_str_color":"000000","lightbox_evt_str_size":"14","lightbox_evt_str_font_weight":"normal","lightbox_evt_ctzpcn_color":"000000","lightbox_evt_ctzpcn_size":"14","lightbox_evt_ctzpcn_font_weight":"normal","lightbox_evt_map_color":"000000","lightbox_evt_map_size":"14","lightbox_evt_map_font_weight":"normal","lightbox_evt_date_color":"000000","lightbox_evt_date_size":"14","lightbox_evt_date_font_weight":"normal","lightbox_evt_info_font_family":"inherit","page_nav_position":"bottom","page_nav_align":"center","page_nav_number":"0","page_nav_font_size":"12","page_nav_font_style":"inherit","page_nav_font_color":"666666","page_nav_font_weight":"bold","page_nav_border_width":"1","page_nav_border_style":"solid","page_nav_border_color":"E3E3E3","page_nav_border_radius":"0","page_nav_margin":"0","page_nav_padding":"3px 6px","page_nav_button_bg_color":"FFFFFF","page_nav_button_bg_transparent":"100","page_nav_box_shadow":"0","page_nav_button_transition":"1","page_nav_button_text":"0","lightbox_obj_icons_color_likes_comments_count":"white"}',
425
- ));
426
 
427
 
428
- }
429
- wp_schedule_event( time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook' );
430
 
 
431
 
 
 
 
 
 
 
432
 
433
- /*$version = get_option("ffwd_version");
434
- $new_version = '1.0.0';
435
- if ($version && version_compare($version, $new_version, '<')) {
436
- require_once WD_FFWD_DIR . "/update/ffwd_update.php";
437
- ffwd_update($version);
438
- update_option("ffwd_version", $new_version);
439
- }
440
- else {
441
- add_option("ffwd_version", $new_version, '', 'no');
442
- }
443
- */
 
 
 
 
444
 
445
  }
 
446
  register_activation_hook(__FILE__, 'ffwd_activate');
447
 
448
 
449
  /* On deactivation, remove all functions from the scheduled action hook.*/
450
- function ffwd_deactivate() {
451
- wp_clear_scheduled_hook( 'wd_fb_schedule_event_hook' );
 
452
  }
453
- register_deactivation_hook( __FILE__, 'ffwd_deactivate' );
454
 
455
- function ffwd_update_hook() {
456
- /*$version = get_option("ffwd_version");
 
 
 
457
  $new_version = '1.0.0';
458
  if ($version && version_compare($version, $new_version, '<')) {
459
  require_once WD_FFWD_DIR . "/update/ffwd_update.php";
@@ -461,167 +486,190 @@ function ffwd_update_hook() {
461
  update_option("ffwd_version", $new_version);
462
  }*/
463
 
464
- return false;
465
  }
 
466
  if (!isset($_GET['action']) || $_GET['action'] != 'deactivate') {
467
- add_action('admin_init', 'ffwd_update_hook');
468
  }
469
 
470
  // Plugin styles.
471
- function ffwd_styles() {
472
- wp_admin_css('thickbox');
473
- wp_enqueue_style('ffwd_tables', WD_FFWD_URL . '/css/ffwd_tables.css', array(), ffwd_version());
 
474
  }
475
 
476
  // Plugin scripts.
477
- function ffwd_scripts() {
478
- wp_enqueue_script('thickbox');
479
- wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_version());
480
-
481
- global $wp_scripts;
482
- if (isset($wp_scripts->registered['jquery'])) {
483
- $jquery = $wp_scripts->registered['jquery'];
484
- if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
485
- wp_deregister_script('jquery');
486
- wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2' );
 
 
487
  }
488
- }
489
- wp_enqueue_script('jquery');
490
- wp_enqueue_script('jquery-ui-sortable');
491
  }
492
 
493
  /* Add pagination to gallery admin pages.*/
494
- function ffwd_add_ffwd_info_per_page_option(){
495
- $option = 'per_page';
496
- $args_galleries = array(
497
- 'label' => 'Items',
498
- 'default' => 20,
499
- 'option' => 'ffwd_info_per_page'
500
- );
501
- add_screen_option( $option, $args_galleries );
502
- }
503
-
504
- function ffwd_add_themes_per_page_option(){
505
- $option = 'per_page';
506
- $args_themes = array(
507
- 'label' => 'Themes',
508
- 'default' => 20,
509
- 'option' => 'ffwd_themes_per_page'
510
- );
511
- add_screen_option( $option, $args_themes );
 
 
512
  }
513
 
514
  add_filter('set-screen-option', 'ffwd_set_option_galleries', 10, 3);
515
  add_filter('set-screen-option', 'ffwd_set_option_themes', 10, 3);
516
 
517
- function ffwd_set_option_galleries($status, $option, $value) {
518
- if ( 'ffwd_info_per_page' == $option ) return $value;
519
- return $status;
 
520
  }
521
- function ffwd_set_option_themes($status, $option, $value) {
522
- if ( 'ffwd_themes_per_page' == $option ) return $value;
523
- return $status;
 
 
524
  }
525
 
526
- function ffwd_admin_scripts() {
527
- wp_enqueue_script('thickbox');
528
- wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_version());
529
- global $wp_scripts;
530
- if (isset($wp_scripts->registered['jquery'])) {
531
- $jquery = $wp_scripts->registered['jquery'];
532
- if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
533
- wp_deregister_script('jquery');
534
- wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2' );
 
 
535
  }
536
- }
537
- wp_enqueue_script('jquery');
538
- wp_enqueue_script('jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9');
539
- wp_enqueue_style('ffwd_font-awesome', WD_FFWD_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0');
540
- }
541
-
542
- function ffwd_front_end_scripts() {
543
- $version = ffwd_version();
544
- global $wp_scripts;
545
- if (isset($wp_scripts->registered['jquery'])) {
546
- $jquery = $wp_scripts->registered['jquery'];
547
- if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
548
- wp_deregister_script('jquery');
549
- wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2' );
 
550
  }
551
- }
552
- wp_enqueue_script('jquery');
553
- wp_enqueue_script('ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version);
554
- wp_enqueue_style('ffwd_frontend', WD_FFWD_FRONT_URL . '/css/ffwd_frontend.css', array(), $version);
555
- // Styles/Scripts for popup.
556
- wp_enqueue_style('ffwd_font-awesome', WD_FFWD_FRONT_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0');
557
- wp_enqueue_script('ffwd_jquery_mobile', WD_FFWD_FRONT_URL . '/js/jquery.mobile.js', array(), $version);
558
- wp_enqueue_script('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $version);
559
- wp_enqueue_style('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/css/jquery.mCustomScrollbar.css', array(), $version);
560
- wp_enqueue_script('jquery-fullscreen', WD_FFWD_FRONT_URL . '/js/jquery.fullscreen-0.4.1.js', array(), '0.4.1');
561
- wp_enqueue_script('ffwd_gallery_box', WD_FFWD_FRONT_URL . '/js/ffwd_gallery_box.js', array(), $version);
562
- wp_localize_script('ffwd_gallery_box', 'ffwd_objectL10n', array(
563
- 'ffwd_field_required' => __('field is required.', 'bwg'),
564
- 'ffwd_mail_validation' => __('This is not a valid email address.', 'bwg'),
565
- 'ffwd_search_result' => __('There are no images matching your search.', 'bwg'),
566
- ));
567
  }
 
568
  add_action('wp_enqueue_scripts', 'ffwd_front_end_scripts');
569
 
570
  /* Add bwg scheduled event for autoupdatable galleries.*/
571
- add_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
572
- function wd_fb_add_autoupdate_interval( $schedules ) {
573
- require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
574
- $autoupdate_interval = WDFacebookFeed::get_autoupdate_interval();
575
- // var_dump($autoupdate_interval);
576
- $schedules['wd_fb_autoupdate_interval'] = array(
577
- 'interval' => 60 * $autoupdate_interval,
578
- 'display' => __( 'WD Facebook plugin autoupdate interval.' )
579
- );
580
- return $schedules;
581
- }
582
-
583
-
584
- add_action( 'wd_fb_schedule_event_hook', 'wd_fb_update' );
585
- // wd_fb_update();
586
- function wd_fb_update() {
587
- global $wpdb;
588
- $query = "SELECT * FROM " . $wpdb->prefix . "wd_fb_info WHERE `update_mode` <> 'no_update'";
589
- $rows = $wpdb->get_results($query);
590
- require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
591
- WDFacebookFeed::update_from_shedule($rows);
592
- return;
 
 
593
  }
594
 
595
  // Facebook feed wd Widget.
596
  if (class_exists('WP_Widget')) {
597
- require_once(WD_FFWD_DIR . '/admin/controllers/FFWDControllerWidget.php');
598
- add_action('widgets_init', create_function('', 'return register_widget("FFWDControllerWidget");'));
599
  }
600
 
601
  // Languages localization.
602
- function ffwd_language_load() {
603
- load_plugin_textdomain('bwg', FALSE, basename(dirname(__FILE__)) . '/languages');
 
604
  }
 
605
  add_action('init', 'ffwd_language_load');
606
 
607
- function ffwd_version(){
 
 
 
 
 
 
 
 
608
 
609
- $version = '1.0.1';
610
 
611
- if(get_option('ffwd_version')===false)
612
- {
613
- add_option('ffwd_version',$version);
614
- }
615
- else
616
- {
617
- update_option('ffwd_version',$version);
618
 
619
 
620
- }
621
 
 
622
 
 
 
 
 
 
 
 
623
 
624
- return $version;
625
 
626
  }
627
 
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.2
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
14
  define('WD_FFWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
15
  define('WD_FFWD_PRO', true);
16
  define('WD_FB_PREFIX', 'ffwd');
17
+ if (session_id() == '')
18
+ session_start();
19
+
20
+ function ffwd_use_home_url()
21
+ {
22
+ $home_url = str_replace("http://", "", home_url());
23
+ $home_url = str_replace("https://", "", $home_url);
24
+ $pos = strpos($home_url, "/");
25
+ if ($pos) {
26
+ $home_url = substr($home_url, 0, $pos);
27
+ }
28
+
29
+ $site_url = str_replace("http://", "", WD_FFWD_URL);
30
+ $site_url = str_replace("https://", "", $site_url);
31
+ $pos = strpos($site_url, "/");
32
+ if ($pos) {
33
+ $site_url = substr($site_url, 0, $pos);
34
+ }
35
+ return $site_url != $home_url;
36
  }
37
 
38
  if (ffwd_use_home_url()) {
39
+ define('WD_FFWD_FRONT_URL', home_url("wp-content/plugins/" . plugin_basename(dirname(__FILE__))));
40
+ } else {
41
+ define('WD_FFWD_FRONT_URL', WD_FFWD_URL);
 
42
  }
43
 
44
  // Plugin menu.
45
+ function ffwd_menu_panel()
46
+ {
47
+ $galleries_page = add_menu_page('Facebook Feed WD', 'Facebook Feed WD', 'manage_options', 'info_ffwd', 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
48
 
49
+ $galleries_page = add_submenu_page('info_ffwd', 'Feeds', 'Feeds', 'manage_options', 'info_ffwd', 'ffwd_menu');
50
+ add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
51
+ add_action('admin_print_scripts-' . $galleries_page, 'ffwd_scripts');
52
+ add_action('load-' . $galleries_page, 'ffwd_add_ffwd_info_per_page_option');
53
 
54
+ $options_page = add_submenu_page('info_ffwd', 'Options', 'Options', 'manage_options', 'options_ffwd', 'ffwd_menu');
55
+ add_action('admin_print_styles-' . $options_page, 'ffwd_styles');
56
+ add_action('admin_print_scripts-' . $options_page, 'ffwd_admin_scripts');
57
 
58
+ $themes_page = add_submenu_page('info_ffwd', 'Themes', 'Themes', 'manage_options', 'themes_ffwd', 'ffwd_menu');
59
+ add_action('admin_print_styles-' . $themes_page, 'ffwd_styles');
60
+ add_action('admin_print_scripts-' . $themes_page, 'ffwd_admin_scripts');
61
+ add_action('load-' . $themes_page, 'ffwd_add_themes_per_page_option');
62
 
63
+ $licensing_page = add_submenu_page('info_ffwd', 'Buy Pro', 'Buy Pro', 'manage_options', 'ffwd_licensing', 'ffwd_licensing_page');
64
+ add_action('admin_print_styles-' . $licensing_page, 'ffwd_styles');
65
 
66
 
67
+ add_submenu_page('info_ffwd', 'Featured Plugins', 'Featured Plugins', 'manage_options', 'featured_plugins_ffwd', 'ffwd_featured');
68
+ add_submenu_page('info_ffwd', 'Featured Themes', 'Featured Themes', 'manage_options', 'featured_themes_ffwd', 'ffwd_featured_themes');
69
 
70
 
71
+ $uninstall_page = add_submenu_page('info_ffwd', 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
72
+ add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
73
+ add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
74
  }
75
+
76
  add_action('admin_menu', 'ffwd_menu_panel');
77
 
78
+ function ffwd_menu()
79
+ {
80
+ global $wpdb;
81
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
82
+ $page = WDW_FFWD_Library::get('page');
83
+ if (($page != '') && (($page == 'info_ffwd') || ($page == 'options_ffwd') || ($page == 'themes_ffwd') || ($page == 'uninstall_ffwd') || ($page == 'FFWDShortcode'))) {
84
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . (($page == 'FFWDShortcode') ? $page : ucfirst(strtolower($page))) . '.php');
85
+ $controller_class = 'FFWDController' . ucfirst(strtolower($page));
86
+ $controller = new $controller_class();
87
+ $controller->execute();
88
+ }
89
  }
90
 
91
+ function ffwd_featured()
92
+ {
93
+ if (function_exists('current_user_can')) {
94
+ if (!current_user_can('manage_options')) {
95
+ die('Access Denied');
96
+ }
97
+ } else {
98
+ die('Access Denied');
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
+ require_once(WD_FFWD_DIR . '/featured/featured.php');
101
+ wp_register_style('ffwd_featured', WD_FFWD_URL . '/featured/style.css', array(), ffwd_get_version());
102
+ wp_print_styles('ffwd_featured');
103
+ spider_featured('facebook-feed-wd');
 
 
 
 
104
  }
105
 
106
+ function ffwd_featured_themes()
107
+ {
108
+ if (function_exists('current_user_can')) {
109
+ if (!current_user_can('manage_options')) {
110
+ die('Access Denied');
111
+ }
112
+ } else {
113
+ die('Access Denied');
114
+ }
115
+ require_once(WD_FFWD_DIR . '/featured/featured_themes.php');
116
+ wp_register_style('featured_themes', WD_FFWD_URL . '/featured/themes_style.css', array(), ffwd_get_version());
117
+ wp_print_styles('featured_themes');
118
+ spider_featured_themes('facebook-feed-wd');
119
  }
120
 
121
 
122
+ function FFWD_licensing_page()
123
+ {
124
+ $controller_class = 'FFWDControllerLicensing_ffwd';
125
+ require_once(WD_FFWD_DIR . '/admin/controllers/' . $controller_class . '.php');
 
 
126
  $controller = new $controller_class();
127
  $controller->execute();
128
+ }
129
+
130
+
131
+ function ffwd_ajax_frontend()
132
+ {
133
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
134
+ $page = WDW_FFWD_Library::get('action');
135
+ if ($page != '' && $page == 'PopupBox') {
136
+ require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDController' . ucfirst($page) . '.php');
137
+ $controller_class = 'FFWDController' . ucfirst($page);
138
+ $controller = new $controller_class();
139
+ $controller->execute();
140
+ }
141
  }
142
 
143
  add_action('wp_ajax_PopupBox', 'ffwd_ajax_frontend');
152
  add_action('wp_ajax_nopriv_dropp_objects', 'ffwd_ajax');
153
  add_action('wp_ajax_dropp_objects', 'ffwd_ajax');
154
 
155
+ function ffwd_ajax()
156
+ {
157
+ if (function_exists('current_user_can')) {
158
+ if (!current_user_can('manage_options')) {
159
+ die('Access Denied');
160
+ }
161
+ } else {
162
+ die('Access Denied');
163
+ }
164
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
165
+ $page = WDW_FFWD_Library::get('action');
166
+ $nonce = ($page == 'save_facebook_feed' || $page == 'dropp_objects') ? 'info_ffwd' : (($page == 'check_app') ? 'options_ffwd' : $page);
167
+ if (($page != 'FFWDShortcode') && !WDW_FFWD_Library::verify_nonce($nonce)) {
168
+ die('Sorry, your nonce did not verify.');
169
+ }
170
+ if ($page == 'FFWDShortcode') {
171
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . ucfirst($page) . '.php');
172
+ $controller_class = 'FFWDController' . ucfirst($page);
173
+ $controller = new $controller_class();
174
+ $controller->execute();
175
+ } elseif ($page == 'check_app' || $page == 'save_facebook_feed' || $page == 'dropp_objects') {
176
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
177
+ WDFacebookFeed::execute();
178
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
 
181
  function ffwd_shortcode($params)
182
  {
183
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
184
 
185
 
186
+ global $wpdb;
187
 
188
+ $check_fb_feed = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $params['id']));
189
+ if (!$check_fb_feed) {
190
+ echo WDW_FFWD_Library::message(__('Feed Doesn\'t exists', 'bwg'), 'error');
191
+ return;
192
+ }
193
+ $params['fb_id'] = $params['id'];
194
+ ob_start();
195
+ ffwd_front_end($params);
196
+ return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
197
  }
198
 
199
  add_shortcode('WD_FB', 'ffwd_shortcode');
200
 
201
  $ffwd = 0;
202
+ function ffwd_front_end($params)
203
+ {
204
+ global $ffwd;
205
+ global $wpdb;
206
+ require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php');
207
 
208
+ $fb_view_type = $wpdb->get_var($wpdb->prepare("SELECT fb_view_type FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%s'", $params['fb_id']));
209
 
210
+ $controller = new FFWDControllerMain($params, 1, $ffwd, ucfirst($fb_view_type));
211
+ $ffwd++;
212
+ return;
213
  }
214
 
215
  // Add the Facebook Feed WD button.
216
+ function ffwd_add_button($buttons)
217
+ {
218
+ array_push($buttons, "wd_fb_mce");
219
+ return $buttons;
220
  }
221
 
222
  // Register Facebook Feed WD button.
223
+ function ffwd_register($plugin_array)
224
+ {
225
+ $url = WD_FFWD_URL . '/js/ffwd_editor_button.js';
226
+ $plugin_array["wd_fb_mce"] = $url;
227
+ return $plugin_array;
228
  }
229
 
230
+ function ffwd_admin_ajax()
231
+ {
232
+ $query_url = wp_nonce_url(admin_url('admin-ajax.php'), '', 'ffwd_nonce');
233
+ ?>
234
+ <script>
235
+ var ffwd_admin_ajax = '<?php echo add_query_arg(array('action' => 'FFWDShortcode'), admin_url('admin-ajax.php')); ?>';
236
+ var ffwd_plugin_url = '<?php echo WD_FFWD_URL; ?>';
237
+ var ajax_url = '<?php echo $query_url; ?>';
238
+ </script>
239
+ <?php
240
  }
241
 
242
  add_action('admin_head', 'ffwd_admin_ajax');
247
  add_filter('mce_buttons', 'ffwd_add_button', 0);
248
 
249
  // Activate plugin.
250
+ function ffwd_activate()
251
+ {
252
+ global $wpdb;
253
+ $wd_fb_shortcode = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_shortcode` (
254
  `id` bigint(20) NOT NULL,
255
  `tagtext` mediumtext NOT NULL,
256
  PRIMARY KEY (`id`)
257
  ) DEFAULT CHARSET=utf8;";
258
+ $wpdb->query($wd_fb_shortcode);
259
 
260
+ $wd_fb_info = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_info` (
261
  `id` int(10) NOT NULL AUTO_INCREMENT,
262
  `name` varchar(255) NOT NULL,
263
  `type` varchar(10) NOT NULL,
350
  `image_onclick_action` varchar(32) NOT NULL,
351
  PRIMARY KEY (`id`)
352
  ) DEFAULT CHARSET=utf8;";
353
+ $wpdb->query($wd_fb_info);
354
+ //message-i , description , name encoding --> utf16_bin
355
+ $wd_fb_data = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_data` (
356
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
357
  `fb_id` int NOT NULL,
358
  `from` varchar(32) NOT NULL,
378
  `created_time_number` bigint(255) NOT NULL,
379
  PRIMARY KEY (`id`)
380
  ) DEFAULT CHARSET=utf8;";
381
+ $wpdb->query($wd_fb_data);
382
 
383
+ $wd_fb_option = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_option` (
384
  `id` bigint(20) NOT NULL,
385
  `autoupdate_interval` int(4) NOT NULL,
386
  `app_id` varchar(255) NOT NULL,
387
  `app_secret` varchar(255) NOT NULL,
388
+ `access_token` varchar(255) NOT NULL,
389
  `date_timezone` varchar(64) NOT NULL,
390
  `post_date_format` varchar(64) NOT NULL,
391
  `event_date_format` varchar(64) NOT NULL
392
  ) DEFAULT CHARSET=utf8;";
393
+ $wpdb->query($wd_fb_option);
394
 
395
+ /*$ffwd_settings = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "ffwd_settings` (
396
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
397
+ `autoupdate_interval` int(4) NOT NULL,
398
  `app_id` varchar(255) NOT NULL,
399
  `app_secret` varchar(255) NOT NULL,
400
  `date_timezone` varchar(64) NOT NULL,
402
  ) DEFAULT CHARSET=utf8;";
403
  $wpdb->query($ffwd_settings);*/
404
 
405
+ $wd_fb_theme = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_theme` (
406
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
407
  `name` varchar(255) NOT NULL,
408
  `params` longtext,
409
  `default_theme` tinyint(1) NOT NULL,
410
  PRIMARY KEY (`id`)
411
  ) DEFAULT CHARSET=utf8;";
412
+ $wpdb->query($wd_fb_theme);
413
 
414
+ $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_option');
415
+ if (!$exists_default) {
416
+ $save = $wpdb->insert($wpdb->prefix . 'wd_fb_option', array(
417
+ 'id' => 1,
418
+ 'autoupdate_interval' => 90,
419
+ 'app_id' => '',
420
+ 'date_timezone' => '',
421
+ 'access_token' => '',
422
+ 'post_date_format' => 'ago',
423
+ 'event_date_format' => 'F j, Y, g:i a',
424
 
425
 
426
+ ));
427
+ }
428
 
429
+ $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_theme');
430
+ if (!$exists_default) {
431
+ $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
432
+ 'name' => 'Theme 1',
433
+ 'default_theme' => 1,
434
+ 'params' => '{"thumb_margin":"10","thumb_padding":"2","thumb_border_radius":"2px","thumb_border_width":"1","thumb_border_style":"none","thumb_border_color":"000000","thumb_bg_color":"FFFFFF","thumbs_bg_color":"FFFFFF","thumb_bg_transparent":"100","thumb_box_shadow":"0px 0px 1px #000000","thumb_transparent":"100","thumb_align":"center","thumb_hover_effect":"rotate","thumb_hover_effect_value":"2deg","thumb_transition":"1","thumb_title_font_color":"797979","thumb_title_font_style":"inherit","thumb_title_pos":"bottom","thumb_title_font_size":"14","thumb_title_font_weight":"normal","thumb_title_margin":"10","thumb_title_shadow":"","thumb_like_comm_pos":"bottom","thumb_like_comm_font_size":"14","thumb_like_comm_font_color":"FFFFFF","thumb_like_comm_font_style":"inherit","thumb_like_comm_font_weight":"normal","thumb_like_comm_shadow":"0px 0px 1px #000000","masonry_thumb_padding":"4","masonry_thumb_border_radius":"2px","masonry_thumb_border_width":"1","masonry_thumb_border_style":"solid","masonry_thumb_border_color":"FFFFFF","masonry_thumbs_bg_color":"FFFFFF","masonry_thumb_bg_transparent":"100","masonry_thumb_transparent":"100","masonry_thumb_align":"center","masonry_thumb_hover_effect":"scale","masonry_thumb_hover_effect_value":"1.1","masonry_thumb_transition":"1","masonry_description_font_size":"14","masonry_description_color":"A3A3A3","masonry_description_font_style":"inherit","masonry_like_comm_pos":"bottom","masonry_like_comm_font_size":"14","masonry_like_comm_font_color":"FFFFFF","masonry_like_comm_font_style":"inherit","masonry_like_comm_font_weight":"normal","masonry_like_comm_shadow":"0px 0px 1px #000000","blog_style_align":"left","blog_style_bg_color":"FFFFFF","blog_style_fd_name_bg_color":"000000","blog_style_fd_name_align":"center","blog_style_fd_name_padding":"10","blog_style_fd_name_color":"FFFFFF","blog_style_fd_name_size":"15","blog_style_fd_name_font_weight":"normal","blog_style_fd_icon":"","blog_style_fd_icon_color":"","blog_style_fd_icon_size":"","blog_style_transparent":"100","blog_style_obj_img_align":"center","blog_style_margin":"10","blog_style_box_shadow":"","blog_style_border_width":"1","blog_style_border_style":"solid","blog_style_border_color":"C9C9C9","blog_style_border_type":"top","blog_style_border_radius":"","blog_style_obj_icons_color":"gray","blog_style_obj_date_pos":"after","blog_style_obj_font_family":"inherit","blog_style_obj_info_bg_color":"FFFFFF","blog_style_page_name_color":"000000","blog_style_obj_page_name_size":"13","blog_style_obj_page_name_font_weight":"bold","blog_style_obj_story_color":"000000","blog_style_obj_story_size":"14","blog_style_obj_story_font_weight":"normal","blog_style_obj_place_color":"000000","blog_style_obj_place_size":"13","blog_style_obj_place_font_weight":"normal","blog_style_obj_name_color":"000000","blog_style_obj_name_size":"13","blog_style_obj_name_font_weight":"bold","blog_style_obj_message_color":"000000","blog_style_obj_message_size":"14","blog_style_obj_message_font_weight":"normal","blog_style_obj_hashtags_color":"000000","blog_style_obj_hashtags_size":"12","blog_style_obj_hashtags_font_weight":"normal","blog_style_obj_likes_social_bg_color":"EAEAEA","blog_style_obj_likes_social_color":"656565","blog_style_obj_likes_social_size":"14","blog_style_obj_likes_social_font_weight":"normal","blog_style_obj_comments_bg_color":"FFFFFF","blog_style_obj_comments_color":"000000","blog_style_obj_comments_font_family":"inherit","blog_style_obj_comments_font_size":"14","blog_style_obj_users_font_color":"000000","blog_style_obj_comments_social_font_weight":"normal","blog_style_obj_comment_border_width":"1","blog_style_obj_comment_border_style":"solid","blog_style_obj_comment_border_color":"C9C9C9","blog_style_obj_comment_border_type":"top","blog_style_evt_str_color":"000000","blog_style_evt_str_size":"14","blog_style_evt_str_font_weight":"normal","blog_style_evt_ctzpcn_color":"000000","blog_style_evt_ctzpcn_size":"14","blog_style_evt_ctzpcn_font_weight":"normal","blog_style_evt_map_color":"000000","blog_style_evt_map_size":"14","blog_style_evt_map_font_weight":"normal","blog_style_evt_date_color":"000000","blog_style_evt_date_size":"14","blog_style_evt_date_font_weight":"normal","blog_style_evt_info_font_family":"inherit","album_compact_back_font_color":"000000","album_compact_back_font_style":"inherit","album_compact_back_font_size":"16","album_compact_back_font_weight":"bold","album_compact_back_padding":"0","album_compact_title_font_color":"797979","album_compact_title_font_style":"inherit","album_compact_thumb_title_pos":"bottom","album_compact_title_font_size":"13","album_compact_title_font_weight":"normal","album_compact_title_margin":"2px","album_compact_title_shadow":"0px 0px 0px #888888","album_compact_thumb_margin":"4","album_compact_thumb_padding":"0","album_compact_thumb_border_radius":"0","album_compact_thumb_border_width":"0","album_compact_thumb_border_style":"none","album_compact_thumb_border_color":"CCCCCC","album_compact_thumb_bg_color":"FFFFFF","album_compact_thumbs_bg_color":"FFFFFF","album_compact_thumb_bg_transparent":"0","album_compact_thumb_box_shadow":"0px 0px 0px #888888","album_compact_thumb_transparent":"100","album_compact_thumb_align":"center","album_compact_thumb_hover_effect":"scale","album_compact_thumb_hover_effect_value":"1.1","album_compact_thumb_transition":"0","lightbox_overlay_bg_color":"000000","lightbox_overlay_bg_transparent":"70","lightbox_bg_color":"000000","lightbox_ctrl_btn_pos":"bottom","lightbox_ctrl_btn_align":"center","lightbox_ctrl_btn_height":"20","lightbox_ctrl_btn_margin_top":"10","lightbox_ctrl_btn_margin_left":"7","lightbox_ctrl_btn_transparent":"100","lightbox_ctrl_btn_color":"","lightbox_toggle_btn_height":"14","lightbox_toggle_btn_width":"100","lightbox_ctrl_cont_bg_color":"000000","lightbox_ctrl_cont_transparent":"65","lightbox_ctrl_cont_border_radius":"4","lightbox_close_btn_transparent":"100","lightbox_close_btn_bg_color":"000000","lightbox_close_btn_border_width":"2","lightbox_close_btn_border_radius":"16px","lightbox_close_btn_border_style":"none","lightbox_close_btn_border_color":"FFFFFF","lightbox_close_btn_box_shadow":"0","lightbox_close_btn_color":"","lightbox_close_btn_size":"10","lightbox_close_btn_width":"20","lightbox_close_btn_height":"20","lightbox_close_btn_top":"-10","lightbox_close_btn_right":"-10","lightbox_close_btn_full_color":"","lightbox_rl_btn_bg_color":"000000","lightbox_rl_btn_transparent":"80","lightbox_rl_btn_border_radius":"20px","lightbox_rl_btn_border_width":"0","lightbox_rl_btn_border_style":"none","lightbox_rl_btn_border_color":"FFFFFF","lightbox_rl_btn_box_shadow":"","lightbox_rl_btn_color":"","lightbox_rl_btn_height":"40","lightbox_rl_btn_width":"40","lightbox_rl_btn_size":"20","lightbox_close_rl_btn_hover_color":"","lightbox_obj_pos":"left","lightbox_obj_width":"350","lightbox_obj_icons_color":"gray","lightbox_obj_date_pos":"after","lightbox_obj_font_family":"inherit","lightbox_obj_info_bg_color":"E2E2E2","lightbox_page_name_color":"4B4B4B","lightbox_obj_page_name_size":"14","lightbox_obj_page_name_font_weight":"bold","lightbox_obj_story_color":"4B4B4B","lightbox_obj_story_size":"14","lightbox_obj_story_font_weight":"normal","lightbox_obj_place_color":"000000","lightbox_obj_place_size":"13","lightbox_obj_place_font_weight":"normal","lightbox_obj_name_color":"4B4B4B","lightbox_obj_name_size":"14","lightbox_obj_name_font_weight":"bold","lightbox_obj_message_color":"000000","lightbox_obj_message_size":"14","lightbox_obj_message_font_weight":"normal","lightbox_obj_hashtags_color":"000000","lightbox_obj_hashtags_size":"12","lightbox_obj_hashtags_font_weight":"normal","lightbox_obj_likes_social_bg_color":"878787","lightbox_obj_likes_social_color":"FFFFFF","lightbox_obj_likes_social_size":"14","lightbox_obj_likes_social_font_weight":"normal","lightbox_obj_comments_bg_color":"EAEAEA","lightbox_obj_comments_color":"4A4A4A","lightbox_obj_comments_font_family":"inherit","lightbox_obj_comments_font_size":"14","lightbox_obj_users_font_color":"4B4B4B","lightbox_obj_comments_social_font_weight":"normal","lightbox_obj_comment_border_width":"1","lightbox_obj_comment_border_style":"solid","lightbox_obj_comment_border_color":"C9C9C9","lightbox_obj_comment_border_type":"top","lightbox_filmstrip_pos":"top","lightbox_filmstrip_rl_bg_color":"3B3B3B","lightbox_filmstrip_rl_btn_size":"20","lightbox_filmstrip_rl_btn_color":"","lightbox_filmstrip_thumb_margin":"0 1px","lightbox_filmstrip_thumb_border_width":"1","lightbox_filmstrip_thumb_border_style":"solid","lightbox_filmstrip_thumb_border_color":"000000","lightbox_filmstrip_thumb_border_radius":"0","lightbox_filmstrip_thumb_deactive_transparent":"80","lightbox_filmstrip_thumb_active_border_width":"0","lightbox_filmstrip_thumb_active_border_color":"FFFFFF","lightbox_rl_btn_style":"","lightbox_evt_str_color":"000000","lightbox_evt_str_size":"14","lightbox_evt_str_font_weight":"normal","lightbox_evt_ctzpcn_color":"000000","lightbox_evt_ctzpcn_size":"14","lightbox_evt_ctzpcn_font_weight":"normal","lightbox_evt_map_color":"000000","lightbox_evt_map_size":"14","lightbox_evt_map_font_weight":"normal","lightbox_evt_date_color":"000000","lightbox_evt_date_size":"14","lightbox_evt_date_font_weight":"normal","lightbox_evt_info_font_family":"inherit","page_nav_position":"bottom","page_nav_align":"center","page_nav_number":"0","page_nav_font_size":"12","page_nav_font_style":"inherit","page_nav_font_color":"666666","page_nav_font_weight":"bold","page_nav_border_width":"1","page_nav_border_style":"solid","page_nav_border_color":"E3E3E3","page_nav_border_radius":"0","page_nav_margin":"0","page_nav_padding":"3px 6px","page_nav_button_bg_color":"FFFFFF","page_nav_button_bg_transparent":"100","page_nav_box_shadow":"0","page_nav_button_transition":"1","page_nav_button_text":"0","lightbox_obj_icons_color_likes_comments_count":"white"}',
435
+ ));
436
 
437
 
438
+ }
439
+ wp_schedule_event(time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook');
440
 
441
+ $old_version=ffwd_get_version();
442
 
443
+ $new_version = ffwd_version();
444
+ $newer = version_compare($new_version, $old_version, '>');
445
+ if ($newer) {
446
+ require_once WD_FFWD_DIR . '/update/ffwd_update.php';
447
+ /*adds new params for new versions*/
448
+ ffwd_update_diff($new_version, $old_version);
449
 
450
+
451
+ }
452
+
453
+
454
+ /*$version = get_option("ffwd_version");
455
+ $new_version = '1.0.0';
456
+ if ($version && version_compare($version, $new_version, '<')) {
457
+ require_once WD_FFWD_DIR . "/update/ffwd_update.php";
458
+ ffwd_update($version);
459
+ update_option("ffwd_version", $new_version);
460
+ }
461
+ else {
462
+ add_option("ffwd_version", $new_version, '', 'no');
463
+ }
464
+ */
465
 
466
  }
467
+
468
  register_activation_hook(__FILE__, 'ffwd_activate');
469
 
470
 
471
  /* On deactivation, remove all functions from the scheduled action hook.*/
472
+ function ffwd_deactivate()
473
+ {
474
+ wp_clear_scheduled_hook('wd_fb_schedule_event_hook');
475
  }
 
476
 
477
+ register_deactivation_hook(__FILE__, 'ffwd_deactivate');
478
+
479
+ function ffwd_update_hook()
480
+ {
481
+ /*$version = get_option("ffwd_version");
482
  $new_version = '1.0.0';
483
  if ($version && version_compare($version, $new_version, '<')) {
484
  require_once WD_FFWD_DIR . "/update/ffwd_update.php";
486
  update_option("ffwd_version", $new_version);
487
  }*/
488
 
489
+ return false;
490
  }
491
+
492
  if (!isset($_GET['action']) || $_GET['action'] != 'deactivate') {
493
+ add_action('admin_init', 'ffwd_update_hook');
494
  }
495
 
496
  // Plugin styles.
497
+ function ffwd_styles()
498
+ {
499
+ wp_admin_css('thickbox');
500
+ wp_enqueue_style('ffwd_tables', WD_FFWD_URL . '/css/ffwd_tables.css', array(), ffwd_get_version());
501
  }
502
 
503
  // Plugin scripts.
504
+ function ffwd_scripts()
505
+ {
506
+ wp_enqueue_script('thickbox');
507
+ wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version());
508
+
509
+ global $wp_scripts;
510
+ if (isset($wp_scripts->registered['jquery'])) {
511
+ $jquery = $wp_scripts->registered['jquery'];
512
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
513
+ wp_deregister_script('jquery');
514
+ wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2');
515
+ }
516
  }
517
+ wp_enqueue_script('jquery');
518
+ wp_enqueue_script('jquery-ui-sortable');
 
519
  }
520
 
521
  /* Add pagination to gallery admin pages.*/
522
+ function ffwd_add_ffwd_info_per_page_option()
523
+ {
524
+ $option = 'per_page';
525
+ $args_galleries = array(
526
+ 'label' => 'Items',
527
+ 'default' => 20,
528
+ 'option' => 'ffwd_info_per_page'
529
+ );
530
+ add_screen_option($option, $args_galleries);
531
+ }
532
+
533
+ function ffwd_add_themes_per_page_option()
534
+ {
535
+ $option = 'per_page';
536
+ $args_themes = array(
537
+ 'label' => 'Themes',
538
+ 'default' => 20,
539
+ 'option' => 'ffwd_themes_per_page'
540
+ );
541
+ add_screen_option($option, $args_themes);
542
  }
543
 
544
  add_filter('set-screen-option', 'ffwd_set_option_galleries', 10, 3);
545
  add_filter('set-screen-option', 'ffwd_set_option_themes', 10, 3);
546
 
547
+ function ffwd_set_option_galleries($status, $option, $value)
548
+ {
549
+ if ('ffwd_info_per_page' == $option) return $value;
550
+ return $status;
551
  }
552
+
553
+ function ffwd_set_option_themes($status, $option, $value)
554
+ {
555
+ if ('ffwd_themes_per_page' == $option) return $value;
556
+ return $status;
557
  }
558
 
559
+ function ffwd_admin_scripts()
560
+ {
561
+ wp_enqueue_script('thickbox');
562
+ wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version());
563
+ global $wp_scripts;
564
+ if (isset($wp_scripts->registered['jquery'])) {
565
+ $jquery = $wp_scripts->registered['jquery'];
566
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
567
+ wp_deregister_script('jquery');
568
+ wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2');
569
+ }
570
  }
571
+ wp_enqueue_script('jquery');
572
+ wp_enqueue_script('jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9');
573
+ wp_enqueue_style('ffwd_font-awesome', WD_FFWD_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0');
574
+ }
575
+
576
+ function ffwd_front_end_scripts()
577
+ {
578
+ $version = ffwd_get_version();
579
+ global $wp_scripts;
580
+ if (isset($wp_scripts->registered['jquery'])) {
581
+ $jquery = $wp_scripts->registered['jquery'];
582
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
583
+ wp_deregister_script('jquery');
584
+ wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2');
585
+ }
586
  }
587
+ wp_enqueue_script('jquery');
588
+ wp_enqueue_script('ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version);
589
+ wp_enqueue_style('ffwd_frontend', WD_FFWD_FRONT_URL . '/css/ffwd_frontend.css', array(), $version);
590
+ // Styles/Scripts for popup.
591
+ wp_enqueue_style('ffwd_font-awesome', WD_FFWD_FRONT_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0');
592
+ wp_enqueue_script('ffwd_jquery_mobile', WD_FFWD_FRONT_URL . '/js/jquery.mobile.js', array(), $version);
593
+ wp_enqueue_script('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $version);
594
+ wp_enqueue_style('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/css/jquery.mCustomScrollbar.css', array(), $version);
595
+ wp_enqueue_script('jquery-fullscreen', WD_FFWD_FRONT_URL . '/js/jquery.fullscreen-0.4.1.js', array(), '0.4.1');
596
+ wp_enqueue_script('ffwd_gallery_box', WD_FFWD_FRONT_URL . '/js/ffwd_gallery_box.js', array(), $version);
597
+ wp_localize_script('ffwd_gallery_box', 'ffwd_objectL10n', array(
598
+ 'ffwd_field_required' => __('field is required.', 'bwg'),
599
+ 'ffwd_mail_validation' => __('This is not a valid email address.', 'bwg'),
600
+ 'ffwd_search_result' => __('There are no images matching your search.', 'bwg'),
601
+ ));
 
602
  }
603
+
604
  add_action('wp_enqueue_scripts', 'ffwd_front_end_scripts');
605
 
606
  /* Add bwg scheduled event for autoupdatable galleries.*/
607
+ add_filter('cron_schedules', 'wd_fb_add_autoupdate_interval');
608
+ function wd_fb_add_autoupdate_interval($schedules)
609
+ {
610
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
611
+ $autoupdate_interval = WDFacebookFeed::get_autoupdate_interval();
612
+ // var_dump($autoupdate_interval);
613
+ $schedules['wd_fb_autoupdate_interval'] = array(
614
+ 'interval' => 60 * $autoupdate_interval,
615
+ 'display' => __('WD Facebook plugin autoupdate interval.')
616
+ );
617
+ return $schedules;
618
+ }
619
+
620
+
621
+ add_action('wd_fb_schedule_event_hook', 'wd_fb_update');
622
+ // wd_fb_update();
623
+ function wd_fb_update()
624
+ {
625
+ global $wpdb;
626
+ $query = "SELECT * FROM " . $wpdb->prefix . "wd_fb_info WHERE `update_mode` <> 'no_update'";
627
+ $rows = $wpdb->get_results($query);
628
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
629
+ WDFacebookFeed::update_from_shedule($rows);
630
+ return;
631
  }
632
 
633
  // Facebook feed wd Widget.
634
  if (class_exists('WP_Widget')) {
635
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDControllerWidget.php');
636
+ add_action('widgets_init', create_function('', 'return register_widget("FFWDControllerWidget");'));
637
  }
638
 
639
  // Languages localization.
640
+ function ffwd_language_load()
641
+ {
642
+ load_plugin_textdomain('bwg', FALSE, basename(dirname(__FILE__)) . '/languages');
643
  }
644
+
645
  add_action('init', 'ffwd_language_load');
646
 
647
+ function ffwd_version()
648
+ {
649
+
650
+ $version = '1.0.2';
651
+
652
+ if (get_option('ffwd_version') === false) {
653
+ add_option('ffwd_version', $version);
654
+ } else {
655
+ update_option('ffwd_version', $version);
656
 
 
657
 
658
+ }
 
 
 
 
 
 
659
 
660
 
661
+ return $version;
662
 
663
+ }
664
 
665
+ function ffwd_get_version()
666
+ {
667
+ if(get_option('ffwd_version') === false) {
668
+ ffwd_version();
669
+
670
+ }
671
+ return get_option('ffwd_version');
672
 
 
673
 
674
  }
675
 
featured/images/catalog.jpg ADDED
Binary file
featured/images/contact-form-builder.jpg ADDED
Binary file
featured/images/contact-form-maker.jpg ADDED
Binary file
featured/images/contacts.jpg ADDED
Binary file
featured/images/download.jpg ADDED
Binary file
featured/images/facebook.jpg ADDED
Binary file
featured/images/faq.jpg ADDED
Binary file
featured/images/flash.calendar.jpg ADDED
Binary file
featured/images/folder.menu.jpg ADDED
Binary file
featured/images/form.jpg ADDED
Binary file
featured/images/photo-gallery.jpg ADDED
Binary file
featured/images/player.jpg ADDED
Binary file
featured/images/slider.jpg ADDED
Binary file
featured/images/spider-calendar.jpg ADDED
Binary file
featured/images/twitter-widget.jpg ADDED
Binary file
featured/images/zoom.jpg ADDED
Binary file
framework/WDFacebookFeed.php CHANGED
@@ -193,7 +193,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
193
  'limit' => self::$limit,
194
  'app_id' => '',
195
  'app_secret' => '',
196
- 'exist_access' => self::$exist_access,
197
  'access_token' => self::$access_token,
198
  'published' => $published,
199
  'update_mode' => $update_mode,
@@ -506,32 +506,37 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
506
  self::wd_fb_massage('error', 'Invalid content type');
507
  }
508
 
509
- public static function set_access_token() {
510
- $exist_access = ((isset($_POST['exist_access'])) ? $_POST['exist_access'] : 1);
511
- // If fb type is profile so get user access token
512
- if(self::$fb_type == 'profile') {
513
- self::$facebook_sdk->setExtendedAccessToken();
514
- self::$access_token = self::$facebook_sdk->getAccessToken();
515
- self::$exist_access = $exist_access;
516
- return;
517
- }
518
- // If fb type is page or group so get any valid access token
519
- if($exist_access) {
520
- $rand_key = array_rand(self::$access_tokens);
521
- self::$access_token = self::$access_tokens[$rand_key];
522
- }
 
 
 
 
 
 
 
 
523
  else {
524
- if(isset($_POST['access_token']) && esc_html(stripslashes($_POST['access_token'])) != '') {
525
- self::$access_token = esc_html(stripslashes($_POST['access_token']));
526
- }
527
- else {
528
- self::wd_fb_massage('error', 'Access token not set');
529
- }
530
- }
531
- self::$exist_access = $exist_access;
532
- }
533
 
534
- public static function check_fb_page_url() {
 
 
 
 
 
 
535
  $first_token = strtok(self::$content_url, '/');
536
  $second_token = strtok('/');
537
  $third_token = strtok('/');
@@ -816,7 +821,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
816
  'limit' => self::$limit,
817
  'app_id' => '',
818
  'app_secret' => '',
819
- 'exist_access' => self::$exist_access,
820
  'access_token' => self::$access_token,
821
  'order' => ((int) $wpdb->get_var('SELECT MAX(`order`) FROM ' . $wpdb->prefix . 'wd_fb_info')) + 1,
822
  'published' => 1,
@@ -1118,55 +1123,80 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
1118
  }
1119
  }
1120
 
1121
- public static function check_app() {
1122
- global $wpdb;
1123
 
1124
  if(!class_exists('Facebook'))
1125
- include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
1126
- $app_id = ((isset($_POST['app_id'])) ? esc_html(stripslashes($_POST['app_id'])) : '');
1127
- $app_secret = ((isset($_POST['app_secret'])) ? esc_html(stripslashes($_POST['app_secret'])) : '');
1128
- //prepare params for graph api call
1129
- $fb_graph_url = str_replace (
1130
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1131
- array($app_id, '', 'access_token=' . $app_id . '|' . $app_secret . '&', 'fields=roles&', '', ''),
1132
- self::$graph_url
1133
- );
1134
 
1135
- $data = self::decap_do_curl($fb_graph_url);
1136
- //check if exists app with such app_id and app_secret
1137
- if(array_key_exists("id", $data) && array_key_exists("roles", $data)) {
1138
- //create facebook object
 
 
 
 
 
 
 
 
 
 
 
 
1139
  self::$facebook_sdk = new Facebook(array(
1140
- 'appId' => $app_id,
1141
- 'secret' => $app_secret,
1142
- ));
1143
- //save app id and app secret
1144
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1145
- 'app_id' => $app_id,
1146
- 'app_secret' => $app_secret,
1147
- ),
 
 
 
 
 
 
 
 
 
 
1148
  array('id' => 1)
1149
  );
1150
 
1151
- //checked logged in user
1152
- $user = self::$facebook_sdk->getUser();
1153
- if (!$user) {
1154
- $app_link_url = self::$facebook_sdk->getLoginUrl(array( 'scope' => 'user_photos,user_videos,user_posts','redirect_uri' => admin_url() . 'admin.php?page=options_ffwd'));
1155
  $app_link_text = __('Log into Facebook with your app', 'bwg');
1156
  self::wd_fb_massage('success', $app_link_url);
1157
- }
1158
- else {
1159
- self::wd_fb_massage('success', admin_url() . 'admin.php?page=options_ffwd');
1160
- }
1161
- }
1162
- //check if exist error
1163
- elseif(array_key_exists("error", $data)) {
1164
- self::wd_fb_massage('error', $data['error']['message']);
1165
- }
1166
- else {
1167
- self::wd_fb_massage('error', 'Something went wrong');
1168
- }
1169
- }
 
 
 
 
 
 
 
 
1170
  public static function dropp_objects() {
1171
  global $wpdb;
1172
  $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? $_POST['ids'] : '';
@@ -1233,7 +1263,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
1233
  $facebook_graph_results = json_decode($facebook_graph_results, true);
1234
  return $facebook_graph_results;
1235
  }
1236
-
1237
  public static function get_autoupdate_interval(){
1238
  global $wpdb;
1239
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
193
  'limit' => self::$limit,
194
  'app_id' => '',
195
  'app_secret' => '',
196
+ 'exist_access' => 1,
197
  'access_token' => self::$access_token,
198
  'published' => $published,
199
  'update_mode' => $update_mode,
506
  self::wd_fb_massage('error', 'Invalid content type');
507
  }
508
 
509
+ public static function set_access_token() {
510
+ $fb_option_data = self::get_fb_option_data();
511
+
512
+
513
+ $exist_access = ((isset($_POST['exist_access'])) ? $_POST['exist_access'] : 1);
514
+
515
+ if($fb_option_data->access_token!='')
516
+ {
517
+ $exist_access=0;
518
+ }
519
+ // If fb type is profile so get user access token
520
+ if(self::$fb_type == 'profile') {
521
+ self::$facebook_sdk->setExtendedAccessToken();
522
+ self::$access_token = self::$facebook_sdk->getAccessToken();
523
+ self::$exist_access = $exist_access;
524
+ return;
525
+ }
526
+ // If fb type is page or group so get any valid access token
527
+ if($exist_access) {
528
+ $rand_key = array_rand(self::$access_tokens);
529
+ self::$access_token = self::$access_tokens[$rand_key];
530
+ }
531
  else {
 
 
 
 
 
 
 
 
 
532
 
533
+ self::$access_token = esc_html(stripslashes($fb_option_data->access_token));
534
+
535
+ }
536
+ self::$exist_access = $exist_access;
537
+ }
538
+
539
+ public static function check_fb_page_url() {
540
  $first_token = strtok(self::$content_url, '/');
541
  $second_token = strtok('/');
542
  $third_token = strtok('/');
821
  'limit' => self::$limit,
822
  'app_id' => '',
823
  'app_secret' => '',
824
+ 'exist_access' => 1,
825
  'access_token' => self::$access_token,
826
  'order' => ((int) $wpdb->get_var('SELECT MAX(`order`) FROM ' . $wpdb->prefix . 'wd_fb_info')) + 1,
827
  'published' => 1,
1123
  }
1124
  }
1125
 
1126
+ public static function check_app() {
1127
+ global $wpdb;
1128
 
1129
  if(!class_exists('Facebook'))
1130
+ include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
1131
+ $app_id = ((isset($_POST['app_id'])) ? esc_html(stripslashes($_POST['app_id'])) : '');
1132
+ $app_secret = ((isset($_POST['app_secret'])) ? esc_html(stripslashes($_POST['app_secret'])) : '');
1133
+ //prepare params for graph api call
 
 
 
 
 
1134
 
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+ $fb_graph_url = str_replace (
1142
+ array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1143
+ array($app_id, '', 'access_token=' . $app_id . '|' . $app_secret . '&', 'fields=roles&', '', ''),
1144
+ self::$graph_url
1145
+ );
1146
+
1147
+ $data = self::decap_do_curl($fb_graph_url);
1148
+ //check if exists app with such app_id and app_secret
1149
+ if(array_key_exists("id", $data) && array_key_exists("roles", $data)) {
1150
+ //create facebook object
1151
  self::$facebook_sdk = new Facebook(array(
1152
+ 'appId' => $app_id,
1153
+ 'secret' => $app_secret,
1154
+ ));
1155
+
1156
+ $response_url='https://graph.facebook.com/oauth/access_token?client_id='.$app_id.'&client_secret='.$app_secret.'&grant_type=client_credentials';
1157
+ $response = wp_remote_get( $response_url);
1158
+
1159
+ $access_token=explode('=',$response['body']);
1160
+ $access_token=$access_token[1];
1161
+
1162
+
1163
+
1164
+ //save app id and app secret
1165
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1166
+ 'app_id' => $app_id,
1167
+ 'app_secret' => $app_secret,
1168
+ 'access_token' => $access_token,
1169
+ ),
1170
  array('id' => 1)
1171
  );
1172
 
1173
+ //checked logged in user
1174
+ $user = self::$facebook_sdk->getUser();
1175
+ if (!$user) {
1176
+ $app_link_url = self::$facebook_sdk->getLoginUrl(array( 'scope' => 'user_photos,user_videos,user_posts','redirect_uri' => admin_url() . 'admin.php?page=options_ffwd'));
1177
  $app_link_text = __('Log into Facebook with your app', 'bwg');
1178
  self::wd_fb_massage('success', $app_link_url);
1179
+ }
1180
+ else {
1181
+ self::wd_fb_massage('success', admin_url() . 'admin.php?page=options_ffwd');
1182
+ }
1183
+ }
1184
+ //check if exist error
1185
+ elseif(array_key_exists("error", $data)) {
1186
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1187
+
1188
+ 'access_token' => '',
1189
+ ),
1190
+ array('id' => 1)
1191
+ );
1192
+
1193
+ self::wd_fb_massage('error', $data['error']['message']);
1194
+ }
1195
+ else {
1196
+ self::wd_fb_massage('error', 'Something went wrong');
1197
+ }
1198
+ }
1199
+
1200
  public static function dropp_objects() {
1201
  global $wpdb;
1202
  $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? $_POST['ids'] : '';
1263
  $facebook_graph_results = json_decode($facebook_graph_results, true);
1264
  return $facebook_graph_results;
1265
  }
1266
+
1267
  public static function get_autoupdate_interval(){
1268
  global $wpdb;
1269
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
images/themes/almum.png ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
4
  Tags: custom facebook feed,custom, customizable, customizable facebook feed, face book, facebook, facebook embed, facebook events, facebook fans, facebook feed, facebook feeds, facebook followers, facebook group, facebook groups, facebook hashtag, facebook like box, facebook likes, facebook Page, facebook pages, facebook plug-in, facebook plugin, facebook postings, facebook posts, facebook wall, facebook walls, facebooks, mobile, posts, responsive, seo, social media, events, facebook photo, facebook photos, responsive facebook feed,, widget, facebook profile, likebox, popup
5
  Requires at least: 3.4
6
  Tested up to: 4.5
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,9 @@ Upgrade to [Facebook Feed Pro](https://web-dorado.com/products/wordpress-faceboo
66
 
67
  == Changelog ==
68
 
 
 
 
69
  = 1.0.1 =
70
  * Minor bug fixed
71
 
4
  Tags: custom facebook feed,custom, customizable, customizable facebook feed, face book, facebook, facebook embed, facebook events, facebook fans, facebook feed, facebook feeds, facebook followers, facebook group, facebook groups, facebook hashtag, facebook like box, facebook likes, facebook Page, facebook pages, facebook plug-in, facebook plugin, facebook postings, facebook posts, facebook wall, facebook walls, facebooks, mobile, posts, responsive, seo, social media, events, facebook photo, facebook photos, responsive facebook feed,, widget, facebook profile, likebox, popup
5
  Requires at least: 3.4
6
  Tested up to: 4.5
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.0.2 =
70
+ * Minor bug fixed
71
+
72
  = 1.0.1 =
73
  * Minor bug fixed
74
 
update/ffwd_update.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @param version without first '1' or '2'
4
+ *
5
+ */
6
+
7
+ function ffwd_update_diff($new_v, $old_v = 0.0){
8
+ global $wpdb;
9
+
10
+
11
+ if(version_compare($old_v,'1.0.2','<')) {
12
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . "wd_fb_option ADD `access_token` varchar(255) NOT NULL DEFAULT ''");
13
+
14
+ }
15
+
16
+
17
+
18
+ }
19
+