Completed
Pull Request — master (#776)
by
unknown
18:12
created
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 /**
17 17
  * Class Give_Shortcode_Button
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct() {
32 32
 
33
-		if ( is_admin() ) {
34
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
33
+		if (is_admin()) {
34
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
35 35
 
36
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
37
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
38
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
36
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
37
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
38
+			add_action('media_buttons', array($this, 'shortcode_button'));
39 39
 		}
40 40
 
41
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
42
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
41
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
42
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @since 1.0
53 53
 	 */
54
-	public function mce_external_plugins( $plugin_array ) {
54
+	public function mce_external_plugins($plugin_array) {
55 55
 
56
-		if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
56
+		if (current_user_can('edit_posts') && current_user_can('edit_pages')) {
57 57
 
58
-			$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
58
+			$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
59 59
 
60
-			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
60
+			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
61 61
 		}
62 62
 
63 63
 		return $plugin_array;
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function admin_enqueue_assets() {
74 74
 
75
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
75
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
76 76
 
77 77
 		wp_enqueue_script(
78 78
 			'give_shortcode',
79
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
80
-			array( 'jquery' ),
79
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
80
+			array('jquery'),
81 81
 			GIVE_VERSION,
82 82
 			true
83 83
 		);
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function admin_localize_scripts() {
94 94
 
95
-		if ( ! empty( self::$shortcodes ) ) {
95
+		if ( ! empty(self::$shortcodes)) {
96 96
 
97 97
 			$variables = array();
98 98
 
99
-			foreach ( self::$shortcodes as $shortcode => $values ) {
100
-				if ( ! empty( $values['required'] ) ) {
101
-					$variables[ $shortcode ] = $values['required'];
99
+			foreach (self::$shortcodes as $shortcode => $values) {
100
+				if ( ! empty($values['required'])) {
101
+					$variables[$shortcode] = $values['required'];
102 102
 				}
103 103
 			}
104 104
 
105
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
105
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
106 106
 		}
107 107
 	}
108 108
 
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
 
118 118
 		global $pagenow, $wp_version;
119 119
 
120
-		$shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' );
120
+		$shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php');
121 121
 		// Only run in admin post/page creation and edit screens
122
-		if ( in_array( $pagenow, $shortcode_button_pages )
123
-		     && apply_filters( 'give_shortcode_button_condition', true )
124
-		     && ! empty( self::$shortcodes )
122
+		if (in_array($pagenow, $shortcode_button_pages)
123
+		     && apply_filters('give_shortcode_button_condition', true)
124
+		     && ! empty(self::$shortcodes)
125 125
 		) {
126 126
 
127 127
 			$shortcodes = array();
128 128
 
129
-			foreach ( self::$shortcodes as $shortcode => $values ) {
129
+			foreach (self::$shortcodes as $shortcode => $values) {
130 130
 				/**
131 131
 				 * Filters the condition for including the current shortcode
132 132
 				 *
133 133
 				 * @since 1.0
134 134
 				 */
135
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
135
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
136 136
 
137
-					$shortcodes[ $shortcode ] = sprintf(
137
+					$shortcodes[$shortcode] = sprintf(
138 138
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
139 139
 						$shortcode,
140 140
 						$values['label'],
@@ -143,37 +143,37 @@  discard block
 block discarded – undo
143 143
 				}
144 144
 			}
145 145
 
146
-			if ( ! empty( $shortcodes ) ) {
146
+			if ( ! empty($shortcodes)) {
147 147
 
148 148
 				// check current WP version
149
-				$img = ( version_compare( $wp_version, '3.5', '<' ) )
150
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
151
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
149
+				$img = (version_compare($wp_version, '3.5', '<'))
150
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
151
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
152 152
 
153
-				reset( $shortcodes );
153
+				reset($shortcodes);
154 154
 
155
-				if ( count( $shortcodes ) == 1 ) {
155
+				if (count($shortcodes) == 1) {
156 156
 
157
-					$shortcode = key( $shortcodes );
157
+					$shortcode = key($shortcodes);
158 158
 
159 159
 					printf(
160 160
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
161 161
 						$shortcode,
162
-						sprintf( '%s %s %s',
162
+						sprintf('%s %s %s',
163 163
 							$img,
164
-							esc_html( 'Insert', 'give' ),
165
-							self::$shortcodes[ $shortcode ]['label']
164
+							esc_html('Insert', 'give'),
165
+							self::$shortcodes[$shortcode]['label']
166 166
 						)
167 167
 					);
168 168
 				} else {
169 169
 					printf(
170
-						'<div class="sc-wrap">' .
171
-						'<button class="button sc-button">%s %s</button>' .
172
-						'<div class="sc-menu mce-menu">%s</div>' .
170
+						'<div class="sc-wrap">'.
171
+						'<button class="button sc-button">%s %s</button>'.
172
+						'<div class="sc-menu mce-menu">%s</div>'.
173 173
 						'</div>',
174 174
 						$img,
175
-						esc_html( 'Give Shortcodes', 'give' ),
176
-						implode( '', array_values( $shortcodes ) )
175
+						esc_html('Give Shortcodes', 'give'),
176
+						implode('', array_values($shortcodes))
177 177
 					);
178 178
 				}
179 179
 			}
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function shortcode_ajax() {
191 191
 
192
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
192
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
193 193
 		$response  = false;
194 194
 
195
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
195
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
196 196
 
197
-			$data = self::$shortcodes[ $shortcode ];
197
+			$data = self::$shortcodes[$shortcode];
198 198
 
199
-			if ( ! empty( $data['errors'] ) ) {
200
-				$data['btn_okay'] = array( esc_html( 'Okay', 'give' ) );
199
+			if ( ! empty($data['errors'])) {
200
+				$data['btn_okay'] = array(esc_html('Okay', 'give'));
201 201
 			}
202 202
 
203 203
 			$response = array(
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 			);
210 210
 		} else {
211 211
 			// todo: handle error
212
-			error_log( print_r( 'AJAX error!', 1 ) );
212
+			error_log(print_r('AJAX error!', 1));
213 213
 		}
214 214
 
215
-		wp_send_json( $response );
215
+		wp_send_json($response);
216 216
 	}
217 217
 }
218 218
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 /**
15 15
  * Class Give_Shortcode_Donation_Form
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title']   = esc_html( 'Donation Form', 'give' );
25
-		$this->shortcode['label']   = esc_html( 'Donation Form', 'give' );
24
+		$this->shortcode['title']   = esc_html('Donation Form', 'give');
25
+		$this->shortcode['label']   = esc_html('Donation Form', 'give');
26 26
 
27
-		parent::__construct( 'give_form' );
27
+		parent::__construct('give_form');
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 		$create_form_link = sprintf(
38 38
 			/* translators: %s: create new form URL */
39
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
40
-			admin_url( 'post-new.php?post_type=give_forms' )
39
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
40
+			admin_url('post-new.php?post_type=give_forms')
41 41
 		);
42 42
 
43 43
 		return array(
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 					'post_type' => 'give_forms',
48 48
 				),
49 49
 				'name'        => 'id',
50
-				'tooltip'     => esc_attr( 'Select a Donation Form', 'give' ),
51
-				'placeholder' => esc_attr( '- Select a Form -', 'give' ),
50
+				'tooltip'     => esc_attr('Select a Donation Form', 'give'),
51
+				'placeholder' => esc_attr('- Select a Form -', 'give'),
52 52
 				'required'    => array(
53
-					'alert' => esc_html( 'You must first select a Form!', 'give' ),
54
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html( 'No donation forms were found!', 'give' ), $create_form_link ),
53
+					'alert' => esc_html('You must first select a Form!', 'give'),
54
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html('No donation forms were found!', 'give'), $create_form_link),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type' => 'container',
59
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html( 'Optional form settings', 'give' ) ),
59
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html('Optional form settings', 'give')),
60 60
 			),
61 61
 			array(
62 62
 				'type'    => 'listbox',
63 63
 				'name'    => 'show_title',
64
-				'label'   => esc_html( 'Show Title:', 'give' ),
65
-				'tooltip' => esc_attr( 'Do you want to display the form title?', 'give' ),
64
+				'label'   => esc_html('Show Title:', 'give'),
65
+				'tooltip' => esc_attr('Do you want to display the form title?', 'give'),
66 66
 				'options' => array(
67
-					'true'  => esc_html( 'Show', 'give' ),
68
-					'false' => esc_html( 'Hide', 'give' ),
67
+					'true'  => esc_html('Show', 'give'),
68
+					'false' => esc_html('Hide', 'give'),
69 69
 				),
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_html( 'Show Goal:', 'give' ),
75
-				'tooltip' => esc_attr( 'Do you want to display the donation goal?', 'give' ),
74
+				'label'   => esc_html('Show Goal:', 'give'),
75
+				'tooltip' => esc_attr('Do you want to display the donation goal?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html( 'Show', 'give' ),
78
-					'false' => esc_html( 'Hide', 'give' ),
77
+					'true'  => esc_html('Show', 'give'),
78
+					'false' => esc_html('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_content',
84 84
 				'minWidth' => 240,
85
-				'label'   => esc_html( 'Display Content:', 'give' ),
86
-				'tooltip' => esc_attr( 'Do you want to display the form content?', 'give' ),
85
+				'label'   => esc_html('Display Content:', 'give'),
86
+				'tooltip' => esc_attr('Do you want to display the form content?', 'give'),
87 87
 				'options' => array(
88
-					'none'  => esc_html( 'No Content', 'give' ),
89
-					'above' => esc_html( 'Display above the form fields', 'give' ),
90
-					'below' => esc_html( 'Display below the form fields', 'give' ),
88
+					'none'  => esc_html('No Content', 'give'),
89
+					'above' => esc_html('Display above the form fields', 'give'),
90
+					'below' => esc_html('Display below the form fields', 'give'),
91 91
 				),
92 92
 			),
93 93
 			array(
94 94
 				'type'    => 'listbox',
95 95
 				'name'    => 'display_style',
96
-				'label'   => esc_html( 'Payment Fields:', 'give' ),
97
-				'tooltip' => esc_attr( 'How would you like to display payment information?', 'give' ),
96
+				'label'   => esc_html('Payment Fields:', 'give'),
97
+				'tooltip' => esc_attr('How would you like to display payment information?', 'give'),
98 98
 				'options' => array(
99
-					'onpage' => esc_html( 'Show on Page', 'give' ),
100
-					'reveal' => esc_html( 'Reveal Upon Click', 'give' ),
101
-					'modal'  => esc_html( 'Modal Window Upon Click', 'give' ),
99
+					'onpage' => esc_html('Show on Page', 'give'),
100
+					'reveal' => esc_html('Reveal Upon Click', 'give'),
101
+					'modal'  => esc_html('Modal Window Upon Click', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'listbox',
106 106
 				'name'    => 'float_labels',
107
-				'label'   => esc_html( 'Floating Labels:', 'give' ),
108
-				'tooltip' => esc_attr( 'Override the default floating labels setting for this form?', 'give' ),
107
+				'label'   => esc_html('Floating Labels:', 'give'),
108
+				'tooltip' => esc_attr('Override the default floating labels setting for this form?', 'give'),
109 109
 				'options' => array(
110
-					'enabled'  => esc_html( 'Enabled', 'give' ),
111
-					'disabled' => esc_html( 'Disabled', 'give' ),
110
+					'enabled'  => esc_html('Enabled', 'give'),
111
+					'disabled' => esc_html('Disabled', 'give'),
112 112
 				),
113 113
 			),
114 114
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = esc_html( 'Donation History', 'give' );
21
+		$this->shortcode['label'] = esc_html('Donation History', 'give');
22 22
 
23
-		parent::__construct( 'donation_history' );
23
+		parent::__construct('donation_history');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-receipt.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html( 'Donation Receipt', 'give' );
22
-		$this->shortcode['label'] = esc_html( 'Donation Receipt', 'give' );
21
+		$this->shortcode['title'] = esc_html('Donation Receipt', 'give');
22
+		$this->shortcode['label'] = esc_html('Donation Receipt', 'give');
23 23
 
24
-		parent::__construct( 'give_receipt' );
24
+		parent::__construct('give_receipt');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,60 +34,60 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="strong">%s</p>', esc_html( 'Optional settings', 'give' ) ),
37
+				'html' => sprintf('<p class="strong">%s</p>', esc_html('Optional settings', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'    => 'listbox',
41 41
 				'name'    => 'price',
42
-				'label'   => esc_html( 'Show Donation Amount:', 'give' ),
42
+				'label'   => esc_html('Show Donation Amount:', 'give'),
43 43
 				'options' => array(
44
-					'true'  => esc_html( 'Show', 'give' ),
45
-					'false' => esc_html( 'Hide', 'give' ),
44
+					'true'  => esc_html('Show', 'give'),
45
+					'false' => esc_html('Hide', 'give'),
46 46
 				),
47 47
 			),
48 48
 			array(
49 49
 				'type'    => 'listbox',
50 50
 				'name'    => 'donor',
51
-				'label'   => esc_html( 'Show Donor Name:', 'give' ),
51
+				'label'   => esc_html('Show Donor Name:', 'give'),
52 52
 				'options' => array(
53
-					'true'  => esc_html( 'Show', 'give' ),
54
-					'false' => esc_html( 'Hide', 'give' ),
53
+					'true'  => esc_html('Show', 'give'),
54
+					'false' => esc_html('Hide', 'give'),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'date',
60
-				'label'   => esc_html( 'Show Date:', 'give' ),
60
+				'label'   => esc_html('Show Date:', 'give'),
61 61
 				'options' => array(
62
-					'true'  => esc_html( 'Show', 'give' ),
63
-					'false' => esc_html( 'Hide', 'give' ),
62
+					'true'  => esc_html('Show', 'give'),
63
+					'false' => esc_html('Hide', 'give'),
64 64
 				),
65 65
 			),
66 66
 			array(
67 67
 				'type'    => 'listbox',
68 68
 				'name'    => 'payment_key',
69
-				'label'   => esc_html( 'Show Payment Key:', 'give' ),
69
+				'label'   => esc_html('Show Payment Key:', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html( 'Show', 'give' ),
72
-					'false' => esc_html( 'Hide', 'give' ),
71
+					'true'  => esc_html('Show', 'give'),
72
+					'false' => esc_html('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'payment_method',
78
-				'label'   => esc_html( 'Show Payment Method:', 'give' ),
78
+				'label'   => esc_html('Show Payment Method:', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html( 'Show', 'give' ),
81
-					'false' => esc_html( 'Hide', 'give' ),
80
+					'true'  => esc_html('Show', 'give'),
81
+					'false' => esc_html('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'payment_id',
87
-				'label'   => esc_html( 'Show Payment ID:', 'give' ),
87
+				'label'   => esc_html('Show Payment ID:', 'give'),
88 88
 				'options' => array(
89
-					'true'  => esc_html( 'Show', 'give' ),
90
-					'false' => esc_html( 'Hide', 'give' ),
89
+					'true'  => esc_html('Show', 'give'),
90
+					'false' => esc_html('Hide', 'give'),
91 91
 				),
92 92
 			),
93 93
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html( 'Donation Form Goal', 'give' );
22
-		$this->shortcode['label'] = esc_html( 'Donation Form Goal', 'give' );
21
+		$this->shortcode['title'] = esc_html('Donation Form Goal', 'give');
22
+		$this->shortcode['label'] = esc_html('Donation Form Goal', 'give');
23 23
 
24
-		parent::__construct( 'give_goal' );
24
+		parent::__construct('give_goal');
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$create_form_link = sprintf(
35 35
 			/* translators: %s: create new form URL */
36
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
37
-			admin_url( 'post-new.php?post_type=give_forms' )
36
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
37
+			admin_url('post-new.php?post_type=give_forms')
38 38
 		);
39 39
 
40 40
 		return array(
@@ -44,35 +44,35 @@  discard block
 block discarded – undo
44 44
 					'post_type' => 'give_forms',
45 45
 				),
46 46
 				'name'        => 'id',
47
-				'tooltip'     => esc_attr( 'Select a Donation Form', 'give' ),
48
-				'placeholder' => esc_attr( '- Select a Form -', 'give' ),
47
+				'tooltip'     => esc_attr('Select a Donation Form', 'give'),
48
+				'placeholder' => esc_attr('- Select a Form -', 'give'),
49 49
 				'required'    => array(
50
-					'alert' => esc_html( 'You must first select a Form!', 'give' ),
51
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html( 'No donation forms were found!', 'give' ), $create_form_link ),
50
+					'alert' => esc_html('You must first select a Form!', 'give'),
51
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html('No donation forms were found!', 'give'), $create_form_link),
52 52
 				),
53 53
 			),
54 54
 			array(
55 55
 				'type' => 'container',
56
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html( 'Optional settings', 'give' ) ),
56
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html('Optional settings', 'give')),
57 57
 			),
58 58
 			array(
59 59
 				'type'    => 'listbox',
60 60
 				'name'    => 'show_text',
61
-				'label'   => esc_html( 'Show Text:', 'give' ),
62
-				'tooltip' => esc_attr( 'This text displays the amount of income raised compared to the goal.', 'give' ),
61
+				'label'   => esc_html('Show Text:', 'give'),
62
+				'tooltip' => esc_attr('This text displays the amount of income raised compared to the goal.', 'give'),
63 63
 				'options' => array(
64
-					'true'  => esc_html( 'Show', 'give' ),
65
-					'false' => esc_html( 'Hide', 'give' ),
64
+					'true'  => esc_html('Show', 'give'),
65
+					'false' => esc_html('Hide', 'give'),
66 66
 				),
67 67
 			),
68 68
 			array(
69 69
 				'type'    => 'listbox',
70 70
 				'name'    => 'show_bar',
71
-				'label'   => esc_html( 'Show Progress Bar:', 'give' ),
72
-				'tooltip' => esc_attr( 'Do you want to display the goal\'s progress bar?', 'give' ),
71
+				'label'   => esc_html('Show Progress Bar:', 'give'),
72
+				'tooltip' => esc_attr('Do you want to display the goal\'s progress bar?', 'give'),
73 73
 				'options' => array(
74
-					'true'  => esc_html( 'Show', 'give' ),
75
-					'false' => esc_html( 'Hide', 'give' ),
74
+					'true'  => esc_html('Show', 'give'),
75
+					'false' => esc_html('Hide', 'give'),
76 76
 				),
77 77
 			),
78 78
 		);
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 					/* translators: %s: day of the week */
54
-					esc_html( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59
-			<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>
59
+			<?php $earnings_today = $stats->get_earnings(0, 'today', false); ?>
60 60
 
61
-			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>
61
+			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p>
62 62
 
63
-			<p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array(
63
+			<p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array(
64 64
 					'publish',
65 65
 					'revoked'
66
-				) ); ?><?php echo give_format_amount( $donations_today, false ); ?>
67
-				<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
66
+				)); ?><?php echo give_format_amount($donations_today, false); ?>
67
+				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span>
68 68
 			</p>
69 69
 
70 70
 
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 		<table class="give-table-stats">
75 75
 			<thead style="display: none;">
76 76
 			<tr>
77
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
78
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
79
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
77
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
78
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
79
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
80 80
 			</tr>
81 81
 			</thead>
82 82
 			<tbody>
83 83
 			<tr id="give-table-stats-tr-1">
84 84
 				<td>
85
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
85
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
86 86
 
87
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this week', 'give' ); ?></p>
87
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('this week', 'give'); ?></p>
88 88
 				</td>
89 89
 				<td>
90
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
90
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
91 91
 
92
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this month', 'give' ); ?></p>
92
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('this month', 'give'); ?></p>
93 93
 				</td>
94 94
 			</tr>
95 95
 			<tr id="give-table-stats-tr-2">
96 96
 				<td>
97
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
97
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
98 98
 
99
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'last month', 'give' ); ?></p>
99
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('last month', 'give'); ?></p>
100 100
 				</td>
101 101
 				<td>
102
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
102
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
103 103
 
104
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this year', 'give' ); ?></p>
104
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('this year', 'give'); ?></p>
105 105
 				</td>
106 106
 			</tr>
107 107
 			</tbody>
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return array
123 123
  */
124
-function give_dashboard_at_a_glance_widget( $items ) {
125
-	$num_posts = wp_count_posts( 'give_forms' );
124
+function give_dashboard_at_a_glance_widget($items) {
125
+	$num_posts = wp_count_posts('give_forms');
126 126
 
127
-	if ( $num_posts && $num_posts->publish ) {
127
+	if ($num_posts && $num_posts->publish) {
128 128
         
129 129
 		$text = sprintf(
130 130
 			/* translators: 1: number of posts published 2: forms singular label 3: forms plural label */
131
-			_n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ),
131
+			_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'),
132 132
 			$num_posts->publish,
133 133
 			give_get_forms_label_singular(),
134 134
 			give_get_forms_label_plural()
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
140
-			$text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text );
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140
+			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
141 141
 		} else {
142
-			$text = sprintf( '<span class="give-forms-count">%1$s</span>', $text );
142
+			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
143 143
 		}
144 144
 
145 145
 		$items[] = $text;
@@ -148,4 +148,4 @@  discard block
 block discarded – undo
148 148
 	return $items;
149 149
 }
150 150
 
151
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
151
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,38 +51,38 @@  discard block
 block discarded – undo
51 51
 	public function admin_menus() {
52 52
 		// About Page
53 53
 		add_dashboard_page(
54
-			esc_html( 'Welcome to Give', 'give' ),
55
-			esc_html( 'Welcome to Give', 'give' ),
54
+			esc_html('Welcome to Give', 'give'),
55
+			esc_html('Welcome to Give', 'give'),
56 56
 			$this->minimum_capability,
57 57
 			'give-about',
58
-			array( $this, 'about_screen' )
58
+			array($this, 'about_screen')
59 59
 		);
60 60
 
61 61
 		// Changelog Page
62 62
 		add_dashboard_page(
63
-			esc_html( 'Give Changelog', 'give' ),
64
-			esc_html( 'Give Changelog', 'give' ),
63
+			esc_html('Give Changelog', 'give'),
64
+			esc_html('Give Changelog', 'give'),
65 65
 			$this->minimum_capability,
66 66
 			'give-changelog',
67
-			array( $this, 'changelog_screen' )
67
+			array($this, 'changelog_screen')
68 68
 		);
69 69
 
70 70
 		// Getting Started Page
71 71
 		add_dashboard_page(
72
-			esc_html( 'Getting started with Give', 'give' ),
73
-			esc_html( 'Getting started with Give', 'give' ),
72
+			esc_html('Getting started with Give', 'give'),
73
+			esc_html('Getting started with Give', 'give'),
74 74
 			$this->minimum_capability,
75 75
 			'give-getting-started',
76
-			array( $this, 'getting_started_screen' )
76
+			array($this, 'getting_started_screen')
77 77
 		);
78 78
 
79 79
 		// Credits Page
80 80
 		add_dashboard_page(
81
-			esc_html( 'The people that build Give', 'give' ),
82
-			esc_html( 'The people that build Give', 'give' ),
81
+			esc_html('The people that build Give', 'give'),
82
+			esc_html('The people that build Give', 'give'),
83 83
 			$this->minimum_capability,
84 84
 			'give-credits',
85
-			array( $this, 'credits_screen' )
85
+			array($this, 'credits_screen')
86 86
 		);
87 87
 	}
88 88
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function admin_head() {
97 97
 
98
-		remove_submenu_page( 'index.php', 'give-about' );
99
-		remove_submenu_page( 'index.php', 'give-changelog' );
100
-		remove_submenu_page( 'index.php', 'give-getting-started' );
101
-		remove_submenu_page( 'index.php', 'give-credits' );
98
+		remove_submenu_page('index.php', 'give-about');
99
+		remove_submenu_page('index.php', 'give-changelog');
100
+		remove_submenu_page('index.php', 'give-getting-started');
101
+		remove_submenu_page('index.php', 'give-credits');
102 102
 
103 103
 		// Badge for welcome page
104
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
104
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
105 105
 
106 106
 		?>
107 107
 		<style type="text/css" media="screen">
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @return void
216 216
 	 */
217 217
 	public function tabs() {
218
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
218
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
219 219
 		?>
220 220
 		<h1 class="nav-tab-wrapper">
221
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
222
-				<?php esc_html_e( "About Give", 'give' ); ?>
221
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
222
+				<?php esc_html_e("About Give", 'give'); ?>
223 223
 			</a>
224
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
225
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
224
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
225
+				<?php esc_html_e('Getting Started', 'give'); ?>
226 226
 			</a>
227
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
228
-				<?php esc_html_e( 'Credits', 'give' ); ?>
227
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
228
+				<?php esc_html_e('Credits', 'give'); ?>
229 229
 			</a>
230
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
230
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
+				<?php esc_html_e('Add-ons', 'give'); ?>
232 232
 			</a>
233 233
 		</h1>
234 234
 	<?php
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @return void
243 243
 	 */
244 244
 	public function about_screen() {
245
-		list( $display_version ) = explode( '-', GIVE_VERSION );
245
+		list($display_version) = explode('-', GIVE_VERSION);
246 246
 		?>
247 247
 		<div class="wrap about-wrap">
248 248
 			<h1 class="welcome-h1"><?php
249 249
 				printf(
250 250
 					/* translators: %s: Give version */
251
-					esc_html( 'Welcome to Give %s', 'give' ),
251
+					esc_html('Welcome to Give %s', 'give'),
252 252
 					$display_version
253 253
 				);
254 254
 			?></h1>
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 			<div class="about-text"><?php
259 259
 				printf(
260 260
 					/* translators: 1: https://givewp.com/documenation/ 2: title attribute text */
261
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
262
-					esc_url( 'https://givewp.com/documenation/' ),
263
-					esc_attr( 'View the Give plugin documentation online', 'give' )
261
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
262
+					esc_url('https://givewp.com/documenation/'),
263
+					esc_attr('View the Give plugin documentation online', 'give')
264 264
 				);
265 265
 			?></div>
266 266
 
267
-			<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
267
+			<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
268 268
 
269 269
 			<?php give_get_newsletter() ?>
270 270
 
271 271
 			<div class="give-badge"><?php
272 272
 				printf(
273 273
 					/* translators: %s: Give version */
274
-					esc_html( 'Version %s', 'give' ),
274
+					esc_html('Version %s', 'give'),
275 275
 					$display_version
276 276
 				);
277 277
 			?></div>
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 			<div class="feature-section clearfix introduction">
284 284
 
285 285
 				<div class="video feature-section-item">
286
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
286
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
287 287
 
288 288
 				</div>
289 289
 
290 290
 				<div class="content feature-section-item last-feature">
291 291
 
292
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
292
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
293 293
 
294
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
294
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
295 295
 					<a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More
296 296
 						<span class="dashicons dashicons-external"></span></a>
297 297
 
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 				<div class="content feature-section-item">
306 306
 
307
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
307
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
308 308
 
309
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
309
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
310 310
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation
311 311
 						<span class="dashicons dashicons-external"></span></a>
312 312
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 				<div class="content  feature-section-item last-feature">
316 316
 
317
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
317
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
318 318
 
319 319
 				</div>
320 320
 
@@ -334,22 +334,22 @@  discard block
 block discarded – undo
334 334
 	 * @return void
335 335
 	 */
336 336
 	public function changelog_screen() {
337
-		list( $display_version ) = explode( '-', GIVE_VERSION );
337
+		list($display_version) = explode('-', GIVE_VERSION);
338 338
 		?>
339 339
 		<div class="wrap about-wrap">
340
-			<h1><?php esc_html_e( 'Give Changelog', 'give' ); ?></h1>
340
+			<h1><?php esc_html_e('Give Changelog', 'give'); ?></h1>
341 341
 
342 342
 			<div class="about-text"><?php
343 343
 				printf(
344 344
 					/* translators: %s: Give version */
345
-					esc_html( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
345
+					esc_html('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
346 346
 					$display_version
347 347
 				);
348 348
 			?></div>
349 349
 			<div class="give-badge"><?php
350 350
 				printf(
351 351
 					/* translators: %s: Give version */
352
-					esc_html( 'Version %s', 'give' ),
352
+					esc_html('Version %s', 'give'),
353 353
 					$display_version
354 354
 				);
355 355
 			?></div>
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			<?php $this->tabs(); ?>
358 358
 
359 359
 			<div class="changelog">
360
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
360
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
361 361
 
362 362
 				<div class="feature-section">
363 363
 					<?php echo $this->parse_readme(); ?>
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 			</div>
366 366
 
367 367
 			<div class="return-to-dashboard">
368
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
368
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
369 369
 					'post_type' => 'give_forms',
370 370
 					'page'      => 'give-settings'
371
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Go to Give Settings', 'give' ); ?></a>
371
+				), 'edit.php'))); ?>"><?php esc_html_e('Go to Give Settings', 'give'); ?></a>
372 372
 			</div>
373 373
 		</div>
374 374
 	<?php
@@ -382,29 +382,29 @@  discard block
 block discarded – undo
382 382
 	 * @return void
383 383
 	 */
384 384
 	public function getting_started_screen() {
385
-		list( $display_version ) = explode( '-', GIVE_VERSION );
385
+		list($display_version) = explode('-', GIVE_VERSION);
386 386
 		?>
387 387
 		<div class="wrap about-wrap get-started">
388 388
 			<h1 class="welcome-h1"><?php
389 389
 				printf(
390 390
 					/* translators: %s: Give version */
391
-					esc_html( 'Give %s - Getting Started Guide', 'give' ),
391
+					esc_html('Give %s - Getting Started Guide', 'give'),
392 392
 					$display_version
393 393
 				);
394 394
 			?></h1>
395 395
 
396 396
 			<?php give_social_media_elements() ?>
397 397
 
398
-			<div class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></div>
398
+			<div class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></div>
399 399
 
400
-			<p class="newsletter-intro"><?php esc_html_e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p>
400
+			<p class="newsletter-intro"><?php esc_html_e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p>
401 401
 
402 402
 			<?php give_get_newsletter() ?>
403 403
 
404 404
 			<div class="give-badge"><?php
405 405
 				printf(
406 406
 					/* translators: %s: Give version */
407
-					esc_html( 'Version %s', 'give' ),
407
+					esc_html('Version %s', 'give'),
408 408
 					$display_version
409 409
 				);
410 410
 			?></div>
@@ -412,17 +412,17 @@  discard block
 block discarded – undo
412 412
 			<?php $this->tabs(); ?>
413 413
 
414 414
 
415
-			<div class="about-text"><?php printf( esc_html( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div>
415
+			<div class="about-text"><?php printf(esc_html('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div>
416 416
 
417 417
 
418 418
 			<div class="feature-section clearfix">
419 419
 
420 420
 				<div class="content feature-section-item">
421
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
421
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
422 422
 
423
-					<p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
423
+					<p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
424 424
 
425
-					<p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p>
425
+					<p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p>
426 426
 				</div>
427 427
 
428 428
 				<div class="content feature-section-item last-feature">
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 				</div>
440 440
 
441 441
 				<div class="content feature-section-item last-feature">
442
-					<h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
442
+					<h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3>
443 443
 
444
-					<p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
444
+					<p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
445 445
 				</div>
446 446
 
447 447
 			</div>
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 			<div class="feature-section clearfix">
451 451
 
452 452
 				<div class="content feature-section-item add-content">
453
-					<h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
453
+					<h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
454 454
 
455
-					<p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
455
+					<p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
456 456
 
457
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
457
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
458 458
 				</div>
459 459
 
460 460
 				<div class="content feature-section-item last-feature">
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 				</div>
472 472
 
473 473
 				<div class="content feature-section-item last-feature">
474
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
474
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
475 475
 
476
-					<p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
476
+					<p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
477 477
 				</div>
478 478
 
479 479
 
@@ -493,38 +493,38 @@  discard block
 block discarded – undo
493 493
 	 * @return void
494 494
 	 */
495 495
 	public function credits_screen() {
496
-		list( $display_version ) = explode( '-', GIVE_VERSION );
496
+		list($display_version) = explode('-', GIVE_VERSION);
497 497
 		?>
498 498
 		<div class="wrap about-wrap">
499 499
 			<h1 class="welcome-h1"><?php
500 500
 				printf(
501 501
 					/* translators: %s: Give version */
502
-					esc_html( 'Give %s - Credits', 'give' ),
502
+					esc_html('Give %s - Credits', 'give'),
503 503
 					$display_version
504 504
 				);
505 505
 			?></h1>
506 506
 
507 507
 			<?php give_social_media_elements() ?>
508 508
 
509
-			<div class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ); ?></div>
509
+			<div class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly. ', 'give'); ?></div>
510 510
 
511
-			<div class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></div>
511
+			<div class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></div>
512 512
 
513
-			<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
513
+			<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
514 514
 
515 515
 			<?php give_get_newsletter() ?>
516 516
 
517 517
 			<div class="give-badge"><?php
518 518
 				printf(
519 519
 					/* translators: %s: Give version */
520
-					esc_html( 'Version %s', 'give' ),
520
+					esc_html('Version %s', 'give'),
521 521
 					$display_version
522 522
 				);
523 523
 			?></div>
524 524
 
525 525
 			<?php $this->tabs(); ?>
526 526
 
527
-			<p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p>
527
+			<p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p>
528 528
 
529 529
 			<?php echo $this->contributors(); ?>
530 530
 		</div>
@@ -539,21 +539,21 @@  discard block
 block discarded – undo
539 539
 	 * @return string $readme HTML formatted readme file
540 540
 	 */
541 541
 	public function parse_readme() {
542
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
542
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
543 543
 
544
-		if ( ! $file ) {
545
-			$readme = '<p>' . esc_html( 'No valid changlog was found.', 'give' ) . '</p>';
544
+		if ( ! $file) {
545
+			$readme = '<p>'.esc_html('No valid changlog was found.', 'give').'</p>';
546 546
 		} else {
547
-			$readme = file_get_contents( $file );
548
-			$readme = nl2br( esc_html( $readme ) );
549
-			$readme = explode( '== Changelog ==', $readme );
550
-			$readme = end( $readme );
551
-
552
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
553
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
554
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
555
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
556
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
547
+			$readme = file_get_contents($file);
548
+			$readme = nl2br(esc_html($readme));
549
+			$readme = explode('== Changelog ==', $readme);
550
+			$readme = end($readme);
551
+
552
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
553
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
554
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
555
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
556
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
557 557
 		}
558 558
 
559 559
 		return $readme;
@@ -570,27 +570,27 @@  discard block
 block discarded – undo
570 570
 	public function contributors() {
571 571
 		$contributors = $this->get_contributors();
572 572
 
573
-		if ( empty( $contributors ) ) {
573
+		if (empty($contributors)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$contributor_list = '<ul class="wp-people-group">';
578 578
 
579
-		foreach ( $contributors as $contributor ) {
579
+		foreach ($contributors as $contributor) {
580 580
 			$contributor_list .= '<li class="wp-person">';
581
-			$contributor_list .= sprintf( '<a href="%s" title="%s">',
582
-				esc_url( 'https://github.com/' . $contributor->login ),
581
+			$contributor_list .= sprintf('<a href="%s" title="%s">',
582
+				esc_url('https://github.com/'.$contributor->login),
583 583
 				esc_html(
584 584
 					sprintf(
585 585
 						/* translators: %s: github contributor */
586
-						esc_html( 'View %s', 'give' ),
586
+						esc_html('View %s', 'give'),
587 587
 						$contributor->login
588 588
 					)
589 589
 				)
590 590
 			);
591
-			$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
591
+			$contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login));
592 592
 			$contributor_list .= '</a>';
593
-			$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
593
+			$contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login));
594 594
 			$contributor_list .= '</a>';
595 595
 			$contributor_list .= '</li>';
596 596
 		}
@@ -608,25 +608,25 @@  discard block
 block discarded – undo
608 608
 	 * @return array $contributors List of contributors
609 609
 	 */
610 610
 	public function get_contributors() {
611
-		$contributors = get_transient( 'give_contributors' );
611
+		$contributors = get_transient('give_contributors');
612 612
 
613
-		if ( false !== $contributors ) {
613
+		if (false !== $contributors) {
614 614
 			return $contributors;
615 615
 		}
616 616
 
617
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
617
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
618 618
 
619
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
619
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
620 620
 			return array();
621 621
 		}
622 622
 
623
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
623
+		$contributors = json_decode(wp_remote_retrieve_body($response));
624 624
 
625
-		if ( ! is_array( $contributors ) ) {
625
+		if ( ! is_array($contributors)) {
626 626
 			return array();
627 627
 		}
628 628
 
629
-		set_transient( 'give_contributors', $contributors, 3600 );
629
+		set_transient('give_contributors', $contributors, 3600);
630 630
 
631 631
 		return $contributors;
632 632
 	}
@@ -645,24 +645,24 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
 		// Bail if no activation redirect
648
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
648
+		if ( ! get_transient('_give_activation_redirect')) {
649 649
 			return;
650 650
 		}
651 651
 
652 652
 		// Delete the redirect transient
653
-		delete_transient( '_give_activation_redirect' );
653
+		delete_transient('_give_activation_redirect');
654 654
 
655 655
 		// Bail if activating from network, or bulk
656
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
656
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
657 657
 			return;
658 658
 		}
659 659
 
660
-		$upgrade = get_option( 'give_version_upgraded_from' );
660
+		$upgrade = get_option('give_version_upgraded_from');
661 661
 
662
-		if ( ! $upgrade ) { // First time install
663
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
662
+		if ( ! $upgrade) { // First time install
663
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
664 664
 			exit;
665
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
665
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
666 666
 
667 667
 		} else { // Welcome is NOT disabled in settings
668 668
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 2 patches
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -13,330 +13,330 @@
 block discarded – undo
13 13
  * @version 1.6
14 14
  */
15 15
 class EDD_SL_Plugin_Updater {
16
-    private $api_url   = '';
17
-    private $api_data  = array();
18
-    private $name      = '';
19
-    private $slug      = '';
20
-
21
-    /**
22
-     * Class constructor.
23
-     *
24
-     * @uses plugin_basename()
25
-     * @uses hook()
26
-     *
27
-     * @param string  $_api_url     The URL pointing to the custom API endpoint.
28
-     * @param string  $_plugin_file Path to the plugin file.
29
-     * @param array   $_api_data    Optional data to send with API calls.
30
-     * @return void
31
-     */
32
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
-        $this->api_url  = trailingslashit( $_api_url );
34
-        $this->api_data = $_api_data;
35
-        $this->name     = plugin_basename( $_plugin_file );
36
-        $this->slug     = basename( $_plugin_file, '.php' );
37
-        $this->version  = $_api_data['version'];
38
-
39
-        // Set up hooks.
40
-        $this->init();
41
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
42
-    }
43
-
44
-    /**
45
-     * Set up WordPress filters to hook into WP's update process.
46
-     *
47
-     * @uses add_filter()
48
-     *
49
-     * @return void
50
-     */
51
-    public function init() {
16
+	private $api_url   = '';
17
+	private $api_data  = array();
18
+	private $name      = '';
19
+	private $slug      = '';
20
+
21
+	/**
22
+	 * Class constructor.
23
+	 *
24
+	 * @uses plugin_basename()
25
+	 * @uses hook()
26
+	 *
27
+	 * @param string  $_api_url     The URL pointing to the custom API endpoint.
28
+	 * @param string  $_plugin_file Path to the plugin file.
29
+	 * @param array   $_api_data    Optional data to send with API calls.
30
+	 * @return void
31
+	 */
32
+	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
+		$this->api_url  = trailingslashit( $_api_url );
34
+		$this->api_data = $_api_data;
35
+		$this->name     = plugin_basename( $_plugin_file );
36
+		$this->slug     = basename( $_plugin_file, '.php' );
37
+		$this->version  = $_api_data['version'];
38
+
39
+		// Set up hooks.
40
+		$this->init();
41
+		add_action( 'admin_init', array( $this, 'show_changelog' ) );
42
+	}
43
+
44
+	/**
45
+	 * Set up WordPress filters to hook into WP's update process.
46
+	 *
47
+	 * @uses add_filter()
48
+	 *
49
+	 * @return void
50
+	 */
51
+	public function init() {
52 52
 
53
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
53
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
+		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
55 55
 
56
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
57
-    }
56
+		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
57
+	}
58 58
 
59
-    /**
60
-     * Check for Updates at the defined API endpoint and modify the update array.
61
-     *
62
-     * This function dives into the update API just when WordPress creates its update array,
63
-     * then adds a custom API call and injects the custom plugin data retrieved from the API.
64
-     * It is reassembled from parts of the native WordPress plugin update code.
65
-     * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
66
-     *
67
-     * @uses api_request()
68
-     *
69
-     * @param array   $_transient_data Update array build by WordPress.
70
-     * @return array Modified update array with custom plugin data.
71
-     */
72
-    function check_update( $_transient_data ) {
59
+	/**
60
+	 * Check for Updates at the defined API endpoint and modify the update array.
61
+	 *
62
+	 * This function dives into the update API just when WordPress creates its update array,
63
+	 * then adds a custom API call and injects the custom plugin data retrieved from the API.
64
+	 * It is reassembled from parts of the native WordPress plugin update code.
65
+	 * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
66
+	 *
67
+	 * @uses api_request()
68
+	 *
69
+	 * @param array   $_transient_data Update array build by WordPress.
70
+	 * @return array Modified update array with custom plugin data.
71
+	 */
72
+	function check_update( $_transient_data ) {
73 73
 
74
-        global $pagenow;
74
+		global $pagenow;
75 75
 
76
-        if( ! is_object( $_transient_data ) ) {
77
-            $_transient_data = new stdClass;
78
-        }
76
+		if( ! is_object( $_transient_data ) ) {
77
+			$_transient_data = new stdClass;
78
+		}
79 79
 
80
-        if( 'plugins.php' == $pagenow && is_multisite() ) {
81
-            return $_transient_data;
82
-        }
80
+		if( 'plugins.php' == $pagenow && is_multisite() ) {
81
+			return $_transient_data;
82
+		}
83 83
 
84
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
84
+		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
85 85
 
86
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86
+			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
87 87
 
88
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
88
+			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
89 89
 
90
-                $this->did_check = true;
90
+				$this->did_check = true;
91 91
 
92
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
92
+				if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
93 93
 
94
-                    $_transient_data->response[ $this->name ] = $version_info;
94
+					$_transient_data->response[ $this->name ] = $version_info;
95 95
 
96
-                }
96
+				}
97 97
 
98
-                $_transient_data->last_checked = time();
99
-                $_transient_data->checked[ $this->name ] = $this->version;
98
+				$_transient_data->last_checked = time();
99
+				$_transient_data->checked[ $this->name ] = $this->version;
100 100
 
101
-            }
101
+			}
102 102
 
103
-        }
103
+		}
104 104
 
105
-        return $_transient_data;
106
-    }
105
+		return $_transient_data;
106
+	}
107 107
 
108
-    /**
109
-     * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
110
-     *
111
-     * @param string  $file
112
-     * @param array   $plugin
113
-     */
114
-    public function show_update_notification( $file, $plugin ) {
108
+	/**
109
+	 * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
110
+	 *
111
+	 * @param string  $file
112
+	 * @param array   $plugin
113
+	 */
114
+	public function show_update_notification( $file, $plugin ) {
115 115
 
116
-        if( ! current_user_can( 'update_plugins' ) ) {
117
-            return;
118
-        }
116
+		if( ! current_user_can( 'update_plugins' ) ) {
117
+			return;
118
+		}
119 119
 
120
-        if( ! is_multisite() ) {
121
-            return;
122
-        }
120
+		if( ! is_multisite() ) {
121
+			return;
122
+		}
123 123
 
124
-        if ( $this->name != $file ) {
125
-            return;
126
-        }
124
+		if ( $this->name != $file ) {
125
+			return;
126
+		}
127 127
 
128
-        // Remove our filter on the site transient
129
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
128
+		// Remove our filter on the site transient
129
+		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
130 130
 
131
-        $update_cache = get_site_transient( 'update_plugins' );
131
+		$update_cache = get_site_transient( 'update_plugins' );
132 132
 
133
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
133
+		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
134 134
 
135
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
-            $version_info = get_transient( $cache_key );
135
+			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
+			$version_info = get_transient( $cache_key );
137 137
 
138
-            if( false === $version_info ) {
138
+			if( false === $version_info ) {
139 139
 
140
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
140
+				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
141 141
 
142
-                set_transient( $cache_key, $version_info, 3600 );
143
-            }
142
+				set_transient( $cache_key, $version_info, 3600 );
143
+			}
144 144
 
145 145
 
146
-            if( ! is_object( $version_info ) ) {
147
-                return;
148
-            }
146
+			if( ! is_object( $version_info ) ) {
147
+				return;
148
+			}
149 149
 
150
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
150
+			if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
151 151
 
152
-                $update_cache->response[ $this->name ] = $version_info;
152
+				$update_cache->response[ $this->name ] = $version_info;
153 153
 
154
-            }
154
+			}
155 155
 
156
-            $update_cache->last_checked = time();
157
-            $update_cache->checked[ $this->name ] = $this->version;
156
+			$update_cache->last_checked = time();
157
+			$update_cache->checked[ $this->name ] = $this->version;
158 158
 
159
-            set_site_transient( 'update_plugins', $update_cache );
159
+			set_site_transient( 'update_plugins', $update_cache );
160 160
 
161
-        } else {
161
+		} else {
162 162
 
163
-            $version_info = $update_cache->response[ $this->name ];
163
+			$version_info = $update_cache->response[ $this->name ];
164 164
 
165
-        }
165
+		}
166 166
 
167
-        // Restore our filter
168
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
167
+		// Restore our filter
168
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
169 169
 
170
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
170
+		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
171 171
 
172
-            // build a plugin list row, with update notification
173
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
172
+			// build a plugin list row, with update notification
173
+			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
+			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
175 175
 
176
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
176
+			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
177 177
 
178
-            if ( empty( $version_info->download_link ) ) {
179
-                printf(
178
+			if ( empty( $version_info->download_link ) ) {
179
+				printf(
180 180
 					/* translators: 1: name 2: changelog URL 3: version */
181
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
182
-                    esc_html( $version_info->name ),
183
-                    esc_url( $changelog_link ),
184
-                    esc_html( $version_info->new_version )
185
-                );
186
-            } else {
187
-                printf(
181
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
182
+					esc_html( $version_info->name ),
183
+					esc_url( $changelog_link ),
184
+					esc_html( $version_info->new_version )
185
+				);
186
+			} else {
187
+				printf(
188 188
 					/* translators: 1: name 2: changelog URL 3: version 4: update URL */
189
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
190
-                    esc_html( $version_info->name ),
191
-                    esc_url( $changelog_link ),
192
-                    esc_html( $version_info->new_version ),
193
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
194
-                );
195
-            }
196
-
197
-            echo '</div></td></tr>';
198
-        }
199
-    }
200
-
201
-
202
-    /**
203
-     * Updates information on the "View version x.x details" page with custom data.
204
-     *
205
-     * @uses api_request()
206
-     *
207
-     * @param mixed   $_data
208
-     * @param string  $_action
209
-     * @param object  $_args
210
-     * @return object $_data
211
-     */
212
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
213
-
214
-
215
-        if ( $_action != 'plugin_information' ) {
216
-
217
-            return $_data;
218
-
219
-        }
220
-
221
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
222
-
223
-            return $_data;
224
-
225
-        }
226
-
227
-        $to_send = array(
228
-            'slug'   => $this->slug,
229
-            'is_ssl' => is_ssl(),
230
-            'fields' => array(
231
-                'banners' => false, // These will be supported soon hopefully
232
-                'reviews' => false
233
-            )
234
-        );
235
-
236
-        $api_response = $this->api_request( 'plugin_information', $to_send );
237
-
238
-        if ( false !== $api_response ) {
239
-            $_data = $api_response;
240
-        }
241
-
242
-        return $_data;
243
-    }
244
-
245
-
246
-    /**
247
-     * Disable SSL verification in order to prevent download update failures
248
-     *
249
-     * @param array   $args
250
-     * @param string  $url
251
-     * @return object $array
252
-     */
253
-    function http_request_args( $args, $url ) {
254
-        // If it is an https request and we are performing a package download, disable ssl verification
255
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
256
-            $args['sslverify'] = false;
257
-        }
258
-        return $args;
259
-    }
260
-
261
-    /**
262
-     * Calls the API and, if successfull, returns the object delivered by the API.
263
-     *
264
-     * @uses get_bloginfo()
265
-     * @uses wp_remote_post()
266
-     * @uses is_wp_error()
267
-     *
268
-     * @param string  $_action The requested action.
269
-     * @param array   $_data   Parameters for the API action.
270
-     * @return false||object
271
-     */
272
-    private function api_request( $_action, $_data ) {
273
-
274
-        global $wp_version;
275
-
276
-        $data = array_merge( $this->api_data, $_data );
277
-
278
-        if ( $data['slug'] != $this->slug )
279
-            return;
280
-
281
-        if ( empty( $data['license'] ) )
282
-            return;
283
-
284
-        if( $this->api_url == home_url() ) {
285
-            return false; // Don't allow a plugin to ping itself
286
-        }
287
-
288
-        $api_params = array(
289
-            'edd_action' => 'get_version',
290
-            'license'    => $data['license'],
291
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
292
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
293
-            'slug'       => $data['slug'],
294
-            'author'     => $data['author'],
295
-            'url'        => home_url()
296
-        );
189
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
190
+					esc_html( $version_info->name ),
191
+					esc_url( $changelog_link ),
192
+					esc_html( $version_info->new_version ),
193
+					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
194
+				);
195
+			}
196
+
197
+			echo '</div></td></tr>';
198
+		}
199
+	}
200
+
201
+
202
+	/**
203
+	 * Updates information on the "View version x.x details" page with custom data.
204
+	 *
205
+	 * @uses api_request()
206
+	 *
207
+	 * @param mixed   $_data
208
+	 * @param string  $_action
209
+	 * @param object  $_args
210
+	 * @return object $_data
211
+	 */
212
+	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
213
+
214
+
215
+		if ( $_action != 'plugin_information' ) {
216
+
217
+			return $_data;
218
+
219
+		}
220
+
221
+		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
222
+
223
+			return $_data;
224
+
225
+		}
226
+
227
+		$to_send = array(
228
+			'slug'   => $this->slug,
229
+			'is_ssl' => is_ssl(),
230
+			'fields' => array(
231
+				'banners' => false, // These will be supported soon hopefully
232
+				'reviews' => false
233
+			)
234
+		);
235
+
236
+		$api_response = $this->api_request( 'plugin_information', $to_send );
237
+
238
+		if ( false !== $api_response ) {
239
+			$_data = $api_response;
240
+		}
241
+
242
+		return $_data;
243
+	}
244
+
245
+
246
+	/**
247
+	 * Disable SSL verification in order to prevent download update failures
248
+	 *
249
+	 * @param array   $args
250
+	 * @param string  $url
251
+	 * @return object $array
252
+	 */
253
+	function http_request_args( $args, $url ) {
254
+		// If it is an https request and we are performing a package download, disable ssl verification
255
+		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
256
+			$args['sslverify'] = false;
257
+		}
258
+		return $args;
259
+	}
260
+
261
+	/**
262
+	 * Calls the API and, if successfull, returns the object delivered by the API.
263
+	 *
264
+	 * @uses get_bloginfo()
265
+	 * @uses wp_remote_post()
266
+	 * @uses is_wp_error()
267
+	 *
268
+	 * @param string  $_action The requested action.
269
+	 * @param array   $_data   Parameters for the API action.
270
+	 * @return false||object
271
+	 */
272
+	private function api_request( $_action, $_data ) {
273
+
274
+		global $wp_version;
275
+
276
+		$data = array_merge( $this->api_data, $_data );
277
+
278
+		if ( $data['slug'] != $this->slug )
279
+			return;
280
+
281
+		if ( empty( $data['license'] ) )
282
+			return;
283
+
284
+		if( $this->api_url == home_url() ) {
285
+			return false; // Don't allow a plugin to ping itself
286
+		}
287
+
288
+		$api_params = array(
289
+			'edd_action' => 'get_version',
290
+			'license'    => $data['license'],
291
+			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
292
+			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
293
+			'slug'       => $data['slug'],
294
+			'author'     => $data['author'],
295
+			'url'        => home_url()
296
+		);
297 297
 
298
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
298
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
299 299
 
300
-        if ( ! is_wp_error( $request ) ) {
301
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
302
-        }
300
+		if ( ! is_wp_error( $request ) ) {
301
+			$request = json_decode( wp_remote_retrieve_body( $request ) );
302
+		}
303 303
 
304
-        if ( $request && isset( $request->sections ) ) {
305
-            $request->sections = maybe_unserialize( $request->sections );
306
-        } else {
307
-            $request = false;
308
-        }
304
+		if ( $request && isset( $request->sections ) ) {
305
+			$request->sections = maybe_unserialize( $request->sections );
306
+		} else {
307
+			$request = false;
308
+		}
309 309
 
310
-        return $request;
311
-    }
310
+		return $request;
311
+	}
312 312
 
313
-    public function show_changelog() {
313
+	public function show_changelog() {
314 314
 
315 315
 
316
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
317
-            return;
318
-        }
316
+		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
317
+			return;
318
+		}
319 319
 
320
-        if( empty( $_REQUEST['plugin'] ) ) {
321
-            return;
322
-        }
323
-
324
-        if( empty( $_REQUEST['slug'] ) ) {
325
-            return;
326
-        }
327
-
328
-        if( ! current_user_can( 'update_plugins' ) ) {
329
-            wp_die( esc_html( 'You do not have permission to install plugin updates.', 'edd' ), esc_html( 'Error', 'edd' ), array( 'response' => 403 ) );
330
-        }
331
-
332
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
333
-
334
-        if( $response && isset( $response->sections['changelog'] ) ) {
335
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
336
-        }
337
-
338
-
339
-        exit;
340
-    }
320
+		if( empty( $_REQUEST['plugin'] ) ) {
321
+			return;
322
+		}
323
+
324
+		if( empty( $_REQUEST['slug'] ) ) {
325
+			return;
326
+		}
327
+
328
+		if( ! current_user_can( 'update_plugins' ) ) {
329
+			wp_die( esc_html( 'You do not have permission to install plugin updates.', 'edd' ), esc_html( 'Error', 'edd' ), array( 'response' => 403 ) );
330
+		}
331
+
332
+		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
333
+
334
+		if( $response && isset( $response->sections['changelog'] ) ) {
335
+			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
336
+		}
337
+
338
+
339
+		exit;
340
+	}
341 341
 
342 342
 }
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly
7
-if ( ! defined( 'ABSPATH' ) ) exit;
7
+if ( ! defined('ABSPATH')) exit;
8 8
 
9 9
 /**
10 10
  * Allows plugins to use their own update API.
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
      * @param array   $_api_data    Optional data to send with API calls.
30 30
      * @return void
31 31
      */
32
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
-        $this->api_url  = trailingslashit( $_api_url );
32
+    function __construct($_api_url, $_plugin_file, $_api_data = null) {
33
+        $this->api_url  = trailingslashit($_api_url);
34 34
         $this->api_data = $_api_data;
35
-        $this->name     = plugin_basename( $_plugin_file );
36
-        $this->slug     = basename( $_plugin_file, '.php' );
35
+        $this->name     = plugin_basename($_plugin_file);
36
+        $this->slug     = basename($_plugin_file, '.php');
37 37
         $this->version  = $_api_data['version'];
38 38
 
39 39
         // Set up hooks.
40 40
         $this->init();
41
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
41
+        add_action('admin_init', array($this, 'show_changelog'));
42 42
     }
43 43
 
44 44
     /**
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function init() {
52 52
 
53
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
53
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
54
+        add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
55 55
 
56
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
56
+        add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
57 57
     }
58 58
 
59 59
     /**
@@ -69,34 +69,34 @@  discard block
 block discarded – undo
69 69
      * @param array   $_transient_data Update array build by WordPress.
70 70
      * @return array Modified update array with custom plugin data.
71 71
      */
72
-    function check_update( $_transient_data ) {
72
+    function check_update($_transient_data) {
73 73
 
74 74
         global $pagenow;
75 75
 
76
-        if( ! is_object( $_transient_data ) ) {
76
+        if ( ! is_object($_transient_data)) {
77 77
             $_transient_data = new stdClass;
78 78
         }
79 79
 
80
-        if( 'plugins.php' == $pagenow && is_multisite() ) {
80
+        if ('plugins.php' == $pagenow && is_multisite()) {
81 81
             return $_transient_data;
82 82
         }
83 83
 
84
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
84
+        if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
85 85
 
86
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
86
+            $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
87 87
 
88
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
88
+            if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
89 89
 
90 90
                 $this->did_check = true;
91 91
 
92
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
92
+                if (version_compare($this->version, $version_info->new_version, '<')) {
93 93
 
94
-                    $_transient_data->response[ $this->name ] = $version_info;
94
+                    $_transient_data->response[$this->name] = $version_info;
95 95
 
96 96
                 }
97 97
 
98 98
                 $_transient_data->last_checked = time();
99
-                $_transient_data->checked[ $this->name ] = $this->version;
99
+                $_transient_data->checked[$this->name] = $this->version;
100 100
 
101 101
             }
102 102
 
@@ -111,86 +111,86 @@  discard block
 block discarded – undo
111 111
      * @param string  $file
112 112
      * @param array   $plugin
113 113
      */
114
-    public function show_update_notification( $file, $plugin ) {
114
+    public function show_update_notification($file, $plugin) {
115 115
 
116
-        if( ! current_user_can( 'update_plugins' ) ) {
116
+        if ( ! current_user_can('update_plugins')) {
117 117
             return;
118 118
         }
119 119
 
120
-        if( ! is_multisite() ) {
120
+        if ( ! is_multisite()) {
121 121
             return;
122 122
         }
123 123
 
124
-        if ( $this->name != $file ) {
124
+        if ($this->name != $file) {
125 125
             return;
126 126
         }
127 127
 
128 128
         // Remove our filter on the site transient
129
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
129
+        remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
130 130
 
131
-        $update_cache = get_site_transient( 'update_plugins' );
131
+        $update_cache = get_site_transient('update_plugins');
132 132
 
133
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
133
+        if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
134 134
 
135
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
136
-            $version_info = get_transient( $cache_key );
135
+            $cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
136
+            $version_info = get_transient($cache_key);
137 137
 
138
-            if( false === $version_info ) {
138
+            if (false === $version_info) {
139 139
 
140
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
140
+                $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
141 141
 
142
-                set_transient( $cache_key, $version_info, 3600 );
142
+                set_transient($cache_key, $version_info, 3600);
143 143
             }
144 144
 
145 145
 
146
-            if( ! is_object( $version_info ) ) {
146
+            if ( ! is_object($version_info)) {
147 147
                 return;
148 148
             }
149 149
 
150
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
150
+            if (version_compare($this->version, $version_info->new_version, '<')) {
151 151
 
152
-                $update_cache->response[ $this->name ] = $version_info;
152
+                $update_cache->response[$this->name] = $version_info;
153 153
 
154 154
             }
155 155
 
156 156
             $update_cache->last_checked = time();
157
-            $update_cache->checked[ $this->name ] = $this->version;
157
+            $update_cache->checked[$this->name] = $this->version;
158 158
 
159
-            set_site_transient( 'update_plugins', $update_cache );
159
+            set_site_transient('update_plugins', $update_cache);
160 160
 
161 161
         } else {
162 162
 
163
-            $version_info = $update_cache->response[ $this->name ];
163
+            $version_info = $update_cache->response[$this->name];
164 164
 
165 165
         }
166 166
 
167 167
         // Restore our filter
168
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
168
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
169 169
 
170
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
170
+        if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
171 171
 
172 172
             // build a plugin list row, with update notification
173
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
174
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
173
+            $wp_list_table = _get_list_table('WP_Plugins_List_Table');
174
+            echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
175 175
 
176
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
176
+            $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
177 177
 
178
-            if ( empty( $version_info->download_link ) ) {
178
+            if (empty($version_info->download_link)) {
179 179
                 printf(
180 180
 					/* translators: 1: name 2: changelog URL 3: version */
181
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
182
-                    esc_html( $version_info->name ),
183
-                    esc_url( $changelog_link ),
184
-                    esc_html( $version_info->new_version )
181
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd'),
182
+                    esc_html($version_info->name),
183
+                    esc_url($changelog_link),
184
+                    esc_html($version_info->new_version)
185 185
                 );
186 186
             } else {
187 187
                 printf(
188 188
 					/* translators: 1: name 2: changelog URL 3: version 4: update URL */
189
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
190
-                    esc_html( $version_info->name ),
191
-                    esc_url( $changelog_link ),
192
-                    esc_html( $version_info->new_version ),
193
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
189
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd'),
190
+                    esc_html($version_info->name),
191
+                    esc_url($changelog_link),
192
+                    esc_html($version_info->new_version),
193
+                    esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
194 194
                 );
195 195
             }
196 196
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
      * @param object  $_args
210 210
      * @return object $_data
211 211
      */
212
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
212
+    function plugins_api_filter($_data, $_action = '', $_args = null) {
213 213
 
214 214
 
215
-        if ( $_action != 'plugin_information' ) {
215
+        if ($_action != 'plugin_information') {
216 216
 
217 217
             return $_data;
218 218
 
219 219
         }
220 220
 
221
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
221
+        if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
222 222
 
223 223
             return $_data;
224 224
 
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
             )
234 234
         );
235 235
 
236
-        $api_response = $this->api_request( 'plugin_information', $to_send );
236
+        $api_response = $this->api_request('plugin_information', $to_send);
237 237
 
238
-        if ( false !== $api_response ) {
238
+        if (false !== $api_response) {
239 239
             $_data = $api_response;
240 240
         }
241 241
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
      * @param string  $url
251 251
      * @return object $array
252 252
      */
253
-    function http_request_args( $args, $url ) {
253
+    function http_request_args($args, $url) {
254 254
         // If it is an https request and we are performing a package download, disable ssl verification
255
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
255
+        if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
256 256
             $args['sslverify'] = false;
257 257
         }
258 258
         return $args;
@@ -269,40 +269,40 @@  discard block
 block discarded – undo
269 269
      * @param array   $_data   Parameters for the API action.
270 270
      * @return false||object
271 271
      */
272
-    private function api_request( $_action, $_data ) {
272
+    private function api_request($_action, $_data) {
273 273
 
274 274
         global $wp_version;
275 275
 
276
-        $data = array_merge( $this->api_data, $_data );
276
+        $data = array_merge($this->api_data, $_data);
277 277
 
278
-        if ( $data['slug'] != $this->slug )
278
+        if ($data['slug'] != $this->slug)
279 279
             return;
280 280
 
281
-        if ( empty( $data['license'] ) )
281
+        if (empty($data['license']))
282 282
             return;
283 283
 
284
-        if( $this->api_url == home_url() ) {
284
+        if ($this->api_url == home_url()) {
285 285
             return false; // Don't allow a plugin to ping itself
286 286
         }
287 287
 
288 288
         $api_params = array(
289 289
             'edd_action' => 'get_version',
290 290
             'license'    => $data['license'],
291
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
292
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
291
+            'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
292
+            'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
293 293
             'slug'       => $data['slug'],
294 294
             'author'     => $data['author'],
295 295
             'url'        => home_url()
296 296
         );
297 297
 
298
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
298
+        $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
299 299
 
300
-        if ( ! is_wp_error( $request ) ) {
301
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
300
+        if ( ! is_wp_error($request)) {
301
+            $request = json_decode(wp_remote_retrieve_body($request));
302 302
         }
303 303
 
304
-        if ( $request && isset( $request->sections ) ) {
305
-            $request->sections = maybe_unserialize( $request->sections );
304
+        if ($request && isset($request->sections)) {
305
+            $request->sections = maybe_unserialize($request->sections);
306 306
         } else {
307 307
             $request = false;
308 308
         }
@@ -313,26 +313,26 @@  discard block
 block discarded – undo
313 313
     public function show_changelog() {
314 314
 
315 315
 
316
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
316
+        if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
317 317
             return;
318 318
         }
319 319
 
320
-        if( empty( $_REQUEST['plugin'] ) ) {
320
+        if (empty($_REQUEST['plugin'])) {
321 321
             return;
322 322
         }
323 323
 
324
-        if( empty( $_REQUEST['slug'] ) ) {
324
+        if (empty($_REQUEST['slug'])) {
325 325
             return;
326 326
         }
327 327
 
328
-        if( ! current_user_can( 'update_plugins' ) ) {
329
-            wp_die( esc_html( 'You do not have permission to install plugin updates.', 'edd' ), esc_html( 'Error', 'edd' ), array( 'response' => 403 ) );
328
+        if ( ! current_user_can('update_plugins')) {
329
+            wp_die(esc_html('You do not have permission to install plugin updates.', 'edd'), esc_html('Error', 'edd'), array('response' => 403));
330 330
         }
331 331
 
332
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
332
+        $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
333 333
 
334
-        if( $response && isset( $response->sections['changelog'] ) ) {
335
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
334
+        if ($response && isset($response->sections['changelog'])) {
335
+            echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
336 336
         }
337 337
 
338 338
 
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -29,31 +29,31 @@  discard block
 block discarded – undo
29 29
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page;
30 30
 
31 31
 	//Payments
32
-	$give_payment       = get_post_type_object( 'give_payment' );
33
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
32
+	$give_payment       = get_post_type_object('give_payment');
33
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
34 34
 
35 35
 	//Donors
36
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Donors', 'give' ), esc_html( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
36
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Donors', 'give'), esc_html('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
37 37
 
38 38
 	//Reports`
39
-	$give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Donation Reports', 'give' ), esc_html( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' );
39
+	$give_reports_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Donation Reports', 'give'), esc_html('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page');
40 40
 
41 41
 	//Settings
42
-	$give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Give Settings', 'give' ), esc_html( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array(
42
+	$give_settings_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Give Settings', 'give'), esc_html('Settings', 'give'), 'manage_give_settings', 'give-settings', array(
43 43
 		Give()->give_settings,
44 44
 		'admin_page_display'
45
-	) );
45
+	));
46 46
 
47 47
 	//Add-ons
48
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Give Add-ons', 'give' ), esc_html( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
48
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Give Add-ons', 'give'), esc_html('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
49 49
 
50 50
 	//Upgrades
51
-	$give_upgrades_screen = add_submenu_page( null, esc_html( 'Give Upgrades', 'give' ), esc_html( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
51
+	$give_upgrades_screen = add_submenu_page(null, esc_html('Give Upgrades', 'give'), esc_html('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
52 52
 
53 53
 
54 54
 }
55 55
 
56
-add_action( 'admin_menu', 'give_add_options_links', 10 );
56
+add_action('admin_menu', 'give_add_options_links', 10);
57 57
 
58 58
 /**
59 59
  *  Determines whether the current admin page is a Give admin page.
@@ -68,224 +68,224 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return bool True if Give admin page.
70 70
  */
71
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
71
+function give_is_admin_page($passed_page = '', $passed_view = '') {
72 72
 
73 73
 	global $pagenow, $typenow;
74 74
 
75 75
 	$found     = false;
76
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
77
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
78
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
79
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
80
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
81
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
76
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
77
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
78
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
79
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
80
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
81
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
82 82
 
83
-	switch ( $passed_page ) {
83
+	switch ($passed_page) {
84 84
 		case 'give_forms':
85
-			switch ( $passed_view ) {
85
+			switch ($passed_view) {
86 86
 				case 'list-table':
87
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
87
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
88 88
 						$found = true;
89 89
 					}
90 90
 					break;
91 91
 				case 'edit':
92
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
92
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
93 93
 						$found = true;
94 94
 					}
95 95
 					break;
96 96
 				case 'new':
97
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
97
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
98 98
 						$found = true;
99 99
 					}
100 100
 					break;
101 101
 				default:
102
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
102
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
103 103
 						$found = true;
104 104
 					}
105 105
 					break;
106 106
 			}
107 107
 			break;
108 108
 		case 'categories':
109
-			switch ( $passed_view ) {
109
+			switch ($passed_view) {
110 110
 				case 'list-table':
111 111
 				case 'new':
112
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
112
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
113 113
 						$found = true;
114 114
 					}
115 115
 					break;
116 116
 				case 'edit':
117
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
117
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
118 118
 						$found = true;
119 119
 					}
120 120
 					break;
121 121
 				default:
122
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
122
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
123 123
 						$found = true;
124 124
 					}
125 125
 					break;
126 126
 			}
127 127
 			break;
128 128
 		case 'tags':
129
-			switch ( $passed_view ) {
129
+			switch ($passed_view) {
130 130
 				case 'list-table':
131 131
 				case 'new':
132
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
132
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
133 133
 						$found = true;
134 134
 					}
135 135
 					break;
136 136
 				case 'edit':
137
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
137
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
138 138
 						$found = true;
139 139
 					}
140 140
 					break;
141 141
 				default:
142
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
142
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
143 143
 						$found = true;
144 144
 					}
145 145
 					break;
146 146
 			}
147 147
 			break;
148 148
 		case 'payments':
149
-			switch ( $passed_view ) {
149
+			switch ($passed_view) {
150 150
 				case 'list-table':
151
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
151
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
152 152
 						$found = true;
153 153
 					}
154 154
 					break;
155 155
 				case 'edit':
156
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
156
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
157 157
 						$found = true;
158 158
 					}
159 159
 					break;
160 160
 				default:
161
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
161
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
162 162
 						$found = true;
163 163
 					}
164 164
 					break;
165 165
 			}
166 166
 			break;
167 167
 		case 'reports':
168
-			switch ( $passed_view ) {
168
+			switch ($passed_view) {
169 169
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
170 170
 				case 'earnings':
171
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
171
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
172 172
 						$found = true;
173 173
 					}
174 174
 					break;
175 175
 				case 'donors':
176
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
176
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
177 177
 						$found = true;
178 178
 					}
179 179
 					break;
180 180
 				case 'gateways':
181
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
181
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
182 182
 						$found = true;
183 183
 					}
184 184
 					break;
185 185
 				case 'export':
186
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
186
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
187 187
 						$found = true;
188 188
 					}
189 189
 					break;
190 190
 				case 'logs':
191
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
191
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
192 192
 						$found = true;
193 193
 					}
194 194
 					break;
195 195
 				default:
196
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
196
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
197 197
 						$found = true;
198 198
 					}
199 199
 					break;
200 200
 			}
201 201
 			break;
202 202
 		case 'settings':
203
-			switch ( $passed_view ) {
203
+			switch ($passed_view) {
204 204
 				case 'general':
205
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
205
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
206 206
 						$found = true;
207 207
 					}
208 208
 					break;
209 209
 				case 'gateways':
210
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
210
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
211 211
 						$found = true;
212 212
 					}
213 213
 					break;
214 214
 				case 'emails':
215
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
215
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
216 216
 						$found = true;
217 217
 					}
218 218
 					break;
219 219
 				case 'display':
220
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
220
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
221 221
 						$found = true;
222 222
 					}
223 223
 					break;
224 224
 				case 'licenses':
225
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
225
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
226 226
 						$found = true;
227 227
 					}
228 228
 					break;
229 229
 				case 'api':
230
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
230
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
231 231
 						$found = true;
232 232
 					}
233 233
 					break;
234 234
 				case 'advanced':
235
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
235
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
236 236
 						$found = true;
237 237
 					}
238 238
 					break;
239 239
 				case 'system_info':
240
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
240
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
241 241
 						$found = true;
242 242
 					}
243 243
 					break;
244 244
 				default:
245
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
245
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
246 246
 						$found = true;
247 247
 					}
248 248
 					break;
249 249
 			}
250 250
 			break;
251 251
 		case 'addons':
252
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
252
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
253 253
 				$found = true;
254 254
 			}
