assets
3 weeks ago
builder
3 weeks ago
templates
4 months ago
views
3 weeks ago
addon-functions.php
4 months ago
admin-functions.php
4 months ago
enqueu-script.php
4 months ago
index.php
4 months ago
enqueu-script.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | use CustomFacebookFeed\Builder\CFF_Feed_Builder; |
| 4 | |
| 5 | if (! defined('ABSPATH')) { |
| 6 | exit; // Exit if accessed directly |
| 7 | } |
| 8 | |
| 9 | require_once trailingslashit(CFF_PLUGIN_DIR) . 'admin/addon-functions.php'; |
| 10 | |
| 11 | require_once trailingslashit(CFF_PLUGIN_DIR) . 'inc/Helpers/PluginSilentUpgrader.php'; |
| 12 | require_once trailingslashit(CFF_PLUGIN_DIR) . 'inc/Helpers/PluginSilentUpgraderSkin.php'; |
| 13 | require_once trailingslashit(CFF_PLUGIN_DIR) . 'inc/Admin/CFF_Install_Skin.php'; |
| 14 | |
| 15 | |
| 16 | function cff_ppca_token_check_flag() |
| 17 | { |
| 18 | check_ajax_referer('cff_nonce', 'cff_nonce'); |
| 19 | |
| 20 | $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 21 | $cap = apply_filters('cff_settings_pages_capability', $cap); |
| 22 | if (! current_user_can($cap)) { |
| 23 | wp_send_json_error(); // This auto-dies. |
| 24 | } |
| 25 | |
| 26 | if (get_transient('cff_ppca_access_token_invalid')) { |
| 27 | print_r(true); |
| 28 | } else { |
| 29 | print_r(false); |
| 30 | } |
| 31 | |
| 32 | die(); |
| 33 | } |
| 34 | add_action('wp_ajax_cff_ppca_token_check_flag', 'cff_ppca_token_check_flag'); |
| 35 | |
| 36 | add_action('admin_enqueue_scripts', 'enqueue_admin_scripts_assets'); |
| 37 | function enqueue_admin_scripts_assets() |
| 38 | { |
| 39 | wp_register_style( |
| 40 | 'custom_wp_admin_css', |
| 41 | CFF_PLUGIN_URL . 'admin/assets/css/cff-admin-style.css', |
| 42 | false, |
| 43 | CFFVER |
| 44 | ); |
| 45 | wp_enqueue_style('custom_wp_admin_css'); |
| 46 | wp_enqueue_style( |
| 47 | 'cff-font-awesome', |
| 48 | 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', |
| 49 | array(), |
| 50 | '4.5.0' |
| 51 | ); |
| 52 | |
| 53 | wp_enqueue_script( |
| 54 | 'cff_admin_script', |
| 55 | CFF_PLUGIN_URL . 'admin/assets/js/cff-admin-scripts.js', |
| 56 | false, |
| 57 | CFFVER |
| 58 | ); |
| 59 | |
| 60 | wp_localize_script('cff_admin_script', 'cffA', array( |
| 61 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 62 | 'cff_nonce' => wp_create_nonce('cff_nonce') |
| 63 | )); |
| 64 | $strings = array( |
| 65 | 'addon_activate' => esc_html__('Activate', 'custom-facebook-feed'), |
| 66 | 'addon_activated' => esc_html__('Activated', 'custom-facebook-feed'), |
| 67 | 'addon_active' => esc_html__('Active', 'custom-facebook-feed'), |
| 68 | 'addon_deactivate' => esc_html__('Deactivate', 'custom-facebook-feed'), |
| 69 | 'addon_inactive' => esc_html__('Inactive', 'custom-facebook-feed'), |
| 70 | 'addon_install' => esc_html__('Install Addon', 'custom-facebook-feed'), |
| 71 | 'addon_error' => esc_html__('Could not install addon. Please download from smashballoon.com and install manually.', 'custom-facebook-feed'), |
| 72 | 'plugin_error' => esc_html__('Could not install a plugin. Please download from WordPress.org and install manually.', 'custom-facebook-feed'), |
| 73 | 'addon_search' => esc_html__('Searching Addons', 'custom-facebook-feed'), |
| 74 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 75 | 'cancel' => esc_html__('Cancel', 'custom-facebook-feed'), |
| 76 | 'close' => esc_html__('Close', 'custom-facebook-feed'), |
| 77 | 'nonce' => wp_create_nonce('cff-admin'), |
| 78 | 'almost_done' => esc_html__('Almost Done', 'custom-facebook-feed'), |
| 79 | 'oops' => esc_html__('Oops!', 'custom-facebook-feed'), |
| 80 | 'ok' => esc_html__('OK', 'custom-facebook-feed'), |
| 81 | 'plugin_install_activate_btn' => esc_html__('Install and Activate', 'custom-facebook-feed'), |
| 82 | 'plugin_install_activate_confirm' => esc_html__('needs to be installed and activated to import its forms. Would you like us to install and activate it for you?', 'custom-facebook-feed'), |
| 83 | 'plugin_activate_btn' => esc_html__('Activate', 'custom-facebook-feed'), |
| 84 | 'oembed_connectionURL' => cffGetOembedConnectionUrl(), |
| 85 | 'smashPlugins' => CFF_Feed_Builder::get_smashballoon_plugins_info() |
| 86 | ); |
| 87 | $strings = apply_filters('cff_admin_strings', $strings); |
| 88 | wp_localize_script( |
| 89 | 'cff_admin_script', |
| 90 | 'cff_admin', |
| 91 | $strings |
| 92 | ); |
| 93 | } |
| 94 |