| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | * | 
| 38 | 38 | * Display admin bar when active | 
| 39 | 39 | * | 
| 40 | - * @return bool | |
| 40 | + * @return false|null | |
| 41 | 41 | */ | 
| 42 | 42 |  	public function give_admin_bar_menu() { | 
| 43 | 43 | global $wp_admin_bar; | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. | 
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | +if ( ! defined('ABSPATH')) { | |
| 14 | 14 | exit; | 
| 15 | 15 | } | 
| 16 | 16 | |
| @@ -33,9 +33,9 @@ discard block | ||
| 33 | 33 | * @since 1.0 | 
| 34 | 34 | */ | 
| 35 | 35 |  	public function __construct() { | 
| 36 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); | |
| 37 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); | |
| 38 | - add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000, 1 ); | |
| 36 | +		add_action('admin_notices', array($this, 'show_notices')); | |
| 37 | +		add_action('give_dismiss_notices', array($this, 'dismiss_notices')); | |
| 38 | +		add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000, 1); | |
| 39 | 39 | |
| 40 | 40 | $this->notices = array( | 
| 41 | 41 | 'updated' => array(), | 
| @@ -51,20 +51,20 @@ discard block | ||
| 51 | 51 | * | 
| 52 | 52 | * @return bool | 
| 53 | 53 | */ | 
| 54 | -	public function give_admin_bar_menu( $wp_admin_bar ) { | |
| 54 | +	public function give_admin_bar_menu($wp_admin_bar) { | |
| 55 | 55 | |
| 56 | -		if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) { | |
| 56 | +		if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) { | |
| 57 | 57 | return false; | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | // Add the main siteadmin menu item. | 
| 61 | - $wp_admin_bar->add_menu( array( | |
| 61 | + $wp_admin_bar->add_menu(array( | |
| 62 | 62 | 'id' => 'give-test-notice', | 
| 63 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), | |
| 63 | +			'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), | |
| 64 | 64 | 'parent' => 'top-secondary', | 
| 65 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), | |
| 66 | - 'meta' => array( 'class' => 'give-test-mode-active' ), | |
| 67 | - ) ); | |
| 65 | +			'title'  => esc_html__('Give Test Mode Active', 'give'), | |
| 66 | +			'meta'   => array('class' => 'give-test-mode-active'), | |
| 67 | + )); | |
| 68 | 68 | |
| 69 | 69 | } | 
| 70 | 70 | |
| @@ -75,100 +75,100 @@ discard block | ||
| 75 | 75 | */ | 
| 76 | 76 |  	public function show_notices() { | 
| 77 | 77 | |
| 78 | -		if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) { | |
| 78 | +		if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) { | |
| 79 | 79 | echo '<div class="error">'; | 
| 80 | - echo '<p>' . esc_html__( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>'; | |
| 80 | +			echo '<p>'.esc_html__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>'; | |
| 81 | 81 | /* translators: %s: https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/ */ | 
| 82 | - echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/' ) ) . '</p>'; | |
| 83 | - echo '<p><a href="' . add_query_arg( array( | |
| 82 | +			echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/')).'</p>'; | |
| 83 | + echo '<p><a href="'.add_query_arg(array( | |
| 84 | 84 | 'give_action' => 'dismiss_notices', | 
| 85 | 85 | 'give_notice' => 'admin_ajax_inaccessible', | 
| 86 | - ) ) . '">' . esc_html__( 'Dismiss Notice', 'give' ) . '</a></p>'; | |
| 86 | +				)).'">'.esc_html__('Dismiss Notice', 'give').'</a></p>'; | |
| 87 | 87 | echo '</div>'; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | -		if ( isset( $_GET['give-message'] ) ) { | |
| 90 | +		if (isset($_GET['give-message'])) { | |
| 91 | 91 | |
| 92 | 92 | // Donation reports errors. | 
| 93 | -			if ( current_user_can( 'view_give_reports' ) ) { | |
| 94 | -				switch ( $_GET['give-message'] ) { | |
| 93 | +			if (current_user_can('view_give_reports')) { | |
| 94 | +				switch ($_GET['give-message']) { | |
| 95 | 95 | case 'donation_deleted' : | 
| 96 | - $this->notices['updated']['give-donation-deleted'] = esc_attr__( 'The donation has been deleted.', 'give' ); | |
| 96 | +						$this->notices['updated']['give-donation-deleted'] = esc_attr__('The donation has been deleted.', 'give'); | |
| 97 | 97 | break; | 
| 98 | 98 | case 'email_sent' : | 
| 99 | - $this->notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' ); | |
| 99 | +						$this->notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give'); | |
| 100 | 100 | break; | 
| 101 | 101 | case 'refreshed-reports' : | 
| 102 | - $this->notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' ); | |
| 102 | +						$this->notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give'); | |
| 103 | 103 | break; | 
| 104 | 104 | case 'donation-note-deleted' : | 
| 105 | - $this->notices['updated']['give-donation-note-deleted'] = esc_attr__( 'The donation note has been deleted.', 'give' ); | |
| 105 | +						$this->notices['updated']['give-donation-note-deleted'] = esc_attr__('The donation note has been deleted.', 'give'); | |
| 106 | 106 | break; | 
| 107 | 107 | } | 
| 108 | 108 | } | 
| 109 | 109 | |
| 110 | 110 | // Give settings notices and errors. | 
| 111 | -			if ( current_user_can( 'manage_give_settings' ) ) { | |
| 112 | -				switch ( $_GET['give-message'] ) { | |
| 111 | +			if (current_user_can('manage_give_settings')) { | |
| 112 | +				switch ($_GET['give-message']) { | |
| 113 | 113 | case 'settings-imported' : | 
| 114 | - $this->notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' ); | |
| 114 | +						$this->notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give'); | |
| 115 | 115 | break; | 
| 116 | 116 | case 'api-key-generated' : | 
| 117 | - $this->notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys have been generated.', 'give' ); | |
| 117 | +						$this->notices['updated']['give-api-key-generated'] = esc_attr__('API keys have been generated.', 'give'); | |
| 118 | 118 | break; | 
| 119 | 119 | case 'api-key-exists' : | 
| 120 | - $this->notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' ); | |
| 120 | +						$this->notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give'); | |
| 121 | 121 | break; | 
| 122 | 122 | case 'api-key-regenerated' : | 
| 123 | - $this->notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys have been regenerated.', 'give' ); | |
| 123 | +						$this->notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys have been regenerated.', 'give'); | |
| 124 | 124 | break; | 
| 125 | 125 | case 'api-key-revoked' : | 
| 126 | - $this->notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys have been revoked.', 'give' ); | |
| 126 | +						$this->notices['updated']['give-api-key-revoked'] = esc_attr__('API keys have been revoked.', 'give'); | |
| 127 | 127 | break; | 
| 128 | 128 | case 'sent-test-email' : | 
| 129 | - $this->notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' ); | |
| 129 | +						$this->notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give'); | |
| 130 | 130 | break; | 
| 131 | 131 | case 'matched-success-failure-page': | 
| 132 | - $this->notices['updated']['give-matched-success-failure-page'] = esc_html__( 'You cannot set the success and failed pages to the same page', 'give' ); | |
| 132 | +						$this->notices['updated']['give-matched-success-failure-page'] = esc_html__('You cannot set the success and failed pages to the same page', 'give'); | |
| 133 | 133 | } | 
| 134 | 134 | } | 
| 135 | 135 | // Payments errors. | 
| 136 | -			if ( current_user_can( 'edit_give_payments' ) ) { | |
| 137 | -				switch ( $_GET['give-message'] ) { | |
| 136 | +			if (current_user_can('edit_give_payments')) { | |
| 137 | +				switch ($_GET['give-message']) { | |
| 138 | 138 | case 'note-added' : | 
| 139 | - $this->notices['updated']['give-note-added'] = esc_attr__( 'The donation note has been added.', 'give' ); | |
| 139 | +						$this->notices['updated']['give-note-added'] = esc_attr__('The donation note has been added.', 'give'); | |
| 140 | 140 | break; | 
| 141 | 141 | case 'payment-updated' : | 
| 142 | - $this->notices['updated']['give-payment-updated'] = esc_attr__( 'The donation has been updated.', 'give' ); | |
| 142 | +						$this->notices['updated']['give-payment-updated'] = esc_attr__('The donation has been updated.', 'give'); | |
| 143 | 143 | break; | 
| 144 | 144 | } | 
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | 147 | // Customer Notices. | 
| 148 | -			if ( current_user_can( 'edit_give_payments' ) ) { | |
| 149 | -				switch ( $_GET['give-message'] ) { | |
| 148 | +			if (current_user_can('edit_give_payments')) { | |
| 149 | +				switch ($_GET['give-message']) { | |
| 150 | 150 | case 'customer-deleted' : | 
| 151 | - $this->notices['updated']['give-customer-deleted'] = esc_attr__( 'The donor has been deleted.', 'give' ); | |
| 151 | +						$this->notices['updated']['give-customer-deleted'] = esc_attr__('The donor has been deleted.', 'give'); | |
| 152 | 152 | break; | 
| 153 | 153 | |
| 154 | 154 | case 'email-added' : | 
| 155 | - $this->notices['updated']['give-customer-email-added'] = esc_attr__( 'Donor email added', 'give' ); | |
| 155 | +						$this->notices['updated']['give-customer-email-added'] = esc_attr__('Donor email added', 'give'); | |
| 156 | 156 | break; | 
| 157 | 157 | |
| 158 | 158 | case 'email-removed' : | 
| 159 | - $this->notices['updated']['give-customer-email-removed'] = esc_attr__( 'Donor email removed', 'give' ); | |
| 159 | +						$this->notices['updated']['give-customer-email-removed'] = esc_attr__('Donor email removed', 'give'); | |
| 160 | 160 | break; | 
| 161 | 161 | |
| 162 | 162 | case 'email-remove-failed' : | 
| 163 | - $this->notices['error']['give-customer-email-remove-failed'] = esc_attr__( 'Failed to remove donor email', 'give' ); | |
| 163 | +						$this->notices['error']['give-customer-email-remove-failed'] = esc_attr__('Failed to remove donor email', 'give'); | |
| 164 | 164 | break; | 
| 165 | 165 | |
| 166 | 166 | case 'primary-email-updated' : | 
| 167 | - $this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__( 'Primary email updated for donors', 'give' ); | |
| 167 | +						$this->notices['updated']['give-customer-primary-email-updated'] = esc_attr__('Primary email updated for donors', 'give'); | |
| 168 | 168 | break; | 
| 169 | 169 | |
| 170 | 170 | case 'primary-email-failed' : | 
| 171 | - $this->notices['error']['give-customer-primary-email-failed'] = esc_attr__( 'Failed to set primary email', 'give' ); | |
| 171 | +						$this->notices['error']['give-customer-primary-email-failed'] = esc_attr__('Failed to set primary email', 'give'); | |
| 172 | 172 | |
| 173 | 173 | } | 
| 174 | 174 | } | 
| @@ -176,19 +176,19 @@ discard block | ||
| 176 | 176 | |
| 177 | 177 | $this->add_payment_bulk_action_notice(); | 
| 178 | 178 | |
| 179 | -		if ( count( $this->notices['updated'] ) > 0 ) { | |
| 180 | -			foreach ( $this->notices['updated'] as $notice => $message ) { | |
| 181 | - add_settings_error( 'give-notices', $notice, $message, 'updated' ); | |
| 179 | +		if (count($this->notices['updated']) > 0) { | |
| 180 | +			foreach ($this->notices['updated'] as $notice => $message) { | |
| 181 | +				add_settings_error('give-notices', $notice, $message, 'updated'); | |
| 182 | 182 | } | 
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | -		if ( count( $this->notices['error'] ) > 0 ) { | |
| 186 | -			foreach ( $this->notices['error'] as $notice => $message ) { | |
| 187 | - add_settings_error( 'give-notices', $notice, $message, 'error' ); | |
| 185 | +		if (count($this->notices['error']) > 0) { | |
| 186 | +			foreach ($this->notices['error'] as $notice => $message) { | |
| 187 | +				add_settings_error('give-notices', $notice, $message, 'error'); | |
| 188 | 188 | } | 
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | - settings_errors( 'give-notices' ); | |
| 191 | +		settings_errors('give-notices'); | |
| 192 | 192 | |
| 193 | 193 | } | 
| 194 | 194 | |
| @@ -200,8 +200,8 @@ discard block | ||
| 200 | 200 | * @return void | 
| 201 | 201 | */ | 
| 202 | 202 |  	function give_admin_addons_notices() { | 
| 203 | - add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr__( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' ); | |
| 204 | - settings_errors( 'give-notices' ); | |
| 203 | +		add_settings_error('give-notices', 'give-addons-feed-error', esc_attr__('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error'); | |
| 204 | +		settings_errors('give-notices'); | |
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | 207 | |
| @@ -212,9 +212,9 @@ discard block | ||
| 212 | 212 | * @return void | 
| 213 | 213 | */ | 
| 214 | 214 |  	function dismiss_notices() { | 
| 215 | -		if ( isset( $_GET['give_notice'] ) ) { | |
| 216 | - update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 ); | |
| 217 | - wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) ); | |
| 215 | +		if (isset($_GET['give_notice'])) { | |
| 216 | + update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1); | |
| 217 | +			wp_redirect(remove_query_arg(array('give_action', 'give_notice'))); | |
| 218 | 218 | exit; | 
| 219 | 219 | } | 
| 220 | 220 | } | 
| @@ -229,24 +229,24 @@ discard block | ||
| 229 | 229 | */ | 
| 230 | 230 |  	function add_payment_bulk_action_notice() { | 
| 231 | 231 | if ( | 
| 232 | - current_user_can( 'edit_give_payments' ) | |
| 233 | - && isset( $_GET['action'] ) | |
| 234 | - && ! empty( $_GET['action'] ) | |
| 235 | - && isset( $_GET['payment'] ) | |
| 236 | - && ! empty( $_GET['payment'] ) | |
| 232 | +			current_user_can('edit_give_payments') | |
| 233 | + && isset($_GET['action']) | |
| 234 | + && ! empty($_GET['action']) | |
| 235 | + && isset($_GET['payment']) | |
| 236 | + && ! empty($_GET['payment']) | |
| 237 | 237 |  		) { | 
| 238 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; | |
| 238 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; | |
| 239 | 239 | |
| 240 | -			switch ( $_GET['action'] ) { | |
| 240 | +			switch ($_GET['action']) { | |
| 241 | 241 | case 'delete': | 
| 242 | -					if ( $payment_count ) { | |
| 243 | - $this->notices['updated']['bulk_action_delete'] = sprintf( _n( 'Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give' ), $payment_count ); | |
| 242 | +					if ($payment_count) { | |
| 243 | +						$this->notices['updated']['bulk_action_delete'] = sprintf(_n('Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give'), $payment_count); | |
| 244 | 244 | } | 
| 245 | 245 | break; | 
| 246 | 246 | |
| 247 | 247 | case 'resend-receipt': | 
| 248 | -					if ( $payment_count ) { | |
| 249 | - $this->notices['updated']['bulk_action_resend_receipt'] = sprintf( _n( 'Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give' ), $payment_count ); | |
| 248 | +					if ($payment_count) { | |
| 249 | +						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf(_n('Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give'), $payment_count); | |
| 250 | 250 | } | 
| 251 | 251 | break; | 
| 252 | 252 | } | 
| @@ -576,7 +576,7 @@ | ||
| 576 | 576 | * selected date-range (if any) | 
| 577 | 577 | * | 
| 578 | 578 | * @since 1.0 | 
| 579 | - * @return array | |
| 579 | + * @return integer|null | |
| 580 | 580 | */ | 
| 581 | 581 |  function give_get_report_dates() { | 
| 582 | 582 | $dates = array(); | 
| @@ -814,12 +814,12 @@ | ||
| 814 | 814 | ) ), 'give-refresh-reports' ); | 
| 815 | 815 | |
| 816 | 816 | echo '<a href="' | 
| 817 | - . esc_url_raw( $url ) | |
| 818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) | |
| 819 | - . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' | |
| 820 | - . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' | |
| 821 | - . esc_html__( 'Refresh Report Data', 'give' ) | |
| 822 | - . '</a>'; | |
| 817 | + . esc_url_raw( $url ) | |
| 818 | + . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) | |
| 819 | + . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' | |
| 820 | + . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' | |
| 821 | + . esc_html__( 'Refresh Report Data', 'give' ) | |
| 822 | + . '</a>'; | |
| 823 | 823 | |
| 824 | 824 | } | 
| 825 | 825 | |
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. | 
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | +if ( ! defined('ABSPATH')) { | |
| 14 | 14 | exit; | 
| 15 | 15 | } | 
| 16 | 16 | |
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 | $dates = give_get_report_dates(); | 
| 26 | 26 | |
| 27 | 27 | // Determine graph options | 
| 28 | - switch ( $dates['range'] ) : | |
| 28 | + switch ($dates['range']) : | |
| 29 | 29 | case 'today' : | 
| 30 | 30 | case 'yesterday' : | 
| 31 | 31 | $day_by_day = true; | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | $day_by_day = false; | 
| 38 | 38 | break; | 
| 39 | 39 | case 'other' : | 
| 40 | -			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { | |
| 40 | +			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { | |
| 41 | 41 | $day_by_day = false; | 
| 42 | 42 |  			} else { | 
| 43 | 43 | $day_by_day = true; | 
| @@ -49,61 +49,61 @@ discard block | ||
| 49 | 49 | endswitch; | 
| 50 | 50 | |
| 51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown | 
| 52 | - $sales_totals = 0; // Total sales for time period shown | |
| 52 | + $sales_totals = 0; // Total sales for time period shown | |
| 53 | 53 | |
| 54 | 54 | $earnings_data = array(); | 
| 55 | 55 | $sales_data = array(); | 
| 56 | 56 | |
| 57 | -	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { | |
| 57 | +	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { | |
| 58 | 58 | // Hour by hour | 
| 59 | 59 | $hour = 1; | 
| 60 | - $month = date( 'n', current_time( 'timestamp' ) ); | |
| 61 | - while ( $hour <= 23 ) : | |
| 60 | +		$month = date('n', current_time('timestamp')); | |
| 61 | + while ($hour <= 23) : | |
| 62 | 62 | |
| 63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); | |
| 64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); | |
| 63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); | |
| 64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); | |
| 65 | 65 | |
| 66 | 66 | $sales_totals += $sales; | 
| 67 | 67 | $earnings_totals += $earnings; | 
| 68 | 68 | |
| 69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; | |
| 70 | - $sales_data[] = array( $date, $sales ); | |
| 71 | - $earnings_data[] = array( $date, $earnings ); | |
| 69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; | |
| 70 | + $sales_data[] = array($date, $sales); | |
| 71 | + $earnings_data[] = array($date, $earnings); | |
| 72 | 72 | |
| 73 | - $hour ++; | |
| 73 | + $hour++; | |
| 74 | 74 | endwhile; | 
| 75 | 75 | |
| 76 | -	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { | |
| 76 | +	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { | |
| 77 | 77 | |
| 78 | 78 | // Day by day | 
| 79 | 79 | $day = $dates['day']; | 
| 80 | 80 | $day_end = $dates['day_end']; | 
| 81 | 81 | $month = $dates['m_start']; | 
| 82 | - while ( $day <= $day_end ) : | |
| 83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); | |
| 82 | + while ($day <= $day_end) : | |
| 83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); | |
| 84 | 84 | $sales_totals += $sales; | 
| 85 | 85 | |
| 86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); | |
| 86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); | |
| 87 | 87 | $earnings_totals += $earnings; | 
| 88 | 88 | |
| 89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; | |
| 90 | - $sales_data[] = array( $date, $sales ); | |
| 91 | - $earnings_data[] = array( $date, $earnings ); | |
| 92 | - $day ++; | |
| 89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; | |
| 90 | + $sales_data[] = array($date, $sales); | |
| 91 | + $earnings_data[] = array($date, $earnings); | |
| 92 | + $day++; | |
| 93 | 93 | endwhile; | 
| 94 | 94 | |
| 95 | 95 |  	} else { | 
| 96 | 96 | |
| 97 | 97 | $y = $dates['year']; | 
| 98 | - while ( $y <= $dates['year_end'] ) : | |
| 98 | + while ($y <= $dates['year_end']) : | |
| 99 | 99 | |
| 100 | -			if ( $dates['year'] == $dates['year_end'] ) { | |
| 100 | +			if ($dates['year'] == $dates['year_end']) { | |
| 101 | 101 | $month_start = $dates['m_start']; | 
| 102 | 102 | $month_end = $dates['m_end']; | 
| 103 | -			} elseif ( $y == $dates['year'] ) { | |
| 103 | +			} elseif ($y == $dates['year']) { | |
| 104 | 104 | $month_start = $dates['m_start']; | 
| 105 | 105 | $month_end = 12; | 
| 106 | -			} elseif ( $y == $dates['year_end'] ) { | |
| 106 | +			} elseif ($y == $dates['year_end']) { | |
| 107 | 107 | $month_start = 1; | 
| 108 | 108 | $month_end = $dates['m_end']; | 
| 109 | 109 |  			} else { | 
| @@ -112,48 +112,48 @@ discard block | ||
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 | $i = $month_start; | 
| 115 | - while ( $i <= $month_end ) : | |
| 115 | + while ($i <= $month_end) : | |
| 116 | 116 | |
| 117 | -				if ( $day_by_day ) { | |
| 117 | +				if ($day_by_day) { | |
| 118 | 118 | |
| 119 | -					if ( $i == $month_end ) { | |
| 119 | +					if ($i == $month_end) { | |
| 120 | 120 | |
| 121 | 121 | $num_of_days = $dates['day_end']; | 
| 122 | 122 | |
| 123 | 123 |  					} else { | 
| 124 | 124 | |
| 125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); | |
| 125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); | |
| 126 | 126 | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | $d = $dates['day']; | 
| 130 | 130 | |
| 131 | - while ( $d <= $num_of_days ) : | |
| 131 | + while ($d <= $num_of_days) : | |
| 132 | 132 | |
| 133 | - $sales = give_get_sales_by_date( $d, $i, $y ); | |
| 133 | + $sales = give_get_sales_by_date($d, $i, $y); | |
| 134 | 134 | $sales_totals += $sales; | 
| 135 | 135 | |
| 136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); | |
| 136 | + $earnings = give_get_earnings_by_date($d, $i, $y); | |
| 137 | 137 | $earnings_totals += $earnings; | 
| 138 | 138 | |
| 139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; | |
| 140 | - $sales_data[] = array( $date, $sales ); | |
| 141 | - $earnings_data[] = array( $date, $earnings ); | |
| 142 | - $d ++; | |
| 139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; | |
| 140 | + $sales_data[] = array($date, $sales); | |
| 141 | + $earnings_data[] = array($date, $earnings); | |
| 142 | + $d++; | |
| 143 | 143 | |
| 144 | 144 | endwhile; | 
| 145 | 145 | |
| 146 | 146 |  				} else { | 
| 147 | 147 | |
| 148 | - $sales = give_get_sales_by_date( null, $i, $y ); | |
| 148 | + $sales = give_get_sales_by_date(null, $i, $y); | |
| 149 | 149 | $sales_totals += $sales; | 
| 150 | 150 | |
| 151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); | |
| 151 | + $earnings = give_get_earnings_by_date(null, $i, $y); | |
| 152 | 152 | $earnings_totals += $earnings; | 
| 153 | 153 | |
| 154 | -					if ( $i == $month_end ) { | |
| 154 | +					if ($i == $month_end) { | |
| 155 | 155 | |
| 156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); | |
| 156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); | |
| 157 | 157 | |
| 158 | 158 |  					} else { | 
| 159 | 159 | |
| @@ -161,24 +161,24 @@ discard block | ||
| 161 | 161 | |
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; | |
| 165 | - $sales_data[] = array( $date, $sales ); | |
| 166 | - $earnings_data[] = array( $date, $earnings ); | |
| 164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; | |
| 165 | + $sales_data[] = array($date, $sales); | |
| 166 | + $earnings_data[] = array($date, $earnings); | |
| 167 | 167 | |
| 168 | 168 | } | 
| 169 | 169 | |
| 170 | - $i ++; | |
| 170 | + $i++; | |
| 171 | 171 | |
| 172 | 172 | endwhile; | 
| 173 | 173 | |
| 174 | - $y ++; | |
| 174 | + $y++; | |
| 175 | 175 | endwhile; | 
| 176 | 176 | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | 179 | $data = array( | 
| 180 | - esc_html__( 'Income', 'give' ) => $earnings_data, | |
| 181 | - esc_html__( 'Donations', 'give' ) => $sales_data | |
| 180 | +		esc_html__('Income', 'give')    => $earnings_data, | |
| 181 | +		esc_html__('Donations', 'give') => $sales_data | |
| 182 | 182 | ); | 
| 183 | 183 | |
| 184 | 184 | // start our own output buffer | 
| @@ -191,12 +191,12 @@ discard block | ||
| 191 | 191 | <div class="inside"> | 
| 192 | 192 | <?php give_reports_graph_controls(); ?> | 
| 193 | 193 | <?php | 
| 194 | - $graph = new Give_Graph( $data ); | |
| 195 | - $graph->set( 'x_mode', 'time' ); | |
| 196 | - $graph->set( 'multiple_y_axes', true ); | |
| 194 | + $graph = new Give_Graph($data); | |
| 195 | +					$graph->set('x_mode', 'time'); | |
| 196 | +					$graph->set('multiple_y_axes', true); | |
| 197 | 197 | $graph->display(); | 
| 198 | 198 | |
| 199 | -					if ( 'this_month' == $dates['range'] ) { | |
| 199 | +					if ('this_month' == $dates['range']) { | |
| 200 | 200 | $estimated = give_estimated_monthly_stats(); | 
| 201 | 201 | } | 
| 202 | 202 | ?> | 
| @@ -205,21 +205,21 @@ discard block | ||
| 205 | 205 | <table class="widefat reports-table alignleft" style="max-width:450px"> | 
| 206 | 206 | <tbody> | 
| 207 | 207 | <tr> | 
| 208 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> | |
| 209 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> | |
| 208 | +					<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> | |
| 209 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> | |
| 210 | 210 | </tr> | 
| 211 | 211 | <tr class="alternate"> | 
| 212 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th> | |
| 212 | +					<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th> | |
| 213 | 213 | <td><?php echo $sales_totals; ?></td> | 
| 214 | 214 | </tr> | 
| 215 | - <?php if ( 'this_month' == $dates['range'] ) : ?> | |
| 215 | +				<?php if ('this_month' == $dates['range']) : ?> | |
| 216 | 216 | <tr> | 
| 217 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th> | |
| 218 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> | |
| 217 | +						<th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th> | |
| 218 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> | |
| 219 | 219 | </tr> | 
| 220 | 220 | <tr class="alternate"> | 
| 221 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th> | |
| 222 | - <td><?php echo floor( $estimated['sales'] ); ?></td> | |
| 221 | +						<th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th> | |
| 222 | + <td><?php echo floor($estimated['sales']); ?></td> | |
| 223 | 223 | </tr> | 
| 224 | 224 | <?php endif; ?> | 
| 225 | 225 | </table> | 
| @@ -232,7 +232,7 @@ discard block | ||
| 232 | 232 | * | 
| 233 | 233 | * @since 1.0 | 
| 234 | 234 | */ | 
| 235 | - do_action( 'give_reports_graph_additional_stats' ); | |
| 235 | +			do_action('give_reports_graph_additional_stats'); | |
| 236 | 236 | ?> | 
| 237 | 237 | |
| 238 | 238 | </div> | 
| @@ -251,12 +251,12 @@ discard block | ||
| 251 | 251 | * @since 1.0 | 
| 252 | 252 | * @return void | 
| 253 | 253 | */ | 
| 254 | -function give_reports_graph_of_form( $form_id = 0 ) { | |
| 254 | +function give_reports_graph_of_form($form_id = 0) { | |
| 255 | 255 | // Retrieve the queried dates | 
| 256 | 256 | $dates = give_get_report_dates(); | 
| 257 | 257 | |
| 258 | 258 | // Determine graph options | 
| 259 | - switch ( $dates['range'] ) : | |
| 259 | + switch ($dates['range']) : | |
| 260 | 260 | case 'today' : | 
| 261 | 261 | case 'yesterday' : | 
| 262 | 262 | $day_by_day = true; | 
| @@ -274,7 +274,7 @@ discard block | ||
| 274 | 274 | $day_by_day = false; | 
| 275 | 275 | break; | 
| 276 | 276 | case 'other' : | 
| 277 | -			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { | |
| 277 | +			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { | |
| 278 | 278 | $day_by_day = false; | 
| 279 | 279 |  			} else { | 
| 280 | 280 | $day_by_day = true; | 
| @@ -286,75 +286,75 @@ discard block | ||
| 286 | 286 | endswitch; | 
| 287 | 287 | |
| 288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown | 
| 289 | - $sales_totals = 0; // Total sales for time period shown | |
| 289 | + $sales_totals = 0; // Total sales for time period shown | |
| 290 | 290 | |
| 291 | 291 | $earnings_data = array(); | 
| 292 | 292 | $sales_data = array(); | 
| 293 | 293 | $stats = new Give_Payment_Stats; | 
| 294 | 294 | |
| 295 | -	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { | |
| 295 | +	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { | |
| 296 | 296 | |
| 297 | 297 | // Hour by hour | 
| 298 | 298 | $month = $dates['m_start']; | 
| 299 | 299 | $hour = 1; | 
| 300 | 300 | $minute = 0; | 
| 301 | 301 | $second = 0; | 
| 302 | - while ( $hour <= 23 ) : | |
| 302 | + while ($hour <= 23) : | |
| 303 | 303 | |
| 304 | -			if ( $hour == 23 ) { | |
| 304 | +			if ($hour == 23) { | |
| 305 | 305 | $minute = $second = 59; | 
| 306 | 306 | } | 
| 307 | 307 | |
| 308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); | |
| 309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); | |
| 308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); | |
| 309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); | |
| 310 | 310 | |
| 311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); | |
| 311 | + $sales = $stats->get_sales($form_id, $date, $date_end); | |
| 312 | 312 | $sales_totals += $sales; | 
| 313 | 313 | |
| 314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); | |
| 314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); | |
| 315 | 315 | $earnings_totals += $earnings; | 
| 316 | 316 | |
| 317 | - $sales_data[] = array( $date * 1000, $sales ); | |
| 318 | - $earnings_data[] = array( $date * 1000, $earnings ); | |
| 317 | + $sales_data[] = array($date * 1000, $sales); | |
| 318 | + $earnings_data[] = array($date * 1000, $earnings); | |
| 319 | 319 | |
| 320 | - $hour ++; | |
| 320 | + $hour++; | |
| 321 | 321 | endwhile; | 
| 322 | 322 | |
| 323 | -	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { | |
| 323 | +	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { | |
| 324 | 324 | |
| 325 | 325 | //Day by day | 
| 326 | 326 | $day = $dates['day']; | 
| 327 | 327 | $day_end = $dates['day_end']; | 
| 328 | 328 | $month = $dates['m_start']; | 
| 329 | - while ( $day <= $day_end ) : | |
| 329 | + while ($day <= $day_end) : | |
| 330 | 330 | |
| 331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); | |
| 332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); | |
| 333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); | |
| 331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); | |
| 332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); | |
| 333 | + $sales = $stats->get_sales($form_id, $date, $date_end); | |
| 334 | 334 | $sales_totals += $sales; | 
| 335 | 335 | |
| 336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); | |
| 336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); | |
| 337 | 337 | $earnings_totals += $earnings; | 
| 338 | 338 | |
| 339 | - $sales_data[] = array( $date * 1000, $sales ); | |
| 340 | - $earnings_data[] = array( $date * 1000, $earnings ); | |
| 339 | + $sales_data[] = array($date * 1000, $sales); | |
| 340 | + $earnings_data[] = array($date * 1000, $earnings); | |
| 341 | 341 | |
| 342 | - $day ++; | |
| 342 | + $day++; | |
| 343 | 343 | endwhile; | 
| 344 | 344 | |
| 345 | 345 |  	} else { | 
| 346 | 346 | |
| 347 | 347 | $y = $dates['year']; | 
| 348 | 348 | |
| 349 | - while ( $y <= $dates['year_end'] ) : | |
| 349 | + while ($y <= $dates['year_end']) : | |
| 350 | 350 | |
| 351 | 351 | $last_year = false; | 
| 352 | 352 | |
| 353 | -			if ( $dates['year'] == $dates['year_end'] ) { | |
| 353 | +			if ($dates['year'] == $dates['year_end']) { | |
| 354 | 354 | $month_start = $dates['m_start']; | 
| 355 | 355 | $month_end = $dates['m_end']; | 
| 356 | 356 | $last_year = true; | 
| 357 | -			} elseif ( $y == $dates['year'] ) { | |
| 357 | +			} elseif ($y == $dates['year']) { | |
| 358 | 358 | $month_start = $dates['m_start']; | 
| 359 | 359 | $month_end = 12; | 
| 360 | 360 |  			} else { | 
| @@ -363,76 +363,76 @@ discard block | ||
| 363 | 363 | } | 
| 364 | 364 | |
| 365 | 365 | $i = $month_start; | 
| 366 | - while ( $i <= $month_end ) : | |
| 366 | + while ($i <= $month_end) : | |
| 367 | 367 | |
| 368 | -				if ( $day_by_day ) { | |
| 368 | +				if ($day_by_day) { | |
| 369 | 369 | |
| 370 | -					if ( $i == $month_end && $last_year ) { | |
| 370 | +					if ($i == $month_end && $last_year) { | |
| 371 | 371 | |
| 372 | 372 | $num_of_days = $dates['day_end']; | 
| 373 | 373 | |
| 374 | 374 |  					} else { | 
| 375 | 375 | |
| 376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); | |
| 376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); | |
| 377 | 377 | |
| 378 | 378 | } | 
| 379 | 379 | |
| 380 | 380 | $d = $dates['day']; | 
| 381 | - while ( $d <= $num_of_days ) : | |
| 381 | + while ($d <= $num_of_days) : | |
| 382 | 382 | |
| 383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); | |
| 384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); | |
| 383 | + $date = mktime(0, 0, 0, $i, $d, $y); | |
| 384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); | |
| 385 | 385 | |
| 386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); | |
| 386 | + $sales = $stats->get_sales($form_id, $date, $end_date); | |
| 387 | 387 | $sales_totals += $sales; | 
| 388 | 388 | |
| 389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); | |
| 389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); | |
| 390 | 390 | $earnings_totals += $earnings; | 
| 391 | 391 | |
| 392 | - $sales_data[] = array( $date * 1000, $sales ); | |
| 393 | - $earnings_data[] = array( $date * 1000, $earnings ); | |
| 394 | - $d ++; | |
| 392 | + $sales_data[] = array($date * 1000, $sales); | |
| 393 | + $earnings_data[] = array($date * 1000, $earnings); | |
| 394 | + $d++; | |
| 395 | 395 | |
| 396 | 396 | endwhile; | 
| 397 | 397 | |
| 398 | 398 |  				} else { | 
| 399 | 399 | |
| 400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); | |
| 400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); | |
| 401 | 401 | |
| 402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); | |
| 403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); | |
| 402 | + $date = mktime(0, 0, 0, $i, 1, $y); | |
| 403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); | |
| 404 | 404 | |
| 405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); | |
| 405 | + $sales = $stats->get_sales($form_id, $date, $end_date); | |
| 406 | 406 | $sales_totals += $sales; | 
| 407 | 407 | |
| 408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); | |
| 408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); | |
| 409 | 409 | $earnings_totals += $earnings; | 
| 410 | 410 | |
| 411 | - $sales_data[] = array( $date * 1000, $sales ); | |
| 412 | - $earnings_data[] = array( $date * 1000, $earnings ); | |
| 411 | + $sales_data[] = array($date * 1000, $sales); | |
| 412 | + $earnings_data[] = array($date * 1000, $earnings); | |
| 413 | 413 | |
| 414 | 414 | } | 
| 415 | 415 | |
| 416 | - $i ++; | |
| 416 | + $i++; | |
| 417 | 417 | |
| 418 | 418 | endwhile; | 
| 419 | 419 | |
| 420 | - $y ++; | |
| 420 | + $y++; | |
| 421 | 421 | endwhile; | 
| 422 | 422 | |
| 423 | 423 | } | 
| 424 | 424 | |
| 425 | 425 | $data = array( | 
| 426 | - esc_html__( 'Income', 'give' ) => $earnings_data, | |
| 427 | - esc_html__( 'Donations', 'give' ) => $sales_data | |
| 426 | +		esc_html__('Income', 'give')    => $earnings_data, | |
| 427 | +		esc_html__('Donations', 'give') => $sales_data | |
| 428 | 428 | ); | 
| 429 | 429 | |
| 430 | 430 | ?> | 
| 431 | 431 | <h3><span><?php | 
| 432 | 432 | printf( | 
| 433 | 433 | /* translators: %s: form title */ | 
| 434 | - esc_html__( 'Income Report for %s', 'give' ), | |
| 435 | - get_the_title( $form_id ) | |
| 434 | +			esc_html__('Income Report for %s', 'give'), | |
| 435 | + get_the_title($form_id) | |
| 436 | 436 | ); | 
| 437 | 437 | ?></span></h3> | 
| 438 | 438 | <div id="give-dashboard-widgets-wrap"> | 
| @@ -441,9 +441,9 @@ discard block | ||
| 441 | 441 | <div class="inside"> | 
| 442 | 442 | <?php give_reports_graph_controls(); ?> | 
| 443 | 443 | <?php | 
| 444 | - $graph = new Give_Graph( $data ); | |
| 445 | - $graph->set( 'x_mode', 'time' ); | |
| 446 | - $graph->set( 'multiple_y_axes', true ); | |
| 444 | + $graph = new Give_Graph($data); | |
| 445 | +					$graph->set('x_mode', 'time'); | |
| 446 | +					$graph->set('multiple_y_axes', true); | |
| 447 | 447 | $graph->display(); | 
| 448 | 448 | ?> | 
| 449 | 449 | </div> | 
| @@ -452,20 +452,20 @@ discard block | ||
| 452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> | 
| 453 | 453 | <tbody> | 
| 454 | 454 | <tr> | 
| 455 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> | |
| 456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> | |
| 455 | +					<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> | |
| 456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> | |
| 457 | 457 | </tr> | 
| 458 | 458 | <tr class="alternate"> | 
| 459 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th> | |
| 459 | +					<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th> | |
| 460 | 460 | <td><?php echo $sales_totals; ?></td> | 
| 461 | 461 | </tr> | 
| 462 | 462 | <tr> | 
| 463 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th> | |
| 464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> | |
| 463 | +					<th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th> | |
| 464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> | |
| 465 | 465 | </tr> | 
| 466 | 466 | <tr class="alternate"> | 
| 467 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th> | |
| 468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> | |
| 467 | +					<th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th> | |
| 468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> | |
| 469 | 469 | </tr> | 
| 470 | 470 | </tbody> | 
| 471 | 471 | </table> | 
| @@ -484,26 +484,26 @@ discard block | ||
| 484 | 484 | * @return void | 
| 485 | 485 | */ | 
| 486 | 486 |  function give_reports_graph_controls() { | 
| 487 | - $date_options = apply_filters( 'give_report_date_options', array( | |
| 488 | - 'today' => esc_html__( 'Today', 'give' ), | |
| 489 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), | |
| 490 | - 'this_week' => esc_html__( 'This Week', 'give' ), | |
| 491 | - 'last_week' => esc_html__( 'Last Week', 'give' ), | |
| 492 | - 'this_month' => esc_html__( 'This Month', 'give' ), | |
| 493 | - 'last_month' => esc_html__( 'Last Month', 'give' ), | |
| 494 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), | |
| 495 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), | |
| 496 | - 'this_year' => esc_html__( 'This Year', 'give' ), | |
| 497 | - 'last_year' => esc_html__( 'Last Year', 'give' ), | |
| 498 | - 'other' => esc_html__( 'Custom', 'give' ) | |
| 499 | - ) ); | |
| 487 | +	$date_options = apply_filters('give_report_date_options', array( | |
| 488 | +		'today'        => esc_html__('Today', 'give'), | |
| 489 | +		'yesterday'    => esc_html__('Yesterday', 'give'), | |
| 490 | +		'this_week'    => esc_html__('This Week', 'give'), | |
| 491 | +		'last_week'    => esc_html__('Last Week', 'give'), | |
| 492 | +		'this_month'   => esc_html__('This Month', 'give'), | |
| 493 | +		'last_month'   => esc_html__('Last Month', 'give'), | |
| 494 | +		'this_quarter' => esc_html__('This Quarter', 'give'), | |
| 495 | +		'last_quarter' => esc_html__('Last Quarter', 'give'), | |
| 496 | +		'this_year'    => esc_html__('This Year', 'give'), | |
| 497 | +		'last_year'    => esc_html__('Last Year', 'give'), | |
| 498 | +		'other'        => esc_html__('Custom', 'give') | |
| 499 | + )); | |
| 500 | 500 | |
| 501 | 501 | $dates = give_get_report_dates(); | 
| 502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; | 
| 503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; | |
| 503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; | |
| 504 | 504 | |
| 505 | -	if ( empty( $dates['day_end'] ) ) { | |
| 506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); | |
| 505 | +	if (empty($dates['day_end'])) { | |
| 506 | +		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); | |
| 507 | 507 | } | 
| 508 | 508 | |
| 509 | 509 | /** | 
| @@ -511,7 +511,7 @@ discard block | ||
| 511 | 511 | * | 
| 512 | 512 | * @since 1.0 | 
| 513 | 513 | */ | 
| 514 | - do_action( 'give_report_graph_controls_before' ); | |
| 514 | +	do_action('give_report_graph_controls_before'); | |
| 515 | 515 | ?> | 
| 516 | 516 | <form id="give-graphs-filter" method="get"> | 
| 517 | 517 | <div class="tablenav top"> | 
| @@ -519,56 +519,56 @@ discard block | ||
| 519 | 519 | |
| 520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> | 
| 521 | 521 | <input type="hidden" name="page" value="give-reports" /> | 
| 522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> | |
| 522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> | |
| 523 | 523 | |
| 524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> | |
| 525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> | |
| 524 | + <?php if (isset($_GET['form-id'])) : ?> | |
| 525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> | |
| 526 | 526 | <?php endif; ?> | 
| 527 | 527 | |
| 528 | 528 | <div id="give-graphs-date-options-wrap"> | 
| 529 | 529 | <select id="give-graphs-date-options" name="range"> | 
| 530 | - <?php foreach ( $date_options as $key => $option ) : ?> | |
| 531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> | |
| 530 | + <?php foreach ($date_options as $key => $option) : ?> | |
| 531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> | |
| 532 | 532 | <?php endforeach; ?> | 
| 533 | 533 | </select> | 
| 534 | 534 | |
| 535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> | |
| 536 | - <span class="screen-reader-text"><?php esc_html_e( 'From', 'give' ); ?> </span> | |
| 535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> | |
| 536 | +						<span class="screen-reader-text"><?php esc_html_e('From', 'give'); ?> </span> | |
| 537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> | 
| 538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> | |
| 539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> | |
| 538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> | |
| 539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> | |
| 540 | 540 | <?php endfor; ?> | 
| 541 | 541 | </select> | 
| 542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> | 
| 543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> | |
| 544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> | |
| 543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> | |
| 544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> | |
| 545 | 545 | <?php endfor; ?> | 
| 546 | 546 | </select> | 
| 547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> | 
| 548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> | |
| 549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> | |
| 548 | +							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?> | |
| 549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> | |
| 550 | 550 | <?php endfor; ?> | 
| 551 | 551 | </select> | 
| 552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> | |
| 552 | +						<span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> | |
| 553 | 553 | <span>–</span> | 
| 554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> | 
| 555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> | |
| 556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> | |
| 555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> | |
| 556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> | |
| 557 | 557 | <?php endfor; ?> | 
| 558 | 558 | </select> | 
| 559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> | 
| 560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> | |
| 561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> | |
| 560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> | |
| 561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> | |
| 562 | 562 | <?php endfor; ?> | 
| 563 | 563 | </select> | 
| 564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> | 
| 565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> | |
| 566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> | |
| 565 | +							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?> | |
| 566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> | |
| 567 | 567 | <?php endfor; ?> | 
| 568 | 568 | </select> | 
| 569 | 569 | </div> | 
| 570 | 570 | |
| 571 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> | |
| 571 | +					<input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> | |
| 572 | 572 | </div> | 
| 573 | 573 | |
| 574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> | 
| @@ -581,7 +581,7 @@ discard block | ||
| 581 | 581 | * | 
| 582 | 582 | * @since 1.0 | 
| 583 | 583 | */ | 
| 584 | - do_action( 'give_report_graph_controls_after' ); | |
| 584 | +	do_action('give_report_graph_controls_after'); | |
| 585 | 585 | } | 
| 586 | 586 | |
| 587 | 587 | /** | 
| @@ -596,65 +596,65 @@ discard block | ||
| 596 | 596 |  function give_get_report_dates() { | 
| 597 | 597 | $dates = array(); | 
| 598 | 598 | |
| 599 | - $current_time = current_time( 'timestamp' ); | |
| 599 | +	$current_time = current_time('timestamp'); | |
| 600 | 600 | |
| 601 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; | |
| 602 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); | |
| 603 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); | |
| 604 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; | |
| 605 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; | |
| 606 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; | |
| 607 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); | |
| 601 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; | |
| 602 | +	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y'); | |
| 603 | +	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); | |
| 604 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; | |
| 605 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; | |
| 606 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; | |
| 607 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); | |
| 608 | 608 | |
| 609 | 609 | // Modify dates based on predefined ranges | 
| 610 | - switch ( $dates['range'] ) : | |
| 610 | + switch ($dates['range']) : | |
| 611 | 611 | |
| 612 | 612 | case 'this_month' : | 
| 613 | - $dates['m_start'] = date( 'n', $current_time ); | |
| 614 | - $dates['m_end'] = date( 'n', $current_time ); | |
| 613 | +			$dates['m_start']  = date('n', $current_time); | |
| 614 | +			$dates['m_end']    = date('n', $current_time); | |
| 615 | 615 | $dates['day'] = 1; | 
| 616 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); | |
| 617 | - $dates['year'] = date( 'Y' ); | |
| 618 | - $dates['year_end'] = date( 'Y' ); | |
| 616 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); | |
| 617 | +			$dates['year']     = date('Y'); | |
| 618 | +			$dates['year_end'] = date('Y'); | |
| 619 | 619 | break; | 
| 620 | 620 | |
| 621 | 621 | case 'last_month' : | 
| 622 | -			if ( date( 'n' ) == 1 ) { | |
| 622 | +			if (date('n') == 1) { | |
| 623 | 623 | $dates['m_start'] = 12; | 
| 624 | 624 | $dates['m_end'] = 12; | 
| 625 | - $dates['year'] = date( 'Y', $current_time ) - 1; | |
| 626 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; | |
| 625 | +				$dates['year']     = date('Y', $current_time) - 1; | |
| 626 | +				$dates['year_end'] = date('Y', $current_time) - 1; | |
| 627 | 627 |  			} else { | 
| 628 | - $dates['m_start'] = date( 'n' ) - 1; | |
| 629 | - $dates['m_end'] = date( 'n' ) - 1; | |
| 628 | +				$dates['m_start']  = date('n') - 1; | |
| 629 | +				$dates['m_end']    = date('n') - 1; | |
| 630 | 630 | $dates['year_end'] = $dates['year']; | 
| 631 | 631 | } | 
| 632 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); | |
| 632 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); | |
| 633 | 633 | break; | 
| 634 | 634 | |
| 635 | 635 | case 'today' : | 
| 636 | - $dates['day'] = date( 'd', $current_time ); | |
| 637 | - $dates['m_start'] = date( 'n', $current_time ); | |
| 638 | - $dates['m_end'] = date( 'n', $current_time ); | |
| 639 | - $dates['year'] = date( 'Y', $current_time ); | |
| 636 | +			$dates['day']     = date('d', $current_time); | |
| 637 | +			$dates['m_start'] = date('n', $current_time); | |
| 638 | +			$dates['m_end']   = date('n', $current_time); | |
| 639 | +			$dates['year']    = date('Y', $current_time); | |
| 640 | 640 | break; | 
| 641 | 641 | |
| 642 | 642 | case 'yesterday' : | 
| 643 | 643 | |
| 644 | - $year = date( 'Y', $current_time ); | |
| 645 | - $month = date( 'n', $current_time ); | |
| 646 | - $day = date( 'd', $current_time ); | |
| 644 | +			$year  = date('Y', $current_time); | |
| 645 | +			$month = date('n', $current_time); | |
| 646 | +			$day   = date('d', $current_time); | |
| 647 | 647 | |
| 648 | -			if ( $month == 1 && $day == 1 ) { | |
| 648 | +			if ($month == 1 && $day == 1) { | |
| 649 | 649 | |
| 650 | 650 | $year -= 1; | 
| 651 | 651 | $month = 12; | 
| 652 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); | |
| 652 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); | |
| 653 | 653 | |
| 654 | -			} elseif ( $month > 1 && $day == 1 ) { | |
| 654 | +			} elseif ($month > 1 && $day == 1) { | |
| 655 | 655 | |
| 656 | 656 | $month -= 1; | 
| 657 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); | |
| 657 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); | |
| 658 | 658 | |
| 659 | 659 |  			} else { | 
| 660 | 660 | |
| @@ -670,91 +670,91 @@ discard block | ||
| 670 | 670 | break; | 
| 671 | 671 | |
| 672 | 672 | case 'this_week' : | 
| 673 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; | |
| 674 | - $dates['day'] += get_option( 'start_of_week' ); | |
| 673 | +			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; | |
| 674 | +			$dates['day'] += get_option('start_of_week'); | |
| 675 | 675 | $dates['day_end'] = $dates['day'] + 6; | 
| 676 | - $dates['m_start'] = date( 'n', $current_time ); | |
| 677 | - $dates['m_end'] = date( 'n', $current_time ); | |
| 678 | - $dates['year'] = date( 'Y', $current_time ); | |
| 676 | +			$dates['m_start'] = date('n', $current_time); | |
| 677 | +			$dates['m_end']   = date('n', $current_time); | |
| 678 | +			$dates['year']    = date('Y', $current_time); | |
| 679 | 679 | break; | 
| 680 | 680 | |
| 681 | 681 | case 'last_week' : | 
| 682 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; | |
| 683 | - $dates['day'] += get_option( 'start_of_week' ); | |
| 682 | +			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; | |
| 683 | +			$dates['day'] += get_option('start_of_week'); | |
| 684 | 684 | $dates['day_end'] = $dates['day'] + 6; | 
| 685 | - $dates['year'] = date( 'Y' ); | |
| 686 | - | |
| 687 | -			if ( date( 'j', $current_time ) <= 7 ) { | |
| 688 | - $dates['m_start'] = date( 'n', $current_time ) - 1; | |
| 689 | - $dates['m_end'] = date( 'n', $current_time ) - 1; | |
| 690 | -				if ( $dates['m_start'] <= 1 ) { | |
| 691 | - $dates['year'] = date( 'Y', $current_time ) - 1; | |
| 692 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; | |
| 685 | +			$dates['year']    = date('Y'); | |
| 686 | + | |
| 687 | +			if (date('j', $current_time) <= 7) { | |
| 688 | +				$dates['m_start'] = date('n', $current_time) - 1; | |
| 689 | +				$dates['m_end']   = date('n', $current_time) - 1; | |
| 690 | +				if ($dates['m_start'] <= 1) { | |
| 691 | +					$dates['year']     = date('Y', $current_time) - 1; | |
| 692 | +					$dates['year_end'] = date('Y', $current_time) - 1; | |
| 693 | 693 | } | 
| 694 | 694 |  			} else { | 
| 695 | - $dates['m_start'] = date( 'n', $current_time ); | |
| 696 | - $dates['m_end'] = date( 'n', $current_time ); | |
| 695 | +				$dates['m_start'] = date('n', $current_time); | |
| 696 | +				$dates['m_end']   = date('n', $current_time); | |
| 697 | 697 | } | 
| 698 | 698 | break; | 
| 699 | 699 | |
| 700 | 700 | case 'this_quarter' : | 
| 701 | - $month_now = date( 'n', $current_time ); | |
| 701 | +			$month_now = date('n', $current_time); | |
| 702 | 702 | |
| 703 | -			if ( $month_now <= 3 ) { | |
| 703 | +			if ($month_now <= 3) { | |
| 704 | 704 | |
| 705 | 705 | $dates['m_start'] = 1; | 
| 706 | 706 | $dates['m_end'] = 4; | 
| 707 | - $dates['year'] = date( 'Y', $current_time ); | |
| 707 | +				$dates['year']    = date('Y', $current_time); | |
| 708 | 708 | |
| 709 | -			} else if ( $month_now <= 6 ) { | |
| 709 | +			} else if ($month_now <= 6) { | |
| 710 | 710 | |
| 711 | 711 | $dates['m_start'] = 4; | 
| 712 | 712 | $dates['m_end'] = 7; | 
| 713 | - $dates['year'] = date( 'Y', $current_time ); | |
| 713 | +				$dates['year']    = date('Y', $current_time); | |
| 714 | 714 | |
| 715 | -			} else if ( $month_now <= 9 ) { | |
| 715 | +			} else if ($month_now <= 9) { | |
| 716 | 716 | |
| 717 | 717 | $dates['m_start'] = 7; | 
| 718 | 718 | $dates['m_end'] = 10; | 
| 719 | - $dates['year'] = date( 'Y', $current_time ); | |
| 719 | +				$dates['year']    = date('Y', $current_time); | |
| 720 | 720 | |
| 721 | 721 |  			} else { | 
| 722 | 722 | |
| 723 | 723 | $dates['m_start'] = 10; | 
| 724 | 724 | $dates['m_end'] = 1; | 
| 725 | - $dates['year'] = date( 'Y', $current_time ); | |
| 726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; | |
| 725 | +				$dates['year']     = date('Y', $current_time); | |
| 726 | +				$dates['year_end'] = date('Y', $current_time) + 1; | |
| 727 | 727 | |
| 728 | 728 | } | 
| 729 | 729 | break; | 
| 730 | 730 | |
| 731 | 731 | case 'last_quarter' : | 
| 732 | - $month_now = date( 'n' ); | |
| 732 | +			$month_now = date('n'); | |
| 733 | 733 | |
| 734 | -			if ( $month_now <= 3 ) { | |
| 734 | +			if ($month_now <= 3) { | |
| 735 | 735 | |
| 736 | 736 | $dates['m_start'] = 10; | 
| 737 | 737 | $dates['m_end'] = 12; | 
| 738 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year | |
| 739 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year | |
| 738 | +				$dates['year']     = date('Y', $current_time) - 1; // Previous year | |
| 739 | +				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year | |
| 740 | 740 | |
| 741 | -			} else if ( $month_now <= 6 ) { | |
| 741 | +			} else if ($month_now <= 6) { | |
| 742 | 742 | |
| 743 | 743 | $dates['m_start'] = 1; | 
| 744 | 744 | $dates['m_end'] = 3; | 
| 745 | - $dates['year'] = date( 'Y', $current_time ); | |
| 745 | +				$dates['year']    = date('Y', $current_time); | |
| 746 | 746 | |
| 747 | -			} else if ( $month_now <= 9 ) { | |
| 747 | +			} else if ($month_now <= 9) { | |
| 748 | 748 | |
| 749 | 749 | $dates['m_start'] = 4; | 
| 750 | 750 | $dates['m_end'] = 6; | 
| 751 | - $dates['year'] = date( 'Y', $current_time ); | |
| 751 | +				$dates['year']    = date('Y', $current_time); | |
| 752 | 752 | |
| 753 | 753 |  			} else { | 
| 754 | 754 | |
| 755 | 755 | $dates['m_start'] = 7; | 
| 756 | 756 | $dates['m_end'] = 9; | 
| 757 | - $dates['year'] = date( 'Y', $current_time ); | |
| 757 | +				$dates['year']    = date('Y', $current_time); | |
| 758 | 758 | |
| 759 | 759 | } | 
| 760 | 760 | break; | 
| @@ -762,19 +762,19 @@ discard block | ||
| 762 | 762 | case 'this_year' : | 
| 763 | 763 | $dates['m_start'] = 1; | 
| 764 | 764 | $dates['m_end'] = 12; | 
| 765 | - $dates['year'] = date( 'Y', $current_time ); | |
| 765 | +			$dates['year']    = date('Y', $current_time); | |
| 766 | 766 | break; | 
| 767 | 767 | |
| 768 | 768 | case 'last_year' : | 
| 769 | 769 | $dates['m_start'] = 1; | 
| 770 | 770 | $dates['m_end'] = 12; | 
| 771 | - $dates['year'] = date( 'Y', $current_time ) - 1; | |
| 772 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; | |
| 771 | +			$dates['year']     = date('Y', $current_time) - 1; | |
| 772 | +			$dates['year_end'] = date('Y', $current_time) - 1; | |
| 773 | 773 | break; | 
| 774 | 774 | |
| 775 | 775 | endswitch; | 
| 776 | 776 | |
| 777 | - return apply_filters( 'give_report_dates', $dates ); | |
| 777 | +	return apply_filters('give_report_dates', $dates); | |
| 778 | 778 | } | 
| 779 | 779 | |
| 780 | 780 | /** | 
| @@ -785,18 +785,18 @@ discard block | ||
| 785 | 785 | * | 
| 786 | 786 | * @param $data | 
| 787 | 787 | */ | 
| 788 | -function give_parse_report_dates( $data ) { | |
| 788 | +function give_parse_report_dates($data) { | |
| 789 | 789 | $dates = give_get_report_dates(); | 
| 790 | 790 | |
| 791 | 791 | $view = give_get_reporting_view(); | 
| 792 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; | |
| 793 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; | |
| 792 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; | |
| 793 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; | |
| 794 | 794 | |
| 795 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); | |
| 795 | +	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); | |
| 796 | 796 | give_die(); | 
| 797 | 797 | } | 
| 798 | 798 | |
| 799 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); | |
| 799 | +add_action('give_filter_reports', 'give_parse_report_dates'); | |
| 800 | 800 | |
| 801 | 801 | |
| 802 | 802 | /** | 
| @@ -808,22 +808,22 @@ discard block | ||
| 808 | 808 | */ | 
| 809 | 809 |  function give_reports_refresh_button() { | 
| 810 | 810 | |
| 811 | - $url = wp_nonce_url( add_query_arg( array( | |
| 811 | + $url = wp_nonce_url(add_query_arg(array( | |
| 812 | 812 | 'give_action' => 'refresh_reports_transients', | 
| 813 | 813 | 'give-message' => 'refreshed-reports' | 
| 814 | - ) ), 'give-refresh-reports' ); | |
| 814 | + )), 'give-refresh-reports'); | |
| 815 | 815 | |
| 816 | 816 | echo '<a href="' | 
| 817 | - . esc_url_raw( $url ) | |
| 818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) | |
| 817 | + . esc_url_raw($url) | |
| 818 | +	     . '" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give') | |
| 819 | 819 | . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' | 
| 820 | 820 | . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' | 
| 821 | - . esc_html__( 'Refresh Report Data', 'give' ) | |
| 821 | +	     . esc_html__('Refresh Report Data', 'give') | |
| 822 | 822 | . '</a>'; | 
| 823 | 823 | |
| 824 | 824 | } | 
| 825 | 825 | |
| 826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); | |
| 826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); | |
| 827 | 827 | |
| 828 | 828 | /** | 
| 829 | 829 | * Trigger the refresh of reports transients | 
| @@ -834,18 +834,18 @@ discard block | ||
| 834 | 834 | * | 
| 835 | 835 | * @return void | 
| 836 | 836 | */ | 
| 837 | -function give_run_refresh_reports_transients( $data ) { | |
| 837 | +function give_run_refresh_reports_transients($data) { | |
| 838 | 838 | |
| 839 | -	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { | |
| 839 | +	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { | |
| 840 | 840 | return; | 
| 841 | 841 | } | 
| 842 | 842 | |
| 843 | 843 | //Delete transients | 
| 844 | - delete_transient( 'give_estimated_monthly_stats' ); | |
| 845 | - delete_transient( 'give_earnings_total' ); | |
| 846 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); | |
| 847 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); | |
| 844 | +	delete_transient('give_estimated_monthly_stats'); | |
| 845 | +	delete_transient('give_earnings_total'); | |
| 846 | +	delete_transient(md5('give_earnings_this_monththis_month')); | |
| 847 | +	delete_transient(md5('give_earnings_todaytoday')); | |
| 848 | 848 | |
| 849 | 849 | } | 
| 850 | 850 | |
| 851 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); | |
| 852 | 851 | \ No newline at end of file | 
| 852 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); | |
| 853 | 853 | \ No newline at end of file | 
| @@ -477,7 +477,7 @@ | ||
| 477 | 477 | * | 
| 478 | 478 | * @param int $payment_id | 
| 479 | 479 | * | 
| 480 | - * @return int payment_id | |
| 480 | + * @return string payment_id | |
| 481 | 481 | */ | 
| 482 | 482 |  function give_email_tag_payment_id( $payment_id ) { | 
| 483 | 483 | return give_get_payment_number( $payment_id ); | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | */ | 
| 24 | 24 | |
| 25 | 25 | // Exit if accessed directly. | 
| 26 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 26 | +if ( ! defined('ABSPATH')) { | |
| 27 | 27 | exit; | 
| 28 | 28 | } | 
| 29 | 29 | |
| @@ -55,9 +55,9 @@ discard block | ||
| 55 | 55 | * @param string $description Email tag description text | 
| 56 | 56 | * @param callable $func Hook to run when email tag is found | 
| 57 | 57 | */ | 
| 58 | -	public function add( $tag, $description, $func ) { | |
| 59 | -		if ( is_callable( $func ) ) { | |
| 60 | - $this->tags[ $tag ] = array( | |
| 58 | +	public function add($tag, $description, $func) { | |
| 59 | +		if (is_callable($func)) { | |
| 60 | + $this->tags[$tag] = array( | |
| 61 | 61 | 'tag' => $tag, | 
| 62 | 62 | 'description' => $description, | 
| 63 | 63 | 'func' => $func | 
| @@ -72,8 +72,8 @@ discard block | ||
| 72 | 72 | * | 
| 73 | 73 | * @param string $tag Email tag to remove hook from | 
| 74 | 74 | */ | 
| 75 | -	public function remove( $tag ) { | |
| 76 | - unset( $this->tags[ $tag ] ); | |
| 75 | +	public function remove($tag) { | |
| 76 | + unset($this->tags[$tag]); | |
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | 79 | /** | 
| @@ -85,8 +85,8 @@ discard block | ||
| 85 | 85 | * | 
| 86 | 86 | * @return bool | 
| 87 | 87 | */ | 
| 88 | -	public function email_tag_exists( $tag ) { | |
| 89 | - return array_key_exists( $tag, $this->tags ); | |
| 88 | +	public function email_tag_exists($tag) { | |
| 89 | + return array_key_exists($tag, $this->tags); | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | /** | 
| @@ -110,16 +110,16 @@ discard block | ||
| 110 | 110 | * | 
| 111 | 111 | * @return string Content with email tags filtered out. | 
| 112 | 112 | */ | 
| 113 | -	public function do_tags( $content, $payment_id ) { | |
| 113 | +	public function do_tags($content, $payment_id) { | |
| 114 | 114 | |
| 115 | 115 | // Check if there is at least one tag added. | 
| 116 | -		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { | |
| 116 | +		if (empty($this->tags) || ! is_array($this->tags)) { | |
| 117 | 117 | return $content; | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | 120 | $this->payment_id = $payment_id; | 
| 121 | 121 | |
| 122 | -		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); | |
| 122 | +		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); | |
| 123 | 123 | |
| 124 | 124 | $this->payment_id = null; | 
| 125 | 125 | |
| @@ -135,17 +135,17 @@ discard block | ||
| 135 | 135 | * | 
| 136 | 136 | * @return mixed | 
| 137 | 137 | */ | 
| 138 | -	public function do_tag( $m ) { | |
| 138 | +	public function do_tag($m) { | |
| 139 | 139 | |
| 140 | 140 | // Get tag | 
| 141 | 141 | $tag = $m[1]; | 
| 142 | 142 | |
| 143 | 143 | // Return tag if tag not set | 
| 144 | -		if ( ! $this->email_tag_exists( $tag ) ) { | |
| 144 | +		if ( ! $this->email_tag_exists($tag)) { | |
| 145 | 145 | return $m[0]; | 
| 146 | 146 | } | 
| 147 | 147 | |
| 148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); | |
| 148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); | |
| 149 | 149 | } | 
| 150 | 150 | |
| 151 | 151 | } | 
| @@ -159,8 +159,8 @@ discard block | ||
| 159 | 159 | * @param string $description Description of the email tag added | 
| 160 | 160 | * @param callable $func Hook to run when email tag is found | 
| 161 | 161 | */ | 
| 162 | -function give_add_email_tag( $tag, $description, $func ) { | |
| 163 | - Give()->email_tags->add( $tag, $description, $func ); | |
| 162 | +function give_add_email_tag($tag, $description, $func) { | |
| 163 | + Give()->email_tags->add($tag, $description, $func); | |
| 164 | 164 | } | 
| 165 | 165 | |
| 166 | 166 | /** | 
| @@ -170,8 +170,8 @@ discard block | ||
| 170 | 170 | * | 
| 171 | 171 | * @param string $tag Email tag to remove hook from | 
| 172 | 172 | */ | 
| 173 | -function give_remove_email_tag( $tag ) { | |
| 174 | - Give()->email_tags->remove( $tag ); | |
| 173 | +function give_remove_email_tag($tag) { | |
| 174 | + Give()->email_tags->remove($tag); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | /** | 
| @@ -183,8 +183,8 @@ discard block | ||
| 183 | 183 | * | 
| 184 | 184 | * @return bool | 
| 185 | 185 | */ | 
| 186 | -function give_email_tag_exists( $tag ) { | |
| 187 | - return Give()->email_tags->email_tag_exists( $tag ); | |
| 186 | +function give_email_tag_exists($tag) { | |
| 187 | + return Give()->email_tags->email_tag_exists($tag); | |
| 188 | 188 | } | 
| 189 | 189 | |
| 190 | 190 | /** | 
| @@ -211,9 +211,9 @@ discard block | ||
| 211 | 211 | $email_tags = give_get_email_tags(); | 
| 212 | 212 | |
| 213 | 213 | ob_start(); | 
| 214 | - if ( count( $email_tags ) > 0 ) : ?> | |
| 214 | + if (count($email_tags) > 0) : ?> | |
| 215 | 215 | <div class="give-email-tags-wrap"> | 
| 216 | - <?php foreach ( $email_tags as $email_tag ) : ?> | |
| 216 | + <?php foreach ($email_tags as $email_tag) : ?> | |
| 217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> | 
| 218 | 218 |  					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> | 
| 219 | 219 | </span> | 
| @@ -235,12 +235,12 @@ discard block | ||
| 235 | 235 | * | 
| 236 | 236 | * @return string Content with email tags filtered out. | 
| 237 | 237 | */ | 
| 238 | -function give_do_email_tags( $content, $payment_id ) { | |
| 238 | +function give_do_email_tags($content, $payment_id) { | |
| 239 | 239 | |
| 240 | 240 | // Replace all tags | 
| 241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); | |
| 241 | + $content = Give()->email_tags->do_tags($content, $payment_id); | |
| 242 | 242 | |
| 243 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); | |
| 243 | +	$content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); | |
| 244 | 244 | |
| 245 | 245 | // Return content | 
| 246 | 246 | return $content; | 
| @@ -259,10 +259,10 @@ discard block | ||
| 259 | 259 | * | 
| 260 | 260 | * @since 1.0 | 
| 261 | 261 | */ | 
| 262 | - do_action( 'give_add_email_tags' ); | |
| 262 | +	do_action('give_add_email_tags'); | |
| 263 | 263 | } | 
| 264 | 264 | |
| 265 | -add_action( 'init', 'give_load_email_tags', - 999 ); | |
| 265 | +add_action('init', 'give_load_email_tags', - 999); | |
| 266 | 266 | |
| 267 | 267 | /** | 
| 268 | 268 | * Add default Give email template tags. | 
| @@ -275,97 +275,97 @@ discard block | ||
| 275 | 275 | $email_tags = array( | 
| 276 | 276 | array( | 
| 277 | 277 | 'tag' => 'donation', | 
| 278 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), | |
| 278 | +			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), | |
| 279 | 279 | 'function' => 'give_email_tag_donation' | 
| 280 | 280 | ), | 
| 281 | 281 | array( | 
| 282 | 282 | 'tag' => 'form_title', | 
| 283 | - 'description' => esc_html__( 'The donation form name.', 'give' ), | |
| 283 | +			'description' => esc_html__('The donation form name.', 'give'), | |
| 284 | 284 | 'function' => 'give_email_tag_form_title' | 
| 285 | 285 | ), | 
| 286 | 286 | array( | 
| 287 | 287 | 'tag' => 'amount', | 
| 288 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), | |
| 288 | +			'description' => esc_html__('The total donation amount with currency sign.', 'give'), | |
| 289 | 289 | 'function' => 'give_email_tag_amount' | 
| 290 | 290 | ), | 
| 291 | 291 | array( | 
| 292 | 292 | 'tag' => 'price', | 
| 293 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), | |
| 293 | +			'description' => esc_html__('The total donation amount with currency sign.', 'give'), | |
| 294 | 294 | 'function' => 'give_email_tag_price' | 
| 295 | 295 | ), | 
| 296 | 296 | array( | 
| 297 | 297 | 'tag' => 'name', | 
| 298 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), | |
| 298 | +			'description' => esc_html__('The donor\'s first name.', 'give'), | |
| 299 | 299 | 'function' => 'give_email_tag_first_name' | 
| 300 | 300 | ), | 
| 301 | 301 | array( | 
| 302 | 302 | 'tag' => 'fullname', | 
| 303 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), | |
| 303 | +			'description' => esc_html__('The donor\'s full name, first and last.', 'give'), | |
| 304 | 304 | 'function' => 'give_email_tag_fullname' | 
| 305 | 305 | ), | 
| 306 | 306 | array( | 
| 307 | 307 | 'tag' => 'username', | 
| 308 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), | |
| 308 | +			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), | |
| 309 | 309 | 'function' => 'give_email_tag_username' | 
| 310 | 310 | ), | 
| 311 | 311 | array( | 
| 312 | 312 | 'tag' => 'user_email', | 
| 313 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), | |
| 313 | +			'description' => esc_html__('The donor\'s email address.', 'give'), | |
| 314 | 314 | 'function' => 'give_email_tag_user_email' | 
| 315 | 315 | ), | 
| 316 | 316 | array( | 
| 317 | 317 | 'tag' => 'billing_address', | 
| 318 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), | |
| 318 | +			'description' => esc_html__('The donor\'s billing address.', 'give'), | |
| 319 | 319 | 'function' => 'give_email_tag_billing_address' | 
| 320 | 320 | ), | 
| 321 | 321 | array( | 
| 322 | 322 | 'tag' => 'date', | 
| 323 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), | |
| 323 | +			'description' => esc_html__('The date of the donation.', 'give'), | |
| 324 | 324 | 'function' => 'give_email_tag_date' | 
| 325 | 325 | ), | 
| 326 | 326 | array( | 
| 327 | 327 | 'tag' => 'payment_id', | 
| 328 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), | |
| 328 | +			'description' => esc_html__('The unique ID number for this donation.', 'give'), | |
| 329 | 329 | 'function' => 'give_email_tag_payment_id' | 
| 330 | 330 | ), | 
| 331 | 331 | array( | 
| 332 | 332 | 'tag' => 'receipt_id', | 
| 333 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), | |
| 333 | +			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), | |
| 334 | 334 | 'function' => 'give_email_tag_receipt_id' | 
| 335 | 335 | ), | 
| 336 | 336 | array( | 
| 337 | 337 | 'tag' => 'payment_method', | 
| 338 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), | |
| 338 | +			'description' => esc_html__('The method of payment used for this donation.', 'give'), | |
| 339 | 339 | 'function' => 'give_email_tag_payment_method' | 
| 340 | 340 | ), | 
| 341 | 341 | array( | 
| 342 | 342 | 'tag' => 'sitename', | 
| 343 | - 'description' => esc_html__( 'The name of your site.', 'give' ), | |
| 343 | +			'description' => esc_html__('The name of your site.', 'give'), | |
| 344 | 344 | 'function' => 'give_email_tag_sitename' | 
| 345 | 345 | ), | 
| 346 | 346 | array( | 
| 347 | 347 | 'tag' => 'receipt_link', | 
| 348 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), | |
| 348 | +			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), | |
| 349 | 349 | 'function' => 'give_email_tag_receipt_link' | 
| 350 | 350 | ), | 
| 351 | 351 | array( | 
| 352 | 352 | 'tag' => 'receipt_link_url', | 
| 353 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), | |
| 353 | +			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), | |
| 354 | 354 | 'function' => 'give_email_tag_receipt_link_url' | 
| 355 | 355 | ), | 
| 356 | 356 | ); | 
| 357 | 357 | |
| 358 | 358 | // Apply give_email_tags filter | 
| 359 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); | |
| 359 | +	$email_tags = apply_filters('give_email_tags', $email_tags); | |
| 360 | 360 | |
| 361 | 361 | // Add email tags | 
| 362 | -	foreach ( $email_tags as $email_tag ) { | |
| 363 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); | |
| 362 | +	foreach ($email_tags as $email_tag) { | |
| 363 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); | |
| 364 | 364 | } | 
| 365 | 365 | |
| 366 | 366 | } | 
| 367 | 367 | |
| 368 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); | |
| 368 | +add_action('give_add_email_tags', 'give_setup_email_tags'); | |
| 369 | 369 | |
| 370 | 370 | |
| 371 | 371 | /** | 
| @@ -377,15 +377,15 @@ discard block | ||
| 377 | 377 | * | 
| 378 | 378 | * @return string name | 
| 379 | 379 | */ | 
| 380 | -function give_email_tag_first_name( $payment_id ) { | |
| 381 | - $payment = new Give_Payment( $payment_id ); | |
| 380 | +function give_email_tag_first_name($payment_id) { | |
| 381 | + $payment = new Give_Payment($payment_id); | |
| 382 | 382 | $user_info = $payment->user_info; | 
| 383 | 383 | |
| 384 | -	if ( empty( $user_info ) ) { | |
| 384 | +	if (empty($user_info)) { | |
| 385 | 385 | return ''; | 
| 386 | 386 | } | 
| 387 | 387 | |
| 388 | - $email_name = give_get_email_names( $user_info ); | |
| 388 | + $email_name = give_get_email_names($user_info); | |
| 389 | 389 | |
| 390 | 390 | return $email_name['name']; | 
| 391 | 391 | } | 
| @@ -399,15 +399,15 @@ discard block | ||
| 399 | 399 | * | 
| 400 | 400 | * @return string fullname | 
| 401 | 401 | */ | 
| 402 | -function give_email_tag_fullname( $payment_id ) { | |
| 403 | - $payment = new Give_Payment( $payment_id ); | |
| 402 | +function give_email_tag_fullname($payment_id) { | |
| 403 | + $payment = new Give_Payment($payment_id); | |
| 404 | 404 | $user_info = $payment->user_info; | 
| 405 | 405 | |
| 406 | -	if ( empty( $user_info ) ) { | |
| 406 | +	if (empty($user_info)) { | |
| 407 | 407 | return ''; | 
| 408 | 408 | } | 
| 409 | 409 | |
| 410 | - $email_name = give_get_email_names( $user_info ); | |
| 410 | + $email_name = give_get_email_names($user_info); | |
| 411 | 411 | |
| 412 | 412 | return $email_name['fullname']; | 
| 413 | 413 | } | 
| @@ -421,15 +421,15 @@ discard block | ||
| 421 | 421 | * | 
| 422 | 422 | * @return string username. | 
| 423 | 423 | */ | 
| 424 | -function give_email_tag_username( $payment_id ) { | |
| 425 | - $payment = new Give_Payment( $payment_id ); | |
| 424 | +function give_email_tag_username($payment_id) { | |
| 425 | + $payment = new Give_Payment($payment_id); | |
| 426 | 426 | $user_info = $payment->user_info; | 
| 427 | 427 | |
| 428 | -	if ( empty( $user_info ) ) { | |
| 428 | +	if (empty($user_info)) { | |
| 429 | 429 | return ''; | 
| 430 | 430 | } | 
| 431 | 431 | |
| 432 | - $email_name = give_get_email_names( $user_info ); | |
| 432 | + $email_name = give_get_email_names($user_info); | |
| 433 | 433 | |
| 434 | 434 | return $email_name['username']; | 
| 435 | 435 | } | 
| @@ -443,8 +443,8 @@ discard block | ||
| 443 | 443 | * | 
| 444 | 444 | * @return string user_email | 
| 445 | 445 | */ | 
| 446 | -function give_email_tag_user_email( $payment_id ) { | |
| 447 | - $payment = new Give_Payment( $payment_id ); | |
| 446 | +function give_email_tag_user_email($payment_id) { | |
| 447 | + $payment = new Give_Payment($payment_id); | |
| 448 | 448 | |
| 449 | 449 | return $payment->email; | 
| 450 | 450 | } | 
| @@ -458,9 +458,9 @@ discard block | ||
| 458 | 458 | * | 
| 459 | 459 | * @return string billing_address | 
| 460 | 460 | */ | 
| 461 | -function give_email_tag_billing_address( $payment_id ) { | |
| 462 | - $user_info = give_get_payment_meta_user_info( $payment_id ); | |
| 463 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( | |
| 461 | +function give_email_tag_billing_address($payment_id) { | |
| 462 | + $user_info = give_get_payment_meta_user_info($payment_id); | |
| 463 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( | |
| 464 | 464 | 'line1' => '', | 
| 465 | 465 | 'line2' => '', | 
| 466 | 466 | 'city' => '', | 
| @@ -469,11 +469,11 @@ discard block | ||
| 469 | 469 | 'zip' => '' | 
| 470 | 470 | ); | 
| 471 | 471 | |
| 472 | - $return = $user_address['line1'] . "\n"; | |
| 473 | -	if ( ! empty( $user_address['line2'] ) ) { | |
| 474 | - $return .= $user_address['line2'] . "\n"; | |
| 472 | + $return = $user_address['line1']."\n"; | |
| 473 | +	if ( ! empty($user_address['line2'])) { | |
| 474 | + $return .= $user_address['line2']."\n"; | |
| 475 | 475 | } | 
| 476 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; | |
| 476 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; | |
| 477 | 477 | $return .= $user_address['country']; | 
| 478 | 478 | |
| 479 | 479 | return $return; | 
| @@ -488,10 +488,10 @@ discard block | ||
| 488 | 488 | * | 
| 489 | 489 | * @return string date | 
| 490 | 490 | */ | 
| 491 | -function give_email_tag_date( $payment_id ) { | |
| 492 | - $payment = new Give_Payment( $payment_id ); | |
| 491 | +function give_email_tag_date($payment_id) { | |
| 492 | + $payment = new Give_Payment($payment_id); | |
| 493 | 493 | |
| 494 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); | |
| 494 | + return date_i18n(give_date_format(), strtotime($payment->date)); | |
| 495 | 495 | } | 
| 496 | 496 | |
| 497 | 497 | /** | 
| @@ -503,11 +503,11 @@ discard block | ||
| 503 | 503 | * | 
| 504 | 504 | * @return string amount | 
| 505 | 505 | */ | 
| 506 | -function give_email_tag_amount( $payment_id ) { | |
| 507 | - $payment = new Give_Payment( $payment_id ); | |
| 508 | - $give_amount = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); | |
| 506 | +function give_email_tag_amount($payment_id) { | |
| 507 | + $payment = new Give_Payment($payment_id); | |
| 508 | + $give_amount = give_currency_filter(give_format_amount($payment->total), $payment->currency); | |
| 509 | 509 | |
| 510 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); | |
| 510 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); | |
| 511 | 511 | } | 
| 512 | 512 | |
| 513 | 513 | /** | 
| @@ -519,8 +519,8 @@ discard block | ||
| 519 | 519 | * | 
| 520 | 520 | * @return string price | 
| 521 | 521 | */ | 
| 522 | -function give_email_tag_price( $payment_id ) { | |
| 523 | - return give_email_tag_amount( $payment_id ); | |
| 522 | +function give_email_tag_price($payment_id) { | |
| 523 | + return give_email_tag_amount($payment_id); | |
| 524 | 524 | } | 
| 525 | 525 | |
| 526 | 526 | /** | 
| @@ -532,8 +532,8 @@ discard block | ||
| 532 | 532 | * | 
| 533 | 533 | * @return int payment_id | 
| 534 | 534 | */ | 
| 535 | -function give_email_tag_payment_id( $payment_id ) { | |
| 536 | - $payment = new Give_Payment( $payment_id ); | |
| 535 | +function give_email_tag_payment_id($payment_id) { | |
| 536 | + $payment = new Give_Payment($payment_id); | |
| 537 | 537 | |
| 538 | 538 | return $payment->number; | 
| 539 | 539 | } | 
| @@ -547,8 +547,8 @@ discard block | ||
| 547 | 547 | * | 
| 548 | 548 | * @return string receipt_id | 
| 549 | 549 | */ | 
| 550 | -function give_email_tag_receipt_id( $payment_id ) { | |
| 551 | - $payment = new Give_Payment( $payment_id ); | |
| 550 | +function give_email_tag_receipt_id($payment_id) { | |
| 551 | + $payment = new Give_Payment($payment_id); | |
| 552 | 552 | |
| 553 | 553 | return $payment->key; | 
| 554 | 554 | } | 
| @@ -562,14 +562,14 @@ discard block | ||
| 562 | 562 | * | 
| 563 | 563 | * @return string $form_title | 
| 564 | 564 | */ | 
| 565 | -function give_email_tag_donation( $payment_id ) { | |
| 566 | - $payment = new Give_Payment( $payment_id ); | |
| 565 | +function give_email_tag_donation($payment_id) { | |
| 566 | + $payment = new Give_Payment($payment_id); | |
| 567 | 567 | $payment_meta = $payment->payment_meta; | 
| 568 | - $level_title = give_has_variable_prices( $payment->form_id ); | |
| 568 | + $level_title = give_has_variable_prices($payment->form_id); | |
| 569 | 569 | $separator = $level_title ? '-' : ''; | 
| 570 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); | |
| 570 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); | |
| 571 | 571 | |
| 572 | - return ! empty( $form_title ) ? $form_title : ''; | |
| 572 | + return ! empty($form_title) ? $form_title : ''; | |
| 573 | 573 | |
| 574 | 574 | } | 
| 575 | 575 | |
| @@ -582,11 +582,11 @@ discard block | ||
| 582 | 582 | * | 
| 583 | 583 | * @return string $form_title | 
| 584 | 584 | */ | 
| 585 | -function give_email_tag_form_title( $payment_id ) { | |
| 586 | - $payment = new Give_Payment( $payment_id ); | |
| 585 | +function give_email_tag_form_title($payment_id) { | |
| 586 | + $payment = new Give_Payment($payment_id); | |
| 587 | 587 | $payment_meta = $payment->payment_meta; | 
| 588 | 588 | |
| 589 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : ''; | |
| 589 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : ''; | |
| 590 | 590 | |
| 591 | 591 | } | 
| 592 | 592 | |
| @@ -599,10 +599,10 @@ discard block | ||
| 599 | 599 | * | 
| 600 | 600 | * @return string gateway | 
| 601 | 601 | */ | 
| 602 | -function give_email_tag_payment_method( $payment_id ) { | |
| 603 | - $payment = new Give_Payment( $payment_id ); | |
| 602 | +function give_email_tag_payment_method($payment_id) { | |
| 603 | + $payment = new Give_Payment($payment_id); | |
| 604 | 604 | |
| 605 | - return give_get_gateway_checkout_label( $payment->gateway ); | |
| 605 | + return give_get_gateway_checkout_label($payment->gateway); | |
| 606 | 606 | } | 
| 607 | 607 | |
| 608 | 608 | /** | 
| @@ -614,8 +614,8 @@ discard block | ||
| 614 | 614 | * | 
| 615 | 615 | * @return string sitename | 
| 616 | 616 | */ | 
| 617 | -function give_email_tag_sitename( $payment_id ) { | |
| 618 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); | |
| 617 | +function give_email_tag_sitename($payment_id) { | |
| 618 | +	return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); | |
| 619 | 619 | } | 
| 620 | 620 | |
| 621 | 621 | /** | 
| @@ -627,19 +627,19 @@ discard block | ||
| 627 | 627 | * | 
| 628 | 628 | * @return string receipt_link | 
| 629 | 629 | */ | 
| 630 | -function give_email_tag_receipt_link( $payment_id ) { | |
| 630 | +function give_email_tag_receipt_link($payment_id) { | |
| 631 | 631 | |
| 632 | - $receipt_url = esc_url( add_query_arg( array( | |
| 633 | - 'payment_key' => give_get_payment_key( $payment_id ), | |
| 632 | + $receipt_url = esc_url(add_query_arg(array( | |
| 633 | + 'payment_key' => give_get_payment_key($payment_id), | |
| 634 | 634 | 'give_action' => 'view_receipt' | 
| 635 | - ), home_url() ) ); | |
| 636 | - $formatted = sprintf( | |
| 635 | + ), home_url())); | |
| 636 | + $formatted = sprintf( | |
| 637 | 637 | '<a href="%1$s">%2$s</a>', | 
| 638 | 638 | $receipt_url, | 
| 639 | - esc_html__( 'View it in your browser', 'give' ) | |
| 639 | +		esc_html__('View it in your browser', 'give') | |
| 640 | 640 | ); | 
| 641 | 641 | |
| 642 | -	if ( give_get_option( 'email_template' ) !== 'none' ) { | |
| 642 | +	if (give_get_option('email_template') !== 'none') { | |
| 643 | 643 | return $formatted; | 
| 644 | 644 |  	} else { | 
| 645 | 645 | return $receipt_url; | 
| @@ -658,12 +658,12 @@ discard block | ||
| 658 | 658 | * | 
| 659 | 659 | * @return string receipt_url | 
| 660 | 660 | */ | 
| 661 | -function give_email_tag_receipt_link_url( $payment_id ) { | |
| 661 | +function give_email_tag_receipt_link_url($payment_id) { | |
| 662 | 662 | |
| 663 | - $receipt_url = esc_url( add_query_arg( array( | |
| 664 | - 'payment_key' => give_get_payment_key( $payment_id ), | |
| 663 | + $receipt_url = esc_url(add_query_arg(array( | |
| 664 | + 'payment_key' => give_get_payment_key($payment_id), | |
| 665 | 665 | 'give_action' => 'view_receipt' | 
| 666 | - ), home_url() ) ); | |
| 666 | + ), home_url())); | |
| 667 | 667 | |
| 668 | 668 | return $receipt_url; | 
| 669 | 669 | |
| @@ -12,7 +12,7 @@ discard block | ||
| 12 | 12 | */ | 
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly | 
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | +if ( ! defined('ABSPATH')) { | |
| 16 | 16 | exit; | 
| 17 | 17 | } | 
| 18 | 18 | |
| @@ -78,15 +78,15 @@ discard block | ||
| 78 | 78 | * | 
| 79 | 79 | * @since 1.0 | 
| 80 | 80 | */ | 
| 81 | -	public function __construct( $_data ) { | |
| 81 | +	public function __construct($_data) { | |
| 82 | 82 | |
| 83 | 83 | $this->data = $_data; | 
| 84 | 84 | |
| 85 | 85 | // Generate unique ID | 
| 86 | - $this->id = md5( rand() ); | |
| 86 | + $this->id = md5(rand()); | |
| 87 | 87 | |
| 88 | 88 | // Setup default options; | 
| 89 | - $this->options = apply_filters( 'give_graph_args', array( | |
| 89 | +		$this->options = apply_filters('give_graph_args', array( | |
| 90 | 90 | 'y_mode' => null, | 
| 91 | 91 | 'x_mode' => null, | 
| 92 | 92 | 'y_decimals' => 0, | 
| @@ -103,7 +103,7 @@ discard block | ||
| 103 | 103 | 'bars' => true, | 
| 104 | 104 | 'lines' => false, | 
| 105 | 105 | 'points' => true | 
| 106 | - ) ); | |
| 106 | + )); | |
| 107 | 107 | |
| 108 | 108 | } | 
| 109 | 109 | |
| @@ -115,8 +115,8 @@ discard block | ||
| 115 | 115 | * | 
| 116 | 116 | * @since 1.0 | 
| 117 | 117 | */ | 
| 118 | -	public function set( $key, $value ) { | |
| 119 | - $this->options[ $key ] = $value; | |
| 118 | +	public function set($key, $value) { | |
| 119 | + $this->options[$key] = $value; | |
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | 122 | /** | 
| @@ -126,8 +126,8 @@ discard block | ||
| 126 | 126 | * | 
| 127 | 127 | * @since 1.0 | 
| 128 | 128 | */ | 
| 129 | -	public function get( $key ) { | |
| 130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; | |
| 129 | +	public function get($key) { | |
| 130 | + return isset($this->options[$key]) ? $this->options[$key] : false; | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | /** | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | * @since 1.0 | 
| 137 | 137 | */ | 
| 138 | 138 |  	public function get_data() { | 
| 139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); | |
| 139 | +		return apply_filters('give_get_graph_data', $this->data, $this); | |
| 140 | 140 | } | 
| 141 | 141 | |
| 142 | 142 | /** | 
| @@ -146,19 +146,19 @@ discard block | ||
| 146 | 146 | */ | 
| 147 | 147 |  	public function load_scripts() { | 
| 148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off | 
| 149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | |
| 149 | +		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | |
| 150 | 150 | |
| 151 | -		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); | |
| 152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); | |
| 151 | +		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); | |
| 152 | +		wp_enqueue_script('jquery-flot-orderbars'); | |
| 153 | 153 | |
| 154 | -		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); | |
| 155 | - wp_enqueue_script( 'jquery-flot-time' ); | |
| 154 | +		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); | |
| 155 | +		wp_enqueue_script('jquery-flot-time'); | |
| 156 | 156 | |
| 157 | -		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); | |
| 158 | - wp_enqueue_script( 'jquery-flot-resize' ); | |
| 157 | +		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); | |
| 158 | +		wp_enqueue_script('jquery-flot-resize'); | |
| 159 | 159 | |
| 160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); | |
| 161 | - wp_enqueue_script( 'jquery-flot' ); | |
| 160 | +		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); | |
| 161 | +		wp_enqueue_script('jquery-flot'); | |
| 162 | 162 | |
| 163 | 163 | } | 
| 164 | 164 | |
| @@ -185,13 +185,13 @@ discard block | ||
| 185 | 185 | [ | 
| 186 | 186 | <?php | 
| 187 | 187 | $order = 0; | 
| 188 | - foreach( $this->get_data() as $label => $data ) : | |
| 188 | + foreach ($this->get_data() as $label => $data) : | |
| 189 | 189 | ?> | 
| 190 | 190 |  						{ | 
| 191 | - label : "<?php echo esc_attr( $label ); ?>", | |
| 192 | - id : "<?php echo sanitize_key( $label ); ?>", | |
| 191 | + label : "<?php echo esc_attr($label); ?>", | |
| 192 | + id : "<?php echo sanitize_key($label); ?>", | |
| 193 | 193 | // data format is: [ point on x, value on y ] | 
| 194 | -							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], | |
| 194 | +							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], | |
| 195 | 195 |  							points: { | 
| 196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, | 
| 197 | 197 | }, | 
| @@ -206,7 +206,7 @@ discard block | ||
| 206 | 206 | fill : true, | 
| 207 | 207 |  								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} | 
| 208 | 208 | }, | 
| 209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> | |
| 209 | + <?php if ($this->options['multiple_y_axes']) : ?> | |
| 210 | 210 | yaxis : <?php echo $yaxis_count; ?> | 
| 211 | 211 | <?php endif; ?> | 
| 212 | 212 | |
| @@ -220,10 +220,10 @@ discard block | ||
| 220 | 220 |  						grid: { | 
| 221 | 221 | show : true, | 
| 222 | 222 | aboveData : false, | 
| 223 | - color : "<?php echo $this->options[ 'color' ]; ?>", | |
| 224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", | |
| 225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", | |
| 226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, | |
| 223 | + color : "<?php echo $this->options['color']; ?>", | |
| 224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", | |
| 225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", | |
| 226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, | |
| 227 | 227 | clickable : false, | 
| 228 | 228 | hoverable : true | 
| 229 | 229 | }, | 
| @@ -234,7 +234,7 @@ discard block | ||
| 234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", | 
| 235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", | 
| 236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", | 
| 237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> | |
| 237 | + <?php if ($this->options['x_mode'] != 'time') : ?> | |
| 238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> | 
| 239 | 239 | <?php endif; ?> | 
| 240 | 240 | }, | 
| @@ -243,7 +243,7 @@ discard block | ||
| 243 | 243 | min : 0, | 
| 244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", | 
| 245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", | 
| 246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> | |
| 246 | + <?php if ($this->options['y_mode'] != 'time') : ?> | |
| 247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> | 
| 248 | 248 | <?php endif; ?> | 
| 249 | 249 | } | 
| @@ -303,9 +303,9 @@ discard block | ||
| 303 | 303 | * @since 1.0 | 
| 304 | 304 | */ | 
| 305 | 305 |  	public function display() { | 
| 306 | - do_action( 'give_before_graph', $this ); | |
| 306 | +		do_action('give_before_graph', $this); | |
| 307 | 307 | echo $this->build_graph(); | 
| 308 | - do_action( 'give_after_graph', $this ); | |
| 308 | +		do_action('give_after_graph', $this); | |
| 309 | 309 | } | 
| 310 | 310 | |
| 311 | 311 | } | 
| @@ -117,8 +117,8 @@ | ||
| 117 | 117 | $shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ); | 
| 118 | 118 | // Only run in admin post/page creation and edit screens | 
| 119 | 119 | if ( in_array( $pagenow, $shortcode_button_pages ) | 
| 120 | - && apply_filters( 'give_shortcode_button_condition', true ) | |
| 121 | - && ! empty( self::$shortcodes ) | |
| 120 | + && apply_filters( 'give_shortcode_button_condition', true ) | |
| 121 | + && ! empty( self::$shortcodes ) | |
| 122 | 122 |  		) { | 
| 123 | 123 | |
| 124 | 124 | $shortcodes = array(); | 
| @@ -113,7 +113,7 @@ | ||
| 113 | 113 | /** | 
| 114 | 114 | * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens. | 
| 115 | 115 | * | 
| 116 | - * @return string|bool | |
| 116 | + * @return false|null | |
| 117 | 117 | * | 
| 118 | 118 | * @since 1.0 | 
| 119 | 119 | */ | 
| @@ -12,7 +12,7 @@ discard block | ||
| 12 | 12 | */ | 
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. | 
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | +if ( ! defined('ABSPATH')) { | |
| 16 | 16 | exit; | 
| 17 | 17 | } | 
| 18 | 18 | |
| @@ -33,16 +33,16 @@ discard block | ||
| 33 | 33 | */ | 
| 34 | 34 |  	public function __construct() { | 
| 35 | 35 | |
| 36 | -		if ( is_admin() ) { | |
| 37 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); | |
| 36 | +		if (is_admin()) { | |
| 37 | +			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); | |
| 38 | 38 | |
| 39 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); | |
| 40 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); | |
| 41 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); | |
| 39 | +			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); | |
| 40 | +			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); | |
| 41 | +			add_action('media_buttons', array($this, 'shortcode_button')); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); | |
| 45 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); | |
| 44 | +		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); | |
| 45 | +		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); | |
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | 48 | /** | 
| @@ -54,15 +54,15 @@ discard block | ||
| 54 | 54 | * | 
| 55 | 55 | * @since 1.0 | 
| 56 | 56 | */ | 
| 57 | -	public function mce_external_plugins( $plugin_array ) { | |
| 57 | +	public function mce_external_plugins($plugin_array) { | |
| 58 | 58 | |
| 59 | -		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { | |
| 59 | +		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { | |
| 60 | 60 | return false; | 
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | |
| 63 | +		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | |
| 64 | 64 | |
| 65 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; | |
| 65 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; | |
| 66 | 66 | |
| 67 | 67 | return $plugin_array; | 
| 68 | 68 | } | 
| @@ -76,12 +76,12 @@ discard block | ||
| 76 | 76 | */ | 
| 77 | 77 |  	public function admin_enqueue_assets() { | 
| 78 | 78 | |
| 79 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | |
| 79 | +		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | |
| 80 | 80 | |
| 81 | 81 | wp_enqueue_script( | 
| 82 | 82 | 'give_shortcode', | 
| 83 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', | |
| 84 | - array( 'jquery' ), | |
| 83 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', | |
| 84 | +			array('jquery'), | |
| 85 | 85 | GIVE_VERSION, | 
| 86 | 86 | true | 
| 87 | 87 | ); | 
| @@ -96,17 +96,17 @@ discard block | ||
| 96 | 96 | */ | 
| 97 | 97 |  	public function admin_localize_scripts() { | 
| 98 | 98 | |
| 99 | -		if ( ! empty( self::$shortcodes ) ) { | |
| 99 | +		if ( ! empty(self::$shortcodes)) { | |
| 100 | 100 | |
| 101 | 101 | $variables = array(); | 
| 102 | 102 | |
| 103 | -			foreach ( self::$shortcodes as $shortcode => $values ) { | |
| 104 | -				if ( ! empty( $values['required'] ) ) { | |
| 105 | - $variables[ $shortcode ] = $values['required']; | |
| 103 | +			foreach (self::$shortcodes as $shortcode => $values) { | |
| 104 | +				if ( ! empty($values['required'])) { | |
| 105 | + $variables[$shortcode] = $values['required']; | |
| 106 | 106 | } | 
| 107 | 107 | } | 
| 108 | 108 | |
| 109 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); | |
| 109 | +			wp_localize_script('give_shortcode', 'scShortcodes', $variables); | |
| 110 | 110 | } | 
| 111 | 111 | } | 
| 112 | 112 | |
| @@ -123,37 +123,37 @@ discard block | ||
| 123 | 123 | |
| 124 | 124 | // If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object. | 
| 125 | 125 | // For example we are loading wp editor by ajax in repeater field. | 
| 126 | -		if ( ! ( $screen instanceof WP_Screen ) ) { | |
| 126 | +		if ( ! ($screen instanceof WP_Screen)) { | |
| 127 | 127 | return false; | 
| 128 | 128 | } | 
| 129 | 129 | |
| 130 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( | |
| 130 | +		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( | |
| 131 | 131 | 'post.php', | 
| 132 | 132 | 'page.php', | 
| 133 | 133 | 'post-new.php', | 
| 134 | 134 | 'post-edit.php', | 
| 135 | 135 | 'edit.php', | 
| 136 | 136 | 'edit.php?post_type=page', | 
| 137 | - ) ); | |
| 137 | + )); | |
| 138 | 138 | |
| 139 | 139 | // Only run in admin post/page creation and edit screens | 
| 140 | - if ( in_array( $screen->parent_file, $shortcode_button_pages ) | |
| 141 | - && apply_filters( 'give_shortcode_button_condition', true ) | |
| 142 | - && ! empty( self::$shortcodes ) | |
| 140 | + if (in_array($screen->parent_file, $shortcode_button_pages) | |
| 141 | +		     && apply_filters('give_shortcode_button_condition', true) | |
| 142 | + && ! empty(self::$shortcodes) | |
| 143 | 143 |  		) { | 
| 144 | 144 | |
| 145 | 145 | $shortcodes = array(); | 
| 146 | 146 | |
| 147 | -			foreach ( self::$shortcodes as $shortcode => $values ) { | |
| 147 | +			foreach (self::$shortcodes as $shortcode => $values) { | |
| 148 | 148 | |
| 149 | 149 | /** | 
| 150 | 150 | * Filters the condition for including the current shortcode | 
| 151 | 151 | * | 
| 152 | 152 | * @since 1.0 | 
| 153 | 153 | */ | 
| 154 | -				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { | |
| 154 | +				if (apply_filters(sanitize_title($shortcode).'_condition', true)) { | |
| 155 | 155 | |
| 156 | - $shortcodes[ $shortcode ] = sprintf( | |
| 156 | + $shortcodes[$shortcode] = sprintf( | |
| 157 | 157 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>', | 
| 158 | 158 | $shortcode, | 
| 159 | 159 | $values['label'], | 
| @@ -162,37 +162,37 @@ discard block | ||
| 162 | 162 | } | 
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | -			if ( ! empty( $shortcodes ) ) { | |
| 165 | +			if ( ! empty($shortcodes)) { | |
| 166 | 166 | |
| 167 | 167 | // check current WP version | 
| 168 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) | |
| 169 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' | |
| 170 | -					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; | |
| 168 | +				$img = (version_compare(get_bloginfo('version'), '3.5', '<')) | |
| 169 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' | |
| 170 | +					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; | |
| 171 | 171 | |
| 172 | - reset( $shortcodes ); | |
| 172 | + reset($shortcodes); | |
| 173 | 173 | |
| 174 | -				if ( count( $shortcodes ) == 1 ) { | |
| 174 | +				if (count($shortcodes) == 1) { | |
| 175 | 175 | |
| 176 | - $shortcode = key( $shortcodes ); | |
| 176 | + $shortcode = key($shortcodes); | |
| 177 | 177 | |
| 178 | 178 | printf( | 
| 179 | 179 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', | 
| 180 | 180 | $shortcode, | 
| 181 | - sprintf( '%s %s %s', | |
| 181 | +						sprintf('%s %s %s', | |
| 182 | 182 | $img, | 
| 183 | - esc_html__( 'Insert', 'give' ), | |
| 184 | - self::$shortcodes[ $shortcode ]['label'] | |
| 183 | +							esc_html__('Insert', 'give'), | |
| 184 | + self::$shortcodes[$shortcode]['label'] | |
| 185 | 185 | ) | 
| 186 | 186 | ); | 
| 187 | 187 |  				} else { | 
| 188 | 188 | printf( | 
| 189 | - '<div class="sc-wrap">' . | |
| 190 | - '<button class="button sc-button">%s %s</button>' . | |
| 191 | - '<div class="sc-menu mce-menu">%s</div>' . | |
| 189 | + '<div class="sc-wrap">'. | |
| 190 | + '<button class="button sc-button">%s %s</button>'. | |
| 191 | + '<div class="sc-menu mce-menu">%s</div>'. | |
| 192 | 192 | '</div>', | 
| 193 | 193 | $img, | 
| 194 | - esc_html__( 'Give Shortcodes', 'give' ), | |
| 195 | - implode( '', array_values( $shortcodes ) ) | |
| 194 | +						esc_html__('Give Shortcodes', 'give'), | |
| 195 | +						implode('', array_values($shortcodes)) | |
| 196 | 196 | ); | 
| 197 | 197 | } | 
| 198 | 198 | } | 
| @@ -208,15 +208,15 @@ discard block | ||
| 208 | 208 | */ | 
| 209 | 209 |  	public function shortcode_ajax() { | 
| 210 | 210 | |
| 211 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; | |
| 211 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; | |
| 212 | 212 | $response = false; | 
| 213 | 213 | |
| 214 | -		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { | |
| 214 | +		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { | |
| 215 | 215 | |
| 216 | - $data = self::$shortcodes[ $shortcode ]; | |
| 216 | + $data = self::$shortcodes[$shortcode]; | |
| 217 | 217 | |
| 218 | -			if ( ! empty( $data['errors'] ) ) { | |
| 219 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); | |
| 218 | +			if ( ! empty($data['errors'])) { | |
| 219 | +				$data['btn_okay'] = array(esc_html__('Okay', 'give')); | |
| 220 | 220 | } | 
| 221 | 221 | |
| 222 | 222 | $response = array( | 
| @@ -228,10 +228,10 @@ discard block | ||
| 228 | 228 | ); | 
| 229 | 229 |  		} else { | 
| 230 | 230 | // todo: handle error | 
| 231 | - error_log( print_r( 'AJAX error!', 1 ) ); | |
| 231 | +			error_log(print_r('AJAX error!', 1)); | |
| 232 | 232 | } | 
| 233 | 233 | |
| 234 | - wp_send_json( $response ); | |
| 234 | + wp_send_json($response); | |
| 235 | 235 | } | 
| 236 | 236 | } | 
| 237 | 237 | |
| @@ -727,10 +727,10 @@ discard block | ||
| 727 | 727 | } | 
| 728 | 728 | |
| 729 | 729 | if ( ! is_int( $params[1] ) | 
| 730 | - && ! is_float( $params[1] ) | |
| 731 | - && ! is_string( $params[1] ) | |
| 732 | - && $params[1] !== null | |
| 733 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) | |
| 730 | + && ! is_float( $params[1] ) | |
| 731 | + && ! is_string( $params[1] ) | |
| 732 | + && $params[1] !== null | |
| 733 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) | |
| 734 | 734 |  		) { | 
| 735 | 735 | trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); | 
| 736 | 736 | |
| @@ -738,10 +738,10 @@ discard block | ||
| 738 | 738 | } | 
| 739 | 739 | |
| 740 | 740 | if ( isset( $params[2] ) | 
| 741 | - && ! is_int( $params[2] ) | |
| 742 | - && ! is_float( $params[2] ) | |
| 743 | - && ! is_string( $params[2] ) | |
| 744 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) | |
| 741 | + && ! is_int( $params[2] ) | |
| 742 | + && ! is_float( $params[2] ) | |
| 743 | + && ! is_string( $params[2] ) | |
| 744 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) | |
| 745 | 745 |  		) { | 
| 746 | 746 | trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); | 
| 747 | 747 | |
| @@ -337,7 +337,7 @@ | ||
| 337 | 337 | * | 
| 338 | 338 | * @since 1.0 | 
| 339 | 339 | * @uses Give()->session->get() | 
| 340 | - * @return mixed array | false | |
| 340 | + * @return string array | false | |
| 341 | 341 | */ | 
| 342 | 342 |  function give_get_purchase_session() { | 
| 343 | 343 | return Give()->session->get( 'give_purchase' ); | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. | 
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | +if ( ! defined('ABSPATH')) { | |
| 14 | 14 | exit; | 
| 15 | 15 | } | 
| 16 | 16 | |
| @@ -23,9 +23,9 @@ discard block | ||
| 23 | 23 | */ | 
| 24 | 24 |  function give_is_test_mode() { | 
| 25 | 25 | |
| 26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); | |
| 26 | +	$ret = give_is_setting_enabled(give_get_option('test_mode')); | |
| 27 | 27 | |
| 28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); | |
| 28 | +	return (bool) apply_filters('give_is_test_mode', $ret); | |
| 29 | 29 | |
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -37,9 +37,9 @@ discard block | ||
| 37 | 37 | */ | 
| 38 | 38 |  function give_get_currency() { | 
| 39 | 39 | |
| 40 | - $currency = give_get_option( 'currency', 'USD' ); | |
| 40 | +	$currency = give_get_option('currency', 'USD'); | |
| 41 | 41 | |
| 42 | - return apply_filters( 'give_currency', $currency ); | |
| 42 | +	return apply_filters('give_currency', $currency); | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | /** | 
| @@ -51,9 +51,9 @@ discard block | ||
| 51 | 51 | */ | 
| 52 | 52 |  function give_get_currency_position() { | 
| 53 | 53 | |
| 54 | - $currency_pos = give_get_option( 'currency_position', 'before' ); | |
| 54 | +	$currency_pos = give_get_option('currency_position', 'before'); | |
| 55 | 55 | |
| 56 | - return apply_filters( 'give_currency_position', $currency_pos ); | |
| 56 | +	return apply_filters('give_currency_position', $currency_pos); | |
| 57 | 57 | } | 
| 58 | 58 | |
| 59 | 59 | |
| @@ -66,39 +66,39 @@ discard block | ||
| 66 | 66 | |
| 67 | 67 |  function give_get_currencies() { | 
| 68 | 68 | $currencies = array( | 
| 69 | - 'USD' => esc_html__( 'US Dollars ($)', 'give' ), | |
| 70 | - 'EUR' => esc_html__( 'Euros (€)', 'give' ), | |
| 71 | - 'GBP' => esc_html__( 'Pounds Sterling (£)', 'give' ), | |
| 72 | - 'AUD' => esc_html__( 'Australian Dollars ($)', 'give' ), | |
| 73 | - 'BRL' => esc_html__( 'Brazilian Real (R$)', 'give' ), | |
| 74 | - 'CAD' => esc_html__( 'Canadian Dollars ($)', 'give' ), | |
| 75 | - 'CZK' => esc_html__( 'Czech Koruna (Kč)', 'give' ), | |
| 76 | - 'DKK' => esc_html__( 'Danish Krone (kr)', 'give' ), | |
| 77 | - 'HKD' => esc_html__( 'Hong Kong Dollar ($)', 'give' ), | |
| 78 | - 'HUF' => esc_html__( 'Hungarian Forint (Ft)', 'give' ), | |
| 79 | - 'ILS' => esc_html__( 'Israeli Shekel (₪)', 'give' ), | |
| 80 | - 'JPY' => esc_html__( 'Japanese Yen (¥)', 'give' ), | |
| 81 | - 'MYR' => esc_html__( 'Malaysian Ringgits (RM)', 'give' ), | |
| 82 | - 'MXN' => esc_html__( 'Mexican Peso ($)', 'give' ), | |
| 83 | - 'MAD' => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ), | |
| 84 | - 'NZD' => esc_html__( 'New Zealand Dollar ($)', 'give' ), | |
| 85 | - 'NOK' => esc_html__( 'Norwegian Krone (Kr.)', 'give' ), | |
| 86 | - 'PHP' => esc_html__( 'Philippine Pesos (₱)', 'give' ), | |
| 87 | - 'PLN' => esc_html__( 'Polish Zloty (zł)', 'give' ), | |
| 88 | - 'SGD' => esc_html__( 'Singapore Dollar ($)', 'give' ), | |
| 89 | - 'KRW' => esc_html__( 'South Korean Won (₩)', 'give' ), | |
| 90 | - 'ZAR' => esc_html__( 'South African Rand (R)', 'give' ), | |
| 91 | - 'SEK' => esc_html__( 'Swedish Krona (kr)', 'give' ), | |
| 92 | - 'CHF' => esc_html__( 'Swiss Franc (CHF)', 'give' ), | |
| 93 | - 'TWD' => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ), | |
| 94 | - 'THB' => esc_html__( 'Thai Baht (฿)', 'give' ), | |
| 95 | - 'INR' => esc_html__( 'Indian Rupee (₹)', 'give' ), | |
| 96 | - 'TRY' => esc_html__( 'Turkish Lira (₺)', 'give' ), | |
| 97 | - 'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ), | |
| 98 | - 'RUB' => esc_html__( 'Russian Rubles (руб)', 'give' ) | |
| 69 | +		'USD'  => esc_html__('US Dollars ($)', 'give'), | |
| 70 | +		'EUR'  => esc_html__('Euros (€)', 'give'), | |
| 71 | +		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'), | |
| 72 | +		'AUD'  => esc_html__('Australian Dollars ($)', 'give'), | |
| 73 | +		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'), | |
| 74 | +		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'), | |
| 75 | +		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'), | |
| 76 | +		'DKK'  => esc_html__('Danish Krone (kr)', 'give'), | |
| 77 | +		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'), | |
| 78 | +		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'), | |
| 79 | +		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'), | |
| 80 | +		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'), | |
| 81 | +		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'), | |
| 82 | +		'MXN'  => esc_html__('Mexican Peso ($)', 'give'), | |
| 83 | +		'MAD'  => esc_html__('Moroccan Dirham (.د.م)', 'give'), | |
| 84 | +		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'), | |
| 85 | +		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'), | |
| 86 | +		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'), | |
| 87 | +		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'), | |
| 88 | +		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'), | |
| 89 | +		'KRW'  => esc_html__('South Korean Won (₩)', 'give'), | |
| 90 | +		'ZAR'  => esc_html__('South African Rand (R)', 'give'), | |
| 91 | +		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'), | |
| 92 | +		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'), | |
| 93 | +		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'), | |
| 94 | +		'THB'  => esc_html__('Thai Baht (฿)', 'give'), | |
| 95 | +		'INR'  => esc_html__('Indian Rupee (₹)', 'give'), | |
| 96 | +		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'), | |
| 97 | +		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'), | |
| 98 | +		'RUB'  => esc_html__('Russian Rubles (руб)', 'give') | |
| 99 | 99 | ); | 
| 100 | 100 | |
| 101 | - return apply_filters( 'give_currencies', $currencies ); | |
| 101 | +	return apply_filters('give_currencies', $currencies); | |
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | |
| @@ -113,12 +113,12 @@ discard block | ||
| 113 | 113 | * | 
| 114 | 114 | * @return string The symbol to use for the currency | 
| 115 | 115 | */ | 
| 116 | -function give_currency_symbol( $currency = '' ) { | |
| 116 | +function give_currency_symbol($currency = '') { | |
| 117 | 117 | |
| 118 | -	if ( empty( $currency ) ) { | |
| 118 | +	if (empty($currency)) { | |
| 119 | 119 | $currency = give_get_currency(); | 
| 120 | 120 | } | 
| 121 | - switch ( $currency ) : | |
| 121 | + switch ($currency) : | |
| 122 | 122 | case 'GBP' : | 
| 123 | 123 | $symbol = '£'; | 
| 124 | 124 | break; | 
| @@ -197,7 +197,7 @@ discard block | ||
| 197 | 197 | endswitch; | 
| 198 | 198 | |
| 199 | 199 | |
| 200 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); | |
| 200 | +	return apply_filters('give_currency_symbol', $symbol, $currency); | |
| 201 | 201 | } | 
| 202 | 202 | |
| 203 | 203 | |
| @@ -209,15 +209,15 @@ discard block | ||
| 209 | 209 | */ | 
| 210 | 210 |  function give_get_current_page_url() { | 
| 211 | 211 | |
| 212 | -	if ( is_front_page() ) { | |
| 213 | - $current_url = home_url( '/' ); | |
| 212 | +	if (is_front_page()) { | |
| 213 | +		$current_url = home_url('/'); | |
| 214 | 214 |  	} else { | 
| 215 | - $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] ); | |
| 216 | - $request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] ); | |
| 217 | - $current_url = set_url_scheme( 'http://' . $http_host . untrailingslashit( $request_uri ) ); | |
| 215 | + $http_host = sanitize_text_field($_SERVER['HTTP_HOST']); | |
| 216 | + $request_uri = sanitize_text_field($_SERVER['REQUEST_URI']); | |
| 217 | +		$current_url = set_url_scheme('http://'.$http_host.untrailingslashit($request_uri)); | |
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | - return apply_filters( 'give_get_current_page_url', $current_url ); | |
| 220 | +	return apply_filters('give_get_current_page_url', $current_url); | |
| 221 | 221 | } | 
| 222 | 222 | |
| 223 | 223 | |
| @@ -238,15 +238,15 @@ discard block | ||
| 238 | 238 | */ | 
| 239 | 239 | $gateways = give_get_enabled_payment_gateways(); | 
| 240 | 240 | |
| 241 | -	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { | |
| 241 | +	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { | |
| 242 | 242 | $ret = true; | 
| 243 | -	} else if ( count( $gateways ) == 1 ) { | |
| 243 | +	} else if (count($gateways) == 1) { | |
| 244 | 244 | $ret = false; | 
| 245 | -	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { | |
| 245 | +	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { | |
| 246 | 246 | $ret = false; | 
| 247 | 247 | } | 
| 248 | 248 | |
| 249 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); | |
| 249 | +	return (bool) apply_filters('give_verify_credit_cards', $ret); | |
| 250 | 250 | } | 
| 251 | 251 | |
| 252 | 252 | /** | 
| @@ -258,26 +258,26 @@ discard block | ||
| 258 | 258 |  function give_get_timezone_id() { | 
| 259 | 259 | |
| 260 | 260 | // if site timezone string exists, return it | 
| 261 | -	if ( $timezone = get_option( 'timezone_string' ) ) { | |
| 261 | +	if ($timezone = get_option('timezone_string')) { | |
| 262 | 262 | return $timezone; | 
| 263 | 263 | } | 
| 264 | 264 | |
| 265 | 265 | // get UTC offset, if it isn't set return UTC | 
| 266 | -	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { | |
| 266 | +	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { | |
| 267 | 267 | return 'UTC'; | 
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | 270 | // attempt to guess the timezone string from the UTC offset | 
| 271 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); | |
| 271 | +	$timezone = timezone_name_from_abbr('', $utc_offset); | |
| 272 | 272 | |
| 273 | 273 | // last try, guess timezone string manually | 
| 274 | -	if ( $timezone === false ) { | |
| 274 | +	if ($timezone === false) { | |
| 275 | 275 | |
| 276 | - $is_dst = date( 'I' ); | |
| 276 | +		$is_dst = date('I'); | |
| 277 | 277 | |
| 278 | -		foreach ( timezone_abbreviations_list() as $abbr ) { | |
| 279 | -			foreach ( $abbr as $city ) { | |
| 280 | -				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { | |
| 278 | +		foreach (timezone_abbreviations_list() as $abbr) { | |
| 279 | +			foreach ($abbr as $city) { | |
| 280 | +				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { | |
| 281 | 281 | return $city['timezone_id']; | 
| 282 | 282 | } | 
| 283 | 283 | } | 
| @@ -301,17 +301,17 @@ discard block | ||
| 301 | 301 | |
| 302 | 302 | $ip = '127.0.0.1'; | 
| 303 | 303 | |
| 304 | -	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
| 304 | +	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { | |
| 305 | 305 | //check ip from share internet | 
| 306 | 306 | $ip = $_SERVER['HTTP_CLIENT_IP']; | 
| 307 | -	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | |
| 307 | +	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { | |
| 308 | 308 | //to check ip is pass from proxy | 
| 309 | 309 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | 
| 310 | -	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { | |
| 310 | +	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { | |
| 311 | 311 | $ip = $_SERVER['REMOTE_ADDR']; | 
| 312 | 312 | } | 
| 313 | 313 | |
| 314 | - return apply_filters( 'give_get_ip', $ip ); | |
| 314 | +	return apply_filters('give_get_ip', $ip); | |
| 315 | 315 | } | 
| 316 | 316 | |
| 317 | 317 | |
| @@ -326,9 +326,9 @@ discard block | ||
| 326 | 326 | * | 
| 327 | 327 | * @uses Give()->session->set() | 
| 328 | 328 | */ | 
| 329 | -function give_set_purchase_session( $purchase_data = array() ) { | |
| 330 | - Give()->session->set( 'give_purchase', $purchase_data ); | |
| 331 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); | |
| 329 | +function give_set_purchase_session($purchase_data = array()) { | |
| 330 | +	Give()->session->set('give_purchase', $purchase_data); | |
| 331 | +	Give()->session->set('give_email', $purchase_data['user_email']); | |
| 332 | 332 | } | 
| 333 | 333 | |
| 334 | 334 | /** | 
| @@ -342,7 +342,7 @@ discard block | ||
| 342 | 342 | * @return mixed array | false | 
| 343 | 343 | */ | 
| 344 | 344 |  function give_get_purchase_session() { | 
| 345 | - return Give()->session->get( 'give_purchase' ); | |
| 345 | +	return Give()->session->get('give_purchase'); | |
| 346 | 346 | } | 
| 347 | 347 | |
| 348 | 348 | /** | 
| @@ -357,14 +357,14 @@ discard block | ||
| 357 | 357 | * | 
| 358 | 358 | * @return string | 
| 359 | 359 | */ | 
| 360 | -function give_get_purchase_summary( $purchase_data, $email = true ) { | |
| 360 | +function give_get_purchase_summary($purchase_data, $email = true) { | |
| 361 | 361 | $summary = ''; | 
| 362 | 362 | |
| 363 | -	if ( $email ) { | |
| 364 | - $summary .= $purchase_data['user_email'] . ' - '; | |
| 363 | +	if ($email) { | |
| 364 | + $summary .= $purchase_data['user_email'].' - '; | |
| 365 | 365 | } | 
| 366 | 366 | |
| 367 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); | |
| 367 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); | |
| 368 | 368 | |
| 369 | 369 | return $summary; | 
| 370 | 370 | } | 
| @@ -381,31 +381,31 @@ discard block | ||
| 381 | 381 |  function give_get_host() { | 
| 382 | 382 | $host = false; | 
| 383 | 383 | |
| 384 | -	if ( defined( 'WPE_APIKEY' ) ) { | |
| 384 | +	if (defined('WPE_APIKEY')) { | |
| 385 | 385 | $host = 'WP Engine'; | 
| 386 | -	} elseif ( defined( 'PAGELYBIN' ) ) { | |
| 386 | +	} elseif (defined('PAGELYBIN')) { | |
| 387 | 387 | $host = 'Pagely'; | 
| 388 | -	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { | |
| 388 | +	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { | |
| 389 | 389 | $host = 'ICDSoft'; | 
| 390 | -	} elseif ( DB_HOST == 'mysqlv5' ) { | |
| 390 | +	} elseif (DB_HOST == 'mysqlv5') { | |
| 391 | 391 | $host = 'NetworkSolutions'; | 
| 392 | -	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { | |
| 392 | +	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { | |
| 393 | 393 | $host = 'iPage'; | 
| 394 | -	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { | |
| 394 | +	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { | |
| 395 | 395 | $host = 'IPower'; | 
| 396 | -	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { | |
| 396 | +	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) { | |
| 397 | 397 | $host = 'MediaTemple Grid'; | 
| 398 | -	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { | |
| 398 | +	} elseif (strpos(DB_HOST, '.pair.com') !== false) { | |
| 399 | 399 | $host = 'pair Networks'; | 
| 400 | -	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { | |
| 400 | +	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { | |
| 401 | 401 | $host = 'Rackspace Cloud'; | 
| 402 | -	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { | |
| 402 | +	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { | |
| 403 | 403 | $host = 'SysFix.eu Power Hosting'; | 
| 404 | -	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { | |
| 404 | +	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { | |
| 405 | 405 | $host = 'Flywheel'; | 
| 406 | 406 |  	} else { | 
| 407 | 407 | // Adding a general fallback for data gathering | 
| 408 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; | |
| 408 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; | |
| 409 | 409 | } | 
| 410 | 410 | |
| 411 | 411 | return $host; | 
| @@ -421,67 +421,67 @@ discard block | ||
| 421 | 421 | * | 
| 422 | 422 | * @return bool true if host matches, false if not | 
| 423 | 423 | */ | 
| 424 | -function give_is_host( $host = false ) { | |
| 424 | +function give_is_host($host = false) { | |
| 425 | 425 | |
| 426 | 426 | $return = false; | 
| 427 | 427 | |
| 428 | -	if ( $host ) { | |
| 429 | - $host = str_replace( ' ', '', strtolower( $host ) ); | |
| 428 | +	if ($host) { | |
| 429 | +		$host = str_replace(' ', '', strtolower($host)); | |
| 430 | 430 | |
| 431 | -		switch ( $host ) { | |
| 431 | +		switch ($host) { | |
| 432 | 432 | case 'wpengine': | 
| 433 | -				if ( defined( 'WPE_APIKEY' ) ) { | |
| 433 | +				if (defined('WPE_APIKEY')) { | |
| 434 | 434 | $return = true; | 
| 435 | 435 | } | 
| 436 | 436 | break; | 
| 437 | 437 | case 'pagely': | 
| 438 | -				if ( defined( 'PAGELYBIN' ) ) { | |
| 438 | +				if (defined('PAGELYBIN')) { | |
| 439 | 439 | $return = true; | 
| 440 | 440 | } | 
| 441 | 441 | break; | 
| 442 | 442 | case 'icdsoft': | 
| 443 | -				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { | |
| 443 | +				if (DB_HOST == 'localhost:/tmp/mysql5.sock') { | |
| 444 | 444 | $return = true; | 
| 445 | 445 | } | 
| 446 | 446 | break; | 
| 447 | 447 | case 'networksolutions': | 
| 448 | -				if ( DB_HOST == 'mysqlv5' ) { | |
| 448 | +				if (DB_HOST == 'mysqlv5') { | |
| 449 | 449 | $return = true; | 
| 450 | 450 | } | 
| 451 | 451 | break; | 
| 452 | 452 | case 'ipage': | 
| 453 | -				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { | |
| 453 | +				if (strpos(DB_HOST, 'ipagemysql.com') !== false) { | |
| 454 | 454 | $return = true; | 
| 455 | 455 | } | 
| 456 | 456 | break; | 
| 457 | 457 | case 'ipower': | 
| 458 | -				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { | |
| 458 | +				if (strpos(DB_HOST, 'ipowermysql.com') !== false) { | |
| 459 | 459 | $return = true; | 
| 460 | 460 | } | 
| 461 | 461 | break; | 
| 462 | 462 | case 'mediatemplegrid': | 
| 463 | -				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { | |
| 463 | +				if (strpos(DB_HOST, '.gridserver.com') !== false) { | |
| 464 | 464 | $return = true; | 
| 465 | 465 | } | 
| 466 | 466 | break; | 
| 467 | 467 | case 'pairnetworks': | 
| 468 | -				if ( strpos( DB_HOST, '.pair.com' ) !== false ) { | |
| 468 | +				if (strpos(DB_HOST, '.pair.com') !== false) { | |
| 469 | 469 | $return = true; | 
| 470 | 470 | } | 
| 471 | 471 | break; | 
| 472 | 472 | case 'rackspacecloud': | 
| 473 | -				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { | |
| 473 | +				if (strpos(DB_HOST, '.stabletransit.com') !== false) { | |
| 474 | 474 | $return = true; | 
| 475 | 475 | } | 
| 476 | 476 | break; | 
| 477 | 477 | case 'sysfix.eu': | 
| 478 | 478 | case 'sysfix.eupowerhosting': | 
| 479 | -				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { | |
| 479 | +				if (strpos(DB_HOST, '.sysfix.eu') !== false) { | |
| 480 | 480 | $return = true; | 
| 481 | 481 | } | 
| 482 | 482 | break; | 
| 483 | 483 | case 'flywheel': | 
| 484 | -				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { | |
| 484 | +				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { | |
| 485 | 485 | $return = true; | 
| 486 | 486 | } | 
| 487 | 487 | break; | 
| @@ -514,7 +514,7 @@ discard block | ||
| 514 | 514 | * @param string $replacement Optional. The function that should have been called. | 
| 515 | 515 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. | 
| 516 | 516 | */ | 
| 517 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { | |
| 517 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { | |
| 518 | 518 | |
| 519 | 519 | /** | 
| 520 | 520 | * Fires while give deprecated function call occurs. | 
| @@ -527,19 +527,19 @@ discard block | ||
| 527 | 527 | * @param string $replacement Optional. The function that should have been called. | 
| 528 | 528 | * @param string $version The plugin version that deprecated the function. | 
| 529 | 529 | */ | 
| 530 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); | |
| 530 | +	do_action('give_deprecated_function_run', $function, $replacement, $version); | |
| 531 | 531 | |
| 532 | - $show_errors = current_user_can( 'manage_options' ); | |
| 532 | +	$show_errors = current_user_can('manage_options'); | |
| 533 | 533 | |
| 534 | 534 | // Allow plugin to filter the output error trigger | 
| 535 | -	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { | |
| 536 | -		if ( ! is_null( $replacement ) ) { | |
| 537 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); | |
| 538 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. | |
| 535 | +	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { | |
| 536 | +		if ( ! is_null($replacement)) { | |
| 537 | +			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); | |
| 538 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. | |
| 539 | 539 | // Alternatively we could dump this to a file. | 
| 540 | 540 |  		} else { | 
| 541 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); | |
| 542 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. | |
| 541 | +			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); | |
| 542 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. | |
| 543 | 543 | // Alternatively we could dump this to a file. | 
| 544 | 544 | } | 
| 545 | 545 | } | 
| @@ -553,8 +553,8 @@ discard block | ||
| 553 | 553 | * @return string $post_id | 
| 554 | 554 | */ | 
| 555 | 555 |  function give_get_admin_post_id() { | 
| 556 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; | |
| 557 | -	if ( ! $post_id && isset( $_POST['post_id'] ) ) { | |
| 556 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; | |
| 557 | +	if ( ! $post_id && isset($_POST['post_id'])) { | |
| 558 | 558 | $post_id = $_POST['post_id']; | 
| 559 | 559 | } | 
| 560 | 560 | |
| @@ -568,7 +568,7 @@ discard block | ||
| 568 | 568 | * @return string Arg separator output | 
| 569 | 569 | */ | 
| 570 | 570 |  function give_get_php_arg_separator_output() { | 
| 571 | - return ini_get( 'arg_separator.output' ); | |
| 571 | +	return ini_get('arg_separator.output'); | |
| 572 | 572 | } | 
| 573 | 573 | |
| 574 | 574 | |
| @@ -583,10 +583,10 @@ discard block | ||
| 583 | 583 | * | 
| 584 | 584 | * @return string Short month name | 
| 585 | 585 | */ | 
| 586 | -function give_month_num_to_name( $n ) { | |
| 587 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); | |
| 586 | +function give_month_num_to_name($n) { | |
| 587 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); | |
| 588 | 588 | |
| 589 | - return date_i18n( "M", $timestamp ); | |
| 589 | +	return date_i18n("M", $timestamp); | |
| 590 | 590 | } | 
| 591 | 591 | |
| 592 | 592 | |
| @@ -599,10 +599,10 @@ discard block | ||
| 599 | 599 | * | 
| 600 | 600 | * @return bool Whether or not function is disabled. | 
| 601 | 601 | */ | 
| 602 | -function give_is_func_disabled( $function ) { | |
| 603 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); | |
| 602 | +function give_is_func_disabled($function) { | |
| 603 | +	$disabled = explode(',', ini_get('disable_functions')); | |
| 604 | 604 | |
| 605 | - return in_array( $function, $disabled ); | |
| 605 | + return in_array($function, $disabled); | |
| 606 | 606 | } | 
| 607 | 607 | |
| 608 | 608 | |
| @@ -613,31 +613,31 @@ discard block | ||
| 613 | 613 | */ | 
| 614 | 614 |  function give_get_newsletter() { ?> | 
| 615 | 615 | |
| 616 | - <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> | |
| 616 | +	<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> | |
| 617 | 617 | |
| 618 | 618 | <div class="give-newsletter-form-wrap"> | 
| 619 | 619 | |
| 620 | 620 | <form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> | 
| 621 | 621 | <div class="give-newsletter-confirmation"> | 
| 622 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> | |
| 622 | +				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> | |
| 623 | 623 | </div> | 
| 624 | 624 | |
| 625 | 625 | <table class="form-table give-newsletter-form"> | 
| 626 | 626 | <tr valign="middle"> | 
| 627 | 627 | <td> | 
| 628 | - <label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> | |
| 629 | - <input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" class="required email" value=""> | |
| 628 | +						<label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> | |
| 629 | +						<input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" class="required email" value=""> | |
| 630 | 630 | </td> | 
| 631 | 631 | <td> | 
| 632 | - <label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> | |
| 633 | - <input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> | |
| 632 | +						<label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> | |
| 633 | +						<input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> | |
| 634 | 634 | </td> | 
| 635 | 635 | <td> | 
| 636 | - <label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> | |
| 637 | - <input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> | |
| 636 | +						<label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> | |
| 637 | +						<input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> | |
| 638 | 638 | </td> | 
| 639 | 639 | <td> | 
| 640 | - <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> | |
| 640 | +						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e('Subscribe', 'give'); ?>"> | |
| 641 | 641 | </td> | 
| 642 | 642 | </tr> | 
| 643 | 643 | </table> | 
| @@ -698,7 +698,7 @@ discard block | ||
| 698 | 698 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php | 
| 699 | 699 | printf( | 
| 700 | 700 | /* translators: %s: Give twitter user @givewp */ | 
| 701 | - esc_html_e( 'Follow %s', 'give' ), | |
| 701 | +				esc_html_e('Follow %s', 'give'), | |
| 702 | 702 | '@givewp' | 
| 703 | 703 | ); | 
| 704 | 704 | ?></a> | 
| @@ -727,7 +727,7 @@ discard block | ||
| 727 | 727 | * | 
| 728 | 728 | * @return string | 
| 729 | 729 | */ | 
| 730 | -function give_svg_icons( $icon ) { | |
| 730 | +function give_svg_icons($icon) { | |
| 731 | 731 | |
| 732 | 732 | // Store your SVGs in an associative array | 
| 733 | 733 | $svgs = array( | 
| @@ -739,7 +739,7 @@ discard block | ||
| 739 | 739 | ); | 
| 740 | 740 | |
| 741 | 741 | // Return the chosen icon's SVG string | 
| 742 | - return $svgs[ $icon ]; | |
| 742 | + return $svgs[$icon]; | |
| 743 | 743 | } | 
| 744 | 744 | |
| 745 | 745 | /** | 
| @@ -751,15 +751,15 @@ discard block | ||
| 751 | 751 | * | 
| 752 | 752 | * @return mixed | 
| 753 | 753 | */ | 
| 754 | -function modify_nav_menu_meta_box_object( $post_type ) { | |
| 755 | -	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { | |
| 756 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); | |
| 754 | +function modify_nav_menu_meta_box_object($post_type) { | |
| 755 | +	if (isset($post_type->name) && $post_type->name == 'give_forms') { | |
| 756 | +		$post_type->labels->name = esc_html__('Donation Forms', 'give'); | |
| 757 | 757 | } | 
| 758 | 758 | |
| 759 | 759 | return $post_type; | 
| 760 | 760 | } | 
| 761 | 761 | |
| 762 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); | |
| 762 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); | |
| 763 | 763 | |
| 764 | 764 | |
| 765 | 765 | /** | 
| @@ -773,7 +773,7 @@ discard block | ||
| 773 | 773 | * @license https://opensource.org/licenses/MIT MIT | 
| 774 | 774 | */ | 
| 775 | 775 | |
| 776 | -if ( ! function_exists( 'array_column' ) ) { | |
| 776 | +if ( ! function_exists('array_column')) { | |
| 777 | 777 | /** | 
| 778 | 778 | * Returns the values from a single column of the input array, identified by | 
| 779 | 779 | * the $columnKey. | 
| @@ -792,53 +792,53 @@ discard block | ||
| 792 | 792 | * | 
| 793 | 793 | * @return array | 
| 794 | 794 | */ | 
| 795 | -	function array_column( $input = null, $columnKey = null, $indexKey = null ) { | |
| 795 | +	function array_column($input = null, $columnKey = null, $indexKey = null) { | |
| 796 | 796 | // Using func_get_args() in order to check for proper number of | 
| 797 | 797 | // parameters and trigger errors exactly as the built-in array_column() | 
| 798 | 798 | // does in PHP 5.5. | 
| 799 | 799 | $argc = func_num_args(); | 
| 800 | 800 | $params = func_get_args(); | 
| 801 | 801 | |
| 802 | -		if ( $argc < 2 ) { | |
| 803 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); | |
| 802 | +		if ($argc < 2) { | |
| 803 | +			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); | |
| 804 | 804 | |
| 805 | 805 | return null; | 
| 806 | 806 | } | 
| 807 | 807 | |
| 808 | -		if ( ! is_array( $params[0] ) ) { | |
| 809 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); | |
| 808 | +		if ( ! is_array($params[0])) { | |
| 809 | +			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); | |
| 810 | 810 | |
| 811 | 811 | return null; | 
| 812 | 812 | } | 
| 813 | 813 | |
| 814 | - if ( ! is_int( $params[1] ) | |
| 815 | - && ! is_float( $params[1] ) | |
| 816 | - && ! is_string( $params[1] ) | |
| 814 | + if ( ! is_int($params[1]) | |
| 815 | + && ! is_float($params[1]) | |
| 816 | + && ! is_string($params[1]) | |
| 817 | 817 | && $params[1] !== null | 
| 818 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) | |
| 818 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) | |
| 819 | 819 |  		) { | 
| 820 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); | |
| 820 | +			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); | |
| 821 | 821 | |
| 822 | 822 | return false; | 
| 823 | 823 | } | 
| 824 | 824 | |
| 825 | - if ( isset( $params[2] ) | |
| 826 | - && ! is_int( $params[2] ) | |
| 827 | - && ! is_float( $params[2] ) | |
| 828 | - && ! is_string( $params[2] ) | |
| 829 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) | |
| 825 | + if (isset($params[2]) | |
| 826 | + && ! is_int($params[2]) | |
| 827 | + && ! is_float($params[2]) | |
| 828 | + && ! is_string($params[2]) | |
| 829 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) | |
| 830 | 830 |  		) { | 
| 831 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); | |
| 831 | +			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); | |
| 832 | 832 | |
| 833 | 833 | return false; | 
| 834 | 834 | } | 
| 835 | 835 | |
| 836 | 836 | $paramsInput = $params[0]; | 
| 837 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; | |
| 837 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; | |
| 838 | 838 | |
| 839 | 839 | $paramsIndexKey = null; | 
| 840 | -		if ( isset( $params[2] ) ) { | |
| 841 | -			if ( is_float( $params[2] ) || is_int( $params[2] ) ) { | |
| 840 | +		if (isset($params[2])) { | |
| 841 | +			if (is_float($params[2]) || is_int($params[2])) { | |
| 842 | 842 | $paramsIndexKey = (int) $params[2]; | 
| 843 | 843 |  			} else { | 
| 844 | 844 | $paramsIndexKey = (string) $params[2]; | 
| @@ -847,26 +847,26 @@ discard block | ||
| 847 | 847 | |
| 848 | 848 | $resultArray = array(); | 
| 849 | 849 | |
| 850 | -		foreach ( $paramsInput as $row ) { | |
| 850 | +		foreach ($paramsInput as $row) { | |
| 851 | 851 | $key = $value = null; | 
| 852 | 852 | $keySet = $valueSet = false; | 
| 853 | 853 | |
| 854 | -			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { | |
| 854 | +			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { | |
| 855 | 855 | $keySet = true; | 
| 856 | - $key = (string) $row[ $paramsIndexKey ]; | |
| 856 | + $key = (string) $row[$paramsIndexKey]; | |
| 857 | 857 | } | 
| 858 | 858 | |
| 859 | -			if ( $paramsColumnKey === null ) { | |
| 859 | +			if ($paramsColumnKey === null) { | |
| 860 | 860 | $valueSet = true; | 
| 861 | 861 | $value = $row; | 
| 862 | -			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { | |
| 862 | +			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { | |
| 863 | 863 | $valueSet = true; | 
| 864 | - $value = $row[ $paramsColumnKey ]; | |
| 864 | + $value = $row[$paramsColumnKey]; | |
| 865 | 865 | } | 
| 866 | 866 | |
| 867 | -			if ( $valueSet ) { | |
| 868 | -				if ( $keySet ) { | |
| 869 | - $resultArray[ $key ] = $value; | |
| 867 | +			if ($valueSet) { | |
| 868 | +				if ($keySet) { | |
| 869 | + $resultArray[$key] = $value; | |
| 870 | 870 |  				} else { | 
| 871 | 871 | $resultArray[] = $value; | 
| 872 | 872 | } | 
| @@ -888,40 +888,40 @@ discard block | ||
| 888 | 888 | * | 
| 889 | 889 | * @return bool Whether the receipt is visible or not. | 
| 890 | 890 | */ | 
| 891 | -function give_can_view_receipt( $payment_key = '' ) { | |
| 891 | +function give_can_view_receipt($payment_key = '') { | |
| 892 | 892 | |
| 893 | 893 | $return = false; | 
| 894 | 894 | |
| 895 | -	if ( empty( $payment_key ) ) { | |
| 895 | +	if (empty($payment_key)) { | |
| 896 | 896 | return $return; | 
| 897 | 897 | } | 
| 898 | 898 | |
| 899 | 899 | global $give_receipt_args; | 
| 900 | 900 | |
| 901 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); | |
| 901 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); | |
| 902 | 902 | |
| 903 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); | |
| 903 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); | |
| 904 | 904 | |
| 905 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); | |
| 905 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); | |
| 906 | 906 | |
| 907 | -	if ( is_user_logged_in() ) { | |
| 908 | -		if ( $user_id === (int) get_current_user_id() ) { | |
| 907 | +	if (is_user_logged_in()) { | |
| 908 | +		if ($user_id === (int) get_current_user_id()) { | |
| 909 | 909 | $return = true; | 
| 910 | -		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { | |
| 910 | +		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { | |
| 911 | 911 | $return = true; | 
| 912 | -		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) { | |
| 912 | +		} elseif (current_user_can('view_give_sensitive_data')) { | |
| 913 | 913 | $return = true; | 
| 914 | 914 | } | 
| 915 | 915 | } | 
| 916 | 916 | |
| 917 | 917 | $session = give_get_purchase_session(); | 
| 918 | -	if ( ! empty( $session ) && ! is_user_logged_in() ) { | |
| 919 | -		if ( $session['purchase_key'] === $payment_meta['key'] ) { | |
| 918 | +	if ( ! empty($session) && ! is_user_logged_in()) { | |
| 919 | +		if ($session['purchase_key'] === $payment_meta['key']) { | |
| 920 | 920 | $return = true; | 
| 921 | 921 | } | 
| 922 | 922 | } | 
| 923 | 923 | |
| 924 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); | |
| 924 | +	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); | |
| 925 | 925 | |
| 926 | 926 | } | 
| 927 | 927 | |
| @@ -930,7 +930,7 @@ discard block | ||
| 930 | 930 | * | 
| 931 | 931 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar | 
| 932 | 932 | */ | 
| 933 | -if ( ! function_exists( 'cal_days_in_month' ) ) { | |
| 933 | +if ( ! function_exists('cal_days_in_month')) { | |
| 934 | 934 | /** | 
| 935 | 935 | * cal_days_in_month | 
| 936 | 936 | * | 
| @@ -940,8 +940,8 @@ discard block | ||
| 940 | 940 | * | 
| 941 | 941 | * @return bool|string | 
| 942 | 942 | */ | 
| 943 | -	function cal_days_in_month( $calendar, $month, $year ) { | |
| 944 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); | |
| 943 | +	function cal_days_in_month($calendar, $month, $year) { | |
| 944 | +		return date('t', mktime(0, 0, 0, $month, 1, $year)); | |
| 945 | 945 | } | 
| 946 | 946 | } | 
| 947 | 947 | |
| @@ -960,42 +960,42 @@ discard block | ||
| 960 | 960 | */ | 
| 961 | 961 |  function give_get_plugins() { | 
| 962 | 962 | $plugins = get_plugins(); | 
| 963 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); | |
| 963 | +	$active_plugin_paths = (array) get_option('active_plugins', array()); | |
| 964 | 964 | |
| 965 | -	if ( is_multisite() ) { | |
| 966 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); | |
| 967 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); | |
| 965 | +	if (is_multisite()) { | |
| 966 | +		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); | |
| 967 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); | |
| 968 | 968 | } | 
| 969 | 969 | |
| 970 | -	foreach ( $plugins as $plugin_path => $plugin_data ) { | |
| 970 | +	foreach ($plugins as $plugin_path => $plugin_data) { | |
| 971 | 971 | // Is plugin active? | 
| 972 | -		if ( in_array( $plugin_path, $active_plugin_paths ) ) { | |
| 973 | - $plugins[ $plugin_path ]['Status'] = 'active'; | |
| 972 | +		if (in_array($plugin_path, $active_plugin_paths)) { | |
| 973 | + $plugins[$plugin_path]['Status'] = 'active'; | |
| 974 | 974 |  		} else { | 
| 975 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; | |
| 975 | + $plugins[$plugin_path]['Status'] = 'inactive'; | |
| 976 | 976 | } | 
| 977 | 977 | |
| 978 | - $dirname = strtolower( dirname( $plugin_path ) ); | |
| 978 | + $dirname = strtolower(dirname($plugin_path)); | |
| 979 | 979 | |
| 980 | 980 | // Is plugin a Give add-on by WordImpress? | 
| 981 | -		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { | |
| 981 | +		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { | |
| 982 | 982 | // Plugin is a Give-addon. | 
| 983 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; | |
| 983 | + $plugins[$plugin_path]['Type'] = 'add-on'; | |
| 984 | 984 | |
| 985 | 985 | // Get license info from database. | 
| 986 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); | |
| 987 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; | |
| 988 | - $license_active = get_option( $db_option ); | |
| 986 | +			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']); | |
| 987 | +			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; | |
| 988 | + $license_active = get_option($db_option); | |
| 989 | 989 | |
| 990 | 990 | // Does a valid license exist? | 
| 991 | -			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { | |
| 992 | - $plugins[ $plugin_path ]['License'] = true; | |
| 991 | +			if ( ! empty($license_active) && 'valid' === $license_active->license) { | |
| 992 | + $plugins[$plugin_path]['License'] = true; | |
| 993 | 993 |  			} else { | 
| 994 | - $plugins[ $plugin_path ]['License'] = false; | |
| 994 | + $plugins[$plugin_path]['License'] = false; | |
| 995 | 995 | } | 
| 996 | 996 |  		} else { | 
| 997 | 997 | // Plugin is not a Give add-on. | 
| 998 | - $plugins[ $plugin_path ]['Type'] = 'other'; | |
| 998 | + $plugins[$plugin_path]['Type'] = 'other'; | |
| 999 | 999 | } | 
| 1000 | 1000 | } | 
| 1001 | 1001 | |
| @@ -1012,16 +1012,16 @@ discard block | ||
| 1012 | 1012 | * | 
| 1013 | 1013 | * @return bool | 
| 1014 | 1014 | */ | 
| 1015 | -function give_is_terms_enabled( $form_id ) { | |
| 1016 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); | |
| 1015 | +function give_is_terms_enabled($form_id) { | |
| 1016 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); | |
| 1017 | 1017 | |
| 1018 | 1018 | if ( | 
| 1019 | - give_is_setting_enabled( $form_option, 'global' ) | |
| 1020 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) | |
| 1019 | + give_is_setting_enabled($form_option, 'global') | |
| 1020 | +		&& give_is_setting_enabled(give_get_option('terms')) | |
| 1021 | 1021 |  	) { | 
| 1022 | 1022 | return true; | 
| 1023 | 1023 | |
| 1024 | -	} elseif ( give_is_setting_enabled( $form_option ) ) { | |
| 1024 | +	} elseif (give_is_setting_enabled($form_option)) { | |
| 1025 | 1025 | return true; | 
| 1026 | 1026 | |
| 1027 | 1027 |  	} else { | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | * @param string $text Label for the search box | 
| 82 | 82 | * @param string $input_id ID of the search box | 
| 83 | 83 | * | 
| 84 | - * @return false | |
| 84 | + * @return false|null | |
| 85 | 85 | */ | 
| 86 | 86 |  	public function search_box( $text, $input_id ) { | 
| 87 | 87 | return; | 
| @@ -253,7 +253,7 @@ discard block | ||
| 253 | 253 | * | 
| 254 | 254 | * @access public | 
| 255 | 255 | * @since 1.0 | 
| 256 | - * @return mixed string If search is present, false otherwise | |
| 256 | + * @return string|false string If search is present, false otherwise | |
| 257 | 257 | */ | 
| 258 | 258 |  	public function get_search() { | 
| 259 | 259 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; | 
| @@ -173,8 +173,8 @@ | ||
| 173 | 173 | |
| 174 | 174 | case 'num_purchases' : | 
| 175 | 175 | $value = '<a href="' . | 
| 176 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) | |
| 177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; | |
| 176 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) | |
| 177 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; | |
| 178 | 178 | break; | 
| 179 | 179 | |
| 180 | 180 | case 'amount_spent' : | 
| @@ -10,13 +10,13 @@ discard block | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. | 
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | +if ( ! defined('ABSPATH')) { | |
| 14 | 14 | exit; | 
| 15 | 15 | } | 
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded | 
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { | |
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; | |
| 18 | +if ( ! class_exists('WP_List_Table')) { | |
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; | |
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | 22 | /** | 
| @@ -62,11 +62,11 @@ discard block | ||
| 62 | 62 | global $status, $page; | 
| 63 | 63 | |
| 64 | 64 | // Set parent defaults | 
| 65 | - parent::__construct( array( | |
| 66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records | |
| 67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records | |
| 65 | + parent::__construct(array( | |
| 66 | +			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records | |
| 67 | +			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records | |
| 68 | 68 | 'ajax' => false // Does this table support ajax? | 
| 69 | - ) ); | |
| 69 | + )); | |
| 70 | 70 | |
| 71 | 71 | } | 
| 72 | 72 | |
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | * | 
| 84 | 84 | * @return false | 
| 85 | 85 | */ | 
| 86 | -	public function search_box( $text, $input_id ) { | |
| 86 | +	public function search_box($text, $input_id) { | |
| 87 | 87 | return; | 
| 88 | 88 | } | 
| 89 | 89 | |
| @@ -98,20 +98,20 @@ discard block | ||
| 98 | 98 | * | 
| 99 | 99 | * @return void | 
| 100 | 100 | */ | 
| 101 | -	public function give_search_box( $text, $input_id ) { | |
| 102 | - $input_id = $input_id . '-search-input'; | |
| 101 | +	public function give_search_box($text, $input_id) { | |
| 102 | + $input_id = $input_id.'-search-input'; | |
| 103 | 103 | |
| 104 | -		if ( ! empty( $_REQUEST['orderby'] ) ) { | |
| 105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; | |
| 104 | +		if ( ! empty($_REQUEST['orderby'])) { | |
| 105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; | |
| 106 | 106 | } | 
| 107 | -		if ( ! empty( $_REQUEST['order'] ) ) { | |
| 108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; | |
| 107 | +		if ( ! empty($_REQUEST['order'])) { | |
| 108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; | |
| 109 | 109 | } | 
| 110 | 110 | ?> | 
| 111 | 111 | <p class="search-box donor-search" role="search"> | 
| 112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> | 
| 113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> | 
| 114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> | |
| 114 | +			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> | |
| 115 | 115 | </p> | 
| 116 | 116 | <?php | 
| 117 | 117 | } | 
| @@ -124,33 +124,33 @@ discard block | ||
| 124 | 124 | * | 
| 125 | 125 | * @param string $which | 
| 126 | 126 | */ | 
| 127 | -	protected function display_tablenav( $which ) { | |
| 127 | +	protected function display_tablenav($which) { | |
| 128 | 128 | |
| 129 | -		if ( 'top' === $which ) { | |
| 130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); | |
| 129 | +		if ('top' === $which) { | |
| 130 | +			wp_nonce_field('bulk-'.$this->_args['plural']); | |
| 131 | 131 | } | 
| 132 | 132 | ?> | 
| 133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> | |
| 133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> | |
| 134 | 134 | |
| 135 | -			<?php if ( 'top' === $which ) { ?> | |
| 135 | +			<?php if ('top' === $which) { ?> | |
| 136 | 136 | <h3 class="alignleft reports-earnings-title"> | 
| 137 | - <span><?php esc_html_e( 'Donors Report', 'give' ); ?></span> | |
| 137 | +					<span><?php esc_html_e('Donors Report', 'give'); ?></span> | |
| 138 | 138 | </h3> | 
| 139 | 139 | <?php } ?> | 
| 140 | 140 | |
| 141 | 141 | <div class="alignright tablenav-right"> | 
| 142 | 142 | <div class="actions bulkactions"> | 
| 143 | 143 | <?php | 
| 144 | -					if ( 'top' === $which ) { | |
| 145 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); | |
| 144 | +					if ('top' === $which) { | |
| 145 | +						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); | |
| 146 | 146 | } | 
| 147 | 147 | |
| 148 | - $this->bulk_actions( $which ); ?> | |
| 148 | + $this->bulk_actions($which); ?> | |
| 149 | 149 | |
| 150 | 150 | </div> | 
| 151 | 151 | <?php | 
| 152 | - $this->extra_tablenav( $which ); | |
| 153 | - $this->pagination( $which ); | |
| 152 | + $this->extra_tablenav($which); | |
| 153 | + $this->pagination($which); | |
| 154 | 154 | ?> | 
| 155 | 155 | </div> | 
| 156 | 156 | |
| @@ -172,25 +172,25 @@ discard block | ||
| 172 | 172 | * | 
| 173 | 173 | * @return string Column Name | 
| 174 | 174 | */ | 
| 175 | -	public function column_default( $item, $column_name ) { | |
| 176 | -		switch ( $column_name ) { | |
| 175 | +	public function column_default($item, $column_name) { | |
| 176 | +		switch ($column_name) { | |
| 177 | 177 | |
| 178 | 178 | case 'num_purchases' : | 
| 179 | - $value = '<a href="' . | |
| 180 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) | |
| 181 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; | |
| 179 | + $value = '<a href="'. | |
| 180 | +				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) | |
| 181 | + ).'">'.esc_html($item['num_purchases']).'</a>'; | |
| 182 | 182 | break; | 
| 183 | 183 | |
| 184 | 184 | case 'amount_spent' : | 
| 185 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); | |
| 185 | + $value = give_currency_filter(give_format_amount($item[$column_name])); | |
| 186 | 186 | break; | 
| 187 | 187 | |
| 188 | 188 | default: | 
| 189 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; | |
| 189 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; | |
| 190 | 190 | break; | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | -		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); | |
| 193 | +		return apply_filters("give_report_column_{$column_name}", $value, $item['id']); | |
| 194 | 194 | } | 
| 195 | 195 | |
| 196 | 196 | /** | 
| @@ -202,14 +202,14 @@ discard block | ||
| 202 | 202 | */ | 
| 203 | 203 |  	public function get_columns() { | 
| 204 | 204 | $columns = array( | 
| 205 | - 'name' => esc_html__( 'Name', 'give' ), | |
| 206 | - 'id' => esc_html__( 'ID', 'give' ), | |
| 207 | - 'email' => esc_html__( 'Email', 'give' ), | |
| 208 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), | |
| 209 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ) | |
| 205 | +			'name'          => esc_html__('Name', 'give'), | |
| 206 | +			'id'            => esc_html__('ID', 'give'), | |
| 207 | +			'email'         => esc_html__('Email', 'give'), | |
| 208 | +			'num_purchases' => esc_html__('Donations', 'give'), | |
| 209 | +			'amount_spent'  => esc_html__('Total Donated', 'give') | |
| 210 | 210 | ); | 
| 211 | 211 | |
| 212 | - return apply_filters( 'give_report_donor_columns', $columns ); | |
| 212 | +		return apply_filters('give_report_donor_columns', $columns); | |
| 213 | 213 | |
| 214 | 214 | } | 
| 215 | 215 | |
| @@ -222,10 +222,10 @@ discard block | ||
| 222 | 222 | */ | 
| 223 | 223 |  	public function get_sortable_columns() { | 
| 224 | 224 | return array( | 
| 225 | - 'id' => array( 'id', true ), | |
| 226 | - 'name' => array( 'name', true ), | |
| 227 | - 'num_purchases' => array( 'purchase_count', false ), | |
| 228 | - 'amount_spent' => array( 'purchase_value', false ), | |
| 225 | +			'id'            => array('id', true), | |
| 226 | +			'name'          => array('name', true), | |
| 227 | +			'num_purchases' => array('purchase_count', false), | |
| 228 | +			'amount_spent'  => array('purchase_value', false), | |
| 229 | 229 | ); | 
| 230 | 230 | } | 
| 231 | 231 | |
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | * @since 1.0 | 
| 237 | 237 | * @return void | 
| 238 | 238 | */ | 
| 239 | -	public function bulk_actions( $which = '' ) { | |
| 239 | +	public function bulk_actions($which = '') { | |
| 240 | 240 | |
| 241 | 241 | } | 
| 242 | 242 | |
| @@ -248,7 +248,7 @@ discard block | ||
| 248 | 248 | * @return int Current page number | 
| 249 | 249 | */ | 
| 250 | 250 |  	public function get_paged() { | 
| 251 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; | |
| 251 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; | |
| 252 | 252 | } | 
| 253 | 253 | |
| 254 | 254 | /** | 
| @@ -259,7 +259,7 @@ discard block | ||
| 259 | 259 | * @return mixed string If search is present, false otherwise | 
| 260 | 260 | */ | 
| 261 | 261 |  	public function get_search() { | 
| 262 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; | |
| 262 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; | |
| 263 | 263 | } | 
| 264 | 264 | |
| 265 | 265 | /** | 
| @@ -276,10 +276,10 @@ discard block | ||
| 276 | 276 | |
| 277 | 277 | $data = array(); | 
| 278 | 278 | $paged = $this->get_paged(); | 
| 279 | - $offset = $this->per_page * ( $paged - 1 ); | |
| 279 | + $offset = $this->per_page * ($paged - 1); | |
| 280 | 280 | $search = $this->get_search(); | 
| 281 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; | |
| 282 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; | |
| 281 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; | |
| 282 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; | |
| 283 | 283 | |
| 284 | 284 | $args = array( | 
| 285 | 285 | 'number' => $this->per_page, | 
| @@ -288,21 +288,21 @@ discard block | ||
| 288 | 288 | 'orderby' => $orderby | 
| 289 | 289 | ); | 
| 290 | 290 | |
| 291 | -		if ( is_email( $search ) ) { | |
| 291 | +		if (is_email($search)) { | |
| 292 | 292 | $args['email'] = $search; | 
| 293 | -		} elseif ( is_numeric( $search ) ) { | |
| 293 | +		} elseif (is_numeric($search)) { | |
| 294 | 294 | $args['id'] = $search; | 
| 295 | 295 | } | 
| 296 | 296 | |
| 297 | - $donors = Give()->customers->get_customers( $args ); | |
| 297 | + $donors = Give()->customers->get_customers($args); | |
| 298 | 298 | |
| 299 | -		if ( $donors ) { | |
| 299 | +		if ($donors) { | |
| 300 | 300 | |
| 301 | - $this->count = count( $donors ); | |
| 301 | + $this->count = count($donors); | |
| 302 | 302 | |
| 303 | -			foreach ( $donors as $donor ) { | |
| 303 | +			foreach ($donors as $donor) { | |
| 304 | 304 | |
| 305 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; | |
| 305 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; | |
| 306 | 306 | |
| 307 | 307 | $data[] = array( | 
| 308 | 308 | 'id' => $donor->id, | 
| @@ -335,16 +335,16 @@ discard block | ||
| 335 | 335 | $hidden = array(); // No hidden columns | 
| 336 | 336 | $sortable = $this->get_sortable_columns(); | 
| 337 | 337 | |
| 338 | - $this->_column_headers = array( $columns, $hidden, $sortable ); | |
| 338 | + $this->_column_headers = array($columns, $hidden, $sortable); | |
| 339 | 339 | |
| 340 | 340 | $this->items = $this->reports_data(); | 
| 341 | 341 | |
| 342 | 342 | $this->total = give_count_total_customers(); | 
| 343 | 343 | |
| 344 | - $this->set_pagination_args( array( | |
| 344 | + $this->set_pagination_args(array( | |
| 345 | 345 | 'total_items' => $this->total, | 
| 346 | 346 | 'per_page' => $this->per_page, | 
| 347 | - 'total_pages' => ceil( $this->total / $this->per_page ) | |
| 348 | - ) ); | |
| 347 | + 'total_pages' => ceil($this->total / $this->per_page) | |
| 348 | + )); | |
| 349 | 349 | } | 
| 350 | 350 | } | 
| 351 | 351 | \ No newline at end of file | 
| @@ -19,6 +19,6 @@ | ||
| 19 | 19 | * @return void | 
| 20 | 20 | */ | 
| 21 | 21 |  function give_disable_mandrill_nl2br() { | 
| 22 | - add_filter( 'mandrill_nl2br', '__return_false' ); | |
| 22 | +	add_filter('mandrill_nl2br', '__return_false'); | |
| 23 | 23 | } | 
| 24 | -add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br'); | |
| 24 | +add_action('give_email_send_before', 'give_disable_mandrill_nl2br'); | |
| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | * | 
| 50 | 50 | * @since: 1.4 | 
| 51 | 51 | * | 
| 52 | - * @return bool | |
| 52 | + * @return boolean|null | |
| 53 | 53 | */ | 
| 54 | 54 |  function give_allow_sessions_for_sysinfo() { | 
| 55 | 55 |  	if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { | 
| @@ -11,7 +11,7 @@ discard block | ||
| 11 | 11 | */ | 
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly | 
| 14 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | +if ( ! defined('ABSPATH')) { | |
| 15 | 15 | exit; | 
| 16 | 16 | } | 
| 17 | 17 | |
| @@ -24,14 +24,14 @@ discard block | ||
| 24 | 24 | */ | 
| 25 | 25 |  function give_system_info_callback() { | 
| 26 | 26 | |
| 27 | -	if ( ! current_user_can( 'manage_give_settings' ) ) { | |
| 27 | +	if ( ! current_user_can('manage_give_settings')) { | |
| 28 | 28 | return; | 
| 29 | 29 | } | 
| 30 | 30 | ?> | 
| 31 | - <textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give' ); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> | |
| 31 | +	<textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" aria-label="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'give'); ?>"><?php echo give_tools_sysinfo_get(); ?></textarea> | |
| 32 | 32 | <p class="submit"> | 
| 33 | 33 | <input type="hidden" name="give-action" value="download_sysinfo"/> | 
| 34 | - <?php submit_button( esc_html__( 'Download System Info File', 'give' ), 'secondary', 'give-download-sysinfo', false ); ?> | |
| 34 | +		<?php submit_button(esc_html__('Download System Info File', 'give'), 'secondary', 'give-download-sysinfo', false); ?> | |
| 35 | 35 | </p> | 
| 36 | 36 | <?php | 
| 37 | 37 | } | 
| @@ -47,12 +47,12 @@ discard block | ||
| 47 | 47 | * @return bool | 
| 48 | 48 | */ | 
| 49 | 49 |  function give_allow_sessions_for_sysinfo() { | 
| 50 | -	if ( is_admin() && ( isset( $_GET['page'] ) && isset( $_GET['tab'] ) ) && ( $_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings' ) ) { | |
| 50 | +	if (is_admin() && (isset($_GET['page']) && isset($_GET['tab'])) && ($_GET['tab'] == 'system_info' && $_GET['page'] == 'give-settings')) { | |
| 51 | 51 | return true; | 
| 52 | 52 | } | 
| 53 | 53 | } | 
| 54 | 54 | |
| 55 | -add_filter( 'give_start_session', 'give_allow_sessions_for_sysinfo' ); | |
| 55 | +add_filter('give_start_session', 'give_allow_sessions_for_sysinfo'); | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | /** | 
| @@ -67,63 +67,63 @@ discard block | ||
| 67 | 67 |  function give_tools_sysinfo_get() { | 
| 68 | 68 | global $wpdb, $give_options; | 
| 69 | 69 | |
| 70 | -	if ( ! class_exists( 'Browser' ) ) { | |
| 71 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php'; | |
| 70 | +	if ( ! class_exists('Browser')) { | |
| 71 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php'; | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | $browser = new Browser(); | 
| 75 | 75 | |
| 76 | 76 | // Get theme info | 
| 77 | -	if ( get_bloginfo( 'version' ) < '3.4' ) { | |
| 78 | - $theme_data = wp_get_theme( get_stylesheet_directory() . '/style.css' ); | |
| 79 | - $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; | |
| 77 | +	if (get_bloginfo('version') < '3.4') { | |
| 78 | + $theme_data = wp_get_theme(get_stylesheet_directory().'/style.css'); | |
| 79 | + $theme = $theme_data['Name'].' '.$theme_data['Version']; | |
| 80 | 80 |  	} else { | 
| 81 | 81 | $theme_data = wp_get_theme(); | 
| 82 | - $theme = $theme_data->Name . ' ' . $theme_data->Version; | |
| 82 | + $theme = $theme_data->Name.' '.$theme_data->Version; | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | // Try to identify the hosting provider | 
| 86 | 86 | $host = give_get_host(); | 
| 87 | 87 | |
| 88 | - $return = '### Begin System Info ###' . "\n\n"; | |
| 88 | + $return = '### Begin System Info ###'."\n\n"; | |
| 89 | 89 | |
| 90 | 90 | // Start with the basics... | 
| 91 | - $return .= '-- Site Info' . "\n\n"; | |
| 92 | - $return .= 'Site URL: ' . site_url() . "\n"; | |
| 93 | - $return .= 'Home URL: ' . home_url() . "\n"; | |
| 94 | - $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; | |
| 91 | + $return .= '-- Site Info'."\n\n"; | |
| 92 | + $return .= 'Site URL: '.site_url()."\n"; | |
| 93 | + $return .= 'Home URL: '.home_url()."\n"; | |
| 94 | + $return .= 'Multisite: '.(is_multisite() ? 'Yes' : 'No')."\n"; | |
| 95 | 95 | |
| 96 | - $return = apply_filters( 'give_sysinfo_after_site_info', $return ); | |
| 96 | +	$return = apply_filters('give_sysinfo_after_site_info', $return); | |
| 97 | 97 | |
| 98 | 98 | // Can we determine the site's host? | 
| 99 | -	if ( $host ) { | |
| 100 | - $return .= "\n" . '-- Hosting Provider' . "\n\n"; | |
| 101 | - $return .= 'Host: ' . $host . "\n"; | |
| 99 | +	if ($host) { | |
| 100 | + $return .= "\n".'-- Hosting Provider'."\n\n"; | |
| 101 | + $return .= 'Host: '.$host."\n"; | |
| 102 | 102 | |
| 103 | - $return = apply_filters( 'give_sysinfo_after_host_info', $return ); | |
| 103 | +		$return = apply_filters('give_sysinfo_after_host_info', $return); | |
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 | // The local users' browser information, handled by the Browser class | 
| 107 | - $return .= "\n" . '-- User Browser' . "\n\n"; | |
| 107 | + $return .= "\n".'-- User Browser'."\n\n"; | |
| 108 | 108 | $return .= $browser; | 
| 109 | 109 | |
| 110 | - $return = apply_filters( 'give_sysinfo_after_user_browser', $return ); | |
| 110 | +	$return = apply_filters('give_sysinfo_after_user_browser', $return); | |
| 111 | 111 | |
| 112 | 112 | // WordPress configuration | 
| 113 | - $return .= "\n" . '-- WordPress Configuration' . "\n\n"; | |
| 114 | - $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; | |
| 115 | - $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; | |
| 116 | - $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; | |
| 117 | - $return .= 'Active Theme: ' . $theme . "\n"; | |
| 118 | - $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; | |
| 113 | + $return .= "\n".'-- WordPress Configuration'."\n\n"; | |
| 114 | +	$return .= 'Version:                  '.get_bloginfo('version')."\n"; | |
| 115 | +	$return .= 'Language:                 '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n"; | |
| 116 | +	$return .= 'Permalink Structure:      '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n"; | |
| 117 | + $return .= 'Active Theme: '.$theme."\n"; | |
| 118 | +	$return .= 'Show On Front:            '.get_option('show_on_front')."\n"; | |
| 119 | 119 | |
| 120 | 120 | // Only show page specs if frontpage is set to 'page' | 
| 121 | -	if ( get_option( 'show_on_front' ) == 'page' ) { | |
| 122 | - $front_page_id = get_option( 'page_on_front' ); | |
| 123 | - $blog_page_id = get_option( 'page_for_posts' ); | |
| 121 | +	if (get_option('show_on_front') == 'page') { | |
| 122 | +		$front_page_id = get_option('page_on_front'); | |
| 123 | +		$blog_page_id  = get_option('page_for_posts'); | |
| 124 | 124 | |
| 125 | - $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; | |
| 126 | - $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; | |
| 125 | + $return .= 'Page On Front: '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n"; | |
| 126 | + $return .= 'Page For Posts: '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n"; | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | // Make sure wp_remote_post() is working | 
| @@ -132,205 +132,205 @@ discard block | ||
| 132 | 132 | $params = array( | 
| 133 | 133 | 'sslverify' => false, | 
| 134 | 134 | 'timeout' => 60, | 
| 135 | - 'user-agent' => 'Give/' . GIVE_VERSION, | |
| 135 | + 'user-agent' => 'Give/'.GIVE_VERSION, | |
| 136 | 136 | 'body' => $request | 
| 137 | 137 | ); | 
| 138 | 138 | |
| 139 | - $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); | |
| 139 | +	$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); | |
| 140 | 140 | |
| 141 | -	if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { | |
| 141 | +	if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { | |
| 142 | 142 | $WP_REMOTE_POST = 'wp_remote_post() works'; | 
| 143 | 143 |  	} else { | 
| 144 | 144 | $WP_REMOTE_POST = 'wp_remote_post() does not work'; | 
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | - $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; | |
| 148 | - $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; | |
| 149 | - $return .= 'Admin AJAX: ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; | |
| 150 | - $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; | |
| 151 | - $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; | |
| 152 | - $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; | |
| 147 | + $return .= 'Remote Post: '.$WP_REMOTE_POST."\n"; | |
| 148 | + $return .= 'Table Prefix: '.'Length: '.strlen($wpdb->prefix).' Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n"; | |
| 149 | + $return .= 'Admin AJAX: '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n"; | |
| 150 | +	$return .= 'WP_DEBUG:                 '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n"; | |
| 151 | + $return .= 'Memory Limit: '.WP_MEMORY_LIMIT."\n"; | |
| 152 | +	$return .= 'Registered Post Stati:    '.implode(', ', get_post_stati())."\n"; | |
| 153 | 153 | |
| 154 | - $return = apply_filters( 'give_sysinfo_after_wordpress_config', $return ); | |
| 154 | +	$return = apply_filters('give_sysinfo_after_wordpress_config', $return); | |
| 155 | 155 | |
| 156 | 156 | // GIVE configuration | 
| 157 | - $return .= "\n" . '-- Give Configuration' . "\n\n"; | |
| 158 | - $return .= 'Version: ' . GIVE_VERSION . "\n"; | |
| 159 | - $return .= 'Upgraded From: ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n"; | |
| 160 | - $return .= 'Test Mode: ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" ); | |
| 161 | - $return .= 'Currency Code: ' . give_get_currency() . "\n"; | |
| 162 | - $return .= 'Currency Position: ' . give_get_option( 'currency_position', 'before' ) . "\n"; | |
| 163 | - $return .= 'Decimal Separator: ' . give_get_option( 'decimal_separator', '.' ) . "\n"; | |
| 164 | - $return .= 'Thousands Separator: ' . give_get_option( 'thousands_separator', ',' ) . "\n"; | |
| 157 | + $return .= "\n".'-- Give Configuration'."\n\n"; | |
| 158 | + $return .= 'Version: '.GIVE_VERSION."\n"; | |
| 159 | +	$return .= 'Upgraded From:            '.get_option('give_version_upgraded_from', 'None')."\n"; | |
| 160 | + $return .= 'Test Mode: '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n"); | |
| 161 | + $return .= 'Currency Code: '.give_get_currency()."\n"; | |
| 162 | +	$return .= 'Currency Position:        '.give_get_option('currency_position', 'before')."\n"; | |
| 163 | +	$return .= 'Decimal Separator:        '.give_get_option('decimal_separator', '.')."\n"; | |
| 164 | +	$return .= 'Thousands Separator:      '.give_get_option('thousands_separator', ',')."\n"; | |
| 165 | 165 | |
| 166 | - $return = apply_filters( 'give_sysinfo_after_give_config', $return ); | |
| 166 | +	$return = apply_filters('give_sysinfo_after_give_config', $return); | |
| 167 | 167 | |
| 168 | 168 | // GIVE pages | 
| 169 | - $return .= "\n" . '-- Give Page Configuration' . "\n\n"; | |
| 170 | - $return .= 'Success Page: ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" ); | |
| 171 | - $return .= 'Failure Page: ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" ); | |
| 172 | - $return .= 'Give Forms Slug: ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" ); | |
| 169 | + $return .= "\n".'-- Give Page Configuration'."\n\n"; | |
| 170 | + $return .= 'Success Page: '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n"); | |
| 171 | + $return .= 'Failure Page: '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n"); | |
| 172 | +	$return .= 'Give Forms Slug:           '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n"); | |
| 173 | 173 | |
| 174 | - $return = apply_filters( 'give_sysinfo_after_give_pages', $return ); | |
| 174 | +	$return = apply_filters('give_sysinfo_after_give_pages', $return); | |
| 175 | 175 | |
| 176 | 176 | // GIVE gateways | 
| 177 | - $return .= "\n" . '-- Give Gateway Configuration' . "\n\n"; | |
| 177 | + $return .= "\n".'-- Give Gateway Configuration'."\n\n"; | |
| 178 | 178 | |
| 179 | 179 | $active_gateways = give_get_enabled_payment_gateways(); | 
| 180 | -	if ( $active_gateways ) { | |
| 181 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); | |
| 182 | -		if ( $default_gateway_is_active ) { | |
| 183 | - $default_gateway = give_get_default_gateway( null ); | |
| 184 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; | |
| 180 | +	if ($active_gateways) { | |
| 181 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); | |
| 182 | +		if ($default_gateway_is_active) { | |
| 183 | + $default_gateway = give_get_default_gateway(null); | |
| 184 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; | |
| 185 | 185 |  		} else { | 
| 186 | 186 | $default_gateway = 'Test Donation'; | 
| 187 | 187 | } | 
| 188 | 188 | |
| 189 | 189 | $gateways = array(); | 
| 190 | -		foreach ( $active_gateways as $gateway ) { | |
| 190 | +		foreach ($active_gateways as $gateway) { | |
| 191 | 191 | $gateways[] = $gateway['admin_label']; | 
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | - $return .= 'Enabled Gateways: ' . implode( ', ', $gateways ) . "\n"; | |
| 195 | - $return .= 'Default Gateway: ' . $default_gateway . "\n"; | |
| 194 | +		$return .= 'Enabled Gateways:         '.implode(', ', $gateways)."\n"; | |
| 195 | + $return .= 'Default Gateway: '.$default_gateway."\n"; | |
| 196 | 196 |  	} else { | 
| 197 | - $return .= 'Enabled Gateways: None' . "\n"; | |
| 197 | + $return .= 'Enabled Gateways: None'."\n"; | |
| 198 | 198 | } | 
| 199 | 199 | |
| 200 | - $return = apply_filters( 'give_sysinfo_after_give_gateways', $return ); | |
| 200 | +	$return = apply_filters('give_sysinfo_after_give_gateways', $return); | |
| 201 | 201 | |
| 202 | 202 | // GIVE Templates | 
| 203 | - $dir = get_stylesheet_directory() . '/give_templates/*'; | |
| 204 | -	if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) { | |
| 205 | - $return .= "\n" . '-- Give Template Overrides' . "\n\n"; | |
| 203 | + $dir = get_stylesheet_directory().'/give_templates/*'; | |
| 204 | +	if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) { | |
| 205 | + $return .= "\n".'-- Give Template Overrides'."\n\n"; | |
| 206 | 206 | |
| 207 | -		foreach ( glob( $dir ) as $file ) { | |
| 208 | - $return .= 'Filename: ' . basename( $file ) . "\n"; | |
| 207 | +		foreach (glob($dir) as $file) { | |
| 208 | + $return .= 'Filename: '.basename($file)."\n"; | |
| 209 | 209 | } | 
| 210 | 210 | |
| 211 | - $return = apply_filters( 'give_sysinfo_after_give_templates', $return ); | |
| 211 | +		$return = apply_filters('give_sysinfo_after_give_templates', $return); | |
| 212 | 212 | } | 
| 213 | 213 | |
| 214 | 214 | // Must-use plugins | 
| 215 | 215 | $muplugins = get_mu_plugins(); | 
| 216 | -	if ( count( $muplugins > 0 ) ) { | |
| 217 | - $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; | |
| 216 | +	if (count($muplugins > 0)) { | |
| 217 | + $return .= "\n".'-- Must-Use Plugins'."\n\n"; | |
| 218 | 218 | |
| 219 | -		foreach ( $muplugins as $plugin => $plugin_data ) { | |
| 220 | - $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; | |
| 219 | +		foreach ($muplugins as $plugin => $plugin_data) { | |
| 220 | + $return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n"; | |
| 221 | 221 | } | 
| 222 | 222 | |
| 223 | - $return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return ); | |
| 223 | +		$return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return); | |
| 224 | 224 | } | 
| 225 | 225 | |
| 226 | 226 | // WordPress active plugins | 
| 227 | - $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; | |
| 227 | + $return .= "\n".'-- WordPress Active Plugins'."\n\n"; | |
| 228 | 228 | |
| 229 | 229 | $plugins = get_plugins(); | 
| 230 | - $active_plugins = get_option( 'active_plugins', array() ); | |
| 230 | +	$active_plugins = get_option('active_plugins', array()); | |
| 231 | 231 | |
| 232 | -	foreach ( $plugins as $plugin_path => $plugin ) { | |
| 233 | -		if ( ! in_array( $plugin_path, $active_plugins ) ) { | |
| 232 | +	foreach ($plugins as $plugin_path => $plugin) { | |
| 233 | +		if ( ! in_array($plugin_path, $active_plugins)) { | |
| 234 | 234 | continue; | 
| 235 | 235 | } | 
| 236 | 236 | |
| 237 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; | |
| 237 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return ); | |
| 240 | +	$return = apply_filters('give_sysinfo_after_wordpress_plugins', $return); | |
| 241 | 241 | |
| 242 | 242 | // WordPress inactive plugins | 
| 243 | - $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; | |
| 243 | + $return .= "\n".'-- WordPress Inactive Plugins'."\n\n"; | |
| 244 | 244 | |
| 245 | -	foreach ( $plugins as $plugin_path => $plugin ) { | |
| 246 | -		if ( in_array( $plugin_path, $active_plugins ) ) { | |
| 245 | +	foreach ($plugins as $plugin_path => $plugin) { | |
| 246 | +		if (in_array($plugin_path, $active_plugins)) { | |
| 247 | 247 | continue; | 
| 248 | 248 | } | 
| 249 | 249 | |
| 250 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; | |
| 250 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; | |
| 251 | 251 | } | 
| 252 | 252 | |
| 253 | - $return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return ); | |
| 253 | +	$return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return); | |
| 254 | 254 | |
| 255 | -	if ( is_multisite() ) { | |
| 255 | +	if (is_multisite()) { | |
| 256 | 256 | // WordPress Multisite active plugins | 
| 257 | - $return .= "\n" . '-- Network Active Plugins' . "\n\n"; | |
| 257 | + $return .= "\n".'-- Network Active Plugins'."\n\n"; | |
| 258 | 258 | |
| 259 | 259 | $plugins = wp_get_active_network_plugins(); | 
| 260 | - $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); | |
| 260 | +		$active_plugins = get_site_option('active_sitewide_plugins', array()); | |
| 261 | 261 | |
| 262 | -		foreach ( $plugins as $plugin_path ) { | |
| 263 | - $plugin_base = plugin_basename( $plugin_path ); | |
| 262 | +		foreach ($plugins as $plugin_path) { | |
| 263 | + $plugin_base = plugin_basename($plugin_path); | |
| 264 | 264 | |
| 265 | -			if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { | |
| 265 | +			if ( ! array_key_exists($plugin_base, $active_plugins)) { | |
| 266 | 266 | continue; | 
| 267 | 267 | } | 
| 268 | 268 | |
| 269 | - $plugin = get_plugin_data( $plugin_path ); | |
| 270 | - $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; | |
| 269 | + $plugin = get_plugin_data($plugin_path); | |
| 270 | + $return .= $plugin['Name'].': '.$plugin['Version']."\n"; | |
| 271 | 271 | } | 
| 272 | 272 | |
| 273 | - $return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return ); | |
| 273 | +		$return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return); | |
| 274 | 274 | } | 
| 275 | 275 | |
| 276 | 276 | // Server configuration (really just versioning) | 
| 277 | - $return .= "\n" . '-- Webserver Configuration' . "\n\n"; | |
| 278 | - $return .= 'PHP Version: ' . PHP_VERSION . "\n"; | |
| 279 | - $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; | |
| 280 | - $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; | |
| 277 | + $return .= "\n".'-- Webserver Configuration'."\n\n"; | |
| 278 | + $return .= 'PHP Version: '.PHP_VERSION."\n"; | |
| 279 | + $return .= 'MySQL Version: '.$wpdb->db_version()."\n"; | |
| 280 | + $return .= 'Webserver Info: '.$_SERVER['SERVER_SOFTWARE']."\n"; | |
| 281 | 281 | |
| 282 | - $return = apply_filters( 'give_sysinfo_after_webserver_config', $return ); | |
| 282 | +	$return = apply_filters('give_sysinfo_after_webserver_config', $return); | |
| 283 | 283 | |
| 284 | 284 | // PHP configs... now we're getting to the important stuff | 
| 285 | - $return .= "\n" . '-- PHP Configuration' . "\n\n"; | |
| 286 | - $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); | |
| 287 | - $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; | |
| 288 | - $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; | |
| 289 | - $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; | |
| 290 | - $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; | |
| 291 | - $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; | |
| 292 | - $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; | |
| 293 | -	$return .= 'URL-aware fopen:          ' . ( ini_get( 'allow_url_fopen' ) ? 'On (' . ini_get( 'allow_url_fopen' ) . ')' : 'N/A' ) . "\n"; | |
| 294 | -	$return .= 'Display Errors:           ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; | |
| 295 | - | |
| 296 | - $return = apply_filters( 'give_sysinfo_after_php_config', $return ); | |
| 285 | + $return .= "\n".'-- PHP Configuration'."\n\n"; | |
| 286 | +	$return .= 'Safe Mode:                '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n"); | |
| 287 | +	$return .= 'Memory Limit:             '.ini_get('memory_limit')."\n"; | |
| 288 | +	$return .= 'Upload Max Size:          '.ini_get('upload_max_filesize')."\n"; | |
| 289 | +	$return .= 'Post Max Size:            '.ini_get('post_max_size')."\n"; | |
| 290 | +	$return .= 'Upload Max Filesize:      '.ini_get('upload_max_filesize')."\n"; | |
| 291 | +	$return .= 'Time Limit:               '.ini_get('max_execution_time')."\n"; | |
| 292 | +	$return .= 'Max Input Vars:           '.ini_get('max_input_vars')."\n"; | |
| 293 | +	$return .= 'URL-aware fopen:          '.(ini_get('allow_url_fopen') ? 'On ('.ini_get('allow_url_fopen').')' : 'N/A')."\n"; | |
| 294 | +	$return .= 'Display Errors:           '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n"; | |
| 295 | + | |
| 296 | +	$return = apply_filters('give_sysinfo_after_php_config', $return); | |
| 297 | 297 | |
| 298 | 298 | // PHP extensions and such | 
| 299 | - $return .= "\n" . '-- PHP Extensions' . "\n\n"; | |
| 300 | - $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; | |
| 299 | + $return .= "\n".'-- PHP Extensions'."\n\n"; | |
| 300 | +	$return .= 'cURL:                     '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n"; | |
| 301 | 301 | |
| 302 | 302 | //cURL version | 
| 303 | -	if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) { | |
| 303 | +	if (function_exists('curl_init') && function_exists('curl_version')) { | |
| 304 | 304 | $curl_values = curl_version(); | 
| 305 | - $return .= 'cURL Version: ' . $curl_values["version"] . "\n"; | |
| 305 | + $return .= 'cURL Version: '.$curl_values["version"]."\n"; | |
| 306 | 306 | } | 
| 307 | - $return .= 'zlib: ' . ( function_exists( 'gzcompress' ) ? 'Supported' : 'Not Supported' ) . "\n"; | |
| 308 | - $return .= 'GD: ' . ( ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ) ? 'Supported' : 'Not Supported' ) . "\n"; | |
| 309 | - $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; | |
| 310 | - $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; | |
| 311 | - $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; | |
| 312 | - $return .= 'DOM: ' . ( extension_loaded( 'dom' ) ? 'Installed' : 'Not Installed' ) . "\n"; | |
| 313 | - $return .= 'MBString: ' . ( extension_loaded( 'mbstring' ) ? 'Installed' : 'Not Installed' ) . "\n"; | |
| 307 | +	$return .= 'zlib:                     '.(function_exists('gzcompress') ? 'Supported' : 'Not Supported')."\n"; | |
| 308 | +	$return .= 'GD:                       '.((extension_loaded('gd') && function_exists('gd_info')) ? 'Supported' : 'Not Supported')."\n"; | |
| 309 | +	$return .= 'fsockopen:                '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n"; | |
| 310 | +	$return .= 'SOAP Client:              '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n"; | |
| 311 | +	$return .= 'Suhosin:                  '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n"; | |
| 312 | +	$return .= 'DOM:                      '.(extension_loaded('dom') ? 'Installed' : 'Not Installed')."\n"; | |
| 313 | +	$return .= 'MBString:                 '.(extension_loaded('mbstring') ? 'Installed' : 'Not Installed')."\n"; | |
| 314 | 314 | |
| 315 | - $return = apply_filters( 'give_sysinfo_after_php_ext', $return ); | |
| 315 | +	$return = apply_filters('give_sysinfo_after_php_ext', $return); | |
| 316 | 316 | |
| 317 | 317 | // Session stuff | 
| 318 | - $return .= "\n" . '-- Session Configuration' . "\n\n"; | |
| 319 | - $return .= 'Give Use Sessions: ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n"; | |
| 320 | - $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; | |
| 318 | + $return .= "\n".'-- Session Configuration'."\n\n"; | |
| 319 | +	$return .= 'Give Use Sessions:        '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n"; | |
| 320 | + $return .= 'Session: '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n"; | |
| 321 | 321 | |
| 322 | 322 | // The rest of this is only relevant is session is enabled | 
| 323 | -	if ( isset( $_SESSION ) ) { | |
| 324 | - $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; | |
| 325 | - $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; | |
| 326 | - $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; | |
| 327 | - $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; | |
| 328 | - $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; | |
| 323 | +	if (isset($_SESSION)) { | |
| 324 | +		$return .= 'Session Name:             '.esc_html(ini_get('session.name'))."\n"; | |
| 325 | +		$return .= 'Cookie Path:              '.esc_html(ini_get('session.cookie_path'))."\n"; | |
| 326 | +		$return .= 'Save Path:                '.esc_html(ini_get('session.save_path'))."\n"; | |
| 327 | +		$return .= 'Use Cookies:              '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n"; | |
| 328 | +		$return .= 'Use Only Cookies:         '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n"; | |
| 329 | 329 | } | 
| 330 | 330 | |
| 331 | - $return = apply_filters( 'give_sysinfo_after_session_config', $return ); | |
| 331 | +	$return = apply_filters('give_sysinfo_after_session_config', $return); | |
| 332 | 332 | |
| 333 | - $return .= "\n" . '### End System Info ###'; | |
| 333 | + $return .= "\n".'### End System Info ###'; | |
| 334 | 334 | |
| 335 | 335 | return $return; | 
| 336 | 336 | } | 
| @@ -344,17 +344,17 @@ discard block | ||
| 344 | 344 | */ | 
| 345 | 345 |  function give_tools_sysinfo_download() { | 
| 346 | 346 | |
| 347 | -	if ( ! current_user_can( 'manage_give_settings' ) ) { | |
| 347 | +	if ( ! current_user_can('manage_give_settings')) { | |
| 348 | 348 | return; | 
| 349 | 349 | } | 
| 350 | 350 | |
| 351 | 351 | nocache_headers(); | 
| 352 | 352 | |
| 353 | - header( 'Content-Type: text/plain' ); | |
| 354 | - header( 'Content-Disposition: attachment; filename="give-system-info.txt"' ); | |
| 353 | +	header('Content-Type: text/plain'); | |
| 354 | +	header('Content-Disposition: attachment; filename="give-system-info.txt"'); | |
| 355 | 355 | |
| 356 | - echo wp_strip_all_tags( $_POST['give-sysinfo'] ); | |
| 356 | + echo wp_strip_all_tags($_POST['give-sysinfo']); | |
| 357 | 357 | give_die(); | 
| 358 | 358 | } | 
| 359 | 359 | |
| 360 | -add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' ); | |
| 361 | 360 | \ No newline at end of file | 
| 361 | +add_action('give_download_sysinfo', 'give_tools_sysinfo_download'); | |
| 362 | 362 | \ No newline at end of file |