PluginProbe ʕ •ᴥ•ʔ
Advanced Ads – Ad Manager & AdSense / 2.0.24
Advanced Ads – Ad Manager & AdSense v2.0.24
2.0.24 2.0.23 2.0.22 2.0.21 1.38.0 1.39.0 1.39.1 1.39.2 1.39.3 1.39.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.40.0 1.40.1 1.40.2 1.41.0 1.42.0 1.42.1 1.42.2 1.43.0 1.44.0 1.44.1 1.45.0 1.45.1 1.46.0 1.47.0 1.47.1 1.47.2 1.47.3 1.47.4 1.47.5 1.48.0 1.48.1 1.49.0 1.5.0 1.5.0.1 1.5.1 1.5.2 1.5.2.1 1.5.4 1.5.4.1 1.5.5 1.50.0 1.51.0 1.51.1 1.51.2 1.51.3 1.52.0 1.52.1 1.52.2 1.52.3 1.52.4 1.53.0 1.53.1 1.53.2 1.54.0 1.54.1 1.55.0 1.56.0 1.56.1 1.56.2 1.56.3 1.56.4 1.6 1.6.1 1.6.10 1.6.10.1 1.6.10.2 1.6.11 1.6.11.1 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.17.1 1.6.17.2 1.6.2 1.6.2.1 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.6.1 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.6.8.3 1.6.9 1.6.9.1 1.6.9.2 1.6.9.3 1.6.9.4 1.7 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.1.1 1.7.1.2 1.7.1.3 1.7.1.4 1.7.1.5 1.7.10 trunk 1.7.11 1.0.1 1.7.12 1.0.2 1.7.13 1.0.3 1.7.14 1.1.0 1.7.15 1.1.1 1.7.16 1.1.2 1.7.17 1.1.3 1.7.18 1.10 1.7.19 1.10.1 1.7.2 1.10.10 1.7.2.1 1.10.11 1.7.20 1.10.12 1.7.21 1.10.2 1.7.22 1.10.3 1.7.23 1.10.4 1.7.24 1.10.5 1.7.25 1.10.6 1.7.3 1.10.7 1.7.4 1.10.8 1.7.4.1 1.10.9 1.7.4.2 1.11 1.7.4.3 1.11.1 1.7.4.4 1.11.2 1.7.4.5 1.12 1.7.5 1.13 1.7.5.1 1.13.1 1.7.6 1.13.2 1.7.7 1.13.3 1.7.8 1.13.4 1.7.9 1.13.5 1.7.9.1 1.13.6 1.7.9.2 1.13.7 1.7.9.3 1.13.8 1.8 1.14 1.8.1 1.14.1 1.8.10 1.14.10 1.8.11 1.14.11 1.8.12 1.14.2 1.8.13 1.14.3 1.8.14 1.14.4 1.8.15 1.14.5 1.8.16 1.14.6 1.8.17 1.14.7 1.8.18 1.14.8 1.8.19 1.14.9 1.8.2 1.15 1.8.20 1.16 1.8.21 1.16.1 1.8.22 1.17 1.8.23 1.17.1 1.8.24 1.17.10 1.8.25 1.17.10-rc.1 1.8.26 1.17.11 1.8.27 1.17.12 1.8.28 1.17.12-rc.1 1.8.29 1.17.2 1.8.3 1.17.3 1.8.30 1.17.4 1.8.4 1.17.5 1.8.5 1.17.6 1.8.6 1.17.7 1.8.7 1.17.8 1.8.8 1.17.9 1.8.9 1.17.9-beta.1 1.9 1.18.0 2.0.0 1.19.0 2.0.1 1.19.1 2.0.10 1.2 2.0.11 1.2.1 2.0.12 1.2.2 2.0.13 1.2.3 2.0.14 1.2.4 2.0.15 1.2.5 2.0.16 1.2.6 2.0.17 1.2.7 2.0.18 1.20.0 2.0.19 1.20.0-rc.1 2.0.2 1.20.0-rc.2 2.0.20 1.20.1 2.0.3 1.20.2 2.0.4 1.20.3 2.0.5 1.21.0 2.0.6 1.21.1 2.0.7 1.22.0 2.0.8 1.22.1 2.0.9 1.22.2 1.23.0 1.23.1 1.23.2 1.24.0 1.24.1 1.24.2 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.29.0 1.29.1 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.30.0 1.30.1 1.30.2 1.30.2-rc.1 1.30.3 1.30.4 1.30.4-rc.1 1.30.5 1.31.0 1.31.1 1.32.0 1.32.0-rc.1 1.33.0 1.33.1 1.33.2 1.34.0 1.35.0 1.35.1 1.36.0 1.36.1 1.36.2 1.36.3 1.37.0 1.37.1 1.37.2
advanced-ads / includes / admin / class-action-links.php
advanced-ads / includes / admin Last commit date
ads 1 week ago groups 1 week ago metaboxes 1 year ago pages 3 months ago placements 1 week ago class-action-links.php 1 week ago class-addon-box.php 1 year ago class-addon-updater.php 3 months ago class-admin-menu.php 1 week ago class-admin-notices.php 1 year ago class-ajax.php 3 months ago class-assets.php 1 week ago class-authors.php 1 year ago class-edd-updater.php 4 weeks ago class-list-filters.php 1 week ago class-marketing.php 1 year ago class-metabox-ad-settings.php 1 year ago class-metabox-ad.php 1 year ago class-misc.php 1 week ago class-page-quick-edit.php 1 year ago class-plugin-installer.php 1 year ago class-post-list.php 1 year ago class-post-types.php 1 week ago class-screen-options.php 3 months ago class-settings.php 1 year ago class-shortcode-creator.php 1 year ago class-system-info.php 1 year ago class-tinymce.php 2 years ago class-translation-promo.php 1 year ago class-upgrades.php 1 year ago class-version-control.php 3 months ago class-welcome.php 1 year ago class-wordpress-dashboard.php 1 year ago index.php 2 years ago
class-action-links.php
176 lines
1 <?php
2 /**
3 * The class manages various admin action links, feedback submission and text overrides in footer.
4 *
5 * @package AdvancedAds
6 * @author Advanced Ads <info@wpadvancedads.com>
7 * @since 1.47.0
8 */
9
10 namespace AdvancedAds\Admin;
11
12 use WP_User;
13 use Advanced_Ads;
14 use AdvancedAds\Utilities\Conditional;
15 use AdvancedAds\Framework\Utilities\Params;
16 use AdvancedAds\Framework\Interfaces\Integration_Interface;
17
18 defined( 'ABSPATH' ) || exit;
19
20 /**
21 * Action Links.
22 */
23 class Action_Links implements Integration_Interface {
24
25 /**
26 * Hook into WordPress.
27 *
28 * @return void
29 */
30 public function hooks(): void {
31 add_filter( 'plugin_action_links_' . ADVADS_PLUGIN_BASENAME, [ $this, 'add_links' ] );
32 add_filter( 'admin_footer', [ $this, 'add_deactivation_popup' ] );
33 add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ], 100 );
34 add_action( 'wp_ajax_advads_send_feedback', [ $this, 'send_feedback' ] );
35 }
36
37 /**
38 * Add links to the plugins list
39 *
40 * @param array $links array of links for the plugins, adapted when the current plugin is found.
41 *
42 * @return array
43 */
44 public function add_links( $links ): array {
45 // Early bail!!
46 if ( ! is_array( $links ) ) {
47 return $links;
48 }
49
50 // Add support page link.
51 $support_link = sprintf(
52 '<a href="%1$s">%2$s</a>',
53 esc_url( admin_url( 'admin.php?page=advanced-ads-settings#top#support' ) ),
54 __( 'Support', 'advanced-ads' )
55 );
56
57 // Add add-ons link.
58 $extend_link = defined( 'AAP_VERSION' )
59 ? '<a href="https://wpadvancedads.com/add-ons/?utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page-add-ons" target="_blank">' . __( 'Add-Ons', 'advanced-ads' ) . '</a>'
60 : '<a href="https://wpadvancedads.com/add-ons/all-access/?utm_source=advanced-ads&utm_medium=link&utm_campaign=plugin-page-features" target="_blank" class="aa-get-pro">' . __( 'See Pro Features', 'advanced-ads' ) . '</a>';
61
62 array_unshift( $links, $support_link, $extend_link );
63
64 return $links;
65 }
66
67 /**
68 * Display deactivation logic on plugins page
69 *
70 * @since 1.7.14
71 *
72 * @return void
73 */
74 public function add_deactivation_popup(): void {
75 $screen = get_current_screen();
76 if ( ! isset( $screen->id ) || ! in_array( $screen->id, [ 'plugins', 'plugins-network' ], true ) ) {
77 return;
78 }
79
80 $from = '';
81 $email = '';
82 $current_user = wp_get_current_user();
83 if ( $current_user instanceof WP_User ) {
84 $from = sprintf( '%1$s <%2$s>', $current_user->user_nicename, trim( $current_user->user_email ) );
85 $email = $current_user->user_email;
86 }
87
88 include ADVADS_ABSPATH . 'views/admin/feedback-disable.php';
89 }
90
91 /**
92 * Overrides WordPress text in Footer
93 *
94 * @param string $text The footer text.
95 *
96 * @return string
97 */
98 public function admin_footer_text( $text ): string {
99 if ( Conditional::is_screen_advanced_ads() ) {
100 return sprintf(
101 /* translators: %1$s is the URL to add a new review */
102 __( 'Thank the developer with a &#9733;&#9733;&#9733;&#9733;&#9733; review on <a href="%1$s" target="_blank">wordpress.org</a>', 'advanced-ads' ),
103 'https://wordpress.org/support/plugin/advanced-ads/reviews/#new-post'
104 );
105 }
106
107 return (string) $text;
108 }
109
110 /**
111 * Send feedback via email
112 *
113 * @since 1.7.14
114 *
115 * @return void
116 */
117 public function send_feedback(): void {
118 $data = Params::post( 'formdata' );
119 if ( ! $data ) {
120 wp_die();
121 }
122
123 wp_parse_str( wp_unslash( $data ), $form );
124
125 if ( ! wp_verify_nonce( $form['advanced_ads_disable_form_nonce'], 'advanced_ads_disable_form' ) ) {
126 wp_die();
127 }
128
129 $email = trim( $form['advanced_ads_disable_reply_email'] );
130 if ( empty( $email ) || ! is_email( $email ) ) {
131 die();
132 }
133
134 $text = '';
135 $headers = [];
136 $options = Advanced_Ads::get_instance()->internal_options();
137 $installed = isset( $options['installed'] ) ? gmdate( 'd.m.Y', $options['installed'] ) : '';
138 $from = $form['advanced_ads_disable_from'] ?? '';
139 $subject = ( $form['advanced_ads_disable_reason'] ?? '(no reason given)' ) . ' (Advanced Ads)';
140
141 if ( isset( $form['advanced_ads_disable_text'] ) ) {
142 $text = implode( "\n\r", $form['advanced_ads_disable_text'] );
143 }
144 $text .= "\n\n" . home_url() . " ($installed)";
145
146 // The user clicked on the "don’t disable" button or if an address is given in the form then use that one.
147 if (
148 isset( $form['advanced_ads_disable_reason'] ) &&
149 'get help' === $form['advanced_ads_disable_reason']
150 ) {
151 $current_user = wp_get_current_user();
152 $name = ( $current_user instanceof WP_User ) ? $current_user->user_nicename : '';
153 $from = $name . ' <' . $email . '>';
154 $is_german = ( preg_match( '/\.de$/', $from ) || 'de_' === substr( get_locale(), 0, 3 ) || 'de_' === substr( get_user_locale(), 0, 3 ) );
155
156 if ( '' !== trim( $form['advanced_ads_disable_text'][0] ?? '' ) ) {
157 $text .= $is_german
158 ? "\n\n Hilfe ist auf dem Weg."
159 : "\n\n Help is on its way.";
160 } else {
161 $text .= $is_german
162 ? "\n\n Vielen Dank für das Feedback."
163 : "\n\n Thank you for your feedback.";
164 }
165 }
166
167 if ( $from ) {
168 $headers[] = "From: $from";
169 $headers[] = "Reply-To: $from";
170 }
171
172 wp_mail( 'support@wpadvancedads.com', $subject, $text, $headers );
173 die();
174 }
175 }
176