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