/** * Handling the request to create a new redirect from the issued URL */ public function ajax_create_redirect() { if ($this->valid_nonce() && class_exists('YMBESEO_URL_Redirect_Manager') && defined('YMBESEO_PREMIUM_PATH')) { $redirect_manager = new YMBESEO_URL_Redirect_Manager(); $old_url = filter_input(INPUT_POST, 'old_url'); // Creates the redirect. if ($redirect_manager->create_redirect($old_url, filter_input(INPUT_POST, 'new_url'), filter_input(INPUT_POST, 'type'))) { if (filter_input(INPUT_POST, 'mark_as_fixed') === 'true') { new YMBESEO_GSC_Marker($old_url); } wp_die('true'); } } wp_die('false'); }
/** * Determine which model box type should be rendered * * @param string $url * @param string $current_redirect * * @return string */ private function modal_box_type($url, &$current_redirect) { if (defined('YMBESEO_PREMIUM_FILE') && class_exists('YMBESEO_URL_Redirect_Manager')) { static $redirect_manager; if (!$redirect_manager) { $redirect_manager = new YMBESEO_URL_Redirect_Manager(); } if ($current_redirect = $redirect_manager->search_url($url)) { return 'already_exists'; } return 'create'; } return 'no_premium'; }