@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode Button Class |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Admin |
|
7 | - * @author Paul Ryley |
|
8 | - * @copyright Copyright (c) 2015, WordImpress |
|
9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
10 | - * @version 1.0 |
|
11 | - * @since 1.3.0 |
|
12 | - */ |
|
3 | + * Shortcode Button Class |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Admin |
|
7 | + * @author Paul Ryley |
|
8 | + * @copyright Copyright (c) 2015, WordImpress |
|
9 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
10 | + * @version 1.0 |
|
11 | + * @since 1.3.0 |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | defined( 'ABSPATH' ) or exit; |
15 | 15 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
118 | 118 | // Only run in admin post/page creation and edit screens |
119 | 119 | if ( in_array( $pagenow, $shortcode_button_pages ) |
120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | - && ! empty( self::$shortcodes ) |
|
120 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | + && ! empty( self::$shortcodes ) |
|
122 | 122 | ) { |
123 | 123 | |
124 | 124 | $shortcodes = array(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 1.3.0 |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) or exit; |
|
14 | +defined('ABSPATH') or exit; |
|
15 | 15 | |
16 | 16 | final class Give_Shortcode_Button { |
17 | 17 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | |
30 | - if ( is_admin() ) { |
|
31 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
30 | + if (is_admin()) { |
|
31 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
32 | 32 | |
33 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
35 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
33 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
35 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
36 | 36 | } |
37 | 37 | |
38 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
39 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
38 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
39 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @since 1.0 |
50 | 50 | */ |
51 | - public function mce_external_plugins( $plugin_array ) { |
|
51 | + public function mce_external_plugins($plugin_array) { |
|
52 | 52 | |
53 | - if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { |
|
53 | + if (current_user_can('edit_posts') && current_user_can('edit_pages')) { |
|
54 | 54 | |
55 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
55 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
56 | 56 | |
57 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
57 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $plugin_array; |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function admin_enqueue_assets() { |
71 | 71 | |
72 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
72 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | 73 | |
74 | 74 | wp_enqueue_script( |
75 | 75 | 'give_shortcode', |
76 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
77 | - array( 'jquery' ), |
|
76 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
77 | + array('jquery'), |
|
78 | 78 | GIVE_VERSION, |
79 | 79 | true |
80 | 80 | ); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function admin_localize_scripts() { |
91 | 91 | |
92 | - if ( ! empty( self::$shortcodes ) ) { |
|
92 | + if ( ! empty(self::$shortcodes)) { |
|
93 | 93 | |
94 | 94 | $variables = array(); |
95 | 95 | |
96 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
97 | - if ( ! empty( $values['required'] ) ) { |
|
98 | - $variables[ $shortcode ] = $values['required']; |
|
96 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
97 | + if ( ! empty($values['required'])) { |
|
98 | + $variables[$shortcode] = $values['required']; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
102 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | |
115 | 115 | global $pagenow, $wp_version; |
116 | 116 | |
117 | - $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); |
|
117 | + $shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php'); |
|
118 | 118 | // Only run in admin post/page creation and edit screens |
119 | - if ( in_array( $pagenow, $shortcode_button_pages ) |
|
120 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
121 | - && ! empty( self::$shortcodes ) |
|
119 | + if (in_array($pagenow, $shortcode_button_pages) |
|
120 | + && apply_filters('give_shortcode_button_condition', true) |
|
121 | + && ! empty(self::$shortcodes) |
|
122 | 122 | ) { |
123 | 123 | |
124 | 124 | $shortcodes = array(); |
125 | 125 | |
126 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
126 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
127 | 127 | /** |
128 | 128 | * Filters the condition for including the current shortcode |
129 | 129 | * |
130 | 130 | * @since 1.0 |
131 | 131 | */ |
132 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
132 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
133 | 133 | |
134 | - $shortcodes[ $shortcode ] = sprintf( |
|
134 | + $shortcodes[$shortcode] = sprintf( |
|
135 | 135 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', |
136 | 136 | $shortcode, |
137 | 137 | $values['label'], |
@@ -140,37 +140,37 @@ discard block |
||
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if ( ! empty( $shortcodes ) ) { |
|
143 | + if ( ! empty($shortcodes)) { |
|
144 | 144 | |
145 | 145 | // check current WP version |
146 | - $img = ( version_compare( $wp_version, '3.5', '<' ) ) |
|
147 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
148 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
146 | + $img = (version_compare($wp_version, '3.5', '<')) |
|
147 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
148 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
149 | 149 | |
150 | - reset( $shortcodes ); |
|
150 | + reset($shortcodes); |
|
151 | 151 | |
152 | - if ( count( $shortcodes ) == 1 ) { |
|
152 | + if (count($shortcodes) == 1) { |
|
153 | 153 | |
154 | - $shortcode = key( $shortcodes ); |
|
154 | + $shortcode = key($shortcodes); |
|
155 | 155 | |
156 | 156 | printf( |
157 | 157 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
158 | 158 | $shortcode, |
159 | - sprintf( '%s %s %s', |
|
159 | + sprintf('%s %s %s', |
|
160 | 160 | $img, |
161 | - __( 'Insert', 'give' ), |
|
162 | - self::$shortcodes[ $shortcode ]['label'] |
|
161 | + __('Insert', 'give'), |
|
162 | + self::$shortcodes[$shortcode]['label'] |
|
163 | 163 | ) |
164 | 164 | ); |
165 | 165 | } else { |
166 | 166 | printf( |
167 | - '<div class="sc-wrap">' . |
|
168 | - '<button class="button sc-button">%s %s</button>' . |
|
169 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
167 | + '<div class="sc-wrap">'. |
|
168 | + '<button class="button sc-button">%s %s</button>'. |
|
169 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
170 | 170 | '</div>', |
171 | 171 | $img, |
172 | - __( 'Give Shortcodes', 'give' ), |
|
173 | - implode( '', array_values( $shortcodes ) ) |
|
172 | + __('Give Shortcodes', 'give'), |
|
173 | + implode('', array_values($shortcodes)) |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | } |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function shortcode_ajax() { |
188 | 188 | |
189 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
189 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
190 | 190 | $response = false; |
191 | 191 | |
192 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
192 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
193 | 193 | |
194 | - $data = self::$shortcodes[ $shortcode ]; |
|
194 | + $data = self::$shortcodes[$shortcode]; |
|
195 | 195 | |
196 | - if ( ! empty( $data['errors'] ) ) { |
|
197 | - $data['btn_okay'] = array( __( 'Okay', 'give' ) ); |
|
196 | + if ( ! empty($data['errors'])) { |
|
197 | + $data['btn_okay'] = array(__('Okay', 'give')); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $response = array( |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | ); |
207 | 207 | } else { |
208 | 208 | // todo: handle error |
209 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
209 | + error_log(print_r('AJAX error!', 1)); |
|
210 | 210 | } |
211 | 211 | |
212 | - wp_send_json( $response ); |
|
212 | + wp_send_json($response); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = __( 'Donation History', 'give' ); |
|
21 | + $this->shortcode['label'] = __('Donation History', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'donation_history' ); |
|
23 | + parent::__construct('donation_history'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_form' ); |
|
24 | + parent::__construct('give_form'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | - $create_form_link = sprintf( __( '%sClick here%s to create a new Donation Form.', 'give' ), |
|
35 | - '<a href="' . admin_url( 'post-new.php?post_type=give_forms' ) . '">', |
|
34 | + $create_form_link = sprintf(__('%sClick here%s to create a new Donation Form.', 'give'), |
|
35 | + '<a href="'.admin_url('post-new.php?post_type=give_forms').'">', |
|
36 | 36 | '</a>' |
37 | 37 | ); |
38 | 38 | |
@@ -43,68 +43,68 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_title', |
60 | - 'label' => __( 'Show Title:', 'give' ), |
|
61 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
60 | + 'label' => __('Show Title:', 'give'), |
|
61 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_goal', |
70 | - 'label' => __( 'Show Goal:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
70 | + 'label' => __('Show Goal:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | array( |
78 | 78 | 'type' => 'listbox', |
79 | 79 | 'name' => 'show_content', |
80 | 80 | 'minWidth' => 240, |
81 | - 'label' => __( 'Display Content:', 'give' ), |
|
82 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
81 | + 'label' => __('Display Content:', 'give'), |
|
82 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
83 | 83 | 'options' => array( |
84 | - 'none' => __( 'No Content', 'give' ), |
|
85 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
86 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
84 | + 'none' => __('No Content', 'give'), |
|
85 | + 'above' => __('Display above the form fields', 'give'), |
|
86 | + 'below' => __('Display below the form fields', 'give'), |
|
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | array( |
90 | 90 | 'type' => 'listbox', |
91 | 91 | 'name' => 'display_style', |
92 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
93 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
92 | + 'label' => __('Payment Fields:', 'give'), |
|
93 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
96 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
97 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
95 | + 'onpage' => __('Show on Page', 'give'), |
|
96 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
97 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | 101 | 'type' => 'listbox', |
102 | 102 | 'name' => 'float_labels', |
103 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
104 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
103 | + 'label' => __('Floating Labels:', 'give'), |
|
104 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
105 | 105 | 'options' => array( |
106 | - 'enabled' => __( 'Enabled', 'give' ), |
|
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
106 | + 'enabled' => __('Enabled', 'give'), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | 108 | ), |
109 | 109 | ), |
110 | 110 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | - $create_form_link = sprintf( __( '%sClick here%s to create a new Donation Form.', 'give' ), |
|
35 | - '<a href="' . admin_url( 'post-new.php?post_type=give_forms' ) . '">', |
|
34 | + $create_form_link = sprintf(__('%sClick here%s to create a new Donation Form.', 'give'), |
|
35 | + '<a href="'.admin_url('post-new.php?post_type=give_forms').'">', |
|
36 | 36 | '</a>' |
37 | 37 | ); |
38 | 38 | |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_text', |
60 | - 'label' => __( 'Show Text:', 'give' ), |
|
61 | - 'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
60 | + 'label' => __('Show Text:', 'give'), |
|
61 | + 'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_bar', |
70 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
70 | + 'label' => __('Show Progress Bar:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Login extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Login', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Login', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Login', 'give'); |
|
22 | + $this->shortcode['label'] = __('Login', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_login' ); |
|
24 | + parent::__construct('give_login'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => __( 'Enter an URL here to redirect to after login.', 'give' ), |
|
43 | + 'tooltip' => __('Enter an URL here to redirect to after login.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = __( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = __('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,51 +34,51 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => __( 'Show Price:', 'give' ), |
|
42 | + 'label' => __('Show Price:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => __( 'Show', 'give' ), |
|
45 | - 'false' => __( 'Hide', 'give' ), |
|
44 | + 'true' => __('Show', 'give'), |
|
45 | + 'false' => __('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'date', |
51 | - 'label' => __( 'Show Date:', 'give' ), |
|
51 | + 'label' => __('Show Date:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => __( 'Show', 'give' ), |
|
54 | - 'false' => __( 'Hide', 'give' ), |
|
53 | + 'true' => __('Show', 'give'), |
|
54 | + 'false' => __('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'payment_key', |
60 | - 'label' => __( 'Show Payment Key:', 'give' ), |
|
60 | + 'label' => __('Show Payment Key:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => __( 'Show', 'give' ), |
|
63 | - 'false' => __( 'Hide', 'give' ), |
|
62 | + 'true' => __('Show', 'give'), |
|
63 | + 'false' => __('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_method', |
69 | - 'label' => __( 'Show Payment Method:', 'give' ), |
|
69 | + 'label' => __('Show Payment Method:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => __( 'Show', 'give' ), |
|
72 | - 'false' => __( 'Hide', 'give' ), |
|
71 | + 'true' => __('Show', 'give'), |
|
72 | + 'false' => __('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_id', |
78 | - 'label' => __( 'Show Payment ID:', 'give' ), |
|
78 | + 'label' => __('Show Payment ID:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => __( 'Show', 'give' ), |
|
81 | - 'false' => __( 'Hide', 'give' ), |
|
80 | + 'true' => __('Show', 'give'), |
|
81 | + 'false' => __('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Register extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Register', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Register', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Register', 'give'); |
|
22 | + $this->shortcode['label'] = __('Register', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_register' ); |
|
24 | + parent::__construct('give_register'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => __( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
43 | + 'tooltip' => __('Enter an URL here to redirect to after registering.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_system_info_callback() { |
26 | 26 | |
27 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
27 | + if ( ! current_user_can('manage_give_settings')) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo give_tools_sysinfo_get(); ?></textarea> |
33 | 33 | <p class="submit"> |
34 | 34 | <input type="hidden" name="give-action" value="download_sysinfo" /> |
35 | - <?php submit_button( 'Download System Info File', 'secondary', 'give-download-sysinfo', false ); ?> |
|
35 | + <?php submit_button('Download System Info File', 'secondary', 'give-download-sysinfo', false); ?> |
|
36 | 36 | </p> |
37 | 37 | <style> |
38 | 38 | .give_forms_page_give-settings .give-submit-wrap { |
@@ -55,63 +55,63 @@ discard block |
||
55 | 55 | function give_tools_sysinfo_get() { |
56 | 56 | global $wpdb, $give_options; |
57 | 57 | |
58 | - if ( ! class_exists( 'Browser' ) ) { |
|
59 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; |
|
58 | + if ( ! class_exists('Browser')) { |
|
59 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $browser = new Browser(); |
63 | 63 | |
64 | 64 | // Get theme info |
65 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
66 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
67 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; |
|
65 | + if (get_bloginfo('version') < '3.4') { |
|
66 | + $theme_data = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
67 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; |
|
68 | 68 | } else { |
69 | 69 | $theme_data = wp_get_theme(); |
70 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; |
|
70 | + $theme = $theme_data->Name.' '.$theme_data->Version; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Try to identify the hosting provider |
74 | 74 | $host = give_get_host(); |
75 | 75 | |
76 | - $return = '### Begin System Info ###' . "\n\n"; |
|
76 | + $return = '### Begin System Info ###'."\n\n"; |
|
77 | 77 | |
78 | 78 | // Start with the basics... |
79 | - $return .= '-- Site Info' . "\n\n"; |
|
80 | - $return .= 'Site URL: ' . site_url() . "\n"; |
|
81 | - $return .= 'Home URL: ' . home_url() . "\n"; |
|
82 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; |
|
79 | + $return .= '-- Site Info'."\n\n"; |
|
80 | + $return .= 'Site URL: '.site_url()."\n"; |
|
81 | + $return .= 'Home URL: '.home_url()."\n"; |
|
82 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; |
|
83 | 83 | |
84 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); |
|
84 | + $return = apply_filters('give_sysinfo_after_site_info', $return); |
|
85 | 85 | |
86 | 86 | // Can we determine the site's host? |
87 | - if ( $host ) { |
|
88 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; |
|
89 | - $return .= 'Host: ' . $host . "\n"; |
|
87 | + if ($host) { |
|
88 | + $return .= "\n".'-- Hosting Provider'."\n\n"; |
|
89 | + $return .= 'Host: '.$host."\n"; |
|
90 | 90 | |
91 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); |
|
91 | + $return = apply_filters('give_sysinfo_after_host_info', $return); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // The local users' browser information, handled by the Browser class |
95 | - $return .= "\n" . '-- User Browser' . "\n\n"; |
|
95 | + $return .= "\n".'-- User Browser'."\n\n"; |
|
96 | 96 | $return .= $browser; |
97 | 97 | |
98 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); |
|
98 | + $return = apply_filters('give_sysinfo_after_user_browser', $return); |
|
99 | 99 | |
100 | 100 | // WordPress configuration |
101 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; |
|
102 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; |
|
103 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; |
|
104 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; |
|
105 | - $return .= 'Active Theme: ' . $theme . "\n"; |
|
106 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; |
|
101 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; |
|
102 | + $return .= 'Version: '.get_bloginfo('version')."\n"; |
|
103 | + $return .= 'Language: '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; |
|
104 | + $return .= 'Permalink Structure: '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; |
|
105 | + $return .= 'Active Theme: '.$theme."\n"; |
|
106 | + $return .= 'Show On Front: '.get_option('show_on_front')."\n"; |
|
107 | 107 | |
108 | 108 | // Only show page specs if frontpage is set to 'page' |
109 | - if ( get_option( 'show_on_front' ) == 'page' ) { |
|
110 | - $front_page_id = get_option( 'page_on_front' ); |
|
111 | - $blog_page_id = get_option( 'page_for_posts' ); |
|
109 | + if (get_option('show_on_front') == 'page') { |
|
110 | + $front_page_id = get_option('page_on_front'); |
|
111 | + $blog_page_id = get_option('page_for_posts'); |
|
112 | 112 | |
113 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; |
|
114 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; |
|
113 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; |
|
114 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // Make sure wp_remote_post() is working |
@@ -120,194 +120,194 @@ discard block |
||
120 | 120 | $params = array( |
121 | 121 | 'sslverify' => false, |
122 | 122 | 'timeout' => 60, |
123 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
123 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
124 | 124 | 'body' => $request |
125 | 125 | ); |
126 | 126 | |
127 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); |
|
127 | + $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); |
|
128 | 128 | |
129 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
129 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
130 | 130 | $WP_REMOTE_POST = 'wp_remote_post() works'; |
131 | 131 | } else { |
132 | 132 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; |
133 | 133 | } |
134 | 134 | |
135 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; |
|
136 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; |
|
137 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; |
|
138 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; |
|
139 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; |
|
140 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; |
|
135 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; |
|
136 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; |
|
137 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; |
|
138 | + $return .= 'WP_DEBUG: '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; |
|
139 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; |
|
140 | + $return .= 'Registered Post Stati: '.implode(', ', get_post_stati())."\n"; |
|
141 | 141 | |
142 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); |
|
142 | + $return = apply_filters('give_sysinfo_after_wordpress_config', $return); |
|
143 | 143 | |
144 | 144 | // GIVE configuration |
145 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; |
|
146 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; |
|
147 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; |
|
148 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); |
|
149 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; |
|
150 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; |
|
151 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; |
|
152 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; |
|
145 | + $return .= "\n".'-- Give Configuration'."\n\n"; |
|
146 | + $return .= 'Version: '.GIVE_VERSION."\n"; |
|
147 | + $return .= 'Upgraded From: '.get_option('give_version_upgraded_from', 'None')."\n"; |
|
148 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); |
|
149 | + $return .= 'Currency Code: '.give_get_currency()."\n"; |
|
150 | + $return .= 'Currency Position: '.give_get_option('currency_position', 'before')."\n"; |
|
151 | + $return .= 'Decimal Separator: '.give_get_option('decimal_separator', '.')."\n"; |
|
152 | + $return .= 'Thousands Separator: '.give_get_option('thousands_separator', ',')."\n"; |
|
153 | 153 | |
154 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); |
|
154 | + $return = apply_filters('give_sysinfo_after_give_config', $return); |
|
155 | 155 | |
156 | 156 | // GIVE pages |
157 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; |
|
158 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); |
|
159 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); |
|
160 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); |
|
157 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; |
|
158 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); |
|
159 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); |
|
160 | + $return .= 'Give Forms Slug: '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); |
|
161 | 161 | |
162 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); |
|
162 | + $return = apply_filters('give_sysinfo_after_give_pages', $return); |
|
163 | 163 | |
164 | 164 | // GIVE gateways |
165 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; |
|
165 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; |
|
166 | 166 | |
167 | 167 | $active_gateways = give_get_enabled_payment_gateways(); |
168 | - if ( $active_gateways ) { |
|
169 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway(null) ); |
|
170 | - if ( $default_gateway_is_active ) { |
|
168 | + if ($active_gateways) { |
|
169 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
170 | + if ($default_gateway_is_active) { |
|
171 | 171 | $default_gateway = give_get_default_gateway(null); |
172 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
172 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
173 | 173 | } else { |
174 | 174 | $default_gateway = 'Test Payment'; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $gateways = array(); |
178 | - foreach ( $active_gateways as $gateway ) { |
|
178 | + foreach ($active_gateways as $gateway) { |
|
179 | 179 | $gateways[] = $gateway['admin_label']; |
180 | 180 | } |
181 | 181 | |
182 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; |
|
183 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; |
|
182 | + $return .= 'Enabled Gateways: '.implode(', ', $gateways)."\n"; |
|
183 | + $return .= 'Default Gateway: '.$default_gateway."\n"; |
|
184 | 184 | } else { |
185 | - $return .= 'Enabled Gateways: None' . "\n"; |
|
185 | + $return .= 'Enabled Gateways: None'."\n"; |
|
186 | 186 | } |
187 | 187 | |
188 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); |
|
188 | + $return = apply_filters('give_sysinfo_after_give_gateways', $return); |
|
189 | 189 | |
190 | 190 | // GIVE Templates |
191 | - $dir = get_stylesheet_directory() . '/give_templates/*'; |
|
192 | - if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { |
|
193 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; |
|
191 | + $dir = get_stylesheet_directory().'/give_templates/*'; |
|
192 | + if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { |
|
193 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; |
|
194 | 194 | |
195 | - foreach ( glob( $dir ) as $file ) { |
|
196 | - $return .= 'Filename: ' . basename( $file ) . "\n"; |
|
195 | + foreach (glob($dir) as $file) { |
|
196 | + $return .= 'Filename: '.basename($file)."\n"; |
|
197 | 197 | } |
198 | 198 | |
199 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); |
|
199 | + $return = apply_filters('give_sysinfo_after_give_templates', $return); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Must-use plugins |
203 | 203 | $muplugins = get_mu_plugins(); |
204 | - if ( count( $muplugins > 0 ) ) { |
|
205 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; |
|
204 | + if (count($muplugins > 0)) { |
|
205 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; |
|
206 | 206 | |
207 | - foreach ( $muplugins as $plugin => $plugin_data ) { |
|
208 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; |
|
207 | + foreach ($muplugins as $plugin => $plugin_data) { |
|
208 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; |
|
209 | 209 | } |
210 | 210 | |
211 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); |
|
211 | + $return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // WordPress active plugins |
215 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; |
|
215 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; |
|
216 | 216 | |
217 | 217 | $plugins = get_plugins(); |
218 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
218 | + $active_plugins = get_option('active_plugins', array()); |
|
219 | 219 | |
220 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
221 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
220 | + foreach ($plugins as $plugin_path => $plugin) { |
|
221 | + if ( ! in_array($plugin_path, $active_plugins)) { |
|
222 | 222 | continue; |
223 | 223 | } |
224 | 224 | |
225 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
225 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
226 | 226 | } |
227 | 227 | |
228 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); |
|
228 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); |
|
229 | 229 | |
230 | 230 | // WordPress inactive plugins |
231 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; |
|
231 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; |
|
232 | 232 | |
233 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
234 | - if ( in_array( $plugin_path, $active_plugins ) ) { |
|
233 | + foreach ($plugins as $plugin_path => $plugin) { |
|
234 | + if (in_array($plugin_path, $active_plugins)) { |
|
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | |
238 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
238 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
239 | 239 | } |
240 | 240 | |
241 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); |
|
241 | + $return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); |
|
242 | 242 | |
243 | - if ( is_multisite() ) { |
|
243 | + if (is_multisite()) { |
|
244 | 244 | // WordPress Multisite active plugins |
245 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; |
|
245 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; |
|
246 | 246 | |
247 | 247 | $plugins = wp_get_active_network_plugins(); |
248 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); |
|
248 | + $active_plugins = get_site_option('active_sitewide_plugins', array()); |
|
249 | 249 | |
250 | - foreach ( $plugins as $plugin_path ) { |
|
251 | - $plugin_base = plugin_basename( $plugin_path ); |
|
250 | + foreach ($plugins as $plugin_path) { |
|
251 | + $plugin_base = plugin_basename($plugin_path); |
|
252 | 252 | |
253 | - if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { |
|
253 | + if ( ! array_key_exists($plugin_base, $active_plugins)) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | |
257 | - $plugin = get_plugin_data( $plugin_path ); |
|
258 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; |
|
257 | + $plugin = get_plugin_data($plugin_path); |
|
258 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; |
|
259 | 259 | } |
260 | 260 | |
261 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); |
|
261 | + $return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Server configuration (really just versioning) |
265 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; |
|
266 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; |
|
267 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; |
|
268 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; |
|
265 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; |
|
266 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; |
|
267 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; |
|
268 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; |
|
269 | 269 | |
270 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); |
|
270 | + $return = apply_filters('give_sysinfo_after_webserver_config', $return); |
|
271 | 271 | |
272 | 272 | // PHP configs... now we're getting to the important stuff |
273 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; |
|
274 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); |
|
275 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; |
|
276 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
277 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; |
|
278 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; |
|
279 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; |
|
280 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; |
|
281 | - $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; |
|
282 | - |
|
283 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); |
|
273 | + $return .= "\n".'-- PHP Configuration'."\n\n"; |
|
274 | + $return .= 'Safe Mode: '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); |
|
275 | + $return .= 'Memory Limit: '.ini_get('memory_limit')."\n"; |
|
276 | + $return .= 'Upload Max Size: '.ini_get('upload_max_filesize')."\n"; |
|
277 | + $return .= 'Post Max Size: '.ini_get('post_max_size')."\n"; |
|
278 | + $return .= 'Upload Max Filesize: '.ini_get('upload_max_filesize')."\n"; |
|
279 | + $return .= 'Time Limit: '.ini_get('max_execution_time')."\n"; |
|
280 | + $return .= 'Max Input Vars: '.ini_get('max_input_vars')."\n"; |
|
281 | + $return .= 'Display Errors: '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; |
|
282 | + |
|
283 | + $return = apply_filters('give_sysinfo_after_php_config', $return); |
|
284 | 284 | |
285 | 285 | // PHP extensions and such |
286 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; |
|
287 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
288 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; |
|
289 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
290 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; |
|
286 | + $return .= "\n".'-- PHP Extensions'."\n\n"; |
|
287 | + $return .= 'cURL: '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; |
|
288 | + $return .= 'fsockopen: '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; |
|
289 | + $return .= 'SOAP Client: '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; |
|
290 | + $return .= 'Suhosin: '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; |
|
291 | 291 | |
292 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); |
|
292 | + $return = apply_filters('give_sysinfo_after_php_ext', $return); |
|
293 | 293 | |
294 | 294 | // Session stuff |
295 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; |
|
296 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; |
|
297 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; |
|
295 | + $return .= "\n".'-- Session Configuration'."\n\n"; |
|
296 | + $return .= 'Give Use Sessions: '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; |
|
297 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; |
|
298 | 298 | |
299 | 299 | // The rest of this is only relevant is session is enabled |
300 | - if ( isset( $_SESSION ) ) { |
|
301 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; |
|
302 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; |
|
303 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; |
|
304 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
305 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; |
|
300 | + if (isset($_SESSION)) { |
|
301 | + $return .= 'Session Name: '.esc_html(ini_get('session.name'))."\n"; |
|
302 | + $return .= 'Cookie Path: '.esc_html(ini_get('session.cookie_path'))."\n"; |
|
303 | + $return .= 'Save Path: '.esc_html(ini_get('session.save_path'))."\n"; |
|
304 | + $return .= 'Use Cookies: '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; |
|
305 | + $return .= 'Use Only Cookies: '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; |
|
306 | 306 | } |
307 | 307 | |
308 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); |
|
308 | + $return = apply_filters('give_sysinfo_after_session_config', $return); |
|
309 | 309 | |
310 | - $return .= "\n" . '### End System Info ###'; |
|
310 | + $return .= "\n".'### End System Info ###'; |
|
311 | 311 | |
312 | 312 | return $return; |
313 | 313 | } |
@@ -321,17 +321,17 @@ discard block |
||
321 | 321 | */ |
322 | 322 | function give_tools_sysinfo_download() { |
323 | 323 | |
324 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
324 | + if ( ! current_user_can('manage_give_settings')) { |
|
325 | 325 | return; |
326 | 326 | } |
327 | 327 | |
328 | 328 | nocache_headers(); |
329 | 329 | |
330 | - header( 'Content-Type: text/plain' ); |
|
331 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); |
|
330 | + header('Content-Type: text/plain'); |
|
331 | + header('Content-Disposition: attachment; filename="give-system-info.txt"'); |
|
332 | 332 | |
333 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); |
|
333 | + echo wp_strip_all_tags($_POST['give-sysinfo']); |
|
334 | 334 | give_die(); |
335 | 335 | } |
336 | 336 | |
337 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); |
|
338 | 337 | \ No newline at end of file |
338 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); |
|
339 | 339 | \ No newline at end of file |