WD Facebook Feed – Custom Facebook Feed Plugin - Version 1.2.0

Version Description

  • Changed: Facebook Graph API v10.0 integration
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 WD Facebook Feed – Custom Facebook Feed Plugin
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.34 to 1.2.0

Files changed (109) hide show
  1. admin/controllers/FFWDControllerInfo_ffwd.php +1 -1
  2. admin/controllers/FFWDControllerLicensing_ffwd.php +5 -35
  3. admin/controllers/FFWDControllerOptions_ffwd.php +11 -30
  4. admin/controllers/FFWDControllerThemes_ffwd.php +1 -0
  5. admin/controllers/FFWDControllerUninstall_ffwd.php +51 -70
  6. admin/controllers/FFWDControllerWidget.php +7 -7
  7. admin/models/FFWDModelFFWDShortcode.php +1 -1
  8. admin/models/FFWDModelInfo_ffwd.php +14 -33
  9. admin/models/FFWDModelLicensing_ffwd.php +0 -30
  10. admin/models/FFWDModelOptions_ffwd.php +98 -56
  11. admin/models/FFWDModelThemes_ffwd.php +6 -33
  12. admin/models/FFWDModelUninstall_ffwd.php +0 -49
  13. admin/models/FFWDModelWidget.php +1 -1
  14. admin/views/FFWDViewFFWDShortcode.php +178 -179
  15. admin/views/FFWDViewInfo_ffwd.php +501 -521
  16. admin/views/FFWDViewLicensing_ffwd.php +80 -123
  17. admin/views/FFWDViewOptions_ffwd.php +62 -25
  18. admin/views/FFWDViewThemes_ffwd.php +200 -57
  19. admin/views/FFWDViewUninstall_ffwd.php +0 -123
  20. admin/views/FFWDViewWidget.php +188 -220
  21. admin/views/uninstall.php +68 -0
  22. css/ffwd_frontend.css +24 -25
  23. css/ffwd_shortcode.css +1 -0
  24. css/ffwd_tables.css +795 -793
  25. css/wd_bp_install.css +4 -0
  26. elementor/elementor.php +1 -0
  27. elementor/widget.php +1 -2
  28. facebook-feed-wd-notices.php +1 -1
  29. facebook-feed-wd.php +452 -604
  30. framework/WDFacebookFeed.php +1680 -1608
  31. framework/WDW_FFWD_Library.php +32 -203
  32. framework/facebook-sdk/base_facebook.php +23 -19
  33. framework/facebook-sdk/src/Facebook/Authentication/AccessToken.php +160 -0
  34. framework/facebook-sdk/src/Facebook/Authentication/AccessTokenMetadata.php +390 -0
  35. framework/facebook-sdk/src/Facebook/Authentication/OAuth2Client.php +292 -0
  36. framework/facebook-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php +33 -0
  37. framework/facebook-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php +33 -0
  38. framework/facebook-sdk/src/Facebook/Exceptions/FacebookClientException.php +33 -0
  39. framework/facebook-sdk/src/Facebook/Exceptions/FacebookOtherException.php +33 -0
  40. framework/facebook-sdk/src/Facebook/Exceptions/FacebookResponseException.php +208 -0
  41. framework/facebook-sdk/src/Facebook/Exceptions/FacebookSDKException.php +33 -0
  42. framework/facebook-sdk/src/Facebook/Exceptions/FacebookServerException.php +33 -0
  43. framework/facebook-sdk/src/Facebook/Exceptions/FacebookThrottleException.php +33 -0
  44. framework/facebook-sdk/src/Facebook/Facebook.php +589 -0
  45. framework/facebook-sdk/src/Facebook/FacebookApp.php +101 -0
  46. framework/facebook-sdk/src/Facebook/FacebookBatchRequest.php +303 -0
  47. framework/facebook-sdk/src/Facebook/FacebookBatchResponse.php +154 -0
  48. framework/facebook-sdk/src/Facebook/FacebookClient.php +250 -0
  49. framework/facebook-sdk/src/Facebook/FacebookRequest.php +536 -0
  50. framework/facebook-sdk/src/Facebook/FacebookResponse.php +410 -0
  51. framework/facebook-sdk/src/Facebook/FileUpload/FacebookFile.php +135 -0
  52. framework/facebook-sdk/src/Facebook/FileUpload/FacebookVideo.php +33 -0
  53. framework/facebook-sdk/src/Facebook/FileUpload/Mimetypes.php +987 -0
  54. framework/facebook-sdk/src/Facebook/GraphNodes/Collection.php +242 -0
  55. framework/facebook-sdk/src/Facebook/GraphNodes/GraphAchievement.php +113 -0
  56. framework/facebook-sdk/src/Facebook/GraphNodes/GraphAlbum.php +183 -0
  57. framework/facebook-sdk/src/Facebook/GraphNodes/GraphApplication.php +43 -0
  58. framework/facebook-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php +72 -0
  59. framework/facebook-sdk/src/Facebook/GraphNodes/GraphEdge.php +260 -0
  60. framework/facebook-sdk/src/Facebook/GraphNodes/GraphEvent.php +242 -0
  61. framework/facebook-sdk/src/Facebook/GraphNodes/GraphGroup.php +171 -0
  62. framework/facebook-sdk/src/Facebook/GraphNodes/GraphList.php +36 -0
  63. framework/facebook-sdk/src/Facebook/GraphNodes/GraphLocation.php +102 -0
  64. framework/facebook-sdk/src/Facebook/GraphNodes/GraphNode.php +185 -0
  65. framework/facebook-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php +392 -0
  66. framework/facebook-sdk/src/Facebook/GraphNodes/GraphObject.php +36 -0
  67. framework/facebook-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php +86 -0
  68. framework/facebook-sdk/src/Facebook/GraphNodes/GraphPage.php +125 -0
  69. framework/facebook-sdk/src/Facebook/GraphNodes/GraphPicture.php +72 -0
  70. framework/facebook-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php +102 -0
  71. framework/facebook-sdk/src/Facebook/GraphNodes/GraphUser.php +162 -0
  72. framework/facebook-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php +52 -0
  73. framework/facebook-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php +42 -0
  74. framework/facebook-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php +95 -0
  75. framework/facebook-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +360 -0
  76. framework/facebook-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +166 -0
  77. framework/facebook-sdk/src/Facebook/Http/GraphRawResponse.php +137 -0
  78. framework/facebook-sdk/src/Facebook/Http/RequestBodyInterface.php +39 -0
  79. framework/facebook-sdk/src/Facebook/Http/RequestBodyMultipart.php +170 -0
  80. framework/facebook-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php +55 -0
  81. framework/facebook-sdk/src/Facebook/HttpClients/FacebookCurl.php +129 -0
  82. framework/facebook-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php +210 -0
  83. framework/facebook-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +97 -0
  84. framework/facebook-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php +47 -0
  85. framework/facebook-sdk/src/Facebook/HttpClients/FacebookStream.php +80 -0
  86. framework/facebook-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php +94 -0
  87. framework/facebook-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
  88. framework/facebook-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +53 -0
  89. framework/facebook-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +76 -0
  90. framework/facebook-sdk/src/Facebook/PersistentData/PersistentDataInterface.php +49 -0
  91. framework/facebook-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +68 -0
  92. framework/facebook-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +67 -0
  93. framework/facebook-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +45 -0
  94. framework/facebook-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +58 -0
  95. framework/facebook-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +89 -0
  96. framework/facebook-sdk/src/Facebook/SignedRequest.php +332 -0
  97. framework/facebook-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php +163 -0
  98. framework/facebook-sdk/src/Facebook/Url/FacebookUrlManipulator.php +167 -0
  99. framework/facebook-sdk/src/Facebook/Url/UrlDetectionInterface.php +39 -0
  100. framework/facebook-sdk/src/Facebook/autoload.php +79 -0
  101. frontend/controllers/FFWDControllerMain.php +4 -36
  102. frontend/controllers/FFWDControllerPopupBox.php +0 -49
  103. frontend/models/FFWDModelAlbum_compact.php +0 -69
  104. frontend/models/FFWDModelBlog_style.php +61 -92
  105. frontend/models/FFWDModelMain.php +53 -59
  106. frontend/models/FFWDModelPopupBox.php +0 -273
  107. frontend/models/FFWDModelThumbnails.php +0 -84
  108. frontend/models/FFWDModelThumbnails_masonry.php +0 -69
  109. frontend/views/FFWDViewAlbum_compact.php +0 -537
admin/controllers/FFWDControllerInfo_ffwd.php CHANGED
@@ -61,7 +61,7 @@ class FFWDControllerInfo_ffwd {
61
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewInfo_ffwd.php";
62
  $view = new FFWDViewInfo_ffwd($model);
63
  $current_id = WDW_FFWD_Library::get('current_id');
64
- $id = ((isset($current_id) && esc_html(stripslashes($current_id)) != '') ? esc_html(stripslashes($current_id)) : 0);
65
  $view->edit($id);
66
  }
67
 
61
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewInfo_ffwd.php";
62
  $view = new FFWDViewInfo_ffwd($model);
63
  $current_id = WDW_FFWD_Library::get('current_id');
64
+ $id = ((isset($current_id) && sanitize_text_field(stripslashes($current_id)) != '') ? sanitize_text_field(stripslashes($current_id)) : 0);
65
  $view->edit($id);
66
  }
67
 
admin/controllers/FFWDControllerLicensing_ffwd.php CHANGED
@@ -1,34 +1,17 @@
1
  <?php
2
 
3
  class FFWDControllerLicensing_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
23
-
24
- if($task != ''){
25
- if(!WDWLibrary::verify_nonce('licensing_bwg')){
26
  die('Sorry, your nonce did not verify.');
27
  }
28
  }
29
-
30
-
31
- if (method_exists($this, $task)) {
32
  $this->$task($id);
33
  }
34
  else {
@@ -37,21 +20,8 @@ class FFWDControllerLicensing_ffwd {
37
  }
38
 
39
  public function display() {
40
- require_once WD_FFWD_DIR . "/admin/models/FFWDModelLicensing_ffwd.php";
41
- $model = new FFWDModelLicensing_ffwd();
42
-
43
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewLicensing_ffwd.php";
44
- $view = new FFWDViewLicensing_ffwd($model);
45
  $view->display();
46
  }
47
-
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- // Getters & Setters //
50
- ////////////////////////////////////////////////////////////////////////////////////////
51
- ////////////////////////////////////////////////////////////////////////////////////////
52
- // Private Methods //
53
- ////////////////////////////////////////////////////////////////////////////////////////
54
- ////////////////////////////////////////////////////////////////////////////////////////
55
- // Listeners //
56
- ////////////////////////////////////////////////////////////////////////////////////////
57
  }
1
  <?php
2
 
3
  class FFWDControllerLicensing_ffwd {
 
 
 
 
 
 
 
 
 
 
 
 
4
  public function __construct() {
5
  }
6
+
 
 
7
  public function execute() {
8
  $task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
9
+ if ( $task != '' ) {
10
+ if ( !WDWLibrary::verify_nonce('licensing_bwg') ) {
 
11
  die('Sorry, your nonce did not verify.');
12
  }
13
  }
14
+ if ( method_exists($this, $task) ) {
 
 
15
  $this->$task($id);
16
  }
17
  else {
20
  }
21
 
22
  public function display() {
 
 
 
23
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewLicensing_ffwd.php";
24
+ $view = new FFWDViewLicensing_ffwd();
25
  $view->display();
26
  }
 
 
 
 
 
 
 
 
 
 
27
  }
admin/controllers/FFWDControllerOptions_ffwd.php CHANGED
@@ -1,23 +1,10 @@
1
  <?php
2
 
3
  class FFWDControllerOptions_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function execute() {
22
  $task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
23
  $id = ((isset($_POST['current_id'])) ? sanitize_text_field(stripslashes($_POST['current_id'])) : 0);
@@ -27,14 +14,15 @@ class FFWDControllerOptions_ffwd {
27
  }
28
  }
29
 
30
- if(isset($_GET['ffwd_code']) && !empty($_GET['ffwd_code'])){
31
- $save_pages = WDFacebookFeed::save_pages(sanitize_text_field($_GET['ffwd_code']));
32
  if ( $save_pages ) {
33
  die('<script>window.location.href="admin.php?page=options_ffwd&success=1"</script>');
34
  }
35
  else{
36
  die('<script>window.location.href="admin.php?page=options_ffwd&success=0"</script>');
37
  }
 
38
  }
39
 
40
  if (method_exists($this, $task)) {
@@ -58,6 +46,7 @@ class FFWDControllerOptions_ffwd {
58
  require_once WD_FFWD_DIR . "/admin/models/FFWDModelOptions_ffwd.php";
59
  $model = new FFWDModelOptions_ffwd();
60
 
 
61
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewOptions_ffwd.php";
62
  $view = new FFWDViewOptions_ffwd($model);
63
  echo WDW_FFWD_Library::message('Settings successfully reset', 'updated');
@@ -72,6 +61,7 @@ class FFWDControllerOptions_ffwd {
72
  public function save_db() {
73
  //facebook user_id pahel autoupdate_interval
74
  global $wpdb;
 
75
  $id = 1;
76
  $autoupdate_interval = (isset($_POST['autoupdate_interval_hour']) && isset($_POST['autoupdate_interval_min']) ? ((int) $_POST['autoupdate_interval_hour'] * 60 + (int) $_POST['autoupdate_interval_min']) : 30);
77
  /*minimum autoupdate interval is 1 min*/
@@ -81,7 +71,8 @@ class FFWDControllerOptions_ffwd {
81
  $date_timezone = (isset($_POST[ WD_FB_PREFIX . '_date_timezone']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_date_timezone'])) : 'Pacific/Midway');
82
  $post_date_format = (isset($_POST[ WD_FB_PREFIX . '_post_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_post_date_format'])) : 'Pacific/Midway');
83
  $event_date_format = (isset($_POST[ WD_FB_PREFIX . '_event_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_event_date_format'])) : 'Pacific/Midway');
84
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
 
85
  'autoupdate_interval' => $autoupdate_interval,
86
  'app_id' => $facebook_app_id,
87
  'app_secret' => $facebook_app_secret,
@@ -97,10 +88,9 @@ class FFWDControllerOptions_ffwd {
97
  * refresh filter according to new time interval,
98
  * then add new schedule with the same hook name
99
  */
 
100
 
101
- update_option('ffwd_autoupdate_time',$autoupdate_interval*60+current_time('timestamp'));
102
-
103
- wp_clear_scheduled_hook( 'wd_fb_schedule_event_hook' );
104
  remove_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
105
  add_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
106
  wp_schedule_event( time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook' );
@@ -126,13 +116,4 @@ class FFWDControllerOptions_ffwd {
126
 
127
  return ($save !== false);
128
  }
129
- ////////////////////////////////////////////////////////////////////////////////////////
130
- // Getters & Setters //
131
- ////////////////////////////////////////////////////////////////////////////////////////
132
- ////////////////////////////////////////////////////////////////////////////////////////
133
- // Private Methods //
134
- ////////////////////////////////////////////////////////////////////////////////////////
135
- ////////////////////////////////////////////////////////////////////////////////////////
136
- // Listeners //
137
- ////////////////////////////////////////////////////////////////////////////////////////
138
  }
1
  <?php
2
 
3
  class FFWDControllerOptions_ffwd {
4
+
 
 
 
 
 
 
 
 
 
 
 
5
  public function __construct() {
6
  }
7
+
 
 
8
  public function execute() {
9
  $task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
10
  $id = ((isset($_POST['current_id'])) ? sanitize_text_field(stripslashes($_POST['current_id'])) : 0);
14
  }
15
  }
16
 
17
+ if(!empty($_GET['ffwd_code'])){
18
+ $save_pages = WDFacebookFeed::save_pages($_GET['ffwd_code']);
19
  if ( $save_pages ) {
20
  die('<script>window.location.href="admin.php?page=options_ffwd&success=1"</script>');
21
  }
22
  else{
23
  die('<script>window.location.href="admin.php?page=options_ffwd&success=0"</script>');
24
  }
25
+
26
  }
27
 
28
  if (method_exists($this, $task)) {
46
  require_once WD_FFWD_DIR . "/admin/models/FFWDModelOptions_ffwd.php";
47
  $model = new FFWDModelOptions_ffwd();
48
 
49
+
50
  require_once WD_FFWD_DIR . "/admin/views/FFWDViewOptions_ffwd.php";
51
  $view = new FFWDViewOptions_ffwd($model);
52
  echo WDW_FFWD_Library::message('Settings successfully reset', 'updated');
61
  public function save_db() {
62
  //facebook user_id pahel autoupdate_interval
63
  global $wpdb;
64
+
65
  $id = 1;
66
  $autoupdate_interval = (isset($_POST['autoupdate_interval_hour']) && isset($_POST['autoupdate_interval_min']) ? ((int) $_POST['autoupdate_interval_hour'] * 60 + (int) $_POST['autoupdate_interval_min']) : 30);
67
  /*minimum autoupdate interval is 1 min*/
71
  $date_timezone = (isset($_POST[ WD_FB_PREFIX . '_date_timezone']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_date_timezone'])) : 'Pacific/Midway');
72
  $post_date_format = (isset($_POST[ WD_FB_PREFIX . '_post_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_post_date_format'])) : 'Pacific/Midway');
73
  $event_date_format = (isset($_POST[ WD_FB_PREFIX . '_event_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_event_date_format'])) : 'Pacific/Midway');
74
+
75
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
76
  'autoupdate_interval' => $autoupdate_interval,
77
  'app_id' => $facebook_app_id,
78
  'app_secret' => $facebook_app_secret,
88
  * refresh filter according to new time interval,
89
  * then add new schedule with the same hook name
90
  */
91
+ update_option('ffwd_autoupdate_time',$autoupdate_interval*60+current_time('timestamp'));
92
 
93
+ wp_clear_scheduled_hook( 'wd_fb_schedule_event_hook' );
 
 
94
  remove_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
95
  add_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
96
  wp_schedule_event( time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook' );
116
 
117
  return ($save !== false);
118
  }
 
 
 
 
 
 
 
 
 
119
  }
admin/controllers/FFWDControllerThemes_ffwd.php CHANGED
@@ -417,6 +417,7 @@ class FFWDControllerThemes_ffwd
417
  global $wpdb;
418
  $isDefault = $wpdb->get_var('SELECT default_theme FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id=' . $id);
419
  if ($isDefault) {
 
420
  echo WDW_FFWD_Library::message("You can't delete default theme", 'error');
421
  } else {
422
  $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id="%d"', $id);
417
  global $wpdb;
418
  $isDefault = $wpdb->get_var('SELECT default_theme FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id=' . $id);
419
  if ($isDefault) {
420
+ $message = 4;
421
  echo WDW_FFWD_Library::message("You can't delete default theme", 'error');
422
  } else {
423
  $query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id="%d"', $id);
admin/controllers/FFWDControllerUninstall_ffwd.php CHANGED
@@ -1,80 +1,61 @@
1
  <?php
2
 
3
- class FFWDControllerUninstall_ffwd
4
- {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- public function __construct()
18
- {
19
 
 
20
 
21
- global $ffwd_options;
22
- if (!class_exists("TenWebLibConfig")) {
23
- include_once(WD_FFWD_DIR . "/wd/config.php");
24
- }
25
- if (!class_exists("TenWebLibDeactivate")) {
26
- include_once(WD_FFWD_DIR . "/wd/includes/deactivate.php");
27
- }
28
- $config = new TenWebLibConfig();
29
- $config->set_options($ffwd_options);
30
- $deactivate_reasons = new TenWebLibDeactivate($config);
31
- //$deactivate_reasons->add_deactivation_feedback_dialog_box();
32
- $deactivate_reasons->submit_and_deactivate();
 
 
 
 
 
33
  }
34
- ////////////////////////////////////////////////////////////////////////////////////////
35
- // Public Methods //
36
- ////////////////////////////////////////////////////////////////////////////////////////
37
- public function execute()
38
- {
39
- $task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
40
- if ($task != '') {
41
- if (!WDW_FFWD_Library::verify_nonce('uninstall_ffwd')) {
42
- die('Sorry, your nonce did not verify.');
43
- }
44
- }
45
- if (method_exists($this, $task)) {
46
- $this->$task();
47
- } else {
48
- $this->display();
49
- }
50
  }
 
51
 
52
- public function display()
53
- {
54
- require_once WD_FFWD_DIR . "/admin/models/FFWDModelUninstall_ffwd.php";
55
- $model = new FFWDModelUninstall_ffwd();
 
 
56
 
57
- require_once WD_FFWD_DIR . "/admin/views/FFWDViewUninstall_ffwd.php";
58
- $view = new FFWDViewUninstall_ffwd($model);
59
- $view->display();
60
- }
 
 
 
 
 
 
61
 
62
- public function uninstall()
63
- {
64
- require_once WD_FFWD_DIR . "/admin/models/FFWDModelUninstall_ffwd.php";
65
- $model = new FFWDModelUninstall_ffwd();
 
66
 
67
- require_once WD_FFWD_DIR . "/admin/views/FFWDViewUninstall_ffwd.php";
68
- $view = new FFWDViewUninstall_ffwd($model);
69
- $view->uninstall();
70
- }
71
- ////////////////////////////////////////////////////////////////////////////////////////
72
- // Getters & Setters //
73
- ////////////////////////////////////////////////////////////////////////////////////////
74
- ////////////////////////////////////////////////////////////////////////////////////////
75
- // Private Methods //
76
- ////////////////////////////////////////////////////////////////////////////////////////
77
- ////////////////////////////////////////////////////////////////////////////////////////
78
- // Listeners //
79
- ////////////////////////////////////////////////////////////////////////////////////////
80
- }
1
  <?php
2
 
3
+ /**
4
+ * Class FFWDControllerUninstall
5
+ */
6
+ class FFWDControllerUninstall_ffwd {
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ private $view;
9
 
10
+ public function __construct() {
11
+ require_once WD_FFWD_DIR . "/admin/views/uninstall.php";
12
+ $this->view = new Uninstall_ffwd();
13
+ }
14
+
15
+ /**
16
+ * Execute.
17
+ */
18
+ public function execute() {
19
+ $task = WDW_FFWD_Library::get('task');
20
+ if ( !empty($task) ) {
21
+ if ( !WDW_FFWD_Library::verify_nonce('uninstall_ffwd') ) {
22
+ die('Sorry, your nonce did not verify.');
23
+ }
24
+ }
25
+ if ( method_exists($this, $task) ) {
26
+ $this->$task();
27
  }
28
+ else {
29
+ $this->display();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
+ }
32
 
33
+ /**
34
+ * Display.
35
+ */
36
+ public function display() {
37
+ $this->view->display();
38
+ }
39
 
40
+ /**
41
+ * Uninstall.
42
+ */
43
+ public function uninstall() {
44
+ global $wpdb;
45
+ $wpdb->query('DROP TABLE ' . $wpdb->prefix . 'wd_fb_info');
46
+ $wpdb->query('DROP TABLE ' . $wpdb->prefix . 'wd_fb_data');
47
+ $wpdb->query('DROP TABLE ' . $wpdb->prefix . 'wd_fb_option');
48
+ $wpdb->query('DROP TABLE ' . $wpdb->prefix . 'wd_fb_theme');
49
+ $wpdb->query('DROP TABLE ' . $wpdb->prefix . 'wd_fb_shortcode');
50
 
51
+ delete_option('ffwd_admin_notice');
52
+ delete_option("ffwd_version");
53
+ delete_option('wds_bk_notice_status');
54
+ delete_option('ffwd_old_version');
55
+ delete_option('ffwd_pages_list');
56
 
57
+ deactivate_plugins(WD_FFWD_MAIN_FILE);
58
+ wp_redirect(admin_url('plugins.php'));
59
+ exit;
60
+ }
61
+ }
 
 
 
 
 
 
 
 
 
admin/controllers/FFWDControllerWidget.php CHANGED
@@ -17,8 +17,8 @@ class FFWDControllerWidget extends WP_Widget {
17
  ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct() {
19
  $widget_ops = array(
20
- 'classname' => 'ffwd_info',
21
- 'description' => 'Add Facebook feed to Your widget area.'
22
  );
23
  // Widget Control Settings.
24
  $control_ops = array('id_base' => 'ffwd_info');
@@ -35,13 +35,13 @@ class FFWDControllerWidget extends WP_Widget {
35
 
36
  public function widget($args, $instance) {
37
  $this->view->widget($args, $instance);
38
- }
39
 
40
- public function form( $instance ) {
41
- $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('id'), parent::get_field_name('id'), parent::get_field_id('count'), parent::get_field_name('count'), parent::get_field_id('width'), parent::get_field_name('width'), parent::get_field_id('height'), parent::get_field_name('height'), parent::get_field_id('theme_id'), parent::get_field_name('theme_id'), parent::get_field_id('view_type'), parent::get_field_name('view_type'));
42
- }
43
 
44
- // Update Settings.
45
  public function update($new_instance, $old_instance) {
46
  $instance['title'] = strip_tags($new_instance['title']);
47
  $instance['id'] = $new_instance['id'];
17
  ////////////////////////////////////////////////////////////////////////////////////////
18
  public function __construct() {
19
  $widget_ops = array(
20
+ 'classname' => 'ffwd_info',
21
+ 'description' => 'Add Facebook feed to Your widget area.'
22
  );
23
  // Widget Control Settings.
24
  $control_ops = array('id_base' => 'ffwd_info');
35
 
36
  public function widget($args, $instance) {
37
  $this->view->widget($args, $instance);
38
+ }
39
 
40
+ public function form( $instance ) {
41
+ $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('id'), parent::get_field_name('id'), parent::get_field_id('count'), parent::get_field_name('count'), parent::get_field_id('width'), parent::get_field_name('width'), parent::get_field_id('height'), parent::get_field_name('height'), parent::get_field_id('theme_id'), parent::get_field_name('theme_id'), parent::get_field_id('view_type'), parent::get_field_name('view_type'));
42
+ }
43
 
44
+ // Update Settings.
45
  public function update($new_instance, $old_instance) {
46
  $instance['title'] = strip_tags($new_instance['title']);
47
  $instance['id'] = $new_instance['id'];
admin/models/FFWDModelFFWDShortcode.php CHANGED
@@ -29,7 +29,7 @@ class FFWDModelFFWDShortcode {
29
  $rows = $wpdb->get_results($query);
30
  return $rows;
31
  }
32
-
33
 
34
 
35
 
29
  $rows = $wpdb->get_results($query);
30
  return $rows;
31
  }
32
+
33
 
34
 
35
 
admin/models/FFWDModelInfo_ffwd.php CHANGED
@@ -1,15 +1,7 @@
1
  <?php
2
 
3
  class FFWDModelInfo_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $per_page = 20;
14
  private $facebook_sdk;
15
  private $app_id;
@@ -143,9 +135,6 @@ class FFWDModelInfo_ffwd {
143
  );
144
  public $pages_list = array();
145
 
146
- ////////////////////////////////////////////////////////////////////////////////////////
147
- // Constructor & Destructor //
148
- ////////////////////////////////////////////////////////////////////////////////////////
149
  public function __construct() {
150
  $user = get_current_user_id();
151
  $screen = get_current_screen();
@@ -160,9 +149,6 @@ class FFWDModelInfo_ffwd {
160
 
161
  $this->pages_list = get_option('ffwd_pages_list', array());
162
  }
163
- ////////////////////////////////////////////////////////////////////////////////////////
164
- // Public Methods //
165
- ////////////////////////////////////////////////////////////////////////////////////////
166
 
167
  public function get_image_rows_data($gallery_id) {
168
  global $wpdb;
@@ -205,8 +191,8 @@ class FFWDModelInfo_ffwd {
205
  //get app_id and secret from facebook login response
206
  $row = $wpdb->get_row($wpdb->prepare('SELECT app_id, app_secret FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
207
 
208
- //$facebook_app_id = (isset($_REQUEST['appId'])) ? esc_html(stripslashes($_REQUEST['appId'])) : '';
209
- //$facebook_app_secret = (isset($_REQUEST['secret'])) ? esc_html(stripslashes($_REQUEST['secret'])) : '';
210
 
211
  $this->app_id = $row->app_id;
212
  $this->app_secret = $row->app_secret;
@@ -232,8 +218,11 @@ class FFWDModelInfo_ffwd {
232
  }
233
 
234
  public function log_in_log_out() {
 
235
  $this->get_facebook_data();
236
  $user = $this->facebook_sdk->getUser();
 
 
237
  if ($user) {
238
  try {
239
  $old_access_token = $this->access_token;
@@ -312,15 +301,15 @@ class FFWDModelInfo_ffwd {
312
  $row->name = '';
313
  $row->page_access_token = '';
314
  $row->type = '';
315
- $row->content_type = 'specific';
316
- $row->content = 'photos';
317
  $row->order = 0;
318
  $row->content_url = '';
319
  $row->timeline_type = 'posts';
320
  $row->limit = 10;
321
  $row->app_id = '';
322
  $row->app_secret = '';
323
- $row->exist_access = 1;
324
  $row->access_token = '';
325
  $row->published = 1;
326
  $row->update_mode = 'keep_old';
@@ -385,13 +374,13 @@ $row->blog_style_view_type= 1;
385
  $row->blog_style_comments= 1;
386
  $row->blog_style_likes= 1;
387
  $row->blog_style_message_desc= 1;
388
- $row->blog_style_shares_butt= 0;
389
  $row->blog_style_shares= 1;
390
  $row->blog_style_author= 1;
391
  $row->blog_style_name= 1;
392
  $row->blog_style_place_name= 1;
393
- $row->blog_style_facebook= 0;
394
- $row->blog_style_twitter= 0;
395
  $row->blog_style_google= 0;
396
  $row->album_max_columns= 5;
397
  $row->album_thumb_width= 200;
@@ -405,6 +394,8 @@ $row->image_onclick_action= 'lightbox';
405
  $row->album_image_thumb_width= 200;
406
  $row->album_image_thumb_height= 150;
407
  $row->album_image_max_columns= 5;
 
 
408
  }
409
  return $row;
410
  }
@@ -460,17 +451,7 @@ $row->album_image_max_columns= 5;
460
  return $rows;
461
  }
462
 
463
- ////////////////////////////////////////////////////////////////////////////////////////
464
- // Getters & Setters //
465
- ////////////////////////////////////////////////////////////////////////////////////////
466
  public function per_page(){
467
  return $this->per_page;
468
-
469
  }
470
- ////////////////////////////////////////////////////////////////////////////////////////
471
- // Private Methods //
472
- ////////////////////////////////////////////////////////////////////////////////////////
473
- ////////////////////////////////////////////////////////////////////////////////////////
474
- // Listeners //
475
- ////////////////////////////////////////////////////////////////////////////////////////
476
  }
1
  <?php
2
 
3
  class FFWDModelInfo_ffwd {
4
+
 
 
 
 
 
 
 
 
5
  private $per_page = 20;
6
  private $facebook_sdk;
7
  private $app_id;
135
  );
136
  public $pages_list = array();
137
 
 
 
 
138
  public function __construct() {
139
  $user = get_current_user_id();
140
  $screen = get_current_screen();
149
 
150
  $this->pages_list = get_option('ffwd_pages_list', array());
151
  }
 
 
 
152
 
153
  public function get_image_rows_data($gallery_id) {
154
  global $wpdb;
191
  //get app_id and secret from facebook login response
192
  $row = $wpdb->get_row($wpdb->prepare('SELECT app_id, app_secret FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
193
 
194
+ //$facebook_app_id = (isset($_REQUEST['appId'])) ? sanitize_text_field(stripslashes($_REQUEST['appId'])) : '';
195
+ //$facebook_app_secret = (isset($_REQUEST['secret'])) ? sanitize_text_field(stripslashes($_REQUEST['secret'])) : '';
196
 
197
  $this->app_id = $row->app_id;
198
  $this->app_secret = $row->app_secret;
218
  }
219
 
220
  public function log_in_log_out() {
221
+
222
  $this->get_facebook_data();
223
  $user = $this->facebook_sdk->getUser();
224
+
225
+
226
  if ($user) {
227
  try {
228
  $old_access_token = $this->access_token;
301
  $row->name = '';
302
  $row->page_access_token = '';
303
  $row->type = '';
304
+ $row->content_type = 'timeline';
305
+ $row->content = 'statuses,photos,videos,links,events';
306
  $row->order = 0;
307
  $row->content_url = '';
308
  $row->timeline_type = 'posts';
309
  $row->limit = 10;
310
  $row->app_id = '';
311
  $row->app_secret = '';
312
+ $row->exist_access = 1;
313
  $row->access_token = '';
314
  $row->published = 1;
315
  $row->update_mode = 'keep_old';
374
  $row->blog_style_comments= 1;
375
  $row->blog_style_likes= 1;
376
  $row->blog_style_message_desc= 1;
377
+ $row->blog_style_shares_butt= 1;
378
  $row->blog_style_shares= 1;
379
  $row->blog_style_author= 1;
380
  $row->blog_style_name= 1;
381
  $row->blog_style_place_name= 1;
382
+ $row->blog_style_facebook= 1;
383
+ $row->blog_style_twitter= 1;
384
  $row->blog_style_google= 0;
385
  $row->album_max_columns= 5;
386
  $row->album_thumb_width= 200;
394
  $row->album_image_thumb_width= 200;
395
  $row->album_image_thumb_height= 150;
396
  $row->album_image_max_columns= 5;
397
+ $row->event_order= 0;
398
+ $row->upcoming_events= 0;
399
  }
400
  return $row;
401
  }
451
  return $rows;
452
  }
453
 
 
 
 
454
  public function per_page(){
455
  return $this->per_page;
 
456
  }
 
 
 
 
 
 
457
  }
admin/models/FFWDModelLicensing_ffwd.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelLicensing_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- ////////////////////////////////////////////////////////////////////////////////////////
22
- // Getters & Setters //
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- // Private Methods //
26
- ////////////////////////////////////////////////////////////////////////////////////////
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- // Listeners //
29
- ////////////////////////////////////////////////////////////////////////////////////////
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FFWDModelOptions_ffwd.php CHANGED
@@ -128,6 +128,7 @@ class FFWDModelOptions_ffwd {
128
  'Pacific/Auckland' => "(GMT+12:00) Auckland",
129
  'Pacific/Fiji' => "(GMT+12:00) Fiji",
130
  );
 
131
  public $date_formats = array(
132
  "ago" => "2 days ago",
133
  "F j, Y, g:i a" => "March 10, 2015, 5:16 pm",
@@ -149,60 +150,121 @@ class FFWDModelOptions_ffwd {
149
  ////////////////////////////////////////////////////////////////////////////////////////
150
  public function get_facebook_data() {
151
  global $wpdb;
152
- if(!class_exists('Facebook'))
153
- include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
 
154
 
155
  $row = $this->get_row_data(false);
156
  $this->app_id = $row->app_id;
157
  $this->app_secret = $row->app_secret;
158
  //$this->access_token = $row->user_access_token;
159
- $this->facebook_sdk = new Facebook(array(
160
- 'appId' => $this->app_id,
161
- 'secret' => $this->app_secret,
162
- ));
 
 
 
 
 
 
 
 
 
163
  if(isset($_POST['app_log_out'])) {
164
  //setcookie('fbs_'.$this->facebook_sdk->getAppId(), '', time()-100, '/', 'http://localhost/wordpress_rfe/');
165
- session_destroy();
166
  }
167
- if($this->facebook_sdk->getUser()) {
168
  try{
169
  }
170
  catch (FacebookApiException $e) {
171
  echo "<!--DEBUG: ".$e." :END-->";
172
  error_log($e);
173
  }
174
- }
175
  //echo $this->facebook_sdk->getAccessToken();
176
- return $this->facebook_sdk->getUser();
 
 
 
 
 
177
  }
178
 
179
  public function log_in_log_out() {
180
  global $wpdb;
 
181
  $this->get_facebook_data();
182
- $user = $this->facebook_sdk->getUser();
183
- if ($user) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  try {
 
185
  // Proceed knowing you have a logged in user who's authenticated.
186
- $user_profile = $this->facebook_sdk->api('/me');
187
- $this->facebook_sdk->setExtendedAccessToken();
188
- $access_token = $this->facebook_sdk->getAccessToken();
189
  } catch (FacebookApiException $e) {
190
  echo '<div class="error"><p><strong>OAuth Error</strong>Error added to error_log: '.$e.'</p></div>';
191
  error_log($e);
192
  $user = null;
193
  }
194
- }
 
 
 
 
195
  // Login or logout url will be needed depending on current user state.
196
  $app_link_text = $app_link_url = null;
197
- if ($user && !isset($_POST['app_log_out'])) {
198
- $app_link_url = '#';
199
- $app_link_text = __("Logout of your app", 'facebook-albums');
 
 
 
 
 
 
200
  } else {
201
- $app_link_url = '#';
 
 
 
 
 
 
 
 
 
202
  $app_link_text = __('Log into Facebook with your app', 'facebook-albums');
 
203
  } ?>
204
  <?php
205
- if($user && !isset($_POST['app_log_out'])) :
206
  ?>
207
  <script>
208
  wd_fb_log_in = true;
@@ -214,7 +276,6 @@ class FFWDModelOptions_ffwd {
214
  <ul style="margin:0px;list-style-type:none">
215
  <li>
216
  <a href="https://developers.facebook.com/apps/<?php echo $this->app_id; ?>" target="_blank"><?php _e("View your application's settings.", 'facebook-albums'); ?></a>
217
-
218
  </li>
219
  <input class="button-primary" type="submit" name="app_log_out" value="Log out from app" />
220
  </ul>
@@ -228,12 +289,8 @@ class FFWDModelOptions_ffwd {
228
  <?php
229
  }
230
  ?>
231
- <a id="<?php echo WD_FB_PREFIX; ?>_login_button" class="<?php echo WD_FB_PREFIX; ?>_login_button" href="<?php echo $app_link_url; ?>"><?php echo $app_link_text; ?></a>
232
- <br>
233
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
234
- version</label>
235
-
236
- <?php
237
  endif;
238
  ?>
239
  <div style="clear: both;">&nbsp;</div>
@@ -247,35 +304,20 @@ class FFWDModelOptions_ffwd {
247
  $row->autoupdate_interval = 90;
248
  $row->app_id = '';
249
  $row->app_secret = '';
250
- $row->view_on_fb = 1;
251
- $row->post_text_length = 200;
252
- $row->post_date_format = '';
253
- $row->date_timezone = 'Pacific/Midway';
254
- $row->event_street = 1;
255
- $row->event_city = 1;
256
- $row->event_country = 1;
257
- $row->event_zip = 1;
258
- $row->event_map = 1;
259
- $row->event_date = 1;
260
- $row->event_date_format = '';
261
- $row->event_desp_length = 200;
262
- $row->comments_replies = 1;
263
- $row->comments_filter = 'toplevel';
264
- $row->comments_order = 'chronological';
265
- $row->page_plugin_pos = 'bottom';
266
- $row->page_plugin_fans = 1;
267
- $row->page_plugin_cover = 1;
268
- $row->page_plugin_header = 0;
269
- $row->page_plugin_width = 380;
270
 
271
- $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
272
- 'autoupdate_interval' => $row->autoupdate_interval,
273
- 'app_id' => $row->app_id,
274
- 'app_secret' => $row->app_secret,
275
- 'date_timezone' => $row->date_timezone,
276
- 'post_date_format' => $row->post_date_format,
277
- 'event_date_format' =>$row->event_date_format,
278
- ), array('id' => 1));
279
  }
280
  return $row;
281
  }
128
  'Pacific/Auckland' => "(GMT+12:00) Auckland",
129
  'Pacific/Fiji' => "(GMT+12:00) Fiji",
130
  );
131
+
132
  public $date_formats = array(
133
  "ago" => "2 days ago",
134
  "F j, Y, g:i a" => "March 10, 2015, 5:16 pm",
150
  ////////////////////////////////////////////////////////////////////////////////////////
151
  public function get_facebook_data() {
152
  global $wpdb;
153
+ //if(!class_exists('Facebook'))
154
+
155
+ include WD_FFWD_DIR . "/framework/facebook-sdk/src/Facebook/autoload.php";
156
 
157
  $row = $this->get_row_data(false);
158
  $this->app_id = $row->app_id;
159
  $this->app_secret = $row->app_secret;
160
  //$this->access_token = $row->user_access_token;
161
+
162
+ if($row->app_id!='' and $row->app_secret!='') {
163
+
164
+
165
+ $this->facebook_sdk = new Facebook\Facebook( array(
166
+ 'app_id' => $this->app_id,
167
+ 'app_secret' => $this->app_secret,
168
+ ) );
169
+
170
+ }
171
+
172
+
173
+
174
  if(isset($_POST['app_log_out'])) {
175
  //setcookie('fbs_'.$this->facebook_sdk->getAppId(), '', time()-100, '/', 'http://localhost/wordpress_rfe/');
176
+ unset($_SESSION['facebook_access_token']);
177
  }
178
+ /*if($this->facebook_sdk->getUser()) {
179
  try{
180
  }
181
  catch (FacebookApiException $e) {
182
  echo "<!--DEBUG: ".$e." :END-->";
183
  error_log($e);
184
  }
185
+ }*/
186
  //echo $this->facebook_sdk->getAccessToken();
187
+
188
+
189
+ if($this->facebook_sdk)
190
+ return true;
191
+ return false;
192
+ //return $this->facebook_sdk->getUser();
193
  }
194
 
195
  public function log_in_log_out() {
196
  global $wpdb;
197
+
198
  $this->get_facebook_data();
199
+
200
+
201
+ if($this->facebook_sdk) {
202
+ $helper = $this->facebook_sdk->getRedirectLoginHelper();
203
+
204
+ $user = 0; //$this->facebook_sdk->getUser();
205
+ try {
206
+ $accessToken = $helper->getAccessToken();
207
+ } catch ( Facebook\Exceptions\FacebookSDKException $e ) {
208
+ // There was an error communicating with Graph
209
+ echo $e->getMessage();
210
+ exit;
211
+ }
212
+ }
213
+
214
+ if (isset($accessToken)) {
215
+ // User authenticated your app!
216
+ // Save the access token to a session and redirect
217
+ $_SESSION['facebook_access_token'] = (string) $accessToken;
218
+ // Log them into your web framework here . . .
219
+ // Redirect here . . .
220
+
221
+ }
222
+
223
+
224
+ if (isset($_SESSION['facebook_access_token'])) {
225
  try {
226
+
227
  // Proceed knowing you have a logged in user who's authenticated.
228
+ $user_profile = $this->facebook_sdk->get('/me',$_SESSION['facebook_access_token']);
229
+ /*$this->facebook_sdk->setExtendedAccessToken();
230
+ $access_token = $this->facebook_sdk->getAccessToken();*/
231
  } catch (FacebookApiException $e) {
232
  echo '<div class="error"><p><strong>OAuth Error</strong>Error added to error_log: '.$e.'</p></div>';
233
  error_log($e);
234
  $user = null;
235
  }
236
+ $user_profile=$user_profile->getDecodedBody();
237
+
238
+ }
239
+
240
+
241
  // Login or logout url will be needed depending on current user state.
242
  $app_link_text = $app_link_url = null;
243
+ if (isset($_SESSION['facebook_access_token']) && !isset($_POST['app_log_out'])) {
244
+
245
+
246
+ /*$helper = $this->facebook_sdk->getRedirectLoginHelper();
247
+ $callback=admin_url() . 'admin.php?page=options_ffwd';
248
+
249
+ $app_link_url = $helper->getLogoutUrl($callback,'');
250
+ $app_link_text = __("Logout of your app", 'facebook-albums');*/
251
+ $validaye_app=0;
252
  } else {
253
+ if($this->facebook_sdk)
254
+ $helper = $this->facebook_sdk->getRedirectLoginHelper();
255
+ $permissions = array( 'user_photos', 'user_videos', 'user_posts', 'user_events' );
256
+ $callback=admin_url() . 'admin.php?page=options_ffwd';
257
+
258
+ //$app_link_url = $helper->getLoginUrl(array('scope' => 'user_photos,user_videos,user_posts,user_events'));
259
+ if($this->facebook_sdk)
260
+ $app_link_url ='';// $helper->getLoginUrl($callback,$permissions);
261
+ else
262
+ $app_link_url='';
263
  $app_link_text = __('Log into Facebook with your app', 'facebook-albums');
264
+ $validaye_app=1;
265
  } ?>
266
  <?php
267
+ if(isset($_SESSION['facebook_access_token']) && !isset($_POST['app_log_out'])) :
268
  ?>
269
  <script>
270
  wd_fb_log_in = true;
276
  <ul style="margin:0px;list-style-type:none">
277
  <li>
278
  <a href="https://developers.facebook.com/apps/<?php echo $this->app_id; ?>" target="_blank"><?php _e("View your application's settings.", 'facebook-albums'); ?></a>
 
279
  </li>
280
  <input class="button-primary" type="submit" name="app_log_out" value="Log out from app" />
281
  </ul>
289
  <?php
290
  }
291
  ?>
292
+ <a id="<?php echo WD_FB_PREFIX; ?>_login_button" class="<?php echo WD_FB_PREFIX; ?>_login_button" <?php if($validaye_app==1) echo 'onclick="check_app(\'ffwd\',\'login\');if(jQuery(\'#ffwd_app_id\').val()==\'\') {alert(\'App Id is required\');return false;} if(jQuery(\'#ffwd_app_secret\').val()==\'\' ){alert(\'App secret is required\');return false;};"'?> href="<?php echo $app_link_url; ?>"><?php echo $app_link_text; ?></a>
293
+ <?php
 
 
 
 
294
  endif;
295
  ?>
296
  <div style="clear: both;">&nbsp;</div>
304
  $row->autoupdate_interval = 90;
305
  $row->app_id = '';
306
  $row->app_secret = '';
307
+ $row->post_date_format = 'ago';
308
+ $row->date_timezone = '';
309
+ $row->event_date_format = '';
310
+
311
+ $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
312
+ 'autoupdate_interval' => $row->autoupdate_interval,
313
+ 'app_id' => $row->app_id,
314
+ 'app_secret' => $row->app_secret,
315
+ 'date_timezone' => $row->date_timezone,
316
+ 'post_date_format' => $row->post_date_format,
317
+ 'event_date_format' =>$row->event_date_format,
318
+ ), array('id' => 1));
319
+
 
 
 
 
 
 
 
320
 
 
 
 
 
 
 
 
 
321
  }
322
  return $row;
323
  }
admin/models/FFWDModelThemes_ffwd.php CHANGED
@@ -1,19 +1,9 @@
1
  <?php
2
 
3
  class FFWDModelThemes_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $per_page = 20;
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
  public function __construct() {
18
  $user = get_current_user_id();
19
  $screen = get_current_screen();
@@ -25,9 +15,7 @@ class FFWDModelThemes_ffwd {
25
  $this->per_page = $screen->get_option( 'per_page', 'default' );
26
  }
27
  }
28
- ////////////////////////////////////////////////////////////////////////////////////////
29
- // Public Methods //
30
- ////////////////////////////////////////////////////////////////////////////////////////
31
  public function get_rows_data() {
32
  global $wpdb;
33
  $where = ((isset($_POST['search_value']) && (sanitize_text_field($_POST['search_value']) != '')) ? $wpdb->prepare('WHERE name LIKE %s', '%' . sanitize_text_field($_POST['search_value']) . '%') : '');
@@ -68,10 +56,6 @@ class FFWDModelThemes_ffwd {
68
  $row->default_theme = FALSE;
69
  }
70
  else {
71
-
72
-
73
-
74
-
75
  $row->thumb_margin='10';
76
  $row->thumb_padding='2';
77
  $row->thumb_border_radius='2px';
@@ -226,7 +210,7 @@ class FFWDModelThemes_ffwd {
226
  $row->lightbox_ctrl_btn_margin_top='10';
227
  $row->lightbox_ctrl_btn_margin_left='7';
228
  $row->lightbox_ctrl_btn_transparent='100';
229
- $row->lightbox_ctrl_btn_color='FFFFFF';
230
  $row->lightbox_toggle_btn_height='14';
231
  $row->lightbox_toggle_btn_width='100';
232
  $row->lightbox_ctrl_cont_bg_color='000000';
@@ -299,7 +283,7 @@ class FFWDModelThemes_ffwd {
299
  $row->lightbox_filmstrip_pos='top';
300
  $row->lightbox_filmstrip_rl_bg_color='3B3B3B';
301
  $row->lightbox_filmstrip_rl_btn_size='20';
302
- $row->lightbox_filmstrip_rl_btn_color='FFFFFF';
303
  $row->lightbox_filmstrip_thumb_margin='0 1px';
304
  $row->lightbox_filmstrip_thumb_border_width='1';
305
  $row->lightbox_filmstrip_thumb_border_style='solid';
@@ -355,8 +339,6 @@ class FFWDModelThemes_ffwd {
355
  $row->default_theme = 0;
356
  }
357
 
358
-
359
-
360
  return $row;
361
  }
362
 
@@ -375,17 +357,8 @@ class FFWDModelThemes_ffwd {
375
  $page_nav['limit'] = (int) ($limit / $this->per_page + 1);
376
  return $page_nav;
377
  }
378
- ////////////////////////////////////////////////////////////////////////////////////////
379
- // Getters & Setters //
380
- ////////////////////////////////////////////////////////////////////////////////////////
381
  public function per_page(){
382
  return $this->per_page;
383
-
384
  }
385
- ////////////////////////////////////////////////////////////////////////////////////////
386
- // Private Methods //
387
- ////////////////////////////////////////////////////////////////////////////////////////
388
- ////////////////////////////////////////////////////////////////////////////////////////
389
- // Listeners //
390
- ////////////////////////////////////////////////////////////////////////////////////////
391
  }
1
  <?php
2
 
3
  class FFWDModelThemes_ffwd {
4
+
 
 
 
 
 
 
 
 
5
  private $per_page = 20;
6
+
 
 
7
  public function __construct() {
8
  $user = get_current_user_id();
9
  $screen = get_current_screen();
15
  $this->per_page = $screen->get_option( 'per_page', 'default' );
16
  }
17
  }
18
+
 
 
19
  public function get_rows_data() {
20
  global $wpdb;
21
  $where = ((isset($_POST['search_value']) && (sanitize_text_field($_POST['search_value']) != '')) ? $wpdb->prepare('WHERE name LIKE %s', '%' . sanitize_text_field($_POST['search_value']) . '%') : '');
56
  $row->default_theme = FALSE;
57
  }
58
  else {
 
 
 
 
59
  $row->thumb_margin='10';
60
  $row->thumb_padding='2';
61
  $row->thumb_border_radius='2px';
210
  $row->lightbox_ctrl_btn_margin_top='10';
211
  $row->lightbox_ctrl_btn_margin_left='7';
212
  $row->lightbox_ctrl_btn_transparent='100';
213
+ $row->lightbox_ctrl_btn_color='ffffff';
214
  $row->lightbox_toggle_btn_height='14';
215
  $row->lightbox_toggle_btn_width='100';
216
  $row->lightbox_ctrl_cont_bg_color='000000';
283
  $row->lightbox_filmstrip_pos='top';
284
  $row->lightbox_filmstrip_rl_bg_color='3B3B3B';
285
  $row->lightbox_filmstrip_rl_btn_size='20';
286
+ $row->lightbox_filmstrip_rl_btn_color='ffffff';
287
  $row->lightbox_filmstrip_thumb_margin='0 1px';
288
  $row->lightbox_filmstrip_thumb_border_width='1';
289
  $row->lightbox_filmstrip_thumb_border_style='solid';
339
  $row->default_theme = 0;
340
  }
341
 
 
 
342
  return $row;
343
  }
344
 
357
  $page_nav['limit'] = (int) ($limit / $this->per_page + 1);
358
  return $page_nav;
359
  }
360
+
 
 
361
  public function per_page(){
362
  return $this->per_page;
 
363
  }
 
 
 
 
 
 
364
  }
admin/models/FFWDModelUninstall_ffwd.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelUninstall_ffwd
4
- {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- public function __construct()
18
- {
19
- }
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- // Public Methods //
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- public function delete_db_tables()
24
- {
25
- global $wpdb;
26
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_info");
27
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_data");
28
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_option");
29
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_theme");
30
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_shortcode");
31
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_shortcode");
32
- delete_option('tenweb_notice_status');
33
- delete_option('ffwd_admin_notice');
34
- delete_option("ffwd_version");
35
- //delete_option("ffwd_subscribe_done");
36
- delete_option('wds_bk_notice_status');
37
- delete_option('ffwd_old_version');
38
- delete_option('ffwd_pages_list');
39
- }
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Getters & Setters //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- ////////////////////////////////////////////////////////////////////////////////////////
44
- // Private Methods //
45
- ////////////////////////////////////////////////////////////////////////////////////////
46
- ////////////////////////////////////////////////////////////////////////////////////////
47
- // Listeners //
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/models/FFWDModelWidget.php CHANGED
@@ -25,7 +25,7 @@ class FFWDModelWidget {
25
  $rows = $wpdb->get_results($query);
26
  return $rows;
27
  }
28
-
29
 
30
 
31
  public function get_ffwd_feed($id) {
25
  $rows = $wpdb->get_results($query);
26
  return $rows;
27
  }
28
+
29
 
30
 
31
  public function get_ffwd_feed($id) {
admin/views/FFWDViewFFWDShortcode.php CHANGED
@@ -2,29 +2,28 @@
2
 
3
  class FFWDViewFFWDShortcode
4
  {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- private $model;
15
-
16
-
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- // Constructor & Destructor //
19
- ////////////////////////////////////////////////////////////////////////////////////////
20
- public function __construct($model)
21
- {
22
- $this->model = $model;
23
-
24
- }
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Public Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
  public function ffwd_enqueue__shortcode_scripts(){
29
  wp_register_script( 'ffwd_shortcode_js', WD_FFWD_URL . '/js/ffwd_shortcode.js', array(), ffwd_get_version() );
30
  wp_register_script( 'ffwd_scolor_js', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), ffwd_get_version() );
@@ -32,163 +31,163 @@ class FFWDViewFFWDShortcode
32
  wp_register_style( 'jquery_ui_custom_css', WD_FFWD_URL . '/css/jquery-ui-1.10.3.custom.css',array(), ffwd_get_version() );
33
  $siteurl = get_option("siteurl");
34
  wp_register_style( 'ffwd_dialog_css', $siteurl."/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css", array(), ffwd_get_version() );
 
35
  }
36
  public function display()
37
- {
38
- $wd_fb_rows = $this->model->get_wd_fb_data();
39
- ?>
40
- <html xmlns="http://www.w3.org/1999/xhtml">
41
- <head>
42
- <title>Facebook Feed by 10Web</title>
43
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css" type="text/css" media="all">
44
- <?php
45
- $this->ffwd_enqueue__shortcode_scripts();
46
- wp_print_scripts('jquery');
47
- wp_print_scripts('jquery-ui-core');
48
- wp_print_scripts('jquery-ui-widget');
49
- wp_print_scripts('jquery-ui-position');
50
- wp_print_scripts('jquery-ui-tooltip');
51
- wp_print_scripts('ffwd_scolor_js');
52
- wp_print_scripts('ffwd_shortcode_js');
53
- wp_print_styles('ffwd_dialog_css');
54
- wp_print_styles('jquery_ui_custom_css');
55
- wp_print_styles('ffwd_shortcode_css')
56
- ?>
57
-
58
-
59
- <base target="_self">
60
- </head>
61
- <body id="link" dir="ltr" class="forceColors">
62
- <form method="post" action="#" id="bwg_shortcode_form">
63
- <?php wp_nonce_field('FFWDShortcode', 'ffwd_nonce'); ?>
64
- <div class="tabs" role="tablist" tabindex="-1">
65
- <h4>Facebook Feed by 10Web</h4>
66
- </div>
67
- <div class="panel_wrapper">
68
- <div id="display_panel" class="panel current">
69
- <div style="">
70
- <div style="float:left">
71
- <div class="gallery_type" style="border-style:none">
72
- <select name="wd_fb_feed" id="wd_fb_feed" onchange="wd_fb_insert_btn_disable(this)">
73
- <option value="0" fb_content_type="0" selected="selected">Select Facebook Feed </option>
74
- <?php foreach ($wd_fb_rows as $gallery_row) { ?>
75
- <option value="<?php echo $gallery_row->id; ?>"
76
- fb_type="<?php echo $gallery_row->type; ?>"
77
- fb_content_type="<?php echo $gallery_row->content_type; ?>"
78
- fb_content="<?php echo $gallery_row->content; ?>"> <?php echo $gallery_row->name; ?></option>
79
- <?php } ?>
80
- </select>
81
- </div>
82
  </div>
83
- <div style="clear:both"></div>
84
- </div>
85
- </div>
86
- </div>
87
- <div class="mceActionPanel">
88
- <div style="float:left;">
89
- <input type="button" id="cancel" name="cancel" value="Cancel" onClick="top.tinyMCE.activeEditor.windowManager.close(window);"/>
90
- </div>
91
- <div style="float:right;">
92
- <input type="button" id="insert" name="insert" value="Insert" onClick="bwg_insert_shortcode('wd_fb', '');"/>
93
- </div>
94
- <div style="clear:both"></div>
95
- </div>
96
- <input type="hidden" id="tagtext" name="tagtext" value=""/>
97
- <input type="hidden" id="currrent_id" name="currrent_id" value=""/>
98
- <input type="hidden" id="bwg_insert" name="bwg_insert" value=""/>
99
- <input type="hidden" id="task" name="task" value=""/>
100
- </form>
101
- <script type="text/javascript">
102
-
103
-
104
- var params = get_params("WD_FB");
105
-
106
- var bwg_insert = 1;
107
-
108
- var content = top.tinyMCE.activeEditor.selection.getContent();
109
-
110
-
111
- // Get shortcodes attributes.
112
- function get_params(module_name) {
113
- var selected_text = top.tinyMCE.activeEditor.selection.getContent();
114
- var module_start_index = selected_text.indexOf("[" + module_name);
115
- var module_end_index = selected_text.indexOf("]", module_start_index);
116
- var module_str = "";
117
- if ((module_start_index >= 0) && (module_end_index >= 0)) {
118
- module_str = selected_text.substring(module_start_index + 1, module_end_index);
119
- }
120
- else {
121
- return false;
122
- }
123
- var params_str = module_str.substring(module_str.indexOf(" ") + 1);
124
- var key_values = params_str.split('" ');
125
- var short_code_attr = new Array();
126
- for (var key in key_values) {
127
- var short_code_index = key_values[key].split('=')[0];
128
- var short_code_value = key_values[key].split('=')[1];
129
- short_code_value = short_code_value.replace(/\"/g, '');
130
- short_code_attr['id'] = short_code_value;
131
- }
132
- return short_code_attr;
133
- }
134
-
135
-
136
- function bwg_insert_shortcode(wd_fb_prefix, content) {
137
-
138
- short_code = '[WD_FB';
139
-
140
-
141
- short_code += ' id="' + jQuery("#wd_fb_feed").val() + '"]';
142
- var short_id = ' id="' + jQuery("#wd_fb_feed").val() + '"';
143
- short_code = short_code.replace(/\[WD_FB([^\]]*)\]/g, function (d, c) {
144
- return "<img src='<?php echo WD_FFWD_URL; ?>/images/ffwd/ffwd_logo_large.png' class='wd_fb_shortcode mceItem' title='WD_FB" + short_id + "' />";
145
- });
146
-
147
- jQuery("#bwg_shortcode_form").submit();
148
- if (top.tinymce.isIE && content) {
149
- // IE and Update.
150
- var all_content = top.tinyMCE.activeEditor.getContent();
151
- all_content = all_content.replace('<p></p><p>[WD_FB', '<p>[WD_FB');
152
- top.tinyMCE.activeEditor.setContent(all_content.replace(content, '[WD_FB id="' + jQuery("#wd_fb_feed").val() + '"]'));
153
- }
154
- else {
155
- top.tinyMCE.execCommand('mceInsertContent', false, short_code);
156
- }
157
- //tinyMCEPopup.editor.execCommand('mceRepaint');
158
- top.tinyMCE.activeEditor.windowManager.close(window);
159
- }
160
-
161
-
162
- params = get_params('WD_FB');
163
- if (params['id']) {
164
- jQuery('#wd_fb_feed').val(params['id']);
165
- }
166
-
167
- function wd_fb_insert_btn_disable(){
168
- if(jQuery('#wd_fb_feed').val() == 0){
169
- jQuery('#insert').prop('disabled', true);
170
- jQuery('#insert').css('opacity', 0.5);
171
- }else{
172
- jQuery('#insert').prop('disabled', false);
173
- jQuery('#insert').css('opacity', 1);
174
- }
175
- }
176
- wd_fb_insert_btn_disable();
177
-
178
- </script>
179
- </body>
180
- </html>
181
- <?php
182
- die();
183
- }
184
-
185
- ////////////////////////////////////////////////////////////////////////////////////////
186
- // Getters & Setters //
187
- ////////////////////////////////////////////////////////////////////////////////////////
188
- ////////////////////////////////////////////////////////////////////////////////////////
189
- // Private Methods //
190
- ////////////////////////////////////////////////////////////////////////////////////////
191
- ////////////////////////////////////////////////////////////////////////////////////////
192
- // Listeners //
193
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
 
194
  }
2
 
3
  class FFWDViewFFWDShortcode
4
  {
5
+ ////////////////////////////////////////////////////////////////////////////////////////
6
+ // Events //
7
+ ////////////////////////////////////////////////////////////////////////////////////////
8
+ ////////////////////////////////////////////////////////////////////////////////////////
9
+ // Constants //
10
+ ////////////////////////////////////////////////////////////////////////////////////////
11
+ ////////////////////////////////////////////////////////////////////////////////////////
12
+ // Variables //
13
+ ////////////////////////////////////////////////////////////////////////////////////////
14
+ private $model;
15
+
16
+
17
+ ////////////////////////////////////////////////////////////////////////////////////////
18
+ // Constructor & Destructor //
19
+ ////////////////////////////////////////////////////////////////////////////////////////
20
+ public function __construct($model)
21
+ {
22
+ $this->model = $model;
23
+ }
24
+ ////////////////////////////////////////////////////////////////////////////////////////
25
+ // Public Methods //
26
+ ////////////////////////////////////////////////////////////////////////////////////////
 
27
  public function ffwd_enqueue__shortcode_scripts(){
28
  wp_register_script( 'ffwd_shortcode_js', WD_FFWD_URL . '/js/ffwd_shortcode.js', array(), ffwd_get_version() );
29
  wp_register_script( 'ffwd_scolor_js', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), ffwd_get_version() );
31
  wp_register_style( 'jquery_ui_custom_css', WD_FFWD_URL . '/css/jquery-ui-1.10.3.custom.css',array(), ffwd_get_version() );
32
  $siteurl = get_option("siteurl");
33
  wp_register_style( 'ffwd_dialog_css', $siteurl."/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css", array(), ffwd_get_version() );
34
+
35
  }
36
  public function display()
37
+ {
38
+ $wd_fb_rows = $this->model->get_wd_fb_data();
39
+ ?>
40
+ <html xmlns="http://www.w3.org/1999/xhtml">
41
+ <head>
42
+ <title>Facebook Feed by 10Web</title>
43
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
44
+ <?php
45
+ $this->ffwd_enqueue__shortcode_scripts();
46
+ wp_print_scripts('jquery');
47
+ wp_print_scripts('jquery-ui-core');
48
+ wp_print_scripts('jquery-ui-widget');
49
+ wp_print_scripts('jquery-ui-position');
50
+ wp_print_scripts('jquery-ui-tooltip');
51
+ wp_print_scripts('dialog');
52
+ wp_print_scripts('ffwd_scolor_js');
53
+ wp_print_scripts('ffwd_shortcode_js');
54
+ wp_print_styles('ffwd_dialog_css');
55
+ wp_print_styles('jquery_ui_custom_css');
56
+ wp_print_styles('ffwd_shortcode_css')
57
+ ?>
58
+ <base target="_self">
59
+ </head>
60
+
61
+ <body id="link" dir="ltr" class="forceColors">
62
+ <?php /* if (isset($_POST['tagtext'])) {
63
+ echo '<script>tinyMCEPopup.close();</script></body></html>';
64
+ die();
65
+ } */ ?>
66
+ <form method="post" action="#" id="bwg_shortcode_form">
67
+ <?php wp_nonce_field('FFWDShortcode', 'ffwd_nonce'); ?>
68
+ <div class="tabs" role="tablist" tabindex="-1">
69
+ <h4>Facebook Feed by 10Web</h4>
 
 
 
 
 
 
 
 
 
 
 
 
70
  </div>
71
+ <div class="panel_wrapper">
72
+ <div id="display_panel" class="panel current">
73
+ <div style="">
74
+ <div style="float:left">
75
+ <div class="gallery_type" style="border-style:none">
76
+ <select name="wd_fb_feed" id="wd_fb_feed" onchange="wd_fb_insert_btn_disable(this)"> <!--onchange="wd_fb_display_type('wd_fb', jQuery(this))"-->
77
+ <option value="0" fb_content_type="0" selected="selected">Select Facebook Feed</option>
78
+ <?php foreach ($wd_fb_rows as $gallery_row) { ?>
79
+ <option value="<?php echo $gallery_row->id; ?>"
80
+ fb_type="<?php echo $gallery_row->type; ?>"
81
+ fb_content_type="<?php echo $gallery_row->content_type; ?>"
82
+ fb_content="<?php echo $gallery_row->content; ?>"> <?php echo $gallery_row->name; ?>
83
+ </option>
84
+ <?php } ?>
85
+ </select>
86
+ </div>
87
+ </div>
88
+ <div style="clear:both"></div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ <div class="mceActionPanel">
93
+ <div style="float:left;">
94
+ <input type="button" id="cancel" name="cancel" value="Cancel" onClick="top.tinyMCE.activeEditor.windowManager.close(window);"/>
95
+ </div>
96
+ <div style="float:right;">
97
+ <input type="button" id="insert" name="insert" value="Insert" onClick="bwg_insert_shortcode('wd_fb', '');"/>
98
+ </div>
99
+ <div style="clear:both"></div>
100
+ </div>
101
+ <input type="hidden" id="tagtext" name="tagtext" value=""/>
102
+ <input type="hidden" id="currrent_id" name="currrent_id" value=""/>
103
+ <input type="hidden" id="bwg_insert" name="bwg_insert" value=""/>
104
+ <input type="hidden" id="task" name="task" value=""/>
105
+ </form>
106
+ <script type="text/javascript">
107
+ var params = get_params("WD_FB");
108
+
109
+ var bwg_insert = 1;
110
+
111
+ var content = top.tinyMCE.activeEditor.selection.getContent();
112
+
113
+ // Get shortcodes attributes.
114
+ function get_params(module_name) {
115
+ //
116
+ var selected_text = top.tinyMCE.activeEditor.selection.getContent();
117
+ var module_start_index = selected_text.indexOf("[" + module_name);
118
+ var module_end_index = selected_text.indexOf("]", module_start_index);
119
+ var module_str = "";
120
+ if ((module_start_index >= 0) && (module_end_index >= 0)) {
121
+ module_str = selected_text.substring(module_start_index + 1, module_end_index);
122
+ }
123
+ else {
124
+ return false;
125
+ }
126
+ var params_str = module_str.substring(module_str.indexOf(" ") + 1);
127
+ var key_values = params_str.split('" ');
128
+ var short_code_attr = new Array();
129
+ for (var key in key_values) {
130
+ var short_code_index = key_values[key].split('=')[0];
131
+ var short_code_value = key_values[key].split('=')[1];
132
+ short_code_value = short_code_value.replace(/\"/g, '');
133
+ short_code_attr['id'] = short_code_value;
134
+ }
135
+ return short_code_attr;
136
+ }
137
+
138
+ function bwg_insert_shortcode(wd_fb_prefix, content) {
139
+
140
+ short_code = '[WD_FB';
141
+
142
+ short_code += ' id="' + jQuery("#wd_fb_feed").val() + '"]';
143
+ var short_id = ' id="' + jQuery("#wd_fb_feed").val() + '"';
144
+ short_code = short_code.replace(/\[WD_FB([^\]]*)\]/g, function (d, c) {
145
+ return "<img src='<?php echo WD_FFWD_URL; ?>/images/ffwd/ffwd_logo_large.png' class='wd_fb_shortcode mceItem' title='WD_FB" + short_id + "' />";
146
+ });
147
+
148
+ jQuery("#bwg_shortcode_form").submit();
149
+ if (top.tinymce.isIE && content) {
150
+ // IE and Update.
151
+ var all_content = top.tinyMCE.activeEditor.getContent();
152
+ all_content = all_content.replace('<p></p><p>[WD_FB', '<p>[WD_FB');
153
+ top.tinyMCE.activeEditor.setContent(all_content.replace(content, '[WD_FB id="' + jQuery("#wd_fb_feed").val() + '"]'));
154
+ }
155
+ else {
156
+ top.tinyMCE.execCommand('mceInsertContent', false, short_code);
157
+ }
158
+ //tinyMCEPopup.editor.execCommand('mceRepaint');
159
+ top.tinyMCE.activeEditor.windowManager.close(window);
160
+ }
161
+
162
+ params = get_params('WD_FB');
163
+ if (params['id']) {
164
+ jQuery('#wd_fb_feed').val(params['id']);
165
+ }
166
+
167
+ function wd_fb_insert_btn_disable(){
168
+ if(jQuery('#wd_fb_feed').val() == 0){
169
+ jQuery('#insert').prop('disabled', true);
170
+ jQuery('#insert').css('opacity', 0.5);
171
+ }else{
172
+ jQuery('#insert').prop('disabled', false);
173
+ jQuery('#insert').css('opacity', 1);
174
+ }
175
+ }
176
+ wd_fb_insert_btn_disable();
177
+ </script>
178
+ </body>
179
+ </html>
180
+ <?php
181
+ die();
182
+ }
183
+
184
+ ////////////////////////////////////////////////////////////////////////////////////////
185
+ // Getters & Setters //
186
+ ////////////////////////////////////////////////////////////////////////////////////////
187
+ ////////////////////////////////////////////////////////////////////////////////////////
188
+ // Private Methods //
189
+ ////////////////////////////////////////////////////////////////////////////////////////
190
+ ////////////////////////////////////////////////////////////////////////////////////////
191
+ // Listeners //
192
+ ////////////////////////////////////////////////////////////////////////////////////////
193
  }
admin/views/FFWDViewInfo_ffwd.php CHANGED
@@ -1,33 +1,14 @@
1
  <?php
2
 
3
- class FFWDViewInfo_ffwd
4
- {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- private $model;
15
 
 
16
 
17
- ////////////////////////////////////////////////////////////////////////////////////////
18
- // Constructor & Destructor //
19
- ////////////////////////////////////////////////////////////////////////////////////////
20
- public function __construct($model)
21
- {
22
  $this->model = $model;
23
  }
24
 
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Public Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- public function display()
29
- {
30
-
31
  $rows_data = $this->model->get_rows_data();
32
  $this->model->del_ffwd_objects();
33
  $page_nav = $this->model->page_nav();
@@ -39,43 +20,33 @@ class FFWDViewInfo_ffwd
39
  $ids_string = '';
40
  $per_page = $this->model->per_page();
41
  $pager = 0;
42
-
43
- WDW_FFWD_Library::topbar();
44
  ?>
45
-
 
 
 
 
 
 
 
46
  <form class="wrap" id="ffwd_info_form" method="post" action="admin.php?page=info_ffwd" style="width:99%;">
47
-
48
- <h2></h2>
49
  <?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
50
-
51
  <div class="ffwd_plugin_header">
52
  <span class="wd-fb-icon"></span>
53
  <h2 class="ffwd_page_name">
54
  Feeds
55
  <a href="" class="ffwd-button-primary ffwd-button-add-new" onclick="spider_set_input_value('task', 'add');
56
- spider_form_submit(event, 'ffwd_info_form')"> Add new</a>
57
-
58
-
59
  </h2>
60
  </div>
61
-
62
- <div id="draganddrop" class="updated" style="display:none;"><strong><p>Changes made in this table should be
63
- saved.</p></strong></div>
64
-
65
-
66
-
67
-
68
-
69
  <div class="buttons_div">
70
  <span class="ffwd-button-secondary non_selectable" onclick="spider_check_all_items()">
71
  <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox()"
72
  style="margin: 0; vertical-align: middle;"/>
73
  <span style="vertical-align: middle;">Select All</span>
74
  </span>
75
-
76
-
77
-
78
-
79
  <input id="show_hide_weights" class="ffwd-button-secondary ffwd-button-show-order" type="button"
80
  onclick="spider_show_hide_weights();return false;" value="Hide order column"/>
81
  <input class="ffwd-button-secondary ffwd-button-save-order" type="submit"
@@ -109,9 +80,9 @@ class FFWDViewInfo_ffwd
109
  echo $order_class;
110
  } ?>">
111
  <a onclick="spider_set_input_value('task', '');
112
- spider_set_input_value('order_by', 'id');
113
- spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'id') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
114
- spider_form_submit(event, 'ffwd_info_form')" href="">
115
  <span>ID</span><span class="sorting-indicator"></span>
116
  </a>
117
  </th>
@@ -119,30 +90,30 @@ class FFWDViewInfo_ffwd
119
  echo $order_class;
120
  } ?>">
121
  <a onclick="spider_set_input_value('task', '');
122
- spider_set_input_value('order_by', 'name');
123
- spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'name') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
124
- spider_form_submit(event, 'ffwd_info_form')" href="">
125
  <span>Name</span><span class="sorting-indicator"></span>
126
  </a>
127
  </th>
128
- <th>Shortcode</th>
129
  <th id="th_order" class="table_medium_col <?php if ($order_by == 'order') {
130
  echo $order_class;
131
  } ?>">
132
  <a onclick="spider_set_input_value('task', '');
133
- spider_set_input_value('order_by', 'order');
134
- spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'order') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
135
- spider_form_submit(event, 'ffwd_info_form')" href="">
136
  <span>Order</span><span class="sorting-indicator"></span>
137
  </a>
138
  </th>
 
139
  <th class="table_big_col <?php if ($order_by == 'published') {
140
  echo $order_class;
141
  } ?>">
142
  <a onclick="spider_set_input_value('task', '');
143
- spider_set_input_value('order_by', 'published');
144
- spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'published') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
145
- spider_form_submit(event, 'ffwd_info_form')" href="">
146
  <span>Published</span><span class="sorting-indicator"></span>
147
  </a>
148
  </th>
@@ -167,39 +138,40 @@ class FFWDViewInfo_ffwd
167
  type="checkbox"/></td>
168
  <td class="table_small_col"><?php echo $row_data->id; ?></td>
169
  <td><a onclick="spider_set_input_value('task', 'edit');
170
- spider_set_input_value('page_number', '1');
171
- spider_set_input_value('search_value', '');
172
- spider_set_input_value('search_or_not', '');
173
- spider_set_input_value('asc_or_desc', 'asc');
174
- spider_set_input_value('order_by', 'order');
175
- spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
176
- spider_form_submit(event, 'ffwd_info_form')"
177
  href=""><?php echo $row_data->name; ?></a></td>
178
  <td class="spider_order table_medium_col"><input
179
- id="order_input_<?php echo $row_data->id; ?>"
180
- name="order_input_<?php echo $row_data->id; ?>" type="text" size="1"
181
- value="<?php echo $row_data->order; ?>"/></td>
182
- <td><input readonly type="text" onclick="jQuery(this).focus();jQuery(this).select();" value='[WD_FB id="<?php echo $row_data->id ?>"]' /></td>
183
 
 
 
184
  <td class="table_big_col"><a
185
- onclick="spider_set_input_value('task', '<?php echo $published; ?>');spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');spider_form_submit(event, 'ffwd_info_form')"
186
- href="" style="display: block;height: 20px;overflow: hidden;"><img
187
- src="<?php echo WD_FFWD_URL . '/images/ffwd/button-icons2.png'; ?>"
188
- style="position: relative;top:<?php echo $published_image ?>"></img></a>
189
  </td>
190
  <td class="table_big_col"><a onclick="spider_set_input_value('task', 'edit');
191
- spider_set_input_value('page_number', '1');
192
- spider_set_input_value('search_value', '');
193
- spider_set_input_value('search_or_not', '');
194
- spider_set_input_value('asc_or_desc', 'asc');
195
- spider_set_input_value('order_by', 'order');
196
- spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
197
- spider_form_submit(event, 'ffwd_info_form')" href="">Edit</a></td>
198
- <td class="table_big_col"><a
199
- onclick="if(! confirm('Are you sure you want to delete ?'))return false;
200
- spider_set_input_value('task', 'delete');
201
  spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
202
- spider_form_submit(event, 'ffwd_info_form')" href="">Delete</a></td>
 
 
 
 
 
203
  </tr>
204
  <?php
205
  $ids_string .= $row_data->id . ',';
@@ -218,7 +190,7 @@ class FFWDViewInfo_ffwd
218
  <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>"/>
219
  <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
220
  <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>"/>
221
- <!--<script>
222
  window.onload = spider_show_hide_weights;
223
  var dropped_ids = [],
224
  ffwd_data = jQuery.parseJSON('<?php /*echo $this->model->ffwd_objects; */?>');
@@ -230,11 +202,13 @@ class FFWDViewInfo_ffwd
230
  ).error(createCallback(i, j));
231
  }
232
  }
 
233
  function createCallback(i, j) {
234
  return function (e) {
235
  do_something_with_data(i, j, e);
236
  };
237
  }
 
238
  function do_something_with_data(i, j, e) {
239
  var error = jQuery.parseJSON(e.responseText);
240
  if (error == null) return;
@@ -254,6 +228,7 @@ class FFWDViewInfo_ffwd
254
  });
255
  }
256
  }
 
257
  function createSuccessCallback(i, j) {
258
  return;
259
  }
@@ -262,46 +237,37 @@ class FFWDViewInfo_ffwd
262
  <?php
263
  }
264
 
265
- public function edit($id)
266
- {
267
-
268
- ///////////////////////////////
269
  $row = $this->model->get_row_data($id);
270
  $theme_rows = $this->model->get_theme_rows_data();
271
  $fb_glob_optons = $this->model->get_option_row_data();
272
  $page_title = (($id != 0) ? 'Edit Facebook Feed by 10Web ' . $row->name : 'Create new Facebook Feed by 10Web');
273
  $type = $row->type;
274
- if($type != 'profile' || $type != 'group' ){
275
- $type = 'page';
276
- }
277
  $content_url = $row->content_url;
278
  $disabled = ($id != 0) ? 'disabled' : '';
279
-
280
  $effects = array(
281
- 'none' => 'None',
282
- 'fade' => 'Fade',
283
- '0' => 'Cube Horizontal',
284
- '1' => 'Cube Vertical',
285
-
286
- '2' => 'Slice Horizontal',
287
- '3' => 'Slice Vertical',
288
- '4' => 'Slide Horizontal',
289
- '5' => 'Slide Vertical',
290
- '6' => 'Scale Out',
291
- '7' => 'Scale In',
292
- '8' => 'Block Scale',
293
- '9' => 'Kaleidoscope',
294
- '10' => 'Fan',
295
- '11' => 'Blind Horizontal',
296
- '12' => 'Blind Vertical',
297
- '13' => 'Random',
298
  );
299
-
300
-
301
  ?>
302
  <style>
303
-
304
-
305
  .ffwd_header {
306
  /*background-image: url("../images/ffwd_logo.png");*/
307
  background: url('<?php echo WD_FFWD_URL; ?>/images/ffwd_logo.png') no-repeat 0px center;
@@ -386,7 +352,7 @@ class FFWDViewInfo_ffwd
386
  .ffwd_view_l_s, .ffwd_varied_s {
387
  padding: 9px;
388
  box-sizing: border-box;
389
- width: 415px;
390
  }
391
 
392
  .ffwd_view_t_s, .ffwd_varied_f {
@@ -534,30 +500,33 @@ class FFWDViewInfo_ffwd
534
 
535
  }
536
  </style>
 
 
 
537
 
 
 
 
 
 
538
 
539
- <div id="message_div" class="updated" style="display: none;"></div>
 
 
540
 
541
- <?php
542
- WDW_FFWD_Library::topbar();
543
- ?>
544
 
545
  <form class="wrap" method="post" id="ffwd_info_form" action="admin.php?page=info_ffwd" style="width:99%;">
546
  <h2></h2>
 
547
  <?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
548
  <!-- <span class="wd-fb-icon"></span> -->
549
  <div style="font-size: 16px" class="ffwd_notice"></div>
550
  <div class="ffwd_plugin_header">
551
-
552
  <span class="wd-fb-icon"></span>
553
  <h2 class="ffwd_page_name"><?php echo $page_title; ?></h2>
554
  </div>
555
 
556
-
557
-
558
-
559
  <div class="ffwd_tabs_cont" style="float:left;">
560
-
561
  <ul class="ffwd_tabs">
562
  <li class="ffwd_tab ffwd_tab_s" show="main" onclick="ffwd_change_tab(this)">Main</li>
563
  <li class="ffwd_tab" id="ffwd_tab_lightbox" show="lightbox_settings"
@@ -571,19 +540,15 @@ class FFWDViewInfo_ffwd
571
  </li>
572
  </ul>
573
  </div>
574
-
575
-
576
-
577
-
578
  <div class="ffwd_butts_c" style="float:right;">
579
  <input class=" ffwd-button-primary ffwd-button-save" type="button"
580
  onclick="if (spider_check_required('name', 'Name') || spider_check_required('fb_page_id', 'Fb pages'))return false;
581
- spider_set_input_value('task', 'save');
582
- spider_ajax_save('<?php echo WD_FB_PREFIX; ?>');" value="Save"/>
583
  <input class=" ffwd-button-primary ffwd-button-apply" type="button"
584
  onclick="if (spider_check_required('name', 'Name') || spider_check_required('fb_page_id', 'Fb pages')) return false;
585
- spider_set_input_value('task', 'apply');
586
- spider_ajax_save('<?php echo WD_FB_PREFIX; ?>');" value="Apply"/>
587
  <input class=" ffwd-button-secondary ffwd-button-cancel" type="submit" onclick="spider_set_input_value('page_number', '1');
588
  spider_set_input_value('task', 'cancel')"
589
  value="Cancel"/>
@@ -610,25 +575,27 @@ class FFWDViewInfo_ffwd
610
  <select name="<?php echo WD_FB_PREFIX; ?>_type"
611
  id="<?php echo WD_FB_PREFIX; ?>_type" style="width:90px;"
612
  onchange="choose_fb_type('<?php echo WD_FB_PREFIX; ?>', jQuery(this).val());">
613
- <option value="selected" <?php if ($type == '') echo 'selected="selected"'; ?>>
 
614
  Select
615
  </option>
616
- <option value="page" <?php if ($type == 'page') echo 'selected="selected"'; ?>>
 
617
  Page
618
  </option>
619
  <option
620
- value="group" <?php if ($type == 'group') echo 'selected="selected"'; ?>>
 
621
  Group
622
  </option>
623
- <option disabled
624
- value="profile">
 
625
  Profile
626
  </option>
627
  </select>
628
- <br>
629
  </td>
630
  </tr>
631
-
632
  </tbody>
633
  <tbody id="ffwd_group_warning"
634
  style="display: <?php echo $type == 'group' ? 'block' : 'none' ?>;">
@@ -667,19 +634,17 @@ class FFWDViewInfo_ffwd
667
  </td>
668
  </tr>
669
  </tbody>
670
-
671
  <!-- fb type page -->
672
  <tbody id="<?php echo WD_FB_PREFIX; ?>_type_page"
673
- style="display:<?php echo($type == 'page' ? 'table-row-group' : 'none'); ?>;">
674
  <tr>
675
- <td class="ffwd_set_l"><label for="fb_page_id">FB pages: <span
676
- style="color:#FF0000;">*</span>
677
  </label></td>
678
  <td>
679
  <select name="fb_page_id" id="fb_page_id">
680
  <option value="">Choose page</option>
681
  <?php
682
- foreach($this->model->pages_list as $page) {
683
  $selected = (isset($row->fb_page_id) && $page->id == $row->fb_page_id) ? "selected" : "";
684
  echo "<option value='" . $page->id . "' " . $selected . ">" . $page->name . "</option>";
685
  }
@@ -692,19 +657,18 @@ class FFWDViewInfo_ffwd
692
  <tr>
693
  <td></td>
694
  <td>
695
- <?php
696
- $pages = get_option('ffwd_pages_list');
697
- if(empty($pages)) {
698
- ?>
699
- <div class="ffwd_page_list_notice">
700
- <p style="color: red">
701
- Facebook Feed plugin has not got the list of your pages yet. Please
702
- <a href="admin.php?page=options_ffwd">get access token</a> first.
703
- </p>
704
- </div>
705
- <?php } ?>
706
  </td>
707
-
708
  </tr>
709
  <tr style="display:none;">
710
  <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_page_exist_access_tok">Use
@@ -728,10 +692,15 @@ class FFWDViewInfo_ffwd
728
  name="<?php echo WD_FB_PREFIX; ?>_group_url"
729
  value="<?php echo $row->content_url; ?>"
730
  size="18"/>
731
- <div class="spider_description">To get your Group ID copy the group URL and paste it to <a href="https://lookup-id.com/" target="_blank">https://lookup-id.com/</a> and press Lookup button.</div>
 
 
 
 
732
 
733
 
734
  </td>
 
735
  </tr>
736
  <tr style="display:none">
737
  <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_group_exist_access_tok">Use
@@ -777,37 +746,44 @@ class FFWDViewInfo_ffwd
777
  <td style="margin-bottom:15px">
778
  <input type="radio" class="inputbox"
779
  id="<?php echo WD_FB_PREFIX; ?>_content_timeline"
780
- name="<?php echo WD_FB_PREFIX; ?>_content_type" checked="checked"
781
  value="timeline"
782
- onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', jQuery(this).val());">
783
  <label for="<?php echo WD_FB_PREFIX; ?>_content_timeline">Timeline</label>&nbsp;
784
- <input disabled type="radio" class="inputbox"
785
- id="<?php echo WD_FB_PREFIX; ?>_content_specific"
786
- name="<?php echo WD_FB_PREFIX; ?>_content_type"
787
- value="specific"
788
- onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', jQuery(this).val());">
789
- <label for="<?php echo WD_FB_PREFIX; ?>_content_specific">Specific</label>
790
- <br>
791
- <label for="" class="ffwd_pro_only">Specific Content Type is Available Only in PRO
792
- version</label>
 
 
793
  </td>
794
  </tr>
795
- <tr <?php if($row->type=='group') echo 'style="display:none;"' ?> id="<?php echo WD_FB_PREFIX; ?>_content_type_timeline_type"
796
- style="display:<?php echo($row->content_type == 'timeline' ? 'table-row' : 'none'); ?>;">
 
 
797
  <td class="ffwd_set_l"><label>Show posts by: </label></td>
798
  <td style="margin-bottom:15px">
799
  <select name="<?php echo WD_FB_PREFIX; ?>_timeline_type"
800
  id="<?php echo WD_FB_PREFIX; ?>_timeline_type" style="width:130px">
801
  <option
802
- value="posts" <?php if ($row->timeline_type == 'posts') echo 'selected="selected"'; ?>>
 
803
  Owner
804
  </option>
805
  <option
806
- value="others" <?php if ($row->timeline_type == 'others') echo 'selected="selected"'; ?>>
 
807
  Others
808
  </option>
809
  <option
810
- value="feed" <?php if ($row->timeline_type == 'feed') echo 'selected="selected"'; ?>>
 
811
  Owner and others
812
  </option>
813
  </select>
@@ -817,33 +793,37 @@ class FFWDViewInfo_ffwd
817
  style="display:<?php echo($row->content_type == 'timeline' ? 'table-row' : 'none'); ?>;">
818
  <td class="ffwd_set_l"><label>Post type: </label></td>
819
  <td>
820
- <input disabled type="checkbox" class="inputbox"
821
- id="<?php echo WD_FB_PREFIX; ?>_timeline_statuses"
822
- name="<?php echo WD_FB_PREFIX; ?>_timeline_statuses" checked="checked"
823
- value="statuses">
824
- <label for="<?php echo WD_FB_PREFIX; ?>_timeline_statuses">Statuses</label>&nbsp;
825
- <br>
826
- <input disabled type="checkbox" class="inputbox"
827
- id="<?php echo WD_FB_PREFIX; ?>_timeline_photos"
828
- name="<?php echo WD_FB_PREFIX; ?>_timeline_photos" checked="checked"
829
- value="photos">
830
- <label for="<?php echo WD_FB_PREFIX; ?>_timeline_photos">Photos</label>
831
- <br>
832
- <input disabled type="checkbox" class="inputbox"
833
- id="<?php echo WD_FB_PREFIX; ?>_timeline_videos"
834
- name="<?php echo WD_FB_PREFIX; ?>_timeline_videos" checked="checked"
835
- value="videos">
836
- <label for="<?php echo WD_FB_PREFIX; ?>_timeline_videos">Videos</label>
837
- <br>
838
- <input disabled type="checkbox" class="inputbox"
839
- id="<?php echo WD_FB_PREFIX; ?>_timeline_links"
840
- name="<?php echo WD_FB_PREFIX; ?>_timeline_links" checked="checked"
841
- value="links">
842
- <label for="<?php echo WD_FB_PREFIX; ?>_timeline_links">Links</label>
 
 
 
 
 
843
  <br>
844
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
845
- version</label>
846
-
847
  </td>
848
  </tr>
849
  <tr id="<?php echo WD_FB_PREFIX; ?>_content_type_specific"
@@ -852,28 +832,29 @@ class FFWDViewInfo_ffwd
852
  <td>
853
  <input type="radio" class="inputbox"
854
  id="<?php echo WD_FB_PREFIX; ?>_specific_photos"
855
- onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific');"
856
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'photos') !== false) ? 'checked="checked"' : ''; ?>
857
  value="photos">
858
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_photos">Photos</label>
859
  <br>
860
  <input type="radio" class="inputbox"
861
  id="<?php echo WD_FB_PREFIX; ?>_specific_videos"
862
- onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific');"
863
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'videos') !== false) ? 'checked="checked"' : ''; ?>
864
  value="videos">
865
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_videos">Videos</label>
866
  <br>
867
  <input type="radio" class="inputbox"
868
  id="<?php echo WD_FB_PREFIX; ?>_specific_albums"
869
- onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific');"
870
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'albums') !== false) ? 'checked="checked"' : ''; ?>
871
  value="albums">
872
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_albums">Albums</label>
873
  </td>
874
  </tr>
875
  <tr>
876
- <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_limit">Number of posts: </label>
 
877
  </td>
878
  <td><input type="number" id="<?php echo WD_FB_PREFIX; ?>_limit"
879
  name="<?php echo WD_FB_PREFIX; ?>_limit" value="<?php echo $row->limit; ?>"
@@ -912,8 +893,12 @@ class FFWDViewInfo_ffwd
912
  </tbody>
913
  </table>
914
  </div>
915
- <div class="ffwd_views_c" <?php if ($row->type == '') echo 'style="display:none"' ?>>
916
-
 
 
 
 
917
  <div class="ffwd_view ffwd_view_en ffwd_view_t ffwd_thumbnails"
918
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'thumbnails', this)">
919
  <div><input type="radio" name="ffwd_view_select"/> Thumbnails View</div>
@@ -922,10 +907,7 @@ class FFWDViewInfo_ffwd
922
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'thumbnails_masonry', this)">
923
  <div><input type="radio" name="ffwd_view_select"/> Masonry View</div>
924
  </div>
925
- <div class="ffwd_view ffwd_view_bh ffwd_blog_style"
926
- onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'blog_style', this)">
927
- <div><input type="radio" name="ffwd_view_select"/>BlogStyle View</div>
928
- </div>
929
  <div class="ffwd_view ffwd_view_a ffwd_album_compact"
930
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'album_compact', this)">
931
  <div><input type="radio" name="ffwd_view_select"/>Album View</div>
@@ -942,25 +924,36 @@ class FFWDViewInfo_ffwd
942
  <table class="ffwd_sett_tabl">
943
  <tbody>
944
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_theme">
945
- <td class="ffwd_set_l"><label
946
- for="<?php echo WD_FB_PREFIX; ?>_theme">Theme: </label></td>
947
  <td class="ffwd_set_i">
948
- <select disabled name="<?php echo WD_FB_PREFIX; ?>_theme"
949
- id="<?php echo WD_FB_PREFIX; ?>_theme" style="width:150px;">
950
- <option value="0" selected="selected">Select Theme</option>
951
- <?php
952
- foreach ($theme_rows as $theme_row) {
953
- ?>
954
- <option <?php
955
-
956
- ?>
957
- value="<?php echo $theme_row->id; ?>"><?php echo $theme_row->name; ?></option>
958
- <?php
 
959
  }
960
- ?>
961
- </select>
 
 
 
 
 
 
 
 
 
 
962
  <br>
963
- <label class="ffwd_pro_only">Changing Theme is Available Only in PRO version</label>
 
964
  </td>
965
  </tr>
966
  <!--Thumbnails, Masonry viewies-->
@@ -970,33 +963,33 @@ class FFWDViewInfo_ffwd
970
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_masonry_hor_ver"
971
  id="<?php echo WD_FB_PREFIX; ?>_masonry_ver" value="vertical"
972
  onclick="ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_image_max_columns_label', 'Max. number of image columns: ');
973
- ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label', 'Image thumbnail width: ');
974
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width').show();
975
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_height').hide();
976
- jQuery('#<?php echo WD_FB_PREFIX; ?>_tr_thumb_name').css('display', 'table-row');
977
- jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[2].disabled = false;
978
- jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[3].disabled = false;
979
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator').hide();"
980
  checked <?php checked($row->masonry_hor_ver, 'vertical') ?> /><label
981
- for="<?php echo WD_FB_PREFIX; ?>_masonry_ver">Vertical</label>
982
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_masonry_hor_ver"
983
  id="<?php echo WD_FB_PREFIX; ?>_masonry_hor" value="horizontal"
984
  onclick="ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_image_max_columns_label', 'Number of image rows: ');
985
- ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label', 'Image thumbnail Height: ');
986
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width').hide();
987
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_height').show();
988
- jQuery('#<?php echo WD_FB_PREFIX; ?>_tr_thumb_name').css('display', 'none');
989
- jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[1].selected = true;
990
- jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[2].disabled = true;
991
- jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[3].disabled = true;
992
- jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator').hide();" <?php checked($row->masonry_hor_ver, 'horizontal') ?> /><label
993
- for="<?php echo WD_FB_PREFIX; ?>_masonry_hor">Horizontal</label>
994
  </td>
995
  </tr>
996
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_image_max_columns">
997
  <td class="ffwd_set_l"><label
998
- id="<?php echo WD_FB_PREFIX; ?>_image_max_columns_label"
999
- for="<?php echo WD_FB_PREFIX; ?>_image_max_columns">Max. number of image
1000
  columns: </label></td>
1001
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_image_max_columns"
1002
  id="<?php echo WD_FB_PREFIX; ?>_image_max_columns"
@@ -1005,15 +998,15 @@ class FFWDViewInfo_ffwd
1005
  </tr>
1006
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_thumb_width_height">
1007
  <td title="Maximum values for thumbnail dimension." class="ffwd_set_l"><label
1008
- id="<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label"
1009
- for="<?php echo WD_FB_PREFIX; ?>_thumb_width">Image Thumbnail
1010
  dimensions: </label></td>
1011
  <td class="ffwd_set_i">
1012
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_thumb_width"
1013
  id="<?php echo WD_FB_PREFIX; ?>_thumb_width"
1014
  value="<?php echo $row->thumb_width == 0 ? '200' : $row->thumb_width ?>"
1015
  class="spider_int_input"/><span
1016
- id="<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator"> x </span>
1017
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_thumb_height"
1018
  id="<?php echo WD_FB_PREFIX; ?>_thumb_height"
1019
  value="<?php echo $row->thumb_height == 0 ? '150' : $row->thumb_height ?>"
@@ -1026,43 +1019,43 @@ class FFWDViewInfo_ffwd
1026
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_comments"
1027
  id="<?php echo WD_FB_PREFIX; ?>_thumb_comments_1" value="1"
1028
  checked="checked" <?php checked($row->thumb_comments, 1) ?> /><label
1029
- for="<?php echo WD_FB_PREFIX; ?>_thumb_comments_yes">Yes</label>
1030
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_comments"
1031
  id="<?php echo WD_FB_PREFIX; ?>_thumb_comments_0"
1032
  value="0" <?php checked($row->thumb_comments, 0) ?> /><label
1033
- for="<?php echo WD_FB_PREFIX; ?>_thumb_comments_no">No</label>
1034
  </td>
1035
  </tr>
1036
- <!--<tr id="<?php /*echo WD_FB_PREFIX; */?>_tr_thumb_likes">
1037
  <td title="Show likes" class="ffwd_set_l"><label>Show likes: </label></td>
1038
  <td class="ffwd_set_i">
1039
- <input type="radio" name="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes"
1040
- id="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes_1" value="1"
1041
- checked="checked" <?php /*checked($row->thumb_likes, 1) */?> /><label
1042
- for="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes_yes">Yes</label>
1043
- <input type="radio" name="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes"
1044
- id="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes_0"
1045
- value="0" <?php /*checked($row->thumb_likes, 0) */?> /><label
1046
- for="<?php /*echo WD_FB_PREFIX; */?>_thumb_likes_no">No</label>
1047
- </td>
1048
- </tr>-->
1049
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_thumb_name">
1050
  <td title="Show likes" class="ffwd_set_l"><label>Show name: </label></td>
1051
  <td class="ffwd_set_i">
1052
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_name"
1053
  id="<?php echo WD_FB_PREFIX; ?>_thumb_name_1" value="1"
1054
  checked="checked" <?php checked($row->thumb_name, 1) ?> /><label
1055
- for="<?php echo WD_FB_PREFIX; ?>_thumb_name_1">Yes</label>
1056
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_name"
1057
  id="<?php echo WD_FB_PREFIX; ?>_thumb_name_0"
1058
  value="0" <?php checked($row->thumb_name, 0) ?> /><label
1059
- for="<?php echo WD_FB_PREFIX; ?>_thumb_name_0">No</label>
1060
  </td>
1061
  </tr>
1062
  <!--Blog Style view-->
1063
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_width">
1064
  <td title="Maximum value for image width." class="ffwd_set_l"><label
1065
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_width">Width: </label></td>
1066
  <td class="ffwd_set_i">
1067
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_blog_style_width"
1068
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_width"
@@ -1072,7 +1065,8 @@ class FFWDViewInfo_ffwd
1072
  </tr>
1073
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_height">
1074
  <td title="Maximum value for image height." class="ffwd_set_l"><label
1075
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_height">Height: </label></td>
 
1076
  <td class="ffwd_set_i">
1077
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_blog_style_height"
1078
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_height"
@@ -1082,19 +1076,21 @@ class FFWDViewInfo_ffwd
1082
  </tr>
1083
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_view_type">
1084
  <td title="Maximum value for image width." class="ffwd_set_l"><label
1085
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1">View
1086
  style: </label></td>
1087
  <td class="ffwd_set_i">
1088
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type"
1089
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1" value="1"
1090
  checked="checked" <?php checked($row->blog_style_view_type, 1) ?>
1091
  onchange=""/><label
1092
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1">Full width</label>
 
1093
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type"
1094
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_0"
1095
  value="0" <?php checked($row->blog_style_view_type, 0) ?>
1096
  onchange=""/><label
1097
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_0">Half width</label>
 
1098
  </td>
1099
  </tr>
1100
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_comments">
@@ -1103,11 +1099,11 @@ class FFWDViewInfo_ffwd
1103
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_comments"
1104
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_1" value="1"
1105
  checked="checked" <?php checked($row->blog_style_comments, 1) ?> /><label
1106
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_yes">Yes</label>
1107
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_comments"
1108
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_0"
1109
  value="0" <?php checked($row->blog_style_comments, 0) ?> /><label
1110
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_no">No</label>
1111
  </td>
1112
  </tr>
1113
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_likes">
@@ -1116,11 +1112,11 @@ class FFWDViewInfo_ffwd
1116
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_likes"
1117
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_1"
1118
  value="1" <?php checked($row->blog_style_likes, 1) ?> checked="checked"/><label
1119
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_yes">Yes</label>
1120
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_likes"
1121
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_0"
1122
  value="0" <?php checked($row->blog_style_likes, 0) ?> /><label
1123
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_no">No</label>
1124
  </td>
1125
  </tr>
1126
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_message_desc">
@@ -1130,11 +1126,11 @@ class FFWDViewInfo_ffwd
1130
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc"
1131
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_1" value="1"
1132
  checked="checked"/><label
1133
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_1">Yes</label>
1134
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc"
1135
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_0"
1136
  value="0" <?php checked($row->blog_style_message_desc, 0) ?> /><label
1137
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_0">No</label>
1138
  </td>
1139
  </tr>
1140
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_shares">
@@ -1143,62 +1139,67 @@ class FFWDViewInfo_ffwd
1143
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares"
1144
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_1" value="1"
1145
  checked="checked"/><label
1146
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_1">Yes</label>
1147
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares"
1148
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_0"
1149
  value="0" <?php checked($row->blog_style_shares, 0) ?> /><label
1150
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_0">No</label>
1151
  </td>
1152
  </tr>
1153
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_shares_butt">
1154
- <td title="Show share buttons" class="ffwd_set_l"><label>Show share
1155
- buttons: </label></td>
1156
  <td class="ffwd_set_i">
1157
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt"
1158
- id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_1" value="1"
1159
- /><label
1160
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_1">Yes</label>
1161
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt"
1162
- id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_0"
1163
- value="0" checked="checked" /><label
1164
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_0">No</label>
 
 
 
1165
  <br>
1166
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1167
- version</label>
1168
  </td>
1169
  </tr>
1170
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_facebook">
1171
- <td title="Show Facebook share button" class="ffwd_set_l"><label>Show Facebook
1172
- button: </label></td>
1173
  <td class="ffwd_set_i">
1174
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook"
1175
- id="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_1" value="1"
1176
- /><label
1177
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_1">Yes</label>
1178
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook"
1179
- id="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_0"
1180
- value="0" checked="checked" /><label
1181
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_0">No</label>
 
 
1182
  <br>
1183
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1184
- version</label>
1185
  </td>
1186
  </tr>
1187
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_twitter">
1188
- <td title="Show Twitter share button" class="ffwd_set_l"><label>Show Twitter
1189
- button: </label></td>
1190
  <td class="ffwd_set_i">
1191
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter"
1192
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_1" value="1"
1193
- /><label
1194
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_1">Yes</label>
1195
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter"
1196
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_0"
1197
- value="0" checked="checked" /><label
1198
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_0">No</label>
 
 
 
1199
  <br>
1200
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1201
- version</label>
1202
  </td>
1203
  </tr>
1204
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_author">
@@ -1207,11 +1208,11 @@ class FFWDViewInfo_ffwd
1207
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_author"
1208
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_author_1" value="1"
1209
  checked="checked"/><label
1210
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_author_1">Yes</label>
1211
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_author"
1212
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_author_0"
1213
  value="0" <?php checked($row->blog_style_author, 0) ?> /><label
1214
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_author_0">No</label>
1215
  </td>
1216
  </tr>
1217
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_name">
@@ -1220,11 +1221,11 @@ class FFWDViewInfo_ffwd
1220
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_name"
1221
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_name_1" value="1"
1222
  checked="checked"/><label
1223
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_name_1">Yes</label>
1224
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_name"
1225
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_name_0"
1226
  value="0" <?php checked($row->blog_style_name, 0) ?> /><label
1227
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_name_0">No</label>
1228
  </td>
1229
  </tr>
1230
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_place_name">
@@ -1233,11 +1234,11 @@ class FFWDViewInfo_ffwd
1233
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name"
1234
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_1" value="1"
1235
  checked="checked"/><label
1236
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_1">Yes</label>
1237
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name"
1238
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_0"
1239
  value="0" <?php checked($row->blog_style_place_name, 0) ?> /><label
1240
- for="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_0">No</label>
1241
  </td>
1242
  </tr>
1243
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_fb_name">
@@ -1246,34 +1247,37 @@ class FFWDViewInfo_ffwd
1246
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_name"
1247
  id="<?php echo WD_FB_PREFIX; ?>_fb_name_1" value="1"
1248
  checked="checked"/><label
1249
- for="<?php echo WD_FB_PREFIX; ?>_fb_name_1">Yes</label>
1250
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_name"
1251
  id="<?php echo WD_FB_PREFIX; ?>_fb_name_0"
1252
  value="0" <?php checked($row->fb_name, 0) ?> /><label
1253
- for="<?php echo WD_FB_PREFIX; ?>_fb_name_0">No</label>
1254
  </td>
1255
  </tr>
1256
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_fb_plugin">
1257
- <td title="Displays page basic information and allows to like the page" class="ffwd_set_l"><label>Show Page Plugin: </label>
 
1258
  </td>
1259
  <td class="ffwd_set_i">
1260
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_plugin"
1261
  id="<?php echo WD_FB_PREFIX; ?>_fb_plugin_1" value="1" checked="checked"
1262
  onchange="ffwd_toggle_page_plugin(1)"/><label
1263
- for="<?php echo WD_FB_PREFIX; ?>_fb_plugin_1">Yes</label>
1264
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_plugin"
1265
  id="<?php echo WD_FB_PREFIX; ?>_fb_plugin_0"
1266
  value="0" <?php checked($row->fb_plugin, 0) ?>
1267
  onchange="ffwd_toggle_page_plugin(0)"/><label
1268
- for="<?php echo WD_FB_PREFIX; ?>_fb_plugin_0">No</label>
1269
- <p class="description">Displays page basic information and allows to like the page</p>
 
1270
  </td>
1271
  </tr>
1272
 
1273
  <!--Compact Album view-->
1274
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_column_number">
1275
  <td class="ffwd_set_l"><label
1276
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_column_number">Max. number of
 
1277
  album columns: </label></td>
1278
  <td><input type="text"
1279
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_column_number"
@@ -1287,17 +1291,17 @@ class FFWDViewInfo_ffwd
1287
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1288
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_hover" value="hover"
1289
  checked/><label
1290
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_hover">Show on
1291
  hover</label><br/>
1292
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1293
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_show"
1294
  value="show" <?php checked($row->album_title, 'show') ?> /><label
1295
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_show">Always
1296
  show</label><br/>
1297
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1298
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_none"
1299
  value="none" <?php checked($row->album_title, 'none') ?> /><label
1300
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_none">Don't
1301
  show</label>
1302
  </td>
1303
  </tr>
@@ -1318,7 +1322,7 @@ class FFWDViewInfo_ffwd
1318
  </tr>
1319
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_image_column_number">
1320
  <td class="ffwd_set_l"><label
1321
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_column_number">Max.
1322
  number of image columns: </label></td>
1323
  <td><input type="text"
1324
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_column_number"
@@ -1336,8 +1340,8 @@ class FFWDViewInfo_ffwd
1336
  </tr> -->
1337
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_image_thumb_width_height">
1338
  <td title="Maximum values for thumbnail width and height." class="ffwd_set_l"><label
1339
- for="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_width"
1340
- id="compuct_album_image_thumb_dimensions">Image thumbnail
1341
  dimensions: </label></td>
1342
  <td class="ffwd_set_i">
1343
  <input type="text"
@@ -1345,7 +1349,7 @@ class FFWDViewInfo_ffwd
1345
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_width"
1346
  value="<?php echo $row->album_image_thumb_width == 0 ? '200' : $row->album_image_thumb_width ?>"
1347
  class="spider_int_input"/><span
1348
- id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_dimensions_x"> x </span>
1349
  <input type="text"
1350
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_height"
1351
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_height"
@@ -1387,23 +1391,26 @@ class FFWDViewInfo_ffwd
1387
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_image_onclick_action">
1388
  <td class="ffwd_set_l"><label>Image Onclick: </label></td>
1389
  <td class="ffwd_set_i">
 
1390
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1391
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_lightbox"
1392
  onchange="toggle_lightbox_tab('lightbox')"
1393
  value="lightbox" <?php checked($row->image_onclick_action, 'lightbox') ?> /><label
1394
- for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_lightbox">Open
1395
  Lightbox</label><br/>
 
1396
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1397
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_facebook"
1398
  onchange="toggle_lightbox_tab('facebook')"
1399
  value="facebook" <?php checked($row->image_onclick_action, 'facebook') ?> /><label
1400
- for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_facebook">Redirect To
 
1401
  Facebook</label><br/>
1402
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1403
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_none"
1404
  onchange="toggle_lightbox_tab('none')"
1405
  value="none" <?php checked($row->image_onclick_action, 'none') ?> /><label
1406
- for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_none">Do
1407
  Nothing </label>
1408
  </td>
1409
  </tr>
@@ -1440,12 +1447,14 @@ class FFWDViewInfo_ffwd
1440
  <td class="ffwd_set_i">
1441
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_view_on_fb"
1442
  id="<?php echo WD_FB_PREFIX; ?>_view_on_fb_1"
1443
- value="1" <?php if ($row->view_on_fb) echo 'checked="checked"'; ?> /><label
1444
- for="<?php echo WD_FB_PREFIX; ?>_view_on_fb_1">Yes</label>
 
1445
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_view_on_fb"
1446
  id="<?php echo WD_FB_PREFIX; ?>_view_on_fb_0"
1447
- value="0" <?php if (!$row->view_on_fb) echo 'checked="checked"'; ?> /><label
1448
- for="<?php echo WD_FB_PREFIX; ?>_view_on_fb_0">No</label>
 
1449
  <div class="spider_description"></div>
1450
  </td>
1451
  </tr>
@@ -1463,7 +1472,6 @@ class FFWDViewInfo_ffwd
1463
  <label class="ffwd_header_l">Lightbox settings</label>
1464
  </div>
1465
  <div class="ffwd_view_l_s">
1466
-
1467
  <table class="ffwd_sett_tabl">
1468
  <!--Lightbox view-->
1469
  <tbody id="<?php echo WD_FB_PREFIX; ?>_tbody_popup">
@@ -1476,17 +1484,18 @@ class FFWDViewInfo_ffwd
1476
  id="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_1"
1477
  value="1" <?php checked($row->popup_fullscreen, 1) ?>
1478
  onchange="bwg_popup_fullscreen(1)"/><label
1479
- for="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_1">Yes</label>
1480
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen"
1481
  id="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_0"
1482
  value="0" <?php checked($row->popup_fullscreen, 0);
1483
  checked($row->popup_fullscreen, '') ?>onchange="bwg_popup_fullscreen(0)"/><label
1484
- for="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_0">No</label>
1485
  </td>
1486
  </tr>
1487
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_width_height">
1488
  <td title="Maximum values for lightbox width and height." class="ffwd_set_l"><label
1489
- for="<?php echo WD_FB_PREFIX; ?>_popup_width">Lightbox dimensions: </label>
 
1490
  </td>
1491
  <td class="ffwd_set_i">
1492
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_width"
@@ -1501,19 +1510,17 @@ class FFWDViewInfo_ffwd
1501
  </tr>
1502
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_effect">
1503
  <td title="Lightbox slideshow effect." class="ffwd_set_l"><label
1504
- for="<?php echo WD_FB_PREFIX; ?>_popup_effect">Lightbox effect: </label>
1505
  </td>
1506
  <td class="ffwd_set_i">
1507
  <select name="<?php echo WD_FB_PREFIX; ?>_popup_effect"
1508
  id="<?php echo WD_FB_PREFIX; ?>_popup_effect" style="width:150px;">
1509
  <?php
1510
- $i=0;
1511
  foreach ($effects as $key => $effect) {
1512
  ?>
1513
- <option <?php if($i>1) echo 'disabled'; ?>
1514
- value="<?php echo $key; ?>" <?php selected($row->popup_effect, $key) ?>><?php echo $effect; ?></option>
1515
  <?php
1516
- $i++;
1517
  }
1518
  ?>
1519
  </select>
@@ -1527,19 +1534,19 @@ class FFWDViewInfo_ffwd
1527
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_autoplay"
1528
  id="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_1" <?php checked($row->popup_autoplay, 1) ?>
1529
  value="1"/><label
1530
- for="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_1">Yes</label>
1531
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_autoplay"
1532
  id="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_0"
1533
  value="0" <?php checked($row->popup_autoplay, 0);
1534
  checked($row->popup_autoplay, '') ?> /><label
1535
- for="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_0">No</label>
1536
  </td>
1537
  </tr>
1538
 
1539
 
1540
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_interval">
1541
  <td title="Interval between two images." class="ffwd_set_l"><label
1542
- for="<?php echo WD_FB_PREFIX; ?>_popup_interval">Time interval: </label>
1543
  </td>
1544
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_interval"
1545
  id="<?php echo WD_FB_PREFIX; ?>_popup_interval"
@@ -1556,44 +1563,45 @@ class FFWDViewInfo_ffwd
1556
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_open_commentbox"
1557
  id="<?php echo WD_FB_PREFIX; ?>_open_commentbox_1" <?php checked($row->open_commentbox, 1) ?>
1558
  value="1"/><label
1559
- for="<?php echo WD_FB_PREFIX; ?>_open_commentbox_1">Yes</label>
1560
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_open_commentbox"
1561
  id="<?php echo WD_FB_PREFIX; ?>_open_commentbox_0"
1562
  value="0" <?php checked($row->open_commentbox, 0);
1563
  checked($row->open_commentbox, '') ?> /><label
1564
- for="<?php echo WD_FB_PREFIX; ?>_open_commentbox_0">No</label>
1565
  </td>
1566
  </tr>
1567
 
1568
 
1569
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_filmstrip">
1570
- <td title="Show filmstrip view for images" class="ffwd_set_l"><label>Show filmstrip
1571
- in lightbox: </label></td>
1572
  <td class="ffwd_set_i">
1573
- <input disabled type="radio"
1574
- name="<?php echo WD_FB_PREFIX; ?>_popup_enable_filmstrip"
1575
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes" value="1"
1576
-
1577
- onClick="bwg_enable_disable('', '<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height', '<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes')"/><label
1578
- for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes">Yes</label>
1579
- <input disabled type="radio"
1580
- name="<?php echo WD_FB_PREFIX; ?>_popup_enable_filmstrip"
1581
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no"
1582
- value="0" checked
1583
- onClick="bwg_enable_disable('none', '<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height', '<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no')"/><label
1584
- for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no">No</label>
 
 
1585
  <br>
1586
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1587
- version</label>
1588
  </td>
1589
  </tr>
1590
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height">
1591
  <td class="ffwd_set_l"><label
1592
- for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height">Filmstrip
1593
  size: </label></td>
1594
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height"
1595
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height"
1596
- value="<?php if ($row->popup_filmstrip_height == 0) echo '75'; else echo $row->popup_filmstrip_height ?>"
 
1597
  class="spider_int_input"/> px
1598
  </td>
1599
  </tr>
@@ -1603,11 +1611,11 @@ class FFWDViewInfo_ffwd
1603
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_comments"
1604
  id="<?php echo WD_FB_PREFIX; ?>_popup_comments_1" value="1"
1605
  checked="checked"/><label
1606
- for="<?php echo WD_FB_PREFIX; ?>_popup_comments_yes">Yes</label>
1607
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_comments"
1608
  id="<?php echo WD_FB_PREFIX; ?>_popup_comments_0"
1609
  value="0" <?php checked($row->popup_comments, 0) ?> /><label
1610
- for="<?php echo WD_FB_PREFIX; ?>_popup_comments_no">No</label>
1611
  </td>
1612
  </tr>
1613
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_likes">
@@ -1616,11 +1624,11 @@ class FFWDViewInfo_ffwd
1616
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_likes"
1617
  id="<?php echo WD_FB_PREFIX; ?>_popup_likes_1" value="1"
1618
  checked="checked"/><label
1619
- for="<?php echo WD_FB_PREFIX; ?>_popup_likes_yes">Yes</label>
1620
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_likes"
1621
  id="<?php echo WD_FB_PREFIX; ?>_popup_likes_0"
1622
  value="0" <?php checked($row->popup_likes, 0) ?> /><label
1623
- for="<?php echo WD_FB_PREFIX; ?>_popup_likes_no">No</label>
1624
  </td>
1625
  </tr>
1626
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_shares">
@@ -1629,11 +1637,11 @@ class FFWDViewInfo_ffwd
1629
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_shares"
1630
  id="<?php echo WD_FB_PREFIX; ?>_popup_shares_1" value="1"
1631
  checked="checked"/><label
1632
- for="<?php echo WD_FB_PREFIX; ?>_popup_shares_1">Yes</label>
1633
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_shares"
1634
  id="<?php echo WD_FB_PREFIX; ?>_popup_shares_0"
1635
  value="0" <?php checked($row->popup_shares, 0) ?> /><label
1636
- for="<?php echo WD_FB_PREFIX; ?>_popup_shares_0">No</label>
1637
  </td>
1638
  </tr>
1639
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_author">
@@ -1642,11 +1650,11 @@ class FFWDViewInfo_ffwd
1642
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_author"
1643
  id="<?php echo WD_FB_PREFIX; ?>_popup_author_1" value="1"
1644
  checked="checked"/><label
1645
- for="<?php echo WD_FB_PREFIX; ?>_popup_author_1">Yes</label>
1646
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_author"
1647
  id="<?php echo WD_FB_PREFIX; ?>_popup_author_0"
1648
  value="0" <?php checked($row->popup_author, 0) ?> /><label
1649
- for="<?php echo WD_FB_PREFIX; ?>_popup_author_0">No</label>
1650
  </td>
1651
  </tr>
1652
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_name">
@@ -1658,7 +1666,7 @@ class FFWDViewInfo_ffwd
1658
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_name"
1659
  id="<?php echo WD_FB_PREFIX; ?>_popup_name_0"
1660
  value="0" <?php checked($row->popup_name, 0) ?> /><label
1661
- for="<?php echo WD_FB_PREFIX; ?>_popup_name_0">No</label>
1662
  </td>
1663
  </tr>
1664
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_place_name">
@@ -1667,11 +1675,11 @@ class FFWDViewInfo_ffwd
1667
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_place_name"
1668
  id="<?php echo WD_FB_PREFIX; ?>_popup_place_name_1" value="1"
1669
  checked="checked"/><label
1670
- for="<?php echo WD_FB_PREFIX; ?>_popup_place_name_1">Yes</label>
1671
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_place_name"
1672
  id="<?php echo WD_FB_PREFIX; ?>_popup_place_name_0"
1673
  value="0" <?php checked($row->popup_place_name, 0) ?> /><label
1674
- for="<?php echo WD_FB_PREFIX; ?>_popup_place_name_0">No</label>
1675
  </td>
1676
  </tr>
1677
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_ctrl_btn">
@@ -1682,12 +1690,12 @@ class FFWDViewInfo_ffwd
1682
  id="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_yes" value="1"
1683
  onClick="bwg_enable_disable('', '<?php echo WD_FB_PREFIX; ?>_tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');"
1684
  checked="checked"/><label
1685
- for="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_yes">Yes</label>
1686
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_ctrl_btn"
1687
  id="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_no"
1688
  value="0" <?php checked($row->popup_enable_ctrl_btn, 0) ?>
1689
  onClick="bwg_enable_disable('none', '<?php echo WD_FB_PREFIX; ?>_tbody_popup_ctrl_btn', 'popup_ctrl_btn_no');"/><label
1690
- for="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_no">No</label>
1691
  </td>
1692
  </tr>
1693
  </tbody>
@@ -1699,78 +1707,88 @@ class FFWDViewInfo_ffwd
1699
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen"
1700
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_1" value="1"
1701
  checked="checked"/><label
1702
- for="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_1">Yes</label>
1703
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen"
1704
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_0" <?php checked($row->popup_enable_fullscreen, 0) ?>
1705
  value="0"/><label
1706
- for="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_0">No</label>
1707
  </td>
1708
  </tr>
1709
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_info_btn">
1710
- <td title="Show object info button for view name etc" class="ffwd_set_l"><label>Show
1711
- info and comments: </label></td>
 
1712
  <td class="ffwd_set_i">
1713
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_info"
1714
- id="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_1" value="1"
1715
- /><label
1716
- for="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_1">Yes</label>
1717
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_info"
1718
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_0"
1719
- value="0" checked="checked" /><label
1720
- for="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_0">No</label>
 
 
 
1721
  <br>
1722
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1723
- version</label>
1724
  </td>
1725
  </tr>
1726
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_message_desc">
1727
- <td title="Show object info button for view name etc" class="ffwd_set_l"><label>Show
1728
- message(description): </label></td>
1729
  <td class="ffwd_set_i">
1730
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_message_desc"
1731
  id="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_1" value="1"
1732
  checked="checked"/><label
1733
- for="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_1">Yes</label>
1734
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_message_desc"
1735
  id="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_0"
1736
  value="0" <?php checked($row->popup_message_desc, 0) ?> /><label
1737
- for="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_0">No</label>
1738
  </td>
1739
  </tr>
1740
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_facebook">
1741
- <td title="Show Facebook share button for images" class="ffwd_set_l"><label>Show
1742
- Facebook button: </label></td>
1743
- <td class="ffwd_set_i">
1744
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_facebook"
1745
- id="<?php echo WD_FB_PREFIX; ?>_popup_facebook_1" value="1"
1746
- /><label
1747
- for="<?php echo WD_FB_PREFIX; ?>_popup_facebook_1">Yes</label>
1748
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_facebook"
1749
- id="<?php echo WD_FB_PREFIX; ?>_popup_facebook_0"
1750
- value="0" checked="checked" /><label
1751
- for="<?php echo WD_FB_PREFIX; ?>_popup_facebook_0">No</label>
1752
- <br>
1753
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1754
- version</label>
1755
  </td>
1756
- </tr>
1757
- <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_twitter">
1758
- <td title="Show Twitter share button for images" class="ffwd_set_l"><label>Show
1759
- Twitter button: </label></td>
1760
  <td class="ffwd_set_i">
1761
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_twitter"
1762
- id="<?php echo WD_FB_PREFIX; ?>_popup_twitter_1" value="1"
1763
- /><label
1764
- for="<?php echo WD_FB_PREFIX; ?>_popup_twitter_1">Yes</label>
1765
- <input disabled type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_twitter"
1766
- id="<?php echo WD_FB_PREFIX; ?>_popup_twitter_0"
1767
- value="0" checked="checked" /><label
1768
- for="<?php echo WD_FB_PREFIX; ?>_popup_twitter_0">No</label>
 
 
 
1769
  <br>
1770
- <label for="" class="ffwd_pro_only">This Feature is Available Only in PRO
1771
- version</label>
1772
  </td>
1773
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1774
  <!-- <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_pinterest">
1775
  <td title="Show Pinterest share button for images" class="ffwd_set_l"><label>Show Pinterest button: </label></td>
1776
  <td class="ffwd_set_i">
@@ -1810,12 +1828,12 @@ class FFWDViewInfo_ffwd
1810
  value="toplevel" <?php checked($row->comments_filter, 'toplevel');
1811
  checked($row->comments_filter, '') ?>
1812
  onchange="ffwd_show_hide_options('tr_comments_replies', 'table-row')"/><label
1813
- for="<?php echo WD_FB_PREFIX; ?>_comments_filter_1">Toplevel</label>
1814
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_filter"
1815
  id="<?php echo WD_FB_PREFIX; ?>_comments_filter_0"
1816
  value="stream" <?php checked($row->comments_filter, 'stream') ?>
1817
  onchange="ffwd_show_hide_options('tr_comments_replies', 'none')"/><label
1818
- for="<?php echo WD_FB_PREFIX; ?>_comments_filter_0">Stream</label>
1819
  <div class="spider_description">
1820
  Toplevel - same structure as they appear on Facebook.
1821
  Comments count (excluding replies).<br>
@@ -1832,12 +1850,14 @@ class FFWDViewInfo_ffwd
1832
  <td class="ffwd_set_i">
1833
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_replies"
1834
  id="<?php echo WD_FB_PREFIX; ?>_comments_replies_1"
1835
- value="1" <?php if ($row->comments_replies) echo 'checked="checked"'; ?> /><label
1836
- for="<?php echo WD_FB_PREFIX; ?>_comments_replies_1">Yes</label>
 
1837
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_replies"
1838
  id="<?php echo WD_FB_PREFIX; ?>_comments_replies_0"
1839
- value="0" <?php if (!$row->comments_replies) echo 'checked="checked"'; ?> /><label
1840
- for="<?php echo WD_FB_PREFIX; ?>_comments_replies_0">No</label>
 
1841
  </td>
1842
  </tr>
1843
  <tr>
@@ -1849,11 +1869,11 @@ class FFWDViewInfo_ffwd
1849
  id="<?php echo WD_FB_PREFIX; ?>_comments_order_1"
1850
  value="chronological" <?php checked($row->comments_order, "chronological");
1851
  checked($row->comments_order, "") ?> /><label
1852
- for="<?php echo WD_FB_PREFIX; ?>_comments_order_1">Chronological</label>
1853
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_order"
1854
  id="<?php echo WD_FB_PREFIX; ?>_comments_order_0"
1855
  value="reverse_chronological" <?php checked($row->comments_order, "reverse_chronological") ?> /><label
1856
- for="<?php echo WD_FB_PREFIX; ?>_comments_order_0">Reverse
1857
  chronological</label>
1858
  </td>
1859
  </tr>
@@ -1882,11 +1902,11 @@ class FFWDViewInfo_ffwd
1882
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_1"
1883
  value="top" <?php checked($row->page_plugin_pos, 'top');
1884
  checked($row->page_plugin_pos, '') ?> /><label
1885
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_1">Top</label>
1886
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos"
1887
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_0"
1888
  value="bottom" <?php checked($row->page_plugin_pos, 'bottom') ?> /><label
1889
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_0">Bottom</label>
1890
  <!-- <div class="spider_description"></div> -->
1891
  </td>
1892
  </tr>
@@ -1897,12 +1917,14 @@ class FFWDViewInfo_ffwd
1897
  <td class="ffwd_set_i">
1898
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans"
1899
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_1"
1900
- value="1" <?php if ($row->page_plugin_fans) echo 'checked="checked"'; ?> /><label
1901
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_1">Yes</label>
 
1902
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans"
1903
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_0"
1904
- value="0" <?php if (!$row->page_plugin_fans) echo 'checked="checked"'; ?> /><label
1905
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_0">No</label>
 
1906
  </td>
1907
  </tr>
1908
  <tr id="tr_page_plugin_width">
@@ -1923,12 +1945,14 @@ class FFWDViewInfo_ffwd
1923
  <td class="ffwd_set_i">
1924
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover"
1925
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_1"
1926
- value="1" <?php if ($row->page_plugin_cover) echo 'checked="checked"'; ?> /><label
1927
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_1">Yes</label>
 
1928
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover"
1929
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_0"
1930
- value="0" <?php if (!$row->page_plugin_cover) echo 'checked="checked"'; ?> /><label
1931
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_0">No</label>
 
1932
  </td>
1933
  </tr>
1934
  <tr id="tr_page_plugin_header">
@@ -1938,12 +1962,14 @@ class FFWDViewInfo_ffwd
1938
  <td class="ffwd_set_i">
1939
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_header"
1940
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_1"
1941
- value="1" <?php if ($row->page_plugin_header) echo 'checked="checked"'; ?> /><label
1942
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_1">Yes</label>
 
1943
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_header"
1944
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_0"
1945
- value="0" <?php if (!$row->page_plugin_header) echo 'checked="checked"'; ?> /><label
1946
- for="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_0">No</label>
 
1947
  </td>
1948
  </tr>
1949
  </table>
@@ -1970,9 +1996,11 @@ class FFWDViewInfo_ffwd
1970
  jQuery('.ffwd_p').css('display', 'none');
1971
  jQuery('.ffwd_' + show).css('display', 'block')
1972
  }
 
1973
  function ffwd_change_label(id, text) {
1974
  jQuery('#' + id).html(text);
1975
  }
 
1976
  function ffwd_view_type(wd_fb_prefix, view_type, that) {
1977
  var fb_type = jQuery("select[id=" + wd_fb_prefix + "_type]").find(":selected").val(),
1978
  fb_content_type = jQuery("input[name=" + wd_fb_prefix + "_content_type]:checked").val(),
@@ -2044,8 +2072,7 @@ class FFWDViewInfo_ffwd
2044
  jQuery("#" + wd_fb_prefix + "_tr_popup_message_desc").css('display', 'none');
2045
 
2046
  switch (view_type) {
2047
- case 'thumbnails':
2048
- {
2049
  ffwd_change_label(wd_fb_prefix + '_image_max_columns_label', 'Max. number of image columns: ');
2050
  ffwd_change_label(wd_fb_prefix + '_thumb_width_height_label', 'Image thumbnail dimensions: ');
2051
  jQuery('#' + wd_fb_prefix + '_thumb_width').show();
@@ -2058,8 +2085,7 @@ class FFWDViewInfo_ffwd
2058
  break;
2059
 
2060
  }
2061
- case 'thumbnails_masonry':
2062
- {
2063
  if (jQuery("input[name=" + wd_fb_prefix + "_masonry_hor_ver]:checked").val() == 'horizontal') {
2064
  ffwd_change_label(wd_fb_prefix + '_image_max_columns_label', 'Number of image rows: ');
2065
  ffwd_change_label(wd_fb_prefix + '_thumb_width_height_label', 'Image thumbnail height: ');
@@ -2084,8 +2110,7 @@ class FFWDViewInfo_ffwd
2084
 
2085
  }
2086
 
2087
- case 'blog_style':
2088
- {
2089
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_view_type").css('display', '');
2090
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_view_type").css('display', '');
2091
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_comments").css('display', '');
@@ -2105,8 +2130,7 @@ class FFWDViewInfo_ffwd
2105
  break;
2106
  }
2107
 
2108
- case 'album_compact':
2109
- {
2110
  jQuery("#" + wd_fb_prefix + "_tr_compuct_album_column_number").css('display', '');
2111
  jQuery("#" + wd_fb_prefix + "_tr_compuct_albums_per_page").css('display', '');
2112
  jQuery("#" + wd_fb_prefix + "_tr_compuct_album_title_hover").css('display', '');
@@ -2187,90 +2211,46 @@ class FFWDViewInfo_ffwd
2187
  break;
2188
  }
2189
  }
2190
- ;
2191
 
2192
 
2193
  jQuery('#ffwd_fb_view_type').val(view_type);
2194
  }
2195
 
2196
- function toggle_lightbox_tab(val) {
2197
- if (val == 'lightbox') {
2198
- jQuery('#ffwd_tab_lightbox').css('display', '');
2199
-
2200
- }
2201
- else {
2202
-
2203
- jQuery('#ffwd_tab_lightbox').css('display', 'none');
2204
-
2205
- }
2206
-
2207
-
2208
  }
2209
 
2210
-
2211
- function ffwd_toggle_page_plugin(val) {
2212
-
2213
- if (val == '1') {
2214
- jQuery('#ffwd_tab_page_plugin').css('display', '');
2215
-
2216
- }
2217
- else {
2218
-
2219
- jQuery('#ffwd_tab_page_plugin').css('display', 'none');
2220
-
2221
- }
2222
-
2223
-
2224
  }
2225
 
2226
-
2227
  jQuery(document).ready(function () {
2228
- ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', '<?php echo $row->fb_view_type ?>', jQuery('.<?php echo WD_FB_PREFIX; ?>_<?php echo $row->fb_view_type ?>'))
2229
- choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', '<?php echo $row->content_type ?>')
2230
- /*jQuery('body').on('click', '.ffwd_header_c', function () {
2231
- var elem = jQuery(this).parent().find('.ffwd_sett_tabl'),
2232
- d = (elem.css('display') == 'none') ? 'block' : 'none';
2233
- elem.css('display', d);
2234
- })*/
2235
 
2236
-
2237
- bwg_popup_fullscreen(<?php echo $row->popup_fullscreen ?>);
2238
-
2239
- <?php
2240
-
2241
- if($row->comments_filter == 'stream')
2242
- {
2243
- ?>
2244
  ffwd_show_hide_options('tr_comments_replies', 'none');
2245
-
2246
- <?php
2247
- }
2248
-
2249
- ?>
2250
-
2251
-
2252
-
2253
- toggle_lightbox_tab('<?php echo $row->image_onclick_action ?>');
2254
- ffwd_toggle_page_plugin('<?php echo $row->fb_plugin ?>');
2255
-
2256
-
2257
  });
2258
 
2259
- function ffwd_show_hide_options(id, display) {
2260
- jQuery("#" + id).css("display", display);
2261
  }
2262
-
2263
-
2264
  </script>
2265
  <?php
2266
  }
2267
- ////////////////////////////////////////////////////////////////////////////////////////
2268
- // Getters & Setters //
2269
- ////////////////////////////////////////////////////////////////////////////////////////
2270
- ////////////////////////////////////////////////////////////////////////////////////////
2271
- // Private Methods //
2272
- ////////////////////////////////////////////////////////////////////////////////////////
2273
- ////////////////////////////////////////////////////////////////////////////////////////
2274
- // Listeners //
2275
- ////////////////////////////////////////////////////////////////////////////////////////
2276
  }
1
  <?php
2
 
3
+ class FFWDViewInfo_ffwd {
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ private $model;
6
 
7
+ public function __construct($model) {
 
 
 
 
8
  $this->model = $model;
9
  }
10
 
11
+ public function display() {
 
 
 
 
 
12
  $rows_data = $this->model->get_rows_data();
13
  $this->model->del_ffwd_objects();
14
  $page_nav = $this->model->page_nav();
20
  $ids_string = '';
21
  $per_page = $this->model->per_page();
22
  $pager = 0;
 
 
23
  ?>
24
+ <div class="ffwd_upgrade wd-clear">
25
+ <div class="ffwd-left">
26
+ <div style="font-size: 14px; ">
27
+ <?php _e(" This section allows you to create, edit and delete Facebook Feed by 10Web.", "ffwd"); ?>
28
+ <a style="color: #5CAEBD; text-decoration: none;border-bottom: 1px dotted;" target="_blank" href="https://help.10web.io/hc/en-us/articles/360017959512-Getting-Facebook-Access-Token?utm_source=facebook_feed&utm_medium=free_plugin"><?php _e("Read More in User Manual.", "ffwd"); ?></a>
29
+ </div>
30
+ </div>
31
+ </div>
32
  <form class="wrap" id="ffwd_info_form" method="post" action="admin.php?page=info_ffwd" style="width:99%;">
 
 
33
  <?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
34
+ <h2></h2>
35
  <div class="ffwd_plugin_header">
36
  <span class="wd-fb-icon"></span>
37
  <h2 class="ffwd_page_name">
38
  Feeds
39
  <a href="" class="ffwd-button-primary ffwd-button-add-new" onclick="spider_set_input_value('task', 'add');
40
+ spider_form_submit(event, 'ffwd_info_form')"> Add new</a>
 
 
41
  </h2>
42
  </div>
43
+ <div id="draganddrop" class="updated" style="display:none;"><strong><p>Changes made in this table should be saved.</p></strong></div>
 
 
 
 
 
 
 
44
  <div class="buttons_div">
45
  <span class="ffwd-button-secondary non_selectable" onclick="spider_check_all_items()">
46
  <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox()"
47
  style="margin: 0; vertical-align: middle;"/>
48
  <span style="vertical-align: middle;">Select All</span>
49
  </span>
 
 
 
 
50
  <input id="show_hide_weights" class="ffwd-button-secondary ffwd-button-show-order" type="button"
51
  onclick="spider_show_hide_weights();return false;" value="Hide order column"/>
52
  <input class="ffwd-button-secondary ffwd-button-save-order" type="submit"
80
  echo $order_class;
81
  } ?>">
82
  <a onclick="spider_set_input_value('task', '');
83
+ spider_set_input_value('order_by', 'id');
84
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'id') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
85
+ spider_form_submit(event, 'ffwd_info_form')" href="">
86
  <span>ID</span><span class="sorting-indicator"></span>
87
  </a>
88
  </th>
90
  echo $order_class;
91
  } ?>">
92
  <a onclick="spider_set_input_value('task', '');
93
+ spider_set_input_value('order_by', 'name');
94
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'name') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
95
+ spider_form_submit(event, 'ffwd_info_form')" href="">
96
  <span>Name</span><span class="sorting-indicator"></span>
97
  </a>
98
  </th>
 
99
  <th id="th_order" class="table_medium_col <?php if ($order_by == 'order') {
100
  echo $order_class;
101
  } ?>">
102
  <a onclick="spider_set_input_value('task', '');
103
+ spider_set_input_value('order_by', 'order');
104
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'order') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
105
+ spider_form_submit(event, 'ffwd_info_form')" href="">
106
  <span>Order</span><span class="sorting-indicator"></span>
107
  </a>
108
  </th>
109
+ <th>Shortcode</th>
110
  <th class="table_big_col <?php if ($order_by == 'published') {
111
  echo $order_class;
112
  } ?>">
113
  <a onclick="spider_set_input_value('task', '');
114
+ spider_set_input_value('order_by', 'published');
115
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'published') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
116
+ spider_form_submit(event, 'ffwd_info_form')" href="">
117
  <span>Published</span><span class="sorting-indicator"></span>
118
  </a>
119
  </th>
138
  type="checkbox"/></td>
139
  <td class="table_small_col"><?php echo $row_data->id; ?></td>
140
  <td><a onclick="spider_set_input_value('task', 'edit');
141
+ spider_set_input_value('page_number', '1');
142
+ spider_set_input_value('search_value', '');
143
+ spider_set_input_value('search_or_not', '');
144
+ spider_set_input_value('asc_or_desc', 'asc');
145
+ spider_set_input_value('order_by', 'order');
146
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
147
+ spider_form_submit(event, 'ffwd_info_form')"
148
  href=""><?php echo $row_data->name; ?></a></td>
149
  <td class="spider_order table_medium_col"><input
150
+ id="order_input_<?php echo $row_data->id; ?>"
151
+ name="order_input_<?php echo $row_data->id; ?>" type="text" size="1"
152
+ value="<?php echo $row_data->order; ?>"/></td>
 
153
 
154
+ <td><input readonly type="text" onclick="jQuery(this).focus();jQuery(this).select();"
155
+ value='[WD_FB id="<?php echo $row_data->id ?>"]'/></td>
156
  <td class="table_big_col"><a
157
+ onclick="spider_set_input_value('task', '<?php echo $published; ?>');spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');spider_form_submit(event, 'ffwd_info_form')"
158
+ href="" style="display: block;height: 20px;overflow: hidden;"><img
159
+ src="<?php echo WD_FFWD_URL . '/images/ffwd/button-icons2.png'; ?>"
160
+ style="position: relative;top:<?php echo $published_image ?>"></img></a>
161
  </td>
162
  <td class="table_big_col"><a onclick="spider_set_input_value('task', 'edit');
163
+ spider_set_input_value('page_number', '1');
164
+ spider_set_input_value('search_value', '');
165
+ spider_set_input_value('search_or_not', '');
166
+ spider_set_input_value('asc_or_desc', 'asc');
167
+ spider_set_input_value('order_by', 'order');
 
 
 
 
 
168
  spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
169
+ spider_form_submit(event, 'ffwd_info_form')" href="">Edit</a></td>
170
+ <td class="table_big_col"><a
171
+ onclick="if(! confirm('Are you sure you want to delete ?'))return false;
172
+ spider_set_input_value('task', 'delete');
173
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
174
+ spider_form_submit(event, 'ffwd_info_form')" href="">Delete</a></td>
175
  </tr>
176
  <?php
177
  $ids_string .= $row_data->id . ',';
190
  <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>"/>
191
  <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
192
  <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>"/>
193
+ <!-- <script>
194
  window.onload = spider_show_hide_weights;
195
  var dropped_ids = [],
196
  ffwd_data = jQuery.parseJSON('<?php /*echo $this->model->ffwd_objects; */?>');
202
  ).error(createCallback(i, j));
203
  }
204
  }
205
+
206
  function createCallback(i, j) {
207
  return function (e) {
208
  do_something_with_data(i, j, e);
209
  };
210
  }
211
+
212
  function do_something_with_data(i, j, e) {
213
  var error = jQuery.parseJSON(e.responseText);
214
  if (error == null) return;
228
  });
229
  }
230
  }
231
+
232
  function createSuccessCallback(i, j) {
233
  return;
234
  }
237
  <?php
238
  }
239
 
240
+ public function edit($id) {
 
 
 
241
  $row = $this->model->get_row_data($id);
242
  $theme_rows = $this->model->get_theme_rows_data();
243
  $fb_glob_optons = $this->model->get_option_row_data();
244
  $page_title = (($id != 0) ? 'Edit Facebook Feed by 10Web ' . $row->name : 'Create new Facebook Feed by 10Web');
245
  $type = $row->type;
246
+ if($type != 'profile' || $type != 'group' ){
247
+ $type = 'page';
248
+ }
249
  $content_url = $row->content_url;
250
  $disabled = ($id != 0) ? 'disabled' : '';
 
251
  $effects = array(
252
+ 'none' => 'None',
253
+ 'cubeH' => 'Cube Horizontal',
254
+ 'cubeV' => 'Cube Vertical',
255
+ 'fade' => 'Fade',
256
+ 'sliceH' => 'Slice Horizontal',
257
+ 'sliceV' => 'Slice Vertical',
258
+ 'slideH' => 'Slide Horizontal',
259
+ 'slideV' => 'Slide Vertical',
260
+ 'scaleOut' => 'Scale Out',
261
+ 'scaleIn' => 'Scale In',
262
+ 'blockScale' => 'Block Scale',
263
+ 'kaleidoscope' => 'Kaleidoscope',
264
+ 'fan' => 'Fan',
265
+ 'blindH' => 'Blind Horizontal',
266
+ 'blindV' => 'Blind Vertical',
267
+ 'random' => 'Random',
 
268
  );
 
 
269
  ?>
270
  <style>
 
 
271
  .ffwd_header {
272
  /*background-image: url("../images/ffwd_logo.png");*/
273
  background: url('<?php echo WD_FFWD_URL; ?>/images/ffwd_logo.png') no-repeat 0px center;
352
  .ffwd_view_l_s, .ffwd_varied_s {
353
  padding: 9px;
354
  box-sizing: border-box;
355
+ width: 500px;
356
  }
357
 
358
  .ffwd_view_t_s, .ffwd_varied_f {
500
 
501
  }
502
  </style>
503
+ <div id="message_div" class="updated" style="display: none;"></div>
504
+ <div class="ffwd_upgrade wd-clear">
505
+ <div class="ffwd-left">
506
 
507
+ <div style="font-size: 14px; ">
508
+ <?php _e(" This section allows you to create, edit and delete Facebook Feed by 10Web.", "ffwd"); ?>
509
+ <a style="color: #5CAEBD; text-decoration: none;border-bottom: 1px dotted;" target="_blank"
510
+ href="https://help.10web.io/hc/en-us/articles/360017959512-Getting-Facebook-Access-Token?utm_source=facebook_feed&utm_medium=free_plugin"><?php _e("Read More in User Manual.", "ffwd"); ?></a>
511
+ </div>
512
 
513
+ </div>
514
+
515
+ </div>
516
 
 
 
 
517
 
518
  <form class="wrap" method="post" id="ffwd_info_form" action="admin.php?page=info_ffwd" style="width:99%;">
519
  <h2></h2>
520
+
521
  <?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
522
  <!-- <span class="wd-fb-icon"></span> -->
523
  <div style="font-size: 16px" class="ffwd_notice"></div>
524
  <div class="ffwd_plugin_header">
 
525
  <span class="wd-fb-icon"></span>
526
  <h2 class="ffwd_page_name"><?php echo $page_title; ?></h2>
527
  </div>
528
 
 
 
 
529
  <div class="ffwd_tabs_cont" style="float:left;">
 
530
  <ul class="ffwd_tabs">
531
  <li class="ffwd_tab ffwd_tab_s" show="main" onclick="ffwd_change_tab(this)">Main</li>
532
  <li class="ffwd_tab" id="ffwd_tab_lightbox" show="lightbox_settings"
540
  </li>
541
  </ul>
542
  </div>
 
 
 
 
543
  <div class="ffwd_butts_c" style="float:right;">
544
  <input class=" ffwd-button-primary ffwd-button-save" type="button"
545
  onclick="if (spider_check_required('name', 'Name') || spider_check_required('fb_page_id', 'Fb pages'))return false;
546
+ spider_set_input_value('task', 'save');
547
+ spider_ajax_save('<?php echo WD_FB_PREFIX; ?>');" value="Save"/>
548
  <input class=" ffwd-button-primary ffwd-button-apply" type="button"
549
  onclick="if (spider_check_required('name', 'Name') || spider_check_required('fb_page_id', 'Fb pages')) return false;
550
+ spider_set_input_value('task', 'apply');
551
+ spider_ajax_save('<?php echo WD_FB_PREFIX; ?>');" value="Apply"/>
552
  <input class=" ffwd-button-secondary ffwd-button-cancel" type="submit" onclick="spider_set_input_value('page_number', '1');
553
  spider_set_input_value('task', 'cancel')"
554
  value="Cancel"/>
575
  <select name="<?php echo WD_FB_PREFIX; ?>_type"
576
  id="<?php echo WD_FB_PREFIX; ?>_type" style="width:90px;"
577
  onchange="choose_fb_type('<?php echo WD_FB_PREFIX; ?>', jQuery(this).val());">
578
+ <option value="selected" <?php if ($type == '')
579
+ echo 'selected="selected"'; ?>>
580
  Select
581
  </option>
582
+ <option value="page" <?php if ($type == 'page')
583
+ echo 'selected="selected"'; ?>>
584
  Page
585
  </option>
586
  <option
587
+ value="group" <?php if ($type == 'group')
588
+ echo 'selected="selected"'; ?>>
589
  Group
590
  </option>
591
+ <option
592
+ value="profile" <?php if ($type == 'profile')
593
+ echo 'selected="selected"'; ?>>
594
  Profile
595
  </option>
596
  </select>
 
597
  </td>
598
  </tr>
 
599
  </tbody>
600
  <tbody id="ffwd_group_warning"
601
  style="display: <?php echo $type == 'group' ? 'block' : 'none' ?>;">
634
  </td>
635
  </tr>
636
  </tbody>
 
637
  <!-- fb type page -->
638
  <tbody id="<?php echo WD_FB_PREFIX; ?>_type_page"
639
+ style="display:<?php echo(($type == 'page') ? 'table-row-group' : 'none'); ?>;">
640
  <tr>
641
+ <td class="ffwd_set_l"><label for="fb_page_id">FB pages: <span style="color:#FF0000;">*</span>
 
642
  </label></td>
643
  <td>
644
  <select name="fb_page_id" id="fb_page_id">
645
  <option value="">Choose page</option>
646
  <?php
647
+ foreach($this->model->pages_list as $page){
648
  $selected = (isset($row->fb_page_id) && $page->id == $row->fb_page_id) ? "selected" : "";
649
  echo "<option value='" . $page->id . "' " . $selected . ">" . $page->name . "</option>";
650
  }
657
  <tr>
658
  <td></td>
659
  <td>
660
+ <?php
661
+ $pages = get_option('ffwd_pages_list');
662
+ if(empty($pages)) {
663
+ ?>
664
+ <div class="ffwd_page_list_notice">
665
+ <p style="color: red">
666
+ Facebook Feed plugin has not got the list of your pages yet. Please
667
+ <a href="admin.php?page=options_ffwd">get access token</a> first.
668
+ </p>
669
+ </div>
670
+ <?php } ?>
671
  </td>
 
672
  </tr>
673
  <tr style="display:none;">
674
  <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_page_exist_access_tok">Use
692
  name="<?php echo WD_FB_PREFIX; ?>_group_url"
693
  value="<?php echo $row->content_url; ?>"
694
  size="18"/>
695
+
696
+ <div class="spider_description">To get your Group ID copy the group URL and paste it
697
+ to <a href="https://lookup-id.com/" target="_blank">https://lookup-id.com/</a>
698
+ and press Lookup button.
699
+ </div>
700
 
701
 
702
  </td>
703
+
704
  </tr>
705
  <tr style="display:none">
706
  <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_group_exist_access_tok">Use
746
  <td style="margin-bottom:15px">
747
  <input type="radio" class="inputbox"
748
  id="<?php echo WD_FB_PREFIX; ?>_content_timeline"
749
+ name="<?php echo WD_FB_PREFIX; ?>_content_type" <?php echo($row->content_type == 'timeline' ? 'checked="checked"' : ''); ?>
750
  value="timeline"
751
+ <?php echo ( WD_FB_IS_FREE ) ? '' : 'onchange="choose_fb_content_type(\'' . WD_FB_PREFIX . '\', jQuery(this).val());"'; ?>>
752
  <label for="<?php echo WD_FB_PREFIX; ?>_content_timeline">Timeline</label>&nbsp;
753
+ <input type="radio" class="inputbox"
754
+ id="<?php echo WD_FB_PREFIX; ?>_content_specific"
755
+ name="<?php echo WD_FB_PREFIX; ?>_content_type" <?php echo($row->content_type == 'specific' ? 'checked="checked"' : ''); ?>
756
+ value="specific"
757
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'onchange="choose_fb_content_type(\'' . WD_FB_PREFIX . '\', jQuery(this).val());"'; ?>
758
+ <?php if ($row->type == 'group') echo 'style="display:none;"' ?>>
759
+ <label for="<?php echo WD_FB_PREFIX; ?>_content_specific" <?php if ($row->type == 'group') echo 'style="display:none;"' ?>>Specific</label>
760
+ <?php if ( WD_FB_IS_FREE ) { ?>
761
+ <br>
762
+ <label class="ffwd_pro_only">Specific Content Type is Available Only in PRO version.</label>
763
+ <?php } ?>
764
  </td>
765
  </tr>
766
+ <tr <?php if ($row->type == 'group')
767
+ echo 'style="display:none;"' ?>
768
+ id="<?php echo WD_FB_PREFIX; ?>_content_type_timeline_type"
769
+ style="display:<?php echo($row->content_type == 'timeline' ? 'table-row' : 'none'); ?>;">
770
  <td class="ffwd_set_l"><label>Show posts by: </label></td>
771
  <td style="margin-bottom:15px">
772
  <select name="<?php echo WD_FB_PREFIX; ?>_timeline_type"
773
  id="<?php echo WD_FB_PREFIX; ?>_timeline_type" style="width:130px">
774
  <option
775
+ value="posts" <?php if ($row->timeline_type == 'posts')
776
+ echo 'selected="selected"'; ?>>
777
  Owner
778
  </option>
779
  <option
780
+ value="others" <?php if ($row->timeline_type == 'others')
781
+ echo 'selected="selected"'; ?>>
782
  Others
783
  </option>
784
  <option
785
+ value="feed" <?php if ($row->timeline_type == 'feed')
786
+ echo 'selected="selected"'; ?>>
787
  Owner and others
788
  </option>
789
  </select>
793
  style="display:<?php echo($row->content_type == 'timeline' ? 'table-row' : 'none'); ?>;">
794
  <td class="ffwd_set_l"><label>Post type: </label></td>
795
  <td>
796
+ <input type="checkbox" class="inputbox"
797
+ id="<?php echo WD_FB_PREFIX; ?>_timeline_statuses"
798
+ name="<?php echo WD_FB_PREFIX; ?>_timeline_statuses" <?php echo (strpos($row->content, 'statuses') !== false) ? 'checked="checked"' : ''; ?>
799
+ value="statuses"
800
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : ''; ?>>
801
+ <label for="<?php echo WD_FB_PREFIX; ?>_timeline_statuses">Statuses</label>&nbsp;
802
+ <br>
803
+ <input type="checkbox" class="inputbox"
804
+ id="<?php echo WD_FB_PREFIX; ?>_timeline_photos"
805
+ name="<?php echo WD_FB_PREFIX; ?>_timeline_photos" <?php echo (strpos($row->content, 'photos') !== false) ? 'checked="checked"' : ''; ?>
806
+ value="photos"
807
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : ''; ?>>
808
+ <label for="<?php echo WD_FB_PREFIX; ?>_timeline_photos">Photos</label>
809
+ <br>
810
+ <input type="checkbox" class="inputbox"
811
+ id="<?php echo WD_FB_PREFIX; ?>_timeline_videos"
812
+ name="<?php echo WD_FB_PREFIX; ?>_timeline_videos" <?php echo (strpos($row->content, 'videos') !== false) ? 'checked="checked"' : ''; ?>
813
+ value="videos"
814
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : ''; ?>>
815
+ <label for="<?php echo WD_FB_PREFIX; ?>_timeline_videos">Videos</label>
816
+ <br>
817
+ <input type="checkbox" class="inputbox"
818
+ id="<?php echo WD_FB_PREFIX; ?>_timeline_links"
819
+ name="<?php echo WD_FB_PREFIX; ?>_timeline_links" <?php echo (strpos($row->content, 'links') !== false) ? 'checked="checked"' : ''; ?>
820
+ value="links"
821
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : ''; ?>>
822
+ <label for="<?php echo WD_FB_PREFIX; ?>_timeline_links">Links</label>
823
+ <?php if ( WD_FB_IS_FREE ) { ?>
824
  <br>
825
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
826
+ <?php } ?>
 
827
  </td>
828
  </tr>
829
  <tr id="<?php echo WD_FB_PREFIX; ?>_content_type_specific"
832
  <td>
833
  <input type="radio" class="inputbox"
834
  id="<?php echo WD_FB_PREFIX; ?>_specific_photos"
835
+ onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific','<?php echo $row->content ?>');"
836
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'photos') !== false) ? 'checked="checked"' : ''; ?>
837
  value="photos">
838
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_photos">Photos</label>
839
  <br>
840
  <input type="radio" class="inputbox"
841
  id="<?php echo WD_FB_PREFIX; ?>_specific_videos"
842
+ onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific','<?php echo $row->content ?>');"
843
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'videos') !== false) ? 'checked="checked"' : ''; ?>
844
  value="videos">
845
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_videos">Videos</label>
846
  <br>
847
  <input type="radio" class="inputbox"
848
  id="<?php echo WD_FB_PREFIX; ?>_specific_albums"
849
+ onchange="choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', 'specific','<?php echo $row->content ?>');"
850
  name="<?php echo WD_FB_PREFIX; ?>_specific" <?php echo (strpos($row->content, 'albums') !== false) ? 'checked="checked"' : ''; ?>
851
  value="albums">
852
  <label for="<?php echo WD_FB_PREFIX; ?>_specific_albums">Albums</label>
853
  </td>
854
  </tr>
855
  <tr>
856
+ <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_limit">Number of
857
+ posts: </label>
858
  </td>
859
  <td><input type="number" id="<?php echo WD_FB_PREFIX; ?>_limit"
860
  name="<?php echo WD_FB_PREFIX; ?>_limit" value="<?php echo $row->limit; ?>"
893
  </tbody>
894
  </table>
895
  </div>
896
+ <div class="ffwd_views_c" <?php if ($row->type == '')
897
+ echo 'style="display:none"' ?>>
898
+ <div class="ffwd_view ffwd_view_bh ffwd_blog_style"
899
+ onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'blog_style', this)">
900
+ <div><input type="radio" name="ffwd_view_select"/>BlogStyle View</div>
901
+ </div>
902
  <div class="ffwd_view ffwd_view_en ffwd_view_t ffwd_thumbnails"
903
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'thumbnails', this)">
904
  <div><input type="radio" name="ffwd_view_select"/> Thumbnails View</div>
907
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'thumbnails_masonry', this)">
908
  <div><input type="radio" name="ffwd_view_select"/> Masonry View</div>
909
  </div>
910
+
 
 
 
911
  <div class="ffwd_view ffwd_view_a ffwd_album_compact"
912
  onClick="ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', 'album_compact', this)">
913
  <div><input type="radio" name="ffwd_view_select"/>Album View</div>
924
  <table class="ffwd_sett_tabl">
925
  <tbody>
926
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_theme">
927
+ <td class="ffwd_set_l"><label for="<?php echo WD_FB_PREFIX; ?>_theme">Theme: </label></td>
 
928
  <td class="ffwd_set_i">
929
+ <select name="<?php echo WD_FB_PREFIX; ?>_theme"
930
+ id="<?php echo WD_FB_PREFIX; ?>_theme" style="width:150px;"
931
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : ''; ?>>
932
+ <option value="0">Select Theme</option>
933
+ <?php
934
+ foreach ( $theme_rows as $theme_row ) {
935
+ if ( !isset($row->theme) || $row->theme === NULL ) {
936
+ $selected = $theme_row->default_theme;
937
+ }
938
+ else {
939
+ if ( $row->theme == $theme_row->id ) {
940
+ $selected = TRUE;
941
  }
942
+ else {
943
+ $selected = FALSE;
944
+ }
945
+ }
946
+ ?>
947
+ <option <?php echo ($selected) ? 'selected="selected"' : ''; ?>
948
+ value="<?php echo $theme_row->id; ?>"><?php echo $theme_row->name; ?></option>
949
+ <?php
950
+ }
951
+ ?>
952
+ </select>
953
+ <?php if ( WD_FB_IS_FREE ) { ?>
954
  <br>
955
+ <label class="ffwd_pro_only">Changing Theme is Available Only in PRO version.</label>
956
+ <?php } ?>
957
  </td>
958
  </tr>
959
  <!--Thumbnails, Masonry viewies-->
963
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_masonry_hor_ver"
964
  id="<?php echo WD_FB_PREFIX; ?>_masonry_ver" value="vertical"
965
  onclick="ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_image_max_columns_label', 'Max. number of image columns: ');
966
+ ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label', 'Image thumbnail width: ');
967
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width').show();
968
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_height').hide();
969
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_tr_thumb_name').css('display', 'table-row');
970
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[2].disabled = false;
971
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[3].disabled = false;
972
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator').hide();"
973
  checked <?php checked($row->masonry_hor_ver, 'vertical') ?> /><label
974
+ for="<?php echo WD_FB_PREFIX; ?>_masonry_ver">Vertical</label>
975
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_masonry_hor_ver"
976
  id="<?php echo WD_FB_PREFIX; ?>_masonry_hor" value="horizontal"
977
  onclick="ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_image_max_columns_label', 'Number of image rows: ');
978
+ ffwd_change_label('<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label', 'Image thumbnail Height: ');
979
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width').hide();
980
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_height').show();
981
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_tr_thumb_name').css('display', 'none');
982
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[1].selected = true;
983
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[2].disabled = true;
984
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_pagination_type').children()[3].disabled = true;
985
+ jQuery('#<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator').hide();" <?php checked($row->masonry_hor_ver, 'horizontal') ?> /><label
986
+ for="<?php echo WD_FB_PREFIX; ?>_masonry_hor">Horizontal</label>
987
  </td>
988
  </tr>
989
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_image_max_columns">
990
  <td class="ffwd_set_l"><label
991
+ id="<?php echo WD_FB_PREFIX; ?>_image_max_columns_label"
992
+ for="<?php echo WD_FB_PREFIX; ?>_image_max_columns">Max. number of image
993
  columns: </label></td>
994
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_image_max_columns"
995
  id="<?php echo WD_FB_PREFIX; ?>_image_max_columns"
998
  </tr>
999
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_thumb_width_height">
1000
  <td title="Maximum values for thumbnail dimension." class="ffwd_set_l"><label
1001
+ id="<?php echo WD_FB_PREFIX; ?>_thumb_width_height_label"
1002
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_width">Image Thumbnail
1003
  dimensions: </label></td>
1004
  <td class="ffwd_set_i">
1005
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_thumb_width"
1006
  id="<?php echo WD_FB_PREFIX; ?>_thumb_width"
1007
  value="<?php echo $row->thumb_width == 0 ? '200' : $row->thumb_width ?>"
1008
  class="spider_int_input"/><span
1009
+ id="<?php echo WD_FB_PREFIX; ?>_thumb_width_height_separator"> x </span>
1010
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_thumb_height"
1011
  id="<?php echo WD_FB_PREFIX; ?>_thumb_height"
1012
  value="<?php echo $row->thumb_height == 0 ? '150' : $row->thumb_height ?>"
1019
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_comments"
1020
  id="<?php echo WD_FB_PREFIX; ?>_thumb_comments_1" value="1"
1021
  checked="checked" <?php checked($row->thumb_comments, 1) ?> /><label
1022
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_comments_yes">Yes</label>
1023
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_comments"
1024
  id="<?php echo WD_FB_PREFIX; ?>_thumb_comments_0"
1025
  value="0" <?php checked($row->thumb_comments, 0) ?> /><label
1026
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_comments_no">No</label>
1027
  </td>
1028
  </tr>
1029
+ <tr id="<?php echo WD_FB_PREFIX; ?>_tr_thumb_likes">
1030
  <td title="Show likes" class="ffwd_set_l"><label>Show likes: </label></td>
1031
  <td class="ffwd_set_i">
1032
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_likes"
1033
+ id="<?php echo WD_FB_PREFIX; ?>_thumb_likes_1" value="1"
1034
+ checked="checked" <?php checked($row->thumb_likes, 1) ?> /><label
1035
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_likes_yes">Yes</label>
1036
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_likes"
1037
+ id="<?php echo WD_FB_PREFIX; ?>_thumb_likes_0"
1038
+ value="0" <?php checked($row->thumb_likes, 0) ?> /><label
1039
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_likes_no">No</label>
1040
+ </td>
1041
+ </tr>
1042
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_thumb_name">
1043
  <td title="Show likes" class="ffwd_set_l"><label>Show name: </label></td>
1044
  <td class="ffwd_set_i">
1045
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_name"
1046
  id="<?php echo WD_FB_PREFIX; ?>_thumb_name_1" value="1"
1047
  checked="checked" <?php checked($row->thumb_name, 1) ?> /><label
1048
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_name_1">Yes</label>
1049
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_thumb_name"
1050
  id="<?php echo WD_FB_PREFIX; ?>_thumb_name_0"
1051
  value="0" <?php checked($row->thumb_name, 0) ?> /><label
1052
+ for="<?php echo WD_FB_PREFIX; ?>_thumb_name_0">No</label>
1053
  </td>
1054
  </tr>
1055
  <!--Blog Style view-->
1056
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_width">
1057
  <td title="Maximum value for image width." class="ffwd_set_l"><label
1058
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_width">Width: </label></td>
1059
  <td class="ffwd_set_i">
1060
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_blog_style_width"
1061
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_width"
1065
  </tr>
1066
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_height">
1067
  <td title="Maximum value for image height." class="ffwd_set_l"><label
1068
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_height">Height: </label>
1069
+ </td>
1070
  <td class="ffwd_set_i">
1071
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_blog_style_height"
1072
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_height"
1076
  </tr>
1077
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_view_type">
1078
  <td title="Maximum value for image width." class="ffwd_set_l"><label
1079
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1">View
1080
  style: </label></td>
1081
  <td class="ffwd_set_i">
1082
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type"
1083
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1" value="1"
1084
  checked="checked" <?php checked($row->blog_style_view_type, 1) ?>
1085
  onchange=""/><label
1086
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_1">Full
1087
+ width</label>
1088
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type"
1089
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_0"
1090
  value="0" <?php checked($row->blog_style_view_type, 0) ?>
1091
  onchange=""/><label
1092
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_view_type_0">Half
1093
+ width</label>
1094
  </td>
1095
  </tr>
1096
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_comments">
1099
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_comments"
1100
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_1" value="1"
1101
  checked="checked" <?php checked($row->blog_style_comments, 1) ?> /><label
1102
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_yes">Yes</label>
1103
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_comments"
1104
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_0"
1105
  value="0" <?php checked($row->blog_style_comments, 0) ?> /><label
1106
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_comments_no">No</label>
1107
  </td>
1108
  </tr>
1109
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_likes">
1112
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_likes"
1113
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_1"
1114
  value="1" <?php checked($row->blog_style_likes, 1) ?> checked="checked"/><label
1115
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_yes">Yes</label>
1116
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_likes"
1117
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_0"
1118
  value="0" <?php checked($row->blog_style_likes, 0) ?> /><label
1119
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_likes_no">No</label>
1120
  </td>
1121
  </tr>
1122
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_message_desc">
1126
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc"
1127
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_1" value="1"
1128
  checked="checked"/><label
1129
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_1">Yes</label>
1130
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc"
1131
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_0"
1132
  value="0" <?php checked($row->blog_style_message_desc, 0) ?> /><label
1133
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_message_desc_0">No</label>
1134
  </td>
1135
  </tr>
1136
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_shares">
1139
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares"
1140
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_1" value="1"
1141
  checked="checked"/><label
1142
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_1">Yes</label>
1143
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares"
1144
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_0"
1145
  value="0" <?php checked($row->blog_style_shares, 0) ?> /><label
1146
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_0">No</label>
1147
  </td>
1148
  </tr>
1149
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_shares_butt">
1150
+ <td title="Show share buttons" class="ffwd_set_l"><label>Show share buttons: </label></td>
 
1151
  <td class="ffwd_set_i">
1152
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt"
1153
+ id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_1" value="1"
1154
+ checked="checked"
1155
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?>>
1156
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_1">Yes</label>
1157
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt"
1158
+ id="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_0"
1159
+ value="0" <?php checked($row->blog_style_shares_butt, 0) ?>
1160
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?>>
1161
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_shares_butt_0">No</label>
1162
+ <?php if ( WD_FB_IS_FREE ) { ?>
1163
  <br>
1164
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1165
+ <?php } ?>
1166
  </td>
1167
  </tr>
1168
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_facebook">
1169
+ <td title="Show Facebook share button" class="ffwd_set_l"><label>Show Facebook button:</label></td>
 
1170
  <td class="ffwd_set_i">
1171
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook"
1172
+ id="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_1" value="1"
1173
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?>>
1174
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_1">Yes</label>
1175
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook"
1176
+ id="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_0"
1177
+ value="0" <?php checked($row->blog_style_facebook, 0) ?>
1178
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?>>
1179
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_facebook_0">No</label>
1180
+ <?php if ( WD_FB_IS_FREE ) { ?>
1181
  <br>
1182
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1183
+ <?php } ?>
1184
  </td>
1185
  </tr>
1186
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_twitter">
1187
+ <td title="Show Twitter share button" class="ffwd_set_l"><label>Show Twitter button:</label></td>
 
1188
  <td class="ffwd_set_i">
1189
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter"
1190
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_1" value="1"
1191
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?>>
1192
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_1">Yes</label>
1193
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter"
1194
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_0"
1195
+ value="0"
1196
+ <?php checked($row->blog_style_twitter, 0) ?>
1197
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?>/>
1198
+ <label for="<?php echo WD_FB_PREFIX; ?>_blog_style_twitter_0">No</label>
1199
+ <?php if ( WD_FB_IS_FREE ) { ?>
1200
  <br>
1201
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1202
+ <?php } ?>
1203
  </td>
1204
  </tr>
1205
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_author">
1208
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_author"
1209
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_author_1" value="1"
1210
  checked="checked"/><label
1211
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_author_1">Yes</label>
1212
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_author"
1213
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_author_0"
1214
  value="0" <?php checked($row->blog_style_author, 0) ?> /><label
1215
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_author_0">No</label>
1216
  </td>
1217
  </tr>
1218
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_name">
1221
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_name"
1222
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_name_1" value="1"
1223
  checked="checked"/><label
1224
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_name_1">Yes</label>
1225
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_name"
1226
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_name_0"
1227
  value="0" <?php checked($row->blog_style_name, 0) ?> /><label
1228
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_name_0">No</label>
1229
  </td>
1230
  </tr>
1231
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_blog_style_place_name">
1234
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name"
1235
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_1" value="1"
1236
  checked="checked"/><label
1237
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_1">Yes</label>
1238
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name"
1239
  id="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_0"
1240
  value="0" <?php checked($row->blog_style_place_name, 0) ?> /><label
1241
+ for="<?php echo WD_FB_PREFIX; ?>_blog_style_place_name_0">No</label>
1242
  </td>
1243
  </tr>
1244
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_fb_name">
1247
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_name"
1248
  id="<?php echo WD_FB_PREFIX; ?>_fb_name_1" value="1"
1249
  checked="checked"/><label
1250
+ for="<?php echo WD_FB_PREFIX; ?>_fb_name_1">Yes</label>
1251
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_name"
1252
  id="<?php echo WD_FB_PREFIX; ?>_fb_name_0"
1253
  value="0" <?php checked($row->fb_name, 0) ?> /><label
1254
+ for="<?php echo WD_FB_PREFIX; ?>_fb_name_0">No</label>
1255
  </td>
1256
  </tr>
1257
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_fb_plugin">
1258
+ <td title="Displays page basic information and allows to like the page"
1259
+ class="ffwd_set_l"><label>Show Page Plugin: </label>
1260
  </td>
1261
  <td class="ffwd_set_i">
1262
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_plugin"
1263
  id="<?php echo WD_FB_PREFIX; ?>_fb_plugin_1" value="1" checked="checked"
1264
  onchange="ffwd_toggle_page_plugin(1)"/><label
1265
+ for="<?php echo WD_FB_PREFIX; ?>_fb_plugin_1">Yes</label>
1266
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_fb_plugin"
1267
  id="<?php echo WD_FB_PREFIX; ?>_fb_plugin_0"
1268
  value="0" <?php checked($row->fb_plugin, 0) ?>
1269
  onchange="ffwd_toggle_page_plugin(0)"/><label
1270
+ for="<?php echo WD_FB_PREFIX; ?>_fb_plugin_0">No</label>
1271
+ <p class="description">Displays page basic information and allows to like the
1272
+ page</p>
1273
  </td>
1274
  </tr>
1275
 
1276
  <!--Compact Album view-->
1277
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_column_number">
1278
  <td class="ffwd_set_l"><label
1279
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_column_number">Max.
1280
+ number of
1281
  album columns: </label></td>
1282
  <td><input type="text"
1283
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_column_number"
1291
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1292
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_hover" value="hover"
1293
  checked/><label
1294
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_hover">Show on
1295
  hover</label><br/>
1296
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1297
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_show"
1298
  value="show" <?php checked($row->album_title, 'show') ?> /><label
1299
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_show">Always
1300
  show</label><br/>
1301
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_compuct_album_title"
1302
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_none"
1303
  value="none" <?php checked($row->album_title, 'none') ?> /><label
1304
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_title_none">Don't
1305
  show</label>
1306
  </td>
1307
  </tr>
1322
  </tr>
1323
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_image_column_number">
1324
  <td class="ffwd_set_l"><label
1325
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_column_number">Max.
1326
  number of image columns: </label></td>
1327
  <td><input type="text"
1328
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_column_number"
1340
  </tr> -->
1341
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_compuct_album_image_thumb_width_height">
1342
  <td title="Maximum values for thumbnail width and height." class="ffwd_set_l"><label
1343
+ for="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_width"
1344
+ id="compuct_album_image_thumb_dimensions">Image thumbnail
1345
  dimensions: </label></td>
1346
  <td class="ffwd_set_i">
1347
  <input type="text"
1349
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_width"
1350
  value="<?php echo $row->album_image_thumb_width == 0 ? '200' : $row->album_image_thumb_width ?>"
1351
  class="spider_int_input"/><span
1352
+ id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_dimensions_x"> x </span>
1353
  <input type="text"
1354
  name="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_height"
1355
  id="<?php echo WD_FB_PREFIX; ?>_compuct_album_image_thumb_height"
1391
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_image_onclick_action">
1392
  <td class="ffwd_set_l"><label>Image Onclick: </label></td>
1393
  <td class="ffwd_set_i">
1394
+ <span class="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_lightbox_wrap">
1395
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1396
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_lightbox"
1397
  onchange="toggle_lightbox_tab('lightbox')"
1398
  value="lightbox" <?php checked($row->image_onclick_action, 'lightbox') ?> /><label
1399
+ for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_lightbox">Open
1400
  Lightbox</label><br/>
1401
+ </span>
1402
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1403
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_facebook"
1404
  onchange="toggle_lightbox_tab('facebook')"
1405
  value="facebook" <?php checked($row->image_onclick_action, 'facebook') ?> /><label
1406
+ for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_facebook">Redirect
1407
+ To
1408
  Facebook</label><br/>
1409
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_image_onclick_action"
1410
  id="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_none"
1411
  onchange="toggle_lightbox_tab('none')"
1412
  value="none" <?php checked($row->image_onclick_action, 'none') ?> /><label
1413
+ for="<?php echo WD_FB_PREFIX; ?>_image_onclick_action_none">Do
1414
  Nothing </label>
1415
  </td>
1416
  </tr>
1447
  <td class="ffwd_set_i">
1448
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_view_on_fb"
1449
  id="<?php echo WD_FB_PREFIX; ?>_view_on_fb_1"
1450
+ value="1" <?php if ($row->view_on_fb)
1451
+ echo 'checked="checked"'; ?> /><label
1452
+ for="<?php echo WD_FB_PREFIX; ?>_view_on_fb_1">Yes</label>
1453
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_view_on_fb"
1454
  id="<?php echo WD_FB_PREFIX; ?>_view_on_fb_0"
1455
+ value="0" <?php if (!$row->view_on_fb)
1456
+ echo 'checked="checked"'; ?> /><label
1457
+ for="<?php echo WD_FB_PREFIX; ?>_view_on_fb_0">No</label>
1458
  <div class="spider_description"></div>
1459
  </td>
1460
  </tr>
1472
  <label class="ffwd_header_l">Lightbox settings</label>
1473
  </div>
1474
  <div class="ffwd_view_l_s">
 
1475
  <table class="ffwd_sett_tabl">
1476
  <!--Lightbox view-->
1477
  <tbody id="<?php echo WD_FB_PREFIX; ?>_tbody_popup">
1484
  id="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_1"
1485
  value="1" <?php checked($row->popup_fullscreen, 1) ?>
1486
  onchange="bwg_popup_fullscreen(1)"/><label
1487
+ for="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_1">Yes</label>
1488
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen"
1489
  id="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_0"
1490
  value="0" <?php checked($row->popup_fullscreen, 0);
1491
  checked($row->popup_fullscreen, '') ?>onchange="bwg_popup_fullscreen(0)"/><label
1492
+ for="<?php echo WD_FB_PREFIX; ?>_popup_fullscreen_0">No</label>
1493
  </td>
1494
  </tr>
1495
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_width_height">
1496
  <td title="Maximum values for lightbox width and height." class="ffwd_set_l"><label
1497
+ for="<?php echo WD_FB_PREFIX; ?>_popup_width">Lightbox
1498
+ dimensions: </label>
1499
  </td>
1500
  <td class="ffwd_set_i">
1501
  <input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_width"
1510
  </tr>
1511
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_effect">
1512
  <td title="Lightbox slideshow effect." class="ffwd_set_l"><label
1513
+ for="<?php echo WD_FB_PREFIX; ?>_popup_effect">Lightbox effect: </label>
1514
  </td>
1515
  <td class="ffwd_set_i">
1516
  <select name="<?php echo WD_FB_PREFIX; ?>_popup_effect"
1517
  id="<?php echo WD_FB_PREFIX; ?>_popup_effect" style="width:150px;">
1518
  <?php
 
1519
  foreach ($effects as $key => $effect) {
1520
  ?>
1521
+ <option
1522
+ value="<?php echo $key; ?>" <?php selected($row->popup_effect, $key) ?>><?php echo $effect; ?></option>
1523
  <?php
 
1524
  }
1525
  ?>
1526
  </select>
1534
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_autoplay"
1535
  id="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_1" <?php checked($row->popup_autoplay, 1) ?>
1536
  value="1"/><label
1537
+ for="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_1">Yes</label>
1538
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_autoplay"
1539
  id="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_0"
1540
  value="0" <?php checked($row->popup_autoplay, 0);
1541
  checked($row->popup_autoplay, '') ?> /><label
1542
+ for="<?php echo WD_FB_PREFIX; ?>_popup_autoplay_0">No</label>
1543
  </td>
1544
  </tr>
1545
 
1546
 
1547
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_interval">
1548
  <td title="Interval between two images." class="ffwd_set_l"><label
1549
+ for="<?php echo WD_FB_PREFIX; ?>_popup_interval">Time interval: </label>
1550
  </td>
1551
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_interval"
1552
  id="<?php echo WD_FB_PREFIX; ?>_popup_interval"
1563
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_open_commentbox"
1564
  id="<?php echo WD_FB_PREFIX; ?>_open_commentbox_1" <?php checked($row->open_commentbox, 1) ?>
1565
  value="1"/><label
1566
+ for="<?php echo WD_FB_PREFIX; ?>_open_commentbox_1">Yes</label>
1567
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_open_commentbox"
1568
  id="<?php echo WD_FB_PREFIX; ?>_open_commentbox_0"
1569
  value="0" <?php checked($row->open_commentbox, 0);
1570
  checked($row->open_commentbox, '') ?> /><label
1571
+ for="<?php echo WD_FB_PREFIX; ?>_open_commentbox_0">No</label>
1572
  </td>
1573
  </tr>
1574
 
1575
 
1576
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_filmstrip">
1577
+ <td title="Show filmstrip view for images" class="ffwd_set_l">
1578
+ <label>Show filmstrip in lightbox: </label></td>
1579
  <td class="ffwd_set_i">
1580
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_filmstrip"
 
1581
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes" value="1"
1582
+ onClick="bwg_enable_disable('', '<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height', '<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes')"
1583
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?> />
1584
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_yes">Yes</label>
1585
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_filmstrip"
 
1586
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no"
1587
+ value="0" <?php checked($row->popup_enable_filmstrip, 0) ?>
1588
+ onClick="bwg_enable_disable('none', '<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height', '<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no')"
1589
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?> />
1590
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_no">No</label>
1591
+ <?php if ( WD_FB_IS_FREE ) { ?>
1592
  <br>
1593
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1594
+ <?php } ?>
1595
  </td>
1596
  </tr>
1597
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_filmstrip_height">
1598
  <td class="ffwd_set_l"><label
1599
+ for="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height">Filmstrip
1600
  size: </label></td>
1601
  <td><input type="text" name="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height"
1602
  id="<?php echo WD_FB_PREFIX; ?>_popup_filmstrip_height"
1603
+ value="<?php if ($row->popup_filmstrip_height == 0)
1604
+ echo '75'; else echo $row->popup_filmstrip_height ?>"
1605
  class="spider_int_input"/> px
1606
  </td>
1607
  </tr>
1611
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_comments"
1612
  id="<?php echo WD_FB_PREFIX; ?>_popup_comments_1" value="1"
1613
  checked="checked"/><label
1614
+ for="<?php echo WD_FB_PREFIX; ?>_popup_comments_yes">Yes</label>
1615
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_comments"
1616
  id="<?php echo WD_FB_PREFIX; ?>_popup_comments_0"
1617
  value="0" <?php checked($row->popup_comments, 0) ?> /><label
1618
+ for="<?php echo WD_FB_PREFIX; ?>_popup_comments_no">No</label>
1619
  </td>
1620
  </tr>
1621
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_likes">
1624
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_likes"
1625
  id="<?php echo WD_FB_PREFIX; ?>_popup_likes_1" value="1"
1626
  checked="checked"/><label
1627
+ for="<?php echo WD_FB_PREFIX; ?>_popup_likes_yes">Yes</label>
1628
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_likes"
1629
  id="<?php echo WD_FB_PREFIX; ?>_popup_likes_0"
1630
  value="0" <?php checked($row->popup_likes, 0) ?> /><label
1631
+ for="<?php echo WD_FB_PREFIX; ?>_popup_likes_no">No</label>
1632
  </td>
1633
  </tr>
1634
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_shares">
1637
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_shares"
1638
  id="<?php echo WD_FB_PREFIX; ?>_popup_shares_1" value="1"
1639
  checked="checked"/><label
1640
+ for="<?php echo WD_FB_PREFIX; ?>_popup_shares_1">Yes</label>
1641
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_shares"
1642
  id="<?php echo WD_FB_PREFIX; ?>_popup_shares_0"
1643
  value="0" <?php checked($row->popup_shares, 0) ?> /><label
1644
+ for="<?php echo WD_FB_PREFIX; ?>_popup_shares_0">No</label>
1645
  </td>
1646
  </tr>
1647
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_author">
1650
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_author"
1651
  id="<?php echo WD_FB_PREFIX; ?>_popup_author_1" value="1"
1652
  checked="checked"/><label
1653
+ for="<?php echo WD_FB_PREFIX; ?>_popup_author_1">Yes</label>
1654
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_author"
1655
  id="<?php echo WD_FB_PREFIX; ?>_popup_author_0"
1656
  value="0" <?php checked($row->popup_author, 0) ?> /><label
1657
+ for="<?php echo WD_FB_PREFIX; ?>_popup_author_0">No</label>
1658
  </td>
1659
  </tr>
1660
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_name">
1666
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_name"
1667
  id="<?php echo WD_FB_PREFIX; ?>_popup_name_0"
1668
  value="0" <?php checked($row->popup_name, 0) ?> /><label
1669
+ for="<?php echo WD_FB_PREFIX; ?>_popup_name_0">No</label>
1670
  </td>
1671
  </tr>
1672
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_place_name">
1675
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_place_name"
1676
  id="<?php echo WD_FB_PREFIX; ?>_popup_place_name_1" value="1"
1677
  checked="checked"/><label
1678
+ for="<?php echo WD_FB_PREFIX; ?>_popup_place_name_1">Yes</label>
1679
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_place_name"
1680
  id="<?php echo WD_FB_PREFIX; ?>_popup_place_name_0"
1681
  value="0" <?php checked($row->popup_place_name, 0) ?> /><label
1682
+ for="<?php echo WD_FB_PREFIX; ?>_popup_place_name_0">No</label>
1683
  </td>
1684
  </tr>
1685
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_ctrl_btn">
1690
  id="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_yes" value="1"
1691
  onClick="bwg_enable_disable('', '<?php echo WD_FB_PREFIX; ?>_tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');"
1692
  checked="checked"/><label
1693
+ for="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_yes">Yes</label>
1694
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_ctrl_btn"
1695
  id="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_no"
1696
  value="0" <?php checked($row->popup_enable_ctrl_btn, 0) ?>
1697
  onClick="bwg_enable_disable('none', '<?php echo WD_FB_PREFIX; ?>_tbody_popup_ctrl_btn', 'popup_ctrl_btn_no');"/><label
1698
+ for="<?php echo WD_FB_PREFIX; ?>_popup_ctrl_btn_no">No</label>
1699
  </td>
1700
  </tr>
1701
  </tbody>
1707
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen"
1708
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_1" value="1"
1709
  checked="checked"/><label
1710
+ for="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_1">Yes</label>
1711
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen"
1712
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_0" <?php checked($row->popup_enable_fullscreen, 0) ?>
1713
  value="0"/><label
1714
+ for="<?php echo WD_FB_PREFIX; ?>_popup_enable_fullscreen_0">No</label>
1715
  </td>
1716
  </tr>
1717
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_info_btn">
1718
+ <td title="Show object info button for view name etc" class="ffwd_set_l">
1719
+ <label>Show info and comments: </label>
1720
+ </td>
1721
  <td class="ffwd_set_i">
1722
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_info"
1723
+ id="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_1" value="1"
1724
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?> />
1725
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_1">Yes</label>
1726
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_info"
1727
  id="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_0"
1728
+ value="0"
1729
+ <?php checked($row->popup_enable_info_btn, 0) ?>
1730
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?> />
1731
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_enable_info_0">No</label>
1732
+ <?php if ( WD_FB_IS_FREE ) { ?>
1733
  <br>
1734
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1735
+ <?php } ?>
1736
  </td>
1737
  </tr>
1738
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_message_desc">
1739
+ <td title="Show object info button for view name etc" class="ffwd_set_l"><label>Show message(description): </label></td>
 
1740
  <td class="ffwd_set_i">
1741
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_message_desc"
1742
  id="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_1" value="1"
1743
  checked="checked"/><label
1744
+ for="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_1">Yes</label>
1745
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_message_desc"
1746
  id="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_0"
1747
  value="0" <?php checked($row->popup_message_desc, 0) ?> /><label
1748
+ for="<?php echo WD_FB_PREFIX; ?>_popup_message_desc_0">No</label>
1749
  </td>
1750
  </tr>
1751
  <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_facebook">
1752
+ <td title="Show Facebook share button for images" class="ffwd_set_l">
1753
+ <label>Show Facebook button: </label>
 
 
 
 
 
 
 
 
 
 
 
 
1754
  </td>
 
 
 
 
1755
  <td class="ffwd_set_i">
1756
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_facebook"
1757
+ id="<?php echo WD_FB_PREFIX; ?>_popup_facebook_1" value="1"
1758
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?> />
1759
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_facebook_1">Yes</label>
1760
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_facebook"
1761
+ id="<?php echo WD_FB_PREFIX; ?>_popup_facebook_0"
1762
+ value="0"
1763
+ <?php checked($row->popup_enable_facebook, 0) ?>
1764
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?> />
1765
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_facebook_0">No</label>
1766
+ <?php if ( WD_FB_IS_FREE ) { ?>
1767
  <br>
1768
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1769
+ <?php } ?>
1770
  </td>
1771
  </tr>
1772
+ <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_twitter">
1773
+ <td title="Show Twitter share button for images" class="ffwd_set_l">
1774
+ <label>Show Twitter button: </label>
1775
+ </td>
1776
+ <td class="ffwd_set_i">
1777
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_twitter"
1778
+ id="<?php echo WD_FB_PREFIX; ?>_popup_twitter_1" value="1"
1779
+ <?php echo ( WD_FB_IS_FREE ) ? 'disabled' : 'checked="checked"'; ?> />
1780
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_twitter_1">Yes</label>
1781
+ <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_popup_enable_twitter"
1782
+ id="<?php echo WD_FB_PREFIX; ?>_popup_twitter_0"
1783
+ value="0"
1784
+ <?php echo ( WD_FB_IS_FREE ) ? 'checked="checked" disabled="disabled"' : ''; ?> />
1785
+ <label for="<?php echo WD_FB_PREFIX; ?>_popup_twitter_0">No</label>
1786
+ <?php if ( WD_FB_IS_FREE ) { ?>
1787
+ <br>
1788
+ <label class="ffwd_pro_only">This Feature is Available Only in PRO version.</label>
1789
+ <?php } ?>
1790
+ </td>
1791
+ </tr>
1792
  <!-- <tr id="<?php echo WD_FB_PREFIX; ?>_tr_popup_enable_pinterest">
1793
  <td title="Show Pinterest share button for images" class="ffwd_set_l"><label>Show Pinterest button: </label></td>
1794
  <td class="ffwd_set_i">
1828
  value="toplevel" <?php checked($row->comments_filter, 'toplevel');
1829
  checked($row->comments_filter, '') ?>
1830
  onchange="ffwd_show_hide_options('tr_comments_replies', 'table-row')"/><label
1831
+ for="<?php echo WD_FB_PREFIX; ?>_comments_filter_1">Toplevel</label>
1832
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_filter"
1833
  id="<?php echo WD_FB_PREFIX; ?>_comments_filter_0"
1834
  value="stream" <?php checked($row->comments_filter, 'stream') ?>
1835
  onchange="ffwd_show_hide_options('tr_comments_replies', 'none')"/><label
1836
+ for="<?php echo WD_FB_PREFIX; ?>_comments_filter_0">Stream</label>
1837
  <div class="spider_description">
1838
  Toplevel - same structure as they appear on Facebook.
1839
  Comments count (excluding replies).<br>
1850
  <td class="ffwd_set_i">
1851
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_replies"
1852
  id="<?php echo WD_FB_PREFIX; ?>_comments_replies_1"
1853
+ value="1" <?php if ($row->comments_replies)
1854
+ echo 'checked="checked"'; ?> /><label
1855
+ for="<?php echo WD_FB_PREFIX; ?>_comments_replies_1">Yes</label>
1856
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_replies"
1857
  id="<?php echo WD_FB_PREFIX; ?>_comments_replies_0"
1858
+ value="0" <?php if (!$row->comments_replies)
1859
+ echo 'checked="checked"'; ?> /><label
1860
+ for="<?php echo WD_FB_PREFIX; ?>_comments_replies_0">No</label>
1861
  </td>
1862
  </tr>
1863
  <tr>
1869
  id="<?php echo WD_FB_PREFIX; ?>_comments_order_1"
1870
  value="chronological" <?php checked($row->comments_order, "chronological");
1871
  checked($row->comments_order, "") ?> /><label
1872
+ for="<?php echo WD_FB_PREFIX; ?>_comments_order_1">Chronological</label>
1873
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_comments_order"
1874
  id="<?php echo WD_FB_PREFIX; ?>_comments_order_0"
1875
  value="reverse_chronological" <?php checked($row->comments_order, "reverse_chronological") ?> /><label
1876
+ for="<?php echo WD_FB_PREFIX; ?>_comments_order_0">Reverse
1877
  chronological</label>
1878
  </td>
1879
  </tr>
1902
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_1"
1903
  value="top" <?php checked($row->page_plugin_pos, 'top');
1904
  checked($row->page_plugin_pos, '') ?> /><label
1905
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_1">Top</label>
1906
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos"
1907
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_0"
1908
  value="bottom" <?php checked($row->page_plugin_pos, 'bottom') ?> /><label
1909
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_pos_0">Bottom</label>
1910
  <!-- <div class="spider_description"></div> -->
1911
  </td>
1912
  </tr>
1917
  <td class="ffwd_set_i">
1918
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans"
1919
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_1"
1920
+ value="1" <?php if ($row->page_plugin_fans)
1921
+ echo 'checked="checked"'; ?> /><label
1922
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_1">Yes</label>
1923
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans"
1924
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_0"
1925
+ value="0" <?php if (!$row->page_plugin_fans)
1926
+ echo 'checked="checked"'; ?> /><label
1927
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_fans_0">No</label>
1928
  </td>
1929
  </tr>
1930
  <tr id="tr_page_plugin_width">
1945
  <td class="ffwd_set_i">
1946
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover"
1947
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_1"
1948
+ value="1" <?php if ($row->page_plugin_cover)
1949
+ echo 'checked="checked"'; ?> /><label
1950
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_1">Yes</label>
1951
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover"
1952
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_0"
1953
+ value="0" <?php if (!$row->page_plugin_cover)
1954
+ echo 'checked="checked"'; ?> /><label
1955
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_cover_0">No</label>
1956
  </td>
1957
  </tr>
1958
  <tr id="tr_page_plugin_header">
1962
  <td class="ffwd_set_i">
1963
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_header"
1964
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_1"
1965
+ value="1" <?php if ($row->page_plugin_header)
1966
+ echo 'checked="checked"'; ?> /><label
1967
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_1">Yes</label>
1968
  <input type="radio" name="<?php echo WD_FB_PREFIX; ?>_page_plugin_header"
1969
  id="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_0"
1970
+ value="0" <?php if (!$row->page_plugin_header)
1971
+ echo 'checked="checked"'; ?> /><label
1972
+ for="<?php echo WD_FB_PREFIX; ?>_page_plugin_header_0">No</label>
1973
  </td>
1974
  </tr>
1975
  </table>
1996
  jQuery('.ffwd_p').css('display', 'none');
1997
  jQuery('.ffwd_' + show).css('display', 'block')
1998
  }
1999
+
2000
  function ffwd_change_label(id, text) {
2001
  jQuery('#' + id).html(text);
2002
  }
2003
+
2004
  function ffwd_view_type(wd_fb_prefix, view_type, that) {
2005
  var fb_type = jQuery("select[id=" + wd_fb_prefix + "_type]").find(":selected").val(),
2006
  fb_content_type = jQuery("input[name=" + wd_fb_prefix + "_content_type]:checked").val(),
2072
  jQuery("#" + wd_fb_prefix + "_tr_popup_message_desc").css('display', 'none');
2073
 
2074
  switch (view_type) {
2075
+ case 'thumbnails': {
 
2076
  ffwd_change_label(wd_fb_prefix + '_image_max_columns_label', 'Max. number of image columns: ');
2077
  ffwd_change_label(wd_fb_prefix + '_thumb_width_height_label', 'Image thumbnail dimensions: ');
2078
  jQuery('#' + wd_fb_prefix + '_thumb_width').show();
2085
  break;
2086
 
2087
  }
2088
+ case 'thumbnails_masonry': {
 
2089
  if (jQuery("input[name=" + wd_fb_prefix + "_masonry_hor_ver]:checked").val() == 'horizontal') {
2090
  ffwd_change_label(wd_fb_prefix + '_image_max_columns_label', 'Number of image rows: ');
2091
  ffwd_change_label(wd_fb_prefix + '_thumb_width_height_label', 'Image thumbnail height: ');
2110
 
2111
  }
2112
 
2113
+ case 'blog_style': {
 
2114
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_view_type").css('display', '');
2115
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_view_type").css('display', '');
2116
  jQuery("#" + wd_fb_prefix + "_tr_blog_style_comments").css('display', '');
2130
  break;
2131
  }
2132
 
2133
+ case 'album_compact': {
 
2134
  jQuery("#" + wd_fb_prefix + "_tr_compuct_album_column_number").css('display', '');
2135
  jQuery("#" + wd_fb_prefix + "_tr_compuct_albums_per_page").css('display', '');
2136
  jQuery("#" + wd_fb_prefix + "_tr_compuct_album_title_hover").css('display', '');
2211
  break;
2212
  }
2213
  }
2214
+
2215
 
2216
 
2217
  jQuery('#ffwd_fb_view_type').val(view_type);
2218
  }
2219
 
2220
+ function toggle_lightbox_tab( val ) {
2221
+ if ( val == 'lightbox' ) {
2222
+ jQuery('#ffwd_tab_lightbox').css('display', '');
2223
+ }
2224
+ else {
2225
+ jQuery('#ffwd_tab_lightbox').css('display', 'none');
2226
+ }
 
 
 
 
 
2227
  }
2228
 
2229
+ function ffwd_toggle_page_plugin( val ) {
2230
+ if ( val == '1' ) {
2231
+ jQuery('#ffwd_tab_page_plugin').css('display', '');
2232
+ }
2233
+ else {
2234
+ jQuery('#ffwd_tab_page_plugin').css('display', 'none');
2235
+ }
 
 
 
 
 
 
 
2236
  }
2237
 
 
2238
  jQuery(document).ready(function () {
2239
+ ffwd_view_type('<?php echo WD_FB_PREFIX; ?>', '<?php echo $row->fb_view_type ?>', jQuery('.<?php echo WD_FB_PREFIX; ?>_<?php echo $row->fb_view_type ?>'))
2240
+ choose_fb_content_type('<?php echo WD_FB_PREFIX; ?>', '<?php echo $row->content_type ?>', '<?php echo $row->content ?>', '<?php echo $row->fb_view_type ?>')
2241
+ bwg_popup_fullscreen(<?php echo $row->popup_fullscreen ?>);
 
 
 
 
2242
 
2243
+ <?php if ( $row->comments_filter == 'stream' ) { ?>
 
 
 
 
 
 
 
2244
  ffwd_show_hide_options('tr_comments_replies', 'none');
2245
+ <?php } ?>
2246
+ toggle_lightbox_tab('<?php echo ( $row->content_type == 'timeline' ) ? '' : $row->image_onclick_action; ?>');
2247
+ ffwd_toggle_page_plugin('<?php echo $row->fb_plugin ?>');
 
 
 
 
 
 
 
 
 
2248
  });
2249
 
2250
+ function ffwd_show_hide_options( id, display ) {
2251
+ jQuery("#" + id).css("display", display);
2252
  }
 
 
2253
  </script>
2254
  <?php
2255
  }
 
 
 
 
 
 
 
 
 
2256
  }
admin/views/FFWDViewLicensing_ffwd.php CHANGED
@@ -1,136 +1,93 @@
1
  <?php
2
 
3
  class FFWDViewLicensing_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
 
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
  }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
  public function display() {
26
  ?>
27
-
28
-
29
- <div class="wrap" id="ffwd_featurs_tables">
30
- <div id="ffwd_featurs_table1">
31
- <span>WordPress 3.4+ <?php _e("ready", 'ffwd'); ?></span>
32
-
33
- <span><?php _e("Responsive layout", 'ffwd'); ?></span>
34
- <span><?php _e("Page feeds", 'ffwd'); ?></span>
35
- <span><?php _e("Public Group feeds", 'ffwd'); ?></span>
36
- <span><?php _e("Auto-update for feeds", 'ffwd'); ?></span>
37
- <span><?php _e("Unlimited Facebook feeds per page/post", 'ffwd'); ?></span>
38
- <span><?php _e("Lightbox", 'ffwd'); ?></span>
39
- <span><?php _e("Top Level & Stream type comment display", 'ffwd'); ?></span>
40
- <span><?php _e("Facebook redirection option", 'ffwd'); ?></span>
41
- <span><?php _e("Shortcode", 'ffwd'); ?></span>
42
- <span><?php _e("Facebook feed widget", 'ffwd'); ?></span>
43
-
44
-
45
- <span><?php _e("15 lightbox effects", 'ffwd'); ?></span>
46
- <span><?php _e("Profile Feed", 'ffwd'); ?></span>
47
- <span><?php _e("Specific content feeds", 'ffwd'); ?></span>
48
- <span><?php _e("Advanced lightbox", 'ffwd'); ?></span>
49
- <span><?php _e("Filmstrip for lightbox", 'ffwd'); ?></span>
50
- <span><?php _e("Themes", 'ffwd'); ?></span>
51
- <span><?php _e("Multiple layouts", 'ffwd'); ?></span>
52
- <span><?php _e("Google+, Twitter, Facebook Sharing", 'ffwd'); ?></span>
53
- <span><?php _e("Support / Updates", 'ffwd'); ?></span>
54
-
55
- </div>
56
- <div id="ffwd_featurs_table2">
57
- <span style="padding-top: 18px;height: 39px;"><?php _e("Free", 'ffwd'); ?></span>
58
-
59
- <span class="yes"></span>
60
- <span class="yes"></span>
61
- <span class="yes"></span>
62
- <span class="yes"></span>
63
- <span class="yes"></span>
64
- <span class="yes"></span>
65
- <span class="yes"></span>
66
- <span class="yes"></span>
67
- <span class="yes"></span>
68
- <span class="yes"></span>
69
- <span class="yes"></span>
70
- <span class="no"></span>
71
- <span class="no"></span>
72
- <span class="no"></span>
73
- <span class="no"></span>
74
- <span class="no"></span>
75
- <span class="no"></span>
76
- <span class="no"></span>
77
- <span class="no"></span>
78
-
79
- <span> <?php _e('Only Bug Fixes',"wdi"); ?> </span>
80
- </div>
81
- <div id="ffwd_featurs_table3">
82
- <span><?php _e("Pro Version", 'ffwd'); ?></span>
83
-
84
- <span class="yes"></span>
85
- <span class="yes"></span>
86
- <span class="yes"></span>
87
- <span class="yes"></span>
88
- <span class="yes"></span>
89
- <span class="yes"></span>
90
- <span class="yes"></span>
91
- <span class="yes"></span>
92
- <span class="yes"></span>
93
- <span class="yes"></span>
94
- <span class="yes"></span>
95
- <span class="yes"></span>
96
- <span class="yes"></span>
97
- <span class="yes"></span>
98
- <span class="yes"></span>
99
- <span class="yes"></span>
100
- <span class="yes"></span>
101
- <span class="yes"></span>
102
- <span class="yes"></span>
103
-
104
- <span> <?php _e('Full Support',"wdi"); ?> </span>
105
- </div>
106
-
107
- <div class="ffwd_upgrade ffwd-clear" style="background: none;">
108
- <div class="wd-cell wd-cell-valign-middle">
109
- <a href="https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin" target="_blank">
110
- <?php _e("UPGRADE TO PAID VERSION", "gmwd"); ?>
111
- </a>
112
  </div>
113
  </div>
114
  </div>
115
-
116
-
117
- <div style="clear: both;">
118
- <p><?php _e("After purchasing the commercial version follow these steps:", 'ffwd'); ?></p>
119
- <ol>
120
- <li><?php _e("Deactivate Facebook Feed by 10Web plugin.", 'ffwd'); ?></li>
121
- <li><?php _e("Delete Facebook Feed by 10Web plugin.", 'ffwd'); ?></li>
122
- <li><?php _e("Install the downloaded commercial version of the plugin.", 'ffwd'); ?></li>
123
- </ol>
124
- </div>
125
  <?php
126
  }
127
- ////////////////////////////////////////////////////////////////////////////////////////
128
- // Getters & Setters //
129
- ////////////////////////////////////////////////////////////////////////////////////////
130
- ////////////////////////////////////////////////////////////////////////////////////////
131
- // Private Methods //
132
- ////////////////////////////////////////////////////////////////////////////////////////
133
- ////////////////////////////////////////////////////////////////////////////////////////
134
- // Listeners //
135
- ////////////////////////////////////////////////////////////////////////////////////////
136
  }
1
  <?php
2
 
3
  class FFWDViewLicensing_ffwd {
 
 
 
 
 
 
 
 
 
 
4
 
5
+ public function __construct() {
 
 
 
 
 
6
  }
7
+
 
 
8
  public function display() {
9
  ?>
10
+ <div class="wrap">
11
+ <div id="ffwd_featurs_tables">
12
+ <div id="ffwd_featurs_table1">
13
+ <span>WordPress 3.4+ <?php _e("ready", 'ffwd'); ?></span>
14
+
15
+ <span><?php _e("Responsive layout", 'ffwd'); ?></span>
16
+ <span><?php _e("Page feeds", 'ffwd'); ?></span>
17
+ <span><?php _e("Public Group feeds", 'ffwd'); ?></span>
18
+ <span><?php _e("Auto-update for feeds", 'ffwd'); ?></span>
19
+ <span><?php _e("Unlimited Facebook feeds per page/post", 'ffwd'); ?></span>
20
+ <span><?php _e("Lightbox", 'ffwd'); ?></span>
21
+ <span><?php _e("Top Level & Stream type comment display", 'ffwd'); ?></span>
22
+ <span><?php _e("Facebook redirection option", 'ffwd'); ?></span>
23
+ <span><?php _e("Shortcode", 'ffwd'); ?></span>
24
+ <span><?php _e("Facebook feed widget", 'ffwd'); ?></span>
25
+ <span><?php _e("15 lightbox effects", 'ffwd'); ?></span>
26
+ <span><?php _e("Profile Feed", 'ffwd'); ?></span>
27
+ <span><?php _e("Specific content feeds", 'ffwd'); ?></span>
28
+ <span><?php _e("Advanced lightbox", 'ffwd'); ?></span>
29
+ <span><?php _e("Filmstrip for lightbox", 'ffwd'); ?></span>
30
+ <span><?php _e("Themes", 'ffwd'); ?></span>
31
+ <span><?php _e("Multiple layouts", 'ffwd'); ?></span>
32
+ <span><?php _e("Google+, Twitter, Facebook Sharing", 'ffwd'); ?></span>
33
+ <span><?php _e("Support / Updates", 'ffwd'); ?></span>
34
+ </div>
35
+ <div id="ffwd_featurs_table2">
36
+ <span style="padding-top: 18px;height: 39px;"><?php _e("Free", 'ffwd'); ?></span>
37
+ <span class="yes"></span>
38
+ <span class="yes"></span>
39
+ <span class="yes"></span>
40
+ <span class="yes"></span>
41
+ <span class="yes"></span>
42
+ <span class="yes"></span>
43
+ <span class="yes"></span>
44
+ <span class="yes"></span>
45
+ <span class="yes"></span>
46
+ <span class="yes"></span>
47
+ <span class="yes"></span>
48
+ <span class="no"></span>
49
+ <span class="no"></span>
50
+ <span class="no"></span>
51
+ <span class="no"></span>
52
+ <span class="no"></span>
53
+ <span class="no"></span>
54
+ <span class="no"></span>
55
+ <span class="no"></span>
56
+ <span> <?php _e('Only Bug Fixes', "wdi"); ?> </span>
57
+ </div>
58
+ <div id="ffwd_featurs_table3">
59
+ <span><?php _e("Pro Version", 'ffwd'); ?></span>
60
+ <span class="yes"></span>
61
+ <span class="yes"></span>
62
+ <span class="yes"></span>
63
+ <span class="yes"></span>
64
+ <span class="yes"></span>
65
+ <span class="yes"></span>
66
+ <span class="yes"></span>
67
+ <span class="yes"></span>
68
+ <span class="yes"></span>
69
+ <span class="yes"></span>
70
+ <span class="yes"></span>
71
+ <span class="yes"></span>
72
+ <span class="yes"></span>
73
+ <span class="yes"></span>
74
+ <span class="yes"></span>
75
+ <span class="yes"></span>
76
+ <span class="yes"></span>
77
+ <span class="yes"></span>
78
+ <span class="yes"></span>
79
+ <span> <?php _e('Full Support', "wdi"); ?> </span>
80
+ </div>
81
+ <div class="ffwd_upgrade ffwd-clear" style="background: none;">
82
+ <div class="wd-cell wd-cell-valign-middle">
83
+ <a href="https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin"
84
+ target="_blank">
85
+ <?php _e("UPGRADE TO PAID VERSION", "gmwd"); ?>
86
+ </a>
87
+ </div>
 
 
 
 
 
 
 
88
  </div>
89
  </div>
90
  </div>
 
 
 
 
 
 
 
 
 
 
91
  <?php
92
  }
 
 
 
 
 
 
 
 
 
93
  }
admin/views/FFWDViewOptions_ffwd.php CHANGED
@@ -28,7 +28,23 @@ class FFWDViewOptions_ffwd
28
  {
29
  global $WD_BWG_UPLOAD_DIR;
30
 
31
- WDW_FFWD_Library::topbar();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  $row = $this->model->get_row_data($reset);
33
  ?>
34
  <script>
@@ -57,48 +73,51 @@ class FFWDViewOptions_ffwd
57
  </div>
58
  </div>
59
  <div style=" width: 100%;" id="display_panel">
60
- <?php
61
- $pages = get_option('ffwd_pages_list');
62
- ?>
63
  <div class="ffwd-access-token-missing">
64
  <a id="ffwd_login_button" class="ffwd_login_button" href="#">
65
  <?php
66
  echo (empty($pages)) ? "Log in and get my Access Token" : "Reauthenticate"
67
  ?>
68
  </a>
69
- <?php if (empty($pages)) { ?>
70
- <p><?php _e("To use Facebook API, you need an Access Token.","ffwd");?></p>
71
- <p><?php _e("Click on the Log in and get my Access Token button, to generate your token.","ffwd");?></p>
72
- <?php
73
- }
74
- else { ?>
75
- <p><?php _e("If there is an issue with the Access Token, please click on Reauthenticate button.","ffwd");?></p>
 
 
 
 
 
 
 
 
76
  <?php
77
- }
78
- ?>
79
  </div>
80
  <div id="ffwd_login_popup" style="display: none;">
81
  <div class="ffwd_login_popup_content">
82
- <p>Log into your Facebook account using the button below and approve the plugin to connect your
83
- account.</p>
84
  <p>
85
  <span id="ffwd_login_popup_cancle_btn">Cancel</span>
86
  <a id="ffwd_login_popup_continue_btn" href="<?php echo WDFacebookFeed::get_auth_url(); ?>">Continue</a>
87
  </p>
88
 
89
- <p id="ffwd_login_popup_notice"><b>Please note:</b> this does not give us permission to manage
90
- your Facebook pages, it simply allows the plugin to see a list of the pages you manage and
91
- retrieve an Access Token.</p>
92
 
93
  </div>
94
  </div>
95
-
96
  <!--User options-->
97
  <div class="spider_div_options" id="div_content_1" style="">
98
- <table style="width: 90%;">
99
  <tbody>
100
-
101
- <!--<tr>
102
  <td class="spider_label_options">
103
  <label for="facebook_log_in">Facebook login / logout: </label>
104
  </td>
@@ -128,7 +147,7 @@ class FFWDViewOptions_ffwd
128
  <label>Timezone:</label>
129
  </td>
130
  <td>
131
- <input type="text" value="<?php echo isset($row->date_timezone) ? $row->date_timezone : ''; ?>" name="<?php echo WD_FB_PREFIX; ?>_date_timezone" />
132
 
133
  <div class="spider_description">If left empty, the server timezone will be used</div>
134
  </td>
@@ -144,7 +163,7 @@ class FFWDViewOptions_ffwd
144
  foreach ($this->model->date_formats as $key => $date_format) {
145
  ?>
146
  <option
147
- value="<?php echo $key; ?>" <?php if (isset($row->post_date_format) && $row->post_date_format == $key) echo 'selected="selected"'; ?>><?php echo $date_format; ?></option>
148
  <?php
149
  }
150
  ?>
@@ -153,7 +172,7 @@ class FFWDViewOptions_ffwd
153
  </td>
154
  </tr>
155
 
156
- <tr>
157
  <td class="spider_label_options">
158
  <label>Date format for events:</label>
159
  </td>
@@ -182,6 +201,7 @@ class FFWDViewOptions_ffwd
182
 
183
  </td>
184
  </tr>
 
185
  <tr>
186
  <td class="spider_label_options">
187
  <label>Uninstall:</label>
@@ -190,6 +210,8 @@ class FFWDViewOptions_ffwd
190
  <a href="admin.php?page=uninstall_ffwd" class="button">Uninstall</a>
191
  </td>
192
  </tr>
 
 
193
  </tbody>
194
  </table>
195
  </div>
@@ -208,6 +230,21 @@ class FFWDViewOptions_ffwd
208
  function ffwd_show_hide_options(id, display) {
209
  jQuery("#" + id).css("display", display);
210
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  </script>
212
  </form>
213
  <?php
28
  {
29
  global $WD_BWG_UPLOAD_DIR;
30
 
31
+
32
+
33
+
34
+ ?>
35
+ <div class="ffwd_upgrade wd-clear" >
36
+ <div class="ffwd-left">
37
+
38
+ <div style="font-size: 14px; ">
39
+ <?php _e("This section allows you to change settings for different views and general options.","ffwd");?>
40
+ <a style="color: #5CAEBD; text-decoration: none;border-bottom: 1px dotted;" target="_blank" href="https://help.10web.io/hc/en-us/articles/360017960312-Other-Settings?utm_source=facebook_feed&utm_medium=free_plugin"><?php _e("Read More in User Manual.","ffwd");?></a>
41
+ </div>
42
+
43
+ </div>
44
+ </div>
45
+
46
+
47
+ <?php
48
  $row = $this->model->get_row_data($reset);
49
  ?>
50
  <script>
73
  </div>
74
  </div>
75
  <div style=" width: 100%;" id="display_panel">
76
+ <?php
77
+ $pages = get_option('ffwd_pages_list');
78
+ ?>
79
  <div class="ffwd-access-token-missing">
80
  <a id="ffwd_login_button" class="ffwd_login_button" href="#">
81
  <?php
82
  echo (empty($pages)) ? "Log in and get my Access Token" : "Reauthenticate"
83
  ?>
84
  </a>
85
+ <?php
86
+ if (empty($pages)) {
87
+ ?>
88
+ <p>
89
+ <?php _e("To use Facebook API, you need an Access Token.","ffwd");?>
90
+ </p>
91
+ <p>
92
+ <?php _e("Click on the Log in and get my Access Token button, to generate your token.","ffwd");?>
93
+ </p>
94
+ <?php
95
+ }
96
+ else { ?>
97
+ <p>
98
+ <?php _e("If there is an issue with the Access Token, please click on Reauthenticate button.","ffwd");?>
99
+ </p>
100
  <?php
101
+ }
102
+ ?>
103
  </div>
104
  <div id="ffwd_login_popup" style="display: none;">
105
  <div class="ffwd_login_popup_content">
106
+ <p>Log into your Facebook account using the button below and approve the plugin to connect your account.</p>
 
107
  <p>
108
  <span id="ffwd_login_popup_cancle_btn">Cancel</span>
109
  <a id="ffwd_login_popup_continue_btn" href="<?php echo WDFacebookFeed::get_auth_url(); ?>">Continue</a>
110
  </p>
111
 
112
+ <p id="ffwd_login_popup_notice"><b>Please note:</b> this does not give us permission to manage your Facebook pages, it simply allows the plugin to see a list of the pages you manage and retrieve an Access Token.</p>
 
 
113
 
114
  </div>
115
  </div>
 
116
  <!--User options-->
117
  <div class="spider_div_options" id="div_content_1" style="">
118
+ <table style="width: 100%;">
119
  <tbody>
120
+ <!-- <tr>
 
121
  <td class="spider_label_options">
122
  <label for="facebook_log_in">Facebook login / logout: </label>
123
  </td>
147
  <label>Timezone:</label>
148
  </td>
149
  <td>
150
+ <input type="text" value="<?php echo $row->date_timezone ?>" name="<?php echo WD_FB_PREFIX; ?>_date_timezone" />
151
 
152
  <div class="spider_description">If left empty, the server timezone will be used</div>
153
  </td>
163
  foreach ($this->model->date_formats as $key => $date_format) {
164
  ?>
165
  <option
166
+ value="<?php echo $key; ?>" <?php if ($row->post_date_format == $key) echo 'selected="selected"'; ?>><?php echo $date_format; ?></option>
167
  <?php
168
  }
169
  ?>
172
  </td>
173
  </tr>
174
 
175
+ <tr style="display: none">
176
  <td class="spider_label_options">
177
  <label>Date format for events:</label>
178
  </td>
201
 
202
  </td>
203
  </tr>
204
+ <tr>
205
  <tr>
206
  <td class="spider_label_options">
207
  <label>Uninstall:</label>
210
  <a href="admin.php?page=uninstall_ffwd" class="button">Uninstall</a>
211
  </td>
212
  </tr>
213
+
214
+
215
  </tbody>
216
  </table>
217
  </div>
230
  function ffwd_show_hide_options(id, display) {
231
  jQuery("#" + id).css("display", display);
232
  }
233
+
234
+ function ffwd_validate_app()
235
+ {
236
+ if(jQuery('#ffwd_app_id').val()=='' || jQuery('#ffwd_app_secret').val()=='' )
237
+ {
238
+
239
+ return false;
240
+ }
241
+ else
242
+ {
243
+ return true;
244
+ }
245
+ }
246
+
247
+
248
  </script>
249
  </form>
250
  <?php
admin/views/FFWDViewThemes_ffwd.php CHANGED
@@ -1,41 +1,22 @@
1
  <?php
2
 
3
- class FFWDViewThemes_ffwd
4
- {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
  private $model;
15
 
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model)
20
- {
21
- $this->model = $model;
22
  }
23
 
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- // Public Methods //
26
- ////////////////////////////////////////////////////////////////////////////////////////
27
- public function display()
28
- {
29
  ?>
30
- <div class="wrap">
31
-
32
- <?php WDW_FFWD_Library::topbar(); ?>
33
-
34
- <div style="clear: both;float: right;color: #15699F; font-size: 20px; margin-top:10px; padding:8px 15px;">
35
  This is FREE version, Customizing themes is available only in the PAID version.
 
36
  </div>
37
- </div>
38
-
39
  <img src='<?php echo plugins_url('../../images/themes/thumbnail.png', __FILE__) ?>'/><br>
40
  <img src='<?php echo plugins_url('../../images/themes/masonry.png', __FILE__) ?>'/><br>
41
  <img src='<?php echo plugins_url('../../images/themes/album.png', __FILE__) ?>'/><br>
@@ -43,7 +24,154 @@ class FFWDViewThemes_ffwd
43
  <img src='<?php echo plugins_url('../../images/themes/lightbox.png', __FILE__) ?>'/><br>
44
  <img src='<?php echo plugins_url('../../images/themes/pagenav.png', __FILE__) ?>'/><br>
45
  <?php
46
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  public function edit($id, $reset)
@@ -87,6 +215,7 @@ class FFWDViewThemes_ffwd
87
  'normal' => 'Normal',
88
  'bold' => 'Bold',
89
  );
 
90
  $hover_effects = array(
91
  'none' => 'None',
92
  'rotate' => 'Rotate',
@@ -94,9 +223,9 @@ class FFWDViewThemes_ffwd
94
  'skew' => 'Skew',
95
  );
96
  $button_styles = array(
97
- 'ffwd-chevron' => 'Chevron',
98
- 'ffwd-angle' => 'Angle',
99
- 'ffwd-angle-double' => 'Double',
100
  );
101
  $rate_icons = array(
102
  'star' => 'Star',
@@ -106,18 +235,31 @@ class FFWDViewThemes_ffwd
106
  'heart' => 'Heart',
107
  'square' => 'Square',
108
  );
109
-
110
- WDW_FFWD_Library::topbar();
111
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <form class="wrap" method="post" id="themes_form" action="admin.php?page=themes_ffwd" style="width:99%;">
113
  <?php wp_nonce_field('themes_ffwd', 'ffwd_nonce'); ?>
114
  <h2></h2>
115
 
116
  <div class="ffwd_plugin_header">
117
- <span class="theme_icon"></span>
118
 
119
- <h2 class="ffwd_page_name"><?php echo $page_title; ?></h2>
120
- </div>
121
  <div style="float: right; margin: 0 5px 0 0;padding-top: 10px">
122
  <input class="ffwd-button-primary ffwd-button-save" type="submit"
123
  onclick="if (spider_check_required('name', 'Name')) {return false;}; spider_set_input_value('task', 'save')"
@@ -125,11 +267,9 @@ class FFWDViewThemes_ffwd
125
  <input class="ffwd-button-primary ffwd-button-apply" type="submit"
126
  onclick="if (spider_check_required('name', 'Name')) {return false;}; spider_set_input_value('task', 'apply')"
127
  value="Apply"/>
128
- <input class="ffwd-button-secondary ffwd-button-cancel" type="submit"
129
- onclick="spider_set_input_value('task', 'cancel')"
130
  value="Cancel"/>
131
- <input title="Reset to default theme" class="ffwd-button-primary ffwd-button-reset" type="submit"
132
- onclick="if (confirm('Do you want to reset to default?')) {
133
  spider_set_input_value('task', 'reset');
134
  } else {
135
  return false;
@@ -151,7 +291,7 @@ class FFWDViewThemes_ffwd
151
  <input type="hidden" id="current_type" name="current_type" value="<?php echo $current_type; ?>"/>
152
  </div>
153
  <fieldset class="spider_fieldset">
154
-
155
  <table style="clear:both;">
156
  <tbody>
157
  <tr>
@@ -1528,6 +1668,8 @@ class FFWDViewThemes_ffwd
1528
  </select>
1529
  </td>
1530
  </tr>
 
 
1531
  <tr>
1532
  <td class="spider_label"><label for="blog_style_evt_str_color">Event place(street)
1533
  color: </label></td>
@@ -1678,6 +1820,7 @@ class FFWDViewThemes_ffwd
1678
  </select>
1679
  </td>
1680
  </tr>
 
1681
  </tbody>
1682
  </table>
1683
  </fieldset>
@@ -2069,11 +2212,11 @@ class FFWDViewThemes_ffwd
2069
  </td>
2070
  </tr>
2071
  <tr id="lightbox_cntrl7">
2072
- <td class="spider_label"><label for="lightbox_ctrl_btn_color">Control buttons color: </label></td>
2073
- <td>
2074
- <input type="text" name="lightbox_ctrl_btn_color" id="lightbox_ctrl_btn_color" value="<?php echo $row->lightbox_ctrl_btn_color; ?>" class="color"/>
2075
- </td>
2076
- </tr>
2077
  <tr id="lightbox_cntrl4">
2078
  <td class="spider_label"><label for="lightbox_ctrl_btn_transparent">Control buttons
2079
  transparency: </label></td>
@@ -2494,11 +2637,11 @@ class FFWDViewThemes_ffwd
2494
  </td>
2495
  </tr>
2496
  <tr id="lightbox_filmstrip7">
2497
- <td class="spider_label"><label for="lightbox_filmstrip_rl_btn_color">Filmstrip right, left buttons color: </label></td>
2498
- <td>
2499
- <input type="text" name="lightbox_filmstrip_rl_btn_color" id="lightbox_filmstrip_rl_btn_color" value="<?php echo $row->lightbox_filmstrip_rl_btn_color; ?>" class="color"/>
2500
- </td>
2501
- </tr>
2502
  <tr id="lightbox_filmstrip8">
2503
  <td class="spider_label"><label for="lightbox_filmstrip_rl_bg_color">Filmstrip right,
2504
  left button background color:</label></td>
@@ -2508,6 +2651,8 @@ class FFWDViewThemes_ffwd
2508
  value="<?php echo $row->lightbox_filmstrip_rl_bg_color; ?>" class="color"/>
2509
  </td>
2510
  </tr>
 
 
2511
  <tr>
2512
  <td class="spider_label"><label for="lightbox_evt_str_color">Event place(street)
2513
  color: </label></td>
@@ -2711,12 +2856,10 @@ class FFWDViewThemes_ffwd
2711
  </td>
2712
  </tr>
2713
  <tr>
2714
- <td class="spider_label"><label for="lightbox_obj_icons_color_likes_comments_count">Info
2715
- icons
2716
  color _comments_count: </label></td>
2717
  <td>
2718
- <select name="lightbox_obj_icons_color_likes_comments_count"
2719
- id="lightbox_obj_icons_color_likes_comments_count">
2720
  <option
2721
  value="gray" <?php echo((isset($row->lightbox_obj_icons_color_likes_comments_count) && $row->lightbox_obj_icons_color_likes_comments_count == "gray") ? 'selected="selected"' : ''); ?>>
2722
  Gray
1
  <?php
2
 
3
+ class FFWDViewThemes_ffwd {
4
+
 
 
 
 
 
 
 
 
 
5
  private $model;
6
 
7
+ public function __construct($model) {
8
+ $this->model = $model;
 
 
 
 
9
  }
10
 
11
+ public function display() {
12
+ if ( WD_FB_IS_FREE ) {
13
+ WDW_FFWD_Library::topbar();
 
 
14
  ?>
15
+ <div class="wrap">
16
+ <div style="clear: both;float: right;color: #15699F; font-size: 20px; margin-top:10px; padding:8px 15px;">
 
 
 
17
  This is FREE version, Customizing themes is available only in the PAID version.
18
+ </div>
19
  </div>
 
 
20
  <img src='<?php echo plugins_url('../../images/themes/thumbnail.png', __FILE__) ?>'/><br>
21
  <img src='<?php echo plugins_url('../../images/themes/masonry.png', __FILE__) ?>'/><br>
22
  <img src='<?php echo plugins_url('../../images/themes/album.png', __FILE__) ?>'/><br>
24
  <img src='<?php echo plugins_url('../../images/themes/lightbox.png', __FILE__) ?>'/><br>
25
  <img src='<?php echo plugins_url('../../images/themes/pagenav.png', __FILE__) ?>'/><br>
26
  <?php
27
+ }
28
+ else {
29
+ $rows_data = $this->model->get_rows_data();
30
+ $page_nav = $this->model->page_nav();
31
+ $search_value = ((isset($_POST['search_value'])) ? sanitize_text_field($_POST['search_value']) : '');
32
+ $search_select_value = ((isset($_POST['search_select_value'])) ? (int) $_POST['search_select_value'] : 0);
33
+ $asc_or_desc = ((isset($_POST['asc_or_desc'])) ? sanitize_text_field($_POST['asc_or_desc']) : 'asc');
34
+ $order_by = (isset($_POST['order_by']) ? sanitize_text_field($_POST['order_by']) : 'id');
35
+ $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
36
+ $ids_string = '';
37
+ $per_page = $this->model->per_page();
38
+ $pager = 0;
39
+ ?>
40
+ <div class="ffwd_upgrade wd-clear">
41
+ <div class="ffwd-left">
42
+ <div style="font-size: 14px; ">
43
+ <?php _e("This section allows you to create, edit and delete themes.", "ffwd"); ?>
44
+ <a style="color: #5CAEBD; text-decoration: none;border-bottom: 1px dotted;" target="_blank"
45
+ href="https://help.10web.io/hc/en-us/articles/360017960352--Facebook-Feed-WD-Themes?utm_source=facebook_feed&utm_medium=free_plugin"><?php _e("Read More in User Manual.", "ffwd"); ?></a>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_ffwd" style="width:99%;">
50
+ <?php wp_nonce_field('themes_ffwd', 'ffwd_nonce'); ?>
51
+ <h2></h2>
52
+ <div class="ffwd_plugin_header">
53
+ <span class="theme_icon"></span>
54
+ <h2 class="ffwd_page_name">Themes <a href="" class="ffwd-button-primary ffwd-button-add-new"
55
+ onclick="spider_set_input_value('task', 'add'); spider_form_submit(event, 'themes_form')">Add
56
+ new</a></h2>
57
+ </div>
58
+ <div class="buttons_div">
59
+ <input class="ffwd-button-secondary ffwd-button-delete" type="submit" onclick="if (confirm('Do you want to delete selected items?')) {
60
+ spider_set_input_value('task', 'delete_all');
61
+ } else {
62
+ return false;
63
+ }" value="Delete"/>
64
+ </div>
65
+ <div class="tablenav top">
66
+ <?php
67
+ WDW_FFWD_Library::search('Title', $search_value, 'themes_form');
68
+ WDW_FFWD_Library::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'themes_form', $per_page);
69
+ ?>
70
+ </div>
71
+ <table class="wp-list-table widefat fixed pages">
72
+ <thead>
73
+ <th class="manage-column column-cb check-column table_small_col">
74
+ <input id="check_all" type="checkbox" style="margin:0;"/>
75
+ </th>
76
+ <th class="table_small_col <?php if ( $order_by == 'id' ) {
77
+ echo $order_class;
78
+ } ?>">
79
+ <a onclick="spider_set_input_value('task', '');
80
+ spider_set_input_value('order_by', 'id');
81
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field($_POST['order_by']) == 'id') && sanitize_text_field($_POST['asc_or_desc']) == 'asc') ? 'desc' : 'asc'); ?>');
82
+ spider_form_submit(event, 'themes_form')" href="">
83
+ <span>ID</span><span class="sorting-indicator"></span></a>
84
+ </th>
85
+ <th class="<?php if ( $order_by == 'name' ) {
86
+ echo $order_class;
87
+ } ?>">
88
+ <a onclick="spider_set_input_value('task', '');
89
+ spider_set_input_value('order_by', 'name');
90
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field($_POST['order_by']) == 'title') && sanitize_text_field($_POST['asc_or_desc']) == 'asc') ? 'desc' : 'asc'); ?>');
91
+ spider_form_submit(event, 'themes_form')" href="">
92
+ <span>Name</span><span class="sorting-indicator"></span></a>
93
+ </th>
94
+ <th class="table_big_col <?php if ( $order_by == 'default_theme' ) {
95
+ echo $order_class;
96
+ } ?>">
97
+ <a onclick="spider_set_input_value('task', '');
98
+ spider_set_input_value('order_by', 'default_theme');
99
+ spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field($_POST['order_by']) == 'default_theme') && sanitize_text_field($_POST['asc_or_desc']) == 'asc') ? 'desc' : 'asc'); ?>');
100
+ spider_form_submit(event, 'themes_form')" href="">
101
+ <span>Default</span><span class="sorting-indicator"></span></a>
102
+ </th>
103
+ <th class="table_big_col">Edit</th>
104
+ <th class="table_big_col">Delete</th>
105
+ </thead>
106
+ <tbody id="tbody_arr">
107
+ <?php
108
+ if ( $rows_data ) {
109
+ foreach ( $rows_data as $row_data ) {
110
+ $alternate = (!isset($alternate) || $alternate == 'class="alternate"') ? '' : 'class="alternate"';
111
+ $default_image = (($row_data->default_theme) ? 'default' : 'notdefault');
112
+ $default = (($row_data->default_theme) ? '' : 'setdefault');
113
+ ?>
114
+ <tr id="tr_<?php echo $row_data->id; ?>" <?php echo $alternate; ?>>
115
+ <td class="table_small_col check-column">
116
+ <input id="check_<?php echo $row_data->id; ?>" name="check_<?php echo $row_data->id; ?>"
117
+ type="checkbox"/>
118
+ </td>
119
+ <td class="table_small_col"><?php echo $row_data->id; ?></td>
120
+ <td>
121
+ <a onclick="spider_set_input_value('task', 'edit');
122
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
123
+ spider_form_submit(event, 'themes_form')" href="" title="Edit"><?php echo $row_data->name; ?></a>
124
+ </td>
125
+ <td class="table_big_col">
126
+ <?php
127
+ if ($default != '') {
128
+ ?>
129
+ <a onclick="spider_set_input_value('task', '<?php echo $default; ?>');
130
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
131
+ spider_form_submit(event, 'themes_form')" href="">
132
+ <?php
133
+ }
134
+ ?>
135
+ <img src="<?php echo WD_FFWD_URL . '/images/' . $default_image . '.png'; ?>"/>
136
+ <?php
137
+ if ($default != '') {
138
+ ?>
139
+ </a>
140
+ <?php
141
+ }
142
+ ?>
143
+ </td>
144
+ <td class="table_big_col">
145
+ <a onclick="spider_set_input_value('task', 'edit');
146
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
147
+ spider_form_submit(event, 'themes_form')" href="">Edit</a>
148
+ </td>
149
+ <td class="table_big_col">
150
+ <a onclick="spider_set_input_value('task', 'delete');
151
+ spider_set_input_value('current_id', '<?php echo $row_data->id; ?>');
152
+ spider_form_submit(event, 'themes_form')" href="">Delete</a>
153
+ </td>
154
+ </tr>
155
+ <?php
156
+ $ids_string .= $row_data->id . ',';
157
+ }
158
+ }
159
+ ?>
160
+ </tbody>
161
+ </table>
162
+ <div class="tablenav bottom">
163
+ <?php
164
+ WDW_FFWD_Library::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'themes_form', $per_page);
165
+ ?>
166
+ </div>
167
+ <input id="task" name="task" type="hidden" value=""/>
168
+ <input id="current_id" name="current_id" type="hidden" value=""/>
169
+ <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?>"/>
170
+ <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc"/>
171
+ <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?>"/>
172
+ </form>
173
+ <?php
174
+ }
175
  }
176
 
177
  public function edit($id, $reset)
215
  'normal' => 'Normal',
216
  'bold' => 'Bold',
217
  );
218
+
219
  $hover_effects = array(
220
  'none' => 'None',
221
  'rotate' => 'Rotate',
223
  'skew' => 'Skew',
224
  );
225
  $button_styles = array(
226
+ 'fa-chevron' => 'Chevron',
227
+ 'fa-angle' => 'Angle',
228
+ 'fa-angle-double' => 'Double',
229
  );
230
  $rate_icons = array(
231
  'star' => 'Star',
235
  'heart' => 'Heart',
236
  'square' => 'Square',
237
  );
 
 
238
  ?>
239
+
240
+ <div class="ffwd_upgrade wd-clear" >
241
+ <div class="ffwd-left">
242
+
243
+ <div style="font-size: 14px; ">
244
+ <?php _e("This section allows you to add/edit themes.","ffwd");?>
245
+ <a style="color: #5CAEBD; text-decoration: none;border-bottom: 1px dotted;" target="_blank" href="https://help.10web.io/hc/en-us/articles/360017960352--Facebook-Feed-WD-Themes?utm_source=facebook_feed&utm_medium=free_plugin"><?php _e("Read More in User Manual.","ffwd");?></a>
246
+ </div>
247
+
248
+ </div>
249
+ </div>
250
+
251
+
252
+
253
+
254
  <form class="wrap" method="post" id="themes_form" action="admin.php?page=themes_ffwd" style="width:99%;">
255
  <?php wp_nonce_field('themes_ffwd', 'ffwd_nonce'); ?>
256
  <h2></h2>
257
 
258
  <div class="ffwd_plugin_header">
259
+ <span class="theme_icon"></span>
260
 
261
+ <h2 class="ffwd_page_name"><?php echo $page_title; ?></h2>
262
+ </div>
263
  <div style="float: right; margin: 0 5px 0 0;padding-top: 10px">
264
  <input class="ffwd-button-primary ffwd-button-save" type="submit"
265
  onclick="if (spider_check_required('name', 'Name')) {return false;}; spider_set_input_value('task', 'save')"
267
  <input class="ffwd-button-primary ffwd-button-apply" type="submit"
268
  onclick="if (spider_check_required('name', 'Name')) {return false;}; spider_set_input_value('task', 'apply')"
269
  value="Apply"/>
270
+ <input class="ffwd-button-secondary ffwd-button-cancel" type="submit" onclick="spider_set_input_value('task', 'cancel')"
 
271
  value="Cancel"/>
272
+ <input title="Reset to default theme" class="ffwd-button-primary ffwd-button-reset" type="submit" onclick="if (confirm('Do you want to reset to default?')) {
 
273
  spider_set_input_value('task', 'reset');
274
  } else {
275
  return false;
291
  <input type="hidden" id="current_type" name="current_type" value="<?php echo $current_type; ?>"/>
292
  </div>
293
  <fieldset class="spider_fieldset">
294
+
295
  <table style="clear:both;">
296
  <tbody>
297
  <tr>
1668
  </select>
1669
  </td>
1670
  </tr>
1671
+ </tbody>
1672
+ <tbody style="display: none;">
1673
  <tr>
1674
  <td class="spider_label"><label for="blog_style_evt_str_color">Event place(street)
1675
  color: </label></td>
1820
  </select>
1821
  </td>
1822
  </tr>
1823
+
1824
  </tbody>
1825
  </table>
1826
  </fieldset>
2212
  </td>
2213
  </tr>
2214
  <tr id="lightbox_cntrl7">
2215
+ <td class="spider_label"><label for="lightbox_ctrl_btn_color">Control buttons color: </label></td>
2216
+ <td>
2217
+ <input type="text" name="lightbox_ctrl_btn_color" id="lightbox_ctrl_btn_color" value="<?php echo $row->lightbox_ctrl_btn_color; ?>" class="color"/>
2218
+ </td>
2219
+ </tr>
2220
  <tr id="lightbox_cntrl4">
2221
  <td class="spider_label"><label for="lightbox_ctrl_btn_transparent">Control buttons
2222
  transparency: </label></td>
2637
  </td>
2638
  </tr>
2639
  <tr id="lightbox_filmstrip7">
2640
+ <td class="spider_label"><label for="lightbox_filmstrip_rl_btn_color">Filmstrip right, left buttons color: </label></td>
2641
+ <td>
2642
+ <input type="text" name="lightbox_filmstrip_rl_btn_color" id="lightbox_filmstrip_rl_btn_color" value="<?php echo $row->lightbox_filmstrip_rl_btn_color; ?>" class="color"/>
2643
+ </td>
2644
+ </tr>
2645
  <tr id="lightbox_filmstrip8">
2646
  <td class="spider_label"><label for="lightbox_filmstrip_rl_bg_color">Filmstrip right,
2647
  left button background color:</label></td>
2651
  value="<?php echo $row->lightbox_filmstrip_rl_bg_color; ?>" class="color"/>
2652
  </td>
2653
  </tr>
2654
+ </tbody>
2655
+ <tbody style="display: none">
2656
  <tr>
2657
  <td class="spider_label"><label for="lightbox_evt_str_color">Event place(street)
2658
  color: </label></td>
2856
  </td>
2857
  </tr>
2858
  <tr>
2859
+ <td class="spider_label"><label for="lightbox_obj_icons_color_likes_comments_count">Info icons
 
2860
  color _comments_count: </label></td>
2861
  <td>
2862
+ <select name="lightbox_obj_icons_color_likes_comments_count" id="lightbox_obj_icons_color_likes_comments_count">
 
2863
  <option
2864
  value="gray" <?php echo((isset($row->lightbox_obj_icons_color_likes_comments_count) && $row->lightbox_obj_icons_color_likes_comments_count == "gray") ? 'selected="selected"' : ''); ?>>
2865
  Gray
admin/views/FFWDViewUninstall_ffwd.php DELETED
@@ -1,123 +0,0 @@
1
- <?php
2
-
3
- class FFWDViewUninstall_ffwd {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display() {
26
- global $wpdb;
27
- $prefix = $wpdb->prefix;
28
- ?>
29
- <form method="post" action="admin.php?page=uninstall_ffwd" style="width:99%;">
30
- <?php wp_nonce_field( 'uninstall_ffwd', 'ffwd_nonce' ); ?>
31
- <div class="wrap">
32
- <h2></h2>
33
- <span class="uninstall_icon"></span>
34
- <h2>Uninstall Facebook Feed by 10Web</h2>
35
- <p>
36
- Deactivating Facebook Feed by 10Web plugin does not remove any data that may have been created. To completely remove this plugin, you can uninstall it here.
37
- </p>
38
- <p style="color: red;">
39
- <strong>WARNING:</strong>
40
- Once uninstalled, this can't be undone. You should use a Database Backup plugin of WordPress to back up all the data first.
41
- </p>
42
- <p style="color: red">
43
- <strong>The following Database Tables will be deleted:</strong>
44
- </p>
45
- <table class="widefat">
46
- <thead>
47
- <tr>
48
- <th>Database Tables</th>
49
- </tr>
50
- </thead>
51
- <tr>
52
- <td valign="top">
53
- <ol>
54
- <li><?php echo $prefix; ?>wd_fb_info</li>
55
- <li><?php echo $prefix; ?>wd_fb_data</li>
56
- <li><?php echo $prefix; ?>wd_fb_option</li>
57
- <li><?php echo $prefix; ?>wd_fb_theme</li>
58
- <li><?php echo $prefix; ?>wd_fb_shortcode</li>
59
- </ol>
60
- </td>
61
- </tr>
62
- </table>
63
- <p style="text-align: center;">
64
- Do you really want to uninstall Facebook Feed by 10Web?
65
- </p>
66
- <p style="text-align: center;">
67
- <input type="checkbox" name="Facebook Feed by 10Web" id="check_yes" value="yes" />&nbsp;<label for="check_yes">Yes</label>
68
- </p>
69
- <p style="text-align: center;">
70
- <input type="submit" value="UNINSTALL" class="button-primary" onclick="if (check_yes.checked) {
71
- if (confirm('You are About to Uninstall Facebook Feed by 10Web from WordPress.\nThis Action Is Not Reversible.')) {
72
- spider_set_input_value('task', 'uninstall');
73
- } else {
74
- return false;
75
- }
76
- }
77
- else {
78
- return false;
79
- }" />
80
- </p>
81
- </div>
82
- <input id="task" name="task" type="hidden" value="" />
83
- </form>
84
- <?php
85
- }
86
-
87
- public function uninstall() {
88
- $flag = TRUE;
89
- global $wpdb;
90
- $this->model->delete_db_tables();
91
- $prefix = $wpdb->prefix;
92
- $deactivate_url = wp_nonce_url('plugins.php?action=deactivate&amp;plugin=wd-facebook-feed/facebook-feed-wd.php', 'deactivate-plugin_wd-facebook-feed/facebook-feed-wd.php');
93
- ?>
94
- <div id="message" class="updated fade">
95
- <p>The following Database Tables successfully deleted:</p>
96
- <p><?php echo $prefix; ?>wd_fb_info,</p>
97
- <p><?php echo $prefix; ?>wd_fb_data,</p>
98
- <p><?php echo $prefix; ?>wd_fb_option,</p>
99
- <p><?php echo $prefix; ?>wd_fb_theme,</p>
100
- <p><?php echo $prefix; ?>wd_fb_shortcode,</p>
101
- </div>
102
- <div class="wrap">
103
- <h2>Uninstall Facebook Feed by 10Web</h2>
104
- <p><strong><a href="<?php echo $deactivate_url; ?>" class="ffwd_deactivate_link" data-uninstall="1">Click Here</a> To Finish the Uninstallation and Facebook Feed by 10Web will be Deactivated Automatically.</strong></p>
105
- <input id="task" name="task" type="hidden" value="" />
106
- </div>
107
- <script>
108
- jQuery("#toplevel_page_info_ffwd ul").remove()
109
- jQuery("#toplevel_page_info_ffwd a").attr("href", "admin.php?page=options_ffwd")
110
- </script>
111
- <?php
112
- }
113
-
114
- ////////////////////////////////////////////////////////////////////////////////////////
115
- // Getters & Setters //
116
- ////////////////////////////////////////////////////////////////////////////////////////
117
- ////////////////////////////////////////////////////////////////////////////////////////
118
- // Private Methods //
119
- ////////////////////////////////////////////////////////////////////////////////////////
120
- ////////////////////////////////////////////////////////////////////////////////////////
121
- // Listeners //
122
- ////////////////////////////////////////////////////////////////////////////////////////
123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/FFWDViewWidget.php CHANGED
@@ -1,223 +1,191 @@
1
  <?php
2
 
3
- class FFWDViewWidget
4
- {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- private $model;
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model)
20
- {
21
- $this->model = $model;
22
- }
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
- // Public Methods //
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
-
27
- public function display()
28
- {
29
- }
30
-
31
- function widget($args, $instance)
32
- {
33
- extract($args);
34
- $title = (isset($instance['title']) ? $instance['title'] : "");
35
- $id = (isset($instance['id']) ? $instance['id'] : 0);
36
- $ffwd_info = $this->model->get_ffwd_feed($id);
37
-
38
- if(!isset($ffwd_info)) {
39
- echo "Please select facebook feed.";
40
- return;
 
 
 
41
  }
42
-
43
-
44
- $count = (isset($instance['count']) ? $instance['count'] : 4);
45
- $width = (isset($instance['width']) ? $instance['width'] : 100);
46
- $height = (isset($instance['height']) ? $instance['height'] : 100);
47
- $theme_id = $ffwd_info->theme;
48
- // Before widget.
49
- echo $before_widget;
50
- // Title of widget.
51
- if ($title) {
52
- echo $before_title . $title . $after_title;
53
- }
54
-
55
-
56
- // Widget output.
57
- global $ffwd;
58
- // Collapse right dimmensions
59
- switch ($ffwd_info->fb_view_type) {
60
- case 'thumbnails': {
61
- $dimmensions = array(
62
- 'thumb_width' => $width,
63
- 'thumb_height' => $height,
64
- );
65
- break;
66
- }
67
- case 'thumbnails_masonry': {
68
- $dimmensions = array(
69
- 'thumb_width' => $width,
70
- 'thumb_height' => $height,
71
- );
72
- break;
73
-
74
- }
75
- case 'blog_style': {
76
- $dimmensions = array(
77
- 'thumb_width' => $width,
78
- 'thumb_height' => $height,
79
- );
80
- break;
81
- }
82
- case 'album_compact': {
83
- $dimmensions = array(
84
- 'album_thumb_width' => $width,
85
- 'album_thumb_height' => $height,
86
- 'thumb_width' => $width,
87
- 'thumb_height' => $height,
88
- );
89
- break;
90
- }
91
- default: {
92
- $dimmensions = array(
93
- 'width' => $width,
94
- 'height' => $height,
95
- );
96
- break;
97
- }
98
- }
99
- $params = array(
100
- 'from' => 'widget',
101
- 'fb_id' => $id,
102
- 'theme_id' => $theme_id,
103
- 'objects_per_page' => $count
104
- );
105
-
106
- $params = array_merge($params, $dimmensions);
107
-
108
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
109
- //$params = WDW_FFWD_Library::filter_params($params);
110
-
111
- if ($ffwd_info->fb_view_type == 'thumbnails' || $ffwd_info->fb_view_type == 'thumbnails_masonry' || $ffwd_info->fb_view_type == 'album_compact' || $ffwd_info->fb_view_type == 'blog_style') {
112
- require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php');
113
- $controller = new FFWDControllerMain($params, 1, $ffwd, ucfirst($ffwd_info->fb_view_type));
114
- $ffwd++;
115
- } else {
116
-
117
- echo "Please select facebook feed.";
118
- }
119
- // After widget.
120
- echo $after_widget;
121
- }
122
-
123
- // Widget Control Panel.
124
- function form($instance, $id_title, $name_title, $id, $ffwd_feed_name, $id_count, $name_count, $id_width, $name_width, $id_height, $name_height, $id_theme_id, $name_theme_id, $id_view_type, $name_view_type)
125
- {
126
- $defaults = array(
127
- 'title' => 'Facebook feed',
128
- 'id' => 0,
129
- 'count' => 4,
130
- 'width' => 100,
131
- 'height' => 100,
132
- );
133
-
134
- $instance = wp_parse_args((array)$instance, $defaults);
135
- $ffwd_feeds = $this->model->get_ffwd_feeds();
136
- ?>
137
- <script>
138
- function ffwd_view_type(select) {
139
- var sel_option = select.options[select.options.selectedIndex],
140
- sel_option_con = sel_option.getAttribute("content"),
141
- sel_option_con_type = sel_option.getAttribute("content_type");
142
- jQuery(".ffwd_sel_thumbnail_view_cont").hide();
143
- jQuery(".ffwd_sel_masonry_view_cont").hide();
144
- jQuery(".ffwd_sel_album_compact_view_cont").hide();
145
- jQuery(".ffwd_sel_blog_style_view_cont").hide();
146
- if (sel_option_con_type == "timeline") {
147
- jQuery(".ffwd_sel_blog_style_view_cont").show();
148
- }
149
- else if (sel_option_con_type == "specific") {
150
- switch (sel_option_con) {
151
- case "albums":
152
- jQuery(".ffwd_sel_album_compact_view_cont").show();
153
- break;
154
- case "photos":
155
- jQuery(".ffwd_sel_thumbnail_view_cont").show();
156
- jQuery(".ffwd_sel_masonry_view_cont").show();
157
- break;
158
- case "videos":
159
- jQuery(".ffwd_sel_thumbnail_view_cont").show();
160
- jQuery(".ffwd_sel_masonry_view_cont").show();
161
- break;
162
- case "events":
163
- jQuery(".ffwd_sel_blog_style_view_cont").show();
164
- jQuery(".ffwd_sel_thumbnail_view_cont").show();
165
- break;
166
- default:
167
- jQuery(".ffwd_sel_thumbnail_view_cont").show();
168
- break;
169
- }
170
- }
171
- }
172
- </script>
173
- <p>
174
- <label for="<?php echo $id_title; ?>">Title:</label>
175
- <input class="widefat" id="<?php echo $id_title; ?>" name="<?php echo $name_title; ?>'" type="text"
176
- value="<?php echo $instance['title']; ?>"/>
177
- </p>
178
- <p id="p_ffwd_feeds">
179
- <select name="<?php echo $ffwd_feed_name; ?>" id="<?php echo $id; ?>" class="widefat"
180
- onchange="ffwd_view_type(this)">
181
- <option value="0">Select facebook feed</option>
182
- <?php
183
- foreach ($ffwd_feeds as $ffwd_feed) {
184
- ?>
185
- <option
186
- value="<?php echo $ffwd_feed->id; ?>" <?php echo(($instance['id'] == $ffwd_feed->id) ? 'selected="selected"' : ''); ?>
187
- content_type="<?php echo $ffwd_feed->content_type; ?>"
188
- content="<?php echo $ffwd_feed->content; ?>"><?php echo $ffwd_feed->name; ?></option>
189
- <?php
190
- }
191
- ?>
192
- </select>
193
- </p>
194
-
195
- <p>
196
- <label for="<?php echo $id_count; ?>">Count:</label>
197
- <input class="widefat" style="width:25%;" id="<?php echo $id_count; ?>" name="<?php echo $name_count; ?>'"
198
- type="text" value="<?php echo $instance['count']; ?>"/>
199
- </p>
200
- <p>
201
- <label style="display: block;" for="<?php echo $id_width; ?>">Dimensions <br>(Leave height empty blank if you do not intend to limit the height of the widget.):</label>
202
- <input class="widefat" style="width:25%;" id="<?php echo $id_width; ?>" name="<?php echo $name_width; ?>'"
203
- type="text" value="<?php echo $instance['width']; ?>"/> x
204
- <input class="widefat" style="width:25%;" id="<?php echo $id_height; ?>" name="<?php echo $name_height; ?>'"
205
- type="text" value="<?php echo $instance['height']; ?>"/> px
206
- </p>
207
-
208
- <script>
209
- ffwd_view_type(document.getElementById("<?php echo $id; ?>"));
210
- </script>
211
- <?php
212
- }
213
-
214
- ////////////////////////////////////////////////////////////////////////////////////////
215
- // Getters & Setters //
216
- ////////////////////////////////////////////////////////////////////////////////////////
217
- ////////////////////////////////////////////////////////////////////////////////////////
218
- // Private Methods //
219
- ////////////////////////////////////////////////////////////////////////////////////////
220
- ////////////////////////////////////////////////////////////////////////////////////////
221
- // Listeners //
222
- ////////////////////////////////////////////////////////////////////////////////////////
223
- }
1
  <?php
2
 
3
+ class FFWDViewWidget {
4
+ private $model;
5
+
6
+ public function __construct( $model ) {
7
+ $this->model = $model;
8
+ }
9
+
10
+ public function display() {
11
+ }
12
+
13
+ function widget( $args, $instance ) {
14
+ extract($args);
15
+ $title = (isset($instance['title']) ? $instance['title'] : "");
16
+ $id = (isset($instance['id']) ? $instance['id'] : 0);
17
+ $ffwd_info = $this->model->get_ffwd_feed($id);
18
+ if ( !isset($ffwd_info) ) {
19
+ echo "Please select facebook feed.";
20
+
21
+ return;
22
+ }
23
+ $count = (isset($instance['count']) ? $instance['count'] : 4);
24
+ $width = (isset($instance['width']) ? $instance['width'] : 100);
25
+ $height = (isset($instance['height']) ? $instance['height'] : 100);
26
+ $theme_id = $ffwd_info->theme;
27
+ // Before widget.
28
+ echo $before_widget;
29
+ // Title of widget.
30
+ if ( $title ) {
31
+ echo $before_title . $title . $after_title;
32
+ }
33
+ // Widget output.
34
+ global $ffwd;
35
+ // Collapse right dimmensions
36
+ switch ( $ffwd_info->fb_view_type ) {
37
+ case 'thumbnails':
38
+ {
39
+ $dimmensions = array(
40
+ 'thumb_width' => $width,
41
+ 'thumb_height' => $height,
42
+ );
43
+ break;
44
  }
45
+ case 'thumbnails_masonry':
46
+ {
47
+ $dimmensions = array(
48
+ 'thumb_width' => $width,
49
+ 'thumb_height' => $height,
50
+ );
51
+ break;
52
+ }
53
+ case 'blog_style':
54
+ {
55
+ $dimmensions = array(
56
+ 'thumb_width' => $width,
57
+ 'thumb_height' => $height,
58
+ );
59
+ break;
60
+ }
61
+ case 'album_compact':
62
+ {
63
+ $dimmensions = array(
64
+ 'album_thumb_width' => $width,
65
+ 'album_thumb_height' => $height,
66
+ 'thumb_width' => $width,
67
+ 'thumb_height' => $height,
68
+ );
69
+ break;
70
+ }
71
+ default:
72
+ {
73
+ $dimmensions = array(
74
+ 'width' => $width,
75
+ 'height' => $height,
76
+ );
77
+ break;
78
+ }
79
+ }
80
+ $params = array(
81
+ 'from' => 'widget',
82
+ 'fb_id' => $id,
83
+ 'theme_id' => $theme_id,
84
+ 'objects_per_page' => $count,
85
+ );
86
+ $params = array_merge($params, $dimmensions);
87
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
88
+ if ( $ffwd_info->fb_view_type == 'thumbnails' || $ffwd_info->fb_view_type == 'thumbnails_masonry' || $ffwd_info->fb_view_type == 'album_compact' || $ffwd_info->fb_view_type == 'blog_style' ) {
89
+ require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php');
90
+ $controller = new FFWDControllerMain($params, 1, $ffwd, ucfirst($ffwd_info->fb_view_type));
91
+ $ffwd++;
92
+ }
93
+ else {
94
+
95
+ echo "Please select facebook feed.";
96
+ }
97
+ // After widget.
98
+ echo $after_widget;
99
+ }
100
+
101
+ // Widget Control Panel.
102
+ function form($instance, $id_title, $name_title, $id, $ffwd_feed_name, $id_count, $name_count, $id_width, $name_width, $id_height, $name_height, $id_theme_id, $name_theme_id, $id_view_type, $name_view_type)
103
+ {
104
+ $defaults = array(
105
+ 'title' => 'Facebook feed',
106
+ 'id' => 0,
107
+ 'count' => 4,
108
+ 'width' => 100,
109
+ 'height' => 100,
110
+ );
111
+
112
+ $instance = wp_parse_args((array)$instance, $defaults);
113
+ $ffwd_feeds = $this->model->get_ffwd_feeds();
114
+ ?>
115
+ <script>
116
+ function ffwd_view_type(select) {
117
+ var sel_option = select.options[select.options.selectedIndex],
118
+ sel_option_con = sel_option.getAttribute("content"),
119
+ sel_option_con_type = sel_option.getAttribute("content_type");
120
+ jQuery(".ffwd_sel_thumbnail_view_cont").hide();
121
+ jQuery(".ffwd_sel_masonry_view_cont").hide();
122
+ jQuery(".ffwd_sel_album_compact_view_cont").hide();
123
+ jQuery(".ffwd_sel_blog_style_view_cont").hide();
124
+ if (sel_option_con_type == "timeline") {
125
+ jQuery(".ffwd_sel_blog_style_view_cont").show();
126
+ }
127
+ else if (sel_option_con_type == "specific") {
128
+ switch (sel_option_con) {
129
+ case "albums":
130
+ jQuery(".ffwd_sel_album_compact_view_cont").show();
131
+ break;
132
+ case "photos":
133
+ jQuery(".ffwd_sel_thumbnail_view_cont").show();
134
+ jQuery(".ffwd_sel_masonry_view_cont").show();
135
+ break;
136
+ case "videos":
137
+ jQuery(".ffwd_sel_thumbnail_view_cont").show();
138
+ jQuery(".ffwd_sel_masonry_view_cont").show();
139
+ break;
140
+ case "events":
141
+ jQuery(".ffwd_sel_blog_style_view_cont").show();
142
+ jQuery(".ffwd_sel_thumbnail_view_cont").show();
143
+ break;
144
+ default:
145
+ jQuery(".ffwd_sel_thumbnail_view_cont").show();
146
+ break;
147
+ }
148
+ }
149
+ }
150
+ </script>
151
+ <p>
152
+ <label for="<?php echo $id_title; ?>">Title:</label>
153
+ <input class="widefat" id="<?php echo $id_title; ?>" name="<?php echo $name_title; ?>'" type="text"
154
+ value="<?php echo $instance['title']; ?>"/>
155
+ </p>
156
+ <p id="p_ffwd_feeds">
157
+ <select name="<?php echo $ffwd_feed_name; ?>" id="<?php echo $id; ?>" class="widefat"
158
+ onchange="ffwd_view_type(this)">
159
+ <option value="0">Select facebook feed</option>
160
+ <?php
161
+ foreach ($ffwd_feeds as $ffwd_feed) {
162
+ ?>
163
+ <option
164
+ value="<?php echo $ffwd_feed->id; ?>" <?php echo(($instance['id'] == $ffwd_feed->id) ? 'selected="selected"' : ''); ?>
165
+ content_type="<?php echo $ffwd_feed->content_type; ?>"
166
+ content="<?php echo $ffwd_feed->content; ?>"><?php echo $ffwd_feed->name; ?></option>
167
+ <?php
168
+ }
169
+ ?>
170
+ </select>
171
+ </p>
172
+
173
+ <p>
174
+ <label for="<?php echo $id_count; ?>">Count:</label>
175
+ <input class="widefat" style="width:25%;" id="<?php echo $id_count; ?>" name="<?php echo $name_count; ?>'"
176
+ type="text" value="<?php echo $instance['count']; ?>"/>
177
+ </p>
178
+ <p>
179
+ <label style="display: block;" for="<?php echo $id_width; ?>">Dimensions <br>(Leave height empty blank if you do not intend to limit the height of the widget.):</label>
180
+ <input class="widefat" style="width:25%;" id="<?php echo $id_width; ?>" name="<?php echo $name_width; ?>'"
181
+ type="text" value="<?php echo $instance['width']; ?>"/> x
182
+ <input class="widefat" style="width:25%;" id="<?php echo $id_height; ?>" name="<?php echo $name_height; ?>'"
183
+ type="text" value="<?php echo $instance['height']; ?>"/> px
184
+ </p>
185
+
186
+ <script>
187
+ ffwd_view_type(document.getElementById("<?php echo $id; ?>"));
188
+ </script>
189
+ <?php
190
+ }
191
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/views/uninstall.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Uninstall_ffwd
5
+ */
6
+ class Uninstall_ffwd {
7
+
8
+ /**
9
+ * Display.
10
+ */
11
+ public function display() {
12
+ global $wpdb;
13
+ $prefix = $wpdb->prefix;
14
+ ?>
15
+ <form method="post" action="admin.php?page=uninstall_ffwd" style="width:99%;">
16
+ <?php wp_nonce_field('uninstall_ffwd', 'ffwd_nonce'); ?>
17
+ <h2></h2>
18
+ <div class="wrap">
19
+ <span class="uninstall_icon"></span>
20
+ <h2><?php _e( 'Uninstall Facebook Feed by 10Web', 'ffwd' ); ?></h2>
21
+ <p><?php _e( 'Deactivating Facebook Feed by 10Web plugin does not remove any data that may have been created. To completely remove this plugin, you can uninstall it here.', 'ffwd' ); ?></p>
22
+ <p style="color: red;">
23
+ <strong><?php _e( 'WARNING', 'ffwd' ); ?>:</strong>
24
+ <?php _e( 'Once uninstalled, this can\'t be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'ffwd' ); ?>
25
+ </p>
26
+ <p style="color: red">
27
+ <strong><?php _e( 'The following Database Tables will be deleted:', 'ffwd' ); ?></strong>
28
+ </p>
29
+ <table class="widefat">
30
+ <thead>
31
+ <tr>
32
+ <th><?php _e( 'Database Tables', 'ffwd' ); ?></th>
33
+ </tr>
34
+ </thead>
35
+ <tr>
36
+ <td valign="top">
37
+ <ol>
38
+ <li><?php echo $prefix; ?>wd_fb_info</li>
39
+ <li><?php echo $prefix; ?>wd_fb_data</li>
40
+ <li><?php echo $prefix; ?>wd_fb_option</li>
41
+ <li><?php echo $prefix; ?>wd_fb_theme</li>
42
+ <li><?php echo $prefix; ?>wd_fb_shortcode</li>
43
+ </ol>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ <p style="text-align: center;"><?php _e( 'Do you really want to uninstall Facebook Feed by 10Web?', 'ffwd' ); ?></p>
48
+ <p style="text-align: center;">
49
+ <input type="checkbox" name="Facebook Feed by 10Web" id="check_yes" value="yes" onclick="if (check_yes.checked) { jQuery('#wd_fb_uninstall_submit').prop('disabled', false); } else { jQuery('#wd_fb_uninstall_submit').prop('disabled', true); }" /><label for="check_yes"><?php _e( 'Yes', 'ffwd' ); ?></label>
50
+ </p>
51
+ <p style="text-align: center;">
52
+ <input type="submit" id="wd_fb_uninstall_submit" value="<?php _e( 'UNINSTALL', 'ffwd' ); ?>" class="button-primary" onclick="if (check_yes.checked) {
53
+ if (confirm('<?php _e( 'You are About to Uninstall Facebook Feed by 10Web from WordPress.', 'ffwd' ); ?>\n<?php _e( 'This Action Is Not Reversible.', 'ffwd' ); ?>')) {
54
+ spider_set_input_value('task', 'uninstall');
55
+ } else {
56
+ return false;
57
+ }
58
+ }
59
+ else {
60
+ return false;
61
+ }" disabled/>
62
+ </p>
63
+ </div>
64
+ <input id="task" name="task" type="hidden" value=""/>
65
+ </form>
66
+ <?php
67
+ }
68
+ }
css/ffwd_frontend.css CHANGED
@@ -55,30 +55,6 @@ div[class^="ffwd_title_spun"] a {
55
  -webkit-animation: spin 2.5s infinite linear;
56
  }
57
 
58
- .spider_popup_overlay,
59
- .footer-list-block .bwp_gallery .spider_popup_overlay,
60
- .footer-list-block .bwp_gallery_tags .spider_popup_overlay {
61
- cursor: pointer;
62
- display: none;
63
- height: 100%;
64
- left: 0;
65
- position: fixed;
66
- top: 0;
67
- width: 100%;
68
- z-index: 10100;
69
- }
70
-
71
- .spider_popup_close,
72
- .spider_popup_close_fullscreen {
73
- -moz-box-sizing: content-box !important;
74
- box-sizing: content-box !important;
75
- cursor: pointer;
76
- display: table;
77
- line-height: 0;
78
- position: absolute;
79
- z-index: 11100;
80
- }
81
-
82
  @-moz-keyframes spin {
83
  from {
84
  -moz-transform: rotate(0deg);
@@ -124,6 +100,29 @@ div[class^="ffwd_title_spun"] a {
124
  }
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
  #spider_popup_left {
129
  left: 0;
@@ -265,4 +264,4 @@ div[class^="ffwd_title_spun"] a {
265
  background-repeat: no-repeat;
266
  position: relative;
267
  top: 18px;
268
- }
55
  -webkit-animation: spin 2.5s infinite linear;
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  @-moz-keyframes spin {
59
  from {
60
  -moz-transform: rotate(0deg);
100
  }
101
  }
102
 
103
+ .spider_popup_overlay,
104
+ .footer-list-block .bwp_gallery .spider_popup_overlay,
105
+ .footer-list-block .bwp_gallery_tags .spider_popup_overlay {
106
+ cursor: pointer;
107
+ display: none;
108
+ height: 100%;
109
+ left: 0;
110
+ position: fixed;
111
+ top: 0;
112
+ width: 100%;
113
+ z-index: 10100;
114
+ }
115
+
116
+ .spider_popup_close,
117
+ .spider_popup_close_fullscreen {
118
+ -moz-box-sizing: content-box !important;
119
+ box-sizing: content-box !important;
120
+ cursor: pointer;
121
+ display: table;
122
+ line-height: 0;
123
+ position: absolute;
124
+ z-index: 11100;
125
+ }
126
 
127
  #spider_popup_left {
128
  left: 0;
264
  background-repeat: no-repeat;
265
  position: relative;
266
  top: 18px;
267
+ }
css/ffwd_shortcode.css CHANGED
@@ -22,6 +22,7 @@
22
  .tabs h4 { padding-left: 10px !important; }
23
 
24
  #display_panel .gallery_type select#wd_fb_feed { margin-top:15px; }
 
25
  .bwg_short_div * {
26
  font-size: 10px;
27
  }
22
  .tabs h4 { padding-left: 10px !important; }
23
 
24
  #display_panel .gallery_type select#wd_fb_feed { margin-top:15px; }
25
+
26
  .bwg_short_div * {
27
  font-size: 10px;
28
  }
css/ffwd_tables.css CHANGED
@@ -1,167 +1,168 @@
1
  .spider_ajax_loading {
2
- border: none !important;
3
- -webkit-animation: spin 2.5s infinite linear;
4
- -moz-animation: spin 2.5s infinite linear;
5
- -o-animation: spin 2.5s infinite linear;
6
- animation: spin 2.5s infinite linear;
7
  }
8
 
9
  @-moz-keyframes spin {
10
- 0% {
11
- -moz-transform: rotate(0deg);
12
- }
13
- 100% {
14
- -moz-transform: rotate(359deg);
15
- }
16
  }
17
 
18
  @-webkit-keyframes spin {
19
- 0% {
20
- -webkit-transform: rotate(0deg);
21
- }
22
- 100% {
23
- -webkit-transform: rotate(359deg);
24
- }
25
  }
26
 
27
  @-o-keyframes spin {
28
- 0% {
29
- -o-transform: rotate(0deg);
30
- }
31
- 100% {
32
- -o-transform: rotate(359deg);
33
- }
34
  }
35
 
36
  @-ms-keyframes spin {
37
- 0% {
38
- -ms-transform: rotate(0deg);
39
- }
40
- 100% {
41
- -ms-transform: rotate(359deg);
42
- }
43
  }
44
 
45
  @keyframes spin {
46
- 0% {
47
- transform: rotate(0deg);
48
- }
49
- 100% {
50
- transform: rotate(359deg);
51
- }
52
  }
53
 
54
  #TB_window,
55
  #TB_iframeContent {
56
- width: 800px !important;
57
- /*height: 500px !important;*/
58
  }
59
 
60
  #TB_window {
61
- margin-left: -400px !important;
62
  }
63
 
64
  .wrap * {
65
- font-size: 12px;
66
- font-family: sans-serif;
67
  }
68
 
 
69
  .input_th {
70
- margin-left: 0px !important;
71
- width: 160px !important;
72
- font-family: sans-serif;
73
  }
74
 
75
  .input_th2 {
76
- margin-left: 0px !important;
77
- width: 160px !important;
78
- margin-top: 5px;
79
- height: 19px;
80
  }
81
 
82
  .edit_input {
83
- height: 28px !important;
84
- padding-bottom: 7px !important;
85
  }
86
 
87
  .add_tag_th {
88
- padding-left: 21px;
89
- font-size: 12px;
90
- font-family: sans-serif;
91
  }
92
 
93
  .pointer {
94
- cursor: pointer;
95
  }
96
 
97
  .non_selectable {
98
- -webkit-touch-callout: none;
99
- -webkit-user-select: none;
100
- -khtml-user-select: none;
101
- -moz-user-select: none;
102
- -ms-user-select: none;
103
- user-select: none;
104
- margin: 2px;
105
  }
106
 
107
  .bwg_position_table td,
108
  .bwg_position_table input {
109
- border: 1px solid #CCCCCC;
110
- margin: 2px;
111
  }
112
 
113
  .spider_div_options {
114
- background: none repeat scroll 0 0 #FFFFFF;
115
 
116
- margin: 2px 0 0 0px;
117
- padding: 13px;
118
- min-height: 300px;
119
- min-width: 600px;
120
- vertical-align: top;
121
  }
122
 
123
  .gallery_type {
124
- background-color: #F4F4F4;
125
- border: 1px solid #8F8D8D;
126
- border-radius: 8px 8px 8px 8px;
127
- cursor: pointer;
128
- display: inline-block;
129
- font-size: 18px;
130
- height: 26px;
131
- padding-top: 10px;
132
- margin: 1px;
133
- text-align: center;
134
- vertical-align: middle;
135
- width: 180px;
136
  }
137
 
138
  .table_small_col {
139
- text-align: center !important;
140
- width: 45px;
141
  }
142
 
143
  .table_medium_col {
144
- text-align: center !important;
145
- width: 70px;
146
  }
147
 
148
  .table_big_col {
149
- text-align: center !important;
150
- width: 80px;
151
  }
152
 
153
  .table_large_col {
154
- text-align: center !important;
155
- width: 140px;
156
  }
157
 
158
  .table_medium_col_uncenter {
159
- width: 80px;
160
  }
161
 
162
  .table_extra_large_col {
163
- padding: 4px !important;
164
- width: 150px !important;
165
  }
166
 
167
  .first-page,
@@ -172,1069 +173,1070 @@
172
  .table_medium_col a,
173
  .table_big_col a,
174
  .table_small_col a {
175
- cursor: pointer;
176
  }
177
 
178
  .spider_word_wrap {
179
- word-wrap: normal;
180
  }
181
 
182
  .spider_description {
183
- color: #666666;
184
- font-size: 0.923em;
185
- line-height: 1.231em;
186
- margin: 2px 0 10px 2px;
187
  }
188
 
189
  .handle {
190
- background: url("../images/ffwd/button-icons2.png") 0px -299px no-repeat transparent;
191
- border: none;
192
- height: 18px;
193
- margin: 0 auto;
194
- vertical-align: middle;
195
- width: 18px;
196
  }
197
 
198
  .tag_icon {
199
- background-image: url("../images/tag-icon.png");
200
- background-repeat: no-repeat;
201
- border: none;
202
- float: left;
203
- height: 32px;
204
- margin: 7px 8px 0 0;
205
- width: 32px;
206
  }
207
 
208
  .wd-fb-icon {
209
- background-image: url("../images/ffwd/ffwd_logo_large.png");
210
- background-repeat: no-repeat;
211
- border: none;
212
- float: left;
213
- height: 55px;
214
- margin: 0px 30px 0 0;
215
- width: 72px;
216
  }
217
 
218
  .wd_fb_facebook_log_in {
219
- display: block;
220
- cursor: default;
221
- background-color: rgba(154, 154, 154, 0.62);
222
- margin-bottom: 6px;
223
- width: 204px;
224
- padding: 1px 7px;
225
- box-shadow: 0px 0px 1px #000000;
226
- font-size: 11px;
227
- text-decoration: none;
228
- color: aliceblue;
229
- font-style: italic;
230
  }
231
 
232
  .wd_fb_options_button {
233
- display: inline-block;
234
- background-color: rgb(74, 199, 255);
235
- padding: 4px 15px;
236
- box-shadow: 0px 0px 1px #000000;
237
- font-size: 13px;
238
- text-decoration: none;
239
- color: aliceblue;
240
  }
241
 
242
  .album-icon {
243
- background-image: url("../images/album-icon.png");
244
- background-repeat: no-repeat;
245
- border: none;
246
- float: left;
247
- height: 32px;
248
- margin: 7px 8px 0 0;
249
- width: 32px;
250
  }
251
 
252
  .option-icon {
253
- background-image: url("../images/ffwd/themes_options.png");
254
- background-repeat: no-repeat;
255
- border: none;
256
- float: left;
257
- height: 36px;
258
- margin: 7px 8px 0 0;
259
- width: 36px;
260
  }
261
 
262
  .theme_icon {
263
- background-image: url("../images/ffwd/themes_options.png");
264
- background-repeat: no-repeat;
265
- border: none;
266
- float: left;
267
- height: 36px;
268
- margin: 7px 8px 0 0;
269
- width: 36px;
270
- background-position: 0px -56px;
271
  }
272
 
273
  .comment_icon {
274
- background-image: url("../images/comment-icon.png");
275
- background-repeat: no-repeat;
276
- border: none;
277
- float: left;
278
- height: 32px;
279
- margin: 7px 8px 0 0;
280
- width: 32px;
281
  }
282
 
283
  .rating_icon {
284
- background-image: url("../images/rating-icon.png");
285
- background-repeat: no-repeat;
286
- border: none;
287
- float: left;
288
- height: 32px;
289
- margin: 7px 8px 0 0;
290
- width: 32px;
291
  }
292
 
293
  .uninstall_icon {
294
- background-image: url("../images/uninstall-icon.png");
295
- background-repeat: no-repeat;
296
- background-size: contain;
297
- border: none;
298
- float: left;
299
- height: 25px;
300
- margin: 0;
301
- width: 32px;
302
  }
303
 
304
  .connectedSortable {
305
- cursor: move;
306
  }
307
 
308
  .spider_label {
309
- font-weight: bold;
310
- width: 100px;
311
  }
312
 
313
  .spider_label_galleries {
314
- font-weight: bold;
315
- width: 180px;
316
  }
317
 
318
  .spider_fieldset .spider_label {
319
- font-weight: bold;
320
- vertical-align: top;
321
- width: 150px;
322
  }
323
 
324
  .spider_label_options {
325
- font-weight: bold;
326
- vertical-align: top;
327
- width: 185px;
328
  }
329
 
330
  .spider_int_input {
331
- width: 80px;
332
  }
333
 
334
  .spider_char_input {
335
- width: 115px;
336
  }
337
 
338
  .spider_text_input {
339
- width: 190px;
340
  }
341
 
342
  .spider_slider_div {
343
- display: inline-block;
344
- vertical-align: middle;
345
- width: 140px;
346
  }
347
 
348
  .spider_slider_percentage,
349
  .spider_slider_percentage input,
350
  .spider_slider_percentage input :focus {
351
- background: transparent;
352
- border: none;
353
- color: #00AEEF;
354
- display: inline;
355
- font-weight: bold;
356
- text-align: right;
357
- vertical-align: middle;
358
- width: 30px;
359
  }
360
 
361
  .updated,
362
  .error {
363
- margin: 5px 0 2px !important;
364
  }
365
 
366
  .buttons_div {
367
- clear: both;
368
- float: right;
369
- margin: 5px 0;
370
  }
371
 
372
  .buttons_div_left {
373
- float: left;
374
- margin: 5px 0;
375
  }
376
 
377
  .buttons_div_right {
378
- float: right;
379
- margin: 5px 0;
380
  }
381
 
382
  .spider_delete_img {
383
- background-image: url("../images/delete.png");
384
- border: none;
385
- cursor: pointer;
386
- display: inline-block;
387
- vertical-align: middle;
388
- height: 14px;
389
- width: 14px;
390
  }
391
 
392
  .spider_delete_img_small {
393
- background-image: url("../images/delete.png");
394
- background-size: 10px auto;
395
- border: medium none;
396
- cursor: pointer;
397
- display: inline-block;
398
- height: 10px;
399
- margin-top: 2px;
400
- vertical-align: middle;
401
- width: 10px;
402
  }
403
 
404
  .spider_fieldset {
405
- background: none repeat scroll 0 0 #FFFFFF;
406
- border: 1px solid #3B5A9A;
407
- display: none;
408
- float: left;
409
 
410
- padding: 13px;
411
- width: 97%;
412
  }
413
 
414
  .spider_type_fieldset {
415
- background: none repeat scroll 0 0 #ffffff;
416
 
417
- display: none;
418
- float: left;
419
- width: 100%;
420
  }
421
 
422
  .spider_child_fieldset {
423
- background: none repeat scroll 0 0 #FFFFFF;
424
- border: 1px solid #3B5A9A;
425
- float: left;
426
- margin: 4px;
427
- width: 30%;
428
- padding: 13px;
429
- display: block;
430
  }
431
 
432
  .spider_table td {
433
- padding: 0;
434
- vertical-align: middle;
435
  }
436
 
437
  .spider_ctrls {
438
- padding: 4px;
439
- text-align: center;
440
- width: 40px;
441
  }
442
 
443
  .theme_type {
444
- font-size: 17px;
445
- float: left;
446
- padding: 10px;
447
- background-color: #fff;
448
- border: 1px solid #FBFBFB;
449
- border-bottom: none;
450
- margin-right: 0px;
451
- position: relative;
452
- z-index: 2;
453
- top: 1px;
454
- cursor: pointer;
455
  }
456
 
457
  .ui-slider-handle {
458
- cursor: pointer !important;
459
  }
460
 
461
  .thumb {
462
- border: 1px solid #CCCCCC;
463
- max-height: 120px;
464
- max-width: 120px;
465
  }
466
 
467
  .fileDescription {
468
- color: #666666;
469
- cursor: pointer;
470
- font-family: sans-serif;
471
- font-size: 12px;
472
  }
473
 
474
  .filename {
475
- font-size: 13px;
476
  }
477
 
478
  .tag_div {
479
- background-clip: padding-box;
480
- background-color: #F3F3F3;
481
- border: 1px solid #AAAAAA;
482
- border-radius: 3px 3px 3px 3px;
483
- box-shadow: 0 0 2px #FFFFFF inset, 0 1px 0 rgba(0, 0, 0, 0.05);
484
- color: #666666;
485
- line-height: 13px;
486
- margin: 2px 0;
487
- padding: 2px 5px 2px 5px;
488
- width: 132px;
489
  }
490
 
491
  .tags_div {
492
- overflow-y: auto;
493
- height: 65px;
494
  }
495
 
496
  .tag_name {
497
- width: 118px;
498
  }
499
 
500
  .edit_thumb {
501
- cursor: pointer;
502
  }
503
 
504
  .spider_rotate {
505
- border-radius: 2px;
506
- border: 1px solid #FFFFFF;
507
- height: 30px;
508
  }
509
 
510
  .spider_search_value {
511
- height: 2em;
512
- margin: 0 0 4px;
513
  }
514
 
515
  #th_order,
516
  .spider_order {
517
- display: none;
518
  }
519
 
520
  #add_embed_help {
521
- /*height: 325px;*/
522
- height: 290px;
523
- width: 672px;
524
- top: 40%;
525
  }
526
 
527
  .bwg_add_embed,
528
  .bwg_resize_image {
529
- display: none;
530
- padding: 10px;
531
- height: 60px;
532
- background-color: #FFFFFF;
533
- border: 1px solid #999999;
534
- top: 50%;
535
- position: fixed;
536
- left: 50%;
537
- text-align: left;
538
- z-index: 100000;
539
- border-radius: 3px;
540
- margin-top: -45px;
541
  }
542
 
543
  .bwg_add_embed {
544
- margin-left: -340px;
545
  }
546
 
547
  .bwg_resize_image {
548
- margin-left: -200px;
549
  }
550
 
551
  .bwg_bulk_embed {
552
- display: none;
553
- padding: 10px;
554
- height: 160px;
555
- background-color: #FFFFFF;
556
- border: 1px solid #999999;
557
- top: 40%;
558
- position: fixed;
559
- left: 55%;
560
- text-align: left;
561
- z-index: 100000;
562
- border-radius: 3px;
563
- margin-top: -45px;
564
- margin-left: -340px;
565
  }
566
 
567
  #add_embed input[type="text"] {
568
- width: 500px;
569
  }
570
 
571
  .bwg_resize_image input[type="text"] {
572
- width: 60px;
573
  }
574
 
575
  .bwg_opacity_media {
576
- display: none;
577
- background-color: #000000;
578
- opacity: 0.75;
579
- filter: Alpha(opacity=75);
580
- position: fixed;
581
- top: 0;
582
- left: 0;
583
- width: 100%;
584
- height: 100%;
585
- z-index: 99998;
586
  }
587
 
588
  .widefat .check-column {
589
- text-align: center;
590
  }
591
 
592
  #ffwd_info_form input[type=checkbox]:checked:before {
593
- content: '\2022' !important;
594
- border-radius: 0px !important;
595
- font-size: 21px !important;
596
- width: 8px !important;
597
- height: 8px !important;
598
- margin: 3px !important;
599
- line-height: 22px !important;
600
- background-color: #3B5A9A !important;
601
- text-indent: -9999px !important;
602
  }
603
 
604
  #ffwd_info_form input[type=checkbox], #ffwd_info_form input[type=radio] {
605
- border: 1px solid #E5E5E5 !important;
606
- -webkit-appearance: none;
607
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
608
- box-shadow: none;
609
- -webkit-transition: none;
610
- transition: none;
611
  }
612
 
613
  #ffwd_info_form input[type=radio]:checked:before {
614
- content: '\2022';
615
- text-indent: -9999px;
616
- -webkit-border-radius: 50px;
617
- border-radius: 50px;
618
- font-size: 24px;
619
- width: 8px;
620
- height: 8px;
621
- margin: 3px;
622
- line-height: 16px;
623
- background-color: #3B5A9A;
624
  }
625
 
626
  #themes_form input[type=checkbox]:checked:before {
627
- content: '\2022' !important;
628
- border-radius: 0px !important;
629
- font-size: 21px !important;
630
- width: 8px !important;
631
- height: 8px !important;
632
- margin: 3px !important;
633
- line-height: 22px !important;
634
- background-color: #3B5A9A !important;
635
- text-indent: -9999px !important;
636
  }
637
 
638
  #themes_form input[type=checkbox], #ffwd_info_form input[type=radio] {
639
- border: 1px solid #E5E5E5 !important;
640
- -webkit-appearance: none;
641
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
642
- box-shadow: none;
643
- -webkit-transition: none;
644
- transition: none;
645
  }
646
 
647
  #themes_form input[type=radio]:checked:before {
648
- content: '\2022';
649
- text-indent: -9999px;
650
- -webkit-border-radius: 50px;
651
- border-radius: 50px;
652
- font-size: 24px;
653
- width: 8px;
654
- height: 8px;
655
- margin: 3px;
656
- line-height: 16px;
657
- background-color: #3B5A9A;
658
  }
659
 
660
  .ffwd_login_button, .ffwd_login_button:hover {
661
- color: #3B5A9A;
662
- text-decoration: none;
663
 
664
  }
665
 
666
-
667
  .ffwd-button-secondary {
668
- background-color: #ffffff;
669
- padding: 6px;
670
- color: #7A7A7A;
671
- font-size: 12px;
672
- border: 1px solid #E7E7E7;
673
- cursor: pointer;
674
- outline: none;
675
  }
676
 
677
  .ffwd-button-secondary:focus {
678
- outline: none;
679
  }
680
 
681
- #ffwd_info_form a,#themes_form a {
682
- color: #3B5A9A;
683
 
684
  }
685
 
686
- #ffwd_info_form th, #ffwd_info_form th span ,#themes_form th, #themes_form th span {
687
- color: #737373;
688
 
689
  }
690
 
691
  .ffwd-button-primary {
692
- background-color: #3B5A9A;
693
- color: #fff !important;
694
- padding: 6px;
695
- border: 1px solid #516CA4;
696
- border-radius: 2px;
697
- text-decoration: none;
698
- cursor:pointer;
699
  }
700
 
701
  .ffwd_plugin_header {
702
- background-color: #fff;
703
- padding: 12px 8px;
704
- clear:both;
705
  }
706
 
707
  h2.ffwd_page_name {
708
- color: #5A5D61;
709
- font-size: 21px;
710
- font-weight: 400;
711
- padding: 10px 15px 9px 0;
712
- line-height: 32px;
713
- margin: 0;
714
  }
715
 
716
  .ffwd_create_new_link {
717
- color: #5A5D61 !important;
718
- text-decoration: none;
719
- font-size: 21px;
720
  }
721
 
722
  .ffwd_create_new_link span {
723
- color: #EBEBEB;
724
 
725
  }
726
 
727
- .ffwd-button-save
728
- {
729
- background-image: url("../images/ffwd/button-icons.png");
730
- background-repeat: no-repeat;
731
- padding-left: 32px;
732
- background-position: 6px 3px;
733
- }
734
- .ffwd-button-apply
735
- {
736
- background-image: url("../images/ffwd/button-icons.png");
737
- background-repeat: no-repeat;
738
- padding-left: 32px;
739
- background-position: 6px -22px;
740
  }
741
 
742
- .ffwd-button-cancel
743
- {
744
- background-image: url("../images/ffwd/button-icons.png");
745
- background-repeat: no-repeat;
746
- padding-left: 24px;
747
- background-position: 6px -45px;
748
  }
749
 
750
- .ffwd-button-reset
751
- {
752
- background-image: url("../images/ffwd/button-icons.png");
753
- background-repeat: no-repeat;
754
- padding-left: 32px;
755
- background-position: 6px -70px;
756
  }
757
 
758
-
759
- .ffwd-button-show-order
760
- {
761
- background-image: url("../images/ffwd/button-icons2.png");
762
- background-repeat: no-repeat;
763
- padding-left: 32px;
764
- background-position: 6px -239px;
765
  }
766
 
767
- .ffwd-button-show-order:hover
768
- {
769
- background-image: url("../images/ffwd/button-icons2.png");
770
- background-repeat: no-repeat;
771
- padding-left: 32px;
772
- background-position: 6px -268px;
773
  }
774
 
775
- .ffwd-button-save-order
776
- {
777
- background-image: url("../images/ffwd/button-icons2.png");
778
- background-repeat: no-repeat;
779
- padding-left: 32px;
780
- background-position: 6px -65px;
781
  }
782
 
783
- .ffwd-button-save-order:hover
784
- {
785
- background-image: url("../images/ffwd/button-icons2.png");
786
- background-repeat: no-repeat;
787
- padding-left: 32px;
788
- background-position: 6px -94px;
789
  }
790
 
791
-
792
- .ffwd-button-publish
793
- {
794
- background-image: url("../images/ffwd/button-icons2.png");
795
- background-repeat: no-repeat;
796
- padding-left: 32px;
797
- background-position: 6px -180px;
798
  }
799
 
800
- .ffwd-button-publish:hover
801
- {
802
- background-image: url("../images/ffwd/button-icons2.png");
803
- background-repeat: no-repeat;
804
- padding-left: 32px;
805
- background-position: 6px -209px
806
  }
807
 
808
- .ffwd-button-unpublish
809
- {
810
- background-image: url("../images/ffwd/button-icons2.png");
811
- background-repeat: no-repeat;
812
- padding-left: 32px;
813
- background-position: 6px -10px;
814
  }
815
 
816
- .ffwd-button-unpublish:hover
817
- {
818
- background-image: url("../images/ffwd/button-icons2.png");
819
- background-repeat: no-repeat;
820
- padding-left: 32px;
821
- background-position: 6px -39px;
822
- }
823
- .ffwd-button-delete
824
- {
825
- background-image: url("../images/ffwd/button-icons2.png");
826
- background-repeat: no-repeat;
827
- padding-left: 32px;
828
- background-position: 6px -122px;
829
  }
830
 
831
- .ffwd-button-delete:hover
832
- {
833
- background-image: url("../images/ffwd/button-icons2.png");
834
- background-repeat: no-repeat;
835
- padding-left: 32px;
836
- background-position: 6px -151px;
837
  }
838
 
839
- .ffwd-button-add-new
840
- {
841
- background-image: url("../images/ffwd/add_new.png");
842
- background-repeat: no-repeat;
843
- padding-left: 32px;
844
- background-position: 6px 5px;
845
  }
846
 
847
- .ffwd_pro_only
848
- {
849
- font-size: 10px;
850
- background-color: #888888;
851
- padding: 2px;
852
- border: 1px solid black;
853
- color: white;
854
- border-radius: 4px;
855
  }
856
 
857
-
858
-
859
- .ffwd-right {
860
- float: right;
 
861
  }
862
- .ffwd-left {
863
- float: left;
 
 
 
 
 
 
 
 
 
864
  }
865
 
 
 
 
866
 
 
 
 
867
 
868
- .wd-cell-valign-middle{
869
- vertical-align:middle;
870
  }
871
 
872
- .wd-clear:after{
873
- clear:both;
874
- content:"";
875
- display:table;
876
  }
877
 
 
 
 
878
 
879
- .wd-table{
880
- display:table;
 
 
881
  }
882
 
883
- .wd-cell{
884
- display:table-cell;
885
  }
886
 
 
 
 
887
 
888
  .ffwd-cell-valign-middle {
889
- vertical-align: middle;
890
  }
891
 
892
  .ffwd-cell {
893
- display: table-cell;
894
  }
895
 
896
-
897
-
898
- div#ffwd_featurs_tables {
899
- display: inline-block;
900
- font-size: 13px;
901
- padding-top: 95px;
902
- text-align: left;
903
- float: left;
904
  }
905
 
906
- div#ffwd_ffwd_featurs_tables div {
907
- vertical-align: top;
908
  }
909
 
910
- div#ffwd_featurs_table1 {
911
- background-color: rgb(254, 254, 254);
912
- display: inline-block;
913
- position: relative;
914
- vertical-align: top;
915
- width: 380px;
916
- height: 684px;
917
- z-index: 10;
918
  }
919
 
920
- div#ffwd_featurs_table1 span::after {
921
- background-image: url("../images/arrow3.png");
922
- background-position: center center;
923
- background-repeat: no-repeat;
924
- content: "";
925
- display: inline-block;
926
- float: right;
927
- height: 37px;
928
- position: relative;
929
- right: -21px;
930
- top: -8px;
931
- width: 26px;
932
  }
933
 
934
- div#ffwd_featurs_table1 span {
935
- border-left: 1px solid #e5e5e5;
936
- border-right: 1px solid #e5e5e5;
937
- border-top: 1px solid #e5e5e5;
938
- color: #545454;
939
- background-color: white;
940
- display: block;
941
- height: 21px;
942
- padding: 8px;
943
- text-align: left;
944
  }
945
 
946
- div#ffwd_featurs_table1 span:last-child,
947
- div#ffwd_featurs_table2 span:last-child,
948
- div#ffwd_featurs_table3 span:last-child {
949
- border-bottom: 1px solid #e5e5e5;
950
  }
951
 
952
- div#ffwd_featurs_table2 {
953
- background-color: rgba(255, 255, 255, 0.9);
954
- display: inline-block;
955
- position: relative;
956
- top: -72px;
957
- width: 180px;
958
  }
959
 
960
- div#ffwd_featurs_table2 span:first-child,
961
- div#ffwd_featurs_table3 span:first-child {
962
- color: #000;
963
- font-size: 22px;
964
- font-weight: bold;
965
- padding-bottom: 14px;
966
- padding-top: 2px;
967
- border-top: 1px solid #e5e5e5;
968
- border-left: 1px solid #e5e5e5;
969
- border-right: 1px solid #e5e5e5;
970
- height: 39px;
971
- padding-top: 18px;
972
  }
973
 
974
- div#ffwd_featurs_table2 span:first-child {
975
- border-left: 1px solid #e5e5e5 !important;
976
  }
977
 
978
- div#ffwd_featurs_table2 span {
979
- border-left: none !important;
 
 
980
  }
981
 
982
- div#ffwd_featurs_table2 span,
983
- div#ffwd_featurs_table3 span {
984
- border-top: 1px solid #e5e5e5;
985
- border-right: 1px solid #e5e5e5;
986
- border-left: 1px solid #e5e5e5;
987
- color: #545454;
988
- display: block;
989
- height: 21px;
990
- padding: 8px;
991
- text-align: center;
992
  }
993
 
994
- .download a {
995
- background-color: #fff;
996
- border: 6px solid #dddddd;
997
- border-radius: 50%;
998
- box-shadow: 0 0 0 7px #eeeeee;
999
- color: #21439c;
1000
- cursor: pointer;
1001
- display: inline-block;
1002
- font-size: 14px;
1003
- font-style: italic;
1004
- font-weight: bold;
1005
- margin-top: -4px;
1006
- outline: 0 none;
1007
- padding: 32px 9px 32px 2px;
1008
- text-align: center;
1009
- text-decoration: none;
1010
- transition-duration: 0.6s;
1011
- transition-property: border-color;
1012
- transition-timing-function: linear;
1013
- width: 72px;
1014
  }
1015
 
1016
- div#ffwd_featurs_table3 {
1017
- background-color: rgba(255, 255, 255, 0.6);
1018
- display: inline-block;
1019
- position: relative;
1020
- top: -72px;
1021
- width: 180px;
1022
- }
1023
 
1024
- div#ffwd_featurs_table2 span.yes,
1025
- div#ffwd_featurs_table3 span.yes {
1026
- background-image: url("../images/plus.png");
1027
- background-position: center center;
1028
- background-repeat: no-repeat;
1029
  }
1030
 
1031
- span.no {
1032
- background-image: url("../images/minus.png");
1033
- background-position: center center;
1034
- background-repeat: no-repeat;
 
 
 
 
 
1035
  }
1036
 
1037
- .download input[type="submit"]:hover,
1038
- .download a:hover {
1039
- border-color: #F4762A;
 
 
 
 
 
 
1040
  }
1041
 
1042
- #ffwd_featurs_tables span.download {
1043
- height: 40px !important;
1044
- border-bottom: 1px solid #e5e5e5 !important;
1045
- border-left: 1px solid #e5e5e5 !important;
1046
  }
1047
 
1048
- .price_big {
1049
- color: #F47629;
1050
- font-size: 22px;
 
 
 
 
 
 
 
 
1051
  }
1052
 
1053
- .price {
1054
- display: block;
1055
- color: #F47629;
1056
  }
1057
 
1058
- .ffwd_upgrade{
1059
- clear: both;
1060
- padding: 15px;
1061
- background: #fff;
1062
- color: #6e7990;
1063
- font-size: 14px;
1064
- font-weight: bold;
1065
- line-height: 30px;
1066
  }
1067
 
1068
- .ffwd_upgrade .wd-cell:first-child{
1069
- padding-right: 14px;
1070
- }
1071
- .ffwd_upgrade .wd-cell:first-child img{
1072
- vertical-align:middle;
1073
  }
1074
- .ffwd_upgrade .wd-cell:first-child a{
1075
- color: #72777c !important;
 
 
 
 
 
1076
  }
1077
- .ffwd_upgrade .wd-cell:last-child{
1078
- background: #45A6B7;
 
1079
  }
1080
- .ffwd_upgrade .wd-cell:last-child a{
1081
- color: #fff !important;
1082
- padding: 18px;
 
 
 
1083
  }
1084
 
1085
- .ffwd_upgrade a, .ffwd_upgrade a:hover {
1086
- text-decoration: none !important;
1087
  }
1088
- a.button-primary
1089
- {
1090
- color: #FFFFFF !important;
 
 
 
 
 
1091
  }
1092
 
1093
- div.ffwd_error {
1094
- color: #a94442;
1095
- background-color: #f2dede;
1096
- padding: 15px;
1097
- margin-bottom: 20px;
1098
- border: 1px solid #ebccd1;
1099
- border-radius: 4px;
1100
- font-size:15px
1101
  }
1102
 
1103
- .ffwd_error p,
1104
- .ffwd_error a
1105
- {
1106
- margin: 0 !important;
1107
- font-size: 14px;
1108
  }
1109
 
 
 
 
 
 
 
 
 
 
1110
 
1111
- .spider_div_options .spider_description, .spider_div_options .spider_description a{
1112
- font-size: 15px;
 
 
 
 
 
 
 
 
 
 
1113
  }
1114
- .spider_div_options .spider_label_options label{
1115
- font-size: 15px;
 
 
 
 
 
 
 
 
 
1116
  }
1117
 
1118
- .ffwd_p .ffwd_set_l label{
1119
- font-size: 15px;
 
 
1120
  }
1121
- .ffwd_p .description{
1122
- font-size: 15px;
 
 
 
 
 
1123
  }
1124
 
1125
- .ffwd_reset_cache_res{
1126
- font-size: 19px;
1127
- margin: 4px 0px 0px 12px;
1128
- display: inline-block;
 
 
 
 
 
 
 
 
1129
  }
1130
 
1131
- #ffwd_login_button{
1132
- background-color: #4267b2;
1133
- color: #ffffff !important;
1134
- display: inline-block;
1135
- text-decoration: none;
1136
- padding: 7px 12px 7px 12px;
1137
- font-size: 14px;
1138
- margin-bottom: 10px;
1139
  }
1140
 
1141
- #ffwd_login_button i{
1142
- font-family: dashicons;
1143
- font-size: 20px;
1144
  }
1145
 
1146
- /*#ffwd_info_form .ffwd_page_list_notice{*/
1147
- /*margin-top: 15px !important;*/
1148
- /*margin-bottom: 15px !important;*/
1149
- /*}*/
 
 
 
 
 
 
 
1150
 
1151
- #ffwd_info_form .ffwd_page_list_notice p,
1152
- #ffwd_info_form .ffwd_page_list_notice a{
1153
- font-size: 14px;
 
 
 
1154
  }
1155
 
1156
- #ffwd_login_popup{
1157
- position: fixed;
1158
- z-index: 999;
1159
- width: 100%;
1160
- top: 0;
1161
- right: 0;
1162
- bottom: 0;
1163
- left: 0;
1164
- background: rgba(0,0,0,0.3);
1165
  }
1166
 
1167
- .ffwd_login_popup_content{
1168
- position: absolute;
1169
- top: 180px;
1170
- left: 50%;
1171
- width: 380px;
1172
- margin: 0 0 0 -195px;
1173
- padding: 20px 40px;
1174
- background: #fff;
1175
- text-align: center;
1176
  }
1177
 
1178
- .ffwd_login_popup_content p{
1179
- font-size: 14px;
1180
- line-height: 1.6;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1181
  }
1182
 
1183
- #ffwd_login_popup_cancle_btn,
1184
- #ffwd_login_popup_continue_btn {
1185
- display: inline-block;
1186
- padding: 0 21px 0 20px;
1187
- height: 45px;
1188
- line-height: 44px;
1189
- text-decoration: none;
1190
- font-size: 14px;
1191
- margin-right: 5px;
1192
- clear: both;
1193
- cursor: pointer;
1194
  }
1195
 
1196
- #ffwd_login_popup_cancle_btn{
1197
- background: #ddd;
1198
- color: #555;
 
1199
  }
1200
 
1201
- #ffwd_login_popup_continue_btn {
1202
- background: #4267b2;
1203
- color: #e9eef3;
1204
  }
1205
 
1206
- #ffwd_login_popup_notice{
1207
- font-size: 11px;
1208
- margin-top: 25px;
1209
  }
1210
 
1211
- #ffwd_page_img{
1212
- width: 29px;
1213
- height: 29px;
1214
- display: inline-block;
1215
- position: absolute;
1216
- margin-left: 4px;
 
 
 
1217
  }
1218
 
1219
- #wpbody-content>div:not(.wrap):not(.wd_topic), .wrap .notice:not(.wd-notice) {
1220
- display: none;
1221
  }
1222
- #wpbody-content .notice.notice-error,
1223
- #wpbody-content .notice.notice-success{
1224
- display: block !important;
1225
  }
1226
 
1227
- #toplevel_page_options_ffwd.current a div img { /*conflict with single item menu*/
1228
- opacity: 1;
1229
  }
1230
 
1231
- .ffwd-access-token-missing {
1232
- margin: 10px 0 50px 0;
1233
- line-height: 17px;
1234
- font-size: 13px;
1235
- color: rgba(50, 58, 69, 1);
1236
  }
1237
 
1238
- .ffwd-access-token-missing p {
1239
- margin: 0;
 
1240
  }
 
 
 
 
1
  .spider_ajax_loading {
2
+ border: none !important;
3
+ -webkit-animation: spin 2.5s infinite linear;
4
+ -moz-animation: spin 2.5s infinite linear;
5
+ -o-animation: spin 2.5s infinite linear;
6
+ animation: spin 2.5s infinite linear;
7
  }
8
 
9
  @-moz-keyframes spin {
10
+ from {
11
+ -moz-transform: rotate(0deg);
12
+ }
13
+ to {
14
+ -moz-transform: rotate(359deg);
15
+ }
16
  }
17
 
18
  @-webkit-keyframes spin {
19
+ from {
20
+ -webkit-transform: rotate(0deg);
21
+ }
22
+ to {
23
+ -webkit-transform: rotate(359deg);
24
+ }
25
  }
26
 
27
  @-o-keyframes spin {
28
+ from {
29
+ -o-transform: rotate(0deg);
30
+ }
31
+ to {
32
+ -o-transform: rotate(359deg);
33
+ }
34
  }
35
 
36
  @-ms-keyframes spin {
37
+ from {
38
+ -ms-transform: rotate(0deg);
39
+ }
40
+ to {
41
+ -ms-transform: rotate(359deg);
42
+ }
43
  }
44
 
45
  @keyframes spin {
46
+ from {
47
+ transform: rotate(0deg);
48
+ }
49
+ to {
50
+ transform: rotate(359deg);
51
+ }
52
  }
53
 
54
  #TB_window,
55
  #TB_iframeContent {
56
+ width: 800px !important;
57
+ /*height: 500px !important;*/
58
  }
59
 
60
  #TB_window {
61
+ margin-left: -400px !important;
62
  }
63
 
64
  .wrap * {
65
+ font-size: 12px;
66
+ font-family: sans-serif;
67
  }
68
 
69
+
70
  .input_th {
71
+ margin-left: 0px !important;
72
+ width: 160px !important;
73
+ font-family: sans-serif;
74
  }
75
 
76
  .input_th2 {
77
+ margin-left: 0px !important;
78
+ width: 160px !important;
79
+ margin-top: 5px;
80
+ height: 19px;
81
  }
82
 
83
  .edit_input {
84
+ height: 28px !important;
85
+ padding-bottom: 7px !important;
86
  }
87
 
88
  .add_tag_th {
89
+ padding-left: 21px;
90
+ font-size: 12px;
91
+ font-family: sans-serif;
92
  }
93
 
94
  .pointer {
95
+ cursor: pointer;
96
  }
97
 
98
  .non_selectable {
99
+ -webkit-touch-callout: none;
100
+ -webkit-user-select: none;
101
+ -khtml-user-select: none;
102
+ -moz-user-select: none;
103
+ -ms-user-select: none;
104
+ user-select: none;
105
+ margin: 2px;
106
  }
107
 
108
  .bwg_position_table td,
109
  .bwg_position_table input {
110
+ border: 1px solid #CCCCCC;
111
+ margin: 2px;
112
  }
113
 
114
  .spider_div_options {
115
+ background: none repeat scroll 0 0 #FFFFFF;
116
 
117
+ margin: 2px 0 0 0px;
118
+ padding: 13px;
119
+ min-height: 300px;
120
+ min-width: 600px;
121
+ vertical-align: top;
122
  }
123
 
124
  .gallery_type {
125
+ background-color: #F4F4F4;
126
+ border: 1px solid #8F8D8D;
127
+ border-radius: 8px 8px 8px 8px;
128
+ cursor: pointer;
129
+ display: inline-block;
130
+ font-size: 18px;
131
+ height: 26px;
132
+ padding-top: 10px;
133
+ margin: 1px;
134
+ text-align: center;
135
+ vertical-align: middle;
136
+ width: 180px;
137
  }
138
 
139
  .table_small_col {
140
+ text-align: center !important;
141
+ width: 45px;
142
  }
143
 
144
  .table_medium_col {
145
+ text-align: center !important;
146
+ width: 70px;
147
  }
148
 
149
  .table_big_col {
150
+ text-align: center !important;
151
+ width: 80px;
152
  }
153
 
154
  .table_large_col {
155
+ text-align: center !important;
156
+ width: 140px;
157
  }
158
 
159
  .table_medium_col_uncenter {
160
+ width: 80px;
161
  }
162
 
163
  .table_extra_large_col {
164
+ padding: 4px !important;
165
+ width: 150px !important;
166
  }
167
 
168
  .first-page,
173
  .table_medium_col a,
174
  .table_big_col a,
175
  .table_small_col a {
176
+ cursor: pointer;
177
  }
178
 
179
  .spider_word_wrap {
180
+ word-wrap: normal;
181
  }
182
 
183
  .spider_description {
184
+ color: #666666;
185
+ font-size: 0.923em;
186
+ line-height: 1.231em;
187
+ margin: 2px 0 10px 2px;
188
  }
189
 
190
  .handle {
191
+ background: url("../images/ffwd/button-icons2.png") 0px -299px no-repeat transparent;
192
+ border: none;
193
+ height: 18px;
194
+ margin: 0 auto;
195
+ vertical-align: middle;
196
+ width: 18px;
197
  }
198
 
199
  .tag_icon {
200
+ background-image: url("../images/tag-icon.png");
201
+ background-repeat: no-repeat;
202
+ border: none;
203
+ float: left;
204
+ height: 32px;
205
+ margin: 7px 8px 0 0;
206
+ width: 32px;
207
  }
208
 
209
  .wd-fb-icon {
210
+ background-image: url("../images/ffwd/ffwd_logo_large.png");
211
+ background-repeat: no-repeat;
212
+ border: none;
213
+ float: left;
214
+ height: 55px;
215
+ margin: 0px 30px 0 0;
216
+ width: 72px;
217
  }
218
 
219
  .wd_fb_facebook_log_in {
220
+ display: block;
221
+ cursor: default;
222
+ background-color: rgba(154, 154, 154, 0.62);
223
+ margin-bottom: 6px;
224
+ width: 204px;
225
+ padding: 1px 7px;
226
+ box-shadow: 0px 0px 1px #000000;
227
+ font-size: 11px;
228
+ text-decoration: none;
229
+ color: aliceblue;
230
+ font-style: italic;
231
  }
232
 
233
  .wd_fb_options_button {
234
+ display: inline-block;
235
+ background-color: rgb(74, 199, 255);
236
+ padding: 4px 15px;
237
+ box-shadow: 0px 0px 1px #000000;
238
+ font-size: 13px;
239
+ text-decoration: none;
240
+ color: aliceblue;
241
  }
242
 
243
  .album-icon {
244
+ background-image: url("../images/album-icon.png");
245
+ background-repeat: no-repeat;
246
+ border: none;
247
+ float: left;
248
+ height: 32px;
249
+ margin: 7px 8px 0 0;
250
+ width: 32px;
251
  }
252
 
253
  .option-icon {
254
+ background-image: url("../images/ffwd/themes_options.png");
255
+ background-repeat: no-repeat;
256
+ border: none;
257
+ float: left;
258
+ height: 36px;
259
+ margin: 7px 8px 0 0;
260
+ width: 36px;
261
  }
262
 
263
  .theme_icon {
264
+ background-image: url("../images/ffwd/themes_options.png");
265
+ background-repeat: no-repeat;
266
+ border: none;
267
+ float: left;
268
+ height: 36px;
269
+ margin: 7px 8px 0 0;
270
+ width: 36px;
271
+ background-position: 0px -56px;
272
  }
273
 
274
  .comment_icon {
275
+ background-image: url("../images/comment-icon.png");
276
+ background-repeat: no-repeat;
277
+ border: none;
278
+ float: left;
279
+ height: 32px;
280
+ margin: 7px 8px 0 0;
281
+ width: 32px;
282
  }
283
 
284
  .rating_icon {
285
+ background-image: url("../images/rating-icon.png");
286
+ background-repeat: no-repeat;
287
+ border: none;
288
+ float: left;
289
+ height: 32px;
290
+ margin: 7px 8px 0 0;
291
+ width: 32px;
292
  }
293
 
294
  .uninstall_icon {
295
+ background-image: url("../images/uninstall-icon.png");
296
+ background-repeat: no-repeat;
297
+ background-size: contain;
298
+ border: none;
299
+ float: left;
300
+ height: 25px;
301
+ margin: 0;
302
+ width: 32px;
303
  }
304
 
305
  .connectedSortable {
306
+ cursor: move;
307
  }
308
 
309
  .spider_label {
310
+ font-weight: bold;
311
+ width: 100px;
312
  }
313
 
314
  .spider_label_galleries {
315
+ font-weight: bold;
316
+ width: 180px;
317
  }
318
 
319
  .spider_fieldset .spider_label {
320
+ font-weight: bold;
321
+ vertical-align: top;
322
+ width: 150px;
323
  }
324
 
325
  .spider_label_options {
326
+ font-weight: bold;
327
+ vertical-align: top;
328
+ width: 185px;
329
  }
330
 
331
  .spider_int_input {
332
+ width: 80px;
333
  }
334
 
335
  .spider_char_input {
336
+ width: 115px;
337
  }
338
 
339
  .spider_text_input {
340
+ width: 190px;
341
  }
342
 
343
  .spider_slider_div {
344
+ display: inline-block;
345
+ vertical-align: middle;
346
+ width: 140px;
347
  }
348
 
349
  .spider_slider_percentage,
350
  .spider_slider_percentage input,
351
  .spider_slider_percentage input :focus {
352
+ background: transparent;
353
+ border: none;
354
+ color: #00AEEF;
355
+ display: inline;
356
+ font-weight: bold;
357
+ text-align: right;
358
+ vertical-align: middle;
359
+ width: 30px;
360
  }
361
 
362
  .updated,
363
  .error {
364
+ margin: 5px 0 2px !important;
365
  }
366
 
367
  .buttons_div {
368
+ clear: both;
369
+ float: right;
370
+ margin: 5px 0;
371
  }
372
 
373
  .buttons_div_left {
374
+ float: left;
375
+ margin: 5px 0;
376
  }
377
 
378
  .buttons_div_right {
379
+ float: right;
380
+ margin: 5px 0;
381
  }
382
 
383
  .spider_delete_img {
384
+ background-image: url("../images/delete.png");
385
+ border: none;
386
+ cursor: pointer;
387
+ display: inline-block;
388
+ vertical-align: middle;
389
+ height: 14px;
390
+ width: 14px;
391
  }
392
 
393
  .spider_delete_img_small {
394
+ background-image: url("../images/delete.png");
395
+ background-size: 10px auto;
396
+ border: medium none;
397
+ cursor: pointer;
398
+ display: inline-block;
399
+ height: 10px;
400
+ margin-top: 2px;
401
+ vertical-align: middle;
402
+ width: 10px;
403
  }
404
 
405
  .spider_fieldset {
406
+ background: none repeat scroll 0 0 #FFFFFF;
407
+ border: 1px solid #3B5A9A;
408
+ display: none;
409
+ float: left;
410
 
411
+ padding: 13px;
412
+ width: 97%;
413
  }
414
 
415
  .spider_type_fieldset {
416
+ background: none repeat scroll 0 0 #FFFFFF;
417
 
418
+ display: none;
419
+ float: left;
420
+ width: 100%;
421
  }
422
 
423
  .spider_child_fieldset {
424
+ background: none repeat scroll 0 0 #FFFFFF;
425
+ border: 1px solid #3B5A9A;
426
+ float: left;
427
+ margin: 4px;
428
+ width: 30%;
429
+ padding: 13px;
430
+ display: block;
431
  }
432
 
433
  .spider_table td {
434
+ padding: 0;
435
+ vertical-align: middle;
436
  }
437
 
438
  .spider_ctrls {
439
+ padding: 4px;
440
+ text-align: center;
441
+ width: 40px;
442
  }
443
 
444
  .theme_type {
445
+ font-size: 17px;
446
+ float: left;
447
+ padding: 10px;
448
+ background-color: #FFF;
449
+ border: 1px solid #FBFBFB;
450
+ border-bottom: none;
451
+ margin-right: 0px;
452
+ position: relative;
453
+ z-index: 2;
454
+ top: 1px;
455
+ cursor: pointer;
456
  }
457
 
458
  .ui-slider-handle {
459
+ cursor: pointer !important;
460
  }
461
 
462
  .thumb {
463
+ border: 1px solid #CCCCCC;
464
+ max-height: 120px;
465
+ max-width: 120px;
466
  }
467
 
468
  .fileDescription {
469
+ color: #666666;
470
+ cursor: pointer;
471
+ font-family: sans-serif;
472
+ font-size: 12px;
473
  }
474
 
475
  .filename {
476
+ font-size: 13px;
477
  }
478
 
479
  .tag_div {
480
+ background-clip: padding-box;
481
+ background-color: #F3F3F3;
482
+ border: 1px solid #AAAAAA;
483
+ border-radius: 3px 3px 3px 3px;
484
+ box-shadow: 0 0 2px #FFFFFF inset, 0 1px 0 rgba(0, 0, 0, 0.05);
485
+ color: #666666;
486
+ line-height: 13px;
487
+ margin: 2px 0;
488
+ padding: 2px 5px 2px 5px;
489
+ width: 132px;
490
  }
491
 
492
  .tags_div {
493
+ overflow-y: auto;
494
+ height: 65px;
495
  }
496
 
497
  .tag_name {
498
+ width: 118px;
499
  }
500
 
501
  .edit_thumb {
502
+ cursor: pointer;
503
  }
504
 
505
  .spider_rotate {
506
+ border-radius: 2px;
507
+ border: 1px solid #FFFFFF;
508
+ height: 30px;
509
  }
510
 
511
  .spider_search_value {
512
+ height: 2em;
513
+ margin: 0 0 4px;
514
  }
515
 
516
  #th_order,
517
  .spider_order {
518
+ display: none;
519
  }
520
 
521
  #add_embed_help {
522
+ /*height: 325px;*/
523
+ height: 290px;
524
+ width: 672px;
525
+ top: 40%;
526
  }
527
 
528
  .bwg_add_embed,
529
  .bwg_resize_image {
530
+ display: none;
531
+ padding: 10px;
532
+ height: 60px;
533
+ background-color: #FFFFFF;
534
+ border: 1px solid #999999;
535
+ top: 50%;
536
+ position: fixed;
537
+ left: 50%;
538
+ text-align: left;
539
+ z-index: 100000;
540
+ border-radius: 3px;
541
+ margin-top: -45px;
542
  }
543
 
544
  .bwg_add_embed {
545
+ margin-left: -340px;
546
  }
547
 
548
  .bwg_resize_image {
549
+ margin-left: -200px;
550
  }
551
 
552
  .bwg_bulk_embed {
553
+ display: none;
554
+ padding: 10px;
555
+ height: 160px;
556
+ background-color: #FFFFFF;
557
+ border: 1px solid #999999;
558
+ top: 40%;
559
+ position: fixed;
560
+ left: 55%;
561
+ text-align: left;
562
+ z-index: 100000;
563
+ border-radius: 3px;
564
+ margin-top: -45px;
565
+ margin-left: -340px;
566
  }
567
 
568
  #add_embed input[type="text"] {
569
+ width: 500px;
570
  }
571
 
572
  .bwg_resize_image input[type="text"] {
573
+ width: 60px;
574
  }
575
 
576
  .bwg_opacity_media {
577
+ display: none;
578
+ background-color: #000000;
579
+ opacity: 0.75;
580
+ filter: Alpha(opacity=75);
581
+ position: fixed;
582
+ top: 0;
583
+ left: 0;
584
+ width: 100%;
585
+ height: 100%;
586
+ z-index: 99998;
587
  }
588
 
589
  .widefat .check-column {
590
+ text-align: center;
591
  }
592
 
593
  #ffwd_info_form input[type=checkbox]:checked:before {
594
+ content: '\2022' !important;
595
+ border-radius: 0px !important;
596
+ font-size: 21px !important;
597
+ width: 8px !important;
598
+ height: 8px !important;
599
+ margin: 3px !important;
600
+ line-height: 22px !important;
601
+ background-color: #3B5A9A !important;
602
+ text-indent: -9999px !important;
603
  }
604
 
605
  #ffwd_info_form input[type=checkbox], #ffwd_info_form input[type=radio] {
606
+ border: 1px solid #E5E5E5 !important;
607
+ -webkit-appearance: none;
608
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
609
+ box-shadow: none;
610
+ -webkit-transition: none;
611
+ transition: none;
612
  }
613
 
614
  #ffwd_info_form input[type=radio]:checked:before {
615
+ content: '\2022';
616
+ text-indent: -9999px;
617
+ -webkit-border-radius: 50px;
618
+ border-radius: 50px;
619
+ font-size: 24px;
620
+ width: 8px;
621
+ height: 8px;
622
+ margin: 3px;
623
+ line-height: 16px;
624
+ background-color: #3B5A9A;
625
  }
626
 
627
  #themes_form input[type=checkbox]:checked:before {
628
+ content: '\2022' !important;
629
+ border-radius: 0px !important;
630
+ font-size: 21px !important;
631
+ width: 8px !important;
632
+ height: 8px !important;
633
+ margin: 3px !important;
634
+ line-height: 22px !important;
635
+ background-color: #3B5A9A !important;
636
+ text-indent: -9999px !important;
637
  }
638
 
639
  #themes_form input[type=checkbox], #ffwd_info_form input[type=radio] {
640
+ border: 1px solid #E5E5E5 !important;
641
+ -webkit-appearance: none;
642
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
643
+ box-shadow: none;
644
+ -webkit-transition: none;
645
+ transition: none;
646
  }
647
 
648
  #themes_form input[type=radio]:checked:before {
649
+ content: '\2022';
650
+ text-indent: -9999px;
651
+ -webkit-border-radius: 50px;
652
+ border-radius: 50px;
653
+ font-size: 24px;
654
+ width: 8px;
655
+ height: 8px;
656
+ margin: 3px;
657
+ line-height: 16px;
658
+ background-color: #3B5A9A;
659
  }
660
 
661
  .ffwd_login_button, .ffwd_login_button:hover {
662
+ color: #3B5A9A;
663
+ text-decoration: none;
664
 
665
  }
666
 
 
667
  .ffwd-button-secondary {
668
+ background-color: #FFFFFF;
669
+ padding: 6px;
670
+ color: #7A7A7A;
671
+ font-size: 12px;
672
+ border: 1px solid #E7E7E7;
673
+ cursor: pointer;
674
+ outline: none;
675
  }
676
 
677
  .ffwd-button-secondary:focus {
678
+ outline: none;
679
  }
680
 
681
+ #ffwd_info_form a, #themes_form a {
682
+ color: #3B5A9A;
683
 
684
  }
685
 
686
+ #ffwd_info_form th, #ffwd_info_form th span, #themes_form th, #themes_form th span {
687
+ color: #737373;
688
 
689
  }
690
 
691
  .ffwd-button-primary {
692
+ background-color: #3B5A9A;
693
+ color: #FFF !important;
694
+ padding: 6px;
695
+ border: 1px solid #516CA4;
696
+ border-radius: 2px;
697
+ text-decoration: none;
698
+ cursor: pointer;
699
  }
700
 
701
  .ffwd_plugin_header {
702
+ background-color: #FFF;
703
+
704
+ padding: 12px 8px;
705
  }
706
 
707
  h2.ffwd_page_name {
708
+ color: #5A5D61;
709
+ font-size: 21px;
710
+ font-weight: 400;
711
+ padding: 10px 15px 9px 0;
712
+ line-height: 32px;
713
+ margin: 0;
714
  }
715
 
716
  .ffwd_create_new_link {
717
+ color: #5A5D61 !important;
718
+ text-decoration: none;
719
+ font-size: 21px;
720
  }
721
 
722
  .ffwd_create_new_link span {
723
+ color: #EBEBEB;
724
 
725
  }
726
 
727
+ .ffwd-button-save {
728
+ background-image: url("../images/ffwd/button-icons.png");
729
+ background-repeat: no-repeat;
730
+ padding-left: 32px;
731
+ background-position: 6px 3px;
 
 
 
 
 
 
 
 
732
  }
733
 
734
+ .ffwd-button-apply {
735
+ background-image: url("../images/ffwd/button-icons.png");
736
+ background-repeat: no-repeat;
737
+ padding-left: 32px;
738
+ background-position: 6px -22px;
 
739
  }
740
 
741
+ .ffwd-button-cancel {
742
+ background-image: url("../images/ffwd/button-icons.png");
743
+ background-repeat: no-repeat;
744
+ padding-left: 24px;
745
+ background-position: 6px -45px;
 
746
  }
747
 
748
+ .ffwd-button-reset {
749
+ background-image: url("../images/ffwd/button-icons.png");
750
+ background-repeat: no-repeat;
751
+ padding-left: 32px;
752
+ background-position: 6px -70px;
 
 
753
  }
754
 
755
+ .ffwd-button-show-order {
756
+ background-image: url("../images/ffwd/button-icons2.png");
757
+ background-repeat: no-repeat;
758
+ padding-left: 32px;
759
+ background-position: 6px -239px;
 
760
  }
761
 
762
+ .ffwd-button-show-order:hover {
763
+ background-image: url("../images/ffwd/button-icons2.png");
764
+ background-repeat: no-repeat;
765
+ padding-left: 32px;
766
+ background-position: 6px -268px;
 
767
  }
768
 
769
+ .ffwd-button-save-order {
770
+ background-image: url("../images/ffwd/button-icons2.png");
771
+ background-repeat: no-repeat;
772
+ padding-left: 32px;
773
+ background-position: 6px -65px;
 
774
  }
775
 
776
+ .ffwd-button-save-order:hover {
777
+ background-image: url("../images/ffwd/button-icons2.png");
778
+ background-repeat: no-repeat;
779
+ padding-left: 32px;
780
+ background-position: 6px -94px;
 
 
781
  }
782
 
783
+ .ffwd-button-publish {
784
+ background-image: url("../images/ffwd/button-icons2.png");
785
+ background-repeat: no-repeat;
786
+ padding-left: 32px;
787
+ background-position: 6px -180px;
 
788
  }
789
 
790
+ .ffwd-button-publish:hover {
791
+ background-image: url("../images/ffwd/button-icons2.png");
792
+ background-repeat: no-repeat;
793
+ padding-left: 32px;
794
+ background-position: 6px -209px
 
795
  }
796
 
797
+ .ffwd-button-unpublish {
798
+ background-image: url("../images/ffwd/button-icons2.png");
799
+ background-repeat: no-repeat;
800
+ padding-left: 32px;
801
+ background-position: 6px -10px;
 
 
 
 
 
 
 
 
802
  }
803
 
804
+ .ffwd-button-unpublish:hover {
805
+ background-image: url("../images/ffwd/button-icons2.png");
806
+ background-repeat: no-repeat;
807
+ padding-left: 32px;
808
+ background-position: 6px -39px;
 
809
  }
810
 
811
+ .ffwd-button-delete {
812
+ background-image: url("../images/ffwd/button-icons2.png");
813
+ background-repeat: no-repeat;
814
+ padding-left: 32px;
815
+ background-position: 6px -122px;
 
816
  }
817
 
818
+ .ffwd-button-delete:hover {
819
+ background-image: url("../images/ffwd/button-icons2.png");
820
+ background-repeat: no-repeat;
821
+ padding-left: 32px;
822
+ background-position: 6px -151px;
 
 
 
823
  }
824
 
825
+ .ffwd-button-add-new {
826
+ background-image: url("../images/ffwd/add_new.png");
827
+ background-repeat: no-repeat;
828
+ padding-left: 32px;
829
+ background-position: 6px 5px;
830
  }
831
+
832
+ .ffwd_upgrade {
833
+ clear: both;
834
+ padding: 15px 0px 15px 13px;
835
+ background: #FFF;
836
+ margin: 12px 2px 6px;
837
+ color: #6E7990;
838
+ font-size: 14px;
839
+ font-weight: bold;
840
+ line-height: 30px;
841
+ width: 98%;
842
  }
843
 
844
+ .ffwd_upgrade .wd-cell:first-child {
845
+ padding-right: 14px;
846
+ }
847
 
848
+ .ffwd_upgrade .wd-cell:first-child img {
849
+ vertical-align: middle;
850
+ }
851
 
852
+ .ffwd_upgrade .wd-cell:first-child a {
853
+ color: #72777C !important;
854
  }
855
 
856
+ .ffwd_upgrade a, .ffwd_upgrade a:hover {
857
+ text-decoration: none !important;
 
 
858
  }
859
 
860
+ .wd-cell-valign-middle {
861
+ vertical-align: middle;
862
+ }
863
 
864
+ .wd-clear:after {
865
+ clear: both;
866
+ content: "";
867
+ display: table;
868
  }
869
 
870
+ .wd-table {
871
+ display: table;
872
  }
873
 
874
+ .wd-cell {
875
+ display: table-cell;
876
+ }
877
 
878
  .ffwd-cell-valign-middle {
879
+ vertical-align: middle;
880
  }
881
 
882
  .ffwd-cell {
883
+ display: table-cell;
884
  }
885
 
886
+ .ffwd-right {
887
+ float: right;
 
 
 
 
 
 
888
  }
889
 
890
+ .ffwd-left {
891
+ float: left;
892
  }
893
 
894
+ a.button-primary {
895
+ color: #FFFFFF !important;
 
 
 
 
 
 
896
  }
897
 
898
+ div.ffwd_error {
899
+ color: #A94442;
900
+ background-color: #F2DEDE;
901
+ padding: 15px;
902
+ margin-bottom: 20px;
903
+ border: 1px solid #EBCCD1;
904
+ border-radius: 4px;
905
+ font-size: 15px
 
 
 
 
906
  }
907
 
908
+ .ffwd_error p,
909
+ .ffwd_error a {
910
+ margin: 0 !important;
911
+ font-size: 14px;
 
 
 
 
 
 
912
  }
913
 
914
+ .spider_div_options .spider_description, .spider_div_options .spider_description a {
915
+ font-size: 15px;
 
 
916
  }
917
 
918
+ .spider_div_options .spider_label_options label {
919
+ font-size: 15px;
 
 
 
 
920
  }
921
 
922
+ .ffwd_p .ffwd_set_l label {
923
+ font-size: 15px;
 
 
 
 
 
 
 
 
 
 
924
  }
925
 
926
+ .ffwd_p .description {
927
+ font-size: 15px;
928
  }
929
 
930
+ .ffwd_reset_cache_res {
931
+ font-size: 19px;
932
+ margin: 4px 0px 0px 12px;
933
+ display: inline-block;
934
  }
935
 
936
+ #ffwd_login_button {
937
+ background-color: #4267B2;
938
+ color: #FFFFFF !important;
939
+ display: inline-block;
940
+ text-decoration: none;
941
+ padding: 7px 12px 7px 12px;
942
+ font-size: 14px;
943
+ margin-bottom: 10px;
 
 
944
  }
945
 
946
+ #ffwd_login_button i {
947
+ font-family: dashicons;
948
+ font-size: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
949
  }
950
 
951
+ /*#ffwd_info_form .ffwd_page_list_notice{*/
952
+ /*margin-top: 15px !important;*/
953
+ /*margin-bottom: 15px !important;*/
954
+ /*}*/
 
 
 
955
 
956
+ #ffwd_info_form .ffwd_page_list_notice p,
957
+ #ffwd_info_form .ffwd_page_list_notice a {
958
+ font-size: 14px;
 
 
959
  }
960
 
961
+ #ffwd_login_popup {
962
+ position: fixed;
963
+ z-index: 999;
964
+ width: 100%;
965
+ top: 0;
966
+ right: 0;
967
+ bottom: 0;
968
+ left: 0;
969
+ background: rgba(0, 0, 0, 0.3);
970
  }
971
 
972
+ .ffwd_login_popup_content {
973
+ position: absolute;
974
+ top: 180px;
975
+ left: 50%;
976
+ width: 380px;
977
+ margin: 0 0 0 -195px;
978
+ padding: 20px 40px;
979
+ background: #FFF;
980
+ text-align: center;
981
  }
982
 
983
+ .ffwd_login_popup_content p {
984
+ font-size: 14px;
985
+ line-height: 1.6;
 
986
  }
987
 
988
+ #ffwd_login_popup_cancle_btn,
989
+ #ffwd_login_popup_continue_btn {
990
+ display: inline-block;
991
+ padding: 0 21px 0 20px;
992
+ height: 45px;
993
+ line-height: 44px;
994
+ text-decoration: none;
995
+ font-size: 14px;
996
+ margin-right: 5px;
997
+ clear: both;
998
+ cursor: pointer;
999
  }
1000
 
1001
+ #ffwd_login_popup_cancle_btn {
1002
+ background: #DDD;
1003
+ color: #555;
1004
  }
1005
 
1006
+ #ffwd_login_popup_continue_btn {
1007
+ background: #4267B2;
1008
+ color: #E9EEF3;
 
 
 
 
 
1009
  }
1010
 
1011
+ #ffwd_login_popup_notice {
1012
+ font-size: 11px;
1013
+ margin-top: 25px;
 
 
1014
  }
1015
+
1016
+ #ffwd_page_img {
1017
+ width: 29px;
1018
+ height: 29px;
1019
+ display: inline-block;
1020
+ position: absolute;
1021
+ margin-left: 4px;
1022
  }
1023
+
1024
+ #toplevel_page_options_ffwd.current a div img { /*conflict with single item menu*/
1025
+ opacity: 1;
1026
  }
1027
+
1028
+ .ffwd-access-token-missing {
1029
+ margin: 10px 0 50px 0;
1030
+ line-height: 17px;
1031
+ font-size: 13px;
1032
+ color: rgba(50, 58, 69, 1);
1033
  }
1034
 
1035
+ .ffwd-access-token-missing p {
1036
+ margin: 0;
1037
  }
1038
+
1039
+ .ffwd_pro_only {
1040
+ font-size: 10px;
1041
+ background-color: #888888;
1042
+ padding: 2px;
1043
+ border: 1px solid black;
1044
+ color: white;
1045
+ border-radius: 4px;
1046
  }
1047
 
1048
+ div#ffwd_featurs_tables {
1049
+ display: inline-block;
1050
+ font-size: 13px;
1051
+ padding-top: 95px;
1052
+ text-align: left;
1053
+ float: left;
 
 
1054
  }
1055
 
1056
+ div#ffwd_ffwd_featurs_tables div {
1057
+ vertical-align: top;
 
 
 
1058
  }
1059
 
1060
+ div#ffwd_featurs_table1 {
1061
+ background-color: rgb(254, 254, 254);
1062
+ display: inline-block;
1063
+ position: relative;
1064
+ vertical-align: top;
1065
+ width: 380px;
1066
+ height: 684px;
1067
+ z-index: 10;
1068
+ }
1069
 
1070
+ div#ffwd_featurs_table1 span::after {
1071
+ background-image: url("../images/arrow3.png");
1072
+ background-position: center center;
1073
+ background-repeat: no-repeat;
1074
+ content: "";
1075
+ display: inline-block;
1076
+ float: right;
1077
+ height: 37px;
1078
+ position: relative;
1079
+ right: -21px;
1080
+ top: -8px;
1081
+ width: 26px;
1082
  }
1083
+
1084
+ div#ffwd_featurs_table1 span {
1085
+ border-left: 1px solid #E5E5E5;
1086
+ border-right: 1px solid #E5E5E5;
1087
+ border-top: 1px solid #E5E5E5;
1088
+ color: #545454;
1089
+ background-color: white;
1090
+ display: block;
1091
+ height: 21px;
1092
+ padding: 8px;
1093
+ text-align: left;
1094
  }
1095
 
1096
+ div#ffwd_featurs_table1 span:last-child,
1097
+ div#ffwd_featurs_table2 span:last-child,
1098
+ div#ffwd_featurs_table3 span:last-child {
1099
+ border-bottom: 1px solid #E5E5E5;
1100
  }
1101
+
1102
+ div#ffwd_featurs_table2 {
1103
+ background-color: rgba(255, 255, 255, 0.9);
1104
+ display: inline-block;
1105
+ position: relative;
1106
+ top: -72px;
1107
+ width: 180px;
1108
  }
1109
 
1110
+ div#ffwd_featurs_table2 span:first-child,
1111
+ div#ffwd_featurs_table3 span:first-child {
1112
+ color: #000;
1113
+ font-size: 22px;
1114
+ font-weight: bold;
1115
+ padding-bottom: 14px;
1116
+ padding-top: 2px;
1117
+ border-top: 1px solid #E5E5E5;
1118
+ border-left: 1px solid #E5E5E5;
1119
+ border-right: 1px solid #E5E5E5;
1120
+ height: 39px;
1121
+ padding-top: 18px;
1122
  }
1123
 
1124
+ div#ffwd_featurs_table2 span:first-child {
1125
+ border-left: 1px solid #E5E5E5 !important;
 
 
 
 
 
 
1126
  }
1127
 
1128
+ div#ffwd_featurs_table2 span {
1129
+ border-left: none !important;
 
1130
  }
1131
 
1132
+ div#ffwd_featurs_table2 span,
1133
+ div#ffwd_featurs_table3 span {
1134
+ border-top: 1px solid #E5E5E5;
1135
+ border-right: 1px solid #E5E5E5;
1136
+ border-left: 1px solid #E5E5E5;
1137
+ color: #545454;
1138
+ display: block;
1139
+ height: 21px;
1140
+ padding: 8px;
1141
+ text-align: center;
1142
+ }
1143
 
1144
+ div#ffwd_featurs_table3 {
1145
+ background-color: rgba(255, 255, 255, 0.6);
1146
+ display: inline-block;
1147
+ position: relative;
1148
+ top: -72px;
1149
+ width: 180px;
1150
  }
1151
 
1152
+ div#ffwd_featurs_table2 span.yes,
1153
+ div#ffwd_featurs_table3 span.yes {
1154
+ background-image: url("../images/plus.png");
1155
+ background-position: center center;
1156
+ background-repeat: no-repeat;
 
 
 
 
1157
  }
1158
 
1159
+ span.no {
1160
+ background-image: url("../images/minus.png");
1161
+ background-position: center center;
1162
+ background-repeat: no-repeat;
 
 
 
 
 
1163
  }
1164
 
1165
+ .download a {
1166
+ background-color: #FFF;
1167
+ border: 6px solid #DDDDDD;
1168
+ border-radius: 50%;
1169
+ box-shadow: 0 0 0 7px #EEEEEE;
1170
+ color: #21439C;
1171
+ cursor: pointer;
1172
+ display: inline-block;
1173
+ font-size: 14px;
1174
+ font-style: italic;
1175
+ font-weight: bold;
1176
+ margin-top: -4px;
1177
+ outline: 0 none;
1178
+ padding: 32px 9px 32px 2px;
1179
+ text-align: center;
1180
+ text-decoration: none;
1181
+ transition-duration: 0.6s;
1182
+ transition-property: border-color;
1183
+ transition-timing-function: linear;
1184
+ width: 72px;
1185
  }
1186
 
1187
+ .download input[type="submit"]:hover,
1188
+ .download a:hover {
1189
+ border-color: #F4762A;
 
 
 
 
 
 
 
 
1190
  }
1191
 
1192
+ #ffwd_featurs_tables span.download {
1193
+ height: 40px !important;
1194
+ border-bottom: 1px solid #E5E5E5 !important;
1195
+ border-left: 1px solid #E5E5E5 !important;
1196
  }
1197
 
1198
+ .price_big {
1199
+ color: #F47629;
1200
+ font-size: 22px;
1201
  }
1202
 
1203
+ .price {
1204
+ display: block;
1205
+ color: #F47629;
1206
  }
1207
 
1208
+ .ffwd_upgrade {
1209
+ clear: both;
1210
+ padding: 15px;
1211
+ background: #FFF;
1212
+ margin: 6px 15px;
1213
+ color: #6E7990;
1214
+ font-size: 14px;
1215
+ font-weight: bold;
1216
+ line-height: 30px;
1217
  }
1218
 
1219
+ .ffwd_upgrade .wd-cell:first-child {
1220
+ padding-right: 14px;
1221
  }
1222
+
1223
+ .ffwd_upgrade .wd-cell:first-child img {
1224
+ vertical-align: middle;
1225
  }
1226
 
1227
+ .ffwd_upgrade .wd-cell:first-child a {
1228
+ color: #72777C !important;
1229
  }
1230
 
1231
+ .ffwd_upgrade .wd-cell:last-child {
1232
+ background: #45A6B7;
 
 
 
1233
  }
1234
 
1235
+ .ffwd_upgrade .wd-cell:last-child a {
1236
+ color: #FFF !important;
1237
+ padding: 18px;
1238
  }
1239
+
1240
+ .ffwd_upgrade a, .ffwd_upgrade a:hover {
1241
+ text-decoration: none !important;
1242
+ }
css/wd_bp_install.css CHANGED
@@ -43,3 +43,7 @@
43
  .wd_bp_notice_dissmiss {
44
  margin-top: 5px;
45
  }
 
 
 
 
43
  .wd_bp_notice_dissmiss {
44
  margin-top: 5px;
45
  }
46
+
47
+ a.button-primary{
48
+ color:#fff !important;
49
+ }
elementor/elementor.php CHANGED
@@ -40,6 +40,7 @@ class FFWDElementor {
40
  public function enqueue_elementor_widget_scripts(){
41
  wp_enqueue_script('ffwd_editor_widget_js', plugin_dir_url(__FILE__) . 'js/ffwd_elementor_widget.js', array('jquery'));
42
  }
 
43
  public function register_widget_category($elements_manager){
44
  $elements_manager->add_category('tenweb-plugins-widgets', array(
45
  'title' => __('10WEB', 'tenweb-builder'),
40
  public function enqueue_elementor_widget_scripts(){
41
  wp_enqueue_script('ffwd_editor_widget_js', plugin_dir_url(__FILE__) . 'js/ffwd_elementor_widget.js', array('jquery'));
42
  }
43
+
44
  public function register_widget_category($elements_manager){
45
  $elements_manager->add_category('tenweb-plugins-widgets', array(
46
  'title' => __('10WEB', 'tenweb-builder'),
elementor/widget.php CHANGED
@@ -71,7 +71,7 @@ class FFWDElementorWidget extends \Elementor\Widget_Base {
71
  [
72
  'label' => __('Select Feed', 'wd-facebook-feed'),
73
  'label_block' => true,
74
- 'description' => __('Select the feed to display.', 'wd-facebook-feed') . ' <a data-ffwd_nonce="'.$ffwd_nonce.'" target="_blank" href="' . $ffwd_edit_link . '">' . __('Edit feed', 'wd-facebook-feed') . '</a>',
75
  'type' => \Elementor\Controls_Manager::SELECT,
76
  'default' => $this->default_feed,
77
  'options' => $this->feed_options
@@ -86,7 +86,6 @@ class FFWDElementorWidget extends \Elementor\Widget_Base {
86
  */
87
  protected function render(){
88
  $settings = $this->get_settings_for_display();
89
-
90
  if(!empty($settings['ffwd_feeds'])) {
91
  echo do_shortcode('[WD_FB id="' . $settings['ffwd_feeds'] . '"]');
92
  } else {
71
  [
72
  'label' => __('Select Feed', 'wd-facebook-feed'),
73
  'label_block' => true,
74
+ 'description' => __('Select the feed to display.', 'wd-facebook-feed') . ' <a data-ffwd_nonce="'.$ffwd_nonce.'" target="_balnk" href="' . $ffwd_edit_link . '">' . __('Edit feed', 'wd-facebook-feed') . '</a>',
75
  'type' => \Elementor\Controls_Manager::SELECT,
76
  'default' => $this->default_feed,
77
  'options' => $this->feed_options
86
  */
87
  protected function render(){
88
  $settings = $this->get_settings_for_display();
 
89
  if(!empty($settings['ffwd_feeds'])) {
90
  echo do_shortcode('[WD_FB id="' . $settings['ffwd_feeds'] . '"]');
91
  } else {
facebook-feed-wd-notices.php CHANGED
@@ -150,7 +150,7 @@ class FFWD_Notices {
150
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
151
  $current_date = current_time("n/j/Y");
152
  $date_array = explode('/', $current_date);
153
- $interval = (isset($_GET['wd_int']) ? intval(sanitize_text_field($_GET['wd_int'])) : 14);
154
  $date_array[1] += $interval;
155
  $new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
156
 
150
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
151
  $current_date = current_time("n/j/Y");
152
  $date_array = explode('/', $current_date);
153
+ $interval = (isset($_GET['wd_int']) ? intVal($_GET['wd_int']) : 14);
154
  $date_array[1] += $interval;
155
  $new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
156
 
facebook-feed-wd.php CHANGED
@@ -1,20 +1,21 @@
1
  <?php
2
  /**
3
- * Plugin Name: 10Web Social Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
6
- * Version: 1.1.34
7
  * Author: 10Web
8
  * Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
11
 
12
- define( 'WD_FFWD_DIR', WP_PLUGIN_DIR . "/" . plugin_basename( dirname( __FILE__ ) ) );
13
- define( 'WD_FFWD_URL', plugins_url( plugin_basename( dirname( __FILE__ ) ) ) );
14
- define( 'WD_FB_PREFIX', 'ffwd' );
15
- define( 'WD_FB_IS_FREE', TRUE );
16
- if (! defined( 'FFWD_VERSION' ) ){
17
- define ('FFWD_VERSION',"1.1.34");
 
18
  }
19
  add_action( 'admin_init', 'ffwd_init' );
20
 
@@ -22,57 +23,28 @@ function ffwd_init() {
22
  ffwd_privacy_policy();
23
  }
24
 
25
- add_action('admin_notices', 'ffwd_login_notice');
26
-
27
- function ffwd_login_notice() {
28
- if (!isset($_GET['page']) || strpos(sanitize_text_field($_GET['page']), '_ffwd') === false || sanitize_text_field($_GET['page'])==="overview_ffwd") {
29
- return;
30
- }
31
- require_once 'framework/WDFacebookFeed.php';
32
- $pages = get_option('ffwd_pages_list');
33
- if(sanitize_text_field($_GET['page'])!="options_ffwd" && empty($pages)){
34
- echo '<div class="notice notice-error is-dismissible" style="padding: 15px">
35
- <span><b>Get access tokens to display Facebook feeds.</b></span>
36
- <a style="margin: 0 0 0 15px" id="ffwd_login_button" class="ffwd_login_button" href="#">Log in and get my Access Token</a>
37
- </div>
38
- <div id="ffwd_login_popup" style="display: none;">
39
- <div class="ffwd_login_popup_content">
40
- <p>Log into your Facebook account using the button below and approve the plugin to connect your account.</p>
41
- <p>
42
- <span id="ffwd_login_popup_cancle_btn">Cancel</span>
43
- <a id="ffwd_login_popup_continue_btn" href="'.WDFacebookFeed::get_auth_url().'">Continue</a>
44
- </p>
45
-
46
- <p id="ffwd_login_popup_notice"><b>Please note:</b> this does not give us permission to manage your Facebook pages, it simply allows the plugin to see a list of the pages you manage and retrieve an Access Token.</p>
47
-
48
- </div>
49
- </div>
50
- ';
51
- }
52
- }
53
-
54
  function ffwd_use_home_url() {
55
- $home_url = str_replace( "http://", "", home_url() );
56
- $home_url = str_replace( "https://", "", $home_url );
57
- $pos = strpos( $home_url, "/" );
58
- if ( $pos ) {
59
- $home_url = substr( $home_url, 0, $pos );
60
- }
61
 
62
- $site_url = str_replace( "http://", "", WD_FFWD_URL );
63
- $site_url = str_replace( "https://", "", $site_url );
64
- $pos = strpos( $site_url, "/" );
65
- if ( $pos ) {
66
- $site_url = substr( $site_url, 0, $pos );
67
- }
68
 
69
- return $site_url != $home_url;
70
  }
71
 
72
- if ( ffwd_use_home_url() ) {
73
- define( 'WD_FFWD_FRONT_URL', plugins_url( plugin_basename( dirname( __FILE__ ) ) ));
74
  } else {
75
- define( 'WD_FFWD_FRONT_URL', WD_FFWD_URL );
76
  }
77
 
78
  add_action('init', 'ffwd_silent_update');
@@ -85,18 +57,16 @@ function ffwd_silent_update(){
85
 
86
  // Plugin menu.
87
  function ffwd_menu_panel() {
88
- if(empty(get_option('ffwd_pages_list'))){
89
- $parent_slug = "options_ffwd";
90
  add_menu_page('Facebook Feed', 'Facebook Feed', 'manage_options', $parent_slug, 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
91
  $galleries_page = add_submenu_page($parent_slug, 'Options', 'Options', 'manage_options', 'options_ffwd', 'ffwd_menu');
92
  add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
93
  add_action('admin_print_scripts-' . $galleries_page, 'ffwd_scripts');
94
  add_action('load-' . $galleries_page, 'ffwd_add_themes_per_page_option');
95
- $uninstall_page = add_submenu_page($parent_slug, 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
96
- add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
97
- add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
98
- } else {
99
- $parent_slug = "info_ffwd";
100
  add_menu_page('Facebook Feed', 'Facebook Feed', 'manage_options', $parent_slug, 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
101
  $galleries_page = add_submenu_page($parent_slug, 'Feeds', 'Feeds', 'manage_options', 'info_ffwd', 'ffwd_menu');
102
  add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
@@ -109,24 +79,23 @@ function ffwd_menu_panel() {
109
  add_action('admin_print_styles-' . $themes_page, 'ffwd_styles');
110
  add_action('admin_print_scripts-' . $themes_page, 'ffwd_admin_scripts');
111
  add_action('load-' . $themes_page, 'ffwd_add_themes_per_page_option');
112
- $licensing_page = add_submenu_page($parent_slug, 'Get Premium', 'Get Premium', 'manage_options', 'ffwd_licensing', 'ffwd_licensing_page');
113
- add_action('admin_print_styles-' . $licensing_page, 'ffwd_styles');
114
- /* Custom link to wordpress.org*/
115
- global $submenu;
116
- $url = 'https://wordpress.org/support/plugin/wd-facebook-feed/#new-post';
117
- $submenu[$parent_slug][] = array(
118
- '<div id="ffwd_ask_question">' . __('Ask a question', 'ffwd_menu') . '</div>',
119
- 'manage_options',
120
- $url,
121
- );
122
- $uninstall_page = add_submenu_page($parent_slug, 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
123
- add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
124
- add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
125
  }
 
 
 
126
  }
127
- add_action( 'admin_menu', 'ffwd_menu_panel', 9);
128
-
129
- add_action( 'init', 'ffwd_silently_update' );
130
 
131
  function ffwd_privacy_policy() {
132
  if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
@@ -219,7 +188,7 @@ Multiple Feeds per Post/Page", "wd_ads"),
219
  ),
220
  6 => array(
221
  "title" => __("Social Buttons"),
222
- "description" => __("Increase social engagement of your Facebook feed by activating the Facebook, Twitter and Google+ buttons. Allow your site visitors to share posts, photos and videos from your FB feed to their preferred social channel.", "wd_ads"),
223
  ),
224
  ),
225
  "user_guide" => array(
@@ -273,8 +242,8 @@ Multiple Feeds per Post/Page", "wd_ads"),
273
  "plugin_wizard_link" => NULL,
274
  "plugin_menu_title" => "Facebook Feed by 10Web",
275
  "plugin_menu_icon" => WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png',
276
- "deactivate" => TRUE,
277
- "subscribe" => false,
278
  "custom_post" => 'info_ffwd',
279
  "display_overview" => FALSE,
280
  );
@@ -282,210 +251,166 @@ Multiple Feeds per Post/Page", "wd_ads"),
282
  }
283
  }
284
 
 
 
 
 
 
 
285
 
286
- function ffwd_silently_update() {
287
- global $wpdb;
288
-
289
-
290
- $old_version = ffwd_get_version();
291
-
292
- $new_version = ffwd_version();
293
-
294
- $newer = version_compare( $new_version, $old_version, '>' );
295
- if ( $newer ) {
296
- require_once WD_FFWD_DIR . '/update/ffwd_update.php';
297
- /*adds new params for new versions*/
298
- ffwd_update_diff( $new_version, $old_version );
299
-
300
 
301
- }
302
- }
303
 
304
  function ffwd_menu() {
305
- global $wpdb;
306
- require_once( WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php' );
307
- $page = WDW_FFWD_Library::get( 'page' );
308
- if ( ( $page != '' ) && ( ( $page == 'info_ffwd' ) || ( $page == 'overview_ffwd' ) || ( $page == 'options_ffwd' ) || ( $page == 'themes_ffwd' ) || ( $page == 'uninstall_ffwd' ) || ( $page == 'FFWDShortcode' ) ) ) {
309
-
310
- if($page!='uninstall_ffwd') {
311
- $acc_tocken = $wpdb->get_var( "SELECT access_token FROM " . $wpdb->prefix . "wd_fb_option WHERE id=1" );
312
- if ( $acc_tocken != '' ) {
313
- delete_option( 'ffwd_limit_notice' );
314
- }
315
- }
316
- $ffwd_limit_notice = get_option( 'ffwd_limit_notice' );
317
-
318
  require_once 'framework/WDFacebookFeed.php';
319
-
320
- require_once( WD_FFWD_DIR . '/admin/controllers/FFWDController' . ( ( $page == 'FFWDShortcode' ) ? $page : ucfirst( strtolower( $page ) ) ) . '.php' );
321
- $controller_class = 'FFWDController' . ucfirst( strtolower( $page ) );
322
- $controller = new $controller_class();
323
- $controller->execute();
324
- }
325
- }
326
-
327
- function ffwd_featured() {
328
- if ( function_exists( 'current_user_can' ) ) {
329
- if ( ! current_user_can( 'manage_options' ) ) {
330
- die( 'Access Denied' );
331
- }
332
- } else {
333
- die( 'Access Denied' );
334
- }
335
- require_once( WD_FFWD_DIR . '/featured/featured.php' );
336
- wp_register_style( 'ffwd_featured', WD_FFWD_URL . '/featured/style.css', array(), ffwd_get_version() );
337
- wp_print_styles( 'ffwd_featured' );
338
- spider_featured( 'facebook-feed-wd' );
339
- }
340
-
341
- function ffwd_featured_themes() {
342
- if ( function_exists( 'current_user_can' ) ) {
343
- if ( ! current_user_can( 'manage_options' ) ) {
344
- die( 'Access Denied' );
345
- }
346
- } else {
347
- die( 'Access Denied' );
348
- }
349
- require_once( WD_FFWD_DIR . '/featured/featured_themes.php' );
350
- wp_register_style( 'featured_themes', WD_FFWD_URL . '/featured/themes_style.css', array(), ffwd_get_version() );
351
- wp_print_styles( 'featured_themes' );
352
- spider_featured_themes( 'facebook-feed-wd' );
353
  }
354
 
355
-
356
  function FFWD_licensing_page() {
357
- $controller_class = 'FFWDControllerLicensing_ffwd';
358
- require_once( WD_FFWD_DIR . '/admin/controllers/' . $controller_class . '.php' );
359
- $controller = new $controller_class();
360
- $controller->execute();
361
  }
362
 
363
-
364
  function ffwd_ajax_frontend() {
365
- require_once( WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php' );
366
- $page = WDW_FFWD_Library::get( 'action' );
367
- if ( $page != '' && $page == 'PopupBox' ) {
368
- require_once( WD_FFWD_DIR . '/frontend/controllers/FFWDController' . ucfirst( $page ) . '.php' );
369
- $controller_class = 'FFWDController' . ucfirst( $page );
370
- $controller = new $controller_class();
371
- $controller->execute();
372
- }
373
  }
374
 
375
- add_action( 'wp_ajax_PopupBox', 'ffwd_ajax_frontend' );
376
- add_action( 'wp_ajax_nopriv_PopupBox', 'ffwd_ajax_frontend' );
377
  // For facebook feed
378
- add_action( 'wp_ajax_nopriv_save_facebook_feed', 'ffwd_ajax' );
379
- add_action( 'wp_ajax_save_facebook_feed', 'ffwd_ajax' );
380
  // For check app
381
- add_action( 'wp_ajax_nopriv_check_app', 'ffwd_ajax' );
382
- add_action( 'wp_ajax_check_app', 'ffwd_ajax' );
383
  // For drop objects
384
- add_action( 'wp_ajax_nopriv_dropp_objects', 'ffwd_ajax' );
385
- add_action( 'wp_ajax_dropp_objects', 'ffwd_ajax' );
 
386
 
387
  // For reset_cache
388
  add_action( 'wp_ajax_ffwd_reset_cache', 'ffwd_reset_cache' );
389
 
390
  function ffwd_reset_cache(){
391
- if ( isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], WD_FFWD_URL . '_ajax_nonce' )) {
392
  delete_option("ffwd_autoupdate_time");
393
  echo json_encode(array("success"=>true));die;
394
  }
395
  echo json_encode(array("success"=>false));die;
396
  }
397
 
398
- function ffwd_ajax() {
399
- if ( function_exists( 'current_user_can' ) ) {
400
- if ( ! current_user_can( 'manage_options' ) ) {
401
- die( 'Access Denied' );
402
- }
403
- } else {
404
- die( 'Access Denied' );
405
- }
406
- require_once( WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php' );
407
- $page = WDW_FFWD_Library::get( 'action' );
408
- $nonce = ( $page == 'save_facebook_feed' || $page == 'dropp_objects' ) ? 'info_ffwd' : ( ( $page == 'check_app' ) ? 'options_ffwd' : $page );
409
- if ( ( $page != 'FFWDShortcode' ) && ! WDW_FFWD_Library::verify_nonce( $nonce ) ) {
410
- die( 'Sorry, your nonce did not verify.' );
411
- }
412
- if ( $page == 'FFWDShortcode' ) {
413
- require_once( WD_FFWD_DIR . '/admin/controllers/FFWDController' . ucfirst( $page ) . '.php' );
414
- $controller_class = 'FFWDController' . ucfirst( $page );
415
- $controller = new $controller_class();
416
- $controller->execute();
417
- } elseif ( $page == 'check_app' || $page == 'save_facebook_feed' || $page == 'dropp_objects' ) {
418
- require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
419
- WDFacebookFeed::execute();
420
- }
421
- }
422
-
423
- function ffwd_shortcode( $params ) {
424
- require_once( WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php' );
425
-
426
 
427
- global $wpdb;
 
 
 
 
 
428
 
429
- $check_fb_feed = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $params['id'] ) );
430
- if ( ! $check_fb_feed ) {
431
- echo WDW_FFWD_Library::message( __( 'Feed Doesn\'t exists', 'ffwd' ), 'error' );
 
 
 
 
 
 
 
 
432
 
433
- return;
434
- }
435
- $params['fb_id'] = $params['id'];
436
- ob_start();
437
- ffwd_front_end( $params );
 
 
 
 
 
 
438
 
439
- return str_replace( array( "\r\n", "\n", "\r" ), '', ob_get_clean() );
440
  }
441
 
442
- add_shortcode( 'WD_FB', 'ffwd_shortcode' );
443
-
444
  $ffwd = 0;
445
  function ffwd_front_end( $params ) {
446
  /* Enqueue css/js in frontend */
447
  do_action("wp_enqueue_ffwd_front_end_scripts");
448
- global $ffwd;
449
- global $wpdb;
450
- require_once( WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php' );
 
 
451
 
452
- $fb_view_type = $wpdb->get_var( $wpdb->prepare( "SELECT fb_view_type FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%s'", $params['fb_id'] ) );
453
-
454
- $controller = new FFWDControllerMain( $params, 1, $ffwd, ucfirst( $fb_view_type ) );
455
- $ffwd ++;
456
-
457
- return;
458
  }
459
 
460
  // Add the Facebook Feed by 10Web button.
461
- function ffwd_add_button( $buttons ) {
462
- array_push( $buttons, "wd_fb_mce" );
 
463
 
464
- return $buttons;
465
  }
466
 
467
  // Register Facebook Feed by 10Web button.
468
- function ffwd_register( $plugin_array ) {
 
469
  if(is_admin()) {
470
  $url = WD_FFWD_URL . '/js/ffwd_editor_button.js';
471
  $plugin_array["wd_fb_mce"] = $url;
472
  }
473
 
474
- return $plugin_array;
475
  }
476
 
477
- function ffwd_admin_ajax() {
478
- $query_url = wp_nonce_url( admin_url( 'admin-ajax.php' ), '', 'ffwd_nonce' );
479
- ?>
 
480
  <script>
481
- var ffwd_admin_ajax = '<?php echo add_query_arg( array( 'action' => 'FFWDShortcode' ), admin_url( 'admin-ajax.php' ) ); ?>';
482
- var ffwd_plugin_url = '<?php echo WD_FFWD_URL; ?>';
483
- var ajax_url = '<?php echo $query_url; ?>';
484
  </script>
485
- <?php
486
  }
487
 
488
- add_action( 'admin_head', 'ffwd_admin_ajax' );
489
 
490
 
491
  add_filter('tw_get_plugin_blocks', 'ffwd_register_plugin_block');
@@ -538,6 +463,8 @@ function ffwd_register_block_editor_assets($assets) {
538
  */
539
  function ffwd_enqueue_block_editor_assets() {
540
 
 
 
541
  // Remove previously registered or enqueued versions
542
  $wp_scripts = wp_scripts();
543
  foreach ($wp_scripts->registered as $key => $value) {
@@ -547,44 +474,48 @@ function ffwd_enqueue_block_editor_assets() {
547
  wp_deregister_style( $key );
548
  }
549
  }
550
- // Get plugin blocks from all 10Web plugins.
551
- $blocks = apply_filters('tw_get_plugin_blocks', array());
552
- // Get the last version from all 10Web plugins.
553
- $assets = apply_filters('tw_get_block_editor_assets', array());
554
- // Not performing unregister or unenqueue as in old versions all are with prefixes.
555
- wp_enqueue_script('tw-gb-block', $assets['js_path'], array( 'wp-blocks', 'wp-element' ), $assets['version']);
556
- wp_localize_script('tw-gb-block', 'tw_obj_translate', array(
557
- 'nothing_selected' => __('Nothing selected.', WD_FB_PREFIX),
558
- 'empty_item' => __('- Select -', WD_FB_PREFIX),
559
- 'blocks' => json_encode($blocks)
560
- ));
561
  wp_enqueue_style('tw-gb-block', $assets['css_path'], array( 'wp-edit-blocks' ), $assets['version']);
562
  }
563
 
564
 
565
 
 
 
566
  // Add the Facebook Feed by 10Web button to editor.
567
- add_action( 'wp_ajax_FFWDShortcode', 'ffwd_ajax' );
568
- add_filter( 'mce_external_plugins', 'ffwd_register' );
569
- add_filter( 'mce_buttons', 'ffwd_add_button', 0 );
570
 
571
  // Activate plugin.
572
- function ffwd_activate() {
573
- $current_time=current_time('timestamp');
574
- $autoupdate_interval = 60;
575
- update_option('ffwd_autoupdate_time',$autoupdate_interval*60+$current_time);
 
 
576
 
 
577
 
578
- global $wpdb;
579
- $charset_collate = $wpdb->get_charset_collate();
580
- $wd_fb_shortcode = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_shortcode` (
581
  `id` bigint(20) NOT NULL,
582
  `tagtext` mediumtext NOT NULL,
583
  PRIMARY KEY (`id`)
584
  ) " . $charset_collate . ";";
585
- $wpdb->query( $wd_fb_shortcode );
586
 
587
- $wd_fb_info = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_info` (
588
  `id` int(10) NOT NULL AUTO_INCREMENT,
589
  `name` varchar(255) NOT NULL,
590
  `page_access_token` text NOT NULL,
@@ -675,15 +606,16 @@ function ffwd_activate() {
675
  `page_plugin_cover` tinyint(1) NOT NULL,
676
  `page_plugin_header` tinyint(1) NOT NULL,
677
  `page_plugin_width` int(4) NOT NULL,
678
- `image_onclick_action` varchar(32) NOT NULL,
679
- `event_order` tinyint(4) NOT NULL,
680
  `upcoming_events` tinyint(4) NOT NULL,
681
  `fb_page_id` varchar(32) NOT NULL,
682
  PRIMARY KEY (`id`)
683
  ) " . $charset_collate . ";";
684
 
685
 
686
- $wpdb->query( $wd_fb_info );
 
687
 
688
  $old_version = ffwd_get_version();
689
 
@@ -694,9 +626,9 @@ function ffwd_activate() {
694
  }
695
 
696
  if($FFWD_version_compare){
697
- $wd_fb_info_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_info`
698
  ADD `fb_page_id` varchar(32) NOT NULL AFTER `upcoming_events`";
699
- $wpdb->query($wd_fb_info_collation);
700
  }
701
 
702
  if(substr($old_version,0,1) === '1'){
@@ -706,14 +638,13 @@ function ffwd_activate() {
706
  }
707
 
708
  if($FFWD_version_compare){
709
- $wd_fb_info_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_info`
710
  ADD `page_access_token` text NOT NULL AFTER `name`";
711
- $wpdb->query($wd_fb_info_collation);
712
  }
713
 
714
-
715
- //message-i , description , name encoding --> utf16_bin
716
- $wd_fb_data = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_data` (
717
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
718
  `fb_id` int NOT NULL,
719
  `from` varchar(32) NOT NULL,
@@ -737,23 +668,24 @@ function ffwd_activate() {
737
  `created_time` varchar(64) NOT NULL,
738
  `updated_time` varchar(64) NOT NULL,
739
  `created_time_number` bigint(255) NOT NULL,
740
- `reactions` text NOT NULL,
741
  `comments` text NOT NULL,
742
  `shares` text NOT NULL,
743
- `attachments` text NOT NULL,
744
  `who_post` text NOT NULL,
745
  PRIMARY KEY (`id`)
746
  ) " . $charset_collate . ";";
747
- $wpdb->query( $wd_fb_data );
748
 
749
- $wd_fb_data_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_data`
750
  MODIFY `name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
751
  MODIFY `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
752
  MODIFY `message` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
753
  ";
754
- $wpdb->query( $wd_fb_data_collation );
755
 
756
- $wd_fb_option = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_option` (
 
 
757
  `id` bigint(20) NOT NULL,
758
  `autoupdate_interval` int(4) NOT NULL,
759
  `app_id` varchar(255) NOT NULL,
@@ -763,337 +695,297 @@ function ffwd_activate() {
763
  `post_date_format` varchar(64) NOT NULL,
764
  `event_date_format` varchar(64) NOT NULL
765
  ) " . $charset_collate . ";";
766
- $wpdb->query( $wd_fb_option );
767
-
768
- /*$ffwd_settings = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "ffwd_settings` (
769
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
770
- `autoupdate_interval` int(4) NOT NULL,
771
- `app_id` varchar(255) NOT NULL,
772
- `app_secret` varchar(255) NOT NULL,
773
- `date_timezone` varchar(64) NOT NULL,
774
- PRIMARY KEY (`id`)
775
- ) DEFAULT CHARSET=utf8;";
776
- $wpdb->query($ffwd_settings);*/
777
-
778
- $wd_fb_theme = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_theme` (
779
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
780
  `name` varchar(255) NOT NULL,
781
  `params` longtext,
782
  `default_theme` tinyint(1) NOT NULL,
783
  PRIMARY KEY (`id`)
784
  ) " . $charset_collate . ";";
785
- $wpdb->query( $wd_fb_theme );
786
 
787
- $exists_default = $wpdb->get_var( 'SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_option' );
788
- if ( ! $exists_default ) {
789
- $save = $wpdb->insert( $wpdb->prefix . 'wd_fb_option', array(
790
- 'id' => 1,
791
- 'autoupdate_interval' => 90,
792
- 'app_id' => '',
793
- 'date_timezone' => '',
794
- 'access_token' => '',
795
- 'post_date_format' => 'ago',
796
- 'event_date_format' => 'F j, Y, g:i a',
797
 
798
 
799
- ) );
800
- }
801
 
802
- $exists_default = $wpdb->get_var( 'SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_theme' );
803
- if ( ! $exists_default ) {
804
- $wpdb->insert( $wpdb->prefix . 'wd_fb_theme', array(
805
- 'name' => 'Theme 1',
806
- 'default_theme' => 1,
807
- 'params' => '{"thumb_margin":"10","thumb_padding":"2","thumb_border_radius":"0","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 0px #000000","thumb_transparent":"100","thumb_align":"center","thumb_hover_effect":"scale","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":"5","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":"10","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":"none","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":"center","blog_style_bg_color":"FFFFFF","blog_style_fd_name_bg_color":"FFFFFF","blog_style_fd_name_align":"left","blog_style_fd_name_padding":"10","blog_style_fd_name_color":"1C1C1C","blog_style_fd_name_size":"24","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":"left","blog_style_margin":"16","blog_style_box_shadow":"","blog_style_border_width":"1","blog_style_border_style":"solid","blog_style_border_color":"EBEBEB","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":"1C1C1C","blog_style_obj_page_name_size":"20","blog_style_obj_page_name_font_weight":"normal","blog_style_obj_story_color":"1C1C1C","blog_style_obj_story_size":"16","blog_style_obj_story_font_weight":"normal","blog_style_obj_place_color":"1C1C1C","blog_style_obj_place_size":"14","blog_style_obj_place_font_weight":"normal","blog_style_obj_name_color":"1C1C1C","blog_style_obj_name_size":"18","blog_style_obj_name_font_weight":"bold","blog_style_obj_message_color":"1C1C1C","blog_style_obj_message_size":"16","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":"FFFFFF","blog_style_obj_likes_social_color":"1C1C1C","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":"10","blog_style_obj_comment_border_style":"solid","blog_style_obj_comment_border_color":"FCFCFC","blog_style_obj_comment_border_type":"top","blog_style_evt_str_color":"1C1C1C","blog_style_evt_str_size":"16","blog_style_evt_str_font_weight":"normal","blog_style_evt_ctzpcn_color":"CFCFCF","blog_style_evt_ctzpcn_size":"14","blog_style_evt_ctzpcn_font_weight":"normal","blog_style_evt_map_color":"1C1C1C","blog_style_evt_map_size":"14","blog_style_evt_map_font_weight":"normal","blog_style_evt_date_color":"CFCFCF","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":"none","album_compact_thumb_hover_effect_value":"1.1","album_compact_thumb_transition":"0","lightbox_overlay_bg_color":"000000","lightbox_overlay_bg_transparent":"60","lightbox_bg_color":"1B1B1B","lightbox_ctrl_btn_pos":"bottom","lightbox_ctrl_btn_align":"center","lightbox_ctrl_btn_height":"16","lightbox_ctrl_btn_margin_top":"24","lightbox_ctrl_btn_margin_left":"10","lightbox_ctrl_btn_transparent":"100","lightbox_ctrl_btn_color":"","lightbox_toggle_btn_height":"14","lightbox_toggle_btn_width":"100","lightbox_ctrl_cont_bg_color":"0A0A0A","lightbox_ctrl_cont_transparent":"100","lightbox_ctrl_cont_border_radius":"4","lightbox_close_btn_transparent":"100","lightbox_close_btn_bg_color":"000000","lightbox_close_btn_border_width":"14","lightbox_close_btn_border_radius":"24px","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":"12","lightbox_close_btn_width":"24","lightbox_close_btn_height":"24","lightbox_close_btn_top":"0","lightbox_close_btn_right":"-30","lightbox_close_btn_full_color":"","lightbox_rl_btn_bg_color":"000000","lightbox_rl_btn_transparent":"70","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":"36","lightbox_rl_btn_width":"36","lightbox_rl_btn_size":"16","lightbox_close_rl_btn_hover_color":"","lightbox_obj_pos":"right","lightbox_obj_width":"350","lightbox_obj_icons_color":"gray","lightbox_obj_date_pos":"after","lightbox_obj_font_family":"inherit","lightbox_obj_info_bg_color":"FFFFFF","lightbox_page_name_color":"4B4B4B","lightbox_obj_page_name_size":"18","lightbox_obj_page_name_font_weight":"bold","lightbox_obj_story_color":"4B4B4B","lightbox_obj_story_size":"16","lightbox_obj_story_font_weight":"normal","lightbox_obj_place_color":"4B4B4B","lightbox_obj_place_size":"14","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":"16","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":"F4F5F7","lightbox_obj_likes_social_color":"000000","lightbox_obj_likes_social_size":"12","lightbox_obj_likes_social_font_weight":"normal","lightbox_obj_comments_bg_color":"FFFFFF","lightbox_obj_comments_color":"4A4A4A","lightbox_obj_comments_font_family":"inherit","lightbox_obj_comments_font_size":"16","lightbox_obj_users_font_color":"4B4B4B","lightbox_obj_comments_social_font_weight":"normal","lightbox_obj_comment_border_width":"1","lightbox_obj_comment_border_style":"none","lightbox_obj_comment_border_color":"000000","lightbox_obj_comment_border_type":"top","lightbox_filmstrip_pos":"bottom","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":"16","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"}',
808
- ) );
809
 
 
 
 
 
 
 
810
 
811
- }
812
- wp_schedule_event( time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook' );
 
 
 
813
 
814
- $old_version = ffwd_get_version();
 
 
 
815
 
816
- $new_version = ffwd_version();
817
- $newer = version_compare( $new_version, $old_version, '>' );
818
- if ( $newer ) {
819
- require_once WD_FFWD_DIR . '/update/ffwd_update.php';
820
- /*adds new params for new versions*/
821
- ffwd_update_diff( $new_version, $old_version );
822
 
 
 
 
 
 
823
 
824
- }
825
 
 
826
 
827
- /*$version = get_option("ffwd_version");
828
- $new_version = '1.0.0';
829
- if ($version && version_compare($version, $new_version, '<')) {
830
- require_once WD_FFWD_DIR . "/update/ffwd_update.php";
831
- ffwd_update($version);
832
- update_option("ffwd_version", $new_version);
833
- }
834
- else {
835
- add_option("ffwd_version", $new_version, '', 'no');
836
- }
837
- */
838
 
839
  }
840
 
841
- register_activation_hook( __FILE__, 'ffwd_activate' );
842
 
843
 
844
  /* On deactivation, remove all functions from the scheduled action hook.*/
845
- function ffwd_deactivate() {
846
- wp_clear_scheduled_hook( 'wd_fb_schedule_event_hook' );
 
847
  }
848
 
849
- register_deactivation_hook( __FILE__, 'ffwd_deactivate' );
850
-
851
- function ffwd_update_hook() {
852
- /*$version = get_option("ffwd_version");
853
- $new_version = '1.0.0';
854
- if ($version && version_compare($version, $new_version, '<')) {
855
- require_once WD_FFWD_DIR . "/update/ffwd_update.php";
856
- ffwd_update($version);
857
- update_option("ffwd_version", $new_version);
858
- }*/
859
-
860
- return false;
861
- }
862
-
863
- if ( ! isset( $_GET['action'] ) || sanitize_text_field($_GET['action']) != 'deactivate' ) {
864
- add_action( 'admin_init', 'ffwd_update_hook' );
865
- }
866
 
867
  // Plugin styles.
868
  function ffwd_styles() {
869
- wp_admin_css( 'thickbox' );
870
- wp_enqueue_style( 'ffwd_tables', WD_FFWD_URL . '/css/ffwd_tables.css', array(), ffwd_get_version() );
871
- wp_register_style('ffwd_topbar', WD_FFWD_URL . '/css/topbar.css', array(), ffwd_get_version());
872
  wp_register_style('ffwd_roboto', 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700');
873
  }
874
 
875
  // Plugin scripts.
876
- function ffwd_scripts() {
877
- wp_enqueue_script( 'thickbox' );
878
- wp_enqueue_script( 'ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version() );
879
- global $wp_scripts;
880
- if ( isset( $wp_scripts->registered['jquery'] ) ) {
881
- $jquery = $wp_scripts->registered['jquery'];
882
- if ( ! isset( $jquery->ver ) OR version_compare( $jquery->ver, '1.8.2', '<' ) ) {
883
- wp_deregister_script( 'jquery' );
884
- wp_register_script( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.10.2' );
885
- }
886
- }
887
- wp_enqueue_script( 'jquery' );
888
- wp_enqueue_script( 'jquery-ui-sortable' );
889
-
 
890
  }
891
 
892
  /* Add pagination to gallery admin pages.*/
893
- function ffwd_add_ffwd_info_per_page_option() {
894
- $option = 'per_page';
895
- $args_galleries = array(
896
- 'label' => 'Items',
897
- 'default' => 20,
898
- 'option' => 'ffwd_info_per_page'
899
- );
900
- add_screen_option( $option, $args_galleries );
 
901
  }
902
 
903
- function ffwd_add_themes_per_page_option() {
904
- $option = 'per_page';
905
- $args_themes = array(
906
- 'label' => 'Themes',
907
- 'default' => 20,
908
- 'option' => 'ffwd_themes_per_page'
909
- );
910
- add_screen_option( $option, $args_themes );
 
911
  }
912
 
913
- add_filter( 'set-screen-option', 'ffwd_set_option_galleries', 10, 3 );
914
- add_filter( 'set-screen-option', 'ffwd_set_option_themes', 10, 3 );
915
 
916
- function ffwd_set_option_galleries( $status, $option, $value ) {
917
- if ( 'ffwd_info_per_page' == $option ) {
918
- return $value;
919
- }
 
920
 
921
- return $status;
922
  }
923
 
924
- function ffwd_set_option_themes( $status, $option, $value ) {
925
- if ( 'ffwd_themes_per_page' == $option ) {
926
- return $value;
927
- }
 
928
 
929
- return $status;
930
  }
931
-
932
  function ffwd_enqueue__admin_scripts(){
933
  wp_enqueue_script( 'ffwd_jquery_form_js', WD_FFWD_URL . '/js/jquery.form.js', array(), ffwd_get_version() );
934
  }
935
 
936
- function ffwd_admin_scripts() {
937
- wp_enqueue_script( 'thickbox' );
938
- wp_enqueue_script( 'ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version() );
939
- wp_localize_script('ffwd_admin', 'ffwd_ajax', array(
940
- 'ajaxurl' => admin_url('admin-ajax.php'),
941
- 'ajaxnonce' => wp_create_nonce(WD_FFWD_URL . '_ajax_nonce'),
942
- ));
943
-
944
-
945
 
946
- global $wp_scripts;
947
- if ( isset( $wp_scripts->registered['jquery'] ) ) {
948
- $jquery = $wp_scripts->registered['jquery'];
949
- if ( ! isset( $jquery->ver ) OR version_compare( $jquery->ver, '1.8.2', '<' ) ) {
950
- wp_deregister_script( 'jquery' );
951
- wp_register_script( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.10.2' );
952
- }
953
- }
954
- wp_enqueue_script( 'jquery' );
955
- wp_enqueue_script( 'jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9' );
956
-
957
- $page = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : '';
958
-
959
- if ( $page == "uninstall_ffwd" ) {
960
-
961
- wp_enqueue_script('ffwd-deactivate-popup', WD_FFWD_URL.'/wd/assets/js/deactivate_popup.js', array(), ffwd_get_version(), true );
962
- $admin_data = wp_get_current_user();
963
-
964
- wp_localize_script( 'ffwd-deactivate-popup', 'ffwdWDDeactivateVars', array(
965
- "prefix" => "ffwd" ,
966
- "deactivate_class" => 'ffwd_deactivate_link',
967
- "email" => $admin_data->data->user_email,
968
- "plugin_wd_url" => "https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin",
969
- ));
970
-
971
- wp_enqueue_style( 'ffwd_deactivate-css', WD_FFWD_URL . '/wd/assets/css/deactivate_popup.css', array(), ffwd_get_version() );
972
-
973
-
974
- }
975
 
 
 
 
 
976
 
 
 
 
 
 
 
 
 
 
 
977
  }
978
 
979
- function ffwd_front_end_scripts() {
980
- $version = ffwd_get_version();
981
- global $wp_scripts;
982
- if ( isset( $wp_scripts->registered['jquery'] ) ) {
983
- $jquery = $wp_scripts->registered['jquery'];
984
- if ( ! isset( $jquery->ver ) OR version_compare( $jquery->ver, '1.8.2', '<' ) ) {
985
- wp_deregister_script( 'jquery' );
986
- wp_register_script( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.10.2' );
987
- }
988
- }
989
- wp_enqueue_script( 'jquery' );
990
- wp_enqueue_script( 'ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version );
991
-
992
-
993
-
994
-
995
- wp_enqueue_style( 'ffwd_frontend', WD_FFWD_FRONT_URL . '/css/ffwd_frontend.css', array(), $version );
996
- // Styles/Scripts for popup.
997
- wp_enqueue_style('ffwd_fonts', WD_FFWD_FRONT_URL . '/css/fonts.css', array(), $version);
998
- wp_enqueue_script( 'ffwd_jquery_mobile', WD_FFWD_FRONT_URL . '/js/jquery.mobile.js', array(), $version );
999
- wp_enqueue_script( 'ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $version );
1000
- wp_enqueue_style( 'ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/css/jquery.mCustomScrollbar.css', array(), $version );
1001
- wp_enqueue_script( 'jquery-fullscreen', WD_FFWD_FRONT_URL . '/js/jquery.fullscreen-0.4.1.js', array(), '0.4.1' );
1002
- wp_enqueue_script( 'ffwd_gallery_box', WD_FFWD_FRONT_URL . '/js/ffwd_gallery_box.js', array(), $version );
1003
- wp_localize_script( 'ffwd_gallery_box', 'ffwd_objectL10n', array(
1004
- 'ffwd_field_required' => __( 'field is required.', 'ffwd' ),
1005
- 'ffwd_mail_validation' => __( 'This is not a valid email address.', 'ffwd' ),
1006
- 'ffwd_search_result' => __( 'There are no images matching your search.', 'ffwd' ),
1007
- ) );
1008
-
1009
- wp_localize_script( 'ffwd_frontend', 'ffwd_frontend_text', array(
1010
- 'comment_reply' => __( 'Reply', 'ffwd' ),
1011
- 'view' => __( 'View', 'ffwd' ),
1012
- 'more_comments' => __( 'more comments', 'ffwd' ),
1013
-
1014
- 'year' => __( 'year', 'ffwd' ),
1015
- 'years' => __( 'years', 'ffwd' ),
1016
- 'hour' => __( 'hour', 'ffwd' ),
1017
- 'hours' => __( 'hours', 'ffwd' ),
1018
- 'months' => __( 'months', 'ffwd' ),
1019
- 'month' => __( 'month', 'ffwd' ),
1020
- 'weeks' => __( 'weeks', 'ffwd' ),
1021
- 'week' => __( 'week', 'ffwd' ),
1022
- 'days' => __( 'days', 'ffwd' ),
1023
- 'day' => __( 'day', 'ffwd' ),
1024
- 'minutes' => __( 'minutes', 'ffwd' ),
1025
- 'minute' => __( 'minute', 'ffwd' ),
1026
- 'seconds' => __( 'seconds', 'ffwd' ),
1027
- 'second' => __( 'second', 'ffwd' ),
1028
- 'ago' => __( 'ago', 'ffwd' ),
 
 
 
1029
  'ajax_url' => admin_url('admin-ajax.php'),
1030
- 'and' => __( 'and', 'ffwd' ),
1031
- 'others' => __( 'others', 'ffwd' ),
1032
-
1033
- ) );
1034
-
1035
 
 
1036
  }
1037
 
1038
  add_action('wp_enqueue_ffwd_front_end_scripts', 'ffwd_front_end_scripts');
1039
  add_action( 'admin_enqueue_scripts', 'ffwd_enqueue__admin_scripts' );
 
 
 
 
 
 
 
 
 
 
 
1040
 
1041
- add_action( 'wp_ajax_ffwd_autoupdate', 'wd_fb_update' );
1042
- add_action( 'wp_ajax_nopriv_ffwd_autoupdate', 'wd_fb_update' );
1043
- /* Add ffwd scheduled event for autoupdatable galleries.*/
1044
- add_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
1045
- function wd_fb_add_autoupdate_interval( $schedules ) {
1046
-
1047
- require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
1048
- $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
1049
-
1050
- $autoupdate_interval=1;
1051
- if($page!='uninstall_ffwd')
1052
- $autoupdate_interval = 1440; //WDFacebookFeed::get_autoupdate_interval();
1053
- // var_dump($autoupdate_interval);
1054
- $schedules['wd_fb_autoupdate_interval'] = array(
1055
- 'interval' => 60 * $autoupdate_interval,
1056
- 'display' => __( 'WD Facebook plugin autoupdate interval.' )
1057
- );
1058
-
1059
- return $schedules;
1060
  }
1061
- add_action( 'wd_fb_schedule_event_hook', 'wd_fb_update' );
 
 
 
1062
  // wd_fb_update();
1063
- function wd_fb_update($from_plugin=0) {
1064
- require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
1065
-
1066
- $current_time=current_time('timestamp');
1067
- $update_time=get_option('ffwd_autoupdate_time');
1068
- $autoupdate_interval = 60;//WDFacebookFeed::get_autoupdate_interval();
1069
- update_option('ffwd_autoupdate_time',$autoupdate_interval*60+$current_time);
1070
-
1071
-
1072
- if(($current_time>=$update_time && $from_plugin) || !$from_plugin )
1073
- {
1074
- global $wpdb;
1075
- $ff_wd_options = get_option('ffwd_pages_list');
1076
- if ( !empty($ff_wd_options) ) {
1077
- foreach ( $ff_wd_options as $ff_wd_option ) {
1078
- $token = $ff_wd_option->access_token;
1079
- $page_id = $ff_wd_option->id;
1080
- WDFacebookFeed::update_page_access_token($token, $page_id);
1081
  }
 
 
 
 
1082
  }
1083
- $query = "SELECT * FROM " . $wpdb->prefix . "wd_fb_info WHERE `update_mode` <> 'no_update'";
1084
- $rows = $wpdb->get_results( $query );
1085
-
1086
- WDFacebookFeed::update_from_shedule( $rows );
1087
- update_option('ffwd_autoupdate_time',$autoupdate_interval*60+current_time('timestamp'));
1088
- }
1089
-
1090
- //die();
1091
-
1092
  }
1093
 
1094
  // Check Valid Token and show message
1095
  $ffwd_token_error_flag = get_option("ffwd_token_error_flag");
1096
  $ffwd_option_reauth_success = ((isset($_GET['success'])) ? $_GET["success"] : '');
 
1097
  if($ffwd_token_error_flag === "1" || $ffwd_option_reauth_success!=""){
1098
  add_action('admin_notices', 'ffwd_token_error_flag_notice');
1099
  }
@@ -1102,7 +994,7 @@ function ffwd_token_error_flag_notice(){
1102
  global $ffwd_token_error_flag, $ffwd_option_reauth_success;
1103
  $screen_base = get_current_screen()->base;
1104
  if($ffwd_token_error_flag === "1"){
1105
- if($screen_base === "dashboard" || $screen_base === "toplevel_page_info_ffwd" || $screen_base === "facebook-feed_page_options_ffwd" || $screen_base === "facebook-feed_page_themes_ffwd" || $screen_base === "facebook-feed_page_uninstall_ffwd" || $screen_base === "facebook-feed_page_ffwd_licensing" ){
1106
  $link_to_reset = "<a href='".site_url()."/wp-admin/admin.php?page=options_ffwd' >reset token</a>";
1107
  if($screen_base === "facebook-feed_page_options_ffwd"){
1108
  $link_to_reset = "reset token";
@@ -1111,86 +1003,59 @@ function ffwd_token_error_flag_notice(){
1111
  }
1112
  }
1113
  if($screen_base === "facebook-feed_page_options_ffwd" && $ffwd_option_reauth_success !=""){
1114
- if($ffwd_option_reauth_success==1){
1115
- echo "<div class='notice notice-success'><p>The Access Token Successfully saved.</p></div>";
1116
- }
1117
- else{
1118
- echo "<div class='notice notice-error'><p>Something wrong. Please try again.</p></div>";
1119
- }
1120
- }
1121
  }
1122
 
 
 
1123
  // Facebook Feed by 10Web Widget.
1124
- if ( class_exists( 'WP_Widget' ) ) {
1125
- add_action('wp_enqueue_scripts', 'ffwd_front_end_scripts');
1126
- require_once( WD_FFWD_DIR . '/admin/controllers/FFWDControllerWidget.php' );
1127
- add_action( 'widgets_init', 'ffwd_register_widget' );
1128
  }
1129
 
1130
  function ffwd_register_widget(){
1131
  return register_widget("FFWDControllerWidget");
1132
  }
1133
 
1134
- // Languages localization.
1135
- function ffwd_language_load() {
1136
- load_plugin_textdomain( 'ffwd', false, basename( dirname( __FILE__ ) ) . '/languages' );
1137
- }
1138
-
1139
- add_action( 'init', 'ffwd_language_load' );
1140
-
1141
- function ffwd_version() {
1142
-
1143
- $version = FFWD_VERSION;
1144
-
1145
- if ( get_option( 'ffwd_version' ) === false ) {
1146
- add_option( 'ffwd_version', $version );
1147
- } else {
1148
- update_option( 'ffwd_version', $version );
1149
- }
1150
-
1151
- return $version;
1152
 
 
 
 
 
1153
  }
1154
 
1155
- function ffwd_get_version() {
1156
- if ( get_option( 'ffwd_version' ) === false ) {
1157
- ffwd_version();
1158
 
1159
- }
 
 
1160
 
1161
- return get_option( 'ffwd_version' );
 
 
 
 
1162
 
 
1163
 
1164
  }
1165
 
1166
-
1167
- function ffwd_add_plugin_meta_links($meta_fields, $file) {
1168
- if ( plugin_basename(__FILE__) == $file ) {
1169
- $plugin_url = "https://wordpress.org/support/plugin/wd-facebook-feed";
1170
- $prefix = 'ffwd';
1171
- $meta_fields[] = "<a href='https://wordpress.org/support/plugin/wd-facebook-feed/#new-post' target='_blank'>" . __('Ask a question', $prefix) . "</a>";
1172
- $meta_fields[] = "<a href='" . $plugin_url . "/reviews#new-post' target='_blank' title='" . __('Rate', $prefix) . "'>
1173
- <i class='wdi-rate-stars'>"
1174
- . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
1175
- . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
1176
- . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
1177
- . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
1178
- . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
1179
- . "</i></a>";
1180
-
1181
- $stars_color = "#ffb900";
1182
-
1183
- echo "<style>"
1184
- . ".wdi-rate-stars{display:inline-block;color:" . $stars_color . ";position:relative;top:3px;}"
1185
- . ".wdi-rate-stars svg{fill:" . $stars_color . ";}"
1186
- . ".wdi-rate-stars svg:hover{fill:" . $stars_color . "}"
1187
- . ".wdi-rate-stars svg:hover ~ svg{fill:none;}"
1188
- . "</style>";
1189
  }
1190
 
1191
- return $meta_fields;
1192
  }
1193
- add_filter("plugin_row_meta", 'ffwd_add_plugin_meta_links', 10, 2);
1194
 
1195
  if (!class_exists('Linkify')) {
1196
  include_once WD_FFWD_DIR . '/framework/linkify/LinkifyInterface.php';
@@ -1205,21 +1070,4 @@ function ffwd_elementor(){
1205
  FFWDElementor::get_instance();
1206
  }
1207
  }
1208
-
1209
- add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'ffwd_add_ask_question_links');
1210
-
1211
- /**
1212
- * Add plugin action links.
1213
- *
1214
- * Add a link to the settings page on the plugins.php page.
1215
- *
1216
- * @since 1.0.0
1217
- *
1218
- * @param array $links List of existing plugin action links.
1219
- * @return array List of modified plugin action links.
1220
- */
1221
- function ffwd_add_ask_question_links ( $links ) {
1222
- $url = 'https://wordpress.org/support/plugin/wd-facebook-feed/#new-post';
1223
- $fm_ask_question_link = array('<a href="' . $url . '" target="_blank">' . __('Help', WD_FB_PREFIX) . '</a>');
1224
- return array_merge( $links, $fm_ask_question_link );
1225
- }
1
  <?php
2
  /**
3
+ * Plugin Name: 10Web Social Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
6
+ * Version: 1.2.0
7
  * Author: 10Web
8
  * Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
  */
11
 
12
+ define('WD_FFWD_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
13
+ define('WD_FFWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
14
+ define('WD_FFWD_MAIN_FILE', plugin_basename(__FILE__));
15
+ define('WD_FB_PREFIX', 'ffwd');
16
+ define('WD_FB_IS_FREE', true);
17
+ if ( !defined('FFWD_VERSION') ) {
18
+ define('FFWD_VERSION', '1.2.0');
19
  }
20
  add_action( 'admin_init', 'ffwd_init' );
21
 
23
  ffwd_privacy_policy();
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  function ffwd_use_home_url() {
27
+ $home_url = str_replace("http://", "", home_url());
28
+ $home_url = str_replace("https://", "", $home_url);
29
+ $pos = strpos($home_url, "/");
30
+ if ($pos) {
31
+ $home_url = substr($home_url, 0, $pos);
32
+ }
33
 
34
+ $site_url = str_replace("http://", "", WD_FFWD_URL);
35
+ $site_url = str_replace("https://", "", $site_url);
36
+ $pos = strpos($site_url, "/");
37
+ if ($pos) {
38
+ $site_url = substr($site_url, 0, $pos);
39
+ }
40
 
41
+ return $site_url != $home_url;
42
  }
43
 
44
+ if (ffwd_use_home_url()) {
45
+ define('WD_FFWD_FRONT_URL', home_url("wp-content/plugins/" . plugin_basename(dirname(__FILE__))));
46
  } else {
47
+ define('WD_FFWD_FRONT_URL', WD_FFWD_URL);
48
  }
49
 
50
  add_action('init', 'ffwd_silent_update');
57
 
58
  // Plugin menu.
59
  function ffwd_menu_panel() {
60
+ if ( empty(get_option('ffwd_pages_list')) ) {
61
+ $parent_slug = 'options_ffwd';
62
  add_menu_page('Facebook Feed', 'Facebook Feed', 'manage_options', $parent_slug, 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
63
  $galleries_page = add_submenu_page($parent_slug, 'Options', 'Options', 'manage_options', 'options_ffwd', 'ffwd_menu');
64
  add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
65
  add_action('admin_print_scripts-' . $galleries_page, 'ffwd_scripts');
66
  add_action('load-' . $galleries_page, 'ffwd_add_themes_per_page_option');
67
+ }
68
+ else {
69
+ $parent_slug = 'info_ffwd';
 
 
70
  add_menu_page('Facebook Feed', 'Facebook Feed', 'manage_options', $parent_slug, 'ffwd_menu', WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png');
71
  $galleries_page = add_submenu_page($parent_slug, 'Feeds', 'Feeds', 'manage_options', 'info_ffwd', 'ffwd_menu');
72
  add_action('admin_print_styles-' . $galleries_page, 'ffwd_styles');
79
  add_action('admin_print_styles-' . $themes_page, 'ffwd_styles');
80
  add_action('admin_print_scripts-' . $themes_page, 'ffwd_admin_scripts');
81
  add_action('load-' . $themes_page, 'ffwd_add_themes_per_page_option');
82
+ if ( WD_FB_IS_FREE ) {
83
+ $licensing_page = add_submenu_page($parent_slug, 'Get Premium', 'Get Premium', 'manage_options', 'ffwd_licensing', 'ffwd_licensing_page');
84
+ add_action('admin_print_styles-' . $licensing_page, 'ffwd_styles');
85
+ /* Custom link to wordpress.org*/ global $submenu;
86
+ $url = 'https://wordpress.org/support/plugin/wd-facebook-feed/#new-post';
87
+ $submenu[$parent_slug][] = array(
88
+ '<div id="ffwd_ask_question">' . __('Ask a question', 'ffwd_menu') . '</div>',
89
+ 'manage_options',
90
+ $url,
91
+ );
92
+ }
 
 
93
  }
94
+ $uninstall_page = add_submenu_page($parent_slug, 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
95
+ add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
96
+ add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
97
  }
98
+ add_action('admin_menu', 'ffwd_menu_panel', 9);
 
 
99
 
100
  function ffwd_privacy_policy() {
101
  if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
188
  ),
189
  6 => array(
190
  "title" => __("Social Buttons"),
191
+ "description" => __("Increase social engagement of your Facebook feed by activating the Facebook, Twitter buttons. Allow your site visitors to share posts, photos and videos from your FB feed to their preferred social channel.", "wd_ads"),
192
  ),
193
  ),
194
  "user_guide" => array(
242
  "plugin_wizard_link" => NULL,
243
  "plugin_menu_title" => "Facebook Feed by 10Web",
244
  "plugin_menu_icon" => WD_FFWD_URL . '/images/ffwd/ffwd_logo_small.png',
245
+ "deactivate" => FALSE,
246
+ "subscribe" => FALSE,
247
  "custom_post" => 'info_ffwd',
248
  "display_overview" => FALSE,
249
  );
251
  }
252
  }
253
 
254
+ function ffwd_add_uninstall_submenu()
255
+ {
256
+ $uninstall_page = add_submenu_page('overview_ffwd', 'Uninstall', 'Uninstall', 'manage_options', 'uninstall_ffwd', 'ffwd_menu');
257
+ add_action('admin_print_styles-' . $uninstall_page, 'ffwd_styles');
258
+ add_action('admin_print_scripts-' . $uninstall_page, 'ffwd_admin_scripts');
259
+ }
260
 
261
+ add_action('admin_menu', 'ffwd_add_uninstall_submenu');
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
 
 
263
 
264
  function ffwd_menu() {
265
+ global $wpdb;
266
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
267
+ $page = WDW_FFWD_Library::get('page');
268
+ if (($page != '') && (($page == 'info_ffwd') || ($page == 'overview_ffwd') || ($page == 'options_ffwd') || ($page == 'themes_ffwd') || ($page == 'uninstall_ffwd') || ($page == 'FFWDShortcode'))) {
269
+
270
+ $acc_tocken = $wpdb->get_var("SELECT access_token FROM " . $wpdb->prefix . "wd_fb_option WHERE id=1");
271
+ if ($acc_tocken != '') {
272
+ delete_option('ffwd_limit_notice');
273
+ }
274
+ $ffwd_limit_notice = get_option('ffwd_limit_notice');
 
 
 
275
  require_once 'framework/WDFacebookFeed.php';
276
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . (($page == 'FFWDShortcode') ? $page : ucfirst(strtolower($page))) . '.php');
277
+ $controller_class = 'FFWDController' . ucfirst(strtolower($page));
278
+ $controller = new $controller_class();
279
+ $controller->execute();
280
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
 
 
283
  function FFWD_licensing_page() {
284
+ $controller_class = 'FFWDControllerLicensing_ffwd';
285
+ require_once( WD_FFWD_DIR . '/admin/controllers/' . $controller_class . '.php' );
286
+ $controller = new $controller_class();
287
+ $controller->execute();
288
  }
289
 
 
290
  function ffwd_ajax_frontend() {
291
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
292
+ $page = WDW_FFWD_Library::get('action');
293
+ if ( $page != '' && $page == 'PopupBox' ) {
294
+ require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDController' . ucfirst($page) . '.php');
295
+ $controller_class = 'FFWDController' . ucfirst($page);
296
+ $controller = new $controller_class();
297
+ $controller->execute();
298
+ }
299
  }
300
 
301
+ add_action('wp_ajax_PopupBox', 'ffwd_ajax_frontend');
302
+ add_action('wp_ajax_nopriv_PopupBox', 'ffwd_ajax_frontend');
303
  // For facebook feed
304
+ add_action('wp_ajax_nopriv_save_facebook_feed', 'ffwd_ajax');
305
+ add_action('wp_ajax_save_facebook_feed', 'ffwd_ajax');
306
  // For check app
307
+ add_action('wp_ajax_nopriv_check_app', 'ffwd_ajax');
308
+ add_action('wp_ajax_check_app', 'ffwd_ajax');
309
  // For drop objects
310
+ add_action('wp_ajax_nopriv_dropp_objects', 'ffwd_ajax');
311
+ add_action('wp_ajax_dropp_objects', 'ffwd_ajax');
312
+
313
 
314
  // For reset_cache
315
  add_action( 'wp_ajax_ffwd_reset_cache', 'ffwd_reset_cache' );
316
 
317
  function ffwd_reset_cache(){
318
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field($_POST['nonce']), WD_FFWD_URL . '_ajax_nonce' )) {
319
  delete_option("ffwd_autoupdate_time");
320
  echo json_encode(array("success"=>true));die;
321
  }
322
  echo json_encode(array("success"=>false));die;
323
  }
324
 
325
+ function ffwd_ajax()
326
+ {
327
+ if (function_exists('current_user_can')) {
328
+ if (!current_user_can('manage_options')) {
329
+ die('Access Denied');
330
+ }
331
+ } else {
332
+ die('Access Denied');
333
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
336
+ $page = WDW_FFWD_Library::get('action');
337
+ $nonce = ($page == 'save_facebook_feed' || $page == 'dropp_objects') ? 'info_ffwd' : (($page == 'check_app') ? 'options_ffwd' : $page);
338
+ if (($page != 'FFWDShortcode') && !WDW_FFWD_Library::verify_nonce($nonce)) {
339
+ die('Sorry, your nonce did not verify.');
340
+ }
341
 
342
+ if ($page == 'FFWDShortcode') {
343
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDController' . ucfirst($page) . '.php');
344
+ $controller_class = 'FFWDController' . ucfirst($page);
345
+ $controller = new $controller_class();
346
+ $controller->execute();
347
+ }
348
+ else if ($page == 'check_app' || $page == 'save_facebook_feed' || $page == 'dropp_objects') {
349
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
350
+ WDFacebookFeed::execute();
351
+ }
352
+ }
353
 
354
+ function ffwd_shortcode($params) {
355
+ global $wpdb;
356
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
357
+ $check_fb_feed = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $params['id']));
358
+ if ( !$check_fb_feed ) {
359
+ echo WDW_FFWD_Library::message(__('Feed Doesn\'t exists', 'bwg'), 'error');
360
+ return;
361
+ }
362
+ $params['fb_id'] = $params['id'];
363
+ ob_start();
364
+ ffwd_front_end($params);
365
 
366
+ return str_replace(array("\r\n", "\n", "\r"), '', ob_get_clean());
367
  }
368
 
369
+ add_shortcode('WD_FB', 'ffwd_shortcode');
 
370
  $ffwd = 0;
371
  function ffwd_front_end( $params ) {
372
  /* Enqueue css/js in frontend */
373
  do_action("wp_enqueue_ffwd_front_end_scripts");
374
+ global $ffwd;
375
+ require_once(WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php');
376
+ $fb_view_type = 'Blog_style';
377
+ $controller = new FFWDControllerMain($params, 1, $ffwd, ucfirst($fb_view_type));
378
+ $ffwd++;
379
 
380
+ return;
 
 
 
 
 
381
  }
382
 
383
  // Add the Facebook Feed by 10Web button.
384
+ function ffwd_add_button($buttons)
385
+ {
386
+ array_push($buttons, "wd_fb_mce");
387
 
388
+ return $buttons;
389
  }
390
 
391
  // Register Facebook Feed by 10Web button.
392
+ function ffwd_register($plugin_array)
393
+ {
394
  if(is_admin()) {
395
  $url = WD_FFWD_URL . '/js/ffwd_editor_button.js';
396
  $plugin_array["wd_fb_mce"] = $url;
397
  }
398
 
399
+ return $plugin_array;
400
  }
401
 
402
+ function ffwd_admin_ajax()
403
+ {
404
+ $query_url = wp_nonce_url(admin_url('admin-ajax.php'), '', 'ffwd_nonce');
405
+ ?>
406
  <script>
407
+ var ffwd_admin_ajax = '<?php echo add_query_arg(array('action' => 'FFWDShortcode'), admin_url('admin-ajax.php')); ?>';
408
+ var ffwd_plugin_url = '<?php echo WD_FFWD_URL; ?>';
409
+ var ajax_url = '<?php echo $query_url; ?>';
410
  </script>
411
+ <?php
412
  }
413
 
 
414
 
415
 
416
  add_filter('tw_get_plugin_blocks', 'ffwd_register_plugin_block');
463
  */
464
  function ffwd_enqueue_block_editor_assets() {
465
 
466
+
467
+
468
  // Remove previously registered or enqueued versions
469
  $wp_scripts = wp_scripts();
470
  foreach ($wp_scripts->registered as $key => $value) {
474
  wp_deregister_style( $key );
475
  }
476
  }
477
+ // Get plugin blocks from all 10Web plugins.
478
+ $blocks = apply_filters('tw_get_plugin_blocks', array());
479
+ // Get the last version from all 10Web plugins.
480
+ $assets = apply_filters('tw_get_block_editor_assets', array());
481
+ // Not performing unregister or unenqueue as in old versions all are with prefixes.
482
+ wp_enqueue_script('tw-gb-block', $assets['js_path'], array( 'wp-blocks', 'wp-element' ), $assets['version']);
483
+ wp_localize_script('tw-gb-block', 'tw_obj_translate', array(
484
+ 'nothing_selected' => __('Nothing selected.', WD_FB_PREFIX),
485
+ 'empty_item' => __('- Select -', WD_FB_PREFIX),
486
+ 'blocks' => json_encode($blocks)
487
+ ));
488
  wp_enqueue_style('tw-gb-block', $assets['css_path'], array( 'wp-edit-blocks' ), $assets['version']);
489
  }
490
 
491
 
492
 
493
+ add_action('admin_head', 'ffwd_admin_ajax');
494
+
495
  // Add the Facebook Feed by 10Web button to editor.
496
+ add_action('wp_ajax_FFWDShortcode', 'ffwd_ajax');
497
+ add_filter('mce_external_plugins', 'ffwd_register');
498
+ add_filter('mce_buttons', 'ffwd_add_button', 0);
499
 
500
  // Activate plugin.
501
+ function ffwd_activate()
502
+ {
503
+ $current_time=current_time('timestamp');
504
+ $autoupdate_interval = 60;
505
+ update_option('ffwd_autoupdate_time',$autoupdate_interval*60+$current_time);
506
+ global $wpdb;
507
 
508
+ delete_transient('ffwd_update_check');
509
 
510
+ $charset_collate = $wpdb->get_charset_collate();
511
+ $wd_fb_shortcode = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_shortcode` (
 
512
  `id` bigint(20) NOT NULL,
513
  `tagtext` mediumtext NOT NULL,
514
  PRIMARY KEY (`id`)
515
  ) " . $charset_collate . ";";
516
+ $wpdb->query($wd_fb_shortcode);
517
 
518
+ $wd_fb_info = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_info` (
519
  `id` int(10) NOT NULL AUTO_INCREMENT,
520
  `name` varchar(255) NOT NULL,
521
  `page_access_token` text NOT NULL,
606
  `page_plugin_cover` tinyint(1) NOT NULL,
607
  `page_plugin_header` tinyint(1) NOT NULL,
608
  `page_plugin_width` int(4) NOT NULL,
609
+ `image_onclick_action` varchar(32) NOT NULL,
610
+ `event_order` tinyint(4) NOT NULL,
611
  `upcoming_events` tinyint(4) NOT NULL,
612
  `fb_page_id` varchar(32) NOT NULL,
613
  PRIMARY KEY (`id`)
614
  ) " . $charset_collate . ";";
615
 
616
 
617
+ $wpdb->query($wd_fb_info);
618
+
619
 
620
  $old_version = ffwd_get_version();
621
 
626
  }
627
 
628
  if($FFWD_version_compare){
629
+ $wd_fb_info_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_info`
630
  ADD `fb_page_id` varchar(32) NOT NULL AFTER `upcoming_events`";
631
+ $wpdb->query($wd_fb_info_collation);
632
  }
633
 
634
  if(substr($old_version,0,1) === '1'){
638
  }
639
 
640
  if($FFWD_version_compare){
641
+ $wd_fb_info_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_info`
642
  ADD `page_access_token` text NOT NULL AFTER `name`";
643
+ $wpdb->query($wd_fb_info_collation);
644
  }
645
 
646
+ //message-i , description , name encoding --> utf16_bin
647
+ $wd_fb_data = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_data` (
 
648
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
649
  `fb_id` int NOT NULL,
650
  `from` varchar(32) NOT NULL,
668
  `created_time` varchar(64) NOT NULL,
669
  `updated_time` varchar(64) NOT NULL,
670
  `created_time_number` bigint(255) NOT NULL,
671
+ `reactions` text NOT NULL,
672
  `comments` text NOT NULL,
673
  `shares` text NOT NULL,
674
+ `attachments` text NOT NULL,
675
  `who_post` text NOT NULL,
676
  PRIMARY KEY (`id`)
677
  ) " . $charset_collate . ";";
678
+ $wpdb->query($wd_fb_data);
679
 
680
+ $wd_fb_data_collation = "ALTER TABLE `" . $wpdb->prefix . "wd_fb_data`
681
  MODIFY `name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
682
  MODIFY `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
683
  MODIFY `message` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
684
  ";
 
685
 
686
+ $wpdb->query($wd_fb_data_collation);
687
+
688
+ $wd_fb_option = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_option` (
689
  `id` bigint(20) NOT NULL,
690
  `autoupdate_interval` int(4) NOT NULL,
691
  `app_id` varchar(255) NOT NULL,
695
  `post_date_format` varchar(64) NOT NULL,
696
  `event_date_format` varchar(64) NOT NULL
697
  ) " . $charset_collate . ";";
698
+ $wpdb->query($wd_fb_option);
699
+
700
+ /*$ffwd_settings = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "ffwd_settings` (
701
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
702
+ `autoupdate_interval` int(4) NOT NULL,
703
+ `app_id` varchar(255) NOT NULL,
704
+ `app_secret` varchar(255) NOT NULL,
705
+ `date_timezone` varchar(64) NOT NULL,
706
+ PRIMARY KEY (`id`)
707
+ ) DEFAULT CHARSET=utf8;";
708
+ $wpdb->query($ffwd_settings);*/
709
+
710
+ $wd_fb_theme = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "wd_fb_theme` (
711
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
712
  `name` varchar(255) NOT NULL,
713
  `params` longtext,
714
  `default_theme` tinyint(1) NOT NULL,
715
  PRIMARY KEY (`id`)
716
  ) " . $charset_collate . ";";
717
+ $wpdb->query($wd_fb_theme);
718
 
719
+ $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_option');
720
+ if (!$exists_default) {
721
+ $save = $wpdb->insert($wpdb->prefix . 'wd_fb_option', array(
722
+ 'id' => 1,
723
+ 'autoupdate_interval' => 90,
724
+ 'app_id' => '',
725
+ 'date_timezone' => '',
726
+ 'access_token' => '',
727
+ 'post_date_format' => 'ago',
728
+ 'event_date_format' => 'F j, Y, g:i a',
729
 
730
 
731
+ ));
732
+ }
733
 
734
+ $exists_default = $wpdb->get_var('SELECT count(id) FROM ' . $wpdb->prefix . 'wd_fb_theme');
 
 
 
 
 
 
735
 
736
+ if (!$exists_default) {
737
+ $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
738
+ 'name' => 'Theme 1',
739
+ 'default_theme' => 1,
740
+ 'params' => '{"thumb_margin":"10","thumb_padding":"2","thumb_border_radius":"0","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 0px #000000","thumb_transparent":"100","thumb_align":"center","thumb_hover_effect":"scale","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":"5","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":"10","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":"none","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":"center","blog_style_bg_color":"FFFFFF","blog_style_fd_name_bg_color":"FFFFFF","blog_style_fd_name_align":"left","blog_style_fd_name_padding":"10","blog_style_fd_name_color":"1C1C1C","blog_style_fd_name_size":"24","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":"left","blog_style_margin":"16","blog_style_box_shadow":"","blog_style_border_width":"1","blog_style_border_style":"solid","blog_style_border_color":"EBEBEB","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":"1C1C1C","blog_style_obj_page_name_size":"20","blog_style_obj_page_name_font_weight":"normal","blog_style_obj_story_color":"1C1C1C","blog_style_obj_story_size":"16","blog_style_obj_story_font_weight":"normal","blog_style_obj_place_color":"1C1C1C","blog_style_obj_place_size":"14","blog_style_obj_place_font_weight":"normal","blog_style_obj_name_color":"1C1C1C","blog_style_obj_name_size":"18","blog_style_obj_name_font_weight":"bold","blog_style_obj_message_color":"1C1C1C","blog_style_obj_message_size":"16","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":"FFFFFF","blog_style_obj_likes_social_color":"1C1C1C","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":"10","blog_style_obj_comment_border_style":"solid","blog_style_obj_comment_border_color":"FCFCFC","blog_style_obj_comment_border_type":"top","blog_style_evt_str_color":"1C1C1C","blog_style_evt_str_size":"16","blog_style_evt_str_font_weight":"normal","blog_style_evt_ctzpcn_color":"CFCFCF","blog_style_evt_ctzpcn_size":"14","blog_style_evt_ctzpcn_font_weight":"normal","blog_style_evt_map_color":"1C1C1C","blog_style_evt_map_size":"14","blog_style_evt_map_font_weight":"normal","blog_style_evt_date_color":"CFCFCF","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":"none","album_compact_thumb_hover_effect_value":"1.1","album_compact_thumb_transition":"0","lightbox_overlay_bg_color":"000000","lightbox_overlay_bg_transparent":"60","lightbox_bg_color":"1B1B1B","lightbox_ctrl_btn_pos":"bottom","lightbox_ctrl_btn_align":"center","lightbox_ctrl_btn_height":"16","lightbox_ctrl_btn_margin_top":"24","lightbox_ctrl_btn_margin_left":"10","lightbox_ctrl_btn_transparent":"100","lightbox_ctrl_btn_color":"ffffff","lightbox_toggle_btn_height":"14","lightbox_toggle_btn_width":"100","lightbox_ctrl_cont_bg_color":"0A0A0A","lightbox_ctrl_cont_transparent":"100","lightbox_ctrl_cont_border_radius":"4","lightbox_close_btn_transparent":"100","lightbox_close_btn_bg_color":"000000","lightbox_close_btn_border_width":"14","lightbox_close_btn_border_radius":"24px","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":"12","lightbox_close_btn_width":"24","lightbox_close_btn_height":"24","lightbox_close_btn_top":"0","lightbox_close_btn_right":"-30","lightbox_close_btn_full_color":"","lightbox_rl_btn_bg_color":"000000","lightbox_rl_btn_transparent":"70","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":"36","lightbox_rl_btn_width":"36","lightbox_rl_btn_size":"16","lightbox_close_rl_btn_hover_color":"","lightbox_obj_pos":"right","lightbox_obj_width":"350","lightbox_obj_icons_color":"gray","lightbox_obj_date_pos":"after","lightbox_obj_font_family":"inherit","lightbox_obj_info_bg_color":"FFFFFF","lightbox_page_name_color":"4B4B4B","lightbox_obj_page_name_size":"18","lightbox_obj_page_name_font_weight":"bold","lightbox_obj_story_color":"4B4B4B","lightbox_obj_story_size":"16","lightbox_obj_story_font_weight":"normal","lightbox_obj_place_color":"4B4B4B","lightbox_obj_place_size":"14","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":"16","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":"F4F5F7","lightbox_obj_likes_social_color":"000000","lightbox_obj_likes_social_size":"12","lightbox_obj_likes_social_font_weight":"normal","lightbox_obj_comments_bg_color":"FFFFFF","lightbox_obj_comments_color":"4A4A4A","lightbox_obj_comments_font_family":"inherit","lightbox_obj_comments_font_size":"16","lightbox_obj_users_font_color":"4B4B4B","lightbox_obj_comments_social_font_weight":"normal","lightbox_obj_comment_border_width":"1","lightbox_obj_comment_border_style":"none","lightbox_obj_comment_border_color":"000000","lightbox_obj_comment_border_type":"top","lightbox_filmstrip_pos":"bottom","lightbox_filmstrip_rl_bg_color":"3B3B3B","lightbox_filmstrip_rl_btn_size":"20","lightbox_filmstrip_rl_btn_color":"ffffff","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":"16","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"}',
741
+ ));
742
 
743
+ $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
744
+ 'name' => 'Theme 2',
745
+ 'default_theme' => 0,
746
+ 'params' => '{"thumb_margin":"10","thumb_padding":"2","thumb_border_radius":"0px","thumb_border_width":"0","thumb_border_style":"none","thumb_border_color":"000000","thumb_bg_color":"BBCED4","thumbs_bg_color":"FFFFFF","thumb_bg_transparent":"100","thumb_box_shadow":"0px 0px 0px #000000","thumb_transparent":"100","thumb_align":"center","thumb_hover_effect":"rotate","thumb_hover_effect_value":"1deg","thumb_transition":"1","thumb_title_font_color":"1F1F1F","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":"BBCED2","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":"1F1F1F","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":"BBCED4","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":"0","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":"BBCED4","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":"ffffff","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":"000000","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":"BBCED4","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":"ffffff","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"}',
747
+ ));
748
 
749
+ $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
750
+ 'name' => 'Theme 3',
751
+ 'default_theme' => 0,
752
+ '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":"C3E0CE","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":"191919","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":"C3E0CE","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":"191919","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":"C3E0CE","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":"191919","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":"C3E0CE","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":"ffffff","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":"C3E0CE","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":"ffffff","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"}',
753
 
754
+ ));
 
 
 
 
 
755
 
756
+ $wpdb->insert($wpdb->prefix . 'wd_fb_theme', array(
757
+ 'name' => 'Theme 4',
758
+ 'default_theme' => 0,
759
+ '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":"CFC3DB","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":"191919","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":"CFC3DB","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":"191919","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":"CFC3DB","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":"191919","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":"0","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":"CFC3DB","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":"ffffff","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":"CFC3DB","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":"ffffff","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"}',
760
+ ));
761
 
762
+ }
763
 
764
+ wp_schedule_event(time(), 'wd_fb_autoupdate_interval', 'wd_fb_schedule_event_hook');
765
 
766
+ ffwd_version();
 
 
 
 
 
 
 
 
 
 
767
 
768
  }
769
 
770
+ register_activation_hook(__FILE__, 'ffwd_activate');
771
 
772
 
773
  /* On deactivation, remove all functions from the scheduled action hook.*/
774
+ function ffwd_deactivate()
775
+ {
776
+ wp_clear_scheduled_hook('wd_fb_schedule_event_hook');
777
  }
778
 
779
+ register_deactivation_hook(__FILE__, 'ffwd_deactivate');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
 
781
  // Plugin styles.
782
  function ffwd_styles() {
783
+ wp_admin_css('thickbox');
784
+ wp_enqueue_style('ffwd_tables', WD_FFWD_URL . '/css/ffwd_tables.css', array(), ffwd_get_version());
785
+ wp_register_style('ffwd_topbar', WD_FFWD_URL . '/css/topbar.css', array(), ffwd_get_version());
786
  wp_register_style('ffwd_roboto', 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700');
787
  }
788
 
789
  // Plugin scripts.
790
+ function ffwd_scripts()
791
+ {
792
+ wp_enqueue_script('thickbox');
793
+ wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version());
794
+
795
+ global $wp_scripts;
796
+ if (isset($wp_scripts->registered['jquery'])) {
797
+ $jquery = $wp_scripts->registered['jquery'];
798
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
799
+ wp_deregister_script('jquery');
800
+ wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.10.2');
801
+ }
802
+ }
803
+ wp_enqueue_script('jquery');
804
+ wp_enqueue_script('jquery-ui-sortable');
805
  }
806
 
807
  /* Add pagination to gallery admin pages.*/
808
+ function ffwd_add_ffwd_info_per_page_option()
809
+ {
810
+ $option = 'per_page';
811
+ $args_galleries = array(
812
+ 'label' => 'Items',
813
+ 'default' => 20,
814
+ 'option' => 'ffwd_info_per_page'
815
+ );
816
+ add_screen_option($option, $args_galleries);
817
  }
818
 
819
+ function ffwd_add_themes_per_page_option()
820
+ {
821
+ $option = 'per_page';
822
+ $args_themes = array(
823
+ 'label' => 'Themes',
824
+ 'default' => 20,
825
+ 'option' => 'ffwd_themes_per_page'
826
+ );
827
+ add_screen_option($option, $args_themes);
828
  }
829
 
830
+ add_filter('set-screen-option', 'ffwd_set_option_galleries', 10, 3);
831
+ add_filter('set-screen-option', 'ffwd_set_option_themes', 10, 3);
832
 
833
+ function ffwd_set_option_galleries($status, $option, $value)
834
+ {
835
+ if ('ffwd_info_per_page' == $option) {
836
+ return $value;
837
+ }
838
 
839
+ return $status;
840
  }
841
 
842
+ function ffwd_set_option_themes($status, $option, $value)
843
+ {
844
+ if ('ffwd_themes_per_page' == $option) {
845
+ return $value;
846
+ }
847
 
848
+ return $status;
849
  }
 
850
  function ffwd_enqueue__admin_scripts(){
851
  wp_enqueue_script( 'ffwd_jquery_form_js', WD_FFWD_URL . '/js/jquery.form.js', array(), ffwd_get_version() );
852
  }
853
 
854
+ function ffwd_admin_scripts()
855
+ {
 
 
 
 
 
 
 
856
 
857
+ wp_enqueue_script('thickbox');
858
+ wp_enqueue_script('ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
859
 
860
+ wp_localize_script('ffwd_admin', 'ffwd_ajax', array(
861
+ 'ajaxurl' => admin_url('admin-ajax.php'),
862
+ 'ajaxnonce' => wp_create_nonce(WD_FFWD_URL . '_ajax_nonce'),
863
+ ));
864
 
865
+ global $wp_scripts;
866
+ if (isset($wp_scripts->registered['jquery'])) {
867
+ $jquery = $wp_scripts->registered['jquery'];
868
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
869
+ wp_deregister_script('jquery');
870
+ wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.10.2');
871
+ }
872
+ }
873
+ wp_enqueue_script('jquery');
874
+ wp_enqueue_script('jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9');
875
  }
876
 
877
+ function ffwd_front_end_scripts()
878
+ {
879
+ $version = ffwd_get_version();
880
+ global $wp_scripts;
881
+ if (isset($wp_scripts->registered['jquery'])) {
882
+ $jquery = $wp_scripts->registered['jquery'];
883
+ if (!isset($jquery->ver) OR version_compare($jquery->ver, '1.8.2', '<')) {
884
+ wp_deregister_script('jquery');
885
+ wp_register_script('jquery', false, array('jquery-core', 'jquery-migrate'), '1.10.2');
886
+ }
887
+ }
888
+ wp_enqueue_script('jquery');
889
+ wp_enqueue_script('ffwd_frontend', WD_FFWD_FRONT_URL . '/js/ffwd_frontend.js', array(), $version);
890
+ /*wp_localize_script('ffwd_frontend', 'wd_ffwd',
891
+ array(
892
+ 'ajax_url' => admin_url('admin-ajax.php'),
893
+
894
+ ));*/
895
+
896
+ wp_enqueue_style('ffwd_frontend', WD_FFWD_FRONT_URL . '/css/ffwd_frontend.css', array(), $version);
897
+ // Styles/Scripts for popup.
898
+ wp_enqueue_style('ffwd_fonts', WD_FFWD_FRONT_URL . '/css/fonts.css', array(), $version);
899
+ wp_enqueue_script('ffwd_jquery_mobile', WD_FFWD_FRONT_URL . '/js/jquery.mobile.js', array(), $version);
900
+ wp_enqueue_script('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $version);
901
+ wp_enqueue_style('ffwd_mCustomScrollbar', WD_FFWD_FRONT_URL . '/css/jquery.mCustomScrollbar.css', array(), $version);
902
+ wp_enqueue_script('jquery-fullscreen', WD_FFWD_FRONT_URL . '/js/jquery.fullscreen-0.4.1.js', array(), '0.4.1');
903
+ wp_enqueue_script('ffwd_gallery_box', WD_FFWD_FRONT_URL . '/js/ffwd_gallery_box.js', array(), $version);
904
+ wp_localize_script('ffwd_gallery_box', 'ffwd_objectL10n', array(
905
+ 'ffwd_field_required' => __('field is required.', 'bwg'),
906
+ 'ffwd_mail_validation' => __('This is not a valid email address.', 'bwg'),
907
+ 'ffwd_search_result' => __('There are no images matching your search.', 'bwg'),
908
+ ));
909
+
910
+ wp_localize_script('ffwd_frontend', 'ffwd_frontend_text', array(
911
+ 'comment_reply' => __('Reply', 'ffwd'),
912
+ 'view' => __('View', 'ffwd'),
913
+ 'more_comments' => __('more comments', 'ffwd'),
914
+
915
+ 'year' => __('year', 'ffwd'),
916
+ 'years' => __('years', 'ffwd'),
917
+ 'hour' => __('hour', 'ffwd'),
918
+ 'hours' => __('hours', 'ffwd'),
919
+ 'months' => __('months', 'ffwd'),
920
+ 'month' => __('month', 'ffwd'),
921
+ 'weeks' => __('weeks', 'ffwd'),
922
+ 'week' => __('week', 'ffwd'),
923
+ 'days' => __('days', 'ffwd'),
924
+ 'day' => __('day', 'ffwd'),
925
+ 'minutes' => __('minutes', 'ffwd'),
926
+ 'minute' => __('minute', 'ffwd'),
927
+ 'seconds' => __('seconds', 'ffwd'),
928
+ 'second' => __('second', 'ffwd'),
929
+ 'ago' => __('ago', 'ffwd'),
930
  'ajax_url' => admin_url('admin-ajax.php'),
931
+ 'and' => __('and', 'ffwd'),
932
+ 'others' => __('others', 'ffwd'),
 
 
 
933
 
934
+ ));
935
  }
936
 
937
  add_action('wp_enqueue_ffwd_front_end_scripts', 'ffwd_front_end_scripts');
938
  add_action( 'admin_enqueue_scripts', 'ffwd_enqueue__admin_scripts' );
939
+ add_action('wp_ajax_ffwd_autoupdate', 'wd_fb_update');
940
+ add_action('wp_ajax_nopriv_ffwd_autoupdate', 'wd_fb_update');
941
+ /* Add bwg scheduled event for autoupdatable galleries.*/
942
+ function wd_fb_add_autoupdate_interval($schedules)
943
+ {
944
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
945
+ $autoupdate_interval = WDFacebookFeed::get_autoupdate_interval();
946
+ $schedules['wd_fb_autoupdate_interval'] = array(
947
+ 'interval' => 86400,// 60 * $autoupdate_interval,
948
+ 'display' => __('WD Facebook plugin autoupdate interval.')
949
+ );
950
 
951
+ return $schedules;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
952
  }
953
+
954
+ add_filter('cron_schedules', 'wd_fb_add_autoupdate_interval');
955
+
956
+ add_action('wd_fb_schedule_event_hook', 'wd_fb_update');
957
  // wd_fb_update();
958
+ function wd_fb_update($from_plugin = 0)
959
+ {
960
+ require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
961
+
962
+ $current_time = current_time('timestamp');
963
+ $update_time = get_option('ffwd_autoupdate_time');
964
+ $autoupdate_interval = 60; //WDFacebookFeed::get_autoupdate_interval();
965
+ update_option('ffwd_autoupdate_time', $autoupdate_interval * 60 + $current_time);
966
+ if (($current_time >= $update_time && $from_plugin) || !$from_plugin) {
967
+ global $wpdb;
968
+ $ff_wd_options = get_option('ffwd_pages_list');
969
+
970
+ if ( !empty($ff_wd_options) ) {
971
+ foreach ( $ff_wd_options as $ff_wd_option ) {
972
+ $token = $ff_wd_option->access_token;
973
+ $page_id = $ff_wd_option->id;
974
+ WDFacebookFeed::update_page_access_token($token, $page_id);
975
+ }
976
  }
977
+ $query = "SELECT * FROM " . $wpdb->prefix . "wd_fb_info WHERE `update_mode` <> 'no_update'";
978
+ $rows = $wpdb->get_results($query);
979
+ WDFacebookFeed::update_from_shedule($rows);
980
+ update_option('ffwd_autoupdate_time', $autoupdate_interval * 60 + current_time('timestamp'));
981
  }
982
+ //die();
 
 
 
 
 
 
 
 
983
  }
984
 
985
  // Check Valid Token and show message
986
  $ffwd_token_error_flag = get_option("ffwd_token_error_flag");
987
  $ffwd_option_reauth_success = ((isset($_GET['success'])) ? $_GET["success"] : '');
988
+
989
  if($ffwd_token_error_flag === "1" || $ffwd_option_reauth_success!=""){
990
  add_action('admin_notices', 'ffwd_token_error_flag_notice');
991
  }
994
  global $ffwd_token_error_flag, $ffwd_option_reauth_success;
995
  $screen_base = get_current_screen()->base;
996
  if($ffwd_token_error_flag === "1"){
997
+ if($screen_base === "dashboard" || $screen_base === "toplevel_page_info_ffwd" || $screen_base === "facebook-feed_page_options_ffwd" || $screen_base === "facebook-feed_page_themes_ffwd" || $screen_base === "facebook-feed_page_uninstall_ffwd" ){
998
  $link_to_reset = "<a href='".site_url()."/wp-admin/admin.php?page=options_ffwd' >reset token</a>";
999
  if($screen_base === "facebook-feed_page_options_ffwd"){
1000
  $link_to_reset = "reset token";
1003
  }
1004
  }
1005
  if($screen_base === "facebook-feed_page_options_ffwd" && $ffwd_option_reauth_success !=""){
1006
+ if($ffwd_option_reauth_success==1){
1007
+ echo "<div class='notice notice-success'><p>The Access Token Successfully saved.</p></div>";
1008
+ }
1009
+ else{
1010
+ echo "<div class='notice notice-error'><p>Something wrong. Please try again.</p></div>";
1011
+ }
1012
+ }
1013
  }
1014
 
1015
+
1016
+
1017
  // Facebook Feed by 10Web Widget.
1018
+ if (class_exists('WP_Widget')) {
1019
+ add_action('wp_enqueue_scripts', 'ffwd_front_end_scripts');
1020
+ require_once(WD_FFWD_DIR . '/admin/controllers/FFWDControllerWidget.php');
1021
+ add_action('widgets_init', 'ffwd_register_widget');
1022
  }
1023
 
1024
  function ffwd_register_widget(){
1025
  return register_widget("FFWDControllerWidget");
1026
  }
1027
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1028
 
1029
+ // Languages localization.
1030
+ function ffwd_language_load()
1031
+ {
1032
+ load_plugin_textdomain('ffwd', false, basename(dirname(__FILE__)) . '/languages');
1033
  }
1034
 
1035
+ add_action('init', 'ffwd_language_load');
 
 
1036
 
1037
+ function ffwd_version()
1038
+ {
1039
+ $version = FFWD_VERSION;
1040
 
1041
+ if (get_option('ffwd_version') === false) {
1042
+ add_option('ffwd_version', $version);
1043
+ } else {
1044
+ update_option('ffwd_version', $version);
1045
+ }
1046
 
1047
+ return $version;
1048
 
1049
  }
1050
 
1051
+ function ffwd_get_version()
1052
+ {
1053
+ if (get_option('ffwd_version') === false) {
1054
+ ffwd_version();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055
  }
1056
 
1057
+ return get_option('ffwd_version');
1058
  }
 
1059
 
1060
  if (!class_exists('Linkify')) {
1061
  include_once WD_FFWD_DIR . '/framework/linkify/LinkifyInterface.php';
1070
  FFWDElementor::get_instance();
1071
  }
1072
  }
1073
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
framework/WDFacebookFeed.php CHANGED
@@ -1,407 +1,385 @@
1
  <?php
2
 
3
-
4
  class WDFacebookFeed {
5
- ////////////////////////////////////////////////////////////////////////////////////////
6
- // Events //
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- ////////////////////////////////////////////////////////////////////////////////////////
9
- // Constants //
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- ////////////////////////////////////////////////////////////////////////////////////////
12
- // Variables //
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- protected static $fb_type;
15
- protected static $facebook_sdk;
16
- protected static $graph_url = 'https://graph.facebook.com/{FB_ID}/{EDGE}?{ACCESS_TOKEN}{FIELDS}{LIMIT}{OTHER}';
17
- protected static $id;
18
- protected static $fb_valid_types = array('page', 'group', 'profile');
19
- protected static $valid_content_types = array('timeline', 'specific');
20
- protected static $content_url;
21
- protected static $content_type;
22
- protected static $timeline_type;
23
- protected static $content;
24
- protected static $limit;
25
- protected static $data;
26
- // For collapse timeline data matching content requirements
27
- protected static $complite_timeline_data = array();
28
- // Maximum graph call integer for timeline type
29
- protected static $timeline_max_call_count = 10;
30
- protected static $valid_content = array('statuses', 'photos', 'videos', 'links', 'events', 'albums');
31
- protected static $access_token;
32
- protected static $exist_access = false;
33
- protected static $auto_update_feed=0;
34
-
35
- protected static $updateOnVersionChange=false;
36
-
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  // Existing app ids and app secrets
40
- protected static $access_tokens = array ();
41
- protected static $save = true;
42
- protected static $edit_feed = false;
43
- protected static $update_mode = 'keep_old';
44
- protected static $fb_id;
45
- private static $ffwd_fb_massage = true;
46
 
47
- public static $client_side_check = array();
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- // Constructor & Destructor //
50
- ////////////////////////////////////////////////////////////////////////////////////////
51
- public function __construct() {
52
 
 
53
 
54
- }
55
 
56
- ////////////////////////////////////////////////////////////////////////////////////////
57
- // Public Methods //
58
- ////////////////////////////////////////////////////////////////////////////////////////
59
- ////////////////////////////////////////////////////////////////////////////////////////
60
- // Getters & Setters //
61
- ////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
62
 
63
- public static function execute() {
64
- if (function_exists('current_user_can')) {
65
- if (!current_user_can('manage_options')) {
66
- if (defined( 'DOING_AJAX' ) && DOING_AJAX )
67
- {
68
- die('Access Denied');
 
 
 
 
 
69
  }
70
- }
71
- }
72
- else {
73
- die('Access Denied');
74
  }
75
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
76
- $action = WDW_FFWD_Library::get('action');
77
 
78
- if(!WDW_FFWD_Library::verify_nonce('')){
79
- die(WDW_FFWD_Library::delimit_wd_output(json_encode(array("error", "Sorry, your nonce did not verify."))));
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
- if (method_exists('WDFacebookFeed', $action)) {
83
- call_user_func(array('WDFacebookFeed', $action));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
- else {
86
- call_user_func(array('WDFacebookFeed', 'wd_fb_massage'), array('error', 'Unknown action'));
 
87
  }
88
- }
89
 
90
- public static function save_facebook_feed() {
91
- $id = (isset($_POST['current_id']) && $_POST['current_id'] != '') ? (int) sanitize_text_field(stripslashes($_POST['current_id'])) : 0;
92
- if($id) {
93
- self::$fb_id = $id;
94
- self::$edit_feed = true;
95
- self::$save = false;
96
- }
97
- else {
98
- self::$save = true;
99
- }
100
- self::check_fb_type();
101
- }
102
-
103
- // Edit facebook feed
104
- public static function edit_feed() {
105
- global $wpdb;
106
- $update_wd_fb_data = false;
107
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE id="%d"', self::$fb_id));
108
- ///////////////////////Araqel
109
- $ffwd_info_options=array();
110
- $ffwd_info_options['theme']=((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
111
- $ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
112
- $ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
113
- $ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
114
- $ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
115
- $ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
116
- $ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
117
- $ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
118
- $ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
119
- $ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
120
- $ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
121
- $ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
122
- $ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
123
- $ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
124
- $ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
125
- $ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
126
- $ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
127
- $ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
128
- $ffwd_info_options['blog_style_google']='0';
129
- $ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
130
- $ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
131
- $ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
132
- $ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
133
- $ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
134
- $ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
135
- $ffwd_info_options['album_title']=((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
136
- $ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
137
- $ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
138
- $ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
139
- $ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
140
- $ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
141
- $ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
142
- $ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
143
- $ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
144
- $ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
145
- $ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
146
- $ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
147
- $ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
148
- $ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
149
- $ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
150
- $ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
151
- $ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
152
- $ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
153
- $ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
154
- $ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
155
- $ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
156
- $ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
157
- $ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
158
- $ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
159
- $ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
160
- $ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
161
- $ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
162
- $ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
163
- $ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
164
- $ffwd_info_options['popup_enable_google']='0';
165
- $ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
166
- $ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
167
-
168
- $ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
169
-
170
- foreach($ffwd_options_db as $ffwd_option_db)
171
- {
172
-
173
- $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
174
- }
175
-
176
- ////////////////////////
177
- $name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
178
- $name = str_replace(array("'", '"'), "" , $name);
179
- $page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
180
-
181
- // $new_access_token = self::update_page_access_token($page_access_token);
182
- // if($new_access_token["success"]){
183
- // $page_access_token = $new_access_token["new_token"];
184
- // }
185
- $update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
186
- $published = ((isset($_POST['published'])) ? (int) sanitize_text_field(stripslashes($_POST['published'])) : 1);
187
- $content = implode(",", self::$content);
188
- $from = self::$id;
189
- $update_wd_fb_data = (
190
- ($row->type != self::$fb_type) ||
191
- ($row->content_type != self::$content_type) ||
192
- ($row->content != $content) ||
193
- ($row->from != $from) ||
194
- ($row->timeline_type != self::$timeline_type)||
195
- (self::$auto_update_feed != 0) ||
196
- ($row->limit != self::$limit)
197
- );
198
-
199
-
200
- if(self::$fb_type=='group')
201
- self::$timeline_type='feed';
202
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_info', array(
203
- 'name' => $name,
204
- 'page_access_token' => $page_access_token,
205
- 'type' => self::$fb_type,
206
- 'content_type' => self::$content_type,
207
- 'content' => $content,
208
- 'content_url' => self::$content_url,
209
- 'timeline_type' => self::$timeline_type,
210
- 'from' => $from,
211
- 'limit' => self::$limit,
212
- 'app_id' => '',
213
- 'app_secret' => '',
214
- 'exist_access' => 1,
215
- 'access_token' => self::$access_token,
216
- 'published' => $published,
217
- 'update_mode' => $update_mode,
218
- ),
219
- array('id' => self::$fb_id)
220
- );
221
-
222
-
223
- if ($save !== FALSE) {
224
- self::update_wd_fb_info_options($ffwd_info_options);
225
- if($update_wd_fb_data) {
226
- $delete_query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d"', self::$fb_id);
227
- $delete = $wpdb->query($delete_query);
228
- if ($delete === false) {
229
- self::wd_fb_massage('error', 'Something went wrong (trying delete wd_fb_data)');
230
- } else {
231
- $data = self::$data['data'];
232
- self::insert_wd_fb_data($data);
233
- }
234
- }
235
- self::wd_fb_massage('success', self::$fb_id);
236
- }
237
- else {
238
- self::wd_fb_massage('error', 'Something went wrong (trying edit feed)');
239
- }
240
- }
241
-
242
- function insert_wd_fb_info_options($options)
243
- { global $wpdb;
244
-
245
-
246
-
247
- }
248
-
249
-
250
- static function update_wd_fb_info_options($options)
251
- { global $wpdb;
252
-
253
-
254
-
255
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_info', array(
256
-
257
- 'theme' =>$options['theme'],
258
- 'masonry_hor_ver' =>$options['masonry_hor_ver'],
259
- 'image_max_columns' =>$options['image_max_columns'],
260
- 'thumb_width' =>$options['thumb_width'],
261
- 'thumb_height' =>$options['thumb_height'],
262
- 'thumb_comments' =>$options['thumb_comments'],
263
- 'thumb_likes' =>$options['thumb_likes'],
264
- 'thumb_name' =>$options['thumb_name'],
265
- 'blog_style_width' =>$options['blog_style_width'],
266
- 'blog_style_height' =>$options['blog_style_height'],
267
- 'blog_style_view_type' =>$options['blog_style_view_type'],
268
- 'blog_style_comments' =>$options['blog_style_comments'],
269
- 'blog_style_likes' =>$options['blog_style_likes'],
270
- 'blog_style_message_desc' =>$options['blog_style_message_desc'],
271
- 'blog_style_shares' =>$options['blog_style_shares'],
272
- 'blog_style_shares_butt' =>$options['blog_style_shares_butt'],
273
- 'blog_style_facebook' =>$options['blog_style_facebook'],
274
- 'blog_style_twitter' =>$options['blog_style_twitter'],
275
- 'blog_style_google' =>$options['blog_style_google'],
276
- 'blog_style_author' =>$options['blog_style_author'],
277
- 'blog_style_name' =>$options['blog_style_name'],
278
- 'blog_style_place_name' =>$options['blog_style_place_name'],
279
- 'fb_name' =>$options['fb_name'],
280
- 'fb_plugin' =>$options['fb_plugin'],
281
- 'album_max_columns' =>$options['album_max_columns'],
282
- 'album_title' =>$options['album_title'],
283
- 'album_thumb_width' =>$options['album_thumb_width'],
284
- 'album_thumb_height' =>$options['album_thumb_height'],
285
- 'album_image_max_columns' =>$options['album_image_max_columns'],
286
- 'album_image_thumb_width' =>$options['album_image_thumb_width'],
287
- 'album_image_thumb_height' =>$options['album_image_thumb_height'],
288
- 'pagination_type' =>$options['pagination_type'],
289
- 'objects_per_page' =>$options['objects_per_page'],
290
- 'popup_fullscreen' =>$options['popup_fullscreen'],
291
- 'popup_height' =>$options['popup_height'],
292
- 'popup_width' =>$options['popup_width'],
293
- 'popup_effect' =>$options['popup_effect'],
294
- 'popup_autoplay' =>$options['popup_autoplay'],
295
- 'open_commentbox' =>$options['open_commentbox'],
296
- 'popup_interval' =>$options['popup_interval'],
297
- 'popup_enable_filmstrip' =>$options['popup_enable_filmstrip'],
298
- 'popup_filmstrip_height' =>$options['popup_filmstrip_height'],
299
- 'popup_comments' =>$options['popup_comments'],
300
- 'popup_likes' =>$options['popup_likes'],
301
- 'popup_shares' =>$options['popup_shares'],
302
- 'popup_author' =>$options['popup_author'],
303
- 'popup_name' =>$options['popup_name'],
304
- 'popup_place_name' =>$options['popup_place_name'],
305
- 'popup_enable_ctrl_btn' =>$options['popup_enable_ctrl_btn'],
306
- 'popup_enable_fullscreen' =>$options['popup_enable_fullscreen'],
307
- 'popup_enable_info_btn' =>$options['popup_enable_info_btn'],
308
- 'popup_message_desc' =>$options['popup_message_desc'],
309
- 'popup_enable_facebook' =>$options['popup_enable_facebook'],
310
- 'popup_enable_twitter' =>$options['popup_enable_twitter'],
311
- 'popup_enable_google' =>$options['popup_enable_google'] ,
312
- 'fb_view_type' =>$options['fb_view_type'],
313
- 'view_on_fb' =>$options['view_on_fb'],
314
- 'post_text_length' =>$options['post_text_length'],
315
- 'event_street' =>$options['event_street'],
316
- 'event_city' =>$options['event_city'],
317
- 'event_country' =>$options['event_country'],
318
- 'event_zip' =>$options['event_zip'],
319
- 'event_map' =>$options['event_map'],
320
- 'event_date' =>$options['event_date'],
321
- 'event_desp_length' =>$options['event_desp_length'],
322
- 'comments_replies' =>$options['comments_replies'],
323
- 'comments_filter' =>$options['comments_filter'],
324
- 'comments_order' =>$options['comments_order'],
325
- 'page_plugin_pos' =>$options['page_plugin_pos'],
326
- 'page_plugin_fans' =>$options['page_plugin_fans'],
327
- 'page_plugin_cover' =>$options['page_plugin_cover'],
328
- 'page_plugin_header' =>$options['page_plugin_header'],
329
- 'page_plugin_width' =>$options['page_plugin_width'],
330
- 'image_onclick_action' =>$options['image_onclick_action'],
331
- 'fb_page_id' => $options['fb_page_id'],
332
- ),
333
- array('id' => self::$fb_id)
334
- );
335
- }
336
-
337
-
338
-
339
-
340
- // Prepare to delete
341
- public static function prepare_to_delete($rows = array()) {
342
- foreach($rows as $row) {
343
- self::$fb_id = isset($row->id) ? $row->id : '';
344
- self::$fb_type = isset($row->type) ? $row->type : '';
345
- self::$content_type = isset($row->content_type) ? $row->content_type : '';
346
- self::$content = isset($row->content) ? explode(",", $row->content) : array();
347
- self::$content_url = isset($row->content_url) ? $row->content_url : '';
348
- self::$limit = isset($row->limit) ? $row->limit : '';
349
- self::$id = isset($row->from) ? $row->from : '';
350
- self::$access_token = isset($row->page_access_token) ? $row->page_access_token : '';
351
-
352
- self::$update_mode = isset($row->update_mode) ? $row->update_mode : self::$update_mode;
353
- self::get_rows_for_delete();
354
- }
355
  }
356
 
357
- public static function get_rows_for_delete($rows = array()) {
358
- global $wpdb;
359
- $id = self::$fb_id;
360
- $rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
361
- $client_side_check = array();
362
- foreach($rows as $row) {
363
- $data_for_client_side = new stdclass();
364
- $fields = 'fields=id&';
365
- $object_id = $row->object_id;
366
-
367
- $fb_graph_url = str_replace (
368
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
369
- array($object_id, '', 'access_token='.self::$access_token.'&', $fields, '', ''),
370
- self::$graph_url
371
- );
372
- $data_for_client_side->id = $row->id;
373
- $data_for_client_side->fb_graph_url = $fb_graph_url;
374
-
375
- array_push($client_side_check, $data_for_client_side);
376
- }
377
- array_push(self::$client_side_check, $client_side_check);
378
- }
379
-
380
-
381
- // Auto update
382
- public static function update_from_shedule($rows = array()) {
383
-
384
- self::$save = false;
385
- self::$edit_feed = false;
386
- self::$auto_update_feed = 1;
387
 
388
- foreach($rows as $row) {
389
- self::$fb_id = isset($row->id) ? $row->id : '';
390
- self::$fb_type = isset($row->type) ? $row->type : '';
391
- self::$content_type = isset($row->content_type) ? $row->content_type : '';
392
- self::$content = isset($row->content) ? explode(",", $row->content) : array();
393
- self::$content_url = isset($row->content_url) ? $row->content_url : '';
394
- self::$timeline_type = isset($row->timeline_type) ? $row->timeline_type : 'posts';
395
- self::$limit = isset($row->limit) ? $row->limit : '';
396
- self::$id = isset($row->from) ? $row->from : '';
397
- self::$access_token = isset($row->page_access_token) ? $row->page_access_token : '';
398
- self::$update_mode = isset($row->update_mode) ? $row->update_mode : self::$update_mode;
399
- $function_name = self::$content_type;
400
- self::$function_name();
401
- }
402
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
 
 
405
  public static function updateOnVersionChange($rows = array())
406
  {
407
 
@@ -428,100 +406,80 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
428
  }
429
  }
430
 
431
- public static function update_db() {
432
- if(!isset(self::$data['data'])){
433
- return;
434
- }
435
- global $wpdb;
436
- $data = self::$data['data'];
437
- $id = self::$fb_id;
438
- $rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
439
- $to_drop = array();
440
- $to_insert = array();
441
- $del_count = 0;
442
- // Store content array as string.
443
- $content = implode(",", self::$content);
444
- foreach($data as $next) {
445
- $exists = false;
446
- $is_newer_then_any_of_olds = true;
447
- $created_time = array_key_exists ( 'created_time' , $next ) ? strtotime($next['created_time']) : '';
448
- $created_time = ($created_time == '' && array_key_exists ( 'start_time' , $next )) ? strtotime($next['start_time']) : $created_time;
449
- foreach($rows as $row) {
450
- if($row->object_id == $next['id']) {
451
- $exists = true;
452
- }
453
-
454
- if($created_time < $row->created_time_number) {
455
- $is_newer_then_any_of_olds = false;
456
- }
457
- }
458
- if(!$exists && $is_newer_then_any_of_olds) {
459
- if(self::$content_type == 'timeline') {
460
- $from = array_key_exists ( 'from' , $next ) ? $next['from']['id'] : '';
461
- if(strpos($content, $next['type']) === false)
462
- continue;
463
-
464
- if(self::$timeline_type == "posts") {
465
- if($from != self::$id)
466
- continue;
467
- }
468
- elseif(self::$timeline_type == "others") {
469
- if($from == self::$id)
470
- continue;
471
- }
472
- }
473
- array_push($to_insert, $next);
474
- }
475
- }
476
- $exist_count = count($rows);
477
- $insert_count = count($to_insert);
478
- if((self::$update_mode == 'remove_old') && ($insert_count + $exist_count) > self::$limit) {
479
- $del_count = ($insert_count + $exist_count) - self::$limit;
480
- $ids = array();
481
- $results = $wpdb->get_results($wpdb->prepare('SELECT `id` FROM `' . $wpdb->prefix . 'wd_fb_data` WHERE `fb_id` = "%d" ORDER BY `created_time_number` ASC LIMIT ' . $del_count, self::$fb_id));
482
- foreach($results as $row) {
483
- array_push($ids, $row->id);
484
- }
485
- $ids = implode(',', $ids);
486
- $delete = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` IN ('.$ids.') AND `fb_id` = "%d"', self::$fb_id));
487
- }
488
- if($insert_count)
489
- self::insert_wd_fb_data($to_insert);
490
- }
491
 
492
- public static function page() {
493
- $page_id = isset($_POST['fb_page_id']) ? sanitize_text_field($_POST['fb_page_id']) : 0;
494
- $pages_list = get_option('ffwd_pages_list', array());
495
 
496
- $fb_page = null;
497
- foreach($pages_list as $page){
498
- if($page->id === $page_id){
499
- $fb_page = $page;
500
- break;
501
- }
502
- }
503
 
504
- if($fb_page == null){
505
- die(0);
506
- }
507
- $fb_page_name = str_replace("/","",$fb_page->name);
 
 
 
 
 
 
 
 
 
508
 
509
- $_POST['content_url'] = "https://www.facebook.com/" . $fb_page_name . "-" . $fb_page->id . "/";
510
- $_POST['page_access_token'] = $fb_page->access_token;
 
 
511
 
 
 
 
 
 
 
512
 
513
- self::$content_url = ((isset($_POST['content_url'])) ? esc_url($_POST['content_url']) : '');
514
- self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
515
- self::set_access_token();
516
- self::check_fb_page_url();
517
- // If user exists => set content.
518
- self::set_content();
519
- // If right content => set access_token.
520
- // If right access_token => call function.
521
- $function_name = self::$content_type;
522
- self::$function_name();
523
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
 
 
 
 
525
 
526
  public static function update_version()
527
  {
@@ -532,1259 +490,1378 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
532
  $delete = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `fb_id` = "%d"', self::$fb_id));
533
 
534
 
535
-
536
  self::insert_wd_fb_data($data);
537
 
538
  }
539
 
540
- public static function group() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  self::$content_url = ((isset($_POST['content_url'])) ? sanitize_text_field(stripslashes($_POST['content_url'])) : '');
542
  self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
543
- self::check_fb_group_url();
544
- self::set_content();
545
  self::set_access_token();
546
- self::timeline();
547
- }
548
-
549
- public static function profile() {
550
- self::$content_url = '';
551
- self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
552
- self::check_fb_user();
553
  self::set_content();
554
- self::set_access_token();
 
555
  $function_name = self::$content_type;
556
  self::$function_name();
557
  }
558
 
559
- public static function check_fb_user() {
560
- if(!class_exists('Facebook'))
561
- include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
562
- global $wpdb;
563
- $fb_option_data = self::get_fb_option_data();
564
- $app_id = $fb_option_data->app_id;
565
- $app_secret = $fb_option_data->app_secret;
566
- self::$facebook_sdk = new Facebook(array(
567
- 'appId' => $app_id,
568
- 'secret' => $app_secret,
569
- ));
570
- $user = self::$facebook_sdk->getUser();
571
- if (!$user) {
572
- self::wd_fb_massage('error', 'Please login first');
573
- }
574
- else {
575
- self::$id = $user;
576
  }
577
- }
578
 
579
- public static function get_fb_option_data() {
580
- global $wpdb;
581
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
582
- return $row;
583
- }
 
 
 
 
 
584
 
585
- public static function set_content() {
586
- $content_type = ((isset($_POST['content_type'])) ? sanitize_text_field(stripslashes($_POST['content_type'])) : '');
587
- $content = WDW_FFWD_Library::validate_string('content', array());
588
- self::$content_type = in_array($content_type, self::$valid_content_types) ? $content_type : false;
589
- // If right content type
590
- if(self::$content_type)
591
- self::$content = $content;
592
- else
593
- self::wd_fb_massage('error', 'Invalid content type');
594
- }
 
 
 
 
 
 
 
595
 
596
- public static function set_access_token() {
597
- if(isset($_POST["page_access_token"]) && $_POST["page_access_token"] != ""){
598
- self::$access_token = sanitize_text_field(stripcslashes($_POST["page_access_token"]));
599
- self::$exist_access = true;
600
- }else{
601
- if(!isset(self::$access_token) || empty(self::$access_token)){
602
- $rand_key = array_rand(self::$access_tokens);
603
- self::$access_token = self::$access_tokens[$rand_key];
604
- }
605
- }
606
- }
607
-
608
- public static function check_fb_page_url() {
609
- $first_token = strtok(self::$content_url, '/');
610
- $second_token = strtok('/');
611
- $third_token = strtok('/');
612
- $fourth = strtok('/');
613
- $fifth = strtok('/');
614
- // Check if it's facebook url
615
- if($second_token === 'www.facebook.com') {
616
- if($third_token == 'pages') {
617
- $fifth = explode('?', $fifth);
618
- self::$id = $fifth[0];
619
- }
620
- else {
621
- // If page's id not showing in url (trying to get id by it's name)
622
- $third_token = explode('-', $third_token);
623
- if(count($third_token) > 0) {
624
- $last = count($third_token)-1;
625
- $name_id = $third_token[$last];
626
- }
627
- else
628
- $name_id = $third_token[0];
629
- // If not set access token , get random from our's
630
- if (empty(self::$access_token)) {
631
- $rand_key = array_rand(self::$access_tokens);
632
- $access_token = self::$access_tokens[$rand_key];
633
  } else {
634
- $access_token = self::$access_token;
635
- }
636
- $fb_graph_url = str_replace (
637
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
638
- array($name_id, '', 'access_token='.$access_token.'&', 'fields=id&', 'limit=10', ''),
639
- self::$graph_url
640
- );
641
- $data = self::decap_do_curl($fb_graph_url);
642
- // Check id existing
643
- if(array_key_exists("id", $data)) {
644
- self::$id = $data['id'];
645
- }
646
- // Check if exist error
647
- elseif(array_key_exists("error", $data)) {
648
- if( $data['error']['code']==4)
649
- update_option('ffwd_limit_notice',1);
650
- self::wd_fb_massage('error', $data['error']['message']);
651
- }
652
- }
653
  }
654
- else
655
- self::wd_fb_massage('error', 'not Facebook url');
656
- }
657
 
658
- public static function check_fb_group_url() {
659
- // Help tool for find your group id http://lookup-id.com/
660
- $first_token = strtok(self::$content_url, '/');
661
- $id = $first_token;
662
- // If not set access token , get random from our's
663
- $rand_key = array_rand(self::$access_tokens);
664
- $access_token = self::$access_tokens[$rand_key];
665
- $fb_graph_url = str_replace (
666
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
667
- array($id, '', 'access_token='.$access_token.'&', '', '', ''),
668
- self::$graph_url
669
- );
670
- // Check if no errors with that id
671
- $data = self::decap_do_curl($fb_graph_url);
672
- if(array_key_exists("error", $data)) {
673
- if( $data['error']['code']==4)
674
- update_option('ffwd_limit_notice',1);
675
- self::wd_fb_massage('error', $data['error']['message']);
676
- }
677
- else {
678
- self::$id = $id;
679
- return;
680
- }
681
- }
682
 
683
- public static function complite_timeline($fb_graph_url) {
684
- $content = implode(",", self::$content);
685
- $data = self::decap_do_curl($fb_graph_url);
686
- // If error exist
687
- if(array_key_exists("error", $data)) {
688
- if ($data['error']['code'] == 4){
689
- update_option('ffwd_limit_notice', 1);
690
- }
691
- if($data['error']['code'] == 100){
692
- self::wd_fb_massage('error', $data['error']['message'].' <a target="_blank" href="https://help.10web.io/hc/en-us/articles/360025514692-Solving-Facebook-Feed-Errors?utm_source=facebook_feed&utm_medium=free_plugin">See more</a>');
 
 
 
 
 
 
 
 
 
 
 
 
 
693
  }else{
694
- self::wd_fb_massage('error', $data['error']['message']);
 
 
 
695
  }
696
- }else{
697
- // Set next page if it exists
698
- $paging = array_key_exists ( 'paging' , $data ) ? $data['paging'] : array();
699
- $next_page = array_key_exists ( 'next' , $paging ) ? $paging['next'] : 0;
700
- $post_data = isset($data['data']) ? $data['data'] : array();
701
- foreach($post_data as $next) {
702
- if(strpos($content, $next['type']) === false)
703
- continue;
704
- if(self::$timeline_type == 'others' && self::$id == $next['from']['id'])
705
- continue;
706
 
707
- if($next['type']=='status' && !isset($next['description']) && !isset($next['message']) && !isset($next['name']))
708
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
 
710
- if(count(self::$complite_timeline_data) < self::$limit)
711
- array_push(self::$complite_timeline_data, $next);
712
- }
713
- if(count(self::$complite_timeline_data) < self::$limit && self::$timeline_max_call_count > 0 && $next_page) {
714
- self::$timeline_max_call_count--;
715
- return self::complite_timeline($next_page);
716
- }
717
- else {
718
- return self::$complite_timeline_data;
719
- }
 
 
 
 
 
 
 
 
 
 
720
  }
721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
 
723
- }
 
 
724
 
 
 
 
 
 
 
 
725
  public static function timeline() {
726
- /**
727
- * Set timeline type.
728
- * Set complite_timeline_data empty array.
729
- * Message_tags in message, with_tags in story.
730
- * Check if fb_type is group so set `feed` for edge, else set `posts`.
731
- * Replace params in graph url.
732
- */
733
- self::set_timeline_type();
734
- self::$complite_timeline_data = array();
735
- $data = array();
736
  self::set_access_token();
737
- $fields = 'fields=comments.limit(25).summary(true){parent.fields(id),created_time,from,like_count,message,comment_count},attachments,shares,id,name,story,link,created_time,updated_time,from{picture,name,link},message,type,source,place,message_tags,story_tags,description,status_type&';
738
  $edge = (self::$fb_type == 'group') ? 'feed' : ((self::$timeline_type == 'feed' || self::$timeline_type == 'others') ? 'feed' : 'posts');
739
- $fb_graph_url = str_replace (
740
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
741
- array(self::$id, $edge, 'access_token=' . self::$access_token . '&', $fields, 'locale='.get_locale().'&', ''), self::$graph_url
742
- );
743
-
744
-
745
- if (self::$auto_update_feed == 1) {
746
- global $wpdb;
747
-
748
- $id = self::$fb_id;
749
- $update_ids = array();
750
- $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));
751
- foreach ($rows as $row) {
752
- $update_ids[$row->object_id] = $row->id;
753
- }
754
- /* max ids count for endpoint is 50 */
755
- $update_ids_parts = array_chunk($update_ids, 50, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756
  foreach ( $update_ids_parts as $update_ids_part ) {
757
- $update_ids = implode(',', array_keys($update_ids_part));
758
- $fb_graph_url_update = str_replace(array(
759
- '{FB_ID}',
760
- '{EDGE}',
761
- '{ACCESS_TOKEN}',
762
- '{FIELDS}',
763
- '{LIMIT}',
764
- '{OTHER}'
765
- ), array(
766
- '',
767
- '',
768
- 'ids=' . $update_ids . '&access_token=' . self::$access_token . '&',
769
- $fields,
770
- 'locale=' . get_locale() . '&',
771
- ''
772
- ), self::$graph_url);
773
  $update_data = self::decap_do_curl($fb_graph_url_update);
774
  self::update_wd_fb_data($update_data, $update_ids_part);
775
  }
776
-
777
  }
778
 
779
- $data['data'] = self::complite_timeline($fb_graph_url);
780
- self::$data = $data;
781
-
782
-
783
-
784
- if (self::$save)
785
- self::save_db();
786
- elseif (self::$edit_feed)
787
- self::edit_feed();
788
- elseif (self::$updateOnVersionChange)
789
- self::update_version();
790
- else {
791
-
792
- self::update_db();
793
-
794
- }
 
 
795
  }
796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
 
798
- public static function update_wd_fb_data($data, $ids)
799
- {
800
- global $wpdb;
801
- $content = implode(",", self::$content);
802
- $success = 'no_data';
803
-
804
-
805
- foreach ($data as $key => $next) {
806
 
807
- if(!isset($ids[$key])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  continue;
809
  }
810
- /**
811
- * check if content_type is timeline dont save wd_fb_data if
812
- * $content string not contain $next['type']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  */
814
- if (self::$content_type == 'timeline') {
815
- if (strpos($content, $next['type']) === false)
816
- continue;
817
- $type = $next['type'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
 
819
- if (self::$timeline_type == 'others')
820
- if (self::$id == $next['from']['id'])
821
- continue;
822
- } else
823
- $type = self::$content[0];
824
-
825
- // Use this var for check if album imgs count not 0
826
- $album_imgs_exists = true;
827
-
828
- switch ($type) {
829
- case 'photos': {
830
- /**
831
- * If object type is photo(photos, video, videos,
832
- * album, event cover photo etc ) so trying to
833
- * check the count of resolution types
834
- * and store source for thumb and main size
835
- */
836
- if (array_key_exists('images', $next)) {
837
- $img_res_count = count($next['images']);
838
- if ($img_res_count > 6) {
839
- $thumb_url = $next['images'][$img_res_count - 1]['source'];
840
- $main_url = $next['images'][0]['source'];
841
- } else {
842
- $thumb_url = $next['images'][0]['source'];
843
- $main_url = $next['images'][0]['source'];
844
- }
845
- $width = $next['images'][0]['width'];
846
- $height = $next['images'][0]['height'];
847
- }
848
- break;
849
- }
850
- case 'videos': {
851
- if (array_key_exists('format', $next)) {
852
- $img_res_count = count($next['format']);
853
- if ($img_res_count > 2) {
854
- $main_url = $next['format'][$img_res_count - 1]['picture'];
855
- $thumb_url = $next['format'][1]['picture'];
856
- } else {
857
- $thumb_url = $next['format'][$img_res_count - 1]['picture'];
858
- $main_url = $next['format'][$img_res_count - 1]['picture'];
859
- }
860
- $width = $next['format'][$img_res_count - 1]['width'];
861
- $height = $next['format'][$img_res_count - 1]['height'];
862
- }
863
- break;
864
- }
865
- case 'albums': {
866
- if (array_key_exists('count', $next)) {
867
- $album_imgs_count = $next['count'];
868
- if ($album_imgs_count == 0) {
869
- $album_imgs_exists = false;
870
- }
871
- }
872
- break;
873
- }
874
- default: {
875
- $thumb_url = '';
876
- $main_url = '';
877
- }
878
  }
879
- if ($type == "albums" && !$album_imgs_exists)
880
- continue;
881
- // Check if exists such keys in $next array
882
- $object_id = array_key_exists('id', $next) ? $next['id'] : '';
883
- $name = array_key_exists('name', $next) ? addcslashes($next['name'], '\\') : '';
884
- $description = array_key_exists('description', $next) ? addcslashes($next['description'], '\\') : '';
885
- $link = array_key_exists('link', $next) ? $next['link'] : '';
886
- $status_type = array_key_exists('status_type', $next) ? $next['status_type'] : '';
887
- $message = array_key_exists('message', $next) ? addcslashes($next['message'], '\\') : '';
888
- $story = array_key_exists('story', $next) ? $next['story'] : '';
889
- $place = array_key_exists('place', $next) ? json_encode($next['place']) : '';
890
- $message_tags = array_key_exists('message_tags', $next) ? json_encode($next['message_tags']) : '';
891
- $with_tags = array_key_exists('with_tags', $next) ? json_encode($next['with_tags']) : '';
892
- $story_tags = array_key_exists('story_tags', $next) ? json_encode($next['story_tags']) : '';
893
- $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
894
- $comments = array_key_exists('comments', $next) ? json_encode($next['comments']) : '';
895
- $shares = array_key_exists('shares', $next) ? json_encode($next['shares']) : '';
896
- $attachments = array_key_exists('attachments', $next) ? json_encode($next['attachments']) : '';
897
- $from_json = array_key_exists('from', $next) ? json_encode($next['from']) : '';
898
- if ($type == "events")
899
- $from_json = array_key_exists('owner', $next) ? json_encode($next['owner']) : '';
900
-
901
-
902
- $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
903
-
904
- // When content is events some fields have different names, so check them.
905
- if ($type == 'events') {
906
- $source = array_key_exists('cover', $next) ? $next['cover']['source'] : '';
907
- $created_time = array_key_exists('start_time', $next) ? $next['start_time'] : '';
908
- $from = array_key_exists('owner', $next) ? $next['owner']['id'] : '';
909
-
910
- $main_url = $source;
911
- $thumb_url = $main_url;
912
- // Store event end time in update_time field
913
- $updated_time = array_key_exists('end_time', $next) ? $next['end_time'] : '';
914
  } else {
915
- $source = array_key_exists('source', $next) ? $next['source'] : '';
916
- $created_time = array_key_exists('created_time', $next) ? $next['created_time'] : '';
917
- $from = array_key_exists('from', $next) ? $next['from']['id'] : '';
918
-
919
- //check if thumb and main urls is set (if no , so set them source )
920
- $thumb_url = isset($thumb_url) ? $thumb_url : $source;
921
- $main_url = isset($main_url) ? $main_url : $source;
922
- $updated_time = array_key_exists('updated_time', $next) ? $next['updated_time'] : '';
923
  }
924
- $width = isset($width) ? $width : '';
925
- $height = isset($height) ? $height : '';
926
- $created_time_number = ($created_time != '') ? strtotime($created_time) : 0;
927
-
928
- $save_fb_data = $wpdb->update($wpdb->prefix . 'wd_fb_data', array(
929
- 'fb_id' => self::$fb_id,
930
- // 'object_id' => $object_id,
931
- // 'from' => $from,
932
- 'name' => $name,
933
- 'description' => $description,
934
- 'type' => $type,
935
- 'message' => $message,
936
- 'story' => $story,
937
- 'place' => $place,
938
- 'message_tags' => $message_tags,
939
- 'with_tags' => $with_tags,
940
- 'story_tags' => $story_tags,
941
- 'status_type' => $status_type,
942
- 'link' => $link,
943
- 'source' => $source,
944
- 'thumb_url' => $thumb_url,
945
- 'main_url' => $main_url,
946
- 'width' => $width,
947
- 'height' => $height,
948
- 'created_time' => $created_time,
949
- 'updated_time' => $updated_time,
950
- 'created_time_number' => $created_time_number,
951
- 'comments' => $comments,
952
- 'shares' => $shares,
953
- 'attachments' => $attachments,
954
- 'who_post' => $from_json,
955
- 'reactions' => $reactions,
956
- ), array('id' => $ids[$key]));
957
-
958
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
 
 
 
 
 
 
960
  }
961
 
 
 
962
 
 
963
 
964
- public static function ffwd_event_data_sort($a, $b)
965
- {
966
- $date1 = strtotime($a['start_time']);
967
- $date2 = strtotime($b['start_time']);
968
 
969
- if ($date1 == $date2) {
970
- return 0;
971
- }
972
- return ($date1 < $date2) ? -1 : 1;
973
- }
974
 
975
 
976
- public static function filter_upcoming_events($data)
977
- {
 
978
 
979
- foreach ($data['data'] as $key => $event) {
 
980
 
981
- $event_start_time = strtotime($event['start_time']);
982
- $now = strtotime(date("Y-m-d H:i:s"));
983
- if ($event_start_time < $now) {
 
 
 
 
 
 
 
 
984
 
 
 
 
 
 
 
 
 
 
985
 
986
- unset($data['data'][$key]);
987
- }
988
- }
989
 
990
- return $data;
991
- }
 
 
 
 
 
 
 
 
 
 
 
 
992
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
 
994
- public static function specific() {
995
- /**
996
- * Define timeline type only for not being null.
997
- * Set fields.
998
- * Chaek if content is photo or videos, so replace {other} => type=uploaded.
999
- * Replace params in graph url.
1000
- * Check errors.
1001
- */
1002
- self::$timeline_type = '';
1003
- $other = '';
1004
- if(self::$content[0] == 'albums')
1005
- $fields = 'fields=name,created_time,updated_time,from{picture,name,link},link,count&';
1006
- elseif(self::$content[0] == 'photos')
1007
- $fields = 'fields=source,name,created_time,updated_time,from{picture,name,link},link,images&';
1008
- elseif(self::$content[0] == 'videos')
1009
- $fields = 'fields=source,created_time,updated_time,from{picture,name,link},description,format&';
1010
- elseif (self::$content[0] == 'events') {
1011
- if (self::$upcoming_events == 1)
1012
- $fields = 'fields=comments.limit(25).summary(true){parent.fields(id),created_time,from,like_count,message,comment_count},name,start_time,end_time,description,cover,owner{picture,name,link},place&since=' . strtotime(date('Y-m-d')) . '&';
1013
- else
1014
- $fields = 'fields=comments.limit(25).summary(true){parent.fields(id),created_time,from,like_count,message,comment_count},name,start_time,end_time,description,cover,owner{picture,name,link},place&';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1015
  }
1016
- else
1017
- $fields = 'fields=source,name,story,created_time,updated_time,from{picture,name,link},link&';
1018
-
1019
- if(self::$content[0] == 'photos' || self::$content[0] == 'videos')
1020
- $other = 'type=uploaded';
1021
- $fb_graph_url = str_replace (
1022
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1023
- array(self::$id, self::$content[0], 'access_token='.self::$access_token.'&', $fields, 'limit='.self::$limit . '&locale='.get_locale().'&', $other),
1024
- self::$graph_url
1025
- );
1026
 
1027
- // print_r($fb_graph_url);
1028
- // wp_die();
1029
- if (self::$auto_update_feed == 1) {
1030
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1031
 
1032
- $id = self::$fb_id;
1033
- $update_ids = array();
1034
- $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));
1035
- foreach ($rows as $row) {
1036
- $update_ids[$row->object_id] = $row->id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1037
  }
1038
- /* max ids count for endpoint is 50 */
1039
- $update_ids_parts = array_chunk($update_ids, 50, true);
1040
- foreach ( $update_ids_parts as $update_ids_part ) {
1041
- $update_ids = implode(',', array_keys($update_ids_part));
1042
- $fb_graph_url_update = str_replace(array(
1043
- '{FB_ID}',
1044
- '{EDGE}',
1045
- '{ACCESS_TOKEN}',
1046
- '{FIELDS}',
1047
- '{LIMIT}',
1048
- '{OTHER}'
1049
- ), array(
1050
- '',
1051
- '',
1052
- 'ids=' . $update_ids . '&access_token=' . self::$access_token . '&',
1053
- $fields,
1054
- 'locale=' . get_locale() . '&',
1055
- ''
1056
- ), self::$graph_url);
1057
- $update_data = self::decap_do_curl($fb_graph_url_update);
1058
- self::update_wd_fb_data($update_data, $update_ids_part);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  }
1060
  }
1061
- $data = self::decap_do_curl($fb_graph_url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
 
 
 
 
 
 
 
 
 
 
 
1063
 
1064
- /////////////EVENT SORTING
 
1065
 
 
 
 
 
1066
 
1067
- if (self::$content[0] == 'events') {
 
 
 
 
1068
 
1069
- if (self::$event_order == 1) {
1070
 
1071
- uasort($data['data'], 'self::ffwd_event_data_sort');
1072
- }
 
 
 
1073
 
 
1074
 
 
 
 
1075
 
 
 
 
 
1076
 
 
 
1077
 
1078
- }
 
 
 
 
 
 
 
 
 
1079
 
 
 
1080
 
 
 
 
1081
 
1082
- if(array_key_exists("error", $data)) {
1083
- if( $data['error']['code']==4)
1084
- update_option('ffwd_limit_notice',1);
1085
- self::wd_fb_massage('error', $data['error']['message']);
1086
- }
1087
- else {
1088
- self::$data = $data;
1089
- if (self::$save)
1090
- self::save_db();
1091
- elseif (self::$edit_feed)
1092
- self::edit_feed();
1093
- elseif (self::$updateOnVersionChange)
1094
- self::update_version();
1095
- else
1096
- self::update_db();
 
 
 
 
 
 
 
1097
  }
1098
- }
1099
 
1100
- public static function set_timeline_type() {
1101
- /**
1102
- * Set timeline type.
1103
- * Posts by owner (so edge is posts).
1104
- * Posts by others (so edge is feed).
1105
- * Posts by owner and others (so edge is feed (but data must be filtered by from atribute not equal to owner ID)).
1106
- */
1107
- if(self::$save || self::$edit_feed)
1108
- self::$timeline_type = (isset($_POST['timeline_type']) && $_POST['timeline_type'] != '') ? sanitize_text_field(stripcslashes($_POST['timeline_type'])) : 'posts';
1109
- return;
1110
- }
1111
-
1112
- public static function save_db() {
1113
- global $wpdb;
1114
- $name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
1115
- $name = str_replace(array("'", '"'), "" , $name);
1116
- $page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
1117
- $update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
1118
- // Collapse content types (multiple when content type is timeline, one when specific)
1119
- $content = implode(",", self::$content);
1120
- $from = self::$id;
1121
- $data = self::$data['data'];
1122
- // If there is no data
1123
- if(!count($data)) {
1124
- self::wd_fb_massage('error', 'There is no data matching your choice.');
1125
- }
1126
-
1127
- ///////////////////////Araqel
1128
- $ffwd_info_options=array();
1129
- $ffwd_info_options['theme']=((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
1130
- $ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
1131
- $ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
1132
- $ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
1133
- $ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
1134
- $ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
1135
- $ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
1136
- $ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
1137
- $ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
1138
- $ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
1139
- $ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
1140
- $ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
1141
- $ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
1142
- $ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
1143
- $ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
1144
- $ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
1145
- $ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
1146
- $ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
1147
- $ffwd_info_options['blog_style_google']='0';
1148
- $ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
1149
- $ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
1150
- $ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
1151
- $ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
1152
- $ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
1153
- $ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
1154
- $ffwd_info_options['album_title']=((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
1155
- $ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
1156
- $ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
1157
- $ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
1158
- $ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
1159
- $ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
1160
- $ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
1161
- $ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
1162
- $ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
1163
- $ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
1164
- $ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
1165
- $ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
1166
- $ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
1167
- $ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
1168
- $ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
1169
- $ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
1170
- $ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
1171
- $ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
1172
- $ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
1173
- $ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
1174
- $ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
1175
- $ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
1176
- $ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
1177
- $ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
1178
- $ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
1179
- $ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
1180
- $ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
1181
- $ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
1182
- $ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
1183
- $ffwd_info_options['popup_enable_google']='0';
1184
- $ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
1185
- $ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
1186
-
1187
- $ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
1188
-
1189
- foreach($ffwd_options_db as $ffwd_option_db)
1190
- {
1191
-
1192
- $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
1193
- }
1194
-
1195
-
1196
- ////////////////////////
1197
-
1198
-
1199
-
1200
- if(self::$fb_type=='group')
1201
- self::$timeline_type='feed';
1202
- $save_fb_info = $wpdb->insert($wpdb->prefix . 'wd_fb_info', array(
1203
- 'name' => $name,
1204
- 'page_access_token' => $page_access_token,
1205
- 'type' => self::$fb_type,
1206
- 'content_type' => 'timeline',
1207
- 'content' => $content,
1208
- 'content_url' => self::$content_url,
1209
- 'timeline_type' => self::$timeline_type,
1210
- 'from' => $from,
1211
- 'limit' => self::$limit,
1212
- 'app_id' => '',
1213
- 'app_secret' => '',
1214
- 'exist_access' => 1,
1215
- 'access_token' => self::$access_token,
1216
- 'order' => ((int) $wpdb->get_var('SELECT MAX(`order`) FROM ' . $wpdb->prefix . 'wd_fb_info')) + 1,
1217
- 'published' => 1,
1218
- 'update_mode' => $update_mode,
1219
- 'theme' =>$ffwd_info_options['theme'],
1220
- 'masonry_hor_ver' =>$ffwd_info_options['masonry_hor_ver'],
1221
- 'image_max_columns' =>$ffwd_info_options['image_max_columns'],
1222
- 'thumb_width' =>$ffwd_info_options['thumb_width'],
1223
- 'thumb_height' =>$ffwd_info_options['thumb_height'],
1224
- 'thumb_comments' =>$ffwd_info_options['thumb_comments'],
1225
- 'thumb_likes' =>$ffwd_info_options['thumb_likes'],
1226
- 'thumb_name' =>$ffwd_info_options['thumb_name'],
1227
- 'blog_style_width' =>$ffwd_info_options['blog_style_width'],
1228
- 'blog_style_height' =>$ffwd_info_options['blog_style_height'],
1229
- 'blog_style_view_type' =>$ffwd_info_options['blog_style_view_type'],
1230
- 'blog_style_comments' =>$ffwd_info_options['blog_style_comments'],
1231
- 'blog_style_likes' =>$ffwd_info_options['blog_style_likes'],
1232
- 'blog_style_message_desc' =>$ffwd_info_options['blog_style_message_desc'],
1233
- 'blog_style_shares' =>$ffwd_info_options['blog_style_shares'],
1234
- 'blog_style_shares_butt' =>0,
1235
- 'blog_style_facebook' =>0,
1236
- 'blog_style_twitter' =>0,
1237
- 'blog_style_google' =>0,
1238
- 'blog_style_author' =>$ffwd_info_options['blog_style_author'],
1239
- 'blog_style_name' =>$ffwd_info_options['blog_style_name'],
1240
- 'blog_style_place_name' =>$ffwd_info_options['blog_style_place_name'],
1241
- 'fb_name' =>$ffwd_info_options['fb_name'],
1242
- 'fb_plugin' =>$ffwd_info_options['fb_plugin'],
1243
- 'album_max_columns' =>$ffwd_info_options['album_max_columns'],
1244
- 'album_title' =>$ffwd_info_options['album_title'],
1245
- 'album_thumb_width' =>$ffwd_info_options['album_thumb_width'],
1246
- 'album_thumb_height' =>$ffwd_info_options['album_thumb_height'],
1247
- 'album_image_max_columns' =>$ffwd_info_options['album_image_max_columns'],
1248
- 'album_image_thumb_width' =>$ffwd_info_options['album_image_thumb_width'],
1249
- 'album_image_thumb_height' =>$ffwd_info_options['album_image_thumb_height'],
1250
- 'pagination_type' =>$ffwd_info_options['pagination_type'],
1251
- 'objects_per_page' =>$ffwd_info_options['objects_per_page'],
1252
- 'popup_fullscreen' =>$ffwd_info_options['popup_fullscreen'],
1253
- 'popup_height' =>$ffwd_info_options['popup_height'],
1254
- 'popup_width' =>$ffwd_info_options['popup_width'],
1255
- 'popup_effect' =>$ffwd_info_options['popup_effect'],
1256
- 'popup_autoplay' =>$ffwd_info_options['popup_autoplay'],
1257
- 'open_commentbox' =>$ffwd_info_options['open_commentbox'],
1258
- 'popup_interval' =>$ffwd_info_options['popup_interval'],
1259
- 'popup_enable_filmstrip' =>0,
1260
- 'popup_filmstrip_height' =>$ffwd_info_options['popup_filmstrip_height'],
1261
- 'popup_comments' =>$ffwd_info_options['popup_comments'],
1262
- 'popup_likes' =>$ffwd_info_options['popup_likes'],
1263
- 'popup_shares' =>$ffwd_info_options['popup_shares'],
1264
- 'popup_author' =>$ffwd_info_options['popup_author'],
1265
- 'popup_name' =>$ffwd_info_options['popup_name'],
1266
- 'popup_place_name' =>$ffwd_info_options['popup_place_name'],
1267
- 'popup_enable_ctrl_btn' =>$ffwd_info_options['popup_enable_ctrl_btn'],
1268
- 'popup_enable_fullscreen' =>$ffwd_info_options['popup_enable_fullscreen'],
1269
- 'popup_enable_info_btn' =>0,
1270
- 'popup_message_desc' =>$ffwd_info_options['popup_message_desc'],
1271
- 'popup_enable_facebook' =>0,
1272
- 'popup_enable_twitter' =>0,
1273
- 'popup_enable_google' =>0 ,
1274
- 'fb_view_type' =>$ffwd_info_options['fb_view_type'],
1275
- 'view_on_fb' =>$ffwd_info_options['view_on_fb'],
1276
- 'post_text_length' =>$ffwd_info_options['post_text_length'],
1277
- 'event_street' =>$ffwd_info_options['event_street'],
1278
- 'event_city' =>$ffwd_info_options['event_city'],
1279
- 'event_country' =>$ffwd_info_options['event_country'],
1280
- 'event_zip' =>$ffwd_info_options['event_zip'],
1281
- 'event_map' =>$ffwd_info_options['event_map'],
1282
- 'event_date' =>$ffwd_info_options['event_date'],
1283
- 'event_desp_length' =>$ffwd_info_options['event_desp_length'],
1284
- 'comments_replies' =>$ffwd_info_options['comments_replies'],
1285
- 'comments_filter' =>$ffwd_info_options['comments_filter'],
1286
- 'comments_order' =>$ffwd_info_options['comments_order'],
1287
- 'page_plugin_pos' =>$ffwd_info_options['page_plugin_pos'],
1288
- 'page_plugin_fans' =>$ffwd_info_options['page_plugin_fans'],
1289
- 'page_plugin_cover' =>$ffwd_info_options['page_plugin_cover'],
1290
- 'page_plugin_header' =>$ffwd_info_options['page_plugin_header'],
1291
- 'page_plugin_width' =>$ffwd_info_options['page_plugin_width'],
1292
- 'image_onclick_action' =>$ffwd_info_options['image_onclick_action'],
1293
- 'fb_page_id' =>$ffwd_info_options['fb_page_id'],
1294
- ), array(
1295
- '%s',//name
1296
- '%s',//page_access_token
1297
- '%s',//type
1298
- '%s',//content_type
1299
- '%s',//content
1300
- '%s',//content_url
1301
- '%s',//timeline_type
1302
- '%s',//from
1303
- '%d',//limit
1304
- '%s',//app_id
1305
- '%s',//app_secret
1306
- '%d',//exist_access
1307
- '%s',//access_token
1308
- '%d',//order
1309
- '%d',//published
1310
- '%s',//update_mode
1311
- ));
1312
 
1313
  /**
1314
- * Get last inserted id from wd_fb_info for table bellow.
1315
- * Insert into type column the
1316
- * first and only value of self::$content array.
1317
- * Escape paging in self::data
1318
  */
1319
- self::$fb_id = $wpdb->insert_id;
1320
- if($save_fb_info !== FALSE) {
1321
- self::insert_wd_fb_data($data);
1322
- self::insert_wd_fb_info_options($ffwd_info_options);
1323
- //save options
1324
- }
1325
- else {
1326
- self::wd_fb_massage('error', 'Problem with save fb feed');
 
 
 
 
 
 
 
 
 
 
1327
  }
1328
- }
1329
-
1330
 
1331
- public static function insert_wd_fb_data($data) {
1332
- global $wpdb;
1333
- $content = implode(",", self::$content);
1334
- $success = 'no_data';
1335
-
1336
- foreach($data as $next) {
1337
- /**
1338
- * check if content_type is timeline dont save wd_fb_data if
1339
- * $content string not contain $next['type']
1340
- */
1341
- if(self::$content_type == 'timeline') {
1342
- if(strpos($content, $next['type']) === false)
1343
- continue;
1344
- $type = $next['type'];
1345
-
1346
- if(self::$timeline_type == 'others')
1347
- if(self::$id == $next['from']['id'])
1348
- continue;
1349
- }
1350
- else
1351
- $type = self::$content[0];
1352
-
1353
- // Use this var for check if album imgs count not 0
1354
- $album_imgs_exists = true;
1355
-
1356
- switch($type) {
1357
- case 'photos': {
1358
- /**
1359
- * If object type is photo(photos, video, videos,
1360
- * album, event cover photo etc ) so trying to
1361
- * check the count of resolution types
1362
- * and store source for thumb and main size
1363
- */
1364
- if(array_key_exists ( 'images' , $next )) {
1365
- $img_res_count = count($next['images']);
1366
- if($img_res_count > 6) {
1367
- $thumb_url = $next['images'][$img_res_count - 1]['source'];
1368
- $main_url = $next['images'][0]['source'];
1369
- }
1370
- else {
1371
- $thumb_url = $next['images'][0]['source'];
1372
- $main_url = $next['images'][0]['source'];
1373
- }
1374
- $width = $next['images'][0]['width'];
1375
- $height = $next['images'][0]['height'];
1376
- }
1377
- break;
1378
- }
1379
- case 'videos': {
1380
- if(array_key_exists ( 'format' , $next )) {
1381
- $img_res_count = count($next['format']);
1382
- if($img_res_count > 2) {
1383
- $main_url = $next['format'][$img_res_count - 1]['picture'];
1384
- $thumb_url = $next['format'][1]['picture'];
1385
- }
1386
- else {
1387
- $thumb_url = $next['format'][$img_res_count - 1]['picture'];
1388
- $main_url = $next['format'][$img_res_count - 1]['picture'];
1389
- }
1390
- $width = $next['format'][$img_res_count - 1]['width'];
1391
- $height = $next['format'][$img_res_count - 1]['height'];
1392
- }
1393
- break;
1394
- }
1395
- case 'albums': {
1396
- if(array_key_exists ( 'count' , $next )) {
1397
- $album_imgs_count = $next['count'];
1398
- if($album_imgs_count == 0) {
1399
- $album_imgs_exists = false;
1400
- }
1401
- }
1402
- break;
1403
- }
1404
- default: {
1405
- $thumb_url = '';
1406
- $main_url = '';
1407
- }
1408
- }
1409
- if($type == "albums" && !$album_imgs_exists)
1410
- continue;
1411
- // Check if exists such keys in $next array
1412
- $object_id = array_key_exists ( 'id' , $next ) ? $next['id'] : '';
1413
- $name = array_key_exists ( 'name' , $next ) ? addcslashes($next['name'], '\\') : '';
1414
- $description = array_key_exists ( 'description', $next ) ? addcslashes($next['description'], '\\') : '';
1415
- $link = array_key_exists ( 'link' , $next ) ? $next['link'] : '';
1416
- $status_type = array_key_exists ( 'status_type' , $next ) ? $next['status_type'] : '';
1417
- $message = array_key_exists ( 'message' , $next ) ? addcslashes($next['message'], '\\') : '';
1418
- $story = array_key_exists ( 'story' , $next ) ? $next['story'] : '';
1419
- $place = array_key_exists ( 'place' , $next ) ? json_encode($next['place']) : '';
1420
- $message_tags = array_key_exists ( 'message_tags' , $next ) ? json_encode($next['message_tags']) : '';
1421
- $with_tags = array_key_exists ( 'with_tags' , $next ) ? json_encode($next['with_tags']) : '';
1422
- $story_tags = array_key_exists ( 'story_tags' , $next ) ? json_encode($next['story_tags']) : '';
1423
- $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
1424
- $comments = array_key_exists('comments', $next) ? json_encode($next['comments']) : '';
1425
- $shares = array_key_exists('shares', $next) ? json_encode($next['shares']) : '';
1426
- $attachments = array_key_exists('attachments', $next) ? json_encode($next['attachments']) : '';
1427
- $from_json = array_key_exists('from', $next) ? json_encode($next['from']) : '';
1428
- if($type=="events")
1429
- $from_json = array_key_exists('owner', $next) ? json_encode($next['owner']) : '';
1430
-
1431
-
1432
-
1433
-
1434
- $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
1435
-
1436
-
1437
-
1438
- // When content is events some fields have different names, so check them.
1439
- if($type == 'events') {
1440
- $source = array_key_exists ( 'cover' , $next ) ? $next['cover']['source'] : '';
1441
- $created_time = array_key_exists ( 'start_time' , $next ) ? $next['start_time'] : '';
1442
- $from = array_key_exists ( 'owner' , $next ) ? $next['owner']['id'] : '';
1443
-
1444
- $main_url = $source;
1445
- $thumb_url = $main_url;
1446
- // Store event end time in update_time field
1447
- $updated_time = array_key_exists ( 'end_time' , $next ) ? $next['end_time'] : '';
1448
- }
1449
- else {
1450
- $source = array_key_exists ( 'source' , $next ) ? $next['source'] : '';
1451
- $created_time = array_key_exists ( 'created_time' , $next ) ? $next['created_time'] : '';
1452
- $from = array_key_exists ( 'from' , $next ) ? $next['from']['id'] : '';
1453
-
1454
- //check if thumb and main urls is set (if no , so set them source )
1455
- $thumb_url = isset($thumb_url) ? $thumb_url : $source;
1456
- $main_url = isset($main_url) ? $main_url : $source;
1457
- $updated_time = array_key_exists ( 'updated_time' , $next ) ? $next['updated_time'] : '';
1458
- }
1459
- $width = isset($width) ? $width : '';
1460
- $height = isset($height) ? $height : '';
1461
- $created_time_number = ($created_time != '') ? strtotime($created_time) : 0;
1462
-
1463
- $save_fb_data = $wpdb->insert($wpdb->prefix . 'wd_fb_data', array(
1464
- 'fb_id' => self::$fb_id,
1465
- 'object_id' => $object_id,
1466
- 'from' => $from,
1467
- 'name' => $name,
1468
- 'description' => $description,
1469
- 'type' => $type,
1470
- 'message' => $message,
1471
- 'story' => $story,
1472
- 'place' => $place,
1473
- 'message_tags' => $message_tags,
1474
- 'with_tags' => $with_tags,
1475
- 'story_tags' => $story_tags,
1476
- 'status_type' => $status_type,
1477
- 'link' => $link,
1478
- 'source' => $source,
1479
- 'thumb_url' => $thumb_url,
1480
- 'main_url' => $main_url,
1481
- 'width' => $width,
1482
- 'height' => $height,
1483
- 'created_time' => $created_time,
1484
- 'updated_time' => $updated_time,
1485
- 'created_time_number' => $created_time_number,
1486
- 'comments' => $comments,
1487
- 'shares' => $shares,
1488
- 'attachments' => $attachments,
1489
- 'who_post' => $from_json,
1490
- 'reactions' => $reactions,
1491
- ), array(
1492
- '%d',
1493
- '%s',
1494
- '%s',
1495
- '%s',
1496
- '%s',
1497
- '%s',
1498
- '%s',
1499
- '%s',
1500
- '%s',
1501
- '%s',
1502
- '%s',
1503
- '%s',
1504
- '%s',
1505
- '%s',
1506
- '%s',
1507
- '%s',
1508
- '%s',
1509
- '%s',
1510
- '%s',
1511
- '%s',
1512
- '%s',
1513
- '%d',
1514
- '%s',
1515
- '%s',
1516
- '%s',
1517
- '%s',
1518
- '%s',
1519
- ));
1520
- if ($save_fb_data !== FALSE) {
1521
- $success = 'success';
1522
- }
1523
- else {
1524
- $success = 'error';
1525
- break;
1526
- }
1527
- }
1528
- if($success == 'success') {
1529
- if(self::$save || self::$edit_feed)
1530
- self::wd_fb_massage('success', self::$fb_id);
1531
- }
1532
- elseif($success == 'error' || $success == 'no_data' && (self::$save || self::$edit_feed)) {
1533
- $message = ($success == 'error') ? 'Problem with save' : 'There is no data matching your choice.';
1534
- self::wd_fb_massage('error', $message);
1535
- }
1536
- else {
1537
- if(self::$save || self::$edit_feed)
1538
- self::wd_fb_massage('error', 'Problem with save');
1539
- }
1540
- }
1541
-
1542
- public static function check_app() {
1543
- global $wpdb;
1544
-
1545
- if(!class_exists('Facebook'))
1546
- include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
1547
- $app_id = ((isset($_POST['app_id'])) ? sanitize_text_field(stripslashes($_POST['app_id'])) : '');
1548
- $app_secret = ((isset($_POST['app_secret'])) ? sanitize_text_field(stripslashes($_POST['app_secret'])) : '');
1549
- //prepare params for graph api call
1550
-
1551
-
1552
-
1553
-
1554
-
1555
-
1556
-
1557
- $fb_graph_url = str_replace (
1558
- array('{FB_ID}', '{EDGE}','{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1559
- array($app_id, '', 'access_token=' . self::$access_token . '&', 'fields=roles&', '', ''),
1560
- self::$graph_url
1561
- );
1562
-
1563
- $data = self::decap_do_curl($fb_graph_url);
1564
- //check if exists app with such app_id and app_secret
1565
- if(array_key_exists("id", $data) && array_key_exists("roles", $data)) {
1566
- //create facebook object
1567
- self::$facebook_sdk = new Facebook(array(
1568
- 'appId' => $app_id,
1569
- 'secret' => $app_secret,
1570
- ));
1571
-
1572
- $response_url='https://graph.facebook.com/oauth/access_token?client_id='.$app_id.'&client_secret='.$app_secret.'&grant_type=client_credentials';
1573
- $response = wp_remote_get( $response_url);
1574
-
1575
- $access_token=explode('=',$response['body']);
1576
- $access_token=$access_token[1];
1577
-
1578
-
1579
-
1580
- //save app id and app secret
1581
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1582
- 'app_id' => $app_id,
1583
- 'app_secret' => $app_secret,
1584
- 'access_token' => $access_token,
1585
- ),
1586
- array('id' => 1)
1587
- );
1588
-
1589
- //checked logged in user
1590
- $user = self::$facebook_sdk->getUser();
1591
- if (!$user) {
1592
- $app_link_url = self::$facebook_sdk->getLoginUrl(array( 'scope' => 'user_photos,user_videos,user_posts','redirect_uri' => admin_url() . 'admin.php?page=options_ffwd'));
1593
- $app_link_text = __('Log into Facebook with your app', 'bwg');
1594
- self::wd_fb_massage('success', $app_link_url);
1595
- }
1596
- else {
1597
- self::wd_fb_massage('success', admin_url() . 'admin.php?page=options_ffwd');
1598
- }
1599
- }
1600
- //check if exist error
1601
- elseif(array_key_exists("error", $data)) {
1602
- $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1603
-
1604
- 'access_token' => '',
1605
- ),
1606
- array('id' => 1)
1607
- );
1608
-
1609
- if( $data['error']['code']==4)
1610
- update_option('ffwd_limit_notice',1);
1611
-
1612
- self::wd_fb_massage('error', $data['error']['message'].'asdasd');
1613
- }
1614
- else {
1615
- self::wd_fb_massage('error', 'Something went wrong');
1616
- }
1617
- }
1618
-
1619
- public static function dropp_objects() {
1620
- global $wpdb;
1621
- $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? sanitize_text_field($_POST['ids']) : '';
1622
- $yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
1623
- echo $yes;
1624
- if (defined( 'DOING_AJAX' ) && DOING_AJAX )
1625
  {
1626
- die();
1627
- }
1628
- }
1629
 
1630
- public static function check_logged_in_user() {
1631
- global $wpdb;
1632
- if(!class_exists('Facebook'))
1633
- include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
1634
- $fb_option_data = self::get_fb_option_data();
1635
- // Create facebook object
1636
- self::$facebook_sdk = new Facebook(array(
1637
- 'appId' => $fb_option_data->app_id,
1638
- 'secret' => $fb_option_data->app_secret,
1639
- ));
1640
- // Checked logged in user
1641
- $user = self::$facebook_sdk->getUser();
1642
- if (!$user) {
1643
- return 0;
1644
- }
1645
- else {
1646
- return 1;
1647
- }
1648
- }
1649
-
1650
- public static function wd_fb_massage($mood, $massage)
1651
- {
1652
- if(self::$ffwd_fb_massage){
1653
- echo json_encode(array($mood, $massage));
1654
- self::$ffwd_fb_massage = false;
1655
-
1656
- if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX )
1657
- {
1658
- wp_die();
1659
  }
1660
- }else{
1661
- return;
1662
  }
1663
- }
1664
-
1665
- public static function check_fb_type() {
1666
- $fb_type = ((isset($_POST['fb_type'])) ? sanitize_text_field(stripslashes($_POST['fb_type'])) : '');
1667
- self::$fb_type = in_array($fb_type, self::$fb_valid_types) ? $fb_type : false;
1668
- if(self::$fb_type)
1669
- self::$fb_type();
1670
- else
1671
- self::wd_fb_massage('error', 'no such FB type');
1672
- }
1673
 
1674
- public static function decap_do_curl($uri)
1675
- {
1676
- $facebook_graph_results = null;
1677
- $facebook_graph_url = $uri; //TODO: Add URL checking here, else error out
1678
-
1679
- $response = wp_remote_get($facebook_graph_url);
1680
-
1681
- if(isset($response->errors) && isset($response->errors["http_request_failed"][0])){
1682
- self::wd_fb_massage('error', $response->errors["http_request_failed"][0]);
1683
- }elseif( is_array( $response ) && isset($response['body'])) {
1684
- $header = $response['headers']; // array of http header lines
1685
- $facebook_graph_results = $response['body']; // use the content
1686
- }
1687
- $facebook_graph_results = json_decode($facebook_graph_results, true);
1688
- if (array_key_exists("error", $facebook_graph_results)) {
1689
- update_option('ffwd_token_error_flag', "1");
1690
- if ($facebook_graph_results['error']['code'] == 2) {
1691
- return self::decap_do_curl($facebook_graph_url);
1692
  }
1693
  }
1694
- else {
1695
- update_option('ffwd_token_error_flag', "0");
1696
- }
1697
- /* if(isset($facebook_graph_results["error"]) && isset($facebook_graph_results["error"]['code']) && $facebook_graph_results["error"]['code']===190){
1698
- if(self::$exist_access){
1699
- $fb_option_data = self::get_fb_option_data();
1700
-
1701
- if(isset($fb_option_data->app_id) && isset($fb_option_data->app_secret)){
1702
- $app_id = $fb_option_data->app_id;
1703
- $app_secret = $fb_option_data->app_secret;
1704
- if(!empty($app_id) && !empty($app_id)){
1705
- $res = self::update_page_access_token(self::$access_token);
1706
- if($res["success"]){
1707
- self::$access_token = $res["success"];
1708
- }
1709
- }
1710
- }
1711
- }
1712
- }*/
1713
-
1714
 
1715
-
1716
- if(isset($facebook_graph_results["error"]) && count(self::$access_tokens)>1){
1717
- if (($key = array_search(self::$access_token, self::$access_tokens)) !== false) {
1718
- unset(self::$access_tokens[$key]);
1719
- self::$access_token = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1720
  }
1721
- $rand_key = array_rand(self::$access_tokens);
1722
- self::$access_token = self::$access_tokens[$rand_key];
1723
-
1724
- $parts = parse_url($uri);
1725
- $queryParams = array();
1726
- parse_str($parts['query'], $queryParams);
1727
- $queryParams["access_token"] = self::$access_token;
1728
 
1729
- $queryString = http_build_query($queryParams);
1730
- $url = "https://graph.facebook.com".$parts['path'] . '?' . $queryString;
1731
- return self::decap_do_curl($url);
1732
  }
1733
- return $facebook_graph_results;
1734
- }
1735
- public static function update_page_access_token($old_access_token, $page_id = ''){
1736
- $redirect_uri = 'https://api.web-dorado.com/fb/';
1737
- $admin_url = urlencode(admin_url('admin.php?page=options_ffwd'));
1738
- $state = array(
1739
- 'wp_site_url' => $admin_url
1740
- );
1741
- $base_url = add_query_arg(array(
1742
  'action' => 'ff_wd_exchange_token',
1743
  'ff_wd_user_token' => $old_access_token,
1744
  'scope' => 'manage_pages',
1745
  'code' => '200',
1746
  ), $redirect_uri);
1747
 
1748
- $base_url .= '&state=' . base64_encode(json_encode($state));
1749
- $response = wp_remote_post($base_url);
1750
 
1751
- if(!is_wp_error( $response ) && isset($response["body"])) {
1752
- $ffwd_user_access_token = json_decode($response["body"], TRUE);
1753
 
1754
- if ( isset($ffwd_user_access_token["access_token"]) ) {
1755
- $ffwd_user_access_token = sanitize_text_field($ffwd_user_access_token["access_token"]);
1756
- $datas = get_option('ffwd_pages_list');
1757
- foreach ( $datas as $data ) {
1758
- if( $data->id == $page_id ) {
1759
- $data->access_token = $ffwd_user_access_token;
 
1760
  }
1761
- }
1762
 
1763
 
1764
- update_option('ffwd_pages_list', $datas);
1765
- update_option('ffwd_token_error_flag', "0");
1766
- self::update_access_tokens();
 
1767
 
 
1768
  }
1769
  }
1770
- }
1771
- public static function get_autoupdate_interval(){
1772
- global $wpdb;
1773
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
1774
- if(!isset($row)){
1775
- return 30;
1776
- }
1777
- if(!isset($row->autoupdate_interval)){
1778
- return 30;
 
 
 
 
 
1779
  }
1780
- $autoupdate_interval = $row->autoupdate_interval;
1781
- return $autoupdate_interval;
1782
- }
1783
 
1784
  public static function get_auth_url(){
1785
  $app_id = '457830911380339';
1786
  $redirect_uri = 'https://api.web-dorado.com/fb/';
1787
-
1788
  $admin_url = urlencode(admin_url('admin.php?page=options_ffwd'));
1789
 
1790
  $state = array(
@@ -1794,7 +1871,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
1794
  $fb_url = add_query_arg(array(
1795
  'client_id' => $app_id,
1796
  'redirect_uri' => $redirect_uri,
1797
- 'scope' => 'manage_pages',
1798
  ), "https://www.facebook.com/dialog/oauth");
1799
 
1800
  $fb_url .= '&state=' . base64_encode(json_encode($state));
@@ -1810,7 +1887,9 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
1810
 
1811
  $pages = json_decode($response['body']);
1812
  update_option('ffwd_pages_list', $pages->data);
 
1813
  update_option('ffwd_token_error_flag', "0");
 
1814
  self::update_access_tokens();
1815
  return true;
1816
  }
@@ -1830,11 +1909,4 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
1830
  }
1831
 
1832
  }
1833
-
1834
- ////////////////////////////////////////////////////////////////////////////////////////
1835
- // Private Methods //
1836
- ////////////////////////////////////////////////////////////////////////////////////////
1837
- ////////////////////////////////////////////////////////////////////////////////////////
1838
- // Listeners //
1839
- ////////////////////////////////////////////////////////////////////////////////////////
1840
- }
1
  <?php
2
 
 
3
  class WDFacebookFeed {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ protected static $fb_type;
6
+ protected static $facebook_sdk;
7
+ protected static $graph_url = 'https://graph.facebook.com/v10.0/{FB_ID}/{EDGE}?{ACCESS_TOKEN}{FIELDS}{LIMIT}{OTHER}';
8
+ protected static $id;
9
+ protected static $fb_valid_types = array('page', 'group', 'profile');
10
+ protected static $valid_content_types = array('timeline', 'specific');
11
+ protected static $content_url;
12
+ protected static $content_type;
13
+ protected static $timeline_type;
14
+ protected static $content;
15
+ protected static $limit;
16
+ protected static $fb_limit = 20;
17
+ protected static $data;
18
+ // For collapse timeline data matching content requirements
19
+ protected static $complite_timeline_data = array();
20
+ // Maximum graph call integer for timeline type
21
+ protected static $timeline_max_call_count = 10;
22
+ protected static $valid_content = array('statuses', 'photos', 'videos', 'links', 'events', 'albums');
23
+ protected static $access_token;
24
+ protected static $event_order;
25
+ protected static $upcoming_events;
26
+ protected static $exist_access = false;
27
+ protected static $auto_update_feed = 0;
28
+ protected static $updateOnVersionChange = false;
29
 
30
  // Existing app ids and app secrets
31
+ protected static $access_tokens = array();
32
+ private static $ffwd_fb_massage = true;
33
+ protected static $save = true;
34
+ protected static $edit_feed = false;
35
+ protected static $update_mode = 'keep_old';
36
+ protected static $fb_id;
37
 
38
+ public static $client_side_check = array();
 
 
 
 
39
 
40
+ public function __construct() {
41
 
42
+ }
43
 
44
+ public static function execute() {
45
+ if (function_exists('current_user_can')) {
46
+ if (!current_user_can('manage_options')) {
47
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX )
48
+ {
49
+ die('Access Denied');
50
+ }
51
+ }
52
+ } else {
53
+ die('Access Denied');
54
+ }
55
+ require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
56
+ $action = WDW_FFWD_Library::get('action');
57
 
58
+ if (!WDW_FFWD_Library::verify_nonce('')) {
59
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX )
60
+ {
61
+ die(WDW_FFWD_Library::delimit_wd_output(json_encode(array("error", "Sorry, your nonce did not verify."))));
62
+ }
63
+ }
64
+
65
+ if (method_exists('WDFacebookFeed', $action)) {
66
+ call_user_func(array('WDFacebookFeed', $action));
67
+ } else {
68
+ call_user_func(array('WDFacebookFeed', 'wd_fb_massage'), array('error', 'Unknown action'));
69
  }
 
 
 
 
70
  }
 
 
71
 
72
+ /**
73
+ * Save/Edit feed
74
+ */
75
+ public static function save_facebook_feed() {
76
+ $id = (isset($_POST['current_id']) && $_POST['current_id'] != '') ? (int)esc_html(stripslashes($_POST['current_id'])) : 0;
77
+ if ($id) {
78
+ self::$fb_id = $id;
79
+ self::$edit_feed = true;
80
+ self::$save = false;
81
+ } else {
82
+ self::$save = true;
83
+ }
84
+ self::check_fb_type();
85
  }
86
 
87
+ /**
88
+ * Edit Facebook Feed
89
+ */
90
+ public static function edit_feed() {
91
+ global $wpdb;
92
+ $update_wd_fb_data = FALSE;
93
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE id="%d"', self::$fb_id));
94
+ $ffwd_info_options = array();
95
+ $ffwd_info_options['theme'] = ((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
96
+ $ffwd_info_options['masonry_hor_ver'] = ((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
97
+ $ffwd_info_options['image_max_columns'] = ((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
98
+ $ffwd_info_options['thumb_width'] = ((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
99
+ $ffwd_info_options['thumb_height'] = ((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
100
+ $ffwd_info_options['thumb_comments'] = ((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
101
+ $ffwd_info_options['thumb_likes'] = ((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
102
+ $ffwd_info_options['thumb_name'] = ((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
103
+ $ffwd_info_options['blog_style_width'] = ((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
104
+ $ffwd_info_options['blog_style_height'] = ((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
105
+ $ffwd_info_options['blog_style_view_type'] = ((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
106
+ $ffwd_info_options['blog_style_comments'] = ((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
107
+ $ffwd_info_options['blog_style_likes'] = ((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
108
+ $ffwd_info_options['blog_style_message_desc'] = ((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
109
+ $ffwd_info_options['blog_style_shares'] = ((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
110
+ $ffwd_info_options['blog_style_shares_butt'] = ((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
111
+ $ffwd_info_options['blog_style_facebook'] = ((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
112
+ $ffwd_info_options['blog_style_twitter'] = ((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
113
+ $ffwd_info_options['blog_style_google'] = '0';
114
+ $ffwd_info_options['blog_style_author'] = ((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
115
+ $ffwd_info_options['blog_style_name'] = ((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
116
+ $ffwd_info_options['blog_style_place_name'] = ((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
117
+ $ffwd_info_options['fb_name'] = ((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
118
+ $ffwd_info_options['fb_plugin'] = ((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
119
+ $ffwd_info_options['album_max_columns'] = ((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
120
+ $ffwd_info_options['album_title'] = ((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
121
+ $ffwd_info_options['album_thumb_width'] = ((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
122
+ $ffwd_info_options['album_thumb_height'] = ((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
123
+ $ffwd_info_options['album_image_max_columns'] = ((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
124
+ $ffwd_info_options['album_image_thumb_width'] = ((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
125
+ $ffwd_info_options['album_image_thumb_height'] = ((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
126
+ $ffwd_info_options['pagination_type'] = ((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
127
+ $ffwd_info_options['objects_per_page'] = ((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
128
+ $ffwd_info_options['popup_fullscreen'] = ((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
129
+ $ffwd_info_options['popup_height'] = ((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
130
+ $ffwd_info_options['popup_width'] = ((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
131
+ $ffwd_info_options['popup_effect'] = ((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
132
+ $ffwd_info_options['popup_autoplay'] = ((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
133
+ $ffwd_info_options['open_commentbox'] = ((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
134
+ $ffwd_info_options['popup_interval'] = ((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
135
+ $ffwd_info_options['popup_enable_filmstrip'] = ((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
136
+ $ffwd_info_options['popup_filmstrip_height'] = ((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
137
+ $ffwd_info_options['popup_comments'] = ((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
138
+ $ffwd_info_options['popup_likes'] = ((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
139
+ $ffwd_info_options['popup_shares'] = ((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
140
+ $ffwd_info_options['popup_author'] = ((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
141
+ $ffwd_info_options['popup_name'] = ((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
142
+ $ffwd_info_options['popup_place_name'] = ((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
143
+ $ffwd_info_options['popup_enable_ctrl_btn'] = ((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
144
+ $ffwd_info_options['popup_enable_fullscreen'] = ((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
145
+ $ffwd_info_options['popup_enable_info_btn'] = ((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
146
+ $ffwd_info_options['popup_message_desc'] = ((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
147
+ $ffwd_info_options['popup_enable_facebook'] = ((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
148
+ $ffwd_info_options['popup_enable_twitter'] = ((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
149
+ $ffwd_info_options['popup_enable_google'] = '0';
150
+ $ffwd_info_options['fb_view_type'] = ((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
151
+ $ffwd_info_options['image_onclick_action'] = ((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
152
+ $ffwd_options_db = array(
153
+ 'view_on_fb',
154
+ 'post_text_length',
155
+ 'event_street',
156
+ 'event_city',
157
+ 'event_country',
158
+ 'event_zip',
159
+ 'event_map',
160
+ 'event_date',
161
+ 'event_desp_length',
162
+ 'comments_replies',
163
+ 'comments_filter',
164
+ 'comments_order',
165
+ 'page_plugin_pos',
166
+ 'page_plugin_fans',
167
+ 'page_plugin_cover',
168
+ 'page_plugin_header',
169
+ 'page_plugin_width',
170
+ 'event_order',
171
+ 'upcoming_events',
172
+ 'fb_page_id'
173
+ );
174
+ foreach ( $ffwd_options_db as $ffwd_option_db ) {
175
+ $ffwd_info_options[$ffwd_option_db] = ((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
176
+ }
177
+ $name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
178
+ $name = str_replace(array( "'", '"' ), "", $name);
179
+ $page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
180
+ $update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
181
+ $published = ((isset($_POST['published'])) ? (int) esc_html(stripslashes($_POST['published'])) : 1);
182
+ $content = implode(",", self::$content);
183
+ $from = self::$id;
184
+ $update_wd_fb_data = ((self::$auto_update_feed != 0) || ($row->type != self::$fb_type) || ($row->content_type != self::$content_type) || ($row->content != $content) || ($row->from != $from) || ($row->timeline_type != self::$timeline_type) || ($row->limit != self::$limit) || ($row->event_order != self::$event_order) || ($row->upcoming_events != self::$upcoming_events));
185
+ if ( self::$fb_type == 'group' ) {
186
+ self::$timeline_type = 'feed';
187
+ }
188
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_info', array(
189
+ 'name' => $name,
190
+ 'page_access_token' => $page_access_token,
191
+ 'type' => self::$fb_type,
192
+ 'content_type' => self::$content_type,
193
+ 'content' => $content,
194
+ 'content_url' => self::$content_url,
195
+ 'timeline_type' => self::$timeline_type,
196
+ 'from' => $from,
197
+ 'limit' => self::$limit,
198
+ 'app_id' => '',
199
+ 'app_secret' => '',
200
+ 'exist_access' => 1,
201
+ 'access_token' => self::$access_token,
202
+ 'published' => $published,
203
+ 'update_mode' => $update_mode,
204
+ ), array( 'id' => self::$fb_id ));
205
+
206
+ if ( $save !== FALSE ) {
207
+ self::update_wd_fb_info_options($ffwd_info_options);
208
+ if ( $update_wd_fb_data ) {
209
+ $delete_query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d"', self::$fb_id);
210
+ $delete = $wpdb->query($delete_query);
211
+ if ( $delete === FALSE ) {
212
+ self::wd_fb_massage('error', 'Something went wrong (trying delete wd_fb_data)');
213
+ }
214
+ else {
215
+ $data = self::$data['data'];
216
+ self::insert_wd_fb_data($data);
217
+ }
218
+ }
219
+ self::wd_fb_massage('success', self::$fb_id);
220
+ }
221
+ else {
222
+ self::wd_fb_massage('error', 'Something went wrong (trying edit feed)');
223
+ }
224
  }
225
+
226
+ function insert_wd_fb_info_options($options) {
227
+ global $wpdb;
228
  }
 
229
 
230
+ /**
231
+ * Update Facebook Feed Options
232
+ *
233
+ * @param $options
234
+ */
235
+ static function update_wd_fb_info_options( $options ) {
236
+ global $wpdb;
237
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_info', array(
238
+ 'theme' => $options['theme'],
239
+ 'masonry_hor_ver' => $options['masonry_hor_ver'],
240
+ 'image_max_columns' => $options['image_max_columns'],
241
+ 'thumb_width' => $options['thumb_width'],
242
+ 'thumb_height' => $options['thumb_height'],
243
+ 'thumb_comments' => $options['thumb_comments'],
244
+ 'thumb_likes' => $options['thumb_likes'],
245
+ 'thumb_name' => $options['thumb_name'],
246
+ 'blog_style_width' => $options['blog_style_width'],
247
+ 'blog_style_height' => $options['blog_style_height'],
248
+ 'blog_style_view_type' => $options['blog_style_view_type'],
249
+ 'blog_style_comments' => $options['blog_style_comments'],
250
+ 'blog_style_likes' => $options['blog_style_likes'],
251
+ 'blog_style_message_desc' => $options['blog_style_message_desc'],
252
+ 'blog_style_shares' => $options['blog_style_shares'],
253
+ 'blog_style_shares_butt' => $options['blog_style_shares_butt'],
254
+ 'blog_style_facebook' => $options['blog_style_facebook'],
255
+ 'blog_style_twitter' => $options['blog_style_twitter'],
256
+ 'blog_style_google' => $options['blog_style_google'],
257
+ 'blog_style_author' => $options['blog_style_author'],
258
+ 'blog_style_name' => $options['blog_style_name'],
259
+ 'blog_style_place_name' => $options['blog_style_place_name'],
260
+ 'fb_name' => $options['fb_name'],
261
+ 'fb_plugin' => $options['fb_plugin'],
262
+ 'album_max_columns' => $options['album_max_columns'],
263
+ 'album_title' => $options['album_title'],
264
+ 'album_thumb_width' => $options['album_thumb_width'],
265
+ 'album_thumb_height' => $options['album_thumb_height'],
266
+ 'album_image_max_columns' => $options['album_image_max_columns'],
267
+ 'album_image_thumb_width' => $options['album_image_thumb_width'],
268
+ 'album_image_thumb_height' => $options['album_image_thumb_height'],
269
+ 'pagination_type' => $options['pagination_type'],
270
+ 'objects_per_page' => $options['objects_per_page'],
271
+ 'popup_fullscreen' => $options['popup_fullscreen'],
272
+ 'popup_height' => $options['popup_height'],
273
+ 'popup_width' => $options['popup_width'],
274
+ 'popup_effect' => $options['popup_effect'],
275
+ 'popup_autoplay' => $options['popup_autoplay'],
276
+ 'open_commentbox' => $options['open_commentbox'],
277
+ 'popup_interval' => $options['popup_interval'],
278
+ 'popup_enable_filmstrip' => $options['popup_enable_filmstrip'],
279
+ 'popup_filmstrip_height' => $options['popup_filmstrip_height'],
280
+ 'popup_comments' => $options['popup_comments'],
281
+ 'popup_likes' => $options['popup_likes'],
282
+ 'popup_shares' => $options['popup_shares'],
283
+ 'popup_author' => $options['popup_author'],
284
+ 'popup_name' => $options['popup_name'],
285
+ 'popup_place_name' => $options['popup_place_name'],
286
+ 'popup_enable_ctrl_btn' => $options['popup_enable_ctrl_btn'],
287
+ 'popup_enable_fullscreen' => $options['popup_enable_fullscreen'],
288
+ 'popup_enable_info_btn' => $options['popup_enable_info_btn'],
289
+ 'popup_message_desc' => $options['popup_message_desc'],
290
+ 'popup_enable_facebook' => $options['popup_enable_facebook'],
291
+ 'popup_enable_twitter' => $options['popup_enable_twitter'],
292
+ 'popup_enable_google' => $options['popup_enable_google'],
293
+ 'fb_view_type' => $options['fb_view_type'],
294
+ 'view_on_fb' => $options['view_on_fb'],
295
+ 'post_text_length' => $options['post_text_length'],
296
+ 'event_street' => $options['event_street'],
297
+ 'event_city' => $options['event_city'],
298
+ 'event_country' => $options['event_country'],
299
+ 'event_zip' => $options['event_zip'],
300
+ 'event_map' => $options['event_map'],
301
+ 'event_date' => $options['event_date'],
302
+ 'event_desp_length' => $options['event_desp_length'],
303
+ 'comments_replies' => $options['comments_replies'],
304
+ 'comments_filter' => $options['comments_filter'],
305
+ 'comments_order' => $options['comments_order'],
306
+ 'page_plugin_pos' => $options['page_plugin_pos'],
307
+ 'page_plugin_fans' => $options['page_plugin_fans'],
308
+ 'page_plugin_cover' => $options['page_plugin_cover'],
309
+ 'page_plugin_header' => $options['page_plugin_header'],
310
+ 'page_plugin_width' => $options['page_plugin_width'],
311
+ 'image_onclick_action' => $options['image_onclick_action'],
312
+ 'event_order' => $options['event_order'],
313
+ 'upcoming_events' => $options['upcoming_events'],
314
+ 'fb_page_id' => $options['fb_page_id'],
315
+ ), array( 'id' => self::$fb_id ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  }
317
 
318
+ // Prepare to delete
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
+ public static function prepare_to_delete($rows = array()) {
321
+ foreach ($rows as $row) {
322
+ self::$fb_id = isset($row->id) ? $row->id : '';
323
+ self::$fb_type = isset($row->type) ? $row->type : '';
324
+ self::$content_type = isset($row->content_type) ? $row->content_type : '';
325
+ self::$content = isset($row->content) ? explode(",", $row->content) : array();
326
+ self::$content_url = isset($row->content_url) ? $row->content_url : '';
327
+ self::$limit = isset($row->limit) ? $row->limit : '';
328
+ self::$id = isset($row->from) ? $row->from : '';
329
+ self::$access_token = isset($row->page_access_token) ? $row->page_access_token : '';
330
+
331
+ self::$update_mode = isset($row->update_mode) ? $row->update_mode : self::$update_mode;
332
+ self::get_rows_for_delete();
333
+ }
334
+ }
335
+
336
+ public static function get_rows_for_delete($rows = array())
337
+ {
338
+ global $wpdb;
339
+ $id = self::$fb_id;
340
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
341
+ $client_side_check = array();
342
+ foreach ($rows as $row) {
343
+ $data_for_client_side = new stdclass();
344
+ $fields = 'fields=id&';
345
+ $object_id = $row->object_id;
346
+
347
+ $fb_graph_url = str_replace(
348
+ array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
349
+ array($object_id, '', 'access_token=' . self::$access_token . '&', $fields, '', ''),
350
+ self::$graph_url
351
+ );
352
+ $data_for_client_side->id = $row->id;
353
+ $data_for_client_side->fb_graph_url = $fb_graph_url;
354
+
355
+ array_push($client_side_check, $data_for_client_side);
356
+ }
357
+ array_push(self::$client_side_check, $client_side_check);
358
+ }
359
 
360
+ // Auto update
361
+ public static function update_from_shedule($rows = array())
362
+ {
363
+ self::$save = false;
364
+ self::$edit_feed = false;
365
+ self::$auto_update_feed = 1;
366
+ foreach ($rows as $row) {
367
+ self::$fb_id = isset($row->id) ? $row->id : '';
368
+ self::$fb_type = isset($row->type) ? $row->type : '';
369
+ self::$content_type = isset($row->content_type) ? $row->content_type : '';
370
+ self::$content = isset($row->content) ? explode(",", $row->content) : array();
371
+ self::$content_url = isset($row->content_url) ? $row->content_url : '';
372
+ self::$timeline_type = isset($row->timeline_type) ? $row->timeline_type : 'posts';
373
+ self::$limit = isset($row->limit) ? $row->limit : '';
374
+ self::$id = isset($row->from) ? $row->from : '';
375
+ self::$access_token = isset($row->page_access_token) ? $row->page_access_token : '';
376
+ self::$update_mode = isset($row->update_mode) ? $row->update_mode : self::$update_mode;
377
+ $function_name = self::$content_type;
378
+ self::$function_name();
379
+ }
380
+ }
381
 
382
+ // updateOnVersionChange
383
  public static function updateOnVersionChange($rows = array())
384
  {
385
 
406
  }
407
  }
408
 
409
+ public static function update_db()
410
+ {
411
+ if(!isset(self::$data['data'])){
412
+ return;
413
+ }
414
+ global $wpdb;
415
+ $data = self::$data['data'];
416
+ $id = self::$fb_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
 
 
 
 
418
 
419
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` ASC ', $id));
420
+ $to_drop = array();
421
+ $to_insert = array();
422
+ $del_count = 0;
423
+ // Store content array as string.
 
 
424
 
425
+ $content = implode(",", self::$content);
426
+ foreach ($data as $next) {
427
+ // @todo API v10.0
428
+ $next['type'] = 'photo';
429
+
430
+ $exists = false;
431
+ $is_newer_then_any_of_olds = true;
432
+ $created_time = array_key_exists('created_time', $next) ? strtotime($next['created_time']) : '';
433
+ $created_time = ($created_time == '' && array_key_exists('start_time', $next)) ? strtotime($next['start_time']) : $created_time;
434
+ foreach ($rows as $row) {
435
+ if ($row->object_id == $next['id']) {
436
+ $exists = true;
437
+ }
438
 
439
+ if ($created_time < $row->created_time_number) {
440
+ $is_newer_then_any_of_olds = false;
441
+ }
442
+ }
443
 
444
+ if (!$exists && $is_newer_then_any_of_olds) {
445
+ if (self::$content_type == 'timeline') {
446
+ $from = array_key_exists('from', $next) ? $next['from']['id'] : '';
447
+ if (strpos($content, $next['type']) === false) {
448
+ continue;
449
+ }
450
 
451
+ if (self::$timeline_type == "posts" && self::$fb_type != 'group') {
452
+ if ($from != self::$id) {
453
+ continue;
454
+ }
455
+ }
456
+ else if (self::$timeline_type == "others") {
457
+ if ($from == self::$id) {
458
+ continue;
459
+ }
460
+ }
461
+ }
462
+ array_push($to_insert, $next);
463
+ }
464
+ }
465
+ $exist_count = count($rows);
466
+ $insert_count = count($to_insert);
467
+ if ((self::$update_mode == 'remove_old') && ($insert_count + $exist_count) > self::$limit) {
468
+ $del_count = ($insert_count + $exist_count) - self::$limit;
469
+ $ids = array();
470
+ $results = $wpdb->get_results($wpdb->prepare('SELECT `id` FROM `' . $wpdb->prefix . 'wd_fb_data` WHERE `fb_id` = "%d" ORDER BY `created_time_number` ASC LIMIT ' . $del_count, self::$fb_id));
471
+ foreach ($results as $row) {
472
+ array_push($ids, $row->id);
473
+ }
474
+ $ids = implode(',', $ids);
475
+ $delete = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` IN (' . $ids . ') AND `fb_id` = "%d"', self::$fb_id));
476
+ }
477
+
478
+ if ($insert_count) {
479
 
480
+ self::insert_wd_fb_data($to_insert);
481
+ }
482
+ }
483
 
484
  public static function update_version()
485
  {
490
  $delete = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `fb_id` = "%d"', self::$fb_id));
491
 
492
 
 
493
  self::insert_wd_fb_data($data);
494
 
495
  }
496
 
497
+ public static function page() {
498
+ $page_id = isset($_POST['fb_page_id']) ? sanitize_text_field($_POST['fb_page_id']) : 0;
499
+ $pages_list = get_option('ffwd_pages_list', array());
500
+ $fb_page = NULL;
501
+ foreach ( $pages_list as $page ) {
502
+ if ( $page->id === $page_id ) {
503
+ $fb_page = $page;
504
+ break;
505
+ }
506
+ }
507
+ if ( $fb_page == NULL ) {
508
+ die(0);
509
+ }
510
+ $fb_page_name = str_replace("/", "", $fb_page->name);
511
+ $_POST['content_url'] = 'https://www.facebook.com/' . $fb_page_name . "-" . $fb_page->id . '/';
512
+ $_POST['page_access_token'] = $fb_page->access_token;
513
  self::$content_url = ((isset($_POST['content_url'])) ? sanitize_text_field(stripslashes($_POST['content_url'])) : '');
514
  self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
 
 
515
  self::set_access_token();
516
+ self::check_fb_page_url();
517
+ // If user exists => set content.
 
 
 
 
 
518
  self::set_content();
519
+ // If right content => set access_token.
520
+ // If right access_token => call function.
521
  $function_name = self::$content_type;
522
  self::$function_name();
523
  }
524
 
525
+ public static function group()
526
+ {
527
+ self::$content_url = ((isset($_POST['content_url'])) ? sanitize_text_field(stripslashes($_POST['content_url'])) : '');
528
+ self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
529
+ self::check_fb_group_url();
530
+ self::set_content();
531
+ self::set_access_token();
532
+ self::timeline();
533
+
 
 
 
 
 
 
 
 
534
  }
 
535
 
536
+ public static function profile()
537
+ {
538
+ self::$content_url = '';
539
+ self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
540
+ self::check_fb_user();
541
+ self::set_content();
542
+ self::set_access_token();
543
+ $function_name = self::$content_type;
544
+ self::$function_name();
545
+ }
546
 
547
+ public static function check_fb_user()
548
+ {
549
+ //if (!class_exists('Facebook'))
550
+ include WD_FFWD_DIR . "/framework/facebook-sdk/src/Facebook/autoload.php";
551
+ global $wpdb;
552
+ $fb_option_data = self::get_fb_option_data();
553
+ $app_id = $fb_option_data->app_id;
554
+ $app_secret = $fb_option_data->app_secret;
555
+ self::$facebook_sdk = new Facebook\Facebook(array(
556
+ 'app_id' => $app_id,
557
+ 'app_secret' => $app_secret,
558
+ ));
559
+
560
+ $user_profile = 0;
561
+ if (isset($_SESSION['facebook_access_token'])) {
562
+ $user_profile = self::$facebook_sdk->get('/me', $_SESSION['facebook_access_token']);
563
+ $user_profile = $user_profile->getDecodedBody();
564
 
565
+ }
566
+
567
+ //$user = self::$facebook_sdk->getUser();
568
+ if ($user_profile)
569
+ $user_id = $user_profile['id'];
570
+
571
+
572
+ if (!$user_id) {
573
+ self::wd_fb_massage('error', 'Please login first');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
  } else {
575
+
576
+ self::$id = $user_id;
577
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  }
 
 
 
579
 
580
+ public static function get_fb_option_data()
581
+ {
582
+ global $wpdb;
583
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
 
585
+ return $row;
586
+ }
587
+
588
+ public static function set_content() {
589
+ $content_type = ((isset($_POST['content_type'])) ? sanitize_text_field(stripslashes($_POST['content_type'])) : '');
590
+ $content = (isset($_POST['content'])) ? $_POST['content'] : array();
591
+ self::$event_order = ((isset($_POST['event_order'])) ? sanitize_text_field(stripslashes($_POST['event_order'])) : 0);
592
+ self::$upcoming_events = ((isset($_POST['upcoming_events'])) ? sanitize_text_field(stripslashes($_POST['upcoming_events'])) : 0);
593
+ self::$content_type = in_array($content_type, self::$valid_content_types) ? $content_type : false;
594
+ // If right content type
595
+ if (self::$content_type) {
596
+ self::$content = $content;
597
+ }
598
+ else {
599
+ self::wd_fb_massage('error', 'Invalid content type');
600
+ }
601
+ }
602
+
603
+ public static function set_access_token()
604
+ {
605
+ if(isset($_POST["page_access_token"]) && $_POST["page_access_token"] != ""){
606
+ self::$access_token = $_POST["page_access_token"];
607
+ self::$exist_access = true;
608
  }else{
609
+ if(!isset(self::$access_token) || empty(self::$access_token)){
610
+ $rand_key = array_rand(self::$access_tokens);
611
+ self::$access_token = self::$access_tokens[$rand_key];
612
+ }
613
  }
614
+ }
 
 
 
 
 
 
 
 
 
615
 
616
+ public static function check_fb_page_url()
617
+ {
618
+ $first_token = strtok(self::$content_url, '/');
619
+ $second_token = strtok('/');
620
+ $third_token = strtok('/');
621
+ $fourth = strtok('/');
622
+ $fifth = strtok('/');
623
+ // Check if it's facebook url
624
+ if ($second_token === 'www.facebook.com') {
625
+ if ($third_token == 'pages') {
626
+ $fifth = explode('?', $fifth);
627
+ self::$id = $fifth[0];
628
+ } else {
629
+ // If page's id not showing in url (trying to get id by it's name)
630
+ $third_token = explode('-', $third_token);
631
+ if (count($third_token) > 0) {
632
+ $last = count($third_token) - 1;
633
+ $name_id = $third_token[$last];
634
+ } else
635
+ $name_id = $third_token[0];
636
+ // If not set access token , get random from our's
637
+ if (empty(self::$access_token)) {
638
+ $rand_key = array_rand(self::$access_tokens);
639
+ $access_token = self::$access_tokens[$rand_key];
640
+ } else {
641
+ $access_token = self::$access_token;
642
+ }
643
 
644
+ // Get data (including page id) by graph url
645
+ $fb_graph_url = str_replace(
646
+ array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
647
+ array($name_id, '', 'access_token=' . $access_token . '&', 'fields=id&', 'limit=10', ''),
648
+ self::$graph_url
649
+ );
650
+
651
+ $data = self::decap_do_curl($fb_graph_url);
652
+ // Check id existing
653
+ if (array_key_exists("id", $data)) {
654
+ self::$id = $data['id'];
655
+ } // Check if exist error
656
+ else if (array_key_exists("error", $data)) {
657
+ if ($data['error']['code'] == 4)
658
+ update_option('ffwd_limit_notice', 1);
659
+ self::wd_fb_massage('error', $data['error']['message']);
660
+ }
661
+ }
662
+ } else
663
+ self::wd_fb_massage('error', 'not Facebook url');
664
  }
665
 
666
+ public static function check_fb_group_url()
667
+ {
668
+ // Help tool for find your group id http://lookup-id.com/
669
+ $first_token = strtok(self::$content_url, '/');
670
+ $id = $first_token;
671
+ // If not set access token , get random from our's
672
+ $rand_key = array_rand(self::$access_tokens);
673
+ $access_token = self::$access_tokens[$rand_key];
674
+ $fb_graph_url = str_replace(
675
+ array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
676
+ array($id, '', 'access_token=' . $access_token . '&', '', '', ''),
677
+ self::$graph_url
678
+ );
679
+ // Check if no errors with that id
680
+ $data = self::decap_do_curl($fb_graph_url);
681
+
682
+ if (array_key_exists("error", $data)) {
683
+ if ($data['error']['code'] == 4)
684
+ update_option('ffwd_limit_notice', 1);
685
+ self::wd_fb_massage('error', $data['error']['message']);
686
+ } else {
687
+ self::$id = $id;
688
 
689
+ return;
690
+ }
691
+ }
692
 
693
+ /**
694
+ * Set timeline type.
695
+ * Set complite_timeline_data empty array.
696
+ * Message_tags in message, with_tags in story.
697
+ * Check if fb_type is group so set `feed` for edge, else set `posts`.
698
+ * Replace params in graph url.
699
+ */
700
  public static function timeline() {
701
+ global $wpdb;
702
+ self::set_timeline_type();
703
+ self::$complite_timeline_data = array();
704
+ $data = array();
 
 
 
 
 
 
705
  self::set_access_token();
 
706
  $edge = (self::$fb_type == 'group') ? 'feed' : ((self::$timeline_type == 'feed' || self::$timeline_type == 'others') ? 'feed' : 'posts');
707
+ // @todo v3.3 api
708
+ // $fields = 'fields=event,comments.limit(25).summary(true){parent.fields(id),created_time,from,like_count,message,comment_count},attachments,shares,id,name,story,link,created_time,updated_time,from{picture,name,link},message,type,source,place,message_tags,story_tags,status_type,privacy&';
709
+ $fields = 'fields=id,status_type,message,message_tags,shares,place,story,story_tags,privacy,attachments{media_type,media,url},from{picture,name,link},event,comments.limit(25).summary(true){parent.fields(id),created_time,from,like_count,comment_count},created_time,updated_time&';
710
+ $fb_graph_url = str_replace(
711
+ array(
712
+ '{FB_ID}',
713
+ '{EDGE}',
714
+ '{ACCESS_TOKEN}',
715
+ '{FIELDS}',
716
+ '{LIMIT}',
717
+ '{OTHER}'
718
+ ),
719
+ array(
720
+ self::$id,
721
+ $edge,
722
+ 'access_token=' . self::$access_token . '&',
723
+ $fields,
724
+ 'limit=' . self::$fb_limit . '&locale=' . get_locale() . '&',
725
+ ''
726
+ ),
727
+ self::$graph_url
728
+ );
729
+
730
+ if ( self::$auto_update_feed == 1 ) {
731
+ $id = self::$fb_id;
732
+ $update_ids = array();
733
+ $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));
734
+ foreach ( $rows as $row ) {
735
+ $update_ids[$row->object_id] = $row->id;
736
+ }
737
+ // max ids count for endpoint is 50
738
+ $update_ids_parts = array_chunk($update_ids, 50, TRUE);
739
  foreach ( $update_ids_parts as $update_ids_part ) {
740
+ $fb_graph_url_update = $fb_graph_url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  $update_data = self::decap_do_curl($fb_graph_url_update);
742
  self::update_wd_fb_data($update_data, $update_ids_part);
743
  }
 
744
  }
745
 
746
+ $data['data'] = self::complite_timeline($fb_graph_url);
747
+ self::$data = $data;
748
+ if ( self::$save ) {
749
+ self::save_db();
750
+ }
751
+ else {
752
+ if ( self::$edit_feed ) {
753
+ self::edit_feed();
754
+ }
755
+ else {
756
+ if ( self::$updateOnVersionChange ) {
757
+ self::update_version();
758
+ }
759
+ else {
760
+ self::update_db();
761
+ }
762
+ }
763
+ }
764
  }
765
 
766
+ public static function complite_timeline( $fb_graph_url ) {
767
+ $content = implode(',', self::$content);
768
+ if ( !empty(self::$content) ) {
769
+ $content = '';
770
+ foreach ( self::$content as $val ) {
771
+ if ( $val == 'photos') {
772
+ $content .= 'photo,album,';
773
+ }
774
+ if ( $val == 'videos') {
775
+ $content .= 'video,';
776
+ }
777
+ if ( $val == 'links') {
778
+ // @todo this a new endpoint https://developers.facebook.com/docs/graph-api/reference/page-post/sharedposts/
779
+ // $content .= 'link,';
780
+ }
781
+ }
782
+ $content = trim($content, ',');
783
+ }
784
+ $data = self::decap_do_curl($fb_graph_url);
785
+ if ( !empty($data) ) {
786
+ // If error exist
787
+ if ( array_key_exists('error', $data) ) {
788
+ if ( $data['error']['code'] == 4 ) {
789
+ update_option('ffwd_limit_notice', 1);
790
+ }
791
+ if ( $data['error']['code'] == 100 ) {
792
+ self::wd_fb_massage('error', $data['error']['message'] . ' <a target="_blank" href="https://help.10web.io/hc/en-us/articles/360025514692-Solving-Facebook-Feed-Errors?utm_source=facebook_feed&utm_medium=free_plugin">See more</a>');
793
+ }
794
+ else {
795
+ self::wd_fb_massage('error', $data['error']['message']);
796
+ }
797
+ }
798
+ else {
799
+ $post_data = !empty($data['data']) ? $data['data'] : array();
800
+ // Set next page if it exists
801
+ $paging = array_key_exists('paging', $data) ? $data['paging'] : array();
802
+ $next_page = array_key_exists('next', $paging) ? $paging['next'] : 0;
803
+
804
+ foreach ( $post_data as $next ) {
805
+ // @todo v10.0 api new logic.
806
+ if ( !empty($next['attachments']['data']) && !empty(!empty($next['attachments']['data'][0])) ) {
807
+ $attachments = $next['attachments']['data'][0];
808
+ $media_type = $attachments['media_type'];
809
+ if ( strpos($content, $media_type) === FALSE ) {
810
+ continue;
811
+ }
812
+ }
813
+ /* @TODO v3.3 deprecated
814
+ * if (strpos($content, $next['type']) === false) {
815
+ * continue;
816
+ * }
817
+ * if ($next['type'] == 'status' && !isset($next['description']) && !isset($next['message']) && !isset($next['name'])) {
818
+ * continue;
819
+ * }
820
+ */
821
+ if ( self::$timeline_type == 'others' && self::$id == $next['from']['id'] ) {
822
+ continue;
823
+ }
824
+ if ( $next['privacy']['value'] && $next['privacy']['value'] != 'EVERYONE' ) {
825
+ continue;
826
+ }
827
+ // if ( count(self::$complite_timeline_data) < self::$limit ) {
828
+ array_push(self::$complite_timeline_data, $next);
829
+ // }
830
+ }
831
+ // @todo what was this for?
832
+ // intval(count(self::$complite_timeline_data)) <= intval(self::$limit) &&
833
+ if ( self::$timeline_max_call_count > 0 && $next_page ) {
834
+ self::$timeline_max_call_count--;
835
 
836
+ return self::complite_timeline($next_page);
837
+ }
838
+ else {
839
+ return self::$complite_timeline_data;
840
+ }
841
+ }
842
+ }
843
+ }
844
 
845
+ public static function update_wd_fb_data( $data, $ids ) {
846
+ global $wpdb;
847
+ $content = implode(",", self::$content);
848
+ $success = 'no_data';
849
+ if ( !empty($data['data']) ) {
850
+ foreach ( $data['data'] as $key => $next ) {
851
+ $object_id = $next['id'];
852
+ // @TODO type is deprecated V3.3
853
+ /*
854
+ // check if content_type is timeline dont save wd_fb_data if
855
+ // $content string not contain $next['type']
856
+ if ( self::$content_type == 'timeline' ) {
857
+ if ( strpos($content, $next['type']) === FALSE ) {
858
+ continue;
859
+ }
860
+ $type = $next['type'];
861
+ if ( self::$timeline_type == 'others' && self::$id == $next['from']['id'] ) {
862
  continue;
863
  }
864
+ }
865
+ else {
866
+ $type = self::$content[0];
867
+ }
868
+ */
869
+ $type = '';
870
+ $source = '';
871
+ $main_url = '';
872
+ $thumb_url = '';
873
+ $link = '';
874
+ $width = '';
875
+ $height = '';
876
+ $attachments = (!empty($next['attachments']['data'][0])) ? $next['attachments']['data'][0] : array();
877
+ if ( self::$content_type == 'timeline' && empty($attachments) ) {
878
+ continue;
879
+ }
880
+ if ( !empty($attachments) ) {
881
+ $type = $attachments['media_type'];
882
+ // @todo API V10.0 Temporary solution for photos!
883
+ if ( self::$content_type == 'specific' && self::$content[0] == 'photos' && $type != 'photo' ) {
884
+ continue;
885
+ }
886
+ $link = !empty($attachments['url']) ? $attachments['url'] : '';
887
+ if ( !empty($attachments['media']) ) {
888
+ $media = $attachments['media'];
889
+ $main_url = !empty($media['image']['src']) ? $media['image']['src'] : '';
890
+ $thumb_url = !empty($media['image']['src']) ? $media['image']['src'] : '';
891
+ $width = !empty($media['image']['width']) ? $media['image']['width'] : '';
892
+ $height = !empty($media['image']['height']) ? $media['image']['height'] : '';
893
+ }
894
+ }
895
+ else if ( self::$content_type == 'specific' ) {
896
+ $type = self::$content[0];
897
+ }
898
+
899
+ // Use this var for check if album imgs count not 0
900
+ $album_imgs_exists = true;
901
+ switch ($type) {
902
+ case 'photos': {
903
+ /* @todo v3.3 API deprecated.
904
+ // * If object type is photo(photos, video, videos,
905
+ // * album, event cover photo etc ) so trying to
906
+ // * check the count of resolution types
907
+ // * and store source for thumb and main size
908
+
909
+ if ( array_key_exists('images', $next) ) {
910
+ $images = count($next['images']);
911
+ if ($images > 6 ) {
912
+ $thumb_url = $next['images'][$images - 1]['source'];
913
+ $main_url = $next['images'][0]['source'];
914
+ } else {
915
+ $thumb_url = $next['images'][0]['source'];
916
+ $main_url = $next['images'][0]['source'];
917
+ }
918
+ $width = $next['images'][0]['width'];
919
+ $height = $next['images'][0]['height'];
920
+ }
921
  */
922
+ break;
923
+ }
924
+ case 'videos': {
925
+ $name = array_key_exists('title', $next) ? addcslashes($next['title'], '\\') : '';
926
+ $link = array_key_exists('permalink_url', $next) ? 'https://www.facebook.com' . $next['permalink_url'] : '';
927
+ if (array_key_exists('format', $next)) {
928
+ $img_res_count = count($next['format']);
929
+ if ($img_res_count > 2) {
930
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
931
+ $thumb_url = $next['format'][1]['picture'];
932
+ } else {
933
+ $thumb_url = $next['format'][$img_res_count - 1]['picture'];
934
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
935
+ }
936
+ $width = $next['format'][$img_res_count - 1]['width'];
937
+ $height = $next['format'][$img_res_count - 1]['height'];
938
+ }
939
+ break;
940
+ }
941
+ case 'albums': {
942
+ if (array_key_exists('count', $next)) {
943
+ $album_imgs_count = $next['count'];
944
+ if ($album_imgs_count == 0) {
945
+ $album_imgs_exists = false;
946
+ }
947
+ }
948
 
949
+ break;
950
+ }
951
+ // @todo V10.0 API
952
+ case 'video': {
953
+ $type ='videos';
954
+ if ( !empty($attachments['media']['source']) ) {
955
+ $source = $attachments['media']['source'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
957
+ /* @todo v3.3 API deprecated.
958
+ if (array_key_exists('format', $next)) {
959
+ $img_res_count = count($next['format']);
960
+ if ($img_res_count > 2) {
961
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
962
+ $thumb_url = $next['format'][1]['picture'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
  } else {
964
+ $thumb_url = $next['format'][$img_res_count - 1]['picture'];
965
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
 
 
 
 
 
 
966
  }
967
+ $width = $next['format'][$img_res_count - 1]['width'];
968
+ $height = $next['format'][$img_res_count - 1]['height'];
969
+ }
970
+ */
971
+ break;
972
+ }
973
+ // @todo V10.0 API
974
+ case 'album': {
975
+ $type = 'albums';
976
+ /* @todo v3.3 API deprecated.
977
+ if (array_key_exists('count', $next)) {
978
+ $album_imgs_count = $next['count'];
979
+ if ($album_imgs_count == 0) {
980
+ $album_imgs_exists = false;
981
+ }
982
+ }
983
+ */
984
+ break;
985
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
986
  }
987
+ // @todo In the case of 'albums' it works in JS version․
988
+ if ( $type == 'albums' && !$album_imgs_exists ) {
989
+ continue;
990
+ }
991
+ // Check if exists such keys in $next array
992
+ $object_id = array_key_exists('id', $next) ? $next['id'] : '';
993
+
994
+ $name = array_key_exists('name', $next) ? addcslashes($next['name'], '\\') : '';
995
+ $description = array_key_exists('description', $next) ? addcslashes($next['description'], '\\') : '';
996
+ // @todo v3.3 API
997
+ // $source = array_key_exists('source', $next) ? $next['source'] : '';
998
+ // $link = array_key_exists('link', $next) ? $next['link'] : '';
999
+ $status_type = array_key_exists('status_type', $next) ? $next['status_type'] : '';
1000
+ $message = array_key_exists('message', $next) ? addcslashes($next['message'], '\\') : '';
1001
+ $story = array_key_exists('story', $next) ? $next['story'] : '';
1002
+ $place = array_key_exists('place', $next) ? json_encode($next['place']) : '';
1003
+ $message_tags = array_key_exists('message_tags', $next) ? json_encode($next['message_tags']) : '';
1004
+ $with_tags = array_key_exists('with_tags', $next) ? json_encode($next['with_tags']) : '';
1005
+ $story_tags = array_key_exists('story_tags', $next) ? json_encode($next['story_tags']) : '';
1006
+ $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
1007
+ $comments = array_key_exists('comments', $next) ? json_encode($next['comments']) : '';
1008
+ $shares = array_key_exists('shares', $next) ? json_encode($next['shares']) : '';
1009
+ $attachments = array_key_exists('attachments', $next) ? json_encode($next['attachments']) : '';
1010
+ $from = array_key_exists('from', $next) ? $next['from']['id'] : '';
1011
+ $from_json = array_key_exists('from', $next) ? json_encode($next['from']) : '';
1012
+ $updated_time = array_key_exists('updated_time', $next) ? $next['updated_time'] : '';
1013
+ $created_time = array_key_exists('created_time', $next) ? $next['created_time'] : '';
1014
+ // When content is events some fields have different names, so check them.
1015
+ if ( $type == 'events' ) {
1016
+ $source = array_key_exists('cover', $next) ? $next['cover']['source'] : '';
1017
+ $main_url = $source;
1018
+ $thumb_url = $main_url;
1019
+ $from = array_key_exists('owner', $next) ? $next['owner']['id'] : '';
1020
+ $from_json = array_key_exists('owner', $next) ? json_encode($next['owner']) : '';
1021
+ // Store event end time in update_time field
1022
+ $updated_time = array_key_exists('end_time', $next) ? $next['end_time'] : '';
1023
+ $created_time = array_key_exists('start_time', $next) ? $next['start_time'] : '';
1024
+ }
1025
+ $created_time_number = ($created_time != '') ? strtotime($created_time) : 0;
1026
+ $format = array('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');
1027
+
1028
+
1029
+ $feed_data = array(
1030
+ 'fb_id' => self::$fb_id,
1031
+ 'object_id' => $object_id,
1032
+ 'from' => $from,
1033
+ 'name' => $name,
1034
+ 'description' => $description,
1035
+ 'type' => $type,
1036
+ 'message' => $message,
1037
+ 'story' => $story,
1038
+ 'place' => $place,
1039
+ 'message_tags' => $message_tags,
1040
+ 'with_tags' => $with_tags,
1041
+ 'story_tags' => $story_tags,
1042
+ 'status_type' => $status_type,
1043
+ 'link' => $link,
1044
+ 'source' => $source,
1045
+ 'thumb_url' => $thumb_url,
1046
+ 'main_url' => $main_url,
1047
+ 'width' => $width,
1048
+ 'height' => $height,
1049
+ 'created_time' => $created_time,
1050
+ 'updated_time' => $updated_time,
1051
+ 'created_time_number' => $created_time_number,
1052
+ 'comments' => $comments,
1053
+ 'shares' => $shares,
1054
+ 'attachments' => $attachments,
1055
+ 'who_post' => $from_json,
1056
+ 'reactions' => $reactions,
1057
+ );
1058
+
1059
+
1060
+ if ( !isset($ids[$object_id]) ) {
1061
+ $wpdb->insert($wpdb->prefix . 'wd_fb_data', $feed_data, $format);
1062
+ } else {
1063
+ $wpdb->update($wpdb->prefix . 'wd_fb_data', $feed_data, array( 'id' => $ids[$object_id] ), $format);
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
 
1069
+ public static function ffwd_event_data_sort( $a, $b ) {
1070
+ $date1 = strtotime($a['start_time']);
1071
+ $date2 = strtotime($b['start_time']);
1072
+ if ( $date1 == $date2 ) {
1073
+ return 0;
1074
  }
1075
 
1076
+ return ($date1 > $date2) ? -1 : 1;
1077
+ }
1078
 
1079
+ public static function filter_upcoming_events( $data ) {
1080
 
1081
+ foreach ( $data['data'] as $key => $event ) {
 
 
 
1082
 
1083
+ $event_start_time = strtotime($event['start_time']);
1084
+ $now = strtotime(date("Y-m-d H:i:s"));
1085
+ if ( $event_start_time < $now ) {
 
 
1086
 
1087
 
1088
+ unset($data['data'][$key]);
1089
+ }
1090
+ }
1091
 
1092
+ return $data;
1093
+ }
1094
 
1095
+ /**
1096
+ * Define timeline type only for not being null.
1097
+ * Set fields.
1098
+ * Chaek if content is photo or videos, so replace {other} => type=uploaded.
1099
+ * Replace params in graph url.
1100
+ * Check errors.
1101
+ */
1102
+ public static function specific() {
1103
+ // @TODO This is a PRO functionality.
1104
+ return;
1105
+ }
1106
 
1107
+ /**
1108
+ * Set timeline type.
1109
+ * Posts by owner (so edge is posts).
1110
+ * Posts by others (so edge is feed).
1111
+ * Posts by owner and others (so edge is feed (but data must be filtered by from atribute not equal to owner ID)).
1112
+ */
1113
+ public static function set_timeline_type() {
1114
+ if (self::$save || self::$edit_feed)
1115
+ self::$timeline_type = (isset($_POST['timeline_type']) && $_POST['timeline_type'] != '') ? sanitize_text_field(stripcslashes($_POST['timeline_type'])) : 'posts';
1116
 
1117
+ return;
1118
+ }
 
1119
 
1120
+ public static function save_db() {
1121
+ global $wpdb;
1122
+ $name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
1123
+ $name = str_replace(array("'", '"'), "" , $name);
1124
+ $page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
1125
+ $update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
1126
+ // Collapse content types (multiple when content type is timeline, one when specific)
1127
+ $content = implode(",", self::$content);
1128
+ $from = self::$id;
1129
+ $data = self::$data['data'];
1130
+ // If there is no data
1131
+ if ( ! count($data) ) {
1132
+ self::wd_fb_massage('error', 'There is no data matching your choice.');
1133
+ }
1134
 
1135
+ $ffwd_info_options = array();
1136
+ $ffwd_info_options['theme'] = ((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
1137
+ $ffwd_info_options['masonry_hor_ver'] = ((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
1138
+ $ffwd_info_options['image_max_columns'] = ((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
1139
+ $ffwd_info_options['thumb_width'] = ((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
1140
+ $ffwd_info_options['thumb_height'] = ((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
1141
+ $ffwd_info_options['thumb_comments'] = ((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
1142
+ $ffwd_info_options['thumb_likes'] = ((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
1143
+ $ffwd_info_options['thumb_name'] = ((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
1144
+ $ffwd_info_options['blog_style_width'] = ((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
1145
+ $ffwd_info_options['blog_style_height'] = ((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
1146
+ $ffwd_info_options['blog_style_view_type'] = ((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
1147
+ $ffwd_info_options['blog_style_comments'] = ((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
1148
+ $ffwd_info_options['blog_style_likes'] = ((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
1149
+ $ffwd_info_options['blog_style_message_desc'] = ((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
1150
+ $ffwd_info_options['blog_style_shares'] = ((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
1151
+ $ffwd_info_options['blog_style_shares_butt'] = ((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
1152
+ $ffwd_info_options['blog_style_facebook'] = ((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
1153
+ $ffwd_info_options['blog_style_twitter'] = ((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
1154
+ $ffwd_info_options['blog_style_google'] = '0';
1155
+ $ffwd_info_options['blog_style_author'] = ((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
1156
+ $ffwd_info_options['blog_style_name'] = ((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
1157
+ $ffwd_info_options['blog_style_place_name'] = ((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
1158
+ $ffwd_info_options['fb_name'] = ((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
1159
+ $ffwd_info_options['fb_plugin'] = ((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
1160
+ $ffwd_info_options['album_max_columns'] = ((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
1161
+ $ffwd_info_options['album_title'] = ((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
1162
+ $ffwd_info_options['album_thumb_width'] = ((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
1163
+ $ffwd_info_options['album_thumb_height'] = ((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
1164
+ $ffwd_info_options['album_image_max_columns'] = ((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
1165
+ $ffwd_info_options['album_image_thumb_width'] = ((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
1166
+ $ffwd_info_options['album_image_thumb_height'] = ((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
1167
+ $ffwd_info_options['pagination_type'] = ((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
1168
+ $ffwd_info_options['objects_per_page'] = ((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
1169
+ $ffwd_info_options['popup_fullscreen'] = ((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
1170
+ $ffwd_info_options['popup_height'] = ((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
1171
+ $ffwd_info_options['popup_width'] = ((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
1172
+ $ffwd_info_options['popup_effect'] = ((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
1173
+ $ffwd_info_options['popup_autoplay'] = ((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
1174
+ $ffwd_info_options['open_commentbox'] = ((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
1175
+ $ffwd_info_options['popup_interval'] = ((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
1176
+ $ffwd_info_options['popup_enable_filmstrip'] = ((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
1177
+ $ffwd_info_options['popup_filmstrip_height'] = ((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
1178
+ $ffwd_info_options['popup_comments'] = ((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
1179
+ $ffwd_info_options['popup_likes'] = ((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
1180
+ $ffwd_info_options['popup_shares'] = ((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
1181
+ $ffwd_info_options['popup_author'] = ((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
1182
+ $ffwd_info_options['popup_name'] = ((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
1183
+ $ffwd_info_options['popup_place_name'] = ((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
1184
+ $ffwd_info_options['popup_enable_ctrl_btn'] = ((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
1185
+ $ffwd_info_options['popup_enable_fullscreen'] = ((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
1186
+ $ffwd_info_options['popup_enable_info_btn'] = ((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
1187
+ $ffwd_info_options['popup_message_desc'] = ((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
1188
+ $ffwd_info_options['popup_enable_facebook'] = ((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
1189
+ $ffwd_info_options['popup_enable_twitter'] = ((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
1190
+ $ffwd_info_options['popup_enable_google'] = '0';
1191
+ $ffwd_info_options['fb_view_type'] = ((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
1192
+ $ffwd_info_options['image_onclick_action'] = ((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
1193
+
1194
+ $ffwd_options_db = array('view_on_fb', 'post_text_length', 'event_street', 'event_city', 'event_country', 'event_zip', 'event_map', 'event_date', 'event_desp_length', 'comments_replies', 'comments_filter', 'comments_order', 'page_plugin_pos', 'page_plugin_fans', 'page_plugin_cover', 'page_plugin_header', 'page_plugin_width', 'event_order', 'upcoming_events', 'fb_page_id');
1195
+
1196
+ foreach ( $ffwd_options_db as $ffwd_option_db ) {
1197
+ $ffwd_info_options[$ffwd_option_db] = ((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
1198
+ }
1199
 
1200
+ if (self::$fb_type == 'group') {
1201
+ self::$timeline_type = 'feed';
1202
+ }
1203
+ $save_fb_info = $wpdb->insert($wpdb->prefix . 'wd_fb_info', array(
1204
+ 'name' => $name,
1205
+ 'page_access_token' => $page_access_token,
1206
+ 'type' => self::$fb_type,
1207
+ 'content_type' => self::$content_type,
1208
+ 'content' => $content,
1209
+ 'content_url' => self::$content_url,
1210
+ 'timeline_type' => self::$timeline_type,
1211
+ 'from' => $from,
1212
+ 'limit' => self::$limit,
1213
+ 'app_id' => '',
1214
+ 'app_secret' => '',
1215
+ 'exist_access' => 1,
1216
+ 'access_token' => self::$access_token,
1217
+ 'order' => ((int)$wpdb->get_var('SELECT MAX(`order`) FROM ' . $wpdb->prefix . 'wd_fb_info')) + 1,
1218
+ 'published' => 1,
1219
+ 'update_mode' => $update_mode,
1220
+ 'theme' => $ffwd_info_options['theme'],
1221
+ 'masonry_hor_ver' => $ffwd_info_options['masonry_hor_ver'],
1222
+ 'image_max_columns' => $ffwd_info_options['image_max_columns'],
1223
+ 'thumb_width' => $ffwd_info_options['thumb_width'],
1224
+ 'thumb_height' => $ffwd_info_options['thumb_height'],
1225
+ 'thumb_comments' => $ffwd_info_options['thumb_comments'],
1226
+ 'thumb_likes' => $ffwd_info_options['thumb_likes'],
1227
+ 'thumb_name' => $ffwd_info_options['thumb_name'],
1228
+ 'blog_style_width' => $ffwd_info_options['blog_style_width'],
1229
+ 'blog_style_height' => $ffwd_info_options['blog_style_height'],
1230
+ 'blog_style_view_type' => $ffwd_info_options['blog_style_view_type'],
1231
+ 'blog_style_comments' => $ffwd_info_options['blog_style_comments'],
1232
+ 'blog_style_likes' => $ffwd_info_options['blog_style_likes'],
1233
+ 'blog_style_message_desc' => $ffwd_info_options['blog_style_message_desc'],
1234
+ 'blog_style_shares' => $ffwd_info_options['blog_style_shares'],
1235
+ 'blog_style_shares_butt' => $ffwd_info_options['blog_style_shares_butt'],
1236
+ 'blog_style_facebook' => $ffwd_info_options['blog_style_facebook'],
1237
+ 'blog_style_twitter' => $ffwd_info_options['blog_style_twitter'],
1238
+ 'blog_style_google' => $ffwd_info_options['blog_style_google'],
1239
+ 'blog_style_author' => $ffwd_info_options['blog_style_author'],
1240
+ 'blog_style_name' => $ffwd_info_options['blog_style_name'],
1241
+ 'blog_style_place_name' => $ffwd_info_options['blog_style_place_name'],
1242
+ 'fb_name' => $ffwd_info_options['fb_name'],
1243
+ 'fb_plugin' => $ffwd_info_options['fb_plugin'],
1244
+ 'album_max_columns' => $ffwd_info_options['album_max_columns'],
1245
+ 'album_title' => $ffwd_info_options['album_title'],
1246
+ 'album_thumb_width' => $ffwd_info_options['album_thumb_width'],
1247
+ 'album_thumb_height' => $ffwd_info_options['album_thumb_height'],
1248
+ 'album_image_max_columns' => $ffwd_info_options['album_image_max_columns'],
1249
+ 'album_image_thumb_width' => $ffwd_info_options['album_image_thumb_width'],
1250
+ 'album_image_thumb_height' => $ffwd_info_options['album_image_thumb_height'],
1251
+ 'pagination_type' => $ffwd_info_options['pagination_type'],
1252
+ 'objects_per_page' => $ffwd_info_options['objects_per_page'],
1253
+ 'popup_fullscreen' => $ffwd_info_options['popup_fullscreen'],
1254
+ 'popup_height' => $ffwd_info_options['popup_height'],
1255
+ 'popup_width' => $ffwd_info_options['popup_width'],
1256
+ 'popup_effect' => $ffwd_info_options['popup_effect'],
1257
+ 'popup_autoplay' => $ffwd_info_options['popup_autoplay'],
1258
+ 'open_commentbox' => $ffwd_info_options['open_commentbox'],
1259
+ 'popup_interval' => $ffwd_info_options['popup_interval'],
1260
+ 'popup_enable_filmstrip' => $ffwd_info_options['popup_enable_filmstrip'],
1261
+ 'popup_filmstrip_height' => $ffwd_info_options['popup_filmstrip_height'],
1262
+ 'popup_comments' => $ffwd_info_options['popup_comments'],
1263
+ 'popup_likes' => $ffwd_info_options['popup_likes'],
1264
+ 'popup_shares' => $ffwd_info_options['popup_shares'],
1265
+ 'popup_author' => $ffwd_info_options['popup_author'],
1266
+ 'popup_name' => $ffwd_info_options['popup_name'],
1267
+ 'popup_place_name' => $ffwd_info_options['popup_place_name'],
1268
+ 'popup_enable_ctrl_btn' => $ffwd_info_options['popup_enable_ctrl_btn'],
1269
+ 'popup_enable_fullscreen' => $ffwd_info_options['popup_enable_fullscreen'],
1270
+ 'popup_enable_info_btn' => $ffwd_info_options['popup_enable_info_btn'],
1271
+ 'popup_message_desc' => $ffwd_info_options['popup_message_desc'],
1272
+ 'popup_enable_facebook' => $ffwd_info_options['popup_enable_facebook'],
1273
+ 'popup_enable_twitter' => $ffwd_info_options['popup_enable_twitter'],
1274
+ 'popup_enable_google' => $ffwd_info_options['popup_enable_google'],
1275
+ 'fb_view_type' => $ffwd_info_options['fb_view_type'],
1276
+ 'view_on_fb' => $ffwd_info_options['view_on_fb'],
1277
+ 'post_text_length' => $ffwd_info_options['post_text_length'],
1278
+ 'event_street' => $ffwd_info_options['event_street'],
1279
+ 'event_city' => $ffwd_info_options['event_city'],
1280
+ 'event_country' => $ffwd_info_options['event_country'],
1281
+ 'event_zip' => $ffwd_info_options['event_zip'],
1282
+ 'event_map' => $ffwd_info_options['event_map'],
1283
+ 'event_date' => $ffwd_info_options['event_date'],
1284
+ 'event_desp_length' => $ffwd_info_options['event_desp_length'],
1285
+ 'comments_replies' => $ffwd_info_options['comments_replies'],
1286
+ 'comments_filter' => $ffwd_info_options['comments_filter'],
1287
+ 'comments_order' => $ffwd_info_options['comments_order'],
1288
+ 'page_plugin_pos' => $ffwd_info_options['page_plugin_pos'],
1289
+ 'page_plugin_fans' => $ffwd_info_options['page_plugin_fans'],
1290
+ 'page_plugin_cover' => $ffwd_info_options['page_plugin_cover'],
1291
+ 'page_plugin_header' => $ffwd_info_options['page_plugin_header'],
1292
+ 'page_plugin_width' => $ffwd_info_options['page_plugin_width'],
1293
+ 'image_onclick_action' => $ffwd_info_options['image_onclick_action'],
1294
+ 'event_order' => $ffwd_info_options['event_order'],
1295
+ 'upcoming_events' => $ffwd_info_options['upcoming_events'],
1296
+ 'fb_page_id' => $ffwd_info_options['fb_page_id'],
1297
+ ), array(
1298
+ '%s',//name
1299
+ '%s',//page_access_token
1300
+ '%s',//type
1301
+ '%s',//content_type
1302
+ '%s',//content
1303
+ '%s',//content_url
1304
+ '%s',//timeline_type
1305
+ '%s',//from
1306
+ '%d',//limit
1307
+ '%s',//app_id
1308
+ '%s',//app_secret
1309
+ '%d',//exist_access
1310
+ '%s',//access_token
1311
+ '%d',//order
1312
+ '%d',//published
1313
+ '%s',//update_mode
1314
+ ));
1315
+
1316
+ /**
1317
+ * Get last inserted id from wd_fb_info for table bellow.
1318
+ * Insert into type column the
1319
+ * first and only value of self::$content array.
1320
+ * Escape paging in self::data
1321
+ */
1322
+ self::$fb_id = $wpdb->insert_id;
1323
+ if ( $save_fb_info !== false ) {
1324
+ self::insert_wd_fb_data($data);
1325
+ self::insert_wd_fb_info_options($ffwd_info_options);
1326
+ }
1327
+ else {
1328
+ self::wd_fb_massage('error', 'Problem with save fb feed');
1329
+ }
1330
  }
 
 
 
 
 
 
 
 
 
 
1331
 
1332
+ /**
1333
+ * Insert data from facebook response to DataBase
1334
+ *
1335
+ * @param $data
1336
+ */
1337
+ public static function insert_wd_fb_data($data) {
1338
+ global $wpdb;
1339
+ $success = 'no_data';
1340
+ $content = implode(',', self::$content);
1341
+ if ( self::$content_type == 'specific' && self::$content[0] == 'events' ) {
1342
+ $start_time = array();
1343
+ foreach ($data as $key => $event) {
1344
+ if (isset($event['event_times'])) {
1345
+ $event_times = $event['event_times'];
1346
+ foreach ($event_times as $event_time) {
1347
+ $event['start_time'] = $event_time['start_time'];
1348
+ $event['end_time'] = $event_time['end_time'];
1349
+ $data[] = $event;
1350
+ unset($data[$key]);
1351
+ }
1352
+ }
1353
+ }
1354
+
1355
+ $added_events = 0;
1356
+ foreach ($data as $key => $event) {
1357
+ $start_time[$key] = $data['start_time'];
1358
+ }
1359
+ array_multisort($start_time, SORT_DESC, $data);
1360
+ }
1361
 
1362
+ foreach ( $data as $key => $next ) {
1363
+ $type = '';
1364
+ $source = '';
1365
+ $main_url = '';
1366
+ $thumb_url = '';
1367
+ $link = '';
1368
+ $width = '';
1369
+ $height = '';
1370
+ $attachments = (!empty($next['attachments']['data'][0])) ? $next['attachments']['data'][0] : array();
1371
+ if ( self::$content_type == 'timeline' && empty($attachments) ) {
1372
+ continue;
1373
+ }
1374
+ if ( !empty($attachments) ) {
1375
+ $type = $attachments['media_type'];
1376
+ // @todo API V10.0 Temporary solution for photos!
1377
+ if ( self::$content_type == 'specific' && self::$content[0] == 'photos' && $type != 'photo' ) {
1378
+ continue;
1379
+ }
1380
+ $link = !empty($attachments['url']) ? $attachments['url'] : '';
1381
+ if ( !empty($attachments['media']) ) {
1382
+ $media = $attachments['media'];
1383
+ $main_url = !empty($media['image']['src']) ? $media['image']['src'] : '';
1384
+ $thumb_url = !empty($media['image']['src']) ? $media['image']['src'] : '';
1385
+ $width = !empty($media['image']['width']) ? $media['image']['width'] : '';
1386
+ $height = !empty($media['image']['height']) ? $media['image']['height'] : '';
1387
  }
1388
+ }
1389
+ else if ( self::$content_type == 'specific' ) {
1390
+ $type = self::$content[0];
1391
+ }
1392
+
1393
+ /**
1394
+ * check if content_type is timeline dont save wd_fb_data if
1395
+ * $content string not contain $next['type']
1396
+ */
1397
+ if ( self::$content_type == 'specific' && self::$content[0] == 'events' ) {
1398
+ $added_events++;
1399
+ if ($added_events > self::$limit) {
1400
+ break;
1401
+ }
1402
+ }
1403
+ /* @TODO v3.3 API
1404
+ if ( self::$content_type == 'timeline' ) {
1405
+ if (strpos($content, $next['type']) === false){
1406
+ continue;
1407
+ }
1408
+ $type = $next['type'];
1409
+
1410
+ if (self::$timeline_type == 'others' && self::$id == $next['from']['id'] ) {
1411
+ continue;
1412
+ }
1413
+ }
1414
+ else {
1415
+ $type = self::$content[0];
1416
+ }
1417
+ */
1418
+
1419
+ // Use this var for check if album imgs count not 0
1420
+ $album_imgs_exists = true;
1421
+ switch ($type) {
1422
+ case 'photos': {
1423
+ /* @todo v3.3 API deprecated.
1424
+ // * If object type is photo(photos, video, videos,
1425
+ // * album, event cover photo etc ) so trying to
1426
+ // * check the count of resolution types
1427
+ // * and store source for thumb and main size
1428
+
1429
+ if ( array_key_exists('images', $next) ) {
1430
+ $images = count($next['images']);
1431
+ if ($images > 6 ) {
1432
+ $thumb_url = $next['images'][$images - 1]['source'];
1433
+ $main_url = $next['images'][0]['source'];
1434
+ } else {
1435
+ $thumb_url = $next['images'][0]['source'];
1436
+ $main_url = $next['images'][0]['source'];
1437
+ }
1438
+ $width = $next['images'][0]['width'];
1439
+ $height = $next['images'][0]['height'];
1440
+ }
1441
+ */
1442
+ break;
1443
+ }
1444
+ case 'videos': {
1445
+ $name = array_key_exists('title', $next) ? addcslashes($next['title'], '\\') : '';
1446
+ $link = array_key_exists('permalink_url', $next) ? 'https://www.facebook.com' . $next['permalink_url'] : '';
1447
+ if (array_key_exists('format', $next)) {
1448
+ $img_res_count = count($next['format']);
1449
+ if ($img_res_count > 2) {
1450
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
1451
+ $thumb_url = $next['format'][1]['picture'];
1452
+ } else {
1453
+ $thumb_url = $next['format'][$img_res_count - 1]['picture'];
1454
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
1455
+ }
1456
+ $width = $next['format'][$img_res_count - 1]['width'];
1457
+ $height = $next['format'][$img_res_count - 1]['height'];
1458
+ }
1459
+ break;
1460
+ }
1461
+ case 'albums': {
1462
+ if (array_key_exists('count', $next)) {
1463
+ $album_imgs_count = $next['count'];
1464
+ if ($album_imgs_count == 0) {
1465
+ $album_imgs_exists = false;
1466
+ }
1467
+ }
1468
+
1469
+ break;
1470
+ }
1471
+ // @todo V10.0 API
1472
+ case 'video': {
1473
+ $type ='videos';
1474
+ if ( !empty($attachments['media']['source']) ) {
1475
+ $source = $attachments['media']['source'];
1476
+ }
1477
+ /* @todo v3.3 API deprecated.
1478
+ if (array_key_exists('format', $next)) {
1479
+ $img_res_count = count($next['format']);
1480
+ if ($img_res_count > 2) {
1481
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
1482
+ $thumb_url = $next['format'][1]['picture'];
1483
+ } else {
1484
+ $thumb_url = $next['format'][$img_res_count - 1]['picture'];
1485
+ $main_url = $next['format'][$img_res_count - 1]['picture'];
1486
+ }
1487
+ $width = $next['format'][$img_res_count - 1]['width'];
1488
+ $height = $next['format'][$img_res_count - 1]['height'];
1489
+ }
1490
+ */
1491
+ break;
1492
+ }
1493
+ // @todo V10.0 API
1494
+ case 'album': {
1495
+ $type = 'albums';
1496
+ /* @todo v3.3 API deprecated.
1497
+ if (array_key_exists('count', $next)) {
1498
+ $album_imgs_count = $next['count'];
1499
+ if ($album_imgs_count == 0) {
1500
+ $album_imgs_exists = false;
1501
+ }
1502
+ }
1503
+ */
1504
+ break;
1505
+ }
1506
+ }
1507
+ // @todo In the case of 'albums' it works in JS version․
1508
+ if ( $type == 'albums' && !$album_imgs_exists ) {
1509
+ continue;
1510
+ }
1511
+ $name = array_key_exists('name', $next) ? addcslashes($next['name'], '\\') : '';
1512
+ // Check if exists such keys in $next array
1513
+ $object_id = array_key_exists('id', $next) ? $next['id'] : '';
1514
+ $description = array_key_exists('description', $next) ? addcslashes($next['description'], '\\') : '';
1515
+ // @todo v3.3 API
1516
+ // $link = array_key_exists('link', $next) ? $next['link'] : '';
1517
+ // $source = array_key_exists('source', $next) ? $next['source'] : '';
1518
+ $status_type = array_key_exists('status_type', $next) ? $next['status_type'] : '';
1519
+ $message = array_key_exists('message', $next) ? addcslashes($next['message'], '\\') : '';
1520
+ $story = array_key_exists('story', $next) ? $next['story'] : '';
1521
+ $place = array_key_exists('place', $next) ? json_encode($next['place']) : '';
1522
+ $message_tags = array_key_exists('message_tags', $next) ? json_encode($next['message_tags']) : '';
1523
+ $with_tags = array_key_exists('with_tags', $next) ? json_encode($next['with_tags']) : '';
1524
+ $story_tags = array_key_exists('story_tags', $next) ? json_encode($next['story_tags']) : '';
1525
+ $reactions = array_key_exists('reactions', $next) ? json_encode($next['reactions']) : '';
1526
+ $comments = array_key_exists('comments', $next) ? json_encode($next['comments']) : '';
1527
+ $shares = array_key_exists('shares', $next) ? json_encode($next['shares']) : '';
1528
+ $attachments = array_key_exists('attachments', $next) ? json_encode($next['attachments']) : '';
1529
+ $from = array_key_exists('from', $next) ? $next['from']['id'] : '';
1530
+ $from_json = array_key_exists('from', $next) ? json_encode($next['from']) : '';
1531
+ $created_time = array_key_exists('created_time', $next) ? $next['created_time'] : '';
1532
+ $updated_time = array_key_exists('updated_time', $next) ? $next['updated_time'] : '';
1533
+ // When content is events some fields have different names, so check them.
1534
+ if ($type == 'events') {
1535
+ $source = array_key_exists('cover', $next) ? $next['cover']['source'] : '';
1536
+ $main_url = $source;
1537
+ $thumb_url = $main_url;
1538
+ $from = array_key_exists('owner', $next) ? $next['owner']['id'] : '';
1539
+ $from_json = array_key_exists('owner', $next) ? json_encode($next['owner']) : '';
1540
+ // Store event end time in update_time field
1541
+ $created_time = array_key_exists('start_time', $next) ? $next['start_time'] : '';
1542
+ $updated_time = array_key_exists('end_time', $next) ? $next['end_time'] : '';
1543
+ }
1544
+ $created_time_number = ($created_time != '') ? strtotime($created_time) : 0;
1545
+ $insert_data = array(
1546
+ 'fb_id' => self::$fb_id,
1547
+ 'object_id' => $object_id,
1548
+ 'from' => $from,
1549
+ 'name' => $name,
1550
+ 'description' => $description,
1551
+ 'type' => $type,
1552
+ 'message' => $message,
1553
+ 'story' => $story,
1554
+ 'place' => $place,
1555
+ 'message_tags' => $message_tags,
1556
+ 'with_tags' => $with_tags,
1557
+ 'story_tags' => $story_tags,
1558
+ 'status_type' => $status_type,
1559
+ 'link' => $link,
1560
+ 'source' => $source,
1561
+ 'thumb_url' => $thumb_url,
1562
+ 'main_url' => $main_url,
1563
+ 'width' => $width,
1564
+ 'height' => $height,
1565
+ 'created_time' => $created_time,
1566
+ 'updated_time' => $updated_time,
1567
+ 'created_time_number' => $created_time_number,
1568
+ 'comments' => $comments,
1569
+ 'shares' => $shares,
1570
+ 'attachments' => $attachments,
1571
+ 'who_post' => $from_json,
1572
+ 'reactions' => $reactions
1573
+ );
1574
+ $save_fb_data = $wpdb->insert($wpdb->prefix . 'wd_fb_data',
1575
+ $insert_data,
1576
+ array('%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d','%s','%s','%s','%s','%s')
1577
+ );
1578
+ if ($save_fb_data !== false) {
1579
+ $success = 'success';
1580
+ }
1581
+ else {
1582
+ $success = 'error';
1583
+ break;
1584
  }
1585
  }
1586
+ if ($success == 'success') {
1587
+ if (self::$save || self::$edit_feed){
1588
+ self::wd_fb_massage('success', self::$fb_id);
1589
+ }
1590
+ }
1591
+ else if ($success == 'error' || $success == 'no_data' && (self::$save || self::$edit_feed)) {
1592
+ $message = ($success == 'error') ? 'Problem with save' : 'There is no data matching your choice.';
1593
+ self::wd_fb_massage('error', $message);
1594
+ }
1595
+ else {
1596
+ if (self::$save || self::$edit_feed){
1597
+ self::wd_fb_massage('error', 'Problem with save');
1598
+ }
1599
+ }
1600
+ }
1601
 
1602
+ /**
1603
+ * check if string is JSON
1604
+ *
1605
+ * @param $string
1606
+ *
1607
+ * @return bool
1608
+ */
1609
+ public static function isJson($string)
1610
+ {
1611
+ json_decode($string);
1612
 
1613
+ return (json_last_error() == JSON_ERROR_NONE);
1614
+ }
1615
 
1616
+ /*not used*/
1617
+ public static function check_app()
1618
+ {
1619
+ global $wpdb;
1620
 
1621
+ if (!class_exists('Facebook'))
1622
+ include WD_FFWD_DIR . "/framework/facebook-sdk/src/Facebook/autoload.php";
1623
+ $app_id = ((isset($_POST['app_id'])) ? sanitize_text_field(stripslashes($_POST['app_id'])) : '');
1624
+ $app_secret = ((isset($_POST['app_secret'])) ? sanitize_text_field(stripslashes($_POST['app_secret'])) : '');
1625
+ //prepare params for graph api call
1626
 
 
1627
 
1628
+ $fb_graph_url = str_replace(
1629
+ array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1630
+ array($app_id, '', 'access_token=' . self::$access_token . '&', 'fields=roles&', '', ''),
1631
+ self::$graph_url
1632
+ );
1633
 
1634
+ $data = self::decap_do_curl($fb_graph_url);
1635
 
1636
+ //check if exists app with such app_id and app_secret
1637
+ if (array_key_exists("id", $data) && array_key_exists("roles", $data)) {
1638
+ //create facebook object
1639
 
1640
+ self::$facebook_sdk = new Facebook\Facebook(array(
1641
+ 'app_id' => $app_id,
1642
+ 'app_secret' => $app_secret,
1643
+ ));
1644
 
1645
+ $response_url = 'https://graph.facebook.com/oauth/access_token?client_id=' . $app_id . '&client_secret=' . $app_secret . '&grant_type=client_credentials';
1646
+ $response = wp_remote_get($response_url);
1647
 
1648
+ $access_token = explode('=', $response['body']);
1649
+ $access_token = $access_token[1];
1650
+ //save app id and app secret
1651
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1652
+ 'app_id' => $app_id,
1653
+ 'app_secret' => $app_secret,
1654
+ 'access_token' => $access_token,
1655
+ ),
1656
+ array('id' => 1)
1657
+ );
1658
 
1659
+ //checked logged in user
1660
+ $helper = self::$facebook_sdk->getRedirectLoginHelper();
1661
 
1662
+ if ($helper) {
1663
+ $permissions = array('user_photos', 'user_videos', 'user_posts', 'user_events');
1664
+ $callback = admin_url() . 'admin.php?page=options_ffwd';
1665
 
1666
+ $app_link_url = $helper->getLoginUrl($callback, $permissions);
1667
+ $app_link_text = __('Log into Facebook with your app', 'bwg');
1668
+ self::wd_fb_massage('success', $app_link_url);
1669
+
1670
+ } else {
1671
+
1672
+ self::wd_fb_massage('success', admin_url() . 'admin.php?page=options_ffwd');
1673
+ }
1674
+ } //check if exist error
1675
+ else if (array_key_exists("error", $data)) {
1676
+ $save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
1677
+ 'access_token' => '',
1678
+ ),
1679
+ array('id' => 1)
1680
+ );
1681
+ if ($data['error']['code'] == 4){
1682
+ update_option('ffwd_limit_notice', 1);
1683
+ }
1684
+ self::wd_fb_massage('error', $data['error']['message']);
1685
+ } else {
1686
+ self::wd_fb_massage('error', 'Something went wrong');
1687
+ }
1688
  }
 
1689
 
1690
+ public static function dropp_objects()
1691
+ {
1692
+ global $wpdb;
1693
+ $dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? sanitize_text_field($_POST['ids']) : '';
1694
+ $yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
1695
+ echo $yes;
1696
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX )
1697
+ {
1698
+ die();
1699
+ }
1700
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1701
 
1702
  /**
1703
+ * Check if user logged in on Facebook
1704
+ * @return int
 
 
1705
  */
1706
+ public static function check_logged_in_user()
1707
+ {
1708
+ global $wpdb;
1709
+ if (!class_exists('Facebook'))
1710
+ include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
1711
+ $fb_option_data = self::get_fb_option_data();
1712
+ // Create facebook object
1713
+ self::$facebook_sdk = new Facebook(array(
1714
+ 'appId' => $fb_option_data->app_id,
1715
+ 'secret' => $fb_option_data->app_secret,
1716
+ ));
1717
+ // Checked logged in user
1718
+ $user = self::$facebook_sdk->getUser();
1719
+ if (!isset($_SESSION['facebook_access_token'])) {
1720
+ return 0;
1721
+ } else {
1722
+ return 1;
1723
+ }
1724
  }
 
 
1725
 
1726
+ /**
1727
+ * @param $mood
1728
+ * @param $massage
1729
+ */
1730
+ public static function wd_fb_massage($mood, $massage)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1731
  {
1732
+ if(self::$ffwd_fb_massage){
1733
+ echo json_encode(array($mood, $massage));
1734
+ self::$ffwd_fb_massage = false;
1735
 
1736
+ if ( is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX )
1737
+ {
1738
+ wp_die();
1739
+ }
1740
+ }else{
1741
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1742
  }
 
 
1743
  }
 
 
 
 
 
 
 
 
 
 
1744
 
1745
+ /**
1746
+ * Check if Facebook type is valid
1747
+ */
1748
+ public static function check_fb_type() {
1749
+ $fb_type = ((isset($_POST['fb_type'])) ? sanitize_text_field(stripslashes($_POST['fb_type'])) : '');
1750
+ self::$fb_type = in_array($fb_type, self::$fb_valid_types) ? $fb_type : false;
1751
+ if (self::$fb_type) {
1752
+ self::$fb_type();
1753
+ }
1754
+ else {
1755
+ self::wd_fb_massage('error', 'no such FB type');
 
 
 
 
 
 
 
1756
  }
1757
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1758
 
1759
+ /**
1760
+ * Get data from Facebook
1761
+ *
1762
+ * @param $uri
1763
+ *
1764
+ * @return mixed|null
1765
+ */
1766
+ public static function decap_do_curl( $uri = '' ) {
1767
+ $facebook_graph_results = NULL;
1768
+ $facebook_graph_url = $uri; // TODO: Add URL checking here, else error out
1769
+ $response = wp_remote_get($facebook_graph_url);
1770
+ if ( isset($response->errors) && isset($response->errors["http_request_failed"][0]) ) {
1771
+ self::wd_fb_massage('error', $response->errors["http_request_failed"][0]);
1772
+ }
1773
+ elseif ( is_array($response) && isset($response['body']) ) {
1774
+ $header = $response['headers']; // array of http header lines
1775
+ $facebook_graph_results = $response['body']; // use the content
1776
+ }
1777
+ $facebook_graph_results = json_decode($facebook_graph_results, TRUE);
1778
+ if ( !empty($facebook_graph_results) ) {
1779
+ if ( array_key_exists('error', $facebook_graph_results) ) {
1780
+ update_option('ffwd_token_error_flag', "1");
1781
+ if ( $facebook_graph_results['error']['code'] == 2 ) {
1782
+ return self::decap_do_curl($facebook_graph_url);
1783
+ }
1784
+ }
1785
+ else {
1786
+ update_option('ffwd_token_error_flag', "0");
1787
+ }
1788
+ }
1789
+ if ( isset($facebook_graph_results['error']) && count(self::$access_tokens) > 1 ) {
1790
+ if ( ($key = array_search(self::$access_token, self::$access_tokens)) !== FALSE ) {
1791
+ unset(self::$access_tokens[$key]);
1792
+ self::$access_token = NULL;
1793
+ }
1794
+ $rand_key = array_rand(self::$access_tokens);
1795
+ self::$access_token = self::$access_tokens[$rand_key];
1796
+ $parts = parse_url($uri);
1797
+ $queryParams = array();
1798
+ parse_str($parts['query'], $queryParams);
1799
+ $queryParams["access_token"] = self::$access_token;
1800
+ $queryString = http_build_query($queryParams);
1801
+ $url = "https://graph.facebook.com" . $parts['path'] . '?' . $queryString;
1802
+
1803
+ return self::decap_do_curl($url);
1804
  }
 
 
 
 
 
 
 
1805
 
1806
+ return $facebook_graph_results;
 
 
1807
  }
1808
+
1809
+ public static function update_page_access_token($old_access_token, $page_id = ''){
1810
+ $redirect_uri = 'https://api.web-dorado.com/fb/';
1811
+ $admin_url = urlencode(admin_url('admin.php?page=options_ffwd'));
1812
+ $state = array(
1813
+ 'wp_site_url' => $admin_url
1814
+ );
1815
+ $base_url = add_query_arg(array(
 
1816
  'action' => 'ff_wd_exchange_token',
1817
  'ff_wd_user_token' => $old_access_token,
1818
  'scope' => 'manage_pages',
1819
  'code' => '200',
1820
  ), $redirect_uri);
1821
 
1822
+ $base_url .= '&state=' . base64_encode(json_encode($state));
1823
+ $response = wp_remote_post($base_url);
1824
 
1825
+ if(!is_wp_error( $response ) && isset($response["body"])) {
1826
+ $ffwd_user_access_token = json_decode($response["body"], TRUE);
1827
 
1828
+ if ( isset($ffwd_user_access_token["access_token"]) ) {
1829
+ $ffwd_user_access_token = sanitize_text_field($ffwd_user_access_token["access_token"]);
1830
+ $datas = get_option('ffwd_pages_list');
1831
+ foreach ( $datas as $data ) {
1832
+ if( $data->id == $page_id ) {
1833
+ $data->access_token = $ffwd_user_access_token;
1834
+ }
1835
  }
 
1836
 
1837
 
1838
+ update_option('ffwd_pages_list', $datas);
1839
+ update_option("ffwd_pages_list_success", "1");
1840
+ update_option('ffwd_token_error_flag', "0");
1841
+ self::update_access_tokens();
1842
 
1843
+ }
1844
  }
1845
  }
1846
+
1847
+ public static function get_autoupdate_interval()
1848
+ {
1849
+ global $wpdb;
1850
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
1851
+ if (!isset($row)) {
1852
+ return 30;
1853
+ }
1854
+ if (!isset($row->autoupdate_interval)) {
1855
+ return 30;
1856
+ }
1857
+ $autoupdate_interval = $row->autoupdate_interval;
1858
+
1859
+ return $autoupdate_interval;
1860
  }
 
 
 
1861
 
1862
  public static function get_auth_url(){
1863
  $app_id = '457830911380339';
1864
  $redirect_uri = 'https://api.web-dorado.com/fb/';
 
1865
  $admin_url = urlencode(admin_url('admin.php?page=options_ffwd'));
1866
 
1867
  $state = array(
1871
  $fb_url = add_query_arg(array(
1872
  'client_id' => $app_id,
1873
  'redirect_uri' => $redirect_uri,
1874
+ 'scope' => '',
1875
  ), "https://www.facebook.com/dialog/oauth");
1876
 
1877
  $fb_url .= '&state=' . base64_encode(json_encode($state));
1887
 
1888
  $pages = json_decode($response['body']);
1889
  update_option('ffwd_pages_list', $pages->data);
1890
+ update_option("ffwd_pages_list_success", "1");
1891
  update_option('ffwd_token_error_flag', "0");
1892
+
1893
  self::update_access_tokens();
1894
  return true;
1895
  }
1909
  }
1910
 
1911
  }
1912
+ }
 
 
 
 
 
 
 
framework/WDW_FFWD_Library.php CHANGED
@@ -1,26 +1,10 @@
1
  <?php
2
 
3
  class WDW_FFWD_Library {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- ////////////////////////////////////////////////////////////////////////////////////////
22
- // Getters & Setters //
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
  public static function get($key, $default_value = '') {
25
  if (isset($_GET[$key])) {
26
  $value = sanitize_text_field($_GET[$key]);
@@ -297,7 +281,7 @@ class WDW_FFWD_Library {
297
  </span>
298
  </div>
299
  <?php if (!$pager) { ?>
300
- <input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) sanitize_text_field($_POST['page_number']) : 1); ?>" />
301
  <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
302
  <?php
303
  }
@@ -447,7 +431,7 @@ class WDW_FFWD_Library {
447
  </span>
448
  </div>
449
  <?php if (!$pager) { ?>
450
- <input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) sanitize_text_field($_POST['page_number']) : 1); ?>" />
451
  <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
452
  <?php
453
  }
@@ -563,7 +547,7 @@ class WDW_FFWD_Library {
563
  }
564
  }
565
  ?>
566
- <input type="hidden" id="page_number_<?php echo $current_view; ?>" name="page_number_<?php echo $current_view; ?>" value="<?php echo ((isset($_POST['page_number_' . $current_view])) ? (int) sanitize_text_field($_POST['page_number_' . $current_view]) : 1); ?>" />
567
  <script type="text/javascript">
568
  function spider_page_<?php echo $current_view; ?>(cur, x, y, load_more) {
569
  if (typeof load_more == "undefined") {
@@ -626,138 +610,6 @@ class WDW_FFWD_Library {
626
  <?php
627
  }
628
 
629
-
630
- public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
631
- $bwg_search = ((isset($_POST['bwg_search_' . $current_view]) && sanitize_text_field($_POST['bwg_search_' . $current_view]) != '') ? sanitize_text_field($_POST['bwg_search_' . $current_view]) : '');
632
- $type = (isset($_POST['type_' . $current_view]) ? sanitize_text_field($_POST['type_' . $current_view]) : 'album');
633
- $album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ? sanitize_text_field($_POST['album_gallery_id_' . $current_view]) : 0);
634
- ?>
635
- <style>
636
- .bwg_search_container_1 {
637
- display: inline-block;
638
- width: 100%;
639
- text-align: right;
640
- margin: 0 5px 20px 5px;
641
- background-color: rgba(0,0,0,0);
642
- }
643
- .bwg_search_container_2 {
644
- display: inline-block;
645
- position: relative;
646
- border-radius: 4px;
647
- box-shadow: 0 0 3px 1px #CCCCCC;
648
- background-color: #FFFFFF;
649
- border: 1px solid #CCCCCC;
650
- width: <?php echo $search_box_width; ?>px;
651
- max-width: 100%;
652
- }
653
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search_input_container {
654
- display: block;
655
- margin-right: 45px;
656
- }
657
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search_loupe_container {
658
- display: inline-block;
659
- margin-right: 1px;
660
- vertical-align: middle;
661
- float: right;
662
- padding-top: 3px;
663
- }
664
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search_reset_container {
665
- display: inline-block;
666
- margin-right: 5px;
667
- vertical-align: middle;
668
- float: right;
669
- padding-top: 3px;
670
- }
671
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search,
672
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_reset {
673
- font-size: 18px;
674
- color: #CCCCCC;
675
- cursor: pointer;
676
- }
677
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search_input_<?php echo $current_view; ?>,
678
- #bwg_search_container_1_<?php echo $current_view; ?> #bwg_search_container_2_<?php echo $current_view; ?> .bwg_search_input_<?php echo $current_view; ?>:focus {
679
- color: hsl(0, 1%, 3%);
680
- outline: none;
681
- border: none;
682
- box-shadow: none;
683
- background: none;
684
- padding: 0 5px;
685
- font-family: inherit;
686
- width: 100%;
687
- }
688
- </style>
689
- <script type="text/javascript">
690
- function clear_input_<?php echo $current_view; ?> (current_view) {
691
- jQuery("#bwg_search_input_" + current_view).val('');
692
- }
693
- function check_enter_key(e) {
694
- var key_code = e.which || e.keyCode;
695
- if (key_code == 13) {
696
- ffwd_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $cur_gal_id; ?>', <?php echo $album_gallery_id; ?>, '', '<?php echo $type; ?>', 1);
697
- return false;
698
- }
699
- return true;
700
- }
701
- </script>
702
- <div class="bwg_search_container_1" id="bwg_search_container_1_<?php echo $current_view; ?>">
703
- <div class="bwg_search_container_2" id="bwg_search_container_2_<?php echo $current_view; ?>">
704
- <span class="bwg_search_reset_container" >
705
- <i title="<?php echo __('Reset', 'bwg'); ?>" class="bwg_reset ffwd ffwd-times" onclick="clear_input_<?php echo $current_view; ?>('<?php echo $current_view; ?>'),ffwd_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $cur_gal_id; ?>', <?php echo $album_gallery_id; ?>, '', '<?php echo $type; ?>', 1)"></i>
706
- </span>
707
- <span class="bwg_search_loupe_container" >
708
- <i title="<?php echo __('Search', 'bwg'); ?>" class="bwg_search ffwd ffwd-search" onclick="ffwd_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $cur_gal_id; ?>', <?php echo $album_gallery_id; ?>, '', '<?php echo $type; ?>', 1)"></i>
709
- </span>
710
- <span class="bwg_search_input_container">
711
- <input id="bwg_search_input_<?php echo $current_view; ?>" class="bwg_search_input_<?php echo $current_view; ?>" type="text" onkeypress="return check_enter_key(event)" name="bwg_search_<?php echo $current_view; ?>" value="<?php echo $bwg_search; ?>" >
712
- <input id="bwg_images_count_<?php echo $current_view; ?>" class="bwg_search_input" type="hidden" name="bwg_images_count_<?php echo $current_view; ?>" value="<?php echo $images_count; ?>" >
713
- </span>
714
- </div>
715
- </div>
716
- <?php
717
- }
718
-
719
- public static function ajax_html_frontend_sort_box($form_id, $current_view, $cur_gal_id, $sort_by = '', $search_box_width = 180) {
720
- $bwg_search = ((isset($_POST['bwg_search_' . $current_view]) && sanitize_text_field($_POST['bwg_search_' . $current_view]) != '') ? sanitize_text_field($_POST['bwg_search_' . $current_view]) : '');
721
- $type = (isset($_POST['type_' . $current_view]) ? sanitize_text_field($_POST['type_' . $current_view]) : 'album');
722
- $album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ? sanitize_text_field($_POST['album_gallery_id_' . $current_view]) : 0);
723
- ?>
724
- <style>
725
- .bwg_order_cont_<?php echo $current_view; ?> {
726
- background-color: rgba(0,0,0,0);
727
- display: block;
728
- margin: 0 5px 20px 5px;
729
- text-align: right;
730
- width: 100%;
731
- }
732
- .bwg_order_label_<?php echo $current_view; ?> {
733
- border: none;
734
- box-shadow: none;
735
- color: #BBBBBB;
736
- font-family: inherit;
737
- font-weight: bold;
738
- outline: none;
739
- }
740
- .bwg_order_<?php echo $current_view; ?> {
741
- background-color: #FFFFFF;
742
- border: 1px solid #CCCCCC;
743
- box-shadow: 0 0 3px 1px #CCCCCC;
744
- border-radius: 4px;
745
- max-width: 100%;
746
- width: <?php echo $search_box_width; ?>px;
747
- }
748
- </style>
749
- <div class="bwg_order_cont_<?php echo $current_view; ?>">
750
- <span class="bwg_order_label_<?php echo $current_view; ?>"><?php echo __('Order by: ', 'bwg'); ?></span>
751
- <select class="bwg_order_<?php echo $current_view; ?>" onchange="ffwd_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $cur_gal_id; ?>', <?php echo $album_gallery_id; ?>, '', '<?php echo $type; ?>', 1, '', this.value)">
752
- <option <?php if ($sort_by == 'default') echo 'selected'; ?> value="default"><?php echo __('Default', 'bwg'); ?></option>
753
- <option <?php if ($sort_by == 'filename') echo 'selected'; ?> value="filename"><?php echo __('Filename', 'bwg'); ?></option>
754
- <option <?php if ($sort_by == 'size') echo 'selected'; ?> value="size"><?php echo __('Size', 'bwg'); ?></option>
755
- <option <?php if ($sort_by == 'RAND()') echo 'selected'; ?> value="random"><?php echo __('Random', 'bwg'); ?></option>
756
- </select>
757
- </div>
758
- <?php
759
- }
760
-
761
  public static function spider_hex2rgb($colour) {
762
  if ($colour[0] == '#') {
763
  $colour = substr( $colour, 1 );
@@ -802,10 +654,10 @@ class WDW_FFWD_Library {
802
 
803
  public static function verify_nonce($page){
804
  $nonce_verified = false;
805
- if ( isset( $_GET['ffwd_nonce'] ) && wp_verify_nonce( sanitize_text_field($_GET['ffwd_nonce']), $page )) {
806
  $nonce_verified = true;
807
  }
808
- elseif ( isset( $_POST['ffwd_nonce'] ) && wp_verify_nonce( sanitize_text_field($_POST['ffwd_nonce']), $page )) {
809
  $nonce_verified = true;
810
  }
811
  return $nonce_verified;
@@ -814,7 +666,7 @@ class WDW_FFWD_Library {
814
  public static function filter_params($params) {
815
  global $wpdb;
816
  $fb_id = isset($params['fb_id']) ? $params['fb_id'] : 0;
817
- $from = (isset($params['from']) ? sanitize_text_field($params['from']) : 0);
818
  $ffwd_info = $wpdb->get_row($wpdb->prepare("SELECT content_type,content FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $fb_id));
819
  if($ffwd_info)
820
  switch($ffwd_info->content_type) {
@@ -949,27 +801,6 @@ class WDW_FFWD_Library {
949
  $default_params_array=array($params);
950
  return shortcode_atts($default_params_array, $params);
951
  }
952
- public static function validate_string($key , $default){
953
- if (isset($_GET[$key])) {
954
- $data = $_GET[$key];
955
- }
956
- elseif (isset($_POST[$key])) {
957
- $data = $_POST[$key];
958
- }
959
- elseif (isset($_REQUEST[$key])) {
960
- $data = $_REQUEST[$key];
961
- }
962
- else {
963
- $data = $default;
964
- }
965
- if(is_array($data)){
966
- $arr_data = array_map('sanitize_text_field', $data );
967
- return $arr_data;
968
- }
969
- $return_data = sanitize_text_field($data);
970
- return $return_data;
971
- }
972
-
973
 
974
  /**
975
  * Generate top bar.
@@ -979,36 +810,33 @@ class WDW_FFWD_Library {
979
  public static function topbar() {
980
  $page = isset($_GET['page']) ? esc_html($_GET['page']) : '';
981
  $user_guide_link = 'https://help.10web.io/hc/en-us/articles/';
982
- $show_guide_link = true;
983
  $description = '';
984
  switch ( $page ) {
985
  case 'info_ffwd':
986
- {
987
- $user_guide_link .= '360017959512-Getting-Facebook-Access-Token';
988
- $description .= __('This section allows you to create, edit and delete Facebook Feed by 10Web.', WD_FB_PREFIX);
989
- break;
990
- }
991
  case 'options_ffwd':
992
- {
993
- $user_guide_link .= '360017960312-Other-Settings';
994
- $description .= __('This section allows you to change settings for different views and general options.', WD_FB_PREFIX);
995
-
996
- break;
997
- }
998
  case 'themes_ffwd':
999
- {
1000
- $user_guide_link .= '360017960352--Facebook-Feed-Themes';
1001
- $description .= __('This section allows you to add/edit theme.', WD_FB_PREFIX);
1002
-
1003
- break;
1004
- }
1005
  default:
1006
- {
1007
- return '';
1008
- break;
1009
- }
1010
  }
1011
-
1012
  $support_forum_link = 'https://wordpress.org/support/plugin/wd-facebook-feed/#new-post';
1013
  $premium_link = 'https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&amp;utm_medium=free_plugin';
1014
  wp_enqueue_style('ffwd_roboto');
@@ -1031,7 +859,8 @@ class WDW_FFWD_Library {
1031
  </div>
1032
  </div>
1033
  <div class="topbar-content-button-container">
1034
- <a href="<?php echo $premium_link; ?>" target="_blank" class="topbar-upgrade-button"><?php _e( 'Upgrade', WD_FB_PREFIX ); ?></a>
 
1035
  </div>
1036
  </div>
1037
  <?php
@@ -1052,13 +881,13 @@ class WDW_FFWD_Library {
1052
  </div>
1053
  <?php
1054
  }
1055
- if (WD_FB_IS_FREE) {
1056
  ?>
1057
  <div class="topbar topbar-links topbar_support_forum">
1058
  <div class="topbar-links-container">
1059
  <a href="<?php echo $support_forum_link; ?>" target="_blank" class="topbar_support_forum">
1060
  <div class="topbar-links-item">
1061
- <img src="<?php echo WD_FFWD_URL . '/css/images/help.svg'; ?>" class="help_icon" />
1062
  <?php _e('Ask a question', WD_FB_PREFIX); ?>
1063
  </div>
1064
  </a>
1
  <?php
2
 
3
  class WDW_FFWD_Library {
4
+
 
 
 
 
 
 
 
 
 
 
 
5
  public function __construct() {
6
  }
7
+
 
 
 
 
 
8
  public static function get($key, $default_value = '') {
9
  if (isset($_GET[$key])) {
10
  $value = sanitize_text_field($_GET[$key]);
281
  </span>
282
  </div>
283
  <?php if (!$pager) { ?>
284
+ <input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
285
  <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
286
  <?php
287
  }
431
  </span>
432
  </div>
433
  <?php if (!$pager) { ?>
434
+ <input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
435
  <input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
436
  <?php
437
  }
547
  }
548
  }
549
  ?>
550
+ <input type="hidden" id="page_number_<?php echo $current_view; ?>" name="page_number_<?php echo $current_view; ?>" value="<?php echo ((isset($_POST['page_number_' . $current_view])) ? (int) $_POST['page_number_' . $current_view] : 1); ?>" />
551
  <script type="text/javascript">
552
  function spider_page_<?php echo $current_view; ?>(cur, x, y, load_more) {
553
  if (typeof load_more == "undefined") {
610
  <?php
611
  }
612
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
  public static function spider_hex2rgb($colour) {
614
  if ($colour[0] == '#') {
615
  $colour = substr( $colour, 1 );
654
 
655
  public static function verify_nonce($page){
656
  $nonce_verified = false;
657
+ if ( isset( $_GET['ffwd_nonce'] ) && wp_verify_nonce( $_GET['ffwd_nonce'], $page )) {
658
  $nonce_verified = true;
659
  }
660
+ elseif ( isset( $_POST['ffwd_nonce'] ) && wp_verify_nonce( $_POST['ffwd_nonce'], $page )) {
661
  $nonce_verified = true;
662
  }
663
  return $nonce_verified;
666
  public static function filter_params($params) {
667
  global $wpdb;
668
  $fb_id = isset($params['fb_id']) ? $params['fb_id'] : 0;
669
+ $from = (isset($params['from']) ? esc_html($params['from']) : 0);
670
  $ffwd_info = $wpdb->get_row($wpdb->prepare("SELECT content_type,content FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $fb_id));
671
  if($ffwd_info)
672
  switch($ffwd_info->content_type) {
801
  $default_params_array=array($params);
802
  return shortcode_atts($default_params_array, $params);
803
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
 
805
  /**
806
  * Generate top bar.
810
  public static function topbar() {
811
  $page = isset($_GET['page']) ? esc_html($_GET['page']) : '';
812
  $user_guide_link = 'https://help.10web.io/hc/en-us/articles/';
813
+ $show_guide_link = TRUE;
814
  $description = '';
815
  switch ( $page ) {
816
  case 'info_ffwd':
817
+ {
818
+ $user_guide_link .= '360017959512-Getting-Facebook-Access-Token';
819
+ $description .= __('This section allows you to create, edit and delete Facebook Feed by 10Web.', WD_FB_PREFIX);
820
+ break;
821
+ }
822
  case 'options_ffwd':
823
+ {
824
+ $user_guide_link .= '360017960312-Other-Settings';
825
+ $description .= __('This section allows you to change settings for different views and general options.', WD_FB_PREFIX);
826
+ break;
827
+ }
 
828
  case 'themes_ffwd':
829
+ {
830
+ $user_guide_link .= '360017960352--Facebook-Feed-Themes';
831
+ $description .= __('This section allows you to add/edit theme.', WD_FB_PREFIX);
832
+ break;
833
+ }
 
834
  default:
835
+ {
836
+ return '';
837
+ break;
838
+ }
839
  }
 
840
  $support_forum_link = 'https://wordpress.org/support/plugin/wd-facebook-feed/#new-post';
841
  $premium_link = 'https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&amp;utm_medium=free_plugin';
842
  wp_enqueue_style('ffwd_roboto');
859
  </div>
860
  </div>
861
  <div class="topbar-content-button-container">
862
+ <a href="<?php echo $premium_link; ?>" target="_blank"
863
+ class="topbar-upgrade-button"><?php _e('Upgrade', WD_FB_PREFIX); ?></a>
864
  </div>
865
  </div>
866
  <?php
881
  </div>
882
  <?php
883
  }
884
+ if ( WD_FB_IS_FREE ) {
885
  ?>
886
  <div class="topbar topbar-links topbar_support_forum">
887
  <div class="topbar-links-container">
888
  <a href="<?php echo $support_forum_link; ?>" target="_blank" class="topbar_support_forum">
889
  <div class="topbar-links-item">
890
+ <img src="<?php echo WD_FFWD_URL . '/css/images/help.svg'; ?>" class="help_icon"/>
891
  <?php _e('Ask a question', WD_FB_PREFIX); ?>
892
  </div>
893
  </a>
framework/facebook-sdk/base_facebook.php CHANGED
@@ -135,6 +135,8 @@ abstract class BaseFacebook
135
  CURLOPT_RETURNTRANSFER => true,
136
  CURLOPT_TIMEOUT => 60,
137
  CURLOPT_USERAGENT => 'facebook-php-3.2',
 
 
138
  );
139
 
140
  /**
@@ -488,7 +490,7 @@ abstract class BaseFacebook
488
  */
489
  public function getSignedRequest() {
490
  if (!$this->signedRequest) {
491
- if (isset($_REQUEST['signed_request']) && !empty($_REQUEST['signed_request'])) {
492
  $this->signedRequest = $this->parseSignedRequest(
493
  $_REQUEST['signed_request']);
494
  } else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
@@ -687,24 +689,26 @@ abstract class BaseFacebook
687
  * @return mixed The authorization code, or false if the authorization
688
  * code could not be determined.
689
  */
690
- protected function getCode() {
691
- if (isset($_REQUEST['code'])) {
692
- if ($this->state !== null &&
693
- isset($_REQUEST['state']) &&
694
- $this->state === $_REQUEST['state']) {
695
-
696
- // CSRF state has done its job, so clear it
697
- $this->state = null;
698
- $this->clearPersistentData('state');
699
- return $_REQUEST['code'];
700
- } else {
701
- self::errorLog('CSRF state token does not match one provided.');
702
- return false;
703
- }
704
- }
705
-
706
- return false;
707
- }
 
 
708
 
709
  /**
710
  * Retrieves the UID with the understanding that
135
  CURLOPT_RETURNTRANSFER => true,
136
  CURLOPT_TIMEOUT => 60,
137
  CURLOPT_USERAGENT => 'facebook-php-3.2',
138
+ CURLOPT_SSL_VERIFYPEER => false,
139
+ CURLOPT_SSL_VERIFYHOST => 2
140
  );
141
 
142
  /**
490
  */
491
  public function getSignedRequest() {
492
  if (!$this->signedRequest) {
493
+ if (!empty($_REQUEST['signed_request'])) {
494
  $this->signedRequest = $this->parseSignedRequest(
495
  $_REQUEST['signed_request']);
496
  } else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
689
  * @return mixed The authorization code, or false if the authorization
690
  * code could not be determined.
691
  */
692
+ protected function getCode() {
693
+ $server_info = array_merge($_POST, $_GET, $_COOKIE);
694
+
695
+ if (isset($server_info['code'])) {
696
+ if ($this->state !== null &&
697
+ isset($server_info['state']) &&
698
+ $this->state === $server_info['state']) {
699
+
700
+ // CSRF state has done its job, so clear it
701
+ $this->state = null;
702
+ $this->clearPersistentData('state');
703
+ return $server_info['code'];
704
+ } else {
705
+ self::errorLog('CSRF state token does not match one provided.');
706
+ return false;
707
+ }
708
+ }
709
+
710
+ return false;
711
+ }
712
 
713
  /**
714
  * Retrieves the UID with the understanding that
framework/facebook-sdk/src/Facebook/Authentication/AccessToken.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Authentication;
25
+
26
+ /**
27
+ * Class AccessToken
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class AccessToken
32
+ {
33
+ /**
34
+ * The access token value.
35
+ *
36
+ * @var string
37
+ */
38
+ protected $value = '';
39
+
40
+ /**
41
+ * Date when token expires.
42
+ *
43
+ * @var \DateTime|null
44
+ */
45
+ protected $expiresAt;
46
+
47
+ /**
48
+ * Create a new access token entity.
49
+ *
50
+ * @param string $accessToken
51
+ * @param int $expiresAt
52
+ */
53
+ public function __construct($accessToken, $expiresAt = 0)
54
+ {
55
+ $this->value = $accessToken;
56
+ if ($expiresAt) {
57
+ $this->setExpiresAtFromTimeStamp($expiresAt);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Generate an app secret proof to sign a request to Graph.
63
+ *
64
+ * @param string $appSecret The app secret.
65
+ *
66
+ * @return string
67
+ */
68
+ public function getAppSecretProof($appSecret)
69
+ {
70
+ return hash_hmac('sha256', $this->value, $appSecret);
71
+ }
72
+
73
+ /**
74
+ * Getter for expiresAt.
75
+ *
76
+ * @return \DateTime|null
77
+ */
78
+ public function getExpiresAt()
79
+ {
80
+ return $this->expiresAt;
81
+ }
82
+
83
+ /**
84
+ * Determines whether or not this is an app access token.
85
+ *
86
+ * @return bool
87
+ */
88
+ public function isAppAccessToken()
89
+ {
90
+ return strpos($this->value, '|') !== false;
91
+ }
92
+
93
+ /**
94
+ * Determines whether or not this is a long-lived token.
95
+ *
96
+ * @return bool
97
+ */
98
+ public function isLongLived()
99
+ {
100
+ if ($this->expiresAt) {
101
+ return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
102
+ }
103
+
104
+ if ($this->isAppAccessToken()) {
105
+ return true;
106
+ }
107
+
108
+ return false;
109
+ }
110
+
111
+ /**
112
+ * Checks the expiration of the access token.
113
+ *
114
+ * @return boolean|null
115
+ */
116
+ public function isExpired()
117
+ {
118
+ if ($this->getExpiresAt() instanceof \DateTime) {
119
+ return $this->getExpiresAt()->getTimestamp() < time();
120
+ }
121
+
122
+ if ($this->isAppAccessToken()) {
123
+ return false;
124
+ }
125
+
126
+ return null;
127
+ }
128
+
129
+ /**
130
+ * Returns the access token as a string.
131
+ *
132
+ * @return string
133
+ */
134
+ public function getValue()
135
+ {
136
+ return $this->value;
137
+ }
138
+
139
+ /**
140
+ * Returns the access token as a string.
141
+ *
142
+ * @return string
143
+ */
144
+ public function __toString()
145
+ {
146
+ return $this->getValue();
147
+ }
148
+
149
+ /**
150
+ * Setter for expires_at.
151
+ *
152
+ * @param int $timeStamp
153
+ */
154
+ protected function setExpiresAtFromTimeStamp($timeStamp)
155
+ {
156
+ $dt = new \DateTime();
157
+ $dt->setTimestamp($timeStamp);
158
+ $this->expiresAt = $dt;
159
+ }
160
+ }
framework/facebook-sdk/src/Facebook/Authentication/AccessTokenMetadata.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Authentication;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ /**
29
+ * Class AccessTokenMetadata
30
+ *
31
+ * Represents metadata from an access token.
32
+ *
33
+ * @package Facebook
34
+ * @see https://developers.facebook.com/docs/graph-api/reference/debug_token
35
+ */
36
+ class AccessTokenMetadata
37
+ {
38
+ /**
39
+ * The access token metadata.
40
+ *
41
+ * @var array
42
+ */
43
+ protected $metadata = [];
44
+
45
+ /**
46
+ * Properties that should be cast as DateTime objects.
47
+ *
48
+ * @var array
49
+ */
50
+ protected static $dateProperties = ['expires_at', 'issued_at'];
51
+
52
+ /**
53
+ * @param array $metadata
54
+ *
55
+ * @throws FacebookSDKException
56
+ */
57
+ public function __construct(array $metadata)
58
+ {
59
+ if (!isset($metadata['data'])) {
60
+ throw new FacebookSDKException('Unexpected debug token response data.', 401);
61
+ }
62
+
63
+ $this->metadata = $metadata['data'];
64
+
65
+ $this->castTimestampsToDateTime();
66
+ }
67
+
68
+ /**
69
+ * Returns a value from the metadata.
70
+ *
71
+ * @param string $field The property to retrieve.
72
+ * @param mixed $default The default to return if the property doesn't exist.
73
+ *
74
+ * @return mixed
75
+ */
76
+ public function getField($field, $default = null)
77
+ {
78
+ if (isset($this->metadata[$field])) {
79
+ return $this->metadata[$field];
80
+ }
81
+
82
+ return $default;
83
+ }
84
+
85
+ /**
86
+ * Returns a value from the metadata.
87
+ *
88
+ * @param string $field The property to retrieve.
89
+ * @param mixed $default The default to return if the property doesn't exist.
90
+ *
91
+ * @return mixed
92
+ *
93
+ * @deprecated 5.0.0 getProperty() has been renamed to getField()
94
+ * @todo v6: Remove this method
95
+ */
96
+ public function getProperty($field, $default = null)
97
+ {
98
+ return $this->getField($field, $default);
99
+ }
100
+
101
+ /**
102
+ * Returns a value from a child property in the metadata.
103
+ *
104
+ * @param string $parentField The parent property.
105
+ * @param string $field The property to retrieve.
106
+ * @param mixed $default The default to return if the property doesn't exist.
107
+ *
108
+ * @return mixed
109
+ */
110
+ public function getChildProperty($parentField, $field, $default = null)
111
+ {
112
+ if (!isset($this->metadata[$parentField])) {
113
+ return $default;
114
+ }
115
+
116
+ if (!isset($this->metadata[$parentField][$field])) {
117
+ return $default;
118
+ }
119
+
120
+ return $this->metadata[$parentField][$field];
121
+ }
122
+
123
+ /**
124
+ * Returns a value from the error metadata.
125
+ *
126
+ * @param string $field The property to retrieve.
127
+ * @param mixed $default The default to return if the property doesn't exist.
128
+ *
129
+ * @return mixed
130
+ */
131
+ public function getErrorProperty($field, $default = null)
132
+ {
133
+ return $this->getChildProperty('error', $field, $default);
134
+ }
135
+
136
+ /**
137
+ * Returns a value from the "metadata" metadata. *Brain explodes*
138
+ *
139
+ * @param string $field The property to retrieve.
140
+ * @param mixed $default The default to return if the property doesn't exist.
141
+ *
142
+ * @return mixed
143
+ */
144
+ public function getMetadataProperty($field, $default = null)
145
+ {
146
+ return $this->getChildProperty('metadata', $field, $default);
147
+ }
148
+
149
+ /**
150
+ * The ID of the application this access token is for.
151
+ *
152
+ * @return string|null
153
+ */
154
+ public function getAppId()
155
+ {
156
+ return $this->getField('app_id');
157
+ }
158
+
159
+ /**
160
+ * Name of the application this access token is for.
161
+ *
162
+ * @return string|null
163
+ */
164
+ public function getApplication()
165
+ {
166
+ return $this->getField('application');
167
+ }
168
+
169
+ /**
170
+ * Any error that a request to the graph api
171
+ * would return due to the access token.
172
+ *
173
+ * @return bool|null
174
+ */
175
+ public function isError()
176
+ {
177
+ return $this->getField('error') !== null;
178
+ }
179
+
180
+ /**
181
+ * The error code for the error.
182
+ *
183
+ * @return int|null
184
+ */
185
+ public function getErrorCode()
186
+ {
187
+ return $this->getErrorProperty('code');
188
+ }
189
+
190
+ /**
191
+ * The error message for the error.
192
+ *
193
+ * @return string|null
194
+ */
195
+ public function getErrorMessage()
196
+ {
197
+ return $this->getErrorProperty('message');
198
+ }
199
+
200
+ /**
201
+ * The error subcode for the error.
202
+ *
203
+ * @return int|null
204
+ */
205
+ public function getErrorSubcode()
206
+ {
207
+ return $this->getErrorProperty('subcode');
208
+ }
209
+
210
+ /**
211
+ * DateTime when this access token expires.
212
+ *
213
+ * @return \DateTime|null
214
+ */
215
+ public function getExpiresAt()
216
+ {
217
+ return $this->getField('expires_at');
218
+ }
219
+
220
+ /**
221
+ * Whether the access token is still valid or not.
222
+ *
223
+ * @return boolean|null
224
+ */
225
+ public function getIsValid()
226
+ {
227
+ return $this->getField('is_valid');
228
+ }
229
+
230
+ /**
231
+ * DateTime when this access token was issued.
232
+ *
233
+ * Note that the issued_at field is not returned
234
+ * for short-lived access tokens.
235
+ *
236
+ * @see https://developers.facebook.com/docs/facebook-login/access-tokens#debug
237
+ *
238
+ * @return \DateTime|null
239
+ */
240
+ public function getIssuedAt()
241
+ {
242
+ return $this->getField('issued_at');
243
+ }
244
+
245
+ /**
246
+ * General metadata associated with the access token.
247
+ * Can contain data like 'sso', 'auth_type', 'auth_nonce'.
248
+ *
249
+ * @return array|null
250
+ */
251
+ public function getMetadata()
252
+ {
253
+ return $this->getField('metadata');
254
+ }
255
+
256
+ /**
257
+ * The 'sso' child property from the 'metadata' parent property.
258
+ *
259
+ * @return string|null
260
+ */
261
+ public function getSso()
262
+ {
263
+ return $this->getMetadataProperty('sso');
264
+ }
265
+
266
+ /**
267
+ * The 'auth_type' child property from the 'metadata' parent property.
268
+ *
269
+ * @return string|null
270
+ */
271
+ public function getAuthType()
272
+ {
273
+ return $this->getMetadataProperty('auth_type');
274
+ }
275
+
276
+ /**
277
+ * The 'auth_nonce' child property from the 'metadata' parent property.
278
+ *
279
+ * @return string|null
280
+ */
281
+ public function getAuthNonce()
282
+ {
283
+ return $this->getMetadataProperty('auth_nonce');
284
+ }
285
+
286
+ /**
287
+ * For impersonated access tokens, the ID of
288
+ * the page this token contains.
289
+ *
290
+ * @return string|null
291
+ */
292
+ public function getProfileId()
293
+ {
294
+ return $this->getField('profile_id');
295
+ }
296
+
297
+ /**
298
+ * List of permissions that the user has granted for
299
+ * the app in this access token.
300
+ *
301
+ * @return array
302
+ */
303
+ public function getScopes()
304
+ {
305
+ return $this->getField('scopes');
306
+ }
307
+
308
+ /**
309
+ * The ID of the user this access token is for.
310
+ *
311
+ * @return string|null
312
+ */
313
+ public function getUserId()
314
+ {
315
+ return $this->getField('user_id');
316
+ }
317
+
318
+ /**
319
+ * Ensures the app ID from the access token
320
+ * metadata is what we expect.
321
+ *
322
+ * @param string $appId
323
+ *
324
+ * @throws FacebookSDKException
325
+ */
326
+ public function validateAppId($appId)
327
+ {
328
+ if ($this->getAppId() !== $appId) {
329
+ throw new FacebookSDKException('Access token metadata contains unexpected app ID.', 401);
330
+ }
331
+ }
332
+
333
+ /**
334
+ * Ensures the user ID from the access token
335
+ * metadata is what we expect.
336
+ *
337
+ * @param string $userId
338
+ *
339
+ * @throws FacebookSDKException
340
+ */
341
+ public function validateUserId($userId)
342
+ {
343
+ if ($this->getUserId() !== $userId) {
344
+ throw new FacebookSDKException('Access token metadata contains unexpected user ID.', 401);
345
+ }
346
+ }
347
+
348
+ /**
349
+ * Ensures the access token has not expired yet.
350
+ *
351
+ * @throws FacebookSDKException
352
+ */
353
+ public function validateExpiration()
354
+ {
355
+ if (!$this->getExpiresAt() instanceof \DateTime) {
356
+ return;
357
+ }
358
+
359
+ if ($this->getExpiresAt()->getTimestamp() < time()) {
360
+ throw new FacebookSDKException('Inspection of access token metadata shows that the access token has expired.', 401);
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Converts a unix timestamp into a DateTime entity.
366
+ *
367
+ * @param int $timestamp
368
+ *
369
+ * @return \DateTime
370
+ */
371
+ private function convertTimestampToDateTime($timestamp)
372
+ {
373
+ $dt = new \DateTime();
374
+ $dt->setTimestamp($timestamp);
375
+
376
+ return $dt;
377
+ }
378
+
379
+ /**
380
+ * Casts the unix timestamps as DateTime entities.
381
+ */
382
+ private function castTimestampsToDateTime()
383
+ {
384
+ foreach (static::$dateProperties as $key) {
385
+ if (isset($this->metadata[$key])) {
386
+ $this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]);
387
+ }
388
+ }
389
+ }
390
+ }
framework/facebook-sdk/src/Facebook/Authentication/OAuth2Client.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Authentication;
25
+
26
+ use Facebook\Facebook;
27
+ use Facebook\FacebookApp;
28
+ use Facebook\FacebookRequest;
29
+ use Facebook\FacebookResponse;
30
+ use Facebook\FacebookClient;
31
+ use Facebook\Exceptions\FacebookResponseException;
32
+ use Facebook\Exceptions\FacebookSDKException;
33
+
34
+ /**
35
+ * Class OAuth2Client
36
+ *
37
+ * @package Facebook
38
+ */
39
+ class OAuth2Client
40
+ {
41
+ /**
42
+ * @const string The base authorization URL.
43
+ */
44
+ const BASE_AUTHORIZATION_URL = 'https://www.facebook.com';
45
+
46
+ /**
47
+ * The FacebookApp entity.
48
+ *
49
+ * @var FacebookApp
50
+ */
51
+ protected $app;
52
+
53
+ /**
54
+ * The Facebook client.
55
+ *
56
+ * @var FacebookClient
57
+ */
58
+ protected $client;
59
+
60
+ /**
61
+ * The version of the Graph API to use.
62
+ *
63
+ * @var string
64
+ */
65
+ protected $graphVersion;
66
+
67
+ /**
68
+ * The last request sent to Graph.
69
+ *
70
+ * @var FacebookRequest|null
71
+ */
72
+ protected $lastRequest;
73
+
74
+ /**
75
+ * @param FacebookApp $app
76
+ * @param FacebookClient $client
77
+ * @param string|null $graphVersion The version of the Graph API to use.
78
+ */
79
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
80
+ {
81
+ $this->app = $app;
82
+ $this->client = $client;
83
+ $this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
84
+ }
85
+
86
+ /**
87
+ * Returns the last FacebookRequest that was sent.
88
+ * Useful for debugging and testing.
89
+ *
90
+ * @return FacebookRequest|null
91
+ */
92
+ public function getLastRequest()
93
+ {
94
+ return $this->lastRequest;
95
+ }
96
+
97
+ /**
98
+ * Get the metadata associated with the access token.
99
+ *
100
+ * @param AccessToken|string $accessToken The access token to debug.
101
+ *
102
+ * @return AccessTokenMetadata
103
+ */
104
+ public function debugToken($accessToken)
105
+ {
106
+ $accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
107
+ $params = ['input_token' => $accessToken];
108
+
109
+ $this->lastRequest = new FacebookRequest(
110
+ $this->app,
111
+ $this->app->getAccessToken(),
112
+ 'GET',
113
+ '/debug_token',
114
+ $params,
115
+ null,
116
+ $this->graphVersion
117
+ );
118
+ $response = $this->client->sendRequest($this->lastRequest);
119
+ $metadata = $response->getDecodedBody();
120
+
121
+ return new AccessTokenMetadata($metadata);
122
+ }
123
+
124
+ /**
125
+ * Generates an authorization URL to begin the process of authenticating a user.
126
+ *
127
+ * @param string $redirectUrl The callback URL to redirect to.
128
+ * @param array $scope An array of permissions to request.
129
+ * @param string $state The CSPRNG-generated CSRF value.
130
+ * @param array $params An array of parameters to generate URL.
131
+ * @param string $separator The separator to use in http_build_query().
132
+ *
133
+ * @return string
134
+ */
135
+ public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator = '&')
136
+ {
137
+ $params += [
138
+ 'client_id' => $this->app->getId(),
139
+ 'state' => $state,
140
+ 'response_type' => 'code',
141
+ 'sdk' => 'php-sdk-' . Facebook::VERSION,
142
+ 'redirect_uri' => $redirectUrl,
143
+ 'scope' => implode(',', $scope)
144
+ ];
145
+
146
+ return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator);
147
+ }
148
+
149
+ /**
150
+ * Get a valid access token from a code.
151
+ *
152
+ * @param string $code
153
+ * @param string $redirectUri
154
+ *
155
+ * @return AccessToken
156
+ *
157
+ * @throws FacebookSDKException
158
+ */
159
+ public function getAccessTokenFromCode($code, $redirectUri = '')
160
+ {
161
+ $params = [
162
+ 'code' => $code,
163
+ 'redirect_uri' => $redirectUri,
164
+ ];
165
+
166
+ return $this->requestAnAccessToken($params);
167
+ }
168
+
169
+ /**
170
+ * Exchanges a short-lived access token with a long-lived access token.
171
+ *
172
+ * @param AccessToken|string $accessToken
173
+ *
174
+ * @return AccessToken
175
+ *
176
+ * @throws FacebookSDKException
177
+ */
178
+ public function getLongLivedAccessToken($accessToken)
179
+ {
180
+ $accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
181
+ $params = [
182
+ 'grant_type' => 'fb_exchange_token',
183
+ 'fb_exchange_token' => $accessToken,
184
+ ];
185
+
186
+ return $this->requestAnAccessToken($params);
187
+ }
188
+
189
+ /**
190
+ * Get a valid code from an access token.
191
+ *
192
+ * @param AccessToken|string $accessToken
193
+ * @param string $redirectUri
194
+ *
195
+ * @return AccessToken
196
+ *
197
+ * @throws FacebookSDKException
198
+ */
199
+ public function getCodeFromLongLivedAccessToken($accessToken, $redirectUri = '')
200
+ {
201
+ $params = [
202
+ 'redirect_uri' => $redirectUri,
203
+ ];
204
+
205
+ $response = $this->sendRequestWithClientParams('/oauth/client_code', $params, $accessToken);
206
+ $data = $response->getDecodedBody();
207
+
208
+ if (!isset($data['code'])) {
209
+ throw new FacebookSDKException('Code was not returned from Graph.', 401);
210
+ }
211
+
212
+ return $data['code'];
213
+ }
214
+
215
+ /**
216
+ * Send a request to the OAuth endpoint.
217
+ *
218
+ * @param array $params
219
+ *
220
+ * @return AccessToken
221
+ *
222
+ * @throws FacebookSDKException
223
+ */
224
+ protected function requestAnAccessToken(array $params)
225
+ {
226
+ $response = $this->sendRequestWithClientParams('/oauth/access_token', $params);
227
+ $data = $response->getDecodedBody();
228
+
229
+ if (!isset($data['access_token'])) {
230
+ throw new FacebookSDKException('Access token was not returned from Graph.', 401);
231
+ }
232
+
233
+ // Graph returns two different key names for expiration time
234
+ // on the same endpoint. Doh! :/
235
+ $expiresAt = 0;
236
+ if (isset($data['expires'])) {
237
+ // For exchanging a short lived token with a long lived token.
238
+ // The expiration time in seconds will be returned as "expires".
239
+ $expiresAt = time() + $data['expires'];
240
+ } elseif (isset($data['expires_in'])) {
241
+ // For exchanging a code for a short lived access token.
242
+ // The expiration time in seconds will be returned as "expires_in".
243
+ // See: https://developers.facebook.com/docs/facebook-login/access-tokens#long-via-code
244
+ $expiresAt = time() + $data['expires_in'];
245
+ }
246
+
247
+ return new AccessToken($data['access_token'], $expiresAt);
248
+ }
249
+
250
+ /**
251
+ * Send a request to Graph with an app access token.
252
+ *
253
+ * @param string $endpoint
254
+ * @param array $params
255
+ * @param string|null $accessToken
256
+ *
257
+ * @return FacebookResponse
258
+ *
259
+ * @throws FacebookResponseException
260
+ */
261
+ protected function sendRequestWithClientParams($endpoint, array $params, $accessToken = null)
262
+ {
263
+ $params += $this->getClientParams();
264
+
265
+ $accessToken = $accessToken ?: $this->app->getAccessToken();
266
+
267
+ $this->lastRequest = new FacebookRequest(
268
+ $this->app,
269
+ $accessToken,
270
+ 'GET',
271
+ $endpoint,
272
+ $params,
273
+ null,
274
+ $this->graphVersion
275
+ );
276
+
277
+ return $this->client->sendRequest($this->lastRequest);
278
+ }
279
+
280
+ /**
281
+ * Returns the client_* params for OAuth requests.
282
+ *
283
+ * @return array
284
+ */
285
+ protected function getClientParams()
286
+ {
287
+ return [
288
+ 'client_id' => $this->app->getId(),
289
+ 'client_secret' => $this->app->getSecret(),
290
+ ];
291
+ }
292
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookAuthenticationException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookAuthenticationException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookAuthorizationException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookAuthorizationException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookClientException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookClientException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookClientException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookOtherException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookOtherException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookOtherException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookResponseException.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ use Facebook\FacebookResponse;
27
+
28
+ /**
29
+ * Class FacebookResponseException
30
+ *
31
+ * @package Facebook
32
+ */
33
+ class FacebookResponseException extends FacebookSDKException
34
+ {
35
+ /**
36
+ * @var FacebookResponse The response that threw the exception.
37
+ */
38
+ protected $response;
39
+
40
+ /**
41
+ * @var array Decoded response.
42
+ */
43
+ protected $responseData;
44
+
45
+ /**
46
+ * Creates a FacebookResponseException.
47
+ *
48
+ * @param FacebookResponse $response The response that threw the exception.
49
+ * @param FacebookSDKException $previousException The more detailed exception.
50
+ */
51
+ public function __construct(FacebookResponse $response, FacebookSDKException $previousException = null)
52
+ {
53
+ $this->response = $response;
54
+ $this->responseData = $response->getDecodedBody();
55
+
56
+ $errorMessage = $this->get('message', 'Unknown error from Graph.');
57
+ $errorCode = $this->get('code', -1);
58
+
59
+ parent::__construct($errorMessage, $errorCode, $previousException);
60
+ }
61
+
62
+ /**
63
+ * A factory for creating the appropriate exception based on the response from Graph.
64
+ *
65
+ * @param FacebookResponse $response The response that threw the exception.
66
+ *
67
+ * @return FacebookResponseException
68
+ */
69
+ public static function create(FacebookResponse $response)
70
+ {
71
+ $data = $response->getDecodedBody();
72
+
73
+ if (!isset($data['error']['code']) && isset($data['code'])) {
74
+ $data = ['error' => $data];
75
+ }
76
+
77
+ $code = isset($data['error']['code']) ? $data['error']['code'] : null;
78
+ $message = isset($data['error']['message']) ? $data['error']['message'] : 'Unknown error from Graph.';
79
+
80
+ $previousException = null;
81
+
82
+ if (isset($data['error']['error_subcode'])) {
83
+ switch ($data['error']['error_subcode']) {
84
+ // Other authentication issues
85
+ case 458:
86
+ case 459:
87
+ case 460:
88
+ case 463:
89
+ case 464:
90
+ case 467:
91
+ return new static($response, new FacebookAuthenticationException($message, $code));
92
+ }
93
+ }
94
+
95
+ switch ($code) {
96
+ // Login status or token expired, revoked, or invalid
97
+ case 100:
98
+ case 102:
99
+ case 190:
100
+ return new static($response, new FacebookAuthenticationException($message, $code));
101
+
102
+ // Server issue, possible downtime
103
+ case 1:
104
+ case 2:
105
+ return new static($response, new FacebookServerException($message, $code));
106
+
107
+ // API Throttling
108
+ case 4:
109
+ case 17:
110
+ case 341:
111
+ return new static($response, new FacebookThrottleException($message, $code));
112
+
113
+ // Duplicate Post
114
+ case 506:
115
+ return new static($response, new FacebookClientException($message, $code));
116
+ }
117
+
118
+ // Missing Permissions
119
+ if ($code == 10 || ($code >= 200 && $code <= 299)) {
120
+ return new static($response, new FacebookAuthorizationException($message, $code));
121
+ }
122
+
123
+ // OAuth authentication error
124
+ if (isset($data['error']['type']) && $data['error']['type'] === 'OAuthException') {
125
+ return new static($response, new FacebookAuthenticationException($message, $code));
126
+ }
127
+
128
+ // All others
129
+ return new static($response, new FacebookOtherException($message, $code));
130
+ }
131
+
132
+ /**
133
+ * Checks isset and returns that or a default value.
134
+ *
135
+ * @param string $key
136
+ * @param mixed $default
137
+ *
138
+ * @return mixed
139
+ */
140
+ private function get($key, $default = null)
141
+ {
142
+ if (isset($this->responseData['error'][$key])) {
143
+ return $this->responseData['error'][$key];
144
+ }
145
+
146
+ return $default;
147
+ }
148
+
149
+ /**
150
+ * Returns the HTTP status code
151
+ *
152
+ * @return int
153
+ */
154
+ public function getHttpStatusCode()
155
+ {
156
+ return $this->response->getHttpStatusCode();
157
+ }
158
+
159
+ /**
160
+ * Returns the sub-error code
161
+ *
162
+ * @return int
163
+ */
164
+ public function getSubErrorCode()
165
+ {
166
+ return $this->get('error_subcode', -1);
167
+ }
168
+
169
+ /**
170
+ * Returns the error type
171
+ *
172
+ * @return string
173
+ */
174
+ public function getErrorType()
175
+ {
176
+ return $this->get('type', '');
177
+ }
178
+
179
+ /**
180
+ * Returns the raw response used to create the exception.
181
+ *
182
+ * @return string
183
+ */
184
+ public function getRawResponse()
185
+ {
186
+ return $this->response->getBody();
187
+ }
188
+
189
+ /**
190
+ * Returns the decoded response used to create the exception.
191
+ *
192
+ * @return array
193
+ */
194
+ public function getResponseData()
195
+ {
196
+ return $this->responseData;
197
+ }
198
+
199
+ /**
200
+ * Returns the response entity used to create the exception.
201
+ *
202
+ * @return FacebookResponse
203
+ */
204
+ public function getResponse()
205
+ {
206
+ return $this->response;
207
+ }
208
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookSDKException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookSDKException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookSDKException extends \Exception
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookServerException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookServerException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookServerException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Exceptions/FacebookThrottleException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Exceptions;
25
+
26
+ /**
27
+ * Class FacebookThrottleException
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookThrottleException extends FacebookSDKException
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/Facebook.php ADDED
@@ -0,0 +1,589 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\Authentication\AccessToken;
27
+ use Facebook\Authentication\OAuth2Client;
28
+ use Facebook\FileUpload\FacebookFile;
29
+ use Facebook\FileUpload\FacebookVideo;
30
+ use Facebook\GraphNodes\GraphEdge;
31
+ use Facebook\Url\UrlDetectionInterface;
32
+ use Facebook\Url\FacebookUrlDetectionHandler;
33
+ use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
34
+ use Facebook\PseudoRandomString\McryptPseudoRandomStringGenerator;
35
+ use Facebook\PseudoRandomString\OpenSslPseudoRandomStringGenerator;
36
+ use Facebook\PseudoRandomString\UrandomPseudoRandomStringGenerator;
37
+ use Facebook\HttpClients\FacebookHttpClientInterface;
38
+ use Facebook\HttpClients\FacebookCurlHttpClient;
39
+ use Facebook\HttpClients\FacebookStreamHttpClient;
40
+ use Facebook\HttpClients\FacebookGuzzleHttpClient;
41
+ use Facebook\PersistentData\PersistentDataInterface;
42
+ use Facebook\PersistentData\FacebookSessionPersistentDataHandler;
43
+ use Facebook\PersistentData\FacebookMemoryPersistentDataHandler;
44
+ use Facebook\Helpers\FacebookCanvasHelper;
45
+ use Facebook\Helpers\FacebookJavaScriptHelper;
46
+ use Facebook\Helpers\FacebookPageTabHelper;
47
+ use Facebook\Helpers\FacebookRedirectLoginHelper;
48
+ use Facebook\Exceptions\FacebookSDKException;
49
+
50
+ /**
51
+ * Class Facebook
52
+ *
53
+ * @package Facebook
54
+ */
55
+ class Facebook
56
+ {
57
+ /**
58
+ * @const string Version number of the Facebook PHP SDK.
59
+ */
60
+ const VERSION = '5.0.0';
61
+
62
+ /**
63
+ * @const string Default Graph API version for requests.
64
+ */
65
+ const DEFAULT_GRAPH_VERSION = 'v2.4';
66
+
67
+ /**
68
+ * @const string The name of the environment variable that contains the app ID.
69
+ */
70
+ const APP_ID_ENV_NAME = 'FACEBOOK_APP_ID';
71
+
72
+ /**
73
+ * @const string The name of the environment variable that contains the app secret.
74
+ */
75
+ const APP_SECRET_ENV_NAME = 'FACEBOOK_APP_SECRET';
76
+
77
+ /**
78
+ * @var FacebookApp The FacebookApp entity.
79
+ */
80
+ protected $app;
81
+
82
+ /**
83
+ * @var FacebookClient The Facebook client service.
84
+ */
85
+ protected $client;
86
+
87
+ /**
88
+ * @var OAuth2Client The OAuth 2.0 client service.
89
+ */
90
+ protected $oAuth2Client;
91
+
92
+ /**
93
+ * @var UrlDetectionInterface|null The URL detection handler.
94
+ */
95
+ protected $urlDetectionHandler;
96
+
97
+ /**
98
+ * @var PseudoRandomStringGeneratorInterface|null The cryptographically secure pseudo-random string generator.
99
+ */
100
+ protected $pseudoRandomStringGenerator;
101
+
102
+ /**
103
+ * @var AccessToken|null The default access token to use with requests.
104
+ */
105
+ protected $defaultAccessToken;
106
+
107
+ /**
108
+ * @var string|null The default Graph version we want to use.
109
+ */
110
+ protected $defaultGraphVersion;
111
+
112
+ /**
113
+ * @var PersistentDataInterface|null The persistent data handler.
114
+ */
115
+ protected $persistentDataHandler;
116
+
117
+ /**
118
+ * @var FacebookResponse|FacebookBatchResponse|null Stores the last request made to Graph.
119
+ */
120
+ protected $lastResponse;
121
+
122
+ /**
123
+ * Instantiates a new Facebook super-class object.
124
+ *
125
+ * @param array $config
126
+ *
127
+ * @throws FacebookSDKException
128
+ */
129
+ public function __construct(array $config = [])
130
+ {
131
+ $appId = isset($config['app_id']) ? $config['app_id'] : getenv(static::APP_ID_ENV_NAME);
132
+ if (!$appId) {
133
+ throw new FacebookSDKException('Required "app_id" key not supplied in config and could not find fallback environment variable "' . static::APP_ID_ENV_NAME . '"');
134
+ }
135
+
136
+ $appSecret = isset($config['app_secret']) ? $config['app_secret'] : getenv(static::APP_SECRET_ENV_NAME);
137
+ if (!$appSecret) {
138
+ throw new FacebookSDKException('Required "app_secret" key not supplied in config and could not find fallback environment variable "' . static::APP_SECRET_ENV_NAME . '"');
139
+ }
140
+
141
+ $this->app = new FacebookApp($appId, $appSecret);
142
+
143
+ $httpClientHandler = null;
144
+ if (isset($config['http_client_handler'])) {
145
+ if ($config['http_client_handler'] instanceof FacebookHttpClientInterface) {
146
+ $httpClientHandler = $config['http_client_handler'];
147
+ } elseif ($config['http_client_handler'] === 'curl') {
148
+ $httpClientHandler = new FacebookCurlHttpClient();
149
+ } elseif ($config['http_client_handler'] === 'stream') {
150
+ $httpClientHandler = new FacebookStreamHttpClient();
151
+ } elseif ($config['http_client_handler'] === 'guzzle') {
152
+ $httpClientHandler = new FacebookGuzzleHttpClient();
153
+ } else {
154
+ throw new \InvalidArgumentException('The http_client_handler must be set to "curl", "stream", "guzzle", or be an instance of Facebook\HttpClients\FacebookHttpClientInterface');
155
+ }
156
+ }
157
+
158
+ $enableBeta = isset($config['enable_beta_mode']) && $config['enable_beta_mode'] === true;
159
+ $this->client = new FacebookClient($httpClientHandler, $enableBeta);
160
+
161
+ if (isset($config['url_detection_handler'])) {
162
+ if ($config['url_detection_handler'] instanceof UrlDetectionInterface) {
163
+ $this->urlDetectionHandler = $config['url_detection_handler'];
164
+ } else {
165
+ throw new \InvalidArgumentException('The url_detection_handler must be an instance of Facebook\Url\UrlDetectionInterface');
166
+ }
167
+ }
168
+
169
+ if (isset($config['pseudo_random_string_generator'])) {
170
+ if ($config['pseudo_random_string_generator'] instanceof PseudoRandomStringGeneratorInterface) {
171
+ $this->pseudoRandomStringGenerator = $config['pseudo_random_string_generator'];
172
+ } elseif ($config['pseudo_random_string_generator'] === 'mcrypt') {
173
+ $this->pseudoRandomStringGenerator = new McryptPseudoRandomStringGenerator();
174
+ } elseif ($config['pseudo_random_string_generator'] === 'openssl') {
175
+ $this->pseudoRandomStringGenerator = new OpenSslPseudoRandomStringGenerator();
176
+ } elseif ($config['pseudo_random_string_generator'] === 'urandom') {
177
+ $this->pseudoRandomStringGenerator = new UrandomPseudoRandomStringGenerator();
178
+ } else {
179
+ throw new \InvalidArgumentException('The pseudo_random_string_generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface');
180
+ }
181
+ }
182
+
183
+ if (isset($config['persistent_data_handler'])) {
184
+ if ($config['persistent_data_handler'] instanceof PersistentDataInterface) {
185
+ $this->persistentDataHandler = $config['persistent_data_handler'];
186
+ } elseif ($config['persistent_data_handler'] === 'session') {
187
+ $this->persistentDataHandler = new FacebookSessionPersistentDataHandler();
188
+ } elseif ($config['persistent_data_handler'] === 'memory') {
189
+ $this->persistentDataHandler = new FacebookMemoryPersistentDataHandler();
190
+ } else {
191
+ throw new \InvalidArgumentException('The persistent_data_handler must be set to "session", "memory", or be an instance of Facebook\PersistentData\PersistentDataInterface');
192
+ }
193
+ }
194
+
195
+ if (isset($config['default_access_token'])) {
196
+ $this->setDefaultAccessToken($config['default_access_token']);
197
+ }
198
+
199
+ if (isset($config['default_graph_version'])) {
200
+ $this->defaultGraphVersion = $config['default_graph_version'];
201
+ } else {
202
+ // @todo v6: Throw an InvalidArgumentException if "default_graph_version" is not set
203
+ $this->defaultGraphVersion = static::DEFAULT_GRAPH_VERSION;
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Returns the FacebookApp entity.
209
+ *
210
+ * @return FacebookApp
211
+ */
212
+ public function getApp()
213
+ {
214
+ return $this->app;
215
+ }
216
+
217
+ /**
218
+ * Returns the FacebookClient service.
219
+ *
220
+ * @return FacebookClient
221
+ */
222
+ public function getClient()
223
+ {
224
+ return $this->client;
225
+ }
226
+
227
+ /**
228
+ * Returns the OAuth 2.0 client service.
229
+ *
230
+ * @return OAuth2Client
231
+ */
232
+ public function getOAuth2Client()
233
+ {
234
+ if (!$this->oAuth2Client instanceof OAuth2Client) {
235
+ $app = $this->getApp();
236
+ $client = $this->getClient();
237
+ $this->oAuth2Client = new OAuth2Client($app, $client, $this->defaultGraphVersion);
238
+ }
239
+
240
+ return $this->oAuth2Client;
241
+ }
242
+
243
+ /**
244
+ * Returns the last response returned from Graph.
245
+ *
246
+ * @return FacebookResponse|FacebookBatchResponse|null
247
+ */
248
+ public function getLastResponse()
249
+ {
250
+ return $this->lastResponse;
251
+ }
252
+
253
+ /**
254
+ * Returns the URL detection handler.
255
+ *
256
+ * @return UrlDetectionInterface
257
+ */
258
+ public function getUrlDetectionHandler()
259
+ {
260
+ if (!$this->urlDetectionHandler instanceof UrlDetectionInterface) {
261
+ $this->urlDetectionHandler = new FacebookUrlDetectionHandler();
262
+ }
263
+
264
+ return $this->urlDetectionHandler;
265
+ }
266
+
267
+ /**
268
+ * Returns the default AccessToken entity.
269
+ *
270
+ * @return AccessToken|null
271
+ */
272
+ public function getDefaultAccessToken()
273
+ {
274
+ return $this->defaultAccessToken;
275
+ }
276
+
277
+ /**
278
+ * Sets the default access token to use with requests.
279
+ *
280
+ * @param AccessToken|string $accessToken The access token to save.
281
+ *
282
+ * @throws \InvalidArgumentException
283
+ */
284
+ public function setDefaultAccessToken($accessToken)
285
+ {
286
+ if (is_string($accessToken)) {
287
+ $this->defaultAccessToken = new AccessToken($accessToken);
288
+
289
+ return;
290
+ }
291
+
292
+ if ($accessToken instanceof AccessToken) {
293
+ $this->defaultAccessToken = $accessToken;
294
+
295
+ return;
296
+ }
297
+
298
+ throw new \InvalidArgumentException('The default access token must be of type "string" or Facebook\AccessToken');
299
+ }
300
+
301
+ /**
302
+ * Returns the default Graph version.
303
+ *
304
+ * @return string
305
+ */
306
+ public function getDefaultGraphVersion()
307
+ {
308
+ return $this->defaultGraphVersion;
309
+ }
310
+
311
+ /**
312
+ * Returns the redirect login helper.
313
+ *
314
+ * @return FacebookRedirectLoginHelper
315
+ */
316
+ public function getRedirectLoginHelper()
317
+ {
318
+ return new FacebookRedirectLoginHelper(
319
+ $this->getOAuth2Client(),
320
+ $this->persistentDataHandler,
321
+ $this->urlDetectionHandler,
322
+ $this->pseudoRandomStringGenerator
323
+ );
324
+ }
325
+
326
+ /**
327
+ * Returns the JavaScript helper.
328
+ *
329
+ * @return FacebookJavaScriptHelper
330
+ */
331
+ public function getJavaScriptHelper()
332
+ {
333
+ return new FacebookJavaScriptHelper($this->app, $this->client, $this->defaultGraphVersion);
334
+ }
335
+
336
+ /**
337
+ * Returns the canvas helper.
338
+ *
339
+ * @return FacebookCanvasHelper
340
+ */
341
+ public function getCanvasHelper()
342
+ {
343
+ return new FacebookCanvasHelper($this->app, $this->client, $this->defaultGraphVersion);
344
+ }
345
+
346
+ /**
347
+ * Returns the page tab helper.
348
+ *
349
+ * @return FacebookPageTabHelper
350
+ */
351
+ public function getPageTabHelper()
352
+ {
353
+ return new FacebookPageTabHelper($this->app, $this->client, $this->defaultGraphVersion);
354
+ }
355
+
356
+ /**
357
+ * Sends a GET request to Graph and returns the result.
358
+ *
359
+ * @param string $endpoint
360
+ * @param AccessToken|string|null $accessToken
361
+ * @param string|null $eTag
362
+ * @param string|null $graphVersion
363
+ *
364
+ * @return FacebookResponse
365
+ *
366
+ * @throws FacebookSDKException
367
+ */
368
+ public function get($endpoint, $accessToken = null, $eTag = null, $graphVersion = null)
369
+ {
370
+ return $this->sendRequest(
371
+ 'GET',
372
+ $endpoint,
373
+ $params = [],
374
+ $accessToken,
375
+ $eTag,
376
+ $graphVersion
377
+ );
378
+ }
379
+
380
+ /**
381
+ * Sends a POST request to Graph and returns the result.
382
+ *
383
+ * @param string $endpoint
384
+ * @param array $params
385
+ * @param AccessToken|string|null $accessToken
386
+ * @param string|null $eTag
387
+ * @param string|null $graphVersion
388
+ *
389
+ * @return FacebookResponse
390
+ *
391
+ * @throws FacebookSDKException
392
+ */
393
+ public function post($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
394
+ {
395
+ return $this->sendRequest(
396
+ 'POST',
397
+ $endpoint,
398
+ $params,
399
+ $accessToken,
400
+ $eTag,
401
+ $graphVersion
402
+ );
403
+ }
404
+
405
+ /**
406
+ * Sends a DELETE request to Graph and returns the result.
407
+ *
408
+ * @param string $endpoint
409
+ * @param array $params
410
+ * @param AccessToken|string|null $accessToken
411
+ * @param string|null $eTag
412
+ * @param string|null $graphVersion
413
+ *
414
+ * @return FacebookResponse
415
+ *
416
+ * @throws FacebookSDKException
417
+ */
418
+ public function delete($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
419
+ {
420
+ return $this->sendRequest(
421
+ 'DELETE',
422
+ $endpoint,
423
+ $params,
424
+ $accessToken,
425
+ $eTag,
426
+ $graphVersion
427
+ );
428
+ }
429
+
430
+ /**
431
+ * Sends a request to Graph for the next page of results.
432
+ *
433
+ * @param GraphEdge $graphEdge The GraphEdge to paginate over.
434
+ *
435
+ * @return GraphEdge|null
436
+ *
437
+ * @throws FacebookSDKException
438
+ */
439
+ public function next(GraphEdge $graphEdge)
440
+ {
441
+ return $this->getPaginationResults($graphEdge, 'next');
442
+ }
443
+
444
+ /**
445
+ * Sends a request to Graph for the previous page of results.
446
+ *
447
+ * @param GraphEdge $graphEdge The GraphEdge to paginate over.
448
+ *
449
+ * @return GraphEdge|null
450
+ *
451
+ * @throws FacebookSDKException
452
+ */
453
+ public function previous(GraphEdge $graphEdge)
454
+ {
455
+ return $this->getPaginationResults($graphEdge, 'previous');
456
+ }
457
+
458
+ /**
459
+ * Sends a request to Graph for the next page of results.
460
+ *
461
+ * @param GraphEdge $graphEdge The GraphEdge to paginate over.
462
+ * @param string $direction The direction of the pagination: next|previous.
463
+ *
464
+ * @return GraphEdge|null
465
+ *
466
+ * @throws FacebookSDKException
467
+ */
468
+ public function getPaginationResults(GraphEdge $graphEdge, $direction)
469
+ {
470
+ $paginationRequest = $graphEdge->getPaginationRequest($direction);
471
+ if (!$paginationRequest) {
472
+ return null;
473
+ }
474
+
475
+ $this->lastResponse = $this->client->sendRequest($paginationRequest);
476
+
477
+ // Keep the same GraphNode subclass
478
+ $subClassName = $graphEdge->getSubClassName();
479
+ $graphEdge = $this->lastResponse->getGraphEdge($subClassName, false);
480
+
481
+ return count($graphEdge) > 0 ? $graphEdge : null;
482
+ }
483
+
484
+ /**
485
+ * Sends a request to Graph and returns the result.
486
+ *
487
+ * @param string $method
488
+ * @param string $endpoint
489
+ * @param array $params
490
+ * @param AccessToken|string|null $accessToken
491
+ * @param string|null $eTag
492
+ * @param string|null $graphVersion
493
+ *
494
+ * @return FacebookResponse
495
+ *
496
+ * @throws FacebookSDKException
497
+ */
498
+ public function sendRequest($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
499
+ {
500
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
501
+ $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
502
+ $request = $this->request($method, $endpoint, $params, $accessToken, $eTag, $graphVersion);
503
+
504
+ return $this->lastResponse = $this->client->sendRequest($request);
505
+ }
506
+
507
+ /**
508
+ * Sends a batched request to Graph and returns the result.
509
+ *
510
+ * @param array $requests
511
+ * @param AccessToken|string|null $accessToken
512
+ * @param string|null $graphVersion
513
+ *
514
+ * @return FacebookBatchResponse
515
+ *
516
+ * @throws FacebookSDKException
517
+ */
518
+ public function sendBatchRequest(array $requests, $accessToken = null, $graphVersion = null)
519
+ {
520
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
521
+ $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
522
+ $batchRequest = new FacebookBatchRequest(
523
+ $this->app,
524
+ $requests,
525
+ $accessToken,
526
+ $graphVersion
527
+ );
528
+
529
+ return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
530
+ }
531
+
532
+ /**
533
+ * Instantiates a new FacebookRequest entity.
534
+ *
535
+ * @param string $method
536
+ * @param string $endpoint
537
+ * @param array $params
538
+ * @param AccessToken|string|null $accessToken
539
+ * @param string|null $eTag
540
+ * @param string|null $graphVersion
541
+ *
542
+ * @return FacebookRequest
543
+ *
544
+ * @throws FacebookSDKException
545
+ */
546
+ public function request($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
547
+ {
548
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
549
+ $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
550
+
551
+ return new FacebookRequest(
552
+ $this->app,
553
+ $accessToken,
554
+ $method,
555
+ $endpoint,
556
+ $params,
557
+ $eTag,
558
+ $graphVersion
559
+ );
560
+ }
561
+
562
+ /**
563
+ * Factory to create FacebookFile's.
564
+ *
565
+ * @param string $pathToFile
566
+ *
567
+ * @return FacebookFile
568
+ *
569
+ * @throws FacebookSDKException
570
+ */
571
+ public function fileToUpload($pathToFile)
572
+ {
573
+ return new FacebookFile($pathToFile);
574
+ }
575
+
576
+ /**
577
+ * Factory to create FacebookVideo's.
578
+ *
579
+ * @param string $pathToFile
580
+ *
581
+ * @return FacebookVideo
582
+ *
583
+ * @throws FacebookSDKException
584
+ */
585
+ public function videoToUpload($pathToFile)
586
+ {
587
+ return new FacebookVideo($pathToFile);
588
+ }
589
+ }
framework/facebook-sdk/src/Facebook/FacebookApp.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\Authentication\AccessToken;
27
+
28
+ class FacebookApp implements \Serializable
29
+ {
30
+ /**
31
+ * @var string The app ID.
32
+ */
33
+ protected $id;
34
+
35
+ /**
36
+ * @var string The app secret.
37
+ */
38
+ protected $secret;
39
+
40
+ /**
41
+ * @param string $id
42
+ * @param string $secret
43
+ */
44
+ public function __construct($id, $secret)
45
+ {
46
+ $this->id = $id;
47
+ $this->secret = $secret;
48
+ }
49
+
50
+ /**
51
+ * Returns the app ID.
52
+ *
53
+ * @return string
54
+ */
55
+ public function getId()
56
+ {
57
+ return $this->id;
58
+ }
59
+
60
+ /**
61
+ * Returns the app secret.
62
+ *
63
+ * @return string
64
+ */
65
+ public function getSecret()
66
+ {
67
+ return $this->secret;
68
+ }
69
+
70
+ /**
71
+ * Returns an app access token.
72
+ *
73
+ * @return AccessToken
74
+ */
75
+ public function getAccessToken()
76
+ {
77
+ return new AccessToken($this->id . '|' . $this->secret);
78
+ }
79
+
80
+ /**
81
+ * Serializes the FacebookApp entity as a string.
82
+ *
83
+ * @return string
84
+ */
85
+ public function serialize()
86
+ {
87
+ return serialize([$this->id, $this->secret]);
88
+ }
89
+
90
+ /**
91
+ * Unserializes a string as a FacebookApp entity.
92
+ *
93
+ * @param string $serialized
94
+ */
95
+ public function unserialize($serialized)
96
+ {
97
+ list($id, $secret) = unserialize($serialized);
98
+
99
+ $this->__construct($id, $secret);
100
+ }
101
+ }
framework/facebook-sdk/src/Facebook/FacebookBatchRequest.php ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use ArrayIterator;
27
+ use IteratorAggregate;
28
+ use ArrayAccess;
29
+ use Facebook\Authentication\AccessToken;
30
+ use Facebook\Exceptions\FacebookSDKException;
31
+
32
+ /**
33
+ * Class BatchRequest
34
+ *
35
+ * @package Facebook
36
+ */
37
+ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, ArrayAccess
38
+ {
39
+ /**
40
+ * @var array An array of FacebookRequest entities to send.
41
+ */
42
+ protected $requests;
43
+
44
+ /**
45
+ * @var array An array of files to upload.
46
+ */
47
+ protected $attachedFiles;
48
+
49
+ /**
50
+ * Creates a new Request entity.
51
+ *
52
+ * @param FacebookApp|null $app
53
+ * @param array $requests
54
+ * @param AccessToken|string|null $accessToken
55
+ * @param string|null $graphVersion
56
+ */
57
+ public function __construct(FacebookApp $app = null, array $requests = [], $accessToken = null, $graphVersion = null)
58
+ {
59
+ parent::__construct($app, $accessToken, 'POST', '', [], null, $graphVersion);
60
+
61
+ $this->add($requests);
62
+ }
63
+
64
+ /**
65
+ * A a new request to the array.
66
+ *
67
+ * @param FacebookRequest|array $request
68
+ * @param string|null $name
69
+ *
70
+ * @return FacebookBatchRequest
71
+ *
72
+ * @throws \InvalidArgumentException
73
+ */
74
+ public function add($request, $name = null)
75
+ {
76
+ if (is_array($request)) {
77
+ foreach ($request as $key => $req) {
78
+ $this->add($req, $key);
79
+ }
80
+
81
+ return $this;
82
+ }
83
+
84
+ if (!$request instanceof FacebookRequest) {
85
+ throw new \InvalidArgumentException('Argument for add() must be of type array or FacebookRequest.');
86
+ }
87
+
88
+ $this->addFallbackDefaults($request);
89
+ $requestToAdd = [
90
+ 'name' => $name,
91
+ 'request' => $request,
92
+ ];
93
+
94
+ // File uploads
95
+ $attachedFiles = $this->extractFileAttachments($request);
96
+ if ($attachedFiles) {
97
+ $requestToAdd['attached_files'] = $attachedFiles;
98
+ }
99
+ $this->requests[] = $requestToAdd;
100
+
101
+ return $this;
102
+ }
103
+
104
+ /**
105
+ * Ensures that the FacebookApp and access token fall back when missing.
106
+ *
107
+ * @param FacebookRequest $request
108
+ *
109
+ * @throws FacebookSDKException
110
+ */
111
+ public function addFallbackDefaults(FacebookRequest $request)
112
+ {
113
+ if (!$request->getApp()) {
114
+ $app = $this->getApp();
115
+ if (!$app) {
116
+ throw new FacebookSDKException('Missing FacebookApp on FacebookRequest and no fallback detected on FacebookBatchRequest.');
117
+ }
118
+ $request->setApp($app);
119
+ }
120
+
121
+ if (!$request->getAccessToken()) {
122
+ $accessToken = $this->getAccessToken();
123
+ if (!$accessToken) {
124
+ throw new FacebookSDKException('Missing access token on FacebookRequest and no fallback detected on FacebookBatchRequest.');
125
+ }
126
+ $request->setAccessToken($accessToken);
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Extracts the files from a request.
132
+ *
133
+ * @param FacebookRequest $request
134
+ *
135
+ * @return string|null
136
+ *
137
+ * @throws FacebookSDKException
138
+ */
139
+ public function extractFileAttachments(FacebookRequest $request)
140
+ {
141
+ if (!$request->containsFileUploads()) {
142
+ return null;
143
+ }
144
+
145
+ $files = $request->getFiles();
146
+ $fileNames = [];
147
+ foreach ($files as $file) {
148
+ $fileName = uniqid();
149
+ $this->addFile($fileName, $file);
150
+ $fileNames[] = $fileName;
151
+ }
152
+
153
+ $request->resetFiles();
154
+
155
+ // @TODO Does Graph support multiple uploads on one endpoint?
156
+ return implode(',', $fileNames);
157
+ }
158
+
159
+ /**
160
+ * Return the FacebookRequest entities.
161
+ *
162
+ * @return array
163
+ */
164
+ public function getRequests()
165
+ {
166
+ return $this->requests;
167
+ }
168
+
169
+ /**
170
+ * Prepares the requests to be sent as a batch request.
171
+ *
172
+ * @return string
173
+ */
174
+ public function prepareRequestsForBatch()
175
+ {
176
+ $this->validateBatchRequestCount();
177
+
178
+ $params = [
179
+ 'batch' => $this->convertRequestsToJson(),
180
+ 'include_headers' => true,
181
+ ];
182
+ $this->setParams($params);
183
+ }
184
+
185
+ /**
186
+ * Converts the requests into a JSON(P) string.
187
+ *
188
+ * @return string
189
+ */
190
+ public function convertRequestsToJson()
191
+ {
192
+ $requests = [];
193
+ foreach ($this->requests as $request) {
194
+ $attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null;
195
+ $requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles);
196
+ }
197
+
198
+ return json_encode($requests);
199
+ }
200
+
201
+ /**
202
+ * Validate the request count before sending them as a batch.
203
+ *
204
+ * @throws FacebookSDKException
205
+ */
206
+ public function validateBatchRequestCount()
207
+ {
208
+ $batchCount = count($this->requests);
209
+ if ($batchCount === 0) {
210
+ throw new FacebookSDKException('There are no batch requests to send.');
211
+ } elseif ($batchCount > 50) {
212
+ // Per: https://developers.facebook.com/docs/graph-api/making-multiple-requests#limits
213
+ throw new FacebookSDKException('You cannot send more than 50 batch requests at a time.');
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Converts a Request entity into an array that is batch-friendly.
219
+ *
220
+ * @param FacebookRequest $request The request entity to convert.
221
+ * @param string|null $requestName The name of the request.
222
+ * @param string|null $attachedFiles Names of files associated with the request.
223
+ *
224
+ * @return array
225
+ */
226
+ public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null)
227
+ {
228
+ $compiledHeaders = [];
229
+ $headers = $request->getHeaders();
230
+ foreach ($headers as $name => $value) {
231
+ $compiledHeaders[] = $name . ': ' . $value;
232
+ }
233
+
234
+ $batch = [
235
+ 'headers' => $compiledHeaders,
236
+ 'method' => $request->getMethod(),
237
+ 'relative_url' => $request->getUrl(),
238
+ ];
239
+
240
+ // Since file uploads are moved to the root request of a batch request,
241
+ // the child requests will always be URL-encoded.
242
+ $body = $request->getUrlEncodedBody()->getBody();
243
+ if ($body) {
244
+ $batch['body'] = $body;
245
+ }
246
+
247
+ if (isset($requestName)) {
248
+ $batch['name'] = $requestName;
249
+ }
250
+
251
+ if (isset($attachedFiles)) {
252
+ $batch['attached_files'] = $attachedFiles;
253
+ }
254
+
255
+ // @TODO Add support for "omit_response_on_success"
256
+ // @TODO Add support for "depends_on"
257
+ // @TODO Add support for JSONP with "callback"
258
+
259
+ return $batch;
260
+ }
261
+
262
+ /**
263
+ * Get an iterator for the items.
264
+ *
265
+ * @return ArrayIterator
266
+ */
267
+ public function getIterator()
268
+ {
269
+ return new ArrayIterator($this->requests);
270
+ }
271
+
272
+ /**
273
+ * @inheritdoc
274
+ */
275
+ public function offsetSet($offset, $value)
276
+ {
277
+ $this->add($value, $offset);
278
+ }
279
+
280
+ /**
281
+ * @inheritdoc
282
+ */
283
+ public function offsetExists($offset)
284
+ {
285
+ return isset($this->requests[$offset]);
286
+ }
287
+
288
+ /**
289
+ * @inheritdoc
290
+ */
291
+ public function offsetUnset($offset)
292
+ {
293
+ unset($this->requests[$offset]);
294
+ }
295
+
296
+ /**
297
+ * @inheritdoc
298
+ */
299
+ public function offsetGet($offset)
300
+ {
301
+ return isset($this->requests[$offset]) ? $this->requests[$offset] : null;
302
+ }
303
+ }
framework/facebook-sdk/src/Facebook/FacebookBatchResponse.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use ArrayIterator;
27
+ use IteratorAggregate;
28
+ use ArrayAccess;
29
+
30
+ /**
31
+ * Class FacebookBatchResponse
32
+ *
33
+ * @package Facebook
34
+ */
35
+ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregate, ArrayAccess
36
+ {
37
+ /**
38
+ * @var FacebookBatchRequest The original entity that made the batch request.
39
+ */
40
+ protected $batchRequest;
41
+
42
+ /**
43
+ * @var array An array of FacebookResponse entities.
44
+ */
45
+ protected $responses = [];
46
+
47
+ /**
48
+ * Creates a new Response entity.
49
+ *
50
+ * @param FacebookBatchRequest $batchRequest
51
+ * @param FacebookResponse $response
52
+ */
53
+ public function __construct(FacebookBatchRequest $batchRequest, FacebookResponse $response)
54
+ {
55
+ $this->batchRequest = $batchRequest;
56
+
57
+ $request = $response->getRequest();
58
+ $body = $response->getBody();
59
+ $httpStatusCode = $response->getHttpStatusCode();
60
+ $headers = $response->getHeaders();
61
+ parent::__construct($request, $body, $httpStatusCode, $headers);
62
+
63
+ $responses = $response->getDecodedBody();
64
+ $this->setResponses($responses);
65
+ }
66
+
67
+ /**
68
+ * Returns an array of FacebookResponse entities.
69
+ *
70
+ * @return array
71
+ */
72
+ public function getResponses()
73
+ {
74
+ return $this->responses;
75
+ }
76
+
77
+ /**
78
+ * The main batch response will be an array of requests so
79
+ * we need to iterate over all the responses.
80
+ *
81
+ * @param array $responses
82
+ */
83
+ public function setResponses(array $responses)
84
+ {
85
+ $this->responses = [];
86
+
87
+ foreach ($responses as $key => $graphResponse) {
88
+ $this->addResponse($key, $graphResponse);
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Add a response to the list.
94
+ *
95
+ * @param int $key
96
+ * @param array|null $response
97
+ */
98
+ public function addResponse($key, $response)
99
+ {
100
+ $originalRequestName = isset($this->batchRequest[$key]['name']) ? $this->batchRequest[$key]['name'] : $key;
101
+ $originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : null;
102
+
103
+ $httpResponseBody = isset($response['body']) ? $response['body'] : null;
104
+ $httpResponseCode = isset($response['code']) ? $response['code'] : null;
105
+ $httpResponseHeaders = isset($response['headers']) ? $response['headers'] : [];
106
+
107
+ $this->responses[$originalRequestName] = new FacebookResponse(
108
+ $originalRequest,
109
+ $httpResponseBody,
110
+ $httpResponseCode,
111
+ $httpResponseHeaders
112
+ );
113
+ }
114
+
115
+ /**
116
+ * @inheritdoc
117
+ */
118
+ public function getIterator()
119
+ {
120
+ return new ArrayIterator($this->responses);
121
+ }
122
+
123
+ /**
124
+ * @inheritdoc
125
+ */
126
+ public function offsetSet($offset, $value)
127
+ {
128
+ $this->addResponse($offset, $value);
129
+ }
130
+
131
+ /**
132
+ * @inheritdoc
133
+ */
134
+ public function offsetExists($offset)
135
+ {
136
+ return isset($this->responses[$offset]);
137
+ }
138
+
139
+ /**
140
+ * @inheritdoc
141
+ */
142
+ public function offsetUnset($offset)
143
+ {
144
+ unset($this->responses[$offset]);
145
+ }
146
+
147
+ /**
148
+ * @inheritdoc
149
+ */
150
+ public function offsetGet($offset)
151
+ {
152
+ return isset($this->responses[$offset]) ? $this->responses[$offset] : null;
153
+ }
154
+ }
framework/facebook-sdk/src/Facebook/FacebookClient.php ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\HttpClients\FacebookHttpClientInterface;
27
+ use Facebook\HttpClients\FacebookCurlHttpClient;
28
+ use Facebook\HttpClients\FacebookStreamHttpClient;
29
+ use Facebook\Exceptions\FacebookSDKException;
30
+
31
+ /**
32
+ * Class FacebookClient
33
+ *
34
+ * @package Facebook
35
+ */
36
+ class FacebookClient
37
+ {
38
+ /**
39
+ * @const string Production Graph API URL.
40
+ */
41
+ const BASE_GRAPH_URL = 'https://graph.facebook.com';
42
+
43
+ /**
44
+ * @const string Graph API URL for video uploads.
45
+ */
46
+ const BASE_GRAPH_VIDEO_URL = 'https://graph-video.facebook.com';
47
+
48
+ /**
49
+ * @const string Beta Graph API URL.
50
+ */
51
+ const BASE_GRAPH_URL_BETA = 'https://graph.beta.facebook.com';
52
+
53
+ /**
54
+ * @const string Beta Graph API URL for video uploads.
55
+ */
56
+ const BASE_GRAPH_VIDEO_URL_BETA = 'https://graph-video.beta.facebook.com';
57
+
58
+ /**
59
+ * @const int The timeout in seconds for a normal request.
60
+ */
61
+ const DEFAULT_REQUEST_TIMEOUT = 60;
62
+
63
+ /**
64
+ * @const int The timeout in seconds for a request that contains file uploads.
65
+ */
66
+ const DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT = 3600;
67
+
68
+ /**
69
+ * @const int The timeout in seconds for a request that contains video uploads.
70
+ */
71
+ const DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT = 7200;
72
+
73
+ /**
74
+ * @var bool Toggle to use Graph beta url.
75
+ */
76
+ protected $enableBetaMode = false;
77
+
78
+ /**
79
+ * @var FacebookHttpClientInterface HTTP client handler.
80
+ */
81
+ protected $httpClientHandler;
82
+
83
+ /**
84
+ * @var int The number of calls that have been made to Graph.
85
+ */
86
+ public static $requestCount = 0;
87
+
88
+ /**
89
+ * Instantiates a new FacebookClient object.
90
+ *
91
+ * @param FacebookHttpClientInterface|null $httpClientHandler
92
+ * @param boolean $enableBeta
93
+ */
94
+ public function __construct(FacebookHttpClientInterface $httpClientHandler = null, $enableBeta = false)
95
+ {
96
+ $this->httpClientHandler = $httpClientHandler ?: $this->detectHttpClientHandler();
97
+ $this->enableBetaMode = $enableBeta;
98
+ }
99
+
100
+ /**
101
+ * Sets the HTTP client handler.
102
+ *
103
+ * @param FacebookHttpClientInterface $httpClientHandler
104
+ */
105
+ public function setHttpClientHandler(FacebookHttpClientInterface $httpClientHandler)
106
+ {
107
+ $this->httpClientHandler = $httpClientHandler;
108
+ }
109
+
110
+ /**
111
+ * Returns the HTTP client handler.
112
+ *
113
+ * @return FacebookHttpClientInterface
114
+ */
115
+ public function getHttpClientHandler()
116
+ {
117
+ return $this->httpClientHandler;
118
+ }
119
+
120
+ /**
121
+ * Detects which HTTP client handler to use.
122
+ *
123
+ * @return FacebookHttpClientInterface
124
+ */
125
+ public function detectHttpClientHandler()
126
+ {
127
+ return function_exists('curl_init') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
128
+ }
129
+
130
+ /**
131
+ * Toggle beta mode.
132
+ *
133
+ * @param boolean $betaMode
134
+ */
135
+ public function enableBetaMode($betaMode = true)
136
+ {
137
+ $this->enableBetaMode = $betaMode;
138
+ }
139
+
140
+ /**
141
+ * Returns the base Graph URL.
142
+ *
143
+ * @param boolean $postToVideoUrl Post to the video API if videos are being uploaded.
144
+ *
145
+ * @return string
146
+ */
147
+ public function getBaseGraphUrl($postToVideoUrl = false)
148
+ {
149
+ if ($postToVideoUrl) {
150
+ return $this->enableBetaMode ? static::BASE_GRAPH_VIDEO_URL_BETA : static::BASE_GRAPH_VIDEO_URL;
151
+ }
152
+
153
+ return $this->enableBetaMode ? static::BASE_GRAPH_URL_BETA : static::BASE_GRAPH_URL;
154
+ }
155
+
156
+ /**
157
+ * Prepares the request for sending to the client handler.
158
+ *
159
+ * @param FacebookRequest $request
160
+ *
161
+ * @return array
162
+ */
163
+ public function prepareRequestMessage(FacebookRequest $request)
164
+ {
165
+ $postToVideoUrl = $request->containsVideoUploads();
166
+ $url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl();
167
+
168
+ // If we're sending files they should be sent as multipart/form-data
169
+ if ($request->containsFileUploads()) {
170
+ $requestBody = $request->getMultipartBody();
171
+ $request->setHeaders([
172
+ 'Content-Type' => 'multipart/form-data; boundary=' . $requestBody->getBoundary(),
173
+ ]);
174
+ } else {
175
+ $requestBody = $request->getUrlEncodedBody();
176
+ $request->setHeaders([
177
+ 'Content-Type' => 'application/x-www-form-urlencoded',
178
+ ]);
179
+ }
180
+
181
+ return [
182
+ $url,
183
+ $request->getMethod(),
184
+ $request->getHeaders(),
185
+ $requestBody->getBody(),
186
+ ];
187
+ }
188
+
189
+ /**
190
+ * Makes the request to Graph and returns the result.
191
+ *
192
+ * @param FacebookRequest $request
193
+ *
194
+ * @return FacebookResponse
195
+ *
196
+ * @throws FacebookSDKException
197
+ */
198
+ public function sendRequest(FacebookRequest $request)
199
+ {
200
+ if (get_class($request) === 'FacebookRequest') {
201
+ $request->validateAccessToken();
202
+ }
203
+
204
+ list($url, $method, $headers, $body) = $this->prepareRequestMessage($request);
205
+
206
+ // Since file uploads can take a while, we need to give more time for uploads
207
+ $timeOut = static::DEFAULT_REQUEST_TIMEOUT;
208
+ if ($request->containsFileUploads()) {
209
+ $timeOut = static::DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT;
210
+ } elseif ($request->containsVideoUploads()) {
211
+ $timeOut = static::DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT;
212
+ }
213
+
214
+ // Should throw `FacebookSDKException` exception on HTTP client error.
215
+ // Don't catch to allow it to bubble up.
216
+ $rawResponse = $this->httpClientHandler->send($url, $method, $body, $headers, $timeOut);
217
+
218
+ static::$requestCount++;
219
+
220
+ $returnResponse = new FacebookResponse(
221
+ $request,
222
+ $rawResponse->getBody(),
223
+ $rawResponse->getHttpResponseCode(),
224
+ $rawResponse->getHeaders()
225
+ );
226
+
227
+ if ($returnResponse->isError()) {
228
+ throw $returnResponse->getThrownException();
229
+ }
230
+
231
+ return $returnResponse;
232
+ }
233
+
234
+ /**
235
+ * Makes a batched request to Graph and returns the result.
236
+ *
237
+ * @param FacebookBatchRequest $request
238
+ *
239
+ * @return FacebookBatchResponse
240
+ *
241
+ * @throws FacebookSDKException
242
+ */
243
+ public function sendBatchRequest(FacebookBatchRequest $request)
244
+ {
245
+ $request->prepareRequestsForBatch();
246
+ $facebookResponse = $this->sendRequest($request);
247
+
248
+ return new FacebookBatchResponse($request, $facebookResponse);
249
+ }
250
+ }
framework/facebook-sdk/src/Facebook/FacebookRequest.php ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\Authentication\AccessToken;
27
+ use Facebook\Url\FacebookUrlManipulator;
28
+ use Facebook\FileUpload\FacebookFile;
29
+ use Facebook\FileUpload\FacebookVideo;
30
+ use Facebook\Http\RequestBodyMultipart;
31
+ use Facebook\Http\RequestBodyUrlEncoded;
32
+ use Facebook\Exceptions\FacebookSDKException;
33
+
34
+ /**
35
+ * Class Request
36
+ *
37
+ * @package Facebook
38
+ */
39
+ class FacebookRequest
40
+ {
41
+ /**
42
+ * @var FacebookApp The Facebook app entity.
43
+ */
44
+ protected $app;
45
+
46
+ /**
47
+ * @var string|null The access token to use for this request.
48
+ */
49
+ protected $accessToken;
50
+
51
+ /**
52
+ * @var string The HTTP method for this request.
53
+ */
54
+ protected $method;
55
+
56
+ /**
57
+ * @var string The Graph endpoint for this request.
58
+ */
59
+ protected $endpoint;
60
+
61
+ /**
62
+ * @var array The headers to send with this request.
63
+ */
64
+ protected $headers = [];
65
+
66
+ /**
67
+ * @var array The parameters to send with this request.
68
+ */
69
+ protected $params = [];
70
+
71
+ /**
72
+ * @var array The files to send with this request.
73
+ */
74
+ protected $files = [];
75
+
76
+ /**
77
+ * @var string ETag to send with this request.
78
+ */
79
+ protected $eTag;
80
+
81
+ /**
82
+ * @var string Graph version to use for this request.
83
+ */
84
+ protected $graphVersion;
85
+
86
+ /**
87
+ * Creates a new Request entity.
88
+ *
89
+ * @param FacebookApp|null $app
90
+ * @param AccessToken|string|null $accessToken
91
+ * @param string|null $method
92
+ * @param string|null $endpoint
93
+ * @param array|null $params
94
+ * @param string|null $eTag
95
+ * @param string|null $graphVersion
96
+ */
97
+ public function __construct(FacebookApp $app = null, $accessToken = null, $method = null, $endpoint = null, array $params = [], $eTag = null, $graphVersion = null)
98
+ {
99
+ $this->setApp($app);
100
+ $this->setAccessToken($accessToken);
101
+ $this->setMethod($method);
102
+ $this->setEndpoint($endpoint);
103
+ $this->setParams($params);
104
+ $this->setETag($eTag);
105
+ $this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
106
+ }
107
+
108
+ /**
109
+ * Set the access token for this request.
110
+ *
111
+ * @param AccessToken|string
112
+ *
113
+ * @return FacebookRequest
114
+ */
115
+ public function setAccessToken($accessToken)
116
+ {
117
+ $this->accessToken = $accessToken;
118
+ if ($accessToken instanceof AccessToken) {
119
+ $this->accessToken = $accessToken->getValue();
120
+ }
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Sets the access token with one harvested from a URL or POST params.
127
+ *
128
+ * @param string $accessToken The access token.
129
+ *
130
+ * @return FacebookRequest
131
+ *
132
+ * @throws FacebookSDKException
133
+ */
134
+ public function setAccessTokenFromParams($accessToken)
135
+ {
136
+ $existingAccessToken = $this->getAccessToken();
137
+ if (!$existingAccessToken) {
138
+ $this->setAccessToken($accessToken);
139
+ } elseif ($accessToken !== $existingAccessToken) {
140
+ throw new FacebookSDKException('Access token mismatch. The access token provided in the FacebookRequest and the one provided in the URL or POST params do not match.');
141
+ }
142
+
143
+ return $this;
144
+ }
145
+
146
+ /**
147
+ * Return the access token for this request.
148
+ *
149
+ * @return string|null
150
+ */
151
+ public function getAccessToken()
152
+ {
153
+ return $this->accessToken;
154
+ }
155
+
156
+ /**
157
+ * Return the access token for this request an an AccessToken entity.
158
+ *
159
+ * @return AccessToken|null
160
+ */
161
+ public function getAccessTokenEntity()
162
+ {
163
+ return $this->accessToken ? new AccessToken($this->accessToken) : null;
164
+ }
165
+
166
+ /**
167
+ * Set the FacebookApp entity used for this request.
168
+ *
169
+ * @param FacebookApp|null $app
170
+ */
171
+ public function setApp(FacebookApp $app = null)
172
+ {
173
+ $this->app = $app;
174
+ }
175
+
176
+ /**
177
+ * Return the FacebookApp entity used for this request.
178
+ *
179
+ * @return FacebookApp
180
+ */
181
+ public function getApp()
182
+ {
183
+ return $this->app;
184
+ }
185
+
186
+ /**
187
+ * Generate an app secret proof to sign this request.
188
+ *
189
+ * @return string|null
190
+ */
191
+ public function getAppSecretProof()
192
+ {
193
+ if (!$accessTokenEntity = $this->getAccessTokenEntity()) {
194
+ return null;
195
+ }
196
+
197
+ return $accessTokenEntity->getAppSecretProof($this->app->getSecret());
198
+ }
199
+
200
+ /**
201
+ * Validate that an access token exists for this request.
202
+ *
203
+ * @throws FacebookSDKException
204
+ */
205
+ public function validateAccessToken()
206
+ {
207
+ $accessToken = $this->getAccessToken();
208
+ if (!$accessToken) {
209
+ throw new FacebookSDKException('You must provide an access token.');
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Set the HTTP method for this request.
215
+ *
216
+ * @param string
217
+ *
218
+ * @return FacebookRequest
219
+ */
220
+ public function setMethod($method)
221
+ {
222
+ $this->method = strtoupper($method);
223
+ }
224
+
225
+ /**
226
+ * Return the HTTP method for this request.
227
+ *
228
+ * @return string
229
+ */
230
+ public function getMethod()
231
+ {
232
+ return $this->method;
233
+ }
234
+
235
+ /**
236
+ * Validate that the HTTP method is set.
237
+ *
238
+ * @throws FacebookSDKException
239
+ */
240
+ public function validateMethod()
241
+ {
242
+ if (!$this->method) {
243
+ throw new FacebookSDKException('HTTP method not specified.');
244
+ }
245
+
246
+ if (!in_array($this->method, ['GET', 'POST', 'DELETE'])) {
247
+ throw new FacebookSDKException('Invalid HTTP method specified.');
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Set the endpoint for this request.
253
+ *
254
+ * @param string
255
+ *
256
+ * @return FacebookRequest
257
+ *
258
+ * @throws FacebookSDKException
259
+ */
260
+ public function setEndpoint($endpoint)
261
+ {
262
+ // Harvest the access token from the endpoint to keep things in sync
263
+ $params = FacebookUrlManipulator::getParamsAsArray($endpoint);
264
+ if (isset($params['access_token'])) {
265
+ $this->setAccessTokenFromParams($params['access_token']);
266
+ }
267
+
268
+ // Clean the token & app secret proof from the endpoint.
269
+ $filterParams = ['access_token', 'appsecret_proof'];
270
+ $this->endpoint = FacebookUrlManipulator::removeParamsFromUrl($endpoint, $filterParams);
271
+
272
+ return $this;
273
+ }
274
+
275
+ /**
276
+ * Return the HTTP method for this request.
277
+ *
278
+ * @return string
279
+ */
280
+ public function getEndpoint()
281
+ {
282
+ // For batch requests, this will be empty
283
+ return $this->endpoint;
284
+ }
285
+
286
+ /**
287
+ * Generate and return the headers for this request.
288
+ *
289
+ * @return array
290
+ */
291
+ public function getHeaders()
292
+ {
293
+ $headers = static::getDefaultHeaders();
294
+
295
+ if ($this->eTag) {
296
+ $headers['If-None-Match'] = $this->eTag;
297
+ }
298
+
299
+ return array_merge($this->headers, $headers);
300
+ }
301
+
302
+ /**
303
+ * Set the headers for this request.
304
+ *
305
+ * @param array $headers
306
+ */
307
+ public function setHeaders(array $headers)
308
+ {
309
+ $this->headers = array_merge($this->headers, $headers);
310
+ }
311
+
312
+ /**
313
+ * Sets the eTag value.
314
+ *
315
+ * @param string $eTag
316
+ */
317
+ public function setETag($eTag)
318
+ {
319
+ $this->eTag = $eTag;
320
+ }
321
+
322
+ /**
323
+ * Set the params for this request.
324
+ *
325
+ * @param array $params
326
+ *
327
+ * @return FacebookRequest
328
+ *
329
+ * @throws FacebookSDKException
330
+ */
331
+ public function setParams(array $params = [])
332
+ {
333
+ if (isset($params['access_token'])) {
334
+ $this->setAccessTokenFromParams($params['access_token']);
335
+ }
336
+
337
+ // Don't let these buggers slip in.
338
+ unset($params['access_token'], $params['appsecret_proof']);
339
+
340
+ // @TODO Refactor code above with this
341
+ //$params = $this->sanitizeAuthenticationParams($params);
342
+ $params = $this->sanitizeFileParams($params);
343
+ $this->dangerouslySetParams($params);
344
+
345
+ return $this;
346
+ }
347
+
348
+ /**
349
+ * Set the params for this request without filtering them first.
350
+ *
351
+ * @param array $params
352
+ *
353
+ * @return FacebookRequest
354
+ */
355
+ public function dangerouslySetParams(array $params = [])
356
+ {
357
+ $this->params = array_merge($this->params, $params);
358
+
359
+ return $this;
360
+ }
361
+
362
+ /**
363
+ * Iterate over the params and pull out the file uploads.
364
+ *
365
+ * @param array $params
366
+ *
367
+ * @return array
368
+ */
369
+ public function sanitizeFileParams(array $params)
370
+ {
371
+ foreach ($params as $key => $value) {
372
+ if ($value instanceof FacebookFile) {
373
+ $this->addFile($key, $value);
374
+ unset($params[$key]);
375
+ }
376
+ }
377
+
378
+ return $params;
379
+ }
380
+
381
+ /**
382
+ * Add a file to be uploaded.
383
+ *
384
+ * @param string $key
385
+ * @param FacebookFile $file
386
+ */
387
+ public function addFile($key, FacebookFile $file)
388
+ {
389
+ $this->files[$key] = $file;
390
+ }
391
+
392
+ /**
393
+ * Removes all the files from the upload queue.
394
+ */
395
+ public function resetFiles()
396
+ {
397
+ $this->files = [];
398
+ }
399
+
400
+ /**
401
+ * Get the list of files to be uploaded.
402
+ *
403
+ * @return array
404
+ */
405
+ public function getFiles()
406
+ {
407
+ return $this->files;
408
+ }
409
+
410
+ /**
411
+ * Let's us know if there is a file upload with this request.
412
+ *
413
+ * @return boolean
414
+ */
415
+ public function containsFileUploads()
416
+ {
417
+ return !empty($this->files);
418
+ }
419
+
420
+ /**
421
+ * Let's us know if there is a video upload with this request.
422
+ *
423
+ * @return boolean
424
+ */
425
+ public function containsVideoUploads()
426
+ {
427
+ foreach ($this->files as $file) {
428
+ if ($file instanceof FacebookVideo) {
429
+ return true;
430
+ }
431
+ }
432
+
433
+ return false;
434
+ }
435
+
436
+ /**
437
+ * Returns the body of the request as multipart/form-data.
438
+ *
439
+ * @return RequestBodyMultipart
440
+ */
441
+ public function getMultipartBody()
442
+ {
443
+ $params = $this->getPostParams();
444
+
445
+ return new RequestBodyMultipart($params, $this->files);
446
+ }
447
+
448
+ /**
449
+ * Returns the body of the request as URL-encoded.
450
+ *
451
+ * @return RequestBodyUrlEncoded
452
+ */
453
+ public function getUrlEncodedBody()
454
+ {
455
+ $params = $this->getPostParams();
456
+
457
+ return new RequestBodyUrlEncoded($params);
458
+ }
459
+
460
+ /**
461
+ * Generate and return the params for this request.
462
+ *
463
+ * @return array
464
+ */
465
+ public function getParams()
466
+ {
467
+ $params = $this->params;
468
+
469
+ $accessToken = $this->getAccessToken();
470
+ if ($accessToken) {
471
+ $params['access_token'] = $accessToken;
472
+ $params['appsecret_proof'] = $this->getAppSecretProof();
473
+ }
474
+
475
+ return $params;
476
+ }
477
+
478
+ /**
479
+ * Only return params on POST requests.
480
+ *
481
+ * @return array
482
+ */
483
+ public function getPostParams()
484
+ {
485
+ if ($this->getMethod() === 'POST') {
486
+ return $this->getParams();
487
+ }
488
+
489
+ return [];
490
+ }
491
+
492
+ /**
493
+ * The graph version used for this request.
494
+ *
495
+ * @return string
496
+ */
497
+ public function getGraphVersion()
498
+ {
499
+ return $this->graphVersion;
500
+ }
501
+
502
+ /**
503
+ * Generate and return the URL for this request.
504
+ *
505
+ * @return string
506
+ */
507
+ public function getUrl()
508
+ {
509
+ $this->validateMethod();
510
+
511
+ $graphVersion = FacebookUrlManipulator::forceSlashPrefix($this->graphVersion);
512
+ $endpoint = FacebookUrlManipulator::forceSlashPrefix($this->getEndpoint());
513
+
514
+ $url = $graphVersion . $endpoint;
515
+
516
+ if ($this->getMethod() !== 'POST') {
517
+ $params = $this->getParams();
518
+ $url = FacebookUrlManipulator::appendParamsToUrl($url, $params);
519
+ }
520
+
521
+ return $url;
522
+ }
523
+
524
+ /**
525
+ * Return the default headers that every request should use.
526
+ *
527
+ * @return array
528
+ */
529
+ public static function getDefaultHeaders()
530
+ {
531
+ return [
532
+ 'User-Agent' => 'fb-php-' . Facebook::VERSION,
533
+ 'Accept-Encoding' => '*',
534
+ ];
535
+ }
536
+ }
framework/facebook-sdk/src/Facebook/FacebookResponse.php ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\GraphNodes\GraphNodeFactory;
27
+ use Facebook\Exceptions\FacebookResponseException;
28
+ use Facebook\Exceptions\FacebookSDKException;
29
+
30
+ /**
31
+ * Class FacebookResponse
32
+ *
33
+ * @package Facebook
34
+ */
35
+ class FacebookResponse
36
+ {
37
+ /**
38
+ * @var int The HTTP status code response from Graph.
39
+ */
40
+ protected $httpStatusCode;
41
+
42
+ /**
43
+ * @var array The headers returned from Graph.
44
+ */
45
+ protected $headers;
46
+
47
+ /**
48
+ * @var string The raw body of the response from Graph.
49
+ */
50
+ protected $body;
51
+
52
+ /**
53
+ * @var array The decoded body of the Graph response.
54
+ */
55
+ protected $decodedBody = [];
56
+
57
+ /**
58
+ * @var FacebookRequest The original request that returned this response.
59
+ */
60
+ protected $request;
61
+
62
+ /**
63
+ * @var FacebookSDKException The exception thrown by this request.
64
+ */
65
+ protected $thrownException;
66
+
67
+ /**
68
+ * Creates a new Response entity.
69
+ *
70
+ * @param FacebookRequest $request
71
+ * @param string|null $body
72
+ * @param int|null $httpStatusCode
73
+ * @param array|null $headers
74
+ */
75
+ public function __construct(FacebookRequest $request, $body = null, $httpStatusCode = null, array $headers = [])
76
+ {
77
+ $this->request = $request;
78
+ $this->body = $body;
79
+ $this->httpStatusCode = $httpStatusCode;
80
+ $this->headers = $headers;
81
+
82
+ $this->decodeBody();
83
+ }
84
+
85
+ /**
86
+ * Return the original request that returned this response.
87
+ *
88
+ * @return FacebookRequest
89
+ */
90
+ public function getRequest()
91
+ {
92
+ return $this->request;
93
+ }
94
+
95
+ /**
96
+ * Return the FacebookApp entity used for this response.
97
+ *
98
+ * @return FacebookApp
99
+ */
100
+ public function getApp()
101
+ {
102
+ return $this->request->getApp();
103
+ }
104
+
105
+ /**
106
+ * Return the access token that was used for this response.
107
+ *
108
+ * @return string|null
109
+ */
110
+ public function getAccessToken()
111
+ {
112
+ return $this->request->getAccessToken();
113
+ }
114
+
115
+ /**
116
+ * Return the HTTP status code for this response.
117
+ *
118
+ * @return int
119
+ */
120
+ public function getHttpStatusCode()
121
+ {
122
+ return $this->httpStatusCode;
123
+ }
124
+
125
+ /**
126
+ * Return the HTTP headers for this response.
127
+ *
128
+ * @return array
129
+ */
130
+ public function getHeaders()
131
+ {
132
+ return $this->headers;
133
+ }
134
+
135
+ /**
136
+ * Return the raw body response.
137
+ *
138
+ * @return string
139
+ */
140
+ public function getBody()
141
+ {
142
+ return $this->body;
143
+ }
144
+
145
+ /**
146
+ * Return the decoded body response.
147
+ *
148
+ * @return array
149
+ */
150
+ public function getDecodedBody()
151
+ {
152
+ return $this->decodedBody;
153
+ }
154
+
155
+ /**
156
+ * Get the app secret proof that was used for this response.
157
+ *
158
+ * @return string|null
159
+ */
160
+ public function getAppSecretProof()
161
+ {
162
+ return $this->request->getAppSecretProof();
163
+ }
164
+
165
+ /**
166
+ * Get the ETag associated with the response.
167
+ *
168
+ * @return string|null
169
+ */
170
+ public function getETag()
171
+ {
172
+ return isset($this->headers['ETag']) ? $this->headers['ETag'] : null;
173
+ }
174
+
175
+ /**
176
+ * Get the version of Graph that returned this response.
177
+ *
178
+ * @return string|null
179
+ */
180
+ public function getGraphVersion()
181
+ {
182
+ return isset($this->headers['Facebook-API-Version']) ? $this->headers['Facebook-API-Version'] : null;
183
+ }
184
+
185
+ /**
186
+ * Returns true if Graph returned an error message.
187
+ *
188
+ * @return boolean
189
+ */
190
+ public function isError()
191
+ {
192
+ return isset($this->decodedBody['error']);
193
+ }
194
+
195
+ /**
196
+ * Throws the exception.
197
+ *
198
+ * @throws FacebookSDKException
199
+ */
200
+ public function throwException()
201
+ {
202
+ throw $this->thrownException;
203
+ }
204
+
205
+ /**
206
+ * Instantiates an exception to be thrown later.
207
+ */
208
+ public function makeException()
209
+ {
210
+ $this->thrownException = FacebookResponseException::create($this);
211
+ }
212
+
213
+ /**
214
+ * Returns the exception that was thrown for this request.
215
+ *
216
+ * @return FacebookSDKException|null
217
+ */
218
+ public function getThrownException()
219
+ {
220
+ return $this->thrownException;
221
+ }
222
+
223
+ /**
224
+ * Convert the raw response into an array if possible.
225
+ *
226
+ * Graph will return 2 types of responses:
227
+ * - JSON(P)
228
+ * Most responses from Grpah are JSON(P)
229
+ * - application/x-www-form-urlencoded key/value pairs
230
+ * Happens on the `/oauth/access_token` endpoint when exchanging
231
+ * a short-lived access token for a long-lived access token
232
+ * - And sometimes nothing :/ but that'd be a bug.
233
+ */
234
+ public function decodeBody()
235
+ {
236
+ $this->decodedBody = json_decode($this->body, true);
237
+
238
+ if ($this->decodedBody === null) {
239
+ $this->decodedBody = [];
240
+ parse_str($this->body, $this->decodedBody);
241
+ } elseif (is_bool($this->decodedBody)) {
242
+ // Backwards compatibility for Graph < 2.1.
243
+ // Mimics 2.1 responses.
244
+ // @TODO Remove this after Graph 2.0 is no longer supported
245
+ $this->decodedBody = ['success' => $this->decodedBody];
246
+ } elseif (is_numeric($this->decodedBody)) {
247
+ $this->decodedBody = ['id' => $this->decodedBody];
248
+ }
249
+
250
+ if (!is_array($this->decodedBody)) {
251
+ $this->decodedBody = [];
252
+ }
253
+
254
+ if ($this->isError()) {
255
+ $this->makeException();
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Instantiate a new GraphObject from response.
261
+ *
262
+ * @param string|null $subclassName The GraphNode sub class to cast to.
263
+ *
264
+ * @return \Facebook\GraphNodes\GraphObject
265
+ *
266
+ * @throws FacebookSDKException
267
+ *
268
+ * @deprecated 5.0.0 getGraphObject() has been renamed to getGraphNode()
269
+ * @todo v6: Remove this method
270
+ */
271
+ public function getGraphObject($subclassName = null)
272
+ {
273
+ return $this->getGraphNode($subclassName);
274
+ }
275
+
276
+ /**
277
+ * Instantiate a new GraphNode from response.
278
+ *
279
+ * @param string|null $subclassName The GraphNode sub class to cast to.
280
+ *
281
+ * @return \Facebook\GraphNodes\GraphNode
282
+ *
283
+ * @throws FacebookSDKException
284
+ */
285
+ public function getGraphNode($subclassName = null)
286
+ {
287
+ $factory = new GraphNodeFactory($this);
288
+
289
+ return $factory->makeGraphNode($subclassName);
290
+ }
291
+
292
+ /**
293
+ * Convenience method for creating a GraphAlbum collection.
294
+ *
295
+ * @return \Facebook\GraphNodes\GraphAlbum
296
+ *
297
+ * @throws FacebookSDKException
298
+ */
299
+ public function getGraphAlbum()
300
+ {
301
+ $factory = new GraphNodeFactory($this);
302
+
303
+ return $factory->makeGraphAlbum();
304
+ }
305
+
306
+ /**
307
+ * Convenience method for creating a GraphPage collection.
308
+ *
309
+ * @return \Facebook\GraphNodes\GraphPage
310
+ *
311
+ * @throws FacebookSDKException
312
+ */
313
+ public function getGraphPage()
314
+ {
315
+ $factory = new GraphNodeFactory($this);
316
+
317
+ return $factory->makeGraphPage();
318
+ }
319
+
320
+ /**
321
+ * Convenience method for creating a GraphSessionInfo collection.
322
+ *
323
+ * @return \Facebook\GraphNodes\GraphSessionInfo
324
+ *
325
+ * @throws FacebookSDKException
326
+ */
327
+ public function getGraphSessionInfo()
328
+ {
329
+ $factory = new GraphNodeFactory($this);
330
+
331
+ return $factory->makeGraphSessionInfo();
332
+ }
333
+
334
+ /**
335
+ * Convenience method for creating a GraphUser collection.
336
+ *
337
+ * @return \Facebook\GraphNodes\GraphUser
338
+ *
339
+ * @throws FacebookSDKException
340
+ */
341
+ public function getGraphUser()
342
+ {
343
+ $factory = new GraphNodeFactory($this);
344
+
345
+ return $factory->makeGraphUser();
346
+ }
347
+
348
+ /**
349
+ * Convenience method for creating a GraphEvent collection.
350
+ *
351
+ * @return \Facebook\GraphNodes\GraphEvent
352
+ *
353
+ * @throws FacebookSDKException
354
+ */
355
+ public function getGraphEvent()
356
+ {
357
+ $factory = new GraphNodeFactory($this);
358
+
359
+ return $factory->makeGraphEvent();
360
+ }
361
+
362
+ /**
363
+ * Convenience method for creating a GraphGroup collection.
364
+ *
365
+ * @return \Facebook\GraphNodes\GraphGroup
366
+ *
367
+ * @throws FacebookSDKException
368
+ */
369
+ public function getGraphGroup()
370
+ {
371
+ $factory = new GraphNodeFactory($this);
372
+
373
+ return $factory->makeGraphGroup();
374
+ }
375
+
376
+ /**
377
+ * Instantiate a new GraphList from response.
378
+ *
379
+ * @param string|null $subclassName The GraphNode sub class to cast list items to.
380
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
381
+ *
382
+ * @return \Facebook\GraphNodes\GraphList
383
+ *
384
+ * @throws FacebookSDKException
385
+ *
386
+ * @deprecated 5.0.0 getGraphList() has been renamed to getGraphEdge()
387
+ * @todo v6: Remove this method
388
+ */
389
+ public function getGraphList($subclassName = null, $auto_prefix = true)
390
+ {
391
+ return $this->getGraphEdge($subclassName, $auto_prefix);
392
+ }
393
+
394
+ /**
395
+ * Instantiate a new GraphEdge from response.
396
+ *
397
+ * @param string|null $subclassName The GraphNode sub class to cast list items to.
398
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
399
+ *
400
+ * @return \Facebook\GraphNodes\GraphEdge
401
+ *
402
+ * @throws FacebookSDKException
403
+ */
404
+ public function getGraphEdge($subclassName = null, $auto_prefix = true)
405
+ {
406
+ $factory = new GraphNodeFactory($this);
407
+
408
+ return $factory->makeGraphEdge($subclassName, $auto_prefix);
409
+ }
410
+ }
framework/facebook-sdk/src/Facebook/FileUpload/FacebookFile.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\FileUpload;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ /**
29
+ * Class FacebookFile
30
+ *
31
+ * @package Facebook
32
+ */
33
+ class FacebookFile
34
+ {
35
+ /**
36
+ * @var string The path to the file on the system.
37
+ */
38
+ protected $path;
39
+
40
+ /**
41
+ * @var resource The stream pointing to the file.
42
+ */
43
+ protected $stream;
44
+
45
+ /**
46
+ * Creates a new FacebookFile entity.
47
+ *
48
+ * @param string $filePath
49
+ *
50
+ * @throws FacebookSDKException
51
+ */
52
+ public function __construct($filePath)
53
+ {
54
+ $this->path = $filePath;
55
+ $this->open();
56
+ }
57
+
58
+ /**
59
+ * Closes the stream when destructed.
60
+ */
61
+ public function __destruct()
62
+ {
63
+ $this->close();
64
+ }
65
+
66
+ /**
67
+ * Opens a stream for the file.
68
+ *
69
+ * @throws FacebookSDKException
70
+ */
71
+ public function open()
72
+ {
73
+ if (!$this->isRemoteFile($this->path) && !is_readable($this->path)) {
74
+ throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to read resource: ' . $this->path . '.');
75
+ }
76
+
77
+ $this->stream = fopen($this->path, 'r');
78
+
79
+ if (!$this->stream) {
80
+ throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to open resource: ' . $this->path . '.');
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Stops the file stream.
86
+ */
87
+ public function close()
88
+ {
89
+ if (is_resource($this->stream)) {
90
+ fclose($this->stream);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Return the contents of the file.
96
+ *
97
+ * @return string
98
+ */
99
+ public function getContents()
100
+ {
101
+ return stream_get_contents($this->stream);
102
+ }
103
+
104
+ /**
105
+ * Return the name of the file.
106
+ *
107
+ * @return string
108
+ */
109
+ public function getFileName()
110
+ {
111
+ return basename($this->path);
112
+ }
113
+
114
+ /**
115
+ * Return the mimetype of the file.
116
+ *
117
+ * @return string
118
+ */
119
+ public function getMimetype()
120
+ {
121
+ return Mimetypes::getInstance()->fromFilename($this->path) ?: 'text/plain';
122
+ }
123
+
124
+ /**
125
+ * Returns true if the path to the file is remote.
126
+ *
127
+ * @param string $pathToFile
128
+ *
129
+ * @return boolean
130
+ */
131
+ protected function isRemoteFile($pathToFile)
132
+ {
133
+ return preg_match('/^(https?|ftp):\/\/.*/', $pathToFile) === 1;
134
+ }
135
+ }
framework/facebook-sdk/src/Facebook/FileUpload/FacebookVideo.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\FileUpload;
25
+
26
+ /**
27
+ * Class FacebookVideo
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookVideo extends FacebookFile
32
+ {
33
+ }
framework/facebook-sdk/src/Facebook/FileUpload/Mimetypes.php ADDED
@@ -0,0 +1,987 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\FileUpload;
25
+
26
+ /**
27
+ * Provides mappings of file extensions to mimetypes
28
+ *
29
+ * Taken from Guzzle
30
+ *
31
+ * @see https://github.com/guzzle/guzzle/blob/master/src/Mimetypes.php
32
+ *
33
+ * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
34
+ */
35
+ class Mimetypes
36
+ {
37
+ /** @var self */
38
+ protected static $instance;
39
+
40
+ /** @var array Mapping of extension to mimetype */
41
+ protected $mimetypes = [
42
+ '3dml' => 'text/vnd.in3d.3dml',
43
+ '3g2' => 'video/3gpp2',
44
+ '3gp' => 'video/3gpp',
45
+ '7z' => 'application/x-7z-compressed',
46
+ 'aab' => 'application/x-authorware-bin',
47
+ 'aac' => 'audio/x-aac',
48
+ 'aam' => 'application/x-authorware-map',
49
+ 'aas' => 'application/x-authorware-seg',
50
+ 'abw' => 'application/x-abiword',
51
+ 'ac' => 'application/pkix-attr-cert',
52
+ 'acc' => 'application/vnd.americandynamics.acc',
53
+ 'ace' => 'application/x-ace-compressed',
54
+ 'acu' => 'application/vnd.acucobol',
55
+ 'acutc' => 'application/vnd.acucorp',
56
+ 'adp' => 'audio/adpcm',
57
+ 'aep' => 'application/vnd.audiograph',
58
+ 'afm' => 'application/x-font-type1',
59
+ 'afp' => 'application/vnd.ibm.modcap',
60
+ 'ahead' => 'application/vnd.ahead.space',
61
+ 'ai' => 'application/postscript',
62
+ 'aif' => 'audio/x-aiff',
63
+ 'aifc' => 'audio/x-aiff',
64
+ 'aiff' => 'audio/x-aiff',
65
+ 'air' => 'application/vnd.adobe.air-application-installer-package+zip',
66
+ 'ait' => 'application/vnd.dvb.ait',
67
+ 'ami' => 'application/vnd.amiga.ami',
68
+ 'apk' => 'application/vnd.android.package-archive',
69
+ 'application' => 'application/x-ms-application',
70
+ 'apr' => 'application/vnd.lotus-approach',
71
+ 'asa' => 'text/plain',
72
+ 'asax' => 'application/octet-stream',
73
+ 'asc' => 'application/pgp-signature',
74
+ 'ascx' => 'text/plain',
75
+ 'asf' => 'video/x-ms-asf',
76
+ 'ashx' => 'text/plain',
77
+ 'asm' => 'text/x-asm',
78
+ 'asmx' => 'text/plain',
79
+ 'aso' => 'application/vnd.accpac.simply.aso',
80
+ 'asp' => 'text/plain',
81
+ 'aspx' => 'text/plain',
82
+ 'asx' => 'video/x-ms-asf',
83
+ 'atc' => 'application/vnd.acucorp',
84
+ 'atom' => 'application/atom+xml',
85
+ 'atomcat' => 'application/atomcat+xml',
86
+ 'atomsvc' => 'application/atomsvc+xml',
87
+ 'atx' => 'application/vnd.antix.game-component',
88
+ 'au' => 'audio/basic',
89
+ 'avi' => 'video/x-msvideo',
90
+ 'aw' => 'application/applixware',
91
+ 'axd' => 'text/plain',
92
+ 'azf' => 'application/vnd.airzip.filesecure.azf',
93
+ 'azs' => 'application/vnd.airzip.filesecure.azs',
94
+ 'azw' => 'application/vnd.amazon.ebook',
95
+ 'bat' => 'application/x-msdownload',
96
+ 'bcpio' => 'application/x-bcpio',
97
+ 'bdf' => 'application/x-font-bdf',
98
+ 'bdm' => 'application/vnd.syncml.dm+wbxml',
99
+ 'bed' => 'application/vnd.realvnc.bed',
100
+ 'bh2' => 'application/vnd.fujitsu.oasysprs',
101
+ 'bin' => 'application/octet-stream',
102
+ 'bmi' => 'application/vnd.bmi',
103
+ 'bmp' => 'image/bmp',
104
+ 'book' => 'application/vnd.framemaker',
105
+ 'box' => 'application/vnd.previewsystems.box',
106
+ 'boz' => 'application/x-bzip2',
107
+ 'bpk' => 'application/octet-stream',
108
+ 'btif' => 'image/prs.btif',
109
+ 'bz' => 'application/x-bzip',
110
+ 'bz2' => 'application/x-bzip2',
111
+ 'c' => 'text/x-c',
112
+ 'c11amc' => 'application/vnd.cluetrust.cartomobile-config',
113
+ 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',
114
+ 'c4d' => 'application/vnd.clonk.c4group',
115
+ 'c4f' => 'application/vnd.clonk.c4group',
116
+ 'c4g' => 'application/vnd.clonk.c4group',
117
+ 'c4p' => 'application/vnd.clonk.c4group',
118
+ 'c4u' => 'application/vnd.clonk.c4group',
119
+ 'cab' => 'application/vnd.ms-cab-compressed',
120
+ 'car' => 'application/vnd.curl.car',
121
+ 'cat' => 'application/vnd.ms-pki.seccat',
122
+ 'cc' => 'text/x-c',
123
+ 'cct' => 'application/x-director',
124
+ 'ccxml' => 'application/ccxml+xml',
125
+ 'cdbcmsg' => 'application/vnd.contact.cmsg',
126
+ 'cdf' => 'application/x-netcdf',
127
+ 'cdkey' => 'application/vnd.mediastation.cdkey',
128
+ 'cdmia' => 'application/cdmi-capability',
129
+ 'cdmic' => 'application/cdmi-container',
130
+ 'cdmid' => 'application/cdmi-domain',
131
+ 'cdmio' => 'application/cdmi-object',
132
+ 'cdmiq' => 'application/cdmi-queue',
133
+ 'cdx' => 'chemical/x-cdx',
134
+ 'cdxml' => 'application/vnd.chemdraw+xml',
135
+ 'cdy' => 'application/vnd.cinderella',
136
+ 'cer' => 'application/pkix-cert',
137
+ 'cfc' => 'application/x-coldfusion',
138
+ 'cfm' => 'application/x-coldfusion',
139
+ 'cgm' => 'image/cgm',
140
+ 'chat' => 'application/x-chat',
141
+ 'chm' => 'application/vnd.ms-htmlhelp',
142
+ 'chrt' => 'application/vnd.kde.kchart',
143
+ 'cif' => 'chemical/x-cif',
144
+ 'cii' => 'application/vnd.anser-web-certificate-issue-initiation',
145
+ 'cil' => 'application/vnd.ms-artgalry',
146
+ 'cla' => 'application/vnd.claymore',
147
+ 'class' => 'application/java-vm',
148
+ 'clkk' => 'application/vnd.crick.clicker.keyboard',
149
+ 'clkp' => 'application/vnd.crick.clicker.palette',
150
+ 'clkt' => 'application/vnd.crick.clicker.template',
151
+ 'clkw' => 'application/vnd.crick.clicker.wordbank',
152
+ 'clkx' => 'application/vnd.crick.clicker',
153
+ 'clp' => 'application/x-msclip',
154
+ 'cmc' => 'application/vnd.cosmocaller',
155
+ 'cmdf' => 'chemical/x-cmdf',
156
+ 'cml' => 'chemical/x-cml',
157
+ 'cmp' => 'application/vnd.yellowriver-custom-menu',
158
+ 'cmx' => 'image/x-cmx',
159
+ 'cod' => 'application/vnd.rim.cod',
160
+ 'com' => 'application/x-msdownload',
161
+ 'conf' => 'text/plain',
162
+ 'cpio' => 'application/x-cpio',
163
+ 'cpp' => 'text/x-c',
164
+ 'cpt' => 'application/mac-compactpro',
165
+ 'crd' => 'application/x-mscardfile',
166
+ 'crl' => 'application/pkix-crl',
167
+ 'crt' => 'application/x-x509-ca-cert',
168
+ 'cryptonote' => 'application/vnd.rig.cryptonote',
169
+ 'cs' => 'text/plain',
170
+ 'csh' => 'application/x-csh',
171
+ 'csml' => 'chemical/x-csml',
172
+ 'csp' => 'application/vnd.commonspace',
173
+ 'css' => 'text/css',
174
+ 'cst' => 'application/x-director',
175
+ 'csv' => 'text/csv',
176
+ 'cu' => 'application/cu-seeme',
177
+ 'curl' => 'text/vnd.curl',
178
+ 'cww' => 'application/prs.cww',
179
+ 'cxt' => 'application/x-director',
180
+ 'cxx' => 'text/x-c',
181
+ 'dae' => 'model/vnd.collada+xml',
182
+ 'daf' => 'application/vnd.mobius.daf',
183
+ 'dataless' => 'application/vnd.fdsn.seed',
184
+ 'davmount' => 'application/davmount+xml',
185
+ 'dcr' => 'application/x-director',
186
+ 'dcurl' => 'text/vnd.curl.dcurl',
187
+ 'dd2' => 'application/vnd.oma.dd2+xml',
188
+ 'ddd' => 'application/vnd.fujixerox.ddd',
189
+ 'deb' => 'application/x-debian-package',
190
+ 'def' => 'text/plain',
191
+ 'deploy' => 'application/octet-stream',
192
+ 'der' => 'application/x-x509-ca-cert',
193
+ 'dfac' => 'application/vnd.dreamfactory',
194
+ 'dic' => 'text/x-c',
195
+ 'dir' => 'application/x-director',
196
+ 'dis' => 'application/vnd.mobius.dis',
197
+ 'dist' => 'application/octet-stream',
198
+ 'distz' => 'application/octet-stream',
199
+ 'djv' => 'image/vnd.djvu',
200
+ 'djvu' => 'image/vnd.djvu',
201
+ 'dll' => 'application/x-msdownload',
202
+ 'dmg' => 'application/octet-stream',
203
+ 'dms' => 'application/octet-stream',
204
+ 'dna' => 'application/vnd.dna',
205
+ 'doc' => 'application/msword',
206
+ 'docm' => 'application/vnd.ms-word.document.macroenabled.12',
207
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
208
+ 'dot' => 'application/msword',
209
+ 'dotm' => 'application/vnd.ms-word.template.macroenabled.12',
210
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
211
+ 'dp' => 'application/vnd.osgi.dp',
212
+ 'dpg' => 'application/vnd.dpgraph',
213
+ 'dra' => 'audio/vnd.dra',
214
+ 'dsc' => 'text/prs.lines.tag',
215
+ 'dssc' => 'application/dssc+der',
216
+ 'dtb' => 'application/x-dtbook+xml',
217
+ 'dtd' => 'application/xml-dtd',
218
+ 'dts' => 'audio/vnd.dts',
219
+ 'dtshd' => 'audio/vnd.dts.hd',
220
+ 'dump' => 'application/octet-stream',
221
+ 'dvi' => 'application/x-dvi',
222
+ 'dwf' => 'model/vnd.dwf',
223
+ 'dwg' => 'image/vnd.dwg',
224
+ 'dxf' => 'image/vnd.dxf',
225
+ 'dxp' => 'application/vnd.spotfire.dxp',
226
+ 'dxr' => 'application/x-director',
227
+ 'ecelp4800' => 'audio/vnd.nuera.ecelp4800',
228
+ 'ecelp7470' => 'audio/vnd.nuera.ecelp7470',
229
+ 'ecelp9600' => 'audio/vnd.nuera.ecelp9600',
230
+ 'ecma' => 'application/ecmascript',
231
+ 'edm' => 'application/vnd.novadigm.edm',
232
+ 'edx' => 'application/vnd.novadigm.edx',
233
+ 'efif' => 'application/vnd.picsel',
234
+ 'ei6' => 'application/vnd.pg.osasli',
235
+ 'elc' => 'application/octet-stream',
236
+ 'eml' => 'message/rfc822',
237
+ 'emma' => 'application/emma+xml',
238
+ 'eol' => 'audio/vnd.digital-winds',
239
+ 'eot' => 'application/vnd.ms-fontobject',
240
+ 'eps' => 'application/postscript',
241
+ 'epub' => 'application/epub+zip',
242
+ 'es3' => 'application/vnd.eszigno3+xml',
243
+ 'esf' => 'application/vnd.epson.esf',
244
+ 'et3' => 'application/vnd.eszigno3+xml',
245
+ 'etx' => 'text/x-setext',
246
+ 'exe' => 'application/x-msdownload',
247
+ 'exi' => 'application/exi',
248
+ 'ext' => 'application/vnd.novadigm.ext',
249
+ 'ez' => 'application/andrew-inset',
250
+ 'ez2' => 'application/vnd.ezpix-album',
251
+ 'ez3' => 'application/vnd.ezpix-package',
252
+ 'f' => 'text/x-fortran',
253
+ 'f4v' => 'video/x-f4v',
254
+ 'f77' => 'text/x-fortran',
255
+ 'f90' => 'text/x-fortran',
256
+ 'fbs' => 'image/vnd.fastbidsheet',
257
+ 'fcs' => 'application/vnd.isac.fcs',
258
+ 'fdf' => 'application/vnd.fdf',
259
+ 'fe_launch' => 'application/vnd.denovo.fcselayout-link',
260
+ 'fg5' => 'application/vnd.fujitsu.oasysgp',
261
+ 'fgd' => 'application/x-director',
262
+ 'fh' => 'image/x-freehand',
263
+ 'fh4' => 'image/x-freehand',
264
+ 'fh5' => 'image/x-freehand',
265
+ 'fh7' => 'image/x-freehand',
266
+ 'fhc' => 'image/x-freehand',
267
+ 'fig' => 'application/x-xfig',
268
+ 'fli' => 'video/x-fli',
269
+ 'flo' => 'application/vnd.micrografx.flo',
270
+ 'flv' => 'video/x-flv',
271
+ 'flw' => 'application/vnd.kde.kivio',
272
+ 'flx' => 'text/vnd.fmi.flexstor',
273
+ 'fly' => 'text/vnd.fly',
274
+ 'fm' => 'application/vnd.framemaker',
275
+ 'fnc' => 'application/vnd.frogans.fnc',
276
+ 'for' => 'text/x-fortran',
277
+ 'fpx' => 'image/vnd.fpx',
278
+ 'frame' => 'application/vnd.framemaker',
279
+ 'fsc' => 'application/vnd.fsc.weblaunch',
280
+ 'fst' => 'image/vnd.fst',
281
+ 'ftc' => 'application/vnd.fluxtime.clip',
282
+ 'fti' => 'application/vnd.anser-web-funds-transfer-initiation',
283
+ 'fvt' => 'video/vnd.fvt',
284
+ 'fxp' => 'application/vnd.adobe.fxp',
285
+ 'fxpl' => 'application/vnd.adobe.fxp',
286
+ 'fzs' => 'application/vnd.fuzzysheet',
287
+ 'g2w' => 'application/vnd.geoplan',
288
+ 'g3' => 'image/g3fax',
289
+ 'g3w' => 'application/vnd.geospace',
290
+ 'gac' => 'application/vnd.groove-account',
291
+ 'gdl' => 'model/vnd.gdl',
292
+ 'geo' => 'application/vnd.dynageo',
293
+ 'gex' => 'application/vnd.geometry-explorer',
294
+ 'ggb' => 'application/vnd.geogebra.file',
295
+ 'ggt' => 'application/vnd.geogebra.tool',
296
+ 'ghf' => 'application/vnd.groove-help',
297
+ 'gif' => 'image/gif',
298
+ 'gim' => 'application/vnd.groove-identity-message',
299
+ 'gmx' => 'application/vnd.gmx',
300
+ 'gnumeric' => 'application/x-gnumeric',
301
+ 'gph' => 'application/vnd.flographit',
302
+ 'gqf' => 'application/vnd.grafeq',
303
+ 'gqs' => 'application/vnd.grafeq',
304
+ 'gram' => 'application/srgs',
305
+ 'gre' => 'application/vnd.geometry-explorer',
306
+ 'grv' => 'application/vnd.groove-injector',
307
+ 'grxml' => 'application/srgs+xml',
308
+ 'gsf' => 'application/x-font-ghostscript',
309
+ 'gtar' => 'application/x-gtar',
310
+ 'gtm' => 'application/vnd.groove-tool-message',
311
+ 'gtw' => 'model/vnd.gtw',
312
+ 'gv' => 'text/vnd.graphviz',
313
+ 'gxt' => 'application/vnd.geonext',
314
+ 'h' => 'text/x-c',
315
+ 'h261' => 'video/h261',
316
+ 'h263' => 'video/h263',
317
+ 'h264' => 'video/h264',
318
+ 'hal' => 'application/vnd.hal+xml',
319
+ 'hbci' => 'application/vnd.hbci',
320
+ 'hdf' => 'application/x-hdf',
321
+ 'hh' => 'text/x-c',
322
+ 'hlp' => 'application/winhlp',
323
+ 'hpgl' => 'application/vnd.hp-hpgl',
324
+ 'hpid' => 'application/vnd.hp-hpid',
325
+ 'hps' => 'application/vnd.hp-hps',
326
+ 'hqx' => 'application/mac-binhex40',
327
+ 'hta' => 'application/octet-stream',
328
+ 'htc' => 'text/html',
329
+ 'htke' => 'application/vnd.kenameaapp',
330
+ 'htm' => 'text/html',
331
+ 'html' => 'text/html',
332
+ 'hvd' => 'application/vnd.yamaha.hv-dic',
333
+ 'hvp' => 'application/vnd.yamaha.hv-voice',
334
+ 'hvs' => 'application/vnd.yamaha.hv-script',
335
+ 'i2g' => 'application/vnd.intergeo',
336
+ 'icc' => 'application/vnd.iccprofile',
337
+ 'ice' => 'x-conference/x-cooltalk',
338
+ 'icm' => 'application/vnd.iccprofile',
339
+ 'ico' => 'image/x-icon',
340
+ 'ics' => 'text/calendar',
341
+ 'ief' => 'image/ief',
342
+ 'ifb' => 'text/calendar',
343
+ 'ifm' => 'application/vnd.shana.informed.formdata',
344
+ 'iges' => 'model/iges',
345
+ 'igl' => 'application/vnd.igloader',
346
+ 'igm' => 'application/vnd.insors.igm',
347
+ 'igs' => 'model/iges',
348
+ 'igx' => 'application/vnd.micrografx.igx',
349
+ 'iif' => 'application/vnd.shana.informed.interchange',
350
+ 'imp' => 'application/vnd.accpac.simply.imp',
351
+ 'ims' => 'application/vnd.ms-ims',
352
+ 'in' => 'text/plain',
353
+ 'ini' => 'text/plain',
354
+ 'ipfix' => 'application/ipfix',
355
+ 'ipk' => 'application/vnd.shana.informed.package',
356
+ 'irm' => 'application/vnd.ibm.rights-management',
357
+ 'irp' => 'application/vnd.irepository.package+xml',
358
+ 'iso' => 'application/octet-stream',
359
+ 'itp' => 'application/vnd.shana.informed.formtemplate',
360
+ 'ivp' => 'application/vnd.immervision-ivp',
361
+ 'ivu' => 'application/vnd.immervision-ivu',
362
+ 'jad' => 'text/vnd.sun.j2me.app-descriptor',
363
+ 'jam' => 'application/vnd.jam',
364
+ 'jar' => 'application/java-archive',
365
+ 'java' => 'text/x-java-source',
366
+ 'jisp' => 'application/vnd.jisp',
367
+ 'jlt' => 'application/vnd.hp-jlyt',
368
+ 'jnlp' => 'application/x-java-jnlp-file',
369
+ 'joda' => 'application/vnd.joost.joda-archive',
370
+ 'jpe' => 'image/jpeg',
371
+ 'jpeg' => 'image/jpeg',
372
+ 'jpg' => 'image/jpeg',
373
+ 'jpgm' => 'video/jpm',
374
+ 'jpgv' => 'video/jpeg',
375
+ 'jpm' => 'video/jpm',
376
+ 'js' => 'text/javascript',
377
+ 'json' => 'application/json',
378
+ 'kar' => 'audio/midi',
379
+ 'karbon' => 'application/vnd.kde.karbon',
380
+ 'kfo' => 'application/vnd.kde.kformula',
381
+ 'kia' => 'application/vnd.kidspiration',
382
+ 'kml' => 'application/vnd.google-earth.kml+xml',
383
+ 'kmz' => 'application/vnd.google-earth.kmz',
384
+ 'kne' => 'application/vnd.kinar',
385
+ 'knp' => 'application/vnd.kinar',
386
+ 'kon' => 'application/vnd.kde.kontour',
387
+ 'kpr' => 'application/vnd.kde.kpresenter',
388
+ 'kpt' => 'application/vnd.kde.kpresenter',
389
+ 'ksp' => 'application/vnd.kde.kspread',
390
+ 'ktr' => 'application/vnd.kahootz',
391
+ 'ktx' => 'image/ktx',
392
+ 'ktz' => 'application/vnd.kahootz',
393
+ 'kwd' => 'application/vnd.kde.kword',
394
+ 'kwt' => 'application/vnd.kde.kword',
395
+ 'lasxml' => 'application/vnd.las.las+xml',
396
+ 'latex' => 'application/x-latex',
397
+ 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop',
398
+ 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
399
+ 'les' => 'application/vnd.hhe.lesson-player',
400
+ 'lha' => 'application/octet-stream',
401
+ 'link66' => 'application/vnd.route66.link66+xml',
402
+ 'list' => 'text/plain',
403
+ 'list3820' => 'application/vnd.ibm.modcap',
404
+ 'listafp' => 'application/vnd.ibm.modcap',
405
+ 'log' => 'text/plain',
406
+ 'lostxml' => 'application/lost+xml',
407
+ 'lrf' => 'application/octet-stream',
408
+ 'lrm' => 'application/vnd.ms-lrm',
409
+ 'ltf' => 'application/vnd.frogans.ltf',
410
+ 'lvp' => 'audio/vnd.lucent.voice',
411
+ 'lwp' => 'application/vnd.lotus-wordpro',
412
+ 'lzh' => 'application/octet-stream',
413
+ 'm13' => 'application/x-msmediaview',
414
+ 'm14' => 'application/x-msmediaview',
415
+ 'm1v' => 'video/mpeg',
416
+ 'm21' => 'application/mp21',
417
+ 'm2a' => 'audio/mpeg',
418
+ 'm2v' => 'video/mpeg',
419
+ 'm3a' => 'audio/mpeg',
420
+ 'm3u' => 'audio/x-mpegurl',
421
+ 'm3u8' => 'application/vnd.apple.mpegurl',
422
+ 'm4a' => 'audio/mp4',
423
+ 'm4u' => 'video/vnd.mpegurl',
424
+ 'm4v' => 'video/mp4',
425
+ 'ma' => 'application/mathematica',
426
+ 'mads' => 'application/mads+xml',
427
+ 'mag' => 'application/vnd.ecowin.chart',
428
+ 'maker' => 'application/vnd.framemaker',
429
+ 'man' => 'text/troff',
430
+ 'mathml' => 'application/mathml+xml',
431
+ 'mb' => 'application/mathematica',
432
+ 'mbk' => 'application/vnd.mobius.mbk',
433
+ 'mbox' => 'application/mbox',
434
+ 'mc1' => 'application/vnd.medcalcdata',
435
+ 'mcd' => 'application/vnd.mcd',
436
+ 'mcurl' => 'text/vnd.curl.mcurl',
437
+ 'mdb' => 'application/x-msaccess',
438
+ 'mdi' => 'image/vnd.ms-modi',
439
+ 'me' => 'text/troff',
440
+ 'mesh' => 'model/mesh',
441
+ 'meta4' => 'application/metalink4+xml',
442
+ 'mets' => 'application/mets+xml',
443
+ 'mfm' => 'application/vnd.mfmp',
444
+ 'mgp' => 'application/vnd.osgeo.mapguide.package',
445
+ 'mgz' => 'application/vnd.proteus.magazine',
446
+ 'mid' => 'audio/midi',
447
+ 'midi' => 'audio/midi',
448
+ 'mif' => 'application/vnd.mif',
449
+ 'mime' => 'message/rfc822',
450
+ 'mj2' => 'video/mj2',
451
+ 'mjp2' => 'video/mj2',
452
+ 'mlp' => 'application/vnd.dolby.mlp',
453
+ 'mmd' => 'application/vnd.chipnuts.karaoke-mmd',
454
+ 'mmf' => 'application/vnd.smaf',
455
+ 'mmr' => 'image/vnd.fujixerox.edmics-mmr',
456
+ 'mny' => 'application/x-msmoney',
457
+ 'mobi' => 'application/x-mobipocket-ebook',
458
+ 'mods' => 'application/mods+xml',
459
+ 'mov' => 'video/quicktime',
460
+ 'movie' => 'video/x-sgi-movie',
461
+ 'mp2' => 'audio/mpeg',
462
+ 'mp21' => 'application/mp21',
463
+ 'mp2a' => 'audio/mpeg',
464
+ 'mp3' => 'audio/mpeg',
465
+ 'mp4' => 'video/mp4',
466
+ 'mp4a' => 'audio/mp4',
467
+ 'mp4s' => 'application/mp4',
468
+ 'mp4v' => 'video/mp4',
469
+ 'mpc' => 'application/vnd.mophun.certificate',
470
+ 'mpe' => 'video/mpeg',
471
+ 'mpeg' => 'video/mpeg',
472
+ 'mpg' => 'video/mpeg',
473
+ 'mpg4' => 'video/mp4',
474
+ 'mpga' => 'audio/mpeg',
475
+ 'mpkg' => 'application/vnd.apple.installer+xml',
476
+ 'mpm' => 'application/vnd.blueice.multipass',
477
+ 'mpn' => 'application/vnd.mophun.application',
478
+ 'mpp' => 'application/vnd.ms-project',
479
+ 'mpt' => 'application/vnd.ms-project',
480
+ 'mpy' => 'application/vnd.ibm.minipay',
481
+ 'mqy' => 'application/vnd.mobius.mqy',
482
+ 'mrc' => 'application/marc',
483
+ 'mrcx' => 'application/marcxml+xml',
484
+ 'ms' => 'text/troff',
485
+ 'mscml' => 'application/mediaservercontrol+xml',
486
+ 'mseed' => 'application/vnd.fdsn.mseed',
487
+ 'mseq' => 'application/vnd.mseq',
488
+ 'msf' => 'application/vnd.epson.msf',
489
+ 'msh' => 'model/mesh',
490
+ 'msi' => 'application/x-msdownload',
491
+ 'msl' => 'application/vnd.mobius.msl',
492
+ 'msty' => 'application/vnd.muvee.style',
493
+ 'mts' => 'model/vnd.mts',
494
+ 'mus' => 'application/vnd.musician',
495
+ 'musicxml' => 'application/vnd.recordare.musicxml+xml',
496
+ 'mvb' => 'application/x-msmediaview',
497
+ 'mwf' => 'application/vnd.mfer',
498
+ 'mxf' => 'application/mxf',
499
+ 'mxl' => 'application/vnd.recordare.musicxml',
500
+ 'mxml' => 'application/xv+xml',
501
+ 'mxs' => 'application/vnd.triscape.mxs',
502
+ 'mxu' => 'video/vnd.mpegurl',
503
+ 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install',
504
+ 'n3' => 'text/n3',
505
+ 'nb' => 'application/mathematica',
506
+ 'nbp' => 'application/vnd.wolfram.player',
507
+ 'nc' => 'application/x-netcdf',
508
+ 'ncx' => 'application/x-dtbncx+xml',
509
+ 'ngdat' => 'application/vnd.nokia.n-gage.data',
510
+ 'nlu' => 'application/vnd.neurolanguage.nlu',
511
+ 'nml' => 'application/vnd.enliven',
512
+ 'nnd' => 'application/vnd.noblenet-directory',
513
+ 'nns' => 'application/vnd.noblenet-sealer',
514
+ 'nnw' => 'application/vnd.noblenet-web',
515
+ 'npx' => 'image/vnd.net-fpx',
516
+ 'nsf' => 'application/vnd.lotus-notes',
517
+ 'oa2' => 'application/vnd.fujitsu.oasys2',
518
+ 'oa3' => 'application/vnd.fujitsu.oasys3',
519
+ 'oas' => 'application/vnd.fujitsu.oasys',
520
+ 'obd' => 'application/x-msbinder',
521
+ 'oda' => 'application/oda',
522
+ 'odb' => 'application/vnd.oasis.opendocument.database',
523
+ 'odc' => 'application/vnd.oasis.opendocument.chart',
524
+ 'odf' => 'application/vnd.oasis.opendocument.formula',
525
+ 'odft' => 'application/vnd.oasis.opendocument.formula-template',
526
+ 'odg' => 'application/vnd.oasis.opendocument.graphics',
527
+ 'odi' => 'application/vnd.oasis.opendocument.image',
528
+ 'odm' => 'application/vnd.oasis.opendocument.text-master',
529
+ 'odp' => 'application/vnd.oasis.opendocument.presentation',
530
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
531
+ 'odt' => 'application/vnd.oasis.opendocument.text',
532
+ 'oga' => 'audio/ogg',
533
+ 'ogg' => 'audio/ogg',
534
+ 'ogv' => 'video/ogg',
535
+ 'ogx' => 'application/ogg',
536
+ 'onepkg' => 'application/onenote',
537
+ 'onetmp' => 'application/onenote',
538
+ 'onetoc' => 'application/onenote',
539
+ 'onetoc2' => 'application/onenote',
540
+ 'opf' => 'application/oebps-package+xml',
541
+ 'oprc' => 'application/vnd.palm',
542
+ 'org' => 'application/vnd.lotus-organizer',
543
+ 'osf' => 'application/vnd.yamaha.openscoreformat',
544
+ 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',
545
+ 'otc' => 'application/vnd.oasis.opendocument.chart-template',
546
+ 'otf' => 'application/x-font-otf',
547
+ 'otg' => 'application/vnd.oasis.opendocument.graphics-template',
548
+ 'oth' => 'application/vnd.oasis.opendocument.text-web',
549
+ 'oti' => 'application/vnd.oasis.opendocument.image-template',
550
+ 'otp' => 'application/vnd.oasis.opendocument.presentation-template',
551
+ 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
552
+ 'ott' => 'application/vnd.oasis.opendocument.text-template',
553
+ 'oxt' => 'application/vnd.openofficeorg.extension',
554
+ 'p' => 'text/x-pascal',
555
+ 'p10' => 'application/pkcs10',
556
+ 'p12' => 'application/x-pkcs12',
557
+ 'p7b' => 'application/x-pkcs7-certificates',
558
+ 'p7c' => 'application/pkcs7-mime',
559
+ 'p7m' => 'application/pkcs7-mime',
560
+ 'p7r' => 'application/x-pkcs7-certreqresp',
561
+ 'p7s' => 'application/pkcs7-signature',
562
+ 'p8' => 'application/pkcs8',
563
+ 'pas' => 'text/x-pascal',
564
+ 'paw' => 'application/vnd.pawaafile',
565
+ 'pbd' => 'application/vnd.powerbuilder6',
566
+ 'pbm' => 'image/x-portable-bitmap',
567
+ 'pcf' => 'application/x-font-pcf',
568
+ 'pcl' => 'application/vnd.hp-pcl',
569
+ 'pclxl' => 'application/vnd.hp-pclxl',
570
+ 'pct' => 'image/x-pict',
571
+ 'pcurl' => 'application/vnd.curl.pcurl',
572
+ 'pcx' => 'image/x-pcx',
573
+ 'pdb' => 'application/vnd.palm',
574
+ 'pdf' => 'application/pdf',
575
+ 'pfa' => 'application/x-font-type1',
576
+ 'pfb' => 'application/x-font-type1',
577
+ 'pfm' => 'application/x-font-type1',
578
+ 'pfr' => 'application/font-tdpfr',
579
+ 'pfx' => 'application/x-pkcs12',
580
+ 'pgm' => 'image/x-portable-graymap',
581
+ 'pgn' => 'application/x-chess-pgn',
582
+ 'pgp' => 'application/pgp-encrypted',
583
+ 'php' => 'text/x-php',
584
+ 'phps' => 'application/x-httpd-phps',
585
+ 'pic' => 'image/x-pict',
586
+ 'pkg' => 'application/octet-stream',
587
+ 'pki' => 'application/pkixcmp',
588
+ 'pkipath' => 'application/pkix-pkipath',
589
+ 'plb' => 'application/vnd.3gpp.pic-bw-large',
590
+ 'plc' => 'application/vnd.mobius.plc',
591
+ 'plf' => 'application/vnd.pocketlearn',
592
+ 'pls' => 'application/pls+xml',
593
+ 'pml' => 'application/vnd.ctc-posml',
594
+ 'png' => 'image/png',
595
+ 'pnm' => 'image/x-portable-anymap',
596
+ 'portpkg' => 'application/vnd.macports.portpkg',
597
+ 'pot' => 'application/vnd.ms-powerpoint',
598
+ 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',
599
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
600
+ 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',
601
+ 'ppd' => 'application/vnd.cups-ppd',
602
+ 'ppm' => 'image/x-portable-pixmap',
603
+ 'pps' => 'application/vnd.ms-powerpoint',
604
+ 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
605
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
606
+ 'ppt' => 'application/vnd.ms-powerpoint',
607
+ 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
608
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
609
+ 'pqa' => 'application/vnd.palm',
610
+ 'prc' => 'application/x-mobipocket-ebook',
611
+ 'pre' => 'application/vnd.lotus-freelance',
612
+ 'prf' => 'application/pics-rules',
613
+ 'ps' => 'application/postscript',
614
+ 'psb' => 'application/vnd.3gpp.pic-bw-small',
615
+ 'psd' => 'image/vnd.adobe.photoshop',
616
+ 'psf' => 'application/x-font-linux-psf',
617
+ 'pskcxml' => 'application/pskc+xml',
618
+ 'ptid' => 'application/vnd.pvi.ptid1',
619
+ 'pub' => 'application/x-mspublisher',
620
+ 'pvb' => 'application/vnd.3gpp.pic-bw-var',
621
+ 'pwn' => 'application/vnd.3m.post-it-notes',
622
+ 'pya' => 'audio/vnd.ms-playready.media.pya',
623
+ 'pyv' => 'video/vnd.ms-playready.media.pyv',
624
+ 'qam' => 'application/vnd.epson.quickanime',
625
+ 'qbo' => 'application/vnd.intu.qbo',
626
+ 'qfx' => 'application/vnd.intu.qfx',
627
+ 'qps' => 'application/vnd.publishare-delta-tree',
628
+ 'qt' => 'video/quicktime',
629
+ 'qwd' => 'application/vnd.quark.quarkxpress',
630
+ 'qwt' => 'application/vnd.quark.quarkxpress',
631
+ 'qxb' => 'application/vnd.quark.quarkxpress',
632
+ 'qxd' => 'application/vnd.quark.quarkxpress',
633
+ 'qxl' => 'application/vnd.quark.quarkxpress',
634
+ 'qxt' => 'application/vnd.quark.quarkxpress',
635
+ 'ra' => 'audio/x-pn-realaudio',
636
+ 'ram' => 'audio/x-pn-realaudio',
637
+ 'rar' => 'application/x-rar-compressed',
638
+ 'ras' => 'image/x-cmu-raster',
639
+ 'rb' => 'text/plain',
640
+ 'rcprofile' => 'application/vnd.ipunplugged.rcprofile',
641
+ 'rdf' => 'application/rdf+xml',
642
+ 'rdz' => 'application/vnd.data-vision.rdz',
643
+ 'rep' => 'application/vnd.businessobjects',
644
+ 'res' => 'application/x-dtbresource+xml',
645
+ 'resx' => 'text/xml',
646
+ 'rgb' => 'image/x-rgb',
647
+ 'rif' => 'application/reginfo+xml',
648
+ 'rip' => 'audio/vnd.rip',
649
+ 'rl' => 'application/resource-lists+xml',
650
+ 'rlc' => 'image/vnd.fujixerox.edmics-rlc',
651
+ 'rld' => 'application/resource-lists-diff+xml',
652
+ 'rm' => 'application/vnd.rn-realmedia',
653
+ 'rmi' => 'audio/midi',
654
+ 'rmp' => 'audio/x-pn-realaudio-plugin',
655
+ 'rms' => 'application/vnd.jcp.javame.midlet-rms',
656
+ 'rnc' => 'application/relax-ng-compact-syntax',
657
+ 'roff' => 'text/troff',
658
+ 'rp9' => 'application/vnd.cloanto.rp9',
659
+ 'rpss' => 'application/vnd.nokia.radio-presets',
660
+ 'rpst' => 'application/vnd.nokia.radio-preset',
661
+ 'rq' => 'application/sparql-query',
662
+ 'rs' => 'application/rls-services+xml',
663
+ 'rsd' => 'application/rsd+xml',
664
+ 'rss' => 'application/rss+xml',
665
+ 'rtf' => 'application/rtf',
666
+ 'rtx' => 'text/richtext',
667
+ 's' => 'text/x-asm',
668
+ 'saf' => 'application/vnd.yamaha.smaf-audio',
669
+ 'sbml' => 'application/sbml+xml',
670
+ 'sc' => 'application/vnd.ibm.secure-container',
671
+ 'scd' => 'application/x-msschedule',
672
+ 'scm' => 'application/vnd.lotus-screencam',
673
+ 'scq' => 'application/scvp-cv-request',
674
+ 'scs' => 'application/scvp-cv-response',
675
+ 'scurl' => 'text/vnd.curl.scurl',
676
+ 'sda' => 'application/vnd.stardivision.draw',
677
+ 'sdc' => 'application/vnd.stardivision.calc',
678
+ 'sdd' => 'application/vnd.stardivision.impress',
679
+ 'sdkd' => 'application/vnd.solent.sdkm+xml',
680
+ 'sdkm' => 'application/vnd.solent.sdkm+xml',
681
+ 'sdp' => 'application/sdp',
682
+ 'sdw' => 'application/vnd.stardivision.writer',
683
+ 'see' => 'application/vnd.seemail',
684
+ 'seed' => 'application/vnd.fdsn.seed',
685
+ 'sema' => 'application/vnd.sema',
686
+ 'semd' => 'application/vnd.semd',
687
+ 'semf' => 'application/vnd.semf',
688
+ 'ser' => 'application/java-serialized-object',
689
+ 'setpay' => 'application/set-payment-initiation',
690
+ 'setreg' => 'application/set-registration-initiation',
691
+ 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',
692
+ 'sfs' => 'application/vnd.spotfire.sfs',
693
+ 'sgl' => 'application/vnd.stardivision.writer-global',
694
+ 'sgm' => 'text/sgml',
695
+ 'sgml' => 'text/sgml',
696
+ 'sh' => 'application/x-sh',
697
+ 'shar' => 'application/x-shar',
698
+ 'shf' => 'application/shf+xml',
699
+ 'sig' => 'application/pgp-signature',
700
+ 'silo' => 'model/mesh',
701
+ 'sis' => 'application/vnd.symbian.install',
702
+ 'sisx' => 'application/vnd.symbian.install',
703
+ 'sit' => 'application/x-stuffit',
704
+ 'sitx' => 'application/x-stuffitx',
705
+ 'skd' => 'application/vnd.koan',
706
+ 'skm' => 'application/vnd.koan',
707
+ 'skp' => 'application/vnd.koan',
708
+ 'skt' => 'application/vnd.koan',
709
+ 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',
710
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
711
+ 'slt' => 'application/vnd.epson.salt',
712
+ 'sm' => 'application/vnd.stepmania.stepchart',
713
+ 'smf' => 'application/vnd.stardivision.math',
714
+ 'smi' => 'application/smil+xml',
715
+ 'smil' => 'application/smil+xml',
716
+ 'snd' => 'audio/basic',
717
+ 'snf' => 'application/x-font-snf',
718
+ 'so' => 'application/octet-stream',
719
+ 'spc' => 'application/x-pkcs7-certificates',
720
+ 'spf' => 'application/vnd.yamaha.smaf-phrase',
721
+ 'spl' => 'application/x-futuresplash',
722
+ 'spot' => 'text/vnd.in3d.spot',
723
+ 'spp' => 'application/scvp-vp-response',
724
+ 'spq' => 'application/scvp-vp-request',
725
+ 'spx' => 'audio/ogg',
726
+ 'src' => 'application/x-wais-source',
727
+ 'sru' => 'application/sru+xml',
728
+ 'srx' => 'application/sparql-results+xml',
729
+ 'sse' => 'application/vnd.kodak-descriptor',
730
+ 'ssf' => 'application/vnd.epson.ssf',
731
+ 'ssml' => 'application/ssml+xml',
732
+ 'st' => 'application/vnd.sailingtracker.track',
733
+ 'stc' => 'application/vnd.sun.xml.calc.template',
734
+ 'std' => 'application/vnd.sun.xml.draw.template',
735
+ 'stf' => 'application/vnd.wt.stf',
736
+ 'sti' => 'application/vnd.sun.xml.impress.template',
737
+ 'stk' => 'application/hyperstudio',
738
+ 'stl' => 'application/vnd.ms-pki.stl',
739
+ 'str' => 'application/vnd.pg.format',
740
+ 'stw' => 'application/vnd.sun.xml.writer.template',
741
+ 'sub' => 'image/vnd.dvb.subtitle',
742
+ 'sus' => 'application/vnd.sus-calendar',
743
+ 'susp' => 'application/vnd.sus-calendar',
744
+ 'sv4cpio' => 'application/x-sv4cpio',
745
+ 'sv4crc' => 'application/x-sv4crc',
746
+ 'svc' => 'application/vnd.dvb.service',
747
+ 'svd' => 'application/vnd.svd',
748
+ 'svg' => 'image/svg+xml',
749
+ 'svgz' => 'image/svg+xml',
750
+ 'swa' => 'application/x-director',
751
+ 'swf' => 'application/x-shockwave-flash',
752
+ 'swi' => 'application/vnd.aristanetworks.swi',
753
+ 'sxc' => 'application/vnd.sun.xml.calc',
754
+ 'sxd' => 'application/vnd.sun.xml.draw',
755
+ 'sxg' => 'application/vnd.sun.xml.writer.global',
756
+ 'sxi' => 'application/vnd.sun.xml.impress',
757
+ 'sxm' => 'application/vnd.sun.xml.math',
758
+ 'sxw' => 'application/vnd.sun.xml.writer',
759
+ 't' => 'text/troff',
760
+ 'tao' => 'application/vnd.tao.intent-module-archive',
761
+ 'tar' => 'application/x-tar',
762
+ 'tcap' => 'application/vnd.3gpp2.tcap',
763
+ 'tcl' => 'application/x-tcl',
764
+ 'teacher' => 'application/vnd.smart.teacher',
765
+ 'tei' => 'application/tei+xml',
766
+ 'teicorpus' => 'application/tei+xml',
767
+ 'tex' => 'application/x-tex',
768
+ 'texi' => 'application/x-texinfo',
769
+ 'texinfo' => 'application/x-texinfo',
770
+ 'text' => 'text/plain',
771
+ 'tfi' => 'application/thraud+xml',
772
+ 'tfm' => 'application/x-tex-tfm',
773
+ 'thmx' => 'application/vnd.ms-officetheme',
774
+ 'tif' => 'image/tiff',
775
+ 'tiff' => 'image/tiff',
776
+ 'tmo' => 'application/vnd.tmobile-livetv',
777
+ 'torrent' => 'application/x-bittorrent',
778
+ 'tpl' => 'application/vnd.groove-tool-template',
779
+ 'tpt' => 'application/vnd.trid.tpt',
780
+ 'tr' => 'text/troff',
781
+ 'tra' => 'application/vnd.trueapp',
782
+ 'trm' => 'application/x-msterminal',
783
+ 'tsd' => 'application/timestamped-data',
784
+ 'tsv' => 'text/tab-separated-values',
785
+ 'ttc' => 'application/x-font-ttf',
786
+ 'ttf' => 'application/x-font-ttf',
787
+ 'ttl' => 'text/turtle',
788
+ 'twd' => 'application/vnd.simtech-mindmapper',
789
+ 'twds' => 'application/vnd.simtech-mindmapper',
790
+ 'txd' => 'application/vnd.genomatix.tuxedo',
791
+ 'txf' => 'application/vnd.mobius.txf',
792
+ 'txt' => 'text/plain',
793
+ 'u32' => 'application/x-authorware-bin',
794
+ 'udeb' => 'application/x-debian-package',
795
+ 'ufd' => 'application/vnd.ufdl',
796
+ 'ufdl' => 'application/vnd.ufdl',
797
+ 'umj' => 'application/vnd.umajin',
798
+ 'unityweb' => 'application/vnd.unity',
799
+ 'uoml' => 'application/vnd.uoml+xml',
800
+ 'uri' => 'text/uri-list',
801
+ 'uris' => 'text/uri-list',
802
+ 'urls' => 'text/uri-list',
803
+ 'ustar' => 'application/x-ustar',
804
+ 'utz' => 'application/vnd.uiq.theme',
805
+ 'uu' => 'text/x-uuencode',
806
+ 'uva' => 'audio/vnd.dece.audio',
807
+ 'uvd' => 'application/vnd.dece.data',
808
+ 'uvf' => 'application/vnd.dece.data',
809
+ 'uvg' => 'image/vnd.dece.graphic',
810
+ 'uvh' => 'video/vnd.dece.hd',
811
+ 'uvi' => 'image/vnd.dece.graphic',
812
+ 'uvm' => 'video/vnd.dece.mobile',
813
+ 'uvp' => 'video/vnd.dece.pd',
814
+ 'uvs' => 'video/vnd.dece.sd',
815
+ 'uvt' => 'application/vnd.dece.ttml+xml',
816
+ 'uvu' => 'video/vnd.uvvu.mp4',
817
+ 'uvv' => 'video/vnd.dece.video',
818
+ 'uvva' => 'audio/vnd.dece.audio',
819
+ 'uvvd' => 'application/vnd.dece.data',
820
+ 'uvvf' => 'application/vnd.dece.data',
821
+ 'uvvg' => 'image/vnd.dece.graphic',
822
+ 'uvvh' => 'video/vnd.dece.hd',
823
+ 'uvvi' => 'image/vnd.dece.graphic',
824
+ 'uvvm' => 'video/vnd.dece.mobile',
825
+ 'uvvp' => 'video/vnd.dece.pd',
826
+ 'uvvs' => 'video/vnd.dece.sd',
827
+ 'uvvt' => 'application/vnd.dece.ttml+xml',
828
+ 'uvvu' => 'video/vnd.uvvu.mp4',
829
+ 'uvvv' => 'video/vnd.dece.video',
830
+ 'uvvx' => 'application/vnd.dece.unspecified',
831
+ 'uvx' => 'application/vnd.dece.unspecified',
832
+ 'vcd' => 'application/x-cdlink',
833
+ 'vcf' => 'text/x-vcard',
834
+ 'vcg' => 'application/vnd.groove-vcard',
835
+ 'vcs' => 'text/x-vcalendar',
836
+ 'vcx' => 'application/vnd.vcx',
837
+ 'vis' => 'application/vnd.visionary',
838
+ 'viv' => 'video/vnd.vivo',
839
+ 'vor' => 'application/vnd.stardivision.writer',
840
+ 'vox' => 'application/x-authorware-bin',
841
+ 'vrml' => 'model/vrml',
842
+ 'vsd' => 'application/vnd.visio',
843
+ 'vsf' => 'application/vnd.vsf',
844
+ 'vss' => 'application/vnd.visio',
845
+ 'vst' => 'application/vnd.visio',
846
+ 'vsw' => 'application/vnd.visio',
847
+ 'vtu' => 'model/vnd.vtu',
848
+ 'vxml' => 'application/voicexml+xml',
849
+ 'w3d' => 'application/x-director',
850
+ 'wad' => 'application/x-doom',
851
+ 'wav' => 'audio/x-wav',
852
+ 'wax' => 'audio/x-ms-wax',
853
+ 'wbmp' => 'image/vnd.wap.wbmp',
854
+ 'wbs' => 'application/vnd.criticaltools.wbs+xml',
855
+ 'wbxml' => 'application/vnd.wap.wbxml',
856
+ 'wcm' => 'application/vnd.ms-works',
857
+ 'wdb' => 'application/vnd.ms-works',
858
+ 'weba' => 'audio/webm',
859
+ 'webm' => 'video/webm',
860
+ 'webp' => 'image/webp',
861
+ 'wg' => 'application/vnd.pmi.widget',
862
+ 'wgt' => 'application/widget',
863
+ 'wks' => 'application/vnd.ms-works',
864
+ 'wm' => 'video/x-ms-wm',
865
+ 'wma' => 'audio/x-ms-wma',
866
+ 'wmd' => 'application/x-ms-wmd',
867
+ 'wmf' => 'application/x-msmetafile',
868
+ 'wml' => 'text/vnd.wap.wml',
869
+ 'wmlc' => 'application/vnd.wap.wmlc',
870
+ 'wmls' => 'text/vnd.wap.wmlscript',
871
+ 'wmlsc' => 'application/vnd.wap.wmlscriptc',
872
+ 'wmv' => 'video/x-ms-wmv',
873
+ 'wmx' => 'video/x-ms-wmx',
874
+ 'wmz' => 'application/x-ms-wmz',
875
+ 'woff' => 'application/x-font-woff',
876
+ 'wpd' => 'application/vnd.wordperfect',
877
+ 'wpl' => 'application/vnd.ms-wpl',
878
+ 'wps' => 'application/vnd.ms-works',
879
+ 'wqd' => 'application/vnd.wqd',
880
+ 'wri' => 'application/x-mswrite',
881
+ 'wrl' => 'model/vrml',
882
+ 'wsdl' => 'application/wsdl+xml',
883
+ 'wspolicy' => 'application/wspolicy+xml',
884
+ 'wtb' => 'application/vnd.webturbo',
885
+ 'wvx' => 'video/x-ms-wvx',
886
+ 'x32' => 'application/x-authorware-bin',
887
+ 'x3d' => 'application/vnd.hzn-3d-crossword',
888
+ 'xap' => 'application/x-silverlight-app',
889
+ 'xar' => 'application/vnd.xara',
890
+ 'xbap' => 'application/x-ms-xbap',
891
+ 'xbd' => 'application/vnd.fujixerox.docuworks.binder',
892
+ 'xbm' => 'image/x-xbitmap',
893
+ 'xdf' => 'application/xcap-diff+xml',
894
+ 'xdm' => 'application/vnd.syncml.dm+xml',
895
+ 'xdp' => 'application/vnd.adobe.xdp+xml',
896
+ 'xdssc' => 'application/dssc+xml',
897
+ 'xdw' => 'application/vnd.fujixerox.docuworks',
898
+ 'xenc' => 'application/xenc+xml',
899
+ 'xer' => 'application/patch-ops-error+xml',
900
+ 'xfdf' => 'application/vnd.adobe.xfdf',
901
+ 'xfdl' => 'application/vnd.xfdl',
902
+ 'xht' => 'application/xhtml+xml',
903
+ 'xhtml' => 'application/xhtml+xml',
904
+ 'xhvml' => 'application/xv+xml',
905
+ 'xif' => 'image/vnd.xiff',
906
+ 'xla' => 'application/vnd.ms-excel',
907
+ 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
908
+ 'xlc' => 'application/vnd.ms-excel',
909
+ 'xlm' => 'application/vnd.ms-excel',
910
+ 'xls' => 'application/vnd.ms-excel',
911
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
912
+ 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
913
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
914
+ 'xlt' => 'application/vnd.ms-excel',
915
+ 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
916
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
917
+ 'xlw' => 'application/vnd.ms-excel',
918
+ 'xml' => 'application/xml',
919
+ 'xo' => 'application/vnd.olpc-sugar',
920
+ 'xop' => 'application/xop+xml',
921
+ 'xpi' => 'application/x-xpinstall',
922
+ 'xpm' => 'image/x-xpixmap',
923
+ 'xpr' => 'application/vnd.is-xpr',
924
+ 'xps' => 'application/vnd.ms-xpsdocument',
925
+ 'xpw' => 'application/vnd.intercon.formnet',
926
+ 'xpx' => 'application/vnd.intercon.formnet',
927
+ 'xsl' => 'application/xml',
928
+ 'xslt' => 'application/xslt+xml',
929
+ 'xsm' => 'application/vnd.syncml+xml',
930
+ 'xspf' => 'application/xspf+xml',
931
+ 'xul' => 'application/vnd.mozilla.xul+xml',
932
+ 'xvm' => 'application/xv+xml',
933
+ 'xvml' => 'application/xv+xml',
934
+ 'xwd' => 'image/x-xwindowdump',
935
+ 'xyz' => 'chemical/x-xyz',
936
+ 'yaml' => 'text/yaml',
937
+ 'yang' => 'application/yang',
938
+ 'yin' => 'application/yin+xml',
939
+ 'yml' => 'text/yaml',
940
+ 'zaz' => 'application/vnd.zzazz.deck+xml',
941
+ 'zip' => 'application/zip',
942
+ 'zir' => 'application/vnd.zul',
943
+ 'zirz' => 'application/vnd.zul',
944
+ 'zmm' => 'application/vnd.handheld-entertainment+xml'
945
+ ];
946
+
947
+ /**
948
+ * Get a singleton instance of the class
949
+ *
950
+ * @return self
951
+ * @codeCoverageIgnore
952
+ */
953
+ public static function getInstance()
954
+ {
955
+ if (!self::$instance) {
956
+ self::$instance = new self();
957
+ }
958
+
959
+ return self::$instance;
960
+ }
961
+
962
+ /**
963
+ * Get a mimetype value from a file extension
964
+ *
965
+ * @param string $extension File extension
966
+ *
967
+ * @return string|null
968
+ */
969
+ public function fromExtension($extension)
970
+ {
971
+ $extension = strtolower($extension);
972
+
973
+ return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : null;
974
+ }
975
+
976
+ /**
977
+ * Get a mimetype from a filename
978
+ *
979
+ * @param string $filename Filename to generate a mimetype from
980
+ *
981
+ * @return string|null
982
+ */
983
+ public function fromFilename($filename)
984
+ {
985
+ return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
986
+ }
987
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/Collection.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class Collection
28
+ *
29
+ * Modified version of Collection in "illuminate/support" by Taylor Otwell
30
+ *
31
+ * @package Facebook
32
+ */
33
+
34
+ use ArrayAccess;
35
+ use ArrayIterator;
36
+ use Countable;
37
+ use IteratorAggregate;
38
+
39
+ class Collection implements ArrayAccess, Countable, IteratorAggregate
40
+ {
41
+ /**
42
+ * The items contained in the collection.
43
+ *
44
+ * @var array
45
+ */
46
+ protected $items = [];
47
+
48
+ /**
49
+ * Create a new collection.
50
+ *
51
+ * @param array $items
52
+ */
53
+ public function __construct(array $items = [])
54
+ {
55
+ $this->items = $items;
56
+ }
57
+
58
+ /**
59
+ * Gets the value of a field from the Graph node.
60
+ *
61
+ * @param string $name The field to retrieve.
62
+ * @param mixed $default The default to return if the field doesn't exist.
63
+ *
64
+ * @return mixed
65
+ */
66
+ public function getField($name, $default = null)
67
+ {
68
+ if (isset($this->items[$name])) {
69
+ return $this->items[$name];
70
+ }
71
+
72
+ return $default ?: null;
73
+ }
74
+
75
+ /**
76
+ * Gets the value of the named property for this graph object.
77
+ *
78
+ * @param string $name The property to retrieve.
79
+ * @param mixed $default The default to return if the property doesn't exist.
80
+ *
81
+ * @return mixed
82
+ *
83
+ * @deprecated 5.0.0 getProperty() has been renamed to getField()
84
+ * @todo v6: Remove this method
85
+ */
86
+ public function getProperty($name, $default = null)
87
+ {
88
+ return $this->getField($name, $default);
89
+ }
90
+
91
+ /**
92
+ * Returns a list of all fields set on the object.
93
+ *
94
+ * @return array
95
+ */
96
+ public function getFieldNames()
97
+ {
98
+ return array_keys($this->items);
99
+ }
100
+
101
+ /**
102
+ * Returns a list of all properties set on the object.
103
+ *
104
+ * @return array
105
+ *
106
+ * @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames()
107
+ * @todo v6: Remove this method
108
+ */
109
+ public function getPropertyNames()
110
+ {
111
+ return $this->getFieldNames();
112
+ }
113
+
114
+ /**
115
+ * Get all of the items in the collection.
116
+ *
117
+ * @return array
118
+ */
119
+ public function all()
120
+ {
121
+ return $this->items;
122
+ }
123
+
124
+ /**
125
+ * Get the collection of items as a plain array.
126
+ *
127
+ * @return array
128
+ */
129
+ public function asArray()
130
+ {
131
+ return array_map(function ($value) {
132
+ return $value instanceof Collection ? $value->asArray() : $value;
133
+ }, $this->items);
134
+ }
135
+
136
+ /**
137
+ * Run a map over each of the items.
138
+ *
139
+ * @param \Closure $callback
140
+ *
141
+ * @return static
142
+ */
143
+ public function map(\Closure $callback)
144
+ {
145
+ return new static(array_map($callback, $this->items, array_keys($this->items)));
146
+ }
147
+
148
+ /**
149
+ * Get the collection of items as JSON.
150
+ *
151
+ * @param int $options
152
+ *
153
+ * @return string
154
+ */
155
+ public function asJson($options = 0)
156
+ {
157
+ return json_encode($this->asArray(), $options);
158
+ }
159
+
160
+ /**
161
+ * Count the number of items in the collection.
162
+ *
163
+ * @return int
164
+ */
165
+ public function count()
166
+ {
167
+ return count($this->items);
168
+ }
169
+
170
+ /**
171
+ * Get an iterator for the items.
172
+ *
173
+ * @return ArrayIterator
174
+ */
175
+ public function getIterator()
176
+ {
177
+ return new ArrayIterator($this->items);
178
+ }
179
+
180
+ /**
181
+ * Determine if an item exists at an offset.
182
+ *
183
+ * @param mixed $key
184
+ *
185
+ * @return bool
186
+ */
187
+ public function offsetExists($key)
188
+ {
189
+ return array_key_exists($key, $this->items);
190
+ }
191
+
192
+ /**
193
+ * Get an item at a given offset.
194
+ *
195
+ * @param mixed $key
196
+ *
197
+ * @return mixed
198
+ */
199
+ public function offsetGet($key)
200
+ {
201
+ return $this->items[$key];
202
+ }
203
+
204
+ /**
205
+ * Set the item at a given offset.
206
+ *
207
+ * @param mixed $key
208
+ * @param mixed $value
209
+ *
210
+ * @return void
211
+ */
212
+ public function offsetSet($key, $value)
213
+ {
214
+ if (is_null($key)) {
215
+ $this->items[] = $value;
216
+ } else {
217
+ $this->items[$key] = $value;
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Unset the item at a given offset.
223
+ *
224
+ * @param string $key
225
+ *
226
+ * @return void
227
+ */
228
+ public function offsetUnset($key)
229
+ {
230
+ unset($this->items[$key]);
231
+ }
232
+
233
+ /**
234
+ * Convert the collection to its string representation.
235
+ *
236
+ * @return string
237
+ */
238
+ public function __toString()
239
+ {
240
+ return $this->asJson();
241
+ }
242
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphAchievement.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphAchievement
28
+ *
29
+ * @package Facebook
30
+ */
31
+
32
+ class GraphAchievement extends GraphNode
33
+ {
34
+ /**
35
+ * @var array Maps object key names to Graph object types.
36
+ */
37
+ protected static $graphObjectMap = [
38
+ 'from' => '\Facebook\GraphNodes\GraphUser',
39
+ 'application' => '\Facebook\GraphNodes\GraphApplication',
40
+ ];
41
+
42
+ /**
43
+ * Returns the ID for the achievement.
44
+ *
45
+ * @return string|null
46
+ */
47
+ public function getId()
48
+ {
49
+ return $this->getField('id');
50
+ }
51
+
52
+ /**
53
+ * Returns the user who achieved this.
54
+ *
55
+ * @return GraphUser|null
56
+ */
57
+ public function getFrom()
58
+ {
59
+ return $this->getField('from');
60
+ }
61
+
62
+ /**
63
+ * Returns the time at which this was achieved.
64
+ *
65
+ * @return \DateTime|null
66
+ */
67
+ public function getPublishTime()
68
+ {
69
+ return $this->getField('publish_time');
70
+ }
71
+
72
+ /**
73
+ * Returns the app in which the user achieved this.
74
+ *
75
+ * @return GraphApplication|null
76
+ */
77
+ public function getApplication()
78
+ {
79
+ return $this->getField('application');
80
+ }
81
+
82
+ /**
83
+ * Returns information about the achievement type this instance is connected with.
84
+ *
85
+ * @return array|null
86
+ */
87
+ public function getData()
88
+ {
89
+ return $this->getField('data');
90
+ }
91
+
92
+ /**
93
+ * Returns the type of achievement.
94
+ *
95
+ * @see https://developers.facebook.com/docs/graph-api/reference/v2.2/achievement
96
+ *
97
+ * @return string
98
+ */
99
+ public function getType()
100
+ {
101
+ return 'game.achievement';
102
+ }
103
+
104
+ /**
105
+ * Indicates whether gaining the achievement published a feed story for the user.
106
+ *
107
+ * @return boolean|null
108
+ */
109
+ public function isNoFeedStory()
110
+ {
111
+ return $this->getField('no_feed_story');
112
+ }
113
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphAlbum.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphAlbum
28
+ *
29
+ * @package Facebook
30
+ */
31
+
32
+ class GraphAlbum extends GraphNode
33
+ {
34
+ /**
35
+ * @var array Maps object key names to Graph object types.
36
+ */
37
+ protected static $graphObjectMap = [
38
+ 'from' => '\Facebook\GraphNodes\GraphUser',
39
+ 'place' => '\Facebook\GraphNodes\GraphPage',
40
+ ];
41
+
42
+ /**
43
+ * Returns the ID for the album.
44
+ *
45
+ * @return string|null
46
+ */
47
+ public function getId()
48
+ {
49
+ return $this->getField('id');
50
+ }
51
+
52
+ /**
53
+ * Returns whether the viewer can upload photos to this album.
54
+ *
55
+ * @return boolean|null
56
+ */
57
+ public function getCanUpload()
58
+ {
59
+ return $this->getField('can_upload');
60
+ }
61
+
62
+ /**
63
+ * Returns the number of photos in this album.
64
+ *
65
+ * @return int|null
66
+ */
67
+ public function getCount()
68
+ {
69
+ return $this->getField('count');
70
+ }
71
+
72
+ /**
73
+ * Returns the ID of the album's cover photo.
74
+ *
75
+ * @return string|null
76
+ */
77
+ public function getCoverPhoto()
78
+ {
79
+ return $this->getField('cover_photo');
80
+ }
81
+
82
+ /**
83
+ * Returns the time the album was initially created.
84
+ *
85
+ * @return \DateTime|null
86
+ */
87
+ public function getCreatedTime()
88
+ {
89
+ return $this->getField('created_time');
90
+ }
91
+
92
+ /**
93
+ * Returns the time the album was updated.
94
+ *
95
+ * @return \DateTime|null
96
+ */
97
+ public function getUpdatedTime()
98
+ {
99
+ return $this->getField('updated_time');
100
+ }
101
+
102
+ /**
103
+ * Returns the description of the album.
104
+ *
105
+ * @return string|null
106
+ */
107
+ public function getDescription()
108
+ {
109
+ return $this->getField('description');
110
+ }
111
+
112
+ /**
113
+ * Returns profile that created the album.
114
+ *
115
+ * @return GraphUser|null
116
+ */
117
+ public function getFrom()
118
+ {
119
+ return $this->getField('from');
120
+ }
121
+
122
+ /**
123
+ * Returns profile that created the album.
124
+ *
125
+ * @return GraphPage|null
126
+ */
127
+ public function getPlace()
128
+ {
129
+ return $this->getField('place');
130
+ }
131
+
132
+ /**
133
+ * Returns a link to this album on Facebook.
134
+ *
135
+ * @return string|null
136
+ */
137
+ public function getLink()
138
+ {
139
+ return $this->getField('link');
140
+ }
141
+
142
+ /**
143
+ * Returns the textual location of the album.
144
+ *
145
+ * @return string|null
146
+ */
147
+ public function getLocation()
148
+ {
149
+ return $this->getField('location');
150
+ }
151
+
152
+ /**
153
+ * Returns the title of the album.
154
+ *
155
+ * @return string|null
156
+ */
157
+ public function getName()
158
+ {
159
+ return $this->getField('name');
160
+ }
161
+
162
+ /**
163
+ * Returns the privacy settings for the album.
164
+ *
165
+ * @return string|null
166
+ */
167
+ public function getPrivacy()
168
+ {
169
+ return $this->getField('privacy');
170
+ }
171
+
172
+ /**
173
+ * Returns the type of the album.
174
+ *
175
+ * enum{ profile, mobile, wall, normal, album }
176
+ *
177
+ * @return string|null
178
+ */
179
+ public function getType()
180
+ {
181
+ return $this->getField('type');
182
+ }
183
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphApplication.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphApplication
28
+ *
29
+ * @package Facebook
30
+ */
31
+
32
+ class GraphApplication extends GraphNode
33
+ {
34
+ /**
35
+ * Returns the ID for the application.
36
+ *
37
+ * @return string|null
38
+ */
39
+ public function getId()
40
+ {
41
+ return $this->getField('id');
42
+ }
43
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphCoverPhoto
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphCoverPhoto extends GraphNode
32
+ {
33
+ /**
34
+ * Returns the id of cover if it exists
35
+ *
36
+ * @return int|null
37
+ */
38
+ public function getId()
39
+ {
40
+ return $this->getField('id');
41
+ }
42
+
43
+ /**
44
+ * Returns the source of cover if it exists
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getSource()
49
+ {
50
+ return $this->getField('source');
51
+ }
52
+
53
+ /**
54
+ * Returns the offset_x of cover if it exists
55
+ *
56
+ * @return int|null
57
+ */
58
+ public function getOffsetX()
59
+ {
60
+ return $this->getField('offset_x');
61
+ }
62
+
63
+ /**
64
+ * Returns the offset_y of cover if it exists
65
+ *
66
+ * @return int|null
67
+ */
68
+ public function getOffsetY()
69
+ {
70
+ return $this->getField('offset_y');
71
+ }
72
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphEdge.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ use Facebook\FacebookRequest;
27
+ use Facebook\Url\FacebookUrlManipulator;
28
+ use Facebook\Exceptions\FacebookSDKException;
29
+
30
+ /**
31
+ * Class GraphEdge
32
+ *
33
+ * @package Facebook
34
+ */
35
+ class GraphEdge extends Collection
36
+ {
37
+ /**
38
+ * @var FacebookRequest The original request that generated this data.
39
+ */
40
+ protected $request;
41
+
42
+ /**
43
+ * @var array An array of Graph meta data like pagination, etc.
44
+ */
45
+ protected $metaData = [];
46
+
47
+ /**
48
+ * @var string|null The parent Graph edge endpoint that generated the list.
49
+ */
50
+ protected $parentEdgeEndpoint;
51
+
52
+ /**
53
+ * @var string|null The subclass of the child GraphNode's.
54
+ */
55
+ protected $subclassName;
56
+
57
+ /**
58
+ * Init this collection of GraphNode's.
59
+ *
60
+ * @param FacebookRequest $request The original request that generated this data.
61
+ * @param array $data An array of GraphNode's.
62
+ * @param array $metaData An array of Graph meta data like pagination, etc.
63
+ * @param string|null $parentEdgeEndpoint The parent Graph edge endpoint that generated the list.
64
+ * @param string|null $subclassName The subclass of the child GraphNode's.
65
+ */
66
+ public function __construct(FacebookRequest $request, array $data = [], array $metaData = [], $parentEdgeEndpoint = null, $subclassName = null)
67
+ {
68
+ $this->request = $request;
69
+ $this->metaData = $metaData;
70
+ $this->parentEdgeEndpoint = $parentEdgeEndpoint;
71
+ $this->subclassName = $subclassName;
72
+
73
+ parent::__construct($data);
74
+ }
75
+
76
+ /**
77
+ * Gets the parent Graph edge endpoint that generated the list.
78
+ *
79
+ * @return string|null
80
+ */
81
+ public function getParentGraphEdge()
82
+ {
83
+ return $this->parentEdgeEndpoint;
84
+ }
85
+
86
+ /**
87
+ * Gets the subclass name that the child GraphNode's are cast as.
88
+ *
89
+ * @return string|null
90
+ */
91
+ public function getSubClassName()
92
+ {
93
+ return $this->subclassName;
94
+ }
95
+
96
+ /**
97
+ * Returns the raw meta data associated with this GraphEdge.
98
+ *
99
+ * @return array
100
+ */
101
+ public function getMetaData()
102
+ {
103
+ return $this->metaData;
104
+ }
105
+
106
+ /**
107
+ * Returns the next cursor if it exists.
108
+ *
109
+ * @return string|null
110
+ */
111
+ public function getNextCursor()
112
+ {
113
+ return $this->getCursor('after');
114
+ }
115
+
116
+ /**
117
+ * Returns the previous cursor if it exists.
118
+ *
119
+ * @return string|null
120
+ */
121
+ public function getPreviousCursor()
122
+ {
123
+ return $this->getCursor('before');
124
+ }
125
+
126
+ /**
127
+ * Returns the cursor for a specific direction if it exists.
128
+ *
129
+ * @param string $direction The direction of the page: after|before
130
+ *
131
+ * @return string|null
132
+ */
133
+ public function getCursor($direction)
134
+ {
135
+ if (isset($this->metaData['paging']['cursors'][$direction])) {
136
+ return $this->metaData['paging']['cursors'][$direction];
137
+ }
138
+
139
+ return null;
140
+ }
141
+
142
+ /**
143
+ * Generates a pagination URL based on a cursor.
144
+ *
145
+ * @param string $direction The direction of the page: next|previous
146
+ *
147
+ * @return string|null
148
+ *
149
+ * @throws FacebookSDKException
150
+ */
151
+ public function getPaginationUrl($direction)
152
+ {
153
+ $this->validateForPagination();
154
+
155
+ // Do we have a paging URL?
156
+ if (isset($this->metaData['paging'][$direction])) {
157
+ // Graph returns the full URL with all the original params.
158
+ // We just want the endpoint though.
159
+ $pageUrl = $this->metaData['paging'][$direction];
160
+
161
+ return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl);
162
+ }
163
+
164
+ // Do we have a cursor to work with?
165
+ $cursorDirection = $direction === 'next' ? 'after' : 'before';
166
+ $cursor = $this->getCursor($cursorDirection);
167
+ if (!$cursor) {
168
+ return null;
169
+ }
170
+
171
+ // If we don't know the ID of the parent node, this ain't gonna work.
172
+ if (!$this->parentEdgeEndpoint) {
173
+ return null;
174
+ }
175
+
176
+ // We have the parent node ID, paging cursor & original request.
177
+ // These were the ingredients chosen to create the perfect little URL.
178
+ $pageUrl = $this->parentEdgeEndpoint . '?' . $cursorDirection . '=' . urlencode($cursor);
179
+
180
+ // Pull in the original params
181
+ $originalUrl = $this->request->getUrl();
182
+ $pageUrl = FacebookUrlManipulator::mergeUrlParams($originalUrl, $pageUrl);
183
+
184
+ return FacebookUrlManipulator::forceSlashPrefix($pageUrl);
185
+ }
186
+
187
+ /**
188
+ * Validates whether or not we can paginate on this request.
189
+ *
190
+ * @throws FacebookSDKException
191
+ */
192
+ public function validateForPagination()
193
+ {
194
+ if ($this->request->getMethod() !== 'GET') {
195
+ throw new FacebookSDKException('You can only paginate on a GET request.', 720);
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Gets the request object needed to make a next|previous page request.
201
+ *
202
+ * @param string $direction The direction of the page: next|previous
203
+ *
204
+ * @return FacebookRequest|null
205
+ *
206
+ * @throws FacebookSDKException
207
+ */
208
+ public function getPaginationRequest($direction)
209
+ {
210
+ $pageUrl = $this->getPaginationUrl($direction);
211
+ if (!$pageUrl) {
212
+ return null;
213
+ }
214
+
215
+ $newRequest = clone $this->request;
216
+ $newRequest->setEndpoint($pageUrl);
217
+
218
+ return $newRequest;
219
+ }
220
+
221
+ /**
222
+ * Gets the request object needed to make a "next" page request.
223
+ *
224
+ * @return FacebookRequest|null
225
+ *
226
+ * @throws FacebookSDKException
227
+ */
228
+ public function getNextPageRequest()
229
+ {
230
+ return $this->getPaginationRequest('next');
231
+ }
232
+
233
+ /**
234
+ * Gets the request object needed to make a "previous" page request.
235
+ *
236
+ * @return FacebookRequest|null
237
+ *
238
+ * @throws FacebookSDKException
239
+ */
240
+ public function getPreviousPageRequest()
241
+ {
242
+ return $this->getPaginationRequest('previous');
243
+ }
244
+
245
+ /**
246
+ * The total number of results according to Graph if it exists.
247
+ *
248
+ * This will be returned if the summary=true modifier is present in the request.
249
+ *
250
+ * @return int|null
251
+ */
252
+ public function getTotalCount()
253
+ {
254
+ if (isset($this->metaData['summary']['total_count'])) {
255
+ return $this->metaData['summary']['total_count'];
256
+ }
257
+
258
+ return null;
259
+ }
260
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphEvent.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphEvent
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphEvent extends GraphNode
32
+ {
33
+ /**
34
+ * @var array Maps object key names to GraphNode types.
35
+ */
36
+ protected static $graphObjectMap = [
37
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
38
+ 'place' => '\Facebook\GraphNodes\GraphPage',
39
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
40
+ 'parent_group' => '\Facebook\GraphNodes\GraphGroup',
41
+ ];
42
+
43
+ /**
44
+ * Returns the `id` (The event ID) as string if present.
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getId()
49
+ {
50
+ return $this->getField('id');
51
+ }
52
+
53
+ /**
54
+ * Returns the `cover` (Cover picture) as GraphCoverPhoto if present.
55
+ *
56
+ * @return GraphCoverPhoto|null
57
+ */
58
+ public function getCover()
59
+ {
60
+ return $this->getField('cover');
61
+ }
62
+
63
+ /**
64
+ * Returns the `description` (Long-form description) as string if present.
65
+ *
66
+ * @return string|null
67
+ */
68
+ public function getDescription()
69
+ {
70
+ return $this->getField('description');
71
+ }
72
+
73
+ /**
74
+ * Returns the `end_time` (End time, if one has been set) as DateTime if present.
75
+ *
76
+ * @return \DateTime|null
77
+ */
78
+ public function getEndTime()
79
+ {
80
+ return $this->getField('end_time');
81
+ }
82
+
83
+ /**
84
+ * Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present.
85
+ *
86
+ * @return bool|null
87
+ */
88
+ public function getIsDateOnly()
89
+ {
90
+ return $this->getField('is_date_only');
91
+ }
92
+
93
+ /**
94
+ * Returns the `name` (Event name) as string if present.
95
+ *
96
+ * @return string|null
97
+ */
98
+ public function getName()
99
+ {
100
+ return $this->getField('name');
101
+ }
102
+
103
+ /**
104
+ * Returns the `owner` (The profile that created the event) as GraphNode if present.
105
+ *
106
+ * @return GraphNode|null
107
+ */
108
+ public function getOwner()
109
+ {
110
+ return $this->getField('owner');
111
+ }
112
+
113
+ /**
114
+ * Returns the `parent_group` (The group the event belongs to) as GraphGroup if present.
115
+ *
116
+ * @return GraphGroup|null
117
+ */
118
+ public function getParentGroup()
119
+ {
120
+ return $this->getField('parent_group');
121
+ }
122
+
123
+ /**
124
+ * Returns the `place` (Event Place information) as GraphPage if present.
125
+ *
126
+ * @return GraphPage|null
127
+ */
128
+ public function getPlace()
129
+ {
130
+ return $this->getField('place');
131
+ }
132
+
133
+ /**
134
+ * Returns the `privacy` (Who can see the event) as string if present.
135
+ *
136
+ * @return string|null
137
+ */
138
+ public function getPrivacy()
139
+ {
140
+ return $this->getField('privacy');
141
+ }
142
+
143
+ /**
144
+ * Returns the `start_time` (Start time) as DateTime if present.
145
+ *
146
+ * @return \DateTime|null
147
+ */
148
+ public function getStartTime()
149
+ {
150
+ return $this->getField('start_time');
151
+ }
152
+
153
+ /**
154
+ * Returns the `ticket_uri` (The link users can visit to buy a ticket to this event) as string if present.
155
+ *
156
+ * @return string|null
157
+ */
158
+ public function getTicketUri()
159
+ {
160
+ return $this->getField('ticket_uri');
161
+ }
162
+
163
+ /**
164
+ * Returns the `timezone` (Timezone) as string if present.
165
+ *
166
+ * @return string|null
167
+ */
168
+ public function getTimezone()
169
+ {
170
+ return $this->getField('timezone');
171
+ }
172
+
173
+ /**
174
+ * Returns the `updated_time` (Last update time) as DateTime if present.
175
+ *
176
+ * @return \DateTime|null
177
+ */
178
+ public function getUpdatedTime()
179
+ {
180
+ return $this->getField('updated_time');
181
+ }
182
+
183
+ /**
184
+ * Returns the `picture` (Event picture) as GraphPicture if present.
185
+ *
186
+ * @return GraphPicture|null
187
+ */
188
+ public function getPicture()
189
+ {
190
+ return $this->getField('picture');
191
+ }
192
+
193
+ /**
194
+ * Returns the `attending_count` (Number of people attending the event) as int if present.
195
+ *
196
+ * @return int|null
197
+ */
198
+ public function getAttendingCount()
199
+ {
200
+ return $this->getField('attending_count');
201
+ }
202
+
203
+ /**
204
+ * Returns the `declined_count` (Number of people who declined the event) as int if present.
205
+ *
206
+ * @return int|null
207
+ */
208
+ public function getDeclinedCount()
209
+ {
210
+ return $this->getField('declined_count');
211
+ }
212
+
213
+ /**
214
+ * Returns the `maybe_count` (Number of people who maybe going to the event) as int if present.
215
+ *
216
+ * @return int|null
217
+ */
218
+ public function getMaybeCount()
219
+ {
220
+ return $this->getField('maybe_count');
221
+ }
222
+
223
+ /**
224
+ * Returns the `noreply_count` (Number of people who did not reply to the event) as int if present.
225
+ *
226
+ * @return int|null
227
+ */
228
+ public function getNoreplyCount()
229
+ {
230
+ return $this->getField('noreply_count');
231
+ }
232
+
233
+ /**
234
+ * Returns the `invited_count` (Number of people invited to the event) as int if present.
235
+ *
236
+ * @return int|null
237
+ */
238
+ public function getInvitedCount()
239
+ {
240
+ return $this->getField('invited_count');
241
+ }
242
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphGroup.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphGroup
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphGroup extends GraphNode
32
+ {
33
+ /**
34
+ * @var array Maps object key names to GraphNode types.
35
+ */
36
+ protected static $graphObjectMap = [
37
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
38
+ 'venue' => '\Facebook\GraphNodes\GraphLocation',
39
+ ];
40
+
41
+ /**
42
+ * Returns the `id` (The Group ID) as string if present.
43
+ *
44
+ * @return string|null
45
+ */
46
+ public function getId()
47
+ {
48
+ return $this->getField('id');
49
+ }
50
+
51
+ /**
52
+ * Returns the `cover` (The cover photo of the Group) as GraphCoverPhoto if present.
53
+ *
54
+ * @return GraphCoverPhoto|null
55
+ */
56
+ public function getCover()
57
+ {
58
+ return $this->getField('cover');
59
+ }
60
+
61
+ /**
62
+ * Returns the `description` (A brief description of the Group) as string if present.
63
+ *
64
+ * @return string|null
65
+ */
66
+ public function getDescription()
67
+ {
68
+ return $this->getField('description');
69
+ }
70
+
71
+ /**
72
+ * Returns the `email` (The email address to upload content to the Group. Only current members of the Group can use this) as string if present.
73
+ *
74
+ * @return string|null
75
+ */
76
+ public function getEmail()
77
+ {
78
+ return $this->getField('email');
79
+ }
80
+
81
+ /**
82
+ * Returns the `icon` (The URL for the Group's icon) as string if present.
83
+ *
84
+ * @return string|null
85
+ */
86
+ public function getIcon()
87
+ {
88
+ return $this->getField('icon');
89
+ }
90
+
91
+ /**
92
+ * Returns the `link` (The Group's website) as string if present.
93
+ *
94
+ * @return string|null
95
+ */
96
+ public function getLink()
97
+ {
98
+ return $this->getField('link');
99
+ }
100
+
101
+ /**
102
+ * Returns the `name` (The name of the Group) as string if present.
103
+ *
104
+ * @return string|null
105
+ */
106
+ public function getName()
107
+ {
108
+ return $this->getField('name');
109
+ }
110
+
111
+ /**
112
+ * Returns the `member_request_count` (Number of people asking to join the group.) as int if present.
113
+ *
114
+ * @return int|null
115
+ */
116
+ public function getMemberRequestCount()
117
+ {
118
+ return $this->getField('member_request_count');
119
+ }
120
+
121
+ /**
122
+ * Returns the `owner` (The profile that created this Group) as GraphNode if present.
123
+ *
124
+ * @return GraphNode|null
125
+ */
126
+ public function getOwner()
127
+ {
128
+ return $this->getField('owner');
129
+ }
130
+
131
+ /**
132
+ * Returns the `parent` (The parent Group of this Group, if it exists) as GraphNode if present.
133
+ *
134
+ * @return GraphNode|null
135
+ */
136
+ public function getParent()
137
+ {
138
+ return $this->getField('parent');
139
+ }
140
+
141
+ /**
142
+ * Returns the `privacy` (The privacy setting of the Group) as string if present.
143
+ *
144
+ * @return string|null
145
+ */
146
+ public function getPrivacy()
147
+ {
148
+ return $this->getField('privacy');
149
+ }
150
+
151
+ /**
152
+ * Returns the `updated_time` (The last time the Group was updated (this includes changes in the Group's properties and changes in posts and comments if user can see them)) as \DateTime if present.
153
+ *
154
+ * @return \DateTime|null
155
+ */
156
+ public function getUpdatedTime()
157
+ {
158
+ return $this->getField('updated_time');
159
+ }
160
+
161
+ /**
162
+ * Returns the `venue` (The location for the Group) as GraphLocation if present.
163
+ *
164
+ * @return GraphLocation|null
165
+ */
166
+ public function getVenue()
167
+ {
168
+ return $this->getField('venue');
169
+ }
170
+
171
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphList.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphList
28
+ *
29
+ * @package Facebook
30
+ *
31
+ * @deprecated 5.0.0 GraphList has been renamed to GraphEdge
32
+ * @todo v6: Remove this class
33
+ */
34
+ class GraphList extends GraphEdge
35
+ {
36
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphLocation.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphLocation
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphLocation extends GraphNode
32
+ {
33
+ /**
34
+ * Returns the street component of the location
35
+ *
36
+ * @return string|null
37
+ */
38
+ public function getStreet()
39
+ {
40
+ return $this->getField('street');
41
+ }
42
+
43
+ /**
44
+ * Returns the city component of the location
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getCity()
49
+ {
50
+ return $this->getField('city');
51
+ }
52
+
53
+ /**
54
+ * Returns the state component of the location
55
+ *
56
+ * @return string|null
57
+ */
58
+ public function getState()
59
+ {
60
+ return $this->getField('state');
61
+ }
62
+
63
+ /**
64
+ * Returns the country component of the location
65
+ *
66
+ * @return string|null
67
+ */
68
+ public function getCountry()
69
+ {
70
+ return $this->getField('country');
71
+ }
72
+
73
+ /**
74
+ * Returns the zipcode component of the location
75
+ *
76
+ * @return string|null
77
+ */
78
+ public function getZip()
79
+ {
80
+ return $this->getField('zip');
81
+ }
82
+
83
+ /**
84
+ * Returns the latitude component of the location
85
+ *
86
+ * @return float|null
87
+ */
88
+ public function getLatitude()
89
+ {
90
+ return $this->getField('latitude');
91
+ }
92
+
93
+ /**
94
+ * Returns the street component of the location
95
+ *
96
+ * @return float|null
97
+ */
98
+ public function getLongitude()
99
+ {
100
+ return $this->getField('longitude');
101
+ }
102
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphNode.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphNode
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphNode extends Collection
32
+ {
33
+ /**
34
+ * @var array Maps object key names to Graph object types.
35
+ */
36
+ protected static $graphObjectMap = [];
37
+
38
+ /**
39
+ * Init this Graph object.
40
+ *
41
+ * @param array $data
42
+ */
43
+ public function __construct(array $data = [])
44
+ {
45
+ parent::__construct($this->castItems($data));
46
+ }
47
+
48
+ /**
49
+ * Iterates over an array and detects the types each node
50
+ * should be cast to and returns all the items as an array.
51
+ *
52
+ * @TODO Add auto-casting to AccessToken entities.
53
+ *
54
+ * @param array $data The array to iterate over.
55
+ *
56
+ * @return array
57
+ */
58
+ public function castItems(array $data)
59
+ {
60
+ $items = [];
61
+
62
+ foreach ($data as $k => $v) {
63
+ if ($this->shouldCastAsDateTime($k)
64
+ && (is_numeric($v)
65
+ || $k === 'birthday'
66
+ || $this->isIso8601DateString($v))
67
+ ) {
68
+ $items[$k] = $this->castToDateTime($v);
69
+ } else {
70
+ $items[$k] = $v;
71
+ }
72
+ }
73
+
74
+ return $items;
75
+ }
76
+
77
+ /**
78
+ * Uncasts any auto-casted datatypes.
79
+ * Basically the reverse of castItems().
80
+ *
81
+ * @return array
82
+ */
83
+ public function uncastItems()
84
+ {
85
+ $items = $this->asArray();
86
+
87
+ return array_map(function ($v) {
88
+ if ($v instanceof \DateTime) {
89
+ return $v->format(\DateTime::ISO8601);
90
+ }
91
+
92
+ return $v;
93
+ }, $items);
94
+ }
95
+
96
+ /**
97
+ * Get the collection of items as JSON.
98
+ *
99
+ * @param int $options
100
+ *
101
+ * @return string
102
+ */
103
+ public function asJson($options = 0)
104
+ {
105
+ return json_encode($this->uncastItems(), $options);
106
+ }
107
+
108
+ /**
109
+ * Detects an ISO 8601 formatted string.
110
+ *
111
+ * @param string $string
112
+ *
113
+ * @return boolean
114
+ *
115
+ * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#readmodifiers
116
+ * @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html
117
+ * @see http://en.wikipedia.org/wiki/ISO_8601
118
+ */
119
+ public function isIso8601DateString($string)
120
+ {
121
+ // This insane regex was yoinked from here:
122
+ // http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
123
+ // ...and I'm all like:
124
+ // http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why
125
+ $crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))'
126
+ . '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?'
127
+ . '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d'
128
+ . '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])'
129
+ . '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d'
130
+ . '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/';
131
+
132
+ return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1;
133
+ }
134
+
135
+ /**
136
+ * Determines if a value from Graph should be cast to DateTime.
137
+ *
138
+ * @param string $key
139
+ *
140
+ * @return boolean
141
+ */
142
+ public function shouldCastAsDateTime($key)
143
+ {
144
+ return in_array($key, [
145
+ 'created_time',
146
+ 'updated_time',
147
+ 'start_time',
148
+ 'end_time',
149
+ 'backdated_time',
150
+ 'issued_at',
151
+ 'expires_at',
152
+ 'birthday',
153
+ 'publish_time'
154
+ ], true);
155
+ }
156
+
157
+ /**
158
+ * Casts a date value from Graph to DateTime.
159
+ *
160
+ * @param int|string $value
161
+ *
162
+ * @return \DateTime
163
+ */
164
+ public function castToDateTime($value)
165
+ {
166
+ if (is_int($value)) {
167
+ $dt = new \DateTime();
168
+ $dt->setTimestamp($value);
169
+ } else {
170
+ $dt = new \DateTime($value);
171
+ }
172
+
173
+ return $dt;
174
+ }
175
+
176
+ /**
177
+ * Getter for $graphObjectMap.
178
+ *
179
+ * @return array
180
+ */
181
+ public static function getObjectMap()
182
+ {
183
+ return static::$graphObjectMap;
184
+ }
185
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ use Facebook\FacebookResponse;
27
+ use Facebook\Exceptions\FacebookSDKException;
28
+
29
+ /**
30
+ * Class GraphNodeFactory
31
+ *
32
+ * @package Facebook
33
+ *
34
+ * ## Assumptions ##
35
+ * GraphEdge - is ALWAYS a numeric array
36
+ * GraphEdge - is ALWAYS an array of GraphNode types
37
+ * GraphNode - is ALWAYS an associative array
38
+ * GraphNode - MAY contain GraphNode's "recurrable"
39
+ * GraphNode - MAY contain GraphEdge's "recurrable"
40
+ * GraphNode - MAY contain DateTime's "primitives"
41
+ * GraphNode - MAY contain string's "primitives"
42
+ */
43
+ class GraphNodeFactory
44
+ {
45
+ /**
46
+ * @const string The base graph object class.
47
+ */
48
+ const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphNode';
49
+
50
+ /**
51
+ * @const string The base graph edge class.
52
+ */
53
+ const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphEdge';
54
+
55
+ /**
56
+ * @const string The graph object prefix.
57
+ */
58
+ const BASE_GRAPH_OBJECT_PREFIX = '\Facebook\GraphNodes\\';
59
+
60
+ /**
61
+ * @var FacebookResponse The response entity from Graph.
62
+ */
63
+ protected $response;
64
+
65
+ /**
66
+ * @var array The decoded body of the FacebookResponse entity from Graph.
67
+ */
68
+ protected $decodedBody;
69
+
70
+ /**
71
+ * Init this Graph object.
72
+ *
73
+ * @param FacebookResponse $response The response entity from Graph.
74
+ */
75
+ public function __construct(FacebookResponse $response)
76
+ {
77
+ $this->response = $response;
78
+ $this->decodedBody = $response->getDecodedBody();
79
+ }
80
+
81
+ /**
82
+ * Tries to convert a FacebookResponse entity into a GraphNode.
83
+ *
84
+ * @param string|null $subclassName The GraphNode sub class to cast to.
85
+ *
86
+ * @return GraphNode
87
+ *
88
+ * @throws FacebookSDKException
89
+ */
90
+ public function makeGraphNode($subclassName = null)
91
+ {
92
+ $this->validateResponseAsArray();
93
+ $this->validateResponseCastableAsGraphNode();
94
+
95
+ return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
96
+ }
97
+
98
+ /**
99
+ * Convenience method for creating a GraphAchievement collection.
100
+ *
101
+ * @return GraphAchievement
102
+ *
103
+ * @throws FacebookSDKException
104
+ */
105
+ public function makeGraphAchievement()
106
+ {
107
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
108
+ }
109
+
110
+ /**
111
+ * Convenience method for creating a GraphAlbum collection.
112
+ *
113
+ * @return GraphAlbum
114
+ *
115
+ * @throws FacebookSDKException
116
+ */
117
+ public function makeGraphAlbum()
118
+ {
119
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
120
+ }
121
+
122
+ /**
123
+ * Convenience method for creating a GraphPage collection.
124
+ *
125
+ * @return GraphPage
126
+ *
127
+ * @throws FacebookSDKException
128
+ */
129
+ public function makeGraphPage()
130
+ {
131
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
132
+ }
133
+
134
+ /**
135
+ * Convenience method for creating a GraphSessionInfo collection.
136
+ *
137
+ * @return GraphSessionInfo
138
+ *
139
+ * @throws FacebookSDKException
140
+ */
141
+ public function makeGraphSessionInfo()
142
+ {
143
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
144
+ }
145
+
146
+ /**
147
+ * Convenience method for creating a GraphUser collection.
148
+ *
149
+ * @return GraphUser
150
+ *
151
+ * @throws FacebookSDKException
152
+ */
153
+ public function makeGraphUser()
154
+ {
155
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
156
+ }
157
+
158
+ /**
159
+ * Convenience method for creating a GraphEvent collection.
160
+ *
161
+ * @return GraphEvent
162
+ *
163
+ * @throws FacebookSDKException
164
+ */
165
+ public function makeGraphEvent()
166
+ {
167
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
168
+ }
169
+
170
+ /**
171
+ * Convenience method for creating a GraphGroup collection.
172
+ *
173
+ * @return GraphGroup
174
+ *
175
+ * @throws FacebookSDKException
176
+ */
177
+ public function makeGraphGroup()
178
+ {
179
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
180
+ }
181
+
182
+ /**
183
+ * Tries to convert a FacebookResponse entity into a GraphEdge.
184
+ *
185
+ * @param string|null $subclassName The GraphNode sub class to cast the list items to.
186
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
187
+ *
188
+ * @return GraphEdge
189
+ *
190
+ * @throws FacebookSDKException
191
+ */
192
+ public function makeGraphEdge($subclassName = null, $auto_prefix = true)
193
+ {
194
+ $this->validateResponseAsArray();
195
+ $this->validateResponseCastableAsGraphEdge();
196
+
197
+ if ($subclassName && $auto_prefix) {
198
+ $subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName;
199
+ }
200
+
201
+ return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
202
+ }
203
+
204
+ /**
205
+ * Validates the decoded body.
206
+ *
207
+ * @throws FacebookSDKException
208
+ */
209
+ public function validateResponseAsArray()
210
+ {
211
+ if (!is_array($this->decodedBody)) {
212
+ throw new FacebookSDKException('Unable to get response from Graph as array.', 620);
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Validates that the return data can be cast as a GraphNode.
218
+ *
219
+ * @throws FacebookSDKException
220
+ */
221
+ public function validateResponseCastableAsGraphNode()
222
+ {
223
+ if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) {
224
+ throw new FacebookSDKException(
225
+ 'Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.',
226
+ 620
227
+ );
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Validates that the return data can be cast as a GraphEdge.
233
+ *
234
+ * @throws FacebookSDKException
235
+ */
236
+ public function validateResponseCastableAsGraphEdge()
237
+ {
238
+ if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) {
239
+ throw new FacebookSDKException(
240
+ 'Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.',
241
+ 620
242
+ );
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Safely instantiates a GraphNode of $subclassName.
248
+ *
249
+ * @param array $data The array of data to iterate over.
250
+ * @param string|null $subclassName The subclass to cast this collection to.
251
+ *
252
+ * @return GraphNode
253
+ *
254
+ * @throws FacebookSDKException
255
+ */
256
+ public function safelyMakeGraphNode(array $data, $subclassName = null)
257
+ {
258
+ $subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS;
259
+ static::validateSubclass($subclassName);
260
+
261
+ // Remember the parent node ID
262
+ $parentNodeId = isset($data['id']) ? $data['id'] : null;
263
+
264
+ $items = [];
265
+
266
+ foreach ($data as $k => $v) {
267
+ // Array means could be recurable
268
+ if (is_array($v)) {
269
+ // Detect any smart-casting from the $graphObjectMap array.
270
+ // This is always empty on the GraphNode collection, but subclasses can define
271
+ // their own array of smart-casting types.
272
+ $graphObjectMap = $subclassName::getObjectMap();
273
+ $objectSubClass = isset($graphObjectMap[$k])
274
+ ? $graphObjectMap[$k]
275
+ : null;
276
+
277
+ // Could be a GraphEdge or GraphNode
278
+ $items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId);
279
+ } else {
280
+ $items[$k] = $v;
281
+ }
282
+ }
283
+
284
+ return new $subclassName($items);
285
+ }
286
+
287
+ /**
288
+ * Takes an array of values and determines how to cast each node.
289
+ *
290
+ * @param array $data The array of data to iterate over.
291
+ * @param string|null $subclassName The subclass to cast this collection to.
292
+ * @param string|null $parentKey The key of this data (Graph edge).
293
+ * @param string|null $parentNodeId The parent Graph node ID.
294
+ *
295
+ * @return GraphNode|GraphEdge
296
+ *
297
+ * @throws FacebookSDKException
298
+ */
299
+ public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
300
+ {
301
+ if (isset($data['data'])) {
302
+ // Create GraphEdge
303
+ if (static::isCastableAsGraphEdge($data['data'])) {
304
+ return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
305
+ }
306
+ // Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
307
+ $data = $data['data'];
308
+ }
309
+
310
+ // Create GraphNode
311
+ return $this->safelyMakeGraphNode($data, $subclassName);
312
+ }
313
+
314
+ /**
315
+ * Return an array of GraphNode's.
316
+ *
317
+ * @param array $data The array of data to iterate over.
318
+ * @param string|null $subclassName The GraphNode subclass to cast each item in the list to.
319
+ * @param string|null $parentKey The key of this data (Graph edge).
320
+ * @param string|null $parentNodeId The parent Graph node ID.
321
+ *
322
+ * @return GraphEdge
323
+ *
324
+ * @throws FacebookSDKException
325
+ */
326
+ public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
327
+ {
328
+ if (!isset($data['data'])) {
329
+ throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620);
330
+ }
331
+
332
+ $dataList = [];
333
+ foreach ($data['data'] as $graphNode) {
334
+ $dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName, $parentKey, $parentNodeId);
335
+ }
336
+
337
+ $metaData = $this->getMetaData($data);
338
+
339
+ // We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination)
340
+ $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null;
341
+ $className = static::BASE_GRAPH_EDGE_CLASS;
342
+
343
+ return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName);
344
+ }
345
+
346
+ /**
347
+ * Get the meta data from a list in a Graph response.
348
+ *
349
+ * @param array $data The Graph response.
350
+ *
351
+ * @return array
352
+ */
353
+ public function getMetaData(array $data)
354
+ {
355
+ unset($data['data']);
356
+
357
+ return $data;
358
+ }
359
+
360
+ /**
361
+ * Determines whether or not the data should be cast as a GraphEdge.
362
+ *
363
+ * @param array $data
364
+ *
365
+ * @return boolean
366
+ */
367
+ public static function isCastableAsGraphEdge(array $data)
368
+ {
369
+ if ($data === []) {
370
+ return true;
371
+ }
372
+
373
+ // Checks for a sequential numeric array which would be a GraphEdge
374
+ return array_keys($data) === range(0, count($data) - 1);
375
+ }
376
+
377
+ /**
378
+ * Ensures that the subclass in question is valid.
379
+ *
380
+ * @param string $subclassName The GraphNode subclass to validate.
381
+ *
382
+ * @throws FacebookSDKException
383
+ */
384
+ public static function validateSubclass($subclassName)
385
+ {
386
+ if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) {
387
+ return;
388
+ }
389
+
390
+ throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620);
391
+ }
392
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphObject.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphObject
28
+ *
29
+ * @package Facebook
30
+ *
31
+ * @deprecated 5.0.0 GraphObject has been renamed to GraphNode
32
+ * @todo v6: Remove this class
33
+ */
34
+ class GraphObject extends GraphNode
35
+ {
36
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphObjectFactory
28
+ *
29
+ * @package Facebook
30
+ *
31
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
32
+ * @todo v6: Remove this class
33
+ */
34
+ class GraphObjectFactory extends GraphNodeFactory
35
+ {
36
+ /**
37
+ * @const string The base graph object class.
38
+ */
39
+ const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphObject';
40
+
41
+ /**
42
+ * @const string The base graph edge class.
43
+ */
44
+ const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphList';
45
+
46
+ /**
47
+ * Tries to convert a FacebookResponse entity into a GraphNode.
48
+ *
49
+ * @param string|null $subclassName The GraphNode sub class to cast to.
50
+ *
51
+ * @return GraphNode
52
+ *
53
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
54
+ */
55
+ public function makeGraphObject($subclassName = null)
56
+ {
57
+ return $this->makeGraphNode($subclassName);
58
+ }
59
+
60
+ /**
61
+ * Convenience method for creating a GraphEvent collection.
62
+ *
63
+ * @return GraphEvent
64
+ *
65
+ * @throws FacebookSDKException
66
+ */
67
+ public function makeGraphEvent()
68
+ {
69
+ return $this->makeGraphObject(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
70
+ }
71
+
72
+ /**
73
+ * Tries to convert a FacebookResponse entity into a GraphEdge.
74
+ *
75
+ * @param string|null $subclassName The GraphNode sub class to cast the list items to.
76
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
77
+ *
78
+ * @return GraphEdge
79
+ *
80
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
81
+ */
82
+ public function makeGraphList($subclassName = null, $auto_prefix = true)
83
+ {
84
+ return $this->makeGraphEdge($subclassName, $auto_prefix);
85
+ }
86
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphPage.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphPage
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphPage extends GraphNode
32
+ {
33
+ /**
34
+ * @var array Maps object key names to Graph object types.
35
+ */
36
+ protected static $graphObjectMap = [
37
+ 'best_page' => '\Facebook\GraphNodes\GraphPage',
38
+ 'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
39
+ 'location' => '\Facebook\GraphNodes\GraphLocation',
40
+ ];
41
+
42
+ /**
43
+ * Returns the ID for the user's page as a string if present.
44
+ *
45
+ * @return string|null
46
+ */
47
+ public function getId()
48
+ {
49
+ return $this->getField('id');
50
+ }
51
+
52
+ /**
53
+ * Returns the Category for the user's page as a string if present.
54
+ *
55
+ * @return string|null
56
+ */
57
+ public function getCategory()
58
+ {
59
+ return $this->getField('category');
60
+ }
61
+
62
+ /**
63
+ * Returns the Name of the user's page as a string if present.
64
+ *
65
+ * @return string|null
66
+ */
67
+ public function getName()
68
+ {
69
+ return $this->getField('name');
70
+ }
71
+
72
+ /**
73
+ * Returns the best available Page on Facebook.
74
+ *
75
+ * @return GraphPage|null
76
+ */
77
+ public function getBestPage()
78
+ {
79
+ return $this->getField('best_page');
80
+ }
81
+
82
+ /**
83
+ * Returns the brand's global (parent) Page.
84
+ *
85
+ * @return GraphPage|null
86
+ */
87
+ public function getGlobalBrandParentPage()
88
+ {
89
+ return $this->getField('global_brand_parent_page');
90
+ }
91
+
92
+ /**
93
+ * Returns the location of this place.
94
+ *
95
+ * @return GraphLocation|null
96
+ */
97
+ public function getLocation()
98
+ {
99
+ return $this->getField('location');
100
+ }
101
+
102
+ /**
103
+ * Returns the page access token for the admin user.
104
+ *
105
+ * Only available in the `/me/accounts` context.
106
+ *
107
+ * @return string|null
108
+ */
109
+ public function getAccessToken()
110
+ {
111
+ return $this->getField('access_token');
112
+ }
113
+
114
+ /**
115
+ * Returns the roles of the page admin user.
116
+ *
117
+ * Only available in the `/me/accounts` context.
118
+ *
119
+ * @return array|null
120
+ */
121
+ public function getPerms()
122
+ {
123
+ return $this->getField('perms');
124
+ }
125
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphPicture.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphPicture
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphPicture extends GraphNode
32
+ {
33
+ /**
34
+ * Returns true if user picture is silhouette.
35
+ *
36
+ * @return bool|null
37
+ */
38
+ public function isSilhouette()
39
+ {
40
+ return $this->getField('is_silhouette');
41
+ }
42
+
43
+ /**
44
+ * Returns the url of user picture if it exists
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getUrl()
49
+ {
50
+ return $this->getField('url');
51
+ }
52
+
53
+ /**
54
+ * Returns the width of user picture if it exists
55
+ *
56
+ * @return int|null
57
+ */
58
+ public function getWidth()
59
+ {
60
+ return $this->getField('width');
61
+ }
62
+
63
+ /**
64
+ * Returns the height of user picture if it exists
65
+ *
66
+ * @return int|null
67
+ */
68
+ public function getHeight()
69
+ {
70
+ return $this->getField('height');
71
+ }
72
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphSessionInfo
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphSessionInfo extends GraphNode
32
+ {
33
+ /**
34
+ * Returns the application id the token was issued for.
35
+ *
36
+ * @return string|null
37
+ */
38
+ public function getAppId()
39
+ {
40
+ return $this->getField('app_id');
41
+ }
42
+
43
+ /**
44
+ * Returns the application name the token was issued for.
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getApplication()
49
+ {
50
+ return $this->getField('application');
51
+ }
52
+
53
+ /**
54
+ * Returns the date & time that the token expires.
55
+ *
56
+ * @return \DateTime|null
57
+ */
58
+ public function getExpiresAt()
59
+ {
60
+ return $this->getField('expires_at');
61
+ }
62
+
63
+ /**
64
+ * Returns whether the token is valid.
65
+ *
66
+ * @return boolean
67
+ */
68
+ public function getIsValid()
69
+ {
70
+ return $this->getField('is_valid');
71
+ }
72
+
73
+ /**
74
+ * Returns the date & time the token was issued at.
75
+ *
76
+ * @return \DateTime|null
77
+ */
78
+ public function getIssuedAt()
79
+ {
80
+ return $this->getField('issued_at');
81
+ }
82
+
83
+ /**
84
+ * Returns the scope permissions associated with the token.
85
+ *
86
+ * @return array
87
+ */
88
+ public function getScopes()
89
+ {
90
+ return $this->getField('scopes');
91
+ }
92
+
93
+ /**
94
+ * Returns the login id of the user associated with the token.
95
+ *
96
+ * @return string|null
97
+ */
98
+ public function getUserId()
99
+ {
100
+ return $this->getField('user_id');
101
+ }
102
+ }
framework/facebook-sdk/src/Facebook/GraphNodes/GraphUser.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\GraphNodes;
25
+
26
+ /**
27
+ * Class GraphUser
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphUser extends GraphNode
32
+ {
33
+ /**
34
+ * @var array Maps object key names to Graph object types.
35
+ */
36
+ protected static $graphObjectMap = [
37
+ 'hometown' => '\Facebook\GraphNodes\GraphPage',
38
+ 'location' => '\Facebook\GraphNodes\GraphPage',
39
+ 'significant_other' => '\Facebook\GraphNodes\GraphUser',
40
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
41
+ ];
42
+
43
+ /**
44
+ * Returns the ID for the user as a string if present.
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getId()
49
+ {
50
+ return $this->getField('id');
51
+ }
52
+
53
+ /**
54
+ * Returns the name for the user as a string if present.
55
+ *
56
+ * @return string|null
57
+ */
58
+ public function getName()
59
+ {
60
+ return $this->getField('name');
61
+ }
62
+
63
+ /**
64
+ * Returns the first name for the user as a string if present.
65
+ *
66
+ * @return string|null
67
+ */
68
+ public function getFirstName()
69
+ {
70
+ return $this->getField('first_name');
71
+ }
72
+
73
+ /**
74
+ * Returns the middle name for the user as a string if present.
75
+ *
76
+ * @return string|null
77
+ */
78
+ public function getMiddleName()
79
+ {
80
+ return $this->getField('middle_name');
81
+ }
82
+
83
+ /**
84
+ * Returns the last name for the user as a string if present.
85
+ *
86
+ * @return string|null
87
+ */
88
+ public function getLastName()
89
+ {
90
+ return $this->getField('last_name');
91
+ }
92
+
93
+ /**
94
+ * Returns the gender for the user as a string if present.
95
+ *
96
+ * @return string|null
97
+ */
98
+ public function getGender()
99
+ {
100
+ return $this->getField('gender');
101
+ }
102
+
103
+ /**
104
+ * Returns the Facebook URL for the user as a string if available.
105
+ *
106
+ * @return string|null
107
+ */
108
+ public function getLink()
109
+ {
110
+ return $this->getField('link');
111
+ }
112
+
113
+ /**
114
+ * Returns the users birthday, if available.
115
+ *
116
+ * @return \DateTime|null
117
+ */
118
+ public function getBirthday()
119
+ {
120
+ return $this->getField('birthday');
121
+ }
122
+
123
+ /**
124
+ * Returns the current location of the user as a GraphPage.
125
+ *
126
+ * @return GraphPage|null
127
+ */
128
+ public function getLocation()
129
+ {
130
+ return $this->getField('location');
131
+ }
132
+
133
+ /**
134
+ * Returns the current location of the user as a GraphPage.
135
+ *
136
+ * @return GraphPage|null
137
+ */
138
+ public function getHometown()
139
+ {
140
+ return $this->getField('hometown');
141
+ }
142
+
143
+ /**
144
+ * Returns the current location of the user as a GraphUser.
145
+ *
146
+ * @return GraphUser|null
147
+ */
148
+ public function getSignificantOther()
149
+ {
150
+ return $this->getField('significant_other');
151
+ }
152
+
153
+ /**
154
+ * Returns the picture of the user as a GraphPicture
155
+ *
156
+ * @return GraphPicture|null
157
+ */
158
+ public function getPicture()
159
+ {
160
+ return $this->getField('picture');
161
+ }
162
+ }
framework/facebook-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Helpers;
25
+
26
+ /**
27
+ * Class FacebookCanvasLoginHelper
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookCanvasHelper extends FacebookSignedRequestFromInputHelper
32
+ {
33
+ /**
34
+ * Returns the app data value.
35
+ *
36
+ * @return mixed|null
37
+ */
38
+ public function getAppData()
39
+ {
40
+ return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
41
+ }
42
+
43
+ /**
44
+ * Get raw signed request from POST.
45
+ *
46
+ * @return string|null
47
+ */
48
+ public function getRawSignedRequest()
49
+ {
50
+ return $this->getRawSignedRequestFromPost() ?: null;
51
+ }
52
+ }
framework/facebook-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Helpers;
25
+
26
+ /**
27
+ * Class FacebookJavaScriptLoginHelper
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookJavaScriptHelper extends FacebookSignedRequestFromInputHelper
32
+ {
33
+ /**
34
+ * Get raw signed request from the cookie.
35
+ *
36
+ * @return string|null
37
+ */
38
+ public function getRawSignedRequest()
39
+ {
40
+ return $this->getRawSignedRequestFromCookie();
41
+ }
42
+ }
framework/facebook-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Helpers;
25
+
26
+ use Facebook\FacebookApp;
27
+ use Facebook\FacebookClient;
28
+
29
+ /**
30
+ * Class FacebookPageTabHelper
31
+ *
32
+ * @package Facebook
33
+ */
34
+ class FacebookPageTabHelper extends FacebookCanvasHelper
35
+ {
36
+ /**
37
+ * @var array|null
38
+ */
39
+ protected $pageData;
40
+
41
+ /**
42
+ * Initialize the helper and process available signed request data.
43
+ *
44
+ * @param FacebookApp $app The FacebookApp entity.
45
+ * @param FacebookClient $client The client to make HTTP requests.
46
+ * @param string|null $graphVersion The version of Graph to use.
47
+ */
48
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
49
+ {
50
+ parent::__construct($app, $client, $graphVersion);
51
+
52
+ if (!$this->signedRequest) {
53
+ return;
54
+ }
55
+
56
+ $this->pageData = $this->signedRequest->get('page');
57
+ }
58
+
59
+ /**
60
+ * Returns a value from the page data.
61
+ *
62
+ * @param string $key
63
+ * @param mixed|null $default
64
+ *
65
+ * @return mixed|null
66
+ */
67
+ public function getPageData($key, $default = null)
68
+ {
69
+ if (isset($this->pageData[$key])) {
70
+ return $this->pageData[$key];
71
+ }
72
+
73
+ return $default;
74
+ }
75
+
76
+ /**
77
+ * Returns true if the user is an admin.
78
+ *
79
+ * @return boolean
80
+ */
81
+ public function isAdmin()
82
+ {
83
+ return $this->getPageData('admin') === true;
84
+ }
85
+
86
+ /**
87
+ * Returns the page id if available.
88
+ *
89
+ * @return string|null
90
+ */
91
+ public function getPageId()
92
+ {
93
+ return $this->getPageData('id');
94
+ }
95
+ }
framework/facebook-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Helpers;
25
+
26
+ use Facebook\Authentication\AccessToken;
27
+ use Facebook\Authentication\OAuth2Client;
28
+ use Facebook\Url\UrlDetectionInterface;
29
+ use Facebook\Url\FacebookUrlDetectionHandler;
30
+ use Facebook\Url\FacebookUrlManipulator;
31
+ use Facebook\PersistentData\PersistentDataInterface;
32
+ use Facebook\PersistentData\FacebookSessionPersistentDataHandler;
33
+ use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
34
+ use Facebook\PseudoRandomString\McryptPseudoRandomStringGenerator;
35
+ use Facebook\PseudoRandomString\OpenSslPseudoRandomStringGenerator;
36
+ use Facebook\PseudoRandomString\UrandomPseudoRandomStringGenerator;
37
+ use Facebook\Exceptions\FacebookSDKException;
38
+
39
+ /**
40
+ * Class FacebookRedirectLoginHelper
41
+ *
42
+ * @package Facebook
43
+ */
44
+ class FacebookRedirectLoginHelper
45
+ {
46
+ /**
47
+ * @const int The length of CSRF string to validate the login link.
48
+ */
49
+ const CSRF_LENGTH = 32;
50
+
51
+ /**
52
+ * @var OAuth2Client The OAuth 2.0 client service.
53
+ */
54
+ protected $oAuth2Client;
55
+
56
+ /**
57
+ * @var UrlDetectionInterface The URL detection handler.
58
+ */
59
+ protected $urlDetectionHandler;
60
+
61
+ /**
62
+ * @var PersistentDataInterface The persistent data handler.
63
+ */
64
+ protected $persistentDataHandler;
65
+
66
+ /**
67
+ * @var PseudoRandomStringGeneratorInterface The cryptographically secure pseudo-random string generator.
68
+ */
69
+ protected $pseudoRandomStringGenerator;
70
+
71
+ /**
72
+ * @param OAuth2Client $oAuth2Client The OAuth 2.0 client service.
73
+ * @param PersistentDataInterface|null $persistentDataHandler The persistent data handler.
74
+ * @param UrlDetectionInterface|null $urlHandler The URL detection handler.
75
+ * @param PseudoRandomStringGeneratorInterface|null $prsg The cryptographically secure pseudo-random string generator.
76
+ */
77
+ public function __construct(OAuth2Client $oAuth2Client, PersistentDataInterface $persistentDataHandler = null, UrlDetectionInterface $urlHandler = null, PseudoRandomStringGeneratorInterface $prsg = null)
78
+ {
79
+ $this->oAuth2Client = $oAuth2Client;
80
+ $this->persistentDataHandler = $persistentDataHandler ?: new FacebookSessionPersistentDataHandler();
81
+ $this->urlDetectionHandler = $urlHandler ?: new FacebookUrlDetectionHandler();
82
+ $this->pseudoRandomStringGenerator = $prsg ?: $this->detectPseudoRandomStringGenerator();
83
+ }
84
+
85
+ /**
86
+ * Returns the persistent data handler.
87
+ *
88
+ * @return PersistentDataInterface
89
+ */
90
+ public function getPersistentDataHandler()
91
+ {
92
+ return $this->persistentDataHandler;
93
+ }
94
+
95
+ /**
96
+ * Returns the URL detection handler.
97
+ *
98
+ * @return UrlDetectionInterface
99
+ */
100
+ public function getUrlDetectionHandler()
101
+ {
102
+ return $this->urlDetectionHandler;
103
+ }
104
+
105
+ /**
106
+ * Returns the cryptographically secure pseudo-random string generator.
107
+ *
108
+ * @return PseudoRandomStringGeneratorInterface
109
+ */
110
+ public function getPseudoRandomStringGenerator()
111
+ {
112
+ return $this->pseudoRandomStringGenerator;
113
+ }
114
+
115
+ /**
116
+ * Detects which pseudo-random string generator to use.
117
+ *
118
+ * @return PseudoRandomStringGeneratorInterface
119
+ *
120
+ * @throws FacebookSDKException
121
+ */
122
+ public function detectPseudoRandomStringGenerator()
123
+ {
124
+ // Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically
125
+ // secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() first.
126
+ if (function_exists('mcrypt_create_iv')) {
127
+ return new McryptPseudoRandomStringGenerator();
128
+ }
129
+
130
+ if (function_exists('openssl_random_pseudo_bytes')) {
131
+ return new OpenSslPseudoRandomStringGenerator();
132
+ }
133
+
134
+ if (!ini_get('open_basedir') && is_readable('/dev/urandom')) {
135
+ return new UrandomPseudoRandomStringGenerator();
136
+ }
137
+
138
+ throw new FacebookSDKException('Unable to detect a cryptographically secure pseudo-random string generator.');
139
+ }
140
+
141
+ /**
142
+ * Stores CSRF state and returns a URL to which the user should be sent to in order to continue the login process with Facebook.
143
+ *
144
+ * @param string $redirectUrl The URL Facebook should redirect users to after login.
145
+ * @param array $scope List of permissions to request during login.
146
+ * @param array $params An array of parameters to generate URL.
147
+ * @param string $separator The separator to use in http_build_query().
148
+ *
149
+ * @return string
150
+ */
151
+ private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
152
+ {
153
+ $state = $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
154
+ $this->persistentDataHandler->set('state', $state);
155
+
156
+ return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
157
+ }
158
+
159
+ /**
160
+ * Returns the URL to send the user in order to login to Facebook.
161
+ *
162
+ * @param string $redirectUrl The URL Facebook should redirect users to after login.
163
+ * @param array $scope List of permissions to request during login.
164
+ * @param string $separator The separator to use in http_build_query().
165
+ *
166
+ * @return string
167
+ */
168
+ public function getLoginUrl($redirectUrl, array $scope = [], $separator = '&')
169
+ {
170
+ return $this->makeUrl($redirectUrl, $scope, [], $separator);
171
+ }
172
+
173
+ /**
174
+ * Returns the URL to send the user in order to log out of Facebook.
175
+ *
176
+ * @param AccessToken|string $accessToken The access token that will be logged out.
177
+ * @param string $next The url Facebook should redirect the user to after a successful logout.
178
+ * @param string $separator The separator to use in http_build_query().
179
+ *
180
+ * @return string
181
+ *
182
+ * @throws FacebookSDKException
183
+ */
184
+ public function getLogoutUrl($accessToken, $next, $separator = '&')
185
+ {
186
+ if (!$accessToken instanceof AccessToken) {
187
+ $accessToken = new AccessToken($accessToken);
188
+ }
189
+
190
+ if ($accessToken->isAppAccessToken()) {
191
+ throw new FacebookSDKException('Cannot generate a logout URL with an app access token.', 722);
192
+ }
193
+
194
+ $params = [
195
+ 'next' => $next,
196
+ 'access_token' => $accessToken->getValue(),
197
+ ];
198
+
199
+ return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, $separator);
200
+ }
201
+
202
+ /**
203
+ * Returns the URL to send the user in order to login to Facebook with permission(s) to be re-asked.
204
+ *
205
+ * @param string $redirectUrl The URL Facebook should redirect users to after login.
206
+ * @param array $scope List of permissions to request during login.
207
+ * @param string $separator The separator to use in http_build_query().
208
+ *
209
+ * @return string
210
+ */
211
+ public function getReRequestUrl($redirectUrl, array $scope = [], $separator = '&')
212
+ {
213
+ $params = ['auth_type' => 'rerequest'];
214
+
215
+ return $this->makeUrl($redirectUrl, $scope, $params, $separator);
216
+ }
217
+
218
+ /**
219
+ * Returns the URL to send the user in order to login to Facebook with user to be re-authenticated.
220
+ *
221
+ * @param string $redirectUrl The URL Facebook should redirect users to after login.
222
+ * @param array $scope List of permissions to request during login.
223
+ * @param string $separator The separator to use in http_build_query().
224
+ *
225
+ * @return string
226
+ */
227
+ public function getReAuthenticationUrl($redirectUrl, array $scope = [], $separator = '&')
228
+ {
229
+ $params = ['auth_type' => 'reauthenticate'];
230
+
231
+ return $this->makeUrl($redirectUrl, $scope, $params, $separator);
232
+ }
233
+
234
+ /**
235
+ * Takes a valid code from a login redirect, and returns an AccessToken entity.
236
+ *
237
+ * @param string|null $redirectUrl The redirect URL.
238
+ *
239
+ * @return AccessToken|null
240
+ *
241
+ * @throws FacebookSDKException
242
+ */
243
+ public function getAccessToken($redirectUrl = null)
244
+ {
245
+ if (!$code = $this->getCode()) {
246
+ return null;
247
+ }
248
+
249
+ $this->validateCsrf();
250
+
251
+ $redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
252
+ // At minimum we need to remove the state param
253
+ $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);
254
+
255
+ return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
256
+ }
257
+
258
+ /**
259
+ * Validate the request against a cross-site request forgery.
260
+ *
261
+ * @throws FacebookSDKException
262
+ */
263
+ protected function validateCsrf()
264
+ {
265
+ $state = $this->getState();
266
+ $savedState = $this->persistentDataHandler->get('state');
267
+
268
+ if (!$state || !$savedState) {
269
+ throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing.');
270
+ }
271
+
272
+ $savedLen = strlen($savedState);
273
+ $givenLen = strlen($state);
274
+
275
+ if ($savedLen !== $givenLen) {
276
+ throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
277
+ }
278
+
279
+ $result = 0;
280
+ for ($i = 0; $i < $savedLen; $i++) {
281
+ $result |= ord($state[$i]) ^ ord($savedState[$i]);
282
+ }
283
+
284
+ if ($result !== 0) {
285
+ throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Return the code.
291
+ *
292
+ * @return string|null
293
+ */
294
+ protected function getCode()
295
+ {
296
+ return $this->getInput('code');
297
+ }
298
+
299
+ /**
300
+ * Return the state.
301
+ *
302
+ * @return string|null
303
+ */
304
+ protected function getState()
305
+ {
306
+ return $this->getInput('state');
307
+ }
308
+
309
+ /**
310
+ * Return the error code.
311
+ *
312
+ * @return string|null
313
+ */
314
+ public function getErrorCode()
315
+ {
316
+ return $this->getInput('error_code');
317
+ }
318
+
319
+ /**
320
+ * Returns the error.
321
+ *
322
+ * @return string|null
323
+ */
324
+ public function getError()
325
+ {
326
+ return $this->getInput('error');
327
+ }
328
+
329
+ /**
330
+ * Returns the error reason.
331
+ *
332
+ * @return string|null
333
+ */
334
+ public function getErrorReason()
335
+ {
336
+ return $this->getInput('error_reason');
337
+ }
338
+
339
+ /**
340
+ * Returns the error description.
341
+ *
342
+ * @return string|null
343
+ */
344
+ public function getErrorDescription()
345
+ {
346
+ return $this->getInput('error_description');
347
+ }
348
+
349
+ /**
350
+ * Returns a value from a GET param.
351
+ *
352
+ * @param string $key
353
+ *
354
+ * @return string|null
355
+ */
356
+ private function getInput($key)
357
+ {
358
+ return isset($_GET[$key]) ? $_GET[$key] : null;
359
+ }
360
+ }
framework/facebook-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Helpers;
25
+
26
+ use Facebook\Facebook;
27
+ use Facebook\FacebookApp;
28
+ use Facebook\FacebookClient;
29
+ use Facebook\SignedRequest;
30
+ use Facebook\Authentication\AccessToken;
31
+ use Facebook\Authentication\OAuth2Client;
32
+
33
+ /**
34
+ * Class FacebookSignedRequestFromInputHelper
35
+ *
36
+ * @package Facebook
37
+ */
38
+ abstract class FacebookSignedRequestFromInputHelper
39
+ {
40
+ /**
41
+ * @var SignedRequest|null The SignedRequest entity.
42
+ */
43
+ protected $signedRequest;
44
+
45
+ /**
46
+ * @var FacebookApp The FacebookApp entity.
47
+ */
48
+ protected $app;
49
+
50
+ /**
51
+ * @var OAuth2Client The OAuth 2.0 client service.
52
+ */
53
+ protected $oAuth2Client;
54
+
55
+ /**
56
+ * Initialize the helper and process available signed request data.
57
+ *
58
+ * @param FacebookApp $app The FacebookApp entity.
59
+ * @param FacebookClient $client The client to make HTTP requests.
60
+ * @param string|null $graphVersion The version of Graph to use.
61
+ */
62
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
63
+ {
64
+ $this->app = $app;
65
+ $graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
66
+ $this->oAuth2Client = new OAuth2Client($this->app, $client, $graphVersion);
67
+
68
+ $this->instantiateSignedRequest();
69
+ }
70
+
71
+ /**
72
+ * Instantiates a new SignedRequest entity.
73
+ *
74
+ * @param string|null
75
+ */
76
+ public function instantiateSignedRequest($rawSignedRequest = null)
77
+ {
78
+ $rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
79
+
80
+ if (!$rawSignedRequest) {
81
+ return;
82
+ }
83
+
84
+ $this->signedRequest = new SignedRequest($this->app, $rawSignedRequest);
85
+ }
86
+
87
+ /**
88
+ * Returns an AccessToken entity from the signed request.
89
+ *
90
+ * @return AccessToken|null
91
+ *
92
+ * @throws \Facebook\Exceptions\FacebookSDKException
93
+ */
94
+ public function getAccessToken()
95
+ {
96
+ if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
97
+ $code = $this->signedRequest->get('code');
98
+ $accessToken = $this->signedRequest->get('oauth_token');
99
+
100
+ if ($code && !$accessToken) {
101
+ return $this->oAuth2Client->getAccessTokenFromCode($code);
102
+ }
103
+
104
+ $expiresAt = $this->signedRequest->get('expires', 0);
105
+
106
+ return new AccessToken($accessToken, $expiresAt);
107
+ }
108
+
109
+ return null;
110
+ }
111
+
112
+ /**
113
+ * Returns the SignedRequest entity.
114
+ *
115
+ * @return SignedRequest|null
116
+ */
117
+ public function getSignedRequest()
118
+ {
119
+ return $this->signedRequest;
120
+ }
121
+
122
+ /**
123
+ * Returns the user_id if available.
124
+ *
125
+ * @return string|null
126
+ */
127
+ public function getUserId()
128
+ {
129
+ return $this->signedRequest ? $this->signedRequest->getUserId() : null;
130
+ }
131
+
132
+ /**
133
+ * Get raw signed request from input.
134
+ *
135
+ * @return string|null
136
+ */
137
+ abstract public function getRawSignedRequest();
138
+
139
+ /**
140
+ * Get raw signed request from POST input.
141
+ *
142
+ * @return string|null
143
+ */
144
+ public function getRawSignedRequestFromPost()
145
+ {
146
+ if (isset($_POST['signed_request'])) {
147
+ return $_POST['signed_request'];
148
+ }
149
+
150
+ return null;
151
+ }
152
+
153
+ /**
154
+ * Get raw signed request from cookie set from the Javascript SDK.
155
+ *
156
+ * @return string|null
157
+ */
158
+ public function getRawSignedRequestFromCookie()
159
+ {
160
+ if (isset($_COOKIE['fbsr_' . $this->app->getId()])) {
161
+ return $_COOKIE['fbsr_' . $this->app->getId()];
162
+ }
163
+
164
+ return null;
165
+ }
166
+ }
framework/facebook-sdk/src/Facebook/Http/GraphRawResponse.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Http;
25
+
26
+ /**
27
+ * Class GraphRawResponse
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class GraphRawResponse
32
+ {
33
+ /**
34
+ * @var array The response headers in the form of an associative array.
35
+ */
36
+ protected $headers;
37
+
38
+ /**
39
+ * @var string The raw response body.
40
+ */
41
+ protected $body;
42
+
43
+ /**
44
+ * @var int The HTTP status response code.
45
+ */
46
+ protected $httpResponseCode;
47
+
48
+ /**
49
+ * Creates a new GraphRawResponse entity.
50
+ *
51
+ * @param string|array $headers The headers as a raw string or array.
52
+ * @param string $body The raw response body.
53
+ * @param int $httpStatusCode The HTTP response code (if sending headers as parsed array).
54
+ */
55
+ public function __construct($headers, $body, $httpStatusCode = null)
56
+ {
57
+ if (is_numeric($httpStatusCode)) {
58
+ $this->httpResponseCode = (int)$httpStatusCode;
59
+ }
60
+
61
+ if (is_array($headers)) {
62
+ $this->headers = $headers;
63
+ } else {
64
+ $this->setHeadersFromString($headers);
65
+ }
66
+
67
+ $this->body = $body;
68
+ }
69
+
70
+ /**
71
+ * Return the response headers.
72
+ *
73
+ * @return array
74
+ */
75
+ public function getHeaders()
76
+ {
77
+ return $this->headers;
78
+ }
79
+
80
+ /**
81
+ * Return the body of the response.
82
+ *
83
+ * @return string
84
+ */
85
+ public function getBody()
86
+ {
87
+ return $this->body;
88
+ }
89
+
90
+ /**
91
+ * Return the HTTP response code.
92
+ *
93
+ * @return int
94
+ */
95
+ public function getHttpResponseCode()
96
+ {
97
+ return $this->httpResponseCode;
98
+ }
99
+
100
+ /**
101
+ * Sets the HTTP response code from a raw header.
102
+ *
103
+ * @param string $rawResponseHeader
104
+ */
105
+ public function setHttpResponseCodeFromHeader($rawResponseHeader)
106
+ {
107
+ preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match);
108
+ $this->httpResponseCode = (int)$match[1];
109
+ }
110
+
111
+ /**
112
+ * Parse the raw headers and set as an array.
113
+ *
114
+ * @param string $rawHeaders The raw headers from the response.
115
+ */
116
+ protected function setHeadersFromString($rawHeaders)
117
+ {
118
+ // Normalize line breaks
119
+ $rawHeaders = str_replace("\r\n", "\n", $rawHeaders);
120
+
121
+ // There will be multiple headers if a 301 was followed
122
+ // or a proxy was followed, etc
123
+ $headerCollection = explode("\n\n", trim($rawHeaders));
124
+ // We just want the last response (at the end)
125
+ $rawHeader = array_pop($headerCollection);
126
+
127
+ $headerComponents = explode("\n", $rawHeader);
128
+ foreach ($headerComponents as $line) {
129
+ if (strpos($line, ': ') === false) {
130
+ $this->setHttpResponseCodeFromHeader($line);
131
+ } else {
132
+ list($key, $value) = explode(': ', $line);
133
+ $this->headers[$key] = $value;
134
+ }
135
+ }
136
+ }
137
+ }
framework/facebook-sdk/src/Facebook/Http/RequestBodyInterface.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Http;
25
+
26
+ /**
27
+ * Interface
28
+ *
29
+ * @package Facebook
30
+ */
31
+ interface RequestBodyInterface
32
+ {
33
+ /**
34
+ * Get the body of the request to send to Graph.
35
+ *
36
+ * @return string
37
+ */
38
+ public function getBody();
39
+ }
framework/facebook-sdk/src/Facebook/Http/RequestBodyMultipart.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Http;
25
+
26
+ use Facebook\FileUpload\FacebookFile;
27
+
28
+ /**
29
+ * Class RequestBodyMultipartt
30
+ *
31
+ * Some things copied from Guzzle
32
+ *
33
+ * @package Facebook
34
+ *
35
+ * @see https://github.com/guzzle/guzzle/blob/master/src/Post/MultipartBody.php
36
+ */
37
+ class RequestBodyMultipart implements RequestBodyInterface
38
+ {
39
+ /**
40
+ * @var string The boundary.
41
+ */
42
+ private $boundary;
43
+
44
+ /**
45
+ * @var array The parameters to send with this request.
46
+ */
47
+ private $params;
48
+
49
+ /**
50
+ * @var array The files to send with this request.
51
+ */
52
+ private $files = [];
53
+
54
+ /**
55
+ * @param array $params The parameters to send with this request.
56
+ * @param array $files The files to send with this request.
57
+ * @param string $boundary Provide a specific boundary.
58
+ */
59
+ public function __construct(array $params = [], array $files = [], $boundary = null)
60
+ {
61
+ $this->params = $params;
62
+ $this->files = $files;
63
+ $this->boundary = $boundary ?: uniqid();
64
+ }
65
+
66
+ /**
67
+ * @inheritdoc
68
+ */
69
+ public function getBody()
70
+ {
71
+ $body = '';
72
+
73
+ // Compile normal params
74
+ $params = $this->getNestedParams($this->params);
75
+ foreach ($params as $k => $v) {
76
+ $body .= $this->getParamString($k, $v);
77
+ }
78
+
79
+ // Compile files
80
+ foreach ($this->files as $k => $v) {
81
+ $body .= $this->getFileString($k, $v);
82
+ }
83
+
84
+ // Peace out
85
+ $body .= "--{$this->boundary}--\r\n";
86
+
87
+ return $body;
88
+ }
89
+
90
+ /**
91
+ * Get the boundary
92
+ *
93
+ * @return string
94
+ */
95
+ public function getBoundary()
96
+ {
97
+ return $this->boundary;
98
+ }
99
+
100
+ /**
101
+ * Get the string needed to transfer a file.
102
+ *
103
+ * @param string $name
104
+ * @param FacebookFile $file
105
+ *
106
+ * @return string
107
+ */
108
+ private function getFileString($name, FacebookFile $file)
109
+ {
110
+ return sprintf(
111
+ "--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"%s\r\n\r\n%s\r\n",
112
+ $this->boundary,
113
+ $name,
114
+ $file->getFileName(),
115
+ $this->getFileHeaders($file),
116
+ $file->getContents()
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Get the string needed to transfer a POST field.
122
+ *
123
+ * @param string $name
124
+ * @param string $value
125
+ *
126
+ * @return string
127
+ */
128
+ private function getParamString($name, $value)
129
+ {
130
+ return sprintf(
131
+ "--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n",
132
+ $this->boundary,
133
+ $name,
134
+ $value
135
+ );
136
+ }
137
+
138
+ /**
139
+ * Returns the params as an array of nested params.
140
+ *
141
+ * @param array $params
142
+ *
143
+ * @return array
144
+ */
145
+ private function getNestedParams(array $params)
146
+ {
147
+ $query = http_build_query($params, null, '&');
148
+ $params = explode('&', $query);
149
+ $result = [];
150
+
151
+ foreach ($params as $param) {
152
+ list($key, $value) = explode('=', $param, 2);
153
+ $result[urldecode($key)] = urldecode($value);
154
+ }
155
+
156
+ return $result;
157
+ }
158
+
159
+ /**
160
+ * Get the headers needed before transferring the content of a POST file.
161
+ *
162
+ * @param FacebookFile $file
163
+ *
164
+ * @return string
165
+ */
166
+ protected function getFileHeaders(FacebookFile $file)
167
+ {
168
+ return "\r\nContent-Type: {$file->getMimetype()}";
169
+ }
170
+ }
framework/facebook-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Http;
25
+
26
+ /**
27
+ * Class RequestBodyUrlEncoded
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class RequestBodyUrlEncoded implements RequestBodyInterface
32
+ {
33
+ /**
34
+ * @var array The parameters to send with this request.
35
+ */
36
+ protected $params = [];
37
+
38
+ /**
39
+ * Creates a new GraphUrlEncodedBody entity.
40
+ *
41
+ * @param array $params
42
+ */
43
+ public function __construct(array $params)
44
+ {
45
+ $this->params = $params;
46
+ }
47
+
48
+ /**
49
+ * @inheritdoc
50
+ */
51
+ public function getBody()
52
+ {
53
+ return http_build_query($this->params, null, '&');
54
+ }
55
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookCurl.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ /**
27
+ * Class FacebookCurl
28
+ *
29
+ * Abstraction for the procedural curl elements so that curl can be mocked and the implementation can be tested.
30
+ *
31
+ * @package Facebook
32
+ */
33
+ class FacebookCurl
34
+ {
35
+
36
+ /**
37
+ * @var resource Curl resource instance
38
+ */
39
+ protected $curl;
40
+
41
+ /**
42
+ * Make a new curl reference instance
43
+ */
44
+ public function init()
45
+ {
46
+ $this->curl = curl_init();
47
+ }
48
+
49
+ /**
50
+ * Set a curl option
51
+ *
52
+ * @param $key
53
+ * @param $value
54
+ */
55
+ public function setopt($key, $value)
56
+ {
57
+ curl_setopt($this->curl, $key, $value);
58
+ }
59
+
60
+ /**
61
+ * Set an array of options to a curl resource
62
+ *
63
+ * @param array $options
64
+ */
65
+ public function setoptArray(array $options)
66
+ {
67
+ curl_setopt_array($this->curl, $options);
68
+ }
69
+
70
+ /**
71
+ * Send a curl request
72
+ *
73
+ * @return mixed
74
+ */
75
+ public function exec()
76
+ {
77
+ return curl_exec($this->curl);
78
+ }
79
+
80
+ /**
81
+ * Return the curl error number
82
+ *
83
+ * @return int
84
+ */
85
+ public function errno()
86
+ {
87
+ return curl_errno($this->curl);
88
+ }
89
+
90
+ /**
91
+ * Return the curl error message
92
+ *
93
+ * @return string
94
+ */
95
+ public function error()
96
+ {
97
+ return curl_error($this->curl);
98
+ }
99
+
100
+ /**
101
+ * Get info from a curl reference
102
+ *
103
+ * @param $type
104
+ *
105
+ * @return mixed
106
+ */
107
+ public function getinfo($type)
108
+ {
109
+ return curl_getinfo($this->curl, $type);
110
+ }
111
+
112
+ /**
113
+ * Get the currently installed curl version
114
+ *
115
+ * @return array
116
+ */
117
+ public function version()
118
+ {
119
+ return curl_version();
120
+ }
121
+
122
+ /**
123
+ * Close the resource connection to curl
124
+ */
125
+ public function close()
126
+ {
127
+ curl_close($this->curl);
128
+ }
129
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ use Facebook\Http\GraphRawResponse;
27
+ use Facebook\Exceptions\FacebookSDKException;
28
+
29
+ /**
30
+ * Class FacebookCurlHttpClient
31
+ *
32
+ * @package Facebook
33
+ */
34
+ class FacebookCurlHttpClient implements FacebookHttpClientInterface
35
+ {
36
+ /**
37
+ * @var string The client error message
38
+ */
39
+ protected $curlErrorMessage = '';
40
+
41
+ /**
42
+ * @var int The curl client error code
43
+ */
44
+ protected $curlErrorCode = 0;
45
+
46
+ /**
47
+ * @var string|boolean The raw response from the server
48
+ */
49
+ protected $rawResponse;
50
+
51
+ /**
52
+ * @var FacebookCurl Procedural curl as object
53
+ */
54
+ protected $facebookCurl;
55
+
56
+ /**
57
+ * @const Curl Version which is unaffected by the proxy header length error.
58
+ */
59
+ const CURL_PROXY_QUIRK_VER = 0x071E00;
60
+
61
+ /**
62
+ * @const "Connection Established" header text
63
+ */
64
+ const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
65
+
66
+ /**
67
+ * @param FacebookCurl|null Procedural curl as object
68
+ */
69
+ public function __construct(FacebookCurl $facebookCurl = null)
70
+ {
71
+ $this->facebookCurl = $facebookCurl ?: new FacebookCurl();
72
+ }
73
+
74
+ /**
75
+ * @inheritdoc
76
+ */
77
+ public function send($url, $method, $body, array $headers, $timeOut)
78
+ {
79
+ $this->openConnection($url, $method, $body, $headers, $timeOut);
80
+ $this->sendRequest();
81
+
82
+ if ($curlErrorCode = $this->facebookCurl->errno()) {
83
+ throw new FacebookSDKException($this->facebookCurl->error(), $curlErrorCode);
84
+ }
85
+
86
+ // Separate the raw headers from the raw body
87
+ list($rawHeaders, $rawBody) = $this->extractResponseHeadersAndBody();
88
+
89
+ $this->closeConnection();
90
+
91
+ return new GraphRawResponse($rawHeaders, $rawBody);
92
+ }
93
+
94
+ /**
95
+ * Opens a new curl connection.
96
+ *
97
+ * @param string $url The endpoint to send the request to.
98
+ * @param string $method The request method.
99
+ * @param string $body The body of the request.
100
+ * @param array $headers The request headers.
101
+ * @param int $timeOut The timeout in seconds for the request.
102
+ */
103
+ public function openConnection($url, $method, $body, array $headers, $timeOut)
104
+ {
105
+ $options = [
106
+ CURLOPT_CUSTOMREQUEST => $method,
107
+ CURLOPT_HTTPHEADER => $this->compileRequestHeaders($headers),
108
+ CURLOPT_URL => $url,
109
+ CURLOPT_CONNECTTIMEOUT => 10,
110
+ CURLOPT_TIMEOUT => $timeOut,
111
+ CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects
112
+ CURLOPT_HEADER => true, // Enable header processing
113
+ CURLOPT_SSL_VERIFYHOST => 2,
114
+ CURLOPT_SSL_VERIFYPEER => true,
115
+ CURLOPT_CAINFO => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
116
+ ];
117
+
118
+ if ($method !== "GET") {
119
+ $options[CURLOPT_POSTFIELDS] = $body;
120
+ }
121
+
122
+ $this->facebookCurl->init();
123
+ $this->facebookCurl->setoptArray($options);
124
+ }
125
+
126
+ /**
127
+ * Closes an existing curl connection
128
+ */
129
+ public function closeConnection()
130
+ {
131
+ $this->facebookCurl->close();
132
+ }
133
+
134
+ /**
135
+ * Send the request and get the raw response from curl
136
+ */
137
+ public function sendRequest()
138
+ {
139
+ $this->rawResponse = $this->facebookCurl->exec();
140
+ }
141
+
142
+ /**
143
+ * Compiles the request headers into a curl-friendly format.
144
+ *
145
+ * @param array $headers The request headers.
146
+ *
147
+ * @return array
148
+ */
149
+ public function compileRequestHeaders(array $headers)
150
+ {
151
+ $return = [];
152
+
153
+ foreach ($headers as $key => $value) {
154
+ $return[] = $key . ': ' . $value;
155
+ }
156
+
157
+ return $return;
158
+ }
159
+
160
+ /**
161
+ * Extracts the headers and the body into a two-part array
162
+ *
163
+ * @return array
164
+ */
165
+ public function extractResponseHeadersAndBody()
166
+ {
167
+ $headerSize = $this->getHeaderSize();
168
+
169
+ $rawHeaders = mb_substr($this->rawResponse, 0, $headerSize);
170
+ $rawBody = mb_substr($this->rawResponse, $headerSize);
171
+
172
+ return [trim($rawHeaders), trim($rawBody)];
173
+ }
174
+
175
+ /**
176
+ * Return proper header size
177
+ *
178
+ * @return integer
179
+ */
180
+ private function getHeaderSize()
181
+ {
182
+ $headerSize = $this->facebookCurl->getinfo(CURLINFO_HEADER_SIZE);
183
+ // This corrects a Curl bug where header size does not account
184
+ // for additional Proxy headers.
185
+ if ($this->needsCurlProxyFix()) {
186
+ // Additional way to calculate the request body size.
187
+ if (preg_match('/Content-Length: (\d+)/', $this->rawResponse, $m)) {
188
+ $headerSize = mb_strlen($this->rawResponse) - $m[1];
189
+ } elseif (stripos($this->rawResponse, self::CONNECTION_ESTABLISHED) !== false) {
190
+ $headerSize += mb_strlen(self::CONNECTION_ESTABLISHED);
191
+ }
192
+ }
193
+
194
+ return $headerSize;
195
+ }
196
+
197
+ /**
198
+ * Detect versions of Curl which report incorrect header lengths when
199
+ * using Proxies.
200
+ *
201
+ * @return boolean
202
+ */
203
+ private function needsCurlProxyFix()
204
+ {
205
+ $ver = $this->facebookCurl->version();
206
+ $version = $ver['version_number'];
207
+
208
+ return $version < self::CURL_PROXY_QUIRK_VER;
209
+ }
210
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ use Facebook\Http\GraphRawResponse;
27
+ use Facebook\Exceptions\FacebookSDKException;
28
+
29
+ use GuzzleHttp\Client;
30
+ use GuzzleHttp\Message\ResponseInterface;
31
+ use GuzzleHttp\Ring\Exception\RingException;
32
+ use GuzzleHttp\Exception\RequestException;
33
+
34
+ class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
35
+ {
36
+ /**
37
+ * @var \GuzzleHttp\Client The Guzzle client.
38
+ */
39
+ protected $guzzleClient;
40
+
41
+ /**
42
+ * @param \GuzzleHttp\Client|null The Guzzle client.
43
+ */
44
+ public function __construct(Client $guzzleClient = null)
45
+ {
46
+ $this->guzzleClient = $guzzleClient ?: new Client();
47
+ }
48
+
49
+ /**
50
+ * @inheritdoc
51
+ */
52
+ public function send($url, $method, $body, array $headers, $timeOut)
53
+ {
54
+ $options = [
55
+ 'headers' => $headers,
56
+ 'body' => $body,
57
+ 'timeout' => $timeOut,
58
+ 'connect_timeout' => 10,
59
+ 'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
60
+ ];
61
+ $request = $this->guzzleClient->createRequest($method, $url, $options);
62
+
63
+ try {
64
+ $rawResponse = $this->guzzleClient->send($request);
65
+ } catch (RequestException $e) {
66
+ $rawResponse = $e->getResponse();
67
+
68
+ if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
69
+ throw new FacebookSDKException($e->getMessage(), $e->getCode());
70
+ }
71
+ }
72
+
73
+ $rawHeaders = $this->getHeadersAsString($rawResponse);
74
+ $rawBody = $rawResponse->getBody();
75
+ $httpStatusCode = $rawResponse->getStatusCode();
76
+
77
+ return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
78
+ }
79
+
80
+ /**
81
+ * Returns the Guzzle array of headers as a string.
82
+ *
83
+ * @param ResponseInterface $response The Guzzle response.
84
+ *
85
+ * @return string
86
+ */
87
+ public function getHeadersAsString(ResponseInterface $response)
88
+ {
89
+ $headers = $response->getHeaders();
90
+ $rawHeaders = [];
91
+ foreach ($headers as $name => $values) {
92
+ $rawHeaders[] = $name . ": " . implode(", ", $values);
93
+ }
94
+
95
+ return implode("\r\n", $rawHeaders);
96
+ }
97
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ /**
27
+ * Interface FacebookHttpClientInterface
28
+ *
29
+ * @package Facebook
30
+ */
31
+ interface FacebookHttpClientInterface
32
+ {
33
+ /**
34
+ * Sends a request to the server and returns the raw response.
35
+ *
36
+ * @param string $url The endpoint to send the request to.
37
+ * @param string $method The request method.
38
+ * @param string $body The body of the request.
39
+ * @param array $headers The request headers.
40
+ * @param int $timeOut The timeout in seconds for the request.
41
+ *
42
+ * @return \Facebook\Http\GraphRawResponse Raw response from the server.
43
+ *
44
+ * @throws \Facebook\Exceptions\FacebookSDKException
45
+ */
46
+ public function send($url, $method, $body, array $headers, $timeOut);
47
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookStream.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ /**
27
+ * Class FacebookStream
28
+ *
29
+ * Abstraction for the procedural stream elements so that the functions can be
30
+ * mocked and the implementation can be tested.
31
+ *
32
+ * @package Facebook
33
+ */
34
+ class FacebookStream
35
+ {
36
+ /**
37
+ * @var resource Context stream resource instance
38
+ */
39
+ protected $stream;
40
+
41
+ /**
42
+ * @var array Response headers from the stream wrapper
43
+ */
44
+ protected $responseHeaders;
45
+
46
+ /**
47
+ * Make a new context stream reference instance
48
+ *
49
+ * @param array $options
50
+ */
51
+ public function streamContextCreate(array $options)
52
+ {
53
+ $this->stream = stream_context_create($options);
54
+ }
55
+
56
+ /**
57
+ * The response headers from the stream wrapper
58
+ *
59
+ * @return array|null
60
+ */
61
+ public function getResponseHeaders()
62
+ {
63
+ return $this->responseHeaders;
64
+ }
65
+
66
+ /**
67
+ * Send a stream wrapped request
68
+ *
69
+ * @param string $url
70
+ *
71
+ * @return mixed
72
+ */
73
+ public function fileGetContents($url)
74
+ {
75
+ $rawResponse = file_get_contents($url, false, $this->stream);
76
+ $this->responseHeaders = $http_response_header;
77
+
78
+ return $rawResponse;
79
+ }
80
+ }
framework/facebook-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\HttpClients;
25
+
26
+ use Facebook\Http\GraphRawResponse;
27
+ use Facebook\Exceptions\FacebookSDKException;
28
+
29
+ class FacebookStreamHttpClient implements FacebookHttpClientInterface
30
+ {
31
+ /**
32
+ * @var FacebookStream Procedural stream wrapper as object.
33
+ */
34
+ protected $facebookStream;
35
+
36
+ /**
37
+ * @param FacebookStream|null Procedural stream wrapper as object.
38
+ */
39
+ public function __construct(FacebookStream $facebookStream = null)
40
+ {
41
+ $this->facebookStream = $facebookStream ?: new FacebookStream();
42
+ }
43
+
44
+ /**
45
+ * @inheritdoc
46
+ */
47
+ public function send($url, $method, $body, array $headers, $timeOut)
48
+ {
49
+ $options = [
50
+ 'http' => [
51
+ 'method' => $method,
52
+ 'header' => $this->compileHeader($headers),
53
+ 'content' => $body,
54
+ 'timeout' => $timeOut,
55
+ 'ignore_errors' => true
56
+ ],
57
+ 'ssl' => [
58
+ 'verify_peer' => true,
59
+ 'verify_peer_name' => true,
60
+ 'allow_self_signed' => true, // All root certificates are self-signed
61
+ 'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
62
+ ],
63
+ ];
64
+
65
+ $this->facebookStream->streamContextCreate($options);
66
+ $rawBody = $this->facebookStream->fileGetContents($url);
67
+ $rawHeaders = $this->facebookStream->getResponseHeaders();
68
+
69
+ if ($rawBody === false || !$rawHeaders) {
70
+ throw new FacebookSDKException('Stream returned an empty response', 660);
71
+ }
72
+
73
+ $rawHeaders = implode("\r\n", $rawHeaders);
74
+
75
+ return new GraphRawResponse($rawHeaders, $rawBody);
76
+ }
77
+
78
+ /**
79
+ * Formats the headers for use in the stream wrapper.
80
+ *
81
+ * @param array $headers The request headers.
82
+ *
83
+ * @return string
84
+ */
85
+ public function compileHeader(array $headers)
86
+ {
87
+ $header = [];
88
+ foreach ($headers as $k => $v) {
89
+ $header[] = $k . ': ' . $v;
90
+ }
91
+
92
+ return implode("\r\n", $header);
93
+ }
94
+ }
framework/facebook-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
3
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4
+ d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
5
+ ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
6
+ MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
7
+ LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
8
+ RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
9
+ +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
10
+ PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
11
+ xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
12
+ Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
13
+ hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
14
+ EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
15
+ MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
16
+ FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
17
+ nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
18
+ eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
19
+ hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
20
+ Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
21
+ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
22
+ +OkuE6N36B9K
23
+ -----END CERTIFICATE-----
framework/facebook-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PersistentData;
25
+
26
+ /**
27
+ * Class FacebookMemoryPersistentDataHandler
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookMemoryPersistentDataHandler implements PersistentDataInterface
32
+ {
33
+ /**
34
+ * @var array The session data to keep in memory.
35
+ */
36
+ protected $sessionData = [];
37
+
38
+ /**
39
+ * @inheritdoc
40
+ */
41
+ public function get($key)
42
+ {
43
+ return isset($this->sessionData[$key]) ? $this->sessionData[$key] : null;
44
+ }
45
+
46
+ /**
47
+ * @inheritdoc
48
+ */
49
+ public function set($key, $value)
50
+ {
51
+ $this->sessionData[$key] = $value;
52
+ }
53
+ }
framework/facebook-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PersistentData;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ /**
29
+ * Class FacebookSessionPersistentDataHandler
30
+ *
31
+ * @package Facebook
32
+ */
33
+ class FacebookSessionPersistentDataHandler implements PersistentDataInterface
34
+ {
35
+ /**
36
+ * @var string Prefix to use for session variables.
37
+ */
38
+ protected $sessionPrefix = 'FBRLH_';
39
+
40
+ /**
41
+ * Init the session handler.
42
+ *
43
+ * @param boolean $enableSessionCheck
44
+ *
45
+ * @throws FacebookSDKException
46
+ */
47
+ public function __construct($enableSessionCheck = true)
48
+ {
49
+ if ($enableSessionCheck && session_status() !== PHP_SESSION_ACTIVE) {
50
+ throw new FacebookSDKException(
51
+ 'Sessions are not active. Please make sure session_start() is at the top of your script.',
52
+ 720
53
+ );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @inheritdoc
59
+ */
60
+ public function get($key)
61
+ {
62
+ if (isset($_SESSION[$this->sessionPrefix . $key])) {
63
+ return $_SESSION[$this->sessionPrefix . $key];
64
+ }
65
+
66
+ return null;
67
+ }
68
+
69
+ /**
70
+ * @inheritdoc
71
+ */
72
+ public function set($key, $value)
73
+ {
74
+ $_SESSION[$this->sessionPrefix . $key] = $value;
75
+ }
76
+ }
framework/facebook-sdk/src/Facebook/PersistentData/PersistentDataInterface.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PersistentData;
25
+
26
+ /**
27
+ * Interface PersistentDataInterface
28
+ *
29
+ * @package Facebook
30
+ */
31
+ interface PersistentDataInterface
32
+ {
33
+ /**
34
+ * Get a value from a persistent data store.
35
+ *
36
+ * @param string $key
37
+ *
38
+ * @return mixed
39
+ */
40
+ public function get($key);
41
+
42
+ /**
43
+ * Set a value in the persistent data store.
44
+ *
45
+ * @param string $key
46
+ * @param mixed $value
47
+ */
48
+ public function set($key, $value);
49
+ }
framework/facebook-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PseudoRandomString;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
29
+ {
30
+ use PseudoRandomStringGeneratorTrait;
31
+
32
+ /**
33
+ * @const string The error message when generating the string fails.
34
+ */
35
+ const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from mcrypt_create_iv(). ';
36
+
37
+ /**
38
+ * @throws FacebookSDKException
39
+ */
40
+ public function __construct()
41
+ {
42
+ if (!function_exists('mcrypt_create_iv')) {
43
+ throw new FacebookSDKException(
44
+ static::ERROR_MESSAGE .
45
+ 'The function mcrypt_create_iv() does not exist.'
46
+ );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * @inheritdoc
52
+ */
53
+ public function getPseudoRandomString($length)
54
+ {
55
+ $this->validateLength($length);
56
+
57
+ $binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
58
+
59
+ if ($binaryString === false) {
60
+ throw new FacebookSDKException(
61
+ static::ERROR_MESSAGE .
62
+ 'mcrypt_create_iv() returned an error.'
63
+ );
64
+ }
65
+
66
+ return $this->binToHex($binaryString, $length);
67
+ }
68
+ }
framework/facebook-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PseudoRandomString;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
29
+ {
30
+ use PseudoRandomStringGeneratorTrait;
31
+
32
+ /**
33
+ * @const string The error message when generating the string fails.
34
+ */
35
+ const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from openssl_random_pseudo_bytes().';
36
+
37
+ /**
38
+ * @throws FacebookSDKException
39
+ */
40
+ public function __construct()
41
+ {
42
+ if (!function_exists('openssl_random_pseudo_bytes')) {
43
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function openssl_random_pseudo_bytes() does not exist.');
44
+ }
45
+ }
46
+
47
+ /**
48
+ * @inheritdoc
49
+ */
50
+ public function getPseudoRandomString($length)
51
+ {
52
+ $this->validateLength($length);
53
+
54
+ $wasCryptographicallyStrong = false;
55
+ $binaryString = openssl_random_pseudo_bytes($length, $wasCryptographicallyStrong);
56
+
57
+ if ($binaryString === false) {
58
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned an unknown error.');
59
+ }
60
+
61
+ if ($wasCryptographicallyStrong !== true) {
62
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned a pseudo-random string but it was not cryptographically secure and cannot be used.');
63
+ }
64
+
65
+ return $this->binToHex($binaryString, $length);
66
+ }
67
+ }
framework/facebook-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PseudoRandomString;
25
+
26
+ /**
27
+ * Interface
28
+ *
29
+ * @package Facebook
30
+ */
31
+ interface PseudoRandomStringGeneratorInterface
32
+ {
33
+ /**
34
+ * Get a cryptographically secure pseudo-random string of arbitrary length.
35
+ *
36
+ * @see http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
37
+ *
38
+ * @param int $length The length of the string to return.
39
+ *
40
+ * @return string
41
+ *
42
+ * @throws \Facebook\Exceptions\FacebookSDKException|\InvalidArgumentException
43
+ */
44
+ public function getPseudoRandomString($length);
45
+ }
framework/facebook-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PseudoRandomString;
25
+
26
+ trait PseudoRandomStringGeneratorTrait
27
+ {
28
+ /**
29
+ * Validates the length argument of a random string.
30
+ *
31
+ * @param int $length The length to validate.
32
+ *
33
+ * @throws \InvalidArgumentException
34
+ */
35
+ public function validateLength($length)
36
+ {
37
+ if (!is_int($length)) {
38
+ throw new \InvalidArgumentException('getPseudoRandomString() expects an integer for the string length');
39
+ }
40
+
41
+ if ($length < 1) {
42
+ throw new \InvalidArgumentException('getPseudoRandomString() expects a length greater than 1');
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Converts binary data to hexadecimal of arbitrary length.
48
+ *
49
+ * @param string $binaryData The binary data to convert to hex.
50
+ * @param int $length The length of the string to return.
51
+ *
52
+ * @return string
53
+ */
54
+ public function binToHex($binaryData, $length)
55
+ {
56
+ return mb_substr(bin2hex($binaryData), 0, $length);
57
+ }
58
+ }
framework/facebook-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\PseudoRandomString;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
29
+ {
30
+
31
+ use PseudoRandomStringGeneratorTrait;
32
+
33
+ /**
34
+ * @const string The error message when generating the string fails.
35
+ */
36
+ const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from /dev/urandom. ';
37
+
38
+ /**
39
+ * @throws FacebookSDKException
40
+ */
41
+ public function __construct()
42
+ {
43
+ if (ini_get('open_basedir')) {
44
+ throw new FacebookSDKException(
45
+ static::ERROR_MESSAGE .
46
+ 'There is an open_basedir constraint that prevents access to /dev/urandom.'
47
+ );
48
+ }
49
+
50
+ if (!is_readable('/dev/urandom')) {
51
+ throw new FacebookSDKException(
52
+ static::ERROR_MESSAGE .
53
+ 'Unable to read from /dev/urandom.'
54
+ );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * @inheritdoc
60
+ */
61
+ public function getPseudoRandomString($length)
62
+ {
63
+ $this->validateLength($length);
64
+
65
+ $stream = fopen('/dev/urandom', 'rb');
66
+ if (!is_resource($stream)) {
67
+ throw new FacebookSDKException(
68
+ static::ERROR_MESSAGE .
69
+ 'Unable to open stream to /dev/urandom.'
70
+ );
71
+ }
72
+
73
+ if (!defined('HHVM_VERSION')) {
74
+ stream_set_read_buffer($stream, 0);
75
+ }
76
+
77
+ $binaryString = fread($stream, $length);
78
+ fclose($stream);
79
+
80
+ if (!$binaryString) {
81
+ throw new FacebookSDKException(
82
+ static::ERROR_MESSAGE .
83
+ 'Stream to /dev/urandom returned no data.'
84
+ );
85
+ }
86
+
87
+ return $this->binToHex($binaryString, $length);
88
+ }
89
+ }
framework/facebook-sdk/src/Facebook/SignedRequest.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook;
25
+
26
+ use Facebook\Exceptions\FacebookSDKException;
27
+
28
+ /**
29
+ * Class SignedRequest
30
+ *
31
+ * @package Facebook
32
+ */
33
+ class SignedRequest
34
+ {
35
+ /**
36
+ * @var FacebookApp The FacebookApp entity.
37
+ */
38
+ protected $app;
39
+
40
+ /**
41
+ * @var string The raw encrypted signed request.
42
+ */
43
+ protected $rawSignedRequest;
44
+
45
+ /**
46
+ * @var array The payload from the decrypted signed request.
47
+ */
48
+ protected $payload;
49
+
50
+ /**
51
+ * Instantiate a new SignedRequest entity.
52
+ *
53
+ * @param FacebookApp $facebookApp The FacebookApp entity.
54
+ * @param string|null $rawSignedRequest The raw signed request.
55
+ */
56
+ public function __construct(FacebookApp $facebookApp, $rawSignedRequest = null)
57
+ {
58
+ $this->app = $facebookApp;
59
+
60
+ if (!$rawSignedRequest) {
61
+ return;
62
+ }
63
+
64
+ $this->rawSignedRequest = $rawSignedRequest;
65
+
66
+ $this->parse();
67
+ }
68
+
69
+ /**
70
+ * Returns the raw signed request data.
71
+ *
72
+ * @return string|null
73
+ */
74
+ public function getRawSignedRequest()
75
+ {
76
+ return $this->rawSignedRequest;
77
+ }
78
+
79
+ /**
80
+ * Returns the parsed signed request data.
81
+ *
82
+ * @return array|null
83
+ */
84
+ public function getPayload()
85
+ {
86
+ return $this->payload;
87
+ }
88
+
89
+ /**
90
+ * Returns a property from the signed request data if available.
91
+ *
92
+ * @param string $key
93
+ * @param mixed|null $default
94
+ *
95
+ * @return mixed|null
96
+ */
97
+ public function get($key, $default = null)
98
+ {
99
+ if (isset($this->payload[$key])) {
100
+ return $this->payload[$key];
101
+ }
102
+
103
+ return $default;
104
+ }
105
+
106
+ /**
107
+ * Returns user_id from signed request data if available.
108
+ *
109
+ * @return string|null
110
+ */
111
+ public function getUserId()
112
+ {
113
+ return $this->get('user_id');
114
+ }
115
+
116
+ /**
117
+ * Checks for OAuth data in the payload.
118
+ *
119
+ * @return boolean
120
+ */
121
+ public function hasOAuthData()
122
+ {
123
+ return $this->get('oauth_token') || $this->get('code');
124
+ }
125
+
126
+ /**
127
+ * Creates a signed request from an array of data.
128
+ *
129
+ * @param array $payload
130
+ *
131
+ * @return string
132
+ */
133
+ public function make(array $payload)
134
+ {
135
+ $payload['algorithm'] = isset($payload['algorithm']) ? $payload['algorithm'] : 'HMAC-SHA256';
136
+ $payload['issued_at'] = isset($payload['issued_at']) ? $payload['issued_at'] : time();
137
+ $encodedPayload = $this->base64UrlEncode(json_encode($payload));
138
+
139
+ $hashedSig = $this->hashSignature($encodedPayload);
140
+ $encodedSig = $this->base64UrlEncode($hashedSig);
141
+
142
+ return $encodedSig . '.' . $encodedPayload;
143
+ }
144
+
145
+ /**
146
+ * Validates and decodes a signed request and saves
147
+ * the payload to an array.
148
+ */
149
+ protected function parse()
150
+ {
151
+ list($encodedSig, $encodedPayload) = $this->split();
152
+
153
+ // Signature validation
154
+ $sig = $this->decodeSignature($encodedSig);
155
+ $hashedSig = $this->hashSignature($encodedPayload);
156
+ $this->validateSignature($hashedSig, $sig);
157
+
158
+ $this->payload = $this->decodePayload($encodedPayload);
159
+
160
+ // Payload validation
161
+ $this->validateAlgorithm();
162
+ }
163
+
164
+ /**
165
+ * Splits a raw signed request into signature and payload.
166
+ *
167
+ * @returns array
168
+ *
169
+ * @throws FacebookSDKException
170
+ */
171
+ protected function split()
172
+ {
173
+ if (strpos($this->rawSignedRequest, '.') === false) {
174
+ throw new FacebookSDKException('Malformed signed request.', 606);
175
+ }
176
+
177
+ return explode('.', $this->rawSignedRequest, 2);
178
+ }
179
+
180
+ /**
181
+ * Decodes the raw signature from a signed request.
182
+ *
183
+ * @param string $encodedSig
184
+ *
185
+ * @returns string
186
+ *
187
+ * @throws FacebookSDKException
188
+ */
189
+ protected function decodeSignature($encodedSig)
190
+ {
191
+ $sig = $this->base64UrlDecode($encodedSig);
192
+
193
+ if (!$sig) {
194
+ throw new FacebookSDKException('Signed request has malformed encoded signature data.', 607);
195
+ }
196
+
197
+ return $sig;
198
+ }
199
+
200
+ /**
201
+ * Decodes the raw payload from a signed request.
202
+ *
203
+ * @param string $encodedPayload
204
+ *
205
+ * @returns array
206
+ *
207
+ * @throws FacebookSDKException
208
+ */
209
+ protected function decodePayload($encodedPayload)
210
+ {
211
+ $payload = $this->base64UrlDecode($encodedPayload);
212
+
213
+ if ($payload) {
214
+ $payload = json_decode($payload, true);
215
+ }
216
+
217
+ if (!is_array($payload)) {
218
+ throw new FacebookSDKException('Signed request has malformed encoded payload data.', 607);
219
+ }
220
+
221
+ return $payload;
222
+ }
223
+
224
+ /**
225
+ * Validates the algorithm used in a signed request.
226
+ *
227
+ * @throws FacebookSDKException
228
+ */
229
+ protected function validateAlgorithm()
230
+ {
231
+ if ($this->get('algorithm') !== 'HMAC-SHA256') {
232
+ throw new FacebookSDKException('Signed request is using the wrong algorithm.', 605);
233
+ }
234
+ }
235
+
236
+ /**
237
+ * Hashes the signature used in a signed request.
238
+ *
239
+ * @param string $encodedData
240
+ *
241
+ * @return string
242
+ *
243
+ * @throws FacebookSDKException
244
+ */
245
+ protected function hashSignature($encodedData)
246
+ {
247
+ $hashedSig = hash_hmac(
248
+ 'sha256',
249
+ $encodedData,
250
+ $this->app->getSecret(),
251
+ $raw_output = true
252
+ );
253
+
254
+ if (!$hashedSig) {
255
+ throw new FacebookSDKException('Unable to hash signature from encoded payload data.', 602);
256
+ }
257
+
258
+ return $hashedSig;
259
+ }
260
+
261
+ /**
262
+ * Validates the signature used in a signed request.
263
+ *
264
+ * @param string $hashedSig
265
+ * @param string $sig
266
+ *
267
+ * @throws FacebookSDKException
268
+ */
269
+ protected function validateSignature($hashedSig, $sig)
270
+ {
271
+ if (mb_strlen($hashedSig) === mb_strlen($sig)) {
272
+ $validate = 0;
273
+ for ($i = 0; $i < mb_strlen($sig); $i++) {
274
+ $validate |= ord($hashedSig[$i]) ^ ord($sig[$i]);
275
+ }
276
+ if ($validate === 0) {
277
+ return;
278
+ }
279
+ }
280
+
281
+ throw new FacebookSDKException('Signed request has an invalid signature.', 602);
282
+ }
283
+
284
+ /**
285
+ * Base64 decoding which replaces characters:
286
+ * + instead of -
287
+ * / instead of _
288
+ *
289
+ * @link http://en.wikipedia.org/wiki/Base64#URL_applications
290
+ *
291
+ * @param string $input base64 url encoded input
292
+ *
293
+ * @return string decoded string
294
+ */
295
+ public function base64UrlDecode($input)
296
+ {
297
+ $urlDecodedBase64 = strtr($input, '-_', '+/');
298
+ $this->validateBase64($urlDecodedBase64);
299
+
300
+ return base64_decode($urlDecodedBase64);
301
+ }
302
+
303
+ /**
304
+ * Base64 encoding which replaces characters:
305
+ * + instead of -
306
+ * / instead of _
307
+ *
308
+ * @link http://en.wikipedia.org/wiki/Base64#URL_applications
309
+ *
310
+ * @param string $input string to encode
311
+ *
312
+ * @return string base64 url encoded input
313
+ */
314
+ public function base64UrlEncode($input)
315
+ {
316
+ return strtr(base64_encode($input), '+/', '-_');
317
+ }
318
+
319
+ /**
320
+ * Validates a base64 string.
321
+ *
322
+ * @param string $input base64 value to validate
323
+ *
324
+ * @throws FacebookSDKException
325
+ */
326
+ protected function validateBase64($input)
327
+ {
328
+ if (!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $input)) {
329
+ throw new FacebookSDKException('Signed request contains malformed base64 encoding.', 608);
330
+ }
331
+ }
332
+ }
framework/facebook-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Url;
25
+
26
+ /**
27
+ * Class FacebookUrlDetectionHandler
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookUrlDetectionHandler implements UrlDetectionInterface
32
+ {
33
+ /**
34
+ * @inheritdoc
35
+ */
36
+ public function getCurrentUrl()
37
+ {
38
+ return $this->getHttpScheme() . '://' . $this->getHostName() . $this->getServerVar('REQUEST_URI');
39
+ }
40
+
41
+ /**
42
+ * Get the currently active URL scheme.
43
+ *
44
+ * @return string
45
+ */
46
+ protected function getHttpScheme()
47
+ {
48
+ return $this->isBehindSsl() ? 'https' : 'http';
49
+ }
50
+
51
+ /**
52
+ * Tries to detect if the server is running behind an SSL.
53
+ *
54
+ * @return boolean
55
+ */
56
+ protected function isBehindSsl()
57
+ {
58
+ // Check for proxy first
59
+ $protocol = $this->getHeader('X_FORWARDED_PROTO');
60
+ if ($protocol) {
61
+ return $this->protocolWithActiveSsl($protocol);
62
+ }
63
+
64
+ $protocol = $this->getServerVar('HTTPS');
65
+ if ($protocol) {
66
+ return $this->protocolWithActiveSsl($protocol);
67
+ }
68
+
69
+ return (string)$this->getServerVar('SERVER_PORT') === '443';
70
+ }
71
+
72
+ /**
73
+ * Detects an active SSL protocol value.
74
+ *
75
+ * @param string $protocol
76
+ *
77
+ * @return boolean
78
+ */
79
+ protected function protocolWithActiveSsl($protocol)
80
+ {
81
+ $protocol = strtolower((string)$protocol);
82
+
83
+ return in_array($protocol, ['on', '1', 'https', 'ssl'], true);
84
+ }
85
+
86
+ /**
87
+ * Tries to detect the host name of the server.
88
+ *
89
+ * Some elements adapted from
90
+ *
91
+ * @see https://github.com/symfony/HttpFoundation/blob/master/Request.php
92
+ *
93
+ * @return string
94
+ */
95
+ protected function getHostName()
96
+ {
97
+ // Check for proxy first
98
+ if ($host = $this->getHeader('X_FORWARDED_HOST')) {
99
+ $elements = explode(',', $host);
100
+ $host = $elements[count($elements) - 1];
101
+ } elseif (!$host = $this->getHeader('HOST')) {
102
+ if (!$host = $this->getServerVar('SERVER_NAME')) {
103
+ $host = $this->getServerVar('SERVER_ADDR');
104
+ }
105
+ }
106
+
107
+ // trim and remove port number from host
108
+ // host is lowercase as per RFC 952/2181
109
+ $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
110
+
111
+ // Port number
112
+ $scheme = $this->getHttpScheme();
113
+ $port = $this->getCurrentPort();
114
+ $appendPort = ':' . $port;
115
+
116
+ // Don't append port number if a normal port.
117
+ if (($scheme == 'http' && $port == '80') || ($scheme == 'https' && $port == '443')) {
118
+ $appendPort = '';
119
+ }
120
+
121
+ return $host . $appendPort;
122
+ }
123
+
124
+ protected function getCurrentPort()
125
+ {
126
+ // Check for proxy first
127
+ $port = $this->getHeader('X_FORWARDED_PORT');
128
+ if ($port) {
129
+ return (string)$port;
130
+ }
131
+
132
+ $protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
133
+ if ($protocol === 'https') {
134
+ return '443';
135
+ }
136
+
137
+ return (string)$this->getServerVar('SERVER_PORT');
138
+ }
139
+
140
+ /**
141
+ * Returns the a value from the $_SERVER super global.
142
+ *
143
+ * @param string $key
144
+ *
145
+ * @return string
146
+ */
147
+ protected function getServerVar($key)
148
+ {
149
+ return isset($_SERVER[$key]) ? $_SERVER[$key] : '';
150
+ }
151
+
152
+ /**
153
+ * Gets a value from the HTTP request headers.
154
+ *
155
+ * @param string $key
156
+ *
157
+ * @return string
158
+ */
159
+ protected function getHeader($key)
160
+ {
161
+ return $this->getServerVar('HTTP_' . $key);
162
+ }
163
+ }
framework/facebook-sdk/src/Facebook/Url/FacebookUrlManipulator.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Url;
25
+
26
+ /**
27
+ * Class FacebookUrlManipulator
28
+ *
29
+ * @package Facebook
30
+ */
31
+ class FacebookUrlManipulator
32
+ {
33
+ /**
34
+ * Remove params from a URL.
35
+ *
36
+ * @param string $url The URL to filter.
37
+ * @param array $paramsToFilter The params to filter from the URL.
38
+ *
39
+ * @return string The URL with the params removed.
40
+ */
41
+ public static function removeParamsFromUrl($url, array $paramsToFilter)
42
+ {
43
+ $parts = parse_url($url);
44
+
45
+ $query = '';
46
+ if (isset($parts['query'])) {
47
+ $params = [];
48
+ parse_str($parts['query'], $params);
49
+
50
+ // Remove query params
51
+ foreach ($paramsToFilter as $paramName) {
52
+ unset($params[$paramName]);
53
+ }
54
+
55
+ if (count($params) > 0) {
56
+ $query = '?' . http_build_query($params, null, '&');
57
+ }
58
+ }
59
+
60
+ $scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : '';
61
+ $host = isset($parts['host']) ? $parts['host'] : '';
62
+ $port = isset($parts['port']) ? ':' . $parts['port'] : '';
63
+ $path = isset($parts['path']) ? $parts['path'] : '';
64
+ $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
65
+
66
+ return $scheme . $host . $port . $path . $query . $fragment;
67
+ }
68
+
69
+ /**
70
+ * Gracefully appends params to the URL.
71
+ *
72
+ * @param string $url The URL that will receive the params.
73
+ * @param array $newParams The params to append to the URL.
74
+ *
75
+ * @return string
76
+ */
77
+ public static function appendParamsToUrl($url, array $newParams = [])
78
+ {
79
+ if (!$newParams) {
80
+ return $url;
81
+ }
82
+
83
+ if (strpos($url, '?') === false) {
84
+ return $url . '?' . http_build_query($newParams, null, '&');
85
+ }
86
+
87
+ list($path, $query) = explode('?', $url, 2);
88
+ $existingParams = [];
89
+ parse_str($query, $existingParams);
90
+
91
+ // Favor params from the original URL over $newParams
92
+ $newParams = array_merge($newParams, $existingParams);
93
+
94
+ // Sort for a predicable order
95
+ ksort($newParams);
96
+
97
+ return $path . '?' . http_build_query($newParams, null, '&');
98
+ }
99
+
100
+ /**
101
+ * Returns the params from a URL in the form of an array.
102
+ *
103
+ * @param string $url The URL to parse the params from.
104
+ *
105
+ * @return array
106
+ */
107
+ public static function getParamsAsArray($url)
108
+ {
109
+ $query = parse_url($url, PHP_URL_QUERY);
110
+ if (!$query) {
111
+ return [];
112
+ }
113
+ $params = [];
114
+ parse_str($query, $params);
115
+
116
+ return $params;
117
+ }
118
+
119
+ /**
120
+ * Adds the params of the first URL to the second URL.
121
+ *
122
+ * Any params that already exist in the second URL will go untouched.
123
+ *
124
+ * @param string $urlToStealFrom The URL harvest the params from.
125
+ * @param string $urlToAddTo The URL that will receive the new params.
126
+ *
127
+ * @return string The $urlToAddTo with any new params from $urlToStealFrom.
128
+ */
129
+ public static function mergeUrlParams($urlToStealFrom, $urlToAddTo)
130
+ {
131
+ $newParams = static::getParamsAsArray($urlToStealFrom);
132
+ // Nothing new to add, return as-is
133
+ if (!$newParams) {
134
+ return $urlToAddTo;
135
+ }
136
+
137
+ return static::appendParamsToUrl($urlToAddTo, $newParams);
138
+ }
139
+
140
+ /**
141
+ * Check for a "/" prefix and prepend it if not exists.
142
+ *
143
+ * @param string|null $string
144
+ *
145
+ * @return string|null
146
+ */
147
+ public static function forceSlashPrefix($string)
148
+ {
149
+ if (!$string) {
150
+ return $string;
151
+ }
152
+
153
+ return strpos($string, '/') === 0 ? $string : '/' . $string;
154
+ }
155
+
156
+ /**
157
+ * Trims off the hostname and Graph version from a URL.
158
+ *
159
+ * @param string $urlToTrim The URL the needs the surgery.
160
+ *
161
+ * @return string The $urlToTrim with the hostname and Graph version removed.
162
+ */
163
+ public static function baseGraphUrlEndpoint($urlToTrim)
164
+ {
165
+ return '/' . preg_replace('/^https:\/\/.+\.facebook\.com(\/v.+?)?\//', '', $urlToTrim);
166
+ }
167
+ }
framework/facebook-sdk/src/Facebook/Url/UrlDetectionInterface.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+ namespace Facebook\Url;
25
+
26
+ /**
27
+ * Interface UrlDetectionInterface
28
+ *
29
+ * @package Facebook
30
+ */
31
+ interface UrlDetectionInterface
32
+ {
33
+ /**
34
+ * Get the currently active URL.
35
+ *
36
+ * @return string
37
+ */
38
+ public function getCurrentUrl();
39
+ }
framework/facebook-sdk/src/Facebook/autoload.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Facebook, Inc.
4
+ *
5
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
+ * use, copy, modify, and distribute this software in source code or binary
7
+ * form for use in connection with the web services and APIs provided by
8
+ * Facebook.
9
+ *
10
+ * As with any software that integrates with the Facebook platform, your use
11
+ * of this software is subject to the Facebook Developer Principles and
12
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
+ * shall be included in all copies or substantial portions of the software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ * DEALINGS IN THE SOFTWARE.
22
+ *
23
+ */
24
+
25
+ /**
26
+ * You only need this file if you are not using composer.
27
+ * Why are you not using composer?
28
+ * https://getcomposer.org/
29
+ */
30
+
31
+ if (version_compare(PHP_VERSION, '5.4.0', '<')) {
32
+ throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
33
+ }
34
+
35
+ /**
36
+ * Register the autoloader for the Facebook SDK classes.
37
+ *
38
+ * Based off the official PSR-4 autoloader example found here:
39
+ * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
40
+ *
41
+ * @param string $class The fully-qualified class name.
42
+ *
43
+ * @return void
44
+ */
45
+ spl_autoload_register(function ($class) {
46
+ // project-specific namespace prefix
47
+ $prefix = 'Facebook\\';
48
+
49
+ // For backwards compatibility
50
+ $customBaseDir = '';
51
+ // @todo v6: Remove support for 'FACEBOOK_SDK_V4_SRC_DIR'
52
+ if (defined('FACEBOOK_SDK_V4_SRC_DIR')) {
53
+ $customBaseDir = FACEBOOK_SDK_V4_SRC_DIR;
54
+ } elseif (defined('FACEBOOK_SDK_SRC_DIR')) {
55
+ $customBaseDir = FACEBOOK_SDK_SRC_DIR;
56
+ }
57
+ // base directory for the namespace prefix
58
+ $baseDir = $customBaseDir ?: __DIR__ . '/';
59
+
60
+ // does the class use the namespace prefix?
61
+ $len = strlen($prefix);
62
+ if (strncmp($prefix, $class, $len) !== 0) {
63
+ // no, move to the next registered autoloader
64
+ return;
65
+ }
66
+
67
+ // get the relative class name
68
+ $relativeClass = substr($class, $len);
69
+
70
+ // replace the namespace prefix with the base directory, replace namespace
71
+ // separators with directory separators in the relative class name, append
72
+ // with .php
73
+ $file = rtrim($baseDir, '/') . '/' . str_replace('\\', '/', $relativeClass) . '.php';
74
+
75
+ // if the file exists, require it
76
+ if (file_exists($file)) {
77
+ require $file;
78
+ }
79
+ });
frontend/controllers/FFWDControllerMain.php CHANGED
@@ -1,28 +1,15 @@
1
  <?php
2
 
3
  class FFWDControllerMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  private $view;
14
- ////////////////////////////////////////////////////////////////////////////////////////
15
- // Constructor & Destructor //
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- public function __construct($params = array(), $from_shortcode = 0, $ffwd = 0, $view = "") {
18
  $this->view = $view;
19
  wd_fb_update(1);
20
  $this->display($params, $from_shortcode, $ffwd);
21
-
22
  }
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
- // Public Methods //
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
  public function display($params, $from_shortcode = 0, $ffwd = 0) {
27
  require_once WD_FFWD_DIR . "/frontend/models/FFWDModelMain.php";
28
  $model_name = "FFWDModel" . $this->view;
@@ -33,23 +20,4 @@ class FFWDControllerMain {
33
  $view = new $view_name($model);
34
  $view->display($params, $from_shortcode, $ffwd);
35
  }
36
-
37
-
38
- private function wd_fb_update() {
39
- global $wpdb;
40
- $query = "SELECT * FROM " . $wpdb->prefix . "wd_fb_info WHERE `update_mode` <> 'no_update'";
41
- $rows = $wpdb->get_results( $query );
42
- require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
43
- WDFacebookFeed::update_from_shedule( $rows );
44
- die;
45
- }
46
- ////////////////////////////////////////////////////////////////////////////////////////
47
- // Getters & Setters //
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- ////////////////////////////////////////////////////////////////////////////////////////
50
- // Private Methods //
51
- ////////////////////////////////////////////////////////////////////////////////////////
52
- ////////////////////////////////////////////////////////////////////////////////////////
53
- // Listeners //
54
- ////////////////////////////////////////////////////////////////////////////////////////
55
  }
1
  <?php
2
 
3
  class FFWDControllerMain {
4
+
 
 
 
 
 
 
 
 
5
  private $view;
6
+
7
+ public function __construct($params = array(), $from_shortcode = 0, $ffwd = 0, $view = 'Blog_style') {
 
 
8
  $this->view = $view;
9
  wd_fb_update(1);
10
  $this->display($params, $from_shortcode, $ffwd);
 
11
  }
12
+
 
 
13
  public function display($params, $from_shortcode = 0, $ffwd = 0) {
14
  require_once WD_FFWD_DIR . "/frontend/models/FFWDModelMain.php";
15
  $model_name = "FFWDModel" . $this->view;
20
  $view = new $view_name($model);
21
  $view->display($params, $from_shortcode, $ffwd);
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
frontend/controllers/FFWDControllerPopupBox.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class FFWDControllerPopupBox {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function execute() {
22
- $ajax_task = (isset($_POST['ajax_task']) ? sanitize_text_field($_POST['ajax_task']) : '');
23
- if (method_exists($this, $ajax_task)) {
24
- $this->$ajax_task();
25
- }
26
- else {
27
- $this->display();
28
- }
29
- }
30
-
31
- public function display() {
32
- require_once WD_FFWD_DIR . "/frontend/models/FFWDModelPopupBox.php";
33
- $model = new FFWDModelPopupBox();
34
-
35
- require_once WD_FFWD_DIR . "/frontend/views/FFWDViewPopupBox.php";
36
- $view = new FFWDViewPopupBox($model);
37
-
38
- $view->display();
39
- }
40
- ////////////////////////////////////////////////////////////////////////////////////////
41
- // Getters & Setters //
42
- ////////////////////////////////////////////////////////////////////////////////////////
43
- ////////////////////////////////////////////////////////////////////////////////////////
44
- // Private Methods //
45
- ////////////////////////////////////////////////////////////////////////////////////////
46
- ////////////////////////////////////////////////////////////////////////////////////////
47
- // Listeners //
48
- ////////////////////////////////////////////////////////////////////////////////////////
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/models/FFWDModelAlbum_compact.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelAlbum_compact extends FFWDModelMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $pagination_type, $sort_direction = ' ASC ') {
22
- global $wpdb;
23
- $album_id = (isset($_REQUEST['album_id_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_id_' . $ffwd]) : 0);
24
- if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
25
- $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
26
- }
27
- else {
28
- $limit = 0;
29
- }
30
- if ($objects_per_page) {
31
- // var_dump(((string) $album_id ));
32
- if(((string) $album_id ) == 'back' && $pagination_type != 0 && $pagination_type != 1) {
33
- $page_number = (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) ? $_REQUEST['page_number_' . $ffwd] : 0;
34
- $limit_str = 'LIMIT 0,' . (((int) $page_number ) * $objects_per_page);
35
- }
36
- else
37
- $limit_str = 'LIMIT ' . $limit . ',' . $objects_per_page;
38
- }
39
- else {
40
- $limit_str = '';
41
- }
42
- $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` DESC ' . $limit_str, $id));
43
- // Store ids ans object_ids
44
- $id_object_id_json = array();
45
- foreach($results as $row) {
46
- $object = new stdClass();
47
- $object->id = $row->id;
48
- $object->object_id = $row->object_id;
49
- array_push($id_object_id_json, $object);
50
- }
51
- $this->id_object_id_json = $id_object_id_json;
52
- // Set graph url
53
- $this->graph_url = str_replace (
54
- array('{ACCESS_TOKEN}', '{LIMIT}', '{OTHER}'),
55
- array('access_token=' . $this->access_token . '&', '', 'summary=true&limit=100'),
56
- $this->graph_url
57
- );
58
- return $results;
59
- }
60
- ////////////////////////////////////////////////////////////////////////////////////////
61
- // Getters & Setters //
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Private Methods //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Listeners //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/models/FFWDModelBlog_style.php CHANGED
@@ -1,25 +1,14 @@
1
  <?php
2
 
3
  class FFWDModelBlog_style extends FFWDModelMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
  public function __construct() {
17
  }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ') {
22
  global $wpdb;
 
23
  if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
24
  $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
25
  }
@@ -32,7 +21,25 @@ class FFWDModelBlog_style extends FFWDModelMain {
32
  else {
33
  $limit_str = '';
34
  }
35
- $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` DESC ' . $limit_str, $id));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  // Store ids ans object_ids
37
  $id_object_id_json = array();
38
  foreach($results as $row) {
@@ -52,7 +59,7 @@ class FFWDModelBlog_style extends FFWDModelMain {
52
  $object->attachments = new stdClass();
53
 
54
  if(isset($attachments->data[0]->media))
55
- $object->attachments->media=$attachments->data[0]->media;
56
  if(isset($attachments->data[0]->subattachments))
57
  $object->attachments->subattachments=$attachments->data[0]->subattachments;
58
  if(isset($attachments->data[0]->type))
@@ -63,7 +70,6 @@ class FFWDModelBlog_style extends FFWDModelMain {
63
  array_push($id_object_id_json, $object);
64
  }
65
  $this->id_object_id_json = $id_object_id_json;
66
-
67
  // Set graph url
68
  $this->graph_url = str_replace (
69
  array('{ACCESS_TOKEN}', '{LIMIT}'),
@@ -72,36 +78,36 @@ class FFWDModelBlog_style extends FFWDModelMain {
72
  );
73
  return $results;
74
  }
75
- public function humanTiming ($time) {
76
- $time = time() - $time;
77
  $tokens = array (
78
- 31536000 => __('year','ffwd'),
79
- 2592000 => __('month','ffwd'),
80
- 604800 => __('week','ffwd'),
81
- 86400 => __('day','ffwd'),
82
- 3600 => __('hour','ffwd'),
83
- 60 => __('minute','ffwd'),
84
- 1 => __('second','ffwd')
85
- );
86
-
87
- $tokens_s = array (
88
- 31536000 => __('years','ffwd'),
89
- 2592000 => __('months','ffwd'),
90
- 604800 => __('weeks','ffwd'),
91
- 86400 => __('days','ffwd'),
92
- 3600 => __('hours','ffwd'),
93
- 60 => __('minutes','ffwd'),
94
- 1 => __('seconds','ffwd')
95
- );
96
- foreach ($tokens as $unit => $text) {
97
- if ($time < $unit) continue;
98
- $numberOfUnits = floor($time / $unit);
99
- if($numberOfUnits>1)
100
- return $numberOfUnits.' '.$tokens_s[$unit] . __(' ago','ffwd');
101
-
102
- return $numberOfUnits.' '.$text. __(' ago','ffwd');
103
- }
104
- }
105
  public function ffwd_time($object_row, $ffwd,$event_date) {
106
  $event_date_format = $this->options->event_date_format;
107
  $post_date_format = $this->options->post_date_format;
@@ -129,9 +135,8 @@ class FFWDModelBlog_style extends FFWDModelMain {
129
  else {
130
  ?>
131
  <div class="ffwd_from_time_post_<?php echo $ffwd; ?>" style="">
132
- <i class=" ffwd ffwd-time"></i>
133
- <span>
134
-
135
  <?php
136
  if($post_date_format == 'ago') {
137
  $time = strtotime($object_row->created_time);
@@ -140,7 +145,7 @@ class FFWDModelBlog_style extends FFWDModelMain {
140
  else
141
  echo $date_create->format($post_date_format);
142
  ?>
143
- </span>
144
  </div>
145
  <?php
146
  }
@@ -173,44 +178,17 @@ class FFWDModelBlog_style extends FFWDModelMain {
173
  $str = implode(' ', $str);
174
  return $str;
175
  }
176
- public function get_share_url($object_row){
177
- $from = $object_row->from;
178
- $link = $object_row->link;
179
- $object_id = $object_row->object_id;
180
- switch ($object_row->type) {
181
- case "photo" :
182
- $share_url = ($link != "") ? $link : "https://www.facebook.com/".$object_id;
183
- break;
184
- case "link" :
185
- $post_id = str_replace($from . "_", "", $object_id);
186
- $share_url = "https://www.facebook.com/".$from."/posts/".$post_id;
187
- break;
188
- case "status" :
189
- $post_id = str_replace($from . "_", "", $object_id);
190
- $share_url = "https://www.facebook.com/".$from."/posts/".$post_id;
191
- break;
192
- case "video" :
193
- $share_url = ($link != "") ? $link : "https://www.facebook.com/".$object_id;
194
- break;
195
- case "events" :
196
- $share_url = "https://www.facebook.com/events/".$object_id;
197
- break;
198
- default:
199
- $share_url = "https://www.facebook.com/".$object_id;
200
- break;
201
- }
202
- return $share_url;
203
- }
204
  public function see_less_more($string, $type, $row_type,$post_text_length=200,$event_desp_length=200) {
205
  $string = strip_tags($string);
206
  $new_string = $string;
207
  $hide_text_paragraph = '';
208
  $length = strlen($string);
209
-
210
  if($row_type == 'events')
211
- $text_length = $event_desp_length;
212
  else
213
- $text_length = $post_text_length;
 
214
 
215
  if ($length > $text_length) {
216
  // Truncate string
@@ -227,13 +205,4 @@ class FFWDModelBlog_style extends FFWDModelMain {
227
  }
228
  return $new_string;
229
  }
230
- ////////////////////////////////////////////////////////////////////////////////////////
231
- // Getters & Setters //
232
- ////////////////////////////////////////////////////////////////////////////////////////
233
- ////////////////////////////////////////////////////////////////////////////////////////
234
- // Private Methods //
235
- ////////////////////////////////////////////////////////////////////////////////////////
236
- ////////////////////////////////////////////////////////////////////////////////////////
237
- // Listeners //
238
- ////////////////////////////////////////////////////////////////////////////////////////
239
  }
1
  <?php
2
 
3
  class FFWDModelBlog_style extends FFWDModelMain {
4
+
 
 
 
 
 
 
 
 
 
 
 
5
  public function __construct() {
6
  }
7
+
8
+ public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' DESC ') {
9
+
 
10
  global $wpdb;
11
+ $sort_direction=' DESC ';
12
  if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
13
  $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
14
  }
21
  else {
22
  $limit_str = '';
23
  }
24
+
25
+ $fb_info=$wpdb->get_row($wpdb->prepare('SELECT content,upcoming_events,event_order FROM ' . $wpdb->prefix . 'wd_fb_info WHERE id="%d"', $id));
26
+
27
+ $events_str='';
28
+ if($fb_info->content=='events' && $fb_info->upcoming_events==1)
29
+ {
30
+ $events_str=' AND created_time_number>='.strtotime(date('Y-m-d'));
31
+ }
32
+
33
+
34
+ if($fb_info->content=='events' && $fb_info->event_order==1)
35
+ {
36
+ $sort_direction=' ASC ';
37
+ }
38
+
39
+
40
+
41
+
42
+ $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" '.$events_str.' ORDER BY created_time '.$sort_direction . $limit_str, $id));
43
  // Store ids ans object_ids
44
  $id_object_id_json = array();
45
  foreach($results as $row) {
59
  $object->attachments = new stdClass();
60
 
61
  if(isset($attachments->data[0]->media))
62
+ $object->attachments->media=$attachments->data[0]->media;
63
  if(isset($attachments->data[0]->subattachments))
64
  $object->attachments->subattachments=$attachments->data[0]->subattachments;
65
  if(isset($attachments->data[0]->type))
70
  array_push($id_object_id_json, $object);
71
  }
72
  $this->id_object_id_json = $id_object_id_json;
 
73
  // Set graph url
74
  $this->graph_url = str_replace (
75
  array('{ACCESS_TOKEN}', '{LIMIT}'),
78
  );
79
  return $results;
80
  }
81
+ public function humanTiming ($time) {
82
+ $time = time() - $time;
83
  $tokens = array (
84
+ 31536000 => __('year','ffwd'),
85
+ 2592000 => __('month','ffwd'),
86
+ 604800 => __('week','ffwd'),
87
+ 86400 => __('day','ffwd'),
88
+ 3600 => __('hour','ffwd'),
89
+ 60 => __('minute','ffwd'),
90
+ 1 => __('second','ffwd')
91
+ );
92
+
93
+ $tokens_s = array (
94
+ 31536000 => __('years','ffwd'),
95
+ 2592000 => __('months','ffwd'),
96
+ 604800 => __('weeks','ffwd'),
97
+ 86400 => __('days','ffwd'),
98
+ 3600 => __('hours','ffwd'),
99
+ 60 => __('minutes','ffwd'),
100
+ 1 => __('seconds','ffwd')
101
+ );
102
+ foreach ($tokens as $unit => $text) {
103
+ if ($time < $unit) continue;
104
+ $numberOfUnits = floor($time / $unit);
105
+ if($numberOfUnits>1)
106
+ return $numberOfUnits.' '.$tokens_s[$unit] . __(' ago','ffwd');
107
+
108
+ return $numberOfUnits.' '.$text. __(' ago','ffwd');
109
+ }
110
+ }
111
  public function ffwd_time($object_row, $ffwd,$event_date) {
112
  $event_date_format = $this->options->event_date_format;
113
  $post_date_format = $this->options->post_date_format;
135
  else {
136
  ?>
137
  <div class="ffwd_from_time_post_<?php echo $ffwd; ?>" style="">
138
+ <i class=" ffwd ffwd-time"></i>
139
+ <span>
 
140
  <?php
141
  if($post_date_format == 'ago') {
142
  $time = strtotime($object_row->created_time);
145
  else
146
  echo $date_create->format($post_date_format);
147
  ?>
148
+ </span>
149
  </div>
150
  <?php
151
  }
178
  $str = implode(' ', $str);
179
  return $str;
180
  }
181
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  public function see_less_more($string, $type, $row_type,$post_text_length=200,$event_desp_length=200) {
183
  $string = strip_tags($string);
184
  $new_string = $string;
185
  $hide_text_paragraph = '';
186
  $length = strlen($string);
 
187
  if($row_type == 'events')
188
+ $text_length = $event_desp_length;
189
  else
190
+ $text_length = $post_text_length;
191
+
192
 
193
  if ($length > $text_length) {
194
  // Truncate string
205
  }
206
  return $new_string;
207
  }
 
 
 
 
 
 
 
 
 
208
  }
frontend/models/FFWDModelMain.php CHANGED
@@ -1,110 +1,104 @@
1
  <?php
2
 
3
  class FFWDModelMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
  public $id_object_id_json;
14
  public $access_token;
15
- public $graph_url = 'https://graph.facebook.com/{FB_ID}/{EDGE}?{ACCESS_TOKEN}{FIELDS}{LIMIT}{OTHER}';
16
  public $page_user_group;
17
  public $options;
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Constructor & Destructor //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
  public function __construct() {
 
22
 
23
-
24
- }
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- // Public Methods //
27
- ////////////////////////////////////////////////////////////////////////////////////////
28
- public function get_theme_row_data($id) {
29
  global $wpdb;
30
- if ($id) {
31
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id="%d"', $id));
32
  }
33
  else {
34
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE default_theme="%d"', 1));
35
  }
36
-
37
- $row = (object) array_merge((array)$row, (array)json_decode( $row->params));
38
  unset($row->params);
39
 
40
  return $row;
41
  }
42
- public function get_ffwd_info($id) {
 
43
  global $wpdb;
44
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE published=1 AND id="%d"', $id),ARRAY_A);
45
  // set access token
46
- if($row != NULL) {
47
- $row["success"] = true;
48
- $this->access_token = $row['access_token'];
49
-
50
- $graph_url_for_page_info = str_replace (
51
- array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
52
- array($row['from'], '', 'access_token=' . $this->access_token . '&', 'fields=picture,name,link&', '', ''),
53
- $this->graph_url
54
- );
55
- $this->page_user_group = array();//self::decap_do_curl($graph_url_for_page_info);
56
- $this->page_user_group = json_encode($this->page_user_group);
57
- }else{
58
- $row["success"] = false;
 
 
 
 
 
 
 
 
 
 
59
  }
 
60
  return $row;
61
  }
62
- public function page_nav($id, $objects_per_page, $ffwd) {
 
63
  global $wpdb;
64
  $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d"', $id));
65
  $page_nav['total'] = $total;
66
-
67
-
68
- if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
69
  $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
70
  }
71
  else {
72
  $limit = 0;
73
  }
74
  $page_nav['limit'] = (int) ($limit / $objects_per_page + 1);
 
75
  return $page_nav;
76
  }
77
- public static function decap_do_curl($uri) {
78
- $facebook_graph_results = null;
 
79
  $facebook_graph_url = $uri;
80
  $response = wp_remote_get($facebook_graph_url);
81
- if(isset($response->errors) && isset($response->errors["http_request_failed"][0])){
82
  print $response->errors["http_request_failed"][0];
83
- }elseif( is_array( $response ) && isset($response['body'])) {
 
84
  $header = $response['headers']; // array of http header lines
85
  $facebook_graph_results = $response['body']; // use the content
86
  }
 
87
 
88
- $facebook_graph_results = json_decode($facebook_graph_results, true);
89
  return $facebook_graph_results;
90
  }
 
91
  public function get_ffwd_options() {
92
  global $wpdb;
93
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
94
  $this->options = $row;
95
- return $row;
 
96
  }
97
- public function get_option_json_data() {
98
- if(isset($this->options) && $this->options != NULL)
99
- return stripslashes(json_encode($this->options));
 
 
100
  }
101
- ////////////////////////////////////////////////////////////////////////////////////////
102
- // Getters & Setters //
103
- ////////////////////////////////////////////////////////////////////////////////////////
104
- ////////////////////////////////////////////////////////////////////////////////////////
105
- // Private Methods //
106
- ////////////////////////////////////////////////////////////////////////////////////////
107
- ////////////////////////////////////////////////////////////////////////////////////////
108
- // Listeners //
109
- ////////////////////////////////////////////////////////////////////////////////////////
110
  }
1
  <?php
2
 
3
  class FFWDModelMain {
4
+
 
 
 
 
 
 
 
 
5
  public $id_object_id_json;
6
  public $access_token;
7
+ public $graph_url = 'https://graph.facebook.com/v10.0/{FB_ID}/{EDGE}?{ACCESS_TOKEN}{FIELDS}{LIMIT}{OTHER}';
8
  public $page_user_group;
9
  public $options;
10
+
 
 
11
  public function __construct() {
12
+ }
13
 
14
+ public function get_theme_row_data( $id ) {
 
 
 
 
 
15
  global $wpdb;
16
+ if ( $id ) {
17
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id="%d"', $id));
18
  }
19
  else {
20
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE default_theme="%d"', 1));
21
  }
22
+ $row = (object) array_merge((array) $row, (array) json_decode($row->params));
 
23
  unset($row->params);
24
 
25
  return $row;
26
  }
27
+
28
+ public function get_ffwd_info( $id ) {
29
  global $wpdb;
30
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE published=1 AND id="%d"', $id), ARRAY_A);
31
  // set access token
32
+ if ( $row != NULL ) {
33
+ $row["success"] = TRUE;
34
+ $this->access_token = $row['access_token'];
35
+ $graph_url_for_page_info = str_replace(array(
36
+ '{FB_ID}',
37
+ '{EDGE}',
38
+ '{ACCESS_TOKEN}',
39
+ '{FIELDS}',
40
+ '{LIMIT}',
41
+ '{OTHER}',
42
+ ), array(
43
+ $row['from'],
44
+ '',
45
+ 'access_token=' . $this->access_token . '&',
46
+ 'fields=picture,name,link&',
47
+ '',
48
+ '',
49
+ ), $this->graph_url);
50
+ $this->page_user_group = array();//self::decap_do_curl($graph_url_for_page_info);
51
+ $this->page_user_group = json_encode($this->page_user_group);
52
+ }
53
+ else {
54
+ $row["success"] = FALSE;
55
  }
56
+
57
  return $row;
58
  }
59
+
60
+ public function page_nav( $id, $objects_per_page, $ffwd ) {
61
  global $wpdb;
62
  $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d"', $id));
63
  $page_nav['total'] = $total;
64
+ if ( isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd] ) {
 
 
65
  $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
66
  }
67
  else {
68
  $limit = 0;
69
  }
70
  $page_nav['limit'] = (int) ($limit / $objects_per_page + 1);
71
+
72
  return $page_nav;
73
  }
74
+
75
+ public static function decap_do_curl( $uri ) {
76
+ $facebook_graph_results = NULL;
77
  $facebook_graph_url = $uri;
78
  $response = wp_remote_get($facebook_graph_url);
79
+ if ( isset($response->errors) && isset($response->errors["http_request_failed"][0]) ) {
80
  print $response->errors["http_request_failed"][0];
81
+ }
82
+ elseif ( is_array($response) && isset($response['body']) ) {
83
  $header = $response['headers']; // array of http header lines
84
  $facebook_graph_results = $response['body']; // use the content
85
  }
86
+ $facebook_graph_results = json_decode($facebook_graph_results, TRUE);
87
 
 
88
  return $facebook_graph_results;
89
  }
90
+
91
  public function get_ffwd_options() {
92
  global $wpdb;
93
  $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
94
  $this->options = $row;
95
+
96
+ return $row;
97
  }
98
+
99
+ public function get_option_json_data() {
100
+ if ( isset($this->options) && $this->options != NULL ) {
101
+ return stripslashes(json_encode($this->options));
102
+ }
103
  }
 
 
 
 
 
 
 
 
 
104
  }
frontend/models/FFWDModelPopupBox.php DELETED
@@ -1,273 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelPopupBox {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- public $access_token;
14
- public $graph_url = 'https://graph.facebook.com/{FB_ID}/{EDGE}?{ACCESS_TOKEN}{FIELDS}{LIMIT}{OTHER}';
15
- public $page_user_group;
16
- public $options;
17
- public $date_offset;
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Constructor & Destructor //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function __construct() {
22
- }
23
- ////////////////////////////////////////////////////////////////////////////////////////
24
- // Public Methods //
25
- ////////////////////////////////////////////////////////////////////////////////////////
26
- public function get_theme_row_data($id) {
27
- global $wpdb;
28
- if ($id) {
29
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE id="%d"', $id));
30
- }
31
- else {
32
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_theme WHERE default_theme="%d"', 1));
33
- }
34
- $row = (object) array_merge((array)$row, (array)json_decode( $row->params));
35
- unset($row->params);
36
-
37
-
38
- return $row;
39
- }
40
-
41
- public function get_option_row_data() {
42
- global $wpdb;
43
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_option WHERE id="%d"', 1));
44
- $this->options = $row;
45
- return $row;
46
- }
47
-
48
- public function get_image_rows_data($fb_id, $sort_by, $order_by = 'asc') {
49
- global $wpdb;
50
- if ($sort_by == 'size' || $sort_by == 'resolution') {
51
- $sort_by = ' CAST(' . $sort_by . ' AS SIGNED) ';
52
- }
53
- elseif (($sort_by != 'alt') && ($sort_by != 'date') && ($sort_by != 'filetype') && ($sort_by != 'filename')) {
54
- //$sort_by = '`order`';
55
- $sort_by = '`id`';
56
- }
57
- if (preg_replace('/\s+/', '', $order_by) != 'asc') {
58
- $order_by = 'desc';
59
- }
60
-
61
- $sort_by = '`created_time_number`';
62
- $order_by = 'DESC';
63
-
64
- $row = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY ' . $sort_by . ' ' . $order_by, $fb_id));
65
- return $row;
66
- }
67
-
68
- public function get_ffwd_info_data($id) {
69
- global $wpdb;
70
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE published=1 AND id="%d"', $id));
71
- // set access token
72
- $this->access_token = $row->page_access_token;
73
- $graph_url_for_page_info = str_replace (
74
- array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
75
- array($row->from, '', 'access_token=' . $this->access_token . '&', 'fields=picture,name,link&', '', ''),
76
- $this->graph_url
77
- );
78
- $this->graph_url = str_replace (
79
- array('{ACCESS_TOKEN}', '{LIMIT}'),
80
- array('access_token=' . $this->access_token . '&', ''),
81
- $this->graph_url
82
- );
83
- $this->page_user_group = self::decap_do_curl($graph_url_for_page_info);
84
- $this->page_user_group = json_encode($this->page_user_group);
85
-
86
-
87
- return $row;
88
- }
89
-
90
- public static function decap_do_curl($uri) {
91
- $facebook_graph_results = null;
92
- $facebook_graph_url = $uri; //TODO: Add URL checking here, else error out
93
- $response = wp_remote_get($facebook_graph_url);
94
- if(isset($response->errors) && isset($response->errors["http_request_failed"][0])){
95
- print $response->errors["http_request_failed"][0];
96
- }elseif( is_array( $response ) && isset($response['body'])) {
97
- $header = $response['headers']; // array of http header lines
98
- $facebook_graph_results = $response['body']; // use the content
99
- }
100
-
101
- $facebook_graph_results = json_decode($facebook_graph_results, true);
102
- return $facebook_graph_results;
103
- }
104
-
105
- public function ffwd_set_date_timezone_offset(){
106
- $date_timezone = isset($this->options->date_timezone) && $this->options->date_timezone!='' ? $this->options->date_timezone : date_default_timezone_get() ;
107
- $date_for_offset = new DateTimeZone($date_timezone);
108
- $date_offset = new DateTime("now", $date_for_offset);
109
- $offset = $date_offset->getOffset();
110
- $offset /= 3600;
111
- $this->date_offset = $offset;
112
- }
113
-
114
- public function ffwd_time($created_time, $updated_time, $type) {
115
- $event_date_format = $this->options->event_date_format;
116
- $post_date_format = $this->options->post_date_format;
117
- $date_timezone = isset($this->options->date_timezone) && $this->options->date_timezone!='' ? $this->options->date_timezone : date_default_timezone_get() ;
118
- $date_create = new DateTime($created_time);
119
- $date_create->setTimezone(new DateTimeZone($date_timezone));
120
- $date_update = new DateTime($updated_time);
121
- $date_update->setTimezone(new DateTimeZone($date_timezone));
122
- if($type == "events") {
123
- if($this->options->event_date) {
124
- ?>
125
- <div class="ffwd_popup_from_time_event" style="">
126
- <i class="ffwd ffwd-time"></i>
127
- <span>
128
-
129
- <?php
130
- echo $date_create->format($event_date_format) . '<br>';
131
- //echo 'Start - ' . $date_create->format($event_date_format) . '<br>' .
132
- //'End - ' . $date_update->format($event_date_format);
133
- ?>
134
- </span>
135
- </div>
136
- <?php
137
- }
138
- }
139
- else {
140
- ?>
141
- <div class="ffwd_popup_from_time_post" style="">
142
- <i class="ffwd ffwd-time"></i>
143
- <span>
144
-
145
- <?php
146
- if($post_date_format == 'ago') {
147
- $time = strtotime($created_time);
148
- echo $this->humanTiming($time);
149
- }
150
- else
151
- echo $date_create->format($post_date_format);
152
- ?>
153
- </span>
154
- </div>
155
- <?php
156
- }
157
- }
158
-
159
- public function humanTiming ($time) {
160
- $time = time() - $time;
161
- $tokens = array (
162
- 31536000 => __('year','ffwd'),
163
- 2592000 => __('month','ffwd'),
164
- 604800 => __('week','ffwd'),
165
- 86400 => __('day','ffwd'),
166
- 3600 => __('hour','ffwd'),
167
- 60 => __('minute','ffwd'),
168
- 1 => __('second','ffwd')
169
- );
170
-
171
- $tokens_s = array (
172
- 31536000 => __('years','ffwd'),
173
- 2592000 => __('months','ffwd'),
174
- 604800 => __('weeks','ffwd'),
175
- 86400 => __('days','ffwd'),
176
- 3600 => __('hours','ffwd'),
177
- 60 => __('minutes','ffwd'),
178
- 1 => __('seconds','ffwd')
179
- );
180
- foreach ($tokens as $unit => $text) {
181
- if ($time < $unit) continue;
182
- $numberOfUnits = floor($time / $unit);
183
- if($numberOfUnits>1)
184
- return $numberOfUnits.' '.$tokens_s[$unit] . __(' ago','ffwd');
185
-
186
- return $numberOfUnits.' '.$text. __(' ago','ffwd');
187
- }
188
- }
189
-
190
- public function fill_hashtags ($str) {
191
- $str = preg_replace("/\n/", " \n", $str);
192
- $str = explode(' ', $str);
193
- for($i=0; $i<count($str); $i++) {
194
- if(strpos($str[$i], '#') === 0) {
195
- $hashtag = str_replace('#', '<a class="ffwd_hashtag" target="_blank" href="https://www.facebook.com/hashtag/', $str[$i]);
196
- $word = explode('#', $str[$i]);
197
- $word = '#' . $word[1];
198
- $hashtag .= '">' . $word . '</a>';
199
- $str[$i] = $hashtag;
200
- }
201
- }
202
- $str = implode(' ', $str);
203
- return $str;
204
- }
205
-
206
- public function see_less_more($string, $type, $row_type) {
207
- $string = strip_tags($string);
208
- $new_string = $string;
209
- $hide_text_paragraph = '';
210
- $length = strlen($string);
211
- /*var_dump($length);*/
212
- if($row_type == 'events')
213
- $text_length = isset($this->options->event_desp_length) ? $this->options->event_desp_length : 200;
214
- else
215
- $text_length = isset($this->options->post_text_length) ? $this->options->post_text_length : 200;
216
- if ($length > $text_length) {
217
- // Truncate string
218
- $stringCut = substr($string, 0, $text_length);//var_dump($stringCut);
219
- // Make sure it ends in a word so football doesn't footba ass...
220
- $last_whitespace_in_string_cut = strrpos($stringCut, ' ');
221
- $last_whitespace_in_string_cut = ($last_whitespace_in_string_cut === false) ? 0 : $last_whitespace_in_string_cut;
222
- // Get hide text
223
- $hide_text_length = $length - $last_whitespace_in_string_cut;
224
- $hide_text = substr($string, $last_whitespace_in_string_cut, $hide_text_length);
225
- $hide_text_paragraph = ' <span style="display:none" class="ffwd_object_'.$type.'_hide" >' . $hide_text . ' </span>';
226
- $new_string = substr($stringCut, 0, $last_whitespace_in_string_cut) . $hide_text_paragraph . ' <span class="ffwd_more_dotes" > ... </span> <a href="" class="ffwd_see_more ffwd_see_more_'.$type.'">See more</a>';
227
- }
228
- return $new_string;
229
- }
230
-
231
- public function fill_tags($string, $message_tags) {
232
- $message_tags = json_decode(str_replace("'", esc_html("'"), $message_tags));
233
- if($message_tags)
234
- foreach($message_tags as $message_tag) {
235
- $type = gettype ( $message_tag );
236
- $tag = ($type == "object") ? $message_tag : $message_tag["0"];
237
- if(strpos($string, $tag->name) !== false) {
238
- $string = str_replace($tag->name, '<a class="ffwd_message_tag" target="_blank" href="https://www.facebook.com/' . $tag->id . '" >'.$tag->name.'</a>', $string);
239
- }
240
- }
241
- return $string;
242
- }
243
-
244
- public function get_option_json_data() {
245
-
246
- if(isset($this->options) && $this->options != NULL)
247
- return stripslashes(json_encode($this->options));
248
- }
249
-
250
- public function ffwd_story($story, $place) {
251
- $enable_place_name = (isset($_GET['enable_place_name']) ? sanitize_text_field($_GET['enable_place_name']) : 0);
252
- //$enable_author = (isset($_GET['enable_author']) ? esc_html($_GET['enable_author']) : 0);
253
- $story = str_replace($this->page_user_group['name'], "", $story);
254
- $place = json_decode($place);
255
- if($place != null) {
256
- $place_name = $place->name;
257
- $story = str_replace(
258
- $place_name,
259
- '<a class="ffwd_place_name" href="https://www.facebook.com/' . $place->id . '" target="_blank">' . $place_name . '</a>',
260
- $story );
261
- }
262
- return $story;
263
- }
264
- ////////////////////////////////////////////////////////////////////////////////////////
265
- // Getters & Setters //
266
- ////////////////////////////////////////////////////////////////////////////////////////
267
- ////////////////////////////////////////////////////////////////////////////////////////
268
- // Private Methods //
269
- ////////////////////////////////////////////////////////////////////////////////////////
270
- ////////////////////////////////////////////////////////////////////////////////////////
271
- // Listeners //
272
- ////////////////////////////////////////////////////////////////////////////////////////
273
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/models/FFWDModelThumbnails.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelThumbnails extends FFWDModelMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ') {
22
- global $wpdb;
23
- if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
24
- $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
25
- }
26
- else {
27
- $limit = 0;
28
- }
29
- if ($objects_per_page) {
30
- $limit_str = 'LIMIT ' . $limit . ',' . $objects_per_page;
31
- }
32
- else {
33
- $limit_str = '';
34
- }
35
- $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` DESC ' . $limit_str, $id));
36
- // Store ids ans object_ids
37
- $id_object_id_json = array();
38
- foreach($results as $row) {
39
- $object = new stdClass();
40
- $object->id = $row->id;
41
- $object->object_id = $row->object_id;
42
- $object->type = $row->type;
43
- array_push($id_object_id_json, $object);
44
- }
45
- $this->id_object_id_json = $id_object_id_json;
46
- // Set graph url
47
- $this->graph_url = str_replace (
48
- array('{ACCESS_TOKEN}', '{LIMIT}', '{OTHER}'),
49
- array('access_token=' . $this->access_token . '&', '', 'summary=true'),
50
- $this->graph_url
51
- );
52
- return $results;
53
- }
54
-
55
- public function see_less_more($string) {
56
- $string = strip_tags($string);
57
- $new_string = $string;
58
- $hide_text_paragraph = '';
59
- $length = strlen($string);
60
- $text_length = 50;
61
- if ($length > $text_length) {
62
- // Truncate string
63
- $stringCut = substr($string, 0, $text_length);
64
- // Make sure it ends in a word so football doesn't footba ass...
65
- $last_whitespace_in_string_cut = strrpos($stringCut, ' ');
66
- $last_whitespace_in_string_cut = ($last_whitespace_in_string_cut === false) ? 0 : $last_whitespace_in_string_cut;
67
- // Get hide text
68
- $hide_text_length = $length - $last_whitespace_in_string_cut;
69
- $hide_text = substr($string, $last_whitespace_in_string_cut, $hide_text_length);
70
- $hide_text_paragraph = ' <span style="display:none" class="ffwd_thumbnail_name_hide" >' . $hide_text . ' </span>';
71
- $new_string = substr($stringCut, 0, $last_whitespace_in_string_cut) . $hide_text_paragraph;
72
- }
73
- return $new_string;
74
- }
75
- ////////////////////////////////////////////////////////////////////////////////////////
76
- // Getters & Setters //
77
- ////////////////////////////////////////////////////////////////////////////////////////
78
- ////////////////////////////////////////////////////////////////////////////////////////
79
- // Private Methods //
80
- ////////////////////////////////////////////////////////////////////////////////////////
81
- ////////////////////////////////////////////////////////////////////////////////////////
82
- // Listeners //
83
- ////////////////////////////////////////////////////////////////////////////////////////
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/models/FFWDModelThumbnails_masonry.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- class FFWDModelThumbnails_masonry extends FFWDModelMain {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- ////////////////////////////////////////////////////////////////////////////////////////
14
- // Constructor & Destructor //
15
- ////////////////////////////////////////////////////////////////////////////////////////
16
- public function __construct() {
17
- }
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
- public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ') {
22
- global $wpdb;
23
- $bwg_search = ((isset($_POST['bwg_search_' . $ffwd]) && sanitize_text_field($_POST['bwg_search_' . $ffwd]) != '') ? sanitize_text_field($_POST['bwg_search_' . $ffwd]) : '');
24
- if ($bwg_search != '') {
25
- $where = 'AND alt LIKE "%%' . $bwg_search . '%%"';
26
- }
27
- else {
28
- $where = '';
29
- }
30
- if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
31
- $limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
32
- }
33
- else {
34
- $limit = 0;
35
- }
36
- if ($objects_per_page) {
37
- $limit_str = 'LIMIT ' . $limit . ',' . $objects_per_page;
38
- }
39
- else {
40
- $limit_str = '';
41
- }
42
- $results = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_data WHERE fb_id="%d" ORDER BY `created_time_number` DESC ' . $limit_str, $id));
43
- //store ids ans object_ids
44
- $id_object_id_json = array();
45
- foreach($results as $row) {
46
- $object = new stdClass();
47
- $object->id = $row->id;
48
- $object->object_id = $row->object_id;
49
- array_push($id_object_id_json, $object);
50
- }
51
- $this->id_object_id_json = $id_object_id_json;
52
- //set graph url
53
- $this->graph_url = str_replace (
54
- array('{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
55
- array('access_token=' . $this->access_token . '&', '', '', 'summary=true'),
56
- $this->graph_url
57
- );
58
- return $results;
59
- }
60
- ////////////////////////////////////////////////////////////////////////////////////////
61
- // Getters & Setters //
62
- ////////////////////////////////////////////////////////////////////////////////////////
63
- ////////////////////////////////////////////////////////////////////////////////////////
64
- // Private Methods //
65
- ////////////////////////////////////////////////////////////////////////////////////////
66
- ////////////////////////////////////////////////////////////////////////////////////////
67
- // Listeners //
68
- ////////////////////////////////////////////////////////////////////////////////////////
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/views/FFWDViewAlbum_compact.php DELETED
@@ -1,752 +0,0 @@
1
- <?php
2
-
3
- class FFWDViewAlbum_compact {
4
- ////////////////////////////////////////////////////////////////////////////////////////
5
- // Events //
6
- ////////////////////////////////////////////////////////////////////////////////////////
7
- ////////////////////////////////////////////////////////////////////////////////////////
8
- // Constants //
9
- ////////////////////////////////////////////////////////////////////////////////////////
10
- ////////////////////////////////////////////////////////////////////////////////////////
11
- // Variables //
12
- ////////////////////////////////////////////////////////////////////////////////////////
13
- private $model;
14
-
15
-
16
- ////////////////////////////////////////////////////////////////////////////////////////
17
- // Constructor & Destructor //
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- public function __construct($model) {
20
- $this->model = $model;
21
- }
22
- ////////////////////////////////////////////////////////////////////////////////////////
23
- // Public Methods //
24
- ////////////////////////////////////////////////////////////////////////////////////////
25
- public function display($params, $from_shortcode = 0, $ffwd = 0) {
26
- global $wp;
27
- $current_url = $wp->query_string;
28
- require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
29
- $type = (isset($_REQUEST['type_' . $ffwd]) ? sanitize_text_field($_REQUEST['type_' . $ffwd]) : 'albums');
30
-
31
- $ffwd_info = $this->model->get_ffwd_info($params['fb_id']);
32
- if ($ffwd_info == NULL || $ffwd_info["success"] === false) {
33
- echo WDW_FFWD_Library::message(__('There is no facebook feed selected or it was deleted.', 'ffwd'), 'error');
34
- return;
35
- }
36
- if ( isset($params['from']) and $params['from'] == 'widget' ) {
37
- $ffwd_info['objects_per_page'] = $params['objects_per_page'];
38
- $ffwd_info['theme'] = $params['theme_id'];
39
- $ffwd_info['album_image_thumb_width'] = $params['thumb_width'];
40
- $ffwd_info['album_image_thumb_height']= $params['thumb_height'];
41
- }
42
-
43
- $theme_row = $this->model->get_theme_row_data($ffwd_info['theme']);
44
- if (!$theme_row) {
45
- echo WDW_FFWD_Library::message(__('There is no theme selected or the theme was deleted.', 'ffwd'), 'error');
46
- return;
47
- }
48
- $ffwd_data = $this->model->get_ffwd_data($params['fb_id'], $ffwd_info['objects_per_page'], '', $ffwd, $ffwd_info['pagination_type'], ' ASC');
49
- if ($ffwd_info == NULL) {
50
- echo WDW_FFWD_Library::message(__('There is no facebook feed selected or it was deleted.', 'ffwd'), 'error');
51
- return;
52
- }
53
-
54
- $album_id = (isset($_REQUEST['album_id_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_id_' . $ffwd]) : 0);
55
- if ($type == 'gallery') {
56
- $items_col_num = $ffwd_info['album_image_max_columns'];
57
- $album_gallery_div_id = 'ffwd_album_compact_' . $ffwd;
58
- $album_gallery_div_class = 'ffwd_standart_thumbnails_' . $ffwd;
59
-
60
- $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->thumb_align . '; width:100%;';
61
- $form_child_div_id = '';
62
- }
63
- else {
64
- $items_per_page = $ffwd_info['objects_per_page'];
65
- $items_col_num = $ffwd_info['album_max_columns'];
66
- if ($ffwd_info['pagination_type'] && $ffwd_info['objects_per_page']) {
67
- $page_nav = $this->model->page_nav($ffwd_info['id'], $items_per_page, $ffwd);
68
- }
69
- $album_gallery_div_id = 'ffwd_album_compact_' . $ffwd;
70
- $album_gallery_div_class = 'ffwd_album_compact_' . $ffwd;
71
-
72
- $form_child_div_id = '';
73
- $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->album_compact_thumb_align . '; width:100%;';
74
-
75
- }
76
- $album_page_number_ = (isset($_REQUEST['album_page_number_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_page_number_' . $ffwd]) : 0);
77
-
78
- $rgb_page_nav_font_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->page_nav_font_color);
79
- $rgb_album_compact_thumbs_bg_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->album_compact_thumbs_bg_color);
80
- $rgb_thumbs_bg_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->thumbs_bg_color);
81
-
82
- $ffwd_info_array = array(
83
- 'action' => 'PopupBox',
84
- 'fb_id' => $params['fb_id'],
85
- 'current_view' => $ffwd,
86
- 'theme_id' => $ffwd_info['theme'],
87
- 'thumb_width' => $ffwd_info['album_thumb_width'],
88
- 'thumb_height' => $ffwd_info['album_thumb_height'],
89
- 'open_with_fullscreen' => $ffwd_info['popup_fullscreen'],
90
- 'open_with_autoplay' => $ffwd_info['popup_autoplay'],
91
- 'image_width' => $ffwd_info['popup_width'],
92
- 'image_height' => $ffwd_info['popup_height'],
93
- 'image_effect' => $ffwd_info['popup_effect'],
94
- 'enable_image_filmstrip' => $ffwd_info['popup_enable_filmstrip'],
95
- 'image_filmstrip_height' => $ffwd_info['popup_filmstrip_height'],
96
-
97
- 'enable_comments' => $ffwd_info['popup_comments'],
98
- 'enable_likes' => $ffwd_info['popup_likes'],
99
- 'enable_shares' => $ffwd_info['popup_shares'],
100
- 'enable_author' => $ffwd_info['popup_author'],
101
- 'enable_name' => $ffwd_info['popup_name'],
102
- 'enable_place_name' => $ffwd_info['popup_place_name'],
103
- 'enable_message_desc' => $ffwd_info['popup_message_desc'],
104
-
105
- 'enable_image_ctrl_btn' => $ffwd_info['popup_enable_ctrl_btn'],
106
- 'enable_image_fullscreen' => $ffwd_info['popup_enable_fullscreen'],
107
- 'enable_object_info' => $ffwd_info['popup_enable_info_btn'],
108
- 'slideshow_interval' => $ffwd_info['popup_interval'],
109
- 'enable_image_facebook' => $ffwd_info['popup_enable_facebook'],
110
- 'enable_image_twitter' => $ffwd_info['popup_enable_twitter'],
111
- 'enable_image_google' => $ffwd_info['popup_enable_google'],
112
- 'current_url' => $current_url
113
- );
114
- ?>
115
- <style>
116
- /* Style for album thumbnail view.*/
117
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_<?php echo $ffwd; ?> {
118
- display: inline-block;
119
- text-align: center;
120
- vertical-align: top;
121
- }
122
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .<?php echo $album_gallery_div_class; ?> * {
123
- -moz-box-sizing: content-box;
124
- box-sizing: content-box;
125
- }
126
-
127
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_page_plugin_<?php echo $ffwd; ?>{
128
- margin: 30px 0px 30px 0px;
129
- background-color: rgba(0, 0, 0, 0);
130
- text-align: <?php echo $theme_row->album_compact_thumb_align; ?>;
131
- width: 100%;
132
- position: relative;
133
- }
134
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_header_container_<?php echo $ffwd; ?> {
135
- display: inline-block;
136
- width: 100%;
137
- max-width: 100%;
138
- text-align: <?php echo $theme_row->blog_style_fd_name_align ?>;
139
- padding: <?php echo $theme_row->blog_style_fd_name_padding ?>px;
140
- box-sizing: border-box;
141
- background-color: #<?php echo $theme_row->blog_style_fd_name_bg_color ?>;
142
- margin: 25px 0px 0px 0px;
143
- }
144
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_header_container_<?php echo $ffwd; ?> .ffwd_album_header_<?php echo $ffwd; ?> {
145
- display: inline-block;
146
- font-family: <?php echo $theme_row->blog_style_obj_font_family; ?>;
147
- font-size: <?php echo $theme_row->blog_style_fd_name_size ?>px;
148
- font-weight: <?php echo $theme_row->blog_style_fd_name_font_weight ?>;
149
- color: #<?php echo $theme_row->blog_style_fd_name_color ?>;
150
- margin: 0px 0px 0px 5px;
151
- }
152
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_header_container_<?php echo $ffwd; ?> .ffwd_album_header_icon_<?php echo $ffwd; ?> {
153
- font-size: <?php echo $theme_row->blog_style_fd_icon_size ?>px;
154
- color: #<?php echo $theme_row->blog_style_fd_icon_color ?>;
155
- vertical-align: middle;
156
- font-family: FontAwesome
157
- }
158
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_spun1_<?php echo $ffwd; ?> {
159
- background-color: #<?php echo $theme_row->album_compact_thumb_bg_color; ?>;
160
- display: inline-block;
161
- width: <?php echo $ffwd_info['album_thumb_width']; ?>px;
162
- height: <?php echo $ffwd_info['album_thumb_height']; ?>px;
163
- margin: <?php echo $theme_row->album_compact_thumb_margin; ?>px;
164
- opacity: <?php echo number_format($theme_row->album_compact_thumb_transparent / 100, 2, ".", ""); ?>;
165
- filter: Alpha(opacity=<?php echo $theme_row->album_compact_thumb_transparent; ?>);
166
- <?php echo ($theme_row->album_compact_thumb_transition) ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : ''; ?>
167
- padding: <?php echo $theme_row->album_compact_thumb_padding; ?>px;
168
- text-align: center;
169
- vertical-align: middle;
170
- z-index: 100;
171
- -webkit-backface-visibility: visible;
172
- -ms-backface-visibility: visible;
173
- }
174
-
175
- .ffwd_album_thumb_<?php echo $ffwd; ?>
176
- {
177
- background-color: #<?php echo $theme_row->album_compact_thumb_bg_color; ?>;
178
- opacity: <?php echo number_format($theme_row->album_compact_thumb_transparent / 100, 2, ".", ""); ?>;
179
- margin: 2px;
180
- }
181
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_spun1_<?php echo $ffwd; ?>:hover {
182
- opacity: 1;
183
- filter: Alpha(opacity=100);
184
- transform: <?php echo $theme_row->album_compact_thumb_hover_effect; ?>(<?php echo $theme_row->album_compact_thumb_hover_effect_value; ?>);
185
- -ms-transform: <?php echo $theme_row->album_compact_thumb_hover_effect; ?>(<?php echo $theme_row->album_compact_thumb_hover_effect_value; ?>);
186
- -webkit-transform: <?php echo $theme_row->album_compact_thumb_hover_effect; ?>(<?php echo $theme_row->album_compact_thumb_hover_effect_value; ?>);
187
- backface-visibility: hidden;
188
- -webkit-backface-visibility: hidden;
189
- -moz-backface-visibility: hidden;
190
- -ms-backface-visibility: hidden;
191
- z-index: 102;
192
- }
193
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_spun2_<?php echo $ffwd; ?> {
194
- border-radius: <?php echo $theme_row->album_compact_thumb_border_radius; ?>;
195
- border: <?php echo $theme_row->album_compact_thumb_border_width; ?>px <?php echo $theme_row->album_compact_thumb_border_style; ?> #<?php echo $theme_row->album_compact_thumb_border_color; ?>;
196
- box-shadow: <?php echo $theme_row->album_compact_thumb_box_shadow; ?>;
197
- display: inline-block;
198
- overflow: hidden;
199
- height: <?php echo $ffwd_info['album_thumb_height']; ?>px;
200
- width: <?php echo $ffwd_info['album_thumb_width']; ?>px;
201
- }
202
-
203
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_spun2_<?php echo $ffwd; ?> > img {
204
- border-radius: 0px !important;
205
- box-shadow: none !important;
206
- border-style: none !important;
207
- padding: 0 !important;
208
- max-height: none !important;
209
- max-width: none !important;
210
- width: <?php echo $ffwd_info['album_thumb_width']; ?>px;
211
- height:<?php echo $ffwd_info['album_thumb_height']; ?>px;
212
- }
213
-
214
- <?php
215
- if ($ffwd_info['album_title'] == 'show') { /* Show album/gallery title at the bottom.*/
216
- ?>
217
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_title_spun1_<?php echo $ffwd; ?> {
218
- display: block;
219
- opacity: 1;
220
- filter: Alpha(opacity=100);
221
- text-align: center;
222
- width: <?php echo $ffwd_info['album_thumb_width']; ?>px;
223
- }
224
- <?php
225
- }
226
- elseif ($ffwd_info['album_title'] == 'hover') { /* Show album/gallery title on hover.*/
227
- ?>
228
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_title_spun1_<?php echo $ffwd; ?> {
229
- display: table;
230
- height: inherit;
231
- left: -3000px;
232
- opacity: 0;
233
- filter: Alpha(opacity=0);
234
- position: absolute;
235
- top: 0px;
236
- width: inherit;
237
- }
238
- <?php
239
- }
240
- ?>
241
-
242
- .ffwd_standart_thumb_img_<?php echo $ffwd; ?> {
243
- max-height: none !important;
244
- max-width: none !important;
245
- padding: 0 !important;
246
- }
247
-
248
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_likes_comments_container_<?php echo $ffwd; ?> {
249
- display: <?php echo ($ffwd_info['album_image_thumb_width'] < 150) ? "none" : "block"; ?>;
250
- height: inherit;
251
- width: inherit;
252
- position: absolute;
253
- left: 0px;
254
- top: 0px;
255
- opacity: 0;
256
- filter: Alpha(opacity=0);
257
- transition: opacity 0.5s;
258
- background-color: rgba(0, 0, 0, 0.46);
259
- border-radius: <?php echo $theme_row->thumb_border_radius; ?>;
260
- }
261
-
262
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_likes_comments_container_<?php echo $ffwd; ?> .ffwd_likes_comments_container_tab_<?php echo $ffwd; ?> {
263
- display: table;
264
- height: inherit;
265
- width: inherit;
266
- }
267
-
268
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_likes_comments_container_<?php echo $ffwd; ?> .ffwd_likes_comments_container_tab_<?php echo $ffwd; ?> .ffwd_likes_comments_<?php echo $ffwd; ?> {
269
- display: table-cell;
270
- vertical-align : <?php echo $theme_row->thumb_like_comm_pos; ?>;
271
- }
272
-
273
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_likes_<?php echo $ffwd; ?> {
274
- height: 30px;
275
- line-height: 30px;
276
- vertical-align: middle;
277
- word-wrap: break-word;
278
- float:left;
279
- margin-left: 5px;
280
- }
281
-
282
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_comments_<?php echo $ffwd; ?> {
283
- height: 30px;
284
- line-height: 30px;
285
- vertical-align: middle;
286
- word-wrap: break-word;
287
- float:right;
288
- margin-right: 5px;
289
- }
290
-
291
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_shares_<?php echo $ffwd; ?> {
292
- height: 30px;
293
- line-height: 30px;
294
- vertical-align: middle;
295
- word-wrap: break-word;
296
- float:left;
297
- margin-left: 25px;
298
- }
299
-
300
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_comments_<?php echo $ffwd; ?> span, #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_likes_<?php echo $ffwd; ?> span, #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_shares_<?php echo $ffwd; ?> span {
301
- padding: 0px 3px 0px 3px;
302
- background-color: rgba(214, 214, 214, 0.07);
303
- border-radius: 0px;
304
- color: #<?php echo $theme_row->thumb_like_comm_font_color; ?>;
305
- font-family: <?php echo $theme_row->thumb_like_comm_font_style; ?>;
306
- font-size: <?php echo $theme_row->thumb_like_comm_font_size; ?>px;
307
- box-shadow: <?php echo $theme_row->thumb_like_comm_shadow; ?>;
308
- font-weight: <?php echo $theme_row->thumb_like_comm_font_weight; ?>;
309
- }
310
-
311
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_thumb_spun1_<?php echo $ffwd; ?>:hover .ffwd_title_spun1_<?php echo $ffwd; ?> {
312
- left: <?php echo $theme_row->album_compact_thumb_padding; ?>px;
313
- top: <?php echo $theme_row->album_compact_thumb_padding; ?>px;
314
- opacity: 1;
315
- filter: Alpha(opacity=100);
316
- }
317
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_title_spun2_<?php echo $ffwd; ?> {
318
- color: #<?php echo $theme_row->album_compact_title_font_color; ?>;
319
- display: table-cell;
320
- font-family: <?php echo $theme_row->album_compact_title_font_style; ?>;
321
- font-size: <?php echo $theme_row->album_compact_title_font_size; ?>px;
322
- font-weight: <?php echo $theme_row->album_compact_title_font_weight; ?>;
323
- height: inherit;
324
- padding: <?php echo $theme_row->album_compact_title_margin; ?>;
325
- text-shadow: <?php echo $theme_row->album_compact_title_shadow; ?>;
326
- vertical-align: middle;
327
- width: inherit;
328
- }
329
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_compact_<?php echo $ffwd; ?> {
330
- display: inline-block;
331
- -moz-box-sizing: border-box;
332
- box-sizing: border-box;
333
- background-color: rgba(<?php echo $rgb_album_compact_thumbs_bg_color['red']; ?>, <?php echo $rgb_album_compact_thumbs_bg_color['green']; ?>, <?php echo $rgb_album_compact_thumbs_bg_color['blue']; ?>, <?php echo number_format($theme_row->album_compact_thumb_bg_transparent / 100, 2, ".", ""); ?>);
334
- font-size: 0;
335
- text-align: <?php echo $theme_row->album_compact_thumb_align; ?>;
336
- max-width: <?php echo $items_col_num * ($ffwd_info['album_thumb_width'] + 2 * (2 + $theme_row->album_compact_thumb_margin + $theme_row->album_compact_thumb_padding + $theme_row->album_compact_thumb_border_width)); ?>px;
337
- }
338
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_album_compact_<?php echo $ffwd; ?> a {
339
- cursor: pointer;
340
- outline: none;
341
- border-style: none;
342
- }
343
- /*Image thumbs styles.*/
344
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_spun1_<?php echo $ffwd; ?> {
345
- background-color: #<?php echo $theme_row->thumb_bg_color; ?>;
346
- display: inline-block;
347
- position: relative;
348
- height: <?php echo $ffwd_info['album_image_thumb_height']; ?>px;
349
- width: <?php echo $ffwd_info['album_image_thumb_width']; ?>px;
350
- margin: <?php echo $theme_row->thumb_margin; ?>px;
351
- opacity: <?php echo number_format($theme_row->thumb_transparent / 100, 2, ".", ""); ?>;
352
- filter: Alpha(opacity=<?php echo $theme_row->thumb_transparent; ?>);
353
- <?php echo ($theme_row->thumb_transition) ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : ''; ?>
354
- padding: <?php echo $theme_row->thumb_padding; ?>px;
355
- text-align: center;
356
- vertical-align: middle;
357
- z-index: 100;
358
- border-radius: <?php echo $theme_row->thumb_border_radius; ?>;
359
- }
360
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_spun1_<?php echo $ffwd; ?>:hover {
361
- -ms-transform: <?php echo $theme_row->thumb_hover_effect; ?>(<?php echo $theme_row->thumb_hover_effect_value; ?>);
362
- -webkit-transform: <?php echo $theme_row->thumb_hover_effect; ?>(<?php echo $theme_row->thumb_hover_effect_value; ?>);
363
- backface-visibility: hidden;
364
- -webkit-backface-visibility: hidden;
365
- -moz-backface-visibility: hidden;
366
- -ms-backface-visibility: hidden;
367
- opacity: 1;
368
- filter: Alpha(opacity=100);
369
- transform: <?php echo $theme_row->thumb_hover_effect; ?>(<?php echo $theme_row->thumb_hover_effect_value; ?>);
370
- z-index: 102;
371
- position: relative;
372
- }
373
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_spun2_<?php echo $ffwd; ?> {
374
- border-radius: <?php echo $theme_row->thumb_border_radius; ?>;
375
- border: <?php echo $theme_row->thumb_border_width; ?>px <?php echo $theme_row->thumb_border_style; ?> #<?php echo $theme_row->thumb_border_color; ?>;
376
- box-shadow: <?php echo $theme_row->thumb_box_shadow; ?>;
377
- height: <?php echo $ffwd_info['album_image_thumb_height']; ?>px;
378
- width: <?php echo $ffwd_info['album_image_thumb_width']; ?>px;
379
- overflow: hidden;
380
- position: relative;
381
- display: inline-block;
382
- }
383
-
384
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_spun2_<?php echo $ffwd; ?>:hover .ffwd_likes_comments_container_<?php echo $ffwd; ?> {
385
- opacity: 1;
386
- }
387
-
388
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumbnails_<?php echo $ffwd; ?> {
389
- -moz-box-sizing: border-box;
390
- display: inline-block;
391
- background-color: rgba(<?php echo $rgb_thumbs_bg_color['red']; ?>, <?php echo $rgb_thumbs_bg_color['green']; ?>, <?php echo $rgb_thumbs_bg_color['blue']; ?>, <?php echo number_format($theme_row->thumb_bg_transparent / 100, 2, ".", ""); ?>);
392
- box-sizing: border-box;
393
- font-size: 0;
394
- max-width: <?php echo $ffwd_info['album_image_max_columns'] * ($ffwd_info['album_image_thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width)); ?>px;
395
- text-align: <?php echo $theme_row->thumb_align; ?>;
396
- }
397
-
398
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumbnails_<?php echo $ffwd; ?> a {
399
- outline: none;
400
- border-style: none;
401
- }
402
-
403
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_<?php echo $ffwd; ?> {
404
- display: inline-block;
405
- text-align: center;
406
- position: relative;
407
- }
408
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .ffwd_standart_thumb_spun1_<?php echo $ffwd; ?>:hover .ffwd_image_title_spun1_<?php echo $ffwd; ?> {
409
- left: <?php echo $theme_row->thumb_padding; ?>px;
410
- top: <?php echo $theme_row->thumb_padding; ?>px;
411
- opacity: 1;
412
- filter: Alpha(opacity=100);
413
- }
414
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .bwg_image_title_spun2_<?php echo $ffwd; ?> {
415
- color: #<?php echo $theme_row->thumb_title_font_color; ?>;
416
- display: table-cell;
417
- font-family: <?php echo $theme_row->thumb_title_font_style; ?>;
418
- font-size: <?php echo $theme_row->thumb_title_font_size; ?>px;
419
- font-weight: <?php echo $theme_row->thumb_title_font_weight; ?>;
420
- height: inherit;
421
- margin: <?php echo $theme_row->thumb_title_margin; ?>;
422
- text-shadow: <?php echo $theme_row->thumb_title_shadow; ?>;
423
- vertical-align: middle;
424
- width: inherit;
425
- word-wrap: break-word;
426
- }
427
- /*Pagination styles.*/
428
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .tablenav-pages_<?php echo $ffwd; ?> {
429
- text-align: <?php echo $theme_row->page_nav_align; ?>;
430
- font-size: <?php echo $theme_row->page_nav_font_size; ?>px;
431
- font-family: <?php echo $theme_row->page_nav_font_style; ?>;
432
- font-weight: <?php echo $theme_row->page_nav_font_weight; ?>;
433
- color: #<?php echo $theme_row->page_nav_font_color; ?>;
434
- margin: 6px 0 4px;
435
- display: block;
436
- height: 30px;
437
- line-height: 30px;
438
- }
439
- @media only screen and (max-width : 320px) {
440
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .displaying-num_<?php echo $ffwd; ?> {
441
- display: none;
442
- }
443
- }
444
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .displaying-num_<?php echo $ffwd; ?> {
445
- font-size: <?php echo $theme_row->page_nav_font_size; ?>px;
446
- font-family: <?php echo $theme_row->page_nav_font_style; ?>;
447
- font-weight: <?php echo $theme_row->page_nav_font_weight; ?>;
448
- color: #<?php echo $theme_row->page_nav_font_color; ?>;
449
- margin-right: 10px;
450
- vertical-align: middle;
451
- }
452
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .paging-input_<?php echo $ffwd; ?> {
453
- font-size: <?php echo $theme_row->page_nav_font_size; ?>px;
454
- font-family: <?php echo $theme_row->page_nav_font_style; ?>;
455
- font-weight: <?php echo $theme_row->page_nav_font_weight; ?>;
456
- color: #<?php echo $theme_row->page_nav_font_color; ?>;
457
- vertical-align: middle;
458
- }
459
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .tablenav-pages_<?php echo $ffwd; ?> a.disabled,
460
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .tablenav-pages_<?php echo $ffwd; ?> a.disabled:hover,
461
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .tablenav-pages_<?php echo $ffwd; ?> a.disabled:focus {
462
- cursor: default;
463
- color: rgba(<?php echo $rgb_page_nav_font_color['red']; ?>, <?php echo $rgb_page_nav_font_color['green']; ?>, <?php echo $rgb_page_nav_font_color['blue']; ?>, 0.5);
464
- }
465
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> .tablenav-pages_<?php echo $ffwd; ?> a {
466
- cursor: pointer;
467
- font-size: <?php echo $theme_row->page_nav_font_size; ?>px;
468
- font-family: <?php echo $theme_row->page_nav_font_style; ?>;
469
- font-weight: <?php echo $theme_row->page_nav_font_weight; ?>;
470
- color: #<?php echo $theme_row->page_nav_font_color; ?>;
471
- text-decoration: none;
472
- padding: <?php echo $theme_row->page_nav_padding; ?>;
473
- margin: <?php echo $theme_row->page_nav_margin; ?>;
474
- border-radius: <?php echo $theme_row->page_nav_border_radius; ?>;
475
- border-style: <?php echo $theme_row->page_nav_border_style; ?>;
476
- border-width: <?php echo $theme_row->page_nav_border_width; ?>px;
477
- border-color: #<?php echo $theme_row->page_nav_border_color; ?>;
478
- background-color: #<?php echo $theme_row->page_nav_button_bg_color; ?>;
479
- opacity: <?php echo number_format($theme_row->page_nav_button_bg_transparent / 100, 2, ".", ""); ?>;
480
- filter: Alpha(opacity=<?php echo $theme_row->page_nav_button_bg_transparent; ?>);
481
- box-shadow: <?php echo $theme_row->page_nav_box_shadow; ?>;
482
- <?php echo ($theme_row->page_nav_button_transition ) ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : ''; ?>
483
- }
484
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> a.bwg_back_<?php echo $ffwd; ?> {
485
- background-color: rgba(0, 0, 0, 0);
486
- color: #<?php echo $theme_row->album_compact_back_font_color; ?> !important;
487
- cursor: pointer;
488
- display: block;
489
- font-family: <?php echo $theme_row->album_compact_back_font_style; ?>;
490
- font-size: <?php echo $theme_row->album_compact_back_font_size; ?>px;
491
- font-weight: <?php echo $theme_row->album_compact_back_font_weight; ?>;
492
- text-decoration: none;
493
- padding: <?php echo $theme_row->album_compact_back_padding; ?>;
494
- outline:none;
495
- border-style:none;
496
- }
497
- #ffwd_container1_<?php echo $ffwd; ?> #ffwd_container2_<?php echo $ffwd; ?> #spider_popup_overlay_<?php echo $ffwd; ?> {
498
- background-color: #<?php echo $theme_row->lightbox_overlay_bg_color; ?>;
499
- opacity: <?php echo number_format($theme_row->lightbox_overlay_bg_transparent / 100, 2, ".", ""); ?>;
500
- filter: Alpha(opacity=<?php echo $theme_row->lightbox_overlay_bg_transparent; ?>);
501
- }
502
- #ajax_loading_<?php echo $ffwd; ?> {
503
- position:absolute;
504
- width: 100%;
505
- z-index: 115;
506
- text-align: center;
507
- height: 100%;
508
- vertical-align: middle;
509
- }
510
- #ajax_loading_tab_<?php echo $ffwd; ?> {
511
- display: table;
512
- vertical-align: middle;
513
- width: 100%;
514
- height: 100%;
515
- background-color: #FFFFFF;
516
- opacity: 0.7;
517
- filter: Alpha(opacity=70);
518
- }
519
- #ajax_loading_tab_cell_<?php echo $ffwd; ?> {
520
- display: table-cell;
521
- text-align: center;
522
- position: relative;
523
- vertical-align: middle;
524
- }
525
- #loading_div_<?php echo $ffwd; ?> {
526
- display: inline-block;
527
- text-align:center;
528
- position:relative;
529
- vertical-align: middle;
530
- }
531
- .bwg_play_icon_spun_<?php echo $ffwd; ?> {
532
- width: inherit;
533
- height: inherit;
534
- display: table;
535
- position: absolute;
536
- }
537
- .b