Not authenticated. Please go to the Wordpress's admin panel → {$boostfab_name} Panel to authenticate."; } $query_str = http_build_query($query); return " "; } function boostfab_register_admin_menu_item() { global $boostfab_name; $badge = ""; $api_token = get_option("boostfab_api_token", ''); if (!is_signedin_or_trying()) { $badge = '!'; } add_menu_page("{$boostfab_name} Panel", "{$boostfab_name} Panel {$badge}", "manage_options", "boostfab-panel", "boostfab_print_admin_panel", "dashicons-cart"); } function is_signedin_or_trying() { return $api_token = get_option("boostfab_api_token", '') != '' || !empty($_POST["api_token"]); } function boostfab_print_admin_panel() { global $boostfab_api_url_from_backend; $api_token = get_option("boostfab_api_token", ''); $can_signin = current_user_can('edit_posts') || current_user_can('edit_pages'); if (isset($_POST["api_token"]) && $can_signin) { check_admin_referer('signin'); $api_token_input = sanitize_text_field($_POST["api_token"]); if (preg_match('/^[a-zA-Z0-9-_\.]+$/', $api_token_input)) { update_option("boostfab_api_token", $api_token_input); $api_token = $api_token_input; $response = wp_remote_get($boostfab_api_url_from_backend . "/organizations", [ 'headers' => [ 'Authorization' => "Bearer {$api_token}" ] ]); if (is_wp_error($response)) { $error_message = $response->get_error_message(); echo esc_html("Something went wrong: " . $error_message); } else { $json = json_decode($response['body']); $organizations = $json->items; if (count($organizations) > 0) { $organization = $organizations[0]; update_option("boostfab_organization_slug", $organization->slug); } } } else { echo esc_html("The API token does not seem to be valid: " . $api_token_input); } } $signedIn = $api_token !== ''; if ($signedIn) { boostfab_print_admin_panel_authenticated(); } else { boostfab_print_admin_panel_unauthenticated(); } ?>
[%2s] to embed %3s in your pages or posts."), esc_html($boostfab_name), esc_html(BOOSTFAB_SHORTCODE), esc_html($boostfab_name), get_admin_url(null, 'edit.php?post_type=page'), get_admin_url(null, 'edit.php') ), 'post' ) ?>
send us a message. We will answer you as soon as possible."), "https://tawk.to/quotify" ), 'post' ) ?>