*/ function plapperbot_plans() { // Before a chatbot is connected, show fixed plan data (as of the plugin release) without contacting plapperbot.de $s = plapperbot_bot() ? plapperbot_remote_plans() : null; $l = isset($s['limits']) && is_array($s['limits']) ? $s['limits'] : array(); $get = function ($plan, $field, $fallback) use ($l) { return isset($l[$plan][$field]) ? (int) $l[$plan][$field] : $fallback; }; $per_month = __('/ month', 'plapperbot'); return array( 'free' => array( 'name' => __('Free', 'plapperbot'), 'price' => '0 €', 'features' => array( /* translators: %s: number of messages */ sprintf(__('%s messages per month', 'plapperbot'), plapperbot_num($get('free', 'messages', 20))), /* translators: %s: number of pages */ sprintf(__('1 website (up to %s pages) or 1 PDF', 'plapperbot'), plapperbot_num($get('free', 'pages', 3))), __('Chat bubble, link and QR code', 'plapperbot'), ), ), 'plus' => array( 'name' => 'Plus', 'price' => (isset($s['priceLabel']) ? sanitize_text_field($s['priceLabel']) : '6,99 €') . ' ' . $per_month, 'features' => array( /* translators: %s: number of messages */ sprintf(__('%s messages per month', 'plapperbot'), plapperbot_num($get('active', 'messages', 500))), /* translators: 1: number of websites, 2: pages per website, 3: number of PDFs */ sprintf(__('%1$s websites with %2$s pages each, %3$s PDFs', 'plapperbot'), plapperbot_num($get('active', 'websites', 5)), plapperbot_num($get('active', 'pages', 20)), plapperbot_num($get('active', 'pdfs', 5))), __('Collect leads, booking link, statistics', 'plapperbot'), ), ), 'pro' => array( 'name' => 'Pro', 'price' => (isset($s['priceLabelPro']) ? sanitize_text_field($s['priceLabelPro']) : '28,99 €') . ' ' . $per_month, 'features' => array( /* translators: %s: number of messages */ sprintf(__('%s messages per month', 'plapperbot'), plapperbot_num($get('pro', 'messages', 2000))), /* translators: 1: number of PDFs, 2: number of shop products */ sprintf(__('%1$s PDFs and %2$s shop products', 'plapperbot'), plapperbot_num($get('pro', 'pdfs', 20)), plapperbot_num($get('pro', 'products', 500))), __('Automatically re-read every night', 'plapperbot'), ), ), ); } function plapperbot_settings_page() { if (!current_user_can('manage_options')) { return; } $link = (string) get_option(PLAPPERBOT_OPTION, ''); $key = (string) get_option(PLAPPERBOT_KEY_OPTION, ''); $bot = plapperbot_bot(); $remote = $bot ? plapperbot_remote_bot() : null; $found = is_array($remote) && isset($remote['_status']) && $remote['_status'] === 200; $stats = $key !== '' ? plapperbot_remote_stats() : null; $stats_ok = is_array($stats) && isset($stats['_status']) && $stats['_status'] === 200; $display = plapperbot_display(); $plan = $found ? plapperbot_plan_key($remote['plan'] ?? '', $remote['tier'] ?? '') : null; // Status line and warnings $warnings = array(); if ($bot && !$found) { $warnings[] = is_array($remote) && ($remote['_status'] ?? 0) === 404 ? __('This chatbot was not found. Please copy the current chat link from your plapperbot account (Embed).', 'plapperbot') : __('plapperbot could not be reached right now. The chat bubble keeps working; the status is checked again shortly.', 'plapperbot'); } if ($found && empty($remote['available'])) { $warnings[] = __('Your chatbot is currently not available to visitors (paused, still learning or blocked by the content check). The chat bubble is hidden until then.', 'plapperbot'); } if ($found && !empty($remote['passwordProtected'])) { $warnings[] = __('Password protection is on: visitors have to enter a password before chatting. You can switch it off in your plapperbot account under Embed → Password protection.', 'plapperbot'); } $slug_changed = $found && !empty($remote['slug']) && $remote['slug'] !== $bot['slug']; if ($key !== '' && is_array($stats) && !$stats_ok) { $warnings[] = __('The plugin key is not valid (anymore). Please copy the current key in your plapperbot account under Embed → WordPress.', 'plapperbot'); } $live = $found && !empty($remote['available']); ?>