WD Facebook Feed – Custom Facebook Feed Plugin - Version 1.0.5

Version Description

  • Added: Review, User guide notices
Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.5

admin/models/FFWDModelUninstall_ffwd.php CHANGED
@@ -25,6 +25,7 @@ class FFWDModelUninstall_ffwd {
25
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_option");
26
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_theme");
27
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_shortcode");
 
28
  delete_option("ffwd_version");
29
  }
30
  ////////////////////////////////////////////////////////////////////////////////////////
25
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_option");
26
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_theme");
27
  $wpdb->query("DROP TABLE " . $wpdb->prefix . "wd_fb_shortcode");
28
+ delete_option('ffwd_admin_notice');
29
  delete_option("ffwd_version");
30
  }
31
  ////////////////////////////////////////////////////////////////////////////////////////
css/ffwd_notices.css ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wd-admin-notice {
2
+ background: #fff;
3
+ border: 4px;
4
+ display: block;
5
+ min-height: 68px;
6
+ padding: 10px 40px 10px 125px;
7
+ position: relative;
8
+ }
9
+ .wd-admin-notice a {
10
+ color: #10738B;
11
+ }
12
+ .ffwd-notice-logo {
13
+ clear: both;
14
+ content: "";
15
+ display: block;
16
+ background-image: url("../images/icon-feed.png");
17
+ background-size: 108px auto;
18
+ background-repeat: no-repeat;
19
+ background-position: 0 45%;
20
+ width: 125px;
21
+ position: absolute;
22
+ top: 0;
23
+ bottom: 0;
24
+ left: 5px;
25
+ }
26
+ .wd-admin-notice > .dashicons {
27
+ color: #424242;
28
+ position: absolute;
29
+ right: 20px;
30
+ top: 40%;
31
+ }
32
+ .wd-notice-title {
33
+ font-size: 24px;
34
+ margin: 0;
35
+ }
36
+ .wd-notice-body {
37
+ font-weight: normal;
38
+ margin: 5px 0;
39
+ }
40
+ .wd-notice-body:after {
41
+ clear: both;
42
+ content: "";
43
+ display: block;
44
+ }
45
+ .wd-notice-body li {
46
+ float: left;
47
+ margin-right: 20px;
48
+ }
49
+ .wd-notice-body .dashicons {
50
+ font-size: 17px;
51
+ }
52
+ .wd-blue {
53
+ color: #10738B;
54
+ }
55
+
56
+ .admin-notice-promo {
57
+ background: #fff;
58
+ border-top: 4px;
59
+ display: block;
60
+ min-height: 68px;
61
+ padding: 10px 40px 0px 10px;
62
+ margin: 10px 0;
63
+ position: relative;
64
+ }
65
+
66
+ .admin-notice-promo:after {
67
+ content: '';
68
+ display: table;
69
+ clear: both;
70
+ }
71
+
72
+ .close-promo {
73
+ position: absolute;
74
+ top: 5px;
75
+ right: 5px;
76
+ }
77
+
78
+ .promo {
79
+ background-position: center;
80
+ background-repeat: no-repeat;
81
+ background-size: 972px 200px;
82
+ height: 200px;
83
+ max-width: 100%;
84
+ }
85
+
86
+ .promo a {
87
+ display: block;
88
+ height: 100%;
89
+ }
facebook-feed-wd-notices.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
4
+ }
5
+
6
+ class FFWD_Notices {
7
+ protected $prefix = 'ffwd';
8
+ protected $plugin_url = WD_FFWD_URL;
9
+ protected $plugin_version = "ffwd_version";
10
+ protected $plugin_name = 'facebook-feed-wd';
11
+ protected $promo_link = '';
12
+
13
+ public $notice_spam = 0;
14
+ public $notice_spam_max = 1;
15
+
16
+ // Basic actions to run
17
+ public function __construct() {
18
+
19
+ // Runs the admin notice ignore function incase a dismiss button has been clicked
20
+ add_action('admin_init', array($this, 'admin_notice_ignore'));
21
+ // Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
22
+ add_action('admin_init', array($this, 'admin_notice_temp_ignore'));
23
+ add_action('admin_notices', array($this, 'wd_admin_notices'));
24
+ }
25
+
26
+ // Checks to ensure notices aren't disabled and the user has the correct permissions.
27
+ public function wd_admin_notice() {
28
+ $settings = get_option($this->prefix . '_admin_notice');
29
+ if (!isset($settings['disable_admin_notices']) || (isset($settings['disable_admin_notices']) && $settings['disable_admin_notices'] == 0)) {
30
+ if (current_user_can('manage_options')) {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+
37
+ // Primary notice function that can be called from an outside function sending necessary variables
38
+ public function admin_notice($admin_notices) {
39
+
40
+ // Check options
41
+ if (!$this->wd_admin_notice()) {
42
+ return false;
43
+ }
44
+ foreach ($admin_notices as $slug => $admin_notice) {
45
+ // Call for spam protection
46
+ if ($this->anti_notice_spam()) {
47
+ return false;
48
+ }
49
+
50
+ // Check for proper page to display on
51
+ if (isset( $admin_notices[$slug]['pages']) && is_array( $admin_notices[$slug]['pages'])) {
52
+ if (!$this->admin_notice_pages($admin_notices[$slug]['pages'])) {
53
+ return false;
54
+ }
55
+ }
56
+
57
+ // Check for required fields
58
+ if (!$this->required_fields($admin_notices[$slug])) {
59
+
60
+ // Get the current date then set start date to either passed value or current date value and add interval
61
+ $current_date = current_time("n/j/Y");
62
+ $start = (isset($admin_notices[$slug]['start']) ? $admin_notices[$slug]['start'] : $current_date);
63
+ $start = date("n/j/Y", strtotime($start));
64
+ $date_array = explode('/', $start);
65
+ $interval = (isset($admin_notices[$slug]['int']) ? $admin_notices[$slug]['int'] : 0);
66
+
67
+ $date_array[1] += $interval;
68
+ $start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
69
+
70
+ // This is the main notices storage option
71
+ $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
72
+ // Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
73
+
74
+ if (!array_key_exists( $slug, $admin_notices_option)) {
75
+
76
+ $admin_notices_option[$slug]['start'] = $start;
77
+ $admin_notices_option[$slug]['int'] = $interval;
78
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
79
+ }
80
+
81
+ // Sanity check to ensure we have accurate information
82
+ // New date information will not overwrite old date information
83
+ $admin_display_check = (isset($admin_notices_option[$slug]['dismissed']) ? $admin_notices_option[$slug]['dismissed'] : 0);
84
+ $admin_display_start = (isset($admin_notices_option[$slug]['start']) ? $admin_notices_option[$slug]['start'] : $start);
85
+ $admin_display_interval = (isset($admin_notices_option[$slug]['int']) ? $admin_notices_option[$slug]['int'] : $interval);
86
+ $admin_display_msg = (isset($admin_notices[$slug]['msg']) ? $admin_notices[$slug]['msg'] : '');
87
+ $admin_display_title = (isset($admin_notices[$slug]['title']) ? $admin_notices[$slug]['title'] : '');
88
+ $admin_display_link = (isset($admin_notices[$slug]['link']) ? $admin_notices[$slug]['link'] : '');
89
+ $output_css = false;
90
+
91
+ // Ensure the notice hasn't been hidden and that the current date is after the start date
92
+ if ($admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date)) {
93
+
94
+ // Get remaining query string
95
+ $query_str = (isset($admin_notices[$slug]['later_link']) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg($this->prefix . '_admin_notice_ignore', $slug)));
96
+ if (strpos($slug, 'promo') === FALSE) {
97
+ // Admin notice display output
98
+ echo '<div class="update-nag wd-admin-notice">
99
+ <div class="' . $this->prefix . '-notice-logo"></div>
100
+ <p class="wd-notice-title">' . $admin_display_title . '</p>
101
+ <p class="wd-notice-body">' . $admin_display_msg . '</p>
102
+ <ul class="wd-notice-body wd-blue">' . $admin_display_link . '</ul>
103
+ <a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>
104
+ </div>';
105
+ }
106
+ else {
107
+ echo '<div class="admin-notice-promo">';
108
+ echo $admin_display_msg;
109
+ echo '<ul class="notice-body-promo blue">
110
+ ' . $admin_display_link . '
111
+ </ul>';
112
+ echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss close-promo"></a>';
113
+ echo '</div>';
114
+ }
115
+ $this->notice_spam += 1;
116
+ $output_css = true;
117
+ }
118
+ if ($output_css) {
119
+ wp_enqueue_style($this->prefix . '-admin-notices', $this->plugin_url . '/css/ffwd_notices.css', array(), get_option($this->plugin_version));
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ // Spam protection check
126
+ public function anti_notice_spam() {
127
+ if ($this->notice_spam >= $this->notice_spam_max) {
128
+ return true;
129
+ }
130
+ return false;
131
+ }
132
+
133
+ // Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
134
+ public function admin_notice_ignore() {
135
+ // If user clicks to ignore the notice, update the option to not show it again
136
+ if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
137
+ $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
138
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
139
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
140
+ $query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
141
+ wp_redirect($query_str);
142
+ exit;
143
+ }
144
+ }
145
+
146
+ // Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
147
+ public function admin_notice_temp_ignore() {
148
+ // If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
149
+ if (isset($_GET[$this->prefix . '_admin_notice_temp_ignore'])) {
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']) ? $_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
+
157
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
158
+ $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
159
+ update_option($this->prefix . '_admin_notice', $admin_notices_option);
160
+ $query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'wd_int'));
161
+ wp_redirect( $query_str );
162
+ exit;
163
+ }
164
+ }
165
+
166
+ public function admin_notice_pages($pages) {
167
+ foreach ($pages as $key => $page) {
168
+ if (is_array($page)) {
169
+ if (isset($_GET['page']) && $_GET['page'] == $page[0] && isset($_GET['tab']) && $_GET['tab'] == $page[1]) {
170
+ return true;
171
+ }
172
+ }
173
+ else {
174
+ if ($page == 'all') {
175
+ return true;
176
+ }
177
+ if (get_current_screen()->id === $page) {
178
+ return true;
179
+ }
180
+ if (isset($_GET['page']) && $_GET['page'] == $page) {
181
+ return true;
182
+ }
183
+ }
184
+ return false;
185
+ }
186
+ }
187
+
188
+ // Required fields check
189
+ public function required_fields( $fields ) {
190
+ if (!isset( $fields['msg']) || (isset($fields['msg']) && empty($fields['msg']))) {
191
+ return true;
192
+ }
193
+ if (!isset( $fields['title']) || (isset($fields['title']) && empty($fields['title']))) {
194
+ return true;
195
+ }
196
+ return false;
197
+ }
198
+
199
+ // Special parameters function that is to be used in any extension of this class
200
+ public function special_parameters($admin_notices) {
201
+ // Intentionally left blank
202
+ }
203
+
204
+ public function wd_admin_notices() {
205
+ $two_week_review_ignore = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'two_week_review'));
206
+ $two_week_review_temp = add_query_arg(array($this->prefix . '_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14));
207
+ $promo_close = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'ecommerce_promo'));
208
+
209
+ /*$notices['ecommerce_promo'] = array(
210
+ 'title' => __('Hey! How\'s It Going?', $this->prefix),
211
+ 'msg' => '<div class="promo" style="background-image: url(' . $this->plugin_url . '/images/Gallery-E-Commerce-banner.png);"><a href="' . $this->promo_link . '" target="_blank"></a></div>',
212
+ 'link' => '<li><span class="dashicons dashicons-dismiss"></span><a href="' . $promo_close . '">' . __('Never show again', $this->prefix) . '</a></li>',
213
+ 'int' => 3
214
+ ); */
215
+
216
+ $notices['two_week_review'] = array(
217
+ 'title' => __('Leave A Review?', $this->prefix),
218
+ 'msg' => sprintf(__('We hope you\'ve enjoyed using WordPress %s! Would you consider leaving us a review on WordPress.org?', $this->prefix), $this->plugin_name),
219
+ 'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/wd-facebook-feed?filter=5" target="_blank">' . __('Sure! I\'d love to!', $this->prefix) . '</a></li>
220
+ <li><span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __('I\'ve already left a review', $this->prefix) . '</a></li>
221
+ <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __('Maybe Later', $this->prefix) . '</a></li>
222
+ <li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __('Never show again', $this->prefix) . '</a></li>',
223
+ 'later_link' => $two_week_review_temp,
224
+ 'int' => 14
225
+ );
226
+ $one_week_support = add_query_arg(array($this->prefix . '_admin_notice_ignore' => 'one_week_support'));
227
+ $notices['one_week_support'] = array(
228
+ 'title' => __('Hey! How\'s It Going?', $this->prefix),
229
+ 'msg' => sprintf(__('Thank you for using WordPress %s! We hope that you\'ve found everything you need, but if you have any questions:', $this->prefix), $this->plugin_name),
230
+ 'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="https://web-dorado.com/wordpress-facebook-feed/installing.html">' . __('Check out User Guide', $this->prefix) . '</a></li>
231
+ <li><span class="dashicons dashicons-sos"></span><a target="_blank" href="https://web-dorado.com/forum/facebook-feed-wd.html">' . __('Get Some Help', $this->prefix) . '</a></li>
232
+ <li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __('Never show again', $this->prefix) . '</a></li>',
233
+ 'int' => 7
234
+ );
235
+ $this->admin_notice($notices);
236
+ }
237
+ }
facebook-feed-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Facebook Feed WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
6
  * Description:Facebook Feed WD is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
