PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 6.5.1
Admin and Site Enhancements (ASE) v6.5.1
9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 8.3.2 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0 8.6.1 8.6.2 8.7.0 5.0.1 5.0.2 5.0.2.1 5.0.2.2 5.0.2.3 5.0.2.4 5.1.0 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.8.0 5.8.1 6.0.0 6.0.3 6.0.4 6.0.5 6.0.5.1 6.0.6 6.0.7 6.0.8.1 6.1.0 6.1.3 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.3.0 6.3.1 6.3.2 6.4.0 6.5.0 6.5.1 6.6.0 6.7.0 6.8.0 6.8.2 6.8.3 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13.1 6.9.13.2 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.2 7.0.2.1 7.0.2.2 7.0.2.3 7.0.3 7.1.0 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2.0 7.2.1 7.3.0 7.3.1 7.3.2 7.3.3 7.4.0 7.4.2 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.6.0 7.6.1 7.6.1.1 7.6.10 7.6.11 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.7.1 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / settings.php
admin-site-enhancements Last commit date
assets 2 years ago classes 2 years ago includes 2 years ago vendor 2 years ago LICENSE.md 2 years ago README.md 2 years ago admin-site-enhancements.php 2 years ago bootstrap.php 2 years ago functions.php 2 years ago settings.php 2 years ago
settings.php
1084 lines
1 <?php
2
3 /**
4 * Initialize options. [TODO] Move this into activation class at v7.
5 *
6 * @since 6.4.1
7 */
8 if ( false === get_option( ASENHA_SLUG_U ) ) {
9 add_option( ASENHA_SLUG_U, array() );
10 }
11 if ( false === get_option( ASENHA_SLUG_U . '_stats' ) ) {
12 add_option( ASENHA_SLUG_U . '_stats', array() );
13 }
14 if ( false === get_option( ASENHA_SLUG_U . '_extra' ) ) {
15 add_option( ASENHA_SLUG_U . '_extra', array() );
16 }
17 /**
18 * Register admin menu
19 *
20 * @since 1.0.0
21 */
22 function asenha_register_admin_menu()
23 {
24 add_submenu_page(
25 'tools.php',
26 // Parent page/menu
27 'Admin and Site Enhancements',
28 // Browser tab/window title
29 'Enhancements',
30 // Sube menu title
31 'manage_options',
32 // Minimal user capabililty
33 ASENHA_SLUG,
34 // Page slug. Shows up in URL.
35 'asenha_add_settings_page'
36 );
37 }
38
39 /**
40 * Create the settings page of the plugin
41 *
42 * @since 1.0.0
43 */
44 function asenha_add_settings_page()
45 {
46 ?>
47 <div class="wrap asenha">
48
49 <div id="asenha-header" class="asenha-header">
50 <div class="asenha-header-left">
51 <img src="<?php
52 echo ASENHA_URL . 'assets/img/ase_icon.png' ;
53 ?>" class="asenha-icon"/>
54 <h1 class="asenha-heading">
55 <?php
56 echo get_admin_page_title() ;
57 ?>
58 (ASE)
59 <?php
60 ?>
61 </h1>
62 <!-- <a href="https://wordpress.org/plugins/admin-site-enhancements/" target="_blank" class="asenha-header-action"><span>&#8505;</span> <?php
63 // esc_html_e( 'Info', 'admin-site-enhancements' );
64 ?></a> -->
65 </div>
66 <div class="asenha-header-right">
67 <?php
68 // https://icon-sets.iconify.design/iconamoon/star-bold/
69 $svg_star = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="2.5" d="m12 2l3.104 6.728l7.358.873l-5.44 5.03l1.444 7.268L12 18.28L5.534 21.9l1.444-7.268L1.538 9.6l7.359-.873L12 2Z"/></svg>';
70 // https://icon-sets.iconify.design/octicon/question-16/
71 $svg_support = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="currentColor" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 0 0 0-13ZM6.92 6.085h.001a.749.749 0 1 1-1.342-.67c.169-.339.436-.701.849-.977C6.845 4.16 7.369 4 8 4a2.756 2.756 0 0 1 1.637.525c.503.377.863.965.863 1.725c0 .448-.115.83-.329 1.15c-.205.307-.47.513-.692.662c-.109.072-.22.138-.313.195l-.006.004a6.24 6.24 0 0 0-.26.16a.952.952 0 0 0-.276.245a.75.75 0 0 1-1.248-.832c.184-.264.42-.489.692-.661c.103-.067.207-.132.313-.195l.007-.004c.1-.061.182-.11.258-.161a.969.969 0 0 0 .277-.245C8.96 6.514 9 6.427 9 6.25a.612.612 0 0 0-.262-.525A1.27 1.27 0 0 0 8 5.5c-.369 0-.595.09-.74.187a1.01 1.01 0 0 0-.34.398ZM9 11a1 1 0 1 1-2 0a1 1 0 0 1 2 0Z"/></svg>';
72 // https://icon-sets.iconify.design/octicon/comment-16/
73 $svg_feedback = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 16 16"><path fill="currentColor" d="M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg>';
74 // https://icon-sets.iconify.design/iconamoon/file-document/
75 $svg_docs = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="2"><path stroke-linecap="round" d="M7 21a2 2 0 0 1-2-2V3h9l5 5v11a2 2 0 0 1-2 2H7Z"/><path d="M13 3v6h6"/><path stroke-linecap="round" d="M9 13h6m-6 4h6"/></g></svg>';
76 // https://icon-sets.iconify.design/pajamas/heart/
77 $svg_sponsor = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M8.753 2.247L8 3l-.753-.753A4.243 4.243 0 0 0 1.25 8.25l5.69 5.69L8 15l1.06-1.06l5.69-5.69a4.243 4.243 0 0 0-5.997-6.003ZM8 12.879l5.69-5.69a2.743 2.743 0 0 0-3.877-3.881l-.752.753L8 5.12L6.94 4.06l-.753-.752v-.001A2.743 2.743 0 0 0 2.31 7.189L8 12.88Z" clip-rule="evenodd"/></svg>';
78 ?>
79 <a href="https://wordpress.org/plugins/admin-site-enhancements/#reviews" target="_blank" class="asenha-header-action review"><?php
80 echo $svg_star . esc_html( 'Review', 'admin-site-enhancements' ) ;
81 ?></a>
82 <a href="https://wordpress.org/support/plugin/admin-site-enhancements/" target="_blank" class="asenha-header-action feedback"><?php
83 echo $svg_feedback . esc_html( 'Feedback', 'admin-site-enhancements' ) ;
84 ?></a>
85 <!--<a href="https://www.wpasenha.com/docs/" target="_blank" class="asenha-header-action docs"><?php
86 // echo $svg_docs . esc_html( 'Docs', 'admin-site-enhancements' );
87 ?></a>-->
88 <!--<a id="plugin-sponsor" href="#" class="asenha-header-action sponsor"><?php
89 // echo $svg_sponsor . esc_html( 'Sponsor', 'admin-site-enhancements' );
90 ?></a>-->
91 <a href="https://www.wpase.com/upgrade-btn" target="_blank" id="plugin-upgrade" class="button button-primary plugin-upgrade">Get ASE Pro</a>
92 <?php
93 ?>
94 <a class="button button-primary asenha-save-button">Save Changes</a>
95 <!-- https://icon-sets.iconify.design/svg-spinners/180-ring-with-bg/ -->
96 <div class="asenha-saving-changes" style="display:none;"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#2271b1" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"/><path fill="#2271b1" d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"><animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></svg></div>
97 <div class="asenha-changes-saved" style="display:none;"><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24"><path fill="seagreen" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zM9.29 16.29L5.7 12.7a.996.996 0 1 1 1.41-1.41L10 14.17l6.88-6.88a.996.996 0 1 1 1.41 1.41l-7.59 7.59a.996.996 0 0 1-1.41 0z"/></svg></div>
98 </div>
99 </div>
100
101 <div class="asenha-body">
102 <?php
103 ?>
104 <div class="asenha-upgrade-nudge" style="display: none;">
105 <div class="asenha-upgrade-nudge__message">The Pro version of ASE is here! Lifetime Deal (LTD) available.</div>
106 <a href="https://www.wpase.com/upgrade-ndg" class="button asenha-upgrade-nudge__button" target="_blank">Find Out More</a>
107 <a href="#" id="dismiss-upgrade-nudge" class="asenha-upgrade-nudge__dismiss">
108 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="currentColor" d="M24 2.4L21.6 0L12 9.6L2.4 0L0 2.4L9.6 12L0 21.6L2.4 24l9.6-9.6l9.6 9.6l2.4-2.4l-9.6-9.6z"/></svg>
109 </a>
110 </div>
111 <div class="asenha-sponsorship-nudge nudge-show-more is-enabled" style="display: none;">
112 <h3>Looks like some of these free enhancements have been useful for your site?</h3>
113 <p class="nudge-description intro">Please consider supporting ASE.</p>
114 <a id="sponsorship-nudge-show-moreless" class="nudge-show-more-less show-more-less show-more" href="#">Find Out How </a>
115 <div class="nudge-wrapper-show-more">
116 <?php
117 // Quotes on sponsorship
118 $sponsorship_quotes = array(
119 '"A very very useful plugin. I have made a little sponsorship and encourage other users to do the same as it is so much deserved. Thank you Bowo!" ~<a href="https://wordpress.org/support/topic/very-very-useful-54/" target="_blank">@pgrand83</a>',
120 '"Please consider supporting it if you use it on multiple sites / it saves you a lot of time, we as a community need to keep good devs like this and gems like this plugin alive." ~<a href="https://wordpress.org/support/topic/you-need-this-19/" target="_blank">@kiikiikii</a>',
121 '"Tried it and was blown away with all the options! How is this free? I will sponsor you because this is simply... [insert your favorite superlative here]" ~<a href="https://wordpress.org/support/topic/installed-on-all-my-sites-3/" target="_blank">@mgjaltema</a>',
122 '"This replaces so many plugins and snippets! Support the developer (reviews, donations etc.)" ~<a href="https://wordpress.org/support/topic/this-relpaces-many-plugins-and-snippets/" target="_blank">Max Ziebell</a>',
123 '"Not only free, but worth a donation. This plugins does so many little things that there\'s bound to be a bunch that will make your life easier." ~<a href="https://wordpress.org/support/topic/not-only-free-but-worth-a-donation/" target="_blank">Darryl</a>',
124 '"Replaced 6 plugins with this. Very easy plugin and great support. Found a bug and was fixed in hours!" ~<a href="https://wordpress.org/support/topic/replaced-6-plugins-with-this/" target="_blank">@dagaloni</a>',
125 '"Amazing plugin that has replaced at least 10 plugins for me. Lightweight, clean and easy to use. The developer is also very helpful and responsive." ~<a href="https://wordpress.org/support/topic/replaced-atleast-10-plugins-for-me/" target="_blank">@sk209</a>',
126 '"Very handy plugin by a great dev. Reported a bug yesterday, it was fixed today. Can’t ask for better than that." ~<a href="https://wordpress.org/support/topic/very-handy-plugin-by-a-great-dev/" target="_blank">Greg Mount</a>',
127 '"Excellent and very well-supported plugin. I had a small issue, posted a support comment, and the developer had things sorted in a couple of days with a patch upgrade." ~<a href="https://wordpress.org/support/topic/excellent-and-very-well-supported-plugin-saves-me-a-lot-of-work/" target="_blank">@grizdev</a>',
128 '"Bowo is awesome! Thanks to his great plugin my WP backend UI is cleaned up and organized, and I was able to uninstall other plugins too. Super useful, really recommended!" ~<a href="https://wordpress.org/support/topic/love-that-plugin-2/" target="_blank">@adminmax</a>',
129 '"A very useful plugin that also has great support. Amazing that this plugin is free too. Great work and thanks to the author." ~<a href="https://wordpress.org/support/topic/very-helpful-1357/" target="_blank">@tomo55555</a>',
130 '"Great plugin! I will definitely support it’s development because I know it will save me time and frustration on all of the websites I set up." ~<a href="https://wordpress.org/support/topic/great-plugin-clear-useful-and-a-joy-to-use/" target="_blank">@toddneufeld</a>',
131 '"Love the work you’ve done with this plugin! Incredibly powerful and well organized. It’s a real accomplishment to put this many features into a plugin and still make it easy to navigate." ~<a href="https://wordpress.org/support/topic/holy-cow-this-is-excellent/" target="_blank">Nathan Ingram</a>',
132 '"I must express gratitude to the author for the exceptional effort invested in developing this plugin... it nearly aligns entirely with the options I typically apply to each website." ~<a href="https://wordpress.org/support/topic/excellent-features-selection/" target="_blank">@cvladan</a>',
133 '"The support is awesome – I had an issue which I was able to pin down with the creator. Very fast response time, polite conversation and successful in the end 🙂. Fully recommended!" ~<a href="https://wordpress.org/support/topic/simple-yet-powerful-103/" target="_blank">@gulpman</a>',
134 '"I\'ve started installing this plugin as part of my \'standard\' set up. It is continually improving and seems very stable and reliable. I have made 6 installations so far and I am very impressed. Thanks Bowo." ~<a href="https://wordpress.org/support/topic/excellent-plugin-8681/" target="_blank">@jacalakie</a>',
135 '"I\'ve been looking for something like this for a long time. The developer is also very friendly and helpful. Highly recommended!" ~<a href="https://wordpress.org/support/topic/must-have-684/" target="_blank">@jdudi</a>',
136 '"A must have plugin for most sites, So many useful features. along with a great developer who is open to suggestions." ~<a href="https://wordpress.org/support/topic/amazing-plugin-2443/" target="_blank">@akgt</a>',
137 '"Great plugin and awesome developer!" ~<a href="https://wordpress.org/support/topic/awesome-9998/" target="_blank">@mrgy05</a>',
138 '"This one plug-in has replaced at the very least four other plug-ins I was using regularly. I can’t thank you enough for your work. Amazing job!" ~<a href="https://wordpress.org/support/topic/amazing-work-63/" target="_blank">@tbutcher</a>',
139 '"Technical support? Unbelievable, one problem and quick response with immediate solution. It has become one of my essential plugins. Just amazing!" ~<a href="https://wordpress.org/support/topic/there-are-no-words-just-amazing/" target="_blank">@samirhp</a>',
140 '"I just can’t believe I’ll be able to start using this single plugin instead of all the separate ones... what a relief! Thanks man for this great plugin, it’s like you’ve read my mind 🙂" ~<a href="https://wordpress.org/support/topic/amazing-how-many-separate-plugins-this-replaces/" target="_blank">@yudayuda</a>',
141 '"Awesome plugin! What a time saver and workflow improvements. Having all these setting in one place, one plugin. Replaces many free and paid for plugins." ~<a href="https://wordpress.org/support/topic/awesome-plugin-replaces-so-many-other-plugins/" target="_blank">@greggwatson</a>',
142 '"This plugin has quickly become my go-to solution for all my projects. It\'s a game-changer, saving me valuable time and sparing me the frustration of dealing with bloated plugins. " ~<a href="https://wordpress.org/support/topic/must-have-plugin-for-every-website-2/" target="_blank">Aronu</a>'
143 );
144 $random_sponsorship_quote = $sponsorship_quotes[rand( 0, count( $sponsorship_quotes ) - 1 )];
145 // Quotes on general support
146 $support_quotes = array(
147 '“Simply the best! Still looking for the sixth star for you. Don’t stop developing… We are supporting you!“ ~<a href="https://wordpress.org/support/topic/too-good-to-be-true-22/" target="_blank">@springbreak</a>',
148 '"Amazing job – premium functions in free plugin. Everything is clear, fast, consistent and lightweight. Best possible rating." ~<a href="https://wordpress.org/support/topic/amazing-job-premium-functions-in-free-plugin/" target="_blank">@pijag</a>',
149 '"Really grateful and impressed at the pace of development and adding new features including some I have suggested, so feedback is really worthwhile." ~<a href="https://wordpress.org/support/topic/fantastic-plugin-replacing-many-other-plugins/" target="_blank">Dale Reardon</a>',
150 '"Greatest plugin ever. All in one solution to most of my problems. Thank you very much." ~<a href="https://wordpress.org/support/topic/greatest-plugin-ever-11/" target="_blank">@angelaustr</a>',
151 '"It’s worth 10 stars (or more). This plugin eliminates the need to install many other plugins and also makes functions.php smaller since I have to insert fewer code snippets." ~<a href="https://wordpress.org/support/topic/its-worth-10-stars-or-more/" target="_blank">Angelika Reisiger</a>',
152 '"This plugin is a real Swiss Army knife... combines multiple plugins and is still lightweight. Also Bowo, the developer, is friendly and replies quite quickly!" ~<a href="https://wordpress.org/support/topic/amazing-3728/" target="_blank">@olpo24</a>',
153 '"Great job! Saved me lots of time to add lots of plugins to get ready for my work. It’s a relief to have everything streamlined and ready to go." ~<a href="https://wordpress.org/support/topic/super-2817/" target="_blank">Tao Sheng</a>',
154 '"Very powerful tool. With this plugin, I can remove tons of plugins to reduce the possibility of plugin conflicts." ~<a href="https://wordpress.org/support/topic/very-powerful-tool-13/" target="_blank">@chiehliniceday</a>',
155 '"Very useful! Great compilation of settings and options. It had quickly become one of my essential plugins." ~<a href="https://wordpress.org/support/topic/very-useful-3276/" target="_blank">@unapersona</a>',
156 '"This plugin easily replaces a dozen or more plugins I install on every website project... and support has been wonderful and responsive. Highly recommended!" ~<a href="https://wordpress.org/support/topic/amazing-must-have-plugin-2/" target="_blank">@netzzjd</a>',
157 '"I love that the whole plugin is smaller in file-size than some of the plugins that it replaces, which do only one of these things. Thank you for the great work!" ~<a href="https://wordpress.org/support/topic/very-useful-swiss-army-knife/" target="_blank">@dvaer</a>',
158 '"This is a great plugin, it replaces many single purpose plugins which bloat up the site and the admin area. Great idea, good work!" ~<a href="https://wordpress.org/support/topic/replaces-a-lot-of-single-purpose-plugins/" target="_blank">@tageins</a>',
159 '"Probably the best WP swiss army knife I’ve ever come across... Has noticeably improved performance on many of my sites. Keep up the great work!" ~<a href="https://wordpress.org/support/topic/im-replacing-so-many-plugins-with-this/" target="_blank">@instadesign</a>',
160 '"ASE’s enhanced admin dashboard, improved site performance, and robust security features have truly transformed our website management." ~<a href="https://wordpress.org/support/topic/this-has-reduced-my-plugin-list-by-6-7/" target="_blank">@tomhung</a>',
161 '"I love your plugin! All this needed functionality in one place is very helpful and saves me from writing (pasting) a lot of custom code every time." ~<a href="https://wordpress.org/support/topic/lifesaver-this-saves-so-much-time-and-custom-coding/" target="_blank">@prosite</a>',
162 '"Amazingly good... you can easily replace several plugins with this easy-to-use one. It’s well thought out and offers features I didn’t even realize I needed." ~<a href="https://wordpress.org/support/topic/amazingly-good-8/" target="_blank">@brenteades</a>',
163 '"Favorite!!! It has replaced several plugins I had in the past. This has become one of the first plugins I install." ~<a href="https://wordpress.org/support/topic/favorite-11/" target="_blank">@cck23</a>',
164 '"ASE has been a game-changer for us... we were able to remove numerous duplicate plugins, reducing clutter and improving efficiency." ~<a href="https://wordpress.org/support/topic/this-has-reduced-my-plugin-list-by-6-7/" target="_blank">@tomhung</a>',
165 '"This plugin is amazing. It replaces so many plugins and still removes bloat. For efficiency, security, flexibility and speed, it doesn’t get better." ~<a href="https://wordpress.org/support/topic/covers-all-manner-of-wp-sins/" target="_blank">Mary C. Dunford</a>',
166 '"This plugin is what I have been waiting for to see for years! It has so many useful options that previously you needed to google to find snippets for and it was hard to keep track of all of them." ~<a href="https://wordpress.org/support/topic/amazing-swiss-army-tool-for-wordpress/" target="_blank">@alexgraphicd</a>',
167 '"I’m already in love with this plugin... it will make my WP-life a lot easier 🙂" ~<a href="https://wordpress.org/support/topic/im-allready-in-love-with-this-plugin/" target="_blank">@medieskolen</a>',
168 '"This plugin allows you to install and maintain one plugin instead of a host of smaller ones. My tests were all successful and I was happy to simplify my maintenance with fewer plugins." ~<a href="https://wordpress.org/support/topic/replaced-4-plugins-worked-well-a/" target="_blank">Vic Drover</a>',
169 '"So many useful features it blows my mind, as well as enabling me to ditch so many other plugins." ~<a href="https://wordpress.org/support/topic/amazing-plugin-2441/" target="_blank">@simonclay</a>',
170 '"One of those plugins that feels like it should be part of the core, lots of useful features without the bloat." ~<a href="https://wordpress.org/support/topic/great-contribution-5/" target="_blank">@mohobook</a>',
171 '"One of the best and feature-rich plugins to add simple functions without using all sorts of separate plugins." ~<a href="https://wordpress.org/support/topic/amazing-all-purpose-plugin/" target="_blank">@toineenzo</a>'
172 );
173 $random_support_quote = $support_quotes[rand( 0, count( $support_quotes ) - 1 )];
174 $share_quotes = array(
175 '"Will recommend to everyone! A nice plugin, which will grow and become the best plugin ever made!!" ~<a href="https://wordpress.org/support/topic/will-recommend-to-everyone/" target="_blank">@simonvinther</a>',
176 '"It’s very honorable that you created this intentionally to give back to the WP community! I’ll be sure to share this plugin with all the freelance WP-builders at my shared office space!" ~<a href="https://wordpress.org/support/topic/installed-on-all-my-sites-3/" target="_blank">@mgjaltema</a>',
177 '"Simple and gold. This plugin so awesome and it should be known by more people." ~<a href="https://wordpress.org/support/topic/simple-and-gold/" target="_blank">Julian Song</a>',
178 '"ASE is a must-have plugin for anyone looking to optimize their WordPress site and streamline their workflow." ~<a href="https://wordpress.org/support/topic/this-has-reduced-my-plugin-list-by-6-7/" target="_blank">@tomhung</a>',
179 '"Admin Site Enhancements has made my list of \'must install\' plug-ins, since it makes so many other tasks much easier." ~<a href="https://wordpress.org/support/topic/excellent-and-very-well-supported-plugin-saves-me-a-lot-of-work/" target="_blank">@grizdev</a>',
180 '"I was super skeptical that this plugin could do so much without any problems, but i was wrong... 100% recommended!" ~<a href="https://wordpress.org/support/topic/the-all-in-one-plugin-you-need-in-your-arsenal/" target="_blank">@scarlywebs</a>',
181 '"The selection of tools... nearly aligns entirely with the options I typically apply to each website. This plugin is commendable." ~<a href="https://wordpress.org/support/topic/excellent-features-selection/" target="_blank">@cvladan</a>',
182 '"This plugin is amazing. So much useful functionality packed in. This is now a must-use plugin in my development stack. Thank you! ~<a href="https://wordpress.org/support/topic/amazing-now-part-of-my-must-use-dev-stack/" target="_blank">@phillcoxon</a>"',
183 '"Very good, must use plugin, that makes life easier for everyone." ~<a href="https://wordpress.org/support/topic/very-good-6977/" target="_blank">@alexeerma</a>',
184 '"Must-have plugin for every website. It\'s a game-changer." ~<a href="https://wordpress.org/support/topic/must-have-plugin-for-every-website-2/" target="_blank">Aronu</a>',
185 '"This plugin has quickly become my go-to solution for all my projects." ~<a href="https://wordpress.org/support/topic/must-have-plugin-for-every-website-2/" target="_blank">Aronu</a>',
186 '"Awesome plugin, it\'s an all in one solution!" ~<a href="https://wordpress.org/support/topic/everything-in-one-place-3/" target="_blank">@gabikod</a>',
187 '"This is one of the best utility plugins that eliminates the need to use multiple plugins. It has become a standard plugin used in my WP site blueprint." ~<a href="https://wordpress.org/support/topic/must-have-wp-utility-tool/" target="_blank">Ken Sim</a>',
188 '"Necessary plugin to every WordPress site." ~<a href="https://wordpress.org/support/topic/its-a-very-useful-plugin/" target="_blank">@ntamas</a>',
189 '"ASE is a highly recommended plugin for anyone looking to improve the functionality and usability of their WordPress site" ~<a href="https://wordpress.org/support/topic/amazing-plugin-in-place-of-multiple-plugins/" target="_blank">Ayyaz Ahmad</a>'
190 );
191 $random_share_quote = $share_quotes[rand( 0, count( $share_quotes ) - 1 )];
192 ?>
193 <div class="nudge-quotes">
194 <div class="user-quote"><?php
195 echo $random_sponsorship_quote ;
196 ?></div>
197 <div class="user-quote"><?php
198 echo $random_support_quote ;
199 ?></div>
200 </div>
201 <div class="nudge-content">
202 <div class="nudge-primary">
203 <h4>Sponsor ASE from as little as USD 1, monthly or one-time</h4>
204 <div class="nudge-info">
205 <p class="nudge-description">Please consider sponsoring ASE's ongoing development and maintenance so it can remain functional and useful for years to come. Thank you!</p>
206 </div>
207 <div class="nudge-ctas">
208 <a href="https://bowo.io/asenha-sp-gth-ndg" class="button button-primary sponsorship-button monthly" target="_blank">Sponsor Monthly</a>
209 <a href="https://bowo.io/asenha-sp-ppl-ndg" class="button sponsorship-button one-time" target="_blank">Sponsor One-Time</a>
210 <a href="#" id="have-sponsored" class="asenha-have-sponsored">I've sponsored ASE</a>
211 </div>
212 <div class="nudge-stats">
213 <p class="nudge-description">This free version of ASE has consumed more than <a href="https://wordpress.org/plugins/admin-site-enhancements/#developers" target="_blank">250 hours of dev time</a>. At v6.5.1 (released on January 29, 2024) and 30,000+ active installs, there have been <a href="https://bowo.io/asenha-sp-gth-ndg" target="_blank">6 monthly sponsors</a> and <a href="https://bowo.io/asenha-sp-ppl-ndg" target="_blank">57 one-time sponsors</a>. You can be one today!</p>
214 </div>
215 </div>
216 <div class="nudge-secondary">
217 <h4>Give ASE your 5-star review or provide detailed feedback</h4>
218 <p class="nudge-description">If financial sponsorship is not something you can provide at the moment, you can always <a href="https://wordpress.org/plugins/admin-site-enhancements/#reviews" target="_blank">add a quick, 5-star review</a>.</p>
219 <p class="nudge-description">Or, if you find something is lacking or not working as you expect it to, you can provide a good and detailed <a href="https://wordpress.org/support/plugin/admin-site-enhancements/" target="_blank">feature request or feedback</a>, which is much more appreciated than a 4-star review or less. This is how we can work together to improve ASE.</p>
220 </div>
221 </div>
222 <div class="user-quote share-quote"><?php
223 echo $random_share_quote ;
224 ?></div>
225 <p class="nudge-description">Do <a href="https://wordpress.org/plugins/admin-site-enhancements/" target="_blank">share about ASE</a> with your colleagues and/or community.</p>
226 <a href="https://bowo.io" target="_blank" class="nudge-photo-link"><img src="<?php
227 echo esc_attr( ASENHA_URL . 'assets/img/bowo.jpg' ) ;
228 ?>" class="nudge-photo" /></a>
229 <h3>Thank you!</h3>
230 <p class="nudge-description nudge-closing">I hope you continue to benefit from ASE. ~<a href="https://bowo.io" target="_blank">Bowo</a></p>
231 <div class="dismiss-sponsorship-nudge"><a id="sponsorship-nudge-show-less" href="#">Show less</a> &bull; <a href="#" id="sponsorship-nudge-dismiss" class="asenha-sponsorship-nudge-dismiss">Dismiss</a></div>
232 </div>
233 </div>
234 <?php
235 ?>
236 <form action="options.php" method="post">
237 <div class="asenha-vertical-tabs">
238 <div class="asenha-tab-buttons">
239 <?php
240 // https://icon-sets.iconify.design/mdi/database-check-outline/ -- db check
241 // https://icon-sets.iconify.design/mdi/file-document-box-multiple-outline/ -- docs
242 // https://icon-sets.iconify.design/fluent/content-view-28-regular/ -- content
243 // https://icon-sets.iconify.design/lucide/shapes/ -- shapes
244 $icon_content_management = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect width="7" height="7" x="3" y="14" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/></g></svg>';
245 // https://icon-sets.iconify.design/mingcute/layout-line/
246 $icon_admin_interface = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z"/><path fill="currentColor" d="M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm16 0H5v3h14V5ZM5 19v-9h4v9H5Zm6 0h8v-9h-8v9Z"/></g></svg>';
247 // https://icon-sets.iconify.design/ri/login-circle-line/
248 $icon_login_logout = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="m10.998 16l5-4l-5-4v3h-9v2h9z"/><path fill="currentColor" d="M12.999 2.999a8.938 8.938 0 0 0-6.364 2.637L8.049 7.05c1.322-1.322 3.08-2.051 4.95-2.051s3.628.729 4.95 2.051S20 10.13 20 12s-.729 3.628-2.051 4.95s-3.08 2.051-4.95 2.051s-3.628-.729-4.95-2.051l-1.414 1.414c1.699 1.7 3.959 2.637 6.364 2.637s4.665-.937 6.364-2.637C21.063 16.665 22 14.405 22 12s-.937-4.665-2.637-6.364a8.938 8.938 0 0 0-6.364-2.637z"/></svg>';
249 // https://icon-sets.iconify.design/mingcute/code-line/
250 $icon_custom_code = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M14.486 3.143a1 1 0 0 1 .692 1.233l-4.43 15.788a1 1 0 0 1-1.926-.54l4.43-15.788a1 1 0 0 1 1.234-.693ZM7.207 7.05a1 1 0 0 1 0 1.414L3.672 12l3.535 3.535a1 1 0 1 1-1.414 1.415L1.55 12.707a1 1 0 0 1 0-1.414L5.793 7.05a1 1 0 0 1 1.414 0Zm9.586 1.414a1 1 0 1 1 1.414-1.414l4.243 4.243a1 1 0 0 1 0 1.414l-4.243 4.242a1 1 0 0 1-1.414-1.414L20.328 12l-3.535-3.536Z"/></g></svg>';
251 // https://icon-sets.iconify.design/mdi/forbid/
252 $icon_disable_components = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2m0 2c-1.9 0-3.6.6-4.9 1.7l11.2 11.2c1-1.4 1.7-3.1 1.7-4.9c0-4.4-3.6-8-8-8m4.9 14.3L5.7 7.1C4.6 8.4 4 10.1 4 12c0 4.4 3.6 8 8 8c1.9 0 3.6-.6 4.9-1.7Z"/></svg>';
253 // https://icon-sets.iconify.design/jam/shield-check/
254 $icon_security = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m8 1.75l5.25 2v5c0 2.25-2 4.5-5.25 5.5c-3.25-1-5.25-3-5.25-5.5v-5z"/><path d="m5.75 7.75l1.5 1.5l3-3.5"/></g></svg>';
255 // https://icon-sets.iconify.design/streamline/image-flash-1-flash-power-connect-charge-electricity-lightning/
256 $icon_optimizations = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M4.25.5L2 5.81a.5.5 0 0 0 .46.69h2.79l-2 7l8.59-8.14a.5.5 0 0 0-.34-.86H7.75l2-4Z"/></svg>';
257 // https://icon-sets.iconify.design/iconoir/tools/
258 $icon_utilities = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m10.05 10.607l-7.07 7.07a2 2 0 0 0 0 2.83v0a2 2 0 0 0 2.828 0l7.07-7.072m4.315.365l3.878 3.878a2 2 0 0 1 0 2.828v0a2 2 0 0 1-2.828 0l-6.209-6.208M6.733 5.904L4.61 6.61L2.49 3.075l1.414-1.414L7.44 3.782l-.707 2.122Zm0 0l2.83 2.83"/><path d="M10.05 10.607c-.844-2.153-.679-4.978 1.061-6.718c1.74-1.74 4.95-2.121 6.717-1.06l-3.04 3.04l-.283 3.111l3.111-.282l3.04-3.041c1.062 1.768.68 4.978-1.06 6.717c-1.74 1.74-4.564 1.905-6.717 1.061"/></g></svg>';
259 ?>
260 <input id="tab-content-management" type="radio" name="tabs" checked><label for="tab-content-management"><?php
261 echo $icon_content_management ;
262 ?>Content Management</label>
263 <input id="tab-admin-interface" type="radio" name="tabs"><label for="tab-admin-interface"><?php
264 echo $icon_admin_interface ;
265 ?>Admin Interface</label>
266 <input id="tab-login-logout" type="radio" name="tabs"><label for="tab-login-logout"><?php
267 echo $icon_login_logout ;
268 ?>Log In | Log Out</label>
269 <input id="tab-custom-code" type="radio" name="tabs"><label for="tab-custom-code"><?php
270 echo $icon_custom_code ;
271 ?>Custom Code</label>
272 <input id="tab-disable-components" type="radio" name="tabs"><label for="tab-disable-components"><?php
273 echo $icon_disable_components ;
274 ?>Disable Components</label>
275 <input id="tab-security" type="radio" name="tabs"><label for="tab-security"><?php
276 echo $icon_security ;
277 ?>Security</label>
278 <input id="tab-optimizations" type="radio" name="tabs"><label for="tab-optimizations"><?php
279 echo $icon_optimizations ;
280 ?>Optimizations</label>
281 <input id="tab-utilities" type="radio" name="tabs"><label for="tab-utilities"><?php
282 echo $icon_utilities ;
283 ?>Utilities</label>
284 </div>
285 <div class="asenha-tab-contents">
286 <section class="asenha-fields fields-content-management">
287 <table class="form-table" role="presentation">
288 <tbody></tbody>
289 </table>
290 </section>
291 <section class="asenha-fields fields-admin-interface">
292 <table class="form-table" role="presentation">
293 <tbody></tbody>
294 </table>
295 </section>
296 <section class="asenha-fields fields-login-logout">
297 <table class="form-table" role="presentation">
298 <tbody></tbody>
299 </table>
300 </section>
301 <section class="asenha-fields fields-custom-code">
302 <table class="form-table" role="presentation">
303 <tbody></tbody>
304 </table>
305 </section>
306 <section class="asenha-fields fields-disable-components">
307 <table class="form-table" role="presentation">
308 <tbody></tbody>
309 </table>
310 </section>
311 <section class="asenha-fields fields-security">
312 <table class="form-table" role="presentation">
313 <tbody></tbody>
314 </table>
315 </section>
316 <section class="asenha-fields fields-optimizations">
317 <table class="form-table" role="presentation">
318 <tbody></tbody>
319 </table>
320 </section>
321 <section class="asenha-fields fields-utilities">
322 <table class="form-table" role="presentation">
323 <tbody></tbody>
324 </table>
325 </section>
326 </div>
327 </div>
328 <div style="display:none;"><!-- Hide to prevent flash of fields appearing at the bottom of the page -->
329 <?php
330 settings_fields( ASENHA_ID );
331 ?>
332 <?php
333 do_settings_sections( ASENHA_SLUG );
334 ?>
335 <?php
336 submit_button(
337 'Save Changes',
338 // Button copy
339 'primary',
340 // Type: 'primary', 'small', or 'large'
341 'submit',
342 // The 'name' attribute
343 true,
344 // Whether to wrap in <p> tag
345 array(
346 'id' => 'asenha-submit',
347 )
348 );
349 ?>
350 </div>
351 </form>
352 <?php
353 ?>
354 <div id="bottom-upgrade-nudge" class="asenha-upgrade-nudge-bottom" style="display:none;">
355 <div class="asenha-upgrade-nudge-bottom__message">Do more with <a href="https://www.wpase.com/upgrade-ndg-btm" target="_blank">ASE Pro</a>. Lifetime deal (LTD) <a href="https://www.wpase.com/upgrade-ndg-btm-prc" target="_blank">available</a>.</div>
356 </div>
357 <?php
358 ?>
359 </div>
360
361 <?php
362 ?>
363
364 </div>
365 <?php
366 // Record the number of times changes were saved as well as the date of last save
367 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
368 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
369
370 if ( $changes_saved ) {
371 $current_date = date( 'Y-m-d', time() );
372
373 if ( !isset( $asenha_stats['first_save_date'] ) ) {
374 $asenha_stats['first_save_date'] = $current_date;
375 $asenha_stats['last_save_date'] = $current_date;
376 $asenha_stats['save_count'] = 1;
377 $asenha_stats['have_sponsored'] = false;
378 $asenha_stats['sponsorship_nudge_dismissed'] = false;
379 $asenha_stats['sponsorship_nudge_last_shown_date'] = '';
380 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = 0;
381 } else {
382 $asenha_stats['last_save_date'] = $current_date;
383 $save_count = $asenha_stats['save_count'];
384 $save_count++;
385 $asenha_stats['save_count'] = $save_count;
386 }
387
388 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
389 }
390
391 }
392
393 /**
394 * Suppress all notices, then add notice for successful settings update
395 *
396 * @since 1.1.0
397 */
398 function asenha_suppress_add_notices()
399 {
400 global $plugin_page ;
401 // Suppress all notices
402 if ( ASENHA_SLUG === $plugin_page ) {
403 remove_all_actions( 'admin_notices' );
404 }
405 // Add notice for successful settings update
406 if ( isset( $_GET['page'] ) && ASENHA_SLUG == $_GET['page'] && isset( $_GET['settings-updated'] ) && true == $_GET['settings-updated'] ) {
407 ?>
408 <script>
409 jQuery(document).ready( function() {
410 jQuery('.asenha-changes-saved').fadeIn(400).delay(2500).fadeOut(400);
411 });
412 </script>
413
414 <?php
415 }
416 }
417
418 /**
419 * Suppress all generic notices on the plugin settings page
420 *
421 * @since 2.7.0
422 */
423 function asenha_suppress_generic_notices()
424 {
425 global $plugin_page ;
426 // Suppress all notices
427 if ( ASENHA_SLUG === $plugin_page ) {
428 remove_all_actions( 'all_admin_notices' );
429 }
430 }
431
432 /**
433 * Enqueue admin scripts
434 *
435 * @since 1.0.0
436 */
437 function asenha_admin_scripts( $hook_suffix )
438 {
439 global
440 $wp_version,
441 $pagenow,
442 $typenow,
443 $taxnow,
444 $hook_suffix,
445 $current_user
446 ;
447 $current_screen = get_current_screen();
448 // Get all WP Enhancements options, default to empty array in case it's not been created yet
449 $options = get_option( 'admin_site_enhancements', array() );
450 // For main page of this plugin
451
452 if ( is_asenha() ) {
453 wp_enqueue_style(
454 'asenha-jbox',
455 ASENHA_URL . 'assets/css/jBox.all.min.css',
456 array(),
457 ASENHA_VERSION
458 );
459 wp_enqueue_script(
460 'asenha-jbox',
461 ASENHA_URL . 'assets/js/jBox.all.min.js',
462 array(),
463 ASENHA_VERSION,
464 false
465 );
466 wp_enqueue_script(
467 'asenha-jsticky',
468 ASENHA_URL . 'assets/js/jquery.jsticky.mod.min.js',
469 array( 'jquery' ),
470 ASENHA_VERSION,
471 false
472 );
473 wp_enqueue_script(
474 'asenha-js-cookie',
475 ASENHA_URL . 'assets/js/js.cookie.min.js',
476 array(),
477 ASENHA_VERSION,
478 false
479 );
480 // jQuery UI Sortables. In use, e.g. for Admin Interface >> Admin Menu Organizer
481 // Re-register and re-enqueue jQuery UI Core and plugins required for sortable, draggable and droppable when ordering menu items
482 wp_deregister_script( 'jquery-ui-core' );
483 wp_register_script(
484 'jquery-ui-core',
485 get_site_url() . '/wp-includes/js/jquery/ui/core.min.js',
486 array( 'jquery' ),
487 ASENHA_VERSION,
488 false
489 );
490 wp_enqueue_script( 'jquery-ui-core' );
491
492 if ( version_compare( $wp_version, '5.6.0', '>=' ) ) {
493 wp_deregister_script( 'jquery-ui-mouse' );
494 wp_register_script(
495 'jquery-ui-mouse',
496 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
497 array( 'jquery-ui-core' ),
498 ASENHA_VERSION,
499 false
500 );
501 wp_enqueue_script( 'jquery-ui-mouse' );
502 } else {
503 wp_deregister_script( 'jquery-ui-widget' );
504 wp_register_script(
505 'jquery-ui-widget',
506 get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js',
507 array( 'jquery' ),
508 ASENHA_VERSION,
509 false
510 );
511 wp_enqueue_script( 'jquery-ui-widget' );
512 wp_deregister_script( 'jquery-ui-mouse' );
513 wp_register_script(
514 'jquery-ui-mouse',
515 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
516 array( 'jquery-ui-core', 'jquery-ui-widget' ),
517 ASENHA_VERSION,
518 false
519 );
520 wp_enqueue_script( 'jquery-ui-mouse' );
521 }
522
523 wp_deregister_script( 'jquery-ui-sortable' );
524 wp_register_script(
525 'jquery-ui-sortable',
526 get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js',
527 array( 'jquery-ui-mouse' ),
528 ASENHA_VERSION,
529 false
530 );
531 wp_enqueue_script( 'jquery-ui-sortable' );
532 wp_deregister_script( 'jquery-ui-draggable' );
533 wp_register_script(
534 'jquery-ui-draggable',
535 get_site_url() . '/wp-includes/js/jquery/ui/draggable.min.js',
536 array( 'jquery-ui-mouse' ),
537 ASENHA_VERSION,
538 false
539 );
540 wp_enqueue_script( 'jquery-ui-draggable' );
541 wp_deregister_script( 'jquery-ui-droppable' );
542 wp_register_script(
543 'jquery-ui-droppable',
544 get_site_url() . '/wp-includes/js/jquery/ui/droppable.min.js',
545 array( 'jquery-ui-draggable' ),
546 ASENHA_VERSION,
547 false
548 );
549 wp_enqueue_script( 'jquery-ui-droppable' );
550 // Script to set behaviour and actions of the sortable menu
551 wp_enqueue_script(
552 'asenha-custom-admin-menu',
553 ASENHA_URL . 'assets/js/custom-admin-menu.js',
554 array( 'jquery-ui-draggable' ),
555 ASENHA_VERSION,
556 false
557 );
558 // First, we unload the CodeMirror libraries included in WP core
559 wp_deregister_script( 'wp-codemirror' );
560 wp_deregister_script( 'code-editor' );
561 wp_deregister_script( 'htmlhint' );
562 wp_deregister_script( 'csslint' );
563 wp_deregister_script( 'esprima' );
564 wp_deregister_script( 'jshint' );
565 // Then, we load ASENHA's CodeMirror libraries. In use, e.g. for Utilities >> Enable Custom Admin / Frontend CSS / ads.txt / app-ads.txt
566 wp_enqueue_style(
567 'asenha-codemirror',
568 ASENHA_URL . 'assets/css/codemirror/codemirror.min.css',
569 array(),
570 ASENHA_VERSION
571 );
572 wp_enqueue_script(
573 'asenha-codemirror',
574 ASENHA_URL . 'assets/js/codemirror/codemirror.min.js',
575 array( 'jquery' ),
576 ASENHA_VERSION,
577 true
578 );
579 wp_enqueue_script(
580 'asenha-codemirror-htmlmixed-mode',
581 ASENHA_URL . 'assets/js/codemirror/htmlmixed.js',
582 array( 'asenha-codemirror' ),
583 ASENHA_VERSION,
584 true
585 );
586 wp_enqueue_script(
587 'asenha-codemirror-xml-mode',
588 ASENHA_URL . 'assets/js/codemirror/xml.js',
589 array( 'asenha-codemirror' ),
590 ASENHA_VERSION,
591 true
592 );
593 wp_enqueue_script(
594 'asenha-codemirror-javascript-mode',
595 ASENHA_URL . 'assets/js/codemirror/javascript.js',
596 array( 'asenha-codemirror' ),
597 ASENHA_VERSION,
598 true
599 );
600 wp_enqueue_script(
601 'asenha-codemirror-css-mode',
602 ASENHA_URL . 'assets/js/codemirror/css.js',
603 array( 'asenha-codemirror' ),
604 ASENHA_VERSION,
605 true
606 );
607 wp_enqueue_script(
608 'asenha-codemirror-markdown-mode',
609 ASENHA_URL . 'assets/js/codemirror/markdown.js',
610 array( 'asenha-codemirror' ),
611 ASENHA_VERSION,
612 true
613 );
614 // DataTables. In use, e.g. for Security >> Limit Login Attempts
615 wp_enqueue_style(
616 'asenha-datatables',
617 ASENHA_URL . 'assets/css/datatables/datatables.min.css',
618 array(),
619 ASENHA_VERSION
620 );
621 wp_enqueue_script(
622 'asenha-datatables',
623 ASENHA_URL . 'assets/js/datatables/datatables.min.js',
624 array( 'jquery' ),
625 ASENHA_VERSION,
626 false
627 );
628 // Add WP media library assets
629 wp_enqueue_media();
630 // Add WP color picker assets
631 wp_enqueue_style( 'wp-color-picker' );
632 wp_enqueue_script( 'wp-color-picker' );
633 // Main style and script for the admin page
634 wp_enqueue_style(
635 'asenha-admin-page',
636 ASENHA_URL . 'assets/css/admin-page.css',
637 array(
638 'asenha-jbox',
639 'asenha-codemirror',
640 'asenha-datatables',
641 'wp-color-picker'
642 ),
643 ASENHA_VERSION
644 );
645 wp_enqueue_script(
646 'asenha-admin-page',
647 ASENHA_URL . 'assets/js/admin-page.js',
648 array(
649 'asenha-jsticky',
650 'asenha-jbox',
651 'asenha-js-cookie',
652 'asenha-codemirror-htmlmixed-mode',
653 'asenha-codemirror-xml-mode',
654 'asenha-codemirror-javascript-mode',
655 'asenha-codemirror-css-mode',
656 'asenha-codemirror-markdown-mode',
657 'asenha-datatables',
658 'asenha-custom-admin-menu',
659 'wp-color-picker'
660 ),
661 ASENHA_VERSION,
662 false
663 );
664 wp_localize_script( 'asenha-admin-page', 'adminPageVars', array(
665 'mediaFrameTitle' => 'Select an Image',
666 'mediaFrameButtonText' => 'Use Selected Image',
667 'resetMenuNonce' => wp_create_nonce( 'reset-menu-nonce' ),
668 ) );
669 }
670
671 // Enqueue on all wp-admin
672 wp_enqueue_style(
673 'asenha-wp-admin',
674 ASENHA_URL . 'assets/css/wp-admin.css',
675 array(),
676 ASENHA_VERSION
677 );
678 // Content Management >> Show IDs, for list tables in wp-admin, e.g. All Posts page
679 if ( false !== strpos( $current_screen->base, 'edit' ) || false !== strpos( $current_screen->base, 'users' ) || false !== strpos( $current_screen->base, 'upload' ) ) {
680 wp_enqueue_style(
681 'asenha-list-table',
682 ASENHA_URL . 'assets/css/list-table.css',
683 array(),
684 ASENHA_VERSION
685 );
686 }
687 // Content Management >> Enable Media Replacement
688
689 if ( $current_screen->base == 'upload' || $current_screen->id == 'attachment' ) {
690 // wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION );
691 // wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false );
692 wp_enqueue_style(
693 'asenha-media-replace',
694 ASENHA_URL . 'assets/css/media-replace.css',
695 array(),
696 ASENHA_VERSION
697 );
698 wp_enqueue_script(
699 'asenha-media-replace',
700 ASENHA_URL . 'assets/js/media-replace.js',
701 array(),
702 ASENHA_VERSION,
703 false
704 );
705 }
706
707 // Utilities >> Image Sizes Panel
708
709 if ( 'post' == $current_screen->base && 'attachment' == $current_screen->id ) {
710 global $post ;
711 // Only enqueue if the attachment is an image
712 if ( property_exists( $post, 'post_mime_type' ) && false !== strpos( $post->post_mime_type, 'image' ) ) {
713 wp_enqueue_style( 'asenha-image-sizes-panel', ASENHA_URL . 'assets/css/image-sizes-panel.css' );
714 }
715 }
716
717 // Content Management >> Hide Admin Notices
718
719 if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) {
720 $hide_for_nonadmins = ( isset( $options['hide_admin_notices_for_nonadmins'] ) ? $options['hide_admin_notices_for_nonadmins'] : false );
721
722 if ( $hide_for_nonadmins && bwasenha_fs()->can_use_premium_code__premium_only() ) {
723 $minimum_capability = 'read';
724 } else {
725 $minimum_capability = 'manage_options';
726 }
727
728
729 if ( current_user_can( $minimum_capability ) ) {
730 wp_enqueue_style(
731 'asenha-jbox',
732 ASENHA_URL . 'assets/css/jBox.all.min.css',
733 array(),
734 ASENHA_VERSION
735 );
736 wp_enqueue_script(
737 'asenha-jbox',
738 ASENHA_URL . 'assets/js/jBox.all.min.js',
739 array(),
740 ASENHA_VERSION,
741 false
742 );
743 wp_enqueue_style(
744 'asenha-hide-admin-notices',
745 ASENHA_URL . 'assets/css/hide-admin-notices.css',
746 array(),
747 ASENHA_VERSION
748 );
749 wp_enqueue_script(
750 'asenha-hide-admin-notices',
751 ASENHA_URL . 'assets/js/hide-admin-notices.js',
752 array( 'asenha-jbox' ),
753 ASENHA_VERSION,
754 false
755 );
756 }
757
758 }
759
760 // Utilities >> Multiple User Roles
761 if ( array_key_exists( 'multiple_user_roles', $options ) && $options['multiple_user_roles'] ) {
762 if ( 'user-edit.php' == $hook_suffix || 'user-new.php' == $hook_suffix ) {
763 // Only replace roles dropdown with checkboxes for users that can assign roles to other users, e.g. administrators
764 if ( current_user_can( 'promote_users', get_current_user_id() ) ) {
765 wp_enqueue_script(
766 'asenha-multiple-user-roles',
767 ASENHA_URL . 'assets/js/multiple-user-roles.js',
768 array( 'jquery' ),
769 ASENHA_VERSION,
770 false
771 );
772 }
773 }
774 }
775 // Pass on ASENHA stats to admin-page.js to determine whether to show sponsorship nudge
776 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
777 $current_date = date( 'Y-m-d', time() );
778 $show_sponsorship_nudge = false;
779 $hide_upgrade_nudge = false;
780 $asenha_stats_localized = array(
781 'firstSaveDate' => '',
782 'lastSaveDate' => '',
783 'saveCount' => 0,
784 'hideUpgradeNudge' => false,
785 'showSponsorshipNudge' => false,
786 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
787 );
788
789 if ( !empty($asenha_stats) ) {
790 $hide_upgrade_nudge = ( isset( $asenha_stats['upgrade_nudge_dismissed'] ) ? $asenha_stats['upgrade_nudge_dismissed'] : false );
791 $have_sponsored = ( isset( $asenha_stats['have_sponsored'] ) ? $asenha_stats['have_sponsored'] : false );
792 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
793 $save_count = ( isset( $asenha_stats['save_count'] ) ? $asenha_stats['save_count'] : 0 );
794 // Compensate for redirect from settings-updated=true URL
795
796 if ( $changes_saved ) {
797 $save_count = $save_count + 1;
798 } else {
799 $save_count = $save_count;
800 }
801
802 $saves_to_nudge_sponsorship = 10;
803
804 if ( $save_count < $saves_to_nudge_sponsorship ) {
805 $save_count_modulo = -1;
806 } else {
807 $save_count_modulo = $save_count % $saves_to_nudge_sponsorship;
808 }
809
810 // User have not sponsored ASE
811 if ( false === $have_sponsored ) {
812 // Sponsorship nudge have not been dismissed
813
814 if ( false === $asenha_stats['sponsorship_nudge_dismissed'] ) {
815 // Show sponsorship nudge after every x saves
816
817 if ( $save_count_modulo >= 0 ) {
818 $show_sponsorship_nudge = true;
819 } else {
820 $show_sponsorship_nudge = false;
821 }
822
823
824 if ( $show_sponsorship_nudge && $save_count_modulo >= 0 ) {
825 $asenha_stats['sponsorship_nudge_last_shown_date'] = $current_date;
826 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = $save_count;
827 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
828 }
829
830 } else {
831
832 if ( $save_count_modulo == 0 ) {
833
834 if ( $save_count > $asenha_stats['sponsorship_nudge_last_shown_save_count'] ) {
835 $asenha_stats['sponsorship_nudge_dismissed'] = false;
836 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
837 $show_sponsorship_nudge = true;
838 } else {
839 $show_sponsorship_nudge = false;
840 }
841
842 } else {
843 $show_sponsorship_nudge = false;
844 }
845
846 }
847
848 }
849 $first_save_date = ( isset( $asenha_stats['first_save_date'] ) ? $asenha_stats['first_save_date'] : '' );
850 $last_save_date = ( isset( $asenha_stats['last_save_date'] ) ? $asenha_stats['last_save_date'] : '' );
851 $asenha_stats_localized = array(
852 'firstSaveDate' => $first_save_date,
853 'lastSaveDate' => $last_save_date,
854 'saveCount' => $save_count,
855 'hideUpgradeNudge' => $hide_upgrade_nudge,
856 'showSponsorshipNudge' => $show_sponsorship_nudge,
857 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
858 );
859 }
860
861 wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized );
862 }
863
864 /**
865 * Dequeue scripts that prevents ASE settings page from working properly. Usually from plugins.
866 *
867 * @since 6.3.3
868 */
869 function asenha_dequeue_scritps()
870 {
871 // https://wordpress.org/plugins/user-activity-log/
872 wp_dequeue_script( 'chats-js' );
873 wp_dequeue_script( 'custom_wp_admin_js' );
874 // https://wordpress.org/plugins/print-invoices-packing-slip-labels-for-woocommerce/
875 wp_dequeue_script( 'print-invoices-packing-slip-labels-for-woocommerce' );
876 wp_dequeue_script( 'print-invoices-packing-slip-labels-for-woocommerce-form-wizard' );
877 }
878
879 /**
880 * Enqueue public scripts
881 *
882 * @since 3.9.0
883 */
884 function asenha_public_scripts( $hook_suffix )
885 {
886 // Get all WP Enhancements options, default to empty array in case it's not been created yet
887 $options = get_option( 'admin_site_enhancements', array() );
888 // External Permalinks
889 $enable_external_permalinks = ( array_key_exists( 'enable_external_permalinks', $options ) ? $options['enable_external_permalinks'] : false );
890
891 if ( $enable_external_permalinks ) {
892 wp_enqueue_script(
893 'asenha-public',
894 ASENHA_URL . 'assets/js/external-permalinks.js',
895 array(),
896 ASENHA_VERSION,
897 false
898 );
899 wp_localize_script( 'asenha-public', 'phpVars', array(
900 'externalPermalinksEnabled' => $enable_external_permalinks,
901 ) );
902 }
903
904 // Media Categories
905 $enable_media_categories = ( array_key_exists( 'enable_media_categories', $options ) ? $options['enable_media_categories'] : false );
906 if ( $enable_media_categories && !is_admin() && is_user_logged_in() ) {
907 wp_enqueue_style(
908 'asenha-media-categories-frontend',
909 ASENHA_URL . 'assets/css/media-categories-frontend.css',
910 array(),
911 ASENHA_VERSION
912 );
913 }
914 // Media Replacement
915 $enable_media_replacement = ( array_key_exists( 'enable_media_replacement', $options ) ? $options['enable_media_replacement'] : false );
916 if ( $enable_media_replacement && is_user_logged_in() ) {
917 wp_enqueue_style(
918 'asenha-media-replace-frontend',
919 ASENHA_URL . 'assets/css/media-replace-frontend.css',
920 array(),
921 ASENHA_VERSION
922 );
923 }
924 }
925
926 /**
927 * Add admin bar styles for wp-admin and frontend
928 *
929 * @since 6.2.1
930 */
931 function asenha_admin_bar_item_js_css()
932 {
933 if ( is_user_logged_in() ) {
934 ?>
935 <!--<script></script>-->
936 <style>
937 #wp-admin-bar-user-info .avatar {
938 object-fit: cover;
939 }
940 </style>
941 <?php
942 }
943 }
944
945 /**
946 * Add 'Access now' plugin action link.
947 *
948 * @since 1.0.0
949 */
950 function asenha_plugin_action_links( $links )
951 {
952 $settings_link = '<a href="tools.php?page=' . ASENHA_SLUG . '">Configure</a>';
953 array_unshift( $links, $settings_link );
954 return $links;
955 }
956
957 /**
958 * Modify footer text
959 *
960 * @since 1.0.0
961 */
962 function asenha_footer_text()
963 {
964 // Show nothing
965 ?>
966 <?php
967 }
968
969 /**
970 * Change WP version number text in footer
971 *
972 * @since 4.8.3
973 */
974 function asenha_footer_version_text()
975 {
976 ?>
977 ASE <a href="https://www.wpase.com/documentation/changelog/" target="_blank">v<?php
978 echo ASENHA_VERSION ;
979 ?></a>
980 <?php
981 }
982
983 /**
984 * Check if current screen is this plugin's main page
985 *
986 * @since 1.0.0
987 */
988 function is_asenha()
989 {
990 $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
991 // e.g. /wp-admin/index.php?page=page-slug
992
993 if ( strpos( $request_uri, 'page=' . ASENHA_SLUG ) !== false ) {
994 return true;
995 // Yes, this is the plugin's main page
996 } else {
997 return false;
998 // Nope, this is NOT the plugin's page
999 }
1000
1001 }
1002
1003 /**
1004 * Mark that user have sponsored ASE
1005 *
1006 * @since 5.2.7
1007 */
1008 function asenha_have_sponsored()
1009 {
1010
1011 if ( isset( $_REQUEST ) ) {
1012 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
1013 $asenha_stats['have_sponsored'] = true;
1014 $asenha_stats['sponsorship_nudge_dismissed'] = true;
1015 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
1016
1017 if ( $success ) {
1018 echo json_encode( array(
1019 'success' => true,
1020 ) ) ;
1021 } else {
1022 echo json_encode( array(
1023 'success' => false,
1024 ) ) ;
1025 }
1026
1027 }
1028
1029 }
1030
1031 /**
1032 * Dismiss sponsorship nudge
1033 *
1034 * @since 5.8.2
1035 */
1036 function asenha_dismiss_upgrade_nudge()
1037 {
1038
1039 if ( isset( $_REQUEST ) ) {
1040 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
1041 $asenha_stats['upgrade_nudge_dismissed'] = true;
1042 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
1043
1044 if ( $success ) {
1045 echo json_encode( array(
1046 'success' => true,
1047 ) ) ;
1048 } else {
1049 echo json_encode( array(
1050 'success' => false,
1051 ) ) ;
1052 }
1053
1054 }
1055
1056 }
1057
1058 /**
1059 * Dismiss sponsorship nudge
1060 *
1061 * @since 5.2.7
1062 */
1063 function asenha_dismiss_sponsorship_nudge()
1064 {
1065
1066 if ( isset( $_REQUEST ) ) {
1067 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
1068 $asenha_stats['sponsorship_nudge_dismissed'] = true;
1069 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
1070
1071 if ( $success ) {
1072 echo json_encode( array(
1073 'success' => true,
1074 ) ) ;
1075 } else {
1076 echo json_encode( array(
1077 'success' => false,
1078 ) ) ;
1079 }
1080
1081 }
1082
1083 }
1084