PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 6.1.0
Admin and Site Enhancements (ASE) v6.1.0
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
997 lines
1 <?php
2
3 /**
4 * Register admin menu
5 *
6 * @since 1.0.0
7 */
8 function asenha_register_admin_menu()
9 {
10 add_submenu_page(
11 'tools.php',
12 // Parent page/menu
13 'Admin and Site Enhancements',
14 // Browser tab/window title
15 'Enhancements',
16 // Sube menu title
17 'manage_options',
18 // Minimal user capabililty
19 ASENHA_SLUG,
20 // Page slug. Shows up in URL.
21 'asenha_add_settings_page'
22 );
23 }
24
25 /**
26 * Create the settings page of the plugin
27 *
28 * @since 1.0.0
29 */
30 function asenha_add_settings_page()
31 {
32 ?>
33 <div class="wrap asenha">
34
35 <div id="asenha-header" class="asenha-header">
36 <div class="asenha-header-left">
37 <img src="<?php
38 echo ASENHA_URL . 'assets/img/ase_icon.png' ;
39 ?>" class="asenha-icon"/>
40 <h1 class="asenha-heading">
41 <?php
42 echo get_admin_page_title() ;
43 ?>
44 (ASE)
45 <?php
46 ?>
47 </h1>
48 <!-- <a href="https://wordpress.org/plugins/admin-site-enhancements/" target="_blank" class="asenha-header-action"><span>&#8505;</span> <?php
49 // esc_html_e( 'Info', 'admin-site-enhancements' );
50 ?></a> -->
51 </div>
52 <div class="asenha-header-right">
53 <?php
54 // https://icon-sets.iconify.design/iconamoon/star-bold/
55 $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>';
56 // https://icon-sets.iconify.design/octicon/question-16/
57 $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>';
58 // https://icon-sets.iconify.design/octicon/comment-16/
59 $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>';
60 // https://icon-sets.iconify.design/iconamoon/file-document/
61 $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>';
62 // https://icon-sets.iconify.design/pajamas/heart/
63 $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>';
64 ?>
65 <a href="https://wordpress.org/plugins/admin-site-enhancements/#reviews" target="_blank" class="asenha-header-action review"><?php
66 echo $svg_star . esc_html( 'Review', 'admin-site-enhancements' ) ;
67 ?></a>
68 <a href="https://wordpress.org/support/plugin/admin-site-enhancements/" target="_blank" class="asenha-header-action feedback"><?php
69 echo $svg_feedback . esc_html( 'Feedback', 'admin-site-enhancements' ) ;
70 ?></a>
71 <!--<a href="https://www.wpasenha.com/docs/" target="_blank" class="asenha-header-action docs"><?php
72 // echo $svg_docs . esc_html( 'Docs', 'admin-site-enhancements' );
73 ?></a>-->
74 <!--<a id="plugin-sponsor" href="#" class="asenha-header-action sponsor"><?php
75 // echo $svg_sponsor . esc_html( 'Sponsor', 'admin-site-enhancements' );
76 ?></a>-->
77 <a href="https://www.wpase.com/upgrade-btn" target="_blank" id="plugin-upgrade" class="button button-primary plugin-upgrade">Get ASE Pro</a>
78 <?php
79 ?>
80 <a class="button button-primary asenha-save-button">Save Changes</a>
81 <!-- https://icon-sets.iconify.design/svg-spinners/180-ring-with-bg/ -->
82 <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>
83 <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>
84 </div>
85 </div>
86
87 <div class="asenha-body">
88 <?php
89 ?>
90 <div class="asenha-upgrade-nudge" style="display: none;">
91 <div class="asenha-upgrade-nudge__message">The Pro version of ASE is here! Lifetime Deal (LTD) available.</div>
92 <a href="https://www.wpase.com/upgrade-ndg" class="button asenha-upgrade-nudge__button" target="_blank">Find Out More</a>
93 <a href="#" id="dismiss-upgrade-nudge" class="asenha-upgrade-nudge__dismiss">
94 <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>
95 </a>
96 </div>
97 <div class="asenha-sponsorship-nudge nudge-show-more is-enabled" style="display: none;">
98 <h3>Looks like some of these free enhancements have been useful for your site?</h3>
99 <p class="nudge-description intro">Please consider supporting ASE.</p>
100 <a id="sponsorship-nudge-show-moreless" class="nudge-show-more-less show-more-less show-more" href="#">Find Out How </a>
101 <div class="nudge-wrapper-show-more">
102 <?php
103 // Quotes on sponsorship
104 $sponsorship_quotes = array(
105 '"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>',
106 '"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>',
107 '"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>',
108 '"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>',
109 '"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>',
110 '"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>',
111 '"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>',
112 '"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>',
113 '"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>',
114 '"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>',
115 '"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>',
116 '"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>',
117 '"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>',
118 '"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>',
119 '"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>',
120 '"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>',
121 '"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>',
122 '"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>',
123 '"Great plugin and awesome developer!" ~<a href="https://wordpress.org/support/topic/awesome-9998/" target="_blank">@mrgy05</a>',
124 '"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>',
125 '"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>',
126 '"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>',
127 '"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>',
128 '"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>'
129 );
130 $random_sponsorship_quote = $sponsorship_quotes[rand( 0, count( $sponsorship_quotes ) - 1 )];
131 // Quotes on general support
132 $support_quotes = array(
133 '“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>',
134 '"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>',
135 '"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>',
136 '"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>',
137 '"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>',
138 '"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>',
139 '"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>',
140 '"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>',
141 '"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>',
142 '"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>',
143 '"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>',
144 '"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>',
145 '"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>',
146 '"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>',
147 '"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>',
148 '"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>',
149 '"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>',
150 '"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>',
151 '"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>',
152 '"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>',
153 '"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>',
154 '"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>',
155 '"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>',
156 '"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>',
157 '"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>'
158 );
159 $random_support_quote = $support_quotes[rand( 0, count( $support_quotes ) - 1 )];
160 $share_quotes = array(
161 '"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>',
162 '"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>',
163 '"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>',
164 '"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>',
165 '"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>',
166 '"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>',
167 '"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>',
168 '"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>"',
169 '"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>',
170 '"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>',
171 '"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>',
172 '"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>',
173 '"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>',
174 '"Necessary plugin to every WordPress site." ~<a href="https://wordpress.org/support/topic/its-a-very-useful-plugin/" target="_blank">@ntamas</a>',
175 '"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>'
176 );
177 $random_share_quote = $share_quotes[rand( 0, count( $share_quotes ) - 1 )];
178 ?>
179 <div class="nudge-quotes">
180 <div class="user-quote"><?php
181 echo $random_sponsorship_quote ;
182 ?></div>
183 <div class="user-quote"><?php
184 echo $random_support_quote ;
185 ?></div>
186 </div>
187 <div class="nudge-content">
188 <div class="nudge-primary">
189 <h4>Sponsor ASE from as little as USD 1, monthly or one-time</h4>
190 <div class="nudge-info">
191 <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>
192 </div>
193 <div class="nudge-ctas">
194 <a href="https://bowo.io/asenha-sp-gth-ndg" class="button button-primary sponsorship-button monthly" target="_blank">Sponsor Monthly</a>
195 <a href="https://bowo.io/asenha-sp-ppl-ndg" class="button sponsorship-button one-time" target="_blank">Sponsor One-Time</a>
196 <a href="#" id="have-sponsored" class="asenha-have-sponsored">I've sponsored ASE</a>
197 </div>
198 <div class="nudge-stats">
199 <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.1.0 (released on November 17, 2023) and 10,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">54 one-time sponsors</a>. You can be one today!</p>
200 </div>
201 </div>
202 <div class="nudge-secondary">
203 <h4>Give ASE your 5-star review or provide detailed feedback</h4>
204 <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>
205 <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>
206 </div>
207 </div>
208 <div class="user-quote share-quote"><?php
209 echo $random_share_quote ;
210 ?></div>
211 <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>
212 <a href="https://bowo.io" target="_blank" class="nudge-photo-link"><img src="<?php
213 echo esc_attr( ASENHA_URL . 'assets/img/bowo.jpg' ) ;
214 ?>" class="nudge-photo" /></a>
215 <h3>Thank you!</h3>
216 <p class="nudge-description nudge-closing">I hope you continue to benefit from ASE. ~<a href="https://bowo.io" target="_blank">Bowo</a></p>
217 <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>
218 </div>
219 </div>
220 <?php
221 ?>
222 <form action="options.php" method="post">
223 <div class="asenha-vertical-tabs">
224 <div class="asenha-tab-buttons">
225 <?php
226 // https://icon-sets.iconify.design/mdi/database-check-outline/ -- db check
227 // https://icon-sets.iconify.design/mdi/file-document-box-multiple-outline/ -- docs
228 // https://icon-sets.iconify.design/fluent/content-view-28-regular/ -- content
229 // https://icon-sets.iconify.design/lucide/shapes/ -- shapes
230 $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>';
231 // https://icon-sets.iconify.design/mingcute/layout-line/
232 $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>';
233 // https://icon-sets.iconify.design/ri/login-circle-line/
234 $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>';
235 // https://icon-sets.iconify.design/mingcute/code-line/
236 $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>';
237 // https://icon-sets.iconify.design/mdi/forbid/
238 $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>';
239 // https://icon-sets.iconify.design/jam/shield-check/
240 $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>';
241 // https://icon-sets.iconify.design/streamline/image-flash-1-flash-power-connect-charge-electricity-lightning/
242 $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>';
243 // https://icon-sets.iconify.design/iconoir/tools/
244 $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>';
245 ?>
246 <input id="tab-content-management" type="radio" name="tabs" checked><label for="tab-content-management"><?php
247 echo $icon_content_management ;
248 ?>Content Management</label>
249 <input id="tab-admin-interface" type="radio" name="tabs"><label for="tab-admin-interface"><?php
250 echo $icon_admin_interface ;
251 ?>Admin Interface</label>
252 <input id="tab-login-logout" type="radio" name="tabs"><label for="tab-login-logout"><?php
253 echo $icon_login_logout ;
254 ?>Log In | Log Out</label>
255 <input id="tab-custom-code" type="radio" name="tabs"><label for="tab-custom-code"><?php
256 echo $icon_custom_code ;
257 ?>Custom Code</label>
258 <input id="tab-disable-components" type="radio" name="tabs"><label for="tab-disable-components"><?php
259 echo $icon_disable_components ;
260 ?>Disable Components</label>
261 <input id="tab-security" type="radio" name="tabs"><label for="tab-security"><?php
262 echo $icon_security ;
263 ?>Security</label>
264 <input id="tab-optimizations" type="radio" name="tabs"><label for="tab-optimizations"><?php
265 echo $icon_optimizations ;
266 ?>Optimizations</label>
267 <input id="tab-utilities" type="radio" name="tabs"><label for="tab-utilities"><?php
268 echo $icon_utilities ;
269 ?>Utilities</label>
270 </div>
271 <div class="asenha-tab-contents">
272 <section class="asenha-fields fields-content-management">
273 <table class="form-table" role="presentation">
274 <tbody></tbody>
275 </table>
276 </section>
277 <section class="asenha-fields fields-admin-interface">
278 <table class="form-table" role="presentation">
279 <tbody></tbody>
280 </table>
281 </section>
282 <section class="asenha-fields fields-login-logout">
283 <table class="form-table" role="presentation">
284 <tbody></tbody>
285 </table>
286 </section>
287 <section class="asenha-fields fields-custom-code">
288 <table class="form-table" role="presentation">
289 <tbody></tbody>
290 </table>
291 </section>
292 <section class="asenha-fields fields-disable-components">
293 <table class="form-table" role="presentation">
294 <tbody></tbody>
295 </table>
296 </section>
297 <section class="asenha-fields fields-security">
298 <table class="form-table" role="presentation">
299 <tbody></tbody>
300 </table>
301 </section>
302 <section class="asenha-fields fields-optimizations">
303 <table class="form-table" role="presentation">
304 <tbody></tbody>
305 </table>
306 </section>
307 <section class="asenha-fields fields-utilities">
308 <table class="form-table" role="presentation">
309 <tbody></tbody>
310 </table>
311 </section>
312 </div>
313 </div>
314 <div style="display:none;"><!-- Hide to prevent flash of fields appearing at the bottom of the page -->
315 <?php
316 settings_fields( ASENHA_ID );
317 ?>
318 <?php
319 do_settings_sections( ASENHA_SLUG );
320 ?>
321 <?php
322 submit_button(
323 'Save Changes',
324 // Button copy
325 'primary',
326 // Type: 'primary', 'small', or 'large'
327 'submit',
328 // The 'name' attribute
329 true,
330 // Whether to wrap in <p> tag
331 array(
332 'id' => 'asenha-submit',
333 )
334 );
335 ?>
336 </div>
337 </form>
338 <?php
339 ?>
340 <div id="bottom-upgrade-nudge" class="asenha-upgrade-nudge-bottom" style="display:none;">
341 <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>
342 </div>
343 <?php
344 ?>
345 </div>
346
347 <?php
348 ?>
349
350 </div>
351 <?php
352 // Record the number of times changes were saved as well as the date of last save
353 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
354 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
355
356 if ( $changes_saved ) {
357 $current_date = date( 'Y-m-d', time() );
358
359 if ( !isset( $asenha_stats['first_save_date'] ) ) {
360 $asenha_stats['first_save_date'] = $current_date;
361 $asenha_stats['last_save_date'] = $current_date;
362 $asenha_stats['save_count'] = 1;
363 $asenha_stats['have_sponsored'] = false;
364 $asenha_stats['sponsorship_nudge_dismissed'] = false;
365 $asenha_stats['sponsorship_nudge_last_shown_date'] = '';
366 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = 0;
367 } else {
368 $asenha_stats['last_save_date'] = $current_date;
369 $save_count = $asenha_stats['save_count'];
370 $save_count++;
371 $asenha_stats['save_count'] = $save_count;
372 }
373
374 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
375 }
376
377 }
378
379 /**
380 * Suppress all notices, then add notice for successful settings update
381 *
382 * @since 1.1.0
383 */
384 function asenha_suppress_add_notices()
385 {
386 global $plugin_page ;
387 // Suppress all notices
388 if ( ASENHA_SLUG === $plugin_page ) {
389 remove_all_actions( 'admin_notices' );
390 }
391 // Add notice for successful settings update
392 if ( isset( $_GET['page'] ) && ASENHA_SLUG == $_GET['page'] && isset( $_GET['settings-updated'] ) && true == $_GET['settings-updated'] ) {
393 ?>
394 <script>
395 jQuery(document).ready( function() {
396 jQuery('.asenha-changes-saved').fadeIn(400).delay(2500).fadeOut(400);
397 });
398 </script>
399
400 <?php
401 }
402 }
403
404 /**
405 * Suppress all generic notices on the plugin settings page
406 *
407 * @since 2.7.0
408 */
409 function asenha_suppress_generic_notices()
410 {
411 global $plugin_page ;
412 // Suppress all notices
413 if ( ASENHA_SLUG === $plugin_page ) {
414 remove_all_actions( 'all_admin_notices' );
415 }
416 }
417
418 /**
419 * Enqueue admin scripts
420 *
421 * @since 1.0.0
422 */
423 function asenha_admin_scripts( $hook_suffix )
424 {
425 global
426 $wp_version,
427 $pagenow,
428 $typenow,
429 $taxnow,
430 $hook_suffix
431 ;
432 $current_screen = get_current_screen();
433 // Get all WP Enhancements options, default to empty array in case it's not been created yet
434 $options = get_option( 'admin_site_enhancements', array() );
435 // For main page of this plugin
436
437 if ( is_asenha() ) {
438 wp_enqueue_style(
439 'asenha-jbox',
440 ASENHA_URL . 'assets/css/jBox.all.min.css',
441 array(),
442 ASENHA_VERSION
443 );
444 wp_enqueue_script(
445 'asenha-jbox',
446 ASENHA_URL . 'assets/js/jBox.all.min.js',
447 array(),
448 ASENHA_VERSION,
449 false
450 );
451 wp_enqueue_script(
452 'asenha-jsticky',
453 ASENHA_URL . 'assets/js/jquery.jsticky.mod.min.js',
454 array( 'jquery' ),
455 ASENHA_VERSION,
456 false
457 );
458 wp_enqueue_script(
459 'asenha-js-cookie',
460 ASENHA_URL . 'assets/js/js.cookie.min.js',
461 array(),
462 ASENHA_VERSION,
463 false
464 );
465 // jQuery UI Sortables. In use, e.g. for Admin Interface >> Admin Menu Organizer
466 // Re-register and re-enqueue jQuery UI Core and plugins required for sortable, draggable and droppable when ordering menu items
467 wp_deregister_script( 'jquery-ui-core' );
468 wp_register_script(
469 'jquery-ui-core',
470 get_site_url() . '/wp-includes/js/jquery/ui/core.min.js',
471 array( 'jquery' ),
472 ASENHA_VERSION,
473 false
474 );
475 wp_enqueue_script( 'jquery-ui-core' );
476
477 if ( version_compare( $wp_version, '5.6.0', '>=' ) ) {
478 wp_deregister_script( 'jquery-ui-mouse' );
479 wp_register_script(
480 'jquery-ui-mouse',
481 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
482 array( 'jquery-ui-core' ),
483 ASENHA_VERSION,
484 false
485 );
486 wp_enqueue_script( 'jquery-ui-mouse' );
487 } else {
488 wp_deregister_script( 'jquery-ui-widget' );
489 wp_register_script(
490 'jquery-ui-widget',
491 get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js',
492 array( 'jquery' ),
493 ASENHA_VERSION,
494 false
495 );
496 wp_enqueue_script( 'jquery-ui-widget' );
497 wp_deregister_script( 'jquery-ui-mouse' );
498 wp_register_script(
499 'jquery-ui-mouse',
500 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
501 array( 'jquery-ui-core', 'jquery-ui-widget' ),
502 ASENHA_VERSION,
503 false
504 );
505 wp_enqueue_script( 'jquery-ui-mouse' );
506 }
507
508 wp_deregister_script( 'jquery-ui-sortable' );
509 wp_register_script(
510 'jquery-ui-sortable',
511 get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js',
512 array( 'jquery-ui-mouse' ),
513 ASENHA_VERSION,
514 false
515 );
516 wp_enqueue_script( 'jquery-ui-sortable' );
517 wp_deregister_script( 'jquery-ui-draggable' );
518 wp_register_script(
519 'jquery-ui-draggable',
520 get_site_url() . '/wp-includes/js/jquery/ui/draggable.min.js',
521 array( 'jquery-ui-mouse' ),
522 ASENHA_VERSION,
523 false
524 );
525 wp_enqueue_script( 'jquery-ui-draggable' );
526 wp_deregister_script( 'jquery-ui-droppable' );
527 wp_register_script(
528 'jquery-ui-droppable',
529 get_site_url() . '/wp-includes/js/jquery/ui/droppable.min.js',
530 array( 'jquery-ui-draggable' ),
531 ASENHA_VERSION,
532 false
533 );
534 wp_enqueue_script( 'jquery-ui-droppable' );
535 // Script to set behaviour and actions of the sortable menu
536 wp_enqueue_script(
537 'asenha-custom-admin-menu',
538 ASENHA_URL . 'assets/js/custom-admin-menu.js',
539 array( 'jquery-ui-draggable' ),
540 ASENHA_VERSION,
541 false
542 );
543 // First, we unload the CodeMirror libraries included in WP core
544 wp_deregister_script( 'wp-codemirror' );
545 wp_deregister_script( 'code-editor' );
546 wp_deregister_script( 'htmlhint' );
547 wp_deregister_script( 'csslint' );
548 wp_deregister_script( 'esprima' );
549 wp_deregister_script( 'jshint' );
550 // Then, we load ASENHA's CodeMirror libraries. In use, e.g. for Utilities >> Enable Custom Admin / Frontend CSS / ads.txt / app-ads.txt
551 wp_enqueue_style(
552 'asenha-codemirror',
553 ASENHA_URL . 'assets/css/codemirror/codemirror.min.css',
554 array(),
555 ASENHA_VERSION
556 );
557 wp_enqueue_script(
558 'asenha-codemirror',
559 ASENHA_URL . 'assets/js/codemirror/codemirror.min.js',
560 array( 'jquery' ),
561 ASENHA_VERSION,
562 true
563 );
564 wp_enqueue_script(
565 'asenha-codemirror-htmlmixed-mode',
566 ASENHA_URL . 'assets/js/codemirror/htmlmixed.js',
567 array( 'asenha-codemirror' ),
568 ASENHA_VERSION,
569 true
570 );
571 wp_enqueue_script(
572 'asenha-codemirror-xml-mode',
573 ASENHA_URL . 'assets/js/codemirror/xml.js',
574 array( 'asenha-codemirror' ),
575 ASENHA_VERSION,
576 true
577 );
578 wp_enqueue_script(
579 'asenha-codemirror-javascript-mode',
580 ASENHA_URL . 'assets/js/codemirror/javascript.js',
581 array( 'asenha-codemirror' ),
582 ASENHA_VERSION,
583 true
584 );
585 wp_enqueue_script(
586 'asenha-codemirror-css-mode',
587 ASENHA_URL . 'assets/js/codemirror/css.js',
588 array( 'asenha-codemirror' ),
589 ASENHA_VERSION,
590 true
591 );
592 wp_enqueue_script(
593 'asenha-codemirror-markdown-mode',
594 ASENHA_URL . 'assets/js/codemirror/markdown.js',
595 array( 'asenha-codemirror' ),
596 ASENHA_VERSION,
597 true
598 );
599 // DataTables. In use, e.g. for Security >> Limit Login Attempts
600 wp_enqueue_style(
601 'asenha-datatables',
602 ASENHA_URL . 'assets/css/datatables/datatables.min.css',
603 array(),
604 ASENHA_VERSION
605 );
606 wp_enqueue_script(
607 'asenha-datatables',
608 ASENHA_URL . 'assets/js/datatables/datatables.min.js',
609 array( 'jquery' ),
610 ASENHA_VERSION,
611 false
612 );
613 // Main style and script for the admin page
614 wp_enqueue_style(
615 'asenha-admin-page',
616 ASENHA_URL . 'assets/css/admin-page.css',
617 array( 'asenha-jbox', 'asenha-codemirror', 'asenha-datatables' ),
618 ASENHA_VERSION
619 );
620 wp_enqueue_script(
621 'asenha-admin-page',
622 ASENHA_URL . 'assets/js/admin-page.js',
623 array(
624 'asenha-jsticky',
625 'asenha-jbox',
626 'asenha-js-cookie',
627 'asenha-codemirror-htmlmixed-mode',
628 'asenha-codemirror-xml-mode',
629 'asenha-codemirror-javascript-mode',
630 'asenha-codemirror-css-mode',
631 'asenha-codemirror-markdown-mode',
632 'asenha-datatables',
633 'asenha-custom-admin-menu'
634 ),
635 ASENHA_VERSION,
636 false
637 );
638 }
639
640 // Enqueue on all wp-admin
641 wp_enqueue_style(
642 'asenha-wp-admin',
643 ASENHA_URL . 'assets/css/wp-admin.css',
644 array(),
645 ASENHA_VERSION
646 );
647 // Content Management >> Show IDs, for list tables in wp-admin, e.g. All Posts page
648 if ( false !== strpos( $current_screen->base, 'edit' ) || false !== strpos( $current_screen->base, 'users' ) || false !== strpos( $current_screen->base, 'upload' ) ) {
649 wp_enqueue_style(
650 'asenha-list-table',
651 ASENHA_URL . 'assets/css/list-table.css',
652 array(),
653 ASENHA_VERSION
654 );
655 }
656 // Content Management >> Enable Media Replacement
657
658 if ( $current_screen->base == 'upload' || $current_screen->id == 'attachment' ) {
659 // wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION );
660 // wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false );
661 wp_enqueue_style(
662 'asenha-media-replace',
663 ASENHA_URL . 'assets/css/media-replace.css',
664 array(),
665 ASENHA_VERSION
666 );
667 wp_enqueue_script(
668 'asenha-media-replace',
669 ASENHA_URL . 'assets/js/media-replace.js',
670 array(),
671 ASENHA_VERSION,
672 false
673 );
674 }
675
676 // Content Management >> Hide Admin Notices
677 if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) {
678
679 if ( current_user_can( 'manage_options' ) ) {
680 wp_enqueue_style(
681 'asenha-jbox',
682 ASENHA_URL . 'assets/css/jBox.all.min.css',
683 array(),
684 ASENHA_VERSION
685 );
686 wp_enqueue_script(
687 'asenha-jbox',
688 ASENHA_URL . 'assets/js/jBox.all.min.js',
689 array(),
690 ASENHA_VERSION,
691 false
692 );
693 wp_enqueue_style(
694 'asenha-hide-admin-notices',
695 ASENHA_URL . 'assets/css/hide-admin-notices.css',
696 array(),
697 ASENHA_VERSION
698 );
699 wp_enqueue_script(
700 'asenha-hide-admin-notices',
701 ASENHA_URL . 'assets/js/hide-admin-notices.js',
702 array( 'asenha-jbox' ),
703 ASENHA_VERSION,
704 false
705 );
706 }
707
708 }
709 // Utilities >> Multiple User Roles
710 if ( array_key_exists( 'multiple_user_roles', $options ) && $options['multiple_user_roles'] ) {
711 if ( 'user-edit.php' == $hook_suffix || 'user-new.php' == $hook_suffix ) {
712 // Only replace roles dropdown with checkboxes for users that can assign roles to other users, e.g. administrators
713 if ( current_user_can( 'promote_users', get_current_user_id() ) ) {
714 wp_enqueue_script(
715 'asenha-multiple-user-roles',
716 ASENHA_URL . 'assets/js/multiple-user-roles.js',
717 array( 'jquery' ),
718 ASENHA_VERSION,
719 false
720 );
721 }
722 }
723 }
724 // Pass on ASENHA stats to admin-page.js to determine whether to show sponsorship nudge
725 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
726 $current_date = date( 'Y-m-d', time() );
727 $show_sponsorship_nudge = false;
728 $hide_upgrade_nudge = false;
729 $asenha_stats_localized = array(
730 'firstSaveDate' => '',
731 'lastSaveDate' => '',
732 'saveCount' => 0,
733 'hideUpgradeNudge' => false,
734 'showSponsorshipNudge' => false,
735 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
736 );
737
738 if ( !empty($asenha_stats) ) {
739 $hide_upgrade_nudge = ( isset( $asenha_stats['upgrade_nudge_dismissed'] ) ? $asenha_stats['upgrade_nudge_dismissed'] : false );
740 $have_sponsored = $asenha_stats['have_sponsored'];
741 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
742 // Compensate for redirect from settings-updated=true URL
743
744 if ( $changes_saved ) {
745 $save_count = $asenha_stats['save_count'] + 1;
746 } else {
747 $save_count = $asenha_stats['save_count'];
748 }
749
750 $saves_to_nudge_sponsorship = 10;
751
752 if ( $save_count < $saves_to_nudge_sponsorship ) {
753 $save_count_modulo = -1;
754 } else {
755 $save_count_modulo = $save_count % $saves_to_nudge_sponsorship;
756 }
757
758 // User have not sponsored ASE
759 if ( false === $have_sponsored ) {
760 // Sponsorship nudge have not been dismissed
761
762 if ( false === $asenha_stats['sponsorship_nudge_dismissed'] ) {
763 // Show sponsorship nudge after every x saves
764
765 if ( $save_count_modulo >= 0 ) {
766 $show_sponsorship_nudge = true;
767 } else {
768 $show_sponsorship_nudge = false;
769 }
770
771
772 if ( $show_sponsorship_nudge && $save_count_modulo >= 0 ) {
773 $asenha_stats['sponsorship_nudge_last_shown_date'] = $current_date;
774 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = $save_count;
775 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
776 }
777
778 } else {
779
780 if ( $save_count_modulo == 0 ) {
781
782 if ( $save_count > $asenha_stats['sponsorship_nudge_last_shown_save_count'] ) {
783 $asenha_stats['sponsorship_nudge_dismissed'] = false;
784 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
785 $show_sponsorship_nudge = true;
786 } else {
787 $show_sponsorship_nudge = false;
788 }
789
790 } else {
791 $show_sponsorship_nudge = false;
792 }
793
794 }
795
796 }
797 $asenha_stats_localized = array(
798 'firstSaveDate' => $asenha_stats['first_save_date'],
799 'lastSaveDate' => $asenha_stats['last_save_date'],
800 'saveCount' => $save_count,
801 'hideUpgradeNudge' => $hide_upgrade_nudge,
802 'showSponsorshipNudge' => $show_sponsorship_nudge,
803 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
804 );
805 }
806
807 wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized );
808 }
809
810 /**
811 * Enqueue public scripts
812 *
813 * @since 3.9.0
814 */
815 function asenha_public_scripts( $hook_suffix )
816 {
817 // Get all WP Enhancements options, default to empty array in case it's not been created yet
818 $options = get_option( 'admin_site_enhancements', array() );
819 // External Permalinks
820 $enable_external_permalinks = ( array_key_exists( 'enable_external_permalinks', $options ) ? $options['enable_external_permalinks'] : false );
821
822 if ( $enable_external_permalinks ) {
823 wp_enqueue_script(
824 'asenha-public',
825 ASENHA_URL . 'assets/js/external-permalinks.js',
826 array(),
827 ASENHA_VERSION,
828 false
829 );
830 wp_localize_script( 'asenha-public', 'phpVars', array(
831 'externalPermalinksEnabled' => $enable_external_permalinks,
832 ) );
833 }
834
835 // Media Categories
836 $enable_media_categories = ( array_key_exists( 'enable_media_categories', $options ) ? $options['enable_media_categories'] : false );
837 if ( $enable_media_categories && !is_admin() && is_user_logged_in() ) {
838 wp_enqueue_style(
839 'asenha-media-categories-frontend',
840 ASENHA_URL . 'assets/css/media-categories-frontend.css',
841 array(),
842 ASENHA_VERSION
843 );
844 }
845 // Media Replacement
846 $enable_media_replacement = ( array_key_exists( 'enable_media_replacement', $options ) ? $options['enable_media_replacement'] : false );
847 if ( $enable_media_replacement && is_user_logged_in() ) {
848 wp_enqueue_style(
849 'asenha-media-replace-frontend',
850 ASENHA_URL . 'assets/css/media-replace-frontend.css',
851 array(),
852 ASENHA_VERSION
853 );
854 }
855 }
856
857 /**
858 * Add 'Access now' plugin action link.
859 *
860 * @since 1.0.0
861 */
862 function asenha_plugin_action_links( $links )
863 {
864 $settings_link = '<a href="tools.php?page=' . ASENHA_SLUG . '">Configure now</a>';
865 array_unshift( $links, $settings_link );
866 return $links;
867 }
868
869 /**
870 * Modify footer text
871 *
872 * @since 1.0.0
873 */
874 function asenha_footer_text()
875 {
876 if ( is_asenha() ) {
877 ?>
878 <?php
879 }
880 }
881
882 /**
883 * Change WP version number text in footer
884 *
885 * @since 4.8.3
886 */
887 function asenha_footer_version_text()
888 {
889 ?>
890 ASE <a href="https://wordpress.org/plugins/admin-site-enhancements/#developers" target="_blank">v<?php
891 echo ASENHA_VERSION ;
892 ?></a>
893 <?php
894 }
895
896 /**
897 * Check if current screen is this plugin's main page
898 *
899 * @since 1.0.0
900 */
901 function is_asenha()
902 {
903 $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
904 // e.g. /wp-admin/index.php?page=page-slug
905
906 if ( strpos( $request_uri, 'page=' . ASENHA_SLUG ) !== false ) {
907 return true;
908 // Yes, this is the plugin's main page
909 } else {
910 return false;
911 // Nope, this is NOT the plugin's page
912 }
913
914 }
915
916 /**
917 * Mark that user have sponsored ASE
918 *
919 * @since 5.2.7
920 */
921 function asenha_have_sponsored()
922 {
923
924 if ( isset( $_REQUEST ) ) {
925 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
926 $asenha_stats['have_sponsored'] = true;
927 $asenha_stats['sponsorship_nudge_dismissed'] = true;
928 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
929
930 if ( $success ) {
931 echo json_encode( array(
932 'success' => true,
933 ) ) ;
934 } else {
935 echo json_encode( array(
936 'success' => false,
937 ) ) ;
938 }
939
940 }
941
942 }
943
944 /**
945 * Dismiss sponsorship nudge
946 *
947 * @since 5.8.2
948 */
949 function asenha_dismiss_upgrade_nudge()
950 {
951
952 if ( isset( $_REQUEST ) ) {
953 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
954 $asenha_stats['upgrade_nudge_dismissed'] = true;
955 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
956
957 if ( $success ) {
958 echo json_encode( array(
959 'success' => true,
960 ) ) ;
961 } else {
962 echo json_encode( array(
963 'success' => false,
964 ) ) ;
965 }
966
967 }
968
969 }
970
971 /**
972 * Dismiss sponsorship nudge
973 *
974 * @since 5.2.7
975 */
976 function asenha_dismiss_sponsorship_nudge()
977 {
978
979 if ( isset( $_REQUEST ) ) {
980 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
981 $asenha_stats['sponsorship_nudge_dismissed'] = true;
982 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
983
984 if ( $success ) {
985 echo json_encode( array(
986 'success' => true,
987 ) ) ;
988 } else {
989 echo json_encode( array(
990 'success' => false,
991 ) ) ;
992 }
993
994 }
995
996 }
997