Responsive Facebook Page Plugin - Version trunk

Version Description

Download this release

Release Info

Developer cameronjonesweb
Plugin Icon 128x128 Responsive Facebook Page Plugin
Version trunk
Comparing to
See all releases

Code changes from version 1.6.3 to trunk

.github/FUNDING.yml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ github: cameronjonesweb
2
+ patreon: cameronjonesweb
3
+ ko_fi: cameronjonesweb
4
+ custom: https://cameronjonesweb.com.au/support-me
.travis.yml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+
3
+ matrix:
4
+ include:
5
+ # Arbitrary PHP version to run the sniffs against.
6
+ - php: '7.1'
7
+
8
+ before_install:
9
+ - export PHPCS_DIR=/tmp/phpcs
10
+ - export SNIFFS_DIR=/tmp/sniffs
11
+ # Install PHP_CodeSniffer.
12
+ - git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR
13
+ # Install WordPress Coding Standards.
14
+ - git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR
15
+ # Set install path for WordPress Coding Standards.
16
+ - $PHPCS_DIR/bin/phpcs --config-set installed_paths $SNIFFS_DIR
17
+ # After CodeSniffer install you should refresh your path.
18
+ - phpenv rehash
19
+
20
+ script:
21
+ # Run against WordPress Coding Standards.
22
+ # If you use a custom ruleset, change `--standard=WordPress` to point to your ruleset file,
23
+ # for example: `--standard=wpcs.xml`.
24
+ # You can use any of the normal PHPCS command line arguments in the command:
25
+ # https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage
26
+ - $PHPCS_DIR/bin/phpcs -p . --standard=WordPress --extensions=php --runtime-set ignore_warnings_on_exit 1
css/{facebook-page-plugin-admin.css → admin-global.css} RENAMED
@@ -1,11 +1,7 @@
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;}
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;}
css/admin-landing-page.css ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
facebook-page-feed-graph-api.php CHANGED
@@ -1,768 +1,720 @@
1
- <?php
2
- /**
3
- * Plugin Name: Responsive Facebook Page Plugin
4
- * Plugin URI: https://cameronjonesweb.com.au/wordpress-plugins/facebook-page-plugin/
5
- * Description: It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 95 different languages
6
- * Version: 1.6.3
7
- * Author: Cameron Jones
8
- * Author URI: https://cameronjonesweb.com.au
9
- * License: GPLv2
10
- * Text Domain: facebook-page-feed-graph-api
11
-
12
- * Copyright 2015-2018 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
- add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 2 );
51
-
52
- }
53
-
54
-
55
- // Filter functions
56
- private static function dashboard_widget_capability() {
57
-
58
- $return = apply_filters( 'facebook_page_plugin_dashboard_widget_capability', 'edit_posts' );
59
- return $return;
60
-
61
- }
62
-
63
-
64
- private static function app_id() {
65
-
66
- $return = apply_filters( 'facebook_page_plugin_app_id', '846690882110183' );
67
- return $return;
68
-
69
- }
70
-
71
-
72
- //Admin functions
73
-
74
- public static function donate_notice() {
75
-
76
- $return = NULL;
77
-
78
- if( current_user_can( 'administrator' ) ) {
79
-
80
- $user_id = get_current_user_id();
81
-
82
- if ( !get_user_meta( $user_id, self::$remove_donate_notice_key ) || get_user_meta( $user_id, self::$remove_donate_notice_key ) === false ) {
83
-
84
- $return .= '<div class="facebook-page-plugin-donate"><p>';
85
-
86
- $return .= __( 'Thank you for using the Facebook Page Plugin. Please consider donating to support ongoing development. ', 'facebook-page-feed-graph-api' );
87
-
88
- $return .= '</p><p>';
89
-
90
- $return .= '<a href="' . CJW_FBPP_PLUGIN_DONATE_LINK . '" target="_blank" class="button button-secondary">' . __( 'Donate now', 'facebook-page-feed-graph-api' ) . '</a>';
91
-
92
- $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>';
93
-
94
- $return .= '</p></div>';
95
-
96
- }
97
-
98
- }
99
-
100
- return $return;
101
-
102
- }
103
-
104
- public static function remove_donate_notice() {
105
-
106
- $user_id = get_current_user_id();
107
-
108
- update_user_meta( $user_id, self::$remove_donate_notice_key, 'true', true );
109
-
110
- if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
111
-
112
- wp_die();
113
-
114
- }
115
-
116
- }
117
-
118
- public function remove_donate_notice_nojs() {
119
-
120
- if ( isset( $_GET[self::$remove_donate_notice_key] ) && '0' == $_GET[self::$remove_donate_notice_key] ) {
121
-
122
- self::remove_donate_notice();
123
-
124
- }
125
-
126
- }
127
-
128
-
129
- // Add a link to support on plugins listing
130
- function plugin_action_links( $links ) {
131
-
132
- $links[] = '<a href="https://wordpress.org/support/plugin/facebook-page-feed-graph-api" target="_blank">Support</a>';
133
- return $links;
134
- }
135
-
136
- //Add link on plugins listing to my plugins directory
137
- function plugin_meta_links( $links, $file ) {
138
-
139
- if ( $file == CJW_FBPP_PLUGIN_BASENAME ) {
140
-
141
- $links[] = '<a href="https://profiles.wordpress.org/cameronjonesweb/#content-plugins" target="_blank">More plugins by cameronjonesweb</a>';
142
-
143
- }
144
-
145
- return $links;
146
-
147
- }
148
-
149
-
150
- //Enqueue CSS and JS for admin
151
- public function facebook_page_plugin_admin_resources() {
152
-
153
- wp_enqueue_script( 'facebook-page-plugin-admin-scripts', CJW_FBPP_PLUGIN_URL . 'js/facebook-page-plugin-admin.js' );
154
- wp_enqueue_style( 'facebook-page-plugin-admin-styles', CJW_FBPP_PLUGIN_URL . 'css/facebook-page-plugin-admin.css' );
155
-
156
- }
157
-
158
- //Register the dashboard widget
159
- public function facebook_page_plugin_dashboard_widget() {
160
-
161
- if( current_user_can( self::dashboard_widget_capability() ) ) {
162
-
163
- 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' ) );
164
-
165
- }
166
-
167
- }
168
-
169
- //Load the dashboard widget
170
- function facebook_page_plugin_dashboard_widget_callback() {
171
- echo '<a name="cameronjonesweb_facebook_page_plugin_shortcode_generator"></a>';
172
- $generator = new cameronjonesweb_facebook_page_plugin_shortcode_generator;
173
- $generator->generate();
174
-
175
- }
176
-
177
- function facebook_page_plugin_landing_page_menu() {
178
- add_submenu_page( 'plugins.php', __( 'Facebook Page Plugin by cameronjonesweb', 'facebook-page-feed-graph-api' ), 'Facebook Page Plugin', 'install_plugins', 'facebook-page-plugin', array( $this, 'facebook_page_plugin_landing_page' ) );
179
- }
180
-
181
- function facebook_page_plugin_landing_page() {
182
-
183
- wp_enqueue_script( 'facebook-page-plugin-landing-page', CJW_FBPP_PLUGIN_URL . 'js/landing-page.js', array( 'jquery' ), NULL, true );
184
- include CJW_FBPP_PLUGIN_DIR . '/inc/landing-page.php';
185
-
186
- }
187
-
188
- /*
189
- * http://stackoverflow.com/a/4860432/1672694
190
- */
191
-
192
- function facebook_page_plugin_is_connected() {
193
- $connected = @fsockopen( "cameronjonesweb.com.au", 80 );
194
- if( $connected ){
195
- $is_conn = true; //action when connected
196
- fclose( $connected );
197
- } else {
198
- $is_conn = false; //action in connection failure
199
- }
200
- return $is_conn;
201
- }
202
-
203
- function facebook_page_plugin_latest_blog_posts_callback() {
204
-
205
- $output = sprintf(
206
- '<p><strong>%1$s</strong></p>',
207
- __( 'Unable to load posts.', 'facebook-page-feed-graph-api' )
208
- );
209
-
210
- $internet = $this->facebook_page_plugin_is_connected();
211
- if( true === $internet && function_exists( 'simplexml_load_file' ) ) {
212
- $feed = 'https://cameronjonesweb.com.au/feed/';
213
- $xml = simplexml_load_file( $feed, 'SimpleXMLElement', LIBXML_NOCDATA );
214
- if( isset( $xml ) && !empty( $xml ) ) {
215
- $output = '';
216
- $output .= '<ul>';
217
- foreach( $xml->channel->item as $blogpost ) {
218
- $output .= '<li>';
219
- $output .= date( 'M jS', strtotime( $blogpost->pubDate ) ) . ' - ';
220
- $output .= '<a href="' . $blogpost->link . '">';
221
- $output .= $blogpost->title;
222
- $output .= '</a>';
223
- $output .= '</li>';
224
- }
225
- $output .= '</ul>';
226
- }
227
- }
228
- $output .= sprintf(
229
- '<p><a href="https://cameronjonesweb.com.au/blog/" target="_blank">%1$s</a></p>',
230
- __( 'View all recent posts', 'facebook-page-feed-graph-api' )
231
- );
232
- wp_die( $output );
233
- }
234
-
235
- function facebook_page_plugin_activation_hook( $plugin ) {
236
- if( $plugin == CJW_FBPP_PLUGIN_BASENAME ) {
237
- exit( wp_redirect( admin_url( 'plugins.php?page=facebook-page-plugin' ) ) );
238
- }
239
- }
240
-
241
-
242
- //Client side stuff
243
- function facebook_page_plugin_generate_wrapper_id() {
244
- return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
245
- }
246
-
247
- //Parse shortcode
248
- function facebook_page_plugin( $filter ) {
249
- wp_enqueue_script( 'facebook-page-plugin-sdk', CJW_FBPP_PLUGIN_URL . 'js/sdk.js', array(), NULL, true );
250
- wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', NULL, true );
251
- $return = NULL;
252
- $a = shortcode_atts( array(
253
- 'href' => NULL,
254
- 'width' => 340,
255
- 'height' => 130,
256
- 'cover' => NULL,
257
- 'facepile' => NULL,
258
- 'posts' => NULL,
259
- 'tabs' => array(),
260
- 'language' => get_bloginfo('language'),
261
- 'cta' => NULL,
262
- 'small' => NULL,
263
- 'adapt' => NULL,
264
- 'link' => true,
265
- 'linktext' => NULL,
266
- 'standard' => 'html5',
267
- '_implementation' => 'shortcode'
268
- ), $filter );
269
- if(isset($a['href']) && !empty($a['href'])){
270
- $a['language'] = str_replace("-", "_", $a['language']);
271
-
272
- //Send the language as a parameter to the SDK
273
- wp_localize_script( 'facebook-page-plugin-sdk', 'facebook_page_plugin_language', array( 'language' => $a['language'] ) );
274
-
275
- $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() . '">';
276
- $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=v2.12&appId=' . self::app_id() . '";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
277
- $return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
278
- if(isset($a['width']) && !empty($a['width'])){
279
- $return .= ' data-width="' . $a['width'] . '"';
280
- $return .= ' data-max-width="' . $a['width'] . '"';
281
- }
282
- if(isset($a['height']) && !empty($a['height'])){
283
- $return .= ' data-height="' . $a['height'] . '"';
284
- }
285
- if(isset($a['cover']) && !empty($a['cover'])){
286
- if($a['cover'] == "false"){
287
- $return .= ' data-hide-cover="true"';
288
- } else if($a['cover'] == "true"){
289
- $return .= ' data-hide-cover="false"';
290
- }
291
- }
292
- if(isset($a['facepile']) && !empty($a['facepile'])){
293
- $return .= ' data-show-facepile="' . $a['facepile'] . '"';
294
- }
295
- if(isset($a['tabs']) && !empty($a['tabs'])){
296
- $return .= ' data-tabs="' . $a['tabs'] . '"';
297
- } else if(isset($a['posts']) && !empty($a['posts'])){
298
- if($a['posts'] == 'true'){
299
- $return .= ' data-tabs="timeline"';
300
- } else {
301
- $return .= ' data-tabs="false"';
302
- }
303
- }
304
- if(isset($a['cta']) && !empty($a['cta'])){
305
- $return .= ' data-hide-cta="' . $a['cta'] . '"';
306
- }
307
- if(isset($a['small']) && !empty($a['small'])){
308
- $return .= ' data-small-header="' . $a['small'] . '"';
309
- }
310
- if(isset($a['adapt']) && !empty($a['adapt'])){
311
- $return .= ' data-adapt-container-width="' . $a['adapt'] . '"';
312
- } else {
313
- $return .= ' data-adapt-container-width="false"';
314
- }
315
- $return .= '><div class="fb-xfbml-parse-ignore">';
316
- if( $a['link'] == 'true' ){
317
- $return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
318
- $return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
319
- if( empty( $a['linktext'] ) ) {
320
- $return .= 'https://www.facebook.com/' . $a['href'];
321
- } else {
322
- $return .= $a['linktext'];
323
- }
324
- $return .= '</a>';
325
- $return .= '</blockquote>';
326
- }
327
- $return .= '</div></div></div>';
328
- }
329
- return $return;
330
- }
331
-
332
- }
333
-
334
- class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
335
-
336
- private $facebookURLs = array( 'https://www.facebook.com/', 'https://facebook.com/', 'www.facebook.com/', 'facebook.com/', 'http://facebook.com/', 'http://www.facebook.com/' );
337
- private $settings;
338
-
339
- function __construct() {
340
- $this->settings = new facebook_page_plugin_settings;
341
- 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' ), ) );
342
- }
343
- public function widget( $args, $instance ) {
344
- if( isset( $instance['title'] ) && !empty( $instance['title'] ) ) {
345
- $title = apply_filters( 'widget_title', $instance['title'] );
346
- } else {
347
- $title = NULL;
348
- }
349
- if(isset($instance['href']) && !empty($instance['href'])){
350
- $href = $instance['href'];
351
- foreach($this->facebookURLs as $url){
352
- $href = str_replace($url, '', $href);
353
- }
354
- } else {
355
- $href = NULL;
356
- }
357
- if(isset($instance['width']) && !empty($instance['width'])){
358
- $width = $instance['width'];
359
- } else {
360
- $width = NULL;
361
- }
362
- if(isset($instance['height']) && !empty($instance['height'])){
363
- $height = $instance['height'];
364
- } else {
365
- $height = NULL;
366
- }
367
- if(isset($instance['cover']) && !empty($instance['cover'])){
368
- $cover = 'true';
369
- } else {
370
- $cover = 'false';
371
- }
372
- if(isset($instance['facepile']) && !empty($instance['facepile'])){
373
- $facepile = 'true';
374
- } else {
375
- $facepile = 'false';
376
- }
377
- if(isset($instance['tabs']) && !empty($instance['tabs'])){
378
- $tabs = $instance['tabs'];
379
- } else {
380
- $tabs = '';
381
- }
382
- if(isset($instance['cta']) && !empty($instance['cta'])){
383
- $cta = 'true';
384
- } else {
385
- $cta = 'false';
386
- }
387
- if(isset($instance['small']) && !empty($instance['small'])){
388
- $small = 'true';
389
- } else {
390
- $small = 'false';
391
- }
392
- if(isset($instance['adapt']) && !empty($instance['adapt'])){
393
- $adapt = 'true';
394
- } else {
395
- $adapt = 'false';
396
- }
397
- if(isset($instance['link']) && !empty($instance['link'])){
398
- $link = 'true';
399
- } else {
400
- $link = 'false';
401
- }
402
- if(isset($instance['linktext']) && !empty($instance['linktext'])){
403
- $linktext = $instance['linktext'];
404
- } else {
405
- $linktext = NULL;
406
- }
407
- if(isset($instance['language']) && !empty($instance['language'])){
408
- $language = $instance['language'];
409
- } else {
410
- $language = NULL;
411
- }
412
- echo $args['before_widget'];
413
- if ( ! empty( $title ) ) {
414
- echo $args['before_title'] . $title . $args['after_title'];
415
- }
416
- if( !empty($href )){
417
- $shortcode = '[facebook-page-plugin href="' . $href . '"';
418
- if( isset( $width ) && !empty( $width ) ){
419
- $shortcode .= ' width="' . $width . '"';
420
- }
421
- if( isset( $height ) && !empty( $height ) ){
422
- $shortcode .= ' height="' . $height . '"';
423
- }
424
- if( isset( $cover ) && !empty( $cover ) ){
425
- $shortcode .= ' cover="' . $cover . '"';
426
- }
427
- if( isset( $facepile ) && !empty( $facepile ) ){
428
- $shortcode .= ' facepile="' . $facepile . '"';
429
- }
430
- if( isset( $tabs ) && !empty( $tabs ) ){
431
- if( is_array( $tabs ) ) {
432
- $shortcode .= ' tabs="';
433
- for( $i = 0; $i < count( $tabs ); $i++ ) {
434
- $shortcode .= $tabs[$i];
435
- $shortcode .= ( $i != count( $tabs ) - 1 ? ',' : '' );
436
- }
437
- $shortcode .= '"';
438
- } else {
439
- $shortcode .= ' tabs="' . $tabs . '"';
440
- }
441
- }
442
- if( isset( $language ) && !empty( $language ) ){
443
- $shortcode .= ' language="' . $language . '"';
444
- }
445
- if( isset( $cta ) && !empty( $cta ) ){
446
- $shortcode .= ' cta="' . $cta . '"';
447
- }
448
- if( isset( $small ) && !empty( $small ) ){
449
- $shortcode .= ' small="' . $small . '"';
450
- }
451
- if( isset( $adapt ) && !empty( $adapt ) ){
452
- $shortcode .= ' adapt="' . $adapt . '"';
453
- }
454
- if( isset( $link ) && !empty( $link ) ){
455
- $shortcode .= ' link="' . $link . '"';
456
- }
457
- if( isset( $linktext ) && !empty( $linktext ) ){
458
- $shortcode .= ' linktext="' . $linktext . '"';
459
- }
460
- $shortcode .= ' _implementation="widget"';
461
- $shortcode .= ']';
462
- echo do_shortcode( $shortcode );
463
- }
464
- echo $args['after_widget'];
465
- }
466
- public function form( $instance ) {
467
-
468
- if ( isset( $instance[ 'title' ] ) ) {
469
- $title = $instance[ 'title' ];
470
- } else {
471
- $title = __( 'New title', 'facebook-page-feed-graph-api' );
472
- }
473
- if ( isset( $instance[ 'href' ] ) ) {
474
- $href = $instance[ 'href' ];
475
- } else {
476
- $href = '';
477
- }
478
- if ( isset( $instance[ 'width' ] ) ) {
479
- $width = $instance[ 'width' ];
480
- } else {
481
- $width = '';
482
- }
483
- if ( isset( $instance[ 'height' ] ) ) {
484
- $height = $instance[ 'height' ];
485
- } else {
486
- $height = '';
487
- }
488
- if ( isset( $instance[ 'cover' ] ) ) {
489
- $cover = $instance[ 'cover' ];
490
- } else {
491
- $cover = 'false';
492
- }
493
- if ( isset( $instance[ 'facepile' ] ) ) {
494
- $facepile = $instance[ 'facepile' ];
495
- } else {
496
- $facepile = 'false';
497
- }
498
- if ( isset( $instance[ 'tabs' ] ) ) {
499
- $tabs = $instance[ 'tabs' ];
500
- } else {
501
- $tabs = '';
502
- }
503
- if ( isset( $instance[ 'cta' ] ) ) {
504
- $cta = $instance[ 'cta' ];
505
- } else {
506
- $cta = 'false';
507
- }
508
- if ( isset( $instance[ 'small' ] ) ) {
509
- $small = $instance[ 'small' ];
510
- } else {
511
- $small = 'false';
512
- }
513
- if ( isset( $instance[ 'adapt' ] ) ) {
514
- $adapt = $instance[ 'adapt' ];
515
- } else {
516
- $adapt = 'true';
517
- }
518
- if ( isset( $instance[ 'link' ] ) ) {
519
- $link = $instance[ 'link' ];
520
- } else {
521
- $link = 'true';
522
- }
523
- if ( isset( $instance[ 'linktext' ] ) ) {
524
- $linktext = $instance[ 'linktext' ];
525
- } else {
526
- $linktext = '';
527
- }
528
- if ( isset( $instance[ 'language' ] ) ) {
529
- $language = $instance[ 'language' ];
530
- } else {
531
- $language = '';
532
- }
533
-
534
- $langs = $this->settings->get_locale_xml();
535
-
536
- echo cameronjonesweb_facebook_page_plugin::donate_notice();
537
-
538
- echo '<p>';
539
- echo '<label for="' . $this->get_field_id( 'title' ) . '">';
540
- _e( 'Title:', 'facebook-page-feed-graph-api' );
541
- echo '</label>';
542
- echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . esc_attr( $title ) . '" />';
543
- echo '</p>';
544
- echo '<p>';
545
- echo '<label for="' . $this->get_field_id( 'href' ) . '">';
546
- _e( 'Page URL:', 'facebook-page-feed-graph-api' );
547
- echo '</label>';
548
- echo '<input class="widefat" id="' . $this->get_field_id( 'href' ) . '" name="' . $this->get_field_name( 'href' ) . '" type="url" value="' . esc_attr( $href ) . '" required />';
549
- echo '</p>';
550
- echo '<p>';
551
- echo '<label for="' . $this->get_field_id( 'width' ) . '">';
552
- _e( 'Width:', 'facebook-page-feed-graph-api' );
553
- echo '</label>';
554
- 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 ) . '" />';
555
- echo '</p>';
556
- echo '<p>';
557
- echo '<label for="' . $this->get_field_id( 'height' ) . '">';
558
- _e( 'Height:', 'facebook-page-feed-graph-api' );
559
- echo '</label>';
560
- echo '<input class="widefat" id="' . $this->get_field_id( 'height' ) . '" name="' . $this->get_field_name( 'height' ) . '" type="number" min="70" value="' . esc_attr( $height ) . '" />';
561
- echo '</p>';
562
- echo '<p>';
563
- echo '<label for="' . $this->get_field_id( 'cover' ) . '">';
564
- _e( 'Cover Photo:', 'facebook-page-feed-graph-api' );
565
- echo '</label>';
566
- 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 ) . ' />';
567
- echo '</p>';
568
- echo '<p>';
569
- echo '<label for="' . $this->get_field_id( 'facepile' ) . '">';
570
- _e( 'Show Facepile:', 'facebook-page-feed-graph-api' );
571
- echo '</label>';
572
- 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 ) . ' />';
573
- echo '</p>';
574
- echo '<p>';
575
- _e( 'Page Tabs:', 'facebook-page-feed-graph-api' );
576
- $CJW_FBPP_TABS = $this->settings->tabs();
577
- if( !empty( $CJW_FBPP_TABS ) ) {
578
- // First we should convert the string to an array as that's how it will be stored moving forward.
579
- if( !is_array( $tabs ) ) {
580
- $oldtabs = esc_attr( $tabs );
581
- $newtabs = explode( ',', $tabs );
582
- $tabs = $newtabs;
583
- }
584
- foreach( $CJW_FBPP_TABS as $tab ) {
585
- echo '<br/><label>';
586
- echo '<input type="checkbox" name="' . $this->get_field_name( 'tabs' ) . '[' . $tab . ']" ' . ( in_array( $tab, $tabs ) ? 'checked' : '' ) . ' /> ';
587
- _e( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
588
- echo '</label>';
589
- }
590
- }
591
- echo '</p>';
592
- echo '<p>';
593
- echo '<label for="' . $this->get_field_id( 'cta' ) . '">';
594
- _e( 'Hide Call To Action:', 'facebook-page-feed-graph-api' );
595
- echo '</label>';
596
- 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 ) . ' />';
597
- echo '</p>';
598
- echo '<p>';
599
- echo '<label for="' . $this->get_field_id( 'small' ) . '">';
600
- _e( 'Small Header:', 'facebook-page-feed-graph-api' );
601
- echo '</label>';
602
- 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 ) . ' />';
603
- echo '</p>';
604
- echo '<p>';
605
- echo '<label for="' . $this->get_field_id( 'adapt' ) . '">';
606
- _e( 'Adaptive Width:', 'facebook-page-feed-graph-api' );
607
- echo '</label>';
608
- 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 ) . ' />';
609
- echo '</p>';
610
- echo '<p>';
611
- echo '<label for="' . $this->get_field_id( 'link' ) . '">';
612
- _e( 'Display link while loading:', 'facebook-page-feed-graph-api' );
613
- echo '</label>';
614
- 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 ) . ' />';
615
- echo '</p>';
616
- echo '<p>';
617
- echo '<label for="' . $this->get_field_id( 'linktext' ) . '">';
618
- _e( 'Link text:', 'facebook-page-feed-graph-api' );
619
- echo '</label>';
620
- echo '<input class="widefat" id="' . $this->get_field_id( 'linktext' ) . '" name="' . $this->get_field_name( 'linktext' ) . '" type="text" value="' . esc_attr( $linktext ) . '" />';
621
- echo '</p>';
622
- echo '<p>';
623
- echo '<label for="' . $this->get_field_id( 'language' ) . '">';
624
- _e( 'Language:', 'facebook-page-feed-graph-api' );
625
- echo '</label>';
626
- echo '<select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';
627
- echo '<option value="">' . __( 'Site Language (default)', 'facebook-page-feed-graph-api' ) . '</option>';
628
- if(isset($langs) && !empty($langs)){
629
- foreach($langs as $lang){
630
- //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
631
- echo '<option value="' . $lang->standard->representation . '"' . selected( esc_attr( $language ), $lang->standard->representation, false ) . '>' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
632
- }
633
- }
634
- echo '</select>';
635
- echo '</p>';
636
- }
637
-
638
- // Updating widget replacing old instances with new
639
- public function update( $new_instance, $old_instance ) {
640
- $instance = array();
641
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
642
- $instance['href'] = ( ! empty( $new_instance['href'] ) ) ? strip_tags( $new_instance['href'] ) : '';
643
- $instance['width'] = ( ! empty( $new_instance['width'] ) ) ? strip_tags( $new_instance['width'] ) : '';
644
- $instance['height'] = ( ! empty( $new_instance['height'] ) ) ? strip_tags( $new_instance['height'] ) : '';
645
- $instance['cover'] = ( ! empty( $new_instance['cover'] ) ) ? strip_tags( $new_instance['cover'] ) : '';
646
- $instance['facepile'] = ( ! empty( $new_instance['facepile'] ) ) ? strip_tags( $new_instance['facepile'] ) : '';
647
- if( !empty( $new_instance['tabs'] ) ) {
648
- if( is_array( $new_instance['tabs'] ) ) {
649
- foreach( $new_instance['tabs'] as $key => $var ) {
650
- $instance['tabs'][] = sanitize_text_field( $key );
651
- }
652
- }
653
- } else {
654
- $instance['tabs'] = '';
655
- }
656
- $instance['cta'] = ( ! empty( $new_instance['cta'] ) ) ? strip_tags( $new_instance['cta'] ) : '';
657
- $instance['small'] = ( ! empty( $new_instance['small'] ) ) ? strip_tags( $new_instance['small'] ) : '';
658
- $instance['adapt'] = ( ! empty( $new_instance['adapt'] ) ) ? strip_tags( $new_instance['adapt'] ) : '';
659
- $instance['link'] = ( ! empty( $new_instance['link'] ) ) ? strip_tags( $new_instance['link'] ) : '';
660
- $instance['linktext'] = ( ! empty( $new_instance['linktext'] ) ) ? strip_tags( $new_instance['linktext'] ) : '';
661
- $instance['language'] = ( ! empty( $new_instance['language'] ) ) ? strip_tags( $new_instance['language'] ) : '';
662
- return $instance;
663
- }
664
-
665
- } // Class wpb_widget ends here
666
-
667
- class cameronjonesweb_facebook_page_plugin_shortcode_generator {
668
-
669
- private $langs;
670
- private $settings;
671
-
672
- function __construct() {
673
-
674
- $this->settings = new facebook_page_plugin_settings;
675
- $this->langs = $this->settings->get_locale_xml();
676
- }
677
-
678
- function generate() {
679
-
680
- $return = NULL;
681
-
682
- $return .= cameronjonesweb_facebook_page_plugin::donate_notice();
683
-
684
- $return .= '<noscript>' . __( 'The shortcode generator requires JavaScript enabled', 'facebook-page-feed-graph-api' ) . '</noscript>';
685
-
686
- $return .= '<form>';
687
- $return .= '<p><label>' . __( 'Facebook Page URL', 'facebook-page-feed-graph-api' ) . ': <input type="url" id="fbpp-href" /></label></p>';
688
- $return .= '<p><label>' . __( 'Width (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" max="500" min="180" id="fbpp-width" /></label></p>';
689
- $return .= '<p><label>' . __( 'Height (pixels)', 'facebook-page-feed-graph-api' ) . ': <input type="number" min="70" id="fbpp-height" /></label></p>';
690
- $return .= '<p><label>' . __( 'Show Cover Photo', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cover" /></label></p>';
691
- $return .= '<p><label>' . __( 'Show Facepile', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
692
- $return .= '<p><label>' . __( 'Page Tabs (formerly posts)', 'facebook-page-feed-graph-api' ) . ':';
693
- $settings = new facebook_page_plugin_settings;
694
- $CJW_FBPP_TABS = $settings->tabs();
695
- if( !empty( $CJW_FBPP_TABS ) ) {
696
- foreach( $CJW_FBPP_TABS as $tab ) {
697
- $return .= '<br/><label>';
698
- $return .= '<input type="checkbox" class="fbpp-tabs" name="' . $tab . '" /> ';
699
- $return .= __( ucfirst( $tab ), 'facebook-page-feed-graph-api' );
700
- $return .= '</label>';
701
- }
702
- }
703
- $return .= '<p><label>' . __( 'Hide Call To Action', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-cta" /></label></p>';
704
- $return .= '<p><label>' . __( 'Small Header', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-small" /></label></p>';
705
- $return .= '<p><label>' . __( 'Adaptive Width', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-adapt" checked /></label></p>';
706
- $return .= '<p><label>' . __( 'Display link while loading', 'facebook-page-feed-graph-api' ) . ': <input type="checkbox" value="true" id="fbpp-link" checked /></label></p>';
707
- $return .= '<p id="linktext-label"><label>' . __( 'Link text', 'facebook-page-feed-graph-api' ) . ': <input type="text" id="fbpp-linktext" /></label></p>';
708
- $return .= '<p><label>' . __( 'Language', 'facebook-page-feed-graph-api' ) . ': <select id="fbpp-lang"><option value="">' . __( 'Site Language', 'facebook-page-feed-graph-api' ) . '</option>';
709
- if(isset($this->langs) && !empty($this->langs)){
710
- foreach($this->langs as $lang){
711
- $return .= '<option value="' . $lang->standard->representation . '">' . __( $lang->englishName, 'facebook-page-feed-graph-api' ) . '</option>';
712
- }
713
- }
714
- $return .= '</select></label></p>';
715
- $return .= '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
716
- $return .= '</form>';
717
-
718
- echo $return;
719
- }
720
-
721
- }
722
-
723
- class facebook_page_plugin_settings {
724
-
725
- public $tabs;
726
-
727
- function __construct() {
728
- $this->tabs = array( 'timeline', 'events', 'messages' );
729
- }
730
-
731
- function tabs() {
732
- return $this->tabs;
733
- }
734
-
735
- function get_locale_xml() {
736
-
737
- $admin_abspath = str_replace( site_url(), ABSPATH, admin_url() );
738
-
739
- include_once( $admin_abspath . '/includes/class-wp-filesystem-base.php' );
740
- include_once( $admin_abspath . '/includes/class-wp-filesystem-direct.php' );
741
- $wp_filesystem = new WP_Filesystem_Direct( null );
742
-
743
- try {
744
- //$xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
745
- //$xml = file_get_contents( CJW_FBPP_PLUGIN_URL ) . 'lang.xml');
746
- $lang_xml = $wp_filesystem->get_contents( CJW_FBPP_PLUGIN_DIR . '/lang.xml');
747
- } catch( Exception $ex ){
748
- $lang_xml = NULL;
749
- }
750
-
751
- if(isset($lang_xml) && !empty($lang_xml)){
752
- $langs = new SimpleXMLElement($lang_xml);
753
- } else {
754
- $langs = NULL;
755
- }
756
-
757
- return $langs;
758
- }
759
-
760
- }
761
-
762
- //Register the widget
763
- function facebook_page_plugin_load_widget() {
764
- register_widget( 'cameronjonesweb_facebook_page_plugin_widget' );
765
- }
766
- add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
767
-
768
- $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.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();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
faq.json DELETED
@@ -1,62 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/banner-1544x500.png ADDED
Binary file
images/banner-772x250.jpg DELETED
Binary file
images/banner-border.png ADDED
Binary file
inc/index.php ADDED
File without changes
inc/landing-page.php CHANGED
@@ -1,133 +1,140 @@
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,4 +144,4 @@ $internet = $this->facebook_page_plugin_is_connected(); ?>
137
  </div>
138
  </div>
139
  </div>
140
- </div>
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
  </div>
145
  </div>
146
  </div>
147
+ </div>
js/{facebook-page-plugin-admin.js → admin-global.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/{landing-page.js → admin-landing-page.js} RENAMED
File without changes
readme.md CHANGED
@@ -1,7 +1,10 @@
1
- # Responsive Facebook Page Plugin
2
- by @cameronjonesweb
3
 
4
- It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget.
 
 
 
 
5
 
6
 
7
  ## Description
@@ -22,25 +25,17 @@ With more than 30,000 installs and nearly 50 5-star rating, the Facebook Page Pl
22
 
23
  ## Frequently Asked Questions
24
 
25
- ### What happened to "Show Posts"?
26
- 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.
27
-
28
- ### What languages are available?
29
- 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.
30
-
31
- ### My Facebook page isn't loading
32
- 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"]`
33
- Also, if your page has only just been created it may take some time for the API to load the page. Just be patient
34
-
35
- ### What versions of WordPress will this plugin work on? ###
36
- 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
37
 
38
  ### I can only see a link, the plugin won't load
39
- 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.
40
- 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.
 
 
41
 
42
- ### I can't get the Facepile to work!
43
- 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.
44
 
45
 
46
  ## Screenshots
@@ -51,7 +46,16 @@ Chances are your plugin isn't tall enough to display the facepile properly. The
51
 
52
  ## Changelog
53
 
54
- ### 1.6.3 - 01/04/18
 
 
 
 
 
 
 
 
 
55
  * Improved string translations
56
  * Updated Graph API from v2.5 to v2.12
57
  * Fail gracefully when SimpleXML isn't installed
@@ -203,4 +207,4 @@ Changes who can see the shortcode generator on the dashboard. Default: `edit_pos
203
 
204
  `facebook_page_plugin_app_id`
205
 
206
- Changes the Facebook App ID.
1
+ [![Build Status](https://api.travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api.svg)](https://travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api)
 
2
 
3
+ # Mongoose Page Plugin
4
+
5
+ [![ko-fi](https://www.ko-fi.com/img/donate_sm.png)](https://ko-fi.com/E1E0GU12) [![patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://patreon.com/cameronjonesweb)
6
+
7
+ 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
8
 
9
 
10
  ## Description
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
 
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
56
+ * Fixed conflict with Elementor page builder
57
+
58
+ ### 1.6.3 - 30/03/18
59
  * Improved string translations
60
  * Updated Graph API from v2.5 to v2.12
61
  * Fail gracefully when SimpleXML isn't installed
207
 
208
  `facebook_page_plugin_app_id`
209
 
210
+ Changes the Facebook App ID.
readme.txt CHANGED
@@ -1,213 +1,222 @@
1
- === Responsive Facebook 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: 4.9
7
- Stable tag: 1.6.3
8
- License: GPLv2
9
- License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
-
11
- It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget.
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
-
21
- Other features include:
22
-
23
- * A shortcode generator on the admin dashboard for easy generating of the shortcode
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 ==
31
-
32
- = What happened to "Show Posts"? =
33
- 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.
34
-
35
- = What languages are available? =
36
- 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.
37
-
38
- = My Facebook page isn't loading =
39
- 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"]`
40
- Also, if your page has only just been created it may take some time for the API to load the page. Just be patient
41
-
42
- = What versions of WordPress will this plugin work on? =
43
- 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
44
-
45
- = I can only see a link, the plugin won't load =
46
- 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.
47
- 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.
48
-
49
- = I can't get the Facepile to work! =
50
- 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.
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.6.3 - 01/04/18 =
62
- * Improved string translations
63
- * Updated Graph API from v2.5 to v2.12
64
- * Fail gracefully when SimpleXML isn't installed
65
- * Fixed changelog link
66
- * Updated the plugin display name to avoid potential trademark issues
67
-
68
- = 1.6.2 - 18/11/17 =
69
- * Changes minimum WordPress version to 4.6 for translations
70
- * Tested for WordPress 4.9 'Tipton'
71
- * Fixed bug with setting the language in the shortcode generator
72
- * Increased accuracy of URL detection in the widget form
73
-
74
- = 1.6.1 - 11/04/17 =
75
- * Adding text domain header
76
- * Adding implementation indicator for debugging
77
-
78
- = 1.6.0 - 02/04/17 =
79
- * New landing page with FAQs to help with onboarding of new users
80
- * Removal of the admin notice review nag
81
- * Localisation of SDK
82
- * Added `events` option to the widget and shortcode generator
83
- * Changed `tabs` setting to checkboxes instead of a dropdown
84
-
85
- = 1.5.3 - 25/01/16 =
86
- * Fixed bug where share button would return `App Not Setup` error
87
-
88
- = 1.5.2 - 01/12/15 =
89
- * Fixed bug where plugin would rerender during scroll on mobile devices
90
-
91
- = 1.5.1 - 29/11/15 =
92
- * Fixed bug where plugin wouldn't rerender
93
- * Fixed bug with languages XML file not loading on installs where the admin is not wp-admin
94
-
95
- = 1.5.0 - 23/11/15 =
96
- * Migrated to object oriented
97
- * Fixed languages XML file being blocked by iThemes Security
98
- * Fixed HTML issue with dashboard widget
99
- * Added script that makes the plugin fully responsive
100
-
101
- = 1.4.2 - 23/09/15 =
102
- * Fixing shortcode not being updated when tabs change in the shortcode generator
103
- * Removing link text parameter and option when `Show Link` is false
104
-
105
- = 1.4.1 - 22/09/15 =
106
- * Fixing shortcode generator using posts instead of tabs
107
- * Verifying compatibility with 4.3.1
108
-
109
- = 1.4.0 - 03/09/15 =
110
- * Options to remove and customise the page link that displays while the plugin loads
111
- * Fixed `undefined index` error when adding a new instance of the plugin in the customizer
112
- * Updated all admin text to be multi-lingual compatible
113
- * Updated `posts` option to `tabs`
114
- * Updated screenshots and example
115
-
116
- = 1.3.4 - 13/08/15 =
117
- * Fixed typo in widget
118
- * Fixed labels in widget
119
- * Changed languages to load from a local file instead of Facebook's Locales XML file. This fixes the issue where approximately 40 languages were supported by Facebook but not for the page plugin, and also users working locally without internet access are now able to change the language from default.
120
- * Re-introduced App ID, while it should not be needed it appears that removing it has affected some sites.
121
-
122
- = 1.3.3 - 11/08/15 =
123
- * Direct access security update
124
- * Verifying compatibility with WP 4.2.4 and WP 4.3
125
- * Fixing bug where some options in the widget would revert to the default instead of false
126
-
127
- = 1.3.2 - 25/07/15 =
128
- * WP 4.2.3 Compatibility
129
- * Upgrading to Graph API 2.4
130
-
131
- = 1.3.0 - 02/07/15 =
132
- * Added hide-cta, small-header and adapt-container-width settings
133
- * Adjusted min height and width
134
-
135
- = 1.2.5 - 06/06/15 =
136
- * Fixed close icon on notice
137
-
138
- = 1.2.4 - 05/06/15 =
139
- * Fixed readme
140
-
141
- = 1.2.3 - 04/06/15 =
142
- * Fixed bug where the admin dashboard and widgets pages would break if the WordPress installation is running on localhost and there is no internet connection
143
-
144
- = 1.2.2 - 27/05/15 =
145
- * Fixed posts option for widget
146
-
147
- = 1.2.1 - 27/05/15 =
148
- * Fixed readme bug
149
-
150
- = 1.2.0 - 26/05/15 =
151
- * Added multilingual support. Language can be specified in the shortcode, otherwise it is retrievd from the site settings.
152
- * Added a shortcode generator dashboard widget to allow easier creation of the shortcode
153
- * Added a custom widget
154
-
155
- = 1.1.1 - 14/05/15 =
156
- * Fixed height bug
157
-
158
- = 1.1.0 - 10/05/15 =
159
- * Added filter to allow calling of shortcodes in the text widget
160
-
161
- = 1.0.3 - 28/04/15 =
162
- * Fixing screenshot issue
163
-
164
- = 1.0.1 - 28/04/15 =
165
- * Cleaning up readme file
166
-
167
- = 1.0 - 25/04/15 =
168
- * Initial release
169
-
170
-
171
- == Plugin Settings ==
172
-
173
- The Facebook Page Plugin uses a shortcode to insert the page feed. You set your settings within the shortcode.
174
- `[facebook-page-plugin setting="value"]`
175
- Available settings:
176
-
177
- `href` (URL path that comes after facebook.com/)
178
-
179
- `width` (number, in pixels, between 180 and 500, default 340)
180
-
181
- `height` (number, in pixels, minimum 70, default 500)
182
-
183
- `cover` (true/false, show page cover photo, default true)
184
-
185
- `facepile` (true/false, show facepile, default true)
186
-
187
- `tabs` (any combination of [posts, messages, events], default timeline)
188
-
189
- `cta` (true/false, hide custom call to action if applicable, default false)
190
-
191
- `small` (true/false, display small header (must be true for height to be lower than 130px), default false)
192
-
193
- `adapt` (true/false, force plugin to be responsive, default true)
194
-
195
- `language` (languageCode_countryCode eg: en_US, language of the plugin, default site language)
196
-
197
- * Deprecated Settings *
198
-
199
- `posts` (true/false) - posts has been replaced by tabs as of 1.4.0. There is a fallback in place to convert it to tabs
200
-
201
- Example: `[facebook-page-plugin href="facebook" width="300" height="500" cover="true" facepile="true" tabs="timeline" adapt="true"]`
202
- This will display a Facebook page feed that loads in the page `facebook.com/facebook` that is 300px wide but adapts to it's container, 500px high, displaying the page's cover photo, facepile and recent posts in the same language as the site. See the screenshots tab for a demonstration of how it will appear
203
-
204
-
205
- == Filter Reference ==
206
-
207
- `facebook_page_plugin_dashboard_widget_capability`
208
-
209
- Changes who can see the shortcode generator on the dashboard. Default: `edit_posts`
210
-
211
- `facebook_page_plugin_app_id`
212
-
 
 
 
 
 
 
 
 
 
213
  Changes the Facebook App ID.
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
+
21
+ Other features include:
22
+
23
+ * A shortcode generator on the admin dashboard for easy generating of the shortcode
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 ==
31
+
32
+ = What happened to "Show Posts"? =
33
+ 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.
34
+
35
+ = What languages are available? =
36
+ 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.
37
+
38
+ = My Facebook page isn't loading =
39
+ 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"]`
40
+ Also, if your page has only just been created it may take some time for the API to load the page. Just be patient
41
+
42
+ = What versions of WordPress will this plugin work on? =
43
+ 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
44
+
45
+ = I can only see a link, the plugin won't load =
46
+ 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.
47
+ 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.
48
+
49
+ = I can't get the Facepile to work! =
50
+ 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.
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
68
+ * Fixed conflict with Elementor page builder
69
+
70
+ = 1.6.3 - 30/03/18 =
71
+ * Improved string translations
72
+ * Updated Graph API from v2.5 to v2.12
73
+ * Fail gracefully when SimpleXML isn't installed
74
+ * Fixed changelog link
75
+ * Updated the plugin display name to avoid potential trademark issues
76
+
77
+ = 1.6.2 - 18/11/17 =
78
+ * Changes minimum WordPress version to 4.6 for translations
79
+ * Tested for WordPress 4.9 'Tipton'
80
+ * Fixed bug with setting the language in the shortcode generator
81
+ * Increased accuracy of URL detection in the widget form
82
+
83
+ = 1.6.1 - 11/04/17 =
84
+ * Adding text domain header
85
+ * Adding implementation indicator for debugging
86
+
87
+ = 1.6.0 - 02/04/17 =
88
+ * New landing page with FAQs to help with onboarding of new users
89
+ * Removal of the admin notice review nag
90
+ * Localisation of SDK
91
+ * Added `events` option to the widget and shortcode generator
92
+ * Changed `tabs` setting to checkboxes instead of a dropdown
93
+
94
+ = 1.5.3 - 25/01/16 =
95
+ * Fixed bug where share button would return `App Not Setup` error
96
+
97
+ = 1.5.2 - 01/12/15 =
98
+ * Fixed bug where plugin would rerender during scroll on mobile devices
99
+
100
+ = 1.5.1 - 29/11/15 =
101
+ * Fixed bug where plugin wouldn't rerender
102
+ * Fixed bug with languages XML file not loading on installs where the admin is not wp-admin
103
+
104
+ = 1.5.0 - 23/11/15 =
105
+ * Migrated to object oriented
106
+ * Fixed languages XML file being blocked by iThemes Security
107
+ * Fixed HTML issue with dashboard widget
108
+ * Added script that makes the plugin fully responsive
109
+
110
+ = 1.4.2 - 23/09/15 =
111
+ * Fixing shortcode not being updated when tabs change in the shortcode generator
112
+ * Removing link text parameter and option when `Show Link` is false
113
+
114
+ = 1.4.1 - 22/09/15 =
115
+ * Fixing shortcode generator using posts instead of tabs
116
+ * Verifying compatibility with 4.3.1
117
+
118
+ = 1.4.0 - 03/09/15 =
119
+ * Options to remove and customise the page link that displays while the plugin loads
120
+ * Fixed `undefined index` error when adding a new instance of the plugin in the customizer
121
+ * Updated all admin text to be multi-lingual compatible
122
+ * Updated `posts` option to `tabs`
123
+ * Updated screenshots and example
124
+
125
+ = 1.3.4 - 13/08/15 =
126
+ * Fixed typo in widget
127
+ * Fixed labels in widget
128
+ * Changed languages to load from a local file instead of Facebook's Locales XML file. This fixes the issue where approximately 40 languages were supported by Facebook but not for the page plugin, and also users working locally without internet access are now able to change the language from default.
129
+ * Re-introduced App ID, while it should not be needed it appears that removing it has affected some sites.
130
+
131
+ = 1.3.3 - 11/08/15 =
132
+ * Direct access security update
133
+ * Verifying compatibility with WP 4.2.4 and WP 4.3
134
+ * Fixing bug where some options in the widget would revert to the default instead of false
135
+
136
+ = 1.3.2 - 25/07/15 =
137
+ * WP 4.2.3 Compatibility
138
+ * Upgrading to Graph API 2.4
139
+
140
+ = 1.3.0 - 02/07/15 =
141
+ * Added hide-cta, small-header and adapt-container-width settings
142
+ * Adjusted min height and width
143
+
144
+ = 1.2.5 - 06/06/15 =
145
+ * Fixed close icon on notice
146
+
147
+ = 1.2.4 - 05/06/15 =
148
+ * Fixed readme
149
+
150
+ = 1.2.3 - 04/06/15 =
151
+ * Fixed bug where the admin dashboard and widgets pages would break if the WordPress installation is running on localhost and there is no internet connection
152
+
153
+ = 1.2.2 - 27/05/15 =
154
+ * Fixed posts option for widget
155
+
156
+ = 1.2.1 - 27/05/15 =
157
+ * Fixed readme bug
158
+
159
+ = 1.2.0 - 26/05/15 =
160
+ * Added multilingual support. Language can be specified in the shortcode, otherwise it is retrievd from the site settings.
161
+ * Added a shortcode generator dashboard widget to allow easier creation of the shortcode
162
+ * Added a custom widget
163
+
164
+ = 1.1.1 - 14/05/15 =
165
+ * Fixed height bug
166
+
167
+ = 1.1.0 - 10/05/15 =
168
+ * Added filter to allow calling of shortcodes in the text widget
169
+
170
+ = 1.0.3 - 28/04/15 =
171
+ * Fixing screenshot issue
172
+
173
+ = 1.0.1 - 28/04/15 =
174
+ * Cleaning up readme file
175
+
176
+ = 1.0 - 25/04/15 =
177
+ * Initial release
178
+
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
+
186
+ `href` (URL path that comes after facebook.com/)
187
+
188
+ `width` (number, in pixels, between 180 and 500, default 340)
189
+
190
+ `height` (number, in pixels, minimum 70, default 500)
191
+
192
+ `cover` (true/false, show page cover photo, default true)
193
+
194
+ `facepile` (true/false, show facepile, default true)
195
+
196
+ `tabs` (any combination of [posts, messages, events], default timeline)
197
+
198
+ `cta` (true/false, hide custom call to action if applicable, default false)
199
+
200
+ `small` (true/false, display small header (must be true for height to be lower than 130px), default false)
201
+
202
+ `adapt` (true/false, force plugin to be responsive, default true)
203
+
204
+ `language` (languageCode_countryCode eg: en_US, language of the plugin, default site language)
205
+
206
+ * Deprecated Settings *
207
+
208
+ `posts` (true/false) - posts has been replaced by tabs as of 1.4.0. There is a fallback in place to convert it to tabs
209
+
210
+ Example: `[facebook-page-plugin href="facebook" width="300" height="500" cover="true" facepile="true" tabs="timeline" adapt="true"]`
211
+ This will display a Facebook page feed that loads in the page `facebook.com/facebook` that is 300px wide but adapts to it's container, 500px high, displaying the page's cover photo, facepile and recent posts in the same language as the site. See the screenshots tab for a demonstration of how it will appear
212
+
213
+
214
+ == Filter Reference ==
215
+
216
+ `facebook_page_plugin_dashboard_widget_capability`
217
+
218
+ Changes who can see the shortcode generator on the dashboard. Default: `edit_posts`
219
+
220
+ `facebook_page_plugin_app_id`
221
+
222
  Changes the Facebook App ID.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file