255 255
 			break;
256 256
 		case 'donors':
257
-			switch ( $passed_view ) {
257
+			switch ($passed_view) {
258 258
 				case 'list-table':
259
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
259
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
260 260
 						$found = true;
261 261
 					}
262 262
 					break;
263 263
 				case 'overview':
264
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
264
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
265 265
 						$found = true;
266 266
 					}
267 267
 					break;
268 268
 				case 'notes':
269
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
269
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
270 270
 						$found = true;
271 271
 					}
272 272
 					break;
273 273
 				default:
274
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
274
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
275 275
 						$found = true;
276 276
 					}
277 277
 					break;
278 278
 			}
279 279
 			break;
280 280
 		case 'reports':
281
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
281
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
282 282
 				$found = true;
283 283
 			}
284 284
 			break;
285 285
 		default:
286 286
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page;
287 287
 
288
-			$admin_pages = apply_filters( 'give_admin_pages', array(
288
+			$admin_pages = apply_filters('give_admin_pages', array(
289 289
 				$give_payments_page,
290 290
 				$give_settings_page,
291 291
 				$give_reports_page,
@@ -294,18 +294,18 @@  discard block
 block discarded – undo
294 294
 				$give_upgrades_screen,
295 295
 				$give_settings_export,
296 296
 				$give_customers_page
297
-			) );
298
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
297
+			));
298
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
299 299
 				$found = true;
300
-				if ( 'give-upgrades' === $page ) {
300
+				if ('give-upgrades' === $page) {
301 301
 					$found = false;
302 302
 				}
303
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
303
+			} elseif (in_array($pagenow, $admin_pages)) {
304 304
 				$found = true;
305 305
 			}
306 306
 			break;
307 307
 	}
308 308
 
309
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
309
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
310 310
 
311 311
 }
312 312
\ No newline at end of file
Please login to merge, or discard this patch.