(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/iconamoon/file-document/ $svg_docs = ''; // https://icon-sets.iconify.design/pajamas/heart/ $svg_sponsor = ''; ?> Get ASE Pro Save Changes
'; // 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 ); // 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' ), 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' ), ASENHA_VERSION, false ); wp_localize_script( 'asenha-admin-page', 'adminPageVars', array( 'mediaFrameTitle' => 'Select an Image', 'mediaFrameButtonText' => 'Use Selected Image', ) ); // 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' ); } // 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 ); } // Content Management >> Hide Admin Notices if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) { if ( current_user_can( 'manage_options' ) ) { 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 sponsorship nudge $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $current_date = date( 'Y-m-d', time() ); $show_sponsorship_nudge = false; $hide_upgrade_nudge = false; $asenha_stats_localized = array( 'firstSaveDate' => '', 'lastSaveDate' => '', 'saveCount' => 0, 'hideUpgradeNudge' => false, 'showSponsorshipNudge' => 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_sponsored = $asenha_stats['have_sponsored']; $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false ); // Compensate for redirect from settings-updated=true URL if ( $changes_saved ) { $save_count = $asenha_stats['save_count'] + 1; } else { $save_count = $asenha_stats['save_count']; } $saves_to_nudge_sponsorship = 10; if ( $save_count < $saves_to_nudge_sponsorship ) { $save_count_modulo = -1; } else { $save_count_modulo = $save_count % $saves_to_nudge_sponsorship; } // User have not sponsored ASE if ( false === $have_sponsored ) { // Sponsorship nudge have not been dismissed if ( false === $asenha_stats['sponsorship_nudge_dismissed'] ) { // Show sponsorship nudge after every x saves if ( $save_count_modulo >= 0 ) { $show_sponsorship_nudge = true; } else { $show_sponsorship_nudge = false; } if ( $show_sponsorship_nudge && $save_count_modulo >= 0 ) { $asenha_stats['sponsorship_nudge_last_shown_date'] = $current_date; $asenha_stats['sponsorship_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['sponsorship_nudge_last_shown_save_count'] ) { $asenha_stats['sponsorship_nudge_dismissed'] = false; update_option( ASENHA_SLUG_U . '_stats', $asenha_stats ); $show_sponsorship_nudge = true; } else { $show_sponsorship_nudge = false; } } else { $show_sponsorship_nudge = false; } } } $asenha_stats_localized = array( 'firstSaveDate' => $asenha_stats['first_save_date'], 'lastSaveDate' => $asenha_stats['last_save_date'], 'saveCount' => $save_count, 'hideUpgradeNudge' => $hide_upgrade_nudge, 'showSponsorshipNudge' => $show_sponsorship_nudge, 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn', ); } wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized ); } /** * 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'; array_unshift( $links, $settings_link ); return $links; } /** * Modify footer text * * @since 1.0.0 */ function asenha_footer_text() { if ( is_asenha() ) { ?> ASE v true, ) ) ; } else { echo json_encode( array( 'success' => false, ) ) ; } } } /** * Dismiss sponsorship 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 sponsorship nudge * * @since 5.2.7 */ function asenha_dismiss_sponsorship_nudge() { if ( isset( $_REQUEST ) ) { $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['sponsorship_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, ) ) ; } } }