PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 5.3.2
Admin and Site Enhancements (ASE) v5.3.2
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 3 years ago classes 3 years ago includes 3 years ago vendor 3 years ago LICENSE.md 3 years ago README.md 3 years ago admin-site-enhancements.php 3 years ago bootstrap.php 3 years ago settings.php 3 years ago
settings.php
884 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 <h1 class="asenha-heading"><?php
38 echo get_admin_page_title() ;
39 ?> <small><?php
40 esc_html_e( 'by', 'admin-site-enhancements' );
41 ?> <a href="https://bowo.io/asenha-bw" target="_blank">Bowo</a></small></h1>
42 <!-- <a href="https://wordpress.org/plugins/admin-site-enhancements/" target="_blank" class="asenha-header-action"><span>&#8505;</span> <?php
43 // esc_html_e( 'Info', 'admin-site-enhancements' );
44 ?></a> -->
45 </div>
46 <div class="asenha-header-right">
47 <a href="https://bowo.io/asenha-rvw" target="_blank" class="asenha-header-action"><span>&starf;</span> <?php
48 esc_html_e( 'Review', 'admin-site-enhancements' );
49 ?></a>
50 <a href="https://bowo.io/asenha-fdbk" target="_blank" class="asenha-header-action">&#10010; <?php
51 esc_html_e( 'Feedback', 'admin-site-enhancements' );
52 ?></a>
53 <a href="https://bowo.io/asenha-trnslt" target="_blank" class="asenha-header-action">&#9654; <?php
54 esc_html_e( 'Translate', 'admin-site-enhancements' );
55 ?></a>
56 <div id="plugin-sponsor" class="button button-primary plugin-sponsor">
57 <?php
58 esc_html_e( 'Sponsor', 'admin-site-enhancements' );
59 ?>
60 </div>
61 <a class="button button-primary asenha-save-button">Save Changes</a>
62 <div class="asenha-changes-saved" style="display:none;">Changes have been saved.</div>
63 </div>
64 </div>
65
66 <div class="asenha-body">
67 <div class="asenha-sponsorship-nudge nudge-show-more is-enabled" style="display: none;">
68 <h3>Looks like some of these enhancements have been useful for your site?</h3>
69 <p class="nudge-description intro">Please consider supporting Admin and Site Enhancements (ASE).</p>
70 <a id="sponsorship-nudge-show-moreless" class="nudge-show-more-less show-more-less show-more" href="#">Find Out How </a>
71 <div class="nudge-wrapper-show-more">
72 <?php
73 // Quotes on sponsorship
74 $sponsorship_quotes = array(
75 '"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>',
76 '"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>',
77 '"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>',
78 '"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>',
79 '"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>',
80 '"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>',
81 '"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>',
82 '"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>',
83 '"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>',
84 '"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>',
85 '"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>',
86 '"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>',
87 '"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>',
88 '"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>',
89 '"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>',
90 '"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>',
91 '"Great plugin and awesome developer!" ~<a href="https://wordpress.org/support/topic/awesome-9998/" target="_blank">@mrgy05</a>',
92 '"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>',
93 '"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>',
94 '"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>',
95 '"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>',
96 '"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>'
97 );
98 $random_sponsorship_quote = $sponsorship_quotes[rand( 0, count( $sponsorship_quotes ) - 1 )];
99 // Quotes on general support
100 $support_quotes = array(
101 '“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>',
102 '"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>',
103 '"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>',
104 '"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>',
105 '"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>',
106 '"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>',
107 '"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>',
108 '"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>',
109 '"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>',
110 '"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>',
111 '"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>',
112 '"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>',
113 '"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>',
114 '"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>',
115 '"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>',
116 '"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>',
117 '"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>',
118 '"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>',
119 '"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>',
120 '"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>',
121 '"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>',
122 '"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>',
123 '"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>',
124 '"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>'
125 );
126 $random_support_quote = $support_quotes[rand( 0, count( $support_quotes ) - 1 )];
127 $share_quotes = array(
128 '"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>',
129 '"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>',
130 '"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>',
131 '"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>',
132 '"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>',
133 '"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>',
134 '"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>',
135 '"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>"',
136 '"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>',
137 '"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>',
138 '"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>',
139 '"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>',
140 '"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>'
141 );
142 $random_share_quote = $share_quotes[rand( 0, count( $share_quotes ) - 1 )];
143 ?>
144 <div class="nudge-quotes">
145 <div class="user-quote"><?php
146 echo $random_sponsorship_quote ;
147 ?></div>
148 <div class="user-quote"><?php
149 echo $random_support_quote ;
150 ?></div>
151 </div>
152 <div class="nudge-content">
153 <div class="nudge-primary">
154 <h4>Sponsor ASE from as little as USD 1, monthly or one-time</h4>
155 <div class="nudge-info">
156 <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>
157 </div>
158 <div class="nudge-ctas">
159 <a href="https://bowo.io/asenha-sp-gth-ndg" class="button button-primary sponsorship-button monthly" target="_blank">Sponsor Monthly</a>
160 <a href="https://bowo.io/asenha-sp-ppl-ndg" class="button sponsorship-button one-time" target="_blank">Sponsor One-Time</a>
161 <a href="#" id="have-sponsored" class="asenha-have-sponsored">I've sponsored ASE</a>
162 </div>
163 <div class="nudge-stats">
164 <p class="nudge-description">ASE has consumed more than <a href="https://bowo.io/asenha-sp-ndg-chnlg" target="_blank">250 hours of dev time</a>. At v5.3.2 (released on July 15, 2023) and 6,000+ active installs, there have been <a href="https://bowo.io/asenha-sp-gth-ndg" target="_blank">4 monthly sponsors</a> and <a href="https://bowo.io/asenha-sp-ppl-ndg" target="_blank">28 one-time sponsors</a>. You can be one today!</p>
165 </div>
166 </div>
167 <div class="nudge-secondary">
168 <h4>Give ASE your 5-star review or provide detailed feedback</h4>
169 <p class="nudge-description">If financial sponsorship is not something you can provide at the moment, you can always <a href="https://bowo.io/asenha-rvw-ndg" target="_blank">add a quick, 5-star review</a> to support ASE. It has received <a href="https://bowo.io/asenha-rvw-ndg" target="_blank">70+ 5-star reviews</a> so far. Help make it 100, or more!</p>
170 <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://bowo.io/asenha-fdbk-ndg" 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>
171 </div>
172 </div>
173 <div class="user-quote share-quote"><?php
174 echo $random_share_quote ;
175 ?></div>
176 <p class="nudge-description">Do <a href="https://bowo.io/asenha-dotorg" target="_blank">share about ASE</a> with your colleagues and/or community.</p>
177 <a href="https://bowo.io/asenha-bw-ndg" target="_blank" class="nudge-photo-link"><img src="<?php
178 echo esc_attr( ASENHA_URL . 'assets/img/bowo.jpg' ) ;
179 ?>" class="nudge-photo" /></a>
180 <h3>Thank you!</h3>
181 <p class="nudge-description nudge-closing">I hope you continue to benefit from ASE. ~<a href="https://bowo.io/asenha-bw-ndg" target="_blank">Bowo</a></p>
182 <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>
183 </div>
184 </div>
185 <form action="options.php" method="post">
186 <div class="asenha-vertical-tabs">
187 <div class="asenha-tab-buttons">
188 <input id="tab-content-management" type="radio" name="tabs" checked><label for="tab-content-management">Content Management</label>
189 <input id="tab-admin-interface" type="radio" name="tabs"><label for="tab-admin-interface">Admin Interface</label>
190 <input id="tab-login-logout" type="radio" name="tabs"><label for="tab-login-logout">Log In | Log Out</label>
191 <input id="tab-custom-code" type="radio" name="tabs"><label for="tab-custom-code">Custom Code</label>
192 <input id="tab-disable-components" type="radio" name="tabs"><label for="tab-disable-components">Disable Components</label>
193 <input id="tab-security" type="radio" name="tabs"><label for="tab-security">Security</label>
194 <input id="tab-optimizations" type="radio" name="tabs"><label for="tab-optimizations">Optimizations</label>
195 <input id="tab-utilities" type="radio" name="tabs"><label for="tab-utilities">Utilities</label>
196 </div>
197 <div class="asenha-tab-contents">
198 <section class="asenha-fields fields-content-management">
199 <table class="form-table" role="presentation">
200 <tbody></tbody>
201 </table>
202 </section>
203 <section class="asenha-fields fields-admin-interface">
204 <table class="form-table" role="presentation">
205 <tbody></tbody>
206 </table>
207 </section>
208 <section class="asenha-fields fields-login-logout">
209 <table class="form-table" role="presentation">
210 <tbody></tbody>
211 </table>
212 </section>
213 <section class="asenha-fields fields-custom-code">
214 <table class="form-table" role="presentation">
215 <tbody></tbody>
216 </table>
217 </section>
218 <section class="asenha-fields fields-disable-components">
219 <table class="form-table" role="presentation">
220 <tbody></tbody>
221 </table>
222 </section>
223 <section class="asenha-fields fields-security">
224 <table class="form-table" role="presentation">
225 <tbody></tbody>
226 </table>
227 </section>
228 <section class="asenha-fields fields-optimizations">
229 <table class="form-table" role="presentation">
230 <tbody></tbody>
231 </table>
232 </section>
233 <section class="asenha-fields fields-utilities">
234 <table class="form-table" role="presentation">
235 <tbody></tbody>
236 </table>
237 </section>
238 </div>
239 </div>
240 <div style="display:none;"><!-- Hide to prevent flash of fields appearing at the bottom of the page -->
241 <?php
242 settings_fields( ASENHA_ID );
243 ?>
244 <?php
245 do_settings_sections( ASENHA_SLUG );
246 ?>
247 <?php
248 submit_button(
249 'Save Changes',
250 // Button copy
251 'primary',
252 // Type: 'primary', 'small', or 'large'
253 'submit',
254 // The 'name' attribute
255 true,
256 // Whether to wrap in <p> tag
257 array(
258 'id' => 'asenha-submit',
259 )
260 );
261 ?>
262 </div>
263 </form>
264 </div>
265
266 <div class="asenha-footer">
267 </div>
268
269 <div id="asenha-sponsor" class="cta-modal-content sponsorship" style="display:none;">
270 <div class="sponsorship-content">
271 <div class="sponsorship-header">
272 <a href="https://bowo.io/asenha-bw-sp" target="_blank" class="sponsorship-photo-link"><img src="<?php
273 echo esc_attr( ASENHA_URL . 'assets/img/bowo.jpg' ) ;
274 ?>" class="sponsorship-bio-photo" /></a>
275 <h2>Thank you for your interest in sponsoring ASE!</h2>
276 <p class="sponsorship-user-quote">“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></p>
277 </div>
278 <div class="sponsorship-content-sections">
279 <div class="sponsorship-info">
280 <p class="sponsorship-description">Your sponsorship will help justify the time and effort I spend in <strong>developing and maintaining Admin and Site Enhancements (ASE)</strong>, so it can remain functional and be more useful for <strong>your personal project(s), paid dev work, client site(s) and/or agency workflow</strong>... hopefully for years to come.</p>
281 </div>
282 <div class="sponsorship-methods">
283 <p class="sponsorship-amount">Sponsorship can be <strong>as little as USD 1</strong>, monthly or one-time.</p>
284 <div class="sponsorship-method sponsor-via-github">
285 <a href="https://bowo.io/asenha-sp-gth" target="_blank" class="button button-primary button-hero sponsorship-button monthly">Monthly Sponsorship via Github <span class="dashicons dashicons-arrow-right-alt2"></span></a>
286 </div>
287 <div class="sponsorship-method sponsor-via-paypal">
288 <a href="https://bowo.io/asenha-sp-ppl" target="_blank" class="button button-hero sponsorship-button one-time">One-time Sponsorship via PayPal <span class="dashicons dashicons-arrow-right-alt2"></span></a>
289 </div>
290 </div>
291 </div>
292 <p>More about me and my work at <a href="https://bowo.io/asenha-bw-sp" target="_blank">bowo.io</a>.</p>
293 </div>
294 </div>
295 </div>
296 <?php
297 // Record the number of times changes were saved as well as the date of last save
298 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
299 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
300
301 if ( $changes_saved ) {
302 $current_date = date( 'Y-m-d', time() );
303
304 if ( !isset( $asenha_stats['first_save_date'] ) ) {
305 $asenha_stats['first_save_date'] = $current_date;
306 $asenha_stats['last_save_date'] = $current_date;
307 $asenha_stats['save_count'] = 1;
308 $asenha_stats['have_sponsored'] = false;
309 $asenha_stats['sponsorship_nudge_dismissed'] = false;
310 $asenha_stats['sponsorship_nudge_last_shown_date'] = '';
311 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = 0;
312 } else {
313 $asenha_stats['last_save_date'] = $current_date;
314 $save_count = $asenha_stats['save_count'];
315 $save_count++;
316 $asenha_stats['save_count'] = $save_count;
317 }
318
319 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
320 }
321
322 }
323
324 /**
325 * Suppress all notices, then add notice for successful settings update
326 *
327 * @since 1.1.0
328 */
329 function asenha_suppress_notices()
330 {
331 global $plugin_page ;
332 // Suppress all notices
333 if ( ASENHA_SLUG === $plugin_page ) {
334 remove_all_actions( 'admin_notices' );
335 }
336 // Add notice for successful settings update
337 if ( isset( $_GET['page'] ) && ASENHA_SLUG == $_GET['page'] && isset( $_GET['settings-updated'] ) && true == $_GET['settings-updated'] ) {
338 ?>
339 <script>
340 jQuery(document).ready( function() {
341 jQuery('.asenha-changes-saved').fadeIn(400).delay(2500).fadeOut(400);
342 });
343 </script>
344
345 <?php
346 }
347 }
348
349 /**
350 * Suppress all generic notices on the plugin settings page
351 *
352 * @since 2.7.0
353 */
354 function asenha_suppress_generic_notices()
355 {
356 global $plugin_page ;
357 // Suppress all notices
358 if ( ASENHA_SLUG === $plugin_page ) {
359 remove_all_actions( 'all_admin_notices' );
360 }
361 }
362
363 /**
364 * Enqueue admin scripts
365 *
366 * @since 1.0.0
367 */
368 function asenha_admin_scripts( $hook_suffix )
369 {
370 global
371 $wp_version,
372 $pagenow,
373 $typenow,
374 $taxnow,
375 $hook_suffix
376 ;
377 $current_screen = get_current_screen();
378 // Get all WP Enhancements options, default to empty array in case it's not been created yet
379 $options = get_option( 'admin_site_enhancements', array() );
380 // For main page of this plugin
381
382 if ( is_asenha() ) {
383 wp_enqueue_style(
384 'asenha-jbox',
385 ASENHA_URL . 'assets/css/jBox.all.min.css',
386 array(),
387 ASENHA_VERSION
388 );
389 wp_enqueue_script(
390 'asenha-jbox',
391 ASENHA_URL . 'assets/js/jBox.all.min.js',
392 array(),
393 ASENHA_VERSION,
394 false
395 );
396 wp_enqueue_script(
397 'asenha-jsticky',
398 ASENHA_URL . 'assets/js/jquery.jsticky.mod.min.js',
399 array( 'jquery' ),
400 ASENHA_VERSION,
401 false
402 );
403 wp_enqueue_script(
404 'asenha-js-cookie',
405 ASENHA_URL . 'assets/js/js.cookie.min.js',
406 array(),
407 ASENHA_VERSION,
408 false
409 );
410 // jQuery UI Sortables. In use, e.g. for Admin Interface >> Admin Menu Organizer
411 // Re-register and re-enqueue jQuery UI Core and plugins required for sortable, draggable and droppable when ordering menu items
412 wp_deregister_script( 'jquery-ui-core' );
413 wp_register_script(
414 'jquery-ui-core',
415 get_site_url() . '/wp-includes/js/jquery/ui/core.min.js',
416 array( 'jquery' ),
417 ASENHA_VERSION,
418 false
419 );
420 wp_enqueue_script( 'jquery-ui-core' );
421
422 if ( version_compare( $wp_version, '5.6.0', '>=' ) ) {
423 wp_deregister_script( 'jquery-ui-mouse' );
424 wp_register_script(
425 'jquery-ui-mouse',
426 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
427 array( 'jquery-ui-core' ),
428 ASENHA_VERSION,
429 false
430 );
431 wp_enqueue_script( 'jquery-ui-mouse' );
432 } else {
433 wp_deregister_script( 'jquery-ui-widget' );
434 wp_register_script(
435 'jquery-ui-widget',
436 get_site_url() . '/wp-includes/js/jquery/ui/widget.min.js',
437 array( 'jquery' ),
438 ASENHA_VERSION,
439 false
440 );
441 wp_enqueue_script( 'jquery-ui-widget' );
442 wp_deregister_script( 'jquery-ui-mouse' );
443 wp_register_script(
444 'jquery-ui-mouse',
445 get_site_url() . '/wp-includes/js/jquery/ui/mouse.min.js',
446 array( 'jquery-ui-core', 'jquery-ui-widget' ),
447 ASENHA_VERSION,
448 false
449 );
450 wp_enqueue_script( 'jquery-ui-mouse' );
451 }
452
453 wp_deregister_script( 'jquery-ui-sortable' );
454 wp_register_script(
455 'jquery-ui-sortable',
456 get_site_url() . '/wp-includes/js/jquery/ui/sortable.min.js',
457 array( 'jquery-ui-mouse' ),
458 ASENHA_VERSION,
459 false
460 );
461 wp_enqueue_script( 'jquery-ui-sortable' );
462 wp_deregister_script( 'jquery-ui-draggable' );
463 wp_register_script(
464 'jquery-ui-draggable',
465 get_site_url() . '/wp-includes/js/jquery/ui/draggable.min.js',
466 array( 'jquery-ui-mouse' ),
467 ASENHA_VERSION,
468 false
469 );
470 wp_enqueue_script( 'jquery-ui-draggable' );
471 wp_deregister_script( 'jquery-ui-droppable' );
472 wp_register_script(
473 'jquery-ui-droppable',
474 get_site_url() . '/wp-includes/js/jquery/ui/droppable.min.js',
475 array( 'jquery-ui-draggable' ),
476 ASENHA_VERSION,
477 false
478 );
479 wp_enqueue_script( 'jquery-ui-droppable' );
480 // Script to set behaviour and actions of the sortable menu
481 wp_enqueue_script(
482 'asenha-custom-admin-menu',
483 ASENHA_URL . 'assets/js/custom-admin-menu.js',
484 array( 'jquery-ui-draggable' ),
485 ASENHA_VERSION,
486 false
487 );
488 // CodeMirror. In use, e.g. for Utilities >> Enable Custom Admin / Frontend CSS / ads.txt / app-ads.txt
489 wp_enqueue_style(
490 'asenha-codemirror',
491 ASENHA_URL . 'assets/css/codemirror/codemirror.min.css',
492 array(),
493 ASENHA_VERSION
494 );
495 wp_enqueue_script(
496 'asenha-codemirror',
497 ASENHA_URL . 'assets/js/codemirror/codemirror.min.js',
498 array( 'jquery' ),
499 ASENHA_VERSION,
500 true
501 );
502 wp_enqueue_script(
503 'asenha-codemirror-htmlmixed-mode',
504 ASENHA_URL . 'assets/js/codemirror/htmlmixed.js',
505 array( 'asenha-codemirror' ),
506 ASENHA_VERSION,
507 true
508 );
509 wp_enqueue_script(
510 'asenha-codemirror-xml-mode',
511 ASENHA_URL . 'assets/js/codemirror/xml.js',
512 array( 'asenha-codemirror' ),
513 ASENHA_VERSION,
514 true
515 );
516 wp_enqueue_script(
517 'asenha-codemirror-javascript-mode',
518 ASENHA_URL . 'assets/js/codemirror/javascript.js',
519 array( 'asenha-codemirror' ),
520 ASENHA_VERSION,
521 true
522 );
523 wp_enqueue_script(
524 'asenha-codemirror-css-mode',
525 ASENHA_URL . 'assets/js/codemirror/css.js',
526 array( 'asenha-codemirror' ),
527 ASENHA_VERSION,
528 true
529 );
530 wp_enqueue_script(
531 'asenha-codemirror-markdown-mode',
532 ASENHA_URL . 'assets/js/codemirror/markdown.js',
533 array( 'asenha-codemirror' ),
534 ASENHA_VERSION,
535 true
536 );
537 // DataTables. In use, e.g. for Security >> Limit Login Attempts
538 wp_enqueue_style(
539 'asenha-datatables',
540 ASENHA_URL . 'assets/css/datatables/datatables.min.css',
541 array(),
542 ASENHA_VERSION
543 );
544 wp_enqueue_script(
545 'asenha-datatables',
546 ASENHA_URL . 'assets/js/datatables/datatables.min.js',
547 array( 'jquery' ),
548 ASENHA_VERSION,
549 false
550 );
551 // Main style and script for the admin page
552 wp_enqueue_style(
553 'asenha-admin-page',
554 ASENHA_URL . 'assets/css/admin-page.css',
555 array( 'asenha-jbox', 'asenha-codemirror', 'asenha-datatables' ),
556 ASENHA_VERSION
557 );
558 wp_enqueue_script(
559 'asenha-admin-page',
560 ASENHA_URL . 'assets/js/admin-page.js',
561 array(
562 'asenha-jsticky',
563 'asenha-jbox',
564 'asenha-js-cookie',
565 'asenha-codemirror-htmlmixed-mode',
566 'asenha-codemirror-xml-mode',
567 'asenha-codemirror-javascript-mode',
568 'asenha-codemirror-css-mode',
569 'asenha-codemirror-markdown-mode',
570 'asenha-datatables',
571 'asenha-custom-admin-menu'
572 ),
573 ASENHA_VERSION,
574 false
575 );
576 }
577
578 // Enqueue on all wp-admin
579 wp_enqueue_style(
580 'asenha-wp-admin',
581 ASENHA_URL . 'assets/css/wp-admin.css',
582 array(),
583 ASENHA_VERSION
584 );
585 // Content Management >> Show IDs, for list tables in wp-admin, e.g. All Posts page
586 if ( false !== strpos( $current_screen->base, 'edit' ) || false !== strpos( $current_screen->base, 'users' ) || false !== strpos( $current_screen->base, 'upload' ) ) {
587 wp_enqueue_style(
588 'asenha-list-table',
589 ASENHA_URL . 'assets/css/list-table.css',
590 array(),
591 ASENHA_VERSION
592 );
593 }
594 // Content Management >> Enable Media Replacement
595
596 if ( $current_screen->base == 'upload' || $current_screen->id == 'attachment' ) {
597 // wp_enqueue_style( 'asenha-jbox', ASENHA_URL . 'assets/css/jBox.all.min.css', array(), ASENHA_VERSION );
598 // wp_enqueue_script( 'asenha-jbox', ASENHA_URL . 'assets/js/jBox.all.min.js', array(), ASENHA_VERSION, false );
599 wp_enqueue_style(
600 'asenha-media-replace',
601 ASENHA_URL . 'assets/css/media-replace.css',
602 array(),
603 ASENHA_VERSION
604 );
605 wp_enqueue_script(
606 'asenha-media-replace',
607 ASENHA_URL . 'assets/js/media-replace.js',
608 array(),
609 ASENHA_VERSION,
610 false
611 );
612 }
613
614 // Content Management >> Hide Admin Notices
615
616 if ( array_key_exists( 'hide_admin_notices', $options ) && $options['hide_admin_notices'] ) {
617 wp_enqueue_style(
618 'asenha-jbox',
619 ASENHA_URL . 'assets/css/jBox.all.min.css',
620 array(),
621 ASENHA_VERSION
622 );
623 wp_enqueue_script(
624 'asenha-jbox',
625 ASENHA_URL . 'assets/js/jBox.all.min.js',
626 array(),
627 ASENHA_VERSION,
628 false
629 );
630 wp_enqueue_style(
631 'asenha-hide-admin-notices',
632 ASENHA_URL . 'assets/css/hide-admin-notices.css',
633 array(),
634 ASENHA_VERSION
635 );
636 wp_enqueue_script(
637 'asenha-hide-admin-notices',
638 ASENHA_URL . 'assets/js/hide-admin-notices.js',
639 array( 'asenha-jbox' ),
640 ASENHA_VERSION,
641 false
642 );
643 }
644
645 // Utilities >> Multiple User Roles
646 if ( array_key_exists( 'multiple_user_roles', $options ) && $options['multiple_user_roles'] ) {
647 if ( 'user-edit.php' == $hook_suffix || 'user-new.php' == $hook_suffix ) {
648 // Only replace roles dropdown with checkboxes for users that can assign roles to other users, e.g. administrators
649 if ( current_user_can( 'promote_users', get_current_user_id() ) ) {
650 wp_enqueue_script(
651 'asenha-multiple-user-roles',
652 ASENHA_URL . 'assets/js/multiple-user-roles.js',
653 array( 'jquery' ),
654 ASENHA_VERSION,
655 false
656 );
657 }
658 }
659 }
660 // Pass on ASENHA stats to admin-page.js to determine whether to show sponsorship nudge
661 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
662 $current_date = date( 'Y-m-d', time() );
663 $show_sponsorship_nudge = false;
664 $asenha_stats_localized = array(
665 'firstSaveDate' => '',
666 'lastSaveDate' => '',
667 'saveCount' => 0,
668 'showSponsorshipNudge' => false,
669 );
670
671 if ( !empty($asenha_stats) ) {
672 $have_sponsored = $asenha_stats['have_sponsored'];
673 $changes_saved = ( isset( $_GET['settings-updated'] ) && 'true' == $_GET['settings-updated'] ? true : false );
674 // Compensate for redirect from settings-updated=true URL
675
676 if ( $changes_saved ) {
677 $save_count = $asenha_stats['save_count'] + 1;
678 } else {
679 $save_count = $asenha_stats['save_count'];
680 }
681
682 $saves_to_nudge_sponsorship = 10;
683
684 if ( $save_count < $saves_to_nudge_sponsorship ) {
685 $save_count_modulo = -1;
686 } else {
687 $save_count_modulo = $save_count % $saves_to_nudge_sponsorship;
688 }
689
690 // User have not sponsored ASE
691 if ( false === $have_sponsored ) {
692 // Sponsorship nudge have not been dismissed
693
694 if ( false === $asenha_stats['sponsorship_nudge_dismissed'] ) {
695 // Show sponsorship nudge after every x saves
696
697 if ( $save_count_modulo >= 0 ) {
698 $show_sponsorship_nudge = true;
699 } else {
700 $show_sponsorship_nudge = false;
701 }
702
703
704 if ( $show_sponsorship_nudge && $save_count_modulo >= 0 ) {
705 $asenha_stats['sponsorship_nudge_last_shown_date'] = $current_date;
706 $asenha_stats['sponsorship_nudge_last_shown_save_count'] = $save_count;
707 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
708 }
709
710 } else {
711
712 if ( $save_count_modulo == 0 ) {
713
714 if ( $save_count > $asenha_stats['sponsorship_nudge_last_shown_save_count'] ) {
715 $asenha_stats['sponsorship_nudge_dismissed'] = false;
716 update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
717 $show_sponsorship_nudge = true;
718 } else {
719 $show_sponsorship_nudge = false;
720 }
721
722 } else {
723 $show_sponsorship_nudge = false;
724 }
725
726 }
727
728 }
729 $asenha_stats_localized = array(
730 'firstSaveDate' => $asenha_stats['first_save_date'],
731 'lastSaveDate' => $asenha_stats['last_save_date'],
732 'saveCount' => $save_count,
733 'showSponsorshipNudge' => $show_sponsorship_nudge,
734 );
735 }
736
737 wp_localize_script( 'asenha-admin-page', 'asenhaStats', $asenha_stats_localized );
738 }
739
740 /**
741 * Enqueue public scripts
742 *
743 * @since 3.9.0
744 */
745 function asenha_public_scripts( $hook_suffix )
746 {
747 // Get all WP Enhancements options, default to empty array in case it's not been created yet
748 $options = get_option( 'admin_site_enhancements', array() );
749
750 if ( array_key_exists( 'enable_external_permalinks', $options ) ) {
751 $enable_external_permalinks = $options['enable_external_permalinks'];
752 } else {
753 $enable_external_permalinks = false;
754 }
755
756
757 if ( $enable_external_permalinks ) {
758 wp_enqueue_script(
759 'asenha-public',
760 ASENHA_URL . 'assets/js/public.js',
761 array( 'jquery' ),
762 ASENHA_VERSION,
763 false
764 );
765 wp_localize_script( 'asenha-public', 'phpVars', array(
766 'externalPermalinksEnabled' => $enable_external_permalinks,
767 ) );
768 }
769
770 }
771
772 /**
773 * Add 'Access now' plugin action link.
774 *
775 * @since 1.0.0
776 */
777 function asenha_plugin_action_links( $links )
778 {
779 $settings_link = '<a href="tools.php?page=' . ASENHA_SLUG . '">Configure now</a>';
780 array_unshift( $links, $settings_link );
781 return $links;
782 }
783
784 /**
785 * Modify footer text
786 *
787 * @since 1.0.0
788 */
789 function asenha_footer_text()
790 {
791 if ( is_asenha() ) {
792 ?>
793 <a href="https://bowo.io/asenha-dotorg" target="_blank">Admin Site Enhancements</a> is on <a href="https://bowo.io/asenha-gthb" target="_blank">github</a>.
794 <?php
795 }
796 }
797
798 /**
799 * Change WP version number text in footer
800 *
801 * @since 4.8.3
802 */
803 function asenha_footer_version_text()
804 {
805 ?>
806 Also by Bowo &#8594; <a href="https://bowo.io/asenha-wpn" target="_blank">WordPress Newsboard</a>: The latest from 100+ sources
807 <?php
808 }
809
810 /**
811 * Check if current screen is this plugin's main page
812 *
813 * @since 1.0.0
814 */
815 function is_asenha()
816 {
817 $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
818 // e.g. /wp-admin/index.php?page=page-slug
819
820 if ( strpos( $request_uri, 'page=' . ASENHA_SLUG ) !== false ) {
821 return true;
822 // Yes, this is the plugin's main page
823 } else {
824 return false;
825 // Nope, this is NOT the plugin's page
826 }
827
828 }
829
830 /**
831 * Mark that user have sponsored ASE
832 *
833 * @since 5.2.7
834 */
835 function asenha_have_sponsored()
836 {
837
838 if ( isset( $_REQUEST ) ) {
839 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
840 $asenha_stats['have_sponsored'] = true;
841 $asenha_stats['sponsorship_nudge_dismissed'] = true;
842 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
843
844 if ( $success ) {
845 echo json_encode( array(
846 'success' => true,
847 ) ) ;
848 } else {
849 echo json_encode( array(
850 'success' => false,
851 ) ) ;
852 }
853
854 }
855
856 }
857
858 /**
859 * Dismiss sponsorship nudge
860 *
861 * @since 5.2.7
862 */
863 function asenha_dismiss_sponsorship_nudge()
864 {
865
866 if ( isset( $_REQUEST ) ) {
867 $asenha_stats = get_option( ASENHA_SLUG_U . '_stats', array() );
868 $asenha_stats['sponsorship_nudge_dismissed'] = true;
869 $success = update_option( ASENHA_SLUG_U . '_stats', $asenha_stats );
870
871 if ( $success ) {
872 echo json_encode( array(
873 'success' => true,
874 ) ) ;
875 } else {
876 echo json_encode( array(
877 'success' => false,
878 ) ) ;
879 }
880
881 }
882
883 }
884