get_option_name('load-css-inline'), $v, false); if ($v && is_file($pluginManagerInstance->getCssFile())) { wp_delete_file($pluginManagerInstance->getCssFile()); } $pluginManagerInstance->handleCssFile(); header('Location: admin.php?page='.esc_attr($_page).'&tab=advanced'); exit; } if (isset($_GET['delete_css'])) { check_admin_referer('ti-delete-css'); if (is_file($pluginManagerInstance->getCssFile())) { wp_delete_file($pluginManagerInstance->getCssFile()); } $pluginManagerInstance->handleCssFile(); header('Location: admin.php?page='.esc_attr($_page).'&tab=advanced'); exit; } if (isset($_POST['save-notification-email'])) { check_admin_referer('ti-notification-email-save'); $type = isset($_POST['type']) ? sanitize_text_field(wp_unslash($_POST['type'])) : null; $type = strtolower(trim($type)); $email = isset($_POST['save-notification-email']) ? sanitize_text_field(wp_unslash($_POST['save-notification-email'])) : null; $email = strtolower(trim($email)); $pluginManagerInstance->setNotificationParam($type, 'email', $email); exit; } $yesIcon = ''; $noIcon = ''; $pluginUpdated = ($pluginManagerInstance->get_plugin_current_version() <= "13.2.7"); $cssInline = get_option($pluginManagerInstance->get_option_name('load-css-inline'), 0); $css = get_option($pluginManagerInstance->get_option_name('css-content')); $tiSuccess = ""; if (isset($_COOKIE['ti-success'])) { $tiSuccess = sanitize_text_field(wp_unslash($_COOKIE['ti-success'])); setcookie('ti-success', '', time() - 60, "/"); } $tiError = null; $tiCommand = isset($_POST['command']) ? sanitize_text_field(wp_unslash($_POST['command'])) : null; if (!in_array($tiCommand, [ 'connect', 'disconnect' ])) { $tiCommand = null; } if ($tiCommand === 'connect') { check_admin_referer('connect-reg_' . $pluginManagerInstance->get_plugin_slug()); $sanitizedEmail = isset($_POST['email']) ? sanitize_email(wp_unslash($_POST['email'])) : ""; $sanitizedPassword = isset($_POST['password']) ? sanitize_text_field(wp_unslash($_POST['password'])) : ""; if ($sanitizedEmail && $sanitizedPassword) { $serverOutput = $pluginManagerInstance->connect_trustindex_api([ 'signin' => [ 'username' => $sanitizedEmail, 'password' => html_entity_decode($sanitizedPassword), ], 'callback' => bin2hex(openssl_random_pseudo_bytes(10)) ], 'connect'); if ($serverOutput['success']) { setcookie('ti-success', 'connected', time() + 60, '/'); header('Location: #trustindex-admin'); exit; } else { $tiError = esc_html(__('Wrong e-mail or password!', 'wp-reviews-plugin-for-google')); } } else { $tiError = esc_html(__('You must provide a password and a valid e-mail!', 'wp-reviews-plugin-for-google')); } } else if ($tiCommand === 'disconnect') { check_admin_referer('disconnect-reg_' . $pluginManagerInstance->get_plugin_slug()); delete_option($pluginManagerInstance->get_option_name('subscription-id')); setcookie('ti-success', 'disconnected', time() + 60, '/'); header('Location: #trustindex-admin'); exit; } $trustindexSubscriptionId = $pluginManagerInstance->is_trustindex_connected(); $widgetNumber = $pluginManagerInstance->get_trustindex_widget_number(); ?>