PluginProbe
Phone Button / trunk
Phone Button vtrunk
trunk 1.0.0 1.0.1 1.0.3 1.1.0 1.1.1 2.0.0 2.1.0 2.1.1 2.1.2
← All changes | notices.php +44 -13 2.0.0trunk View file →
@@ -9,12 +9,13 @@
9 9 'plugin_name' => "Phone Button", // the name of the plugin
10 10 'developer_website' => "https://www.yydevelopment.com", // link to the developer website page
11 11 'plugin_review_page' => "https://wordpress.org/plugins/phone-button/#reviews", // link to the plugin support page
12 12 'plugin_support_link' => "https://wordpress.org/support/plugin/phone-button/", // link to the plugin review page
13 + 'plugin_donate_link' => "https://www.yydevelopment.com/coffee-break/?plugin=phone-button", // link to the plugin donate page
13 14 'company_plugins_page' => "https://www.yydevelopment.com/yydevelopment-wordpress-plugins/", // link to the main company plugins page
14 15 'icon_image_path' => plugins_url() . "/" . basename( dirname( __FILE__ ) ) . "/images/icon.png", // link to the plugin icon
15 16 'save_database_time_stamp_name' => "yydev_phone_btn_timestamp", // database input name to save data
16 - 'send_mail_in_days' => (4 * 30 * 60 * 60 * 24) + strtotime("now"), // the amount of time after we show the notice (4 months)
17 + 'send_mail_in_days' => (30 * 60 * 60 * 24) + strtotime("now"), // the amount of time after we show the notice (4 months)
17 18 );
18 19
19 20 // ================================================
20 21 // creating time stamp if it doesn't exists
@@ -41,11 +42,21 @@
41 42
42 43 // when the visitor want to stop getting the messages
43 44 function yydev_phone_btn_stop_notice_forever() {
44 45
46 + // Verify nonce for security
47 + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) {
48 + wp_die('Security check failed');
49 + }
50 +
51 + // Check if user has proper capabilities
52 + if (!current_user_can('manage_options')) {
53 + wp_die('Insufficient permissions');
54 + }
55 +
45 56 global $yydev_phone_btn_notice_info_array;
46 57 update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], 'stop');
47 - die(); // we have to end ajax functions with die();
58 + wp_die(); // Use wp_die() instead of die() for WordPress AJAX
48 59
49 60 } // function yydev_phone_btn_stop_notice_forever() {
50 61
51 62 add_action( 'wp_ajax_yydev_phone_btn_stop_notice_forever', 'yydev_phone_btn_stop_notice_forever' );
@@ -53,11 +64,21 @@
53 64
54 65 // when the visitor ask to get the message in the future
55 66 function yydev_phone_btn_stop_notice_for_now() {
56 67
68 + // Verify nonce for security
69 + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) {
70 + wp_die('Security check failed');
71 + }
72 +
73 + // Check if user has proper capabilities
74 + if (!current_user_can('manage_options')) {
75 + wp_die('Insufficient permissions');
76 + }
77 +
57 78 global $yydev_phone_btn_notice_info_array;
58 79 update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], $yydev_phone_btn_notice_info_array['send_mail_in_days']);
59 - die(); // we have to end ajax functions with die();
80 + wp_die(); // Use wp_die() instead of die() for WordPress AJAX
60 81
61 82 } // function yydev_phone_btn_stop_notice_for_now() {
62 83
63 84 add_action( 'wp_ajax_yydev_phone_btn_stop_notice_for_now', 'yydev_phone_btn_stop_notice_for_now' );
@@ -74,8 +95,9 @@
74 95 $plugin_name = $yydev_phone_btn_notice_info_array['plugin_name'];
75 96 $developer_website = $yydev_phone_btn_notice_info_array['developer_website'];
76 97 $plugin_review_page = $yydev_phone_btn_notice_info_array['plugin_review_page'];
77 98 $plugin_support_link = $yydev_phone_btn_notice_info_array['plugin_support_link'];
99 + $plugin_donate_link = $yydev_phone_btn_notice_info_array['plugin_donate_link'];
78 100 $company_plugins_page = $yydev_phone_btn_notice_info_array['company_plugins_page'];
79 101 $icon_image_path = $yydev_phone_btn_notice_info_array['icon_image_path'];
80 102 $save_database_time_stamp_name = $yydev_phone_btn_notice_info_array['save_database_time_stamp_name'];
81 103
@@ -91,9 +113,12 @@
91 113
92 114 $(this).css("display", "none");
93 115
94 116 // use the function and update value using ajax
95 - var data = {'action': 'yydev_phone_btn_stop_notice_forever'}; // var data = {
117 + var data = {
118 + 'action': 'yydev_phone_btn_stop_notice_forever',
119 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
120 + };
96 121 jQuery.post(ajaxurl, data, function(response) {});
97 122
98 123 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
99 124 return false;
@@ -105,9 +130,12 @@
105 130
106 131 $(this).css("display", "none");
107 132
108 133 // use the function and update value using ajax
109 - var data = {'action': 'yydev_phone_btn_stop_notice_for_now'}; // var data = {
134 + var data = {
135 + 'action': 'yydev_phone_btn_stop_notice_for_now',
136 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
137 + };
110 138 jQuery.post(ajaxurl, data, function(response) {});
111 139
112 140 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
113 141 return false;
@@ -120,9 +148,12 @@
120 148
121 149 $(this).css("display", "none");
122 150
123 151 // use the function and update value using ajax
124 - var data = {'action': 'yydev_phone_btn_stop_notice_forever'}; // var data = {
152 + var data = {
153 + 'action': 'yydev_phone_btn_stop_notice_forever',
154 + 'nonce': '<?php echo wp_create_nonce('yydev_phone_btn_nonce'); ?>'
155 + };
125 156 jQuery.post(ajaxurl, data, function(response) {});
126 157
127 158 }); // $( relatedPostBox ).animate({opacity: "0"}, 1000, function() {
128 159 }); // $(document).on('click', '.yydev_phone_btn_notice_style notice-dismiss', function() {
@@ -210,24 +241,24 @@
210 241
211 242 <div class="yydev_phone_btn_notice_style notice notice-info">
212 243
213 244 <div class="yy-plugin-icon">
214 - <img src="<?php echo $icon_image_path; ?>" alt="<?php echo $plugin_name; ?>" />
245 + <img src="<?php echo esc_url($icon_image_path); ?>" alt="<?php echo esc_attr($plugin_name); ?>" />
215 246 </div><!--yy-plugin-icon-->
216 247
217 - We are happy to see that you are using our <b><?php echo $plugin_name; ?></b> plugin for some time now.
218 - We at <a href="<?php echo $developer_website; ?>" target="_blank">YYDevelopment</a> share our plugin for free under GPLv2 license and the only thing we ask in return is that you give a <a href="<?php echo $plugin_review_page; ?>" target="_blank">positive review</a> if you liked it.
248 + We are happy to see that you are using our <b><?php echo esc_html($plugin_name); ?></b> plugin for some time now.
249 + We at <a href="<?php echo esc_url($developer_website); ?>" target="_blank">YYDevelopment</a> share our plugin for free under GPLv2 license and the only thing we ask in return is that you give a <a href="<?php echo esc_url($plugin_review_page); ?>" target="_blank">positive review</a> if you liked it.
219 250
220 251 <div class="notice-buttons">
221 - <a class="button button-primary yy-review-plugin" href="<?php echo $plugin_review_page; ?>" target="_blank">Yes!!! This plugin saved my life I love it and I will be happy to give it 5 stars review :)</a>
252 + <a class="button button-primary yy-review-plugin" href="<?php echo esc_url($plugin_review_page); ?>" target="_blank">Yes!!! This plugin saved my life I love it and I will be happy to give it 5 stars review :)</a>
222 253 <a class="button yy-plugin-dismiss-for-now" href="#" target="_blank">I am busy dude ask me again later</a>
223 254 <a class="button button-secondary yy-plugin-dismiss-forever" href="#" target="_blank">Never show this message again :(</a>
224 255 </div><!--notice-buttons-->
225 256
226 - If you have problems with the plugin you can submit a ticket at our <a href="<?php echo $plugin_support_link; ?>" target="_blank">plugin support page</a> and we will be happy to help.
227 - You are also welcome to check <a href="<?php echo $company_plugins_page; ?>" target="_blank">our other free wordpress plugins</a>.
257 + If you have problems with the plugin you can submit a ticket at our <a href="<?php echo esc_url($plugin_support_link); ?>" target="_blank">plugin support page</a> and we will be happy to help.
258 + You are also welcome to check our other <a href="<?php echo esc_url($company_plugins_page); ?>" target="_blank">free wordpress plugins</a>. And if you want to help support this FREE plugins <a target="_blank" href="<?php echo esc_url($plugin_donate_link); ?>">buy us a coffee</a>.
228 259
229 - <div class="yy-bottom-plugin-name "><?php echo $plugin_name; ?> Plugin</div>
260 + <div class="yy-bottom-plugin-name "><?php echo esc_html($plugin_name); ?> Plugin</div>
230 261
231 262 </div><!--yydev_phone_btn_notice_style-->
232 263
233 264 <?php