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_Global_Settings.php
1783 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_Cache; |
| 16 | use CustomFacebookFeed\CFF_Group_Posts; |
| 17 | use CustomFacebookFeed\CFF_View; |
| 18 | use CustomFacebookFeed\CFF_Utils; |
| 19 | use CustomFacebookFeed\CFF_Resizer; |
| 20 | use CustomFacebookFeed\CFF_Response; |
| 21 | use CustomFacebookFeed\CFF_HTTP_Request; |
| 22 | use CustomFacebookFeed\CFF_GDPR_Integrations; |
| 23 | use CustomFacebookFeed\Builder\CFF_Feed_Saver_Manager; |
| 24 | use CustomFacebookFeed\Builder\CFF_Db; |
| 25 | use CustomFacebookFeed\Builder\CFF_Feed_Builder; |
| 26 | use CustomFacebookFeed\Builder\CFF_Source; |
| 27 | use CustomFacebookFeed\Admin\Traits\CFF_Settings; |
| 28 | use CustomFacebookFeed\Helpers\Util; |
| 29 | use CustomFacebookFeed\UsageTracking\Config as SmashTrackingConfig; |
| 30 | |
| 31 | |
| 32 | class CFF_Global_Settings |
| 33 | { |
| 34 | use CFF_Settings; |
| 35 | |
| 36 | /** |
| 37 | * Admin menu page slug. |
| 38 | * |
| 39 | * @since 4.0 |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | const SLUG = 'cff-settings'; |
| 44 | |
| 45 | /** |
| 46 | * Upgrade URL format string (license key placeholder). |
| 47 | * |
| 48 | * @since 4.7.7 |
| 49 | * |
| 50 | * @var string |
| 51 | */ |
| 52 | const UPGRADE_LICENSE_URL = 'https://smashballoon.com/custom-facebook-feed/facebook-lite-upgrade/?license_key=%s&upgrade=true&utm_campaign=facebook-free&utm_source=settings&utm_medium=upgrade-license'; |
| 53 | |
| 54 | /** |
| 55 | * Initializing the class |
| 56 | * |
| 57 | * @since 4.0 |
| 58 | */ |
| 59 | public function __construct() |
| 60 | { |
| 61 | $this->init(); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Determining if the user is viewing the our page, if so, party on. |
| 66 | * |
| 67 | * @since 4.0 |
| 68 | */ |
| 69 | public function init() |
| 70 | { |
| 71 | if (! is_admin()) { |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | // if cff_cache_cron exists and it's free version then remove cff_cache_cron schedule |
| 76 | if (wp_get_schedule('cff_cache_cron') && !CFF_Utils::cff_is_pro_version()) { |
| 77 | wp_clear_scheduled_hook('cff_cache_cron'); |
| 78 | } |
| 79 | |
| 80 | add_action('admin_menu', [$this, 'register_menu']); |
| 81 | add_action('in_admin_header', [$this, 'maybe_remove_admin_footer']); |
| 82 | |
| 83 | add_action('wp_ajax_cff_save_settings', [$this, 'cff_save_settings']); |
| 84 | add_action('wp_ajax_cff_activate_license', [$this, 'cff_activate_license']); |
| 85 | add_action('wp_ajax_cff_deactivate_license', [$this, 'cff_deactivate_license']); |
| 86 | add_action('wp_ajax_cff_activate_extension_license', [$this, 'cff_activate_extension_license']); |
| 87 | add_action('wp_ajax_cff_deactivate_extension_license', [$this, 'cff_deactivate_extension_license']); |
| 88 | add_action('wp_ajax_cff_test_connection', [$this, 'cff_test_connection']); |
| 89 | add_action('wp_ajax_cff_import_settings_json', [$this, 'cff_import_settings_json']); |
| 90 | add_action('wp_ajax_cff_export_settings_json', [$this, 'cff_export_settings_json']); |
| 91 | add_action('wp_ajax_cff_clear_cache', [$this, 'cff_clear_cache']); |
| 92 | add_action('wp_ajax_cff_clear_image_resize_cache', [$this, 'cff_clear_image_resize_cache']); |
| 93 | add_action('wp_ajax_cff_dpa_reset', [$this, 'cff_dpa_reset']); |
| 94 | |
| 95 | CFF_Upgrader::hooks(); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * CFF Save Settings |
| 100 | * |
| 101 | * This will save the data fron the settings page |
| 102 | * |
| 103 | * @since 4.0 |
| 104 | * |
| 105 | * @return CFF_Response |
| 106 | */ |
| 107 | public function cff_save_settings() |
| 108 | { |
| 109 | // Security Checks |
| 110 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 111 | |
| 112 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 113 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 114 | if (! current_user_can($cap)) { |
| 115 | wp_send_json_error(); // This auto-dies. |
| 116 | } |
| 117 | |
| 118 | $data = $_POST; |
| 119 | $model = isset($data[ 'model' ]) ? $data['model'] : null; |
| 120 | |
| 121 | // return if the model is null |
| 122 | if (null === $model) { |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | // get the cff license key and extensions license key |
| 127 | $cff_license_key = sanitize_text_field($_POST['cff_license_key']); |
| 128 | $extensions_license_key = json_decode(stripslashes($_POST['extensions_license_key'])); |
| 129 | |
| 130 | // Only update the cff_license_key value when it's inactive |
| 131 | if (get_option('cff_license_status') == 'inactive') { |
| 132 | if (empty($cff_license_key) || strlen($cff_license_key) < 1) { |
| 133 | delete_option('cff_license_key'); |
| 134 | } else { |
| 135 | update_option('cff_license_key', $cff_license_key); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // Only update the extension license key when it's not activated |
| 140 | if (count($extensions_license_key) > 0) { |
| 141 | foreach ($extensions_license_key as $extension => $license) { |
| 142 | // if license is not valid then allow to update or remove license keys |
| 143 | if (! get_option('cff_license_status_' . $extension) || 'valid' != get_option('cff_license_status_' . $extension)) { |
| 144 | // if license status is not valid then either delete or update |
| 145 | if (empty($license) || strlen($license) < 1) { |
| 146 | delete_option('cff_license_key_' . $extension); |
| 147 | } else { |
| 148 | update_option('cff_license_key_' . $extension, $license_key); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | $model = (array) \json_decode(\stripslashes($model)); |
| 155 | $general = (array) $model['general']; |
| 156 | $feeds = (array) $model['feeds']; |
| 157 | $translation = (array) $model['translation']; |
| 158 | $advanced = (array) $model['advanced']; |
| 159 | |
| 160 | // Get the values and sanitize |
| 161 | $cff_locale = sanitize_text_field($feeds['selectedLocale']); |
| 162 | $cff_style_settings = get_option( 'cff_style_settings', array() ); |
| 163 | $cff_style_settings[ 'cff_timezone' ] = sanitize_text_field($feeds['selectedTimezone']); |
| 164 | $cff_style_settings[ 'cff_custom_css' ] = $feeds['customCSS']; |
| 165 | $cff_style_settings[ 'cff_custom_js' ] = $feeds['customJS']; |
| 166 | $cff_style_settings[ 'gdpr' ] = sanitize_text_field($feeds['gdpr']); |
| 167 | $cachingType = sanitize_text_field($feeds['cachingType']); |
| 168 | $cronInterval = sanitize_text_field($feeds['cronInterval']); |
| 169 | $cronTime = sanitize_text_field($feeds['cronTime']); |
| 170 | $cronAmPm = sanitize_text_field($feeds['cronAmPm']); |
| 171 | $cacheTime = sanitize_text_field($feeds['cacheTime']); |
| 172 | $cacheTimeUnit = sanitize_text_field($feeds['cacheTimeUnit']); |
| 173 | |
| 174 | // Save general settings data |
| 175 | update_option('cff_preserve_settings', $general['preserveSettings']); |
| 176 | |
| 177 | // Save feeds settings data |
| 178 | update_option('cff_locale', $cff_locale); |
| 179 | |
| 180 | // Caching option for the Pro version |
| 181 | if (CFF_Utils::cff_is_pro_version()) { |
| 182 | update_option('cff_caching_type', $cachingType); |
| 183 | update_option('cff_cache_cron_interval', $cronInterval); |
| 184 | update_option('cff_cache_cron_time', $cronTime); |
| 185 | update_option('cff_cache_cron_am_pm', $cronAmPm); |
| 186 | } |
| 187 | |
| 188 | // Caching options for the Free version |
| 189 | if (! CFF_Utils::cff_is_pro_version()) { |
| 190 | // cff_caching_type should be 'page' for the free version |
| 191 | update_option('cff_caching_type', 'page'); |
| 192 | update_option('cff_cache_time', (int) $cacheTime); |
| 193 | update_option('cff_cache_time_unit', $cacheTimeUnit); |
| 194 | } |
| 195 | |
| 196 | // Save translation settings data |
| 197 | foreach ($translation as $key => $val) { |
| 198 | $cff_style_settings[ $key ] = $val; |
| 199 | } |
| 200 | |
| 201 | // Save advanced settings data |
| 202 | $cff_ajax = sanitize_text_field($advanced['cff_ajax']); |
| 203 | |
| 204 | foreach ($advanced as $key => $val) { |
| 205 | if ($key == 'cff_disable_resize' || $key == 'disable_admin_notice') { |
| 206 | $cff_style_settings[ $key ] = !$val; |
| 207 | } else { |
| 208 | $cff_style_settings[ $key ] = $val; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | if ( isset( $advanced['usage_tracking'] ) ) { |
| 213 | $tracking_enabled = (bool) $advanced['usage_tracking']; |
| 214 | $usage_tracking = get_option( |
| 215 | 'cff_usage_tracking', |
| 216 | array( |
| 217 | 'enabled' => SmashTrackingConfig::DEFAULT_ENABLED, |
| 218 | 'last_send' => 0, |
| 219 | ) |
| 220 | ); |
| 221 | $last_send = is_array( $usage_tracking ) && isset( $usage_tracking['last_send'] ) ? $usage_tracking['last_send'] : 0; |
| 222 | update_option( |
| 223 | 'cff_usage_tracking', |
| 224 | array( |
| 225 | 'enabled' => $tracking_enabled, |
| 226 | 'last_send' => $last_send, |
| 227 | ), |
| 228 | false |
| 229 | ); |
| 230 | if ( ! $tracking_enabled ) { |
| 231 | wp_clear_scheduled_hook( SmashTrackingConfig::CRON_HOOK ); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | update_option('cff_ajax', $cff_ajax); |
| 236 | |
| 237 | // Update the cff_style_settings option that contains data for translation and advanced tabs |
| 238 | update_option('cff_style_settings', $cff_style_settings); |
| 239 | |
| 240 | // clear cron caches |
| 241 | $this->cff_clear_cache(); |
| 242 | |
| 243 | $response = new CFF_Response(true, array( |
| 244 | 'cronNextCheck' => $this->get_cron_next_check() |
| 245 | )); |
| 246 | $response->send(); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * CFF Activate License Key |
| 251 | * |
| 252 | * @since 4.0 |
| 253 | * |
| 254 | * @return CFF_Response |
| 255 | */ |
| 256 | public function cff_activate_license() |
| 257 | { |
| 258 | // Security Checks |
| 259 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 260 | |
| 261 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 262 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 263 | if (! current_user_can($cap)) { |
| 264 | wp_send_json_error(); // This auto-dies. |
| 265 | } |
| 266 | |
| 267 | // do the form validation to check if license_key is not empty |
| 268 | if (empty($_POST[ 'license_key' ])) { |
| 269 | $response = new CFF_Response(false, array( |
| 270 | 'message' => __('License key required!', 'custom-facebook-feed'), |
| 271 | )); |
| 272 | $response->send(); |
| 273 | } |
| 274 | $license_key = sanitize_text_field($_POST[ 'license_key' ]); |
| 275 | // make the remote api call and get license data |
| 276 | $cff_license_data = $this->get_license_data($license_key, 'activate_license', WPW_SL_ITEM_NAME); |
| 277 | // update the license data |
| 278 | if (!empty($cff_license_data)) { |
| 279 | update_option('cff_license_data', $cff_license_data); |
| 280 | } |
| 281 | // update the licnese key only when the license status is activated |
| 282 | update_option('cff_license_key', $license_key); |
| 283 | // update the license status |
| 284 | update_option('cff_license_status', $cff_license_data['license']); |
| 285 | |
| 286 | // Check if there is any error in the license key then handle it |
| 287 | $cff_license_data = CFF_Global_Settings::get_license_error_message($cff_license_data); |
| 288 | |
| 289 | // Send ajax response back to client end |
| 290 | $data = array( |
| 291 | 'licenseStatus' => $cff_license_data['license'], |
| 292 | 'licenseData' => $cff_license_data |
| 293 | ); |
| 294 | $response = new CFF_Response(true, $data); |
| 295 | $response->send(); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * CFF Deactivate License Key |
| 300 | * |
| 301 | * @since 4.0 |
| 302 | * |
| 303 | * @return CFF_Response |
| 304 | */ |
| 305 | public function cff_deactivate_license() |
| 306 | { |
| 307 | // Security Checks |
| 308 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 309 | |
| 310 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 311 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 312 | if (! current_user_can($cap)) { |
| 313 | wp_send_json_error(); // This auto-dies. |
| 314 | } |
| 315 | |
| 316 | $license_key = trim(get_option('cff_license_key')); |
| 317 | $cff_license_data = $this->get_license_data($license_key, 'deactivate_license', WPW_SL_ITEM_NAME); |
| 318 | // update the license data |
| 319 | if (!empty($cff_license_data)) { |
| 320 | update_option('cff_license_data', $cff_license_data); |
| 321 | } |
| 322 | if (! $cff_license_data['success']) { |
| 323 | $response = new CFF_Response(false, array()); |
| 324 | $response->send(); |
| 325 | } |
| 326 | // remove the license keys and update license key status |
| 327 | if ($cff_license_data['license'] == 'deactivated') { |
| 328 | update_option('cff_license_status', 'inactive'); |
| 329 | $data = array( |
| 330 | 'licenseStatus' => 'inactive' |
| 331 | ); |
| 332 | $response = new CFF_Response(true, $data); |
| 333 | $response->send(); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * CFF Activate Extension License Key |
| 339 | * |
| 340 | * @since 4.0 |
| 341 | * |
| 342 | * @return CFF_Response |
| 343 | */ |
| 344 | public function cff_activate_extension_license() |
| 345 | { |
| 346 | // Security Checks |
| 347 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 348 | |
| 349 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 350 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 351 | if (! current_user_can($cap)) { |
| 352 | wp_send_json_error(); // This auto-dies. |
| 353 | } |
| 354 | |
| 355 | // do the form validation to check if license_key is not empty |
| 356 | if (empty($_POST[ 'license_key' ])) { |
| 357 | $response = new CFF_Response(false, array( |
| 358 | 'message' => __('License key required!', 'custom-facebook-feed'), |
| 359 | )); |
| 360 | $response->send(); |
| 361 | } |
| 362 | $license_key = sanitize_text_field($_POST[ 'license_key' ]); |
| 363 | $extension_name = sanitize_text_field($_POST[ 'extension_name' ]); |
| 364 | $extension_item_name = sanitize_text_field($_POST[ 'extension_item_name' ]); |
| 365 | |
| 366 | // make the remote api call and get license data |
| 367 | $cff_license_data = $this->get_license_data($license_key, 'activate_license', $extension_item_name); |
| 368 | // update the licnese key only when the license status is activated |
| 369 | update_option('cff_license_key_' . $extension_name, $license_key); |
| 370 | // update the license status |
| 371 | update_option('cff_license_status_' . $extension_name, $cff_license_data['license']); |
| 372 | |
| 373 | // Send ajax response back to client end |
| 374 | $data = array( |
| 375 | 'licenseStatus' => $cff_license_data['license'], |
| 376 | 'licenseData' => $cff_license_data |
| 377 | ); |
| 378 | $response = new CFF_Response(true, $data); |
| 379 | $response->send(); |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * CFF Deactivate Extension License Key |
| 384 | * |
| 385 | * @since 4.0 |
| 386 | * |
| 387 | * @return CFF_Response |
| 388 | */ |
| 389 | public function cff_deactivate_extension_license() |
| 390 | { |
| 391 | // Security Checks |
| 392 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 393 | |
| 394 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 395 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 396 | if (! current_user_can($cap)) { |
| 397 | wp_send_json_error(); // This auto-dies. |
| 398 | } |
| 399 | |
| 400 | $extension_name = sanitize_text_field($_POST[ 'extension_name' ]); |
| 401 | $extension_item_name = sanitize_text_field($_POST[ 'extension_item_name' ]); |
| 402 | $license_key = get_option('cff_license_key_' . $extension_name); |
| 403 | $license_status = get_option('cff_license_status_' . $extension_name); |
| 404 | |
| 405 | $cff_license_data = $this->get_license_data($license_key, 'deactivate_license', $extension_item_name); |
| 406 | |
| 407 | if (! $cff_license_data['success']) { |
| 408 | $response = new CFF_Response(false, array()); |
| 409 | $response->send(); |
| 410 | } |
| 411 | |
| 412 | // remove the license keys and update license key status |
| 413 | if ($cff_license_data['license'] == 'deactivated') { |
| 414 | delete_option('cff_license_status_' . $extension_name); |
| 415 | $data = array( |
| 416 | 'licenseStatus' => $cff_license_data['license'] |
| 417 | ); |
| 418 | $response = new CFF_Response(true, $data); |
| 419 | $response->send(); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * CFF Test Connection |
| 425 | * |
| 426 | * @since 4.0 |
| 427 | * |
| 428 | * @return CFF_Response |
| 429 | */ |
| 430 | public function cff_test_connection() |
| 431 | { |
| 432 | // Security Checks |
| 433 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 434 | |
| 435 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 436 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 437 | if (! current_user_can($cap)) { |
| 438 | wp_send_json_error(); // This auto-dies. |
| 439 | } |
| 440 | |
| 441 | $license_key = get_option('cff_license_key'); |
| 442 | $cff_api_params = array( |
| 443 | 'edd_action' => 'check_license', |
| 444 | 'license' => $license_key, |
| 445 | 'item_name' => urlencode(WPW_SL_ITEM_NAME) // the name of our product in EDD |
| 446 | ); |
| 447 | $url = add_query_arg($cff_api_params, WPW_SL_STORE_URL); |
| 448 | $args = array( |
| 449 | 'timeout' => 60, |
| 450 | 'sslverify' => false |
| 451 | ); |
| 452 | // Make the remote API request |
| 453 | $request = CFF_HTTP_Request::request('GET', $url, $args); |
| 454 | if (CFF_HTTP_Request::is_error($request)) { |
| 455 | ray($request); |
| 456 | $response = new CFF_Response(false, array( |
| 457 | 'hasError' => true |
| 458 | )); |
| 459 | $response->send(); |
| 460 | } |
| 461 | |
| 462 | $response = new CFF_Response(true, array( |
| 463 | 'hasError' => false |
| 464 | )); |
| 465 | $response->send(); |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * CFF Import Feed Settings JSON |
| 470 | * |
| 471 | * @since 4.0 |
| 472 | * |
| 473 | * @return CFF_Response |
| 474 | */ |
| 475 | public function cff_import_settings_json() |
| 476 | { |
| 477 | // Security Checks |
| 478 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 479 | |
| 480 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 481 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 482 | if (! current_user_can($cap)) { |
| 483 | wp_send_json_error(); // This auto-dies. |
| 484 | } |
| 485 | |
| 486 | $filename = $_FILES['file']['name']; |
| 487 | $ext = pathinfo($filename, PATHINFO_EXTENSION); |
| 488 | if ('json' !== $ext) { |
| 489 | $response = new CFF_Response(false, []); |
| 490 | $response->send(); |
| 491 | } |
| 492 | $imported_settings = file_get_contents($_FILES["file"]["tmp_name"]); |
| 493 | // check if the file is empty |
| 494 | if (empty($imported_settings)) { |
| 495 | $response = new CFF_Response(false, []); |
| 496 | $response->send(); |
| 497 | } |
| 498 | $feed_return = CFF_Feed_Saver_Manager::import_feed($imported_settings); |
| 499 | // check if there's error while importing |
| 500 | if (! $feed_return['success']) { |
| 501 | $response = new CFF_Response(false, []); |
| 502 | $response->send(); |
| 503 | } |
| 504 | // Once new feed has imported lets export all the feeds to update in front end |
| 505 | $exported_feeds = CFF_Db::feeds_query(); |
| 506 | $feeds = array(); |
| 507 | foreach ($exported_feeds as $feed_id => $feed) { |
| 508 | $feeds[] = array( |
| 509 | 'id' => $feed['id'], |
| 510 | 'name' => $feed['feed_name'] |
| 511 | ); |
| 512 | } |
| 513 | |
| 514 | $response = new CFF_Response(true, array( |
| 515 | 'feeds' => $feeds |
| 516 | )); |
| 517 | $response->send(); |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * CFF Export Feed Settings JSON |
| 522 | * |
| 523 | * @since 4.0 |
| 524 | * |
| 525 | * @return CFF_Response |
| 526 | */ |
| 527 | public function cff_export_settings_json() |
| 528 | { |
| 529 | // Security Checks |
| 530 | if (check_ajax_referer('cff_admin_nonce', 'nonce', false) || check_ajax_referer('cff-admin', 'nonce', false)) { |
| 531 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 532 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 533 | if (! current_user_can($cap)) { |
| 534 | wp_send_json_error(); // This auto-dies. |
| 535 | } |
| 536 | |
| 537 | if (! isset($_GET['feed_id'])) { |
| 538 | return; |
| 539 | } |
| 540 | $feed_id = filter_var($_GET['feed_id'], FILTER_SANITIZE_NUMBER_INT); |
| 541 | $feed = CFF_Feed_Saver_Manager::get_export_json($feed_id); |
| 542 | $feed_info = CFF_Db::feeds_query(array('id' => $feed_id)); |
| 543 | $feed_name = strtolower($feed_info[0]['feed_name']); |
| 544 | $filename = 'cff-feed-' . $feed_name . '.json'; |
| 545 | // create a new empty file in the php memory |
| 546 | $file = fopen('php://memory', 'w'); |
| 547 | fwrite($file, $feed); |
| 548 | fseek($file, 0); |
| 549 | header('Content-type: application/json'); |
| 550 | header('Content-disposition: attachment; filename = "' . $filename . '";'); |
| 551 | fpassthru($file); |
| 552 | } |
| 553 | exit; |
| 554 | } |
| 555 | |
| 556 | /** |
| 557 | * CFF Clear Cache |
| 558 | * |
| 559 | * @since 4.0 |
| 560 | */ |
| 561 | public function cff_clear_cache() |
| 562 | { |
| 563 | // Security Checks |
| 564 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 565 | |
| 566 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 567 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 568 | if (! current_user_can($cap)) { |
| 569 | wp_send_json_error(); // This auto-dies. |
| 570 | } |
| 571 | |
| 572 | |
| 573 | // Get the settings model data |
| 574 | $model = isset($_POST[ 'model' ]) ? $_POST['model'] : null; |
| 575 | |
| 576 | // Caching clear option for the free version |
| 577 | if (!CFF_Utils::cff_is_pro_version()) { |
| 578 | if ($model !== null) { |
| 579 | $model = (array) \json_decode(\stripslashes($model)); |
| 580 | $feeds = (array) $model['feeds']; |
| 581 | } |
| 582 | |
| 583 | $cff_cache_time = sanitize_text_field($feeds['cacheTime']); |
| 584 | $cff_cache_time_unit = sanitize_text_field($feeds['cacheTimeUnit']); |
| 585 | |
| 586 | update_option('cff_cache_time', (int) $cff_cache_time); |
| 587 | update_option('cff_cache_time_unit', $cff_cache_time_unit); |
| 588 | |
| 589 | // Clear the existing cron event |
| 590 | wp_clear_scheduled_hook('cff_cron_job'); |
| 591 | |
| 592 | // Set the event schedule based on what the caching time is set to |
| 593 | $cff_cron_schedule = 'hourly'; |
| 594 | if ($cff_cache_time_unit == 'hours' && $cff_cache_time > 5) { |
| 595 | $cff_cron_schedule = 'twicedaily'; |
| 596 | } |
| 597 | if ($cff_cache_time_unit == 'days') { |
| 598 | $cff_cron_schedule = 'daily'; |
| 599 | } |
| 600 | |
| 601 | wp_schedule_event(time(), $cff_cron_schedule, 'cff_cron_job'); |
| 602 | |
| 603 | $this->clear_stored_caches(); |
| 604 | |
| 605 | $response = new CFF_Response(true, array()); |
| 606 | $response->send(); |
| 607 | } |
| 608 | |
| 609 | // Get the updated cron schedule interval and time settings from user input and update the database |
| 610 | if ($model !== null) { |
| 611 | $model = (array) \json_decode(\stripslashes($model)); |
| 612 | $feeds = (array) $model['feeds']; |
| 613 | update_option('cff_cache_cron_interval', sanitize_text_field($feeds['cronInterval'])); |
| 614 | update_option('cff_cache_cron_time', sanitize_text_field($feeds['cronTime'])); |
| 615 | update_option('cff_cache_cron_am_pm', sanitize_text_field($feeds['cronAmPm'])); |
| 616 | } |
| 617 | |
| 618 | // Now get the updated cron schedule interval and time values |
| 619 | $cff_cache_cron_interval_val = get_option('cff_cache_cron_interval', '12hours'); |
| 620 | $cff_cache_cron_time_val = get_option('cff_cache_cron_time', '1'); |
| 621 | $cff_cache_cron_am_pm_val = get_option('cff_cache_cron_am_pm', 'am'); |
| 622 | |
| 623 | // Default Timezone |
| 624 | $defaults = array( |
| 625 | 'cff_timezone' => 'America/Chicago', |
| 626 | 'cff_load_more' => true, |
| 627 | 'cff_num_mobile' => '' |
| 628 | ); |
| 629 | $style_options = get_option('cff_style_settings', $defaults); |
| 630 | $cff_timezone = $style_options[ 'cff_timezone' ]; |
| 631 | |
| 632 | // Clear the stored caches in the database |
| 633 | $this->clear_stored_caches(); |
| 634 | |
| 635 | // Clear the existing cron event |
| 636 | wp_clear_scheduled_hook('cff_cache_cron'); |
| 637 | switch ($cff_cache_cron_interval_val) { |
| 638 | case "30mins": |
| 639 | $cff_cron_schedule = '30mins'; |
| 640 | break; |
| 641 | case "1hour": |
| 642 | $cff_cron_schedule = 'hourly'; |
| 643 | break; |
| 644 | case "12hours": |
| 645 | $cff_cron_schedule = 'twicedaily'; |
| 646 | break; |
| 647 | default: |
| 648 | $cff_cron_schedule = 'daily'; |
| 649 | } |
| 650 | |
| 651 | // If the 30mins or 1hour are selected then use the current time and set it to start at the next 30mins/hour |
| 652 | $cff_cache_cron_time_unix = strtotime($cff_cache_cron_time_val . $cff_cache_cron_am_pm_val . ' ' . $cff_timezone); |
| 653 | if ($cff_cache_cron_interval_val == '30mins' || $cff_cache_cron_interval_val == '1hour') { |
| 654 | $cff_cache_cron_time_unix = time(); |
| 655 | } |
| 656 | |
| 657 | CFF_Group_Posts::group_reschedule_event($cff_cache_cron_time_unix, $cff_cron_schedule); |
| 658 | wp_schedule_event($cff_cache_cron_time_unix, $cff_cron_schedule, 'cff_cache_cron'); |
| 659 | |
| 660 | $response = new CFF_Response(true, array( |
| 661 | 'cronNextCheck' => $this->get_cron_next_check() |
| 662 | )); |
| 663 | $response->send(); |
| 664 | } |
| 665 | |
| 666 | /** |
| 667 | * Clear the stored caches from the database and from other caching plugins |
| 668 | * |
| 669 | * @since 4.0 |
| 670 | */ |
| 671 | public function clear_stored_caches() |
| 672 | { |
| 673 | CFF_Cache::clear_legacy(); |
| 674 | CFF_Cache::clear_all_builder(); |
| 675 | CFF_Cache::clear_page_caches(); |
| 676 | } |
| 677 | |
| 678 | /** |
| 679 | * CFF Clear Image Resize Cache |
| 680 | * |
| 681 | * @since 4.0 |
| 682 | */ |
| 683 | public function cff_clear_image_resize_cache() |
| 684 | { |
| 685 | // Security Checks |
| 686 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 687 | |
| 688 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 689 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 690 | if (! current_user_can($cap)) { |
| 691 | wp_send_json_error(); // This auto-dies. |
| 692 | } |
| 693 | |
| 694 | // Caching option is a Pro only feature |
| 695 | if (!CFF_Utils::cff_is_pro_version()) { |
| 696 | return; |
| 697 | } |
| 698 | |
| 699 | CFF_Resizer::delete_resizing_table_and_images(); |
| 700 | \cff_main()->cff_error_reporter->add_action_log('Reset resizing tables.'); |
| 701 | if (!CFF_Resizer::create_resizing_table_and_uploads_folder()) { |
| 702 | return; |
| 703 | } |
| 704 | |
| 705 | $response = new CFF_Response(true, []); |
| 706 | $response->send(); |
| 707 | } |
| 708 | |
| 709 | /** |
| 710 | * CFF Get License Data from our license API |
| 711 | * |
| 712 | * @since 4.0 |
| 713 | * |
| 714 | * @param string $license_key |
| 715 | * @param string $license_action |
| 716 | * |
| 717 | * @return void|array $cff_license_data |
| 718 | */ |
| 719 | public function get_license_data($license_key, $license_action = 'check_license', $item_name = WPW_SL_ITEM_NAME) |
| 720 | { |
| 721 | $cff_api_params = array( |
| 722 | 'edd_action' => $license_action, |
| 723 | 'license' => $license_key, |
| 724 | 'item_name' => urlencode($item_name) // the name of our product in EDD |
| 725 | ); |
| 726 | $url = add_query_arg($cff_api_params, WPW_SL_STORE_URL); |
| 727 | $args = array( |
| 728 | 'timeout' => 60, |
| 729 | 'sslverify' => false |
| 730 | ); |
| 731 | // Make the remote API request |
| 732 | $request = CFF_HTTP_Request::request('GET', $url, $args); |
| 733 | if (CFF_HTTP_Request::is_error($request)) { |
| 734 | return; |
| 735 | } |
| 736 | $cff_license_data = (array) CFF_HTTP_Request::data($request); |
| 737 | return $cff_license_data; |
| 738 | } |
| 739 | |
| 740 | /** |
| 741 | * Get license error message depending on license status |
| 742 | * |
| 743 | * @since 4.0 |
| 744 | * |
| 745 | * @param array $cff_license_data |
| 746 | * |
| 747 | * @return array $cff_license_data |
| 748 | */ |
| 749 | public static function get_license_error_message($cff_license_data) |
| 750 | { |
| 751 | |
| 752 | global $cff_download_id; |
| 753 | |
| 754 | $license_key = null; |
| 755 | if (get_option('cff_license_key')) { |
| 756 | $license_key = get_option('cff_license_key'); |
| 757 | } |
| 758 | |
| 759 | $upgrade_url = sprintf(self::UPGRADE_LICENSE_URL, $license_key); |
| 760 | $renew_url = sprintf('https://smashballoon.com/checkout/?license_key=%s&download_id=%s&utm_campaign=facebook-free&utm_source=settings&utm_medium=upgrade-license&utm_content=renew-license', $license_key, $cff_download_id); |
| 761 | $learn_more_url = 'https://smashballoon.com/doc/my-license-key-wont-activate/?utm_campaign=facebook-free&utm_source=settings&utm_medium=license&utm_content=learn-more'; |
| 762 | |
| 763 | // Check if the license key reached max site installations |
| 764 | if (isset($cff_license_data['error']) && 'no_activations_left' === $cff_license_data['error']) { |
| 765 | $cff_license_data['errorMsg'] = sprintf( |
| 766 | '%s (%s/%s). %s <a href="%s" target="_blank">%s</a> %s <a href="%s" target="_blank">%s</a>', |
| 767 | __('You have reached the maximum number of sites available in your plan', 'custom-facebook-feed'), |
| 768 | $cff_license_data['site_count'], |
| 769 | $cff_license_data['max_sites'], |
| 770 | __('Learn more about it', 'custom-facebook-feed'), |
| 771 | $learn_more_url, |
| 772 | 'here', |
| 773 | __('or upgrade your plan.', 'custom-facebook-feed'), |
| 774 | $upgrade_url, |
| 775 | __('Upgrade', 'custom-facebook-feed') |
| 776 | ); |
| 777 | } elseif ( |
| 778 | // Check if the license key has expired |
| 779 | ( isset($cff_license_data['license']) && 'expired' === $cff_license_data['license'] ) || |
| 780 | ( isset($cff_license_data['error']) && 'expired' === $cff_license_data['error'] ) |
| 781 | ) { |
| 782 | $cff_license_data['error'] = true; |
| 783 | $expired_date = new \DateTime($cff_license_data['expires']); |
| 784 | $expired_date = $expired_date->format('F d, Y'); |
| 785 | $cff_license_data['errorMsg'] = sprintf( |
| 786 | '%s %s. %s <a href="%s" target="_blank">%s</a>', |
| 787 | __('The license expired on ', 'custom-facebook-feed'), |
| 788 | $expired_date, |
| 789 | __('Please renew it and try again.', 'custom-facebook-feed'), |
| 790 | $renew_url, |
| 791 | __('Renew', 'custom-facebook-feed') |
| 792 | ); |
| 793 | } elseif ( |
| 794 | // check if invalid license |
| 795 | ( isset($cff_license_data['success']) && false === $cff_license_data['success'] ) || |
| 796 | ( isset($cff_license_data['license']) && 'invalid' === $cff_license_data['license'] ) |
| 797 | ) { |
| 798 | $cff_license_data['errorMsg'] = __('This license is invalid.', 'custom-facebook-feed'); |
| 799 | } |
| 800 | |
| 801 | return $cff_license_data; |
| 802 | } |
| 803 | |
| 804 | /** |
| 805 | * Conditionally remove admin footer on plugin pages only. |
| 806 | * |
| 807 | * @since 4.8 |
| 808 | */ |
| 809 | public function maybe_remove_admin_footer() |
| 810 | { |
| 811 | if (Util::is_fb_page()) { |
| 812 | add_filter('admin_footer_text', [$this, 'remove_admin_footer_text']); |
| 813 | add_filter('update_footer', [$this, 'remove_admin_footer_text'], 11); |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | /** |
| 818 | * Remove admin footer message. |
| 819 | * |
| 820 | * @since 4.0 |
| 821 | * |
| 822 | * @param string $footer_text The footer text. |
| 823 | * |
| 824 | * @return string |
| 825 | */ |
| 826 | public function remove_admin_footer_text($footer_text) |
| 827 | { |
| 828 | return ''; |
| 829 | } |
| 830 | |
| 831 | /** |
| 832 | * Register Menu. |
| 833 | * |
| 834 | * @since 4.0 |
| 835 | */ |
| 836 | public function register_menu() |
| 837 | { |
| 838 | |
| 839 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 840 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 841 | |
| 842 | $notice = ''; |
| 843 | if (\cff_main()->cff_error_reporter->are_critical_errors()) { |
| 844 | $notice = ' <span class="update-plugins cff-error-alert"><span>!</span></span>'; |
| 845 | } |
| 846 | |
| 847 | $global_settings = add_submenu_page( |
| 848 | 'cff-top', |
| 849 | __('Settings', 'custom-facebook-feed'), |
| 850 | __('Settings ' . $notice, 'custom-facebook-feed'), |
| 851 | $cap, |
| 852 | 'cff-settings', |
| 853 | [$this, 'global_settings'], |
| 854 | 1 |
| 855 | ); |
| 856 | add_action('load-' . $global_settings, [$this,'builder_enqueue_admin_scripts']); |
| 857 | } |
| 858 | |
| 859 | /** |
| 860 | * Enqueue Builder CSS & Script. |
| 861 | * |
| 862 | * Loads only for builder pages |
| 863 | * |
| 864 | * @since 4.0 |
| 865 | */ |
| 866 | public function builder_enqueue_admin_scripts() |
| 867 | { |
| 868 | if (! Util::current_page_is('cff-settings')) { |
| 869 | return; |
| 870 | } |
| 871 | $cff_status = 'inactive'; |
| 872 | $model = $this->get_settings_data(); |
| 873 | $exported_feeds = CFF_Db::feeds_query(); |
| 874 | $feeds = array(); |
| 875 | foreach ($exported_feeds as $feed_id => $feed) { |
| 876 | $feeds[] = array( |
| 877 | 'id' => $feed['id'], |
| 878 | 'name' => $feed['feed_name'] |
| 879 | ); |
| 880 | } |
| 881 | $licenseErrorMsg = null; |
| 882 | $license_key = trim(get_option('cff_license_key')); |
| 883 | if ($license_key) { |
| 884 | $license_last_check = get_option('cff_license_last_check_timestamp'); |
| 885 | $date = time() - (DAY_IN_SECONDS * 90); |
| 886 | if ($date > $license_last_check) { |
| 887 | // make the remote api call and get license data |
| 888 | $cff_license_data = $this->get_license_data($license_key); |
| 889 | if (!empty($cff_license_data)) { |
| 890 | update_option('cff_license_data', $cff_license_data); |
| 891 | } |
| 892 | update_option('cff_license_last_check_timestamp', time()); |
| 893 | } else { |
| 894 | $cff_license_data = get_option('cff_license_data'); |
| 895 | } |
| 896 | // update the license data with proper error messages when necessary |
| 897 | $cff_license_data = CFF_Global_Settings::get_license_error_message($cff_license_data); |
| 898 | $cff_status = $cff_license_data['license']; |
| 899 | $licenseErrorMsg = ( isset($cff_license_data['error']) && isset($cff_license_data['errorMsg']) ) ? $cff_license_data['errorMsg'] : null; |
| 900 | } |
| 901 | |
| 902 | wp_enqueue_style( |
| 903 | 'settings-style', |
| 904 | CFF_PLUGIN_URL . 'admin/assets/css/settings.css', |
| 905 | false, |
| 906 | CFFVER |
| 907 | ); |
| 908 | |
| 909 | CFF_Feed_Builder::global_enqueue_ressources_scripts(true); |
| 910 | |
| 911 | |
| 912 | wp_enqueue_script( |
| 913 | 'settings-app', |
| 914 | CFF_PLUGIN_URL . 'admin/assets/js/settings.js', |
| 915 | array( 'sb-vue' ), |
| 916 | CFFVER, |
| 917 | true |
| 918 | ); |
| 919 | |
| 920 | $license_key = null; |
| 921 | if (get_option('cff_license_key')) { |
| 922 | $license_key = get_option('cff_license_key'); |
| 923 | } |
| 924 | |
| 925 | $has_license_error = false; |
| 926 | if ( |
| 927 | ( isset($cff_license_data['license']) && 'expired' === $cff_license_data['license'] ) || |
| 928 | ( isset($cff_license_data['error']) && ( $cff_license_data['error'] || 'expired' == $cff_license_data['error'] ) ) |
| 929 | ) { |
| 930 | $has_license_error = true; |
| 931 | } |
| 932 | |
| 933 | $upgrade_url = 'https://smashballoon.com/custom-facebook-feed/facebook-lite-upgrade/?utm_campaign=facebook-free&utm_source=settings&utm_medium=upgrade'; |
| 934 | $footer_upgrade_url = 'https://smashballoon.com/custom-facebook-feed/facebook-lite-upgrade/?utm_campaign=facebook-free&utm_source=settings&utm_medium=footer-banner&utm_content=getStarted'; |
| 935 | $usage_tracking_url = 'https://smashballoon.com/custom-facebook-feed/docs/usage-tracking/?utm_campaign=facebook-free&utm_source=settings&utm_medium=docs'; |
| 936 | $feed_issue_email_url = 'https://smashballoon.com/email-report-is-not-in-my-inbox/?utm_campaign=facebook-free&utm_source=settings&utm_medium=docs'; |
| 937 | |
| 938 | $sources_list = CFF_Feed_Builder::get_source_list(); |
| 939 | |
| 940 | // Extract only license keys and build array for extensions license keys |
| 941 | $extensions_license_key = array(); |
| 942 | foreach ($this->get_extensions_license() as $item) { |
| 943 | if ($item['licenseKey'] != false) { |
| 944 | $extensions_license_key[ $item['name'] ] = $item['licenseKey']; |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | $cff_settings = array( |
| 949 | 'admin_url' => admin_url(), |
| 950 | 'ajax_handler' => admin_url('admin-ajax.php'), |
| 951 | 'nonce' => wp_create_nonce('cff_admin_nonce'), |
| 952 | 'supportPageUrl' => admin_url('admin.php?page=cff-support'), |
| 953 | 'builderUrl' => admin_url('admin.php?page=cff-feed-builder'), |
| 954 | 'links' => $this->get_links_with_utm(), |
| 955 | 'licenseType' => CFF_Utils::cff_is_pro_version() ? 'pro' : 'free', |
| 956 | 'licenseKey' => $license_key, |
| 957 | 'licenseStatus' => $cff_status, |
| 958 | 'licenseErrorMsg' => $licenseErrorMsg, |
| 959 | 'extensionsLicense' => $this->get_extensions_license(), |
| 960 | 'extensionsLicenseKey' => $extensions_license_key, |
| 961 | 'hasError' => $has_license_error, |
| 962 | 'upgradeUrl' => $upgrade_url, |
| 963 | 'footerUpgradeUrl' => $footer_upgrade_url, |
| 964 | 'isDevSite' => CFF_Upgrader::is_dev_url(home_url()), |
| 965 | 'model' => $model, |
| 966 | 'feeds' => $feeds, |
| 967 | 'sources' => $sources_list, |
| 968 | 'locales' => CFF_Global_Settings::locales(), |
| 969 | 'timezones' => CFF_Global_Settings::timezones(), |
| 970 | 'socialWallLinks' => CFF_Feed_Builder::get_social_wall_links(), |
| 971 | 'socialWallActivated' => is_plugin_active('social-wall/social-wall.php'), |
| 972 | 'genericText' => CFF_Feed_Builder::get_generic_text(), |
| 973 | 'generalTab' => array( |
| 974 | 'licenseBox' => array( |
| 975 | 'title' => __('License Key', 'custom-facebook-feed'), |
| 976 | 'description' => __('Your license key provides access to updates and support', 'custom-facebook-feed'), |
| 977 | 'activeText' => __('Your <b>Custom Facebook Feed Pro</b> license is Active!', 'custom-facebook-feed'), |
| 978 | 'inactiveText' => __('Your <b>Custom Facebook Feed Pro</b> license is Inactive!', 'custom-facebook-feed'), |
| 979 | 'freeText' => __('Already purchased? Simply enter your license key below to activate Custom Facebook Feed Pro.', 'custom-facebook-feed'), |
| 980 | 'inactiveFieldPlaceholder' => __('Paste license key here', 'custom-facebook-feed'), |
| 981 | 'upgradeText1' => __('You are using the Lite version of the plugin–no license needed. Enjoy! 🙂 To unlock more features, consider <a href="' . $upgrade_url . '&utm_content=Upgrade to Pro link" target="_blank">Upgrading to Pro</a>.', 'custom-facebook-feed'), |
| 982 | 'upgradeText2' => __('As a valued user of our Lite plugin, you receive 50% OFF - automatically applied at checkout!', 'custom-facebook-feed'), |
| 983 | 'manageLicense' => __('Manage License', 'custom-facebook-feed'), |
| 984 | 'test' => __('Test Connection', 'custom-facebook-feed'), |
| 985 | 'connectionSuccessful' => __('Connection successful', 'custom-facebook-feed'), |
| 986 | 'connectionFailed' => __('Connection failed', 'custom-facebook-feed'), |
| 987 | 'viewError' => __('View error', 'custom-facebook-feed'), |
| 988 | 'upgrade' => __('Upgrade', 'custom-facebook-feed'), |
| 989 | 'deactivate' => __('Deactivate', 'custom-facebook-feed'), |
| 990 | 'activate' => __('Activate', 'custom-facebook-feed'), |
| 991 | 'installPro' => __('Install Pro', 'custom-facebook-feed'), |
| 992 | ), |
| 993 | 'manageSource' => array( |
| 994 | 'title' => __('Manage Sources', 'custom-facebook-feed'), |
| 995 | 'description' => __('Add or remove connected Facebook accounts', 'custom-facebook-feed'), |
| 996 | ), |
| 997 | 'preserveBox' => array( |
| 998 | 'title' => __('Preserve settings if plugin is removed', 'custom-facebook-feed'), |
| 999 | 'description' => __('This will make sure that all of your feeds and settings are still saved even if the plugin is uninstalled', 'custom-facebook-feed'), |
| 1000 | ), |
| 1001 | 'importBox' => array( |
| 1002 | 'title' => __('Import Feed Settings', 'custom-facebook-feed'), |
| 1003 | 'description' => __('You will need a JSON file previously exported from the Custom Facebook Feed Plugin', 'custom-facebook-feed'), |
| 1004 | 'button' => __('Import', 'custom-facebook-feed'), |
| 1005 | ), |
| 1006 | 'exportBox' => array( |
| 1007 | 'title' => __('Export Feed Settings', 'custom-facebook-feed'), |
| 1008 | 'description' => __('Export settings for one or more of your feeds', 'custom-facebook-feed'), |
| 1009 | 'button' => __('Export', 'custom-facebook-feed'), |
| 1010 | ) |
| 1011 | ), |
| 1012 | 'feedsTab' => array( |
| 1013 | 'localizationBox' => array( |
| 1014 | 'title' => __('Localization', 'custom-facebook-feed'), |
| 1015 | 'tooltip' => '<p>This controls the language of any predefined text strings provided by Facebook. 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/cff-how-does-the-plugin-handle-text-and-language-translation/?utm_campaign=facebook-free&utm_source=settings&utm_medium=docs">this FAQ</a>.</p>' |
| 1016 | ), |
| 1017 | 'timezoneBox' => array( |
| 1018 | 'title' => __('Timezone', 'custom-facebook-feed') |
| 1019 | ), |
| 1020 | 'cachingBox' => array( |
| 1021 | 'title' => __('Caching', 'custom-facebook-feed'), |
| 1022 | 'pageLoads' => __('When the Page loads', 'custom-facebook-feed'), |
| 1023 | 'inTheBackground' => __('In the Background', 'custom-facebook-feed'), |
| 1024 | 'inTheBackgroundOptions' => array( |
| 1025 | '30mins' => __('Every 30 minutes', 'custom-facebook-feed'), |
| 1026 | '1hour' => __('Every hour', 'custom-facebook-feed'), |
| 1027 | '12hours' => __('Every 12 hours', 'custom-facebook-feed'), |
| 1028 | '24hours' => __('Every 24 hours', 'custom-facebook-feed'), |
| 1029 | ), |
| 1030 | 'timeUnits' => array( |
| 1031 | 'minutes' => __('Minutes', 'custom-facebook-feed'), |
| 1032 | 'hours' => __('Hours', 'custom-facebook-feed'), |
| 1033 | 'days' => __('Days', 'custom-facebook-feed'), |
| 1034 | ), |
| 1035 | 'am' => __('AM', 'custom-facebook-feed'), |
| 1036 | 'pm' => __('PM', 'custom-facebook-feed'), |
| 1037 | 'clearCache' => __('Clear All Caches', 'custom-facebook-feed'), |
| 1038 | 'promoText' => __('Update feeds asynchronously in the background with Facebook Feed Pro', 'custom-facebook-feed') |
| 1039 | ), |
| 1040 | 'gdprBox' => array( |
| 1041 | 'title' => __('GDPR', 'custom-facebook-feed'), |
| 1042 | 'automatic' => __('Automatic', 'custom-facebook-feed'), |
| 1043 | 'yes' => __('Yes', 'custom-facebook-feed'), |
| 1044 | 'no' => __('No', 'custom-facebook-feed'), |
| 1045 | 'infoAuto' => $this->get_gdpr_auto_info(), |
| 1046 | 'infoYes' => __('No requests will be made to third-party websites. To accommodate this, some features of the plugin will be limited.', 'custom-facebook-feed'), |
| 1047 | 'infoNo' => __('The plugin will function as normal and load images and videos directly from Facebook', 'custom-facebook-feed'), |
| 1048 | 'someFacebook' => __('Some Facebook Feed features will be limited for visitors to ensure GDPR compliance, until they give consent.', 'custom-facebook-feed'), |
| 1049 | 'whatLimited' => __('What will be limited?', 'custom-facebook-feed'), |
| 1050 | 'tooltip' => '<p><b>If set to “Yes”,</b> it prevents all images and videos from being loaded directly from Facebook’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> |
| 1051 | <p><b>If set to “No”,</b> the plugin will still make some requests to load and display images and videos directly from Facebook.</p> |
| 1052 | <p><b>If set to “Automatic”,</b> it will only load images and videos directly from Facebook if consent has been given by one of these integrated GDPR cookie Plugins.</p> |
| 1053 | <p><a href="#">Learn More</a></p>', |
| 1054 | 'gdprTooltipFeatureInfo' => array( |
| 1055 | 'headline' => __('Features that would be disabled or limited include: ', 'custom-facebook-feed'), |
| 1056 | 'features' => array( |
| 1057 | __('Only local images (not directly from Facebook) will be displayed in the feed', 'custom-facebook-feed'), |
| 1058 | __('Placeholder blank images will be displayed until images are available', 'custom-facebook-feed'), |
| 1059 | __('The images in the Visual header will not be displayed', 'custom-facebook-feed'), |
| 1060 | __('To play videos visitors will click a link to view the video in Facebook.', 'custom-facebook-feed'), |
| 1061 | __('The “Load more” button will be disabled', 'custom-facebook-feed'), |
| 1062 | __('The “Like Box” widget will be disabled', 'custom-facebook-feed'), |
| 1063 | __('For album feeds, only the album cover image is available in lightbox', 'custom-facebook-feed'), |
| 1064 | __('The maximum image resolution will be 700px wide in the lightbox. If your images are smaller, reset the “resized images” using the button in “Advanced” section.', 'custom-facebook-feed'), |
| 1065 | ) |
| 1066 | ) |
| 1067 | ), |
| 1068 | 'customCSSBox' => array( |
| 1069 | 'title' => __('Custom CSS', 'custom-facebook-feed'), |
| 1070 | 'placeholder' => __('Enter any custom CSS here', 'custom-facebook-feed'), |
| 1071 | 'message' => sprintf(__('The Custom CSS field has been deprecated. Your CSS has been moved into the native WordPress Custom CSS field instead. This is located %shere%s at <i>Appearance > Customize > Additional CSS.</i>', ''), '<a href="' . esc_url(wp_customize_url()) . '" target="_blank" rel="noopener noreferrer">', '</a>') |
| 1072 | ), |
| 1073 | 'customJSBox' => array( |
| 1074 | 'title' => __('Custom JS', 'custom-facebook-feed'), |
| 1075 | 'placeholder' => __('Enter any custom JS here', 'custom-facebook-feed'), |
| 1076 | 'message' => sprintf(__('The Custom JS field has been deprecated. Your JavaScript is displayed below. To continue using this JavaScript, please first review the code below and follow the directions in %sthis doc%s.', ''), '<a href="https://smashballoon.com/doc/moving-custom-javascript-code-out-of-our-plugins/?utm_campaign=facebook-free&utm_source=settings&utm_medium=docs" target="_blank" rel="noopener noreferrer">', '</a>') |
| 1077 | ) |
| 1078 | ), |
| 1079 | 'translationTab' => array( |
| 1080 | 'title' => __('Custom Text/Translate', 'custom-facebook-feed'), |
| 1081 | 'description' => __('Enter custom text for the words below, or translate it into the language you would like to use.', 'custom-facebook-feed'), |
| 1082 | 'table' => array( |
| 1083 | 'originalText' => __('Original Text', 'custom-facebook-feed'), |
| 1084 | 'customText' => __('Custom text/translation', 'custom-facebook-feed'), |
| 1085 | 'context' => __('Context', 'custom-facebook-feed'), |
| 1086 | 'postText' => __('Post Text', 'custom-facebook-feed'), |
| 1087 | 'seeMore' => __('See More', 'custom-facebook-feed'), |
| 1088 | 'seeLess' => __('See Less', 'custom-facebook-feed'), |
| 1089 | 'usedWhen' => __('Used when truncating the post text', 'custom-facebook-feed'), |
| 1090 | 'events' => __('Events', 'custom-facebook-feed'), |
| 1091 | 'map' => __('Map', 'custom-facebook-feed'), |
| 1092 | 'addedAfter' => __('Added after the address of an event', 'custom-facebook-feed'), |
| 1093 | 'noUpcoming' => __('No upcoming events', 'custom-facebook-feed'), |
| 1094 | 'shownWhen' => __('Shown when there are no upcoming events to display', 'custom-facebook-feed'), |
| 1095 | 'interested' => __('interested', 'custom-facebook-feed'), |
| 1096 | 'usedFor' => __('Used for the number of people interested in an event', 'custom-facebook-feed'), |
| 1097 | 'going' => __('going', 'custom-facebook-feed'), |
| 1098 | 'usedFor2' => __('Used for the number of people going to an event', 'custom-facebook-feed'), |
| 1099 | 'buyTickets' => __('Buy tickets', 'custom-facebook-feed'), |
| 1100 | 'shownWhen2' => __('Shown when there is a link to buy event tickets', 'custom-facebook-feed'), |
| 1101 | 'postAction' => __('Post Action Links', 'custom-facebook-feed'), |
| 1102 | 'viewOnFB' => __('View on Facebook', 'custom-facebook-feed'), |
| 1103 | 'usedFor3' => __('Used for the link to the post on Facebook', 'custom-facebook-feed'), |
| 1104 | 'share' => __('Share', 'custom-facebook-feed'), |
| 1105 | 'usedFor4' => __('Used for sharing the Facebook post via Social Media', 'custom-facebook-feed'), |
| 1106 | 'loadMoreBtn' => __('“Load More” Button', 'custom-facebook-feed'), |
| 1107 | 'loadMore' => __('Load More', 'custom-facebook-feed'), |
| 1108 | 'media' => __('Media', 'custom-facebook-feed'), |
| 1109 | 'photo' => __('Photo', 'custom-facebook-feed'), |
| 1110 | 'video' => __('Video', 'custom-facebook-feed'), |
| 1111 | 'usedTo1' => __('Used to link photos on Facebook', 'custom-facebook-feed'), |
| 1112 | 'usedTo2' => __('Used to link videos on Facebook', 'custom-facebook-feed'), |
| 1113 | 'usedIn' => __('Used in the button that loads more posts', 'custom-facebook-feed'), |
| 1114 | 'noMorePosts' => __('No more posts', 'custom-facebook-feed'), |
| 1115 | 'usedWhen2' => __('Used when there are no more posts to load', 'custom-facebook-feed'), |
| 1116 | 'likeShareComment' => __('Likes, Shares and Comments', 'custom-facebook-feed'), |
| 1117 | 'viewMore' => __('View more comments', 'custom-facebook-feed'), |
| 1118 | 'usedIn2' => __('Used in the comments section (when applicable)', 'custom-facebook-feed'), |
| 1119 | 'commentOnFB' => __('Comment on Facebook', 'custom-facebook-feed'), |
| 1120 | 'usedAt' => __('Used at the bottom of the comments section', 'custom-facebook-feed'), |
| 1121 | 'photos' => __('photos', 'custom-facebook-feed'), |
| 1122 | 'addedTo' => __('Added to the end of an album name. Eg. (6 photos)', 'custom-facebook-feed'), |
| 1123 | 'likeThis' => __('like this', 'custom-facebook-feed'), |
| 1124 | 'likesThis' => __('likes this', 'custom-facebook-feed'), |
| 1125 | 'egLikeThis' => __('Eg. __ and __ like this', 'custom-facebook-feed'), |
| 1126 | 'egLikesThis' => __('Eg. __ likes this', 'custom-facebook-feed'), |
| 1127 | 'reactedToThis' => __('reacted to this', 'custom-facebook-feed'), |
| 1128 | 'egReactedToThis' => __('Eg. __ reacted to this', 'custom-facebook-feed'), |
| 1129 | 'and' => __('and', 'custom-facebook-feed'), |
| 1130 | 'other' => __('other', 'custom-facebook-feed'), |
| 1131 | 'eg1otherLike' => __('Eg. __, __ and 1 other like this', 'custom-facebook-feed'), |
| 1132 | 'others' => __('others', 'custom-facebook-feed'), |
| 1133 | 'eg10othersLike' => __('Eg. __, __ and 10 others like this', 'custom-facebook-feed'), |
| 1134 | 'reply' => __('reply', 'custom-facebook-feed'), |
| 1135 | 'eg1reply' => __('Eg. 1 reply', 'custom-facebook-feed'), |
| 1136 | 'replies' => __('replies', 'custom-facebook-feed'), |
| 1137 | 'eg5replies' => __('Eg. 5 replies', 'custom-facebook-feed'), |
| 1138 | 'callToBTN' => __('Call to Action Buttons', 'custom-facebook-feed'), |
| 1139 | 'learnMore' => __('Learn More', 'custom-facebook-feed'), |
| 1140 | 'usedFor5' => __("Used for the 'Learn More' button", 'custom-facebook-feed'), |
| 1141 | 'shopNow' => __('Shop Now', 'custom-facebook-feed'), |
| 1142 | 'usedFor6' => __("Used for the 'Shop Now' button", 'custom-facebook-feed'), |
| 1143 | 'usedFor7' => __("Used for the 'Message Page' button", 'custom-facebook-feed'), |
| 1144 | 'usedFor8' => __("Used for the 'Get Directions' button", 'custom-facebook-feed'), |
| 1145 | 'messagePage' => __('Message Page', 'custom-facebook-feed'), |
| 1146 | 'getDirections' => __('Get Directions', 'custom-facebook-feed'), |
| 1147 | 'date' => __('Date', 'custom-facebook-feed'), |
| 1148 | 'second' => __('second', 'custom-facebook-feed'), |
| 1149 | 'seconds' => __('second', 'custom-facebook-feed'), |
| 1150 | 'usedFor9' => __('Used for “Posted a second ago”', 'custom-facebook-feed'), |
| 1151 | 'usedFor10' => __('Used for “Posted __ seconds ago”', 'custom-facebook-feed'), |
| 1152 | 'usedFor11' => __('Used for “Posted a minute ago”', 'custom-facebook-feed'), |
| 1153 | 'usedFor12' => __('Used for “Posted __ minutes ago”', 'custom-facebook-feed'), |
| 1154 | 'usedFor13' => __('Used for “Posted a hour ago”', 'custom-facebook-feed'), |
| 1155 | 'usedFor14' => __('Used for “Posted __ hours ago”', 'custom-facebook-feed'), |
| 1156 | 'usedFor15' => __('Used for “Posted a day ago”', 'custom-facebook-feed'), |
| 1157 | 'usedFor16' => __('Used for “Posted __ days ago”', 'custom-facebook-feed'), |
| 1158 | 'usedFor17' => __('Used for “Posted a week ago”', 'custom-facebook-feed'), |
| 1159 | 'usedFor18' => __('Used for “Posted __ weeks ago”', 'custom-facebook-feed'), |
| 1160 | 'usedFor19' => __('Used for “Posted a month ago”', 'custom-facebook-feed'), |
| 1161 | 'usedFor20' => __('Used for “Posted __ months ago”', 'custom-facebook-feed'), |
| 1162 | 'usedFor21' => __('Used for “Posted a year ago”', 'custom-facebook-feed'), |
| 1163 | 'usedFor22' => __('Used for “Posted __ years ago”', 'custom-facebook-feed'), |
| 1164 | 'usedFor23' => __('Used for “Posted __ seconds ago”', 'custom-facebook-feed'), |
| 1165 | 'minute' => __('minute', 'custom-facebook-feed'), |
| 1166 | 'minutes' => __('minutes', 'custom-facebook-feed'), |
| 1167 | 'hour' => __('hour', 'custom-facebook-feed'), |
| 1168 | 'hours' => __('hours', 'custom-facebook-feed'), |
| 1169 | 'day' => __('day', 'custom-facebook-feed'), |
| 1170 | 'days' => __('days', 'custom-facebook-feed'), |
| 1171 | 'week' => __('week', 'custom-facebook-feed'), |
| 1172 | 'weeks' => __('weeks', 'custom-facebook-feed'), |
| 1173 | 'month' => __('month', 'custom-facebook-feed'), |
| 1174 | 'months' => __('months', 'custom-facebook-feed'), |
| 1175 | 'year' => __('year', 'custom-facebook-feed'), |
| 1176 | 'years' => __('years', 'custom-facebook-feed'), |
| 1177 | 'ago' => __('ago', 'custom-facebook-feed'), |
| 1178 | ) |
| 1179 | ), |
| 1180 | 'advancedTab' => array( |
| 1181 | 'optimizeBox' => array( |
| 1182 | 'title' => __('Optimize Images', 'custom-facebook-feed'), |
| 1183 | '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-facebook-feed'), |
| 1184 | 'reset' => __('Reset', 'custom-facebook-feed'), |
| 1185 | 'promoText' => __('Optimize images with Facebook Feed Pro', 'custom-facebook-feed'), |
| 1186 | ), |
| 1187 | 'usageBox' => array( |
| 1188 | 'title' => __('Usage Tracking', 'custom-facebook-feed'), |
| 1189 | '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-facebook-feed' ), '<a href="' . $usage_tracking_url . '" target="_blank">' . __( 'Learn More', 'custom-facebook-feed' ) . '</a>' ), |
| 1190 | ), |
| 1191 | 'ajaxBox' => array( |
| 1192 | 'title' => __('AJAX theme loading fix', 'custom-facebook-feed'), |
| 1193 | 'helpText' => __('Fixes issues caused by Ajax loading themes. It can also be used to workaround JavaScript errors on the page.', 'custom-facebook-feed'), |
| 1194 | ), |
| 1195 | 'showCreditBox' => array( |
| 1196 | 'title' => __('Show Credit Link', 'custom-facebook-feed'), |
| 1197 | 'helpText' => __('Display a link at the bottom of the feed to the Smash Balloon website. Thank you! :)', 'custom-facebook-feed'), |
| 1198 | ), |
| 1199 | 'fixTextBox' => array( |
| 1200 | 'title' => __('Fix a text shortening issue caused by some themes', 'custom-facebook-feed'), |
| 1201 | ), |
| 1202 | 'adminErrorBox' => array( |
| 1203 | 'title' => __('Admin Error Notice', 'custom-facebook-feed'), |
| 1204 | 'helpText' => __('This will disable or enable the feed error notice that displays in the bottom right corner of your site for logged-in admins.', 'custom-facebook-feed'), |
| 1205 | ), |
| 1206 | 'feedIssueBox' => array( |
| 1207 | 'title' => __('Feed Issue Email Reports', 'custom-facebook-feed'), |
| 1208 | 'helpText' => __('If the feed is down due to a critical issue, we will switch to a cached version and notify you based on these settings. <a href="' . $feed_issue_email_url . '" target="_blank">View Documentation</a>', 'custom-facebook-feed'), |
| 1209 | 'sendReport' => __('Send a report every', 'custom-facebook-feed'), |
| 1210 | 'to' => __('to', 'custom-facebook-feed'), |
| 1211 | 'placeholder' => __('Enter one or more email addresses separated by comma', 'custom-facebook-feed'), |
| 1212 | 'weekDays' => array( |
| 1213 | array( |
| 1214 | 'val' => 'monday', |
| 1215 | 'label' => __('Monday', 'custom-facebook-feed') |
| 1216 | ), |
| 1217 | array( |
| 1218 | 'val' => 'tuesday', |
| 1219 | 'label' => __('Tuesday', 'custom-facebook-feed') |
| 1220 | ), |
| 1221 | array( |
| 1222 | 'val' => 'wednesday', |
| 1223 | 'label' => __('Wednesday', 'custom-facebook-feed') |
| 1224 | ), |
| 1225 | array( |
| 1226 | 'val' => 'thursday', |
| 1227 | 'label' => __('Thursday', 'custom-facebook-feed') |
| 1228 | ), |
| 1229 | array( |
| 1230 | 'val' => 'friday', |
| 1231 | 'label' => __('Friday', 'custom-facebook-feed') |
| 1232 | ), |
| 1233 | array( |
| 1234 | 'val' => 'saturday', |
| 1235 | 'label' => __('Saturday', 'custom-facebook-feed') |
| 1236 | ), |
| 1237 | array( |
| 1238 | 'val' => 'sunday', |
| 1239 | 'label' => __('Sunday', 'custom-facebook-feed') |
| 1240 | ), |
| 1241 | ) |
| 1242 | ), |
| 1243 | 'dpaClear' => array( |
| 1244 | 'title' => __('Manage Data', 'custom-facebook-feed'), |
| 1245 | 'helpText' => __('Warning: Clicking this button will permanently delete all Facebook data, including all connected accounts, cached posts, and stored images.', 'custom-facebook-feed'), |
| 1246 | 'clear' => __('Delete all Platform Data', 'custom-facebook-feed'), |
| 1247 | ), |
| 1248 | ), |
| 1249 | 'dialogBoxPopupScreen' => array( |
| 1250 | 'deleteSource' => array( |
| 1251 | 'heading' => __('Delete "#"?', 'custom-facebook-feed'), |
| 1252 | '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-facebook-feed'), |
| 1253 | ), |
| 1254 | ), |
| 1255 | |
| 1256 | 'selectSourceScreen' => CFF_Feed_Builder::select_source_screen_text(), |
| 1257 | |
| 1258 | 'nextCheck' => $this->get_cron_next_check(), |
| 1259 | '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>', |
| 1260 | '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>', |
| 1261 | 'uploadSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1262 | <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>', |
| 1263 | 'exportSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1264 | <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>', |
| 1265 | 'reloadSVG' => '<svg width="20" height="14" viewBox="0 0 20 14" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1266 | <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.28596C4.03587 3.5362 3.3335 5.23189 3.3335 7H0.833496L4.16683 10.3333L7.50016 7" fill="#141B38"/></svg>', |
| 1267 | '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>', |
| 1268 | 'svgIcons' => CFF_Feed_Builder::builder_svg_icons() |
| 1269 | ); |
| 1270 | |
| 1271 | $newly_retrieved_source_connection_data = CFF_Source::maybe_source_connection_data(); |
| 1272 | if ($newly_retrieved_source_connection_data) { |
| 1273 | $cff_settings['newSourceData'] = $newly_retrieved_source_connection_data; |
| 1274 | } |
| 1275 | // Check For Manual Source Popup |
| 1276 | $cff_settings['newManualSourcePopup'] = (isset($_GET['manualsource']) && $_GET['manualsource'] == 'true') ? true : false; |
| 1277 | |
| 1278 | |
| 1279 | wp_localize_script( |
| 1280 | 'settings-app', |
| 1281 | 'cff_settings', |
| 1282 | $cff_settings |
| 1283 | ); |
| 1284 | } |
| 1285 | |
| 1286 | /** |
| 1287 | * Get Extensions License Information |
| 1288 | * |
| 1289 | * @since 4.0 |
| 1290 | * |
| 1291 | * @return array |
| 1292 | */ |
| 1293 | public function get_extensions_license() |
| 1294 | { |
| 1295 | $data = array(); |
| 1296 | $cff_ext = is_plugin_active('cff-extensions/cff-extensions.php'); |
| 1297 | |
| 1298 | // check whether the extensions plugin is activated or not |
| 1299 | if ($cff_ext) { |
| 1300 | $license_key = get_option('cff_license_key_extensions'); |
| 1301 | $license_status = get_option('cff_license_status_extensions'); |
| 1302 | $status_text = ''; |
| 1303 | if ($license_status !== false && $license_status == 'valid') { |
| 1304 | $status_text = __('Your <b>Extensions</b> license is Active!', 'custom-facebook-feed'); |
| 1305 | } else { |
| 1306 | $status_text = __('Your <b>Extensions</b> license is Inactive!', 'custom-facebook-feed'); |
| 1307 | } |
| 1308 | $upgrade_url = sprintf( |
| 1309 | self::UPGRADE_LICENSE_URL, |
| 1310 | $license_key |
| 1311 | ); |
| 1312 | |
| 1313 | $data[] = array( |
| 1314 | 'name' => 'extensions', |
| 1315 | 'itemName' => SB_ITEM_NAME_EXTENSIONS, |
| 1316 | 'upgradeUrl' => $upgrade_url, |
| 1317 | 'statusText' => $status_text, |
| 1318 | 'licenseKey' => $license_key, |
| 1319 | 'licenseStatus' => $license_status, |
| 1320 | ); |
| 1321 | |
| 1322 | return $data; |
| 1323 | } |
| 1324 | |
| 1325 | // Define the variables |
| 1326 | $multifeed_active = is_plugin_active('cff-multifeed/cff-multifeed.php'); |
| 1327 | $reviews_active = is_plugin_active('cff-reviews/cff-reviews.php'); |
| 1328 | $carousel_active = is_plugin_active('cff-carousel/cff-carousel.php'); |
| 1329 | $date_range_active = is_plugin_active('cff-date-range/cff-date-range.php'); |
| 1330 | $featured_active = is_plugin_active('cff-featured-post/cff-featured-post.php'); |
| 1331 | $album_active = is_plugin_active('cff-album/cff-album.php'); |
| 1332 | |
| 1333 | // If multifeed extension is activated |
| 1334 | if ($multifeed_active) { |
| 1335 | $license_key = get_option('cff_license_key_multifeed'); |
| 1336 | $license_status = get_option('cff_license_status_multifeed'); |
| 1337 | $status_text = ''; |
| 1338 | if ($license_status !== false && $license_status == 'valid') { |
| 1339 | $status_text = __('Your <b>Multifeed</b> license is Active!', 'custom-facebook-feed'); |
| 1340 | } else { |
| 1341 | $status_text = __('Your <b>Multifeed</b> license is Inactive!', 'custom-facebook-feed'); |
| 1342 | } |
| 1343 | $upgrade_url = sprintf( |
| 1344 | self::UPGRADE_LICENSE_URL, |
| 1345 | $license_key |
| 1346 | ); |
| 1347 | $data[] = array( |
| 1348 | 'name' => 'multifeed', |
| 1349 | 'itemName' => SB_ITEM_NAME_MULTIFEED, |
| 1350 | 'upgradeUrl' => $upgrade_url, |
| 1351 | 'statusText' => $status_text, |
| 1352 | 'licenseKey' => $license_key, |
| 1353 | 'licenseStatus' => $license_status, |
| 1354 | ); |
| 1355 | } |
| 1356 | |
| 1357 | // If reviews extension is activated |
| 1358 | if ($reviews_active) { |
| 1359 | $license_key = get_option('cff_license_key_ext_reviews'); |
| 1360 | $license_status = get_option('cff_license_status_ext_reviews'); |
| 1361 | $status_text = ''; |
| 1362 | if ($license_status !== false && $license_status == 'valid') { |
| 1363 | $status_text = __('Your <b>Reviews</b> license is Active!', 'custom-facebook-feed'); |
| 1364 | } else { |
| 1365 | $status_text = __('Your <b>Reviews</b> license is Inactive!', 'custom-facebook-feed'); |
| 1366 | } |
| 1367 | $upgrade_url = sprintf( |
| 1368 | self::UPGRADE_LICENSE_URL, |
| 1369 | $license_key |
| 1370 | ); |
| 1371 | $data[] = array( |
| 1372 | 'name' => 'ext_reviews', |
| 1373 | 'itemName' => SB_ITEM_NAME_EXT_REVIEWS, |
| 1374 | 'upgradeUrl' => $upgrade_url, |
| 1375 | 'statusText' => $status_text, |
| 1376 | 'licenseKey' => $license_key == 'false' ? false : $license_key, |
| 1377 | 'licenseStatus' => $license_status, |
| 1378 | ); |
| 1379 | } |
| 1380 | |
| 1381 | // If carousel extension is activated |
| 1382 | if ($carousel_active) { |
| 1383 | $license_key = get_option('cff_license_key_ext_carousel'); |
| 1384 | $license_status = get_option('cff_license_status_ext_carousel'); |
| 1385 | $status_text = ''; |
| 1386 | if ($license_status !== false && $license_status == 'valid') { |
| 1387 | $status_text = __('Your <b>Carousel</b> license is Active!', 'custom-facebook-feed'); |
| 1388 | } else { |
| 1389 | $status_text = __('Your <b>Carousel</b> license is Inactive!', 'custom-facebook-feed'); |
| 1390 | } |
| 1391 | $upgrade_url = sprintf( |
| 1392 | self::UPGRADE_LICENSE_URL, |
| 1393 | $license_key |
| 1394 | ); |
| 1395 | $data[] = array( |
| 1396 | 'name' => 'ext_carousel', |
| 1397 | 'itemName' => SB_ITEM_NAME_CAROUSEL, |
| 1398 | 'upgradeUrl' => $upgrade_url, |
| 1399 | 'statusText' => $status_text, |
| 1400 | 'licenseKey' => $license_key == 'false' ? false : $license_key, |
| 1401 | 'licenseStatus' => $license_status, |
| 1402 | ); |
| 1403 | } |
| 1404 | |
| 1405 | // If date range extension is activated |
| 1406 | if ($date_range_active) { |
| 1407 | $license_key = get_option('cff_license_key_ext_date'); |
| 1408 | $license_status = get_option('cff_license_status_ext_date'); |
| 1409 | $status_text = ''; |
| 1410 | if ($license_status !== false && $license_status == 'valid') { |
| 1411 | $status_text = __('Your <b>Date Range</b> license is Active!', 'custom-facebook-feed'); |
| 1412 | } else { |
| 1413 | $status_text = __('Your <b>Date Range</b> license is Inactive!', 'custom-facebook-feed'); |
| 1414 | } |
| 1415 | $upgrade_url = sprintf( |
| 1416 | self::UPGRADE_LICENSE_URL, |
| 1417 | $license_key |
| 1418 | ); |
| 1419 | $data[] = array( |
| 1420 | 'name' => 'ext_date', |
| 1421 | 'itemName' => SB_ITEM_NAME_EXT_DATE, |
| 1422 | 'upgradeUrl' => $upgrade_url, |
| 1423 | 'statusText' => $status_text, |
| 1424 | 'licenseKey' => $license_key == 'false' ? false : $license_key, |
| 1425 | 'licenseStatus' => $license_status, |
| 1426 | ); |
| 1427 | } |
| 1428 | |
| 1429 | // If featured post extension is activated |
| 1430 | if ($featured_active) { |
| 1431 | $license_key = get_option('cff_license_key_featured_post'); |
| 1432 | $license_status = get_option('cff_license_status_featured_post'); |
| 1433 | $status_text = ''; |
| 1434 | if ($license_status !== false && $license_status == 'valid') { |
| 1435 | $status_text = __('Your <b>Featured Post</b> license is Active!', 'custom-facebook-feed'); |
| 1436 | } else { |
| 1437 | $status_text = __('Your <b>Featured Post</b> license is Inactive!', 'custom-facebook-feed'); |
| 1438 | } |
| 1439 | $upgrade_url = sprintf( |
| 1440 | self::UPGRADE_LICENSE_URL, |
| 1441 | $license_key |
| 1442 | ); |
| 1443 | $data[] = array( |
| 1444 | 'name' => 'featured_post', |
| 1445 | 'itemName' => SB_ITEM_NAME_FEATURED, |
| 1446 | 'upgradeUrl' => $upgrade_url, |
| 1447 | 'statusText' => $status_text, |
| 1448 | 'licenseKey' => $license_key == 'false' ? false : $license_key, |
| 1449 | 'licenseStatus' => $license_status, |
| 1450 | ); |
| 1451 | } |
| 1452 | |
| 1453 | // If album extension is activated |
| 1454 | if ($album_active) { |
| 1455 | $license_key = get_option('cff_license_key_album'); |
| 1456 | $license_status = get_option('cff_license_status_album'); |
| 1457 | $status_text = ''; |
| 1458 | if ($license_status !== false && $license_status == 'valid') { |
| 1459 | $status_text = __('Your <b>Album</b> license is Active!', 'custom-facebook-feed'); |
| 1460 | } else { |
| 1461 | $status_text = __('Your <b>Album</b> license is Inactive!', 'custom-facebook-feed'); |
| 1462 | } |
| 1463 | $upgrade_url = sprintf( |
| 1464 | self::UPGRADE_LICENSE_URL, |
| 1465 | $license_key |
| 1466 | ); |
| 1467 | $data[] = array( |
| 1468 | 'name' => 'album', |
| 1469 | 'itemName' => SB_ITEM_NAME_ALBUM, |
| 1470 | 'upgradeUrl' => $upgrade_url, |
| 1471 | 'statusText' => $status_text, |
| 1472 | 'licenseKey' => $license_key == 'false' ? false : $license_key, |
| 1473 | 'licenseStatus' => $license_status, |
| 1474 | ); |
| 1475 | } |
| 1476 | |
| 1477 | return $data; |
| 1478 | } |
| 1479 | |
| 1480 | /** |
| 1481 | * Get Links with UTM |
| 1482 | * |
| 1483 | * @return array |
| 1484 | * |
| 1485 | * @since 4.0 |
| 1486 | */ |
| 1487 | public static function get_links_with_utm() |
| 1488 | { |
| 1489 | $license_key = null; |
| 1490 | if (get_option('cff_license_key')) { |
| 1491 | $license_key = get_option('cff_license_key'); |
| 1492 | } |
| 1493 | $all_access_bundle_popup = sprintf('https://smashballoon.com/all-access/?license_key=%s&upgrade=true&utm_campaign=facebook-free&utm_source=balloon&utm_medium=all-access', $license_key); |
| 1494 | |
| 1495 | return array( |
| 1496 | 'manageLicense' => 'https://smashballoon.com/account/downloads/?utm_campaign=facebook-free&utm_source=settings&utm_medium=manage-license', |
| 1497 | 'popup' => array( |
| 1498 | 'allAccessBundle' => $all_access_bundle_popup, |
| 1499 | 'fbProfile' => 'https://www.facebook.com/SmashBalloon/', |
| 1500 | 'twitterProfile' => 'https://twitter.com/smashballoon', |
| 1501 | ), |
| 1502 | 'proCachingLink' => 'https://smashballoon.com/custom-facebook-feed/facebook-lite-upgrade/?utm_campaign=facebook-free&utm_source=settings&utm_medium=pro-caching', |
| 1503 | 'optimizeImagesLink' => 'https://smashballoon.com/custom-facebook-feed/facebook-lite-upgrade/?utm_campaign=facebook-free&utm_source=settings&utm_medium=optimize-images' |
| 1504 | ); |
| 1505 | } |
| 1506 | |
| 1507 | /** |
| 1508 | * The Settings Data |
| 1509 | * |
| 1510 | * @since 4.0 |
| 1511 | * |
| 1512 | * @return array |
| 1513 | */ |
| 1514 | public function get_settings_data() |
| 1515 | { |
| 1516 | $cff_preserve_setitngs = get_option('cff_preserve_settings'); |
| 1517 | $cff_locale = get_option('cff_locale', 'en_US'); |
| 1518 | $cff_style_settings = wp_parse_args(get_option('cff_style_settings'), $this->default_settings_options()); |
| 1519 | $cff_caching_type = get_option('cff_caching_type', 'background'); |
| 1520 | $cff_cache_cron_interval = get_option('cff_cache_cron_interval', '12hours'); |
| 1521 | $cff_cache_cron_time = get_option('cff_cache_cron_time', 1); |
| 1522 | $cff_cache_cron_am_pm = get_option('cff_cache_cron_am_pm', 'am'); |
| 1523 | $cff_ajax = get_option('cff_ajax'); |
| 1524 | $active_gdpr_plugin = CFF_GDPR_Integrations::gdpr_plugins_active(); |
| 1525 | $cff_cache_time = get_option('cff_cache_time', 1); |
| 1526 | $cff_cache_time_unit = get_option('cff_cache_time_unit', 'hours'); |
| 1527 | $custom_js_text = ! empty($cff_style_settings['cff_custom_js']) && trim(wp_unslash($cff_style_settings['cff_custom_js'])) !== '' ? wp_unslash($cff_style_settings['cff_custom_js']) : ''; |
| 1528 | if (! empty($custom_js_text)) { |
| 1529 | $js_wrapper_array = [ |
| 1530 | esc_html('<!-- Custom Facebook Feed JS -->') . "\n", |
| 1531 | esc_html('<script type="text/javascript">') . "\n", |
| 1532 | esc_html('function cff_custom_js($){') . "\n", |
| 1533 | esc_html(' var $ = jQuery;') . "\n", |
| 1534 | esc_html('}cff_custom_js($);') . "\n", |
| 1535 | esc_html('</script>') . "\n" |
| 1536 | ]; |
| 1537 | foreach ($js_wrapper_array as $single_wrapper) { |
| 1538 | $custom_js_text = str_replace($single_wrapper, '', $custom_js_text); |
| 1539 | } |
| 1540 | |
| 1541 | $js_html = esc_html('<!-- Custom Facebook Feed JS -->') . "\n"; |
| 1542 | $js_html .= esc_html('<script type="text/javascript">') . "\n"; |
| 1543 | $js_html .= esc_html('function cff_custom_js($){') . "\n"; |
| 1544 | $js_html .= esc_html(' var $ = jQuery;') . "\n"; |
| 1545 | $js_html .= esc_html($custom_js_text) . "\n"; |
| 1546 | $js_html .= esc_html('}cff_custom_js($);') . "\n"; |
| 1547 | $js_html .= esc_html('</script>') . "\n"; |
| 1548 | |
| 1549 | $custom_js_text = $js_html; |
| 1550 | } |
| 1551 | |
| 1552 | return array( |
| 1553 | 'general' => array( |
| 1554 | 'preserveSettings' => $cff_preserve_setitngs |
| 1555 | ), |
| 1556 | 'feeds' => array( |
| 1557 | 'selectedLocale' => $cff_locale, |
| 1558 | 'selectedTimezone' => $cff_style_settings['cff_timezone'], |
| 1559 | 'cachingType' => 'background', |
| 1560 | 'cronInterval' => $cff_cache_cron_interval, |
| 1561 | 'cronTime' => $cff_cache_cron_time, |
| 1562 | 'cronAmPm' => $cff_cache_cron_am_pm, |
| 1563 | 'cacheTime' => $cff_cache_time, |
| 1564 | 'cacheTimeUnit' => $cff_cache_time_unit, |
| 1565 | 'gdpr' => $cff_style_settings['gdpr'], |
| 1566 | 'gdprPlugin' => $active_gdpr_plugin, |
| 1567 | 'customCSS' => isset($cff_style_settings['cff_custom_css_read_only']) ? esc_html(stripslashes(trim($cff_style_settings['cff_custom_css_read_only']))) : '', |
| 1568 | 'customJS' => $custom_js_text, |
| 1569 | ), |
| 1570 | 'translation' => array( |
| 1571 | 'cff_see_more_text' => $cff_style_settings['cff_see_more_text'], |
| 1572 | 'cff_see_less_text' => $cff_style_settings['cff_see_less_text'], |
| 1573 | 'cff_map_text' => $cff_style_settings['cff_map_text'], |
| 1574 | 'cff_no_events_text' => $cff_style_settings['cff_no_events_text'], |
| 1575 | 'cff_interested_text' => $cff_style_settings['cff_interested_text'], |
| 1576 | 'cff_going_text' => $cff_style_settings['cff_going_text'], |
| 1577 | 'cff_buy_tickets_text' => $cff_style_settings['cff_buy_tickets_text'], |
| 1578 | 'cff_facebook_link_text' => $cff_style_settings['cff_facebook_link_text'], |
| 1579 | 'cff_facebook_share_text' => $cff_style_settings['cff_facebook_share_text'], |
| 1580 | 'cff_load_more_text' => $cff_style_settings['cff_load_more_text'], |
| 1581 | 'cff_no_more_posts_text' => $cff_style_settings['cff_no_more_posts_text'], |
| 1582 | 'cff_translate_view_previous_comments_text' => $cff_style_settings['cff_translate_view_previous_comments_text'], |
| 1583 | 'cff_translate_comment_on_facebook_text' => $cff_style_settings['cff_translate_comment_on_facebook_text'], |
| 1584 | 'cff_translate_photos_text' => $cff_style_settings['cff_translate_photos_text'], |
| 1585 | 'cff_translate_photo_text' => $cff_style_settings['cff_translate_photo_text'], |
| 1586 | 'cff_translate_video_text' => $cff_style_settings['cff_translate_video_text'], |
| 1587 | 'cff_translate_like_this_text' => $cff_style_settings['cff_translate_like_this_text'], |
| 1588 | 'cff_translate_likes_this_text' => $cff_style_settings['cff_translate_likes_this_text'], |
| 1589 | 'cff_translate_reacted_text' => $cff_style_settings['cff_translate_reacted_text'], |
| 1590 | 'cff_translate_and_text' => $cff_style_settings['cff_translate_and_text'], |
| 1591 | 'cff_translate_other_text' => $cff_style_settings['cff_translate_other_text'], |
| 1592 | 'cff_translate_others_text' => $cff_style_settings['cff_translate_others_text'], |
| 1593 | 'cff_translate_reply_text' => $cff_style_settings['cff_translate_reply_text'], |
| 1594 | 'cff_translate_replies_text' => $cff_style_settings['cff_translate_replies_text'], |
| 1595 | 'cff_translate_learn_more_text' => $cff_style_settings['cff_translate_learn_more_text'], |
| 1596 | 'cff_translate_shop_now_text' => $cff_style_settings['cff_translate_shop_now_text'], |
| 1597 | 'cff_translate_message_page_text' => $cff_style_settings['cff_translate_message_page_text'], |
| 1598 | 'cff_translate_get_directions_text' => $cff_style_settings['cff_translate_get_directions_text'], |
| 1599 | 'cff_translate_second' => $cff_style_settings['cff_translate_second'], |
| 1600 | 'cff_translate_seconds' => $cff_style_settings['cff_translate_seconds'], |
| 1601 | 'cff_translate_minute' => $cff_style_settings['cff_translate_minute'], |
| 1602 | 'cff_translate_minutes' => $cff_style_settings['cff_translate_minutes'], |
| 1603 | 'cff_translate_hour' => $cff_style_settings['cff_translate_hour'], |
| 1604 | 'cff_translate_hours' => $cff_style_settings['cff_translate_hours'], |
| 1605 | 'cff_translate_day' => $cff_style_settings['cff_translate_day'], |
| 1606 | 'cff_translate_days' => $cff_style_settings['cff_translate_days'], |
| 1607 | 'cff_translate_week' => $cff_style_settings['cff_translate_week'], |
| 1608 | 'cff_translate_weeks' => $cff_style_settings['cff_translate_weeks'], |
| 1609 | 'cff_translate_month' => $cff_style_settings['cff_translate_month'], |
| 1610 | 'cff_translate_months' => $cff_style_settings['cff_translate_months'], |
| 1611 | 'cff_translate_year' => $cff_style_settings['cff_translate_year'], |
| 1612 | 'cff_translate_years' => $cff_style_settings['cff_translate_years'], |
| 1613 | 'cff_translate_ago' => $cff_style_settings['cff_translate_ago'], |
| 1614 | ), |
| 1615 | 'advanced' => array( |
| 1616 | 'cff_disable_resize' => !$cff_style_settings['cff_disable_resize'], |
| 1617 | 'usage_tracking' => SmashTrackingConfig::is_enabled(), |
| 1618 | 'cff_ajax' => $cff_ajax, |
| 1619 | 'cff_show_credit' => $cff_style_settings['cff_show_credit'], |
| 1620 | 'cff_format_issue' => $cff_style_settings['cff_format_issue'], |
| 1621 | 'disable_admin_notice' => !$cff_style_settings['disable_admin_notice'], |
| 1622 | 'enable_email_report' => $cff_style_settings['enable_email_report'], |
| 1623 | 'email_notification' => $cff_style_settings['email_notification'], |
| 1624 | 'email_notification_addresses' => $cff_style_settings['email_notification_addresses'], |
| 1625 | ) |
| 1626 | ); |
| 1627 | } |
| 1628 | |
| 1629 | /** |
| 1630 | * Return the default settings options for cff_style_settings option |
| 1631 | * |
| 1632 | * @since 4.0 |
| 1633 | * |
| 1634 | * @return array |
| 1635 | */ |
| 1636 | public function default_settings_options() |
| 1637 | { |
| 1638 | return array( |
| 1639 | 'cff_timezone' => 'America/Chicago', |
| 1640 | 'gdpr' => 'auto', |
| 1641 | 'cff_see_more_text' => 'See More', |
| 1642 | 'cff_see_less_text' => 'See Less', |
| 1643 | 'cff_map_text' => 'Map', |
| 1644 | 'cff_no_events_text' => 'No upcoming events', |
| 1645 | 'cff_facebook_link_text' => 'View on Facebook', |
| 1646 | 'cff_facebook_share_text' => 'Share', |
| 1647 | 'cff_buy_tickets_text' => 'Buy Tickets', |
| 1648 | 'cff_interested_text' => 'interested', |
| 1649 | 'cff_going_text' => 'going', |
| 1650 | 'cff_load_more_text' => 'Load more', |
| 1651 | 'cff_no_more_posts_text' => 'No more posts', |
| 1652 | 'cff_translate_view_previous_comments_text' => 'View more comments', |
| 1653 | 'cff_translate_comment_on_facebook_text' => 'Comment on Facebook', |
| 1654 | 'cff_translate_photos_text' => 'photos', |
| 1655 | 'cff_translate_photo_text' => 'Photo', |
| 1656 | 'cff_translate_video_text' => 'Video', |
| 1657 | 'cff_translate_likes_this_text' => 'likes this', |
| 1658 | 'cff_translate_like_this_text' => 'like this', |
| 1659 | 'cff_translate_reacted_text' => 'reacted to this', |
| 1660 | 'cff_translate_and_text' => 'and', |
| 1661 | 'cff_translate_other_text' => 'other', |
| 1662 | 'cff_translate_others_text' => 'others', |
| 1663 | 'cff_translate_reply_text' => 'Reply', |
| 1664 | 'cff_translate_replies_text' => 'Replies', |
| 1665 | 'cff_translate_learn_more_text' => 'Learn More', |
| 1666 | 'cff_translate_shop_now_text' => 'Shop Now', |
| 1667 | 'cff_translate_message_page_text' => 'Message Page', |
| 1668 | 'cff_translate_get_directions_text' => 'Get Directions', |
| 1669 | 'cff_translate_second' => 'second', |
| 1670 | 'cff_translate_seconds' => 'seconds', |
| 1671 | 'cff_translate_minute' => 'minute', |
| 1672 | 'cff_translate_minutes' => 'minutes', |
| 1673 | 'cff_translate_hour' => 'hour', |
| 1674 | 'cff_translate_hours' => 'hours', |
| 1675 | 'cff_translate_day' => 'day', |
| 1676 | 'cff_translate_days' => 'days', |
| 1677 | 'cff_translate_week' => 'week', |
| 1678 | 'cff_translate_weeks' => 'weeks', |
| 1679 | 'cff_translate_month' => 'month', |
| 1680 | 'cff_translate_months' => 'months', |
| 1681 | 'cff_translate_year' => 'year', |
| 1682 | 'cff_translate_years' => 'years', |
| 1683 | 'cff_translate_ago' => 'ago', |
| 1684 | 'cff_show_credit' => false, |
| 1685 | 'cff_format_issue' => false, |
| 1686 | 'cff_disable_resize' => false, |
| 1687 | 'disable_admin_notice' => false, |
| 1688 | 'enable_email_report' => 'on', |
| 1689 | 'email_notification' => 'monday', |
| 1690 | 'email_notification_addresses' => get_option('admin_email') |
| 1691 | ); |
| 1692 | } |
| 1693 | |
| 1694 | /** |
| 1695 | * Get GDPR Automatic state information |
| 1696 | * |
| 1697 | * @since 4.0 |
| 1698 | * |
| 1699 | * @return string $output |
| 1700 | */ |
| 1701 | public function get_gdpr_auto_info() |
| 1702 | { |
| 1703 | $gdpr_doc_url = 'https://smashballoon.com/doc/custom-facebook-feed-gdpr-compliance/?facebook&utm_campaign=facebook-free&utm_source=settings&utm_medium=docs'; |
| 1704 | $output = ''; |
| 1705 | $active_gdpr_plugin = CFF_GDPR_Integrations::gdpr_plugins_active(); |
| 1706 | if ($active_gdpr_plugin) { |
| 1707 | $output = $active_gdpr_plugin; |
| 1708 | } else { |
| 1709 | $output = __('No GDPR consent plugin detected. Install a compatible <a href="' . $gdpr_doc_url . '" target="_blank">GDPR consent plugin</a>, or manually enable the setting to display a GDPR compliant version of the feed to all visitors.', 'custom-facebook-feed'); |
| 1710 | } |
| 1711 | return $output; |
| 1712 | } |
| 1713 | |
| 1714 | /** |
| 1715 | * CFF Get cron next check time |
| 1716 | * |
| 1717 | * @since 4.0 |
| 1718 | * |
| 1719 | * @return string $output |
| 1720 | */ |
| 1721 | public function get_cron_next_check() |
| 1722 | { |
| 1723 | $output = ''; |
| 1724 | |
| 1725 | if (wp_next_scheduled('cff_cache_cron')) { |
| 1726 | // Get the timezone |
| 1727 | $cff_orig_timezone = date_default_timezone_get(); |
| 1728 | $options = get_option('cff_style_settings'); |
| 1729 | if (isset($options[ 'cff_timezone' ])) { |
| 1730 | date_default_timezone_set($options[ 'cff_timezone' ]); |
| 1731 | } |
| 1732 | |
| 1733 | $schedule = wp_get_schedule('cff_cache_cron'); |
| 1734 | if ($schedule == '30mins') { |
| 1735 | $schedule = 'every 30 minutes'; |
| 1736 | } |
| 1737 | if ($schedule == 'twicedaily') { |
| 1738 | $schedule = 'every 12 hours'; |
| 1739 | } |
| 1740 | $cff_next_cron_event = wp_next_scheduled('cff_cache_cron'); |
| 1741 | $output = '<b>Next check: ' . date('g:i a', $cff_next_cron_event) . ' (' . $schedule . ')</b> - Note: Clicking "Clear All Caches" will reset this schedule.'; |
| 1742 | |
| 1743 | // Reset the timezone |
| 1744 | date_default_timezone_set($cff_orig_timezone); |
| 1745 | } else { |
| 1746 | $output = 'Nothing currently scheduled'; |
| 1747 | } |
| 1748 | |
| 1749 | return $output; |
| 1750 | } |
| 1751 | |
| 1752 | /** |
| 1753 | * Settings Page View Template |
| 1754 | * |
| 1755 | * @since 4.0 |
| 1756 | */ |
| 1757 | public function global_settings() |
| 1758 | { |
| 1759 | CFF_View::render('settings.index'); |
| 1760 | } |
| 1761 | |
| 1762 | /** |
| 1763 | * CFF Clear Everything |
| 1764 | * |
| 1765 | * @since 4.1 |
| 1766 | */ |
| 1767 | public function cff_dpa_reset() |
| 1768 | { |
| 1769 | // Security Checks |
| 1770 | check_ajax_referer('cff_admin_nonce', 'nonce'); |
| 1771 | |
| 1772 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 1773 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 1774 | if (! current_user_can($cap)) { |
| 1775 | wp_send_json_error(); // This auto-dies. |
| 1776 | } |
| 1777 | |
| 1778 | cff_delete_all_platform_data(); |
| 1779 | $response = new CFF_Response(true, []); |
| 1780 | $response->send(); |
| 1781 | } |
| 1782 | } |
| 1783 |