@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: http://docs.givewp.com/docs */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'http://docs.givewp.com/docs' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('http://docs.givewp.com/docs') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | - <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
207 | + <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
210 | 210 | </ul> |
211 | 211 | |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="content feature-section-item last-feature"> |
215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
217 | 217 | </div> |
218 | 218 | |
219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function changelog_screen() { |
235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
236 | 236 | ?> |
237 | 237 | <div class="wrap about-wrap"> |
238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <p class="about-text"><?php |
241 | 241 | printf( |
242 | 242 | /* translators: %s: Give version */ |
243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
244 | 244 | $display_version |
245 | 245 | ); |
246 | 246 | ?></p> |
247 | 247 | <div class="give-badge"><?php |
248 | 248 | printf( |
249 | 249 | /* translators: %s: Give version */ |
250 | - esc_html__( 'Version %s', 'give' ), |
|
250 | + esc_html__('Version %s', 'give'), |
|
251 | 251 | $display_version |
252 | 252 | ); |
253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php $this->tabs(); ?> |
256 | 256 | |
257 | 257 | <div class="changelog"> |
258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
259 | 259 | |
260 | 260 | <div class="feature-section"> |
261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="return-to-dashboard"> |
266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
267 | 267 | 'post_type' => 'give_forms', |
268 | 268 | 'page' => 'give-settings' |
269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function getting_started_screen() { |
283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
284 | 284 | ?> |
285 | 285 | <div class="wrap about-wrap get-started"> |
286 | 286 | |
287 | 287 | <?php $this->get_welcome_header() ?> |
288 | 288 | |
289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
290 | 290 | |
291 | 291 | <?php give_get_newsletter(); ?> |
292 | 292 | |
293 | 293 | <div class="give-badge"><?php |
294 | 294 | printf( |
295 | 295 | /* translators: %s: Give version */ |
296 | - esc_html__( 'Version %s', 'give' ), |
|
296 | + esc_html__('Version %s', 'give'), |
|
297 | 297 | $display_version |
298 | 298 | ); |
299 | 299 | ?></div> |
300 | 300 | |
301 | 301 | <?php $this->tabs(); ?> |
302 | 302 | |
303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
304 | 304 | |
305 | 305 | <div class="feature-section clearfix"> |
306 | 306 | |
307 | 307 | <div class="content feature-section-item"> |
308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
309 | 309 | |
310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
313 | 313 | </div> |
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="content feature-section-item last-feature"> |
329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
330 | 330 | |
331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
332 | 332 | </div> |
333 | 333 | |
334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | <div class="feature-section clearfix"> |
338 | 338 | |
339 | 339 | <div class="content feature-section-item add-content"> |
340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
341 | 341 | |
342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
343 | 343 | |
344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
345 | 345 | </div> |
346 | 346 | |
347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class="content feature-section-item last-feature"> |
361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
362 | 362 | |
363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
364 | 364 | </div> |
365 | 365 | |
366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function credits_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap"> |
386 | 386 | |
387 | 387 | <?php $this->get_welcome_header() ?> |
388 | 388 | |
389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
390 | 390 | |
391 | 391 | <?php give_get_newsletter(); ?> |
392 | 392 | |
393 | 393 | <div class="give-badge"><?php |
394 | 394 | printf( |
395 | 395 | /* translators: %s: Give version */ |
396 | - esc_html__( 'Version %s', 'give' ), |
|
396 | + esc_html__('Version %s', 'give'), |
|
397 | 397 | $display_version |
398 | 398 | ); |
399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | <p class="about-description"><?php |
404 | 404 | printf( |
405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
407 | + esc_url('https://github.com/WordImpress/give') |
|
408 | 408 | ); |
409 | 409 | ?></p> |
410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * @return string $readme HTML formatted readme file |
422 | 422 | */ |
423 | 423 | public function parse_readme() { |
424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
425 | 425 | |
426 | - if ( ! $file ) { |
|
427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
426 | + if ( ! $file) { |
|
427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
428 | 428 | } else { |
429 | - $readme = file_get_contents( $file ); |
|
430 | - $readme = nl2br( esc_html( $readme ) ); |
|
431 | - $readme = explode( '== Changelog ==', $readme ); |
|
432 | - $readme = end( $readme ); |
|
433 | - |
|
434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
429 | + $readme = file_get_contents($file); |
|
430 | + $readme = nl2br(esc_html($readme)); |
|
431 | + $readme = explode('== Changelog ==', $readme); |
|
432 | + $readme = end($readme); |
|
433 | + |
|
434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | public function contributors() { |
453 | 453 | $contributors = $this->get_contributors(); |
454 | 454 | |
455 | - if ( empty( $contributors ) ) { |
|
455 | + if (empty($contributors)) { |
|
456 | 456 | return ''; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
460 | 460 | |
461 | - foreach ( $contributors as $contributor ) { |
|
461 | + foreach ($contributors as $contributor) { |
|
462 | 462 | $contributor_list .= '<li class="wp-person">'; |
463 | 463 | $contributor_list .= sprintf( |
464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
466 | - esc_url( $contributor->avatar_url ), |
|
467 | - esc_attr( $contributor->login ) |
|
465 | + esc_url('https://github.com/'.$contributor->login), |
|
466 | + esc_url($contributor->avatar_url), |
|
467 | + esc_attr($contributor->login) |
|
468 | 468 | ); |
469 | 469 | $contributor_list .= sprintf( |
470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
472 | - esc_html( $contributor->login ) |
|
471 | + esc_url('https://github.com/'.$contributor->login), |
|
472 | + esc_html($contributor->login) |
|
473 | 473 | ); |
474 | 474 | $contributor_list .= '</li>'; |
475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
487 | 487 | * @return array $contributors List of contributors |
488 | 488 | */ |
489 | 489 | public function get_contributors() { |
490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
491 | 491 | |
492 | - if ( false !== $contributors ) { |
|
492 | + if (false !== $contributors) { |
|
493 | 493 | return $contributors; |
494 | 494 | } |
495 | 495 | |
496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
497 | 497 | |
498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
499 | 499 | return array(); |
500 | 500 | } |
501 | 501 | |
502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
503 | 503 | |
504 | - if ( ! is_array( $contributors ) ) { |
|
504 | + if ( ! is_array($contributors)) { |
|
505 | 505 | return array(); |
506 | 506 | } |
507 | 507 | |
508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
509 | 509 | |
510 | 510 | return $contributors; |
511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function get_welcome_header() { |
519 | 519 | // Badge for welcome page |
520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
521 | 521 | ?> |
522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
611 | 611 | printf( |
612 | 612 | /* translators: %s: Give twitter user @givewp */ |
613 | - esc_html_e( 'Follow %s', 'give' ), |
|
613 | + esc_html_e('Follow %s', 'give'), |
|
614 | 614 | '@givewp' |
615 | 615 | ); |
616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
644 | 644 | public function welcome() { |
645 | 645 | |
646 | 646 | // Bail if no activation redirect |
647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) { |
|
647 | + if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) { |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Delete the redirect transient |
652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
653 | 653 | |
654 | 654 | // Bail if activating from network, or bulk |
655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | 658 | |
659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
660 | 660 | |
661 | - if ( ! $upgrade ) { // First time install |
|
662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
661 | + if ( ! $upgrade) { // First time install |
|
662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
663 | 663 | exit; |
664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
665 | 665 | |
666 | 666 | } else { // Welcome is NOT disabled in settings |
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | 669 | } |
670 | 670 | } |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_New_Offline_Donation_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_New_Offline_Donation_Email |
@@ -36,32 +36,32 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'new-offline-donation', |
43 | - 'label' => __( 'New Offline Donation', 'give' ), |
|
44 | - 'description' => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ), |
|
43 | + 'label' => __('New Offline Donation', 'give'), |
|
44 | + 'description' => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'), |
|
45 | 45 | 'has_recipient_field' => true, |
46 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
46 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tags_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | 51 | 'default_email_subject' => $this->get_default_email_subject(), |
52 | 52 | 'default_email_message' => $this->get_default_email_message(), |
53 | 53 | 'notices' => array( |
54 | 54 | 'non-notification-status-editable' => sprintf( |
55 | 55 | '%1$s <a href="%2$s">%3$s »</a>', |
56 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
57 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
58 | - __( 'Edit Setting', 'give' ) |
|
56 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
57 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
58 | + __('Edit Setting', 'give') |
|
59 | 59 | ) |
60 | 60 | ), |
61 | - ) ); |
|
61 | + )); |
|
62 | 62 | |
63 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
64 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
63 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
64 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | $subject = apply_filters( |
82 | 82 | 'give_offline_admin_donation_notification_subject', |
83 | - __( 'New Pending Donation', 'give' ) |
|
83 | + __('New Pending Donation', 'give') |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | /** |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | * @return string |
106 | 106 | */ |
107 | 107 | public function get_default_email_message() { |
108 | - $message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
109 | - $message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
110 | - $message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
108 | + $message = __('Dear Admin,', 'give')."\n\n"; |
|
109 | + $message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
110 | + $message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
111 | 111 | |
112 | - $message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
113 | - $message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
112 | + $message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
113 | + $message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
114 | 114 | |
115 | 115 | $message .= sprintf( |
116 | 116 | '<a href="%1$s">%2$s</a>', |
117 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ), |
|
118 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
119 | - ) . "\n\n"; |
|
117 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID), |
|
118 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
119 | + )."\n\n"; |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Filter the donation receipt email message |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public function get_email_message( $form_id = null ) { |
|
157 | + public function get_email_message($form_id = null) { |
|
158 | 158 | $message = Give_Email_Notification_Util::get_value( |
159 | 159 | $this, |
160 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
160 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
161 | 161 | $form_id, |
162 | 162 | $this->config['default_email_message'] |
163 | 163 | ); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return array |
199 | 199 | */ |
200 | - public function get_email_attachments( $form_id = null ) { |
|
200 | + public function get_email_attachments($form_id = null) { |
|
201 | 201 | /** |
202 | 202 | * Filter the attachments. |
203 | 203 | * Note: This filter will deprecate soon. |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param int $payment_id |
250 | 250 | */ |
251 | - public function setup_email_notification( $payment_id ) { |
|
252 | - $this->payment = new Give_Payment( $payment_id ); |
|
251 | + public function setup_email_notification($payment_id) { |
|
252 | + $this->payment = new Give_Payment($payment_id); |
|
253 | 253 | |
254 | 254 | // Exit if not donation was not with offline donation. |
255 | - if ( 'offline' !== $this->payment->gateway ) { |
|
255 | + if ('offline' !== $this->payment->gateway) { |
|
256 | 256 | return; |
257 | 257 | } |
258 | 258 | |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $this->setup_email_data(); |
261 | 261 | |
262 | 262 | // Send email. |
263 | - $this->send_email_notification( array( |
|
263 | + $this->send_email_notification(array( |
|
264 | 264 | 'payment_id' => $this->payment->ID, |
265 | - ) ); |
|
265 | + )); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -274,18 +274,18 @@ discard block |
||
274 | 274 | * @param $update_options |
275 | 275 | * @param $option_name |
276 | 276 | */ |
277 | - public function set_notification_status( $update_options, $option_name ) { |
|
277 | + public function set_notification_status($update_options, $option_name) { |
|
278 | 278 | // Get updated settings. |
279 | 279 | $update_options = give_get_settings(); |
280 | 280 | |
281 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
281 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
282 | 282 | |
283 | 283 | if ( |
284 | - empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
285 | - || $notification_status !== $update_options[ "{$this->config['id']}_notification" ] |
|
284 | + empty($update_options["{$this->config['id']}_notification"]) |
|
285 | + || $notification_status !== $update_options["{$this->config['id']}_notification"] |
|
286 | 286 | ) { |
287 | - $update_options[ "{$this->config['id']}_notification" ] = $notification_status; |
|
288 | - update_option( $option_name, $update_options ); |
|
287 | + $update_options["{$this->config['id']}_notification"] = $notification_status; |
|
288 | + update_option($option_name, $update_options); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return array |
302 | 302 | */ |
303 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
303 | + public function add_metabox_setting_field($settings, $form_id) { |
|
304 | 304 | |
305 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
305 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
306 | 306 | $settings[] = array( |
307 | 307 | 'id' => $this->config['id'], |
308 | 308 | 'title' => $this->config['label'], |
309 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
309 | + 'fields' => $this->get_setting_fields($form_id), |
|
310 | 310 | ); |
311 | 311 | } |
312 | 312 |
@@ -19,28 +19,28 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return array |
21 | 21 | */ |
22 | -function give_email_notification_row_actions_callback( $row_actions, $email ) { |
|
23 | - if( Give_Email_Notification_Util::is_email_preview( $email ) ) { |
|
22 | +function give_email_notification_row_actions_callback($row_actions, $email) { |
|
23 | + if (Give_Email_Notification_Util::is_email_preview($email)) { |
|
24 | 24 | $preview_link = sprintf( |
25 | 25 | '<a href="%1$s" target="_blank">%2$s</a>', |
26 | 26 | wp_nonce_url( |
27 | 27 | add_query_arg( |
28 | - array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ), |
|
28 | + array('give_action' => 'preview_email', 'email_type' => $email->config['id']), |
|
29 | 29 | home_url() |
30 | 30 | ), 'give-preview-email' |
31 | 31 | ), |
32 | - __( 'Preview', 'give' ) |
|
32 | + __('Preview', 'give') |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | $send_preview_email_link = sprintf( |
36 | 36 | '<a href="%1$s">%2$s</a>', |
37 | 37 | wp_nonce_url( |
38 | - add_query_arg( array( |
|
38 | + add_query_arg(array( |
|
39 | 39 | 'give_action' => 'send_preview_email', |
40 | 40 | 'email_type' => $email->config['id'], |
41 | 41 | 'give-message' => 'sent-test-email', |
42 | - ) ), 'give-send-preview-email' ), |
|
43 | - __( 'Send test email', 'give' ) |
|
42 | + )), 'give-send-preview-email' ), |
|
43 | + __('Send test email', 'give') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | $row_actions['email_preview'] = $preview_link; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | return $row_actions; |
51 | 51 | } |
52 | -add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 ); |
|
52 | +add_filter('give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * This help to decode all email template tags. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_decode_email_tags( $message, $email_obj ) { |
|
65 | - if ( ! empty( $email_obj->tag_args ) ) { |
|
66 | - $message = give_do_email_tags( $message, $email_obj->tag_args ); |
|
64 | +function give_decode_email_tags($message, $email_obj) { |
|
65 | + if ( ! empty($email_obj->tag_args)) { |
|
66 | + $message = give_do_email_tags($message, $email_obj->tag_args); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $message; |
70 | 70 | } |
71 | 71 | |
72 | -add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 ); |
|
73 | 72 | \ No newline at end of file |
73 | +add_filter('give_email_message', 'give_decode_email_tags', 10, 2); |
|
74 | 74 | \ No newline at end of file |
@@ -175,10 +175,10 @@ |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
178 | + __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | + get_bloginfo( 'url' ), |
|
180 | + get_bloginfo( 'admin_email' ) |
|
181 | + ) . "\n\n"; |
|
182 | 182 | $message .= '{email_access_link}' . "\n\n"; |
183 | 183 | $message .= "\n\n"; |
184 | 184 | $message .= __( 'Sincerely,', 'give' ) . "\n"; |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if access directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Email_Access_Email' ) ) : |
|
18 | +if ( ! class_exists('Give_Email_Access_Email')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Email_Access_Email |
@@ -31,30 +31,30 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'email-access', |
36 | - 'label' => __( 'Email access', 'give' ), |
|
37 | - 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ), |
|
38 | - 'notification_status' => give_get_option( 'email_access', 'disabled' ), |
|
36 | + 'label' => __('Email access', 'give'), |
|
37 | + 'description' => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'), |
|
38 | + 'notification_status' => give_get_option('email_access', 'disabled'), |
|
39 | 39 | 'form_metabox_setting' => false, |
40 | 40 | 'notification_status_editable' => false, |
41 | 41 | 'email_tag_context' => 'donor', |
42 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
43 | - 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ), |
|
42 | + 'recipient_group_name' => __('Donor', 'give'), |
|
43 | + 'default_email_subject' => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')), |
|
44 | 44 | 'default_email_message' => $this->get_default_email_message(), |
45 | 45 | 'notices' => array( |
46 | 46 | 'non-notification-status-editable' => sprintf( |
47 | 47 | '%1$s <a href="%2$s">%3$s »</a>', |
48 | - __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ), |
|
49 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control') ), |
|
50 | - __( 'Edit Setting', 'give' ) |
|
48 | + __('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'), |
|
49 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control')), |
|
50 | + __('Edit Setting', 'give') |
|
51 | 51 | ) |
52 | 52 | ), |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | |
55 | - add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 ); |
|
56 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
57 | - add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 ); |
|
55 | + add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2); |
|
56 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
57 | + add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function get_email_subject( $form_id = null ) { |
|
71 | + public function get_email_subject($form_id = null) { |
|
72 | 72 | $subject = wp_strip_all_tags( |
73 | 73 | Give_Email_Notification_Util::get_value( |
74 | 74 | $this, |
75 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
75 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
76 | 76 | $form_id, |
77 | 77 | $this->config['default_email_subject'] |
78 | 78 | ) |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @since 1.0 |
86 | 86 | */ |
87 | - $subject = apply_filters( 'give_email_access_token_subject', $subject ); |
|
87 | + $subject = apply_filters('give_email_access_token_subject', $subject); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Filters the donation notification subject. |
91 | 91 | * |
92 | 92 | * @since 2.0 |
93 | 93 | */ |
94 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
94 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
95 | 95 | |
96 | 96 | return $subject; |
97 | 97 | } |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function get_email_message( $form_id = null ) { |
|
110 | + public function get_email_message($form_id = null) { |
|
111 | 111 | $message = Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_message'] |
116 | 116 | ); |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @since 1.0 |
123 | 123 | */ |
124 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
124 | + $message = apply_filters('give_email_access_token_message', $message); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter the email message |
128 | 128 | * |
129 | 129 | * @since 2.0 |
130 | 130 | */ |
131 | - $message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id ); |
|
131 | + $message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id); |
|
132 | 132 | |
133 | 133 | return $message; |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param int $form_id |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function get_email_attachments( $form_id = null ) { |
|
146 | + public function get_email_attachments($form_id = null) { |
|
147 | 147 | /** |
148 | 148 | * Filters the donation notification email attachments. |
149 | 149 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array() ); |
|
154 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array()); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Filters the donation notification email attachments. |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 2.0 |
161 | 161 | */ |
162 | - $attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id ); |
|
162 | + $attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id); |
|
163 | 163 | |
164 | 164 | return $attachments; |
165 | 165 | } |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
182 | - $message .= '{email_access_link}' . "\n\n"; |
|
178 | + __('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'), |
|
179 | + get_bloginfo('url'), |
|
180 | + get_bloginfo('admin_email') |
|
181 | + )."\n\n"; |
|
182 | + $message .= '{email_access_link}'."\n\n"; |
|
183 | 183 | $message .= "\n\n"; |
184 | - $message .= __( 'Sincerely,', 'give' ) . "\n"; |
|
185 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
184 | + $message .= __('Sincerely,', 'give')."\n"; |
|
185 | + $message .= get_bloginfo('name')."\n"; |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filter the new donation email message |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param string $message |
193 | 193 | */ |
194 | - return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this ); |
|
194 | + return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @since 1.0 |
209 | 209 | */ |
210 | - $from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() ); |
|
210 | + $from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name()); |
|
211 | 211 | |
212 | 212 | /** |
213 | 213 | * Filters the from email. |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.0 |
217 | 217 | */ |
218 | - $from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() ); |
|
218 | + $from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address()); |
|
219 | 219 | |
220 | - Give()->emails->__set( 'from_name', $from_name ); |
|
221 | - Give()->emails->__set( 'from_email', $from_email ); |
|
222 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Confirm Email', 'give' ) ) ); |
|
220 | + Give()->emails->__set('from_name', $from_name); |
|
221 | + Give()->emails->__set('from_email', $from_email); |
|
222 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Confirm Email', 'give'))); |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Filters the donation notification email headers. |
226 | 226 | * |
227 | 227 | * @since 1.0 |
228 | 228 | */ |
229 | - $headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() ); |
|
229 | + $headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers()); |
|
230 | 230 | |
231 | - Give()->emails->__set( 'headers', $headers ); |
|
231 | + Give()->emails->__set('headers', $headers); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return bool |
244 | 244 | */ |
245 | - public function setup_email_notification( $donor_id, $email ) { |
|
246 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
245 | + public function setup_email_notification($donor_id, $email) { |
|
246 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
247 | 247 | $this->recipient_email = $email; |
248 | 248 | |
249 | 249 | // Set email data. |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | * @param $update_options |
269 | 269 | * @param $option_name |
270 | 270 | */ |
271 | - public function set_notification_status( $update_options, $option_name ) { |
|
271 | + public function set_notification_status($update_options, $option_name) { |
|
272 | 272 | // Get updated settings. |
273 | 273 | $update_options = give_get_settings(); |
274 | 274 | |
275 | 275 | if ( |
276 | - ! empty( $update_options['email_access'] ) |
|
277 | - && ! empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
278 | - && $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ] |
|
276 | + ! empty($update_options['email_access']) |
|
277 | + && ! empty($update_options["{$this->config['id']}_notification"]) |
|
278 | + && $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"] |
|
279 | 279 | ) { |
280 | - $update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access']; |
|
281 | - update_option( $option_name, $update_options ); |
|
280 | + $update_options["{$this->config['id']}_notification"] = $update_options['email_access']; |
|
281 | + update_option($option_name, $update_options); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | * @param Give_Email_Access_Email $email |
294 | 294 | * @return string |
295 | 295 | */ |
296 | - public function email_preview_header( $email_preview_header, $email ) { |
|
297 | - if( $this->config['id'] === $email->config['id'] ) { |
|
296 | + public function email_preview_header($email_preview_header, $email) { |
|
297 | + if ($this->config['id'] === $email->config['id']) { |
|
298 | 298 | $email_preview_header = ''; |
299 | 299 | } |
300 | 300 |
@@ -21,33 +21,33 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
25 | - $setting_fields = self::get_default_setting_fields( $email, $form_id ); |
|
24 | + public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
25 | + $setting_fields = self::get_default_setting_fields($email, $form_id); |
|
26 | 26 | |
27 | 27 | // Recipient field. |
28 | - if ( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
29 | - $setting_fields[] = self::get_recipient_setting_field( $email, $form_id ); |
|
28 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
29 | + $setting_fields[] = self::get_recipient_setting_field($email, $form_id); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | // Add extra setting field. |
34 | - if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) { |
|
35 | - $setting_fields = array_merge( $setting_fields, $extra_setting_field ); |
|
34 | + if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) { |
|
35 | + $setting_fields = array_merge($setting_fields, $extra_setting_field); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Preview field. |
39 | - if ( Give_Email_Notification_Util::has_preview( $email ) ) { |
|
40 | - $setting_fields[] = self::get_preview_setting_field( $email, $form_id ); |
|
39 | + if (Give_Email_Notification_Util::has_preview($email)) { |
|
40 | + $setting_fields[] = self::get_preview_setting_field($email, $form_id); |
|
41 | 41 | } |
42 | 42 | |
43 | - $setting_fields = self::add_section_end( $email, $setting_fields ); |
|
43 | + $setting_fields = self::add_section_end($email, $setting_fields); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Filter the email notification settings. |
47 | 47 | * |
48 | 48 | * @since 2.0 |
49 | 49 | */ |
50 | - return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id ); |
|
50 | + return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return bool |
63 | 63 | */ |
64 | - public static function has_section_end( $setting ) { |
|
65 | - $last_field = end( $setting ); |
|
64 | + public static function has_section_end($setting) { |
|
65 | + $last_field = end($setting); |
|
66 | 66 | $has_section_end = false; |
67 | 67 | |
68 | - if ( 'sectionend' === $last_field['type'] ) { |
|
68 | + if ('sectionend' === $last_field['type']) { |
|
69 | 69 | $has_section_end = true; |
70 | 70 | } |
71 | 71 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return array |
85 | 85 | */ |
86 | - public static function get_section_start( Give_Email_Notification $email, $form_id = null ) { |
|
86 | + public static function get_section_start(Give_Email_Notification $email, $form_id = null) { |
|
87 | 87 | // Add section end field. |
88 | 88 | $setting = array( |
89 | 89 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return array |
107 | 107 | */ |
108 | - public static function add_section_end( Give_Email_Notification $email, $setting ) { |
|
109 | - if ( ! self::has_section_end( $setting ) ) { |
|
108 | + public static function add_section_end(Give_Email_Notification $email, $setting) { |
|
109 | + if ( ! self::has_section_end($setting)) { |
|
110 | 110 | // Add section end field. |
111 | 111 | $setting[] = array( |
112 | 112 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -128,25 +128,25 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
132 | - $settings[] = self::get_section_start( $email, $form_id ); |
|
133 | - $settings[] = self::get_notification_status_field( $email, $form_id ); |
|
131 | + public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
132 | + $settings[] = self::get_section_start($email, $form_id); |
|
133 | + $settings[] = self::get_notification_status_field($email, $form_id); |
|
134 | 134 | |
135 | - if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) { |
|
136 | - if( $form_id || give_is_add_new_form_page() ){ |
|
135 | + if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) { |
|
136 | + if ($form_id || give_is_add_new_form_page()) { |
|
137 | 137 | // Do not allow admin to disable notification on perform basis. |
138 | - unset( $settings[1]['options']['disabled'] ); |
|
139 | - } else{ |
|
138 | + unset($settings[1]['options']['disabled']); |
|
139 | + } else { |
|
140 | 140 | // Do not allow admin to edit notification status globally. |
141 | - unset( $settings[1] ); |
|
141 | + unset($settings[1]); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - $settings[] = self::get_email_subject_field( $email, $form_id ); |
|
146 | - $settings[] = self::get_email_message_field( $email, $form_id ); |
|
145 | + $settings[] = self::get_email_subject_field($email, $form_id); |
|
146 | + $settings[] = self::get_email_message_field($email, $form_id); |
|
147 | 147 | |
148 | - if( Give_Email_Notification_Util::is_content_type_editable( $email ) ) { |
|
149 | - $settings[] = self::get_email_content_type_field( $email, $form_id ); |
|
148 | + if (Give_Email_Notification_Util::is_content_type_editable($email)) { |
|
149 | + $settings[] = self::get_email_content_type_field($email, $form_id); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $settings; |
@@ -163,31 +163,31 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array |
165 | 165 | */ |
166 | - public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) { |
|
166 | + public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) { |
|
167 | 167 | $option = array( |
168 | - 'enabled' => __( 'Enabled', 'give' ), |
|
169 | - 'disabled' => __( 'Disabled', 'give' ), |
|
168 | + 'enabled' => __('Enabled', 'give'), |
|
169 | + 'disabled' => __('Disabled', 'give'), |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | $default_value = $email->get_notification_status(); |
173 | 173 | |
174 | 174 | // Add global options. |
175 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
175 | + if ($form_id || give_is_add_new_form_page()) { |
|
176 | 176 | $option = array( |
177 | - 'global' => __( 'Global Options' ), |
|
178 | - 'enabled' => __( 'Customize', 'give' ), |
|
179 | - 'disabled' => __( 'Disabled', 'give' ), |
|
177 | + 'global' => __('Global Options'), |
|
178 | + 'enabled' => __('Customize', 'give'), |
|
179 | + 'disabled' => __('Disabled', 'give'), |
|
180 | 180 | ); |
181 | 181 | |
182 | 182 | $default_value = 'global'; |
183 | 183 | } |
184 | 184 | |
185 | - $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) ); |
|
185 | + $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails')); |
|
186 | 186 | |
187 | 187 | return array( |
188 | - 'name' => esc_html__( 'Notification', 'give' ), |
|
188 | + 'name' => esc_html__('Notification', 'give'), |
|
189 | 189 | 'desc' => $description, |
190 | - 'id' => self::get_prefix( $email, $form_id ) . 'notification', |
|
190 | + 'id' => self::get_prefix($email, $form_id).'notification', |
|
191 | 191 | 'type' => 'radio_inline', |
192 | 192 | 'default' => $default_value, |
193 | 193 | 'options' => $option, |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return array |
208 | 208 | */ |
209 | - public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) { |
|
209 | + public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) { |
|
210 | 210 | return array( |
211 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_subject', |
|
212 | - 'name' => esc_html__( 'Email Subject', 'give' ), |
|
213 | - 'desc' => esc_html__( 'Enter the email subject line.', 'give' ), |
|
211 | + 'id' => self::get_prefix($email, $form_id).'email_subject', |
|
212 | + 'name' => esc_html__('Email Subject', 'give'), |
|
213 | + 'desc' => esc_html__('Enter the email subject line.', 'give'), |
|
214 | 214 | 'default' => $email->config['default_email_subject'], |
215 | 215 | 'type' => 'text', |
216 | 216 | ); |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return array |
229 | 229 | */ |
230 | - public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) { |
|
231 | - $desc = esc_html__( 'Enter the email message.', 'give' ); |
|
230 | + public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) { |
|
231 | + $desc = esc_html__('Enter the email message.', 'give'); |
|
232 | 232 | |
233 | - if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) { |
|
233 | + if ($email_tag_list = $email->get_allowed_email_tags(true)) { |
|
234 | 234 | $desc = sprintf( |
235 | - esc_html__( 'The email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
235 | + esc_html__('The email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
236 | 236 | $email_tag_list |
237 | 237 | ); |
238 | 238 | |
239 | 239 | } |
240 | 240 | |
241 | 241 | return array( |
242 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_message', |
|
243 | - 'name' => esc_html__( 'Email message', 'give' ), |
|
242 | + 'id' => self::get_prefix($email, $form_id).'email_message', |
|
243 | + 'name' => esc_html__('Email message', 'give'), |
|
244 | 244 | 'desc' => $desc, |
245 | 245 | 'type' => 'wysiwyg', |
246 | 246 | 'default' => $email->config['default_email_message'], |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return array |
260 | 260 | */ |
261 | - public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) { |
|
261 | + public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) { |
|
262 | 262 | return array( |
263 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_content_type', |
|
264 | - 'name' => esc_html__( 'Email Content Type', 'give' ), |
|
265 | - 'desc' => __( 'Choose email type.', 'give' ), |
|
263 | + 'id' => self::get_prefix($email, $form_id).'email_content_type', |
|
264 | + 'name' => esc_html__('Email Content Type', 'give'), |
|
265 | + 'desc' => __('Choose email type.', 'give'), |
|
266 | 266 | 'type' => 'select', |
267 | 267 | 'options' => array( |
268 | - 'text/html' => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ), |
|
269 | - 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ), |
|
268 | + 'text/html' => Give_Email_Notification_Util::get_formatted_email_type('text/html'), |
|
269 | + 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'), |
|
270 | 270 | ), |
271 | 271 | 'default' => $email->config['content_type'], |
272 | 272 | ); |
@@ -285,29 +285,29 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return array |
287 | 287 | */ |
288 | - public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
289 | - $recipient = array( |
|
290 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
291 | - 'name' => esc_html__( 'Email Recipients', 'give' ), |
|
292 | - 'desc' => __( 'Enter the email address(es) that should receive a notification.', 'give' ), |
|
288 | + public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
289 | + $recipient = array( |
|
290 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
291 | + 'name' => esc_html__('Email Recipients', 'give'), |
|
292 | + 'desc' => __('Enter the email address(es) that should receive a notification.', 'give'), |
|
293 | 293 | 'type' => 'email', |
294 | - 'default' => get_bloginfo( 'admin_email' ), |
|
294 | + 'default' => get_bloginfo('admin_email'), |
|
295 | 295 | 'repeat' => true, |
296 | - 'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ), |
|
296 | + 'repeat_btn_title' => esc_html__('Add Recipient', 'give'), |
|
297 | 297 | ); |
298 | 298 | |
299 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
300 | - $recipient['name'] = __( 'Email', 'give' ); |
|
299 | + if ($form_id || give_is_add_new_form_page()) { |
|
300 | + $recipient['name'] = __('Email', 'give'); |
|
301 | 301 | $recipient['default'] = ''; |
302 | 302 | $recipient['id'] = 'email'; |
303 | - $recipient['desc'] = __( 'Enter the email address that should receive a notification.', 'give' ); |
|
303 | + $recipient['desc'] = __('Enter the email address that should receive a notification.', 'give'); |
|
304 | 304 | |
305 | 305 | $recipient = array( |
306 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
306 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
307 | 307 | 'type' => 'group', |
308 | 308 | 'options' => array( |
309 | - 'add_button' => __( 'Add Email', 'give' ), |
|
310 | - 'header_title' => __( 'Email Recipient', 'give' ), |
|
309 | + 'add_button' => __('Add Email', 'give'), |
|
310 | + 'header_title' => __('Email Recipient', 'give'), |
|
311 | 311 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
312 | 312 | ), |
313 | 313 | 'fields' => array( |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return array |
332 | 332 | */ |
333 | - public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
333 | + public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
334 | 334 | return array( |
335 | - 'name' => __( 'Preview Email', 'give' ), |
|
336 | - 'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
337 | - 'give' ), |
|
338 | - 'id' => self::get_prefix( $email, $form_id ) . 'preview_buttons', |
|
335 | + 'name' => __('Preview Email', 'give'), |
|
336 | + 'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
337 | + 'give'), |
|
338 | + 'id' => self::get_prefix($email, $form_id).'preview_buttons', |
|
339 | 339 | 'type' => 'email_preview_buttons', |
340 | 340 | ); |
341 | 341 | } |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return string |
354 | 354 | */ |
355 | - public static function get_prefix( Give_Email_Notification $email, $form_id = null ) { |
|
355 | + public static function get_prefix(Give_Email_Notification $email, $form_id = null) { |
|
356 | 356 | $meta_key = "{$email->config['id']}_"; |
357 | 357 | |
358 | - if( $form_id || give_is_add_new_form_page() ) { |
|
358 | + if ($form_id || give_is_add_new_form_page()) { |
|
359 | 359 | $meta_key = "_give_{$email->config['id']}_"; |
360 | 360 | } |
361 | 361 |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_Offline_Donation_Instruction_Email |
@@ -36,32 +36,32 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'offline-donation-instruction', |
43 | - 'label' => __( 'Offline Donation Instructions', 'give' ), |
|
44 | - 'description' => __( 'Sent to the donor when they submit an offline donation.', 'give' ), |
|
45 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
43 | + 'label' => __('Offline Donation Instructions', 'give'), |
|
44 | + 'description' => __('Sent to the donor when they submit an offline donation.', 'give'), |
|
45 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
46 | 46 | 'form_metabox_setting' => true, |
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tag_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | - 'default_email_subject' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
51 | + 'default_email_subject' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
52 | 52 | 'default_email_message' => give_get_default_offline_donation_email_content(), |
53 | 53 | 'notices' => array( |
54 | 54 | 'non-notification-status-editable' => sprintf( |
55 | 55 | '%1$s <a href="%2$s">%3$s »</a>', |
56 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
57 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
58 | - __( 'Edit Setting', 'give' ) |
|
56 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
57 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
58 | + __('Edit Setting', 'give') |
|
59 | 59 | ) |
60 | 60 | ), |
61 | - ) ); |
|
61 | + )); |
|
62 | 62 | |
63 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
64 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
63 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
64 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function get_email_message( $form_id = null ) { |
|
77 | + public function get_email_message($form_id = null) { |
|
78 | 78 | $message = Give_Email_Notification_Util::get_value( |
79 | 79 | $this, |
80 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
80 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
81 | 81 | $form_id, |
82 | 82 | $this->config['default_email_message'] |
83 | 83 | ); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function get_email_subject( $form_id = null ) { |
|
109 | + public function get_email_subject($form_id = null) { |
|
110 | 110 | $subject = wp_strip_all_tags( |
111 | 111 | Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_subject'] |
116 | 116 | ) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param int $form_id |
140 | 140 | * @return array |
141 | 141 | */ |
142 | - public function get_email_attachments( $form_id = null ) { |
|
142 | + public function get_email_attachments($form_id = null) { |
|
143 | 143 | /** |
144 | 144 | * Filter the attachments. |
145 | 145 | * Note: This filter will deprecate soon. |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $this->payment->payment_meta |
203 | 203 | ); |
204 | 204 | |
205 | - Give()->emails->__set( 'from_name', $from_name ); |
|
206 | - Give()->emails->__set( 'from_email', $from_email ); |
|
207 | - Give()->emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
208 | - Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) ); |
|
205 | + Give()->emails->__set('from_name', $from_name); |
|
206 | + Give()->emails->__set('from_email', $from_email); |
|
207 | + Give()->emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
208 | + Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta)); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param int $payment_id |
218 | 218 | */ |
219 | - public function setup_email_notification( $payment_id ) { |
|
220 | - $this->payment = new Give_Payment( $payment_id ); |
|
219 | + public function setup_email_notification($payment_id) { |
|
220 | + $this->payment = new Give_Payment($payment_id); |
|
221 | 221 | |
222 | 222 | // Exit if not donation was not with offline donation. |
223 | - if ( 'offline' !== $this->payment->gateway ) { |
|
223 | + if ('offline' !== $this->payment->gateway) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | $this->setup_email_data(); |
229 | 229 | |
230 | 230 | // Send email. |
231 | - $this->send_email_notification( array( |
|
231 | + $this->send_email_notification(array( |
|
232 | 232 | 'payment_id' => $this->payment->ID, |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | * @param $update_options |
243 | 243 | * @param $option_name |
244 | 244 | */ |
245 | - public function set_notification_status( $update_options, $option_name ) { |
|
245 | + public function set_notification_status($update_options, $option_name) { |
|
246 | 246 | // Get updated settings. |
247 | 247 | $update_options = give_get_settings(); |
248 | 248 | |
249 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
249 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
250 | 250 | |
251 | 251 | if ( |
252 | - empty( $update_options["{$this->config['id']}_notification"] ) |
|
252 | + empty($update_options["{$this->config['id']}_notification"]) |
|
253 | 253 | || $notification_status !== $update_options["{$this->config['id']}_notification"] |
254 | 254 | ) { |
255 | 255 | $update_options["{$this->config['id']}_notification"] = $notification_status; |
256 | - update_option( $option_name, $update_options ); |
|
256 | + update_option($option_name, $update_options); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return array |
271 | 271 | */ |
272 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
273 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
272 | + public function add_metabox_setting_field($settings, $form_id) { |
|
273 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
274 | 274 | $settings[] = array( |
275 | 275 | 'id' => $this->config['id'], |
276 | 276 | 'title' => $this->config['label'], |
277 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
277 | + 'fields' => $this->get_setting_fields($form_id), |
|
278 | 278 | ); |
279 | 279 | } |
280 | 280 |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @access public |
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | - parent::__construct( array( |
|
40 | - 'singular' => __( 'Give Email Notification', 'give' ), |
|
41 | - 'plural' => __( 'Give Email Notifications', 'give' ), |
|
42 | - ) ); |
|
39 | + parent::__construct(array( |
|
40 | + 'singular' => __('Give Email Notification', 'give'), |
|
41 | + 'plural' => __('Give Email Notifications', 'give'), |
|
42 | + )); |
|
43 | 43 | |
44 | 44 | $this->email_notifications = Give_Email_Notifications::get_instance(); |
45 | 45 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 2.0 |
61 | 61 | */ |
62 | - return apply_filters( 'give_email_notification_setting_columns', array( |
|
63 | - 'cb' => __( 'Email Status', 'give' ), |
|
64 | - 'name' => __( 'Email', 'give' ), |
|
65 | - 'email_type' => __( 'Content Type', 'give' ), |
|
66 | - 'recipient' => __( 'Recipient(s)', 'give' ), |
|
67 | - 'setting' => __( 'Edit Email', 'give' ), |
|
68 | - ) ); |
|
62 | + return apply_filters('give_email_notification_setting_columns', array( |
|
63 | + 'cb' => __('Email Status', 'give'), |
|
64 | + 'name' => __('Email', 'give'), |
|
65 | + 'email_type' => __('Content Type', 'give'), |
|
66 | + 'recipient' => __('Recipient(s)', 'give'), |
|
67 | + 'setting' => __('Edit Email', 'give'), |
|
68 | + )); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function column_name( $email ) { |
|
82 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
83 | - $actions = $this->get_row_actions( $email ); |
|
81 | + public function column_name($email) { |
|
82 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
83 | + $actions = $this->get_row_actions($email); |
|
84 | 84 | |
85 | 85 | ob_start(); |
86 | 86 | ?> |
87 | 87 | <a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a> |
88 | 88 | |
89 | - <?php if ( $desc = $email->config['description'] ) : ?> |
|
90 | - <?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?> |
|
89 | + <?php if ($desc = $email->config['description']) : ?> |
|
90 | + <?php echo Give()->tooltips->render_help(esc_attr($desc)); ?> |
|
91 | 91 | <?php endif; ?> |
92 | 92 | |
93 | - <?php echo $this->row_actions( $actions ); ?> |
|
93 | + <?php echo $this->row_actions($actions); ?> |
|
94 | 94 | <?php |
95 | 95 | return ob_get_clean(); |
96 | 96 | } |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function column_recipient( $email ) { |
|
108 | + public function column_recipient($email) { |
|
109 | 109 | ob_start(); |
110 | 110 | |
111 | - if( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
111 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
112 | 112 | $recipients = $email->get_recipient(); |
113 | - if ( is_array( $recipients ) ) { |
|
114 | - $recipients = implode( '<br>', $recipients ); |
|
113 | + if (is_array($recipients)) { |
|
114 | + $recipients = implode('<br>', $recipients); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | echo $recipients; |
118 | 118 | |
119 | - } elseif ( ! empty( $email->config['recipient_group_name'] ) ) { |
|
119 | + } elseif ( ! empty($email->config['recipient_group_name'])) { |
|
120 | 120 | echo $email->config['recipient_group_name']; |
121 | 121 | } |
122 | 122 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function column_cb( $email ) { |
|
136 | + public function column_cb($email) { |
|
137 | 137 | $notification_status = $email->get_notification_status(); |
138 | - $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email ); |
|
139 | - $icon_classes = Give_Email_Notification_Util::is_email_notification_active( $email ) |
|
138 | + $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email); |
|
139 | + $icon_classes = Give_Email_Notification_Util::is_email_notification_active($email) |
|
140 | 140 | ? 'dashicons dashicons-yes' |
141 | 141 | : 'dashicons dashicons-no-alt'; |
142 | 142 | $attributes = array( |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | 'data-edit' => $user_can_edit_status, |
147 | 147 | ); |
148 | 148 | |
149 | - if ( ! $user_can_edit_status ) { |
|
150 | - $icon_classes = 'dashicons dashicons-lock'; |
|
149 | + if ( ! $user_can_edit_status) { |
|
150 | + $icon_classes = 'dashicons dashicons-lock'; |
|
151 | 151 | |
152 | - $attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] ); |
|
152 | + $attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $html = sprintf( |
156 | 156 | '<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>', |
157 | - give_get_attribute_str( $attributes ), |
|
157 | + give_get_attribute_str($attributes), |
|
158 | 158 | $icon_classes |
159 | 159 | ); |
160 | 160 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function column_email_type( Give_Email_Notification $email ) { |
|
176 | - return Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ); |
|
175 | + public function column_email_type(Give_Email_Notification $email) { |
|
176 | + return Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public function column_setting( Give_Email_Notification $email ) { |
|
190 | - return Give()->tooltips->render_link( array( |
|
191 | - 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}", |
|
189 | + public function column_setting(Give_Email_Notification $email) { |
|
190 | + return Give()->tooltips->render_link(array( |
|
191 | + 'label' => __('Edit', 'give')." {$email->config['label']}", |
|
192 | 192 | 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>', |
193 | - 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ), |
|
193 | + 'link' => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])), |
|
194 | 194 | 'attributes' => array( |
195 | 195 | 'class' => 'button button-small', |
196 | 196 | ), |
197 | - ) ); |
|
197 | + )); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array |
210 | 210 | */ |
211 | - private function get_row_actions( $email ) { |
|
212 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
211 | + private function get_row_actions($email) { |
|
212 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
213 | 213 | |
214 | 214 | /** |
215 | 215 | * Filter the row actions |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $row_actions = apply_filters( |
222 | 222 | 'give_email_notification_row_actions', |
223 | 223 | array( |
224 | - 'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>', |
|
224 | + 'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>', |
|
225 | 225 | ), |
226 | 226 | |
227 | 227 | ); |
@@ -242,22 +242,22 @@ discard block |
||
242 | 242 | $hidden = array(); |
243 | 243 | $email_notifications = array(); |
244 | 244 | $sortable = $this->get_sortable_columns(); |
245 | - $this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() ); |
|
245 | + $this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name()); |
|
246 | 246 | |
247 | 247 | // Set email notifications. |
248 | 248 | /* @var Give_Email_Notification $email_notification */ |
249 | - foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) { |
|
250 | - if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) { |
|
249 | + foreach ($this->email_notifications->get_email_notifications() as $email_notification) { |
|
250 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) { |
|
251 | 251 | $email_notifications[] = $email_notification; |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - $totalItems = count( $email_notifications ); |
|
255 | + $totalItems = count($email_notifications); |
|
256 | 256 | $this->items = $email_notifications; |
257 | - $this->set_pagination_args( array( |
|
257 | + $this->set_pagination_args(array( |
|
258 | 258 | 'total_items' => $totalItems, |
259 | 259 | 'per_page' => $this->per_page, |
260 | - ) ); |
|
260 | + )); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @access public |
268 | 268 | */ |
269 | 269 | public function no_items() { |
270 | - _e( 'No give email notification found.' ); |
|
270 | + _e('No give email notification found.'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if access directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
20 | -if ( ! class_exists( 'Give_New_Donation_Email' ) ) : |
|
20 | +if ( ! class_exists('Give_New_Donation_Email')) : |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Give_New_Donation_Email |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function init() { |
39 | 39 | // Initialize empty payment. |
40 | - $this->payment = new Give_Payment( 0 ); |
|
40 | + $this->payment = new Give_Payment(0); |
|
41 | 41 | |
42 | - $this->load( array( |
|
42 | + $this->load(array( |
|
43 | 43 | 'id' => 'new-donation', |
44 | - 'label' => __( 'New Donation', 'give' ), |
|
45 | - 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ), |
|
44 | + 'label' => __('New Donation', 'give'), |
|
45 | + 'description' => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'), |
|
46 | 46 | 'has_recipient_field' => true, |
47 | 47 | 'notification_status' => 'enabled', |
48 | 48 | 'form_metabox_setting' => true, |
49 | - 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
49 | + 'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
50 | 50 | 'default_email_message' => give_get_default_donation_notification_email(), |
51 | 51 | |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) ); |
|
54 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - public function get_email_subject( $form_id = null ) { |
|
68 | + public function get_email_subject($form_id = null) { |
|
69 | 69 | $subject = wp_strip_all_tags( |
70 | 70 | Give_Email_Notification_Util::get_value( |
71 | 71 | $this, |
72 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
72 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
73 | 73 | $form_id, |
74 | 74 | $this->config['default_email_subject'] |
75 | 75 | ) |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @since 1.0 |
83 | 83 | */ |
84 | - $subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID ); |
|
84 | + $subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation notification subject. |
88 | 88 | * |
89 | 89 | * @since 2.0 |
90 | 90 | */ |
91 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
91 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
92 | 92 | |
93 | 93 | return $subject; |
94 | 94 | } |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public function get_email_message( $form_id = null ) { |
|
107 | + public function get_email_message($form_id = null) { |
|
108 | 108 | $message = Give_Email_Notification_Util::get_value( |
109 | 109 | $this, |
110 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
110 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
111 | 111 | $form_id, |
112 | 112 | $this->config['default_email_message'] |
113 | 113 | ); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param int $form_id |
151 | 151 | * @return array |
152 | 152 | */ |
153 | - public function get_email_attachments( $form_id = null ) { |
|
153 | + public function get_email_attachments($form_id = null) { |
|
154 | 154 | /** |
155 | 155 | * Filters the donation notification email attachments. |
156 | 156 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | $this->payment->payment_meta |
214 | 214 | ); |
215 | 215 | |
216 | - Give()->emails->__set( 'from_name', $from_name ); |
|
217 | - Give()->emails->__set( 'from_email', $from_email ); |
|
218 | - Give()->emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
216 | + Give()->emails->__set('from_name', $from_name); |
|
217 | + Give()->emails->__set('from_email', $from_email); |
|
218 | + Give()->emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
219 | 219 | /** |
220 | 220 | * Filters the donation notification email headers. |
221 | 221 | * |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $this->payment->payment_meta |
229 | 229 | ); |
230 | 230 | |
231 | - Give()->emails->__set( 'headers', $headers ); |
|
231 | + Give()->emails->__set('headers', $headers); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -239,16 +239,16 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @param int $payment_id |
241 | 241 | */ |
242 | - public function setup_email_notification( $payment_id ) { |
|
243 | - $this->payment = new Give_Payment( $payment_id ); |
|
242 | + public function setup_email_notification($payment_id) { |
|
243 | + $this->payment = new Give_Payment($payment_id); |
|
244 | 244 | |
245 | 245 | // Set email data. |
246 | 246 | $this->setup_email_data(); |
247 | 247 | |
248 | 248 | // Send email. |
249 | - $this->send_email_notification( array( |
|
249 | + $this->send_email_notification(array( |
|
250 | 250 | 'payment_id' => $payment_id, |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 |
@@ -16,12 +16,12 @@ |
||
16 | 16 | * @since 2.0 |
17 | 17 | */ |
18 | 18 | function give_set_notification_status_handler() { |
19 | - $notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : ''; |
|
20 | - if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) { |
|
19 | + $notification_id = isset($_POST['notification_id']) ? give_clean($_POST['notification_id']) : ''; |
|
20 | + if ( ! empty($notification_id) && give_update_option("{$notification_id}_notification", give_clean($_POST['status']))) { |
|
21 | 21 | wp_send_json_success(); |
22 | 22 | } |
23 | 23 | |
24 | 24 | wp_send_json_error(); |
25 | 25 | } |
26 | 26 | |
27 | -add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' ); |
|
27 | +add_action('wp_ajax_give_set_notification_status', 'give_set_notification_status_handler'); |