PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 6.2.4
Admin and Site Enhancements (ASE) v6.2.4
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
1032 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.2.4 (released on December 8, 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 $current_user
432 ;
433 $current_screen = get_current_screen();
434 // Get all WP Enhancements options, default to empty array in case it's not been created yet
435 $options = get_option( 'admin_site_enhancements', array() );
436 // For main page of this plugin
437
438 if ( is_asenha() ) {
439 wp_enqueue_style(
440 'asenha-jbox',
441 ASENHA_URL . 'assets/css/jBox.all.min.css',
442 array(),
443 ASENHA_VERSION
444 );
445 wp_enqueue_script(
446 'asenha-jbox',
447 ASENHA_URL . 'assets/js/jBox.all.min.js',
448 array(),
449 ASENHA_VERSION,
450 false
451 );
452 wp_enqueue_script(
453 'asenha-jsticky',
454 ASENHA_URL . 'assets/js/jquery.jsticky.mod.min.js',
455 array( 'jquery' ),
456 ASENHA_VERSION,
457 false
458 );
459 wp_enqueue_script(
460 'asenha-js-cookie',
461 ASENHA_URL . 'assets/js/js.cookie.min.js',
462 array(),
463 ASENHA_VERSION,
464 false
465 );
466 // jQuery UI Sortables. In use, e.g. for Admin Interface >> Admin Menu Organizer
467 // Re-register and re-enqueue jQuery UI Core and plugins required for sortable, draggable and droppable when ordering menu items
468 wp_deregister_script( 'jquery-ui-core' );
469 wp_register_script(
470 'jquery-ui-core',
471 get_site_url() . '/wp-includes/js/jquery/ui/core.min.js',
472 array( 'jquery' ),
473 ASENHA_VERSION,
474 false
475 );
476 wp_enqueue_script( 'jquery-ui-core' );
477
478 if ( version_compare( $wp_version, '5.6.0', '>=' ) ) {
479 wp_deregister_script( 'jquery-ui-mouse' );
480 wp_register_script(
481 'jquery-ui-mouse',
482 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
483 array( 'jquery-ui-core' ),
484 ASENHA_VERSION,
485 false
486 );
487 wp_enqueue_script( 'jquery-ui-mouse' );
488 } else {
489 wp_deregister_script( 'jquery-ui-widget' );
490 wp_register_script(
491 'jquery-ui-widget',
492 get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js',
493 array( 'jquery' ),
494 ASENHA_VERSION,
495 false
496 );
497 wp_enqueue_script( 'jquery-ui-widget' );
498 wp_deregister_script( 'jquery-ui-mouse' );
499 wp_register_script(
500 'jquery-ui-mouse',
501 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
502 array( 'jquery-ui-core', 'jquery-ui-widget' ),
503 ASENHA_VERSION,
504 false
505 );
506 wp_enqueue_script( 'jquery-ui-mouse' );
507 }
508
509 wp_deregister_script( 'jquery-ui-sortable' );
510 wp_register_script(
511 'jquery-ui-sortable',
512 get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js',
513 array( 'jquery-ui-mouse' ),
514 ASENHA_VERSION,
515 false
516 );
517 wp_enqueue_script( 'jquery-ui-sortable' );
518 wp_deregister_script( 'jquery-ui-draggable' );
519 wp_register_script(
520 'jquery-ui-draggable',
521 get_site_url() . '/wp-includes/js/jquery/ui/draggable.min.js',
522 array( 'jquery-ui-mouse' ),
523 ASENHA_VERSION,
524 false
525 );
526 wp_enqueue_script( 'jquery-ui-draggable' );
527 wp_deregister_script( 'jquery-ui-droppable' );
528 wp_register_script(
529 'jquery-ui-droppable',
530 get_site_url() . '/wp-includes/js/jquery/ui/droppable.min.js',
531 array( 'jquery-ui-draggable' ),
532 ASENHA_VERSION,
533 false
534 );
535 wp_enqueue_script( 'jquery-ui-droppable' );
536 // Script to set behaviour and actions of the sortable menu
537 wp_enqueue_script(
538 'asenha-custom-admin-menu',
539 ASENHA_URL . 'assets/js/custom-admin-menu.js',
540 array( 'jquery-ui-draggable' ),
541 ASENHA_VERSION,
542 false
543 );
544 // First, we unload the CodeMirror libraries included in WP core
545 wp_deregister_script( 'wp-codemirror' );
546 wp_deregister_script( 'code-editor' );
547 wp_deregister_script( 'htmlhint' );
548 wp_deregister_script( 'csslint' );
549 wp_deregister_script( 'esprima' );
550 wp_deregister_script( 'jshint' );
551 // Then, we load ASENHA's CodeMirror libraries. In use, e.g. for Utilities >> Enable Custom Admin / Frontend CSS / ads.txt / app-ads.txt
552 wp_enqueue_style(
553 'asenha-codemirror',
554 ASENHA_URL . 'assets/css/codemirror/codemirror.min.css',
555 array(),
556 ASENHA_VERSION
557 );
558 wp_enqueue_script(
559 'asenha-codemirror',
560 ASENHA_URL . 'assets/js/codemirror/codemirror.min.js',
561 array( 'jquery' ),
562 ASENHA_VERSION,
563 true
564 );
565 wp_enqueue_script(
566 'asenha-codemirror-htmlmixed-mode',
567 ASENHA_URL . 'assets/js/codemirror/htmlmixed.js',
568 array( 'asenha-codemirror' ),
569 ASENHA_VERSION,
570 true
571 );
572 wp_enqueue_script(
573 'asenha-codemirror-xml-mode',
574 ASENHA_URL . 'assets/js/codemirror/xml.js',
575 array( 'asenha-codemirror' ),
576 ASENHA_VERSION,
577 true
578 );
579 wp_enqueue_script(
580 'asenha-codemirror-javascript-mode',
581 ASENHA_URL . 'assets/js/codemirror/javascript.js',
582 array( 'asenha-codemirror' ),
583 ASENHA_VERSION,
584 true
585 );
586 wp_enqueue_script(
587 'asenha-codemirror-css-mode',
588 ASENHA_URL . 'assets/js/codemirror/css.js',
589 array( 'asenha-codemirror' ),
590 ASENHA_VERSION,
591 true
592 );
593 wp_enqueue_script(
594 'asenha-codemirror-markdown-mode',
595 ASENHA_URL . 'assets/js/codemirror/markdown.js',
596 array( 'asenha-codemirror' ),
597 ASENHA_VERSION,
598 true
599 );
600 // DataTables. In use, e.g. for Security >> Limit Login Attempts
601 wp_enqueue_style(
602 'asenha-datatables',
603 ASENHA_URL . 'assets/css/datatables/datatables.min.css',
604 array(),
605 ASENHA_VERSION
606 );
607 wp_enqueue_script(
608 'asenha-datatables',
609 ASENHA_URL . 'assets/js/datatables/datatables.min.js',
610 array( 'jquery' ),
611 ASENHA_VERSION,
612 false
613 );
614 // Add WP media library assets
615 wp_enqueue_media();
616 // Add WP color picker assets
617 wp_enqueue_style( 'wp-color-picker' );
618 wp_enqueue_script( 'wp-color-picker' );
619 // Main style and script for the admin page
620 wp_enqueue_style(
621 'asenha-admin-page',
622 ASENHA_URL . 'assets/css/admin-page.css',
623 array(
624 'asenha-jbox',
625 'asenha-codemirror',
626 'asenha-datatables',
627 'wp-color-picker'
628 ),
629 ASENHA_VERSION
630 );
631 wp_enqueue_script(
632 'asenha-admin-page',
633 ASENHA_URL . 'assets/js/admin-page.js',
634 array(
635 'asenha-jsticky',
636 'asenha-jbox',
637 'asenha-js-cookie',
638 'asenha-codemirror-htmlmixed-mode',
639 'asenha-codemirror-xml-mode',
640 'asenha-codemirror-javascript-mode',
641 'asenha-codemirror-css-mode',
642 'asenha-codemirror-markdown-mode',
643 'asenha-datatables',
644 'asenha-custom-admin-menu',
645 'wp-color-picker'
646 ),
647 ASENHA_VERSION,
648 false
649 );
650 wp_localize_script( 'asenha-admin-page', 'adminPageVars', array(
651 'mediaFrameTitle' => 'Select an Image',
652 'mediaFrameButtonText' => 'Use Selected Image',
653 ) );
654 }
655
656 // Enqueue on all wp-admin
657 wp_enqueue_style(
658 'asenha-wp-admin',
659 ASENHA_URL . 'assets/css/wp-admin.css',
660 array(),
661 ASENHA_VERSION
662 );
663 // Content Management >> Show IDs, for list tables in wp-admin, e.g. All Posts page
664 if ( false !== strpos( $current_screen->base, 'edit' ) || false !== strpos( $current_screen->base, 'users' ) || false !== strpos( $current_screen->base, 'upload' ) ) {
665 wp_enqueue_style(
666 'asenha-list-table',
667 ASENHA_URL . 'assets/css/list-table.css',
668 array(),
669 ASENHA_VERSION
670 );
671 }
672 // Content Management >> Enable Media Replacement
673
674 if ( $current_screen->base == 'upload' || $current_screen->id == 'attachment' ) {
675 // wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION );
676 // wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false );
677 wp_enqueue_style(
678 'asenha-media-replace',
679 ASENHA_URL . 'assets/css/media-replace.css',
680 array(),
681 ASENHA_VERSION
682 );
683 wp_enqueue_script(
684 'asenha-media-replace',
685 ASENHA_URL . 'assets/js/media-replace.js',
686 array(),
687 ASENHA_VERSION,
688 false
689 );
690 }
691
692 // Content Management >> Hide Admin Notices
693 if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) {
694
695 if ( current_user_can( 'manage_options' ) ) {
696 wp_enqueue_style(
697 'asenha-jbox',
698 ASENHA_URL . 'assets/css/jBox.all.min.css',
699 array(),
700 ASENHA_VERSION
701 );
702 wp_enqueue_script(
703 'asenha-jbox',
704 ASENHA_URL . 'assets/js/jBox.all.min.js',
705 array(),
706 ASENHA_VERSION,
707 false
708 );
709 wp_enqueue_style(
710 'asenha-hide-admin-notices',
711 ASENHA_URL . 'assets/css/hide-admin-notices.css',
712 array(),
713 ASENHA_VERSION
714 );
715 wp_enqueue_script(
716 'asenha-hide-admin-notices',
717 ASENHA_URL . 'assets/js/hide-admin-notices.js',
718 array( 'asenha-jbox' ),
719 ASENHA_VERSION,
720 false
721 );
722 }
723
724 }
725 // Utilities >> Multiple User Roles
726 if ( array_key_exists( 'multiple_user_roles', $options ) && $options['multiple_user_roles'] ) {
727 if ( 'user-edit.php' == $hook_suffix || 'user-new.php' == $hook_suffix ) {
728 // Only replace roles dropdown with checkboxes for users that can assign roles to other users, e.g. administrators
729 if ( current_user_can( 'promote_users', get_current_user_id() ) ) {
730 wp_enqueue_script(
731 'asenha-multiple-user-roles',
732 ASENHA_URL . 'assets/js/multiple-user-roles.js',
733 array( 'jquery' ),
734 ASENHA_VERSION,
735 false
736 );
737 }
738 }
739 }
740 // Pass on ASENHA stats to admin-page.js to determine whether to show sponsorship nudge
741 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
742 $current_date = date( 'Y-m-d', time() );
743 $show_sponsorship_nudge = false;
744 $hide_upgrade_nudge = false;
745 $asenha_stats_localized = array(
746 'firstSaveDate' => '',
747 'lastSaveDate' => '',
748 'saveCount' => 0,
749 'hideUpgradeNudge' => false,
750 'showSponsorshipNudge' => false,
751 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
752 );
753
754 if ( !empty($asenha_stats) ) {
755 $hide_upgrade_nudge = ( isset( $asenha_stats['upgrade_nudge_dismissed'] ) ? $asenha_stats['upgrade_nudge_dismissed'] : false );
756 $have_sponsored = $asenha_stats['have_sponsored'];
757 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
758 // Compensate for redirect from settings-updated=true URL
759
760 if ( $changes_saved ) {
761 $save_count = $asenha_stats['save_count'] + 1;
762 } else {
763 $save_count = $asenha_stats['save_count'];
764 }
765
766 $saves_to_nudge_sponsorship = 10;
767
768 if ( $save_count < $saves_to_nudge_sponsorship ) {
769 $save_count_modulo = -1;
770 } else {
771 $save_count_modulo = $save_count % $saves_to_nudge_sponsorship;
772 }
773
774 // User have not sponsored ASE
775 if ( false === $have_sponsored ) {
776 // Sponsorship nudge have not been dismissed
777
778 if ( false === $asenha_stats['sponsorship_nudge_dismissed'] ) {
779 // Show sponsorship nudge after every x saves
780
781 if ( $save_count_modulo >= 0 ) {
782 $show_sponsorship_nudge = true;
783 } else {
784 $show_sponsorship_nudge = false;
785 }
786
787
788 if ( $show_sponsorship_nudge && $save_count_modulo >= 0 ) {
789 $asenha_stats['sponsorship_nudge_last_shown_date'] = $current_date;
790 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = $save_count;
791 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
792 }
793
794 } else {
795
796 if ( $save_count_modulo == 0 ) {
797
798 if ( $save_count > $asenha_stats['sponsorship_nudge_last_shown_save_count'] ) {
799 $asenha_stats['sponsorship_nudge_dismissed'] = false;
800 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
801 $show_sponsorship_nudge = true;
802 } else {
803 $show_sponsorship_nudge = false;
804 }
805
806 } else {
807 $show_sponsorship_nudge = false;
808 }
809
810 }
811
812 }
813 $asenha_stats_localized = array(
814 'firstSaveDate' => $asenha_stats['first_save_date'],
815 'lastSaveDate' => $asenha_stats['last_save_date'],
816 'saveCount' => $save_count,
817 'hideUpgradeNudge' => $hide_upgrade_nudge,
818 'showSponsorshipNudge' => $show_sponsorship_nudge,
819 'saveChangesJsonpUrl' => 'https://bowo.io/asenha-save-btn',
820 );
821 }
822
823 wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized );
824 }
825
826 /**
827 * Enqueue public scripts
828 *
829 * @since 3.9.0
830 */
831 function asenha_public_scripts( $hook_suffix )
832 {
833 // Get all WP Enhancements options, default to empty array in case it's not been created yet
834 $options = get_option( 'admin_site_enhancements', array() );
835 // External Permalinks
836 $enable_external_permalinks = ( array_key_exists( 'enable_external_permalinks', $options ) ? $options['enable_external_permalinks'] : false );
837
838 if ( $enable_external_permalinks ) {
839 wp_enqueue_script(
840 'asenha-public',
841 ASENHA_URL . 'assets/js/external-permalinks.js',
842 array(),
843 ASENHA_VERSION,
844 false
845 );
846 wp_localize_script( 'asenha-public', 'phpVars', array(
847 'externalPermalinksEnabled' => $enable_external_permalinks,
848 ) );
849 }
850
851 // Media Categories
852 $enable_media_categories = ( array_key_exists( 'enable_media_categories', $options ) ? $options['enable_media_categories'] : false );
853 if ( $enable_media_categories && !is_admin() && is_user_logged_in() ) {
854 wp_enqueue_style(
855 'asenha-media-categories-frontend',
856 ASENHA_URL . 'assets/css/media-categories-frontend.css',
857 array(),
858 ASENHA_VERSION
859 );
860 }
861 // Media Replacement
862 $enable_media_replacement = ( array_key_exists( 'enable_media_replacement', $options ) ? $options['enable_media_replacement'] : false );
863 if ( $enable_media_replacement && is_user_logged_in() ) {
864 wp_enqueue_style(
865 'asenha-media-replace-frontend',
866 ASENHA_URL . 'assets/css/media-replace-frontend.css',
867 array(),
868 ASENHA_VERSION
869 );
870 }
871 }
872
873 /**
874 * Add admin bar styles for wp-admin and frontend
875 *
876 * @since 6.2.1
877 */
878 function asenha_admin_bar_item_js_css()
879 {
880 if ( is_user_logged_in() ) {
881 ?>
882 <!--<script></script>-->
883 <style>
884 #wp-admin-bar-user-info .avatar {
885 object-fit: cover;
886 }
887 </style>
888 <?php
889 }
890 }
891
892 /**
893 * Add 'Access now' plugin action link.
894 *
895 * @since 1.0.0
896 */
897 function asenha_plugin_action_links( $links )
898 {
899 $settings_link = '<a href="tools.php?page=' . ASENHA_SLUG . '">Configure</a>';
900 array_unshift( $links, $settings_link );
901 return $links;
902 }
903
904 /**
905 * Modify footer text
906 *
907 * @since 1.0.0
908 */
909 function asenha_footer_text()
910 {
911 if ( is_asenha() ) {
912 ?>
913 <?php
914 }
915 }
916
917 /**
918 * Change WP version number text in footer
919 *
920 * @since 4.8.3
921 */
922 function asenha_footer_version_text()
923 {
924 ?>
925 ASE <a href="https://www.wpase.com/documentation/changelog/" target="_blank">v<?php
926 echo ASENHA_VERSION ;
927 ?></a>
928 <?php
929 }
930
931 /**
932 * Check if current screen is this plugin's main page
933 *
934 * @since 1.0.0
935 */
936 function is_asenha()
937 {
938 $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
939 // e.g. /wp-admin/index.php?page=page-slug
940
941 if ( strpos( $request_uri, 'page=' . ASENHA_SLUG ) !== false ) {
942 return true;
943 // Yes, this is the plugin's main page
944 } else {
945 return false;
946 // Nope, this is NOT the plugin's page
947 }
948
949 }
950
951 /**
952 * Mark that user have sponsored ASE
953 *
954 * @since 5.2.7
955 */
956 function asenha_have_sponsored()
957 {
958
959 if ( isset( $_REQUEST ) ) {
960 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
961 $asenha_stats['have_sponsored'] = true;
962 $asenha_stats['sponsorship_nudge_dismissed'] = true;
963 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
964
965 if ( $success ) {
966 echo json_encode( array(
967 'success' => true,
968 ) ) ;
969 } else {
970 echo json_encode( array(
971 'success' => false,
972 ) ) ;
973 }
974
975 }
976
977 }
978
979 /**
980 * Dismiss sponsorship nudge
981 *
982 * @since 5.8.2
983 */
984 function asenha_dismiss_upgrade_nudge()
985 {
986
987 if ( isset( $_REQUEST ) ) {
988 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
989 $asenha_stats['upgrade_nudge_dismissed'] = true;
990 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
991
992 if ( $success ) {
993 echo json_encode( array(
994 'success' => true,
995 ) ) ;
996 } else {
997 echo json_encode( array(
998 'success' => false,
999 ) ) ;
1000 }
1001
1002 }
1003
1004 }
1005
1006 /**
1007 * Dismiss sponsorship nudge
1008 *
1009 * @since 5.2.7
1010 */
1011 function asenha_dismiss_sponsorship_nudge()
1012 {
1013
1014 if ( isset( $_REQUEST ) ) {
1015 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
1016 $asenha_stats['sponsorship_nudge_dismissed'] = true;
1017 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
1018
1019 if ( $success ) {
1020 echo json_encode( array(
1021 'success' => true,
1022 ) ) ;
1023 } else {
1024 echo json_encode( array(
1025 'success' => false,
1026 ) ) ;
1027 }
1028
1029 }
1030
1031 }
1032