PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.1.2
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.1.2
4.8.1 trunk 1.0 1.1 1.12.1 1.2.3 1.2.4 1.2.5 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5 1.5.1 1.5.2 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.5.1 1.6.6 1.6.6.1 1.6.6.2 1.6.6.3 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.9.0 1.9.1 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.8.1 1.9.9 1.9.9.1 1.9.9.2 1.9.9.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.10 2.11 2.11.1 2.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13 2.14 2.14.1 2.15 2.15.1 2.16 2.16.1 2.17 2.17.1 2.18 2.18.1 2.18.2 2.18.3 2.19 2.19.1 2.19.2 2.19.3 2.2 2.2.1 2.3 2.3.1 2.3.10 2.3.2 2.3.3 2.3.4 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.1.1 2.4.1.2 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.7 2.7.1 2.7.2 2.8 2.9 2.9.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.7.5 4.7.6 4.7.7
custom-facebook-feed / inc / Admin / CFF_Support.php
custom-facebook-feed / inc / Admin Last commit date
Traits 4 years ago CFF_About.php 4 years ago CFF_About_Us.php 4 years ago CFF_Admin.php 4 years ago CFF_Global_Settings.php 4 years ago CFF_Install_Skin.php 4 years ago CFF_New_User.php 4 years ago CFF_Notifications.php 4 years ago CFF_Support.php 4 years ago CFF_Tracking.php 4 years ago CFF_Upgrader.php 4 years ago CFF_oEmbeds.php 4 years ago
CFF_Support.php
712 lines
1 <?php
2
3 /**
4 * The Settings Page
5 *
6 * @since 4.0
7 */
8
9 namespace CustomFacebookFeed\Admin;
10 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
12 use CustomFacebookFeed\CFF_View;
13 use CustomFacebookFeed\CFF_Utils;
14 use CustomFacebookFeed\CFF_Response;
15 use CustomFacebookFeed\SB_Facebook_Data_Manager;
16 use CustomFacebookFeed\Builder\CFF_Db;
17 use CustomFacebookFeed\CFF_Feed_Locator;
18 use CustomFacebookFeed\Builder\CFF_Feed_Builder;
19 use CustomFacebookFeed\CFF_GDPR_Integrations;
20 use CustomFacebookFeed\Builder\CFF_Feed_Saver_Manager;
21
22 class CFF_Support {
23 /**
24 * Admin menu page slug.
25 *
26 * @since 4.0
27 *
28 * @var string
29 */
30 const SLUG = 'cff-support';
31
32 /**
33 * Initializing the class
34 *
35 * @since 4.0
36 */
37 function __construct(){
38 $this->init();
39 }
40
41 /**
42 * Determining if the user is viewing the our page, if so, party on.
43 *
44 * @since 4.0
45 */
46 public function init() {
47 if ( ! is_admin() ) {
48 return;
49 }
50
51 add_action( 'admin_menu', [ $this, 'register_menu' ] );
52 add_action( 'wp_ajax_cff_export_settings_json', [$this, 'cff_export_settings_json'] );
53 }
54
55 /**
56 * Register Menu.
57 *
58 * @since 4.0
59 */
60 function register_menu() {
61 $cap = current_user_can( 'manage_custom_facebook_feed_options' ) ? 'manage_custom_facebook_feed_options' : 'manage_options';
62 $cap = apply_filters( 'cff_settings_pages_capability', $cap );
63
64 $support_page = add_submenu_page(
65 'cff-top',
66 __( 'Support', 'custom-facebook-feed' ),
67 __( 'Support', 'custom-facebook-feed' ),
68 $cap,
69 self::SLUG,
70 [$this, 'support_page'],
71 4
72 );
73 add_action( 'load-' . $support_page, [$this,'support_page_enqueue_assets']);
74 }
75
76 /**
77 * Enqueue Extension CSS & Script.
78 *
79 * Loads only for Extension page
80 *
81 * @since 4.0
82 */
83 public function support_page_enqueue_assets(){
84 if( ! get_current_screen() ) {
85 return;
86 }
87 $screen = get_current_screen();
88 if ( ! 'facebook-feed_page_cff-support' === $screen->id ) {
89 return;
90 }
91
92 wp_enqueue_style(
93 'cff-fira-code-font',
94 'https://fonts.googleapis.com/css2?family=Fira+Code&display=swap',
95 false,
96 CFFVER
97 );
98
99 wp_enqueue_style(
100 'support-style',
101 CFF_PLUGIN_URL . 'admin/assets/css/support.css',
102 false,
103 CFFVER
104 );
105
106 wp_enqueue_script(
107 'vue-main',
108 'https://cdn.jsdelivr.net/npm/vue@2.6.12',
109 null,
110 '2.6.12',
111 true
112 );
113
114 wp_enqueue_script(
115 'support-app',
116 CFF_PLUGIN_URL.'admin/assets/js/support.js',
117 null,
118 CFFVER,
119 true
120 );
121
122 $cff_support = $this->page_data();
123
124 wp_localize_script(
125 'support-app',
126 'cff_support',
127 $cff_support
128 );
129 }
130
131 /**
132 * Page Data to use in front end
133 *
134 * @since 4.0
135 *
136 * @return array
137 */
138 public function page_data() {
139 $exported_feeds = CFF_Db::feeds_query();
140 $feeds = array();
141 foreach( $exported_feeds as $feed_id => $feed ) {
142 $feeds[] = array(
143 'id' => $feed['id'],
144 'name' => $feed['feed_name']
145 );
146 }
147
148 $return = array(
149 'admin_url' => admin_url(),
150 'ajax_handler' => admin_url( 'admin-ajax.php' ),
151 'nonce' => wp_create_nonce( 'cff-admin' ),
152 'links' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_links_with_utm(),
153 'supportPageUrl' => admin_url( 'admin.php?page=cff-support' ),
154 'siteSearchUrl' => 'https://smashballoon.com/search/',
155 'system_info' => $this->get_system_info(),
156 'system_info_n' => str_replace("</br>", "\n", $this->get_system_info()),
157 'feeds' => $feeds,
158 'supportUrl' => $this->get_support_url(),
159 'svgIcons' => CFF_Feed_Builder::builder_svg_icons(),
160 'socialWallLinks' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_social_wall_links(),
161 'socialWallActivated' => is_plugin_active( 'social-wall/social-wall.php' ),
162 'genericText' => array(
163 'help' => __( 'Help', 'custom-facebook-feed' ),
164 'title' => __( 'Support', 'custom-facebook-feed' ),
165 'gettingStarted' => __( 'Getting Started', 'custom-facebook-feed' ),
166 'someHelpful' => __( 'Some helpful resources to get you started', 'custom-facebook-feed' ),
167 'docsN' => __( 'Docs & Troubleshooting', 'custom-facebook-feed' ),
168 'runInto' => __( 'Run into an issue? Check out our help docs.', 'custom-facebook-feed' ),
169 'additionalR' => __( 'Additional Resources', 'custom-facebook-feed' ),
170 'toHelp' => __( 'To help you get the most out of the plugin', 'custom-facebook-feed' ),
171 'needMore' => __( 'Need more support? We’re here to help.', 'custom-facebook-feed' ),
172 'ourFast' => __( 'Our fast and friendly support team is always happy to help!', 'custom-facebook-feed' ),
173 'systemInfo' => __( 'System Info', 'custom-facebook-feed' ),
174 'exportSettings' => __( 'Export Settings', 'custom-facebook-feed' ),
175 'shareYour' => __( 'Share your plugin settings easily with Support', 'custom-facebook-feed' ),
176 'copiedToClipboard' => __( 'Copied to clipboard', 'custom-facebook-feed' ),
177 ),
178 'buttons' => array(
179 'searchDoc' => __( 'Search Documentation', 'custom-facebook-feed' ),
180 'moreHelp' => __( 'More help on Getting started', 'custom-facebook-feed' ),
181 'viewDoc' => __( 'View Documentation', 'custom-facebook-feed' ),
182 'viewBlog' => __( 'View Blog', 'custom-facebook-feed' ),
183 'submitTicket' => __( 'Submit a Support Ticket', 'custom-facebook-feed' ),
184 'copy' => __( 'Copy', 'custom-facebook-feed' ),
185 'copied' => __( 'Copied', 'custom-facebook-feed' ),
186 'copy' => __( 'Copy', 'custom-facebook-feed' ),
187 'export' => __( 'Export', 'custom-facebook-feed' ),
188 'expand' => __( 'Expand', 'custom-facebook-feed' ),
189 'collapse' => __( 'Collapse', 'custom-facebook-feed' ),
190 ),
191 'icons' => array(
192 'rocket' => CFF_PLUGIN_URL . 'admin/assets/img/rocket-icon.png',
193 'book' => CFF_PLUGIN_URL . 'admin/assets/img/book-icon.png',
194 'save' => CFF_PLUGIN_URL . 'admin/assets/img/save-plus-icon.png',
195 'magnify' => '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.91667 0.5C7.35326 0.5 8.73101 1.07068 9.74683 2.08651C10.7627 3.10233 11.3333 4.48008 11.3333 5.91667C11.3333 7.25833 10.8417 8.49167 10.0333 9.44167L10.2583 9.66667H10.9167L15.0833 13.8333L13.8333 15.0833L9.66667 10.9167V10.2583L9.44167 10.0333C8.45879 10.8723 7.20892 11.3333 5.91667 11.3333C4.48008 11.3333 3.10233 10.7627 2.08651 9.74683C1.07068 8.73101 0.5 7.35326 0.5 5.91667C0.5 4.48008 1.07068 3.10233 2.08651 2.08651C3.10233 1.07068 4.48008 0.5 5.91667 0.5ZM5.91667 2.16667C3.83333 2.16667 2.16667 3.83333 2.16667 5.91667C2.16667 8 3.83333 9.66667 5.91667 9.66667C8 9.66667 9.66667 8 9.66667 5.91667C9.66667 3.83333 8 2.16667 5.91667 2.16667Z" fill="#141B38"/></svg>',
196 'rightAngle' => '<svg width="7" height="11" viewBox="0 0 5 8" fill="#000" xmlns="http://www.w3.org/2000/svg"><path d="M1.00006 0L0.0600586 0.94L3.11339 4L0.0600586 7.06L1.00006 8L5.00006 4L1.00006 0Z" fill="#000"/></svg>',
197 'linkIcon' => '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.166626 10.6583L8.99163 1.83329H3.49996V0.166626H11.8333V8.49996H10.1666V3.00829L1.34163 11.8333L0.166626 10.6583Z" fill="#141B38"/></svg>',
198 'plusIcon' => '<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0832 6.83317H7.08317V11.8332H5.4165V6.83317H0.416504V5.1665H5.4165V0.166504H7.08317V5.1665H12.0832V6.83317Z" fill="white"/></>',
199 'loaderSVG' => '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>',
200 'checkmarkSVG' => '<svg width="13" height="10" viewBox="0 0 13 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.13112 6.88917L11.4951 0.525204L12.9093 1.93942L5.13112 9.71759L0.888482 5.47495L2.3027 4.06074L5.13112 6.88917Z" fill="#8C8F9A"/></svg>',
201 'forum' => '<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.8335 14V3.50004C19.8335 3.19062 19.7106 2.89388 19.4918 2.67508C19.273 2.45629 18.9762 2.33337 18.6668 2.33337H3.50016C3.19074 2.33337 2.894 2.45629 2.6752 2.67508C2.45641 2.89388 2.3335 3.19062 2.3335 3.50004V19.8334L7.00016 15.1667H18.6668C18.9762 15.1667 19.273 15.0438 19.4918 14.825C19.7106 14.6062 19.8335 14.3095 19.8335 14ZM24.5002 7.00004H22.1668V17.5H7.00016V19.8334C7.00016 20.1428 7.12308 20.4395 7.34187 20.6583C7.56066 20.8771 7.85741 21 8.16683 21H21.0002L25.6668 25.6667V8.16671C25.6668 7.85729 25.5439 7.56054 25.3251 7.34175C25.1063 7.12296 24.8096 7.00004 24.5002 7.00004Z" fill="#141B38"/></svg>',
202 'copy' => '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.33334H6C5.26667 1.33334 4.66667 1.93334 4.66667 2.66667V10.6667C4.66667 11.4 5.26667 12 6 12H12C12.7333 12 13.3333 11.4 13.3333 10.6667V2.66667C13.3333 1.93334 12.7333 1.33334 12 1.33334ZM12 10.6667H6V2.66667H12V10.6667ZM2 10V8.66667H3.33333V10H2ZM2 6.33334H3.33333V7.66667H2V6.33334ZM6.66667 13.3333H8V14.6667H6.66667V13.3333ZM2 12.3333V11H3.33333V12.3333H2ZM3.33333 14.6667C2.6 14.6667 2 14.0667 2 13.3333H3.33333V14.6667ZM5.66667 14.6667H4.33333V13.3333H5.66667V14.6667ZM9 14.6667V13.3333H10.3333C10.3333 14.0667 9.73333 14.6667 9 14.6667ZM3.33333 4V5.33334H2C2 4.6 2.6 4 3.33333 4Z" fill="#141B38"/></svg>',
203 'downAngle' => '<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.94 0.226685L4 3.28002L7.06 0.226685L8 1.16668L4 5.16668L0 1.16668L0.94 0.226685Z" fill="#141B38"/></svg>',
204 'exportSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.166748 14.6667H11.8334V13H0.166748V14.6667ZM11.8334 5.5H8.50008V0.5H3.50008V5.5H0.166748L6.00008 11.3333L11.8334 5.5Z" fill="#141B38"/></svg>',
205 ),
206 'images' => array(
207 'supportMembers' => CFF_PLUGIN_URL . 'admin/assets/img/support-members.png'
208 ),
209 'articles' => array(
210 'gettingStarted' => array(
211 array(
212 'title' => __( 'Creating your first Facebook feed', 'custom-facebook-feed' ),
213 'link' => 'https://smashballoon.com/doc/setting-up-the-free-custom-facebook-feed-wordpress-plugin-4-0/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Creating your first Facebook feed'
214 ),
215 array(
216 'title' => __( 'Displaying a Facebook Group feed', 'custom-facebook-feed' ),
217 'link' => 'https://smashballoon.com/doc/display-facebook-group-feed/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Displaying a Facebook Group feed'
218 ),
219 array(
220 'title' => __( 'Customizing your feed', 'custom-facebook-feed' ),
221 'link' => 'https://smashballoon.com/doc/customize-facebook-feed/?facebook&utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Customizing your feed'
222 ),
223 ),
224 'docs' => array(
225 array(
226 'title' => __( 'Facebook feed is not displaying', 'custom-facebook-feed' ),
227 'link' => 'https://smashballoon.com/doc/facebook-feed-doesnt-show-can-see-like-box-posts-gives/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Facebook feed is not displaying'
228 ),
229 array(
230 'title' => __( 'Facebook posts missing or feed stopped updating', 'custom-facebook-feed' ),
231 'link' => 'https://smashballoon.com/doc/facebook-feed-appears-stopped-updating-working/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Facebook posts missing or feed stopped updating'
232 ),
233 array(
234 'title' => __( 'How to resolve error messages', 'custom-facebook-feed' ),
235 'link' => 'https://smashballoon.com/doc/facebook-api-errors/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=How to resolve error messages'
236 ),
237 ),
238 'resources' => array(
239 array(
240 'title' => __( 'Add Facebook pages or groups to the same feed', 'custom-facebook-feed' ),
241 'link' => 'https://smashballoon.com/extensions/multifeed/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Add Facebook pages or groups to the same feed'
242 ),
243 array(
244 'title' => __( 'Display your Facebook feed as a carousel', 'custom-facebook-feed' ),
245 'link' => 'https://smashballoon.com/extensions/carousel/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Display your Facebook feed as a carousel'
246 ),
247 array(
248 'title' => __( 'Create a Facebook Reviews feed', 'custom-facebook-feed' ),
249 'link' => 'https://smashballoon.com/extensions/reviews/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Create a Facebook Reviews feed'
250 ),
251 ),
252 )
253 );
254
255 return $return;
256 }
257
258 /**
259 * Get System Info
260 *
261 * @since 4.0
262 */
263 public function get_system_info() {
264 $output = '';
265
266 $next_background_check = '';
267 $options = get_option('cff_style_settings');
268 if ( wp_next_scheduled( 'cff_cache_cron' ) ) {
269 //Get the timezone
270 $cff_orig_timezone = date_default_timezone_get();
271 if ( isset( $options[ 'cff_timezone' ] ) ) {
272 date_default_timezone_set( $options[ 'cff_timezone' ] );
273 }
274 $schedule = wp_get_schedule( 'cff_cache_cron' );
275 if( $schedule == '30mins' ) $schedule = 'every ' . $schedule;
276 $cff_next_cron_event = wp_next_scheduled( 'cff_cache_cron' );
277 $next_background_check = date('g:i a', $cff_next_cron_event) . ' (' . $schedule . ')';
278 //Reset the timezone
279 date_default_timezone_set( $cff_orig_timezone );
280 } else {
281 $next_background_check = 'Nothing currently scheduled';
282 }
283 $timezone = '';
284 $timezone = isset( $options[ 'cff_timezone' ] ) ? $options[ 'cff_timezone' ] : '';
285
286 // Build the output strings
287 $output .= self::get_site_n_server_info();
288 $output .= self::get_active_plugins_info();
289 $output .= self::get_global_settings_info();
290 $output .= self::get_feeds_settings_info();
291 $output .= self::get_posts_table_info();
292 $output .= self::get_errors_info();
293 $output .= self::get_action_logs_info();
294 $output .= self::get_oembeds_info();
295
296 return $output;
297 }
298
299 /**
300 * Get Site and Server Info
301 *
302 * @since 4.0
303 *
304 * @return string
305 */
306 public static function get_site_n_server_info() {
307 $allow_url_fopen = ini_get( 'allow_url_fopen' ) ? "Yes" : "No";
308 $php_curl = is_callable('curl_init') ? "Yes" : "No";
309 $php_json_decode = function_exists("json_decode") ? "Yes" : "No";
310 $php_ssl = in_array('https', stream_get_wrappers()) ? "Yes" : "No";
311 $plugin_name = 'Smash Balloon Custom Facebook Feed';
312
313 $output = '## SITE/SERVER INFO: ##' . "</br>";
314 $output .= 'Plugin Version:' . self::get_whitespace( 11 ) . $plugin_name . "</br>";
315 $output .= 'Site URL:' . self::get_whitespace( 17 ) . site_url() . "</br>";
316 $output .= 'Home URL:' . self::get_whitespace( 17 ) . home_url() . "</br>";
317 $output .= 'WordPress Version:' . self::get_whitespace( 8 ) . get_bloginfo( 'version' ) . "</br>";
318 $output .= 'PHP Version:' . self::get_whitespace( 14 ) . PHP_VERSION . "</br>";
319 $output .= 'Web Server Info:' . self::get_whitespace( 10 ) . $_SERVER['SERVER_SOFTWARE'] . "</br>";
320 $output .= 'PHP allow_url_fopen:' . self::get_whitespace( 6 ) . $allow_url_fopen . "</br>";
321 $output .= 'PHP cURL:' . self::get_whitespace( 17 ) . $php_curl . "</br>";
322 $output .= 'JSON:' . self::get_whitespace( 21 ) . $php_json_decode . "</br>";
323 $output .= 'SSL Stream:' . self::get_whitespace( 15 ) . $php_ssl . "</br>";
324 $output .= "</br>";
325
326 return $output;
327 }
328
329 /**
330 * Get Active Plugins
331 *
332 * @since 4.0
333 *
334 * @return string
335 */
336 public static function get_active_plugins_info() {
337 $plugins = get_plugins();
338 $active_plugins = get_option('active_plugins');
339 $output = "## ACTIVE PLUGINS: ## </br>";
340
341 foreach ( $plugins as $plugin_path => $plugin ) {
342 if ( in_array( $plugin_path, $active_plugins ) ) {
343 $output .= $plugin['Name'] . ': ' . $plugin['Version'] ."</br>";
344 }
345 }
346
347 $output .= "</br>";
348
349 return $output;
350 }
351
352 /**
353 * Get Global Settings
354 *
355 * @since 4.0
356 *
357 * @return string
358 */
359 public static function get_global_settings_info() {
360 $output = "## GLOBAL SETTINGS: ## </br>";
361 $cff_license_key = get_option( 'cff_license_key' );
362 $cff_license_data = get_option( 'cff_license_data' );
363 $cff_license_status = get_option( 'cff_license_status' );
364 $cff_preserve_setitngs = get_option( 'cff_preserve_settings' );
365 $cff_locale = get_option( 'cff_locale', 'en_US' );
366 $cff_options = get_option( 'cff_style_settings' );
367 $usage_tracking = get_option( 'cff_usage_tracking', array( 'last_send' => 0, 'enabled' => CFF_Utils::cff_is_pro_version() ) );
368
369 $output .= 'License key: ';
370 if ( $cff_license_key ) {
371 $output .= $cff_license_key;
372 } else {
373 $output .= ' Not added';;
374 }
375 $output .= "</br>";
376 $output .= 'License status: ';
377 if ( $cff_license_status ) {
378 $output .= $cff_license_status;
379 } else {
380 $output .= ' Inactive';
381 }
382 $output .= "</br>";
383 $output .= 'Preserve settings if plugin is removed: ';
384 $output .= ( $cff_preserve_setitngs ) ? 'Yes' : 'No';
385 $output .= "</br>";
386 $output .= "Connected Accounts: ";
387 if ( get_option( 'cff_connected_accounts' ) ) {
388 $output .= "Connected Accounts: ";
389 } else {
390 $output .= 'No accounts are connected';
391 }
392 $output .= "</br>";
393 $output .= 'Locale: ' . $cff_locale . "</br>";
394 $output .= 'Timezone: ';
395 $output .= isset( $cff_options['cff_timezone'] ) ? $cff_options['cff_timezone'] : '';
396 $output .= "</br>";
397 $output .= 'GDPR: ';
398 $output .= isset( $cff_options[ 'gdpr' ] ) ? $cff_options[ 'gdpr' ] : ' Not setup';
399 $output .= "</br>";
400 $output .= 'Custom CSS: ';
401 $output .= isset( $cff_options[ 'cff_custom_css' ] ) && ! empty( $cff_options[ 'cff_custom_css' ] ) ? $cff_options[ 'cff_custom_js' ] : 'Empty';
402 $output .= "</br>";
403 $output .= 'Custom JS: ';
404 $output .= isset( $cff_options[ 'cff_custom_js' ] ) && ! empty( $cff_options[ 'cff_custom_js' ] ) ? $cff_options[ 'cff_custom_js' ] : 'Empty';
405 $output .= "</br>";
406 $output .= 'Usage Tracking: ';
407 $output .= isset( $usage_tracking['enabled'] ) && $usage_tracking['enabled'] == true ? 'Enabled' : 'Disabled';
408 $output .= "</br>";
409 $output .= 'AJAX theme loading fix: ';
410 $output .= isset( $cff_options[ 'cff_disable_ajax_cache' ] ) && $cff_options[ 'cff_disable_ajax_cache' ] == true ? 'Enabled' : 'Disabled';
411 $output .= "</br>";
412 $output .= 'Show Credit Link: ';
413 $output .= isset( $cff_options['cff_format_issue'] ) && $cff_options['cff_format_issue'] == true ? 'Enabled' : 'Disabled';
414 $output .= "</br>";
415 $output .= 'Fix Text Shortening Issue: ';
416 $output .= isset( $cff_options['cff_show_credit'] ) && $cff_options['cff_show_credit'] == true ? 'Enabled' : 'Disabled';
417 $output .= "</br>";
418 $output .= 'Admin Error Notice: ';
419 $output .= isset( $cff_options['disable_admin_notice'] ) && $cff_options['disable_admin_notice'] == true ? 'Enabled' : 'Disabled';
420 $output .= "</br>";
421 $output .= 'Feed Issue Email Reports: ';
422 $output .= isset( $cff_options['enable_email_report'] ) && $cff_options['enable_email_report'] == true ? 'Enabled' : 'Disabled';
423 $output .= "</br>";
424 $output .= 'Email notification: ';
425 $output .= isset( $cff_options['email_notification'] ) && $cff_options['email_notification'] !== null ? ucfirst($cff_options['email_notification']) : 'Off';
426 $output .= "</br>";
427 $output .= 'Email notification addresses: ';
428 $output .= isset( $cff_options['email_notification_addresses'] ) && !empty( $cff_options['email_notification_addresses'] ) ? $cff_options['email_notification_addresses'] : 'Not available';
429 $output .= "</br>";
430 $output .= "</br>";
431 return $output;
432 }
433
434 /**
435 * Get Feeds Settings
436 *
437 * @since 4.0
438 *
439 * @return string
440 */
441 public static function get_feeds_settings_info() {
442 $output = "## FEEDS: ## </br>";
443
444 $feeds_list = CFF_Feed_Builder::get_feed_list();
445 $source_list = CFF_Feed_Builder::get_source_list();
446 $manager = new SB_Facebook_Data_Manager();
447 $i = 0;
448 foreach( $feeds_list as $feed ) {
449 if ( $i >= 25 ) {
450 break;
451 }
452 $output .= $feed['feed_name'];
453 if ( isset( $feed['settings'] ) ) {
454 $source_id = $feed['settings']->sources;
455 $source = array();
456 $output .= ' - ' . ucfirst( $feed['settings']->feedtype );
457 $output .= '</br>';
458 foreach( $source_list as $source ) {
459 if ( $source['account_id'] == $source_id ) {
460 $output .= $source['username'];
461 $output .= ' (' . $source_id . ')';
462 $output .= "</br>";
463 $output .= $manager->remote_encrypt( $source['access_token'] );
464 }
465 }
466 }
467 $output .= "</br>";
468 if ( isset( $feed['location_summary'] ) && count( $feed['location_summary'] ) > 0 ) {
469 $first_feed = $feed['location_summary'][0];
470 $output .= $first_feed['link'] . '?sb_debug';
471 }
472 $output .= "</br>";
473
474 if ( $i < ( count( $feeds_list ) - 1 ) ) {
475 $output .= "</br>";
476 }
477 $i++;
478 }
479 $output .= "</br>";
480
481 return $output;
482 }
483
484 /**
485 * Get Image Resizing Info
486 *
487 * @since 4.0
488 *
489 * @return string
490 */
491 public static function get_image_resizing_info() {
492 $output = "## IMAGE RESIZING: ##" . "</br>";
493
494 $upload = wp_upload_dir();
495 $upload_dir = $upload['basedir'];
496 $upload_dir = trailingslashit( $upload_dir ) . CFF_UPLOADS_NAME;
497 if ( file_exists( $upload_dir ) ) {
498 $output .= 'upload directory exists' . "</br>";
499 } else {
500 $created = wp_mkdir_p( $upload_dir );
501 if ( ! $created ) {
502 $output .= 'cannot create upload directory';
503 }
504 }
505 $output .= "</br>";
506
507 return $output;
508 }
509
510 /**
511 * Get Posts Table Info
512 *
513 * @since 4.0
514 *
515 * @return string
516 */
517 public static function get_posts_table_info() {
518 $output = "## POSTS: ## </br>";
519
520 global $wpdb;
521 $table_name = esc_sql( $wpdb->prefix . CFF_POSTS_TABLE );
522 $feeds_posts_table_name = esc_sql( $wpdb->prefix . CFF_FEEDS_POSTS_TABLE );
523
524 if ( $wpdb->get_var( "show tables like '$feeds_posts_table_name'" ) != $feeds_posts_table_name ) {
525 $output .= 'no feeds posts table' . "</br>";
526 } else {
527 $last_result = $wpdb->get_results( "SELECT * FROM $feeds_posts_table_name ORDER BY id DESC LIMIT 1;" );
528 if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
529 $output .= '## FEEDS POSTS TABLE ##' . "</br>";
530 foreach ( $last_result as $column ) {
531 foreach ( $column as $key => $value ) {
532 $output .= $key . ': ' . esc_html( $value ) . "</br>";;
533 }
534 }
535 } else {
536 $output .= 'feeds posts has no rows';
537 $output .= "</br>";
538 }
539 }
540 $output .= "</br>";
541 if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
542 $output .= 'no posts table' . "</br>";
543 } else {
544 $last_result = $wpdb->get_results( "SELECT * FROM $table_name ORDER BY id DESC LIMIT 1;" );
545 if ( is_array( $last_result ) && isset( $last_result[0] ) ) {
546 $output .= '## POSTS TABLE ##';
547 $output .= "</br>";
548 foreach ( $last_result as $column ) {
549 foreach ( $column as $key => $value ) {
550 $output .= $key . ': ' . esc_html( $value ) . "</br>";;
551 }
552 }
553 } else {
554 $output .= 'feeds posts has no rows' . "</br>";
555 }
556 }
557 $output .= "</br>";
558
559 return $output;
560 }
561
562 /**
563 * CFF Get Errors Info
564 *
565 * @since 4.0
566 *
567 * @return string
568 */
569 public static function get_errors_info() {
570 $output = "## ERRORS: ##" . "</br>";
571 $errors = \cff_main()->cff_error_reporter->get_errors();
572 if ( ! empty( $errors['resizing'] ) ) :
573 $output .= '* Resizing *' . "</br>";
574 $output .= $errors['resizing'] . "</br>";
575 endif;
576 if ( ! empty( $errors['database_create'] ) ) :
577 $output .= '* Database Create *' . "</br>";
578 $output .= $errors['database_create'] . "</br>";
579 endif;
580 if ( ! empty( $errors['upload_dir'] ) ) :
581 $output .= '* Uploads Directory *' . "</br>";
582 $output .= $errors['upload_dir'] . "</br>";
583 endif;
584 if ( ! empty( $errors['connection'] ) ) :
585 $output .= '* API/WP_HTTP Request *' . "</br>";
586 $output .= print_r( $errors['connection'], true );
587 endif;
588 $output .= "</br>";
589
590 return $output;
591 }
592
593 /**
594 * Get Action Logs Info
595 *
596 * @since 4.0
597 *
598 * @return string
599 */
600 public static function get_action_logs_info() {
601 $output = "## ACTION LOG ##" . "</br>";
602 $actions = \cff_main()->cff_error_reporter->get_action_log();
603 if ( ! empty( $actions ) ) :
604 foreach ( $actions as $action ) :
605 $output .= strip_tags($action) . "</br>";
606 endforeach;
607 endif;
608 $output .= "</br>";
609
610 return $output;
611 }
612
613 /**
614 * Get Feeds Settings
615 *
616 * @since 4.0
617 *
618 * @return string
619 */
620 public static function get_oembeds_info() {
621 $output = "## OEMBED: ##" . "</br>";
622 $oembed_token_settings = get_option( 'cff_oembed_token', array() );
623 foreach( $oembed_token_settings as $key => $value ) {
624 $output .= $key . ': ' . esc_attr( $value ) . "</br>";
625 }
626
627 return $output;
628 }
629
630 /**
631 * CFF Get Support URL
632 *
633 * @since 4.0
634 *
635 * @return string $url
636 */
637 public function get_support_url() {
638 $url = 'https://smashballoon.com/custom-facebook-feed/support/';
639 $license_type = CFF_Utils::cff_is_pro_version() ? 'pro' : 'free';
640
641 $args = array();
642 $license_key = get_option( 'cff_license_key' );
643 if ( $license_key ) {
644 $license_key = sb_encrypt_decrypt( 'encrypt', $license_key );
645 $args['license'] = $license_key;
646 }
647
648 $args['license_type'] = $license_type;
649 $args['version'] = CFFVER;
650 $url = add_query_arg( $args, $url );
651 return $url;
652 }
653
654 /**
655 * CFF Export Feed Settings JSON
656 *
657 * @since 4.0
658 *
659 * @return CFF_Response
660 */
661 public function cff_export_settings_json() {
662 //\CustomFacebookFeed\Builder\CFF_Feed_Builder::check_privilege( false );
663 //Security Checks
664 check_ajax_referer( 'cff-admin', 'nonce' );
665
666 $cap = current_user_can( 'manage_custom_facebook_feed_options' ) ? 'manage_custom_facebook_feed_options' : 'manage_options';
667 $cap = apply_filters( 'cff_settings_pages_capability', $cap );
668 if ( ! current_user_can( $cap ) ) {
669 wp_send_json_error(); // This auto-dies.
670 }
671
672 if ( ! isset( $_GET['feed_id'] ) ) {
673 return;
674 }
675 $feed_id = filter_var( $_GET['feed_id'], FILTER_SANITIZE_NUMBER_INT );
676 $feed = CFF_Feed_Saver_Manager::get_export_json( $feed_id );
677 $feed_info = CFF_Db::feeds_query( array('id' => $feed_id) );
678 $feed_name = strtolower( $feed_info[0]['feed_name'] );
679 $filename = 'cff-feed-' . $feed_name . '.json';
680 // Creates a new csv file and store it in tmp directory
681 $file = fopen( '/tmp/' . $filename, 'w' );
682 fwrite($file, $feed);
683 fclose($file);
684 // output headers so that the file is downloaded rather than displayed
685 header( "Content-type: application/json" );
686 header( "Content-disposition: attachment; filename = " . $filename );
687 readfile( "/tmp/" . $filename );
688 exit;
689 }
690
691 /**
692 * CFF Get Whitespace
693 *
694 * @since 4.0
695 *
696 * @param int $times
697 *
698 * @return string
699 */
700 public static function get_whitespace( $times ) {
701 return str_repeat('&nbsp;', $times );
702 }
703
704 /**
705 * Extensions Manager Page View Template
706 *
707 * @since 4.0
708 */
709 public function support_page(){
710 return CFF_View::render( 'support.index' );
711 }
712 }