PluginProbe ʕ •ᴥ•ʔ
Custom Twitter Feeds – A Tweets Widget or X Feed Widget / 2.7.0
Custom Twitter Feeds – A Tweets Widget or X Feed Widget v2.7.0
2.8.0 2.7.0 2.6.1 2.6.0 1.0 1.0.1 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.5 1.5.1 1.6 1.6.1 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1 2.1.1 2.1.2 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.5.4 2.5.5 trunk
custom-twitter-feeds / inc / Admin / CTF_Global_Settings.php
custom-twitter-feeds / inc / Admin Last commit date
Traits 1 month ago CTF_About_Us.php 1 month ago CTF_Admin_Notices.php 1 month ago CTF_Cache_Handler.php 1 month ago CTF_Global_Settings.php 1 month ago CTF_HTTP_Request.php 1 month ago CTF_New_User.php 1 month ago CTF_Notifications.php 1 month ago CTF_Response.php 1 month ago CTF_Support.php 1 month ago CTF_Upgrader.php 1 month ago CTF_View.php 1 month ago PluginSilentUpgrader.php 1 month ago PluginSilentUpgraderSkin.php 1 month ago SB_Twitter_Cache.php 1 month ago addon-functions.php 1 month ago class-install-skin.php 1 month ago
CTF_Global_Settings.php
1449 lines
1 <?php
2
3 /**
4 * The Settings Page
5 *
6 * @since 2.0
7 */
8
9 namespace TwitterFeed\Admin;
10 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11 use TwitterFeed\Admin\CTF_Response;
12 use TwitterFeed\Admin\CTF_Cache_Handler;
13 use TwitterFeed\Builder\CTF_Feed_Saver;
14 use TwitterFeed\Builder\CTF_Feed_Builder;
15 use TwitterFeed\Admin\CTF_HTTP_Request;
16 use TwitterFeed\CTF_GDPR_Integrations;
17 use TwitterFeed\Pro\CTF_Resizer;
18 use TwitterFeed\SB_Twitter_Cron_Updater;
19 use TwitterFeed\UsageTracking\Config as SmashTrackingConfig;
20
21 class CTF_Global_Settings {
22 //use CTF_Settings;
23 /**
24 * Admin menu page slug.
25 *
26 * @since 2.0
27 *
28 * @var string
29 */
30 const SLUG = 'ctf-settings';
31
32 /**
33 * Initializing the class
34 *
35 * @since 2.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 2.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('in_admin_header', [$this, 'maybe_remove_admin_footer']);
53
54 add_action( 'wp_ajax_ctf_save_settings', [$this, 'ctf_save_settings'] );
55 add_action( 'wp_ajax_ctf_activate_license', [$this, 'ctf_activate_license'] );
56 add_action( 'wp_ajax_ctf_deactivate_license', [$this, 'ctf_deactivate_license'] );
57 add_action( 'wp_ajax_ctf_test_connection', [$this, 'ctf_test_connection'] );
58 add_action( 'wp_ajax_ctf_recheck_connection', [$this, 'ctf_recheck_connection'] );
59 add_action( 'wp_ajax_ctf_import_settings_json', [$this, 'ctf_import_settings_json'] );
60 add_action( 'wp_ajax_ctf_export_settings_json', [$this, 'ctf_export_settings_json'] );
61 add_action( 'wp_ajax_ctf_clear_cache_settings', [$this, 'ctf_clear_cache_settings'] );
62 add_action( 'wp_ajax_ctf_clear_persistent_cache', [$this, 'ctf_clear_persistent_cache'] );
63 add_action( 'wp_ajax_ctf_clear_twittercard_cache', [$this, 'ctf_clear_twittercard_cache'] );
64 add_action( 'wp_ajax_ctf_clear_image_resize_cache', [$this, 'ctf_clear_image_resize_cache'] );
65 add_action( 'wp_ajax_ctf_dpa_reset', [$this, 'ctf_dpa_reset'] );
66 }
67
68 /**
69 * SBI Save Settings
70 *
71 * This will save the data fron the settings page
72 *
73 * @since 2.0
74 *
75 * @return CTF_Response
76 */
77 public function ctf_save_settings() {
78 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
79
80 $cap = ctf_get_manage_options_cap();
81 if ( ! current_user_can( $cap ) ) {
82 wp_send_json_error(); // This auto-dies.
83 }
84
85 $data = $_POST;
86 $model = isset( $data[ 'model' ] ) ? $data['model'] : null;
87
88 // return if the model is null
89 if ( null === $model ) {
90 return;
91 }
92
93 // get the ctf license key and extensions license key
94 $ctf_license_key = sanitize_text_field( $_POST['ctf_license_key'] );
95
96 // Only update the ctf_license_key value when it's inactive
97 if ( get_option( 'ctf_license_status') == 'inactive' ) {
98 if ( empty( $ctf_license_key ) || strlen( $ctf_license_key ) < 1 ) {
99 delete_option( 'ctf_license_key' );
100 delete_option( 'ctf_license_data' );
101 delete_option( 'ctf_license_status' );
102 } else {
103 update_option( 'ctf_license_key', $ctf_license_key );
104 }
105 } else {
106 $license_key = trim( get_option( 'ctf_license_key' ) );
107
108 if ( empty( $ctf_license_key ) && ! empty( $license_key ) ) {
109 $ctf_license_data = $this->get_license_data( $license_key, 'deactivate_license', CTF_PRODUCT_NAME );
110
111 delete_option( 'ctf_license_key' );
112 delete_option( 'ctf_license_data' );
113 delete_option( 'ctf_license_status' );
114 }
115 }
116
117 $model = (array) \json_decode( \stripslashes( $model ) );
118
119 $general = (array) $model['general'];
120 $feeds = (array) $model['feeds'];
121 $translation = (array) $model['translation'];
122 $advanced = (array) $model['advanced'];
123
124 // Get the values and sanitize
125 $ctf_settings = get_option( 'ctf_options', array() );
126 /**
127 * General Tab
128 */
129 $ctf_settings['preserve_settings'] = $general['preserveSettings'];
130 $ctf_settings[ CTF_SITE_ACCESS_TOKEN_KEY ] = $general['siteKey'];
131
132 // Save translation settings data
133 foreach( $translation as $key => $val ) {
134 $ctf_settings[ $key ] = $val;
135 }
136
137 /**
138 * Feeds Tab
139 */
140 if ( current_user_can( 'unfiltered_html' ) ) {
141 $ctf_settings['custom_css'] = $feeds['customCSS'];
142 $ctf_settings['custom_js'] = $feeds['customJS'];
143 }
144 $ctf_settings['gdpr'] = sanitize_text_field( $feeds['gdpr'] );
145 $ctf_settings['ctf_caching_type'] = sanitize_text_field( $feeds['cachingType'] );
146 $ctf_settings['cache_time'] = sanitize_text_field( $feeds['cacheTime'] );
147 $ctf_settings['cache_time_unit'] = sanitize_text_field( $feeds['cacheTimeUnit'] );
148
149 $ctf_settings['ctf_cache_cron_interval'] = sanitize_text_field( $feeds['cronInterval'] );
150 $ctf_settings['ctf_cache_cron_time'] = sanitize_text_field( $feeds['cronTime'] );
151 $ctf_settings['ctf_cache_cron_am_pm'] = sanitize_text_field( $feeds['cronAmPm'] );
152 /**
153 * Advanced Tab
154 */
155 $ctf_settings['rebranding'] = (bool)$advanced['rebranding'];
156 $ctf_settings['resizing'] = (bool)$advanced['resizing'];
157 $ctf_settings['persistentcache'] = (bool)$advanced['persistentcache'];
158 $ctf_settings['ajax_theme'] = (bool)$advanced['ajax_theme'];
159 $ctf_settings['headenqueue'] = (bool)$advanced['headenqueue'];
160 $ctf_settings['customtemplates'] = (bool)$advanced['customtemplates'];
161 $ctf_settings['creditctf'] = (bool)$advanced['creditctf'];
162 $ctf_settings['autores'] = (bool)$advanced['autores'];
163 $ctf_settings['customtemplates'] = (bool)$advanced['customtemplates'];
164 $ctf_settings['disableintents'] = !(bool)$advanced['enableintents'];
165 $ctf_settings['request_method'] = sanitize_text_field($advanced['request_method']);
166 $ctf_settings['cron_cache_clear'] = sanitize_text_field($advanced['cron_cache_clear']);
167 $ctf_settings['sslonly'] = (bool)$advanced['sslonly'];
168 $ctf_settings['curlcards'] = (bool)$advanced['curlcards'];
169
170
171 if ( isset( $advanced['usage_tracking'] ) ) {
172 $tracking_enabled = (bool) $advanced['usage_tracking'];
173 $usage_tracking = get_option(
174 'ctf_usage_tracking',
175 array(
176 'enabled' => SmashTrackingConfig::DEFAULT_ENABLED,
177 'last_send' => 0,
178 )
179 );
180 $last_send = is_array( $usage_tracking ) && isset( $usage_tracking['last_send'] ) ? $usage_tracking['last_send'] : 0;
181 update_option(
182 'ctf_usage_tracking',
183 array(
184 'enabled' => $tracking_enabled,
185 'last_send' => $last_send,
186 ),
187 false
188 );
189 if ( ! $tracking_enabled ) {
190 wp_clear_scheduled_hook( SmashTrackingConfig::CRON_HOOK );
191 }
192 }
193
194 // Update the ctf_style_settings option that contains data for translation and advanced tabs
195 update_option( 'ctf_options', $ctf_settings );
196
197 // clear cron caches
198 SB_Twitter_Cron_Updater::start_cron_job( $ctf_settings['ctf_cache_cron_interval'], $ctf_settings['ctf_cache_cron_time'], $ctf_settings['ctf_cache_cron_am_pm'] );
199
200 // Clear the stored caches.
201 $cache_handler = new CTF_Cache_Handler();
202 $cache_handler->clear_persistent_cache();
203
204 new CTF_Response( true, array(
205 'cronNextCheck' => $this->get_cron_next_check()
206 ) );
207 }
208
209 /**
210 * SBI Activate License Key
211 *
212 * @since 2.0
213 *
214 * @return CTF_Response
215 */
216 public function ctf_activate_license() {
217 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
218
219 $cap = ctf_get_manage_options_cap();
220 if ( ! current_user_can( $cap ) ) {
221 wp_send_json_error(); // This auto-dies.
222 }
223
224 // do the form validation to check if license_key is not empty
225 if ( empty( $_POST[ 'license_key' ] ) ) {
226 new CTF_Response( false, array(
227 'message' => __( 'License key required!', 'custom-twitter-feeds' ),
228 ) );
229 }
230 $license_key = sanitize_text_field( $_POST[ 'license_key' ] );
231 // make the remote api call and get license data
232 $ctf_license_data = $this->get_license_data( $license_key, 'activate_license', CTF_PRODUCT_NAME );
233
234 // update the license data
235 if( !empty( $ctf_license_data ) ) {
236 update_option( 'ctf_license_data', $ctf_license_data );
237 }
238 // update the licnese key only when the license status is activated
239 update_option( 'ctf_license_key', $license_key );
240 // update the license status
241 update_option( 'ctf_license_status', $ctf_license_data['license'] );
242
243 // Check if there is any error in the license key then handle it
244 $ctf_license_data = $this->get_license_error_message( $ctf_license_data );
245
246
247 // Send ajax response back to client end
248 $data = array(
249 'licenseStatus' => $ctf_license_data['license'],
250 'licenseData' => $ctf_license_data
251 );
252 new CTF_Response( true, $data );
253 }
254
255 /**
256 * SBI Deactivate License Key
257 *
258 * @since 2.0
259 *
260 * @return CTF_Response
261 */
262 public function ctf_deactivate_license() {
263 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
264
265 $cap = ctf_get_manage_options_cap();
266 if ( ! current_user_can( $cap ) ) {
267 wp_send_json_error(); // This auto-dies.
268 }
269
270 $license_key = trim( get_option( 'ctf_license_key' ) );
271 $ctf_license_data = $this->get_license_data( $license_key, 'deactivate_license', CTF_PRODUCT_NAME );
272 // update the license data
273 if( !empty( $ctf_license_data ) ) {
274 update_option( 'ctf_license_data', $ctf_license_data );
275 }
276 if ( ! $ctf_license_data['success'] ) {
277 new CTF_Response( false, array() );
278 }
279 // remove the license keys and update license key status
280 if( $ctf_license_data['license'] == 'deactivated' ) {
281 update_option( 'ctf_license_status', 'inactive' );
282 $data = array(
283 'licenseStatus' => 'inactive'
284 );
285 new CTF_Response( true, $data );
286 }
287 }
288
289 /**
290 * SBI Test Connection
291 *
292 * @since 2.0
293 *
294 * @return CTF_Response
295 */
296 public function ctf_test_connection() {
297 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
298
299 $cap = ctf_get_manage_options_cap();
300 if ( ! current_user_can( $cap ) ) {
301 wp_send_json_error(); // This auto-dies.
302 }
303
304 $license_key = get_option( 'ctf_license_key' );
305 $ctf_api_params = array(
306 'edd_action'=> 'check_license',
307 'license' => $license_key,
308 'item_name' => urlencode( CTF_PRODUCT_NAME ) // the name of our product in EDD
309 );
310 $url = add_query_arg( $ctf_api_params, CTF_LICENSE_URL );
311 $args = array(
312 'timeout' => 60,
313 'sslverify' => false
314 );
315 // Make the remote API request
316 $request = CTF_HTTP_Request::request( 'GET', $url, $args );
317 if ( CTF_HTTP_Request::is_error( $request ) ) {
318 new CTF_Response( false, array(
319 'hasError' => true
320 ) );
321 }
322
323 new CTF_Response( true, array(
324 'hasError' => false
325 ) );
326 }
327
328 /**
329 * SBI Re-Check License
330 *
331 * @since 2.0
332 *
333 * @return CTF_Response
334 */
335 public function ctf_recheck_connection() {
336 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
337
338 $cap = ctf_get_manage_options_cap();
339 if ( ! current_user_can( $cap ) ) {
340 wp_send_json_error(); // This auto-dies.
341 }
342
343 // Do the form validation
344 $license_key = isset( $_POST['license_key'] ) ? sanitize_text_field( $_POST['license_key'] ) : '';
345 $item_name = isset( $_POST['item_name'] ) ? sanitize_text_field( $_POST['item_name'] ) : '';
346 $option_name = isset( $_POST['option_name'] ) ? sanitize_text_field( $_POST['option_name'] ) : '';
347 if ( empty( $license_key ) || empty( $item_name ) ) {
348 new CTF_Response( false, array() );
349 }
350
351 // make the remote license check API call
352 $ctf_license_data = $this->get_license_data( $license_key, 'check_license', $item_name );
353
354 // update options data
355 $license_changed = $this->update_recheck_license_data( $ctf_license_data, $item_name, $option_name );
356
357 // send AJAX response back
358 new CTF_Response( true, array(
359 'license' => $ctf_license_data['license'],
360 'licenseChanged' => $license_changed
361 ) );
362 }
363
364 /**
365 * Update License Data
366 *
367 * @since 2.0
368 *
369 * @param array $license_data
370 * @param string $item_name
371 * @param string $option_name
372 *
373 * @return bool $license_changed
374 */
375 public function update_recheck_license_data( $license_data, $item_name, $option_name ) {
376 $license_changed = false;
377 // if we are updating plugin's license data
378 if ( CTF_PRODUCT_NAME == $item_name ) {
379 // compare the old stored license status with new license status
380 if ( get_option( 'ctf_license_status' ) != $license_data['license'] ) {
381 $license_changed = true;
382 }
383 update_option( 'ctf_license_data', $license_data );
384 update_option( 'ctf_license_status', $license_data['license'] );
385 }
386
387 // If we are updating extensions license data
388 if ( CTF_PRODUCT_NAME != $item_name ) {
389 // compare the old stored license status with new license status
390 if ( get_option( 'ctf_license_status_' . $option_name ) != $license_data['license'] ) {
391 $license_changed = true;
392 }
393 update_option( 'ctf_license_status_' . $option_name, $license_data['license'] );
394 }
395 // if we are updating extensions license data and it's not valid
396 // then remote the extensions license status
397 if ( CTF_PRODUCT_NAME != $item_name && 'valid' != $license_data['license'] ) {
398 delete_option( 'ctf_license_status_' . $option_name );
399 }
400
401 return $license_changed;
402 }
403
404 /**
405 * SBI Import Feed Settings JSON
406 *
407 * @since 2.0
408 *
409 * @return CTF_Response
410 */
411 public function ctf_import_settings_json() {
412 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
413
414 $cap = ctf_get_manage_options_cap();
415 if ( ! current_user_can( $cap ) ) {
416 wp_send_json_error(); // This auto-dies.
417 }
418
419 $filename = $_FILES['file']['name'];
420 $ext = pathinfo($filename, PATHINFO_EXTENSION);
421 if ( 'json' !== $ext ) {
422 new CTF_Response( false, [] );
423 }
424 $imported_settings = file_get_contents( $_FILES["file"]["tmp_name"] );
425 // check if the file is empty
426 if ( empty( $imported_settings ) ) {
427 new CTF_Response( false, [] );
428 }
429 $feed_return = \TwitterFeed\Builder\CTF_Feed_Saver_Manager::import_feed( $imported_settings );
430 // check if there's error while importing
431 if ( ! $feed_return['success'] ) {
432 new CTF_Response( false, [] );
433 }
434 // Once new feed has imported lets export all the feeds to update in front end
435 $exported_feeds = \TwitterFeed\Builder\CTF_Db::feeds_query();
436 $feeds = array();
437 foreach( $exported_feeds as $feed_id => $feed ) {
438 $feeds[] = array(
439 'id' => $feed['id'],
440 'name' => $feed['feed_name']
441 );
442 }
443
444 new CTF_Response( true, array(
445 'feeds' => $feeds
446 ) );
447 }
448
449 /**
450 * SBI Export Feed Settings JSON
451 *
452 * @since 2.0
453 *
454 * @return CTF_Response
455 */
456 public function ctf_export_settings_json() {
457 \TwitterFeed\Builder\CTF_Feed_Builder::check_privilege();
458 if ( ! isset( $_GET['feed_id'] ) ) {
459 return;
460 }
461 $feed_id = filter_var( $_GET['feed_id'], FILTER_SANITIZE_NUMBER_INT );
462 $feed = \TwitterFeed\Builder\CTF_Feed_Saver_Manager::get_export_json( $feed_id );
463 $feed_info = \TwitterFeed\Builder\CTF_Db::feeds_query( array('id' => $feed_id) );
464 $feed_name = strtolower( $feed_info[0]['feed_name'] );
465 $filename = 'ctf-feed-' . $feed_name . '.json';
466 // create a new empty file in the php memory
467 $file = fopen( 'php://memory', 'w' );
468 fwrite( $file, $feed );
469 fseek( $file, 0 );
470 header( 'Content-type: application/json' );
471 header( 'Content-disposition: attachment; filename = "' . $filename . '";' );
472 fpassthru( $file );
473 exit;
474 }
475
476 /**
477 * SBI Clear Cache
478 *
479 * @since 2.0
480 */
481 public function ctf_clear_cache_settings() {
482 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
483
484 $cap = ctf_get_manage_options_cap();
485 if ( ! current_user_can( $cap ) ) {
486 wp_send_json_error(); // This auto-dies.
487 }
488
489 // Get the updated cron schedule interval and time settings from user input and update the database
490 $model = isset( $_POST[ 'model' ] ) ? sanitize_text_field( $_POST['model'] ) : null;
491 if ( $model !== null ) {
492 $model = (array) \json_decode( \stripslashes( $model ) );
493 $feeds = (array) $model['feeds'];
494 $ctf_options = wp_parse_args( get_option( 'ctf_options' ), $this->default_settings_options() );
495
496 $cron_clear_cache = isset($ctf_options['cron_cache_clear']) ? $ctf_options['cron_cache_clear'] : 'no';
497 ctf_clear_cache_sql();
498
499 /*
500 $cache_time = isset($feeds['cache_time']) ? (int)$feeds['cache_time'] : 1;
501 $cache_time_unit = isset($feeds['cache_time_unit']) ? (int)$feeds['cache_time_unit'] : 3600;
502 if ($cron_clear_cache == 'no') {
503 wp_clear_scheduled_hook('ctf_cron_job');
504 }
505 elseif ($cron_clear_cache == 'yes') {
506 //Clear the existing cron event
507 wp_clear_scheduled_hook('ctf_cron_job');
508 //Set the event schedule based on what the caching time is set to
509 if ($cache_time_unit == 3600 && $cache_time > 5) {
510 $ctf_cron_schedule = 'twicedaily';
511 }
512 elseif ($cache_time_unit == 86400) {
513 $ctf_cron_schedule = 'daily';
514 }
515 else {
516 $ctf_cron_schedule = 'hourly';
517 }
518
519 wp_schedule_event(time() , $ctf_cron_schedule, 'ctf_cron_job');
520 }
521 */
522
523 // Clear the stored caches.
524 $cache_handler = new CTF_Cache_Handler();
525 $cache_handler->clear_all_cache();
526
527 $ctf_cache_cron_interval = $ctf_options['ctf_cache_cron_interval'];
528 $ctf_cache_cron_time = $ctf_options['ctf_cache_cron_time'];
529 $ctf_cache_cron_am_pm = $ctf_options['ctf_cache_cron_am_pm'];
530
531 SB_Twitter_Cron_Updater::start_cron_job( $ctf_cache_cron_interval, $ctf_cache_cron_time, $ctf_cache_cron_am_pm );
532 }
533
534
535
536 new CTF_Response( true, array(
537 'cronNextCheck' => $this->get_cron_next_check()
538 ) );
539 }
540
541 /**
542 * SBI Clear Image Resize Cache
543 *
544 * @since 2.0
545 */
546 public function ctf_clear_image_resize_cache() {
547 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
548 $cap = ctf_get_manage_options_cap();
549 if ( ! current_user_can( $cap ) ) {
550 wp_send_json_error(); // This auto-dies.
551 }
552 CTF_Resizer::delete_resizing_table_and_images( false );
553
554 new CTF_Response( true, [] );
555 }
556
557 /**
558 * CTF Clear Persistent Cache
559 *
560 * @since 2.0
561 */
562 public function ctf_clear_persistent_cache() {
563 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
564
565 $cap = ctf_get_manage_options_cap();
566 if ( ! current_user_can( $cap ) ) {
567 wp_send_json_error(); // This auto-dies.
568 }
569 $cache = new CTF_Cache_Handler();
570
571 $cache->clear_persistent_cache();
572 new CTF_Response( true, [] );
573 }
574
575 /**
576 * CTF Clear Persistent Cache
577 *
578 * @since 2.0
579 */
580 public function ctf_clear_twittercard_cache() {
581 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
582
583 $cap = ctf_get_manage_options_cap();
584 if ( ! current_user_can( $cap ) ) {
585 wp_send_json_error(); // This auto-dies.
586 }
587
588 $cache = new CTF_Cache_Handler();
589
590 $cache->clear_twittercard_cache();
591
592 new CTF_Response( true, [] );
593 }
594
595
596 /**
597 * SBI Clear Image Resize Cache
598 *
599 * @since 2.0
600 */
601 public function ctf_dpa_reset() {
602 check_ajax_referer( 'ctf_admin_nonce', 'nonce' );
603
604 $cap = ctf_get_manage_options_cap();
605 if ( ! current_user_can( $cap ) ) {
606 wp_send_json_error(); // This auto-dies.
607 }
608 ctf_delete_all_platform_data();
609
610 new CTF_Response( true, [] );
611 }
612
613 /**
614 * SBI Get License Data from our license API
615 *
616 * @since 2.0
617 *
618 * @param string $license_key
619 * @param string $license_action
620 *
621 * @return void|array $ctf_license_data
622 */
623 public function get_license_data( $license_key, $license_action = 'check_license', $item_name = CTF_PRODUCT_NAME ) {
624 $ctf_api_params = array(
625 'edd_action'=> $license_action,
626 'license' => $license_key,
627 'item_name' => urlencode( $item_name ) // the name of our product in EDD
628 );
629 $url = add_query_arg( $ctf_api_params, CTF_LICENSE_URL );
630 $args = array(
631 'timeout' => 60,
632 'sslverify' => false
633 );
634 // Make the remote API request
635 $request = CTF_HTTP_Request::request( 'GET', $url, $args );
636 if ( CTF_HTTP_Request::is_error( $request ) ) {
637 return;
638 }
639 $ctf_license_data = (array) CTF_HTTP_Request::data( $request );
640 return $ctf_license_data;
641 }
642
643 /**
644 * Get license error message depending on license status
645 *
646 * @since 2.0
647 *
648 * @param array $ctf_license_data
649 *
650 * @return array $ctf_license_data
651 */
652 public function get_license_error_message( $ctf_license_data ) {
653 $license_key = null;
654 if ( get_option('ctf_license_key') ) {
655 $license_key = get_option('ctf_license_key');
656 }
657
658 $upgrade_url = sprintf('https://smashballoon.com/custom-twitter-feeds/twitter-lite-upgrade/?edd_license_key=%s&upgrade=true&utm_campaign=twitter-free&utm_source=settings&utm_medium=upgrade-license', $license_key);
659 $renew_url = sprintf('https://smashballoon.com/checkout/?edd_license_key=%s&download_id=%s&utm_campaign=twitter-free&utm_source=settings&utm_medium=upgrade-license&utm_content=renew-license', $license_key, '');
660 $learn_more_url = 'https://smashballoon.com/doc/my-license-key-wont-activate/?utm_campaign=twitter-free&utm_source=settings&utm_medium=license&utm_content=learn-more';
661
662 // Check if the license key reached max site installations
663 if ( isset( $ctf_license_data['error'] ) && 'no_activations_left' === $ctf_license_data['error'] ) {
664 $ctf_license_data['errorMsg'] = sprintf(
665 '%s (%s/%s). %s <a href="%s" target="_blank">%s</a> %s <a href="%s" target="_blank">%s</a>',
666 __( 'You have reached the maximum number of sites available in your plan', 'custom-twitter-feeds' ),
667 $ctf_license_data['site_count'],
668 $ctf_license_data['max_sites'],
669 __( 'Learn more about it', 'custom-twitter-feeds' ),
670 $learn_more_url,
671 'here',
672 __( 'or upgrade your plan.', 'custom-twitter-feeds' ),
673 $upgrade_url,
674 __( 'Upgrade', 'custom-twitter-feeds' )
675 );
676 }
677 // Check if the license key has expired
678 if (
679 ( isset( $ctf_license_data['license'] ) && 'expired' === $ctf_license_data['license'] ) ||
680 ( isset( $ctf_license_data['error'] ) && 'expired' === $ctf_license_data['error'] )
681 ) {
682 $ctf_license_data['error'] = true;
683 $expired_date = new \DateTime( $ctf_license_data['expires'] );
684 $expired_date = $expired_date->format('F d, Y');
685 $ctf_license_data['errorMsg'] = sprintf(
686 '%s %s. %s <a href="%s" target="_blank">%s</a>',
687 __( 'The license expired on ', 'custom-twitter-feeds' ),
688 $expired_date,
689 __( 'Please renew it and try again.', 'custom-twitter-feeds' ),
690 $renew_url,
691 __( 'Renew', 'custom-twitter-feeds' )
692 );
693 }
694 return $ctf_license_data;
695 }
696
697 /**
698 * Conditionally remove admin footer on plugin pages only.
699 *
700 * @since 2.6
701 */
702 public function maybe_remove_admin_footer() {
703 static $plugin_pages = array(
704 'custom-twitter-feeds',
705 'ctf-feed-builder',
706 'ctf-settings',
707 'ctf-about-us',
708 'ctf-support',
709 );
710 $current_page = isset($_GET['page']) ? sanitize_key($_GET['page']) : '';
711 if (in_array($current_page, $plugin_pages, true)) {
712 add_filter('admin_footer_text', [$this, 'remove_admin_footer_text']);
713 add_filter('update_footer', [$this, 'remove_admin_footer_text'], 11);
714 }
715 }
716
717 public function remove_admin_footer_text() {
718 return '';
719 }
720
721 /**
722 * Register Menu.
723 *
724 * @since 2.0
725 */
726 function register_menu() {
727
728 $cap = ctf_get_manage_options_cap();
729
730 $notice = '';
731 /*if ( \ctf_main_pro()->ctf_error_reporter->are_critical_errors() ) {
732 $notice = ' <span class="update-plugins ctf-error-alert"><span>!</span></span>';
733 }*/
734
735 $global_settings = add_submenu_page(
736 'custom-twitter-feeds',
737 __( 'Settings', 'custom-twitter-feeds' ),
738 __( 'Settings ' . $notice , 'custom-twitter-feeds' ),
739 $cap,
740 'ctf-settings',
741 [$this, 'global_settings'],
742 1
743 );
744 add_action( 'load-' . $global_settings, [$this,'builder_enqueue_admin_scripts']);
745 }
746
747 /**
748 * Enqueue Builder CSS & Script.
749 *
750 * Loads only for builder pages
751 *
752 * @since 2.0
753 */
754 public function builder_enqueue_admin_scripts(){
755 if( ! get_current_screen() ) {
756 return;
757 }
758 $screen = get_current_screen();
759 if ( ! 'twitter-feed_page_ctf-settings' === $screen->id ) {
760 return;
761 }
762 $ctf_status = 'inactive';
763 $model = $this->get_settings_data();
764 $exported_feeds = \TwitterFeed\Builder\CTF_Db::feeds_query();
765 $feeds = array();
766 foreach( $exported_feeds as $feed_id => $feed ) {
767 $feeds[] = array(
768 'id' => $feed['id'],
769 'name' => $feed['feed_name']
770 );
771 }
772 $licenseErrorMsg = null;
773 $license_key = trim( get_option( 'ctf_license_key' ) );
774 if ( $license_key ) {
775 $license_last_check = get_option( 'ctf_license_last_check_timestamp' );
776 $date = time() - (DAY_IN_SECONDS * 90);
777 if ( $date > $license_last_check ) {
778 // make the remote api call and get license data
779 $ctf_license_data = $this->get_license_data( $license_key );
780 if( !empty($ctf_license_data) ) update_option( 'ctf_license_data', $ctf_license_data );
781 update_option( 'ctf_license_last_check_timestamp', time() );
782 } else {
783 $ctf_license_data = get_option( 'ctf_license_data' );
784 }
785 // update the license data with proper error messages when necessary
786 $ctf_license_data = $this->get_license_error_message( $ctf_license_data );
787 $ctf_status = $ctf_license_data['license'];
788 $licenseErrorMsg = ( isset( $ctf_license_data['error'] ) && isset( $ctf_license_data['errorMsg'] ) ) ? $ctf_license_data['errorMsg'] : null;
789 }
790
791 $ctf_options = get_option( 'ctf_options', array() );
792
793 wp_enqueue_style(
794 'settings-style',
795 CTF_PLUGIN_URL . 'admin/assets/css/settings.css',
796 false,
797 CTF_VERSION
798 );
799
800 \TwitterFeed\Builder\CTF_Feed_Builder::global_enqueue_ressources_scripts(true);
801
802
803 wp_enqueue_script(
804 'settings-app',
805 CTF_PLUGIN_URL.'admin/assets/js/settings.js',
806 null,
807 CTF_VERSION,
808 true
809 );
810
811 $license_key = null;
812 if ( get_option('ctf_license_key') ) {
813 $license_key = get_option('ctf_license_key');
814 }
815
816 $has_license_error = false;
817 if (
818 ( isset( $ctf_license_data['license'] ) && 'expired' === $ctf_license_data['license'] ) ||
819 ( isset( $ctf_license_data['error'] ) && ( $ctf_license_data['error'] || 'expired' == $ctf_license_data['error'] ) )
820 ) {
821 $has_license_error = true;
822 }
823
824 $upgrade_url = sprintf('https://smashballoon.com/custom-twitter-feeds/twitter-lite-upgrade/?edd_license_key=%s&upgrade=true&utm_campaign=twitter-free&utm_source=settings&utm_medium=upgrade-license', $license_key);
825 $footer_upgrade_url = 'https://smashballoon.com/custom-twitter-feeds/twitter-lite-upgrade/?utm_campaign=twitter-free&utm_source=settings&utm_medium=footer-banner&utm_content=Try Demo';
826 $usage_tracking_url = 'https://smashballoon.com/custom-twitter-feeds/usage-tracking/?utm_campaign=twitter-free&utm_source=settings&utm_medium=footer-banner&utm_content=Usage';
827 $feed_issue_email_url = 'https://smashballoon.com/email-report-is-not-in-my-inbox/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=footer-banner&utm_content=Email Issue';
828 if ( ! empty( $_GET['ctf_site_token'] )
829 && ! empty( $_GET['con_nonce'] )
830 && wp_verify_nonce( $_GET['con_nonce'], 'ctf_con' )
831 ) {
832 $ctf_site_access_token = sanitize_key( $_GET['ctf_site_token'] );
833 } else {
834 $ctf_site_access_token = isset( $ctf_options[ CTF_SITE_ACCESS_TOKEN_KEY ] ) ? $ctf_options[ CTF_SITE_ACCESS_TOKEN_KEY ] : '';
835 }
836
837 // Extract only license keys and build array for extensions license keys
838
839 $ctf_settings = array(
840 'admin_url' => admin_url(),
841 'ajax_handler' => admin_url( 'admin-ajax.php' ),
842 'nonce' => wp_create_nonce( 'ctf_admin_nonce' ),
843 'supportPageUrl' => admin_url( 'admin.php?page=ctf-support' ),
844 'builderUrl' => admin_url( 'admin.php?page=ctf-feed-builder' ),
845 'links' => $this->get_links_with_utm(),
846 'ctfRebrand' => ctf_should_rebrand_to_x(),
847 'pluginItemName' => CTF_PRODUCT_NAME,
848 'licenseType' => 'free',
849 'licenseKey' => $license_key,
850 'licenseStatus' => $ctf_status,
851 'licenseErrorMsg' => $licenseErrorMsg,
852 'extensionsLicense' => array(),
853 'extensionsLicenseKey' => array(),
854 'hasError' => $has_license_error,
855 'upgradeUrl' => $upgrade_url,
856 'footerUpgradeUrl' => $footer_upgrade_url,
857 'isDevSite' => CTF_Upgrader::is_dev_url( home_url() ),
858 'model' => $model,
859 'feeds' => $feeds,
860 'appCredentials' => CTF_Feed_Builder::get_app_credentials( $ctf_options ),
861 'connectAccountScreen' => CTF_Feed_Builder::connect_account_secreen(),
862 'appOAUTH' => ctf_oauth_url( admin_url( 'admin.php?page=ctf-settings' ) ),
863
864 //'locales' => CTF_Settings::locales(),
865 //'timezones' => CTF_Settings::timezones(),
866 //'socialWallLinks' => \TwitterFeed\Builder\CTF_Feed_Builder::get_social_wall_links(),
867 'socialWallLinks' => \TwitterFeed\Builder\CTF_Feed_Builder::get_social_wall_links(),
868 'socialWallActivated' => is_plugin_active( 'social-wall/social-wall.php' ),
869 'genericText' => \TwitterFeed\Builder\CTF_Feed_Builder::get_generic_text(),
870 'generalTab' => array(
871 'licenseBox' => array(
872 'title' => __( 'License Key', 'custom-twitter-feeds' ),
873 'description' => __( 'Your license key provides access to updates and support', 'custom-twitter-feeds' ),
874 'activeText' => __( 'Your <b>Twitter Feed Pro</b> license is Active!', 'custom-twitter-feeds' ),
875 'inactiveText' => __( 'Your <b>Twitter Feed Pro</b> license is Inactive!', 'custom-twitter-feeds' ),
876 'freeText' => __( 'Already purchased? Simply enter your license key below to activate Twitter Feed Pro.', 'custom-twitter-feeds'),
877 'inactiveFieldPlaceholder' => __( 'Paste license key here', 'custom-twitter-feeds' ),
878 'upgradeText1' => sprintf( __( 'You are using the Lite version of the plugin–no license needed. Enjoy! 🙂 To unlock more features, consider %sUpgrading to Pro%s.', 'custom-twitter-feeds' ), '<a href="' . $upgrade_url . '" target="_blank" rel="nofollow noopener">', '</a>' ),
879 'upgradeText2' => __( 'As a valued user of our Lite plugin, you receive 50% OFF - automatically applied at checkout!', 'custom-twitter-feeds' ),
880 'manageLicense' => __( 'Manage License', 'custom-twitter-feeds' ),
881 'test' => __( 'Test Connection', 'custom-twitter-feeds' ),
882 'recheckLicense' => __( 'Recheck license', 'custom-twitter-feeds' ),
883 'licenseValid' => __( 'License valid', 'custom-twitter-feeds' ),
884 'licenseExpired' => __( 'License expired', 'custom-twitter-feeds' ),
885 'connectionSuccessful' => __( 'Connection successful', 'custom-twitter-feeds' ),
886 'connectionFailed' => __( 'Connection failed', 'custom-twitter-feeds' ),
887 'viewError' => __( 'View error', 'custom-twitter-feeds' ),
888 'upgrade' => __( 'Upgrade', 'custom-twitter-feeds' ),
889 'deactivate' => __( 'Deactivate', 'custom-twitter-feeds' ),
890 'activate' => __( 'Activate', 'custom-twitter-feeds' ),
891 'installPro' => __( 'Install Pro', 'custom-twitter-feeds' ),
892 ),
893 'manageAccount' => array(
894 'title' => __( 'Twitter Integration', 'custom-twitter-feeds' ),
895 'description' => sprintf(__( 'Your feeds are automatically updated once per week. <br />Read more %shere%s about Twitter latest changes and how they affect our product.', 'custom-twitter-feeds' ), '<a href="https://smashballoon.com/doc/smash-balloon-twitter-changes-free-version/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=docs" target="_blank">', '</a>' ),
896 'button' => __( 'Change', 'custom-twitter-feeds' ),
897 'buttonConnect' => __( 'Connect new Account', 'custom-twitter-feeds' ),
898 'buttonConnectOwnApp' => __( 'Connect your Own App (V2)', 'custom-twitter-feeds' ),
899 'titleApp' => __( 'Connected Twitter App', 'custom-twitter-feeds' ),
900 'cKey' => __( 'Consumer Key', 'custom-twitter-feeds' ),
901 'cSecret' => __( 'Consumer Secret', 'custom-twitter-feeds' ),
902 'aToken' => __( 'Access Token', 'custom-twitter-feeds' ),
903 'aTokenSecret' => __( 'Access Token Secret', 'custom-twitter-feeds' ),
904 ),
905 'connectAccount' => array(
906 'emailTitle' => __( 'Connected Email', 'custom-twitter-feeds' ),
907 'siteKeyTitle' => __( 'Site Key', 'custom-twitter-feeds' ),
908 'siteKeyDescription' => __( 'This is used to fetch data from the Twitter API', 'custom-twitter-feeds' ),
909 'siteKeyButton' => __( 'Refresh', 'custom-twitter-feeds' ),
910 'siteKeyConnectButton' => __( 'Connect', 'custom-twitter-feeds' ),
911 'siteKeyPreview' => sprintf ( __( 'Your site key is %s', 'custom-twitter-feeds' ), '<span style="color: #434960;font-weight: bold;">' . esc_html( substr($ctf_site_access_token, 0, 7) . '...' ) ) . '</span>'
912 ),
913 'preserveBox' => array(
914 'title' => __( 'Preserve settings if plugin is removed', 'custom-twitter-feeds' ),
915 'description' => __( 'This will make sure that all of your feeds and settings are still saved even if the plugin is uninstalled', 'custom-twitter-feeds' ),
916 ),
917 'importBox' => array(
918 'title' => __( 'Import Feed Settings', 'custom-twitter-feeds' ),
919 'description' => __( 'You will need a JSON file previously exported from the Twitter Feed Plugin', 'custom-twitter-feeds' ),
920 'button' => __( 'Import', 'custom-twitter-feeds' ),
921 ),
922 'exportBox' => array(
923 'title' => __( 'Export Feed Settings', 'custom-twitter-feeds' ),
924 'description' => __( 'Export settings for one or more of your feeds', 'custom-twitter-feeds' ),
925 'button' => __( 'Export', 'custom-twitter-feeds' ),
926 )
927 ),
928 'feedsTab' => array(
929 'localizationBox' => array(
930 'title' => __( 'Localization', 'custom-twitter-feeds' ),
931 'tooltip' => '<p>This controls the language of any predefined text strings provided by Twitter. For example, the descriptive text that accompanies some timeline posts (eg: Smash Balloon created an event) and the text in the \'Like Box\' widget. To find out how to translate the other text in the plugin see <a href="https://smashballoon.com/ctf-how-does-the-plugin-handle-text-and-language-translation/?utm_campaign=twitter-free&utm_source=settings&utm_medium=docs" target="_blank" rel="nofollow noopener">this FAQ</a>.</p>'
932 ),
933 'timezoneBox' => array(
934 'title' => __( 'Timezone', 'custom-twitter-feeds' )
935 ),
936 /*
937 'cachingBox' => array(
938 'title' => __( 'Caching', 'custom-twitter-feeds' ),
939 'cacheTimeUnits' => array(
940 60 => __( 'Minutes', 'custom-twitter-feeds' ),
941 3600 => __( 'Hours', 'custom-twitter-feeds' ),
942 86400 => __( 'Days', 'custom-twitter-feeds' )
943 ),
944 'clearCache' => __( 'Clear All Caches', 'custom-twitter-feeds' )
945 ),
946 */
947 'cachingBox' => array(
948 'title' => __( 'Caching', 'custom-twitter-feeds' ),
949 'pageLoads' => __( 'When the Page loads', 'custom-twitter-feeds' ),
950 'inTheBackground' => __( 'In the Background', 'custom-twitter-feeds' ),
951 'promoText' => __( 'Update Feeds more often with Twitter Feed Pro', 'custom-twitter-feeds' ),
952 'noticeText' => __( 'Due to Twitter API changes, we have to limit feed updates to once a week', 'custom-twitter-feeds' ),
953 'cacheTypeOptions' => array(
954 'background' => __( 'Background', 'custom-twitter-feeds' ),
955 'page' => __( 'Page', 'custom-twitter-feeds' ),
956 ),
957 'inTheBackgroundOptions' => array(
958 '30mins' => __( 'Every 30 minutes', 'custom-twitter-feeds' ),
959 '1hour' => __( 'Every hour', 'custom-twitter-feeds' ),
960 '12hours' => __( 'Every 12 hours', 'custom-twitter-feeds' ),
961 '24hours' => __( 'Every 24 hours', 'custom-twitter-feeds' ),
962 ),
963 'cacheTimeUnits' => array(
964 60 => __( 'Minutes', 'custom-twitter-feeds' ),
965 3600 => __( 'Hours', 'custom-twitter-feeds' ),
966 86400 => __( 'Days', 'custom-twitter-feeds' )
967 ),
968 'am' => __( 'AM', 'custom-twitter-feeds' ),
969 'pm' => __( 'PM', 'custom-twitter-feeds' ),
970 'clearCache' => __( 'Clear All Caches', 'custom-twitter-feeds' ),
971 ),
972 'gdprBox' => array(
973 'title' => __( 'GDPR', 'custom-twitter-feeds' ),
974 'automatic' => __( 'Automatic', 'custom-twitter-feeds' ),
975 'yes' => __( 'Yes', 'custom-twitter-feeds' ),
976 'no' => __( 'No', 'custom-twitter-feeds' ),
977 'infoAuto' => $this->get_gdpr_auto_info(),
978 'infoYes' => __( 'No requests will be made to third-party websites. To accommodate this, some features of the plugin will be limited.', 'custom-twitter-feeds' ),
979 'infoNo' => __( 'The plugin will function as normal and load images and videos directly from Twitter', 'custom-twitter-feeds' ),
980 'someTwitter' => __( 'Some Twitter Feed features will be limited for visitors to ensure GDPR compliance, until they give consent.', 'custom-twitter-feeds'),
981 'whatLimited' => __( 'What will be limited?', 'custom-twitter-feeds'),
982 'tooltip' => '<p><b>If set to “Yes”,</b> it prevents all images from being loaded directly from Twitter’s servers (CDN) to prevent any requests to external websites in your browser. To accommodate this, some features of your plugin will be disabled or limited. </p>
983 <p><b>If set to “No”,</b> the plugin will still make some requests to load and display images directly from Twitter.</p>
984 <p><b>If set to “Automatic”,</b> it will only load images directly from Twitter if consent has been given by one of these integrated GDPR cookie Plugins.</p>
985 <p><a href="https://smashballoon.com/doc/custom-twitter-feeds-gdpr-compliance/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=gdpr&utm_content=Learn More" target="_blank" rel="nofollow noopener">Learn More</a></p>',
986 'gdprTooltipFeatureInfo' => array(
987 'headline' => __( 'Features that would be disabled or limited include: ', 'custom-twitter-feeds'),
988 'features' => array(
989 __( 'Only local images (not from Twitter\'s CDN) will be displayed in the feed.', 'custom-twitter-feeds'),
990 __( 'Users will leave your site in order to reply, share, or like a tweet in your feed.', 'custom-twitter-feeds'),
991 )
992 )
993 ),
994 'customCSSBox' => array(
995 'title' => __( 'Custom CSS', 'custom-twitter-feeds' ),
996 'placeholder' => __( 'Enter any custom CSS here', 'custom-twitter-feeds' ),
997 ),
998 'customJSBox' => array(
999 'title' => __( 'Custom JS', 'custom-twitter-feeds' ),
1000 'placeholder' => __( 'Enter any custom JS here', 'custom-twitter-feeds' ),
1001 )
1002 ),
1003 'translationTab' => array(
1004 'title' => __( 'Custom Text/Translate', 'custom-twitter-feeds' ),
1005 'description' => __( 'Enter custom text for the words below, or translate it into the language you would like to use.', 'custom-twitter-feeds' ),
1006 'table' => array(
1007 'originalText' => __( 'Original Text', 'custom-twitter-feeds' ),
1008 'customText' => __( 'Custom text/translation', 'custom-twitter-feeds' ),
1009 'context' => __( 'Context', 'custom-twitter-feeds' ),
1010 'tweetText' => __( 'Tweet Text', 'custom-twitter-feeds' ),
1011 'retweeted' => __( 'Retweeted', 'custom-twitter-feeds' ),
1012 'retweetedCtnx' => __( 'Used for showing retweets', 'custom-twitter-feeds' ),
1013 'inReplyTo' => __( 'In Reply To', 'custom-twitter-feeds' ),
1014 'inReplyToCtnx' => __( 'Used for showing replies', 'custom-twitter-feeds' ),
1015 'loadMore' => __( 'Load More', 'custom-twitter-feeds' ),
1016 'loadMoreCtnx' => __( 'Used in the button that loads more posts', 'custom-twitter-feeds' ),
1017
1018 'date' => __( 'Date', 'custom-twitter-feeds' ),
1019 'mtime' => __( 'Minutes', 'custom-twitter-feeds' ),
1020 'htime' => __( 'Hours', 'custom-twitter-feeds' ),
1021 'nowtime' => __( 'Now', 'custom-twitter-feeds' ),
1022 'usedinTimeline' => __( 'Used for tweet timeline', 'custom-twitter-feeds' ),
1023 )
1024 ),
1025 'advancedTab' => array(
1026 'rebrandingBox' => array(
1027 'title' => __( 'Change Twitter to X', 'custom-twitter-feeds' ),
1028 'helpText' => __( 'Changes the branding from Twitter to X across the plugin, including your feeds.', 'custom-twitter-feeds' ),
1029 ),
1030 'optimizeBox' => array(
1031 'title' => __( 'Optimize Images', 'custom-twitter-feeds' ),
1032 'helpText' => __( 'This will create multiple local copies of images in different sizes. The plugin then displays the smallest version based on the size of the feed.', 'custom-twitter-feeds' ),
1033 'reset' => __( 'Reset', 'custom-twitter-feeds' ),
1034 'promoText' => __( 'Optimize images with Twitter Feed Pro', 'custom-twitter-feeds' ),
1035 ),
1036 'persistentCacheBox' => array(
1037 'title' => __( 'Persistent Cache', 'custom-twitter-feeds' ),
1038 'helpText' => __( 'This makes all Search and Hashtag feeds have a permanent cache saved in the database up to 150 tweets. Tweets will be available for the feed even after the 7 day limit however numbers of retweets and likes will not update.', 'custom-twitter-feeds' ),
1039 'reset' => __( 'Reset', 'custom-twitter-feeds' ),
1040 ),
1041 'twitterCardCacheBox' => array(
1042 'title' => __( 'Twitter Card Cache', 'custom-twitter-feeds' ),
1043 'helpText' => __( 'Twitter Cards are rich text links that replace links to other websites when information for the card is available.', 'custom-twitter-feeds' ),
1044 'reset' => __( 'Reset', 'custom-twitter-feeds' ),
1045 ),
1046 'ajaxThemeBox' => array(
1047 'title' => __( 'AJAX theme loading fix', 'custom-twitter-feeds' ),
1048 'helpText' => '',
1049 ),
1050 'jsHeaderBox' => array(
1051 'title' => __( 'Enqueue JS in header fix', 'custom-twitter-feeds' ),
1052 'helpText' => __( 'Add the Javascript file for the plugin in the header instead of the footer.', 'custom-twitter-feeds' ),
1053 ),
1054 'templatesBox' => array(
1055 'title' => __( 'Custom Templates', 'custom-twitter-feeds' ),
1056 'helpText' => sprintf( __( 'The default HTML for the feed can be replaced with custom templates added to your theme\'s folder. Enable this setting to use these templates. See %sthis guide%s.', 'custom-twitter-feeds' ), '<a href="https://smashballoon.com/doc/twitter-custom-templates/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=docs" target="_blank">', '</a>' ),
1057 ),
1058 'creditbox' => array(
1059 'title' => __( 'Show Credit Link', 'custom-twitter-feeds' ),
1060 'helpText' => __( 'Display a link at the bottom of the feed to the Smash Balloon website.', 'custom-twitter-feeds' ),
1061 ),
1062 'resbox' => array(
1063 'title' => __( 'Auto-detect Image Resolution', 'custom-twitter-feeds' ),
1064 'helpText' => __( 'The resolution of the images in your feed will be set based on their width when the page loads. Disabling this will load all images in full resolution.', 'custom-twitter-feeds' ),
1065 ),
1066 'intentBox' => array(
1067 'title' => __( 'Twitter Intent JS', 'custom-twitter-feeds' ),
1068 'helpText' => __( 'This allows visitors of your site to reply to, retweet, and like tweets without leaving your site. ', 'custom-twitter-feeds' ),
1069 ),
1070 'requestMethodBox' => array(
1071 'title' => __( 'Request Method', 'custom-twitter-feeds' ),
1072 'helpText' => __( 'Explicitly set the request method. You would only want to change this if you are unable to connect to the Twitter API.', 'custom-twitter-feeds' ),
1073 'options' => array(
1074 'auto' => __( 'Auto', 'custom-twitter-feeds' ),
1075 'curl' => __( 'cURL', 'custom-twitter-feeds' ),
1076 'file_get_contents' => __( 'file_get_contents()', 'custom-twitter-feeds' ),
1077 'wp_http' => __( 'WP_Http', 'custom-twitter-feeds' )
1078 )
1079 ),
1080 'clearCacheBox' => array(
1081 'title' => __( 'Force Cache to clear on interval', 'custom-twitter-feeds' ),
1082 'helpText' => '',
1083 ),
1084 'sslonlyBox' => array(
1085 'title' => __( 'HTTPs Images only', 'custom-twitter-feeds' ),
1086 'helpText' => __( 'This will fix mixed-content warnings when Twitter card links are non-https. After enabling, clear your Twitter cards cache.', 'custom-twitter-feeds' ),
1087 ),
1088 'curlcardsBox' => array(
1089 'title' => __( 'Use cURL for Retrieval', 'custom-twitter-feeds' ),
1090 'helpText' => __( 'This will fix mixed-content warnings when Twitter card links are non-https. After enabling, clear your Twitter cards using the button above.', 'custom-twitter-feeds' ),
1091 ),
1092 'usageBox' => array(
1093 'title' => __( 'Usage Tracking', 'custom-twitter-feeds' ),
1094 'helpText' => sprintf( __( 'Send a weekly report to Smash Balloon to help improve the product. No sensitive data is collected. You can disable this at any time. %s', 'custom-twitter-feeds' ), '<a href="https://smashballoon.com/custom-twitter-feeds/usage-tracking/" target="_blank">' . __( 'Learn More', 'custom-twitter-feeds' ) . '</a>' ),
1095 ),
1096 'twittercard' => array(
1097 'title' => __( 'Twitter Cards', 'custom-twitter-feeds' ),
1098 'description' => __( 'Twitter Cards are rich visual previews of the link in your Tweet.', 'custom-twitter-feeds' ),
1099 'promoTitle' => __( 'Upgrade to Pro and get rich link<br/>previews with Twitter Cards', 'custom-twitter-feeds' ),
1100 'promoLink' => sprintf(
1101 '<a href="%s" class="sb-setting-promo-link" target="_blank">%s</a>',
1102 'https://smashballoon.com/custom-twitter-feeds/features/?utm_campaign=twitter-free&utm_source=settings&utm_medium=twitter-cards',
1103 __( 'Learn More', 'custom-twitter-feeds' )
1104 ),
1105 'promoIcon' => 'cardPromoTitle'
1106 ),
1107
1108 'dpaClear' => array(
1109 'title' => __( 'Manage Data', 'custom-twitter-feeds' ),
1110 'helpText' => __( 'Warning: Clicking this button will permanently delete all Twitter data, including all connected accounts, cached posts, and stored images.', 'custom-twitter-feeds' ),
1111 'clear' => __( 'Delete all Platform Data', 'custom-twitter-feeds' ),
1112 ),
1113 ),
1114 'dialogBoxPopupScreen' => array(
1115 'deleteSource' => array(
1116 'heading' => __( 'Delete "#"?', 'custom-twitter-feeds' ),
1117 'description' => __( 'This source is being used in a feed on your site. If you delete this source then new posts can no longer be retrieved for these feeds.', 'custom-twitter-feeds' ),
1118 ),
1119 'deleteAccount' => array(
1120 'heading' => __( 'Delete Account?', 'custom-twitter-feeds' ),
1121 'description' => __( 'If you delete this account then new posts can no longer be retrieved in your feeds.', 'custom-twitter-feeds' ),
1122 ),
1123 'deleteApp' => array(
1124 'heading' => __( 'Delete App?', 'custom-twitter-feeds' ),
1125 'description' => __( 'Are you sure you want to delete this app.', 'custom-twitter-feeds' ),
1126 ),
1127 ),
1128
1129 'selectSourceScreen' => \TwitterFeed\Builder\CTF_Feed_Builder::select_source_screen_text(),
1130
1131 'nextCheck' => $this->get_cron_next_check(),
1132 '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.683h6.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>',
1133 'checkmarkSVG' => '<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg>',
1134 'uploadSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg">
1135 <path d="M0.166748 14.6667H11.8334V13H0.166748V14.6667ZM0.166748 6.33333H3.50008V11.3333H8.50008V6.33333H11.8334L6.00008 0.5L0.166748 6.33333Z" fill="#141B38"/></svg>',
1136 'exportSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg">
1137 <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>',
1138 'reloadSVG' => '<svg width="20" height="14" viewBox="0 0 20 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1139 <path d="M15.8335 3.66667L12.5002 7H15.0002C15.0002 8.32608 14.4734 9.59785 13.5357 10.5355C12.598 11.4732 11.3262 12 10.0002 12C9.16683 12 8.3585 11.7917 7.66683 11.4167L6.45016 12.6333C7.51107 13.3085 8.74261 13.667 10.0002 13.6667C11.7683 13.6667 13.464 12.9643 14.7142 11.714C15.9644 10.4638 16.6668 8.76811 16.6668 7H19.1668L15.8335 3.66667ZM5.00016 7C5.00016 5.67392 5.52695 4.40215 6.46463 3.46447C7.40231 2.52678 8.67408 2 10.0002 2C10.8335 2 11.6418 2.20833 12.3335 2.58333L13.5502 1.36667C12.4893 0.691461 11.2577 0.332984 10.0002 0.333334C8.23205 0.333334 6.53636 1.03571 5.28612 2.28596C6.03587 3.5362 3.3335 5.23189 3.3335 7H0.833496L4.16683 10.3333L7.50016 7" fill="#141B38"/></svg>',
1140 'tooltipHelpSvg' => '<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.1665 8H10.8332V6.33333H9.1665V8ZM9.99984 17.1667C6.32484 17.1667 3.33317 14.175 3.33317 10.5C3.33317 6.825 6.32484 3.83333 9.99984 3.83333C13.6748 3.83333 16.6665 6.825 16.6665 10.5C16.6665 14.175 13.6748 17.1667 9.99984 17.1667ZM9.99984 2.16666C8.90549 2.16666 7.82186 2.38221 6.81081 2.801C5.79976 3.21979 4.8811 3.83362 4.10728 4.60744C2.54448 6.17024 1.6665 8.28986 1.6665 10.5C1.6665 12.7101 2.54448 14.8298 4.10728 16.3926C4.8811 17.1664 5.79976 17.7802 6.81081 18.199C7.82186 18.6178 8.90549 18.8333 9.99984 18.8333C12.21 18.8333 14.3296 17.9554 15.8924 16.3926C17.4552 14.8298 18.3332 12.7101 18.3332 10.5C18.3332 9.40565 18.1176 8.32202 17.6988 7.31097C17.28 6.29992 16.6662 5.38126 15.8924 4.60744C15.1186 3.83362 14.1999 3.21979 13.1889 2.801C12.1778 2.38221 11.0942 2.16666 9.99984 2.16666ZM9.1665 14.6667H10.8332V9.66666H9.1665V14.6667Z" fill="#434960"/></svg>',
1141 'svgIcons' => \TwitterFeed\Builder\CTF_Feed_Builder::builder_svg_icons()
1142 );
1143
1144 $maybe_new_account = CTF_Feed_Builder::connect_site_token( $_GET );
1145 if( $maybe_new_account !== false ){
1146 $ctf_settings['newAccountData'] = $maybe_new_account;
1147 $ctf_options = get_option('ctf_options', array());
1148 }
1149
1150 if ( CTF_DOING_SMASH_TWITTER ) {
1151 if( CTF_Feed_Builder::is_connected( $ctf_options, $maybe_new_account ) ){
1152 $ctf_settings['accountDetails'] = [
1153 'site_token' => $maybe_new_account,
1154 'access_token' => '',
1155 'access_token_secret' => '',
1156 'account_avatar' => ''
1157 ];
1158 $ctf_settings['appCredentials'] = $ctf_settings['accountDetails'];
1159 }
1160 } else {
1161 if( CTF_Feed_Builder::is_connected( $ctf_options ) ){
1162 //Check if No Account Details are added => Then make API call to get them!
1163 if( !isset( $ctf_options['account_handle'] ) || !isset( $ctf_options['account_avatar'] ) || empty( $ctf_options['account_handle'] ) || empty( $ctf_options['account_avatar'] )){
1164 $auth = [
1165 'access_token' => $ctf_options['access_token'],
1166 'access_token_secret' => $ctf_options['access_token_secret'],
1167 ];
1168 $details = CTF_Feed_Builder::get_account_info( $auth );
1169 if( !isset( $details['error'] ) ){
1170 $ctf_options['account_handle'] = $details['account_handle'];
1171 $ctf_options['account_avatar'] = $details['account_avatar'];
1172 update_option( 'ctf_options', $ctf_options );
1173 }
1174 }
1175
1176 $ctf_settings['accountDetails'] = [
1177 'app_name' => isset($ctf_options['app_name']) ? $ctf_options['app_name'] : '' ,
1178 'consumer_key' => isset($ctf_options['consumer_key']) ? $ctf_options['consumer_key'] : '' ,
1179 'consumer_secret' => isset($ctf_options['consumer_secret']) ? $ctf_options['consumer_secret'] : '' ,
1180 'access_token' => isset($ctf_options['access_token']) ? $ctf_options['access_token'] : '' ,
1181 'access_token_secret' => isset($ctf_options['access_token_secret']) ? $ctf_options['access_token_secret'] : '' ,
1182 'account_handle' => isset($ctf_options['account_handle']) ? $ctf_options['account_handle'] : '' ,
1183 'account_avatar' => isset($ctf_options['account_avatar']) ? $ctf_options['account_avatar'] : ''
1184 ];
1185 }
1186 }
1187
1188 wp_localize_script(
1189 'settings-app',
1190 'ctf_settings',
1191 $ctf_settings
1192 );
1193 }
1194
1195 /**
1196 * Get Extensions License Information
1197 *
1198 * @since 2.0
1199 *
1200 * @return array
1201 */
1202 public function get_extensions_license() {
1203 return;
1204
1205 }
1206
1207 /**
1208 * Get Links with UTM
1209 *
1210 * @return array
1211 *
1212 * @since 2.0
1213 */
1214 public static function get_links_with_utm() {
1215 $license_key = null;
1216 if ( get_option('ctf_license_key') ) {
1217 $license_key = get_option('ctf_license_key');
1218 }
1219
1220 return array(
1221 'manageLicense' => 'https://smashballoon.com/account/downloads/?utm_campaign=twitter-free&utm_source=settings&utm_medium=manage-license',
1222 'popup' => array(
1223 'allAccessBundle' => 'https://smashballoon.com/custom-twitter-feeds/twitter-lite-upgrade/?utm_campaign=twitter-free&utm_source=balloon&utm_medium=upgrade-button',
1224 'fbProfile' => 'https://www.facebook.com/SmashBalloon/',
1225 'twitterProfile' => 'https://twitter.com/smashballoon',
1226 ),
1227 'optimizeImagesLink' => 'https://smashballoondemo.com/?utm_campaign=twitter-free&utm_source=settings&utm_medium=optimize-images'
1228 );
1229 }
1230
1231 /**
1232 * @param $default_settings
1233 * @param $saved_settings
1234 *
1235 * @return mixed
1236 */
1237 public function filter_for_legacy( $default_settings, $saved_settings ) {
1238 if ( ! is_array( $saved_settings ) ) {
1239 $saved_settings = array();
1240 }
1241 if ( ! empty( $saved_settings['ctf_caching_type'] ) ) {
1242 return $default_settings;
1243 }
1244
1245 $default_settings['ctf_caching_type'] = 'page';
1246
1247 return $default_settings;
1248 }
1249
1250 /**
1251 * The Settings Data
1252 *
1253 * @since 2.0
1254 *
1255 * @return array
1256 */
1257 public function get_settings_data() {
1258 $defaults = $this->filter_for_legacy( $this->default_settings_options(), get_option( 'ctf_options' ) );
1259 $ctf_settings = wp_parse_args( get_option( 'ctf_options' ), $defaults );
1260
1261 //$cachetype = $ctf_settings['ctf_caching_type'] ;
1262 $cachetype = 'background';
1263 $cache_time_unit = $ctf_settings['cache_time_unit'] ;
1264 $cache_time = $ctf_settings['cache_time'];
1265 $ctf_cache_cron_interval = $ctf_settings['ctf_cache_cron_interval'];
1266 $ctf_cache_cron_time = $ctf_settings['ctf_cache_cron_time'];
1267 $ctf_cache_cron_am_pm = $ctf_settings['ctf_cache_cron_am_pm'];
1268
1269 $ctf_ajax = $ctf_settings['ajax_theme'];
1270 $active_gdpr_plugin = CTF_GDPR_Integrations::gdpr_plugins_active();
1271 $ctf_preserve_settings = $ctf_settings['preserve_settings'];
1272
1273 if ( ! empty( $_GET['ctf_site_token'] )
1274 && ! empty( $_GET['con_nonce'] )
1275 && wp_verify_nonce( $_GET['con_nonce'], 'ctf_con' )
1276 ) {
1277 $ctf_site_access_token = sanitize_key( $_GET['ctf_site_token'] );
1278 } else {
1279 $ctf_site_access_token = isset( $ctf_settings[ CTF_SITE_ACCESS_TOKEN_KEY ] ) ? $ctf_settings[ CTF_SITE_ACCESS_TOKEN_KEY ] : '';
1280 }
1281
1282 $custom_css = '';
1283 $custom_js = '';
1284
1285 if ( current_user_can( 'unfiltered_html' ) ) {
1286 $custom_css = isset( $ctf_settings['custom_css'] ) ? wp_strip_all_tags( stripslashes( $ctf_settings['custom_css'] ) ) : '';
1287 $custom_js = isset( $ctf_settings['custom_js'] ) ? stripslashes( $ctf_settings['custom_js'] ) : '';
1288 }
1289 return array(
1290 'general' => array(
1291 'preserveSettings' => $ctf_preserve_settings,
1292 'siteKey' => $ctf_site_access_token
1293
1294 ),
1295 'feeds' => array(
1296 'cachingType' => $cachetype,
1297 'cronInterval' => $ctf_cache_cron_interval,
1298 'cronTime' => $ctf_cache_cron_time,
1299 'cronAmPm' => $ctf_cache_cron_am_pm,
1300
1301 'cacheTimeUnit' => $cache_time_unit,
1302 'cacheTime' => $cache_time,
1303 'gdpr' => $ctf_settings['gdpr'],
1304 'gdprPlugin' => $active_gdpr_plugin,
1305 'customCSS' => $custom_css,
1306 'customJS' => $custom_js,
1307 ),
1308 'translation' => array(
1309 'retweetedtext' => $ctf_settings['retweetedtext'],
1310 'inreplytotext' => $ctf_settings['inreplytotext'],
1311 'buttontext' => $ctf_settings['buttontext'],
1312 'mtime' => $ctf_settings['mtime'],
1313 'htime' => $ctf_settings['htime'],
1314 'nowtime' => $ctf_settings['nowtime'],
1315 ),
1316 'advanced' => array(
1317 'rebranding' => $ctf_settings['rebranding'],
1318 'usage_tracking' => SmashTrackingConfig::is_enabled(),
1319 'resizing' => $ctf_settings['resizing'],
1320 'persistentcache' => $ctf_settings['persistentcache'],
1321 'ajax_theme' => $ctf_settings['ajax_theme'],
1322 'headenqueue' => $ctf_settings['headenqueue'],
1323 'customtemplates' => $ctf_settings['customtemplates'],
1324 'creditctf' => $ctf_settings['creditctf'],
1325 'usagetracking' => $ctf_settings['usagetracking'],
1326 'autores' => $ctf_settings['autores'],
1327 'enableintents' => !$ctf_settings['disableintents'],
1328 'request_method' => $ctf_settings['request_method'],
1329 'cron_cache_clear' => $ctf_settings['cron_cache_clear'],
1330 'sslonly' => $ctf_settings['sslonly'],
1331 'curlcards' => $ctf_settings['curlcards']
1332 )
1333 );
1334 }
1335
1336 /**
1337 * Return the default settings options for ctf_style_settings option
1338 *
1339 * @since 2.0
1340 *
1341 * @return array
1342 */
1343 public function default_settings_options() {
1344 return [
1345 'preserve_settings' => '',
1346 CTF_SITE_ACCESS_TOKEN_KEY => '',
1347 'cache_time' => 1,
1348 'cache_time_unit' => '3600',
1349 'gdpr' => 'auto',
1350 'ctf_caching_type' => 'background',
1351 'ctf_cache_cron_interval' => '12hours',
1352 'ctf_cache_cron_time' => '1',
1353 'ctf_cache_cron_am_pm' => 'am',
1354
1355 //Translation Goes Here
1356
1357 //----------
1358 'rebranding' => true,
1359 'resizing' => true,
1360 'persistentcache' => true,
1361 'ajax_theme' => false,
1362 'headenqueue' => false,
1363 'customtemplates' => false,
1364 'creditctf' => false,
1365 'usagetracking' => true,
1366 'autores' => false,
1367 'disableintents' => false,
1368 'request_method' => 'auto',
1369 'cron_cache_clear' => 'unset',
1370 'sslonly' => false,
1371 'curlcards' => true,
1372 'retweetedtext' => 'Retweeted',
1373 'buttontext' => 'Load More',
1374 'inreplytotext' => 'In Reply To',
1375 'mtime' => 'm',
1376 'htime' => 'h',
1377 'nowtime' => 'now',
1378
1379 ];
1380
1381 }
1382
1383 /**
1384 * Get GDPR Automatic state information
1385 *
1386 * @since 2.0
1387 *
1388 * @return string $output
1389 */
1390 public function get_gdpr_auto_info() {
1391 $gdpr_doc_url = 'https://smashballoon.com/doc/custom-twitter-feeds-gdpr-compliance/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=docs';
1392 $output = '';
1393 $active_gdpr_plugin = CTF_GDPR_Integrations::gdpr_plugins_active();
1394 if ( $active_gdpr_plugin ) {
1395 $output = $active_gdpr_plugin;
1396 } else {
1397 $output = sprintf(__('No GDPR consent plugin detected. Install a compatible %sGDPR consent plugin%s, or manually enable the setting to display a GDPR compliant version of the feed to all visitors.', 'custom-twitter-feeds'), '<a href="' . $gdpr_doc_url . '" target="_blank" rel="nofollow noopener">', '</a>');
1398 }
1399 return $output;
1400 }
1401
1402 /**
1403 * SBI Get cron next check time
1404 *
1405 * @since 2.0
1406 *
1407 * @return string $output
1408 */
1409 public function get_cron_next_check() {
1410
1411 if ( CTF_DOING_SMASH_TWITTER ) {
1412 return __( 'Your feed will update once a week automatically.', 'custom-twitter-feeds' );
1413 }
1414 if ( wp_next_scheduled( 'ctf_feed_update' ) ) {
1415 $time_format = get_option( 'time_format' );
1416 if ( ! $time_format ) {
1417 $time_format = 'g:i a';
1418 }
1419 //
1420 $schedule = wp_get_schedule( 'ctf_feed_update' );
1421 if ( $schedule === '30mins' ) {
1422 $schedule = __( 'every 30 minutes', 'custom-twitter-feeds' );
1423 }
1424 if ( $schedule === 'twicedaily' ) {
1425 $schedule = __( 'every 12 hours', 'custom-twitter-feeds' );
1426 }
1427 $ctf_next_cron_event = wp_next_scheduled( 'ctf_feed_update' );
1428 $output = '<strong>' . __( 'Next check', 'custom-twitter-feeds' ) . ': ' . date( $time_format, $ctf_next_cron_event + ctf_get_utc_offset() ) . ' (' . $schedule . ')</strong> - ' . __( 'Note: Clicking "Clear All Caches" will reset this schedule.', 'custom-twitter-feeds' );
1429 } else {
1430 $output = __( 'Nothing currently scheduled', 'custom-twitter-feeds' );
1431 }
1432
1433 return $output;
1434
1435
1436
1437 }
1438
1439 /**
1440 * Settings Page View Template
1441 *
1442 * @since 2.0
1443 */
1444 public function global_settings(){
1445 return \TwitterFeed\Admin\CTF_View::render( 'settings.index' );
1446 }
1447
1448 }
1449