";
}
/** Do an action like trash/delete/ignore/edit and display a page like stats/logs/redirects/options.
* @return void
*/
static function handleMainAdminPageActionAndDisplay() {
global $abj404view;
$instance = self::getInstance();
try {
$action = $instance->dao->getPostOrGetSanitize('action');
if (!is_admin() || !$instance->logic->userIsPluginAdmin()) {
$instance->logger->logUserCapabilities("handleMainAdminPageActionAndDisplay (" .
esc_html($action == '' ? '(none)' : $action) . ")");
echo '
';
echo '
' . esc_html(PLUGIN_NAME) . '
';
echo '
';
echo '' . esc_html__('Permission denied.', '404-solution') . ' ';
echo esc_html__('Your user account does not have permission to access this page.', '404-solution');
echo '
';
echo esc_html__('Please verify that your WordPress role has the', '404-solution') . ' ';
echo 'manage_options ' . esc_html__('capability.', '404-solution') . ' ';
echo esc_html__('If you have a security plugin installed, it may be restricting access to this page.', '404-solution');
echo '
';
return;
}
$sub = "";
// --------------------------------------------------------------------
// Handle Post Actions
$instance->logger->debugMessage("Processing request for action: " .
esc_html($action == '' ? '(none)' : $action));
// this should really not pass things by reference so it can be more object oriented (encapsulation etc).
$message = "";
$message .= $instance->logic->handlePluginAction($action, $sub);
$message .= $instance->logic->hanldeTrashAction();
$message .= $instance->logic->handleDeleteAction();
$message .= $instance->logic->handleIgnoreAction();
$message .= $instance->logic->handleLaterAction();
$message .= $instance->logic->handleActionEdit($sub, $action);
$message .= $instance->logic->handleActionImportRedirects();
$instance->logic->handleActionChangeItemsPerRow();
$message .= $instance->logic->handleActionImportFile();
// --------------------------------------------------------------------
// Output the correct page.
$abj404view->echoChosenAdminTab($action, $sub, $message);
} catch (\Throwable $e) {
$encodedEx = json_encode($e);
$instance->logger->errorMessage("Caught exception: " . stripcslashes(wp_kses_post(is_string($encodedEx) ? $encodedEx : '')));
echo '
';
echo '
';
echo '
404 Solution: An error occurred while rendering this page.
';
echo '' . esc_html__("You're all set!", '404-solution') . ' ';
if ($auto && $notify) {
echo esc_html__('404 Solution is now monitoring your site. When visitors hit broken links, they will be automatically redirected. We will email you if something needs attention.', '404-solution');
} elseif ($auto) {
echo esc_html__('404 Solution is now monitoring your site. When visitors hit broken links, they will be automatically redirected.', '404-solution');
} elseif ($notify) {
echo esc_html__('404 Solution is now monitoring your site. We will email you if captured 404 URLs need attention.', '404-solution');
} else {
echo esc_html__('404 Solution is now monitoring your site. You can create manual redirects anytime from the Page Redirects tab.', '404-solution');
}
echo '
\n";
}
$isSimpleMode = $this->logic->getSettingsMode() === 'simple';
echo '';
}
/** This outputs a box with a title and some content in it.
* It's used on the Stats, Options and Tools page (for example).
* @param int|string $id
* @param string $title
* @param string $content
* @return void
*/
function echoPostBox($id, $title, $content) {
echo "
";
echo "
" . esc_html($title) . "
";
echo "
" . $content /* Can't escape here, as contains forms */ . "
";
echo "
";
}
/**
* Echo an accordion section using card-based layout
* @param string $sectionId The section identifier
* @param string $postboxId The ID for the postbox
* @param string $title The title of the section
* @param string $content The content to display
* @param bool $initiallyVisible Whether the card starts expanded (default: false)
* @param string $icon The SVG icon for the card header (optional)
* @param string $badge Optional info badge text
* @return void
*/
function echoOptionsSection($sectionId, $postboxId, $title, $content, $initiallyVisible = false, $icon = '', $badge = '') {
$expandedClass = $initiallyVisible ? ' expanded' : '';
echo "
";
echo "
";
echo "
";
if ($icon) {
echo $icon; // Icon is pre-sanitized SVG
}
echo esc_html($title);
if ($badge) {
echo "" . esc_html($badge) . "";
}
echo "
";
echo "";
echo "
";
echo "
";
echo $content; /* Can't escape here, as contains forms */
echo "
";
echo "
";
}
/**
* Get SVG icon for a section
* @param string $iconName The icon name
* @return string The SVG icon markup
*/
function getCardIcon($iconName) {
$icons = array(
'lightning' => '',
'gear' => '',
'filter' => '',
'document' => '',
'sliders' => '',
'lightbulb' => '',
// Stats page icons
'chart' => '',
'warning' => '',
'clock' => '',
// Tools page icons
'download' => '',
'upload' => '',
'trash' => '',
'database' => '',
'cog' => ''
);
return isset($icons[$iconName]) ? $icons[$iconName] : '';
}
/**
* Echo the sticky save bar
* @return void
*/
function echoStickySaveBar() {
$version = ABJ404_VERSION;
echo '
';
echo '
';
/* translators: %s: plugin version number */
echo esc_html(sprintf(__('Plugin v%s', '404-solution'), $version));
echo '
';
echo '
';
echo '';
echo '
';
echo '
';
}
/**
* Echo the success toast notification container
* @return void
*/
function echoToastNotification() {
echo '
';
}
/**
* Echo the expand/collapse all button and save button
* @param bool $showSuggestions Not used (kept for compatibility)
* @return void
*/
function echoExpandCollapseButton($showSuggestions = true) {
?>