@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Forms' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Forms')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Forms. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'forms'; |
46 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
46 | + $this->label = esc_html__('Forms', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_reports_forms', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'forms', |
98 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
98 | + 'name' => esc_html__('Forms', 'give'), |
|
99 | 99 | 'type' => 'report_forms', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_forms_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_forms'); |
|
134 | + public function render_report_forms_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_forms'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Earnings' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Earnings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Earnings. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'earnings'; |
46 | - $this->label = esc_html__( 'Income', 'give' ); |
|
46 | + $this->label = esc_html__('Income', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_tools_earnings', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'earnings', |
98 | - 'name' => esc_html__( 'Income', 'give' ), |
|
98 | + 'name' => esc_html__('Income', 'give'), |
|
99 | 99 | 'type' => 'report_earnings', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_earnings_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_earnings' ); |
|
134 | + public function render_report_earnings_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_earnings'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Admin View: Settings |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
5 | +if ( ! defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
9 | 9 | |
10 | 10 | // Bailout: Do not output anything if setting tab is not defined. |
11 | -if( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) : |
|
11 | +if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) : |
|
12 | 12 | /** |
13 | 13 | * Filter the form action. |
14 | 14 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8 |
20 | 20 | */ |
21 | - $form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' ); |
|
21 | + $form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post'); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Filter the main form tab. |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @since 1.8 |
32 | 32 | */ |
33 | - $form_open_tag = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' ); |
|
34 | - $form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' ); |
|
33 | + $form_open_tag = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">'); |
|
34 | + $form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>'); |
|
35 | 35 | ?> |
36 | - <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix . '-setting-page'; ?>"> |
|
36 | + <div class="wrap give-settings-page <?php echo self::$setting_filter_prefix.'-setting-page'; ?>"> |
|
37 | 37 | <?php echo $form_open_tag; ?> |
38 | 38 | <h2 class="nav-tab-wrapper give-nav-tab-wrapper"> |
39 | 39 | <?php |
40 | - foreach ( $tabs as $name => $label ) { |
|
41 | - echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
40 | + foreach ($tabs as $name => $label) { |
|
41 | + echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab == $name ? 'nav-tab-active' : '').'">'.$label.'</a>'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 1.8 |
52 | 52 | */ |
53 | - do_action( self::$setting_filter_prefix . '_tabs' ); |
|
53 | + do_action(self::$setting_filter_prefix.'_tabs'); |
|
54 | 54 | ?> |
55 | 55 | </h2> |
56 | 56 | <div class="give-sub-nav-tab-wrapper"> |
57 | - <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
57 | + <a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span></a> |
|
58 | 58 | <nav class="give-sub-nav-tab give-hidden"></nav> |
59 | 59 | </div> |
60 | - <h1 class="screen-reader-text"><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1> |
|
60 | + <h1 class="screen-reader-text"><?php echo esc_html($tabs[$current_tab]); ?></h1> |
|
61 | 61 | <?php |
62 | 62 | |
63 | 63 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.8 |
71 | 71 | */ |
72 | - do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" ); |
|
72 | + do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page"); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | // Show messages. |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | */ |
88 | - do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" ); |
|
88 | + do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page"); |
|
89 | 89 | |
90 | - if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?> |
|
90 | + if (empty($GLOBALS['give_hide_save_button'])) : ?> |
|
91 | 91 | <div class="give-submit-wrap"> |
92 | - <?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?> |
|
93 | - <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'give' ); ?>" /> |
|
92 | + <?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?> |
|
93 | + <input name="save" class="button-primary give-save-button" type="submit" value="<?php esc_attr_e('Save changes', 'give'); ?>" /> |
|
94 | 94 | </div> |
95 | 95 | <?php endif; ?> |
96 | 96 | <?php echo $form_close_tag; ?> |
97 | 97 | </div> |
98 | - <?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
98 | + <?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?> |
|
99 | 99 | <?php endif; ?> |
100 | 100 | \ No newline at end of file |
@@ -95,5 +95,8 @@ |
||
95 | 95 | <?php endif; ?> |
96 | 96 | <?php echo $form_close_tag; ?> |
97 | 97 | </div> |
98 | - <?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?> |
|
98 | + <?php else { |
|
99 | + : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
100 | +} |
|
101 | +?> |
|
99 | 102 | <?php endif; ?> |
100 | 103 | \ No newline at end of file |
@@ -87,13 +87,13 @@ |
||
87 | 87 | 'disabled' => __( 'Head', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'advanced_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'advanced_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | + 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_data_control_2', |
99 | 99 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = esc_html__( 'Advanced', 'give' ); |
|
30 | + $this->label = esc_html__('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => esc_html__( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => esc_html__('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data this time', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data this time', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | /* translators: %s: the_content */ |
68 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
68 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
69 | 69 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
70 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
70 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
71 | 71 | 'id' => 'the_content_filter', |
72 | 72 | 'default' => 'enabled', |
73 | 73 | 'type' => 'radio_inline', |
74 | 74 | 'options' => array( |
75 | - 'enabled' => __( 'Enabled', 'give' ), |
|
76 | - 'disabled' => __( 'Disabled', 'give' ), |
|
75 | + 'enabled' => __('Enabled', 'give'), |
|
76 | + 'disabled' => __('Disabled', 'give'), |
|
77 | 77 | ) |
78 | 78 | ), |
79 | 79 | array( |
80 | - 'name' => esc_html__( 'Script Loading Location', 'give' ), |
|
81 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
80 | + 'name' => esc_html__('Script Loading Location', 'give'), |
|
81 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
82 | 82 | 'id' => 'scripts_footer', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'disabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Footer', 'give' ), |
|
87 | - 'disabled' => __( 'Head', 'give' ), |
|
86 | + 'enabled' => __('Footer', 'give'), |
|
87 | + 'disabled' => __('Head', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
91 | + 'name' => esc_html__('Advanced Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'advanced_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
94 | + 'title' => __('Advanced Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Filter the advanced settings. |
108 | 108 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
109 | 109 | */ |
110 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
110 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Filter the settings. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param array $settings |
118 | 118 | */ |
119 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
119 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
120 | 120 | |
121 | 121 | // Output. |
122 | 122 | return $settings; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function get_sections() { |
132 | 132 | $sections = array( |
133 | - 'advanced-options' => esc_html__( 'Advanced Options', 'give' ) |
|
133 | + 'advanced-options' => esc_html__('Advanced Options', 'give') |
|
134 | 134 | ); |
135 | 135 | |
136 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
136 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = esc_html__( 'General', 'give' ); |
|
30 | + $this->label = esc_html__('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'access-control': |
49 | 49 | $settings = array( |
50 | 50 | // Section 3: Access control. |
@@ -54,47 +54,47 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'session_lifetime', |
57 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
58 | - 'desc' => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
57 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
58 | + 'desc' => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => array( |
61 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
62 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
63 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
64 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
61 | + '86400' => esc_html__('24 Hours', 'give'), |
|
62 | + '172800' => esc_html__('48 Hours', 'give'), |
|
63 | + '259200' => esc_html__('72 Hours', 'give'), |
|
64 | + '604800' => esc_html__('1 Week', 'give'), |
|
65 | 65 | ) |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
69 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
68 | + 'name' => esc_html__('Email Access', 'give'), |
|
69 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
70 | 70 | 'id' => 'email_access', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | 79 | 'id' => 'recaptcha_key', |
80 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
80 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
81 | 81 | /* translators: %s: https://www.google.com/recaptcha/ */ |
82 | - 'desc' => sprintf( __( 'Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
82 | + 'desc' => sprintf(__('Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
83 | 83 | 'default' => '', |
84 | 84 | 'type' => 'text' |
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'recaptcha_secret', |
88 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
89 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
88 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
89 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | 93 | array( |
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
94 | + 'name' => esc_html__('Access Control Docs Link', 'give'), |
|
95 | 95 | 'id' => 'access_control_docs_link', |
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
96 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
97 | + 'title' => __('Access Control', 'give'), |
|
98 | 98 | 'type' => 'give_docs_link', |
99 | 99 | ), |
100 | 100 | array( |
@@ -112,61 +112,61 @@ discard block |
||
112 | 112 | 'id' => 'give_title_general_settings_2' |
113 | 113 | ), |
114 | 114 | array( |
115 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
115 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
116 | 116 | 'desc' => '', |
117 | 117 | 'type' => 'give_title', |
118 | 118 | 'id' => 'give_title_general_settings_2' |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
122 | - 'desc' => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
121 | + 'name' => esc_html__('Currency', 'give'), |
|
122 | + 'desc' => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
123 | 123 | 'id' => 'currency', |
124 | 124 | 'type' => 'select', |
125 | 125 | 'options' => give_get_currencies(), |
126 | 126 | 'default' => 'USD', |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
130 | - 'desc' => esc_html__( 'The position of the currency symbol.', 'give' ), |
|
129 | + 'name' => esc_html__('Currency Position', 'give'), |
|
130 | + 'desc' => esc_html__('The position of the currency symbol.', 'give'), |
|
131 | 131 | 'id' => 'currency_position', |
132 | 132 | 'type' => 'select', |
133 | 133 | 'options' => array( |
134 | 134 | /* translators: %s: currency symbol */ |
135 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
135 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
136 | 136 | /* translators: %s: currency symbol */ |
137 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
137 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
138 | 138 | ), |
139 | 139 | 'default' => 'before', |
140 | 140 | ), |
141 | 141 | array( |
142 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
143 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
142 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
143 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
144 | 144 | 'id' => 'thousands_separator', |
145 | 145 | 'type' => 'text', |
146 | 146 | 'default' => ',', |
147 | 147 | 'css' => 'width:12em;', |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
150 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
151 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
152 | 152 | 'id' => 'decimal_separator', |
153 | 153 | 'type' => 'text', |
154 | 154 | 'default' => '.', |
155 | 155 | 'css' => 'width:12em;', |
156 | 156 | ), |
157 | 157 | array( |
158 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
159 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
158 | + 'name' => __('Number of Decimals', 'give'), |
|
159 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
160 | 160 | 'id' => 'number_decimals', |
161 | 161 | 'type' => 'text', |
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | 165 | array( |
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
166 | + 'name' => esc_html__('Currency Options Docs Link', 'give'), |
|
167 | 167 | 'id' => 'currency_settings_docs_link', |
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
168 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
169 | + 'title' => __('Currency Settings', 'give'), |
|
170 | 170 | 'type' => 'give_docs_link', |
171 | 171 | ), |
172 | 172 | array( |
@@ -184,55 +184,55 @@ discard block |
||
184 | 184 | 'id' => 'give_title_general_settings_1' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
187 | + 'name' => esc_html__('General Settings', 'give'), |
|
188 | 188 | 'desc' => '', |
189 | 189 | 'type' => 'give_title', |
190 | 190 | 'id' => 'give_title_general_settings_1' |
191 | 191 | ), |
192 | 192 | array( |
193 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
193 | + 'name' => esc_html__('Success Page', 'give'), |
|
194 | 194 | /* translators: %s: [give_receipt] */ |
195 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
195 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
196 | 196 | 'id' => 'success_page', |
197 | 197 | 'type' => 'select', |
198 | - 'options' => give_cmb2_get_post_options( array( |
|
198 | + 'options' => give_cmb2_get_post_options(array( |
|
199 | 199 | 'post_type' => 'page', |
200 | - 'numberposts' => - 1 |
|
201 | - ) ), |
|
200 | + 'numberposts' => -1 |
|
201 | + )), |
|
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => esc_html__( 'Failed Donation Page', 'give' ), |
|
205 | - 'desc' => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
204 | + 'name' => esc_html__('Failed Donation Page', 'give'), |
|
205 | + 'desc' => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
206 | 206 | 'id' => 'failure_page', |
207 | 207 | 'type' => 'select', |
208 | - 'options' => give_cmb2_get_post_options( array( |
|
208 | + 'options' => give_cmb2_get_post_options(array( |
|
209 | 209 | 'post_type' => 'page', |
210 | - 'numberposts' => - 1 |
|
211 | - ) ), |
|
210 | + 'numberposts' => -1 |
|
211 | + )), |
|
212 | 212 | ), |
213 | 213 | array( |
214 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
214 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
215 | 215 | /* translators: %s: [donation_history] */ |
216 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
216 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
217 | 217 | 'id' => 'history_page', |
218 | 218 | 'type' => 'select', |
219 | - 'options' => give_cmb2_get_post_options( array( |
|
219 | + 'options' => give_cmb2_get_post_options(array( |
|
220 | 220 | 'post_type' => 'page', |
221 | - 'numberposts' => - 1 |
|
222 | - ) ), |
|
221 | + 'numberposts' => -1 |
|
222 | + )), |
|
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
226 | - 'desc' => esc_html__( 'The country your site operates from.', 'give' ), |
|
225 | + 'name' => esc_html__('Base Country', 'give'), |
|
226 | + 'desc' => esc_html__('The country your site operates from.', 'give'), |
|
227 | 227 | 'id' => 'base_country', |
228 | 228 | 'type' => 'select', |
229 | 229 | 'options' => give_get_country_list(), |
230 | 230 | ), |
231 | 231 | array( |
232 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
232 | + 'name' => esc_html__('General Options Docs Link', 'give'), |
|
233 | 233 | 'id' => 'general_options_docs_link', |
234 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | - 'title' => __( 'General Options', 'give' ), |
|
234 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
235 | + 'title' => __('General Options', 'give'), |
|
236 | 236 | 'type' => 'give_docs_link', |
237 | 237 | ), |
238 | 238 | array( |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * Filter the general settings. |
248 | 248 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
249 | 249 | */ |
250 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
250 | + $settings = apply_filters('give_settings_general', $settings); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Filter the settings. |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @param array $settings |
258 | 258 | */ |
259 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
259 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
260 | 260 | |
261 | 261 | // Output. |
262 | 262 | return $settings; |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function get_sections() { |
272 | 272 | $sections = array( |
273 | - 'general-settings' => esc_html__( 'General', 'give' ), |
|
274 | - 'currency-settings' => esc_html__( 'Currency', 'give' ), |
|
275 | - 'access-control' => esc_html__( 'Access Control', 'give' ) |
|
273 | + 'general-settings' => esc_html__('General', 'give'), |
|
274 | + 'currency-settings' => esc_html__('Currency', 'give'), |
|
275 | + 'access-control' => esc_html__('Access Control', 'give') |
|
276 | 276 | ); |
277 | 277 | |
278 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
278 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | - array( |
|
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | - 'id' => 'access_control_docs_link', |
|
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
98 | - 'type' => 'give_docs_link', |
|
99 | - ), |
|
93 | + array( |
|
94 | + 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | + 'id' => 'access_control_docs_link', |
|
96 | + 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | + 'title' => __( 'Access Control', 'give' ), |
|
98 | + 'type' => 'give_docs_link', |
|
99 | + ), |
|
100 | 100 | array( |
101 | 101 | 'id' => 'give_title_session_control_1', |
102 | 102 | 'type' => 'sectionend' |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | - array( |
|
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | - 'id' => 'currency_settings_docs_link', |
|
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
170 | - 'type' => 'give_docs_link', |
|
171 | - ), |
|
165 | + array( |
|
166 | + 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | + 'id' => 'currency_settings_docs_link', |
|
168 | + 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | + 'title' => __( 'Currency Settings', 'give' ), |
|
170 | + 'type' => 'give_docs_link', |
|
171 | + ), |
|
172 | 172 | array( |
173 | 173 | 'type' => 'sectionend', |
174 | 174 | 'id' => 'give_title_general_settings_2' |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | 'type' => 'select', |
229 | 229 | 'options' => give_get_country_list(), |
230 | 230 | ), |
231 | - array( |
|
232 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
233 | - 'id' => 'general_options_docs_link', |
|
234 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | - 'title' => __( 'General Options', 'give' ), |
|
236 | - 'type' => 'give_docs_link', |
|
237 | - ), |
|
231 | + array( |
|
232 | + 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
233 | + 'id' => 'general_options_docs_link', |
|
234 | + 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | + 'title' => __( 'General Options', 'give' ), |
|
236 | + 'type' => 'give_docs_link', |
|
237 | + ), |
|
238 | 238 | array( |
239 | 239 | 'type' => 'sectionend', |
240 | 240 | 'id' => 'give_title_general_settings_1' |
@@ -137,31 +137,31 @@ |
||
137 | 137 | * @return void |
138 | 138 | */ |
139 | 139 | function give_process_user_logout( $data ) { |
140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
140 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
141 | 141 | |
142 | - // Prevent occurring of any custom action on wp_logout. |
|
143 | - remove_all_actions( 'wp_logout' ); |
|
142 | + // Prevent occurring of any custom action on wp_logout. |
|
143 | + remove_all_actions( 'wp_logout' ); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Fires before processing user logout. |
147 | 147 | * |
148 | 148 | * @since 1.0 |
149 | 149 | */ |
150 | - do_action( 'give_before_user_logout' ); |
|
150 | + do_action( 'give_before_user_logout' ); |
|
151 | 151 | |
152 | - // Logout user. |
|
153 | - wp_logout(); |
|
152 | + // Logout user. |
|
153 | + wp_logout(); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Fires after processing user logout. |
157 | 157 | * |
158 | 158 | * @since 1.0 |
159 | 159 | */ |
160 | - do_action( 'give_after_user_logout' ); |
|
160 | + do_action( 'give_after_user_logout' ); |
|
161 | 161 | |
162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
163 | - give_die(); |
|
164 | - } |
|
162 | + wp_redirect( $data['give_logout_redirect'] ); |
|
163 | + give_die(); |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string Login form |
28 | 28 | */ |
29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
30 | - if ( empty( $login_redirect ) ) { |
|
29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
30 | + if (empty($login_redirect)) { |
|
31 | 31 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $logout_redirect ) ) { |
|
35 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
34 | + if (empty($logout_redirect)) { |
|
35 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $logout_redirect = add_query_arg( |
41 | 41 | array( |
42 | 42 | 'give_action' => 'user_logout', |
43 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
44 | - 'give_logout_redirect' => urlencode( $logout_redirect ), |
|
43 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
44 | + 'give_logout_redirect' => urlencode($logout_redirect), |
|
45 | 45 | ), |
46 | - home_url( '/' ) |
|
46 | + home_url('/') |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | ob_start(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | |
59 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
59 | + return apply_filters('give_login_form', ob_get_clean()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Register form |
71 | 71 | */ |
72 | -function give_register_form( $redirect = '' ) { |
|
73 | - if ( empty( $redirect ) ) { |
|
72 | +function give_register_form($redirect = '') { |
|
73 | + if (empty($redirect)) { |
|
74 | 74 | $redirect = give_get_current_page_url(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | ob_start(); |
78 | 78 | |
79 | - if ( ! is_user_logged_in() ) { |
|
79 | + if ( ! is_user_logged_in()) { |
|
80 | 80 | give_get_template( |
81 | 81 | 'shortcode-register', |
82 | 82 | array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
88 | + return apply_filters('give_register_form', ob_get_clean()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,34 +97,34 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | -function give_process_login_form( $data ) { |
|
101 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
102 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
103 | - if ( ! $user_data ) { |
|
104 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
100 | +function give_process_login_form($data) { |
|
101 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
102 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
103 | + if ( ! $user_data) { |
|
104 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
105 | 105 | } |
106 | - if ( $user_data ) { |
|
106 | + if ($user_data) { |
|
107 | 107 | $user_ID = $user_data->ID; |
108 | 108 | $user_email = $user_data->user_email; |
109 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
110 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
109 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
110 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
111 | 111 | } else { |
112 | - give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) ); |
|
112 | + give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give')); |
|
113 | 113 | } |
114 | 114 | } else { |
115 | - give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) ); |
|
115 | + give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give')); |
|
116 | 116 | } |
117 | 117 | // Check for errors and redirect if none present |
118 | 118 | $errors = give_get_errors(); |
119 | - if ( ! $errors ) { |
|
120 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
121 | - wp_redirect( $redirect ); |
|
119 | + if ( ! $errors) { |
|
120 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
121 | + wp_redirect($redirect); |
|
122 | 122 | give_die(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
127 | +add_action('give_user_login', 'give_process_login_form'); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | /** |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | -function give_process_user_logout( $data ) { |
|
140 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
139 | +function give_process_user_logout($data) { |
|
140 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
141 | 141 | |
142 | 142 | // Prevent occurring of any custom action on wp_logout. |
143 | - remove_all_actions( 'wp_logout' ); |
|
143 | + remove_all_actions('wp_logout'); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Fires before processing user logout. |
147 | 147 | * |
148 | 148 | * @since 1.0 |
149 | 149 | */ |
150 | - do_action( 'give_before_user_logout' ); |
|
150 | + do_action('give_before_user_logout'); |
|
151 | 151 | |
152 | 152 | // Logout user. |
153 | 153 | wp_logout(); |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @since 1.0 |
159 | 159 | */ |
160 | - do_action( 'give_after_user_logout' ); |
|
160 | + do_action('give_after_user_logout'); |
|
161 | 161 | |
162 | - wp_redirect( $data['give_logout_redirect'] ); |
|
162 | + wp_redirect($data['give_logout_redirect']); |
|
163 | 163 | give_die(); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
167 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Log User In |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return void |
179 | 179 | */ |
180 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
181 | - if ( $user_id < 1 ) { |
|
180 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
181 | + if ($user_id < 1) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - wp_set_auth_cookie( $user_id ); |
|
186 | - wp_set_current_user( $user_id, $user_login ); |
|
185 | + wp_set_auth_cookie($user_id); |
|
186 | + wp_set_current_user($user_id, $user_login); |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * Fires after the user has successfully logged in. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param string $user_login Username. |
194 | 194 | * @param WP_User $$user WP_User object of the logged-in user. |
195 | 195 | */ |
196 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
196 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Fires after give user has successfully logged in. |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string $user_login Username. |
205 | 205 | * @param string $user_pass User password. |
206 | 206 | */ |
207 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
207 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return void |
219 | 219 | */ |
220 | -function give_process_register_form( $data ) { |
|
220 | +function give_process_register_form($data) { |
|
221 | 221 | |
222 | - if ( is_user_logged_in() ) { |
|
222 | + if (is_user_logged_in()) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
226 | + if (empty($_POST['give_register_submit'])) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
@@ -232,38 +232,38 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_pre_process_register_form' ); |
|
235 | + do_action('give_pre_process_register_form'); |
|
236 | 236 | |
237 | - if ( empty( $data['give_user_login'] ) ) { |
|
238 | - give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) ); |
|
237 | + if (empty($data['give_user_login'])) { |
|
238 | + give_set_error('empty_username', esc_html__('Invalid username.', 'give')); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
242 | - give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) ); |
|
241 | + if (username_exists($data['give_user_login'])) { |
|
242 | + give_set_error('username_unavailable', esc_html__('Username already taken.', 'give')); |
|
243 | 243 | } |
244 | 244 | |
245 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
246 | - give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) ); |
|
245 | + if ( ! validate_username($data['give_user_login'])) { |
|
246 | + give_set_error('username_invalid', esc_html__('Invalid username.', 'give')); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
250 | - give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) ); |
|
249 | + if (email_exists($data['give_user_email'])) { |
|
250 | + give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give')); |
|
251 | 251 | } |
252 | 252 | |
253 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
254 | - give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) ); |
|
253 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
254 | + give_set_error('email_invalid', esc_html__('Invalid email.', 'give')); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
258 | - give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) ); |
|
257 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
258 | + give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give')); |
|
259 | 259 | } |
260 | 260 | |
261 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
262 | - give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) ); |
|
261 | + if (empty($_POST['give_user_pass'])) { |
|
262 | + give_set_error('empty_password', esc_html__('Please enter a password.', 'give')); |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
266 | - give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) ); |
|
265 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
266 | + give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @since 1.0 |
273 | 273 | */ |
274 | - do_action( 'give_process_register_form' ); |
|
274 | + do_action('give_process_register_form'); |
|
275 | 275 | |
276 | 276 | // Check for errors and redirect if none present |
277 | 277 | $errors = give_get_errors(); |
278 | 278 | |
279 | - if ( empty( $errors ) ) { |
|
279 | + if (empty($errors)) { |
|
280 | 280 | |
281 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
281 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
282 | 282 | |
283 | - give_register_and_login_new_user( array( |
|
283 | + give_register_and_login_new_user(array( |
|
284 | 284 | 'user_login' => $data['give_user_login'], |
285 | 285 | 'user_pass' => $data['give_user_pass'], |
286 | 286 | 'user_email' => $data['give_user_email'], |
287 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
288 | - 'role' => get_option( 'default_role' ) |
|
289 | - ) ); |
|
287 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
288 | + 'role' => get_option('default_role') |
|
289 | + )); |
|
290 | 290 | |
291 | - wp_redirect( $redirect ); |
|
291 | + wp_redirect($redirect); |
|
292 | 292 | give_die(); |
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
297 | 296 | \ No newline at end of file |
297 | +add_action('give_user_register', 'give_process_register_form'); |
|
298 | 298 | \ No newline at end of file |
@@ -253,7 +253,7 @@ |
||
253 | 253 | * |
254 | 254 | * @access public |
255 | 255 | * @since 1.0 |
256 | - * @return mixed string If search is present, false otherwise. |
|
256 | + * @return string|false string If search is present, false otherwise. |
|
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | 259 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -185,8 +185,8 @@ |
||
185 | 185 | |
186 | 186 | case 'num_donations' : |
187 | 187 | $value = '<a href="' . |
188 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
189 | - ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
188 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
189 | + ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
190 | 190 | break; |
191 | 191 | |
192 | 192 | case 'amount_spent' : |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults |
64 | - parent::__construct( array( |
|
65 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
66 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
66 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
67 | 67 | 'ajax' => false // Does this table support ajax? |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
88 | 88 | } |
89 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
90 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
89 | + if ( ! empty($_REQUEST['order'])) { |
|
90 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | <p class="search-box" role="search"> |
94 | 94 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
95 | 95 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
96 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
96 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
97 | 97 | </p> |
98 | 98 | <?php |
99 | 99 | } |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string Column Name. |
111 | 111 | */ |
112 | - public function column_default( $item, $column_name ) { |
|
113 | - switch ( $column_name ) { |
|
112 | + public function column_default($item, $column_name) { |
|
113 | + switch ($column_name) { |
|
114 | 114 | |
115 | 115 | case 'num_donations' : |
116 | - $value = '<a href="' . |
|
117 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
118 | - ) . '">' . esc_html( $item['num_donations'] ) . '</a>'; |
|
116 | + $value = '<a href="'. |
|
117 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
118 | + ).'">'.esc_html($item['num_donations']).'</a>'; |
|
119 | 119 | break; |
120 | 120 | |
121 | 121 | case 'amount_spent' : |
122 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
122 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
123 | 123 | break; |
124 | 124 | |
125 | 125 | case 'date_created' : |
126 | - $value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) ); |
|
126 | + $value = date_i18n(give_date_format(), strtotime($item['date_created'])); |
|
127 | 127 | break; |
128 | 128 | |
129 | 129 | default: |
130 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
130 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
134 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function column_name( $item ) { |
|
146 | - $name = '#' . $item['id'] . ' '; |
|
147 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
148 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
149 | - $actions = $this->get_row_actions( $item ); |
|
145 | + public function column_name($item) { |
|
146 | + $name = '#'.$item['id'].' '; |
|
147 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
148 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
149 | + $actions = $this->get_row_actions($item); |
|
150 | 150 | |
151 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
151 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function get_columns() { |
162 | 162 | $columns = array( |
163 | - 'name' => esc_html__( 'Name', 'give' ), |
|
164 | - 'email' => esc_html__( 'Email', 'give' ), |
|
165 | - 'num_donations' => esc_html__( 'Donations', 'give' ), |
|
166 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
167 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
163 | + 'name' => esc_html__('Name', 'give'), |
|
164 | + 'email' => esc_html__('Email', 'give'), |
|
165 | + 'num_donations' => esc_html__('Donations', 'give'), |
|
166 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
167 | + 'date_created' => esc_html__('Date Created', 'give') |
|
168 | 168 | ); |
169 | 169 | |
170 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
170 | + return apply_filters('give_report_customer_columns', $columns); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | public function get_sortable_columns() { |
182 | 182 | |
183 | 183 | $columns = array( |
184 | - 'date_created' => array( 'date_created', true ), |
|
185 | - 'name' => array( 'name', true ), |
|
186 | - 'num_donations' => array( 'purchase_count', false ), |
|
187 | - 'amount_spent' => array( 'purchase_value', false ), |
|
184 | + 'date_created' => array('date_created', true), |
|
185 | + 'name' => array('name', true), |
|
186 | + 'num_donations' => array('purchase_count', false), |
|
187 | + 'amount_spent' => array('purchase_value', false), |
|
188 | 188 | ); |
189 | 189 | |
190 | - return apply_filters( 'give_report_sortable_customer_columns', $columns ); |
|
190 | + return apply_filters('give_report_sortable_customer_columns', $columns); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -200,34 +200,34 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return array An array of action links. |
202 | 202 | */ |
203 | - public function get_row_actions( $item ) { |
|
203 | + public function get_row_actions($item) { |
|
204 | 204 | |
205 | 205 | $actions = array( |
206 | 206 | |
207 | 207 | 'view' => sprintf( |
208 | 208 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
209 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ), |
|
210 | - sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ), |
|
211 | - esc_html__( 'View Donor', 'give' ) |
|
209 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']), |
|
210 | + sprintf(esc_attr__('View "%s"', 'give'), $item['name']), |
|
211 | + esc_html__('View Donor', 'give') |
|
212 | 212 | ), |
213 | 213 | |
214 | 214 | 'notes' => sprintf( |
215 | 215 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
216 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ), |
|
217 | - sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ), |
|
218 | - esc_html__( 'Notes', 'give' ) |
|
216 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']), |
|
217 | + sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']), |
|
218 | + esc_html__('Notes', 'give') |
|
219 | 219 | ), |
220 | 220 | |
221 | 221 | 'delete' => sprintf( |
222 | 222 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
223 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), |
|
224 | - sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ), |
|
225 | - esc_html__( 'Delete', 'give' ) |
|
223 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), |
|
224 | + sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']), |
|
225 | + esc_html__('Delete', 'give') |
|
226 | 226 | ) |
227 | 227 | |
228 | 228 | ); |
229 | 229 | |
230 | - return apply_filters( 'give_donor_row_actions', $actions, $item ); |
|
230 | + return apply_filters('give_donor_row_actions', $actions, $item); |
|
231 | 231 | |
232 | 232 | } |
233 | 233 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @since 1.0 |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - public function bulk_actions( $which = '' ) { |
|
244 | + public function bulk_actions($which = '') { |
|
245 | 245 | // These aren't really bulk actions but this outputs the markup in the right place. |
246 | 246 | } |
247 | 247 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return int Current page number. |
254 | 254 | */ |
255 | 255 | public function get_paged() { |
256 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
256 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @return mixed string If search is present, false otherwise. |
265 | 265 | */ |
266 | 266 | public function get_search() { |
267 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
267 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | |
282 | 282 | // Get donor query. |
283 | 283 | $args = $this->get_donor_query(); |
284 | - $customers = Give()->customers->get_customers( $args ); |
|
284 | + $customers = Give()->customers->get_customers($args); |
|
285 | 285 | |
286 | - if ( $customers ) { |
|
286 | + if ($customers) { |
|
287 | 287 | |
288 | - foreach ( $customers as $customer ) { |
|
288 | + foreach ($customers as $customer) { |
|
289 | 289 | |
290 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
290 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
291 | 291 | |
292 | 292 | $data[] = array( |
293 | 293 | 'id' => $customer->id, |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
304 | + return apply_filters('give_donors_column_query_data', $data); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | $_donor_query = $this->get_donor_query(); |
316 | 316 | |
317 | 317 | $_donor_query['number'] = - 1; |
318 | - $donors = Give()->customers->get_customers( $_donor_query ); |
|
318 | + $donors = Give()->customers->get_customers($_donor_query); |
|
319 | 319 | |
320 | - return count( $donors ); |
|
320 | + return count($donors); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function get_donor_query() { |
331 | 331 | $paged = $this->get_paged(); |
332 | - $offset = $this->per_page * ( $paged - 1 ); |
|
332 | + $offset = $this->per_page * ($paged - 1); |
|
333 | 333 | $search = $this->get_search(); |
334 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
335 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
334 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
335 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
336 | 336 | |
337 | 337 | $args = array( |
338 | 338 | 'number' => $this->per_page, |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | 'orderby' => $orderby, |
342 | 342 | ); |
343 | 343 | |
344 | - if ( $search ) { |
|
345 | - if ( is_email( $search ) ) { |
|
344 | + if ($search) { |
|
345 | + if (is_email($search)) { |
|
346 | 346 | $args['email'] = $search; |
347 | - } elseif ( is_numeric( $search ) ) { |
|
347 | + } elseif (is_numeric($search)) { |
|
348 | 348 | $args['id'] = $search; |
349 | 349 | } else { |
350 | 350 | $args['name'] = $search; |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | $hidden = array(); // No hidden columns |
372 | 372 | $sortable = $this->get_sortable_columns(); |
373 | 373 | |
374 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
374 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
375 | 375 | |
376 | 376 | $this->items = $this->donor_data(); |
377 | 377 | |
378 | 378 | $this->total = $this->get_donor_count(); |
379 | 379 | |
380 | - $this->set_pagination_args( array( |
|
380 | + $this->set_pagination_args(array( |
|
381 | 381 | 'total_items' => $this->total, |
382 | 382 | 'per_page' => $this->per_page, |
383 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
384 | - ) ); |
|
383 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
384 | + )); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | \ No newline at end of file |
@@ -641,9 +641,12 @@ discard block |
||
641 | 641 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
642 | 642 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
643 | 643 | <?php echo $form_data_tab['icon-html']; ?> |
644 | - <?php else : ?> |
|
644 | + <?php else { |
|
645 | + : ?> |
|
645 | 646 | <span class="give-icon give-icon-default"></span> |
646 | - <?php endif; ?> |
|
647 | + <?php endif; |
|
648 | +} |
|
649 | +?> |
|
647 | 650 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
648 | 651 | </a> |
649 | 652 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -653,9 +656,12 @@ discard block |
||
653 | 656 | <a href="#<?php echo $sub_tab['id']; ?>"> |
654 | 657 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
655 | 658 | <?php echo $sub_tab['icon-html']; ?> |
656 | - <?php else : ?> |
|
659 | + <?php else { |
|
660 | + : ?> |
|
657 | 661 | <span class="give-icon give-icon-default"></span> |
658 | - <?php endif; ?> |
|
662 | + <?php endif; |
|
663 | +} |
|
664 | +?> |
|
659 | 665 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
660 | 666 | </a> |
661 | 667 | </li> |
@@ -682,11 +688,14 @@ discard block |
||
682 | 688 | </div> |
683 | 689 | |
684 | 690 | <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
685 | - <?php else: ?> |
|
691 | + <?php else { |
|
692 | + : ?> |
|
686 | 693 | <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
687 | 694 | <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
688 | 695 | <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
689 | - <div id="<?php echo $sub_fields['id']; ?>" |
|
696 | + <div id="<?php echo $sub_fields['id']; |
|
697 | +} |
|
698 | +?>" |
|
690 | 699 | class="panel give_options_panel give-hidden"> |
691 | 700 | <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
692 | 701 | <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
400 | 400 | 'id' => $prefix . 'form_goal_achieved_message', |
401 | 401 | 'type' => 'wysiwyg', |
402 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
402 | + 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
403 | 403 | ), |
404 | 404 | array( |
405 | 405 | 'name' => 'donation_goal_docs', |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | |
672 | 672 | <div id="<?php echo $setting['id']; ?>" |
673 | 673 | class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
674 | - $show_first_tab_content = false; ?>"> |
|
674 | + $show_first_tab_content = false; ?>"> |
|
675 | 675 | <?php if ( ! empty( $setting['fields'] ) ) : ?> |
676 | 676 | <?php foreach ( $setting['fields'] as $field ) : ?> |
677 | 677 | <?php give_render_field( $field ); ?> |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function get_settings() { |
85 | 85 | $post_id = give_get_admin_post_id(); |
86 | - $price = give_get_form_price( $post_id ); |
|
87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
88 | - $goal = give_get_form_goal( $post_id ); |
|
86 | + $price = give_get_form_price($post_id); |
|
87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
88 | + $goal = give_get_form_goal($post_id); |
|
89 | 89 | |
90 | 90 | // No empty prices - min. 1.00 for new forms |
91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
91 | + if (empty($price) && is_null($post_id)) { |
|
92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Min. $1.00 for new forms |
96 | - if ( empty( $custom_amount_minimum ) ) { |
|
97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
96 | + if (empty($custom_amount_minimum)) { |
|
97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Repeatable Field Groups |
106 | 106 | */ |
107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
108 | 108 | 'id' => 'form_field_options', |
109 | - 'title' => __( 'Donation Options', 'give' ), |
|
109 | + 'title' => __('Donation Options', 'give'), |
|
110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
112 | 112 | // Donation Option |
113 | 113 | array( |
114 | - 'name' => __( 'Donation Option', 'give' ), |
|
115 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
116 | - 'id' => $prefix . 'price_option', |
|
114 | + 'name' => __('Donation Option', 'give'), |
|
115 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
116 | + 'id' => $prefix.'price_option', |
|
117 | 117 | 'type' => 'radio_inline', |
118 | 118 | 'default' => 'set', |
119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
120 | - 'set' => __( 'Set Donation', 'give' ), |
|
121 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
122 | - ) ), |
|
119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
120 | + 'set' => __('Set Donation', 'give'), |
|
121 | + 'multi' => __('Multi-level Donation', 'give'), |
|
122 | + )), |
|
123 | 123 | ), |
124 | 124 | array( |
125 | - 'name' => __( 'Set Donation', 'give' ), |
|
126 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
127 | - 'id' => $prefix . 'set_price', |
|
125 | + 'name' => __('Set Donation', 'give'), |
|
126 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
127 | + 'id' => $prefix.'set_price', |
|
128 | 128 | 'type' => 'text_small', |
129 | 129 | 'data_type' => 'price', |
130 | 130 | 'attributes' => array( |
131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
132 | - 'value' => give_format_decimal( $price ), |
|
131 | + 'placeholder' => give_format_decimal('1.00'), |
|
132 | + 'value' => give_format_decimal($price), |
|
133 | 133 | 'class' => 'give-money-field', |
134 | 134 | ), |
135 | 135 | ), |
136 | 136 | // Display Style |
137 | 137 | array( |
138 | - 'name' => __( 'Display Style', 'give' ), |
|
139 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
140 | - 'id' => $prefix . 'display_style', |
|
138 | + 'name' => __('Display Style', 'give'), |
|
139 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
140 | + 'id' => $prefix.'display_style', |
|
141 | 141 | 'type' => 'radio_inline', |
142 | 142 | 'default' => 'buttons', |
143 | 143 | 'options' => array( |
144 | - 'buttons' => __( 'Buttons', 'give' ), |
|
145 | - 'radios' => __( 'Radios', 'give' ), |
|
146 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
144 | + 'buttons' => __('Buttons', 'give'), |
|
145 | + 'radios' => __('Radios', 'give'), |
|
146 | + 'dropdown' => __('Dropdown', 'give'), |
|
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | // Custom Amount |
150 | 150 | array( |
151 | - 'name' => __( 'Custom Amount', 'give' ), |
|
152 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
153 | - 'id' => $prefix . 'custom_amount', |
|
151 | + 'name' => __('Custom Amount', 'give'), |
|
152 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
153 | + 'id' => $prefix.'custom_amount', |
|
154 | 154 | 'type' => 'radio_inline', |
155 | 155 | 'default' => 'disabled', |
156 | 156 | 'options' => array( |
157 | - 'enabled' => __( 'Enabled', 'give' ), |
|
158 | - 'disabled' => __( 'Disabled', 'give' ), |
|
157 | + 'enabled' => __('Enabled', 'give'), |
|
158 | + 'disabled' => __('Disabled', 'give'), |
|
159 | 159 | ), |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
163 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
162 | + 'name' => __('Minimum Amount', 'give'), |
|
163 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
164 | + 'id' => $prefix.'custom_amount_minimum', |
|
165 | 165 | 'type' => 'text_small', |
166 | 166 | 'data_type' => 'price', |
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_decimal('1.00'), |
|
169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
170 | 170 | 'class' => 'give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text_medium', |
178 | 178 | 'attributes' => array( |
179 | 179 | 'rows' => 3, |
180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
181 | 181 | ), |
182 | 182 | ), |
183 | 183 | // Donation Levels: Repeatable CMB2 Group |
184 | 184 | array( |
185 | - 'id' => $prefix . 'donation_levels', |
|
185 | + 'id' => $prefix.'donation_levels', |
|
186 | 186 | 'type' => 'group', |
187 | 187 | 'options' => array( |
188 | - 'add_button' => __( 'Add Level', 'give' ), |
|
189 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
188 | + 'add_button' => __('Add Level', 'give'), |
|
189 | + 'header_title' => __('Donation Level', 'give'), |
|
190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
191 | 191 | ), |
192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
193 | 193 | // Prefix is not needed. |
194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
195 | 195 | array( |
196 | - 'name' => __( 'ID', 'give' ), |
|
197 | - 'id' => $prefix . 'id', |
|
196 | + 'name' => __('ID', 'give'), |
|
197 | + 'id' => $prefix.'id', |
|
198 | 198 | 'type' => 'levels_id', |
199 | 199 | ), |
200 | 200 | array( |
201 | - 'name' => __( 'Amount', 'give' ), |
|
202 | - 'id' => $prefix . 'amount', |
|
201 | + 'name' => __('Amount', 'give'), |
|
202 | + 'id' => $prefix.'amount', |
|
203 | 203 | 'type' => 'text_small', |
204 | 204 | 'data_type' => 'price', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
206 | + 'placeholder' => give_format_decimal('1.00'), |
|
207 | 207 | 'class' => 'give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | array( |
211 | - 'name' => __( 'Text', 'give' ), |
|
212 | - 'id' => $prefix . 'text', |
|
211 | + 'name' => __('Text', 'give'), |
|
212 | + 'id' => $prefix.'text', |
|
213 | 213 | 'type' => 'text', |
214 | 214 | 'attributes' => array( |
215 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
215 | + 'placeholder' => __('Donation Level', 'give'), |
|
216 | 216 | 'class' => 'give-multilevel-text-field', |
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Default', 'give' ), |
|
221 | - 'id' => $prefix . 'default', |
|
220 | + 'name' => __('Default', 'give'), |
|
221 | + 'id' => $prefix.'default', |
|
222 | 222 | 'type' => 'give_default_radio_inline', |
223 | 223 | ), |
224 | - ) ), |
|
224 | + )), |
|
225 | 225 | ), |
226 | 226 | array( |
227 | 227 | 'name' => 'donation_options_docs', |
228 | 228 | 'type' => 'docs_link', |
229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
230 | - 'title' => __( 'Donation Options', 'give' ), |
|
230 | + 'title' => __('Donation Options', 'give'), |
|
231 | 231 | ), |
232 | 232 | ), |
233 | 233 | $post_id |
234 | 234 | ), |
235 | - ) ), |
|
235 | + )), |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Display Options |
239 | 239 | */ |
240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
241 | 241 | 'id' => 'form_display_options', |
242 | - 'title' => __( 'Form Display', 'give' ), |
|
242 | + 'title' => __('Form Display', 'give'), |
|
243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
245 | 245 | array( |
246 | - 'name' => __( 'Display Options', 'give' ), |
|
247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
248 | - 'id' => $prefix . 'payment_display', |
|
246 | + 'name' => __('Display Options', 'give'), |
|
247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
248 | + 'id' => $prefix.'payment_display', |
|
249 | 249 | 'type' => 'radio_inline', |
250 | 250 | 'options' => array( |
251 | - 'onpage' => __( 'All Fields', 'give' ), |
|
252 | - 'modal' => __( 'Modal', 'give' ), |
|
253 | - 'reveal' => __( 'Reveal', 'give' ), |
|
254 | - 'button' => __( 'Button', 'give' ), |
|
251 | + 'onpage' => __('All Fields', 'give'), |
|
252 | + 'modal' => __('Modal', 'give'), |
|
253 | + 'reveal' => __('Reveal', 'give'), |
|
254 | + 'button' => __('Button', 'give'), |
|
255 | 255 | ), |
256 | 256 | 'default' => 'onpage', |
257 | 257 | ), |
258 | 258 | array( |
259 | - 'id' => $prefix . 'reveal_label', |
|
260 | - 'name' => __( 'Continue Button', 'give' ), |
|
261 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
259 | + 'id' => $prefix.'reveal_label', |
|
260 | + 'name' => __('Continue Button', 'give'), |
|
261 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
262 | 262 | 'type' => 'text_small', |
263 | 263 | 'attributes' => array( |
264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
265 | 265 | ), |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Guest Donations', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
285 | - 'id' => $prefix . 'logged_in_only', |
|
283 | + 'name' => __('Guest Donations', 'give'), |
|
284 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
285 | + 'id' => $prefix.'logged_in_only', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'default' => 'enabled', |
288 | 288 | 'options' => array( |
289 | - 'enabled' => __( 'Enabled', 'give' ), |
|
290 | - 'disabled' => __( 'Disabled', 'give' ), |
|
289 | + 'enabled' => __('Enabled', 'give'), |
|
290 | + 'disabled' => __('Disabled', 'give'), |
|
291 | 291 | ), |
292 | 292 | ), |
293 | 293 | array( |
294 | - 'name' => __( 'Registration', 'give' ), |
|
295 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
296 | - 'id' => $prefix . 'show_register_form', |
|
294 | + 'name' => __('Registration', 'give'), |
|
295 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
296 | + 'id' => $prefix.'show_register_form', |
|
297 | 297 | 'type' => 'radio', |
298 | 298 | 'options' => array( |
299 | - 'none' => __( 'None', 'give' ), |
|
300 | - 'registration' => __( 'Registration', 'give' ), |
|
301 | - 'login' => __( 'Login', 'give' ), |
|
302 | - 'both' => __( 'Registration + Login', 'give' ), |
|
299 | + 'none' => __('None', 'give'), |
|
300 | + 'registration' => __('Registration', 'give'), |
|
301 | + 'login' => __('Login', 'give'), |
|
302 | + 'both' => __('Registration + Login', 'give'), |
|
303 | 303 | ), |
304 | 304 | 'default' => 'none', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | + 'name' => __('Floating Labels', 'give'), |
|
308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
310 | - 'id' => $prefix . 'form_floating_labels', |
|
309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
310 | + 'id' => $prefix.'form_floating_labels', |
|
311 | 311 | 'type' => 'radio_inline', |
312 | 312 | 'options' => array( |
313 | - 'global' => __( 'Global Option', 'give' ), |
|
314 | - 'enabled' => __( 'Enabled', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'global' => __('Global Option', 'give'), |
|
314 | + 'enabled' => __('Enabled', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | ), |
317 | 317 | 'default' => 'global', |
318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'name' => 'form_display_docs', |
321 | 321 | 'type' => 'docs_link', |
322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
323 | - 'title' => __( 'Form Display', 'give' ), |
|
323 | + 'title' => __('Form Display', 'give'), |
|
324 | 324 | ), |
325 | 325 | ), |
326 | 326 | $post_id |
@@ -331,172 +331,172 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Donation Goals |
333 | 333 | */ |
334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
335 | 335 | 'id' => 'donation_goal_options', |
336 | - 'title' => __( 'Donation Goal', 'give' ), |
|
336 | + 'title' => __('Donation Goal', 'give'), |
|
337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
339 | 339 | // Goals |
340 | 340 | array( |
341 | - 'name' => __( 'Donation Goal', 'give' ), |
|
342 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
343 | - 'id' => $prefix . 'goal_option', |
|
341 | + 'name' => __('Donation Goal', 'give'), |
|
342 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
343 | + 'id' => $prefix.'goal_option', |
|
344 | 344 | 'type' => 'radio_inline', |
345 | 345 | 'default' => 'disabled', |
346 | 346 | 'options' => array( |
347 | - 'enabled' => __( 'Enabled', 'give' ), |
|
348 | - 'disabled' => __( 'Disabled', 'give' ), |
|
347 | + 'enabled' => __('Enabled', 'give'), |
|
348 | + 'disabled' => __('Disabled', 'give'), |
|
349 | 349 | ), |
350 | 350 | ), |
351 | 351 | array( |
352 | - 'name' => __( 'Goal Amount', 'give' ), |
|
353 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
354 | - 'id' => $prefix . 'set_goal', |
|
352 | + 'name' => __('Goal Amount', 'give'), |
|
353 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
354 | + 'id' => $prefix.'set_goal', |
|
355 | 355 | 'type' => 'text_small', |
356 | 356 | 'data_type' => 'price', |
357 | 357 | 'attributes' => array( |
358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
359 | - 'value' => give_format_decimal( $goal ), |
|
358 | + 'placeholder' => give_format_decimal('0.00'), |
|
359 | + 'value' => give_format_decimal($goal), |
|
360 | 360 | 'class' => 'give-money-field', |
361 | 361 | ), |
362 | 362 | ), |
363 | 363 | |
364 | 364 | array( |
365 | - 'name' => __( 'Goal Format', 'give' ), |
|
366 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
367 | - 'id' => $prefix . 'goal_format', |
|
365 | + 'name' => __('Goal Format', 'give'), |
|
366 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
367 | + 'id' => $prefix.'goal_format', |
|
368 | 368 | 'type' => 'radio_inline', |
369 | 369 | 'default' => 'amount', |
370 | 370 | 'options' => array( |
371 | - 'amount' => __( 'Amount', 'give' ), |
|
372 | - 'percentage' => __( 'Percentage', 'give' ), |
|
371 | + 'amount' => __('Amount', 'give'), |
|
372 | + 'percentage' => __('Percentage', 'give'), |
|
373 | 373 | ), |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
377 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
378 | - 'id' => $prefix . 'goal_color', |
|
376 | + 'name' => __('Progress Bar Color', 'give'), |
|
377 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
378 | + 'id' => $prefix.'goal_color', |
|
379 | 379 | 'type' => 'colorpicker', |
380 | 380 | 'default' => '#2bc253', |
381 | 381 | ), |
382 | 382 | |
383 | 383 | array( |
384 | - 'name' => __( 'Close Form', 'give' ), |
|
385 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
384 | + 'name' => __('Close Form', 'give'), |
|
385 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
387 | 387 | 'type' => 'radio_inline', |
388 | 388 | 'default' => 'disabled', |
389 | 389 | 'options' => array( |
390 | - 'enabled' => __( 'Enabled', 'give' ), |
|
391 | - 'disabled' => __( 'Disabled', 'give' ), |
|
390 | + 'enabled' => __('Enabled', 'give'), |
|
391 | + 'disabled' => __('Disabled', 'give'), |
|
392 | 392 | ), |
393 | 393 | ), |
394 | 394 | array( |
395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
398 | 398 | 'type' => 'wysiwyg', |
399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | 402 | 'name' => 'donation_goal_docs', |
403 | 403 | 'type' => 'docs_link', |
404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
405 | - 'title' => __( 'Donation Goal', 'give' ), |
|
405 | + 'title' => __('Donation Goal', 'give'), |
|
406 | 406 | ), |
407 | 407 | ), |
408 | 408 | $post_id |
409 | 409 | ), |
410 | - ) ), |
|
410 | + )), |
|
411 | 411 | |
412 | 412 | /** |
413 | 413 | * Content Field |
414 | 414 | */ |
415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
416 | 416 | 'id' => 'form_content_options', |
417 | - 'title' => __( 'Form Content', 'give' ), |
|
417 | + 'title' => __('Form Content', 'give'), |
|
418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
420 | 420 | |
421 | 421 | // Donation content. |
422 | 422 | array( |
423 | - 'name' => __( 'Display Content', 'give' ), |
|
424 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
425 | - 'id' => $prefix . 'display_content', |
|
423 | + 'name' => __('Display Content', 'give'), |
|
424 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
425 | + 'id' => $prefix.'display_content', |
|
426 | 426 | 'type' => 'radio_inline', |
427 | 427 | 'options' => array( |
428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
428 | + 'enabled' => __('Enabled', 'give'), |
|
429 | + 'disabled' => __('Disabled', 'give'), |
|
430 | 430 | ), |
431 | 431 | 'default' => 'disabled', |
432 | 432 | ), |
433 | 433 | |
434 | 434 | // Content placement. |
435 | 435 | array( |
436 | - 'name' => __( 'Content Placement', 'give' ), |
|
437 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
438 | - 'id' => $prefix . 'content_placement', |
|
436 | + 'name' => __('Content Placement', 'give'), |
|
437 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
438 | + 'id' => $prefix.'content_placement', |
|
439 | 439 | 'type' => 'radio_inline', |
440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
441 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
442 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
441 | + 'give_pre_form' => __('Above fields', 'give'), |
|
442 | + 'give_post_form' => __('Below fields', 'give'), |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | 'default' => 'give_pre_form', |
446 | 446 | ), |
447 | 447 | array( |
448 | - 'name' => __( 'Content', 'give' ), |
|
449 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
450 | - 'id' => $prefix . 'form_content', |
|
448 | + 'name' => __('Content', 'give'), |
|
449 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
450 | + 'id' => $prefix.'form_content', |
|
451 | 451 | 'type' => 'wysiwyg', |
452 | 452 | ), |
453 | 453 | array( |
454 | 454 | 'name' => 'form_content_docs', |
455 | 455 | 'type' => 'docs_link', |
456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
457 | - 'title' => __( 'Form Content', 'give' ), |
|
457 | + 'title' => __('Form Content', 'give'), |
|
458 | 458 | ), |
459 | 459 | ), |
460 | 460 | $post_id |
461 | 461 | ), |
462 | - ) ), |
|
462 | + )), |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Terms & Conditions |
466 | 466 | */ |
467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
468 | 468 | 'id' => 'form_terms_options', |
469 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
469 | + 'title' => __('Terms & Conditions', 'give'), |
|
470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
472 | 472 | // Donation Option |
473 | 473 | array( |
474 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
475 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
476 | - 'id' => $prefix . 'terms_option', |
|
474 | + 'name' => __('Terms and Conditions', 'give'), |
|
475 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
476 | + 'id' => $prefix.'terms_option', |
|
477 | 477 | 'type' => 'radio_inline', |
478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
479 | - 'global' => __( 'Global Option', 'give' ), |
|
480 | - 'enabled' => __( 'Customize', 'give' ), |
|
481 | - 'disabled' => __( 'Disable', 'give' ), |
|
478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
479 | + 'global' => __('Global Option', 'give'), |
|
480 | + 'enabled' => __('Customize', 'give'), |
|
481 | + 'disabled' => __('Disable', 'give'), |
|
482 | 482 | ) |
483 | 483 | ), |
484 | 484 | 'default' => 'global', |
485 | 485 | ), |
486 | 486 | array( |
487 | - 'id' => $prefix . 'agree_label', |
|
488 | - 'name' => __( 'Agreement Label', 'give' ), |
|
489 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
487 | + 'id' => $prefix.'agree_label', |
|
488 | + 'name' => __('Agreement Label', 'give'), |
|
489 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
490 | 490 | 'type' => 'text', |
491 | 491 | 'size' => 'regular', |
492 | 492 | 'attributes' => array( |
493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
494 | 494 | ), |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'id' => $prefix . 'agree_text', |
|
498 | - 'name' => __( 'Agreement Text', 'give' ), |
|
499 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
497 | + 'id' => $prefix.'agree_text', |
|
498 | + 'name' => __('Agreement Text', 'give'), |
|
499 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
500 | 500 | 'default' => give_get_option('agreement_text'), |
501 | 501 | 'type' => 'wysiwyg', |
502 | 502 | ), |
@@ -504,19 +504,19 @@ discard block |
||
504 | 504 | 'name' => 'terms_docs', |
505 | 505 | 'type' => 'docs_link', |
506 | 506 | 'url' => 'http://docs.givewp.com/form-terms', |
507 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
507 | + 'title' => __('Terms and Conditions', 'give'), |
|
508 | 508 | ), |
509 | 509 | ), |
510 | 510 | $post_id |
511 | 511 | ), |
512 | - ) ), |
|
512 | + )), |
|
513 | 513 | ); |
514 | 514 | |
515 | 515 | |
516 | 516 | /** |
517 | 517 | * Filter the metabox tabbed panel settings. |
518 | 518 | */ |
519 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
519 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
520 | 520 | |
521 | 521 | // Output. |
522 | 522 | return $settings; |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | add_meta_box( |
533 | 533 | $this->get_metabox_ID(), |
534 | 534 | $this->get_metabox_label(), |
535 | - array( $this, 'output' ), |
|
536 | - array( 'give_forms' ), |
|
535 | + array($this, 'output'), |
|
536 | + array('give_forms'), |
|
537 | 537 | 'normal', |
538 | 538 | 'high' |
539 | 539 | ); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | function enqueue_script() { |
550 | 550 | global $post; |
551 | 551 | |
552 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
552 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
553 | 553 | |
554 | 554 | } |
555 | 555 | } |
@@ -584,32 +584,32 @@ discard block |
||
584 | 584 | public function get_tabs() { |
585 | 585 | $tabs = array(); |
586 | 586 | |
587 | - if ( ! empty( $this->settings ) ) { |
|
588 | - foreach ( $this->settings as $setting ) { |
|
589 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
587 | + if ( ! empty($this->settings)) { |
|
588 | + foreach ($this->settings as $setting) { |
|
589 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
590 | 590 | continue; |
591 | 591 | } |
592 | 592 | $tab = array( |
593 | 593 | 'id' => $setting['id'], |
594 | 594 | 'label' => $setting['title'], |
595 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
595 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
596 | 596 | ); |
597 | 597 | |
598 | - if ( $this->has_sub_tab( $setting ) ) { |
|
599 | - if ( empty( $setting['sub-fields'] ) ) { |
|
598 | + if ($this->has_sub_tab($setting)) { |
|
599 | + if (empty($setting['sub-fields'])) { |
|
600 | 600 | $tab = array(); |
601 | 601 | } else { |
602 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
602 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
603 | 603 | $tab['sub-fields'][] = array( |
604 | 604 | 'id' => $sub_fields['id'], |
605 | 605 | 'label' => $sub_fields['title'], |
606 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
606 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
607 | 607 | ); |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | - if ( ! empty( $tab ) ) { |
|
612 | + if ( ! empty($tab)) { |
|
613 | 613 | $tabs[] = $tab; |
614 | 614 | } |
615 | 615 | } |
@@ -626,27 +626,27 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public function output() { |
628 | 628 | // Bailout. |
629 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
630 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
629 | + if ($form_data_tabs = $this->get_tabs()) { |
|
630 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
631 | 631 | ?> |
632 | 632 | <div class="give-metabox-panel-wrap"> |
633 | 633 | <ul class="give-form-data-tabs give-metabox-tabs"> |
634 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
635 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
634 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
635 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
636 | 636 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
637 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
637 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
638 | 638 | <?php echo $form_data_tab['icon-html']; ?> |
639 | 639 | <?php else : ?> |
640 | 640 | <span class="give-icon give-icon-default"></span> |
641 | 641 | <?php endif; ?> |
642 | 642 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
643 | 643 | </a> |
644 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
644 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
645 | 645 | <ul class="give-metabox-sub-tabs give-hidden"> |
646 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
646 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
647 | 647 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
648 | 648 | <a href="#<?php echo $sub_tab['id']; ?>"> |
649 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
649 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
650 | 650 | <?php echo $sub_tab['icon-html']; ?> |
651 | 651 | <?php else : ?> |
652 | 652 | <span class="give-icon give-icon-default"></span> |
@@ -662,30 +662,30 @@ discard block |
||
662 | 662 | </ul> |
663 | 663 | |
664 | 664 | <?php $show_first_tab_content = true; ?> |
665 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
666 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
667 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
665 | + <?php foreach ($this->settings as $setting) : ?> |
|
666 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
667 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
668 | 668 | |
669 | 669 | <div id="<?php echo $setting['id']; ?>" |
670 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
670 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
671 | 671 | $show_first_tab_content = false; ?>"> |
672 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
673 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
674 | - <?php give_render_field( $field ); ?> |
|
672 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
673 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
674 | + <?php give_render_field($field); ?> |
|
675 | 675 | <?php endforeach; ?> |
676 | 676 | <?php endif; ?> |
677 | 677 | </div> |
678 | 678 | |
679 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
679 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
680 | 680 | <?php else: ?> |
681 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
682 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
683 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
681 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
682 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
683 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
684 | 684 | <div id="<?php echo $sub_fields['id']; ?>" |
685 | 685 | class="panel give_options_panel give-hidden"> |
686 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
687 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
688 | - <?php give_render_field( $sub_field ); ?> |
|
686 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
687 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
688 | + <?php give_render_field($sub_field); ?> |
|
689 | 689 | <?php endforeach; ?> |
690 | 690 | <?php endif; ?> |
691 | 691 | </div> |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - private function has_sub_tab( $field_setting ) { |
|
712 | + private function has_sub_tab($field_setting) { |
|
713 | 713 | $has_sub_tab = false; |
714 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
714 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
715 | 715 | $has_sub_tab = true; |
716 | 716 | } |
717 | 717 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | * @return array |
726 | 726 | */ |
727 | 727 | function cmb2_metabox_settings() { |
728 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
728 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
729 | 729 | $give_forms_settings = $all_cmb2_settings; |
730 | 730 | |
731 | 731 | // Filter settings: Use only give forms related settings. |
732 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
733 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
734 | - unset( $give_forms_settings[ $index ] ); |
|
732 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
733 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
734 | + unset($give_forms_settings[$index]); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -749,114 +749,114 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return void |
751 | 751 | */ |
752 | - public function save( $post_id, $post ) { |
|
752 | + public function save($post_id, $post) { |
|
753 | 753 | |
754 | 754 | // $post_id and $post are required. |
755 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
755 | + if (empty($post_id) || empty($post)) { |
|
756 | 756 | return; |
757 | 757 | } |
758 | 758 | |
759 | 759 | // Don't save meta boxes for revisions or autosaves. |
760 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
760 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
761 | 761 | return; |
762 | 762 | } |
763 | 763 | |
764 | 764 | // Check the nonce. |
765 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
765 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
766 | 766 | return; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
770 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
770 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
771 | 771 | return; |
772 | 772 | } |
773 | 773 | |
774 | 774 | // Check user has permission to edit. |
775 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
775 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
776 | 776 | return; |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Fire action before saving form meta. |
780 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
780 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
781 | 781 | |
782 | 782 | /** |
783 | 783 | * Filter the meta key to save. |
784 | 784 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
785 | 785 | */ |
786 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
786 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
787 | 787 | |
788 | 788 | // Save form meta data. |
789 | - if ( ! empty( $form_meta_keys ) ) { |
|
790 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
789 | + if ( ! empty($form_meta_keys)) { |
|
790 | + foreach ($form_meta_keys as $form_meta_key) { |
|
791 | 791 | |
792 | 792 | // Set default value for checkbox fields. |
793 | 793 | if ( |
794 | - ! isset( $_POST[ $form_meta_key ] ) |
|
795 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
794 | + ! isset($_POST[$form_meta_key]) |
|
795 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
796 | 796 | ) { |
797 | - $_POST[ $form_meta_key ] = ''; |
|
797 | + $_POST[$form_meta_key] = ''; |
|
798 | 798 | } |
799 | 799 | |
800 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
801 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
802 | - switch ( $field_type ) { |
|
800 | + if (isset($_POST[$form_meta_key])) { |
|
801 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
802 | + switch ($field_type) { |
|
803 | 803 | case 'textarea': |
804 | 804 | case 'wysiwyg': |
805 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
806 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
805 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
806 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
807 | 807 | break; |
808 | 808 | |
809 | 809 | case 'group': |
810 | 810 | $form_meta_value = array(); |
811 | 811 | |
812 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
812 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
813 | 813 | |
814 | 814 | // Do not save template input field values. |
815 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
815 | + if ('{{row-count-placeholder}}' === $index) { |
|
816 | 816 | continue; |
817 | 817 | } |
818 | 818 | |
819 | 819 | $group_meta_value = array(); |
820 | - foreach ( $group as $field_id => $field_value ) { |
|
821 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
820 | + foreach ($group as $field_id => $field_value) { |
|
821 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
822 | 822 | case 'wysiwyg': |
823 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
823 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
824 | 824 | break; |
825 | 825 | |
826 | 826 | default: |
827 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
827 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | - if ( ! empty( $group_meta_value ) ) { |
|
832 | - $form_meta_value[ $index ] = $group_meta_value; |
|
831 | + if ( ! empty($group_meta_value)) { |
|
832 | + $form_meta_value[$index] = $group_meta_value; |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | 836 | |
837 | 837 | // Arrange repeater field keys in order. |
838 | - $form_meta_value = array_values( $form_meta_value ); |
|
838 | + $form_meta_value = array_values($form_meta_value); |
|
839 | 839 | |
840 | 840 | // Save data. |
841 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
841 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
842 | 842 | break; |
843 | 843 | |
844 | 844 | default: |
845 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
845 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
846 | 846 | |
847 | 847 | // Save data. |
848 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
848 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | // Fire after saving form meta key. |
852 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
852 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
858 | 858 | // Fire action after saving form meta. |
859 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
859 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -869,10 +869,10 @@ discard block |
||
869 | 869 | * |
870 | 870 | * @return string |
871 | 871 | */ |
872 | - private function get_field_id( $field ) { |
|
872 | + private function get_field_id($field) { |
|
873 | 873 | $field_id = ''; |
874 | 874 | |
875 | - if ( array_key_exists( 'id', $field ) ) { |
|
875 | + if (array_key_exists('id', $field)) { |
|
876 | 876 | $field_id = $field['id']; |
877 | 877 | |
878 | 878 | } |
@@ -889,12 +889,12 @@ discard block |
||
889 | 889 | * |
890 | 890 | * @return array |
891 | 891 | */ |
892 | - private function get_fields_id( $setting ) { |
|
892 | + private function get_fields_id($setting) { |
|
893 | 893 | $meta_keys = array(); |
894 | 894 | |
895 | - if ( ! empty( $setting ) ) { |
|
896 | - foreach ( $setting['fields'] as $field ) { |
|
897 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
895 | + if ( ! empty($setting)) { |
|
896 | + foreach ($setting['fields'] as $field) { |
|
897 | + if ($field_id = $this->get_field_id($field)) { |
|
898 | 898 | $meta_keys[] = $field_id; |
899 | 899 | } |
900 | 900 | } |
@@ -912,14 +912,14 @@ discard block |
||
912 | 912 | * |
913 | 913 | * @return array |
914 | 914 | */ |
915 | - private function get_sub_fields_id( $setting ) { |
|
915 | + private function get_sub_fields_id($setting) { |
|
916 | 916 | $meta_keys = array(); |
917 | 917 | |
918 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
919 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
920 | - if ( ! empty( $fields['fields'] ) ) { |
|
921 | - foreach ( $fields['fields'] as $field ) { |
|
922 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
918 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
919 | + foreach ($setting['sub-fields'] as $fields) { |
|
920 | + if ( ! empty($fields['fields'])) { |
|
921 | + foreach ($fields['fields'] as $field) { |
|
922 | + if ($field_id = $this->get_field_id($field)) { |
|
923 | 923 | $meta_keys[] = $field_id; |
924 | 924 | } |
925 | 925 | } |
@@ -940,14 +940,14 @@ discard block |
||
940 | 940 | private function get_meta_keys_from_settings() { |
941 | 941 | $meta_keys = array(); |
942 | 942 | |
943 | - foreach ( $this->settings as $setting ) { |
|
944 | - if ( $this->has_sub_tab( $setting ) ) { |
|
945 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
943 | + foreach ($this->settings as $setting) { |
|
944 | + if ($this->has_sub_tab($setting)) { |
|
945 | + $meta_key = $this->get_sub_fields_id($setting); |
|
946 | 946 | } else { |
947 | - $meta_key = $this->get_fields_id( $setting ); |
|
947 | + $meta_key = $this->get_fields_id($setting); |
|
948 | 948 | } |
949 | 949 | |
950 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
950 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
951 | 951 | } |
952 | 952 | |
953 | 953 | return $meta_keys; |
@@ -964,10 +964,10 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return string |
966 | 966 | */ |
967 | - function get_field_type( $field_id, $group_id = '' ) { |
|
968 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
967 | + function get_field_type($field_id, $group_id = '') { |
|
968 | + $field = $this->get_setting_field($field_id, $group_id); |
|
969 | 969 | |
970 | - $type = array_key_exists( 'type', $field ) |
|
970 | + $type = array_key_exists('type', $field) |
|
971 | 971 | ? $field['type'] |
972 | 972 | : ''; |
973 | 973 | |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | * |
986 | 986 | * @return array |
987 | 987 | */ |
988 | - private function get_field( $setting, $field_id ) { |
|
988 | + private function get_field($setting, $field_id) { |
|
989 | 989 | $setting_field = array(); |
990 | 990 | |
991 | - if ( ! empty( $setting['fields'] ) ) { |
|
992 | - foreach ( $setting['fields'] as $field ) { |
|
993 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
991 | + if ( ! empty($setting['fields'])) { |
|
992 | + foreach ($setting['fields'] as $field) { |
|
993 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
994 | 994 | $setting_field = $field; |
995 | 995 | break; |
996 | 996 | } |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return array |
1012 | 1012 | */ |
1013 | - private function get_sub_field( $setting, $field_id ) { |
|
1013 | + private function get_sub_field($setting, $field_id) { |
|
1014 | 1014 | $setting_field = array(); |
1015 | 1015 | |
1016 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1017 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1018 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1016 | + if ( ! empty($setting['sub-fields'])) { |
|
1017 | + foreach ($setting['sub-fields'] as $fields) { |
|
1018 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1019 | 1019 | $setting_field = $field; |
1020 | 1020 | break; |
1021 | 1021 | } |
@@ -1035,17 +1035,17 @@ discard block |
||
1035 | 1035 | * |
1036 | 1036 | * @return array |
1037 | 1037 | */ |
1038 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1038 | + function get_setting_field($field_id, $group_id = '') { |
|
1039 | 1039 | $setting_field = array(); |
1040 | 1040 | |
1041 | 1041 | $_field_id = $field_id; |
1042 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1042 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1043 | 1043 | |
1044 | - if ( ! empty( $this->settings ) ) { |
|
1045 | - foreach ( $this->settings as $setting ) { |
|
1044 | + if ( ! empty($this->settings)) { |
|
1045 | + foreach ($this->settings as $setting) { |
|
1046 | 1046 | if ( |
1047 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1048 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1047 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1048 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1049 | 1049 | ) { |
1050 | 1050 | break; |
1051 | 1051 | } |
@@ -1054,9 +1054,9 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | |
1056 | 1056 | // Get field from group. |
1057 | - if ( ! empty( $group_id ) ) { |
|
1058 | - foreach ( $setting_field['fields'] as $field ) { |
|
1059 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1057 | + if ( ! empty($group_id)) { |
|
1058 | + foreach ($setting_field['fields'] as $field) { |
|
1059 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1060 | 1060 | $setting_field = $field; |
1061 | 1061 | } |
1062 | 1062 | } |
@@ -1075,14 +1075,14 @@ discard block |
||
1075 | 1075 | * |
1076 | 1076 | * @return mixed |
1077 | 1077 | */ |
1078 | - function add_offline_donations_setting_tab( $settings ) { |
|
1079 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1080 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1078 | + function add_offline_donations_setting_tab($settings) { |
|
1079 | + if (give_is_gateway_active('offline')) { |
|
1080 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1081 | 1081 | 'id' => 'offline_donations_options', |
1082 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1082 | + 'title' => __('Offline Donations', 'give'), |
|
1083 | 1083 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1084 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1085 | - ) ); |
|
1084 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1085 | + )); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | return $settings; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct() { |
89 | 89 | |
90 | - if ( 'none' === $this->get_template() ) { |
|
90 | + if ('none' === $this->get_template()) { |
|
91 | 91 | $this->html = false; |
92 | 92 | } |
93 | 93 | |
94 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
95 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
94 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
95 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param $key |
105 | 105 | * @param $value |
106 | 106 | */ |
107 | - public function __set( $key, $value ) { |
|
107 | + public function __set($key, $value) { |
|
108 | 108 | $this->$key = $value; |
109 | 109 | } |
110 | 110 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | 116 | public function get_from_name() { |
117 | - if ( ! $this->from_name ) { |
|
118 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
117 | + if ( ! $this->from_name) { |
|
118 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
119 | 119 | } |
120 | 120 | |
121 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
121 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | 129 | public function get_from_address() { |
130 | - if ( ! $this->from_address ) { |
|
131 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
130 | + if ( ! $this->from_address) { |
|
131 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
134 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | * @since 1.0 |
141 | 141 | */ |
142 | 142 | public function get_content_type() { |
143 | - if ( ! $this->content_type && $this->html ) { |
|
144 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
145 | - } else if ( ! $this->html ) { |
|
143 | + if ( ! $this->content_type && $this->html) { |
|
144 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
145 | + } else if ( ! $this->html) { |
|
146 | 146 | $this->content_type = 'text/plain'; |
147 | 147 | } |
148 | 148 | |
149 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
149 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * @since 1.0 |
156 | 156 | */ |
157 | 157 | public function get_headers() { |
158 | - if ( ! $this->headers ) { |
|
158 | + if ( ! $this->headers) { |
|
159 | 159 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
160 | 160 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
161 | 161 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
164 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function get_templates() { |
173 | 173 | $templates = array( |
174 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
175 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
174 | + 'default' => esc_html__('Default Template', 'give'), |
|
175 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
176 | 176 | ); |
177 | 177 | |
178 | - return apply_filters( 'give_email_templates', $templates ); |
|
178 | + return apply_filters('give_email_templates', $templates); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @since 1.0 |
185 | 185 | */ |
186 | 186 | public function get_template() { |
187 | - if ( ! $this->template ) { |
|
188 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
187 | + if ( ! $this->template) { |
|
188 | + $this->template = give_get_option('email_template', 'default'); |
|
189 | 189 | } |
190 | 190 | |
191 | - return apply_filters( 'give_email_template', $this->template ); |
|
191 | + return apply_filters('give_email_template', $this->template); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | 199 | public function get_heading() { |
200 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
200 | + return apply_filters('give_email_heading', $this->heading); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function parse_tags( $content ) { |
|
210 | + public function parse_tags($content) { |
|
211 | 211 | return $content; |
212 | 212 | } |
213 | 213 | |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function build_email( $message ) { |
|
223 | + public function build_email($message) { |
|
224 | 224 | |
225 | - if ( false === $this->html ) { |
|
226 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
225 | + if (false === $this->html) { |
|
226 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
227 | 227 | } |
228 | 228 | |
229 | - $message = $this->text_to_html( $message ); |
|
229 | + $message = $this->text_to_html($message); |
|
230 | 230 | |
231 | 231 | $template = $this->get_template(); |
232 | 232 | |
233 | 233 | ob_start(); |
234 | 234 | |
235 | - give_get_template_part( 'emails/header', $template, true ); |
|
235 | + give_get_template_part('emails/header', $template, true); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires in the email head. |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param Give_Emails $this The email object. |
243 | 243 | */ |
244 | - do_action( 'give_email_header', $this ); |
|
244 | + do_action('give_email_header', $this); |
|
245 | 245 | |
246 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
246 | + if (has_action('give_email_template_'.$template)) { |
|
247 | 247 | /** |
248 | 248 | * Fires in a specific email template. |
249 | 249 | * |
250 | 250 | * @since 1.0 |
251 | 251 | */ |
252 | - do_action( "give_email_template_{$template}" ); |
|
252 | + do_action("give_email_template_{$template}"); |
|
253 | 253 | } else { |
254 | - give_get_template_part( 'emails/body', $template, true ); |
|
254 | + give_get_template_part('emails/body', $template, true); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param Give_Emails $this The email object. |
263 | 263 | */ |
264 | - do_action( 'give_email_body', $this ); |
|
264 | + do_action('give_email_body', $this); |
|
265 | 265 | |
266 | - give_get_template_part( 'emails/footer', $template, true ); |
|
266 | + give_get_template_part('emails/footer', $template, true); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Fires in the email footer. |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @param Give_Emails $this The email object. |
274 | 274 | */ |
275 | - do_action( 'give_email_footer', $this ); |
|
275 | + do_action('give_email_footer', $this); |
|
276 | 276 | |
277 | 277 | $body = ob_get_clean(); |
278 | - $message = str_replace( '{email}', $message, $body ); |
|
278 | + $message = str_replace('{email}', $message, $body); |
|
279 | 279 | |
280 | - return apply_filters( 'give_email_message', $message, $this ); |
|
280 | + return apply_filters('give_email_message', $message, $this); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return bool |
292 | 292 | */ |
293 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
293 | + public function send($to, $subject, $message, $attachments = '') { |
|
294 | 294 | |
295 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
296 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
295 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
296 | + _doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
297 | 297 | |
298 | 298 | return false; |
299 | 299 | } |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @param Give_Emails $this The email object. |
307 | 307 | */ |
308 | - do_action( 'give_email_send_before', $this ); |
|
308 | + do_action('give_email_send_before', $this); |
|
309 | 309 | |
310 | - $subject = $this->parse_tags( $subject ); |
|
311 | - $message = $this->parse_tags( $message ); |
|
310 | + $subject = $this->parse_tags($subject); |
|
311 | + $message = $this->parse_tags($message); |
|
312 | 312 | |
313 | - $message = $this->build_email( $message ); |
|
313 | + $message = $this->build_email($message); |
|
314 | 314 | |
315 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
315 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
316 | 316 | |
317 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
317 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Fires after sending an email. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Emails $this The email object. |
325 | 325 | */ |
326 | - do_action( 'give_email_send_after', $this ); |
|
326 | + do_action('give_email_send_after', $this); |
|
327 | 327 | |
328 | 328 | return $sent; |
329 | 329 | |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @since 1.0 |
336 | 336 | */ |
337 | 337 | public function send_before() { |
338 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
339 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
340 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
338 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
339 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
340 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @since 1.0 |
347 | 347 | */ |
348 | 348 | public function send_after() { |
349 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
350 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
351 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
349 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
350 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
351 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
352 | 352 | |
353 | 353 | // Reset heading to an empty string |
354 | 354 | $this->heading = ''; |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @since 1.0 |
361 | 361 | */ |
362 | - public function text_to_html( $message ) { |
|
362 | + public function text_to_html($message) { |
|
363 | 363 | |
364 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
365 | - $message = wpautop( $message ); |
|
364 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
365 | + $message = wpautop($message); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | return $message; |