| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Dashboard Widgets | |
| 4 | - * | |
| 5 | - * @package Give | |
| 6 | - * @subpackage Admin/Dashboard | |
| 7 | - * @copyright Copyright (c) 2015, WordImpress | |
| 8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 9 | - * @since 1.0 | |
| 10 | - */ | |
| 3 | + * Dashboard Widgets | |
| 4 | + * | |
| 5 | + * @package Give | |
| 6 | + * @subpackage Admin/Dashboard | |
| 7 | + * @copyright Copyright (c) 2015, WordImpress | |
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 9 | + * @since 1.0 | |
| 10 | + */ | |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly | 
| 13 | 13 |  if ( ! defined( 'ABSPATH' ) ) { | 
| @@ -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 | |
| @@ -21,12 +21,12 @@ discard block | ||
| 21 | 21 | * @return void | 
| 22 | 22 | */ | 
| 23 | 23 |  function give_register_dashboard_widgets() { | 
| 24 | -	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { | |
| 25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); | |
| 24 | +	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { | |
| 25 | +		wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); | |
| 26 | 26 | } | 
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); | |
| 29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); | |
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | 32 | * Sales Summary Dashboard Widget | 
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 | */ | 
| 39 | 39 |  function give_dashboard_sales_widget() { | 
| 40 | 40 | |
| 41 | -	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { | |
| 41 | +	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { | |
| 42 | 42 | return; | 
| 43 | 43 | } | 
| 44 | 44 | $stats = new Give_Payment_Stats; ?> | 
| @@ -46,19 +46,19 @@ discard block | ||
| 46 | 46 | <div class="give-dashboard-widget"> | 
| 47 | 47 | |
| 48 | 48 | <div class="give-dashboard-today give-clearfix"> | 
| 49 | - <h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3> | |
| 49 | +			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3> | |
| 50 | 50 | |
| 51 | - <p class="give-dashboard-happy-day"><?php printf( __( 'Happy %1$s!', 'give' ), date( 'l', current_time( 'timestamp' ) ) ); ?></p> | |
| 51 | +			<p class="give-dashboard-happy-day"><?php printf(__('Happy %1$s!', 'give'), date('l', current_time('timestamp'))); ?></p> | |
| 52 | 52 | |
| 53 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> | |
| 53 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> | |
| 54 | 54 | |
| 55 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> | |
| 55 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> | |
| 56 | 56 | |
| 57 | - <p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array( | |
| 57 | + <p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array( | |
| 58 | 58 | 'publish', | 
| 59 | 59 | 'revoked' | 
| 60 | - ) ); ?><?php echo give_format_amount( $donations_today, false ); ?> | |
| 61 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> | |
| 60 | + )); ?><?php echo give_format_amount($donations_today, false); ?> | |
| 61 | +				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> | |
| 62 | 62 | </p> | 
| 63 | 63 | |
| 64 | 64 | |
| @@ -68,34 +68,34 @@ discard block | ||
| 68 | 68 | <table class="give-table-stats"> | 
| 69 | 69 | <thead style="display: none;"> | 
| 70 | 70 | <tr> | 
| 71 | - <th><?php _e( 'This Week', 'give' ); ?></th> | |
| 72 | - <th><?php _e( 'This Month', 'give' ); ?></th> | |
| 73 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> | |
| 71 | +				<th><?php _e('This Week', 'give'); ?></th> | |
| 72 | +				<th><?php _e('This Month', 'give'); ?></th> | |
| 73 | +				<th><?php _e('Past 30 Days', 'give'); ?></th> | |
| 74 | 74 | </tr> | 
| 75 | 75 | </thead> | 
| 76 | 76 | <tbody> | 
| 77 | 77 | <tr id="give-table-stats-tr-1"> | 
| 78 | 78 | <td> | 
| 79 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> | |
| 79 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> | |
| 80 | 80 | |
| 81 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this week', 'give' ); ?></p> | |
| 81 | +					<p class="give-dashboard-stat-total-label"><?php _e('this week', 'give'); ?></p> | |
| 82 | 82 | </td> | 
| 83 | 83 | <td> | 
| 84 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> | |
| 84 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> | |
| 85 | 85 | |
| 86 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this month', 'give' ); ?></p> | |
| 86 | +					<p class="give-dashboard-stat-total-label"><?php _e('this month', 'give'); ?></p> | |
| 87 | 87 | </td> | 
| 88 | 88 | </tr> | 
| 89 | 89 | <tr id="give-table-stats-tr-2"> | 
| 90 | 90 | <td> | 
| 91 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> | |
| 91 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> | |
| 92 | 92 | |
| 93 | - <p class="give-dashboard-stat-total-label"><?php _e( 'last month', 'give' ); ?></p> | |
| 93 | +					<p class="give-dashboard-stat-total-label"><?php _e('last month', 'give'); ?></p> | |
| 94 | 94 | </td> | 
| 95 | 95 | <td> | 
| 96 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> | |
| 96 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> | |
| 97 | 97 | |
| 98 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this year', 'give' ); ?></p> | |
| 98 | +					<p class="give-dashboard-stat-total-label"><?php _e('this year', 'give'); ?></p> | |
| 99 | 99 | </td> | 
| 100 | 100 | </tr> | 
| 101 | 101 | </tbody> | 
| @@ -115,19 +115,19 @@ discard block | ||
| 115 | 115 | * | 
| 116 | 116 | * @return array | 
| 117 | 117 | */ | 
| 118 | -function give_dashboard_at_a_glance_widget( $items ) { | |
| 119 | - $num_posts = wp_count_posts( 'give_forms' ); | |
| 118 | +function give_dashboard_at_a_glance_widget($items) { | |
| 119 | +	$num_posts = wp_count_posts('give_forms'); | |
| 120 | 120 | |
| 121 | -	if ( $num_posts && $num_posts->publish ) { | |
| 121 | +	if ($num_posts && $num_posts->publish) { | |
| 122 | 122 | |
| 123 | - $text = sprintf( _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural() ); | |
| 123 | +		$text = sprintf(_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural()); | |
| 124 | 124 | |
| 125 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); | |
| 125 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); | |
| 126 | 126 | |
| 127 | -		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { | |
| 128 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); | |
| 127 | +		if (current_user_can('edit_give_forms', get_current_user_id())) { | |
| 128 | +			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); | |
| 129 | 129 |  		} else { | 
| 130 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); | |
| 130 | +			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text); | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | $items[] = $text; | 
| @@ -136,4 +136,4 @@ discard block | ||
| 136 | 136 | return $items; | 
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); | |
| 139 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); | |