';
if ( defined( 'WPSEO_VERSION' ) && method_exists( 'WPSEO_Options', 'get' ) && WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
// as of version 11.1.1 we not only check inf Yoast SEO is active but also if Yoast SEO sitemap feature is activated
echo '
';
if ( $this->settings()->get( 'fire_error' ) ) {
echo esc_html__( 'Yoast SEO sitemap detected. Your 404 page is automatically excluded from the XML sitemap created by Yoast.', '404page' );
} else {
echo esc_html__( 'Yoast SEO sitemap detected. Your 404 page is NOT automatically excluded from the XML sitemap created by Yoast, because you disabled the option "Send an 404 error if the page is accessed directly by its URL" on the "Advanced" tab.', '404page' );
}
echo '
';
}
if ( defined( 'JETPACK__VERSION' ) && method_exists( 'Jetpack', 'is_module_active' ) && Jetpack::is_module_active( 'sitemaps' ) ) {
// Jetpack since version 11.1.2
echo '
';
if ( $this->settings()->get( 'fire_error' ) ) {
echo esc_html__( 'Jetpack sitemap detected. Your 404 page is automatically excluded from the XML sitemap created by Jetpack.', '404page' );
} else {
echo esc_html__( 'Jetpack sitemap detected. Your 404 page is NOT automatically excluded from the XML sitemap created by Jetpack, because you disabled the option "Send an 404 error if the page is accessed directly by its URL" on the "Advanced" tab.', '404page' );
}
echo '
';
}
// WP Super Cache
// since 11.2.0
if ( defined('WPCACHEHOME') ) {
global $cache_enabled;
// is caching active?
if ( $cache_enabled ) {
echo '
';
echo esc_html__( 'WP Super Cache detected. All 404 errors are automatically excluded from caching.', '404page' );
echo '
';
}
}
// W3 Total Cache
// since 11.2.1
if ( defined( 'W3TC' ) ) {
if ( class_exists( 'W3TC\Dispatcher' ) ) {
// is caching active?
if ( W3TC\Dispatcher::config()->get_boolean( 'pgcache.enabled' ) ) {
echo '
';
echo esc_html__( 'W3 Total Cache detected. All 404 errors are automatically excluded from caching.', '404page' );
echo '
';
}
}
}
}
/**
* handle the settings field hide
* moved to PP_404Page_Admin in v 10
*/
function admin_hide() {
$this->print_slider_check(
'hide',
esc_html__( 'Hide the selected page from the Pages list', '404page' ),
false,
false,
' ' . esc_html__( 'For Administrators the page is always visible.', '404page' )
);
}
/**
* handle the settings field fire 404 error
* moved to PP_404Page_Admin in v 10
*/
function admin_fire404() {
$this->print_slider_check(
'fire_error',
esc_html__( 'Send an 404 error if the page is accessed directly by its URL', '404page' ),
false,
false,
' ' . esc_html__( 'Uncheck this if you want the selected page to be accessible.', '404page' )
);
}
/**
* handle the settings field to force an 404 error
* moved to PP_404Page_Admin in v 10
*/
function admin_force404() {
$this->print_slider_check(
'force_error',
esc_html__( 'Force 404 error after loading page', '404page' ),
false,
'09OOCbFLfnI',
' ' . esc_html__( 'Generally this is not needed. It is not recommended to activate this option, unless it is necessary. Please note that this may cause problems with your theme.', '404page' )
);
}
/**
* handle the settings field to stop URL guessing
* moved to PP_404Page_Admin in v 10
*/
function admin_noguess() {
$this->print_slider_check(
'no_url_guessing',
esc_html__( 'Disable URL autocorrection guessing', '404page' ),
false,
'H0EdtFcAGl4',
' ' . esc_html__( 'This stops WordPress from URL autocorrection guessing. Only activate, if you are sure about the consequences.', '404page' )
);
}
/**
* handle the settings field to send an http 410 error in case the object is trashed
* @since 3.2
* moved to PP_404Page_Admin in v 10
*/
function admin_http410() {
$this->print_slider_check(
'http410_if_trashed',
esc_html__( 'Send an HTTP 410 error instead of HTTP 404 in case the requested object is in trash', '404page' ),
false,
'O5xPM0BMZxM',
' ' . esc_html__( 'Check this if you want to inform search engines that the resource requested is no longer available and will not be available again so it can be removed from the search index immediately.', '404page' ),
$this->settings()->get( 'http410_always' )
);
}
/**
* handle the settings field to always send an http 410 error
* @since 11.3.0
*/
function admin_http410_always() {
$this->print_slider_check(
'http410_always',
esc_html__( 'Always send an HTTP 410 error instead of HTTP 404', '404page' ),
false,
false,
' ' . esc_html__( 'Check this if you always want to send an HTTP 410 error instead of an HTTP 404 error.', '404page' )
);
}
/**
* handle the settings field method
* moved to PP_404Page_Admin in v 10
*/
function admin_method() {
// unfortunately we can't use print_slider_check() here
if ( $this->core()->is_native() || defined( 'CUSTOMIZR_VER' ) || defined( 'ICL_SITEPRESS_VERSION' ) ) {
$dis = ' disabled="disabled"';
} else {
$dis = '';
}
echo '
settings()->get( 'method' ), false ) . $dis . '/>';
echo '' . esc_html__( 'Activate Compatibility Mode', '404page' ) . ' ';
echo ' ';
if ( $this->core()->is_native() ) {
esc_html_e( 'This setting is not available because the Theme you are using natively supports the 404page plugin.', '404page' );
} elseif ( defined( 'CUSTOMIZR_VER' ) ) {
esc_html_e( 'This setting is not availbe because the 404page Plugin works in Customizr Compatibility Mode.', '404page' );
} elseif ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
esc_html_e( 'This setting is not availbe because the 404page Plugin works in WPML Mode.', '404page' );
} else {
esc_html_e( 'If you are using a theme or plugin that modifies the WordPress Template System, the 404page plugin may not work properly. Compatibility Mode maybe can fix the problem. Activate Compatibility Mode only if you have any problems.', '404page' );
}
echo '
';
}
/**
* create the menu entry
* moved to PP_404Page_Admin in v 10
*/
function action_admin_menu() {
$screen_id = add_theme_page ( esc_html__( '404 Error Page', "404page" ), esc_html__( '404 Error Page', '404page' ), 'manage_options', '404pagesettings', array( $this, 'show_admin' ) );
$this->set_screen_id( $screen_id );
}
/**
* add admin css to header
* moved to PP_404Page_Admin in v 10
*/
function action_admin_head() {
if ( $this->settings()->get( 'page_id' ) > 0 ) {
echo '';
}
}
/**
* add admin css file
* moved to PP_404Page_Admin in v 10
*/
function admin_css() {
if ( get_current_screen()->id == $this->get_screen_id() ) {
wp_enqueue_style( '404pagelity', $this->core()->get_asset_url( 'css', 'lity.min.css' ) );
wp_enqueue_style( '404pagecss', $this->core()->get_asset_url( 'css', '404page-ui.css' ) );
do_action( '404page_enqueue_css' );
}
}
/**
* add admin js files
* moved to PP_404Page_Admin in v 10
*/
function admin_js() {
if ( get_current_screen()->id == $this->get_screen_id() ) {
wp_enqueue_script( '404page-ui', $this->core()->get_asset_url( 'js', '404page-ui.js' ), 'jquery', $this->core()->get_plugin_version(), true );
wp_enqueue_script( '404page-lity', $this->core()->get_asset_url( 'js', 'lity.min.js' ), 'jquery', $this->core()->get_plugin_version(), true );
do_action( '404page_enqueue_js' );
}
}
/**
* show admin page
* moved to PP_404Page_Admin in v 10
*/
function show_admin() {
$this->show( 'manage_options' );
}
/**
* create nonce
*
* @since 10.4
* @access private
* @return string Nonce
*/
private function get_nonce() {
return wp_create_nonce( 'pp_404page_dismiss_admin_notice' );
}
/**
* check nonce
*
* @since 10.4
* @access private
* @return boolean
*/
private function check_nonce() {
return check_ajax_referer( 'pp_404page_dismiss_admin_notice', 'securekey', false );
}
}
}