Changeset 3846572
- Timestamp:
- 12/05/2026 04:56:48 PM (4 hours ago)
- Location:
- secherit-site-health-monitor/trunk
- Files:
-
- 2 added
- 8 edited
-
assets/admin.css (modified) (1 diff)
-
assets/admin.js (modified) (1 diff)
-
assets/settings.js (added)
-
includes/admin-view.php (modified) (3 diffs)
-
includes/class-sitepilot-growth.php (modified) (2 diffs)
-
includes/class-sitepilot-onboarding.php (added)
-
includes/class-sitepilot.php (modified) (14 diffs)
-
readme.txt (modified) (8 diffs)
-
secherit-site-health-monitor.php (modified) (3 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
secherit-site-health-monitor/trunk/assets/admin.css
r3845057 r3846572 204 204 .sp-trialbar__close{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;color:#8c8f94;font-size:20px;line-height:1;text-decoration:none} 205 205 .sp-trialbar__close:hover,.sp-trialbar__close:focus{background:#f0f0f1;color:#1d2327} 206 207 .sp-pages-setup__explain{margin:0 25px 18px;padding:14px 16px;border:1px solid #e6ecf5;border-radius:10px;background:#f8fafd;color:#3e506a;font-size:12px;line-height:1.6} 208 .sp-pages-setup__explain p{margin:0 0 6px}.sp-pages-setup__explain p:last-child{margin:8px 0 0} 209 .sp-pages-setup__explain ul{margin:0 0 0 18px;list-style:disc}.sp-pages-setup__explain li{margin:2px 0} 210 .sp-pages-setup__suggest{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 25px 16px;font-size:12px;color:#3e506a} 211 .sp-chip{border:1px solid #c5d9ed;background:#fff;color:#2271b1;border-radius:999px;padding:5px 12px;font-size:12px;font-weight:600;cursor:pointer} 212 .sp-chip:hover,.sp-chip:focus{background:#f0f6fc;border-color:#2271b1} 213 .sp-chip[disabled]{opacity:.5;cursor:default} -
secherit-site-health-monitor/trunk/assets/admin.js
r3805959 r3846572 47 47 }); 48 48 })(); 49 -
secherit-site-health-monitor/trunk/includes/admin-view.php
r3843620 r3846572 113 113 <?php do_action( 'sitepilot_dashboard_notices', $tab ); ?> 114 114 <?php if ( isset( $_GET['notice'] ) ) : $notice = sanitize_key( wp_unslash( $_GET['notice'] ) ); ?> 115 <div class="sp-alert" role="status"><?php echo esc_html( array( 'saved' => 'Settings saved successfully.', 'repaired' => 'Selected safe repair completed.')[ $notice ] ?? 'Action completed.' ); ?></div>115 <div class="sp-alert" role="status"><?php echo esc_html( array( 'saved' => __( 'Settings saved successfully.', 'secherit-site-health-monitor' ), 'repaired' => __( 'Selected safe repair completed.', 'secherit-site-health-monitor' ), 'update_check_done' => __( 'Checks finished. Your results after the update are below.', 'secherit-site-health-monitor' ), 'update_check_failed' => __( 'The checks could not finish. Try Run checks again in a moment.', 'secherit-site-health-monitor' ) )[ $notice ] ?? 'Action completed.' ); ?></div> 116 116 <?php endif; ?> 117 117 <div class="sp-toast" id="sp-toast" role="status" aria-live="polite" hidden></div> … … 200 200 <section class="sp-page-heading"><div><span class="sp-kicker"><?php esc_html_e( 'YOUR WORKSPACE', 'secherit-site-health-monitor' ); ?></span><h1><?php esc_html_e( 'Settings', 'secherit-site-health-monitor' ); ?></h1><p><?php esc_html_e( 'Configure your monitored pages.', 'secherit-site-health-monitor' ); ?></p></div></section> 201 201 <form class="sp-settings" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"><input type="hidden" name="action" value="sitepilot_settings"><?php wp_nonce_field( 'sitepilot_settings' ); ?> 202 <section class="sp-panel"><div class="sp-panel__head"><div><h3><?php esc_html_e( 'Priority website pages', 'secherit-site-health-monitor' ); ?></h3><p><?php esc_html_e( 'One full URL or site-relative path per line, on your own domain only', 'secherit-site-health-monitor' ); ?></p></div></div><label for="sp-watch"><?php esc_html_e( 'Pages to monitor', 'secherit-site-health-monitor' ); ?></label><textarea id="sp-watch" name="watch_urls" rows="5"><?php echo esc_textarea( implode( "\n", $s['watch_urls'] ) ); ?></textarea><small class="sp-help">Configure up to <?php echo esc_html( $sp->page_limit() ); ?> pages. Home is always supported.</small></section> 202 <section class="sp-panel sp-pages-setup"><div class="sp-panel__head"><div><h3><?php esc_html_e( 'Pages to check', 'secherit-site-health-monitor' ); ?></h3><p><?php esc_html_e( 'Choose the pages that would cost you visitors, customers or sales if they broke.', 'secherit-site-health-monitor' ); ?></p></div></div> 203 <div class="sp-pages-setup__explain"> 204 <p><strong><?php esc_html_e( 'What happens to these pages', 'secherit-site-health-monitor' ); ?></strong></p> 205 <ul> 206 <li><?php esc_html_e( 'Each check opens them like a visitor and makes sure they load.', 'secherit-site-health-monitor' ); ?></li> 207 <li><?php esc_html_e( 'Every link on them to the rest of your site is tested for errors.', 'secherit-site-health-monitor' ); ?></li> 208 <li><?php esc_html_e( 'Forms and buttons are looked for, so you notice when one disappears.', 'secherit-site-health-monitor' ); ?></li> 209 <li><?php esc_html_e( 'Google visibility, page title, meta description and insecure files are checked.', 'secherit-site-health-monitor' ); ?></li> 210 </ul> 211 <p><strong><?php esc_html_e( 'Good pages to add:', 'secherit-site-health-monitor' ); ?></strong> <?php esc_html_e( 'your home page, contact page, pricing or main product page, checkout, and the page most visitors land on.', 'secherit-site-health-monitor' ); ?></p> 212 </div> 213 <?php $sitepilot_suggestions = array_diff( $sp->suggested_pages(), (array) $s['watch_urls'] ); ?> 214 <?php if ( $sitepilot_suggestions ) : ?> 215 <div class="sp-pages-setup__suggest"><span><?php esc_html_e( 'Suggested from your site:', 'secherit-site-health-monitor' ); ?></span> 216 <?php foreach ( $sitepilot_suggestions as $sitepilot_label => $sitepilot_url ) : ?> 217 <button type="button" class="sp-chip" data-sp-add-url="<?php echo esc_attr( $sitepilot_url ); ?>" title="<?php echo esc_attr( $sitepilot_url ); ?>">+ <?php echo esc_html( $sitepilot_label ); ?></button> 218 <?php endforeach; ?> 219 </div> 220 <?php endif; ?> 221 <label for="sp-watch"><?php esc_html_e( 'Pages to check (one per line)', 'secherit-site-health-monitor' ); ?></label> 222 <textarea id="sp-watch" name="watch_urls" rows="5" data-sp-limit="<?php echo esc_attr( $sp->page_limit() ); ?>" placeholder="<?php echo esc_attr( home_url( '/' ) . "\n" . home_url( '/contact/' ) . "\n/pricing/" ); ?>"><?php echo esc_textarea( implode( "\n", $s['watch_urls'] ) ); ?></textarea> 223 <small class="sp-help"><?php 224 echo esc_html( sprintf( 225 /* translators: 1: maximum number of pages, 2: example address. */ 226 __( 'Up to %1$d pages on this website. Paste the full address (for example %2$s) or just the part after the domain (/contact/). Click a suggestion above to add it, then Save settings.', 'secherit-site-health-monitor' ), 227 $sp->page_limit(), 228 home_url( '/contact/' ) 229 ) ); 230 ?></small> 231 </section> 203 232 <section class="sp-panel"><div class="sp-panel__head"><div><h3><?php esc_html_e( 'Data on removal', 'secherit-site-health-monitor' ); ?></h3><p><?php esc_html_e( 'By default your history and settings are kept, so a reinstall starts where you left off.', 'secherit-site-health-monitor' ); ?></p></div></div><input type="hidden" name="sitepilot_uninstall_field" value="1"><label class="sp-toggle-row"><span><strong><?php esc_html_e( 'Delete all data when the plugin is deleted', 'secherit-site-health-monitor' ); ?></strong><small><?php esc_html_e( 'Removes check history, settings and scheduled tasks. Kept automatically while the Premium add-on is installed.', 'secherit-site-health-monitor' ); ?></small></span><input type="checkbox" name="sitepilot_delete_data" value="1" <?php checked( '1', get_option( 'sitepilot_delete_data_on_uninstall' ) ); ?>></label></section> 204 233 <div class="sp-form-footer"><button type="submit" class="sp-btn sp-btn--primary"><span class="dashicons dashicons-saved"></span> <?php esc_html_e( 'Save settings', 'secherit-site-health-monitor' ); ?></button></div></form> … … 214 243 <section class="sp-page-heading"><div><span class="sp-kicker"><?php esc_html_e( 'PLANS', 'secherit-site-health-monitor' ); ?></span><h1>Plans & license</h1><p><?php esc_html_e( 'Compare the plans and learn how to activate the separate Premium add-on.', 'secherit-site-health-monitor' ); ?></p></div></section> 215 244 <div class="sp-plan-options"> 216 <section class="sp-plan-option"><div class="sp-plan-option__labels"><span class="sp-tier sp-tier--free"><?php esc_html_e( 'Free', 'secherit-site-health-monitor' ); ?></span><span class="sp-current-plan"><?php esc_html_e( 'Current plan', 'secherit-site-health-monitor' ); ?></span></div><h2><?php esc_html_e( 'Site Health Monitor Free', 'secherit-site-health-monitor' ); ?></h2><p><?php esc_html_e( 'Run checks on demand. No account or license required.', 'secherit-site-health-monitor' ); ?></p><ul class="sp-plan-list"><li><?php esc_html_e( 'Monitor up to 3 selected pages', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Manual HTTP and internal link checks', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Detect rendered forms and buttons', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Check history and CSV export', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Website optimization audit', 'secherit-site-health-monitor' ); ?></li></ul></section>245 <section class="sp-plan-option"><div class="sp-plan-option__labels"><span class="sp-tier sp-tier--free"><?php esc_html_e( 'Free', 'secherit-site-health-monitor' ); ?></span><span class="sp-current-plan"><?php esc_html_e( 'Current plan', 'secherit-site-health-monitor' ); ?></span></div><h2><?php esc_html_e( 'Site Health Monitor Free', 'secherit-site-health-monitor' ); ?></h2><p><?php esc_html_e( 'Run checks on demand. No account or license required.', 'secherit-site-health-monitor' ); ?></p><ul class="sp-plan-list"><li><?php esc_html_e( 'Monitor up to 5 selected pages', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Manual HTTP and internal link checks', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Detect rendered forms and buttons', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Check history and CSV export', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Website optimization audit', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Google visibility, mixed content, SEO basics and redirect checks', 'secherit-site-health-monitor' ); ?></li></ul></section> 217 246 <section class="sp-plan-option sp-plan-option--pro"><div class="sp-plan-option__labels"><span class="sp-tier sp-tier--pro"><?php esc_html_e( 'Premium', 'secherit-site-health-monitor' ); ?></span></div><h2><?php esc_html_e( 'Site Health Monitor Premium', 'secherit-site-health-monitor' ); ?></h2><p><?php esc_html_e( 'All Free features plus automated monitoring and advanced tools.', 'secherit-site-health-monitor' ); ?></p><ul class="sp-plan-list"><li><?php esc_html_e( 'Scheduled monitoring for up to 20 pages', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Email alerts and weekly reports', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'PHP and JavaScript error monitoring', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Important element monitoring and after-update checks', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Internal link repair, preview and undo', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'SSL expiry, response time and broken image checks', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'WooCommerce payment-method availability checks', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Optional update file backups and recovery', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Visual comparisons with a configured browser worker', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'One-click Optimize for speed, database and security', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Action center', 'secherit-site-health-monitor' ); ?></li><li><?php esc_html_e( 'Smart Fix with supported repairs and opt-in schedule recovery', 'secherit-site-health-monitor' ); ?></li></ul><a class="sp-upgrade-button" href="<?php echo esc_url( $upgrade_url ); ?>"><?php esc_html_e( 'Learn about Premium', 'secherit-site-health-monitor' ); ?> <span aria-hidden="true">↗</span></a></section> 218 247 </div> -
secherit-site-health-monitor/trunk/includes/class-sitepilot-growth.php
r3845057 r3846572 42 42 if ( ! empty( $state['done'] ) || (int) ( $state['until'] ?? 0 ) > time() ) { return false; } 43 43 $first = (int) get_option( 'sitepilot_first_scan_at', 0 ); 44 return (int) get_option( 'sitepilot_scan_count', 0 ) >= 3 && $first && time() - $first >= 7* DAY_IN_SECONDS44 return (int) get_option( 'sitepilot_scan_count', 0 ) >= 2 && $first && time() - $first >= 3 * DAY_IN_SECONDS 45 45 && ! get_option( 'sitepilot_scan_error' ) && ! get_option( 'sitepilot_history_error' ); 46 46 } … … 72 72 } 73 73 if ( count( (array) $sp->get_settings()['watch_urls'] ) >= $sp->page_limit() ) { 74 $candidates['page-limit'] = __( 'You are monitoring the 3pages included in Free. Premium monitors up to 20 pages.', 'secherit-site-health-monitor' );74 $candidates['page-limit'] = __( 'You are monitoring the 5 pages included in Free. Premium monitors up to 20 pages.', 'secherit-site-health-monitor' ); 75 75 } 76 76 foreach ( $sp->current_checks( 50, 'health' ) as $row ) { -
secherit-site-health-monitor/trunk/includes/class-sitepilot.php
r3843620 r3846572 153 153 public function has_pro_addon() { return false; } 154 154 // The separately installed add-on supplies pro(); Free alone always returns false. 155 public function page_limit() { return $this->pro() ? 20 : 3; }155 public function page_limit() { return $this->pro() ? 20 : 5; } 156 156 public function get_settings() { $s = $this->settings; $s['watch_urls'] = array_values( array_unique( array_filter( array_map( array( $this, 'clean_public_url' ), array_slice( (array) $s['watch_urls'], 0, $this->page_limit() ) ) ) ) ); return $s; } 157 157 const UPGRADE_URL = 'https://secherit.dk/product/secherit-sitepilot/'; … … 282 282 wp_enqueue_style( 'sitepilot-optimize', SITEPILOT_URL . 'assets/optimize.css', array( 'sitepilot-admin' ), SITEPILOT_VERSION . '.' . (int) filemtime( SITEPILOT_DIR . 'assets/optimize.css' ) ); 283 283 wp_enqueue_script( 'sitepilot-admin', apply_filters( 'sitepilot_admin_script_url', SITEPILOT_URL . 'assets/admin.js' ), array(), apply_filters( 'sitepilot_admin_script_version', SITEPILOT_VERSION ), true ); 284 wp_enqueue_script( 'sitepilot-settings', SITEPILOT_URL . 'assets/settings.js', array(), SITEPILOT_VERSION . '.' . (int) filemtime( SITEPILOT_DIR . 'assets/settings.js' ), true ); 284 285 wp_localize_script( 'sitepilot-admin', 'SitePilotAdmin', array( 'root' => esc_url_raw( rest_url( 'sitepilot/v1/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'running' => __( 'Running checks…', 'secherit-site-health-monitor' ) ) ); 285 286 } … … 324 325 } 325 326 326 public function render_first_scan() { 327 /** Pages suggested for the first scan: home, plus contact and checkout when they exist. */ 328 public function suggested_watch() { 327 329 $watch = $this->get_settings()['watch_urls']; 328 330 if ( $watch === array( $this->clean_public_url( home_url( '/' ) ) ) ) { … … 341 343 $watch = $this->parse_urls( implode( "\n", $watch ), $this->page_limit() ); 342 344 } 345 return $watch; 346 } 347 348 /** Pages on this site worth monitoring, as label => URL, for the settings screen. */ 349 public function suggested_pages() { 350 $out = array( __( 'Home page', 'secherit-site-health-monitor' ) => home_url( '/' ) ); 351 $groups = array( 352 __( 'Contact', 'secherit-site-health-monitor' ) => array( 'contact', 'contact-us', 'kontakt' ), 353 __( 'Pricing', 'secherit-site-health-monitor' ) => array( 'pricing', 'prices', 'priser' ), 354 __( 'About', 'secherit-site-health-monitor' ) => array( 'about', 'about-us', 'om-os', 'om' ), 355 ); 356 foreach ( $groups as $label => $slugs ) { 357 foreach ( $slugs as $slug ) { 358 $page = get_page_by_path( $slug, OBJECT, 'page' ); 359 if ( $page && 'publish' === $page->post_status && ! $page->post_password ) { $out[ $label ] = get_permalink( $page ); break; } 360 } 361 } 362 if ( function_exists( 'wc_get_page_id' ) ) { 363 foreach ( array( 'shop' => __( 'Shop', 'secherit-site-health-monitor' ), 'cart' => __( 'Cart', 'secherit-site-health-monitor' ), 'checkout' => __( 'Checkout', 'secherit-site-health-monitor' ) ) as $key => $label ) { 364 $id = wc_get_page_id( $key ); 365 $page = $id > 0 ? get_post( $id ) : null; 366 if ( $page && 'publish' === $page->post_status && ! $page->post_password ) { $out[ $label ] = get_permalink( $page ); } 367 } 368 } 369 $posts_page = (int) get_option( 'page_for_posts' ); 370 if ( $posts_page && 'publish' === get_post_status( $posts_page ) ) { $out[ __( 'Blog', 'secherit-site-health-monitor' ) ] = get_permalink( $posts_page ); } 371 return array_filter( array_map( array( $this, 'clean_public_url' ), $out ) ); 372 } 373 374 /** Runs a scan from outside the dashboard (first-run and after-update checks). */ 375 public function run_background_scan( $watch = null ) { 376 return $this->run_scan( $watch ); 377 } 378 379 public function render_first_scan() { 380 $watch = $this->suggested_watch(); 343 381 require SITEPILOT_DIR . 'includes/first-scan-view.php'; 344 382 } … … 429 467 'headers' => array( 'User-Agent' => 'SitePilot/' . SITEPILOT_VERSION . ' (+site-monitor)', 'Cache-Control' => 'no-cache' ), 'cookies' => array() ) ); 430 468 if ( is_wp_error( $response ) ) { return $response; } 431 if ( ! in_array( (int) wp_remote_retrieve_response_code( $response ), array( 301, 302, 303, 307, 308 ), true ) ) { $response['sitepilot_final_url'] = $url; return $response; }469 if ( ! in_array( (int) wp_remote_retrieve_response_code( $response ), array( 301, 302, 303, 307, 308 ), true ) ) { $response['sitepilot_final_url'] = $url; $response['sitepilot_hops'] = $i; return $response; } 432 470 $location = wp_remote_retrieve_header( $response, 'location' ); 433 471 $next = is_string( $location ) && '' !== $location ? $this->clean_public_url( $this->resolve_link( $url, $location ) ) : ''; … … 500 538 'why' => 'Without it, your site is not checked automatically and you will not get alerts.', 501 539 'fix' => 'Deactivate and reactivate the plugin, or use the repair button. If it keeps disappearing, ask your host whether WordPress Cron is disabled.', 540 ), 541 'search_visibility' => array( 542 'what' => 'The setting "Discourage search engines from indexing this site" is turned on, so Google is asked to leave your whole site out of search results.', 543 'why' => 'Nobody can find you on Google. This setting is often left on by mistake after a site was built or moved.', 544 'fix' => 'Go to Settings > Reading, untick "Discourage search engines from indexing this site" and save. Then ask Google to index your home page in Search Console.', 545 ), 546 'page_noindex' => array( 547 'what' => 'This page contains a "noindex" instruction, so Google will not show it in search results.', 548 'why' => 'If this is one of your important pages, people cannot find it on Google.', 549 'fix' => 'In your SEO plugin, open the page and allow it in search results (in Yoast: Advanced > Allow search engines to show this page). If the instruction comes from your host or a security plugin, remove it there. Ignore this if the page should be private.', 550 ), 551 'mixed_content' => array( 552 'what' => 'Some images, scripts or styles on this secure https page are still loaded over insecure http.', 553 'why' => 'Browsers may block these files or show "Not secure", which can break the layout and scare visitors.', 554 'fix' => 'Change the addresses to https:// in the page or theme settings. A search-and-replace plugin can update old http:// addresses in the database. Back up first.', 555 ), 556 'seo_basics' => array( 557 'what' => 'This page has no title or no meta description for search results.', 558 'why' => 'Google then writes its own text, which is often less clear, and fewer people click your result.', 559 'fix' => 'Add a page title and a short description (about 150 characters) in your SEO plugin, for example in the Yoast box below the page editor.', 560 ), 561 'redirect_chain' => array( 562 'what' => 'Some links on this page go through two or more redirects before they reach the right page.', 563 'why' => 'Every redirect makes the page slower to open, and search engines may stop following long chains.', 564 'fix' => 'Edit the links so they point straight to the final address. You can see the final address by opening the link in your browser.', 502 565 ), 503 566 'php_dom' => array( … … 543 606 } elseif ( 'health' === $row->kind && isset( self::health_explanations()[ $details['check'] ?? '' ] ) && 'plugin_updates' !== ( $details['check'] ?? '' ) ) { 544 607 $e = self::health_explanations()[ $details['check'] ]; 608 $examples = array_map( 'esc_url_raw', array_slice( (array) ( $details['examples'] ?? array() ), 0, 3 ) ); 609 if ( $examples ) { $e['what'] .= ' ' . __( 'For example:', 'secherit-site-health-monitor' ) . ' ' . implode( ', ', $examples ) . '.'; } 545 610 $out = array_merge( $out, $e, array( 'message' => $e['what'] . ' ' . $e['why'] . ' ' . $e['fix'] ) ); 546 611 } elseif ( 'health' === $row->kind && 'plugin_updates' === ( $details['check'] ?? '' ) ) { … … 603 668 if ( ! $parsed ) { $this->record_unverified_elements( $url ); continue; } 604 669 $this->log_check( 'health', $url, 'info', 'HTML parsing available.', array( 'check' => 'php_dom' ) ); 670 $this->page_quality_checks( $url, $response, $dom ); 605 671 $forms = $dom->getElementsByTagName( 'form' ); 606 672 $buttons = $dom->getElementsByTagName( 'button' ); … … 640 706 } 641 707 $links = array_slice( $links, 0, 60 ); 708 $chains = array(); 709 $chain_checked = array(); 642 710 foreach ( $links as $link ) { 643 711 if ( microtime( true ) - $start > 22 ) { break; } … … 648 716 if ( 'fail' === $status ) { $results['broken']++; } 649 717 if ( 'warning' === $status ) { $results['unverified_links']++; } 718 if ( 'pass' === $status ) { 719 $chain_checked[ $link_queue[ $link ] ] = true; 720 if ( (int) ( $r['sitepilot_hops'] ?? 0 ) >= 2 ) { $chains[ $link_queue[ $link ] ][] = $link; } 721 } 650 722 $this->log_check( 'link', $link, $status, $message, array( 'code' => $code, 'source_url' => $link_queue[ $link ], 'error' => is_wp_error( $r ) ? mb_substr( $r->get_error_message(), 0, 200 ) : '' ) ); 723 } 724 foreach ( array_keys( $chain_checked ) as $source ) { 725 $found = $chains[ $source ] ?? array(); 726 $n = count( $found ); 727 $this->log_check( 'health', $source, $n ? 'warning' : 'pass', 728 $n ? sprintf( /* translators: %d: number of links. */ _n( '%d link on this page goes through several redirects.', '%d links on this page go through several redirects.', $n, 'secherit-site-health-monitor' ), $n ) : __( 'Checked links reach their page without redirect chains.', 'secherit-site-health-monitor' ), 729 array( 'check' => 'redirect_chain', 'count' => $n, 'examples' => array_slice( $found, 0, 5 ) ), $n ); 651 730 } 652 731 $this->health_checks(); … … 665 744 return $results; 666 745 } 746 /** Free checks on a loaded page: hidden from Google, mixed content and missing title or description. */ 747 private function page_quality_checks( $url, $response, DOMDocument $dom ) { 748 $robots = ''; 749 foreach ( $dom->getElementsByTagName( 'meta' ) as $meta ) { 750 $name = strtolower( trim( $meta->getAttribute( 'name' ) ) ); 751 if ( in_array( $name, array( 'robots', 'googlebot' ), true ) ) { $robots .= ' ' . strtolower( $meta->getAttribute( 'content' ) ); } 752 } 753 $header = wp_remote_retrieve_header( $response, 'x-robots-tag' ); 754 $header = strtolower( is_array( $header ) ? implode( ' ', $header ) : (string) $header ); 755 $noindex = false !== strpos( $robots, 'noindex' ) || preg_match( '/(^|[\s,])none([\s,]|$)/', trim( $robots ) ) || false !== strpos( $header, 'noindex' ); 756 // WooCommerce hides cart, checkout and account pages from Google on purpose. 757 $private = $this->is_private_shop_page( $url ); 758 $this->log_check( 'health', $url, $noindex ? ( $private ? 'info' : 'fail' ) : 'pass', 759 $noindex ? ( $private ? __( 'Hidden from Google on purpose. WooCommerce does this for cart, checkout and account pages, and that is normal.', 'secherit-site-health-monitor' ) : __( 'This page tells Google not to show it in search results (noindex).', 'secherit-site-health-monitor' ) ) : __( 'Search engines are allowed to show this page.', 'secherit-site-health-monitor' ), 760 array( 'check' => 'page_noindex', 'source' => false !== strpos( $header, 'noindex' ) ? 'header' : ( $noindex ? 'meta' : '' ) ) ); 761 762 if ( 'https' === wp_parse_url( $url, PHP_URL_SCHEME ) ) { 763 $insecure = array(); 764 $attrs = array( 'img' => array( 'src' ), 'script' => array( 'src' ), 'iframe' => array( 'src' ), 'source' => array( 'src' ), 'video' => array( 'src', 'poster' ), 'audio' => array( 'src' ), 'embed' => array( 'src' ), 'link' => array( 'href' ) ); 765 foreach ( $attrs as $tag => $names ) { 766 foreach ( $dom->getElementsByTagName( $tag ) as $el ) { 767 if ( 'link' === $tag && ! in_array( strtolower( $el->getAttribute( 'rel' ) ), array( 'stylesheet', 'icon', 'preload' ), true ) ) { continue; } 768 foreach ( $names as $attr ) { 769 $value = trim( $el->getAttribute( $attr ) ); 770 if ( 0 === stripos( $value, 'http://' ) ) { $insecure[ $value ] = true; } 771 } 772 } 773 } 774 $n = count( $insecure ); 775 $this->log_check( 'health', $url, $n ? 'warning' : 'pass', 776 $n ? sprintf( /* translators: %d: number of files. */ _n( '%d file on this secure page is loaded over insecure http.', '%d files on this secure page are loaded over insecure http.', $n, 'secherit-site-health-monitor' ), $n ) : __( 'All images, scripts and styles load over https.', 'secherit-site-health-monitor' ), 777 array( 'check' => 'mixed_content', 'count' => $n, 'examples' => array_slice( array_keys( $insecure ), 0, 5 ) ), $n ); 778 } 779 780 $titles = $dom->getElementsByTagName( 'title' ); 781 $title = $titles->length ? trim( $titles->item( 0 )->textContent ) : ''; 782 $description = ''; 783 foreach ( $dom->getElementsByTagName( 'meta' ) as $meta ) { 784 if ( 'description' === strtolower( trim( $meta->getAttribute( 'name' ) ) ) ) { $description = trim( $meta->getAttribute( 'content' ) ); break; } 785 } 786 if ( $private ) { // Search results text does not matter for pages Google never shows. 787 $this->log_check( 'health', $url, 'info', __( 'Not needed: this page is not shown in search results.', 'secherit-site-health-monitor' ), array( 'check' => 'seo_basics', 'missing' => array() ) ); 788 return; 789 } 790 $missing = array(); 791 if ( '' === $title ) { $missing[] = __( 'page title', 'secherit-site-health-monitor' ); } 792 if ( '' === $description ) { $missing[] = __( 'meta description', 'secherit-site-health-monitor' ); } 793 $this->log_check( 'health', $url, $missing ? 'warning' : 'pass', 794 /* translators: %s: missing items, such as "meta description". */ 795 $missing ? sprintf( __( 'Missing for search results: %s.', 'secherit-site-health-monitor' ), implode( ', ', $missing ) ) : __( 'Page title and meta description are set.', 'secherit-site-health-monitor' ), 796 array( 'check' => 'seo_basics', 'title' => mb_substr( $title, 0, 120 ), 'missing' => $missing ) ); 797 } 798 /** Cart, checkout and account pages are meant to stay out of search results. */ 799 private function is_private_shop_page( $url ) { 800 if ( ! function_exists( 'wc_get_page_id' ) ) { return false; } 801 foreach ( array( 'cart', 'checkout', 'myaccount' ) as $key ) { 802 $id = wc_get_page_id( $key ); 803 if ( $id > 0 && $this->clean_public_url( get_permalink( $id ) ) === $this->clean_public_url( $url ) ) { return true; } 804 } 805 return false; 806 } 667 807 private function record_unverified_elements( $url ) { 668 808 foreach ( array( 'form', 'button' ) as $kind ) { … … 676 816 } 677 817 protected function health_checks() { 818 $hidden = '0' === (string) get_option( 'blog_public', '1' ); 819 $this->log_check( 'health', home_url(), $hidden ? 'fail' : 'pass', $hidden ? __( 'The whole site asks search engines not to index it (Settings > Reading).', 'secherit-site-health-monitor' ) : __( 'Search engines are allowed to index the site.', 'secherit-site-health-monitor' ), array( 'check' => 'search_visibility' ) ); 678 820 $ssl = is_ssl() || 'https' === wp_parse_url( home_url(), PHP_URL_SCHEME ); 679 821 $this->log_check( 'health', home_url(), $ssl ? 'pass' : 'fail', $ssl ? 'HTTPS is configured.' : 'HTTPS is not configured.', array( 'check' => 'https' ) ); … … 776 918 if ( $observed && ! isset( $referenced[ $row->target ] ) && $complete_since >= $observed ) { return false; } 777 919 } 778 if ( 'health' === $row->kind && 'php_dom' === ( $details['check'] ?? '') && ! in_array( $row->target, $pages, true ) ) { return false; }920 if ( 'health' === $row->kind && in_array( $details['check'] ?? '', array( 'php_dom', 'page_noindex', 'mixed_content', 'seo_basics', 'redirect_chain' ), true ) && ! in_array( $row->target, $pages, true ) ) { return false; } 779 921 if ( 'element' === $row->kind && ! isset( $rules[ $details['rule_id'] ?? '' ] ) ) { return false; } 780 922 if ( in_array( $row->kind, array( 'visual', 'performance' ), true ) && ! in_array( $row->target, $visual, true ) ) { return false; } … … 860 1002 $all += $weight; 861 1003 if ( 'page' === $kind ) { $page_down = true; } 1004 // A site or key page hidden from Google is as serious as a page that is down. 1005 if ( 'health' === $kind && in_array( (string) ( json_decode( $row->details ?? '', true )['check'] ?? '' ), array( 'search_visibility', 'page_noindex' ), true ) ) { $page_down = true; } 862 1006 } elseif ( 'warning' === $row->status ) { $out['warnings']++; } 863 1007 } -
secherit-site-health-monitor/trunk/readme.txt
r3845057 r3846572 1 === Secherit Site Health Monitor ===1 === Secherit Site Health Monitor – Broken Links, Page & Form Checker === 2 2 Contributors: oliversech 3 3 Tags: broken link checker, broken links, 404, site health, website monitoring … … 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.4. 37 Stable tag: 1.4.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 19 19 = What the free plugin checks = 20 20 21 * **Page errors:** HTTP status and response time for up to three important pages, such as your home, contactand checkout pages.21 * **Page errors:** HTTP status and response time for up to five important pages, such as your home, contact, pricing and checkout pages. 22 22 * **Broken internal links:** up to 60 internal links per scan, with the page each broken link was found on and a direct link to edit it. 23 23 * **Forms and buttons:** whether forms and buttons are still present in the page HTML, so you notice when a contact form disappears after an update. 24 * **Hidden from Google:** warns when the whole site or an important page tells search engines not to show it (noindex). 25 * **Mixed content, SEO basics and redirects:** finds insecure http files on https pages, missing page titles or meta descriptions, and links that go through several redirects. 24 26 * **Basic site health:** HTTPS, public PHP error display, PHP version and pending plugin updates. 25 27 * **History and export:** keep a history of every check and export it as CSV. … … 42 44 2. Search for Secherit Site Health Monitor, install it and activate it. 43 45 3. Open Site Health Monitor in the admin menu. 44 4. Choose up to three important pages, for example your home, contact and checkout pages.46 4. Choose up to five important pages, for example your home, contact and checkout pages. 45 47 5. Select Run checks and review the results. 46 48 … … 53 55 = Does it slow down my website? = 54 56 55 No. Checks only run when you start them from the dashboard. Nothing runs for your visitors.57 No. Checks run once in the background right after you activate the plugin, and after that only when you start them. Nothing runs for your visitors. 56 58 57 59 = Does it work with WooCommerce? = … … 67 69 No. It detects forms and buttons in the HTML the page returns. It does not submit forms or test that messages are delivered. 68 70 71 = Can it tell if my site is hidden from Google? = 72 73 Yes. Every check looks for the "Discourage search engines" setting and for noindex instructions on your important pages, and explains how to fix them. 74 75 = Does it remind me to check after updates? = 76 77 Yes. After you update plugins, a theme or WordPress, a small notice offers to run checks in one click. You can dismiss it, and it goes away by itself after two days. 78 69 79 = Do I need an account? = 70 80 … … 73 83 = How many pages can I check? = 74 84 75 Up to three pages in the free plugin, and up to 20 with Premium.85 Up to five pages in the free plugin, and up to 20 with Premium. 76 86 77 87 = Can I run checks automatically? = … … 102 112 103 113 == Changelog == 114 115 = 1.4.4 = 116 * New: The first check runs automatically in the background after activation, so your dashboard shows results right away. 117 * New: After you update plugins, a theme or WordPress, a dismissible notice offers to check your site in one click. 118 * Improved: The review request now appears after two successful checks and three days. 119 * Improved: Clearer plugin name in the plugin directory. 120 * New: Warns when your site or an important page is hidden from Google (Discourage search engines or noindex). 121 * New: Finds images, scripts and styles loaded over insecure http on https pages (mixed content). 122 * New: Flags important pages without a page title or meta description. 123 * New: Finds links that go through several redirects. 124 * New: Dashboard widget with your latest result and a Run checks button. 125 * Improved: The free plugin now checks up to five pages (was three). 126 * Improved: WooCommerce cart, checkout and account pages are recognised as hidden from Google on purpose, so they never lower your health score. 127 * Improved: The settings screen explains what is checked on each page and suggests pages from your site that you can add in one click. 104 128 105 129 = 1.4.3 = -
secherit-site-health-monitor/trunk/secherit-site-health-monitor.php
r3845057 r3846572 1 1 <?php 2 2 /** 3 * Plugin Name: Secherit Site Health Monitor 3 * Plugin Name: Secherit Site Health Monitor – Broken Links, Page & Form Checker 4 4 * Description: Intelligent WordPress website health, link, form and experience monitoring with manual checks and local monitoring history. 5 * Version: 1.4. 35 * Version: 1.4.4 6 6 * Requires at least: 6.2 7 7 * Requires PHP: 7.4 … … 13 13 if ( ! defined( 'ABSPATH' ) ) { exit; } 14 14 if ( class_exists( 'Secherit_SitePilot', false ) ) { return; } 15 define( 'SITEPILOT_VERSION', '1.4. 3' );15 define( 'SITEPILOT_VERSION', '1.4.4' ); 16 16 define( 'SITEPILOT_FILE', __FILE__ ); 17 17 define( 'SITEPILOT_DIR', plugin_dir_path( __FILE__ ) ); … … 19 19 require_once SITEPILOT_DIR . 'includes/class-sitepilot.php'; 20 20 require_once SITEPILOT_DIR . 'includes/class-sitepilot-optimizer.php'; 21 require_once SITEPILOT_DIR . 'includes/class-sitepilot-onboarding.php'; 22 // Loaded everywhere so background scans (cron) are counted too; hooks are only added in admin. 23 require_once SITEPILOT_DIR . 'includes/class-sitepilot-growth.php'; 24 Secherit_SitePilot_Onboarding::init(); 21 25 if ( is_admin() ) { 22 26 require_once SITEPILOT_DIR . 'includes/class-sitepilot-feedback.php'; 23 27 Secherit_SitePilot_Feedback::init(); 24 require_once SITEPILOT_DIR . 'includes/class-sitepilot-growth.php';25 28 Secherit_SitePilot_Growth::init(); 26 29 require_once SITEPILOT_DIR . 'includes/class-sitepilot-site-health.php'; 27 30 Secherit_SitePilot_Site_Health::init(); 28 31 } 29 register_activation_hook( __FILE__, array( 'Secherit_SitePilot ', 'activate' ) );30 register_deactivation_hook( __FILE__, array( 'Secherit_SitePilot ', 'deactivate' ) );32 register_activation_hook( __FILE__, array( 'Secherit_SitePilot_Onboarding', 'activate' ) ); 33 register_deactivation_hook( __FILE__, array( 'Secherit_SitePilot_Onboarding', 'deactivate' ) ); 31 34 add_action( 'plugins_loaded', array( 'Secherit_SitePilot', 'schedule_events' ), 20 ); -
secherit-site-health-monitor/trunk/uninstall.php
r3843620 r3846572 15 15 // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Remove only this plugin's options. 16 16 $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'sitepilot_' ) . '%' ) ); 17 foreach ( array( 'sitepilot_review_state', 'sitepilot_upsell_dismissed' ) as $sitepilot_meta ) {17 foreach ( array( 'sitepilot_review_state', 'sitepilot_upsell_dismissed', 'sitepilot_trial_bar_until', 'sitepilot_trial_notice_done' ) as $sitepilot_meta ) { 18 18 delete_metadata( 'user', 0, $sitepilot_meta, '', true ); 19 19 } 20 foreach ( array( 'sitepilot_scan_event', 'sitepilot_weekly_event', 'sitepilot_license_event', 'sitepilot_visual_event', 'sitepilot_advanced_event', 'sitepilot_after_update_event', 'sitepilot_backup_verify' ) as $sitepilot_hook ) {20 foreach ( array( 'sitepilot_scan_event', 'sitepilot_weekly_event', 'sitepilot_license_event', 'sitepilot_visual_event', 'sitepilot_advanced_event', 'sitepilot_after_update_event', 'sitepilot_backup_verify', 'sitepilot_first_scan_event' ) as $sitepilot_hook ) { 21 21 wp_unschedule_hook( $sitepilot_hook ); 22 22 }
Note:
See TracChangeset
for help on using the changeset viewer.