Responsive Facebook Page Plugin - Version 1.7.0

Version Description

  • 03/06/19 =
  • Rebranded under the Mongoose Marketplace umbrella
  • Updated RSS feed
  • Fixed conflict with Elementor page builder
Download this release

Release Info

Developer deployer
Plugin Icon 128x128 Responsive Facebook Page Plugin
Version 1.7.0
Comparing to
See all releases

Code changes from version trunk to 1.7.0

.github/FUNDING.yml DELETED
@@ -1,4 +0,0 @@
1
- github: cameronjonesweb
2
- patreon: cameronjonesweb
3
- ko_fi: cameronjonesweb
4
- custom: https://cameronjonesweb.com.au/support-me
 
 
 
 
css/admin-landing-page.css DELETED
@@ -1,115 +0,0 @@
1
- body.settings_page_facebook-page-plugin {
2
- background: #fff;
3
- }
4
-
5
- .settings_page_facebook-page-plugin .welcome-panel-content {
6
- margin-right: 13px;
7
- }
8
-
9
- .settings_page_facebook-page-plugin .welcome-panel-image {
10
- width: 100%;
11
- }
12
-
13
- .settings_page_facebook-page-plugin .about-description {
14
- margin: 13px 0 0;
15
- }
16
-
17
- .settings_page_facebook-page-plugin .spinner.is-active {
18
- float: none !important;
19
- margin-left: 0 !important;
20
- }
21
-
22
- .settings_page_facebook-page-plugin #wpbody-content {
23
- font-family: 'Muli', 'Helvetica', 'Arial', sans-serif;
24
- }
25
-
26
- .settings_page_facebook-page-plugin .page-title {
27
- font-family: 'Rammetto One', cursive;
28
- padding: 0;
29
- }
30
-
31
- .settings_page_facebook-page-plugin h2,
32
- .settings_page_facebook-page-plugin h3,
33
- .settings_page_facebook-page-plugin h4,
34
- .settings_page_facebook-page-plugin h5,
35
- .settings_page_facebook-page-plugin h6 {
36
- font-family: 'Paytone One', sans-serif;
37
- }
38
-
39
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__box {
40
- background-color: #f8f3ed;
41
- padding: 20px 25px;
42
- margin-bottom: 20px;
43
- border: none;
44
- box-shadow: none;
45
- }
46
-
47
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__box p:last-child {
48
- margin-bottom: 0 !important;
49
- }
50
-
51
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__box .inside {
52
- margin-top: 0;
53
- padding: 0;
54
- }
55
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__box .inside h2 {
56
- padding-top: 0;
57
- }
58
-
59
- .settings_page_facebook-page-plugin .notices-placeholder {
60
- visibility: hidden;
61
- height: 0;
62
- overflow: hidden;
63
- }
64
-
65
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin {
66
- max-width: 1544px;
67
- }
68
-
69
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__banner {
70
- position: relative;
71
- }
72
-
73
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__banner:after {
74
- position: absolute;
75
- content: "";
76
- background-image: url( ../images/banner-border.png );
77
- background-size: contain;
78
- bottom: 0;
79
- left: 0;
80
- width: 100%;
81
- height: 100%;
82
- background-position: center bottom;
83
- background-repeat: no-repeat;
84
- }
85
-
86
- .settings_page_facebook-page-plugin .mongoose-facebook-page-plugin__banner img {
87
- max-width: 100%;
88
- height: auto;
89
- display: block;
90
- }
91
-
92
- .mongoose-facebook-page-plugin .button {
93
- border: none;
94
- background: #e46341;
95
- box-shadow: none;
96
- border-radius: 0;
97
- color: #fff;
98
- border: 2px solid #e46341;
99
- padding: 4px 12px;
100
- height: auto;
101
- transition: .2s ease all;
102
- font-family: 'Paytone One', sans-serif;
103
- }
104
-
105
- .mongoose-facebook-page-plugin .button:hover,
106
- .mongoose-facebook-page-plugin .button:focus {
107
- background: transparent;
108
- border: 2px solid #e46341;
109
- color: #e46341;
110
- }
111
-
112
- #mce-EMAIL {
113
- padding: 4px 12px;
114
- line-height: 28px;
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/{admin-global.css → facebook-page-plugin-admin.css} RENAMED
@@ -1,7 +1,11 @@
1
- #facebook-page-plugin-shortcode-generator p:after{clear:both;display:table;content:" ";}
2
- #facebook-page-plugin-shortcode-generator input:not([type="checkbox"]),#facebook-page-plugin-shortcode-generator select{width:50%;}
3
- #facebook-page-plugin-shortcode-generator input,#facebook-page-plugin-shortcode-generator select{float:right;}
4
- #facebook-page-plugin-shortcode-generator #facebook-page-plugin-shortcode-generator-output{width:100%;float:none;}
5
- .facebook-page-plugin-donate{margin:20px 0 10px;font-size:14px;line-height:175%;background:#fff;border: 1px solid rgba(0,0,0,0.1);border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:1px 29px 1px 12px;position:relative;}
6
- .facebook-page-plugin-donate p{margin:.5em 0;padding:2px;}
 
 
 
 
7
  .facebook-page-plugin-donate .notice-dismiss{text-decoration:none;}
1
+ #facebook-page-plugin-shortcode-generator p:after{clear:both;display:table;content:" ";}
2
+ #facebook-page-plugin-shortcode-generator input:not([type="checkbox"]),#facebook-page-plugin-shortcode-generator select{width:50%;}
3
+ #facebook-page-plugin-shortcode-generator input,#facebook-page-plugin-shortcode-generator select{float:right;}
4
+ #facebook-page-plugin-shortcode-generator #facebook-page-plugin-shortcode-generator-output{width:100%;float:none;}
5
+ .plugins_page_facebook-page-plugin .welcome-panel-content{margin-right:13px;}
6
+ .plugins_page_facebook-page-plugin .welcome-panel-image{width:100%;}
7
+ .plugins_page_facebook-page-plugin .about-description{margin:13px 0;}
8
+ .plugins_page_facebook-page-plugin .spinner.is-active{float:none !important;}
9
+ .facebook-page-plugin-donate{margin:20px 0 10px;font-size:14px;line-height:175%;background:#fff;border: 1px solid rgba(0,0,0,0.1);border-left:4px solid #46b450;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:1px 29px 1px 12px;position:relative;}
10
+ .facebook-page-plugin-donate p{margin:.5em 0;padding:2px;}
11
  .facebook-page-plugin-donate .notice-dismiss{text-decoration:none;}
facebook-page-feed-graph-api.php CHANGED
@@ -1,720 +1,735 @@
1
- <?php
2
- /**
3
- * Plugin Name: Mongoose Page Plugin
4
- * Plugin URI: https://mongoosemarketplace.com/downloads/facebook-page-plugin/
5
- * Description: The most popular way to display the Facebook Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
6
- * Version: 1.7.1
7
- * Author: Mongoose Marketplace
8
- * Author URI: https://mongoosemarketplace.com/
9
- * License: GPLv2
10
- * Text Domain: facebook-page-feed-graph-api
11
-
12
- * Copyright 2015-2019 Cameron Jones (email : support@mongoosemarketplace.com)
13
-
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License, version 2, as
16
- published by the Free Software Foundation.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
- */
23
-
24
- defined( 'ABSPATH' ) or die();
25
-
26
- class cameronjonesweb_facebook_page_plugin {
27
-
28
- public static $remove_donate_notice_key = 'facebook_page_plugin_donate_notice_ignore';
29
-
30
- public function __construct() {
31
-
32
- define( 'CJW_FBPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
33
- define( 'CJW_FBPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
34
- define( 'CJW_FBPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
35
- define( 'CJW_FBPP_PLUGIN_VER', '1.7.1' );
36
- define( 'CJW_FBPP_PLUGIN_DONATE_LINK', 'https://www.patreon.com/cameronjonesweb' );
37
- define( 'CJW_FBPP_PLUGIN_SURVEY_LINK', 'https://cameronjonesweb.typeform.com/to/BllbYm' );
38
-
39
- // Add all the hooks and actions.
40
- add_shortcode( 'facebook-page-plugin', array( $this, 'facebook_page_plugin' ) );
41
- add_filter( 'widget_text', 'do_shortcode' );
42
- add_action( 'wp_dashboard_setup', array( $this, 'facebook_page_plugin_dashboard_widget' ) );
43
- add_action( 'admin_enqueue_scripts', array( $this, 'facebook_page_plugin_admin_resources' ) );
44
- add_action( 'admin_init', array( $this, 'remove_donate_notice_nojs' ) );
45
- add_action( 'admin_menu', array( $this, 'facebook_page_plugin_landing_page_menu' ) );
46
- add_action( 'wp_ajax_facebook_page_plugin_latest_blog_posts_callback', array( $this, 'facebook_page_plugin_latest_blog_posts_callback' ) );
47
- add_action( 'activated_plugin', array( $this, 'facebook_page_plugin_activation_hook' ) );
48
- add_action( 'wp_ajax_facebook_page_plugin_remove_donate_notice', array( $this, 'remove_donate_notice' ) );
49
- add_filter( 'plugin_action_links_' . CJW_FBPP_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
50
-
51
- }
52
-
53
-
54
- // Filter functions.
55
- private static function dashboard_widget_capability() {
56
-
57
- $return = apply_filters( 'facebook_page_plugin_dashboard_widget_capability', 'edit_posts' );
58
- return $return;
59
-
60
- }
61
-
62
-
63
- private static function app_id() {
64
-
65
- $return = apply_filters( 'facebook_page_plugin_app_id', '846690882110183' );
66
- return $return;
67
-
68
- }
69
-
70
-
71
- // Admin functions.
72
-
73
- public static function donate_notice() {
74
-
75
- $return = NULL;
76
-
77
- if( current_user_can( 'administrator' ) ) {
78
-
79
- $user_id = get_current_user_id();
80
-
81
- if ( !get_user_meta( $user_id, self::$remove_donate_notice_key ) || get_user_meta( $user_id, self::$remove_donate_notice_key ) === false ) {
82
-
83
- $return .= '<div class="facebook-page-plugin-donate"><p>';
84
-
85
- $return .= __( 'Thank you for using the Mongoose Page Plugin. Please consider donating to support ongoing development. ', 'facebook-page-feed-graph-api' );
86
-
87
- $return .= '</p><p>';
88
-
89
- $return .= '<a href="' . CJW_FBPP_PLUGIN_DONATE_LINK . '" target="_blank" class="button button-secondary">' . __( 'Donate now', 'facebook-page-feed-graph-api' ) . '</a>';
90
-
91
- $return .= '<a href="?' . self::$remove_donate_notice_key . '=0" class="notice-dismiss facebook-page-plugin-donate-notice-dismiss" title="' . __( 'Dismiss this notice', 'facebook-page-feed-graph-api' ) . '"><span class="screen-reader-text">' . __( 'Dismiss this notice', 'facebook-page-feed-graph-api' ) . '.</span></a>';
92
-
93
- $return .= '</p></div>';
94
-
95
- }
96
-
97
- }
98
-
99
- return $return;
100
-
101
- }
102
-
103
- public static function remove_donate_notice() {
104
-
105
- $user_id = get_current_user_id();
106
-
107
- update_user_meta( $user_id, self::$remove_donate_notice_key, 'true', true );
108
-
109
- if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
110
-
111
- wp_die();
112
-
113
- }
114
-
115
- }
116
-
117
- public function remove_donate_notice_nojs() {
118
-
119
- if ( isset( $_GET[self::$remove_donate_notice_key] ) && '0' == $_GET[self::$remove_donate_notice_key] ) {
120
-
121
- self::remove_donate_notice();
122
-
123
- }
124
-
125
- }
126
-
127
-
128
- // Add a link to support on plugins listing
129
- function plugin_action_links( $links ) {
130
-
131
- $links[] = sprintf(
132
- '<a href="https://wordpress.org/support/plugin/facebook-page-feed-graph-api" target="_blank">%1$s</a>',
133
- __( 'Support', 'facebook-page-feed-graph-api' )
134
- );
135
- return $links;
136
- }
137
-
138
-
139
- //Enqueue CSS and JS for admin
140
- public function facebook_page_plugin_admin_resources() {
141
-
142
- wp_enqueue_script( 'facebook-page-plugin-admin-scripts', CJW_FBPP_PLUGIN_URL . 'js/admin-global.js' );
143
- wp_enqueue_style( 'facebook-page-plugin-admin-styles', CJW_FBPP_PLUGIN_URL . 'css/admin-global.css' );
144
-
145
- }
146
-
147
- //Register the dashboard widget
148
- public function facebook_page_plugin_dashboard_widget() {
149
-
150
- if( current_user_can( self::dashboard_widget_capability() ) ) {
151
-
152
- wp_add_dashboard_widget( 'facebook-page-plugin-shortcode-generator', __( 'Mongoose Page Plugin Shortcode Generator', 'facebook-page-feed-graph-api' ), array( $this, 'facebook_page_plugin_dashboard_widget_callback' ) );
153
-
154
- }
155
-
156
- }
157
-
158
- //Load the dashboard widget
159
- function facebook_page_plugin_dashboard_widget_callback() {
160
- echo '<a name="cameronjonesweb_facebook_page_plugin_shortcode_generator"></a>';
161
- $generator = new cameronjonesweb_facebook_page_plugin_shortcode_generator();
162
- $generator->generate();
163
-
164
- }
165
-
166
- function facebook_page_plugin_landing_page_menu() {
167
- add_options_page( __( 'Mongoose Page Plugin by Mongoose Marketplace', 'facebook-page-feed-graph-api' ), 'Mongoose Page Plugin', 'install_plugins', 'facebook-page-plugin', array( $this, 'facebook_page_plugin_landing_page' ) );
168
- }
169
-
170
- function facebook_page_plugin_landing_page() {
171
- wp_enqueue_style( 'facebook-page-plugin-landing-page-css', CJW_FBPP_PLUGIN_URL . 'css/admin-landing-page.css', [], CJW_FBPP_PLUGIN_VER );
172
- wp_enqueue_style( 'facebook-page-plugin-google-fonts', 'https://fonts.googleapis.com/css?family=Rammetto+One|Paytone+One|Space+Mono:400|Muli:400,400i,700', [], CJW_FBPP_PLUGIN_VER );
173
- wp_enqueue_script( 'facebook-page-plugin-landing-page-js', CJW_FBPP_PLUGIN_URL . 'js/admin-landing-page.js', array( 'jquery' ), CJW_FBPP_PLUGIN_VER, true );
174
- include CJW_FBPP_PLUGIN_DIR . '/inc/landing-page.php';
175
- }
176
-
177
- function facebook_page_plugin_latest_blog_posts_callback() {
178
- $links = sprintf(
179
- '<p><a href="https://cameronjonesweb.com.au/blog/" target="_blank">%1$s</a> | <a href="https://mongoosemarketplace.com/news/" target="_blank">%2$s</a></p>',
180
- __( 'Developer\'s blog', 'facebook-page-feed-graph-api' ),
181
- __( 'Latest plugin news', 'facebook-page-feed-graph-api' )
182
- );
183
- wp_widget_rss_output( 'https://feed.rssunify.com/5b718c594e800/rss.xml', [ 'show_date' => 1 ] );
184
- wp_die( $links );
185
- }
186
-
187
- function facebook_page_plugin_activation_hook( $plugin ) {
188
- if( $plugin == CJW_FBPP_PLUGIN_BASENAME ) {
189
- exit( wp_redirect( admin_url( 'options-general.php?page=facebook-page-plugin' ) ) );
190
- }
191
- }
192
-
193
-
194
- // Client side stuff.
195
- function facebook_page_plugin_generate_wrapper_id() {
196
- return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
197
- }
198
-
199
- // Parse shortcode.
200
- function facebook_page_plugin( $filter ) {
201
- wp_enqueue_script( 'facebook-page-plugin-sdk', CJW_FBPP_PLUGIN_URL . 'js/sdk.js', array(), NULL, true );
202
- wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', NULL, true );
203
- $return = NULL;
204
- $a = shortcode_atts( array(
205
- 'href' => NULL,
206
- 'width' => 340,
207
- 'height' => 130,
208
- 'cover' => NULL,
209
- 'facepile' => NULL,
210
- 'posts' => NULL,
211
- 'tabs' => array(),
212
- 'language' => get_bloginfo('language'),
213
- 'cta' => NULL,
214
- 'small' => NULL,
215
- 'adapt' => NULL,
216
- 'link' => true,
217
- 'linktext' => NULL,
218
- 'standard' => 'html5',
219
- '_implementation' => 'shortcode'
220
- ), $filter );
221
- if(isset($a['href']) && !empty($a['href'])){
222
- $a['language'] = str_replace("-", "_", $a['language']);
223
-
224
- //Send the language as a parameter to the SDK
225
- wp_localize_script( 'facebook-page-plugin-sdk', 'facebook_page_plugin_language', array( 'language' => $a['language'] ) );
226
-
227
- $return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" data-implementation="' . esc_attr( $a['_implementation'] ) . '" id="' . $this->facebook_page_plugin_generate_wrapper_id() . '">';
228
- $return .= '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/' . $a['language'] . '/sdk.js#xfbml=1&version=v3.2&appId=' . self::app_id() . '";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
229
- $return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
230
- if(isset($a['width']) && !empty($a['width'])){
231
- $return .= ' data-width="' . $a['width'] . '"';
232
- $return .= ' data-max-width="' . $a['width'] . '"';
233
- }
234
- if(isset($a['height']) && !empty($a['height'])){
235
- $return .= ' data-height="' . $a['height'] . '"';
236
- }
237
- if(isset($a['cover']) && !empty($a['cover'])){
238
- if($a['cover'] == "false"){
239
- $return .= ' data-hide-cover="true"';
240
- } else if($a['cover'] == "true"){
241
- $return .= ' data-hide-cover="false"';
242
- }
243
- }
244
- if(isset($a['facepile']) && !empty($a['facepile'])){
245
- $return .= ' data-show-facepile="' . $a['facepile'] . '"';
246
- }
247
- if(isset($a['tabs']) && !empty($a['tabs'])){
248
- $return .= ' data-tabs="' . $a['tabs'] . '"';
249
- } else if(isset($a['posts']) && !empty($a['posts'])){
250
- if($a['posts'] == 'true'){
251
- $return .= ' data-tabs="timeline"';
252
- } else {
253
- $return .= ' data-tabs="false"';
254
- }
255
- }
256
- if(isset($a['cta']) && !empty($a['cta'])){
257
- $return .= ' data-hide-cta="' . $a['cta'] . '"';
258
- }
259
- if(isset($a['small']) && !empty($a['small'])){
260
- $return .= ' data-small-header="' . $a['small'] . '"';
261
- }
262
- if(isset($a['adapt']) && !empty($a['adapt'])){
263
- $return .= ' data-adapt-container-width="' . $a['adapt'] . '"';
264
- } else {
265
- $return .= ' data-adapt-container-width="false"';
266
- }
267
- $return .= '><div class="fb-xfbml-parse-ignore">';
268
- if( $a['link'] == 'true' ){
269
- $return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
270
- $return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
271
- if( empty( $a['linktext'] ) ) {
272
- $return .= 'https://www.facebook.com/' . $a['href'];
273
- } else {
274
- $return .= $a['linktext'];
275
- }
276
- $return .= '</a>';
277
- $return .= '</blockquote>';
278
- }
279
- $return .= '</div></div></div>';
280
- }
281
- return $return;
282
- }
283
-
284
- }
285
-
286
- class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
287
-
288
- private $facebookURLs = array( 'https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/', 'http://facebook.com/', 'http://www.facebook.com/' );
289
- private $settings;
290
-
291
- function __construct() {
292
- $this->settings = new facebook_page_plugin_settings;
293
- parent::__construct( 'facebook_page_plugin_widget', __( 'Mongoose Page Plugin', 'facebook-page-feed-graph-api' ), array( 'description' => __( 'Generates a Facebook Page feed in your widget area', 'facebook-page-feed-graph-api' ), ) );
294
- }
295
- public function widget( $args, $instance ) {
296
- if( isset( $instance['title'] ) && !empty( $instance['title'] ) ) {
297
- $title = apply_filters( 'widget_title', $instance['title'] );
298
- } else {
299
- $title = NULL;
300
- }
301
- if(isset($instance['href']) && !empty($instance['href'])){
302
- $href = $instance['href'];
303
- foreach($this->facebookURLs as $url){
304
- $href = str_replace($url, '', $href);
305
- }
306
- } else {
307
- $href = NULL;
308
- }
309
- if(isset($instance['width']) && !empty($instance['width'])){
310
- $width = $instance['width'];
311
- } else {
312
- $width = NULL;
313
- }
314
- if(isset($instance['height']) && !empty($instance['height'])){
315
- $height = $instance['height'];
316
- } else {
317
- $height = NULL;
318
- }
319
- if(isset($instance['cover']) && !empty($instance['cover'])){
320
- $cover = 'true';
321
- } else {
322
- $cover = 'false';
323
- }
324
- if(isset($instance['facepile']) && !empty($instance['facepile'])){
325
- $facepile = 'true';
326
- } else {
327
- $facepile = 'false';
328
- }
329
- if(isset($instance['tabs']) && !empty($instance['tabs'])){
330
- $tabs = $instance['tabs'];
331
- } else {
332
- $tabs = '';
333
- }
334
- if(isset($instance['cta']) && !empty($instance['cta'])){
335
- $cta = 'true';
336
- } else {
337
- $cta = 'false';
338
- }
339
- if(isset($instance['small']) && !empty($instance['small'])){
340
- $small = 'true';
341
- } else {
342
- $small = 'false';
343
- }
344
- if(isset($instance['adapt']) && !empty($instance['adapt'])){
345
- $adapt = 'true';
346
- } else {
347
- $adapt = 'false';
348
- }
349
- if(isset($instance['link']) && !empty($instance['link'])){
350
- $link = 'true';
351
- } else {
352
- $link = 'false';
353
- }
354
- if(isset($instance['linktext']) && !empty($instance['linktext'])){
355
- $linktext = $instance['linktext'];
356
- } else {
357
- $linktext = NULL;
358
- }
359
- if(isset($instance['language']) && !empty($instance['language'])){
360
- $language = $instance['language'];
361
- } else {
362
- $language = NULL;
363
- }
364
- echo $args['before_widget'];
365
- if ( ! empty( $title ) ) {
366
- echo $args['before_title'] . $title . $args['after_title'];
367
- }
368
- if( !empty($href )){
369
- $shortcode = '[facebook-page-plugin href="' . $href . '"';
370
- if( isset( $width ) && !empty( $width ) ){
371
- $shortcode .= ' width="' . $width . '"';
372
- }
373
- if( isset( $height ) && !empty( $height ) ){
374
- $shortcode .= ' height="' . $height . '"';
375
- }
376
- if( isset( $cover ) && !empty( $cover ) ){
377
- $shortcode .= ' cover="' . $cover . '"';
378
- }
379
- if( isset( $facepile ) && !empty( $facepile ) ){
380
- $shortcode .= ' facepile="' . $facepile . '"';
381
- }
382
- if( isset( $tabs ) && !empty( $tabs ) ){
383
- if( is_array( $tabs ) ) {
384
- $shortcode .= ' tabs="';
385
- for( $i = 0; $i < count( $tabs ); $i++ ) {
386
- $shortcode .= $tabs[$i];
387
- $shortcode .= ( $i != count( $tabs ) - 1 ? ',' : '' );
388
- }
389
- $shortcode .= '"';
390
- } else {
391
- $shortcode .= ' tabs="' . $tabs . '"';
392
- }
393
- }
394
- if( isset( $language ) && !empty( $language ) ){
395
- $shortcode .= ' language="' . $language . '"';
396
- }
397
- if( isset( $cta ) && !empty( $cta ) ){
398
- $shortcode .= ' cta="' . $cta . '"';
399
- }
400
- if( isset( $small ) && !empty( $small ) ){
401
- $shortcode .= ' small="' . $small . '"';
402
- }
403
- if( isset( $adapt ) && !empty( $adapt ) ){
404
- $shortcode .= ' adapt="' . $adapt . '"';
405
- }
406
- if( isset( $link ) && !empty( $link ) ){
407
- $shortcode .= ' link="' . $link . '"';
408
- }
409
- if( isset( $linktext ) && !empty( $linktext ) ){
410
- $shortcode .= ' linktext="' . $linktext . '"';
411
- }
412
- $shortcode .= ' _implementation="widget"';
413
- $shortcode .= ']';
414
- echo do_shortcode( $shortcode );
415
- }
416
- echo $args['after_widget'];
417
- }
418
- public function form( $instance ) {
419
-
420
- if ( isset( $instance[ 'title' ] ) ) {
421
- $title = $instance[ 'title' ];
422
- } else {
423
- $title = __( 'New title', 'facebook-page-feed-graph-api' );
424
- }
425
- if ( isset( $instance[ 'href' ] ) ) {
426
- $href = $instance[ 'href' ];
427
- } else {
428
- $href = '';
429
- }
430
- if ( isset( $instance[ 'width' ] ) ) {
431
- $width = $instance[ 'width' ];
432
- } else {
433
- $width = '';
434
- }
435
- if ( isset( $instance[ 'height' ] ) ) {
436
- $height = $instance[ 'height' ];
437
- } else {
438
- $height = '';
439
- }
440
- if ( isset( $instance[ 'cover' ] ) ) {
441
- $cover = $instance[ 'cover' ];
442
- } else {
443
- $cover = 'false';
444
- }
445
- if ( isset( $instance[ 'facepile' ] ) ) {
446
- $facepile = $instance[ 'facepile' ];
447
- } else {
448
- $facepile = 'false';
449
- }
450
- if ( isset( $instance[ 'tabs' ] ) ) {
451
- $tabs = $instance[ 'tabs' ];
452
- } else {
453
- $tabs = '';
454
- }
455
- if ( isset( $instance[ 'cta' ] ) ) {
456
- $cta = $instance[ 'cta' ];
457
- } else {
458
- $cta = 'false';
459
- }
460
- if ( isset( $instance[ 'small' ] ) ) {
461
- $small = $instance[ 'small' ];
462
- } else {
463
- $small = 'false';
464
- }
465
- if ( isset( $instance[ 'adapt' ] ) ) {
466
- $adapt = $instance[ 'adapt' ];
467
- } else {
468
- $adapt = 'true';
469
- }
470
- if ( isset( $instance[ 'link' ] ) ) {
471
- $link = $instance[ 'link' ];
472
- } else {
473
- $link = 'true';
474
- }
475
- if ( isset( $instance[ 'linktext' ] ) ) {
476
- $linktext = $instance[ 'linktext' ];
477
- } else {
478
- $linktext = '';
479
- }
480
- if ( isset( $instance[ 'language' ] ) ) {
481
- $language = $instance[ 'language' ];
482
- } else {
483
- $language = '';
484
- }
485
-
486
- $langs = $this->settings->get_locale_xml();
487
-
488
- echo cameronjonesweb_facebook_page_plugin::donate_notice();
489
-
490
- echo '<p>';
491
- echo '<label for="' . $this->get_field_id( 'title' ) . '">';
492
- _e( 'Title:', 'facebook-page-feed-graph-api' );
493
- echo '</label>';
494
- echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . esc_attr( $title ) . '" />';
495
- echo '</p>';
496
- echo '<p>';
497
- echo '<label for="' . $this->get_field_id( 'href' ) . '">';
498
- _e( 'Page URL:', 'facebook-page-feed-graph-api' );
499
- echo '</label>';
500
- echo '<input class="widefat" id="' . $this->get_field_id( 'href' ) . '" name="' . $this->get_field_name( 'href' ) . '" type="url" value="' . esc_attr( $href ) . '" required />';
501
- echo '</p>';
502
- echo '<p>';
503
- echo '<label for="' . $this->get_field_id( 'width' ) . '">';
504
- _e( 'Width:', 'facebook-page-feed-graph-api' );
505
- echo '</label>';
506
- echo '<input class="widefat" id="' . $this->get_field_id( 'width' ) . '" name="' . $this->get_field_name( 'width' ) . '" type="number" min="180" max="500" value="' . esc_attr( $width ) . '" />';
507
- echo '</p>';
508
- echo '<p>';
509
- echo '<label for="' . $this->get_field_id( 'height' ) . '">';
510
- _e( 'Height:', 'facebook-page-feed-graph-api' );
511
- echo '</label>';
512
- echo '<input class="widefat" id="' . $this->get_field_id( 'height' ) . '" name="' . $this->get_field_name( 'height' ) . '" type="number" min="70" value="' . esc_attr( $height ) . '" />';
513
- echo '</p>';
514
- echo '<p>';
515
- echo '<label for="' . $this->get_field_id( 'cover' ) . '">';
516
- _e( 'Cover Photo:', 'facebook-page-feed-graph-api' );
517
- echo '</label>';
518
- echo ' <input class="widefat" id="' . $this->get_field_id( 'cover' ) . '" name="' . $this->get_field_name( 'cover' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $cover ), 'true', false ) . ' />';
519
- echo '</p>';
520
- echo '<p>';
521
- echo '<label for="' . $this->get_field_id( 'facepile' ) . '">';
522
- _e( 'Show Facepile:', 'facebook-page-feed-graph-api' );
523
- echo '</label>';
524
- echo ' <input class="widefat" id="' . $this->get_field_id( 'facepile' ) . '" name="' . $this->get_field_name( 'facepile' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $facepile ), 'true', false ) . ' />';
525
- echo '</p>';
526
- echo '<p>';
527
- _e( 'Page Tabs:', 'facebook-page-feed-graph-api' );
528
- $CJW_FBPP_TABS = $this->settings->tabs();
529
- if( !empty( $CJW_FBPP_TABS ) ) {
530
- // First we should convert the string to an array as that's how it will be stored moving forward.
531
- if( !is_array( $tabs ) ) {
532
- $oldtabs = esc_attr( $tabs );
533
- $newtabs = explode( ',', $tabs );
534
- $tabs = $newtabs;
535
- }
536
- foreach( $CJW_FBPP_TABS as $tab ) {
537
- echo '<br/><label>';
538
- echo '<input type="checkbox" name="' . $this->get_field_name( 'tabs' ) . '[' . $tab . ']" ' . ( in_array( $tab, $tabs ) ? 'checked' : '' ) . ' /> ';
539
- _e( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
540
- echo '</label>';
541
- }
542
- }
543
- echo '</p>';
544
- echo '<p>';
545
- echo '<label for="' . $this->get_field_id( 'cta' ) . '">';
546
- _e( 'Hide Call To Action:', 'facebook-page-feed-graph-api' );
547
- echo '</label>';
548
- echo ' <input class="widefat" id="' . $this->get_field_id( 'cta' ) . '" name="' . $this->get_field_name( 'cta' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $cta ), 'true', false ) . ' />';
549
- echo '</p>';
550
- echo '<p>';
551
- echo '<label for="' . $this->get_field_id( 'small' ) . '">';
552
- _e( 'Small Header:', 'facebook-page-feed-graph-api' );
553
- echo '</label>';
554
- echo ' <input class="widefat" id="' . $this->get_field_id( 'small' ) . '" name="' . $this->get_field_name( 'small' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $small ), 'true', false ) . ' />';
555
- echo '</p>';
556
- echo '<p>';
557
- echo '<label for="' . $this->get_field_id( 'adapt' ) . '">';
558
- _e( 'Adaptive Width:', 'facebook-page-feed-graph-api' );
559
- echo '</label>';
560
- echo ' <input class="widefat" id="' . $this->get_field_id( 'adapt' ) . '" name="' . $this->get_field_name( 'adapt' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $adapt ), 'true', false ) . ' />';
561
- echo '</p>';
562
- echo '<p>';
563
- echo '<label for="' . $this->get_field_id( 'link' ) . '">';
564
- _e( 'Display link while loading:', 'facebook-page-feed-graph-api' );
565
- echo '</label>';
566
- echo ' <input class="widefat" id="' . $this->get_field_id( 'link' ) . '" name="' . $this->get_field_name( 'link' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $link ), 'true', false ) . ' />';
567
- echo '</p>';
568
- echo '<p>';
569
- echo '<label for="' . $this->get_field_id( 'linktext' ) . '">';
570
- _e( 'Link text:', 'facebook-page-feed-graph-api' );
571
- echo '</label>';
572
- echo '<input class="widefat" id="' . $this->get_field_id( 'linktext' ) . '" name="' . $this->get_field_name( 'linktext' ) . '" type="text" value="' . esc_attr( $linktext ) . '" />';
573
- echo '</p>';
574
- echo '<p>';
575
- echo '<label for="' . $this->get_field_id( 'language' ) . '">';
576
- _e( 'Language:', 'facebook-page-feed-graph-api' );
577
- echo '</label>';
578
- echo '<select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';
579
- echo '<option value="">' . __( 'Site Language (default)', 'facebook-page-feed-graph-api' ) . '</option>';
580
- if(isset($langs) && !empty($langs)){
581
- foreach($langs as $lang){
582
- //echo '<option value="' . $lang->codes->code->standard->representation . '"' . selected( esc_attr( $language ), $lang->codes->code->standard->representation, false ) . '>' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>'; // Facebook only
583
- echo '<option value="' . $lang->standard->representation . '"' . selected( esc_attr( $language ), $lang->standard->representation, false ) . '>' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
584
- }
585
- }
586
- echo '</select>';
587
- echo '</p>';
588
- }
589
-
590
- // Updating widget replacing old instances with new
591
- public function update( $new_instance, $old_instance ) {
592
- $instance = array();
593
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
594
- $instance['href'] = ( ! empty( $new_instance['href'] ) ) ? strip_tags( $new_instance['href'] ) : '';
595
- $instance['width'] = ( ! empty( $new_instance['width'] ) ) ? strip_tags( $new_instance['width'] ) : '';
596
- $instance['height'] = ( ! empty( $new_instance['height'] ) ) ? strip_tags( $new_instance['height'] ) : '';
597
- $instance['cover'] = ( ! empty( $new_instance['cover'] ) ) ? strip_tags( $new_instance['cover'] ) : '';
598
- $instance['facepile'] = ( ! empty( $new_instance['facepile'] ) ) ? strip_tags( $new_instance['facepile'] ) : '';
599
- if( !empty( $new_instance['tabs'] ) ) {
600
- if( is_array( $new_instance['tabs'] ) ) {
601
- foreach( $new_instance['tabs'] as $key => $var ) {
602
- $instance['tabs'][] = sanitize_text_field( $key );
603
- }
604
- }
605
- } else {
606
- $instance['tabs'] = '';
607
- }
608
- $instance['cta'] = ( ! empty( $new_instance['cta'] ) ) ? strip_tags( $new_instance['cta'] ) : '';
609
- $instance['small'] = ( ! empty( $new_instance['small'] ) ) ? strip_tags( $new_instance['small'] ) : '';
610
- $instance['adapt'] = ( ! empty( $new_instance['adapt'] ) ) ? strip_tags( $new_instance['adapt'] ) : '';
611
- $instance['link'] = ( ! empty( $new_instance['link'] ) ) ? strip_tags( $new_instance['link'] ) : '';
612
- $instance['linktext'] = ( ! empty( $new_instance['linktext'] ) ) ? strip_tags( $new_instance['linktext'] ) : '';
613
- $instance['language'] = ( ! empty( $new_instance['language'] ) ) ? strip_tags( $new_instance['language'] ) : '';
614
- return $instance;
615
- }
616
-
617
- }
618
-
619
- class cameronjonesweb_facebook_page_plugin_shortcode_generator {
620
-
621
- private $langs;
622
- private $settings;
623
-
624
- function __construct() {
625
-
626
- $this->settings = new facebook_page_plugin_settings;
627
- $this->langs = $this->settings->get_locale_xml();
628
- }
629
-
630
- function generate() {
631
-
632
- $return = NULL;
633
-
634
- $return .= cameronjonesweb_facebook_page_plugin::donate_notice();
635
-
636
- $return .= '<noscript>' . __( 'The shortcode generator requires JavaScript enabled', 'facebook-page-feed-graph-api' ) . '</noscript>';
637
-
638
- $return .= '<form>';
639
- $return .= '<p><label>' . __( 'Facebook Page URL', 'facebook-page-feed-graph-api' ) . ': <input type="url" id="fbpp-href" /></label></p>';
640
- $return .= '<p><label>' . __( 'Width (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" max="500" min="180" id="fbpp-width" /></label></p>';
641
- $return .= '<p><label>' . __( 'Height (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" min="70" id="fbpp-height" /></label></p>';
642
- $return .= '<p><label>' . __( 'Show Cover Photo', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cover" /></label></p>';
643
- $return .= '<p><label>' . __( 'Show Facepile', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
644
- $return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ':';
645
- $settings = new facebook_page_plugin_settings;
646
- $CJW_FBPP_TABS = $settings->tabs();
647
- if( !empty( $CJW_FBPP_TABS ) ) {
648
- foreach( $CJW_FBPP_TABS as $tab ) {
649
- $return .= '<br/><label>';
650
- $return .= '<input type="checkbox" class="fbpp-tabs" name="' . $tab . '" /> ';
651
- $return .= __( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
652
- $return .= '</label>';
653
- }
654
- }
655
- $return .= '<p><label>' . __( 'Hide Call To Action', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cta" /></label></p>';
656
- $return .= '<p><label>' . __( 'Small Header', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-small" /></label></p>';
657
- $return .= '<p><label>' . __( 'Adaptive Width', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-adapt" checked /></label></p>';
658
- $return .= '<p><label>' . __( 'Display link while loading', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-link" checked /></label></p>';
659
- $return .= '<p id="linktext-label"><label>' . __( 'Link text', 'facebook-page-feed-graph-api' ) . ': <input type="text" id="fbpp-linktext" /></label></p>';
660
- $return .= '<p><label>' . __( 'Language', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-lang"><option value="">' . __( 'Site Language', 'facebook-page-feed-graph-api' ) . '</option>';
661
- if(isset($this->langs) && !empty($this->langs)){
662
- foreach($this->langs as $lang){
663
- $return .= '<option value="' . $lang->standard->representation . '">' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
664
- }
665
- }
666
- $return .= '</select></label></p>';
667
- $return .= '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
668
- $return .= '</form>';
669
-
670
- echo $return;
671
- }
672
-
673
- }
674
-
675
- class facebook_page_plugin_settings {
676
-
677
- public $tabs;
678
-
679
- function __construct() {
680
- $this->tabs = array( 'timeline', 'events', 'messages' );
681
- }
682
-
683
- function tabs() {
684
- return $this->tabs;
685
- }
686
-
687
- function get_locale_xml() {
688
-
689
- $admin_abspath = str_replace( site_url(), ABSPATH, admin_url() );
690
-
691
- include_once( $admin_abspath . '/includes/class-wp-filesystem-base.php' );
692
- include_once( $admin_abspath . '/includes/class-wp-filesystem-direct.php' );
693
- $wp_filesystem = new WP_Filesystem_Direct( null );
694
-
695
- try {
696
- //$xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
697
- //$xml = file_get_contents( CJW_FBPP_PLUGIN_URL ) . 'lang.xml');
698
- $lang_xml = $wp_filesystem->get_contents( CJW_FBPP_PLUGIN_DIR . '/lang.xml');
699
- } catch( Exception $ex ){
700
- $lang_xml = NULL;
701
- }
702
-
703
- if(isset($lang_xml) && !empty($lang_xml)){
704
- $langs = new SimpleXMLElement($lang_xml);
705
- } else {
706
- $langs = NULL;
707
- }
708
-
709
- return $langs;
710
- }
711
-
712
- }
713
-
714
- // Register the widget.
715
- function facebook_page_plugin_load_widget() {
716
- register_widget( 'cameronjonesweb_facebook_page_plugin_widget' );
717
- }
718
- add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
719
-
720
- $cameronjonesweb_facebook_page_plugin = new cameronjonesweb_facebook_page_plugin();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Mongoose Page Plugin
4
+ * Plugin URI: https://mongoosemarketplace.com/downloads/facebook-page-plugin/
5
+ * Description: The most popular way to display the Facebook Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
6
+ * Version: 1.7.0
7
+ * Author: Mongoose Marketplace
8
+ * Author URI: https://mongoosemarketplace.com/
9
+ * License: GPLv2
10
+ * Text Domain: facebook-page-feed-graph-api
11
+
12
+ * Copyright 2015-2019 Cameron Jones (email : plugins@cameronjonesweb.com.au)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+ */
23
+
24
+ defined( 'ABSPATH' ) or die();
25
+
26
+ class cameronjonesweb_facebook_page_plugin {
27
+
28
+ public static $remove_donate_notice_key = 'facebook_page_plugin_donate_notice_ignore';
29
+
30
+ public function __construct() {
31
+
32
+ define( 'CJW_FBPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
33
+ define( 'CJW_FBPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
34
+ define( 'CJW_FBPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
35
+ define( 'CJW_FBPP_PLUGIN_VER', '1.6.3' );
36
+ define( 'CJW_FBPP_PLUGIN_DONATE_LINK', 'https://www.patreon.com/cameronjonesweb' );
37
+ define( 'CJW_FBPP_PLUGIN_SURVEY_LINK', 'https://cameronjonesweb.typeform.com/to/BllbYm' );
38
+
39
+ // Add all the hooks and actions.
40
+ add_shortcode( 'facebook-page-plugin', array( $this, 'facebook_page_plugin' ) );
41
+ add_filter( 'widget_text', 'do_shortcode' );
42
+ add_action( 'wp_dashboard_setup', array( $this, 'facebook_page_plugin_dashboard_widget' ) );
43
+ add_action( 'admin_enqueue_scripts', array( $this, 'facebook_page_plugin_admin_resources' ) );
44
+ add_action( 'admin_init', array( $this, 'remove_donate_notice_nojs' ) );
45
+ add_action( 'admin_menu', array( $this, 'facebook_page_plugin_landing_page_menu' ) );
46
+ add_action( 'wp_ajax_facebook_page_plugin_latest_blog_posts_callback', array( $this, 'facebook_page_plugin_latest_blog_posts_callback' ) );
47
+ add_action( 'activated_plugin', array( $this, 'facebook_page_plugin_activation_hook' ) );
48
+ add_action( 'wp_ajax_facebook_page_plugin_remove_donate_notice', array( $this, 'remove_donate_notice' ) );
49
+ add_filter( 'plugin_action_links_' . CJW_FBPP_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
50
+
51
+ }
52
+
53
+
54
+ // Filter functions.
55
+ private static function dashboard_widget_capability() {
56
+
57
+ $return = apply_filters( 'facebook_page_plugin_dashboard_widget_capability', 'edit_posts' );
58
+ return $return;
59
+
60
+ }
61
+
62
+
63
+ private static function app_id() {
64
+
65
+ $return = apply_filters( 'facebook_page_plugin_app_id', '846690882110183' );
66
+ return $return;
67
+
68
+ }
69
+
70
+
71
+ // Admin functions.
72
+
73
+ public static function donate_notice() {
74
+
75
+ $return = NULL;
76
+
77
+ if( current_user_can( 'administrator' ) ) {
78
+
79
+ $user_id = get_current_user_id();
80
+
81
+ if ( !get_user_meta( $user_id, self::$remove_donate_notice_key ) || get_user_meta( $user_id, self::$remove_donate_notice_key ) === false ) {
82
+
83
+ $return .= '<div class="facebook-page-plugin-donate"><p>';
84
+
85
+ $return .= __( 'Thank you for using the Facebook Page Plugin. Please consider donating to support ongoing development. ', 'facebook-page-feed-graph-api' );
86
+
87
+ $return .= '</p><p>';
88
+
89
+ $return .= '<a href="' . CJW_FBPP_PLUGIN_DONATE_LINK . '" target="_blank" class="button button-secondary">' . __( 'Donate now', 'facebook-page-feed-graph-api' ) . '</a>';
90
+
91
+ $return .= '<a href="?' . self::$remove_donate_notice_key . '=0" class="notice-dismiss facebook-page-plugin-donate-notice-dismiss" title="' . __( 'Dismiss this notice', 'facebook-page-feed-graph-api' ) . '"><span class="screen-reader-text">' . __( 'Dismiss this notice', 'facebook-page-feed-graph-api' ) . '.</span></a>';
92
+
93
+ $return .= '</p></div>';
94
+
95
+ }
96
+
97
+ }
98
+
99
+ return $return;
100
+
101
+ }
102
+
103
+ public static function remove_donate_notice() {
104
+
105
+ $user_id = get_current_user_id();
106
+
107
+ update_user_meta( $user_id, self::$remove_donate_notice_key, 'true', true );
108
+
109
+ if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
110
+
111
+ wp_die();
112
+
113
+ }
114
+
115
+ }
116
+
117
+ public function remove_donate_notice_nojs() {
118
+
119
+ if ( isset( $_GET[self::$remove_donate_notice_key] ) && '0' == $_GET[self::$remove_donate_notice_key] ) {
120
+
121
+ self::remove_donate_notice();
122
+
123
+ }
124
+
125
+ }
126
+
127
+
128
+ // Add a link to support on plugins listing
129
+ function plugin_action_links( $links ) {
130
+
131
+ $links[] = sprintf(
132
+ '<a href="https://wordpress.org/support/plugin/facebook-page-feed-graph-api" target="_blank">%1$s</a>',
133
+ __( 'Support', 'facebook-page-feed-graph-api' )
134
+ );
135
+ return $links;
136
+ }
137
+
138
+
139
+ //Enqueue CSS and JS for admin
140
+ public function facebook_page_plugin_admin_resources() {
141
+
142
+ wp_enqueue_script( 'facebook-page-plugin-admin-scripts', CJW_FBPP_PLUGIN_URL . 'js/admin-global.js' );
143
+ wp_enqueue_style( 'facebook-page-plugin-admin-styles', CJW_FBPP_PLUGIN_URL . 'css/admin-global.css' );
144
+
145
+ }
146
+
147
+ //Register the dashboard widget
148
+ public function facebook_page_plugin_dashboard_widget() {
149
+
150
+ if( current_user_can( self::dashboard_widget_capability() ) ) {
151
+
152
+ wp_add_dashboard_widget( 'facebook-page-plugin-shortcode-generator', __( 'Facebook Page Plugin Shortcode Generator', 'facebook-page-feed-graph-api' ), array( $this, 'facebook_page_plugin_dashboard_widget_callback' ) );
153
+
154
+ }
155
+
156
+ }
157
+
158
+ //Load the dashboard widget
159
+ function facebook_page_plugin_dashboard_widget_callback() {
160
+ echo '<a name="cameronjonesweb_facebook_page_plugin_shortcode_generator"></a>';
161
+ $generator = new cameronjonesweb_facebook_page_plugin_shortcode_generator();
162
+ $generator->generate();
163
+
164
+ }
165
+
166
+ function facebook_page_plugin_landing_page_menu() {
167
+ add_submenu_page( 'plugins.php', __( 'Facebook Page Plugin', 'facebook-page-feed-graph-api' ), 'Facebook Page Plugin', 'install_plugins', 'facebook-page-plugin', array( $this, 'facebook_page_plugin_landing_page' ) );
168
+ }
169
+
170
+ function facebook_page_plugin_landing_page() {
171
+ wp_enqueue_style( 'facebook-page-plugin-google-fonts', 'https://fonts.googleapis.com/css?family=Rammetto+One|Paytone+One|Space+Mono:400|Muli:400,400i,700', [], CJW_FBPP_PLUGIN_VER );
172
+ wp_enqueue_script( 'facebook-page-plugin-landing-page-js', CJW_FBPP_PLUGIN_URL . 'js/admin-landing-page.js', array( 'jquery' ), CJW_FBPP_PLUGIN_VER, true );
173
+ wp_enqueue_style( 'facebook-page-plugin-landing-page-css', CJW_FBPP_PLUGIN_URL . 'css/admin-landing-page.css', [], CJW_FBPP_PLUGIN_VER );
174
+ include CJW_FBPP_PLUGIN_DIR . '/inc/landing-page.php';
175
+ }
176
+
177
+ /*
178
+ * http://stackoverflow.com/a/4860432/1672694
179
+ */
180
+
181
+ function facebook_page_plugin_is_connected() {
182
+ $connected = @fsockopen( "cameronjonesweb.com.au", 80 );
183
+ if( $connected ){
184
+ $is_conn = true; //action when connected
185
+ fclose( $connected );
186
+ } else {
187
+ $is_conn = false; //action in connection failure
188
+ }
189
+ return $is_conn;
190
+ }
191
+
192
+ function facebook_page_plugin_latest_blog_posts_callback() {
193
+ $links = sprintf(
194
+ '<p><a href="https://cameronjonesweb.com.au/blog/" target="_blank">%1$s</a> | <a href="https://mongoosemarketplace.com/news/" target="_blank">%2$s</a></p>',
195
+ __( 'Developer\'s blog', 'facebook-page-feed-graph-api' ),
196
+ __( 'Latest plugin news', 'facebook-page-feed-graph-api' )
197
+ );
198
+ wp_widget_rss_output( 'https://feed.rssunify.com/5b718c594e800/rss.xml', [ 'show_date' => 1 ] );
199
+ wp_die( $links );
200
+ }
201
+
202
+ function facebook_page_plugin_activation_hook( $plugin ) {
203
+ if( $plugin == CJW_FBPP_PLUGIN_BASENAME ) {
204
+ exit( wp_redirect( admin_url( 'plugins.php?page=facebook-page-plugin' ) ) );
205
+ }
206
+ }
207
+
208
+
209
+ // Client side stuff.
210
+ function facebook_page_plugin_generate_wrapper_id() {
211
+ return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
212
+ }
213
+
214
+ // Parse shortcode.
215
+ function facebook_page_plugin( $filter ) {
216
+ wp_enqueue_script( 'facebook-page-plugin-sdk', CJW_FBPP_PLUGIN_URL . 'js/sdk.js', array(), NULL, true );
217
+ wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', NULL, true );
218
+ $return = NULL;
219
+ $a = shortcode_atts( array(
220
+ 'href' => NULL,
221
+ 'width' => 340,
222
+ 'height' => 130,
223
+ 'cover' => NULL,
224
+ 'facepile' => NULL,
225
+ 'posts' => NULL,
226
+ 'tabs' => array(),
227
+ 'language' => get_bloginfo('language'),
228
+ 'cta' => NULL,
229
+ 'small' => NULL,
230
+ 'adapt' => NULL,
231
+ 'link' => true,
232
+ 'linktext' => NULL,
233
+ 'standard' => 'html5',
234
+ '_implementation' => 'shortcode'
235
+ ), $filter );
236
+ if(isset($a['href']) && !empty($a['href'])){
237
+ $a['language'] = str_replace("-", "_", $a['language']);
238
+
239
+ //Send the language as a parameter to the SDK
240
+ wp_localize_script( 'facebook-page-plugin-sdk', 'facebook_page_plugin_language', array( 'language' => $a['language'] ) );
241
+
242
+ $return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" data-implementation="' . esc_attr( $a['_implementation'] ) . '" id="' . $this->facebook_page_plugin_generate_wrapper_id() . '">';
243
+ $return .= '<div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/' . $a['language'] . '/sdk.js#xfbml=1&version=v3.2&appId=' . self::app_id() . '";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
244
+ $return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
245
+ if(isset($a['width']) && !empty($a['width'])){
246
+ $return .= ' data-width="' . $a['width'] . '"';
247
+ $return .= ' data-max-width="' . $a['width'] . '"';
248
+ }
249
+ if(isset($a['height']) && !empty($a['height'])){
250
+ $return .= ' data-height="' . $a['height'] . '"';
251
+ }
252
+ if(isset($a['cover']) && !empty($a['cover'])){
253
+ if($a['cover'] == "false"){
254
+ $return .= ' data-hide-cover="true"';
255
+ } else if($a['cover'] == "true"){
256
+ $return .= ' data-hide-cover="false"';
257
+ }
258
+ }
259
+ if(isset($a['facepile']) && !empty($a['facepile'])){
260
+ $return .= ' data-show-facepile="' . $a['facepile'] . '"';
261
+ }
262
+ if(isset($a['tabs']) && !empty($a['tabs'])){
263
+ $return .= ' data-tabs="' . $a['tabs'] . '"';
264
+ } else if(isset($a['posts']) && !empty($a['posts'])){
265
+ if($a['posts'] == 'true'){
266
+ $return .= ' data-tabs="timeline"';
267
+ } else {
268
+ $return .= ' data-tabs="false"';
269
+ }
270
+ }
271
+ if(isset($a['cta']) && !empty($a['cta'])){
272
+ $return .= ' data-hide-cta="' . $a['cta'] . '"';
273
+ }
274
+ if(isset($a['small']) && !empty($a['small'])){
275
+ $return .= ' data-small-header="' . $a['small'] . '"';
276
+ }
277
+ if(isset($a['adapt']) && !empty($a['adapt'])){
278
+ $return .= ' data-adapt-container-width="' . $a['adapt'] . '"';
279
+ } else {
280
+ $return .= ' data-adapt-container-width="false"';
281
+ }
282
+ $return .= '><div class="fb-xfbml-parse-ignore">';
283
+ if( $a['link'] == 'true' ){
284
+ $return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
285
+ $return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
286
+ if( empty( $a['linktext'] ) ) {
287
+ $return .= 'https://www.facebook.com/' . $a['href'];
288
+ } else {
289
+ $return .= $a['linktext'];
290
+ }
291
+ $return .= '</a>';
292
+ $return .= '</blockquote>';
293
+ }
294
+ $return .= '</div></div></div>';
295
+ }
296
+ return $return;
297
+ }
298
+
299
+ }
300
+
301
+ class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
302
+
303
+ private $facebookURLs = array( 'https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/', 'http://facebook.com/', 'http://www.facebook.com/' );
304
+ private $settings;
305
+
306
+ function __construct() {
307
+ $this->settings = new facebook_page_plugin_settings;
308
+ parent::__construct( 'facebook_page_plugin_widget', __( 'Facebook Page Plugin', 'facebook-page-feed-graph-api' ), array( 'description' => __( 'Generates a Facebook Page feed in your widget area', 'facebook-page-feed-graph-api' ), ) );
309
+ }
310
+ public function widget( $args, $instance ) {
311
+ if( isset( $instance['title'] ) && !empty( $instance['title'] ) ) {
312
+ $title = apply_filters( 'widget_title', $instance['title'] );
313
+ } else {
314
+ $title = NULL;
315
+ }
316
+ if(isset($instance['href']) && !empty($instance['href'])){
317
+ $href = $instance['href'];
318
+ foreach($this->facebookURLs as $url){
319
+ $href = str_replace($url, '', $href);
320
+ }
321
+ } else {
322
+ $href = NULL;
323
+ }
324
+ if(isset($instance['width']) && !empty($instance['width'])){
325
+ $width = $instance['width'];
326
+ } else {
327
+ $width = NULL;
328
+ }
329
+ if(isset($instance['height']) && !empty($instance['height'])){
330
+ $height = $instance['height'];
331
+ } else {
332
+ $height = NULL;
333
+ }
334
+ if(isset($instance['cover']) && !empty($instance['cover'])){
335
+ $cover = 'true';
336
+ } else {
337
+ $cover = 'false';
338
+ }
339
+ if(isset($instance['facepile']) && !empty($instance['facepile'])){
340
+ $facepile = 'true';
341
+ } else {
342
+ $facepile = 'false';
343
+ }
344
+ if(isset($instance['tabs']) && !empty($instance['tabs'])){
345
+ $tabs = $instance['tabs'];
346
+ } else {
347
+ $tabs = '';
348
+ }
349
+ if(isset($instance['cta']) && !empty($instance['cta'])){
350
+ $cta = 'true';
351
+ } else {
352
+ $cta = 'false';
353
+ }
354
+ if(isset($instance['small']) && !empty($instance['small'])){
355
+ $small = 'true';
356
+ } else {
357
+ $small = 'false';
358
+ }
359
+ if(isset($instance['adapt']) && !empty($instance['adapt'])){
360
+ $adapt = 'true';
361
+ } else {
362
+ $adapt = 'false';
363
+ }
364
+ if(isset($instance['link']) && !empty($instance['link'])){
365
+ $link = 'true';
366
+ } else {
367
+ $link = 'false';
368
+ }
369
+ if(isset($instance['linktext']) && !empty($instance['linktext'])){
370
+ $linktext = $instance['linktext'];
371
+ } else {
372
+ $linktext = NULL;
373
+ }
374
+ if(isset($instance['language']) && !empty($instance['language'])){
375
+ $language = $instance['language'];
376
+ } else {
377
+ $language = NULL;
378
+ }
379
+ echo $args['before_widget'];
380
+ if ( ! empty( $title ) ) {
381
+ echo $args['before_title'] . $title . $args['after_title'];
382
+ }
383
+ if( !empty($href )){
384
+ $shortcode = '[facebook-page-plugin href="' . $href . '"';
385
+ if( isset( $width ) && !empty( $width ) ){
386
+ $shortcode .= ' width="' . $width . '"';
387
+ }
388
+ if( isset( $height ) && !empty( $height ) ){
389
+ $shortcode .= ' height="' . $height . '"';
390
+ }
391
+ if( isset( $cover ) && !empty( $cover ) ){
392
+ $shortcode .= ' cover="' . $cover . '"';
393
+ }
394
+ if( isset( $facepile ) && !empty( $facepile ) ){
395
+ $shortcode .= ' facepile="' . $facepile . '"';
396
+ }
397
+ if( isset( $tabs ) && !empty( $tabs ) ){
398
+ if( is_array( $tabs ) ) {
399
+ $shortcode .= ' tabs="';
400
+ for( $i = 0; $i < count( $tabs ); $i++ ) {
401
+ $shortcode .= $tabs[$i];
402
+ $shortcode .= ( $i != count( $tabs ) - 1 ? ',' : '' );
403
+ }
404
+ $shortcode .= '"';
405
+ } else {
406
+ $shortcode .= ' tabs="' . $tabs . '"';
407
+ }
408
+ }
409
+ if( isset( $language ) && !empty( $language ) ){
410
+ $shortcode .= ' language="' . $language . '"';
411
+ }
412
+ if( isset( $cta ) && !empty( $cta ) ){
413
+ $shortcode .= ' cta="' . $cta . '"';
414
+ }
415
+ if( isset( $small ) && !empty( $small ) ){
416
+ $shortcode .= ' small="' . $small . '"';
417
+ }
418
+ if( isset( $adapt ) && !empty( $adapt ) ){
419
+ $shortcode .= ' adapt="' . $adapt . '"';
420
+ }
421
+ if( isset( $link ) && !empty( $link ) ){
422
+ $shortcode .= ' link="' . $link . '"';
423
+ }
424
+ if( isset( $linktext ) && !empty( $linktext ) ){
425
+ $shortcode .= ' linktext="' . $linktext . '"';
426
+ }
427
+ $shortcode .= ' _implementation="widget"';
428
+ $shortcode .= ']';
429
+ echo do_shortcode( $shortcode );
430
+ }
431
+ echo $args['after_widget'];
432
+ }
433
+ public function form( $instance ) {
434
+
435
+ if ( isset( $instance[ 'title' ] ) ) {
436
+ $title = $instance[ 'title' ];
437
+ } else {
438
+ $title = __( 'New title', 'facebook-page-feed-graph-api' );
439
+ }
440
+ if ( isset( $instance[ 'href' ] ) ) {
441
+ $href = $instance[ 'href' ];
442
+ } else {
443
+ $href = '';
444
+ }
445
+ if ( isset( $instance[ 'width' ] ) ) {
446
+ $width = $instance[ 'width' ];
447
+ } else {
448
+ $width = '';
449
+ }
450
+ if ( isset( $instance[ 'height' ] ) ) {
451
+ $height = $instance[ 'height' ];
452
+ } else {
453
+ $height = '';
454
+ }
455
+ if ( isset( $instance[ 'cover' ] ) ) {
456
+ $cover = $instance[ 'cover' ];
457
+ } else {
458
+ $cover = 'false';
459
+ }
460
+ if ( isset( $instance[ 'facepile' ] ) ) {
461
+ $facepile = $instance[ 'facepile' ];
462
+ } else {
463
+ $facepile = 'false';
464
+ }
465
+ if ( isset( $instance[ 'tabs' ] ) ) {
466
+ $tabs = $instance[ 'tabs' ];
467
+ } else {
468
+ $tabs = '';
469
+ }
470
+ if ( isset( $instance[ 'cta' ] ) ) {
471
+ $cta = $instance[ 'cta' ];
472
+ } else {
473
+ $cta = 'false';
474
+ }
475
+ if ( isset( $instance[ 'small' ] ) ) {
476
+ $small = $instance[ 'small' ];
477
+ } else {
478
+ $small = 'false';
479
+ }
480
+ if ( isset( $instance[ 'adapt' ] ) ) {
481
+ $adapt = $instance[ 'adapt' ];
482
+ } else {
483
+ $adapt = 'true';
484
+ }
485
+ if ( isset( $instance[ 'link' ] ) ) {
486
+ $link = $instance[ 'link' ];
487
+ } else {
488
+ $link = 'true';
489
+ }
490
+ if ( isset( $instance[ 'linktext' ] ) ) {
491
+ $linktext = $instance[ 'linktext' ];
492
+ } else {
493
+ $linktext = '';
494
+ }
495
+ if ( isset( $instance[ 'language' ] ) ) {
496
+ $language = $instance[ 'language' ];
497
+ } else {
498
+ $language = '';
499
+ }
500
+
501
+ $langs = $this->settings->get_locale_xml();
502
+
503
+ echo cameronjonesweb_facebook_page_plugin::donate_notice();
504
+
505
+ echo '<p>';
506
+ echo '<label for="' . $this->get_field_id( 'title' ) . '">';
507
+ _e( 'Title:', 'facebook-page-feed-graph-api' );
508
+ echo '</label>';
509
+ echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . esc_attr( $title ) . '" />';
510
+ echo '</p>';
511
+ echo '<p>';
512
+ echo '<label for="' . $this->get_field_id( 'href' ) . '">';
513
+ _e( 'Page URL:', 'facebook-page-feed-graph-api' );
514
+ echo '</label>';
515
+ echo '<input class="widefat" id="' . $this->get_field_id( 'href' ) . '" name="' . $this->get_field_name( 'href' ) . '" type="url" value="' . esc_attr( $href ) . '" required />';
516
+ echo '</p>';
517
+ echo '<p>';
518
+ echo '<label for="' . $this->get_field_id( 'width' ) . '">';
519
+ _e( 'Width:', 'facebook-page-feed-graph-api' );
520
+ echo '</label>';
521
+ echo '<input class="widefat" id="' . $this->get_field_id( 'width' ) . '" name="' . $this->get_field_name( 'width' ) . '" type="number" min="180" max="500" value="' . esc_attr( $width ) . '" />';
522
+ echo '</p>';
523
+ echo '<p>';
524
+ echo '<label for="' . $this->get_field_id( 'height' ) . '">';
525
+ _e( 'Height:', 'facebook-page-feed-graph-api' );
526
+ echo '</label>';
527
+ echo '<input class="widefat" id="' . $this->get_field_id( 'height' ) . '" name="' . $this->get_field_name( 'height' ) . '" type="number" min="70" value="' . esc_attr( $height ) . '" />';
528
+ echo '</p>';
529
+ echo '<p>';
530
+ echo '<label for="' . $this->get_field_id( 'cover' ) . '">';
531
+ _e( 'Cover Photo:', 'facebook-page-feed-graph-api' );
532
+ echo '</label>';
533
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'cover' ) . '" name="' . $this->get_field_name( 'cover' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $cover ), 'true', false ) . ' />';
534
+ echo '</p>';
535
+ echo '<p>';
536
+ echo '<label for="' . $this->get_field_id( 'facepile' ) . '">';
537
+ _e( 'Show Facepile:', 'facebook-page-feed-graph-api' );
538
+ echo '</label>';
539
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'facepile' ) . '" name="' . $this->get_field_name( 'facepile' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $facepile ), 'true', false ) . ' />';
540
+ echo '</p>';
541
+ echo '<p>';
542
+ _e( 'Page Tabs:', 'facebook-page-feed-graph-api' );
543
+ $CJW_FBPP_TABS = $this->settings->tabs();
544
+ if( !empty( $CJW_FBPP_TABS ) ) {
545
+ // First we should convert the string to an array as that's how it will be stored moving forward.
546
+ if( !is_array( $tabs ) ) {
547
+ $oldtabs = esc_attr( $tabs );
548
+ $newtabs = explode( ',', $tabs );
549
+ $tabs = $newtabs;
550
+ }
551
+ foreach( $CJW_FBPP_TABS as $tab ) {
552
+ echo '<br/><label>';
553
+ echo '<input type="checkbox" name="' . $this->get_field_name( 'tabs' ) . '[' . $tab . ']" ' . ( in_array( $tab, $tabs ) ? 'checked' : '' ) . ' /> ';
554
+ _e( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
555
+ echo '</label>';
556
+ }
557
+ }
558
+ echo '</p>';
559
+ echo '<p>';
560
+ echo '<label for="' . $this->get_field_id( 'cta' ) . '">';
561
+ _e( 'Hide Call To Action:', 'facebook-page-feed-graph-api' );
562
+ echo '</label>';
563
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'cta' ) . '" name="' . $this->get_field_name( 'cta' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $cta ), 'true', false ) . ' />';
564
+ echo '</p>';
565
+ echo '<p>';
566
+ echo '<label for="' . $this->get_field_id( 'small' ) . '">';
567
+ _e( 'Small Header:', 'facebook-page-feed-graph-api' );
568
+ echo '</label>';
569
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'small' ) . '" name="' . $this->get_field_name( 'small' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $small ), 'true', false ) . ' />';
570
+ echo '</p>';
571
+ echo '<p>';
572
+ echo '<label for="' . $this->get_field_id( 'adapt' ) . '">';
573
+ _e( 'Adaptive Width:', 'facebook-page-feed-graph-api' );
574
+ echo '</label>';
575
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'adapt' ) . '" name="' . $this->get_field_name( 'adapt' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $adapt ), 'true', false ) . ' />';
576
+ echo '</p>';
577
+ echo '<p>';
578
+ echo '<label for="' . $this->get_field_id( 'link' ) . '">';
579
+ _e( 'Display link while loading:', 'facebook-page-feed-graph-api' );
580
+ echo '</label>';
581
+ echo ' <input class="widefat" id="' . $this->get_field_id( 'link' ) . '" name="' . $this->get_field_name( 'link' ) . '" type="checkbox" value="true" ' . checked( esc_attr( $link ), 'true', false ) . ' />';
582
+ echo '</p>';
583
+ echo '<p>';
584
+ echo '<label for="' . $this->get_field_id( 'linktext' ) . '">';
585
+ _e( 'Link text:', 'facebook-page-feed-graph-api' );
586
+ echo '</label>';
587
+ echo '<input class="widefat" id="' . $this->get_field_id( 'linktext' ) . '" name="' . $this->get_field_name( 'linktext' ) . '" type="text" value="' . esc_attr( $linktext ) . '" />';
588
+ echo '</p>';
589
+ echo '<p>';
590
+ echo '<label for="' . $this->get_field_id( 'language' ) . '">';
591
+ _e( 'Language:', 'facebook-page-feed-graph-api' );
592
+ echo '</label>';
593
+ echo '<select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';
594
+ echo '<option value="">' . __( 'Site Language (default)', 'facebook-page-feed-graph-api' ) . '</option>';
595
+ if(isset($langs) && !empty($langs)){
596
+ foreach($langs as $lang){
597
+ //echo '<option value="' . $lang->codes->code->standard->representation . '"' . selected( esc_attr( $language ), $lang->codes->code->standard->representation, false ) . '>' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>'; // Facebook only
598
+ echo '<option value="' . $lang->standard->representation . '"' . selected( esc_attr( $language ), $lang->standard->representation, false ) . '>' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
599
+ }
600
+ }
601
+ echo '</select>';
602
+ echo '</p>';
603
+ }
604
+
605
+ // Updating widget replacing old instances with new
606
+ public function update( $new_instance, $old_instance ) {
607
+ $instance = array();
608
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
609
+ $instance['href'] = ( ! empty( $new_instance['href'] ) ) ? strip_tags( $new_instance['href'] ) : '';
610
+ $instance['width'] = ( ! empty( $new_instance['width'] ) ) ? strip_tags( $new_instance['width'] ) : '';
611
+ $instance['height'] = ( ! empty( $new_instance['height'] ) ) ? strip_tags( $new_instance['height'] ) : '';
612
+ $instance['cover'] = ( ! empty( $new_instance['cover'] ) ) ? strip_tags( $new_instance['cover'] ) : '';
613
+ $instance['facepile'] = ( ! empty( $new_instance['facepile'] ) ) ? strip_tags( $new_instance['facepile'] ) : '';
614
+ if( !empty( $new_instance['tabs'] ) ) {
615
+ if( is_array( $new_instance['tabs'] ) ) {
616
+ foreach( $new_instance['tabs'] as $key => $var ) {
617
+ $instance['tabs'][] = sanitize_text_field( $key );
618
+ }
619
+ }
620
+ } else {
621
+ $instance['tabs'] = '';
622
+ }
623
+ $instance['cta'] = ( ! empty( $new_instance['cta'] ) ) ? strip_tags( $new_instance['cta'] ) : '';
624
+ $instance['small'] = ( ! empty( $new_instance['small'] ) ) ? strip_tags( $new_instance['small'] ) : '';
625
+ $instance['adapt'] = ( ! empty( $new_instance['adapt'] ) ) ? strip_tags( $new_instance['adapt'] ) : '';
626
+ $instance['link'] = ( ! empty( $new_instance['link'] ) ) ? strip_tags( $new_instance['link'] ) : '';
627
+ $instance['linktext'] = ( ! empty( $new_instance['linktext'] ) ) ? strip_tags( $new_instance['linktext'] ) : '';
628
+ $instance['language'] = ( ! empty( $new_instance['language'] ) ) ? strip_tags( $new_instance['language'] ) : '';
629
+ return $instance;
630
+ }
631
+
632
+ }
633
+
634
+ class cameronjonesweb_facebook_page_plugin_shortcode_generator {
635
+
636
+ private $langs;
637
+ private $settings;
638
+
639
+ function __construct() {
640
+
641
+ $this->settings = new facebook_page_plugin_settings;
642
+ $this->langs = $this->settings->get_locale_xml();
643
+ }
644
+
645
+ function generate() {
646
+
647
+ $return = NULL;
648
+
649
+ $return .= cameronjonesweb_facebook_page_plugin::donate_notice();
650
+
651
+ $return .= '<noscript>' . __( 'The shortcode generator requires JavaScript enabled', 'facebook-page-feed-graph-api' ) . '</noscript>';
652
+
653
+ $return .= '<form>';
654
+ $return .= '<p><label>' . __( 'Facebook Page URL', 'facebook-page-feed-graph-api' ) . ': <input type="url" id="fbpp-href" /></label></p>';
655
+ $return .= '<p><label>' . __( 'Width (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" max="500" min="180" id="fbpp-width" /></label></p>';
656
+ $return .= '<p><label>' . __( 'Height (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" min="70" id="fbpp-height" /></label></p>';
657
+ $return .= '<p><label>' . __( 'Show Cover Photo', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cover" /></label></p>';
658
+ $return .= '<p><label>' . __( 'Show Facepile', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
659
+ $return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ':';
660
+ $settings = new facebook_page_plugin_settings;
661
+ $CJW_FBPP_TABS = $settings->tabs();
662
+ if( !empty( $CJW_FBPP_TABS ) ) {
663
+ foreach( $CJW_FBPP_TABS as $tab ) {
664
+ $return .= '<br/><label>';
665
+ $return .= '<input type="checkbox" class="fbpp-tabs" name="' . $tab . '" /> ';
666
+ $return .= __( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
667
+ $return .= '</label>';
668
+ }
669
+ }
670
+ $return .= '<p><label>' . __( 'Hide Call To Action', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cta" /></label></p>';
671
+ $return .= '<p><label>' . __( 'Small Header', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-small" /></label></p>';
672
+ $return .= '<p><label>' . __( 'Adaptive Width', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-adapt" checked /></label></p>';
673
+ $return .= '<p><label>' . __( 'Display link while loading', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-link" checked /></label></p>';
674
+ $return .= '<p id="linktext-label"><label>' . __( 'Link text', 'facebook-page-feed-graph-api' ) . ': <input type="text" id="fbpp-linktext" /></label></p>';
675
+ $return .= '<p><label>' . __( 'Language', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-lang"><option value="">' . __( 'Site Language', 'facebook-page-feed-graph-api' ) . '</option>';
676
+ if(isset($this->langs) && !empty($this->langs)){
677
+ foreach($this->langs as $lang){
678
+ $return .= '<option value="' . $lang->standard->representation . '">' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
679
+ }
680
+ }
681
+ $return .= '</select></label></p>';
682
+ $return .= '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
683
+ $return .= '</form>';
684
+
685
+ echo $return;
686
+ }
687
+
688
+ }
689
+
690
+ class facebook_page_plugin_settings {
691
+
692
+ public $tabs;
693
+
694
+ function __construct() {
695
+ $this->tabs = array( 'timeline', 'events', 'messages' );
696
+ }
697
+
698
+ function tabs() {
699
+ return $this->tabs;
700
+ }
701
+
702
+ function get_locale_xml() {
703
+
704
+ $admin_abspath = str_replace( site_url(), ABSPATH, admin_url() );
705
+
706
+ include_once( $admin_abspath . '/includes/class-wp-filesystem-base.php' );
707
+ include_once( $admin_abspath . '/includes/class-wp-filesystem-direct.php' );
708
+ $wp_filesystem = new WP_Filesystem_Direct( null );
709
+
710
+ try {
711
+ //$xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
712
+ //$xml = file_get_contents( CJW_FBPP_PLUGIN_URL ) . 'lang.xml');
713
+ $lang_xml = $wp_filesystem->get_contents( CJW_FBPP_PLUGIN_DIR . '/lang.xml');
714
+ } catch( Exception $ex ){
715
+ $lang_xml = NULL;
716
+ }
717
+
718
+ if(isset($lang_xml) && !empty($lang_xml)){
719
+ $langs = new SimpleXMLElement($lang_xml);
720
+ } else {
721
+ $langs = NULL;
722
+ }
723
+
724
+ return $langs;
725
+ }
726
+
727
+ }
728
+
729
+ // Register the widget.
730
+ function facebook_page_plugin_load_widget() {
731
+ register_widget( 'cameronjonesweb_facebook_page_plugin_widget' );
732
+ }
733
+ add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
734
+
735
+ $cameronjonesweb_facebook_page_plugin = new cameronjonesweb_facebook_page_plugin();
faq.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "faqs": [
3
+ {
4
+ "question": "The plugin is blank or only displays a link",
5
+ "answer": "It is likely one of two issues, your page has audience restrictions or you're using an ad-blocker or similar browser extension that is blocking it. If your Facebook page has audience restrictions for age and/or location, the plugin will not display. If you want the plugin to display, make sure any audience restrictions are disabled in your page settings on Facebook, and turn off your ad-blocker or whitelist your website."
6
+ },
7
+ {
8
+ "question": "Where is the settings page?",
9
+ "answer": "There is no settings page for the Facebook Page Plugin. To add the plugin to a widget area, go to your <a href='widgets.php'>widgets</a> page, select Facebook Page Plugin from the list of available widgets, add it to your desired widget area and fill out the form. If you wish to use the plugin in a post or page, go to your <a href='index.php#cameronjonesweb_facebook_page_plugin_shortcode_generator'>dashboard</a> and fill out the shortcode generator. Copy the shortcode result and paste it into your post or page editor."
10
+ },
11
+ {
12
+ "question": "The Facepile and/or posts aren't showing up",
13
+ "answer": "The chances are that they are loading, but your plugin isn't tall enough to display them. Make sure they're enabled properly and try increasing the height of the plugin to 500px and see if they are displaying."
14
+ },
15
+ {
16
+ "question": "It's still broken, where do I get help?",
17
+ "answer": "You can go to <a href='https://wordpress.org/support/plugin/facebook-page-feed-graph-api' target='_blank'>https://wordpress.org/support/plugin/facebook-page-feed-graph-api</a> and create a support ticket on WordPress.org, or you can email the developer at <a href='mailto:plugins@cameronjonesweb.com.au' target='_blank'>plugins@cameronjonesweb.com.au</a>. Please provide your website URL if possible and any console log errors."
18
+ }
19
+ ],
20
+
21
+ "changelog": [
22
+ {
23
+ "version": "1.5.3",
24
+ "changes": [
25
+ "Fixed bug where share button would return \"App Not Setup\" error"
26
+ ]
27
+ },
28
+ {
29
+ "version": "1.6",
30
+ "changes": [
31
+ "Tabs are now checkboxes and the events tab is now available",
32
+ "New landing page to provide help new users"
33
+ ]
34
+ },
35
+ {
36
+ "version": "1.6.1",
37
+ "changes": [
38
+ "Adding text domain header",
39
+ "Adding implementation indicator for debugging"
40
+ ]
41
+ },
42
+ {
43
+ "version": "1.6.2",
44
+ "changes": [
45
+ "Changes minimum WordPress version to 4.6 for translations",
46
+ "Tested for WordPress 4.9 'Tipton'",
47
+ "Fixed bug with setting the language in the shortcode generator",
48
+ "Increased accuracy of URL detection in the widget form"
49
+ ]
50
+ },
51
+ {
52
+ "version": "1.6.3",
53
+ "changes": [
54
+ "Improved string translations",
55
+ "Updated Graph API from v2.5 to v2.12",
56
+ "Fail gracefully when SimpleXML isn't installed",
57
+ "Fixed changelog link",
58
+ "Updated the plugin display name to avoid potential trademark issues"
59
+ ]
60
+ },
61
+ {
62
+ "version": "1.7.0",
63
+ "changes": [
64
+ "Rebranded under the Mongoose Marketplace umbrella",
65
+ "Updated RSS feed",
66
+ "Fixed conflict with Elementor page builder"
67
+ ]
68
+ }
69
+ ]
70
+ }
images/banner-1544x500.png DELETED
Binary file
images/banner-772x250.jpg ADDED
Binary file
images/banner-border.png DELETED
Binary file
inc/index.php DELETED
File without changes
inc/landing-page.php CHANGED
@@ -1,140 +1,133 @@
1
- <?php
2
- defined( 'ABSPATH' ) or die();
3
  $currentuser = wp_get_current_user();
4
- if ( ! function_exists( 'plugins_api' ) ) {
5
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
6
- }
7
- $plugin_data = plugins_api(
8
- 'plugin_information',
9
- [
10
- 'slug' => 'facebook-page-feed-graph-api',
11
- 'fields' => [ 'sections' ],
12
- ]
13
- );
14
- ?>
15
- <div class="wrap mongoose-facebook-page-plugin">
16
- <h1 class="notices-placeholder"></h1>
17
- <div class="mongoose-facebook-page-plugin__banner">
18
- <img src="<?php echo esc_url( trailingslashit( CJW_FBPP_PLUGIN_URL ) ); ?>images/banner-1544x500.png" />
19
- </div>
20
- <div class="mongoose-facebook-page-plugin__box">
21
- <?php
22
- printf(
23
- '<h1 class="page-title">%1$s</h1>',
24
- esc_html( get_admin_page_title() )
25
- );
26
- ?>
27
- <p class="about-description"><?php esc_html_e( 'Thank you for downloading the Mongoose Page Plugin by Mongoose Marketplace! You\'ve joined more than 30,000 other WordPress websites using this plugin to display a Facebook Page on their site. To help introduce you to the plugin, I\'ve created this page full of useful information. Please enjoy using my Mongoose Page Plugin and let me know how it works for you!', 'facebook-page-feed-graph-api' ); ?></p>
28
  </div>
29
  <div id="dashboard-widgets-wrap">
30
  <div id="dashboard-widgets" class="metabox-holder columns-2">
31
  <div id="postbox-container-1" class="postbox-container">
32
  <div class="meta-box-sortables">
33
- <div class="postbox mongoose-facebook-page-plugin__box">
34
  <div class="main inside">
35
- <h2><?php esc_html_e( 'FAQs', 'facebook-page-feed-graph-api' ); ?></h2>
36
- <?php
37
- if ( ! empty( $plugin_data ) && ! is_wp_error( $plugin_data ) && isset( $plugin_data->sections['faq'] ) ) {
38
- $faqs = $plugin_data->sections['faq'];
39
- echo wp_kses_post( $faqs );
 
 
 
 
 
 
 
 
 
40
  } else {
41
- esc_html_e( 'There was a problem retrieving the FAQs.', 'facebook-page-feed-graph-api' );
42
- }
43
- ?>
44
  </div>
45
  </div>
46
  </div>
47
  <div class="meta-box-sortables">
48
- <div class="postbox mongoose-facebook-page-plugin__box">
49
  <div class="main inside">
50
- <h2><?php esc_html_e( 'Changelog', 'facebook-page-feed-graph-api' ); ?></h2>
51
- <h3>
52
- <?php
53
- printf(
54
- /* translators: 1. version number */
55
- esc_html__( 'New in version %1$s', 'facebook-page-feed-graph-api' ),
56
- esc_html( CJW_FBPP_PLUGIN_VER )
57
- );
58
- ?>
59
- </h3>
60
- <?php
61
- if ( ! empty( $plugin_data ) && ! is_wp_error( $plugin_data ) && isset( $plugin_data->sections['changelog'] ) ) {
62
- $changelog = explode( '</ul>', $plugin_data->sections['changelog'] );
63
- if ( ! empty( $changelog ) ) {
64
- $changes = explode( '</h4>', $changelog[0] );
65
- echo wp_kses_post( $changes[1] );
66
- echo '</ul>';
 
 
 
 
 
67
  }
68
- }
69
- printf(
70
- '<p><a href="https://wordpress.org/plugins/facebook-page-feed-graph-api/#developers" target="_blank" rel="noopener noreferrer">%1$s</a></p>',
71
- esc_html__( 'View full changelog', 'facebook-page-feed-graph-api' )
72
- );
73
- ?>
74
  </div>
75
  </div>
76
  </div>
77
  </div>
78
  <div id="postbox-container-2" class="postbox-container">
79
  <div class="meta-box-sortables">
80
- <div class="postbox mongoose-facebook-page-plugin__box">
81
  <div class="main inside">
82
  <h3><i class="dashicons dashicons-heart"></i> <?php _e( 'Donate', 'facebook-page-feed-graph-api' ); ?></h3>
83
  <p><?php printf(
84
- __( 'Development relies on donations from kind-hearted supporters of the Mongoose Page Plugin. If you\'re enjoying the plugin, <a href="%1$s" target="_blank" rel="noopener noreferrer">please donate today</a>.', 'facebook-page-feed-graph-api' ),
85
  CJW_FBPP_PLUGIN_DONATE_LINK
86
  ); ?></p>
87
  </div>
88
  </div>
89
- <div class="postbox mongoose-facebook-page-plugin__box">
90
  <div class="main inside">
91
  <h3><i class="dashicons dashicons-email-alt"></i> <?php _e( 'Plugin Newsletter', 'facebook-page-feed-graph-api' ); ?></h3>
92
- <p><?php _e( 'Subscribe today to receive the latest updates for the Mongoose Page Plugin', 'facebook-page-feed-graph-api' ); ?></p>
93
  <!-- Begin MailChimp Signup Form -->
94
  <div id="mc_embed_signup">
95
  <form action="//cameronjonesweb.us10.list-manage.com/subscribe/post?u=507cd0221f4894316c903e99b&amp;id=8d3d7b8378" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
96
- <div id="mc_embed_signup_scroll">
97
- <input type="email" value="<?php echo esc_attr( $currentuser->user_email ); ?>" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
98
- <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
99
- <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_507cd0221f4894316c903e99b_8d3d7b8378" tabindex="-1" value=""></div>
100
- <input type="submit" value="<?php esc_attr_e( 'Subscribe', 'facebook-page-feed-graph-api' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button">
101
- <div class="clear"></div>
102
- </div>
103
  </form>
104
  </div>
105
  <!--End mc_embed_signup-->
106
  </div>
107
  </div>
108
- <div class="postbox mongoose-facebook-page-plugin__box">
109
  <div class="main inside">
110
- <h3><i class="dashicons dashicons-star-filled"></i> <?php esc_html_e( 'Leave A Review', 'facebook-page-feed-graph-api' ); ?></h3>
111
- <p>
112
- <?php printf(
113
- '%1$s <a href="https://wordpress.org/support/view/plugin-reviews/facebook-page-feed-graph-api#new-post" target="_blank" rel="noopener noreferrer">%2$s</a>!</p>',
114
- esc_html__( 'Is this the best plugin for adding a Facebook Page to your WordPress website?', 'facebook-page-feed-graph-api' ),
115
- esc_html__( 'Let me know', 'facebook-page-feed-graph-api' )
116
- ); ?>
117
- </p>
118
- <p>
119
- <?php printf(
120
  __( 'If there\'s a problem, please open a support ticket on <a href="%1$s" target="_blank" rel="noopener noreferrer">Github</a>, on <a href="%2$s" target="_blank" rel="noopener noreferrer">WordPress.org</a>, or <a href="%3$s" target="_blank" rel="noopener noreferrer">email me</a>.', 'facebook-page-feed-graph-api' ),
121
- 'https://github.com/cameronjonesweb/facebook-page-feed-graph-api/issues',
122
- 'https://wordpress.org/support/plugin/facebook-page-feed-graph-api',
123
- 'mailto:support@mongoosemarketplace.com'
124
- ); ?>
125
- </p>
126
  </div>
127
  </div>
128
- <div class="postbox mongoose-facebook-page-plugin__box">
129
  <div class="main inside">
130
- <h3><i class="dashicons dashicons-chart-line"></i> <?php esc_html_e( 'Take The Survey', 'facebook-page-feed-graph-api' ); ?></h3>
131
- <p><?php esc_html_e( 'Want to have your say about the Mongoose Page Plugin?', 'facebook-page-feed-graph-api' ); ?></p>
132
- <p><a href="<?php echo CJW_FBPP_PLUGIN_SURVEY_LINK; ?>" class="button" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Take The Survey!', 'facebook-page-feed-graph-api' ); ?></a></p>
133
  </div>
134
  </div>
135
- <div class="postbox mongoose-facebook-page-plugin__box">
136
  <div class="main inside">
137
- <h3><i class="dashicons dashicons-testimonial"></i> <?php esc_html_e( 'Latest News From The Developer', 'facebook-page-feed-graph-api' ); ?></h3>
138
  <div id="blog-posts-target">
139
  <span class="spinner is-active"></span>
140
  </div>
@@ -144,4 +137,4 @@ $plugin_data = plugins_api(
144
  </div>
145
  </div>
146
  </div>
147
- </div>
1
+ <?php defined( 'ABSPATH' ) or die();
 
2
  $currentuser = wp_get_current_user();
3
+ $internet = $this->facebook_page_plugin_is_connected(); ?>
4
+ <div class="wrap">
5
+
6
+ <?php printf(
7
+ '<h1>%1$s</h1>',
8
+ __( 'Facebook Page Plugin', 'facebook-page-feed-graph-api' )
9
+ ); ?>
10
+
11
+ <div class="welcome-panel">
12
+ <div class="welcome-panel-content">
13
+ <img src="<?php echo CJW_FBPP_PLUGIN_URL; ?>/images/banner-772x250.jpg" class="welcome-panel-image">
14
+ <p class="about-description"><?php _e( 'Thank you for downloading the Facebook Page Plugin by cameronjonesweb! You\'ve joined more than 30,000 other WordPress websites using this plugin to display a Facebook Page on their site. To help introduce you to the plugin, I\'ve created this page full of useful information. Please enjoy using my Facebook Page Plugin and let me know how it works for you!', 'facebook-page-feed-graph-api' ); ?></p>
15
+ </div>
 
 
 
 
 
 
 
 
 
 
 
16
  </div>
17
  <div id="dashboard-widgets-wrap">
18
  <div id="dashboard-widgets" class="metabox-holder columns-2">
19
  <div id="postbox-container-1" class="postbox-container">
20
  <div class="meta-box-sortables">
21
+ <div class="postbox">
22
  <div class="main inside">
23
+ <h2><abbr title="<?php _e( 'Frequently Asked Questions', 'facebook-page-feed-graph-api' ); ?>"><?php _e( 'FAQs', 'facebook-page-feed-graph-api' ); ?></abbr></h2>
24
+ <?php $file = CJW_FBPP_PLUGIN_DIR . '/faq.json';
25
+ $json = file_get_contents( $file );
26
+ $faq_obj = json_decode( $json );
27
+ if( !empty( $faq_obj->faqs ) ) {
28
+ echo '<ul>';
29
+ foreach( $faq_obj->faqs as $faq ) {
30
+ printf(
31
+ '<li><strong>%1$s</strong><p>%2$s</p></li>',
32
+ $faq->question,
33
+ $faq->answer
34
+ );
35
+ }
36
+ echo '</ul>';
37
  } else {
38
+ _e( 'There was a problem retrieving the FAQs.', 'facebook-page-feed-graph-api' );
39
+ } ?>
 
40
  </div>
41
  </div>
42
  </div>
43
  <div class="meta-box-sortables">
44
+ <div class="postbox">
45
  <div class="main inside">
46
+ <h2><?php _e( 'Changelog', 'facebook-page-feed-graph-api' ); ?></h2>
47
+ <h3><?php printf(
48
+ __( 'New in version %1$s', 'facebook-page-feed-graph-api' ),
49
+ CJW_FBPP_PLUGIN_VER
50
+ ); ?></h3>
51
+
52
+ <?php if( !empty( $faq_obj->changelog ) ) {
53
+ foreach( $faq_obj->changelog as $version ) {
54
+ if( $version->version == CJW_FBPP_PLUGIN_VER ) {
55
+ echo '<ul>';
56
+ foreach( $version->changes as $change ) {
57
+ printf(
58
+ '<li>%1$s</li>',
59
+ $change
60
+ );
61
+ }
62
+ echo '</ul>';
63
+ printf(
64
+ '<a href="https://wordpress.org/plugins/facebook-page-feed-graph-api/#developers" target="_blank" rel="noopener noreferrer">%1$s</a>',
65
+ __( 'View full changelog', 'facebook-page-feed-graph-api' )
66
+ );
67
+ }
68
  }
69
+ } ?>
 
 
 
 
 
70
  </div>
71
  </div>
72
  </div>
73
  </div>
74
  <div id="postbox-container-2" class="postbox-container">
75
  <div class="meta-box-sortables">
76
+ <div class="postbox">
77
  <div class="main inside">
78
  <h3><i class="dashicons dashicons-heart"></i> <?php _e( 'Donate', 'facebook-page-feed-graph-api' ); ?></h3>
79
  <p><?php printf(
80
+ __( 'Development relies on donations from kind-hearted supporters of the Facebook Page Plugin. If you\'re enjoying the plugin, <a href="%1$s" target="_blank" rel="noopener noreferrer">please donate today</a>.', 'facebook-page-feed-graph-api' ),
81
  CJW_FBPP_PLUGIN_DONATE_LINK
82
  ); ?></p>
83
  </div>
84
  </div>
85
+ <div class="postbox">
86
  <div class="main inside">
87
  <h3><i class="dashicons dashicons-email-alt"></i> <?php _e( 'Plugin Newsletter', 'facebook-page-feed-graph-api' ); ?></h3>
88
+ <p><?php _e( 'Subscribe today to receive the latest updates for the Facebook Page Plugin', 'facebook-page-feed-graph-api' ); ?></p>
89
  <!-- Begin MailChimp Signup Form -->
90
  <div id="mc_embed_signup">
91
  <form action="//cameronjonesweb.us10.list-manage.com/subscribe/post?u=507cd0221f4894316c903e99b&amp;id=8d3d7b8378" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
92
+ <div id="mc_embed_signup_scroll">
93
+ <input type="email" value="<?php echo $currentuser->user_email; ?>" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
94
+ <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
95
+ <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_507cd0221f4894316c903e99b_8d3d7b8378" tabindex="-1" value=""></div>
96
+ <input type="submit" value="<?php _e( 'Subscribe', 'facebook-page-feed-graph-api' ); ?>" name="subscribe" id="mc-embedded-subscribe" class="button">
97
+ <div class="clear"></div>
98
+ </div>
99
  </form>
100
  </div>
101
  <!--End mc_embed_signup-->
102
  </div>
103
  </div>
104
+ <div class="postbox">
105
  <div class="main inside">
106
+ <h3><i class="dashicons dashicons-star-filled"></i> <?php _e( 'Leave A Review', 'facebook-page-feed-graph-api' ); ?></h3>
107
+ <p><?php printf(
108
+ '%1$s <a href="https://wordpress.org/support/view/plugin-reviews/facebook-page-feed-graph-api#new-post" target="_blank" rel="noopener noreferrer">%2$s</a>!</p>',
109
+ __( 'Is this the best plugin for adding a Facebook Page to your WordPress website?', 'facebook-page-feed-graph-api' ),
110
+ __( 'Let me know', 'facebook-page-feed-graph-api' )
111
+ ); ?></p>
112
+ <p><?php printf(
 
 
 
113
  __( 'If there\'s a problem, please open a support ticket on <a href="%1$s" target="_blank" rel="noopener noreferrer">Github</a>, on <a href="%2$s" target="_blank" rel="noopener noreferrer">WordPress.org</a>, or <a href="%3$s" target="_blank" rel="noopener noreferrer">email me</a>.', 'facebook-page-feed-graph-api' ),
114
+ 'https://github.com/cameronjonesweb/facebook-page-feed-graph-api/issues',
115
+ 'https://wordpress.org/support/plugin/facebook-page-feed-graph-api',
116
+ 'mailto:plugins@cameronjonesweb.com.au'
117
+
118
+ ); ?></p>
119
  </div>
120
  </div>
121
+ <div class="postbox">
122
  <div class="main inside">
123
+ <h3><i class="dashicons dashicons-chart-line"></i> <?php _e( 'Take The Survey', 'facebook-page-feed-graph-api' ); ?></h3>
124
+ <p><?php _e( 'Want to have your say about the Facebook Page Plugin?', 'facebook-page-feed-graph-api' ); ?></p>
125
+ <p><a href="<?php echo CJW_FBPP_PLUGIN_SURVEY_LINK; ?>" class="button" target="_blank" rel="noopener noreferrer"><?php _e( 'Take The Survey!', 'facebook-page-feed-graph-api' ); ?></a></p>
126
  </div>
127
  </div>
128
+ <div class="postbox">
129
  <div class="main inside">
130
+ <h3><i class="dashicons dashicons-testimonial"></i> <?php _e( 'Latest News From The Developer', 'facebook-page-feed-graph-api' ); ?></h3>
131
  <div id="blog-posts-target">
132
  <span class="spinner is-active"></span>
133
  </div>
137
  </div>
138
  </div>
139
  </div>
140
+ </div>
js/{admin-global.js → facebook-page-plugin-admin.js} RENAMED
@@ -1,109 +1,109 @@
1
- (function($){
2
-
3
- $(document).ready(function(){
4
-
5
- $('#facebook-page-plugin-shortcode-generator form').submit(function(e){
6
-
7
- e.preventDefault();
8
-
9
- });
10
-
11
- var $facebookURLs = ['https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/'];
12
- $('#facebook-page-plugin-shortcode-generator input, #facebook-page-plugin-shortcode-generator select').change(function(){
13
- if( $('#fbpp-link').prop("checked") == false ) {
14
- $('#linktext-label').hide();
15
- } else {
16
- $('#linktext-label').show();
17
- }
18
- var $shortcode = '';
19
- $shortcode += '[facebook-page-plugin ';
20
- var $href = $('#fbpp-href').val();
21
- for(i = 0; i < $facebookURLs.length; i++) {
22
- $href = $href.replace($facebookURLs[i],'');
23
- }
24
- if($href.length > 0){
25
- $shortcode += 'href="' + $href + '" ';
26
- var $width = $('#fbpp-width').val();
27
- if($width.length > 0){
28
- $shortcode += 'width="' + $width + '" ';
29
- }
30
- var $height = $('#fbpp-height').val();
31
- if($height.length > 0){
32
- $shortcode += 'height="' + $height + '" ';
33
- }
34
- var $cover = $('#fbpp-cover').prop("checked");
35
- $shortcode += 'cover="' + $cover + '" ';
36
- var $facepile = $('#fbpp-facepile').prop("checked");
37
- $shortcode += 'facepile="' + $facepile + '" ';
38
- var $tabs = [];
39
- $('.fbpp-tabs').each(function(){
40
- if( $(this).prop('checked') == true ) {
41
- $tabs.push( $(this).attr('name' ) );
42
- }
43
- });
44
- if($tabs.length > 0){
45
- var $tabstring = '';
46
- for( $i = 0; $i < $tabs.length; $i++ ) {
47
- $tabstring += $tabs[$i];
48
- if( $i != $tabs.length - 1 ) {
49
- $tabstring += ','
50
- }
51
- }
52
- $shortcode += 'tabs="' + $tabstring + '" ';
53
- }
54
- var $cta = $('#fbpp-cta').prop("checked");
55
- $shortcode += 'cta="' + $cta + '" ';
56
- var $small = $('#fbpp-small').prop("checked");
57
- $shortcode += 'small="' + $small + '" ';
58
- var $adapt = $('#fbpp-adapt').prop("checked");
59
- $shortcode += 'adapt="' + $adapt + '" ';
60
- var $link = $('#fbpp-link').prop("checked");
61
- $shortcode += 'link="' + $link + '" ';
62
- if( $link == true ) {
63
- var $linktext = $('#fbpp-linktext').val();
64
- $shortcode += 'linktext="' + $linktext + '" ';
65
- }
66
- var $lang = $('#fbpp-lang').val();
67
- if($lang.length > 0){
68
- $shortcode += 'language="' + $lang + '" ';
69
- }
70
- $shortcode += ']';
71
- $('#facebook-page-plugin-shortcode-generator-output').val($shortcode);
72
-
73
- }
74
-
75
- });
76
-
77
- jQuery( document ).on( 'click', '.facebook-page-plugin-donate-notice-dismiss', function(e){
78
-
79
- e.preventDefault();
80
-
81
- var $notice = jQuery(this).parents('.facebook-page-plugin-donate');
82
-
83
- jQuery.ajax({
84
-
85
- type: "POST",
86
- url: ajaxurl,
87
- data: {
88
-
89
- action: 'facebook_page_plugin_remove_donate_notice',
90
-
91
- },
92
- success: function() {
93
-
94
- $notice.fadeOut();
95
-
96
- },
97
- error: function( data ) {
98
-
99
- console.log( data );
100
-
101
- }
102
-
103
- });
104
-
105
- });
106
-
107
- });
108
-
109
  }(jQuery));
1
+ (function($){
2
+
3
+ $(document).ready(function(){
4
+
5
+ $('#facebook-page-plugin-shortcode-generator form').submit(function(e){
6
+
7
+ e.preventDefault();
8
+
9
+ });
10
+
11
+ var $facebookURLs = ['https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/'];
12
+ $('#facebook-page-plugin-shortcode-generator input, #facebook-page-plugin-shortcode-generator select').change(function(){
13
+ if( $('#fbpp-link').prop("checked") == false ) {
14
+ $('#linktext-label').hide();
15
+ } else {
16
+ $('#linktext-label').show();
17
+ }
18
+ var $shortcode = '';
19
+ $shortcode += '[facebook-page-plugin ';
20
+ var $href = $('#fbpp-href').val();
21
+ for(i = 0; i < $facebookURLs.length; i++) {
22
+ $href = $href.replace($facebookURLs[i],'');
23
+ }
24
+ if($href.length > 0){
25
+ $shortcode += 'href="' + $href + '" ';
26
+ var $width = $('#fbpp-width').val();
27
+ if($width.length > 0){
28
+ $shortcode += 'width="' + $width + '" ';
29
+ }
30
+ var $height = $('#fbpp-height').val();
31
+ if($height.length > 0){
32
+ $shortcode += 'height="' + $height + '" ';
33
+ }
34
+ var $cover = $('#fbpp-cover').prop("checked");
35
+ $shortcode += 'cover="' + $cover + '" ';
36
+ var $facepile = $('#fbpp-facepile').prop("checked");
37
+ $shortcode += 'facepile="' + $facepile + '" ';
38
+ var $tabs = [];
39
+ $('.fbpp-tabs').each(function(){
40
+ if( $(this).prop('checked') == true ) {
41
+ $tabs.push( $(this).attr('name' ) );
42
+ }
43
+ });
44
+ if($tabs.length > 0){
45
+ var $tabstring = '';
46
+ for( $i = 0; $i < $tabs.length; $i++ ) {
47
+ $tabstring += $tabs[$i];
48
+ if( $i != $tabs.length - 1 ) {
49
+ $tabstring += ','
50
+ }
51
+ }
52
+ $shortcode += 'tabs="' + $tabstring + '" ';
53
+ }
54
+ var $cta = $('#fbpp-cta').prop("checked");
55
+ $shortcode += 'cta="' + $cta + '" ';
56
+ var $small = $('#fbpp-small').prop("checked");
57
+ $shortcode += 'small="' + $small + '" ';
58
+ var $adapt = $('#fbpp-adapt').prop("checked");
59
+ $shortcode += 'adapt="' + $adapt + '" ';
60
+ var $link = $('#fbpp-link').prop("checked");
61
+ $shortcode += 'link="' + $link + '" ';
62
+ if( $link == true ) {
63
+ var $linktext = $('#fbpp-linktext').val();
64
+ $shortcode += 'linktext="' + $linktext + '" ';
65
+ }
66
+ var $lang = $('#fbpp-lang').val();
67
+ if($lang.length > 0){
68
+ $shortcode += 'language="' + $lang + '" ';
69
+ }
70
+ $shortcode += ']';
71
+ $('#facebook-page-plugin-shortcode-generator-output').val($shortcode);
72
+
73
+ }
74
+
75
+ });
76
+
77
+ jQuery( document ).on( 'click', '.facebook-page-plugin-donate-notice-dismiss', function(e){
78
+
79
+ e.preventDefault();
80
+
81
+ var $notice = jQuery(this).parents('.facebook-page-plugin-donate');
82
+
83
+ jQuery.ajax({
84
+
85
+ type: "POST",
86
+ url: ajaxurl,
87
+ data: {
88
+
89
+ action: 'facebook_page_plugin_remove_donate_notice',
90
+
91
+ },
92
+ success: function() {
93
+
94
+ $notice.fadeOut();
95
+
96
+ },
97
+ error: function( data ) {
98
+
99
+ console.log( data );
100
+
101
+ }
102
+
103
+ });
104
+
105
+ });
106
+
107
+ });
108
+
109
  }(jQuery));
js/{admin-landing-page.js → landing-page.js} RENAMED
File without changes
readme.md CHANGED
@@ -25,17 +25,25 @@ With more than 30,000 installs and nearly 50 5-star rating, the Facebook Page Pl
25
 
26
  ## Frequently Asked Questions
27
 
28
- ### Where did Mongoose Marketplace come from?
29
- Mongoose Marketplace is a new website just for my plugins. It's still being maintained by the same developer as always, just with new branding.
30
 
31
- ### I can only see a link, the plugin won't load
32
- The two most common causes of the plugin not displaying are an ad blocker, or audience restrictions. Disable or whitelist any ad blocking browser extension and disable any audience restrictions in your page settings on Facebook.
 
 
 
 
33
 
34
- ### The plugin loads but doesn't show the facepile or posts
35
- The default height of the plugin is only tall enough to display the main page header. Increase the height until you can see the additional features you want to display.
36
 
37
- ### Where is the shortcode generator?
38
- On your dashboard. We'll be improving how this is implemented in future versions.
 
 
 
 
39
 
40
 
41
  ## Screenshots
@@ -46,10 +54,6 @@ On your dashboard. We'll be improving how this is implemented in future versions
46
 
47
  ## Changelog
48
 
49
- ### 1.7.1 - 21/06/19
50
- * Rebranded langing page
51
- * Fixed admin resources not being enqueued properly
52
-
53
  ### 1.7.0 - 03/06/19
54
  * Rebranded under the Mongoose Marketplace umbrella
55
  * Updated RSS feed
25
 
26
  ## Frequently Asked Questions
27
 
28
+ ### What happened to "Show Posts"?
29
+ The latest version of the API has removed show posts and replaced it with `tabs` which is more dynamic. To show just the posts, your tabs value should be "timeline". To hide the posts, `tabs` should be empty (shortcode) or select "none" (widget). If you're using the shortcode, remember that by default it shows the timeline so you must set it as either an empty or false value to hide posts ie `tabs=""` or `tabs="false"`. If the posts option is already being used it will be converted to tabs.
30
 
31
+ ### What languages are available?
32
+ As of version 1.2.0, the plugin is available in all languages provided by Facebook ( full list availabe [here](https://www.facebook.com/translations/FacebookLocales.xml) ). By default it uses the same language as the site, but alternatively you can specify the language in the shortcode. The dashboard widget is currently only available in English but is multilingual ready.
33
+
34
+ ### My Facebook page isn't loading
35
+ If the URL for your page is http://facebook.com/ABC123 then when you use the shortcode don't include the domain, instead use like so: `[facebook-page-plugin href="ABC123"]`
36
+ Also, if your page has only just been created it may take some time for the API to load the page. Just be patient
37
 
38
+ ### What versions of WordPress will this plugin work on? ###
39
+ Shortcodes were introduced in WordPress 2.5, so theorectially it should work on all sites that are at least 2.5, however it has only been tested on versions 4.0 and up, and no guarantee will be made concerning earlier versions
40
 
41
+ ### I can only see a link, the plugin won't load
42
+ By default the plugin will display a link to your page while the page plugin loads. If the page plugin doesn't load, this could happen for a number of reasons. Your connection could be very slow, you could have JavaScript disabled, you could have an ad blocker or similar browser extension blocking the plugin or there could be an error in the information you have provided in the widget or shortcode.
43
+ Additionally, if your Facebook page has audience restrictions for age and/or location, the plugin will not display. If you want the plugin to display, disable the audience restrictions in your page settings on Facebook.
44
+
45
+ ### I can't get the Facepile to work!
46
+ Chances are your plugin isn't tall enough to display the facepile properly. The facepile requires the plugin to have a minimum height of 214 pixels, or 154 pixel if using the small header.
47
 
48
 
49
  ## Screenshots
54
 
55
  ## Changelog
56
 
 
 
 
 
57
  ### 1.7.0 - 03/06/19
58
  * Rebranded under the Mongoose Marketplace umbrella
59
  * Updated RSS feed
readme.txt CHANGED
@@ -1,20 +1,20 @@
1
  === Mongoose Page Plugin ===
2
- Contributors: cameronjonesweb, mongoosemarketplace
3
  Tags: like box,facebook like box,facebook page plugin, facebook feed, facebook page
4
  Donate link: https://www.patreon.com/cameronjonesweb
5
  Requires at least: 4.6
6
  Tested up to: 5.2
7
- Stable tag: 1.7.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
11
- The most popular way to display the Mongoose Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
12
 
13
 
14
  == Description ==
15
- Seamlessly add a Facebook Page to your WordPress website with the Mongoose Page Plugin! Trusted by more than 30,000 WordPress websites worldwide, the Mongoose Page Plugin is the simplest way to add a Facebook page to your website.
16
 
17
- You can add your Facebook page to any widget area with the custom Mongoose Page Plugin widget, with live preview available in the Customizer.
18
 
19
  The plugin can be used to add your Facebook page to any post, page or text widget by using the `[facebook-page-plugin]` shortcode to display the plugin wherever you like, as often as you like.
20
 
@@ -24,7 +24,7 @@ Other features include:
24
 
25
  * Uses your site language by default, but you can display your Facebook page in all 95 languages that Facebook supports, including English, Spanish, Arabic, German, French, Russian and many more
26
 
27
- With more than 30,000 installs and over 50 5-star ratings, the Mongoose Page Plugin is one of the most popular social media plugins for WordPress.
28
 
29
 
30
  == Frequently Asked Questions ==
@@ -51,17 +51,13 @@ Chances are your plugin isn't tall enough to display the facepile properly. The
51
 
52
 
53
  == Screenshots ==
54
- 1. The Mongoose Page Plugin widget in use with the Twenty Sixteen theme
55
  2. Easy-to-use widget form with the new options available in 1.6
56
  3. The shortcode generator dashboard widget
57
 
58
 
59
  == Changelog ==
60
 
61
- = 1.7.1 - 21/06/19 =
62
- * Rebranded langing page
63
- * Fixed admin resources not being enqueued properly
64
-
65
  = 1.7.0 - 03/06/19 =
66
  * Rebranded under the Mongoose Marketplace umbrella
67
  * Updated RSS feed
@@ -179,7 +175,7 @@ Chances are your plugin isn't tall enough to display the facepile properly. The
179
 
180
  == Plugin Settings ==
181
 
182
- The Mongoose Page Plugin uses a shortcode to insert the page feed. You set your settings within the shortcode.
183
  `[facebook-page-plugin setting="value"]`
184
  Available settings:
185
 
1
  === Mongoose Page Plugin ===
2
+ Contributors: cameronjonesweb
3
  Tags: like box,facebook like box,facebook page plugin, facebook feed, facebook page
4
  Donate link: https://www.patreon.com/cameronjonesweb
5
  Requires at least: 4.6
6
  Tested up to: 5.2
7
+ Stable tag: 1.7.0
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
11
+ The most popular way to display the Facebook Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
12
 
13
 
14
  == Description ==
15
+ Seamlessly add a Facebook Page to your WordPress website with the Facebook Page Plugin! Trusted by more than 30,000 WordPress websites worldwide, the Facebook Page Plugin is the simplest way to add a Facebook page to your website.
16
 
17
+ You can add your Facebook page to any widget area with the custom Facebook Page Plugin widget, with live preview available in the Customizer.
18
 
19
  The plugin can be used to add your Facebook page to any post, page or text widget by using the `[facebook-page-plugin]` shortcode to display the plugin wherever you like, as often as you like.
20
 
24
 
25
  * Uses your site language by default, but you can display your Facebook page in all 95 languages that Facebook supports, including English, Spanish, Arabic, German, French, Russian and many more
26
 
27
+ With more than 30,000 installs and nearly 50 5-star rating, the Facebook Page Plugin is one of the most popular social media plugins for WordPress.
28
 
29
 
30
  == Frequently Asked Questions ==
51
 
52
 
53
  == Screenshots ==
54
+ 1. The Facebook Page Plugin widget in use with the Twenty Sixteen theme
55
  2. Easy-to-use widget form with the new options available in 1.6
56
  3. The shortcode generator dashboard widget
57
 
58
 
59
  == Changelog ==
60
 
 
 
 
 
61
  = 1.7.0 - 03/06/19 =
62
  * Rebranded under the Mongoose Marketplace umbrella
63
  * Updated RSS feed
175
 
176
  == Plugin Settings ==
177
 
178
+ The Facebook Page Plugin uses a shortcode to insert the page feed. You set your settings within the shortcode.
179
  `[facebook-page-plugin setting="value"]`
180
  Available settings:
181
 
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file