(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', ) ); ?>
= 10 ) { $is_yearend_promo_period = true; } else { $is_yearend_promo_period = false; } return $is_yearend_promo_period; } /** * Suppress all notices, then add notice for successful settings update * * @since 1.1.0 */ function asenha_suppress_add_notices() { global $plugin_page; // Suppress all notices if ( ASENHA_SLUG === $plugin_page ) { remove_all_actions( 'admin_notices' ); } // Add notice for successful settings update if ( isset( $_GET['page'] ) && ASENHA_SLUG == $_GET['page'] && isset( $_GET['settings-updated'] ) && true == $_GET['settings-updated'] ) { ?> > 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', 'wp-color-picker', 'wp-mediaelement', 'wp-tinymce-root', 'wp-tinymce' ), ASENHA_VERSION, false ); wp_localize_script( 'asenha-admin-page', 'adminPageVars', array( 'nonce' => wp_create_nonce( 'asenha-' . get_current_user_id() ), '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' ), 'sendTestEmailNonce' => wp_create_nonce( 'send-test-email-nonce_' . get_current_user_id() ), 'formBuilderSendTestEmailNonce' => wp_create_nonce( 'formbuilder_ajax' ), '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 ); } // Admin Interface >> Admin Menu Organizer if ( 'settings_page_admin-menu-organizer' == $current_screen->base ) { // 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 ); wp_enqueue_style( 'asenha-admin-menu-organizer', ASENHA_URL . 'assets/css/admin-menu-organizer.css', array(), ASENHA_VERSION ); wp_enqueue_script( 'asenha-admin-menu-organizer', ASENHA_URL . 'assets/js/admin-menu-organizer.js', array('asenha-custom-admin-menu'), ASENHA_VERSION, false ); wp_localize_script( 'asenha-admin-menu-organizer', 'amoPageVars', array( 'saveMenuNonce' => wp_create_nonce( 'save-menu-nonce' ), 'resetMenuNonce' => wp_create_nonce( 'reset-menu-nonce' ), ) ); } // Utilities >> Email Delivery Log if ( 'tools_page_email-delivery-log' == $hook_suffix ) { wp_enqueue_style( 'jquery-ui-css', ASENHA_URL . 'assets/premium/css/jquery-ui/jquery-ui.min.css' ); wp_enqueue_style( 'asenha-email-delivery-log', ASENHA_URL . 'assets/premium/css/email-delivery-log.css' ); wp_enqueue_script( 'jquery-ui' ); // wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_script( 'jquery-ui-tabs' ); wp_enqueue_script( 'asenha-email-delivery-log', ASENHA_URL . 'assets/premium/js/email-delivery-log.js' ); $nonce = wp_create_nonce( 'email-delivery-log' . get_current_user_id() ); wp_localize_script( 'asenha-email-delivery-log', 'emailLog', array( 'nonce' => $nonce, ) ); } // 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' ); } } // Code Snippets Manager if ( 'post' == $current_screen->base && 'asenha_code_snippet' == $current_screen->id || 'edit' == $current_screen->base && 'edit-asenha_code_snippet' == $current_screen->id ) { } // 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 ); } } } $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $hide_promo_nudge = false; $is_yearend_promo_period = is_yearend_promo_period(); // Pass on ASENHA stats to admin-page.js to determine whether to show support nudge $current_date = date( 'Y-m-d', time() ); $show_support_nudge = false; $asenha_stats_localized = array( 'firstSaveDate' => '', 'lastSaveDate' => '', 'saveCount' => 0, 'hideUpgradeNudge' => false, 'hidePromoNudge' => false, 'showSupportNudge' => false, ); if ( !empty( $asenha_stats ) ) { $hide_upgrade_nudge = ( isset( $asenha_stats['upgrade_nudge_dismissed'] ) ? $asenha_stats['upgrade_nudge_dismissed'] : false ); $hide_promo_nudge = ( isset( $asenha_stats['promo_nudge_dismissed'] ) ? $asenha_stats['promo_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, false ); } } else { if ( $save_count_modulo == 0 ) { $support_nudge_last_shown_save_count = ( isset( $asenha_stats['support_nudge_last_shown_save_count'] ) ? $asenha_stats['support_nudge_last_shown_save_count'] : 0 ); if ( $save_count > $support_nudge_last_shown_save_count ) { $asenha_stats['support_nudge_dismissed'] = false; update_option( ASENHA_SLUG_U . '_stats', $asenha_stats, false ); $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, 'isYearEndPromoPeriod' => $is_yearend_promo_period, 'hideUpgradeNudge' => $hide_upgrade_nudge, 'hidePromoNudge' => $hide_promo_nudge, 'showSupportNudge' => $show_support_nudge, ); } wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized ); } /** * Inline CSS for Admin Menu Organizer in all wp-admin pages. Previously loaded externally as part of wp-admin.css file * * @since 7.6.11 */ function asenha_admin_menu_organizer_css() { ?> $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 ) && current_user_can( 'manage_options' ) ) { if ( wp_verify_nonce( sanitize_text_field( $_REQUEST['nonce'] ), 'asenha-' . get_current_user_id() ) ) { $current_date = date( 'Y-m-d', time() ); $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['upgrade_nudge_dismissed'] = true; $asenha_stats['upgrade_nudge_dismissed_date'] = $current_date; $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats, false ); if ( $success ) { echo json_encode( array( 'success' => true, ) ); } else { echo json_encode( array( 'success' => false, ) ); } } } } /** * Dismiss promo nudge * * @since 7.5.1 */ function asenha_dismiss_promo_nudge() { if ( isset( $_REQUEST ) && current_user_can( 'manage_options' ) ) { if ( wp_verify_nonce( sanitize_text_field( $_REQUEST['nonce'] ), 'asenha-' . get_current_user_id() ) ) { $current_date = date( 'Y-m-d', time() ); $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['promo_nudge_dismissed'] = true; $asenha_stats['promo_nudge_dismissed_date'] = $current_date; $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats, false ); 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 ) && current_user_can( 'manage_options' ) ) { if ( wp_verify_nonce( sanitize_text_field( $_REQUEST['nonce'] ), 'asenha-' . get_current_user_id() ) ) { $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() ); $asenha_stats['support_nudge_dismissed'] = true; $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats, false ); if ( $success ) { echo json_encode( array( 'success' => true, ) ); } else { echo json_encode( array( 'success' => false, ) ); } } } }