PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.10.0
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.10.0
4.12.0 4.10.0 4.9.0 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
Blocks 3 weeks ago Traits 3 weeks ago CFF_About_Us.php 3 weeks ago CFF_Admin.php 3 weeks ago CFF_Admin_Notices.php 3 weeks ago CFF_Callout.php 3 weeks ago CFF_Global_Settings.php 3 weeks ago CFF_Install_Skin.php 3 weeks ago CFF_New_User.php 3 weeks ago CFF_Notifications.php 3 weeks ago CFF_Onboarding_Wizard.php 3 weeks ago CFF_Support.php 3 weeks ago CFF_Support_Tool.php 3 weeks ago CFF_Upgrader.php 3 weeks ago CFF_oEmbeds.php 3 weeks ago index.php 3 weeks ago
CFF_Support.php
758 lines
1 <?php
2
3 /**
4 * The Settings Page
5 *
6 * @since 4.0
7 */
8
9 namespace CustomFacebookFeed\Admin;
10
11 if (! defined('ABSPATH')) {
12 exit; // Exit if accessed directly
13 }
14
15 use CustomFacebookFeed\CFF_View;
16 use CustomFacebookFeed\CFF_Utils;
17 use CustomFacebookFeed\CFF_Response;
18 use CustomFacebookFeed\SB_Facebook_Data_Manager;
19 use CustomFacebookFeed\Builder\CFF_Db;
20 use CustomFacebookFeed\CFF_Feed_Locator;
21 use CustomFacebookFeed\Builder\CFF_Feed_Builder;
22 use CustomFacebookFeed\CFF_GDPR_Integrations;
23 use CustomFacebookFeed\Builder\CFF_Feed_Saver_Manager;
24
25 class CFF_Support
26 {
27 /**
28 * Admin menu page slug.
29 *
30 * @since 4.0
31 *
32 * @var string
33 */
34 const SLUG = 'cff-support';
35
36 /**
37 * Initializing the class
38 *
39 * @since 4.0
40 */
41 public function __construct()
42 {
43 $this->init();
44 }
45
46 /**
47 * Determining if the user is viewing the our page, if so, party on.
48 *
49 * @since 4.0
50 */
51 public function init()
52 {
53 if (! is_admin()) {
54 return;
55 }
56
57 add_action('admin_menu', [ $this, 'register_menu' ]);
58 add_action('wp_ajax_cff_export_settings_json', [$this, 'cff_export_settings_json']);
59 }
60
61 /**
62 * Register Menu.
63 *
64 * @since 4.0
65 */
66 public function register_menu()
67 {
68 $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options';
69 $cap = apply_filters('cff_settings_pages_capability', $cap);
70
71 $support_page = add_submenu_page(
72 'cff-top',
73 __('Support', 'custom-facebook-feed'),
74 __('Support', 'custom-facebook-feed'),
75 $cap,
76 self::SLUG,
77 [$this, 'support_page'],
78 4
79 );
80 add_action('load-' . $support_page, [$this,'support_page_enqueue_assets']);
81 }
82
83 /**
84 * Enqueue Extension CSS & Script.
85 *
86 * Loads only for Extension page
87 *
88 * @since 4.0
89 */
90 public function support_page_enqueue_assets()
91 {
92 if (! get_current_screen()) {
93 return;
94 }
95 $screen = get_current_screen();
96 if (! 'facebook-feed_page_cff-support' === $screen->id) {
97 return;
98 }
99
100 wp_enqueue_style(
101 'cff-fira-code-font',
102 'https://fonts.googleapis.com/css2?family=Fira+Code&display=swap',
103 false,
104 CFFVER
105 );
106
107 wp_enqueue_style(
108 'support-style',
109 CFF_PLUGIN_URL . 'admin/assets/css/support.css',
110 false,
111 CFFVER
112 );
113
114 wp_enqueue_script(
115 'sb-vue',
116 CFF_PLUGIN_URL . 'admin/assets/js/vue.min.js',
117 null,
118 '2.6.12',
119 true
120 );
121
122 wp_enqueue_script(
123 'support-app',
124 CFF_PLUGIN_URL . 'admin/assets/js/support.js',
125 array( 'sb-vue' ),
126 CFFVER,
127 true
128 );
129
130 $cff_support = $this->page_data();
131
132 wp_localize_script(
133 'support-app',
134 'cff_support',
135 $cff_support
136 );
137 }
138
139 /**
140 * Page Data to use in front end
141 *
142 * @since 4.0
143 *
144 * @return array
145 */
146 public function page_data()
147 {
148 $exported_feeds = CFF_Db::feeds_query();
149 $feeds = array();
150 foreach ($exported_feeds as $feed_id => $feed) {
151 $feeds[] = array(
152 'id' => $feed['id'],
153 'name' => $feed['feed_name']
154 );
155 }
156
157 $return = array(
158 'admin_url' => admin_url(),
159 'ajax_handler' => admin_url('admin-ajax.php'),
160 'nonce' => wp_create_nonce('cff-admin'),
161 'links' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_links_with_utm(),
162 'supportPageUrl' => admin_url('admin.php?page=cff-support'),
163 'siteSearchUrl' => 'https://smashballoon.com/search/?utm_campaign=facebook-free&utm_source=support&utm_medium=search',
164 'system_info' => $this->get_system_info(),
165 'system_info_n' => str_replace("</br>", "\n", $this->get_system_info()),
166 'feeds' => $feeds,
167 'supportUrl' => $this->get_support_url(),
168 'svgIcons' => CFF_Feed_Builder::builder_svg_icons(),
169 'socialWallLinks' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_social_wall_links(),
170 'socialWallActivated' => is_plugin_active('social-wall/social-wall.php'),
171 'tempUser' => \CustomFacebookFeed\Admin\CFF_Support_Tool::check_temporary_user_exists(),
172 'genericText' => array(
173 'help' => __('Help', 'custom-facebook-feed'),
174 'title' => __('Support', 'custom-facebook-feed'),
175 'gettingStarted' => __('Getting Started', 'custom-facebook-feed'),
176 'someHelpful' => __('Some helpful resources to get you started', 'custom-facebook-feed'),
177 'docsN' => __('Docs & Troubleshooting', 'custom-facebook-feed'),
178 'runInto' => __('Run into an issue? Check out our help docs.', 'custom-facebook-feed'),
179 'additionalR' => __('Additional Resources', 'custom-facebook-feed'),
180 'toHelp' => __('To help you get the most out of the plugin', 'custom-facebook-feed'),
181 'needMore' => __('Need more support? We’re here to help.', 'custom-facebook-feed'),
182 'neverPost' => '*' . __('Do not include your "System Info" with forum posts.', 'custom-facebook-feed'),
183 'ourFast' => __('Our fast and friendly support team is always happy to help!', 'custom-facebook-feed'),
184 'systemInfo' => __('System Info', 'custom-facebook-feed'),
185 'exportSettings' => __('Export Settings', 'custom-facebook-feed'),
186 'shareYour' => __('Share your plugin settings easily with Support', 'custom-facebook-feed'),
187 'copiedToClipboard' => __('Copied to clipboard', 'custom-facebook-feed'),
188 'learnMore' => __('Learn More', 'custom-facebook-feed'),
189 'delete' => __('Delete', 'custom-facebook-feed'),
190 'copyLink' => __('Copy Link', 'custom-facebook-feed'),
191 'link' => __('Link', 'custom-facebook-feed'),
192 'expires' => __('Expires in', 'custom-facebook-feed'),
193 'days' => __('Days', 'custom-facebook-feed'),
194 'day' => __('Day', 'custom-facebook-feed'),
195
196 'newTempHeading' => __('Temporary Login', 'custom-facebook-feed'),
197 'newTempDesc' => __('Our team might require temporary login access with limited access to only our plugin to help you test your issues.', 'custom-facebook-feed'),
198 'newTempButton' => __('Create Temporary Login Link', 'custom-facebook-feed'),
199
200 'tempLoginHeading' => __('Temporary Login', 'custom-facebook-feed'),
201 'tempLoginDesc' => __('Temporary Login link for support access created by you. This is auto-destructed 14 days after creation. To create a new link, please delete the old one.', 'custom-facebook-feed'),
202 ),
203 'buttons' => array(
204 'searchDoc' => __('Search Documentation', 'custom-facebook-feed'),
205 'moreHelp' => __('More help on Getting started', 'custom-facebook-feed'),
206 'viewDoc' => __('View Documentation', 'custom-facebook-feed'),
207 'viewBlog' => __('View Blog', 'custom-facebook-feed'),
208 'submitTicket' => __('Get Help in the WordPress.org Forum', 'custom-facebook-feed'),
209 'copy' => __('Copy', 'custom-facebook-feed'),
210 'copied' => __('Copied', 'custom-facebook-feed'),
211 'copy' => __('Copy', 'custom-facebook-feed'),
212 'export' => __('Export', 'custom-facebook-feed'),
213 'expand' => __('Expand', 'custom-facebook-feed'),
214 'collapse' => __('Collapse', 'custom-facebook-feed'),
215 ),
216 'icons' => array(
217 'rocket' => CFF_PLUGIN_URL . 'admin/assets/img/rocket-icon.png',
218 'book' => CFF_PLUGIN_URL . 'admin/assets/img/book-icon.png',
219 'save' => CFF_PLUGIN_URL . 'admin/assets/img/save-plus-icon.png',
220 '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>',
221 '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>',
222 '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>',
223 '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"/></>',
224 '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>',
225 '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>',
226 '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>',
227 '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>',
228 '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>',
229 '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>',
230 ),
231 'images' => array(
232 'supportMembers' => CFF_PLUGIN_URL . 'admin/assets/img/support-members.png'
233 ),
234 'articles' => array(
235 'gettingStarted' => array(
236 array(
237 'title' => __('Creating your first Facebook feed', 'custom-facebook-feed'),
238 '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'
239 ),
240 array(
241 'title' => __('Displaying a Facebook Group feed', 'custom-facebook-feed'),
242 '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'
243 ),
244 array(
245 'title' => __('Customizing your feed', 'custom-facebook-feed'),
246 'link' => 'https://smashballoon.com/doc/customize-facebook-feed/?facebook&utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Customizing your feed'
247 ),
248 ),
249 'docs' => array(
250 array(
251 'title' => __('Facebook feed is not displaying', 'custom-facebook-feed'),
252 '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'
253 ),
254 array(
255 'title' => __('Facebook posts missing or feed stopped updating', 'custom-facebook-feed'),
256 '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'
257 ),
258 array(
259 'title' => __('How to resolve error messages', 'custom-facebook-feed'),
260 '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'
261 ),
262 ),
263 'resources' => array(
264 array(
265 'title' => __('Add Facebook pages or groups to the same feed', 'custom-facebook-feed'),
266 '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'
267 ),
268 array(
269 'title' => __('Display your Facebook feed as a carousel', 'custom-facebook-feed'),
270 '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'
271 ),
272 array(
273 'title' => __('Create a Facebook Reviews feed', 'custom-facebook-feed'),
274 'link' => 'https://smashballoon.com/extensions/reviews/?utm_campaign=facebook-free&utm_source=support&utm_medium=docs&utm_content=Create a Facebook Reviews feed'
275 ),
276 ),
277 )
278 );
279
280 return $return;
281 }
282
283 /**
284 * Get System Info
285 *
286 * @since 4.0
287 */
288 public function get_system_info()
289 {
290 $output = '';
291
292 $next_background_check = '';
293 $options = get_option('cff_style_settings');
294 if (wp_next_scheduled('cff_cache_cron')) {
295 // Get the timezone
296 $cff_orig_timezone = date_default_timezone_get();
297 if (isset($options[ 'cff_timezone' ])) {
298 date_default_timezone_set($options[ 'cff_timezone' ]);
299 }
300 $schedule = wp_get_schedule('cff_cache_cron');
301 if ($schedule == '30mins') {
302 $schedule = 'every ' . $schedule;
303 }
304 $cff_next_cron_event = wp_next_scheduled('cff_cache_cron');
305 $next_background_check = date('g:i a', $cff_next_cron_event) . ' (' . $schedule . ')';
306 // Reset the timezone
307 date_default_timezone_set($cff_orig_timezone);
308 } else {
309 $next_background_check = 'Nothing currently scheduled';
310 }
311 $timezone = '';
312 $timezone = isset($options[ 'cff_timezone' ]) ? $options[ 'cff_timezone' ] : '';
313
314 // Build the output strings
315 $output .= self::get_site_n_server_info();
316 $output .= self::get_active_plugins_info();
317 $output .= self::get_global_settings_info();
318 $output .= self::get_feeds_settings_info();
319 $output .= self::get_posts_table_info();
320 $output .= self::get_errors_info();
321 $output .= self::get_action_logs_info();
322 $output .= self::get_oembeds_info();
323
324 return $output;
325 }
326
327 /**
328 * Get Site and Server Info
329 *
330 * @since 4.0
331 *
332 * @return string
333 */
334 public static function get_site_n_server_info()
335 {
336 $allow_url_fopen = ini_get('allow_url_fopen') ? "Yes" : "No";
337 $php_curl = is_callable('curl_init') ? "Yes" : "No";
338 $php_json_decode = function_exists("json_decode") ? "Yes" : "No";
339 $php_ssl = in_array('https', stream_get_wrappers()) ? "Yes" : "No";
340 $plugin_name = 'Smash Balloon Custom Facebook Feed';
341
342 $output = '## SITE/SERVER INFO: ##' . "</br>";
343 $output .= 'Plugin Version:' . self::get_whitespace(11) . $plugin_name . "</br>";
344 $output .= 'Site URL:' . self::get_whitespace(17) . site_url() . "</br>";
345 $output .= 'Home URL:' . self::get_whitespace(17) . home_url() . "</br>";
346 $output .= 'WordPress Version:' . self::get_whitespace(8) . get_bloginfo('version') . "</br>";
347 $output .= 'PHP Version:' . self::get_whitespace(14) . PHP_VERSION . "</br>";
348 $output .= 'Web Server Info:' . self::get_whitespace(10) . $_SERVER['SERVER_SOFTWARE'] . "</br>";
349 $output .= 'PHP allow_url_fopen:' . self::get_whitespace(6) . $allow_url_fopen . "</br>";
350 $output .= 'PHP cURL:' . self::get_whitespace(17) . $php_curl . "</br>";
351 $output .= 'JSON:' . self::get_whitespace(21) . $php_json_decode . "</br>";
352 $output .= 'SSL Stream:' . self::get_whitespace(15) . $php_ssl . "</br>";
353 $output .= "</br>";
354
355 return $output;
356 }
357
358 /**
359 * Get Active Plugins
360 *
361 * @since 4.0
362 *
363 * @return string
364 */
365 public static function get_active_plugins_info()
366 {
367 $plugins = get_plugins();
368 $active_plugins = get_option('active_plugins');
369 $output = "## ACTIVE PLUGINS: ## </br>";
370
371 foreach ($plugins as $plugin_path => $plugin) {
372 if (in_array($plugin_path, $active_plugins)) {
373 $output .= $plugin['Name'] . ': ' . $plugin['Version'] . "</br>";
374 }
375 }
376
377 $output .= "</br>";
378
379 return $output;
380 }
381
382 /**
383 * Get Global Settings
384 *
385 * @since 4.0
386 *
387 * @return string
388 */
389 public static function get_global_settings_info()
390 {
391 $output = "## GLOBAL SETTINGS: ## </br>";
392 $cff_license_key = get_option('cff_license_key');
393 $cff_license_data = get_option('cff_license_data');
394 $cff_license_status = get_option('cff_license_status');
395 $cff_preserve_setitngs = get_option('cff_preserve_settings');
396 $cff_locale = get_option('cff_locale', 'en_US');
397 $cff_options = get_option('cff_style_settings');
398 $usage_tracking = get_option('cff_usage_tracking', array( 'last_send' => 0, 'enabled' => CFF_Utils::cff_is_pro_version() ));
399
400 $output .= 'License key: ';
401 if ($cff_license_key) {
402 $output .= $cff_license_key;
403 } else {
404 $output .= ' Not added';
405 ;
406 }
407 $output .= "</br>";
408 $output .= 'License status: ';
409 if ($cff_license_status) {
410 $output .= $cff_license_status;
411 } else {
412 $output .= ' Inactive';
413 }
414 $output .= "</br>";
415 $output .= 'Preserve settings if plugin is removed: ';
416 $output .= ( $cff_preserve_setitngs ) ? 'Yes' : 'No';
417 $output .= "</br>";
418 $output .= "Connected Accounts: ";
419 if (get_option('cff_connected_accounts')) {
420 $output .= "Connected Accounts: ";
421 } else {
422 $output .= 'No accounts are connected';
423 }
424 $output .= "</br>";
425 $output .= 'Locale: ' . $cff_locale . "</br>";
426 $output .= 'Timezone: ';
427 $output .= isset($cff_options['cff_timezone']) ? $cff_options['cff_timezone'] : '';
428 $output .= "</br>";
429 $output .= 'GDPR: ';
430 $output .= isset($cff_options[ 'gdpr' ]) ? $cff_options[ 'gdpr' ] : ' Not setup';
431 $output .= "</br>";
432 $output .= 'Custom CSS: ';
433 $output .= isset($cff_options[ 'cff_custom_css' ]) && ! empty($cff_options[ 'cff_custom_css' ]) ? $cff_options[ 'cff_custom_js' ] : 'Empty';
434 $output .= "</br>";
435 $output .= 'Custom JS: ';
436 $output .= isset($cff_options[ 'cff_custom_js' ]) && ! empty($cff_options[ 'cff_custom_js' ]) ? $cff_options[ 'cff_custom_js' ] : 'Empty';
437 $output .= "</br>";
438 $output .= 'Usage Tracking: ';
439 $output .= isset($usage_tracking['enabled']) && $usage_tracking['enabled'] == true ? 'Enabled' : 'Disabled';
440 $output .= "</br>";
441 $output .= 'AJAX theme loading fix: ';
442 $output .= isset($cff_options[ 'cff_disable_ajax_cache' ]) && $cff_options[ 'cff_disable_ajax_cache' ] == true ? 'Enabled' : 'Disabled';
443 $output .= "</br>";
444 $output .= 'Show Credit Link: ';
445 $output .= isset($cff_options['cff_format_issue']) && $cff_options['cff_format_issue'] == true ? 'Enabled' : 'Disabled';
446 $output .= "</br>";
447 $output .= 'Fix Text Shortening Issue: ';
448 $output .= isset($cff_options['cff_show_credit']) && $cff_options['cff_show_credit'] == true ? 'Enabled' : 'Disabled';
449 $output .= "</br>";
450 $output .= 'Admin Error Notice: ';
451 $output .= isset($cff_options['disable_admin_notice']) && $cff_options['disable_admin_notice'] == true ? 'Enabled' : 'Disabled';
452 $output .= "</br>";
453 $output .= 'Feed Issue Email Reports: ';
454 $output .= isset($cff_options['enable_email_report']) && $cff_options['enable_email_report'] == true ? 'Enabled' : 'Disabled';
455 $output .= "</br>";
456 $output .= 'Email notification: ';
457 $output .= isset($cff_options['email_notification']) && $cff_options['email_notification'] !== null ? ucfirst($cff_options['email_notification']) : 'Off';
458 $output .= "</br>";
459 $output .= 'Email notification addresses: ';
460 $output .= isset($cff_options['email_notification_addresses']) && !empty($cff_options['email_notification_addresses']) ? $cff_options['email_notification_addresses'] : 'Not available';
461 $output .= "</br>";
462 $output .= "</br>";
463 return $output;
464 }
465
466 /**
467 * Get Feeds Settings
468 *
469 * @since 4.0
470 *
471 * @return string
472 */
473 public static function get_feeds_settings_info()
474 {
475 $output = "## FEEDS: ## </br>";
476
477 $feeds_list = CFF_Feed_Builder::get_feed_list();
478 $source_list = CFF_Feed_Builder::get_source_list();
479 $manager = new SB_Facebook_Data_Manager();
480 $i = 0;
481 foreach ($feeds_list as $feed) {
482 if ($i >= 25) {
483 break;
484 }
485 $output .= $feed['feed_name'];
486 if (isset($feed['settings'])) {
487 $source_id = $feed['settings']->sources;
488 $source = array();
489 $output .= ' - ' . ucfirst($feed['settings']->feedtype);
490 $output .= '</br>';
491 foreach ($source_list as $source) {
492 if ($source['account_id'] == $source_id) {
493 $output .= $source['username'];
494 $output .= ' (' . $source_id . ')';
495 }
496 }
497 }
498 $output .= "</br>";
499 if (isset($feed['location_summary']) && count($feed['location_summary']) > 0) {
500 $first_feed = $feed['location_summary'][0];
501 $output .= $first_feed['link'] . '?sb_debug';
502 }
503 $output .= "</br>";
504
505 if ($i < ( count($feeds_list) - 1 )) {
506 $output .= "</br>";
507 }
508 $i++;
509 }
510 $output .= "</br>";
511
512 return $output;
513 }
514
515 /**
516 * Get Image Resizing Info
517 *
518 * @since 4.0
519 *
520 * @return string
521 */
522 public static function get_image_resizing_info()
523 {
524 $output = "## IMAGE RESIZING: ##" . "</br>";
525
526 $upload = wp_upload_dir();
527 $upload_dir = $upload['basedir'];
528 $upload_dir = trailingslashit($upload_dir) . CFF_UPLOADS_NAME;
529 if (file_exists($upload_dir)) {
530 $output .= 'upload directory exists' . "</br>";
531 } else {
532 $created = wp_mkdir_p($upload_dir);
533 if (! $created) {
534 $output .= 'cannot create upload directory';
535 }
536 }
537 $output .= "</br>";
538
539 return $output;
540 }
541
542 /**
543 * Get Posts Table Info
544 *
545 * @since 4.0
546 *
547 * @return string
548 */
549 public static function get_posts_table_info()
550 {
551 $output = "## POSTS: ## </br>";
552
553 global $wpdb;
554 $table_name = esc_sql($wpdb->prefix . CFF_POSTS_TABLE);
555 $feeds_posts_table_name = esc_sql($wpdb->prefix . CFF_FEEDS_POSTS_TABLE);
556
557 if ($wpdb->get_var("show tables like '$feeds_posts_table_name'") != $feeds_posts_table_name) {
558 $output .= 'no feeds posts table' . "</br>";
559 } else {
560 $last_result = $wpdb->get_results("SELECT * FROM $feeds_posts_table_name ORDER BY id DESC LIMIT 1;");
561 if (is_array($last_result) && isset($last_result[0])) {
562 $output .= '## FEEDS POSTS TABLE ##' . "</br>";
563 foreach ($last_result as $column) {
564 foreach ($column as $key => $value) {
565 $output .= $key . ': ' . esc_html($value) . "</br>";
566 ;
567 }
568 }
569 } else {
570 $output .= 'feeds posts has no rows';
571 $output .= "</br>";
572 }
573 }
574 $output .= "</br>";
575 if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
576 $output .= 'no posts table' . "</br>";
577 } else {
578 $last_result = $wpdb->get_results("SELECT * FROM $table_name ORDER BY id DESC LIMIT 1;");
579 if (is_array($last_result) && isset($last_result[0])) {
580 $output .= '## POSTS TABLE ##';
581 $output .= "</br>";
582 foreach ($last_result as $column) {
583 foreach ($column as $key => $value) {
584 $output .= $key . ': ' . esc_html($value) . "</br>";
585 ;
586 }
587 }
588 } else {
589 $output .= 'feeds posts has no rows' . "</br>";
590 }
591 }
592 $output .= "</br>";
593
594 return $output;
595 }
596
597 /**
598 * CFF Get Errors Info
599 *
600 * @since 4.0
601 *
602 * @return string
603 */
604 public static function get_errors_info()
605 {
606 $output = "## ERRORS: ##" . "</br>";
607 $errors = \cff_main()->cff_error_reporter->get_errors();
608 if (! empty($errors['resizing']) && is_string($errors['resizing'])) :
609 $output .= '* Resizing *' . "</br>";
610 $output .= $errors['resizing'] . "</br>";
611 endif;
612 if (! empty($errors['database_create'])) :
613 $output .= '* Database Create *' . "</br>";
614 $output .= $errors['database_create'] . "</br>";
615 endif;
616 if (! empty($errors['upload_dir'])) :
617 $output .= '* Uploads Directory *' . "</br>";
618 $output .= $errors['upload_dir'] . "</br>";
619 endif;
620 if (! empty($errors['connection'])) :
621 $output .= '* API/WP_HTTP Request *' . "</br>";
622 $output .= print_r($errors['connection'], true);
623 endif;
624 $output .= "</br>";
625
626 return $output;
627 }
628
629 /**
630 * Get Action Logs Info
631 *
632 * @since 4.0
633 *
634 * @return string
635 */
636 public static function get_action_logs_info()
637 {
638 $output = "## ACTION LOG ##" . "</br>";
639 $actions = \cff_main()->cff_error_reporter->get_action_log();
640 if (! empty($actions)) :
641 foreach ($actions as $action) :
642 $output .= strip_tags($action) . "</br>";
643 endforeach;
644 endif;
645 $output .= "</br>";
646
647 return $output;
648 }
649
650 /**
651 * Get Feeds Settings
652 *
653 * @since 4.0
654 *
655 * @return string
656 */
657 public static function get_oembeds_info()
658 {
659 $output = "## OEMBED: ##" . "</br>";
660 $oembed_token_settings = get_option('cff_oembed_token', array());
661 foreach ($oembed_token_settings as $key => $value) {
662 $output .= $key . ': ' . esc_attr($value) . "</br>";
663 }
664
665 return $output;
666 }
667
668 /**
669 * CFF Get Support URL
670 *
671 * @since 4.0
672 *
673 * @return string $url
674 */
675 public function get_support_url()
676 {
677 $license_type = CFF_Utils::cff_is_pro_version() ? 'pro' : 'free';
678 if ($license_type === 'free') {
679 return 'https://wordpress.org/support/plugin/custom-facebook-feed/';
680 }
681
682 $url = 'https://smashballoon.com/custom-facebook-feed/support/?utm_campaign=facebook-free&utm_source=support&utm_medium=support';
683 $args = array();
684 $license_key = get_option('cff_license_key');
685 if ($license_key) {
686 $license_key = sb_encrypt_decrypt('encrypt', $license_key);
687 $args['license'] = $license_key;
688 }
689
690 $args['license_type'] = $license_type;
691 $args['version'] = CFFVER;
692 $url = add_query_arg($args, $url);
693 return $url;
694 }
695
696 /**
697 * CFF Export Feed Settings JSON
698 *
699 * @since 4.0
700 *
701 * @return CFF_Response
702 */
703 public function cff_export_settings_json()
704 {
705 // \CustomFacebookFeed\Builder\CFF_Feed_Builder::check_privilege( false );
706 // Security Checks
707 check_ajax_referer('cff-admin', 'nonce');
708
709 $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options';
710 $cap = apply_filters('cff_settings_pages_capability', $cap);
711 if (! current_user_can($cap)) {
712 wp_send_json_error(); // This auto-dies.
713 }
714
715 if (! isset($_GET['feed_id'])) {
716 return;
717 }
718 $feed_id = filter_var($_GET['feed_id'], FILTER_SANITIZE_NUMBER_INT);
719 $feed = CFF_Feed_Saver_Manager::get_export_json($feed_id);
720 $feed_info = CFF_Db::feeds_query(array('id' => $feed_id));
721 $feed_name = strtolower($feed_info[0]['feed_name']);
722 $filename = 'cff-feed-' . $feed_name . '.json';
723 // Creates a new csv file and store it in tmp directory
724 $file = fopen('/tmp/' . $filename, 'w');
725 fwrite($file, $feed);
726 fclose($file);
727 // output headers so that the file is downloaded rather than displayed
728 header("Content-type: application/json");
729 header("Content-disposition: attachment; filename = " . $filename);
730 readfile("/tmp/" . $filename);
731 exit;
732 }
733
734 /**
735 * CFF Get Whitespace
736 *
737 * @since 4.0
738 *
739 * @param int $times
740 *
741 * @return string
742 */
743 public static function get_whitespace($times)
744 {
745 return str_repeat('&nbsp;', $times);
746 }
747
748 /**
749 * Extensions Manager Page View Template
750 *
751 * @since 4.0
752 */
753 public function support_page()
754 {
755 CFF_View::render('support.index');
756 }
757 }
758