$settings, 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wpas_nonce' ), 'proUrl' => 'https://mdshahinurislamm.github.io/wp-accessibility-suite/', ) ); } /* ── Skip Links ─────────────────────────────────────────────────────────── */ add_action( 'wp_body_open', 'wpas_render_skip_links', 1 ); function wpas_render_skip_links() { if ( ! wpas_is_enabled( 'skip_links_enabled' ) ) return; echo ''; } /* ── Toolbar ─────────────────────────────────────────────────────────────── */ add_action( 'wp_footer', 'wpas_render_toolbar', 99 ); function wpas_render_toolbar() { if ( ! wpas_is_enabled( 'toolbar_enabled' ) ) return; $pos = esc_attr( wpas_get( 'toolbar_position' ) ); $color = esc_attr( wpas_get( 'toolbar_color' ) ); ?>
(function(){var m=[["main,#content,.site-content","wpas-main-content",""],["nav,.site-navigation,.main-navigation","wpas-main-nav","navigation"],["footer,.site-footer","wpas-footer",""]];m.forEach(function(x){var e=document.querySelector(x[0]);if(e&&!e.id)e.id=x[1];if(e&&x[2]&&!e.getAttribute("role"))e.setAttribute("role",x[2]);});})();'; } /* ── External Links ─────────────────────────────────────────────────────── */ add_filter( 'the_content', 'wpas_external_link_filter' ); function wpas_external_link_filter( $content ) { if ( ! wpas_is_enabled( 'external_link_indicator' ) ) return $content; $home = home_url(); return preg_replace_callback( '/]*href=["\']https?:\/\/[^"\']+["\'][^>]*)>/i', function( $m ) use ( $home ) { $tag = $m[0]; if ( strpos($tag,$home) !== false || strpos($tag,'wpas-ext') !== false ) return $tag; return rtrim($tag,'>') . ' class="wpas-ext-link" rel="noopener noreferrer" target="_blank" aria-describedby="wpas-new-tab-notice">'; }, $content ); } add_action( 'wp_footer', function() { if ( wpas_is_enabled('new_tab_warning') ) echo '(opens in a new tab)'; } );