- * Version: 1.0.4
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -651,7 +651,7 @@ add_action('init', 'ffwd_language_load');
651
  function ffwd_version()
652
  {
653
 
654
- $version = '1.0.4';
655
 
656
  if (get_option('ffwd_version') === false) {
657
  add_option('ffwd_version', $version);
@@ -677,6 +677,11 @@ function ffwd_get_version()
677
 
678
  }
679
 
 
 
 
 
 
680
 
681
 
682
  ?>
4
  * Plugin Name: Facebook Feed WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
6
  * Description:Facebook Feed WD is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
+ * Version: 1.0.5
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
651
  function ffwd_version()
652
  {
653
 
654
+ $version = '1.0.5';
655
 
656
  if (get_option('ffwd_version') === false) {
657
  add_option('ffwd_version', $version);
677
 
678
  }
679
 
680
+ if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)) {
681
+
682
+ include_once(WD_FFWD_DIR . '/facebook-feed-wd-notices.php');
683
+ new FFWD_Notices();
684
+ }
685
 
686
 
687
  ?>
images/icon-feed.png ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-facebook-feed-plugin.html
4
  Tags: customizable, facebook, facebook events, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, likebox
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
- Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,9 @@ Upgrade to [Facebook Feed Pro](https://web-dorado.com/products/wordpress-faceboo
66
 
67
  == Changelog ==
68
 
 
 
 
69
  = 1.0.4 =
70
  * Fixed: Bug in Autoupdate
71
 
@@ -111,9 +114,6 @@ After downloading the ZIP file of the plugin,
111
  5. Click "Activate Plugin" button for activating Facebook Feed WD.
112
  6. If the installation does not succeed, please contact us at [support@web-dorado.com](mailto:support@web-dorado.com).
113
 
114
-
115
- == Changelog ==
116
-
117
  == Facebook Feed WD User Manual ==
118
 
119
  = Installation =
4
  Tags: customizable, facebook, facebook events, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, likebox
5
  Requires at least: 3.4
6
  Tested up to: 4.6
7
+ Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.0.5 =
70
+ * Added: Review, User guide notices
71
+
72
  = 1.0.4 =
73
  * Fixed: Bug in Autoupdate
74
 
114
  5. Click "Activate Plugin" button for activating Facebook Feed WD.
115
  6. If the installation does not succeed, please contact us at [support@web-dorado.com](mailto:support@web-dorado.com).
116
 
 
 
 
117
  == Facebook Feed WD User Manual ==
118
 
119
  = Installation =