From 78034d533a9e02601229c56c390a6298014a90fd Mon Sep 17 00:00:00 2001 From: d5admin Date: Mon, 16 Nov 2026 12:40:26 -0500 Subject: [PATCH] Updated the plugin URI and author information in the 404 Enhancer plugin file, and updated the version number from 0.3 to 0.4. Also added new entries to the .gitignore file to ignore .kilocode/, .env, .env.*, *.local, and .DS_Store files. --- 404-enhancer.php | 6 +- _cli_ajax.php | 26 ------- _cli_debug.php | 19 ----- _cli_render.php | 48 ------------- _cli_test.php | 113 ------------------------------ _smoke.php | 36 ---------- includes/class-fe-suggestions.php | 16 +++++ includes/class-fe-updater.php | 8 +-- 8 files changed, 23 insertions(+), 249 deletions(-) delete mode 100644 _cli_ajax.php delete mode 100644 _cli_debug.php delete mode 100644 _cli_render.php delete mode 100644 _cli_test.php delete mode 100644 _smoke.php diff --git a/404-enhancer.php b/404-enhancer.php index e299f93..d1e071e 100644 --- a/404-enhancer.php +++ b/404-enhancer.php @@ -1,12 +1,12 @@ 'administrator', 'number' => 1, 'fields' => 'ID' ) )[0]; -} -wp_set_current_user( $admin_id ); - -$_POST['s'] = 'hello'; -$_POST['nonce'] = wp_create_nonce( 'fe_admin_nonce' ); -$_REQUEST['nonce'] = $_POST['nonce']; -$_REQUEST['s'] = $_POST['s']; -$_REQUEST['action'] = 'fe_search_posts'; - -FE_Settings::ajax_search_posts(); // Echoes JSON and dies. diff --git a/_cli_debug.php b/_cli_debug.php deleted file mode 100644 index 987b571..0000000 --- a/_cli_debug.php +++ /dev/null @@ -1,19 +0,0 @@ -set_404(); -echo "is_404: " . var_export( is_404(), true ) . "\n"; -echo "plugin active: " . var_export( is_plugin_active( '404-enhancer/404-enhancer.php' ), true ) . "\n"; -echo "template_include filter result: " . apply_filters( 'template_include', 'x' ) . "\n"; -ob_start(); -include dirname( __DIR__ ) . '/templates/404.php'; -$html = ob_get_clean(); -echo "rendered len=" . strlen( $html ) . "\n"; -echo substr( $html, 0, 300 ) . "\n"; diff --git a/_cli_render.php b/_cli_render.php deleted file mode 100644 index 9bdfd97..0000000 --- a/_cli_render.php +++ /dev/null @@ -1,48 +0,0 @@ -set_404(); -status_header( 404 ); - -update_option( 'fe_custom_message', '

Sorry, we moved things around.

' ); -update_option( 'fe_enabled_post_types', array( 'post', 'page' ) ); -update_option( 'fe_suggestions_per_page', 3 ); - -ob_start(); -include __DIR__ . '/templates/404.php'; -$html = ob_get_clean(); - -$fail = 0; -function check( $label, $cond, $extra = '' ) { - global $fail; - if ( ! $cond ) { - $fail++; - } - printf( "%s %-52s %s\n", $cond ? 'PASS' : 'FAIL', $label, $extra ); -} - -check( 'renders without fatal', strlen( $html ) > 500, 'len=' . strlen( $html ) ); -check( 'has .fe-404 wrapper', false !== strpos( $html, 'class="fe-404"' ) ); -check( 'has heading', false !== strpos( $html, 'fe-404-heading' ) ); -check( 'shows requested path', false !== strpos( $html, '/this-page-does-not-exist-2024/' ) ); -check( 'shows custom message', false !== strpos( $html, 'Sorry, we moved things around.' ) ); -check( 'has search form', false !== strpos( $html, 'fe-search-form' ) && false !== strpos( $html, 'name="s"' ) ); -check( 'search prefilled from URL tokens', false !== strpos( $html, 'value="this does exist 2024"' ), '' ); -check( 'has did-you-mean or sections container', false !== strpos( $html, 'fe-did-you-mean' ) || false !== strpos( $html, 'fe-section' ) ); -check( 'stylesheet enqueued on 404', wp_style_is( 'fe-404', 'enqueued' ), '' ); -check( 'no PHP warnings in output', false === strpos( $html, 'Warning:' ) && false === strpos( $html, 'Fatal error' ) && false === strpos( $html, 'Notice:' ) ); - -echo $fail ? "\nRENDER RESULT: $fail FAILURES\n" : "\nRENDER RESULT: ALL PASS\n"; -exit( $fail ? 1 : 0 ); diff --git a/_cli_test.php b/_cli_test.php deleted file mode 100644 index 2802a79..0000000 --- a/_cli_test.php +++ /dev/null @@ -1,113 +0,0 @@ - 'administrator', 'number' => 1, 'fields' => 'ID' ) )[0]; -} -wp_set_current_user( $admin_id ); - -$fail = 0; -function check( $label, $cond, $extra = '' ) { - global $fail; - if ( ! $cond ) { - $fail++; - } - printf( "%s %-52s %s\n", $cond ? 'PASS' : 'FAIL', $label, $extra ); -} - -// 1. Activation. -$already = is_plugin_active( '404-enhancer/404-enhancer.php' ); -if ( ! $already ) { - $result = activate_plugin( '404-enhancer/404-enhancer.php' ); - check( 'activate_plugin no WP_Error', ! is_wp_error( $result ), is_wp_error( $result ) ? $result->get_error_message() : '' ); -} -check( 'plugin active', is_plugin_active( '404-enhancer/404-enhancer.php' ) ); -check( 'post types option exists', is_array( get_option( 'fe_enabled_post_types' ) ), json_encode( get_option( 'fe_enabled_post_types' ) ) ); -check( 'per page option exists', is_numeric( get_option( 'fe_suggestions_per_page' ) ) ); - -// 2. Classes loaded. -check( 'FE_Settings loaded', class_exists( 'FE_Settings' ) ); -check( 'FE_Suggestions loaded', class_exists( 'FE_Suggestions' ) ); -check( 'FE_Template loaded', class_exists( 'FE_Template' ) ); -check( 'FE_Updater loaded', class_exists( 'FE_Updater' ) ); - -// 3. Options round-trip with sanitizers. -update_option( 'fe_custom_message', '

Hello 404

' ); -check( 'message saved', get_option( 'fe_custom_message' ) !== false ); -check( 'per page sanitize via register', FE_Settings::sanitize_per_page( 99 ) === 24 ); -check( 'post types sanitize', FE_Settings::sanitize_post_types( array( 'post', 'evil