@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /* @var WPDB $wpdb */ |
| 51 | 51 | global $wpdb; |
| 52 | 52 | |
| 53 | - $wpdb->formmeta = $this->table_name = $wpdb->prefix . 'give_formmeta'; |
|
| 53 | + $wpdb->formmeta = $this->table_name = $wpdb->prefix.'give_formmeta'; |
|
| 54 | 54 | $this->primary_key = 'meta_id'; |
| 55 | 55 | $this->version = '1.0'; |
| 56 | 56 | |
@@ -84,6 +84,6 @@ discard block |
||
| 84 | 84 | * @return bool |
| 85 | 85 | */ |
| 86 | 86 | protected function is_custom_meta_table_active() { |
| 87 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
| 87 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
| 88 | 88 | } |
| 89 | 89 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Logs' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Logs. |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct() { |
| 36 | 36 | $this->id = 'logs'; |
| 37 | - $this->label = __( 'Logs', 'give' ); |
|
| 37 | + $this->label = __('Logs', 'give'); |
|
| 38 | 38 | |
| 39 | 39 | $this->default_tab = 'sales'; |
| 40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function get_settings() { |
| 52 | 52 | // Get settings. |
| 53 | - $settings = apply_filters( 'give_settings_logs', array( |
|
| 53 | + $settings = apply_filters('give_settings_logs', array( |
|
| 54 | 54 | array( |
| 55 | 55 | 'id' => 'give_tools_logs', |
| 56 | 56 | 'type' => 'title', |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ), |
| 59 | 59 | array( |
| 60 | 60 | 'id' => 'logs', |
| 61 | - 'name' => __( 'Log', 'give' ), |
|
| 61 | + 'name' => __('Log', 'give'), |
|
| 62 | 62 | 'type' => 'logs', |
| 63 | 63 | |
| 64 | 64 | ), |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | 'type' => 'sectionend', |
| 68 | 68 | 'table_html' => false, |
| 69 | 69 | ), |
| 70 | - ) ); |
|
| 70 | + )); |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * Filter the settings. |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @param array $settings |
| 78 | 78 | */ |
| 79 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 79 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 80 | 80 | |
| 81 | 81 | // Output. |
| 82 | 82 | return $settings; |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function get_sections() { |
| 92 | 92 | $sections = array( |
| 93 | - 'sales' => __( 'Donations', 'give' ), |
|
| 94 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
| 95 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
| 96 | - 'updates' => __( 'Updates', 'give' ), |
|
| 93 | + 'sales' => __('Donations', 'give'), |
|
| 94 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
| 95 | + 'api_requests' => __('API Requests', 'give'), |
|
| 96 | + 'updates' => __('Updates', 'give'), |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
| 99 | + $sections = apply_filters('give_log_views', $sections); |
|
| 100 | 100 | |
| 101 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 101 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function give_get_logs_tab() { |
| 24 | 24 | |
| 25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
| 25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
| 26 | 26 | |
| 27 | 27 | // Get current section. |
| 28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 1.0 |
| 34 | 34 | */ |
| 35 | - do_action( "give_logs_view_{$current_section}" ); |
|
| 35 | + do_action("give_logs_view_{$current_section}"); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function give_logs_view_sales() { |
| 48 | 48 | |
| 49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
| 49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
| 50 | 50 | |
| 51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
| 52 | 52 | $logs_table->prepare_items(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @since 1.8.12 |
| 61 | 61 | */ |
| 62 | - do_action( 'give_logs_donations_top' ); |
|
| 62 | + do_action('give_logs_donations_top'); |
|
| 63 | 63 | |
| 64 | 64 | $logs_table->display(); ?> |
| 65 | 65 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @since 1.8.12 |
| 75 | 75 | */ |
| 76 | - do_action( 'give_logs_donations_bottom' ); |
|
| 76 | + do_action('give_logs_donations_bottom'); |
|
| 77 | 77 | ?> |
| 78 | 78 | |
| 79 | 79 | </div> |
| 80 | 80 | <?php |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
| 83 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Update Logs |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | 92 | function give_logs_view_updates() { |
| 93 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' ); |
|
| 93 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php'); |
|
| 94 | 94 | |
| 95 | 95 | $logs_table = new Give_Update_Log_Table(); |
| 96 | 96 | $logs_table->prepare_items(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @since 2.0.1 |
| 105 | 105 | */ |
| 106 | - do_action( 'give_logs_update_top' ); |
|
| 106 | + do_action('give_logs_update_top'); |
|
| 107 | 107 | |
| 108 | 108 | $logs_table->display(); ?> |
| 109 | 109 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @since 2.0.1 |
| 119 | 119 | */ |
| 120 | - do_action( 'give_logs_update_bottom' ); |
|
| 120 | + do_action('give_logs_update_bottom'); |
|
| 121 | 121 | ?> |
| 122 | 122 | |
| 123 | 123 | </div> |
| 124 | 124 | <?php |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -add_action( 'give_logs_view_updates', 'give_logs_view_updates' ); |
|
| 127 | +add_action('give_logs_view_updates', 'give_logs_view_updates'); |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Gateway Error Logs |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | 137 | function give_logs_view_gateway_errors() { |
| 138 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
| 138 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
| 139 | 139 | |
| 140 | 140 | $logs_table = new Give_Gateway_Error_Log_Table(); |
| 141 | 141 | $logs_table->prepare_items(); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.8.12 |
| 150 | 150 | */ |
| 151 | - do_action( 'give_logs_payment_error_top' ); |
|
| 151 | + do_action('give_logs_payment_error_top'); |
|
| 152 | 152 | |
| 153 | 153 | $logs_table->display(); ?> |
| 154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @since 1.8.12 |
| 164 | 164 | */ |
| 165 | - do_action( 'give_logs_payment_error_bottom' ); |
|
| 165 | + do_action('give_logs_payment_error_bottom'); |
|
| 166 | 166 | ?> |
| 167 | 167 | |
| 168 | 168 | </div> |
| 169 | 169 | <?php |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
| 172 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * API Request Logs |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @return void |
| 181 | 181 | */ |
| 182 | 182 | function give_logs_view_api_requests() { |
| 183 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
| 183 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
| 184 | 184 | |
| 185 | 185 | $logs_table = new Give_API_Request_Log_Table(); |
| 186 | 186 | $logs_table->prepare_items(); |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @since 1.0 |
| 192 | 192 | */ |
| 193 | - do_action( 'give_logs_api_requests_top' ); |
|
| 193 | + do_action('give_logs_api_requests_top'); |
|
| 194 | 194 | |
| 195 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
| 195 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
| 196 | 196 | $logs_table->display(); |
| 197 | 197 | ?> |
| 198 | 198 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @since 1.0 |
| 208 | 208 | */ |
| 209 | - do_action( 'give_logs_api_requests_bottom' ); |
|
| 209 | + do_action('give_logs_api_requests_bottom'); |
|
| 210 | 210 | } |
| 211 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
| 211 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Renders the log views drop down. |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | $current_section = give_get_current_setting_section(); |
| 221 | 221 | |
| 222 | 222 | // If there are not any event attach to action then do not show form. |
| 223 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
| 223 | + if ( ! has_action('give_log_view_actions')) { |
|
| 224 | 224 | return; |
| 225 | 225 | } |
| 226 | 226 | ?> |
| 227 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
| 227 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
| 228 | 228 | <?php |
| 229 | 229 | /** |
| 230 | 230 | * Fires after displaying the reports page views drop down. |
@@ -233,14 +233,14 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @since 1.0 |
| 235 | 235 | */ |
| 236 | - do_action( 'give_log_view_actions' ); |
|
| 236 | + do_action('give_log_view_actions'); |
|
| 237 | 237 | ?> |
| 238 | 238 | |
| 239 | 239 | <input type="hidden" name="post_type" value="give_forms"/> |
| 240 | 240 | <input type="hidden" name="page" value="give-tools"/> |
| 241 | 241 | <input type="hidden" name="tab" value="logs"/> |
| 242 | 242 | |
| 243 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 243 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
| 244 | 244 | </form> |
| 245 | 245 | <?php |
| 246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | -function give_tools_set_form_method( $method ) { |
|
| 255 | +function give_tools_set_form_method($method) { |
|
| 256 | 256 | return 'get'; |
| 257 | 257 | } |
| 258 | -add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 ); |
|
| 258 | +add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10); |
|
@@ -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 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | - 'ajax' => false,// Does this table support ajax? |
|
| 52 | - ) ); |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | + 'ajax' => false, // Does this table support ajax? |
|
| 52 | + )); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function search_box( $text, $input_id ) { |
|
| 66 | + public function search_box($text, $input_id) { |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function get_columns() { |
| 78 | 78 | $columns = array( |
| 79 | - 'ID' => __( 'Log ID', 'give' ), |
|
| 80 | - 'date' => __( 'Date', 'give' ), |
|
| 81 | - 'details' => __( 'Process Details', 'give' ), |
|
| 79 | + 'ID' => __('Log ID', 'give'), |
|
| 80 | + 'date' => __('Date', 'give'), |
|
| 81 | + 'details' => __('Process Details', 'give'), |
|
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | return $columns; |
@@ -95,17 +95,17 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return string Column Name |
| 97 | 97 | */ |
| 98 | - public function column_default( $item, $column_name ) { |
|
| 99 | - switch ( $column_name ) { |
|
| 98 | + public function column_default($item, $column_name) { |
|
| 99 | + switch ($column_name) { |
|
| 100 | 100 | case 'ID': |
| 101 | 101 | return sprintf( |
| 102 | 102 | '<span class="give-item-label give-item-label-gray">%1$s</span> %2$s', |
| 103 | - esc_attr( $item[ $column_name ] ), |
|
| 104 | - esc_attr( $item['title'] ) |
|
| 103 | + esc_attr($item[$column_name]), |
|
| 104 | + esc_attr($item['title']) |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | default: |
| 108 | - return esc_attr( $item[ $column_name ] ); |
|
| 108 | + return esc_attr($item[$column_name]); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -119,24 +119,24 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return void |
| 121 | 121 | */ |
| 122 | - public function column_details( $item ) { |
|
| 123 | - echo Give()->tooltips->render_link( array( |
|
| 124 | - 'label' => __( 'View Update Log', 'give' ), |
|
| 122 | + public function column_details($item) { |
|
| 123 | + echo Give()->tooltips->render_link(array( |
|
| 124 | + 'label' => __('View Update Log', 'give'), |
|
| 125 | 125 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
| 126 | 126 | 'link' => "#TB_inline?width=640&inlineId=log-details-{$item['ID']}", |
| 127 | 127 | 'attributes' => array( |
| 128 | 128 | 'class' => 'thickbox give-error-log-details-link button button-small', |
| 129 | 129 | ), |
| 130 | - ) ); |
|
| 130 | + )); |
|
| 131 | 131 | ?> |
| 132 | 132 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
| 133 | 133 | <?php |
| 134 | 134 | |
| 135 | 135 | // Print Log Content, if not empty. |
| 136 | - if ( ! empty( $item['log_content'] ) ) { |
|
| 136 | + if ( ! empty($item['log_content'])) { |
|
| 137 | 137 | echo sprintf( |
| 138 | 138 | '<p><pre>%1$s</pre></div>', |
| 139 | - esc_html( $item['log_content'] ) |
|
| 139 | + esc_html($item['log_content']) |
|
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | ?> |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @param string $which |
| 159 | 159 | */ |
| 160 | - protected function display_tablenav( $which ) { |
|
| 161 | - if ( 'top' === $which ) { |
|
| 162 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 160 | + protected function display_tablenav($which) { |
|
| 161 | + if ('top' === $which) { |
|
| 162 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 163 | 163 | } |
| 164 | 164 | ?> |
| 165 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 165 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 166 | 166 | |
| 167 | 167 | <div class="alignleft actions bulkactions"> |
| 168 | - <?php $this->bulk_actions( $which ); ?> |
|
| 168 | + <?php $this->bulk_actions($which); ?> |
|
| 169 | 169 | </div> |
| 170 | 170 | <?php |
| 171 | - $this->extra_tablenav( $which ); |
|
| 172 | - $this->pagination( $which ); |
|
| 171 | + $this->extra_tablenav($which); |
|
| 172 | + $this->pagination($which); |
|
| 173 | 173 | ?> |
| 174 | 174 | |
| 175 | 175 | <br class="clear"/> |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return int Current page number |
| 187 | 187 | */ |
| 188 | 188 | public function get_paged() { |
| 189 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 189 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return void |
| 201 | 201 | */ |
| 202 | - function bulk_actions( $which = '' ) { |
|
| 202 | + function bulk_actions($which = '') { |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | 'posts_per_page' => $this->per_page, |
| 220 | 220 | ); |
| 221 | 221 | |
| 222 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
| 222 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
| 223 | 223 | |
| 224 | - if ( $logs ) { |
|
| 225 | - foreach ( $logs as $log ) { |
|
| 224 | + if ($logs) { |
|
| 225 | + foreach ($logs as $log) { |
|
| 226 | 226 | |
| 227 | 227 | $logs_data[] = array( |
| 228 | 228 | 'ID' => $log->ID, |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | $columns = $this->get_columns(); |
| 255 | 255 | $hidden = array(); // No hidden columns |
| 256 | 256 | $sortable = $this->get_sortable_columns(); |
| 257 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 257 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 258 | 258 | $this->items = $this->get_logs(); |
| 259 | - $total_items = Give()->logs->get_log_count( 0, 'update' ); |
|
| 259 | + $total_items = Give()->logs->get_log_count(0, 'update'); |
|
| 260 | 260 | |
| 261 | - $this->set_pagination_args( array( |
|
| 261 | + $this->set_pagination_args(array( |
|
| 262 | 262 | 'total_items' => $total_items, |
| 263 | 263 | 'per_page' => $this->per_page, |
| 264 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
| 264 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
| 265 | 265 | ) |
| 266 | 266 | ); |
| 267 | 267 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | * @since 1.8.17 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; // Exit if accessed directly |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Give_Import_Core_Settings' ) ) { |
|
| 18 | +if ( ! class_exists('Give_Import_Core_Settings')) { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Give_Import_Core_Settings. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return static |
| 69 | 69 | */ |
| 70 | 70 | public static function get_instance() { |
| 71 | - if ( null === static::$instance ) { |
|
| 71 | + if (null === static::$instance) { |
|
| 72 | 72 | self::$instance = new static(); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -95,26 +95,26 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | private function setup_hooks() { |
| 98 | - if ( ! $this->is_donations_import_page() ) { |
|
| 98 | + if ( ! $this->is_donations_import_page()) { |
|
| 99 | 99 | return; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Do not render main import tools page. |
| 103 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
| 103 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
| 104 | 104 | |
| 105 | 105 | // Render donation import page |
| 106 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
| 106 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
| 107 | 107 | |
| 108 | 108 | // Print the HTML. |
| 109 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
| 109 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
| 110 | 110 | |
| 111 | 111 | // Run when form submit. |
| 112 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
| 112 | + add_action('give-tools_save_import', array($this, 'save')); |
|
| 113 | 113 | |
| 114 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
| 114 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
| 115 | 115 | |
| 116 | 116 | // Used to add submit button. |
| 117 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
| 117 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return mixed |
| 128 | 128 | */ |
| 129 | - public function update_notices( $messages ) { |
|
| 130 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
| 131 | - unset( $messages['give-setting-updated'] ); |
|
| 129 | + public function update_notices($messages) { |
|
| 130 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
| 131 | + unset($messages['give-setting-updated']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | return $messages; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @since 1.8.17 |
| 141 | 141 | */ |
| 142 | 142 | public function submit() { |
| 143 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
| 143 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
| 144 | 144 | ?> |
| 145 | 145 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
| 146 | 146 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | id="<?php echo "step-{$step}"; ?>"> |
| 164 | 164 | <tbody> |
| 165 | 165 | <?php |
| 166 | - switch ( $this->get_step() ) { |
|
| 166 | + switch ($this->get_step()) { |
|
| 167 | 167 | case 1: |
| 168 | 168 | $this->render_upload_html(); |
| 169 | 169 | break; |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | public function import_success() { |
| 191 | 191 | // Imported successfully |
| 192 | 192 | |
| 193 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
| 194 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
| 193 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
| 194 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
| 195 | 195 | $query_arg_setting = array( |
| 196 | 196 | 'post_type' => 'give_forms', |
| 197 | 197 | 'page' => 'give-settings', |
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | - if ( $undo ) { |
|
| 200 | + if ($undo) { |
|
| 201 | 201 | $success = false; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -210,30 +210,30 @@ discard block |
||
| 210 | 210 | 'undo' => 'true', |
| 211 | 211 | ); |
| 212 | 212 | |
| 213 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
| 214 | - if ( $success ) { |
|
| 213 | + $title = __('Settings Importing Completed!', 'give'); |
|
| 214 | + if ($success) { |
|
| 215 | 215 | $query_arg_success['undo'] = '1'; |
| 216 | 216 | $query_arg_success['step'] = '3'; |
| 217 | 217 | $query_arg_success['success'] = '1'; |
| 218 | - $text = __( 'Undo Importing', 'give' ); |
|
| 218 | + $text = __('Undo Importing', 'give'); |
|
| 219 | 219 | } else { |
| 220 | - if ( $undo ) { |
|
| 221 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
| 222 | - update_option( 'give_settings', $host_give_options ); |
|
| 223 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
| 220 | + if ($undo) { |
|
| 221 | + $host_give_options = get_option('give_settings_old', array()); |
|
| 222 | + update_option('give_settings', $host_give_options); |
|
| 223 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
| 224 | 224 | } else { |
| 225 | - $title = __( 'Failed to import', 'give' ); |
|
| 225 | + $title = __('Failed to import', 'give'); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $text = __( 'Importing Again', 'give' ); |
|
| 228 | + $text = __('Importing Again', 'give'); |
|
| 229 | 229 | } |
| 230 | 230 | ?> |
| 231 | 231 | <tr valign="top" class="give-import-dropdown"> |
| 232 | 232 | <th colspan="2"> |
| 233 | 233 | <h2><?php echo $title; ?></h2> |
| 234 | 234 | <p> |
| 235 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
| 236 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a> |
|
| 235 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
| 236 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a> |
|
| 237 | 237 | </p> |
| 238 | 238 | </th> |
| 239 | 239 | </tr> |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | * @since 1.8.17 |
| 247 | 247 | */ |
| 248 | 248 | public function start_import() { |
| 249 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
| 250 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
| 249 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
| 250 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
| 251 | 251 | |
| 252 | 252 | ?> |
| 253 | 253 | <tr valign="top" class="give-import-dropdown"> |
| 254 | 254 | <th colspan="2"> |
| 255 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
| 256 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
| 255 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
| 256 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
| 257 | 257 | </th> |
| 258 | 258 | </tr> |
| 259 | 259 | |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | $step = $this->get_step(); |
| 287 | 287 | ?> |
| 288 | 288 | <ol class="give-progress-steps"> |
| 289 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
| 290 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
| 289 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
| 290 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
| 291 | 291 | </li> |
| 292 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
| 293 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
| 292 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
| 293 | + <?php esc_html_e('Import', 'give'); ?> |
|
| 294 | 294 | </li> |
| 295 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
| 296 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
| 295 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
| 296 | + <?php esc_html_e('Done!', 'give'); ?> |
|
| 297 | 297 | </li> |
| 298 | 298 | </ol> |
| 299 | 299 | <?php |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | * @return int $step on which step doest the import is on. |
| 308 | 308 | */ |
| 309 | 309 | public function get_step() { |
| 310 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
| 310 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
| 311 | 311 | $on_step = 1; |
| 312 | 312 | |
| 313 | - if ( empty( $step ) || 1 === $step ) { |
|
| 313 | + if (empty($step) || 1 === $step) { |
|
| 314 | 314 | $on_step = 1; |
| 315 | - } elseif ( 2 === $step ) { |
|
| 315 | + } elseif (2 === $step) { |
|
| 316 | 316 | $on_step = 2; |
| 317 | - } elseif ( 3 === $step ) { |
|
| 317 | + } elseif (3 === $step) { |
|
| 318 | 318 | $on_step = 3; |
| 319 | 319 | } |
| 320 | 320 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @since 1.8.17 |
| 328 | 328 | */ |
| 329 | 329 | public function render_page() { |
| 330 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
| 330 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -339,28 +339,28 @@ discard block |
||
| 339 | 339 | * @return void |
| 340 | 340 | */ |
| 341 | 341 | public function render_upload_html() { |
| 342 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
| 343 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
| 342 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
| 343 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
| 344 | 344 | $step = $this->get_step(); |
| 345 | 345 | |
| 346 | 346 | ?> |
| 347 | 347 | <tr valign="top"> |
| 348 | 348 | <th colspan="2"> |
| 349 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
| 350 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p> |
|
| 349 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
| 350 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p> |
|
| 351 | 351 | </th> |
| 352 | 352 | </tr> |
| 353 | 353 | |
| 354 | 354 | <tr valign="top"> |
| 355 | 355 | <th scope="row" class="titledesc"> |
| 356 | - <label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label> |
|
| 356 | + <label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label> |
|
| 357 | 357 | </th> |
| 358 | 358 | <td class="give-forminp"> |
| 359 | 359 | <div class="give-field-wrap"> |
| 360 | 360 | <label for="json"> |
| 361 | 361 | <input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>" |
| 362 | 362 | accept=".json"> |
| 363 | - <p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p> |
|
| 363 | + <p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p> |
|
| 364 | 364 | </label> |
| 365 | 365 | </div> |
| 366 | 366 | </td> |
@@ -369,20 +369,20 @@ discard block |
||
| 369 | 369 | $settings = array( |
| 370 | 370 | array( |
| 371 | 371 | 'id' => 'type', |
| 372 | - 'name' => __( 'Merge Type:', 'give' ), |
|
| 373 | - 'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ), |
|
| 372 | + 'name' => __('Merge Type:', 'give'), |
|
| 373 | + 'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'), |
|
| 374 | 374 | 'default' => $type, |
| 375 | 375 | 'type' => 'radio_inline', |
| 376 | 376 | 'options' => array( |
| 377 | - 'merge' => __( 'Merge', 'give' ), |
|
| 378 | - 'replace' => __( 'Replace', 'give' ), |
|
| 377 | + 'merge' => __('Merge', 'give'), |
|
| 378 | + 'replace' => __('Replace', 'give'), |
|
| 379 | 379 | ), |
| 380 | 380 | ), |
| 381 | 381 | ); |
| 382 | 382 | |
| 383 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
| 383 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
| 384 | 384 | |
| 385 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
| 385 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
| 386 | 386 | ?> |
| 387 | 387 | <tr valign="top"> |
| 388 | 388 | <th></th> |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | <input type="submit" |
| 391 | 391 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
| 392 | 392 | id="recount-stats-submit" |
| 393 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
| 393 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
| 394 | 394 | </th> |
| 395 | 395 | </tr> |
| 396 | 396 | <?php |
@@ -407,20 +407,20 @@ discard block |
||
| 407 | 407 | $step = $this->get_step(); |
| 408 | 408 | |
| 409 | 409 | // Validation for first step. |
| 410 | - if ( 1 === $step ) { |
|
| 411 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
| 410 | + if (1 === $step) { |
|
| 411 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
| 412 | 412 | $core_settings = self::upload_widget_settings_file(); |
| 413 | - if ( ! empty( $core_settings['error'] ) ) { |
|
| 414 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
| 413 | + if ( ! empty($core_settings['error'])) { |
|
| 414 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
| 415 | 415 | } else { |
| 416 | - $file_path = explode( '/', $core_settings['file'] ); |
|
| 417 | - $count = ( count( $file_path ) - 1 ); |
|
| 418 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
| 416 | + $file_path = explode('/', $core_settings['file']); |
|
| 417 | + $count = (count($file_path) - 1); |
|
| 418 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
| 419 | 419 | 'step' => '2', |
| 420 | 420 | 'importer-type' => $this->importer_type, |
| 421 | 421 | 'type' => $type, |
| 422 | - 'file_name' => $file_path[ $count ], |
|
| 423 | - ) ) ); |
|
| 422 | + 'file_name' => $file_path[$count], |
|
| 423 | + ))); |
|
| 424 | 424 | |
| 425 | 425 | ?> |
| 426 | 426 | <script type="text/javascript"> |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * @return bool |
| 439 | 439 | */ |
| 440 | 440 | private function is_donations_import_page() { |
| 441 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
| 441 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -447,14 +447,14 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public static function upload_widget_settings_file() { |
| 449 | 449 | $upload = false; |
| 450 | - if ( isset( $_FILES['json'] ) ) { |
|
| 451 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
| 450 | + if (isset($_FILES['json'])) { |
|
| 451 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
| 452 | 452 | |
| 453 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
| 453 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
| 454 | 454 | |
| 455 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
| 455 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
| 456 | 456 | } else { |
| 457 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
| 457 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $upload; |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @param array $existing_mimes |
| 467 | 467 | */ |
| 468 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
| 468 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
| 469 | 469 | $existing_mimes['json'] = 'application/json'; |
| 470 | 470 | |
| 471 | 471 | return $existing_mimes; |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /* @var WPDB $wpdb */ |
| 51 | 51 | global $wpdb; |
| 52 | 52 | |
| 53 | - $wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta'; |
|
| 53 | + $wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta'; |
|
| 54 | 54 | $this->primary_key = 'meta_id'; |
| 55 | 55 | $this->version = '1.0'; |
| 56 | 56 | |
@@ -84,6 +84,6 @@ discard block |
||
| 84 | 84 | * @return bool |
| 85 | 85 | */ |
| 86 | 86 | protected function is_custom_meta_table_active() { |
| 87 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
| 87 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
| 88 | 88 | } |
| 89 | 89 | } |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /* @var WPDB $wpdb */ |
| 51 | 51 | global $wpdb; |
| 52 | 52 | |
| 53 | - $wpdb->logmeta = $this->table_name = $wpdb->prefix . 'give_logmeta'; |
|
| 53 | + $wpdb->logmeta = $this->table_name = $wpdb->prefix.'give_logmeta'; |
|
| 54 | 54 | $this->primary_key = 'meta_id'; |
| 55 | 55 | $this->version = '1.0'; |
| 56 | 56 | |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function delete_row( $log_id = 0 ) { |
|
| 89 | + public function delete_row($log_id = 0) { |
|
| 90 | 90 | /* @var WPDB $wpdb */ |
| 91 | 91 | global $wpdb; |
| 92 | 92 | |
| 93 | 93 | // Row ID must be positive integer |
| 94 | - $log_id = absint( $log_id ); |
|
| 94 | + $log_id = absint($log_id); |
|
| 95 | 95 | |
| 96 | - if ( empty( $log_id ) ) { |
|
| 96 | + if (empty($log_id)) { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) { |
|
| 100 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE log_id = %d", $log_id))) { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | - protected function is_valid_post_type( $ID ) { |
|
| 117 | + protected function is_valid_post_type($ID) { |
|
| 118 | 118 | return $ID && true; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /* @var WPDB $wpdb */ |
| 54 | 54 | global $wpdb; |
| 55 | 55 | |
| 56 | - $wpdb->donormeta = $this->table_name = $wpdb->prefix . 'give_donormeta'; |
|
| 56 | + $wpdb->donormeta = $this->table_name = $wpdb->prefix.'give_donormeta'; |
|
| 57 | 57 | $this->primary_key = 'meta_id'; |
| 58 | 58 | $this->version = '1.0'; |
| 59 | 59 | |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return bool False for failure. True for success. |
| 92 | 92 | */ |
| 93 | - public function delete_all_meta( $donor_id = 0 ) { |
|
| 93 | + public function delete_all_meta($donor_id = 0) { |
|
| 94 | 94 | global $wpdb; |
| 95 | - $status = $wpdb->delete( $this->table_name, array( 'donor_id' => $donor_id ), array( '%d' ) ); |
|
| 95 | + $status = $wpdb->delete($this->table_name, array('donor_id' => $donor_id), array('%d')); |
|
| 96 | 96 | |
| 97 | - if( $status ) { |
|
| 98 | - Give_Cache::delete_group( $donor_id, 'give-donors' ); |
|
| 97 | + if ($status) { |
|
| 98 | + Give_Cache::delete_group($donor_id, 'give-donors'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | global $wpdb; |
| 112 | 112 | |
| 113 | 113 | if ( |
| 114 | - ! give_has_upgrade_completed( 'v20_rename_donor_tables' ) && |
|
| 115 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) ) |
|
| 114 | + ! give_has_upgrade_completed('v20_rename_donor_tables') && |
|
| 115 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta")) |
|
| 116 | 116 | ) { |
| 117 | 117 | $wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta"; |
| 118 | 118 | $this->meta_type = 'customer'; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
| 134 | - protected function is_valid_post_type( $ID ) { |
|
| 134 | + protected function is_valid_post_type($ID) { |
|
| 135 | 135 | return $ID && true; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -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 | |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Constructor. |
| 50 | 50 | */ |
| 51 | - public function __construct( $_step = 1 ) { |
|
| 52 | - parent::__construct( $_step ); |
|
| 51 | + public function __construct($_step = 1) { |
|
| 52 | + parent::__construct($_step); |
|
| 53 | 53 | |
| 54 | 54 | $this->is_writable = true; |
| 55 | 55 | } |
@@ -66,32 +66,32 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $args = array( |
| 68 | 68 | 'number' => $this->per_step, |
| 69 | - 'offset' => $this->per_step * ( $this->step - 1 ), |
|
| 69 | + 'offset' => $this->per_step * ($this->step - 1), |
|
| 70 | 70 | 'orderby' => 'id', |
| 71 | 71 | 'order' => 'DESC', |
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | - $donors = Give()->donors->get_donors( $args ); |
|
| 74 | + $donors = Give()->donors->get_donors($args); |
|
| 75 | 75 | |
| 76 | - if ( $donors ) { |
|
| 76 | + if ($donors) { |
|
| 77 | 77 | |
| 78 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
| 78 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
| 79 | 79 | |
| 80 | - foreach ( $donors as $donor ) { |
|
| 80 | + foreach ($donors as $donor) { |
|
| 81 | 81 | |
| 82 | - $attached_payment_ids = explode( ',', $donor->payment_ids ); |
|
| 82 | + $attached_payment_ids = explode(',', $donor->payment_ids); |
|
| 83 | 83 | |
| 84 | 84 | $attached_args = array( |
| 85 | 85 | 'post__in' => $attached_payment_ids, |
| 86 | - 'number' => - 1, |
|
| 86 | + 'number' => -1, |
|
| 87 | 87 | 'status' => $allowed_payment_status, |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - $attached_payments = (array) give_get_payments( $attached_args ); |
|
| 90 | + $attached_payments = (array) give_get_payments($attached_args); |
|
| 91 | 91 | |
| 92 | 92 | $unattached_args = array( |
| 93 | 93 | 'post__not_in' => $attached_payment_ids, |
| 94 | - 'number' => - 1, |
|
| 94 | + 'number' => -1, |
|
| 95 | 95 | 'status' => $allowed_payment_status, |
| 96 | 96 | 'meta_query' => array( |
| 97 | 97 | array( |
@@ -102,29 +102,29 @@ discard block |
||
| 102 | 102 | ), |
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
| 105 | + $unattached_payments = give_get_payments($unattached_args); |
|
| 106 | 106 | |
| 107 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
| 107 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
| 108 | 108 | |
| 109 | 109 | $purchase_value = 0.00; |
| 110 | 110 | $purchase_count = 0; |
| 111 | 111 | $payment_ids = array(); |
| 112 | 112 | |
| 113 | - if ( $payments ) { |
|
| 113 | + if ($payments) { |
|
| 114 | 114 | |
| 115 | - foreach ( $payments as $payment ) { |
|
| 115 | + foreach ($payments as $payment) { |
|
| 116 | 116 | |
| 117 | 117 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
| 118 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
| 118 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
| 119 | 119 | |
| 120 | - if ( true === $should_process_payment ) { |
|
| 120 | + if (true === $should_process_payment) { |
|
| 121 | 121 | |
| 122 | - if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) { |
|
| 123 | - $purchase_value += (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
| 122 | + if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) { |
|
| 123 | + $purchase_value += (float) give_donation_amount($payment->ID, array('type' => 'stats')); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) { |
|
| 127 | - $purchase_count ++; |
|
| 126 | + if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) { |
|
| 127 | + $purchase_count++; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $payment_ids = implode( ',', $payment_ids ); |
|
| 135 | + $payment_ids = implode(',', $payment_ids); |
|
| 136 | 136 | |
| 137 | 137 | $donor_update_data = array( |
| 138 | 138 | 'purchase_count' => $purchase_count, |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | 'payment_ids' => $payment_ids, |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $donor_instance = new Give_Donor( $donor->id ); |
|
| 144 | - $donor_instance->update( $donor_update_data ); |
|
| 143 | + $donor_instance = new Give_Donor($donor->id); |
|
| 144 | + $donor_instance->update($donor_update_data); |
|
| 145 | 145 | |
| 146 | 146 | }// End foreach(). |
| 147 | 147 | |
@@ -161,21 +161,21 @@ discard block |
||
| 161 | 161 | public function get_percentage_complete() { |
| 162 | 162 | |
| 163 | 163 | $args = array( |
| 164 | - 'number' => - 1, |
|
| 164 | + 'number' => -1, |
|
| 165 | 165 | 'orderby' => 'id', |
| 166 | 166 | 'order' => 'DESC', |
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | - $donors = Give()->donors->get_donors( $args ); |
|
| 170 | - $total = count( $donors ); |
|
| 169 | + $donors = Give()->donors->get_donors($args); |
|
| 170 | + $total = count($donors); |
|
| 171 | 171 | |
| 172 | 172 | $percentage = 100; |
| 173 | 173 | |
| 174 | - if ( $total > 0 ) { |
|
| 175 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 174 | + if ($total > 0) { |
|
| 175 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( $percentage > 100 ) { |
|
| 178 | + if ($percentage > 100) { |
|
| 179 | 179 | $percentage = 100; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param array $request The Form Data passed into the batch processing |
| 191 | 191 | */ |
| 192 | - public function set_properties( $request ) { |
|
| 192 | + public function set_properties($request) { |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -200,21 +200,21 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function process_step() { |
| 202 | 202 | |
| 203 | - if ( ! $this->can_export() ) { |
|
| 204 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 203 | + if ( ! $this->can_export()) { |
|
| 204 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array( |
|
| 205 | 205 | 'response' => 403, |
| 206 | - ) ); |
|
| 206 | + )); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | $had_data = $this->get_data(); |
| 210 | 210 | |
| 211 | - if ( $had_data ) { |
|
| 211 | + if ($had_data) { |
|
| 212 | 212 | $this->done = false; |
| 213 | 213 | |
| 214 | 214 | return true; |
| 215 | 215 | } else { |
| 216 | 216 | $this->done = true; |
| 217 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
| 217 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
| 218 | 218 | |
| 219 | 219 | return false; |
| 220 | 220 | } |