(ASE)

'; // https://icon-sets.iconify.design/octicon/question-16/ $svg_support = ''; // https://icon-sets.iconify.design/octicon/comment-16/ $svg_feedback = ''; // https://icon-sets.iconify.design/ic/baseline-translate/ $svg_translate = ''; // https://icon-sets.iconify.design/iconamoon/file-document/ $svg_docs = ''; // https://icon-sets.iconify.design/pajamas/heart/ $svg_sponsor = ''; ?>
'; // https://icon-sets.iconify.design/mingcute/layout-line/ $icon_admin_interface = ''; // https://icon-sets.iconify.design/ri/login-circle-line/ $icon_login_logout = ''; // https://icon-sets.iconify.design/mingcute/code-line/ $icon_custom_code = ''; // https://icon-sets.iconify.design/mdi/forbid/ $icon_disable_components = ''; // https://icon-sets.iconify.design/jam/shield-check/ $icon_security = ''; // https://icon-sets.iconify.design/streamline/image-flash-1-flash-power-connect-charge-electricity-lightning/ $icon_optimizations = ''; // https://icon-sets.iconify.design/iconoir/tools/ $icon_utilities = ''; ?>
tag array( 'id' => 'asenha-submit', ) ); ?>
> Admin Menu Organizer // Re-register and re-enqueue jQuery UI Core and plugins required for sortable, draggable and droppable when ordering menu items wp_deregister_script( 'jquery-ui-core' ); wp_register_script( 'jquery-ui-core', get_site_url() . '/wp-includes/js/jquery/ui/core.min.js', array('jquery'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-core' ); if ( version_compare( $wp_version, '5.6.0', '>=' ) ) { wp_deregister_script( 'jquery-ui-mouse' ); wp_register_script( 'jquery-ui-mouse', get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js', array('jquery-ui-core'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-mouse' ); } else { wp_deregister_script( 'jquery-ui-widget' ); wp_register_script( 'jquery-ui-widget', get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js', array('jquery'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-widget' ); wp_deregister_script( 'jquery-ui-mouse' ); wp_register_script( 'jquery-ui-mouse', get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js', array('jquery-ui-core', 'jquery-ui-widget'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-mouse' ); } wp_deregister_script( 'jquery-ui-sortable' ); wp_register_script( 'jquery-ui-sortable', get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js', array('jquery-ui-mouse'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-sortable' ); wp_deregister_script( 'jquery-ui-draggable' ); wp_register_script( 'jquery-ui-draggable', get_site_url() . '/wp-includes/js/jquery/ui/draggable.min.js', array('jquery-ui-mouse'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-draggable' ); wp_deregister_script( 'jquery-ui-droppable' ); wp_register_script( 'jquery-ui-droppable', get_site_url() . '/wp-includes/js/jquery/ui/droppable.min.js', array('jquery-ui-draggable'), ASENHA_VERSION, false ); wp_enqueue_script( 'jquery-ui-droppable' ); // Script to set behaviour and actions of the sortable menu wp_enqueue_script( 'asenha-custom-admin-menu', ASENHA_URL . 'assets/js/custom-admin-menu.js', array('jquery-ui-draggable'), ASENHA_VERSION, false ); // First, we unload the CodeMirror libraries included in WP core wp_deregister_script( 'wp-codemirror' ); wp_deregister_script( 'code-editor' ); wp_deregister_script( 'htmlhint' ); wp_deregister_script( 'csslint' ); wp_deregister_script( 'esprima' ); wp_deregister_script( 'jshint' ); // Then, we load ASENHA's CodeMirror libraries. In use, e.g. for Utilities >> Enable Custom Admin / Frontend CSS / ads.txt / app-ads.txt wp_enqueue_style( 'asenha-codemirror', ASENHA_URL . 'assets/css/codemirror/codemirror.min.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-codemirror', ASENHA_URL . 'assets/js/codemirror/codemirror.min.js', array('jquery'), ASENHA_VERSION, true ); wp_enqueue_script( 'asenha-codemirror-htmlmixed-mode', ASENHA_URL . 'assets/js/codemirror/htmlmixed.js', array('asenha-codemirror'), ASENHA_VERSION, true ); wp_enqueue_script( 'asenha-codemirror-xml-mode', ASENHA_URL . 'assets/js/codemirror/xml.js', array('asenha-codemirror'), ASENHA_VERSION, true ); wp_enqueue_script( 'asenha-codemirror-javascript-mode', ASENHA_URL . 'assets/js/codemirror/javascript.js', array('asenha-codemirror'), ASENHA_VERSION, true ); wp_enqueue_script( 'asenha-codemirror-css-mode', ASENHA_URL . 'assets/js/codemirror/css.js', array('asenha-codemirror'), ASENHA_VERSION, true ); wp_enqueue_script( 'asenha-codemirror-markdown-mode', ASENHA_URL . 'assets/js/codemirror/markdown.js', array('asenha-codemirror'), ASENHA_VERSION, true ); // DataTables. In use, e.g. for Security >> Limit Login Attempts wp_enqueue_style( 'asenha-datatables', ASENHA_URL . 'assets/css/datatables/datatables.min.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-datatables', ASENHA_URL . 'assets/js/datatables/datatables.min.js', array('jquery'), ASENHA_VERSION, false ); // Add WP media library assets wp_enqueue_media(); // Add WP color picker assets wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); // We force loading the uncompressed version of TinyMCE. This ensures we load 'wp-tinymce-root' and then 'wp-tinymce', // which prevents issue where the Visual tab is unusable in some scenarios $wp_scripts = wp_scripts(); $wp_scripts->remove( 'wp-tinymce' ); wp_register_tinymce_scripts( $wp_scripts, true ); // Main style and script for the admin page wp_enqueue_style( 'asenha-admin-page', ASENHA_URL . 'assets/css/admin-page.css', array( 'asenha-jbox', 'asenha-codemirror', 'asenha-datatables', 'wp-color-picker' ), ASENHA_VERSION ); wp_enqueue_script( 'asenha-admin-page', ASENHA_URL . 'assets/js/admin-page.js', array( 'asenha-jsticky', 'asenha-jbox', 'asenha-js-cookie', 'asenha-codemirror-htmlmixed-mode', 'asenha-codemirror-xml-mode', 'asenha-codemirror-javascript-mode', 'asenha-codemirror-css-mode', 'asenha-codemirror-markdown-mode', 'asenha-datatables', 'asenha-custom-admin-menu', 'wp-color-picker', 'wp-mediaelement', 'wp-tinymce-root', 'wp-tinymce' ), ASENHA_VERSION, false ); wp_localize_script( 'asenha-admin-page', 'adminPageVars', array( 'siteUrl' => get_site_url(), 'wpcontentUrl' => content_url(), 'mediaFrameTitle' => __( 'Select an Image', 'admin-site-enhancements' ), 'mediaFrameButtonText' => __( 'Use Selected Image', 'admin-site-enhancements' ), 'resetMenuNonce' => wp_create_nonce( 'reset-menu-nonce' ), 'expandText' => __( 'Expand', 'admin-site-enhancements' ), 'collapseText' => __( 'Collapse', 'admin-site-enhancements' ), 'dataTable' => array( 'emptyTable' => __( 'No data available in table', 'admin-site-enhancements' ), 'info' => __( 'Showing _START_ to _END_ of _TOTAL_ entries', 'admin-site-enhancements' ), 'infoEmpty' => __( 'Showing 0 to 0 of 0 entries', 'admin-site-enhancements' ), 'infoFiltered' => __( '(filtered from _MAX_ total entries)', 'admin-site-enhancements' ), 'lengthMenu' => __( 'Show _MENU_ entries', 'admin-site-enhancements' ), 'search' => __( 'Search:', 'admin-site-enhancements' ), 'zeroRecords' => __( 'No matching records found', 'admin-site-enhancements' ), 'paginate' => array( 'first' => __( 'First', 'admin-site-enhancements' ), 'last' => __( 'Last', 'admin-site-enhancements' ), 'next' => __( 'Next', 'admin-site-enhancements' ), 'previous' => __( 'Previous', 'admin-site-enhancements' ), ), ), ) ); } // Enqueue on all wp-admin wp_enqueue_style( 'asenha-wp-admin', ASENHA_URL . 'assets/css/wp-admin.css', array(), ASENHA_VERSION ); // Content Management >> Show IDs, for list tables in wp-admin, e.g. All Posts page if ( false !== strpos( $current_screen->base, 'edit' ) || false !== strpos( $current_screen->base, 'users' ) || false !== strpos( $current_screen->base, 'upload' ) ) { wp_enqueue_style( 'asenha-list-table', ASENHA_URL . 'assets/css/list-table.css', array(), ASENHA_VERSION ); } // Content Management >> Enable Media Replacement if ( $current_screen->base == 'upload' || $current_screen->id == 'attachment' ) { // wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION ); // wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false ); wp_enqueue_style( 'asenha-media-replace', ASENHA_URL . 'assets/css/media-replace.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-media-replace', ASENHA_URL . 'assets/js/media-replace.js', array(), ASENHA_VERSION, false ); $media_replace = array( 'selectMediaText' => __( 'Select New Media File', 'admin-site-enhancements' ), 'performReplacementText' => __( 'Perform Replacement', 'admin-site-enhancements' ), ); wp_localize_script( 'asenha-media-replace', 'mediaReplace', $media_replace ); } // Utilities >> Image Sizes Panel if ( 'post' == $current_screen->base && 'attachment' == $current_screen->id ) { global $post; // Only enqueue if the attachment is an image if ( property_exists( $post, 'post_mime_type' ) && false !== strpos( $post->post_mime_type, 'image' ) ) { wp_enqueue_style( 'asenha-image-sizes-panel', ASENHA_URL . 'assets/css/image-sizes-panel.css' ); } } // Content Management >> Hide Admin Notices if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) { $hide_for_nonadmins = ( isset( $options['hide_admin_notices_for_nonadmins'] ) ? $options['hide_admin_notices_for_nonadmins'] : false ); $minimum_capability = 'manage_options'; if ( function_exists( 'bwasenha_fs' ) ) { if ( $hide_for_nonadmins && bwasenha_fs()->can_use_premium_code__premium_only() ) { $minimum_capability = 'read'; } } if ( current_user_can( $minimum_capability ) ) { wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false ); wp_enqueue_style( 'asenha-hide-admin-notices', ASENHA_URL . 'assets/css/hide-admin-notices.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-hide-admin-notices', ASENHA_URL . 'assets/js/hide-admin-notices.js', array('asenha-jbox'), ASENHA_VERSION, false ); } } // Utilities >> Multiple User Roles if ( array_key_exists( 'multiple_user_roles', $options ) && $options['multiple_user_roles'] ) { if ( 'user-edit.php' == $hook_suffix || 'user-new.php' == $hook_suffix ) { // Only replace roles dropdown with checkboxes for users that can assign roles to other users, e.g. administrators if ( current_user_can( 'promote_users', get_current_user_id() ) ) { wp_enqueue_script( 'asenha-multiple-user-roles', ASENHA_URL . 'assets/js/multiple-user-roles.js', array('jquery'), ASENHA_VERSION, false ); } } } // Pass on ASENHA stats to admin-page.js to determine whether to show support nudge $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $current_date = date( 'Y-m-d', time() ); $show_support_nudge = false; $hide_upgrade_nudge = false; $asenha_stats_localized = array( 'firstSaveDate' => '', 'lastSaveDate' => '', 'saveCount' => 0, 'hideUpgradeNudge' => false, 'showSupportNudge' => false, 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn', ); if ( !empty( $asenha_stats ) ) { $hide_upgrade_nudge = ( isset( $asenha_stats['upgrade_nudge_dismissed'] ) ? $asenha_stats['upgrade_nudge_dismissed'] : false ); $have_supported = ( isset( $asenha_stats['have_supported'] ) ? $asenha_stats['have_supported'] : false ); $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == sanitize_text_field( $_GET['settings-updated'] ) ? true : false ); $save_count = ( isset( $asenha_stats['save_count'] ) ? $asenha_stats['save_count'] : 0 ); // Compensate for redirect from settings-updated=true URL if ( $changes_saved ) { $save_count = $save_count + 1; } else { $save_count = $save_count; } $saves_to_nudge_support = 10; if ( $save_count < $saves_to_nudge_support ) { $save_count_modulo = -1; } else { $save_count_modulo = $save_count % $saves_to_nudge_support; } // User have not supported ASE if ( false === $have_supported ) { // Support nudge have not been dismissed if ( isset( $asenha_stats['support_nudge_dismissed'] ) && false === $asenha_stats['support_nudge_dismissed'] ) { // Show support nudge after every x saves if ( $save_count_modulo >= 0 ) { $show_support_nudge = true; } else { $show_support_nudge = false; } if ( $show_support_nudge && $save_count_modulo >= 0 ) { $asenha_stats['support_nudge_last_shown_date'] = $current_date; $asenha_stats['support_nudge_last_shown_save_count'] = $save_count; update_option( ASENHA_SLUG_U . '_stats', $asenha_stats ); } } else { if ( $save_count_modulo == 0 ) { if ( $save_count > $asenha_stats['support_nudge_last_shown_save_count'] ) { $asenha_stats['support_nudge_dismissed'] = false; update_option( ASENHA_SLUG_U . '_stats', $asenha_stats ); $show_support_nudge = true; } else { $show_support_nudge = false; } } else { $show_support_nudge = false; } } } $first_save_date = ( isset( $asenha_stats['first_save_date'] ) ? $asenha_stats['first_save_date'] : '' ); $last_save_date = ( isset( $asenha_stats['last_save_date'] ) ? $asenha_stats['last_save_date'] : '' ); $asenha_stats_localized = array( 'firstSaveDate' => $first_save_date, 'lastSaveDate' => $last_save_date, 'saveCount' => $save_count, 'hideUpgradeNudge' => $hide_upgrade_nudge, 'showSupportNudge' => $show_support_nudge, 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn', ); } wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized ); } /** * Dequeue scripts that prevents ASE settings page from working properly. Usually from plugins. * * @since 6.3.3 */ function asenha_dequeue_scritps() { // https://wordpress.org/plugins/user-activity-log/ wp_dequeue_script( 'chats-js' ); wp_dequeue_script( 'custom_wp_admin_js' ); // https://wordpress.org/plugins/print-invoices-packing-slip-labels-for-woocommerce/ wp_dequeue_script( 'print-invoices-packing-slip-labels-for-woocommerce' ); wp_dequeue_script( 'print-invoices-packing-slip-labels-for-woocommerce-form-wizard' ); // https://wordpress.org/plugins/wp-reading-progress/ wp_dequeue_script( 'ruigehond006_admin_javascript' ); // WordPress Mentions Légales plugin v1.2.3 by Jean-Baptiste Aramendy - http://jba-development.fr/ wp_dequeue_script( 'jquery-ui' ); wp_dequeue_script( 'wordpress-mentions-legales' ); // https://wordpress.org/plugins/us-weather-widget-willyweather/ wp_dequeue_script( 'self' ); // iThemes Security Pro / Solid Security Pro wp_dequeue_script( 'itsec-core-admin-notices' ); } /** * Enqueue public scripts * * @since 3.9.0 */ function asenha_public_scripts( $hook_suffix ) { // Get all WP Enhancements options, default to empty array in case it's not been created yet $options = get_option( 'admin_site_enhancements', array() ); // External Permalinks $enable_external_permalinks = ( array_key_exists( 'enable_external_permalinks', $options ) ? $options['enable_external_permalinks'] : false ); if ( $enable_external_permalinks ) { wp_enqueue_script( 'asenha-public', ASENHA_URL . 'assets/js/external-permalinks.js', array(), ASENHA_VERSION, false ); wp_localize_script( 'asenha-public', 'phpVars', array( 'externalPermalinksEnabled' => $enable_external_permalinks, ) ); } // Media Categories $enable_media_categories = ( array_key_exists( 'enable_media_categories', $options ) ? $options['enable_media_categories'] : false ); if ( $enable_media_categories && !is_admin() && is_user_logged_in() ) { wp_enqueue_style( 'asenha-media-categories-frontend', ASENHA_URL . 'assets/css/media-categories-frontend.css', array(), ASENHA_VERSION ); } // Media Replacement $enable_media_replacement = ( array_key_exists( 'enable_media_replacement', $options ) ? $options['enable_media_replacement'] : false ); if ( $enable_media_replacement && is_user_logged_in() ) { wp_enqueue_style( 'asenha-media-replace-frontend', ASENHA_URL . 'assets/css/media-replace-frontend.css', array(), ASENHA_VERSION ); } } /** * Add admin bar styles for wp-admin and frontend * * @since 6.2.1 */ function asenha_admin_bar_item_js_css() { if ( is_user_logged_in() ) { ?> ' . __( 'Configure', 'admin-site-enhancements' ) . ''; array_unshift( $links, $settings_link ); return $links; } /** * Modify footer text * * @since 1.0.0 */ function asenha_footer_text() { // Show nothing ?> ASE v true, ) ); } else { echo json_encode( array( 'success' => false, ) ); } } } /** * Dismiss support nudge * * @since 5.8.2 */ function asenha_dismiss_upgrade_nudge() { if ( isset( $_REQUEST ) ) { $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['upgrade_nudge_dismissed'] = true; $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats ); if ( $success ) { echo json_encode( array( 'success' => true, ) ); } else { echo json_encode( array( 'success' => false, ) ); } } } /** * Dismiss support nudge * * @since 5.2.7 */ function asenha_dismiss_support_nudge() { if ( isset( $_REQUEST ) ) { $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['support_nudge_dismissed'] = true; $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats ); if ( $success ) { echo json_encode( array( 'success' => true, ) ); } else { echo json_encode( array( 'success' => false, ) ); } } }