@@ -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,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array The altered list of views. |
| 25 | 25 | */ |
| 26 | -function give_register_default_donor_views( $views ) { |
|
| 26 | +function give_register_default_donor_views($views) { |
|
| 27 | 27 | |
| 28 | 28 | $default_views = array( |
| 29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | 'notes' => 'give_donor_notes_view', |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - return array_merge( $views, $default_views ); |
|
| 34 | + return array_merge($views, $default_views); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
| 38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return array The altered list of tabs |
| 48 | 48 | */ |
| 49 | -function give_register_default_donor_tabs( $tabs ) { |
|
| 49 | +function give_register_default_donor_tabs($tabs) { |
|
| 50 | 50 | |
| 51 | 51 | $default_tabs = array( |
| 52 | 52 | 'overview' => array( |
| 53 | 53 | 'dashicon' => 'dashicons-admin-users', |
| 54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
| 54 | + 'title' => __('Donor Profile', 'give'), |
|
| 55 | 55 | ), |
| 56 | 56 | 'notes' => array( |
| 57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
| 58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
| 58 | + 'title' => __('Donor Notes', 'give'), |
|
| 59 | 59 | ), |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - return array_merge( $tabs, $default_tabs ); |
|
| 62 | + return array_merge($tabs, $default_tabs); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
| 65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
| 75 | 75 | */ |
| 76 | -function give_register_delete_donor_tab( $tabs ) { |
|
| 76 | +function give_register_delete_donor_tab($tabs) { |
|
| 77 | 77 | |
| 78 | 78 | $tabs['delete'] = array( |
| 79 | 79 | 'dashicon' => 'dashicons-trash', |
| 80 | - 'title' => esc_html__( 'Delete Donor', 'give' ), |
|
| 80 | + 'title' => esc_html__('Delete Donor', 'give'), |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | return $tabs; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
| 86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
|
@@ -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 | |
@@ -25,48 +25,48 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_do_automatic_upgrades() { |
| 27 | 27 | $did_upgrade = false; |
| 28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
| 28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
| 29 | 29 | |
| 30 | - if ( ! $give_version ) { |
|
| 30 | + if ( ! $give_version) { |
|
| 31 | 31 | // 1.0 is the first version to use this option so we must add it. |
| 32 | 32 | $give_version = '1.0'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - switch ( true ) { |
|
| 35 | + switch (true) { |
|
| 36 | 36 | |
| 37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
| 37 | + case version_compare($give_version, '1.6', '<') : |
|
| 38 | 38 | give_v16_upgrades(); |
| 39 | 39 | $did_upgrade = true; |
| 40 | 40 | |
| 41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
| 41 | + case version_compare($give_version, '1.7', '<') : |
|
| 42 | 42 | give_v17_upgrades(); |
| 43 | 43 | $did_upgrade = true; |
| 44 | 44 | |
| 45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
| 45 | + case version_compare($give_version, '1.8', '<') : |
|
| 46 | 46 | give_v18_upgrades(); |
| 47 | 47 | $did_upgrade = true; |
| 48 | 48 | |
| 49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
| 49 | + case version_compare($give_version, '1.8.7', '<') : |
|
| 50 | 50 | give_v187_upgrades(); |
| 51 | 51 | $did_upgrade = true; |
| 52 | 52 | |
| 53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
| 53 | + case version_compare($give_version, '1.8.8', '<') : |
|
| 54 | 54 | give_v188_upgrades(); |
| 55 | 55 | $did_upgrade = true; |
| 56 | 56 | |
| 57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
| 57 | + case version_compare($give_version, '1.8.9', '<') : |
|
| 58 | 58 | give_v189_upgrades(); |
| 59 | 59 | $did_upgrade = true; |
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if ( $did_upgrade ) { |
|
| 64 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 63 | + if ($did_upgrade) { |
|
| 64 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
| 69 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
| 68 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
| 69 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Display Upgrade Notices |
@@ -76,18 +76,18 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function give_show_upgrade_notices() { |
| 78 | 78 | // Don't show notices on the upgrades page. |
| 79 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
| 79 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $give_version = get_option( 'give_version' ); |
|
| 83 | + $give_version = get_option('give_version'); |
|
| 84 | 84 | |
| 85 | - if ( ! $give_version ) { |
|
| 85 | + if ( ! $give_version) { |
|
| 86 | 86 | // 1.0 is the first version to use this option so we must add it. |
| 87 | 87 | $give_version = '1.0'; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 90 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 91 | 91 | |
| 92 | 92 | /* |
| 93 | 93 | * NOTICE: |
@@ -100,64 +100,64 @@ discard block |
||
| 100 | 100 | // Resume updates. |
| 101 | 101 | // Check if we have a stalled upgrade. |
| 102 | 102 | $resume_upgrade = give_maybe_resume_upgrade(); |
| 103 | - if ( ! empty( $resume_upgrade ) ) { |
|
| 104 | - $resume_url = add_query_arg( give_maybe_resume_upgrade(), admin_url( 'index.php' ) ); |
|
| 103 | + if ( ! empty($resume_upgrade)) { |
|
| 104 | + $resume_url = add_query_arg(give_maybe_resume_upgrade(), admin_url('index.php')); |
|
| 105 | 105 | |
| 106 | - Give()->notices->register_notice( array( |
|
| 106 | + Give()->notices->register_notice(array( |
|
| 107 | 107 | 'id' => 'give-resume-updates', |
| 108 | 108 | 'type' => 'warning', |
| 109 | 109 | 'description' => sprintf( |
| 110 | - __( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ), |
|
| 111 | - esc_url( $resume_url ) |
|
| 110 | + __('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'), |
|
| 111 | + esc_url($resume_url) |
|
| 112 | 112 | ), |
| 113 | - ) ); |
|
| 113 | + )); |
|
| 114 | 114 | |
| 115 | 115 | return; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // v1.3.2 Upgrades |
| 119 | - Give()->notices->register_notice( array( |
|
| 119 | + Give()->notices->register_notice(array( |
|
| 120 | 120 | 'id' => 'give-version-1-3-2-updates', |
| 121 | 121 | 'type' => 'warning', |
| 122 | 122 | 'description' => sprintf( |
| 123 | - '<p>' . __( 'Give 1.3.2 needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p>', |
|
| 124 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
| 123 | + '<p>'.__('Give 1.3.2 needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p>', |
|
| 124 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
| 125 | 125 | ), |
| 126 | - 'show' => ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ), |
|
| 127 | - ) ); |
|
| 126 | + 'show' => (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')), |
|
| 127 | + )); |
|
| 128 | 128 | |
| 129 | 129 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
| 130 | - Give()->notices->register_notice( array( |
|
| 130 | + Give()->notices->register_notice(array( |
|
| 131 | 131 | 'id' => 'give-version-1-3-4-updates', |
| 132 | 132 | 'type' => 'warning', |
| 133 | 133 | 'description' => sprintf( |
| 134 | - '<p>' . __( 'Give 1.3.4 needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p>', |
|
| 135 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
| 134 | + '<p>'.__('Give 1.3.4 needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p>', |
|
| 135 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
| 136 | 136 | ), |
| 137 | - 'show' => ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ), |
|
| 138 | - ) ); |
|
| 137 | + 'show' => (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))), |
|
| 138 | + )); |
|
| 139 | 139 | |
| 140 | 140 | // v1.8 form metadata upgrades. |
| 141 | - Give()->notices->register_notice( array( |
|
| 141 | + Give()->notices->register_notice(array( |
|
| 142 | 142 | 'id' => 'give-version-1-8-updates', |
| 143 | 143 | 'type' => 'warning', |
| 144 | 144 | 'description' => sprintf( |
| 145 | - __( 'Give 1.8 needs to upgrade the form database, click <a class="give-upgrade-link" href="%s">here</a> to start the upgrade.', 'give' ), |
|
| 146 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) |
|
| 145 | + __('Give 1.8 needs to upgrade the form database, click <a class="give-upgrade-link" href="%s">here</a> to start the upgrade.', 'give'), |
|
| 146 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')) |
|
| 147 | 147 | ), |
| 148 | - 'show' => ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) |
|
| 149 | - ) ); |
|
| 148 | + 'show' => (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) |
|
| 149 | + )); |
|
| 150 | 150 | |
| 151 | 151 | // v1.8.9 Upgrades |
| 152 | - Give()->notices->register_notice( array( |
|
| 152 | + Give()->notices->register_notice(array( |
|
| 153 | 153 | 'id' => 'give-version-1-8-9-updates', |
| 154 | 154 | 'type' => 'warning', |
| 155 | 155 | 'description' => sprintf( |
| 156 | - __( 'Give 1.8.9 needs to update the donation form\'s meta fields within database, click <a href="%s">here</a> to start the upgrade.', 'give' ), |
|
| 157 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=v189_upgrades_levels_post_meta' ) ) |
|
| 156 | + __('Give 1.8.9 needs to update the donation form\'s meta fields within database, click <a href="%s">here</a> to start the upgrade.', 'give'), |
|
| 157 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=v189_upgrades_levels_post_meta')) |
|
| 158 | 158 | ), |
| 159 | - 'show' => ( version_compare( $give_version, '1.8.9', '<' ) || ( ! give_has_upgrade_completed( 'v189_upgrades_levels_post_meta' ) ) ), |
|
| 160 | - ) ); |
|
| 159 | + 'show' => (version_compare($give_version, '1.8.9', '<') || ( ! give_has_upgrade_completed('v189_upgrades_levels_post_meta'))), |
|
| 160 | + )); |
|
| 161 | 161 | |
| 162 | 162 | // End 'Stepped' upgrade process notices. |
| 163 | 163 | ?> |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $upgrade_links.on('click', function (e) { |
| 169 | 169 | e.preventDefault(); |
| 170 | 170 | |
| 171 | - if (!window.confirm('<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>')) { |
|
| 171 | + if (!window.confirm('<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>')) { |
|
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | <?php |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
| 184 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * Triggers all upgrade functions |
@@ -193,29 +193,29 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | function give_trigger_upgrades() { |
| 195 | 195 | |
| 196 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 197 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 196 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 197 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 198 | 198 | 'response' => 403, |
| 199 | - ) ); |
|
| 199 | + )); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $give_version = get_option( 'give_version' ); |
|
| 202 | + $give_version = get_option('give_version'); |
|
| 203 | 203 | |
| 204 | - if ( ! $give_version ) { |
|
| 204 | + if ( ! $give_version) { |
|
| 205 | 205 | // 1.0 is the first version to use this option so we must add it. |
| 206 | 206 | $give_version = '1.0'; |
| 207 | - add_option( 'give_version', $give_version ); |
|
| 207 | + add_option('give_version', $give_version); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 211 | - delete_option( 'give_doing_upgrade' ); |
|
| 210 | + update_option('give_version', GIVE_VERSION); |
|
| 211 | + delete_option('give_doing_upgrade'); |
|
| 212 | 212 | |
| 213 | - if ( DOING_AJAX ) { |
|
| 214 | - die( 'complete' ); |
|
| 213 | + if (DOING_AJAX) { |
|
| 214 | + die('complete'); |
|
| 215 | 215 | } // End if(). |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
| 218 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * Check if the upgrade routine has been run for a specific action |
@@ -226,15 +226,15 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return bool If the action has been added to the completed actions array |
| 228 | 228 | */ |
| 229 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
| 229 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
| 230 | 230 | |
| 231 | - if ( empty( $upgrade_action ) ) { |
|
| 231 | + if (empty($upgrade_action)) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $completed_upgrades = give_get_completed_upgrades(); |
| 236 | 236 | |
| 237 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
| 237 | + return in_array($upgrade_action, $completed_upgrades); |
|
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
| 247 | 247 | */ |
| 248 | 248 | function give_maybe_resume_upgrade() { |
| 249 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
| 250 | - if ( empty( $doing_upgrade ) ) { |
|
| 249 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
| 250 | + if (empty($doing_upgrade)) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @return bool If the function was successfully added |
| 265 | 265 | */ |
| 266 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
| 266 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
| 267 | 267 | |
| 268 | - if ( empty( $upgrade_action ) ) { |
|
| 268 | + if (empty($upgrade_action)) { |
|
| 269 | 269 | return false; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | $completed_upgrades[] = $upgrade_action; |
| 274 | 274 | |
| 275 | 275 | // Remove any blanks, and only show uniques. |
| 276 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
| 276 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
| 277 | 277 | |
| 278 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
| 278 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | function give_get_completed_upgrades() { |
| 288 | 288 | |
| 289 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
| 289 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
| 290 | 290 | |
| 291 | - if ( false === $completed_upgrades ) { |
|
| 291 | + if (false === $completed_upgrades) { |
|
| 292 | 292 | $completed_upgrades = array(); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -305,31 +305,31 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | function give_v132_upgrade_give_payment_customer_id() { |
| 307 | 307 | global $wpdb; |
| 308 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 309 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 308 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 309 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 310 | 310 | 'response' => 403, |
| 311 | - ) ); |
|
| 311 | + )); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - ignore_user_abort( true ); |
|
| 314 | + ignore_user_abort(true); |
|
| 315 | 315 | |
| 316 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 317 | - @set_time_limit( 0 ); |
|
| 316 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 317 | + @set_time_limit(0); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // UPDATE DB METAKEYS. |
| 321 | 321 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
| 322 | - $query = $wpdb->query( $sql ); |
|
| 322 | + $query = $wpdb->query($sql); |
|
| 323 | 323 | |
| 324 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 325 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
| 326 | - delete_option( 'give_doing_upgrade' ); |
|
| 327 | - wp_redirect( admin_url() ); |
|
| 324 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 325 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
| 326 | + delete_option('give_doing_upgrade'); |
|
| 327 | + wp_redirect(admin_url()); |
|
| 328 | 328 | exit; |
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
| 332 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * Upgrades the Offline Status |
@@ -342,16 +342,16 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | global $wpdb; |
| 344 | 344 | |
| 345 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 346 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 345 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 346 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 347 | 347 | 'response' => 403, |
| 348 | - ) ); |
|
| 348 | + )); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - ignore_user_abort( true ); |
|
| 351 | + ignore_user_abort(true); |
|
| 352 | 352 | |
| 353 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 354 | - @set_time_limit( 0 ); |
|
| 353 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 354 | + @set_time_limit(0); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // Get abandoned offline payments. |
@@ -361,31 +361,31 @@ discard block |
||
| 361 | 361 | $where .= "AND ( p.post_status = 'abandoned' )"; |
| 362 | 362 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
| 363 | 363 | |
| 364 | - $sql = $select . $join . $where; |
|
| 365 | - $found_payments = $wpdb->get_col( $sql ); |
|
| 364 | + $sql = $select.$join.$where; |
|
| 365 | + $found_payments = $wpdb->get_col($sql); |
|
| 366 | 366 | |
| 367 | - foreach ( $found_payments as $payment ) { |
|
| 367 | + foreach ($found_payments as $payment) { |
|
| 368 | 368 | |
| 369 | 369 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
| 370 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
| 370 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
| 371 | 371 | |
| 372 | 372 | // 1450124863 = 12/10/2015 20:42:25. |
| 373 | - if ( $modified_time >= 1450124863 ) { |
|
| 373 | + if ($modified_time >= 1450124863) { |
|
| 374 | 374 | |
| 375 | - give_update_payment_status( $payment, 'pending' ); |
|
| 375 | + give_update_payment_status($payment, 'pending'); |
|
| 376 | 376 | |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 381 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
| 382 | - delete_option( 'give_doing_upgrade' ); |
|
| 383 | - wp_redirect( admin_url() ); |
|
| 380 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 381 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
| 382 | + delete_option('give_doing_upgrade'); |
|
| 383 | + wp_redirect(admin_url()); |
|
| 384 | 384 | exit; |
| 385 | 385 | |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
| 388 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
| 389 | 389 | |
| 390 | 390 | /** |
| 391 | 391 | * Cleanup User Roles |
@@ -396,17 +396,17 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | function give_v152_cleanup_users() { |
| 398 | 398 | |
| 399 | - $give_version = get_option( 'give_version' ); |
|
| 399 | + $give_version = get_option('give_version'); |
|
| 400 | 400 | |
| 401 | - if ( ! $give_version ) { |
|
| 401 | + if ( ! $give_version) { |
|
| 402 | 402 | // 1.0 is the first version to use this option so we must add it. |
| 403 | 403 | $give_version = '1.0'; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 406 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 407 | 407 | |
| 408 | 408 | // v1.5.2 Upgrades |
| 409 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
| 409 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
| 410 | 410 | |
| 411 | 411 | // Delete all caps with "ss". |
| 412 | 412 | // Also delete all unused "campaign" roles. |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | ); |
| 454 | 454 | |
| 455 | 455 | global $wp_roles; |
| 456 | - foreach ( $delete_caps as $cap ) { |
|
| 457 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 458 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 456 | + foreach ($delete_caps as $cap) { |
|
| 457 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 458 | + $wp_roles->remove_cap($role, $cap); |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -465,15 +465,15 @@ discard block |
||
| 465 | 465 | $roles->add_caps(); |
| 466 | 466 | |
| 467 | 467 | // The Update Ran. |
| 468 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 469 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
| 470 | - delete_option( 'give_doing_upgrade' ); |
|
| 468 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 469 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
| 470 | + delete_option('give_doing_upgrade'); |
|
| 471 | 471 | |
| 472 | 472 | }// End if(). |
| 473 | 473 | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
| 476 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | 479 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -516,53 +516,53 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | // Get addons license key. |
| 518 | 518 | $addons = array(); |
| 519 | - foreach ( $give_options as $key => $value ) { |
|
| 520 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
| 521 | - $addons[ $key ] = $value; |
|
| 519 | + foreach ($give_options as $key => $value) { |
|
| 520 | + if (false !== strpos($key, '_license_key')) { |
|
| 521 | + $addons[$key] = $value; |
|
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | // Bailout: We do not have any addon license data to upgrade. |
| 526 | - if ( empty( $addons ) ) { |
|
| 526 | + if (empty($addons)) { |
|
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - foreach ( $addons as $key => $addon_license ) { |
|
| 530 | + foreach ($addons as $key => $addon_license) { |
|
| 531 | 531 | |
| 532 | 532 | // Get addon shortname. |
| 533 | - $shortname = str_replace( '_license_key', '', $key ); |
|
| 533 | + $shortname = str_replace('_license_key', '', $key); |
|
| 534 | 534 | |
| 535 | 535 | // Addon license option name. |
| 536 | - $addon_license_option_name = $shortname . '_license_active'; |
|
| 536 | + $addon_license_option_name = $shortname.'_license_active'; |
|
| 537 | 537 | |
| 538 | 538 | // bailout if license is empty. |
| 539 | - if ( empty( $addon_license ) ) { |
|
| 540 | - delete_option( $addon_license_option_name ); |
|
| 539 | + if (empty($addon_license)) { |
|
| 540 | + delete_option($addon_license_option_name); |
|
| 541 | 541 | continue; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | // Get addon name. |
| 545 | 545 | $addon_name = array(); |
| 546 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
| 547 | - foreach ( $addon_name_parts as $name_part ) { |
|
| 546 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
| 547 | + foreach ($addon_name_parts as $name_part) { |
|
| 548 | 548 | |
| 549 | 549 | // Fix addon name |
| 550 | - switch ( $name_part ) { |
|
| 550 | + switch ($name_part) { |
|
| 551 | 551 | case 'authorizenet' : |
| 552 | 552 | $name_part = 'authorize.net'; |
| 553 | 553 | break; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - $addon_name[] = ucfirst( $name_part ); |
|
| 556 | + $addon_name[] = ucfirst($name_part); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $addon_name = implode( ' ', $addon_name ); |
|
| 559 | + $addon_name = implode(' ', $addon_name); |
|
| 560 | 560 | |
| 561 | 561 | // Data to send to the API |
| 562 | 562 | $api_params = array( |
| 563 | 563 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
| 564 | 564 | 'license' => $addon_license, |
| 565 | - 'item_name' => urlencode( $addon_name ), |
|
| 565 | + 'item_name' => urlencode($addon_name), |
|
| 566 | 566 | 'url' => home_url(), |
| 567 | 567 | ); |
| 568 | 568 | |
@@ -577,17 +577,17 @@ discard block |
||
| 577 | 577 | ); |
| 578 | 578 | |
| 579 | 579 | // Make sure there are no errors. |
| 580 | - if ( is_wp_error( $response ) ) { |
|
| 581 | - delete_option( $addon_license_option_name ); |
|
| 580 | + if (is_wp_error($response)) { |
|
| 581 | + delete_option($addon_license_option_name); |
|
| 582 | 582 | continue; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | // Tell WordPress to look for updates. |
| 586 | - set_site_transient( 'update_plugins', null ); |
|
| 586 | + set_site_transient('update_plugins', null); |
|
| 587 | 587 | |
| 588 | 588 | // Decode license data. |
| 589 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 590 | - update_option( $addon_license_option_name, $license_data ); |
|
| 589 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 590 | + update_option($addon_license_option_name, $license_data); |
|
| 591 | 591 | }// End foreach(). |
| 592 | 592 | } |
| 593 | 593 | |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | ); |
| 618 | 618 | |
| 619 | 619 | global $wp_roles; |
| 620 | - foreach ( $delete_caps as $cap ) { |
|
| 621 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 622 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 620 | + foreach ($delete_caps as $cap) { |
|
| 621 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 622 | + $wp_roles->remove_cap($role, $cap); |
|
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | function give_v18_upgrades_core_setting() { |
| 654 | 654 | // Core settings which changes from checkbox to radio. |
| 655 | 655 | $core_setting_names = array_merge( |
| 656 | - array_keys( give_v18_renamed_core_settings() ), |
|
| 656 | + array_keys(give_v18_renamed_core_settings()), |
|
| 657 | 657 | array( |
| 658 | 658 | 'uninstall_on_delete', |
| 659 | 659 | 'scripts_footer', |
@@ -665,48 +665,48 @@ discard block |
||
| 665 | 665 | ); |
| 666 | 666 | |
| 667 | 667 | // Bailout: If not any setting define. |
| 668 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
| 668 | + if ($give_settings = get_option('give_settings')) { |
|
| 669 | 669 | |
| 670 | 670 | $setting_changed = false; |
| 671 | 671 | |
| 672 | 672 | // Loop: check each setting field. |
| 673 | - foreach ( $core_setting_names as $setting_name ) { |
|
| 673 | + foreach ($core_setting_names as $setting_name) { |
|
| 674 | 674 | // New setting name. |
| 675 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
| 675 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
| 676 | 676 | |
| 677 | 677 | // Continue: If setting already set. |
| 678 | 678 | if ( |
| 679 | - array_key_exists( $new_setting_name, $give_settings ) |
|
| 680 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
| 679 | + array_key_exists($new_setting_name, $give_settings) |
|
| 680 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
| 681 | 681 | ) { |
| 682 | 682 | continue; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | // Set checkbox value to radio value. |
| 686 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
| 686 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
| 687 | 687 | |
| 688 | 688 | // @see https://github.com/WordImpress/Give/issues/1063 |
| 689 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
| 689 | + if (false !== strpos($setting_name, 'disable_')) { |
|
| 690 | 690 | |
| 691 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
| 692 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
| 691 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
| 692 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
| 693 | 693 | |
| 694 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
| 694 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | // Tell bot to update core setting to db. |
| 698 | - if ( ! $setting_changed ) { |
|
| 698 | + if ( ! $setting_changed) { |
|
| 699 | 699 | $setting_changed = true; |
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | // Update setting only if they changed. |
| 704 | - if ( $setting_changed ) { |
|
| 705 | - update_option( 'give_settings', $give_settings ); |
|
| 704 | + if ($setting_changed) { |
|
| 705 | + update_option('give_settings', $give_settings); |
|
| 706 | 706 | } |
| 707 | 707 | }// End if(). |
| 708 | 708 | |
| 709 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
| 709 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /** |
@@ -716,22 +716,22 @@ discard block |
||
| 716 | 716 | * @return void |
| 717 | 717 | */ |
| 718 | 718 | function give_v18_upgrades_form_metadata() { |
| 719 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 720 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 719 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 720 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 721 | 721 | 'response' => 403, |
| 722 | - ) ); |
|
| 722 | + )); |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - ignore_user_abort( true ); |
|
| 725 | + ignore_user_abort(true); |
|
| 726 | 726 | |
| 727 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 728 | - @set_time_limit( 0 ); |
|
| 727 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 728 | + @set_time_limit(0); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 731 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
| 732 | 732 | |
| 733 | 733 | // form query |
| 734 | - $forms = new WP_Query( array( |
|
| 734 | + $forms = new WP_Query(array( |
|
| 735 | 735 | 'paged' => $step, |
| 736 | 736 | 'status' => 'any', |
| 737 | 737 | 'order' => 'ASC', |
@@ -740,39 +740,39 @@ discard block |
||
| 740 | 740 | ) |
| 741 | 741 | ); |
| 742 | 742 | |
| 743 | - if ( $forms->have_posts() ) { |
|
| 744 | - while ( $forms->have_posts() ) { |
|
| 743 | + if ($forms->have_posts()) { |
|
| 744 | + while ($forms->have_posts()) { |
|
| 745 | 745 | $forms->the_post(); |
| 746 | 746 | |
| 747 | 747 | // Form content. |
| 748 | 748 | // Note in version 1.8 display content setting split into display content and content placement setting. |
| 749 | 749 | // You can delete _give_content_option in future |
| 750 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
| 751 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
| 752 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
| 753 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
| 750 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
| 751 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
| 752 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
| 753 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
| 754 | 754 | |
| 755 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
| 756 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
| 755 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
| 756 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | // "Disable" Guest Donation. Checkbox |
| 760 | 760 | // See: https://github.com/WordImpress/Give/issues/1470 |
| 761 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
| 762 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
| 763 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
| 761 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
| 762 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
| 763 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
| 764 | 764 | |
| 765 | 765 | // Offline Donations |
| 766 | 766 | // See: https://github.com/WordImpress/Give/issues/1579 |
| 767 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
| 768 | - if ( 'no' === $offline_donation ) { |
|
| 767 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
| 768 | + if ('no' === $offline_donation) { |
|
| 769 | 769 | $offline_donation_newval = 'global'; |
| 770 | - } elseif ( 'yes' === $offline_donation ) { |
|
| 770 | + } elseif ('yes' === $offline_donation) { |
|
| 771 | 771 | $offline_donation_newval = 'enabled'; |
| 772 | 772 | } else { |
| 773 | 773 | $offline_donation_newval = 'disabled'; |
| 774 | 774 | } |
| 775 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
| 775 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
| 776 | 776 | |
| 777 | 777 | // Convert yes/no setting field to enabled/disabled. |
| 778 | 778 | $form_radio_settings = array( |
@@ -792,15 +792,15 @@ discard block |
||
| 792 | 792 | '_give_offline_donation_enable_billing_fields_single', |
| 793 | 793 | ); |
| 794 | 794 | |
| 795 | - foreach ( $form_radio_settings as $meta_key ) { |
|
| 795 | + foreach ($form_radio_settings as $meta_key) { |
|
| 796 | 796 | // Get value. |
| 797 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
| 797 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
| 798 | 798 | |
| 799 | 799 | // Convert meta value only if it is in yes/no/none. |
| 800 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
| 800 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
| 801 | 801 | |
| 802 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
| 803 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
| 802 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
| 803 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | }// End while(). |
@@ -808,27 +808,27 @@ discard block |
||
| 808 | 808 | wp_reset_postdata(); |
| 809 | 809 | |
| 810 | 810 | // Forms found so upgrade them |
| 811 | - $step ++; |
|
| 812 | - $redirect = add_query_arg( array( |
|
| 811 | + $step++; |
|
| 812 | + $redirect = add_query_arg(array( |
|
| 813 | 813 | 'page' => 'give-upgrades', |
| 814 | 814 | 'give-upgrade' => 'give_v18_upgrades_form_metadata', |
| 815 | 815 | 'step' => $step, |
| 816 | - ), admin_url( 'index.php' ) ); |
|
| 817 | - wp_redirect( $redirect ); |
|
| 816 | + ), admin_url('index.php')); |
|
| 817 | + wp_redirect($redirect); |
|
| 818 | 818 | exit(); |
| 819 | 819 | |
| 820 | 820 | } else { |
| 821 | 821 | // No more forms found, finish up. |
| 822 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 823 | - delete_option( 'give_doing_upgrade' ); |
|
| 824 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
| 822 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 823 | + delete_option('give_doing_upgrade'); |
|
| 824 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
| 825 | 825 | |
| 826 | - wp_redirect( admin_url() ); |
|
| 826 | + wp_redirect(admin_url()); |
|
| 827 | 827 | exit; |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | -add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' ); |
|
| 831 | +add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata'); |
|
| 832 | 832 | |
| 833 | 833 | /** |
| 834 | 834 | * Get list of core setting renamed in version 1.8. |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | '_transient_give_stats_', |
| 875 | 875 | 'give_cache', |
| 876 | 876 | '_transient_give_add_ons_feed', |
| 877 | - '_transient__give_ajax_works' . |
|
| 877 | + '_transient__give_ajax_works'. |
|
| 878 | 878 | '_transient_give_total_api_keys', |
| 879 | 879 | '_transient_give_i18n_give_promo_hide', |
| 880 | 880 | '_transient_give_contributors', |
@@ -901,24 +901,24 @@ discard block |
||
| 901 | 901 | ARRAY_A |
| 902 | 902 | ); |
| 903 | 903 | |
| 904 | - if ( ! empty( $user_apikey_options ) ) { |
|
| 905 | - foreach ( $user_apikey_options as $user ) { |
|
| 906 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
| 907 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
| 908 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
| 904 | + if ( ! empty($user_apikey_options)) { |
|
| 905 | + foreach ($user_apikey_options as $user) { |
|
| 906 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
| 907 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
| 908 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - if ( ! empty( $cached_options ) ) { |
|
| 913 | - foreach ( $cached_options as $option ) { |
|
| 914 | - switch ( true ) { |
|
| 915 | - case ( false !== strpos( $option, 'transient' ) ): |
|
| 916 | - $option = str_replace( '_transient_', '', $option ); |
|
| 917 | - delete_transient( $option ); |
|
| 912 | + if ( ! empty($cached_options)) { |
|
| 913 | + foreach ($cached_options as $option) { |
|
| 914 | + switch (true) { |
|
| 915 | + case (false !== strpos($option, 'transient')): |
|
| 916 | + $option = str_replace('_transient_', '', $option); |
|
| 917 | + delete_transient($option); |
|
| 918 | 918 | break; |
| 919 | 919 | |
| 920 | 920 | default: |
| 921 | - delete_option( $option ); |
|
| 921 | + delete_option($option); |
|
| 922 | 922 | } |
| 923 | 923 | } |
| 924 | 924 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | global $wp_roles; |
| 937 | 937 | |
| 938 | 938 | // Get the role object. |
| 939 | - $give_worker = get_role( 'give_worker' ); |
|
| 939 | + $give_worker = get_role('give_worker'); |
|
| 940 | 940 | |
| 941 | 941 | // A list of capabilities to add for give workers. |
| 942 | 942 | $caps_to_add = array( |
@@ -944,9 +944,9 @@ discard block |
||
| 944 | 944 | 'edit_pages', |
| 945 | 945 | ); |
| 946 | 946 | |
| 947 | - foreach ( $caps_to_add as $cap ) { |
|
| 947 | + foreach ($caps_to_add as $cap) { |
|
| 948 | 948 | // Add the capability. |
| 949 | - $give_worker->add_cap( $cap ); |
|
| 949 | + $give_worker->add_cap($cap); |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | } |
@@ -960,22 +960,22 @@ discard block |
||
| 960 | 960 | */ |
| 961 | 961 | function give_v189_upgrades_levels_post_meta_callback() { |
| 962 | 962 | |
| 963 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 964 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 963 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 964 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 965 | 965 | 'response' => 403, |
| 966 | - ) ); |
|
| 966 | + )); |
|
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - ignore_user_abort( true ); |
|
| 969 | + ignore_user_abort(true); |
|
| 970 | 970 | |
| 971 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 972 | - @set_time_limit( 0 ); |
|
| 971 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 972 | + @set_time_limit(0); |
|
| 973 | 973 | } |
| 974 | 974 | |
| 975 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 975 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
| 976 | 976 | |
| 977 | 977 | // form query |
| 978 | - $donation_forms = new WP_Query( array( |
|
| 978 | + $donation_forms = new WP_Query(array( |
|
| 979 | 979 | 'paged' => $step, |
| 980 | 980 | 'status' => 'any', |
| 981 | 981 | 'order' => 'ASC', |
@@ -984,8 +984,8 @@ discard block |
||
| 984 | 984 | ) |
| 985 | 985 | ); |
| 986 | 986 | |
| 987 | - if ( $donation_forms->have_posts() ) { |
|
| 988 | - while ( $donation_forms->have_posts() ) { |
|
| 987 | + if ($donation_forms->have_posts()) { |
|
| 988 | + while ($donation_forms->have_posts()) { |
|
| 989 | 989 | $donation_forms->the_post(); |
| 990 | 990 | $form_id = get_the_ID(); |
| 991 | 991 | |
@@ -993,41 +993,41 @@ discard block |
||
| 993 | 993 | update_post_meta( |
| 994 | 994 | $form_id, |
| 995 | 995 | '_give_set_price', |
| 996 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
| 996 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
| 997 | 997 | ); |
| 998 | 998 | |
| 999 | 999 | // Remove formatting from _give_custom_amount_minimum |
| 1000 | 1000 | update_post_meta( |
| 1001 | 1001 | $form_id, |
| 1002 | 1002 | '_give_custom_amount_minimum', |
| 1003 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
| 1003 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
| 1004 | 1004 | ); |
| 1005 | 1005 | |
| 1006 | 1006 | // Bailout. |
| 1007 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
| 1007 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
| 1008 | 1008 | continue; |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
| 1011 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
| 1012 | 1012 | |
| 1013 | - if ( ! empty( $donation_levels ) ) { |
|
| 1013 | + if ( ! empty($donation_levels)) { |
|
| 1014 | 1014 | |
| 1015 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
| 1016 | - if( isset( $donation_level['_give_amount'] ) ) { |
|
| 1017 | - $donation_levels[$index]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
| 1015 | + foreach ($donation_levels as $index => $donation_level) { |
|
| 1016 | + if (isset($donation_level['_give_amount'])) { |
|
| 1017 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
| 1018 | 1018 | } |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
| 1021 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
| 1022 | 1022 | |
| 1023 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
| 1023 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
| 1024 | 1024 | |
| 1025 | - $min_amount = min( $donation_levels_amounts ); |
|
| 1026 | - $max_amount = max( $donation_levels_amounts ); |
|
| 1025 | + $min_amount = min($donation_levels_amounts); |
|
| 1026 | + $max_amount = max($donation_levels_amounts); |
|
| 1027 | 1027 | |
| 1028 | 1028 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
| 1029 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
| 1030 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
| 1029 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
| 1030 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | } |
@@ -1036,27 +1036,27 @@ discard block |
||
| 1036 | 1036 | wp_reset_postdata(); |
| 1037 | 1037 | |
| 1038 | 1038 | // Forms found so upgrade them |
| 1039 | - $step ++; |
|
| 1040 | - $redirect = add_query_arg( array( |
|
| 1039 | + $step++; |
|
| 1040 | + $redirect = add_query_arg(array( |
|
| 1041 | 1041 | 'page' => 'give-upgrades', |
| 1042 | 1042 | 'give-upgrade' => 'v189_upgrades_levels_post_meta', |
| 1043 | 1043 | 'step' => $step, |
| 1044 | - ), admin_url( 'index.php' ) ); |
|
| 1045 | - wp_redirect( $redirect ); |
|
| 1044 | + ), admin_url('index.php')); |
|
| 1045 | + wp_redirect($redirect); |
|
| 1046 | 1046 | exit(); |
| 1047 | 1047 | } else { |
| 1048 | 1048 | // The Update Ran. |
| 1049 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 1050 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
| 1051 | - delete_option( 'give_doing_upgrade' ); |
|
| 1049 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 1050 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
| 1051 | + delete_option('give_doing_upgrade'); |
|
| 1052 | 1052 | |
| 1053 | - wp_redirect( admin_url() ); |
|
| 1053 | + wp_redirect(admin_url()); |
|
| 1054 | 1054 | exit; |
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | -add_action( 'give_v189_upgrades_levels_post_meta', 'give_v189_upgrades_levels_post_meta_callback' ); |
|
| 1059 | +add_action('give_v189_upgrades_levels_post_meta', 'give_v189_upgrades_levels_post_meta_callback'); |
|
| 1060 | 1060 | |
| 1061 | 1061 | |
| 1062 | 1062 | /** |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return string Donations dropdown. |
| 37 | 37 | */ |
| 38 | - public function donations_dropdown( $args = array() ) { |
|
| 38 | + public function donations_dropdown($args = array()) { |
|
| 39 | 39 | |
| 40 | 40 | $defaults = array( |
| 41 | 41 | 'name' => 'donations', |
@@ -45,32 +45,32 @@ discard block |
||
| 45 | 45 | 'selected' => 0, |
| 46 | 46 | 'chosen' => false, |
| 47 | 47 | 'number' => 30, |
| 48 | - 'placeholder' => __( 'Select a donation', 'give' ), |
|
| 48 | + 'placeholder' => __('Select a donation', 'give'), |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - $args = wp_parse_args( $args, $defaults ); |
|
| 51 | + $args = wp_parse_args($args, $defaults); |
|
| 52 | 52 | |
| 53 | - $payments = new Give_Payments_Query( array( |
|
| 53 | + $payments = new Give_Payments_Query(array( |
|
| 54 | 54 | 'number' => $args['number'], |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | $payments = $payments->get_payments(); |
| 58 | 58 | |
| 59 | 59 | $options = array(); |
| 60 | 60 | |
| 61 | 61 | // Provide nice human readable options. |
| 62 | - if ( $payments ) { |
|
| 62 | + if ($payments) { |
|
| 63 | 63 | $options[0] = $args['placeholder']; |
| 64 | - foreach ( $payments as $payment ) { |
|
| 64 | + foreach ($payments as $payment) { |
|
| 65 | 65 | |
| 66 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
| 66 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | - $options[0] = __( 'No donations found.', 'give' ); |
|
| 70 | + $options[0] = __('No donations found.', 'give'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $output = $this->select( array( |
|
| 73 | + $output = $this->select(array( |
|
| 74 | 74 | 'name' => $args['name'], |
| 75 | 75 | 'selected' => $args['selected'], |
| 76 | 76 | 'id' => $args['id'], |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'select_atts' => $args['select_atts'], |
| 83 | 83 | 'show_option_all' => false, |
| 84 | 84 | 'show_option_none' => false, |
| 85 | - ) ); |
|
| 85 | + )); |
|
| 86 | 86 | |
| 87 | 87 | return $output; |
| 88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return string Give forms dropdown. |
| 101 | 101 | */ |
| 102 | - public function forms_dropdown( $args = array() ) { |
|
| 102 | + public function forms_dropdown($args = array()) { |
|
| 103 | 103 | |
| 104 | 104 | $defaults = array( |
| 105 | 105 | 'name' => 'forms', |
@@ -109,39 +109,39 @@ discard block |
||
| 109 | 109 | 'selected' => 0, |
| 110 | 110 | 'chosen' => false, |
| 111 | 111 | 'number' => 30, |
| 112 | - 'placeholder' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
| 112 | + 'placeholder' => esc_attr__('Select a Donation Form', 'give'), |
|
| 113 | 113 | 'data' => array( |
| 114 | 114 | 'search-type' => 'form', |
| 115 | 115 | ), |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - $args = wp_parse_args( $args, $defaults ); |
|
| 118 | + $args = wp_parse_args($args, $defaults); |
|
| 119 | 119 | |
| 120 | - $forms = get_posts( array( |
|
| 120 | + $forms = get_posts(array( |
|
| 121 | 121 | 'post_type' => 'give_forms', |
| 122 | 122 | 'orderby' => 'title', |
| 123 | 123 | 'order' => 'ASC', |
| 124 | 124 | 'posts_per_page' => $args['number'], |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $options = array(); |
| 128 | 128 | |
| 129 | 129 | // Ensure the selected. |
| 130 | - if ( false !== $args['selected'] && $args['selected'] !== 0 ) { |
|
| 131 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
| 130 | + if (false !== $args['selected'] && $args['selected'] !== 0) { |
|
| 131 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( $forms ) { |
|
| 134 | + if ($forms) { |
|
| 135 | 135 | $options[0] = $args['placeholder']; |
| 136 | - foreach ( $forms as $form ) { |
|
| 137 | - $form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title; |
|
| 138 | - $options[ absint( $form->ID ) ] = esc_html( $form_title ); |
|
| 136 | + foreach ($forms as $form) { |
|
| 137 | + $form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title; |
|
| 138 | + $options[absint($form->ID)] = esc_html($form_title); |
|
| 139 | 139 | } |
| 140 | 140 | } else { |
| 141 | - $options[0] = esc_html__( 'No forms found.', 'give' ); |
|
| 141 | + $options[0] = esc_html__('No forms found.', 'give'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $output = $this->select( array( |
|
| 144 | + $output = $this->select(array( |
|
| 145 | 145 | 'name' => $args['name'], |
| 146 | 146 | 'selected' => $args['selected'], |
| 147 | 147 | 'id' => $args['id'], |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'show_option_all' => false, |
| 154 | 154 | 'show_option_none' => false, |
| 155 | 155 | 'data' => $args['data'], |
| 156 | - ) ); |
|
| 156 | + )); |
|
| 157 | 157 | |
| 158 | 158 | return $output; |
| 159 | 159 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return string Donors dropdown. |
| 172 | 172 | */ |
| 173 | - public function donor_dropdown( $args = array() ) { |
|
| 173 | + public function donor_dropdown($args = array()) { |
|
| 174 | 174 | |
| 175 | 175 | $defaults = array( |
| 176 | 176 | 'name' => 'donors', |
@@ -179,57 +179,57 @@ discard block |
||
| 179 | 179 | 'multiple' => false, |
| 180 | 180 | 'selected' => 0, |
| 181 | 181 | 'chosen' => true, |
| 182 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
| 182 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
| 183 | 183 | 'number' => 30, |
| 184 | 184 | 'data' => array( |
| 185 | 185 | 'search-type' => 'donor', |
| 186 | 186 | ), |
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | - $args = wp_parse_args( $args, $defaults ); |
|
| 189 | + $args = wp_parse_args($args, $defaults); |
|
| 190 | 190 | |
| 191 | - $donors = Give()->donors->get_donors( array( |
|
| 191 | + $donors = Give()->donors->get_donors(array( |
|
| 192 | 192 | 'number' => $args['number'] |
| 193 | - ) ); |
|
| 193 | + )); |
|
| 194 | 194 | |
| 195 | 195 | $options = array(); |
| 196 | 196 | |
| 197 | - if ( $donors ) { |
|
| 198 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
| 199 | - foreach ( $donors as $donor ) { |
|
| 200 | - $options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
| 197 | + if ($donors) { |
|
| 198 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
| 199 | + foreach ($donors as $donor) { |
|
| 200 | + $options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')'); |
|
| 201 | 201 | } |
| 202 | 202 | } else { |
| 203 | - $options[0] = esc_html__( 'No donors found.', 'give' ); |
|
| 203 | + $options[0] = esc_html__('No donors found.', 'give'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if ( ! empty( $args['selected'] ) ) { |
|
| 206 | + if ( ! empty($args['selected'])) { |
|
| 207 | 207 | |
| 208 | 208 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
| 209 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
| 209 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
| 210 | 210 | |
| 211 | - $donor = new Give_Donor( $args['selected'] ); |
|
| 211 | + $donor = new Give_Donor($args['selected']); |
|
| 212 | 212 | |
| 213 | - if ( $donor ) { |
|
| 213 | + if ($donor) { |
|
| 214 | 214 | |
| 215 | - $options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
| 215 | + $options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')'); |
|
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $output = $this->select( array( |
|
| 221 | + $output = $this->select(array( |
|
| 222 | 222 | 'name' => $args['name'], |
| 223 | 223 | 'selected' => $args['selected'], |
| 224 | 224 | 'id' => $args['id'], |
| 225 | - 'class' => $args['class'] . ' give-customer-select', |
|
| 225 | + 'class' => $args['class'].' give-customer-select', |
|
| 226 | 226 | 'options' => $options, |
| 227 | 227 | 'multiple' => $args['multiple'], |
| 228 | 228 | 'chosen' => $args['chosen'], |
| 229 | 229 | 'show_option_all' => false, |
| 230 | 230 | 'show_option_none' => false, |
| 231 | 231 | 'data' => $args['data'], |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | 234 | return $output; |
| 235 | 235 | } |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return string Categories dropdown. |
| 250 | 250 | */ |
| 251 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) { |
|
| 252 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
| 251 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) { |
|
| 252 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
| 253 | 253 | $options = array(); |
| 254 | 254 | |
| 255 | - foreach ( $categories as $category ) { |
|
| 256 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
| 255 | + foreach ($categories as $category) { |
|
| 256 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 259 | + $output = $this->select(wp_parse_args($args, array( |
|
| 260 | 260 | 'name' => $name, |
| 261 | 261 | 'selected' => $selected, |
| 262 | 262 | 'options' => $options, |
| 263 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
| 263 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
| 264 | 264 | 'show_option_none' => false, |
| 265 | - ) ) ); |
|
| 265 | + ))); |
|
| 266 | 266 | |
| 267 | 267 | return $output; |
| 268 | 268 | } |
@@ -281,21 +281,21 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return string Tags dropdown. |
| 283 | 283 | */ |
| 284 | - public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) { |
|
| 285 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
| 284 | + public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) { |
|
| 285 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
| 286 | 286 | $options = array(); |
| 287 | 287 | |
| 288 | - foreach ( $tags as $tag ) { |
|
| 289 | - $options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
| 288 | + foreach ($tags as $tag) { |
|
| 289 | + $options[absint($tag->term_id)] = esc_html($tag->name); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $output = $this->select( wp_parse_args( $args, array( |
|
| 292 | + $output = $this->select(wp_parse_args($args, array( |
|
| 293 | 293 | 'name' => $name, |
| 294 | 294 | 'selected' => $selected, |
| 295 | 295 | 'options' => $options, |
| 296 | - 'show_option_all' => esc_html__( 'All Tags', 'give' ), |
|
| 296 | + 'show_option_all' => esc_html__('All Tags', 'give'), |
|
| 297 | 297 | 'show_option_none' => false, |
| 298 | - ) ) ); |
|
| 298 | + ))); |
|
| 299 | 299 | |
| 300 | 300 | return $output; |
| 301 | 301 | } |
@@ -315,25 +315,25 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string Years dropdown. |
| 317 | 317 | */ |
| 318 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
| 319 | - $current = date( 'Y' ); |
|
| 320 | - $start_year = $current - absint( $years_before ); |
|
| 321 | - $end_year = $current + absint( $years_after ); |
|
| 322 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
| 318 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
| 319 | + $current = date('Y'); |
|
| 320 | + $start_year = $current - absint($years_before); |
|
| 321 | + $end_year = $current + absint($years_after); |
|
| 322 | + $selected = empty($selected) ? date('Y') : $selected; |
|
| 323 | 323 | $options = array(); |
| 324 | 324 | |
| 325 | - while ( $start_year <= $end_year ) { |
|
| 326 | - $options[ absint( $start_year ) ] = $start_year; |
|
| 327 | - $start_year ++; |
|
| 325 | + while ($start_year <= $end_year) { |
|
| 326 | + $options[absint($start_year)] = $start_year; |
|
| 327 | + $start_year++; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $output = $this->select( array( |
|
| 330 | + $output = $this->select(array( |
|
| 331 | 331 | 'name' => $name, |
| 332 | 332 | 'selected' => $selected, |
| 333 | 333 | 'options' => $options, |
| 334 | 334 | 'show_option_all' => false, |
| 335 | 335 | 'show_option_none' => false, |
| 336 | - ) ); |
|
| 336 | + )); |
|
| 337 | 337 | |
| 338 | 338 | return $output; |
| 339 | 339 | } |
@@ -351,23 +351,23 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @return string Months dropdown. |
| 353 | 353 | */ |
| 354 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
| 354 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
| 355 | 355 | $month = 1; |
| 356 | 356 | $options = array(); |
| 357 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
| 357 | + $selected = empty($selected) ? date('n') : $selected; |
|
| 358 | 358 | |
| 359 | - while ( $month <= 12 ) { |
|
| 360 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
| 361 | - $month ++; |
|
| 359 | + while ($month <= 12) { |
|
| 360 | + $options[absint($month)] = give_month_num_to_name($month); |
|
| 361 | + $month++; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $output = $this->select( array( |
|
| 364 | + $output = $this->select(array( |
|
| 365 | 365 | 'name' => $name, |
| 366 | 366 | 'selected' => $selected, |
| 367 | 367 | 'options' => $options, |
| 368 | 368 | 'show_option_all' => false, |
| 369 | 369 | 'show_option_none' => false, |
| 370 | - ) ); |
|
| 370 | + )); |
|
| 371 | 371 | |
| 372 | 372 | return $output; |
| 373 | 373 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * |
| 385 | 385 | * @return string The dropdown. |
| 386 | 386 | */ |
| 387 | - public function select( $args = array() ) { |
|
| 387 | + public function select($args = array()) { |
|
| 388 | 388 | $defaults = array( |
| 389 | 389 | 'options' => array(), |
| 390 | 390 | 'name' => null, |
@@ -395,67 +395,67 @@ discard block |
||
| 395 | 395 | 'placeholder' => null, |
| 396 | 396 | 'multiple' => false, |
| 397 | 397 | 'select_atts' => false, |
| 398 | - 'show_option_all' => __( 'All', 'give' ), |
|
| 399 | - 'show_option_none' => __( 'None', 'give' ), |
|
| 398 | + 'show_option_all' => __('All', 'give'), |
|
| 399 | + 'show_option_none' => __('None', 'give'), |
|
| 400 | 400 | 'data' => array(), |
| 401 | 401 | 'readonly' => false, |
| 402 | 402 | 'disabled' => false, |
| 403 | 403 | ); |
| 404 | 404 | |
| 405 | - $args = wp_parse_args( $args, $defaults ); |
|
| 405 | + $args = wp_parse_args($args, $defaults); |
|
| 406 | 406 | |
| 407 | 407 | $data_elements = ''; |
| 408 | - foreach ( $args['data'] as $key => $value ) { |
|
| 409 | - $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
| 408 | + foreach ($args['data'] as $key => $value) { |
|
| 409 | + $data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if ( $args['multiple'] ) { |
|
| 412 | + if ($args['multiple']) { |
|
| 413 | 413 | $multiple = ' MULTIPLE'; |
| 414 | 414 | } else { |
| 415 | 415 | $multiple = ''; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if ( $args['chosen'] ) { |
|
| 418 | + if ($args['chosen']) { |
|
| 419 | 419 | $args['class'] .= ' give-select-chosen'; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if ( $args['placeholder'] ) { |
|
| 422 | + if ($args['placeholder']) { |
|
| 423 | 423 | $placeholder = $args['placeholder']; |
| 424 | 424 | } else { |
| 425 | 425 | $placeholder = ''; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
| 428 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>'; |
|
| 429 | 429 | |
| 430 | - if ( $args['show_option_all'] ) { |
|
| 431 | - if ( $args['multiple'] ) { |
|
| 432 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
| 430 | + if ($args['show_option_all']) { |
|
| 431 | + if ($args['multiple']) { |
|
| 432 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
| 433 | 433 | } else { |
| 434 | - $selected = selected( $args['selected'], 0, false ); |
|
| 434 | + $selected = selected($args['selected'], 0, false); |
|
| 435 | 435 | } |
| 436 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
| 436 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if ( ! empty( $args['options'] ) ) { |
|
| 439 | + if ( ! empty($args['options'])) { |
|
| 440 | 440 | |
| 441 | - if ( $args['show_option_none'] ) { |
|
| 442 | - if ( $args['multiple'] ) { |
|
| 443 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
| 441 | + if ($args['show_option_none']) { |
|
| 442 | + if ($args['multiple']) { |
|
| 443 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
| 444 | 444 | } else { |
| 445 | - $selected = selected( $args['selected'], - 1, false ); |
|
| 445 | + $selected = selected($args['selected'], - 1, false); |
|
| 446 | 446 | } |
| 447 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 447 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - foreach ( $args['options'] as $key => $option ) { |
|
| 450 | + foreach ($args['options'] as $key => $option) { |
|
| 451 | 451 | |
| 452 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 453 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
| 452 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
| 453 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
| 454 | 454 | } else { |
| 455 | - $selected = selected( $args['selected'], $key, false ); |
|
| 455 | + $selected = selected($args['selected'], $key, false); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
| 458 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * |
| 477 | 477 | * @return string The checkbox. |
| 478 | 478 | */ |
| 479 | - public function checkbox( $args = array() ) { |
|
| 479 | + public function checkbox($args = array()) { |
|
| 480 | 480 | $defaults = array( |
| 481 | 481 | 'name' => null, |
| 482 | 482 | 'current' => null, |
@@ -487,16 +487,16 @@ discard block |
||
| 487 | 487 | ), |
| 488 | 488 | ); |
| 489 | 489 | |
| 490 | - $args = wp_parse_args( $args, $defaults ); |
|
| 490 | + $args = wp_parse_args($args, $defaults); |
|
| 491 | 491 | |
| 492 | 492 | $options = ''; |
| 493 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
| 493 | + if ( ! empty($args['options']['disabled'])) { |
|
| 494 | 494 | $options .= ' disabled="disabled"'; |
| 495 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
| 495 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
| 496 | 496 | $options .= ' readonly'; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
| 499 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
| 500 | 500 | |
| 501 | 501 | return $output; |
| 502 | 502 | } |
@@ -513,22 +513,22 @@ discard block |
||
| 513 | 513 | * |
| 514 | 514 | * @return string The text field. |
| 515 | 515 | */ |
| 516 | - public function text( $args = array() ) { |
|
| 516 | + public function text($args = array()) { |
|
| 517 | 517 | // Backwards compatibility. |
| 518 | - if ( func_num_args() > 1 ) { |
|
| 518 | + if (func_num_args() > 1) { |
|
| 519 | 519 | $args = func_get_args(); |
| 520 | 520 | |
| 521 | 521 | $name = $args[0]; |
| 522 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
| 523 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
| 524 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
| 522 | + $value = isset($args[1]) ? $args[1] : ''; |
|
| 523 | + $label = isset($args[2]) ? $args[2] : ''; |
|
| 524 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $defaults = array( |
| 528 | - 'name' => isset( $name ) ? $name : 'text', |
|
| 529 | - 'value' => isset( $value ) ? $value : null, |
|
| 530 | - 'label' => isset( $label ) ? $label : null, |
|
| 531 | - 'desc' => isset( $desc ) ? $desc : null, |
|
| 528 | + 'name' => isset($name) ? $name : 'text', |
|
| 529 | + 'value' => isset($value) ? $value : null, |
|
| 530 | + 'label' => isset($label) ? $label : null, |
|
| 531 | + 'desc' => isset($desc) ? $desc : null, |
|
| 532 | 532 | 'placeholder' => '', |
| 533 | 533 | 'class' => 'regular-text', |
| 534 | 534 | 'disabled' => false, |
@@ -536,29 +536,29 @@ discard block |
||
| 536 | 536 | 'data' => false, |
| 537 | 537 | ); |
| 538 | 538 | |
| 539 | - $args = wp_parse_args( $args, $defaults ); |
|
| 539 | + $args = wp_parse_args($args, $defaults); |
|
| 540 | 540 | |
| 541 | 541 | $disabled = ''; |
| 542 | - if ( $args['disabled'] ) { |
|
| 542 | + if ($args['disabled']) { |
|
| 543 | 543 | $disabled = ' disabled="disabled"'; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | $data = ''; |
| 547 | - if ( ! empty( $args['data'] ) ) { |
|
| 548 | - foreach ( $args['data'] as $key => $value ) { |
|
| 549 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
| 547 | + if ( ! empty($args['data'])) { |
|
| 548 | + foreach ($args['data'] as $key => $value) { |
|
| 549 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 553 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 554 | 554 | |
| 555 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 555 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 556 | 556 | |
| 557 | - if ( ! empty( $args['desc'] ) ) { |
|
| 558 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 557 | + if ( ! empty($args['desc'])) { |
|
| 558 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
| 561 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
| 562 | 562 | |
| 563 | 563 | $output .= '</span>'; |
| 564 | 564 | |
@@ -577,15 +577,15 @@ discard block |
||
| 577 | 577 | * |
| 578 | 578 | * @return string The date picker. |
| 579 | 579 | */ |
| 580 | - public function date_field( $args = array() ) { |
|
| 580 | + public function date_field($args = array()) { |
|
| 581 | 581 | |
| 582 | - if ( empty( $args['class'] ) ) { |
|
| 582 | + if (empty($args['class'])) { |
|
| 583 | 583 | $args['class'] = 'give_datepicker'; |
| 584 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
| 584 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
| 585 | 585 | $args['class'] .= ' give_datepicker'; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - return $this->text( $args ); |
|
| 588 | + return $this->text($args); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | * |
| 601 | 601 | * @return string The textarea. |
| 602 | 602 | */ |
| 603 | - public function textarea( $args = array() ) { |
|
| 603 | + public function textarea($args = array()) { |
|
| 604 | 604 | $defaults = array( |
| 605 | 605 | 'name' => 'textarea', |
| 606 | 606 | 'value' => null, |
@@ -610,21 +610,21 @@ discard block |
||
| 610 | 610 | 'disabled' => false, |
| 611 | 611 | ); |
| 612 | 612 | |
| 613 | - $args = wp_parse_args( $args, $defaults ); |
|
| 613 | + $args = wp_parse_args($args, $defaults); |
|
| 614 | 614 | |
| 615 | 615 | $disabled = ''; |
| 616 | - if ( $args['disabled'] ) { |
|
| 616 | + if ($args['disabled']) { |
|
| 617 | 617 | $disabled = ' disabled="disabled"'; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
| 620 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
| 621 | 621 | |
| 622 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
| 622 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
| 623 | 623 | |
| 624 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
| 624 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
| 625 | 625 | |
| 626 | - if ( ! empty( $args['desc'] ) ) { |
|
| 627 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
| 626 | + if ( ! empty($args['desc'])) { |
|
| 627 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $output .= '</span>'; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * |
| 645 | 645 | * @return string The text field with ajax search. |
| 646 | 646 | */ |
| 647 | - public function ajax_user_search( $args = array() ) { |
|
| 647 | + public function ajax_user_search($args = array()) { |
|
| 648 | 648 | |
| 649 | 649 | $defaults = array( |
| 650 | 650 | 'name' => 'users', |
@@ -655,13 +655,13 @@ discard block |
||
| 655 | 655 | 'chosen' => true, |
| 656 | 656 | 'number' => 30, |
| 657 | 657 | 'select_atts' => '', |
| 658 | - 'placeholder' => __( 'Select a user', 'give' ), |
|
| 658 | + 'placeholder' => __('Select a user', 'give'), |
|
| 659 | 659 | 'data' => array( |
| 660 | 660 | 'search-type' => 'user', |
| 661 | 661 | ), |
| 662 | 662 | ); |
| 663 | 663 | |
| 664 | - $args = wp_parse_args( $args, $defaults ); |
|
| 664 | + $args = wp_parse_args($args, $defaults); |
|
| 665 | 665 | |
| 666 | 666 | // Set initial args. |
| 667 | 667 | $get_users_args = array( |
@@ -670,31 +670,31 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // Ensure selected user is not included in initial query. |
| 672 | 672 | // This is because sites with many users, it's not a guarantee the selected user will be returned. |
| 673 | - if ( ! empty( $args['selected'] ) ) { |
|
| 673 | + if ( ! empty($args['selected'])) { |
|
| 674 | 674 | $get_users_args['exclude'] = $args['selected']; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | // Initial users array. |
| 678 | - $users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args ); |
|
| 678 | + $users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args); |
|
| 679 | 679 | |
| 680 | 680 | // Now add the selected user to the $users array if the arg is present. |
| 681 | - if ( ! empty( $args['selected'] ) ) { |
|
| 682 | - $selected_user = apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );; |
|
| 683 | - $users = array_merge( $users, $selected_user ); |
|
| 681 | + if ( ! empty($args['selected'])) { |
|
| 682 | + $selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ; |
|
| 683 | + $users = array_merge($users, $selected_user); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | $options = array(); |
| 687 | 687 | |
| 688 | - if ( $users ) { |
|
| 688 | + if ($users) { |
|
| 689 | 689 | $options[0] = $args['placeholder']; |
| 690 | - foreach ( $users as $user ) { |
|
| 691 | - $options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' ); |
|
| 690 | + foreach ($users as $user) { |
|
| 691 | + $options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')'); |
|
| 692 | 692 | } |
| 693 | 693 | } else { |
| 694 | - $options[0] = __( 'No users found.', 'give' ); |
|
| 694 | + $options[0] = __('No users found.', 'give'); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $output = $this->select( array( |
|
| 697 | + $output = $this->select(array( |
|
| 698 | 698 | 'name' => $args['name'], |
| 699 | 699 | 'selected' => $args['selected'], |
| 700 | 700 | 'id' => $args['id'], |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | 'show_option_all' => false, |
| 708 | 708 | 'show_option_none' => false, |
| 709 | 709 | 'data' => $args['data'], |
| 710 | - ) ); |
|
| 710 | + )); |
|
| 711 | 711 | |
| 712 | 712 | return $output; |
| 713 | 713 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @return Give |
| 15 | 15 | */ |
| 16 | -function give_load_deprecated_properties( $instance ) { |
|
| 16 | +function give_load_deprecated_properties($instance) { |
|
| 17 | 17 | |
| 18 | 18 | // If a property is renamed then it gets placed below. |
| 19 | 19 | $instance->customers = new Give_DB_Customers(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -add_action( 'give_init', 'give_load_deprecated_properties', 10, 1 ); |
|
| 26 | +add_action('give_init', 'give_load_deprecated_properties', 10, 1); |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Give_DB_Customers Class (deprecated) |
@@ -52,30 +52,30 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return mixed |
| 54 | 54 | */ |
| 55 | - public function __call( $name, $arguments ) { |
|
| 55 | + public function __call($name, $arguments) { |
|
| 56 | 56 | $deprecated_function_arr = array( |
| 57 | 57 | 'get_customer_by', |
| 58 | 58 | 'give_update_customer_email_on_user_update', |
| 59 | 59 | 'get_customers', |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - if ( in_array( $name, $deprecated_function_arr ) ) { |
|
| 63 | - switch ( $name ) { |
|
| 62 | + if (in_array($name, $deprecated_function_arr)) { |
|
| 63 | + switch ($name) { |
|
| 64 | 64 | case 'get_customers': |
| 65 | - $args = ! empty( $arguments[0] ) ? $arguments[0] : array(); |
|
| 65 | + $args = ! empty($arguments[0]) ? $arguments[0] : array(); |
|
| 66 | 66 | |
| 67 | - return $this->get_donors( $args ); |
|
| 67 | + return $this->get_donors($args); |
|
| 68 | 68 | case 'get_customer_by': |
| 69 | - $field = ! empty( $arguments[0] ) ? $arguments[0] : 'id'; |
|
| 70 | - $donor_id = ! empty( $arguments[1] ) ? $arguments[1] : 0; |
|
| 69 | + $field = ! empty($arguments[0]) ? $arguments[0] : 'id'; |
|
| 70 | + $donor_id = ! empty($arguments[1]) ? $arguments[1] : 0; |
|
| 71 | 71 | |
| 72 | - return $this->get_donor_by( $field, $donor_id ); |
|
| 72 | + return $this->get_donor_by($field, $donor_id); |
|
| 73 | 73 | |
| 74 | 74 | case 'give_update_customer_email_on_user_update': |
| 75 | - $user_id = ! empty( $arguments[0] ) ? $arguments[0] : 0; |
|
| 76 | - $old_user_data = ! empty( $arguments[1] ) ? $arguments[1] : false; |
|
| 75 | + $user_id = ! empty($arguments[0]) ? $arguments[0] : 0; |
|
| 76 | + $old_user_data = ! empty($arguments[1]) ? $arguments[1] : false; |
|
| 77 | 77 | |
| 78 | - return $this->update_donor_email_on_user_update( $user_id, $old_user_data ); |
|
| 78 | + return $this->update_donor_email_on_user_update($user_id, $old_user_data); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @param bool $_id_or_email |
| 97 | 97 | * @param bool $by_user_id |
| 98 | 98 | */ |
| 99 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
| 100 | - parent::__construct( $_id_or_email, $by_user_id ); |
|
| 99 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
| 100 | + parent::__construct($_id_or_email, $by_user_id); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return mixed |
| 113 | 113 | */ |
| 114 | - public function __call( $name, $arguments ) { |
|
| 114 | + public function __call($name, $arguments) { |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | /* @var WPDB $wpdb */ |
| 132 | 132 | global $wpdb; |
| 133 | 133 | |
| 134 | - $this->table_name = $wpdb->prefix . 'give_customermeta'; |
|
| 134 | + $this->table_name = $wpdb->prefix.'give_customermeta'; |
|
| 135 | 135 | $this->primary_key = 'meta_id'; |
| 136 | 136 | $this->version = '1.0'; |
| 137 | 137 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
| 151 | - public function __call( $name, $arguments ) { |
|
| 151 | + public function __call($name, $arguments) { |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 6 | 6 | |
| 7 | -foreach ( $give_map_deprecated_actions as $new => $old ) { |
|
| 8 | - add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
|
| 7 | +foreach ($give_map_deprecated_actions as $new => $old) { |
|
| 8 | + add_action($new, 'give_deprecated_action_mapping', 10, 4); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return mixed|void |
| 107 | 107 | */ |
| 108 | -function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
| 108 | +function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
| 109 | 109 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 110 | 110 | $action = current_filter(); |
| 111 | 111 | |
| 112 | - if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
|
| 113 | - if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
|
| 114 | - do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
|
| 112 | + if (isset($give_map_deprecated_actions[$action])) { |
|
| 113 | + if (has_action($give_map_deprecated_actions[$action])) { |
|
| 114 | + do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3); |
|
| 115 | 115 | |
| 116 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
| 116 | + if ( ! defined('DOING_AJAX')) { |
|
| 117 | 117 | // translators: %s: action name. |
| 118 | - _give_deprecated_function( sprintf( __( 'The %s action' ), $give_map_deprecated_actions[ $action ] ), '1.7', $action ); |
|
| 118 | + _give_deprecated_function(sprintf(__('The %s action'), $give_map_deprecated_actions[$action]), '1.7', $action); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -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 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return bool $ret True if guest checkout is enabled, false otherwise |
| 29 | 29 | */ |
| 30 | -function give_no_guest_checkout( $form_id ) { |
|
| 30 | +function give_no_guest_checkout($form_id) { |
|
| 31 | 31 | |
| 32 | 32 | $backtrace = debug_backtrace(); |
| 33 | 33 | |
| 34 | - _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace ); |
|
| 34 | + _give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace); |
|
| 35 | 35 | |
| 36 | - $ret = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
| 36 | + $ret = give_get_meta($form_id, '_give_logged_in_only', true); |
|
| 37 | 37 | |
| 38 | - return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) ); |
|
| 38 | + return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $backtrace = debug_backtrace(); |
| 52 | 52 | |
| 53 | - _give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace ); |
|
| 53 | + _give_deprecated_function(__FUNCTION__, '1.8', null, $backtrace); |
|
| 54 | 54 | |
| 55 | 55 | $views = array( |
| 56 | - 'sales' => __( 'Donations', 'give' ), |
|
| 57 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
| 58 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
| 56 | + 'sales' => __('Donations', 'give'), |
|
| 57 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
| 58 | + 'api_requests' => __('API Requests', 'give'), |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - $views = apply_filters( 'give_log_views', $views ); |
|
| 61 | + $views = apply_filters('give_log_views', $views); |
|
| 62 | 62 | |
| 63 | 63 | return $views; |
| 64 | 64 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $backtrace = debug_backtrace(); |
| 75 | 75 | |
| 76 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_agree_to_terms', $backtrace ); |
|
| 76 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_agree_to_terms', $backtrace); |
|
| 77 | 77 | |
| 78 | 78 | // Call new renamed function. |
| 79 | 79 | give_donation_form_validate_agree_to_terms(); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $backtrace = debug_backtrace(); |
| 92 | 92 | |
| 93 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_logged_in_user', $backtrace ); |
|
| 93 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_logged_in_user', $backtrace); |
|
| 94 | 94 | |
| 95 | 95 | // Call new renamed function. |
| 96 | 96 | give_donation_form_validate_logged_in_user(); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $backtrace = debug_backtrace(); |
| 109 | 109 | |
| 110 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_gateway', $backtrace ); |
|
| 110 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_gateway', $backtrace); |
|
| 111 | 111 | |
| 112 | 112 | // Call new renamed function. |
| 113 | 113 | give_donation_form_validate_gateway(); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $backtrace = debug_backtrace(); |
| 126 | 126 | |
| 127 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_fields', $backtrace ); |
|
| 127 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_fields', $backtrace); |
|
| 128 | 128 | |
| 129 | 129 | // Call new renamed function. |
| 130 | 130 | give_donation_form_validate_fields(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $backtrace = debug_backtrace(); |
| 143 | 143 | |
| 144 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc', $backtrace ); |
|
| 144 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_cc', $backtrace); |
|
| 145 | 145 | |
| 146 | 146 | // Call new renamed function. |
| 147 | 147 | give_donation_form_validate_cc(); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $backtrace = debug_backtrace(); |
| 160 | 160 | |
| 161 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_cc_info', $backtrace ); |
|
| 161 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_cc_info', $backtrace); |
|
| 162 | 162 | |
| 163 | 163 | // Call new renamed function. |
| 164 | 164 | give_get_donation_cc_info(); |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | * @param int $zip |
| 176 | 176 | * @param string $country_code |
| 177 | 177 | */ |
| 178 | -function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
| 178 | +function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
| 179 | 179 | |
| 180 | 180 | $backtrace = debug_backtrace(); |
| 181 | 181 | |
| 182 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc_zip', $backtrace ); |
|
| 182 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_cc_zip', $backtrace); |
|
| 183 | 183 | |
| 184 | 184 | // Call new renamed function. |
| 185 | - give_donation_form_validate_cc_zip( $zip, $country_code ); |
|
| 185 | + give_donation_form_validate_cc_zip($zip, $country_code); |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $backtrace = debug_backtrace(); |
| 198 | 198 | |
| 199 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_user_login', $backtrace ); |
|
| 199 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_user_login', $backtrace); |
|
| 200 | 200 | |
| 201 | 201 | // Call new renamed function. |
| 202 | 202 | give_donation_form_validate_user_login(); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $backtrace = debug_backtrace(); |
| 215 | 215 | |
| 216 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_guest_user', $backtrace ); |
|
| 216 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_guest_user', $backtrace); |
|
| 217 | 217 | |
| 218 | 218 | // Call new renamed function. |
| 219 | 219 | give_donation_form_validate_guest_user(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $backtrace = debug_backtrace(); |
| 232 | 232 | |
| 233 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_new_user', $backtrace ); |
|
| 233 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_new_user', $backtrace); |
|
| 234 | 234 | |
| 235 | 235 | // Call new renamed function. |
| 236 | 236 | give_donation_form_validate_new_user(); |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @param array $valid_data |
| 248 | 248 | */ |
| 249 | -function give_get_purchase_form_user( $valid_data = array() ) { |
|
| 249 | +function give_get_purchase_form_user($valid_data = array()) { |
|
| 250 | 250 | |
| 251 | 251 | $backtrace = debug_backtrace(); |
| 252 | 252 | |
| 253 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace ); |
|
| 253 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace); |
|
| 254 | 254 | |
| 255 | 255 | // Call new renamed function. |
| 256 | - give_get_donation_form_user( $valid_data ); |
|
| 256 | + give_get_donation_form_user($valid_data); |
|
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | |
@@ -269,12 +269,12 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | -function give_checkout_button_purchase( $form_id ) { |
|
| 272 | +function give_checkout_button_purchase($form_id) { |
|
| 273 | 273 | $backtrace = debug_backtrace(); |
| 274 | 274 | |
| 275 | - _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_submit_button', $backtrace ); |
|
| 275 | + _give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_form_submit_button', $backtrace); |
|
| 276 | 276 | |
| 277 | - return give_get_donation_form_submit_button( $form_id ); |
|
| 277 | + return give_get_donation_form_submit_button($form_id); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @return int $customer_id Customer ID. |
| 289 | 289 | */ |
| 290 | -function give_get_payment_customer_id( $payment_id ) { |
|
| 290 | +function give_get_payment_customer_id($payment_id) { |
|
| 291 | 291 | |
| 292 | 292 | $backtrace = debug_backtrace(); |
| 293 | 293 | |
| 294 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_payment_donor_id', $backtrace ); |
|
| 294 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_payment_donor_id', $backtrace); |
|
| 295 | 295 | |
| 296 | - return give_get_payment_donor_id( $payment_id ); |
|
| 296 | + return give_get_payment_donor_id($payment_id); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $backtrace = debug_backtrace(); |
| 310 | 310 | |
| 311 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_total_donations', $backtrace ); |
|
| 311 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_total_donations', $backtrace); |
|
| 312 | 312 | |
| 313 | 313 | return give_get_total_donations(); |
| 314 | 314 | } |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return int The total number of donations |
| 328 | 328 | */ |
| 329 | -function give_count_purchases_of_customer( $user = null ) { |
|
| 329 | +function give_count_purchases_of_customer($user = null) { |
|
| 330 | 330 | |
| 331 | 331 | $backtrace = debug_backtrace(); |
| 332 | 332 | |
| 333 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_donations_of_donor', $backtrace ); |
|
| 333 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_count_donations_of_donor', $backtrace); |
|
| 334 | 334 | |
| 335 | - return give_count_donations_of_donor( $user ); |
|
| 335 | + return give_count_donations_of_donor($user); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | * |
| 349 | 349 | * @return array |
| 350 | 350 | */ |
| 351 | -function give_get_purchase_stats_by_user( $user = '' ) { |
|
| 351 | +function give_get_purchase_stats_by_user($user = '') { |
|
| 352 | 352 | |
| 353 | 353 | $backtrace = debug_backtrace(); |
| 354 | 354 | |
| 355 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_donation_stats_by_user', $backtrace ); |
|
| 355 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_donation_stats_by_user', $backtrace); |
|
| 356 | 356 | |
| 357 | - return give_get_donation_stats_by_user( $user ); |
|
| 357 | + return give_get_donation_stats_by_user($user); |
|
| 358 | 358 | |
| 359 | 359 | } |
| 360 | 360 | |
@@ -372,13 +372,13 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @return bool|object List of all user donations |
| 374 | 374 | */ |
| 375 | -function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
| 375 | +function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
| 376 | 376 | |
| 377 | 377 | $backtrace = debug_backtrace(); |
| 378 | 378 | |
| 379 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_users_donations', $backtrace ); |
|
| 379 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_users_donations', $backtrace); |
|
| 380 | 380 | |
| 381 | - return give_get_users_donations( $user, $number, $pagination, $status ); |
|
| 381 | + return give_get_users_donations($user, $number, $pagination, $status); |
|
| 382 | 382 | |
| 383 | 383 | } |
| 384 | 384 | |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @return bool True if has donated, false other wise. |
| 397 | 397 | */ |
| 398 | -function give_has_purchases( $user_id = null ) { |
|
| 398 | +function give_has_purchases($user_id = null) { |
|
| 399 | 399 | |
| 400 | 400 | $backtrace = debug_backtrace(); |
| 401 | 401 | |
| 402 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_has_donations', $backtrace ); |
|
| 402 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_has_donations', $backtrace); |
|
| 403 | 403 | |
| 404 | - return give_has_donations( $user_id ); |
|
| 404 | + return give_has_donations($user_id); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | function give_count_total_customers() { |
| 416 | 416 | $backtrace = debug_backtrace(); |
| 417 | 417 | |
| 418 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_total_donors', $backtrace ); |
|
| 418 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_count_total_donors', $backtrace); |
|
| 419 | 419 | |
| 420 | 420 | return give_count_total_donors(); |
| 421 | 421 | } |
@@ -430,13 +430,13 @@ discard block |
||
| 430 | 430 | * |
| 431 | 431 | * @return float The total amount the user has spent |
| 432 | 432 | */ |
| 433 | -function give_purchase_total_of_user( $user = null ) { |
|
| 433 | +function give_purchase_total_of_user($user = null) { |
|
| 434 | 434 | |
| 435 | 435 | $backtrace = debug_backtrace(); |
| 436 | 436 | |
| 437 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_donation_total_of_user', $backtrace ); |
|
| 437 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_donation_total_of_user', $backtrace); |
|
| 438 | 438 | |
| 439 | - return give_donation_total_of_user( $user ); |
|
| 439 | + return give_donation_total_of_user($user); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -450,13 +450,13 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @return void |
| 452 | 452 | */ |
| 453 | -function give_delete_purchase( $payment_id = 0, $update_customer = true ) { |
|
| 453 | +function give_delete_purchase($payment_id = 0, $update_customer = true) { |
|
| 454 | 454 | |
| 455 | 455 | $backtrace = debug_backtrace(); |
| 456 | 456 | |
| 457 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_delete_donation', $backtrace ); |
|
| 457 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_delete_donation', $backtrace); |
|
| 458 | 458 | |
| 459 | - give_delete_donation( $payment_id, $update_customer ); |
|
| 459 | + give_delete_donation($payment_id, $update_customer); |
|
| 460 | 460 | |
| 461 | 461 | } |
| 462 | 462 | |
@@ -474,13 +474,13 @@ discard block |
||
| 474 | 474 | * |
| 475 | 475 | * @return void |
| 476 | 476 | */ |
| 477 | -function give_undo_purchase( $form_id = false, $payment_id ) { |
|
| 477 | +function give_undo_purchase($form_id = false, $payment_id) { |
|
| 478 | 478 | |
| 479 | 479 | $backtrace = debug_backtrace(); |
| 480 | 480 | |
| 481 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace ); |
|
| 481 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace); |
|
| 482 | 482 | |
| 483 | - give_undo_donation( $payment_id ); |
|
| 483 | + give_undo_donation($payment_id); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | * |
| 494 | 494 | * @return void |
| 495 | 495 | */ |
| 496 | -function give_trigger_purchase_delete( $data ) { |
|
| 496 | +function give_trigger_purchase_delete($data) { |
|
| 497 | 497 | $backtrace = debug_backtrace(); |
| 498 | 498 | |
| 499 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_trigger_donation_delete', $backtrace ); |
|
| 499 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_trigger_donation_delete', $backtrace); |
|
| 500 | 500 | |
| 501 | - give_trigger_donation_delete( $data ); |
|
| 501 | + give_trigger_donation_delete($data); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | |
@@ -512,12 +512,12 @@ discard block |
||
| 512 | 512 | * |
| 513 | 513 | * @return bool|int |
| 514 | 514 | */ |
| 515 | -function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
| 515 | +function give_increase_purchase_count($form_id = 0, $quantity = 1) { |
|
| 516 | 516 | $backtrace = debug_backtrace(); |
| 517 | 517 | |
| 518 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_increase_donation_count', $backtrace ); |
|
| 518 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_increase_donation_count', $backtrace); |
|
| 519 | 519 | |
| 520 | - give_increase_donation_count( $form_id, $quantity ); |
|
| 520 | + give_increase_donation_count($form_id, $quantity); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | |
@@ -536,12 +536,12 @@ discard block |
||
| 536 | 536 | * |
| 537 | 537 | * @return void |
| 538 | 538 | */ |
| 539 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
| 539 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
| 540 | 540 | $backtrace = debug_backtrace(); |
| 541 | 541 | |
| 542 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace ); |
|
| 542 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace); |
|
| 543 | 543 | |
| 544 | - give_record_donation_in_log( $give_form_id, $payment_id, $price_id, $sale_date ); |
|
| 544 | + give_record_donation_in_log($give_form_id, $payment_id, $price_id, $sale_date); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | /** |
@@ -558,12 +558,12 @@ discard block |
||
| 558 | 558 | * |
| 559 | 559 | * @return void |
| 560 | 560 | */ |
| 561 | -function give_print_errors( $form_id ) { |
|
| 561 | +function give_print_errors($form_id) { |
|
| 562 | 562 | $backtrace = debug_backtrace(); |
| 563 | 563 | |
| 564 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_errors', $backtrace ); |
|
| 564 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_errors', $backtrace); |
|
| 565 | 565 | |
| 566 | - do_action( 'give_frontend_notices', $form_id ); |
|
| 566 | + do_action('give_frontend_notices', $form_id); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /** |
@@ -579,10 +579,10 @@ discard block |
||
| 579 | 579 | * |
| 580 | 580 | * @return string $error |
| 581 | 581 | */ |
| 582 | -function give_output_error( $message, $echo = true, $error_id = 'warning' ) { |
|
| 582 | +function give_output_error($message, $echo = true, $error_id = 'warning') { |
|
| 583 | 583 | $backtrace = debug_backtrace(); |
| 584 | 584 | |
| 585 | - _give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace ); |
|
| 585 | + _give_deprecated_function(__FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace); |
|
| 586 | 586 | |
| 587 | - Give()->notices->print_frontend_notice( $message, $echo, $error_id ); |
|
| 587 | + Give()->notices->print_frontend_notice($message, $echo, $error_id); |
|
| 588 | 588 | } |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $give_map_deprecated_filters = give_deprecated_filters(); |
| 9 | 9 | |
| 10 | -foreach ( $give_map_deprecated_filters as $new => $old ) { |
|
| 11 | - add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 ); |
|
| 10 | +foreach ($give_map_deprecated_filters as $new => $old) { |
|
| 11 | + add_filter($new, 'give_deprecated_filter_mapping', 10, 4); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return mixed |
| 67 | 67 | */ |
| 68 | -function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
| 68 | +function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
| 69 | 69 | $give_map_deprecated_filters = give_deprecated_filters(); |
| 70 | 70 | $filter = current_filter(); |
| 71 | 71 | |
| 72 | - if ( isset( $give_map_deprecated_filters[ $filter ] ) ) { |
|
| 73 | - if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) { |
|
| 74 | - $data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); |
|
| 72 | + if (isset($give_map_deprecated_filters[$filter])) { |
|
| 73 | + if (has_filter($give_map_deprecated_filters[$filter])) { |
|
| 74 | + $data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3); |
|
| 75 | 75 | |
| 76 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
| 77 | - _give_deprecated_function( sprintf( /* translators: %s: filter name */ |
|
| 78 | - __( 'The %s filter' ), $give_map_deprecated_filters[ $filter ] ), '1.7', $filter ); |
|
| 76 | + if ( ! defined('DOING_AJAX')) { |
|
| 77 | + _give_deprecated_function(sprintf( /* translators: %s: filter name */ |
|
| 78 | + __('The %s filter'), $give_map_deprecated_filters[$filter] ), '1.7', $filter); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -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,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_load_scripts() { |
| 27 | 27 | |
| 28 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
| 29 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 30 | - $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
|
| 28 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
| 29 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 30 | + $scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false; |
|
| 31 | 31 | |
| 32 | 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 33 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 33 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 34 | 34 | |
| 35 | 35 | // Localize / PHP to AJAX vars. |
| 36 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
| 36 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
| 37 | 37 | 'ajaxurl' => give_get_ajax_url(), |
| 38 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
| 39 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 38 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
| 39 | + 'currency_sign' => give_currency_filter(''), |
|
| 40 | 40 | 'currency_pos' => give_get_currency_position(), |
| 41 | 41 | 'thousands_separator' => give_get_price_thousand_separator(), |
| 42 | 42 | 'decimal_separator' => give_get_price_decimal_separator(), |
| 43 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
| 44 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
| 45 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
| 46 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
| 43 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
| 44 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
| 45 | + 'general_loading' => __('Loading...', 'give'), |
|
| 46 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
| 47 | 47 | 'number_decimals' => give_get_price_decimals(), |
| 48 | 48 | 'give_version' => GIVE_VERSION, |
| 49 | 49 | 'magnific_options' => apply_filters( |
@@ -57,81 +57,81 @@ discard block |
||
| 57 | 57 | 'give_form_translation_js', |
| 58 | 58 | array( |
| 59 | 59 | // Field name Validation message. |
| 60 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
| 61 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
| 62 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
| 63 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
| 64 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
| 65 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
| 66 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
| 60 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
| 61 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
| 62 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
| 63 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
| 64 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
| 65 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
| 66 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
| 67 | 67 | ) |
| 68 | 68 | ), |
| 69 | - ) ); |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
| 71 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
| 72 | 72 | 'ajaxurl' => give_get_ajax_url(), |
| 73 | - 'loading' => __( 'Loading', 'give' ), |
|
| 73 | + 'loading' => __('Loading', 'give'), |
|
| 74 | 74 | // General loading message. |
| 75 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
| 75 | + 'select_option' => __('Please select an option', 'give'), |
|
| 76 | 76 | // Variable pricing error with multi-donation option enabled. |
| 77 | - 'default_gateway' => give_get_default_gateway( null ), |
|
| 78 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
| 77 | + 'default_gateway' => give_get_default_gateway(null), |
|
| 78 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
| 79 | 79 | 'number_decimals' => give_get_price_decimals(), |
| 80 | - ) ); |
|
| 80 | + )); |
|
| 81 | 81 | |
| 82 | 82 | // DEBUG is On. |
| 83 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
| 83 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
| 84 | 84 | |
| 85 | - if ( give_is_cc_verify_enabled() ) { |
|
| 86 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 87 | - wp_enqueue_script( 'give-cc-validator' ); |
|
| 85 | + if (give_is_cc_verify_enabled()) { |
|
| 86 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 87 | + wp_enqueue_script('give-cc-validator'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 91 | - wp_enqueue_script( 'give-float-labels' ); |
|
| 90 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 91 | + wp_enqueue_script('give-float-labels'); |
|
| 92 | 92 | |
| 93 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 94 | - wp_enqueue_script( 'give-blockui' ); |
|
| 93 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 94 | + wp_enqueue_script('give-blockui'); |
|
| 95 | 95 | |
| 96 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 97 | - wp_enqueue_script( 'give-qtip' ); |
|
| 96 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 97 | + wp_enqueue_script('give-qtip'); |
|
| 98 | 98 | |
| 99 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 100 | - wp_enqueue_script( 'give-accounting' ); |
|
| 99 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 100 | + wp_enqueue_script('give-accounting'); |
|
| 101 | 101 | |
| 102 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 103 | - wp_enqueue_script( 'give-magnific' ); |
|
| 102 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 103 | + wp_enqueue_script('give-magnific'); |
|
| 104 | 104 | |
| 105 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 106 | - wp_enqueue_script( 'give-checkout-global' ); |
|
| 105 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 106 | + wp_enqueue_script('give-checkout-global'); |
|
| 107 | 107 | |
| 108 | 108 | // General scripts. |
| 109 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 110 | - wp_enqueue_script( 'give-scripts' ); |
|
| 109 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 110 | + wp_enqueue_script('give-scripts'); |
|
| 111 | 111 | |
| 112 | 112 | // Load AJAX scripts, if enabled. |
| 113 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 114 | - wp_enqueue_script( 'give-ajax' ); |
|
| 113 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 114 | + wp_enqueue_script('give-ajax'); |
|
| 115 | 115 | |
| 116 | 116 | // Localize / Pass AJAX vars from PHP, |
| 117 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
|
| 118 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
| 117 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars); |
|
| 118 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
| 119 | 119 | |
| 120 | 120 | } else { |
| 121 | 121 | |
| 122 | 122 | // DEBUG is OFF (one JS file to rule them all!). |
| 123 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 124 | - wp_enqueue_script( 'give' ); |
|
| 123 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 124 | + wp_enqueue_script('give'); |
|
| 125 | 125 | |
| 126 | 126 | // Localize / Pass AJAX vars from PHP. |
| 127 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
| 128 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
| 127 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
| 128 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
| 134 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Register styles. |
@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | function give_register_styles() { |
| 146 | 146 | |
| 147 | - if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
| 147 | + if ( ! give_is_setting_enabled(give_get_option('css'))) { |
|
| 148 | 148 | return; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
| 152 | - wp_enqueue_style( 'give-styles' ); |
|
| 151 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
| 152 | + wp_enqueue_style('give-styles'); |
|
| 153 | 153 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
| 156 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -166,19 +166,19 @@ discard block |
||
| 166 | 166 | function give_get_stylesheet_uri() { |
| 167 | 167 | |
| 168 | 168 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 169 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 169 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 170 | 170 | |
| 171 | 171 | // LTR or RTL files. |
| 172 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 172 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 173 | 173 | |
| 174 | - $file = 'give' . $direction . $suffix . '.css'; |
|
| 174 | + $file = 'give'.$direction.$suffix.'.css'; |
|
| 175 | 175 | $templates_dir = give_get_theme_template_dir_name(); |
| 176 | 176 | |
| 177 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
| 178 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 179 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
| 180 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 181 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
| 177 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
| 178 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 179 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
| 180 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css'; |
|
| 181 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
| 182 | 182 | |
| 183 | 183 | $uri = false; |
| 184 | 184 | |
@@ -188,23 +188,23 @@ discard block |
||
| 188 | 188 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 189 | 189 | * This allows users to copy just give.css to their theme. |
| 190 | 190 | */ |
| 191 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
| 192 | - if ( ! empty( $nonmin ) ) { |
|
| 193 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 191 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
| 192 | + if ( ! empty($nonmin)) { |
|
| 193 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 194 | 194 | } else { |
| 195 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
| 195 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
| 196 | 196 | } |
| 197 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
| 198 | - if ( ! empty( $nonmin ) ) { |
|
| 199 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
|
| 197 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
| 198 | + if ( ! empty($nonmin)) { |
|
| 199 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css'; |
|
| 200 | 200 | } else { |
| 201 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
| 201 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
| 202 | 202 | } |
| 203 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
| 204 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
| 203 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
| 204 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
| 207 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
@@ -221,76 +221,76 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * @return void |
| 223 | 223 | */ |
| 224 | -function give_load_admin_scripts( $hook ) { |
|
| 224 | +function give_load_admin_scripts($hook) { |
|
| 225 | 225 | |
| 226 | 226 | global $post, $post_type; |
| 227 | 227 | |
| 228 | 228 | $give_options = give_get_settings(); |
| 229 | 229 | |
| 230 | 230 | // Directories of assets. |
| 231 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 232 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 233 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 231 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 232 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 233 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 234 | 234 | |
| 235 | 235 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 236 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 236 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 237 | 237 | |
| 238 | 238 | // LTR or RTL files. |
| 239 | - $direction = ( is_rtl() ) ? '-rtl' : ''; |
|
| 239 | + $direction = (is_rtl()) ? '-rtl' : ''; |
|
| 240 | 240 | |
| 241 | 241 | // Global Admin. |
| 242 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
| 243 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
| 242 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
| 243 | + wp_enqueue_style('give-admin-bar-notification'); |
|
| 244 | 244 | |
| 245 | 245 | // Give Admin Only. |
| 246 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
| 246 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // CSS. |
| 251 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
| 252 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 253 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 254 | - wp_enqueue_style( 'give-admin' ); |
|
| 255 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 256 | - wp_enqueue_style( 'jquery-chosen' ); |
|
| 257 | - wp_enqueue_style( 'thickbox' ); |
|
| 258 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 251 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
| 252 | + wp_enqueue_style('jquery-ui-css'); |
|
| 253 | + wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION); |
|
| 254 | + wp_enqueue_style('give-admin'); |
|
| 255 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
| 256 | + wp_enqueue_style('jquery-chosen'); |
|
| 257 | + wp_enqueue_style('thickbox'); |
|
| 258 | + wp_enqueue_style('wp-color-picker'); |
|
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | // JS. |
| 262 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 263 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 262 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 263 | + wp_enqueue_script('jquery-chosen'); |
|
| 264 | 264 | |
| 265 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 266 | - wp_enqueue_script( 'give-accounting' ); |
|
| 265 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 266 | + wp_enqueue_script('give-accounting'); |
|
| 267 | 267 | |
| 268 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 269 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 270 | - wp_enqueue_script( 'thickbox' ); |
|
| 268 | + wp_enqueue_script('wp-color-picker'); |
|
| 269 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 270 | + wp_enqueue_script('thickbox'); |
|
| 271 | 271 | |
| 272 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false ); |
|
| 273 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
| 272 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker'), GIVE_VERSION, false); |
|
| 273 | + wp_enqueue_script('give-admin-scripts'); |
|
| 274 | 274 | |
| 275 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
| 276 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 275 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
| 276 | + wp_enqueue_script('jquery-flot'); |
|
| 277 | 277 | |
| 278 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 279 | - wp_enqueue_script( 'give-qtip' ); |
|
| 278 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 279 | + wp_enqueue_script('give-qtip'); |
|
| 280 | 280 | |
| 281 | - wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 282 | - wp_enqueue_script( 'give-repeatable-fields' ); |
|
| 281 | + wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 282 | + wp_enqueue_script('give-repeatable-fields'); |
|
| 283 | 283 | |
| 284 | 284 | // Forms CPT Script. |
| 285 | - if ( $post_type === 'give_forms' ) { |
|
| 286 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 287 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
| 285 | + if ($post_type === 'give_forms') { |
|
| 286 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 287 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // Settings Scripts. |
| 291 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
| 292 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 293 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
| 291 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
| 292 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 293 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Price Separators. |
@@ -298,74 +298,74 @@ discard block |
||
| 298 | 298 | $decimal_separator = give_get_price_decimal_separator(); |
| 299 | 299 | |
| 300 | 300 | // Localize strings & variables for JS. |
| 301 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
| 302 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
| 301 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
| 302 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
| 303 | 303 | 'give_version' => GIVE_VERSION, |
| 304 | 304 | 'thousands_separator' => $thousand_separator, |
| 305 | 305 | 'decimal_separator' => $decimal_separator, |
| 306 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
| 307 | - 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
|
| 308 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
| 309 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
| 310 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
| 311 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
| 312 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
| 313 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
| 314 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
| 315 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 316 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 317 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
| 318 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
| 319 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
| 320 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
| 321 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
| 306 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
| 307 | + 'delete_payment' => __('Are you sure you want to delete this payment?', 'give'), |
|
| 308 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
| 309 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
| 310 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
| 311 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
| 312 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
| 313 | + 'one_option' => __('Choose a form', 'give'), |
|
| 314 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
| 315 | + 'currency_sign' => give_currency_filter(''), |
|
| 316 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 317 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
| 318 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
| 319 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
| 320 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
| 321 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
| 322 | 322 | /* translators : %s: Donation form options metabox */ |
| 323 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ), |
|
| 324 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 325 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
| 326 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
| 327 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
| 328 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
| 329 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
| 323 | + 'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'), |
|
| 324 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 325 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
| 326 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
| 327 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
| 328 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
| 329 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
| 330 | 330 | 'bulk_action' => array( |
| 331 | 331 | 'delete' => array( |
| 332 | - 'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ), |
|
| 333 | - 'delete_payment' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
| 334 | - 'delete_payments' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
| 332 | + 'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'), |
|
| 333 | + 'delete_payment' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
| 334 | + 'delete_payments' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
| 335 | 335 | ), |
| 336 | 336 | 'resend_receipt' => array( |
| 337 | - 'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
| 338 | - 'resend_receipt' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
| 339 | - 'resend_receipts' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
| 337 | + 'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
| 338 | + 'resend_receipt' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
| 339 | + 'resend_receipts' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
| 340 | 340 | ), |
| 341 | 341 | 'set_to_status' => array( |
| 342 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
| 343 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
| 344 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
| 342 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
| 343 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
| 344 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
| 345 | 345 | ), |
| 346 | 346 | ), |
| 347 | 347 | 'metabox_fields' => array( |
| 348 | 348 | 'media' => array( |
| 349 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
| 349 | + 'button_title' => __('Choose Image', 'give'), |
|
| 350 | 350 | ), |
| 351 | 351 | 'file' => array( |
| 352 | - 'button_title' => __( 'Choose File', 'give' ), |
|
| 352 | + 'button_title' => __('Choose File', 'give'), |
|
| 353 | 353 | ) |
| 354 | 354 | ), |
| 355 | 355 | 'chosen' => array( |
| 356 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
| 357 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
| 356 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
| 357 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
| 358 | 358 | ), |
| 359 | - ) ); |
|
| 359 | + )); |
|
| 360 | 360 | |
| 361 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
|
| 361 | + if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) { |
|
| 362 | 362 | // call for new media manager. |
| 363 | 363 | wp_enqueue_media(); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
| 368 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
| 369 | 369 | |
| 370 | 370 | /** |
| 371 | 371 | * Admin Give Icon |
@@ -380,13 +380,13 @@ discard block |
||
| 380 | 380 | ?> |
| 381 | 381 | <style type="text/css" media="screen"> |
| 382 | 382 | |
| 383 | - <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
|
| 383 | + <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?> |
|
| 384 | 384 | @font-face { |
| 385 | 385 | font-family: 'give-icomoon'; |
| 386 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 387 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 388 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 389 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 386 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
|
| 387 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
| 388 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
| 389 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
| 390 | 390 | font-weight: normal; |
| 391 | 391 | font-style: normal; |
| 392 | 392 | } |
@@ -405,4 +405,4 @@ discard block |
||
| 405 | 405 | <?php |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
| 408 | +add_action('admin_head', 'give_admin_icon'); |
|