@@ -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 | |
@@ -28,93 +28,93 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | global $give_options; |
| 30 | 30 | |
| 31 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
| 32 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 33 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
| 31 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
| 32 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 33 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
| 34 | 34 | |
| 35 | 35 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 36 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 36 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 37 | 37 | |
| 38 | 38 | //Localize / PHP to AJAX vars |
| 39 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
| 39 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
| 40 | 40 | 'ajaxurl' => give_get_ajax_url(), |
| 41 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
| 42 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 43 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 44 | - 'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',', |
|
| 45 | - 'decimal_separator' => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.', |
|
| 46 | - 'no_gateway' => __( 'Please select a payment method', 'give' ), |
|
| 47 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
| 48 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
| 41 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
| 42 | + 'currency_sign' => give_currency_filter(''), |
|
| 43 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 44 | + 'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',', |
|
| 45 | + 'decimal_separator' => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.', |
|
| 46 | + 'no_gateway' => __('Please select a payment method', 'give'), |
|
| 47 | + 'general_loading' => __('Loading...', 'give'), |
|
| 48 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
| 49 | 49 | 'give_version' => GIVE_VERSION |
| 50 | - ) ); |
|
| 51 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
| 50 | + )); |
|
| 51 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
| 52 | 52 | 'ajaxurl' => give_get_ajax_url(), |
| 53 | - 'position_in_cart' => isset( $position ) ? $position : - 1, |
|
| 54 | - 'loading' => __( 'Loading', 'give' ), |
|
| 53 | + 'position_in_cart' => isset($position) ? $position : - 1, |
|
| 54 | + 'loading' => __('Loading', 'give'), |
|
| 55 | 55 | // General loading message |
| 56 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
| 56 | + 'select_option' => __('Please select an option', 'give'), |
|
| 57 | 57 | // Variable pricing error with multi-purchase option enabled |
| 58 | - 'default_gateway' => give_get_default_gateway( null ), |
|
| 59 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
| 60 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ) |
|
| 61 | - ) ); |
|
| 58 | + 'default_gateway' => give_get_default_gateway(null), |
|
| 59 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
| 60 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2) |
|
| 61 | + )); |
|
| 62 | 62 | |
| 63 | 63 | //DEBUG is On |
| 64 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
| 64 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
| 65 | 65 | |
| 66 | - if ( give_is_cc_verify_enabled() ) { |
|
| 67 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 68 | - wp_enqueue_script( 'give-cc-validator' ); |
|
| 66 | + if (give_is_cc_verify_enabled()) { |
|
| 67 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 68 | + wp_enqueue_script('give-cc-validator'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 72 | - wp_enqueue_script( 'give-float-labels' ); |
|
| 71 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 72 | + wp_enqueue_script('give-float-labels'); |
|
| 73 | 73 | |
| 74 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 75 | - wp_enqueue_script( 'give-blockui' ); |
|
| 74 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 75 | + wp_enqueue_script('give-blockui'); |
|
| 76 | 76 | |
| 77 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 78 | - wp_enqueue_script( 'give-qtip' ); |
|
| 77 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 78 | + wp_enqueue_script('give-qtip'); |
|
| 79 | 79 | |
| 80 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 81 | - wp_enqueue_script( 'give-accounting' ); |
|
| 80 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 81 | + wp_enqueue_script('give-accounting'); |
|
| 82 | 82 | |
| 83 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 84 | - wp_enqueue_script( 'give-magnific' ); |
|
| 83 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 84 | + wp_enqueue_script('give-magnific'); |
|
| 85 | 85 | |
| 86 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 87 | - wp_enqueue_script( 'give-checkout-global' ); |
|
| 86 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 87 | + wp_enqueue_script('give-checkout-global'); |
|
| 88 | 88 | |
| 89 | 89 | //General scripts |
| 90 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 91 | - wp_enqueue_script( 'give-scripts' ); |
|
| 90 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 91 | + wp_enqueue_script('give-scripts'); |
|
| 92 | 92 | |
| 93 | 93 | // Load AJAX scripts, if enabled |
| 94 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 95 | - wp_enqueue_script( 'give-ajax' ); |
|
| 94 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 95 | + wp_enqueue_script('give-ajax'); |
|
| 96 | 96 | |
| 97 | 97 | //Localize / Pass AJAX vars from PHP |
| 98 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
| 99 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
| 98 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
| 99 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | } else { |
| 103 | 103 | |
| 104 | 104 | //DEBUG is OFF (one JS file to rule them all!) |
| 105 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
| 106 | - wp_enqueue_script( 'give' ); |
|
| 105 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
| 106 | + wp_enqueue_script('give'); |
|
| 107 | 107 | |
| 108 | 108 | //Localize / Pass AJAX vars from PHP |
| 109 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
| 110 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
| 109 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
| 110 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
| 117 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Register Styles |
@@ -126,47 +126,47 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | function give_register_styles() { |
| 128 | 128 | |
| 129 | - if ( give_get_option( 'disable_css', false ) ) { |
|
| 129 | + if (give_get_option('disable_css', false)) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 134 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 134 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 135 | 135 | |
| 136 | - $file = 'give' . $suffix . '.css'; |
|
| 136 | + $file = 'give'.$suffix.'.css'; |
|
| 137 | 137 | $templates_dir = give_get_theme_template_dir_name(); |
| 138 | 138 | |
| 139 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
| 140 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
| 141 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
| 142 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
| 143 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
| 139 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
| 140 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
| 141 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
| 142 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
| 143 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
| 144 | 144 | |
| 145 | 145 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
| 146 | 146 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 147 | 147 | // This allows users to copy just give.css to their theme |
| 148 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
| 149 | - if ( ! empty( $nonmin ) ) { |
|
| 150 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
| 148 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
| 149 | + if ( ! empty($nonmin)) { |
|
| 150 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
| 151 | 151 | } else { |
| 152 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
| 152 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
| 153 | 153 | } |
| 154 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
| 155 | - if ( ! empty( $nonmin ) ) { |
|
| 156 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
| 154 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
| 155 | + if ( ! empty($nonmin)) { |
|
| 156 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
| 157 | 157 | } else { |
| 158 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
| 158 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
| 159 | 159 | } |
| 160 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
| 161 | - $url = trailingslashit( give_get_templates_url() ) . $file; |
|
| 160 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
| 161 | + $url = trailingslashit(give_get_templates_url()).$file; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' ); |
|
| 165 | - wp_enqueue_style( 'give-styles' ); |
|
| 164 | + wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all'); |
|
| 165 | + wp_enqueue_style('give-styles'); |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
| 169 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Load Admin Scripts |
@@ -180,94 +180,94 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | -function give_load_admin_scripts( $hook ) { |
|
| 183 | +function give_load_admin_scripts($hook) { |
|
| 184 | 184 | |
| 185 | 185 | global $wp_version, $post, $post_type; |
| 186 | 186 | |
| 187 | 187 | //Directories of assets |
| 188 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 189 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 190 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 188 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 189 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 190 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 191 | 191 | |
| 192 | 192 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 193 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 193 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 194 | 194 | |
| 195 | 195 | //Global Admin: |
| 196 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
| 197 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
| 196 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
| 197 | + wp_enqueue_style('give-admin-bar-notification'); |
|
| 198 | 198 | |
| 199 | 199 | //Give Admin Only: |
| 200 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
| 200 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
| 201 | 201 | return; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | //CSS |
| 205 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
| 206 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 207 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
| 208 | - wp_enqueue_style( 'give-admin' ); |
|
| 209 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
| 210 | - wp_enqueue_style( 'jquery-chosen' ); |
|
| 211 | - wp_enqueue_style( 'thickbox' ); |
|
| 205 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
| 206 | + wp_enqueue_style('jquery-ui-css'); |
|
| 207 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
| 208 | + wp_enqueue_style('give-admin'); |
|
| 209 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
| 210 | + wp_enqueue_style('jquery-chosen'); |
|
| 211 | + wp_enqueue_style('thickbox'); |
|
| 212 | 212 | |
| 213 | 213 | //JS |
| 214 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 215 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 214 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 215 | + wp_enqueue_script('jquery-chosen'); |
|
| 216 | 216 | |
| 217 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 218 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
| 217 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 218 | + wp_enqueue_script('give-admin-scripts'); |
|
| 219 | 219 | |
| 220 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
| 221 | - wp_enqueue_script( 'jquery-flot' ); |
|
| 220 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
| 221 | + wp_enqueue_script('jquery-flot'); |
|
| 222 | 222 | |
| 223 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 224 | - wp_enqueue_script( 'give-qtip' ); |
|
| 223 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 224 | + wp_enqueue_script('give-qtip'); |
|
| 225 | 225 | |
| 226 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 227 | - wp_enqueue_script( 'thickbox' ); |
|
| 226 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 227 | + wp_enqueue_script('thickbox'); |
|
| 228 | 228 | |
| 229 | 229 | //Forms CPT Script |
| 230 | - if ( $post_type === 'give_forms' ) { |
|
| 231 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 232 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
| 230 | + if ($post_type === 'give_forms') { |
|
| 231 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 232 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | //Localize strings & variables for JS |
| 236 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
| 237 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
| 236 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
| 237 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
| 238 | 238 | 'give_version' => GIVE_VERSION, |
| 239 | - 'quick_edit_warning' => __( 'Sorry, not available for variable priced forms.', 'give' ), |
|
| 240 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
| 241 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
| 242 | - 'delete_tax_rate' => __( 'Are you sure you wish to delete this tax rate?', 'give' ), |
|
| 243 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
| 244 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
| 245 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
| 246 | - 'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor', 'give' ), |
|
| 247 | - 'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
| 248 | - 'one_price_min' => __( 'You must have at least one price', 'give' ), |
|
| 249 | - 'one_file_min' => __( 'You must have at least one file', 'give' ), |
|
| 250 | - 'one_field_min' => __( 'You must have at least one field', 'give' ), |
|
| 251 | - 'one_option' => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
| 252 | - 'one_or_more_option' => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
| 253 | - 'numeric_item_price' => __( 'Item price must be numeric', 'give' ), |
|
| 254 | - 'numeric_quantity' => __( 'Quantity must be numeric', 'give' ), |
|
| 255 | - 'currency_sign' => give_currency_filter( '' ), |
|
| 256 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
| 239 | + 'quick_edit_warning' => __('Sorry, not available for variable priced forms.', 'give'), |
|
| 240 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
| 241 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
| 242 | + 'delete_tax_rate' => __('Are you sure you wish to delete this tax rate?', 'give'), |
|
| 243 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
| 244 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
| 245 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
| 246 | + 'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor', 'give'), |
|
| 247 | + 'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
| 248 | + 'one_price_min' => __('You must have at least one price', 'give'), |
|
| 249 | + 'one_file_min' => __('You must have at least one file', 'give'), |
|
| 250 | + 'one_field_min' => __('You must have at least one field', 'give'), |
|
| 251 | + 'one_option' => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
| 252 | + 'one_or_more_option' => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
| 253 | + 'numeric_item_price' => __('Item price must be numeric', 'give'), |
|
| 254 | + 'numeric_quantity' => __('Quantity must be numeric', 'give'), |
|
| 255 | + 'currency_sign' => give_currency_filter(''), |
|
| 256 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
| 257 | 257 | 'currency_decimals' => give_currency_decimal_filter(), |
| 258 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
| 259 | - 'remove_text' => __( 'Remove', 'give' ), |
|
| 260 | - 'type_to_search' => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
| 261 | - ) ); |
|
| 258 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
| 259 | + 'remove_text' => __('Remove', 'give'), |
|
| 260 | + 'type_to_search' => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
| 261 | + )); |
|
| 262 | 262 | |
| 263 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
| 263 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
| 264 | 264 | //call for new media manager |
| 265 | 265 | wp_enqueue_media(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
| 270 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Admin Give Icon |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | ?> |
| 285 | 285 | <style type="text/css" media="screen"> |
| 286 | 286 | |
| 287 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
| 287 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
| 288 | 288 | @font-face { |
| 289 | 289 | font-family: 'give-icomoon'; |
| 290 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
| 291 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
| 292 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
| 293 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
| 294 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
| 290 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
| 291 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
| 292 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
| 293 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
| 294 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
| 295 | 295 | font-weight: normal; |
| 296 | 296 | font-style: normal; |
| 297 | 297 | } |
@@ -310,4 +310,4 @@ discard block |
||
| 310 | 310 | <?php |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
| 313 | +add_action('admin_head', 'give_admin_icon'); |
|
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | //validate display_style and float_labels value |
| 81 | 81 | if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
| 82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 82 | + || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 83 | 83 | ) { |
| 84 | 84 | |
| 85 | 85 | $atts[ $key ] = ''; |
@@ -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 | |
@@ -24,17 +24,17 @@ discard block |
||
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | 26 | function give_donation_history() { |
| 27 | - if ( is_user_logged_in() ) { |
|
| 27 | + if (is_user_logged_in()) { |
|
| 28 | 28 | ob_start(); |
| 29 | - give_get_template_part( 'history', 'donations' ); |
|
| 29 | + give_get_template_part('history', 'donations'); |
|
| 30 | 30 | |
| 31 | 31 | return ob_get_clean(); |
| 32 | 32 | } else { |
| 33 | - echo apply_filters( 'give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>' . __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ) . '</p></div>' ); |
|
| 33 | + echo apply_filters('give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>'.__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give').'</p></div>'); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
| 37 | +add_shortcode('donation_history', 'give_donation_history'); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Donation Form Shortcode |
@@ -48,53 +48,53 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | -function give_form_shortcode( $atts, $content = null ) { |
|
| 52 | - $atts = shortcode_atts( array( |
|
| 51 | +function give_form_shortcode($atts, $content = null) { |
|
| 52 | + $atts = shortcode_atts(array( |
|
| 53 | 53 | 'id' => '', |
| 54 | 54 | 'show_title' => true, |
| 55 | 55 | 'show_goal' => true, |
| 56 | 56 | 'show_content' => '', |
| 57 | 57 | 'float_labels' => '', |
| 58 | 58 | 'display_style' => '', |
| 59 | - ), $atts, 'give_form' ); |
|
| 59 | + ), $atts, 'give_form'); |
|
| 60 | 60 | |
| 61 | - foreach ( $atts as $key => $value ) { |
|
| 61 | + foreach ($atts as $key => $value) { |
|
| 62 | 62 | //convert shortcode_atts values to booleans |
| 63 | - if ( $key == 'show_title' ) { |
|
| 64 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
| 65 | - } elseif ( $key == 'show_goal' ) { |
|
| 66 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
| 63 | + if ($key == 'show_title') { |
|
| 64 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
| 65 | + } elseif ($key == 'show_goal') { |
|
| 66 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | //validate show_content value |
| 70 | - if ( $key == 'show_content' ) { |
|
| 71 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
| 72 | - $atts[ $key ] = ''; |
|
| 73 | - } else if ( $value == 'above' ) { |
|
| 74 | - $atts[ $key ] = 'give_pre_form'; |
|
| 75 | - } else if ( $value == 'below' ) { |
|
| 76 | - $atts[ $key ] = 'give_post_form'; |
|
| 70 | + if ($key == 'show_content') { |
|
| 71 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
| 72 | + $atts[$key] = ''; |
|
| 73 | + } else if ($value == 'above') { |
|
| 74 | + $atts[$key] = 'give_pre_form'; |
|
| 75 | + } else if ($value == 'below') { |
|
| 76 | + $atts[$key] = 'give_post_form'; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | //validate display_style and float_labels value |
| 81 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
| 82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
| 81 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
| 82 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
| 83 | 83 | ) { |
| 84 | 84 | |
| 85 | - $atts[ $key ] = ''; |
|
| 85 | + $atts[$key] = ''; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | //get the Give Form |
| 90 | 90 | ob_start(); |
| 91 | - give_get_donation_form( $atts ); |
|
| 91 | + give_get_donation_form($atts); |
|
| 92 | 92 | $final_output = ob_get_clean(); |
| 93 | 93 | |
| 94 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
| 94 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
| 97 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Donation Form Goal Shortcode |
@@ -108,37 +108,37 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | -function give_goal_shortcode( $atts, $content = null ) { |
|
| 112 | - $atts = shortcode_atts( array( |
|
| 111 | +function give_goal_shortcode($atts, $content = null) { |
|
| 112 | + $atts = shortcode_atts(array( |
|
| 113 | 113 | 'id' => '', |
| 114 | 114 | 'show_text' => true, |
| 115 | 115 | 'show_bar' => true, |
| 116 | - ), $atts, 'give_goal' ); |
|
| 116 | + ), $atts, 'give_goal'); |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | //get the Give Form |
| 120 | 120 | ob_start(); |
| 121 | 121 | |
| 122 | 122 | //Sanity check 1: ensure there is an ID Provided |
| 123 | - if ( empty( $atts['id'] ) ) { |
|
| 124 | - give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true ); |
|
| 123 | + if (empty($atts['id'])) { |
|
| 124 | + give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //Sanity check 2: Check that this form even has Goals enabled |
| 128 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
| 129 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
| 130 | - give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true ); |
|
| 128 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
| 129 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
| 130 | + give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true); |
|
| 131 | 131 | } else { |
| 132 | 132 | //Passed all sanity checks: output Goal |
| 133 | - give_show_goal_progress( $atts['id'], $atts ); |
|
| 133 | + give_show_goal_progress($atts['id'], $atts); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $final_output = ob_get_clean(); |
| 137 | 137 | |
| 138 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
| 138 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
| 141 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | * @uses give_login_form() |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
| 159 | - extract( shortcode_atts( array( |
|
| 158 | +function give_login_form_shortcode($atts, $content = null) { |
|
| 159 | + extract(shortcode_atts(array( |
|
| 160 | 160 | 'redirect' => '', |
| 161 | - ), $atts, 'give_login' ) |
|
| 161 | + ), $atts, 'give_login') |
|
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | - return give_login_form( $redirect ); |
|
| 164 | + return give_login_form($redirect); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
| 167 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Register Shortcode |
@@ -179,16 +179,16 @@ discard block |
||
| 179 | 179 | * @uses give_register_form() |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
| 183 | - extract( shortcode_atts( array( |
|
| 182 | +function give_register_form_shortcode($atts, $content = null) { |
|
| 183 | + extract(shortcode_atts(array( |
|
| 184 | 184 | 'redirect' => '', |
| 185 | - ), $atts, 'give_register' ) |
|
| 185 | + ), $atts, 'give_register') |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | - return give_register_form( $redirect ); |
|
| 188 | + return give_register_form($redirect); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
| 191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -203,49 +203,49 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return string |
| 205 | 205 | */ |
| 206 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
| 206 | +function give_receipt_shortcode($atts, $content = null) { |
|
| 207 | 207 | |
| 208 | 208 | global $give_receipt_args; |
| 209 | 209 | |
| 210 | - $give_receipt_args = shortcode_atts( array( |
|
| 211 | - 'error' => __( 'Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give' ), |
|
| 210 | + $give_receipt_args = shortcode_atts(array( |
|
| 211 | + 'error' => __('Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give'), |
|
| 212 | 212 | 'price' => true, |
| 213 | 213 | 'date' => true, |
| 214 | 214 | 'payment_key' => false, |
| 215 | 215 | 'payment_method' => true, |
| 216 | 216 | 'payment_id' => true |
| 217 | - ), $atts, 'give_receipt' ); |
|
| 217 | + ), $atts, 'give_receipt'); |
|
| 218 | 218 | |
| 219 | 219 | //set $session var |
| 220 | 220 | $session = give_get_purchase_session(); |
| 221 | 221 | |
| 222 | 222 | //set payment key var |
| 223 | - if ( isset( $_GET['payment_key'] ) ) { |
|
| 224 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
| 225 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
| 223 | + if (isset($_GET['payment_key'])) { |
|
| 224 | + $payment_key = urldecode($_GET['payment_key']); |
|
| 225 | + } elseif ($give_receipt_args['payment_key']) { |
|
| 226 | 226 | $payment_key = $give_receipt_args['payment_key']; |
| 227 | - } else if ( $session ) { |
|
| 227 | + } else if ($session) { |
|
| 228 | 228 | $payment_key = $session['purchase_key']; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | // No key found |
| 233 | - if ( ! isset( $payment_key ) ) { |
|
| 234 | - return '<div class="give_errors"><p class="give_error">' . $give_receipt_args['error'] . '</p></div>'; |
|
| 233 | + if ( ! isset($payment_key)) { |
|
| 234 | + return '<div class="give_errors"><p class="give_error">'.$give_receipt_args['error'].'</p></div>'; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
| 238 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
| 237 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
| 238 | + $user_can_view = give_can_view_receipt($payment_key); |
|
| 239 | 239 | |
| 240 | 240 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt |
| 241 | - if ( ! $user_can_view && ! empty( $payment_key ) && ! is_user_logged_in() && ! give_is_guest_payment( $payment_id ) ) { |
|
| 241 | + if ( ! $user_can_view && ! empty($payment_key) && ! is_user_logged_in() && ! give_is_guest_payment($payment_id)) { |
|
| 242 | 242 | global $give_login_redirect; |
| 243 | 243 | $give_login_redirect = give_get_current_page_url(); |
| 244 | 244 | |
| 245 | 245 | ob_start(); |
| 246 | - echo '<div class="give_errors"><p class="give_error">' . __( 'You must be logged in to view this payment receipt.', 'give' ) . '</p></div>'; |
|
| 246 | + echo '<div class="give_errors"><p class="give_error">'.__('You must be logged in to view this payment receipt.', 'give').'</p></div>'; |
|
| 247 | 247 | |
| 248 | - give_get_template_part( 'shortcode', 'login' ); |
|
| 248 | + give_get_template_part('shortcode', 'login'); |
|
| 249 | 249 | |
| 250 | 250 | $login_form = ob_get_clean(); |
| 251 | 251 | |
@@ -264,13 +264,13 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | |
| 266 | 266 | |
| 267 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
| 268 | - return '<p class="edd-alert edd-alert-error">' . $give_receipt_args['error'] . '</p>'; |
|
| 267 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
| 268 | + return '<p class="edd-alert edd-alert-error">'.$give_receipt_args['error'].'</p>'; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | ob_start(); |
| 272 | 272 | |
| 273 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
| 273 | + give_get_template_part('shortcode', 'receipt'); |
|
| 274 | 274 | |
| 275 | 275 | $display = ob_get_clean(); |
| 276 | 276 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
| 282 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * Profile Editor Shortcode |
@@ -299,18 +299,18 @@ discard block |
||
| 299 | 299 | * |
| 300 | 300 | * @return string Output generated from the profile editor |
| 301 | 301 | */ |
| 302 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
| 302 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
| 303 | 303 | |
| 304 | 304 | ob_start(); |
| 305 | 305 | |
| 306 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
| 306 | + give_get_template_part('shortcode', 'profile-editor'); |
|
| 307 | 307 | |
| 308 | 308 | $display = ob_get_clean(); |
| 309 | 309 | |
| 310 | 310 | return $display; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
| 313 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * Process Profile Updater Form |
@@ -323,30 +323,30 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @return false |
| 325 | 325 | */ |
| 326 | -function give_process_profile_editor_updates( $data ) { |
|
| 326 | +function give_process_profile_editor_updates($data) { |
|
| 327 | 327 | // Profile field change request |
| 328 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
| 328 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
| 329 | 329 | return false; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Nonce security |
| 333 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
| 333 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
| 334 | 334 | return false; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | $user_id = get_current_user_id(); |
| 338 | - $old_user_data = get_userdata( $user_id ); |
|
| 339 | - |
|
| 340 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
| 341 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
| 342 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
| 343 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
| 344 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
| 345 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
| 346 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
| 347 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
| 348 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
| 349 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
| 338 | + $old_user_data = get_userdata($user_id); |
|
| 339 | + |
|
| 340 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
| 341 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
| 342 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
| 343 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
| 344 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
| 345 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
| 346 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
| 347 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
| 348 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
| 349 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
| 350 | 350 | |
| 351 | 351 | $userdata = array( |
| 352 | 352 | 'ID' => $user_id, |
@@ -366,45 +366,45 @@ discard block |
||
| 366 | 366 | 'country' => $country |
| 367 | 367 | ); |
| 368 | 368 | |
| 369 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
| 369 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
| 370 | 370 | |
| 371 | 371 | // New password |
| 372 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
| 373 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
| 374 | - give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
| 372 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
| 373 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
| 374 | + give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give')); |
|
| 375 | 375 | } else { |
| 376 | 376 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // Make sure the new email doesn't belong to another user |
| 381 | - if ( $email != $old_user_data->user_email ) { |
|
| 382 | - if ( email_exists( $email ) ) { |
|
| 383 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
| 381 | + if ($email != $old_user_data->user_email) { |
|
| 382 | + if (email_exists($email)) { |
|
| 383 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Check for errors |
| 388 | 388 | $errors = give_get_errors(); |
| 389 | 389 | |
| 390 | - if ( $errors ) { |
|
| 390 | + if ($errors) { |
|
| 391 | 391 | // Send back to the profile editor if there are errors |
| 392 | - wp_redirect( $data['give_redirect'] ); |
|
| 392 | + wp_redirect($data['give_redirect']); |
|
| 393 | 393 | give_die(); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Update the user |
| 397 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
| 398 | - $updated = wp_update_user( $userdata ); |
|
| 397 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
| 398 | + $updated = wp_update_user($userdata); |
|
| 399 | 399 | |
| 400 | - if ( $updated ) { |
|
| 401 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
| 402 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
| 400 | + if ($updated) { |
|
| 401 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
| 402 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
| 403 | 403 | give_die(); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | return false; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
| 409 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
| 410 | 410 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | 23 | function give_get_templates_dir() { |
| 24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
| 24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | 33 | function give_get_templates_url() { |
| 34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
| 34 | + return GIVE_PLUGIN_URL.'templates'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | * @uses load_template() |
| 52 | 52 | * @uses get_template_part() |
| 53 | 53 | */ |
| 54 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
| 54 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
| 55 | 55 | |
| 56 | 56 | // Execute code for this part |
| 57 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
| 57 | + do_action('get_template_part_'.$slug, $slug, $name); |
|
| 58 | 58 | |
| 59 | 59 | // Setup possible parts |
| 60 | 60 | $templates = array(); |
| 61 | - if ( isset( $name ) ) { |
|
| 62 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 61 | + if (isset($name)) { |
|
| 62 | + $templates[] = $slug.'-'.$name.'.php'; |
|
| 63 | 63 | } |
| 64 | - $templates[] = $slug . '.php'; |
|
| 64 | + $templates[] = $slug.'.php'; |
|
| 65 | 65 | |
| 66 | 66 | // Allow template parts to be filtered |
| 67 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
| 67 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
| 68 | 68 | |
| 69 | 69 | // Return the part that is found |
| 70 | - return give_locate_template( $templates, $load, false ); |
|
| 70 | + return give_locate_template($templates, $load, false); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -88,37 +88,37 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string The template filename if one is located. |
| 90 | 90 | */ |
| 91 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
| 91 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
| 92 | 92 | // No file found yet |
| 93 | 93 | $located = false; |
| 94 | 94 | |
| 95 | 95 | // Try to find a template file |
| 96 | - foreach ( (array) $template_names as $template_name ) { |
|
| 96 | + foreach ((array) $template_names as $template_name) { |
|
| 97 | 97 | |
| 98 | 98 | // Continue if template is empty |
| 99 | - if ( empty( $template_name ) ) { |
|
| 99 | + if (empty($template_name)) { |
|
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Trim off any slashes from the template name |
| 104 | - $template_name = ltrim( $template_name, '/' ); |
|
| 104 | + $template_name = ltrim($template_name, '/'); |
|
| 105 | 105 | |
| 106 | 106 | // try locating this template file by looping through the template paths |
| 107 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
| 107 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
| 108 | 108 | |
| 109 | - if ( file_exists( $template_path . $template_name ) ) { |
|
| 110 | - $located = $template_path . $template_name; |
|
| 109 | + if (file_exists($template_path.$template_name)) { |
|
| 110 | + $located = $template_path.$template_name; |
|
| 111 | 111 | break; |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ( $located ) { |
|
| 115 | + if ($located) { |
|
| 116 | 116 | break; |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
| 121 | - load_template( $located, $require_once ); |
|
| 120 | + if ((true == $load) && ! empty($located)) { |
|
| 121 | + load_template($located, $require_once); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return $located; |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | $template_dir = give_get_theme_template_dir_name(); |
| 136 | 136 | |
| 137 | 137 | $file_paths = array( |
| 138 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
| 139 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
| 138 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
| 139 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
| 140 | 140 | 100 => give_get_templates_dir() |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
| 143 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
| 144 | 144 | |
| 145 | 145 | // sort the file paths based on priority |
| 146 | - ksort( $file_paths, SORT_NUMERIC ); |
|
| 146 | + ksort($file_paths, SORT_NUMERIC); |
|
| 147 | 147 | |
| 148 | - return array_map( 'trailingslashit', $file_paths ); |
|
| 148 | + return array_map('trailingslashit', $file_paths); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | 159 | function give_get_theme_template_dir_name() { |
| 160 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
| 160 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | * @return void |
| 168 | 168 | */ |
| 169 | 169 | function give_version_in_header() { |
| 170 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
| 170 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
| 173 | +add_action('wp_head', 'give_version_in_header'); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Determines if we're currently on the Donations History page. |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | function give_is_donation_history_page() { |
| 182 | 182 | |
| 183 | - $ret = is_page( give_get_option( 'purchase_history_page' ) ); |
|
| 183 | + $ret = is_page(give_get_option('purchase_history_page')); |
|
| 184 | 184 | |
| 185 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
| 185 | + return apply_filters('give_is_donation_history_page', $ret); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -194,25 +194,25 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return array Modified array of classes |
| 196 | 196 | */ |
| 197 | -function give_add_body_classes( $class ) { |
|
| 197 | +function give_add_body_classes($class) { |
|
| 198 | 198 | $classes = (array) $class; |
| 199 | 199 | |
| 200 | - if ( give_is_success_page() ) { |
|
| 200 | + if (give_is_success_page()) { |
|
| 201 | 201 | $classes[] = 'give-success'; |
| 202 | 202 | $classes[] = 'give-page'; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( give_is_failed_transaction_page() ) { |
|
| 205 | + if (give_is_failed_transaction_page()) { |
|
| 206 | 206 | $classes[] = 'give-failed-transaction'; |
| 207 | 207 | $classes[] = 'give-page'; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( give_is_donation_history_page() ) { |
|
| 210 | + if (give_is_donation_history_page()) { |
|
| 211 | 211 | $classes[] = 'give-donation-history'; |
| 212 | 212 | $classes[] = 'give-page'; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if ( give_is_test_mode() ) { |
|
| 215 | + if (give_is_test_mode()) { |
|
| 216 | 216 | $classes[] = 'give-test-mode'; |
| 217 | 217 | $classes[] = 'give-page'; |
| 218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | //Theme-specific Classes used to prevent conflicts via CSS |
| 221 | 221 | $current_theme = wp_get_theme(); |
| 222 | 222 | |
| 223 | - switch ( $current_theme->template ) { |
|
| 223 | + switch ($current_theme->template) { |
|
| 224 | 224 | |
| 225 | 225 | case 'Divi': |
| 226 | 226 | $classes[] = 'give-divi'; |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - return array_unique( $classes ); |
|
| 234 | + return array_unique($classes); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
| 237 | +add_filter('body_class', 'give_add_body_classes'); |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -250,22 +250,22 @@ discard block |
||
| 250 | 250 | * |
| 251 | 251 | * @return array |
| 252 | 252 | */ |
| 253 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
| 254 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
| 253 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
| 254 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
| 255 | 255 | return $classes; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
| 259 | 259 | |
| 260 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
| 261 | - unset( $classes[ $key ] ); |
|
| 260 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
| 261 | + unset($classes[$key]); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $classes; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
| 268 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
| 268 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -277,12 +277,12 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return array |
| 279 | 279 | */ |
| 280 | -function give_get_image_size( $image_size ) { |
|
| 281 | - if ( in_array( $image_size, array( 'give_form_thumbnail', 'give_form_single' ) ) ) { |
|
| 282 | - $size = get_option( $image_size . '_image_size', array() ); |
|
| 283 | - $size['width'] = isset( $size['width'] ) ? $size['width'] : '300'; |
|
| 284 | - $size['height'] = isset( $size['height'] ) ? $size['height'] : '300'; |
|
| 285 | - $size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 0; |
|
| 280 | +function give_get_image_size($image_size) { |
|
| 281 | + if (in_array($image_size, array('give_form_thumbnail', 'give_form_single'))) { |
|
| 282 | + $size = get_option($image_size.'_image_size', array()); |
|
| 283 | + $size['width'] = isset($size['width']) ? $size['width'] : '300'; |
|
| 284 | + $size['height'] = isset($size['height']) ? $size['height'] : '300'; |
|
| 285 | + $size['crop'] = isset($size['crop']) ? $size['crop'] : 0; |
|
| 286 | 286 | } else { |
| 287 | 287 | $size = array( |
| 288 | 288 | 'width' => '300', |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | ); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - return apply_filters( 'give_get_image_size_' . $image_size, $size ); |
|
| 294 | + return apply_filters('give_get_image_size_'.$image_size, $size); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -302,86 +302,86 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | function give_get_placeholder_img_src() { |
| 304 | 304 | |
| 305 | - $image_size = give_get_image_size( 'give_form_thumbnail' ); |
|
| 305 | + $image_size = give_get_image_size('give_form_thumbnail'); |
|
| 306 | 306 | |
| 307 | - $placeholder_url = 'http://placehold.it/' . $image_size['width'] . 'x' . $image_size['height'] . '&text=' . __( 'Give+Placeholder+Image+', 'give' ) . '(' . $image_size['width'] . 'x' . $image_size['height'] . ')'; |
|
| 307 | + $placeholder_url = 'http://placehold.it/'.$image_size['width'].'x'.$image_size['height'].'&text='.__('Give+Placeholder+Image+', 'give').'('.$image_size['width'].'x'.$image_size['height'].')'; |
|
| 308 | 308 | |
| 309 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
| 309 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| 313 | 313 | /** |
| 314 | 314 | * Global |
| 315 | 315 | */ |
| 316 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
| 316 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * Output the start of the page wrapper. |
| 320 | 320 | */ |
| 321 | 321 | function give_output_content_wrapper() { |
| 322 | - give_get_template_part( 'global/wrapper-start' ); |
|
| 322 | + give_get_template_part('global/wrapper-start'); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
| 325 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Output the end of the page wrapper. |
| 329 | 329 | */ |
| 330 | 330 | function give_output_content_wrapper_end() { |
| 331 | - give_get_template_part( 'global/wrapper-end' ); |
|
| 331 | + give_get_template_part('global/wrapper-end'); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * Single Give Form |
| 337 | 337 | */ |
| 338 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
| 338 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
| 339 | 339 | function give_left_sidebar_pre_wrap() { |
| 340 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
| 340 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
| 344 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
| 345 | 345 | function give_left_sidebar_post_wrap() { |
| 346 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
| 346 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
| 350 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
| 351 | 351 | function give_get_forms_sidebar() { |
| 352 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
| 352 | + give_get_template_part('single-give-form/sidebar'); |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
| 356 | +if ( ! function_exists('give_show_form_images')) { |
|
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | 359 | * Output the product image before the single product summary. |
| 360 | 360 | */ |
| 361 | 361 | function give_show_form_images() { |
| 362 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
| 363 | - if ( $featured_image_option !== 'on' ) { |
|
| 364 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
| 362 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
| 363 | + if ($featured_image_option !== 'on') { |
|
| 364 | + give_get_template_part('single-give-form/featured-image'); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
| 369 | +if ( ! function_exists('give_template_single_title')) { |
|
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | 372 | * Output the product title. |
| 373 | 373 | */ |
| 374 | 374 | function give_template_single_title() { |
| 375 | - give_get_template_part( 'single-give-form/title' ); |
|
| 375 | + give_get_template_part('single-give-form/title'); |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
| 379 | +if ( ! function_exists('give_show_avatars')) { |
|
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | 382 | * Output the product title. |
| 383 | 383 | */ |
| 384 | 384 | function give_show_avatars() { |
| 385 | - echo do_shortcode( '[give_donators_gravatars]' ); |
|
| 385 | + echo do_shortcode('[give_donators_gravatars]'); |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | \ No newline at end of file |
@@ -10,83 +10,83 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load Give file |
| 18 | -include_once( 'give.php' ); |
|
| 18 | +include_once('give.php'); |
|
| 19 | 19 | |
| 20 | 20 | global $wpdb, $wp_roles; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
| 23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
| 24 | 24 | |
| 25 | 25 | // Delete All the Custom Post Types |
| 26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', ); |
|
| 27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
| 28 | - foreach ( $give_post_types as $post_type ) { |
|
| 26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type',); |
|
| 27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
| 28 | + foreach ($give_post_types as $post_type) { |
|
| 29 | 29 | |
| 30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
| 31 | - $items = get_posts( array( |
|
| 30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
| 31 | + $items = get_posts(array( |
|
| 32 | 32 | 'post_type' => $post_type, |
| 33 | 33 | 'post_status' => 'any', |
| 34 | - 'numberposts' => - 1, |
|
| 34 | + 'numberposts' => -1, |
|
| 35 | 35 | 'fields' => 'ids' |
| 36 | - ) ); |
|
| 36 | + )); |
|
| 37 | 37 | |
| 38 | - if ( $items ) { |
|
| 39 | - foreach ( $items as $item ) { |
|
| 40 | - wp_delete_post( $item, true ); |
|
| 38 | + if ($items) { |
|
| 39 | + foreach ($items as $item) { |
|
| 40 | + wp_delete_post($item, true); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Delete All the Terms & Taxonomies |
| 46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
| 46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
| 47 | 47 | |
| 48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
| 48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
| 49 | 49 | |
| 50 | 50 | // Delete Terms |
| 51 | - if ( $terms ) { |
|
| 52 | - foreach ( $terms as $term ) { |
|
| 53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
| 54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
| 51 | + if ($terms) { |
|
| 52 | + foreach ($terms as $term) { |
|
| 53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
| 54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Delete Taxonomies |
| 59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
| 59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Delete the Plugin Pages |
| 63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
| 64 | - foreach ( $give_created_pages as $p ) { |
|
| 65 | - $page = give_get_option( $p, false ); |
|
| 66 | - if ( $page ) { |
|
| 67 | - wp_delete_post( $page, true ); |
|
| 63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
| 64 | + foreach ($give_created_pages as $p) { |
|
| 65 | + $page = give_get_option($p, false); |
|
| 66 | + if ($page) { |
|
| 67 | + wp_delete_post($page, true); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Delete all the Plugin Options |
| 72 | - delete_option( 'give_settings' ); |
|
| 73 | - delete_option( 'give_version' ); |
|
| 72 | + delete_option('give_settings'); |
|
| 73 | + delete_option('give_version'); |
|
| 74 | 74 | |
| 75 | 75 | // Delete Capabilities |
| 76 | 76 | Give()->roles->remove_caps(); |
| 77 | 77 | |
| 78 | 78 | // Delete the Roles |
| 79 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
| 80 | - foreach ( $give_roles as $role ) { |
|
| 81 | - remove_role( $role ); |
|
| 79 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
| 80 | + foreach ($give_roles as $role) { |
|
| 81 | + remove_role($role); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Remove all database tables |
| 85 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" ); |
|
| 86 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" ); |
|
| 85 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors"); |
|
| 86 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers"); |
|
| 87 | 87 | |
| 88 | 88 | // Cleanup Cron Events |
| 89 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
| 90 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
| 91 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
| 89 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
| 90 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
| 91 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
| 92 | 92 | } |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 13 | +if ( ! defined('ABSPATH')) {
|
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
| 17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
|
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Define the metabox and field configurations. |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
|
|
| 26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
|
|
| 27 | 27 | |
| 28 | 28 | $post_id = give_get_admin_post_id(); |
| 29 | - $price = give_get_form_price( $post_id ); |
|
| 30 | - $goal = give_get_form_goal( $post_id ); |
|
| 31 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
| 32 | - $prices = give_get_variable_prices( $post_id ); |
|
| 29 | + $price = give_get_form_price($post_id); |
|
| 30 | + $goal = give_get_form_goal($post_id); |
|
| 31 | + $variable_pricing = give_has_variable_prices($post_id); |
|
| 32 | + $prices = give_get_variable_prices($post_id); |
|
| 33 | 33 | |
| 34 | 34 | //No empty prices - min. 1.00 for new forms |
| 35 | - if ( empty( $price ) ) {
|
|
| 36 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
| 35 | + if (empty($price)) {
|
|
| 36 | + $price = esc_attr(give_format_amount('1.00'));
|
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Start with an underscore to hide fields from custom fields list |
@@ -42,275 +42,275 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Repeatable Field Groups |
| 44 | 44 | */ |
| 45 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
| 45 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
|
|
| 46 | 46 | 'id' => 'form_field_options', |
| 47 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 48 | - 'object_types' => array( 'give_forms' ), |
|
| 47 | + 'title' => __('Donation Options', 'give'),
|
|
| 48 | + 'object_types' => array('give_forms'),
|
|
| 49 | 49 | 'context' => 'normal', |
| 50 | 50 | 'priority' => 'high', //Show above Content WYSIWYG |
| 51 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 51 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
|
|
| 52 | 52 | //Donation Option |
| 53 | 53 | array( |
| 54 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 55 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
| 56 | - 'id' => $prefix . 'price_option', |
|
| 54 | + 'name' => __('Donation Option', 'give'),
|
|
| 55 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'),
|
|
| 56 | + 'id' => $prefix.'price_option', |
|
| 57 | 57 | 'type' => 'radio_inline', |
| 58 | 58 | 'default' => 'set', |
| 59 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 60 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 61 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 62 | - ) ), |
|
| 59 | + 'options' => apply_filters('give_forms_price_options', array(
|
|
| 60 | + 'set' => __('Set Donation', 'give'),
|
|
| 61 | + 'multi' => __('Multi-level Donation', 'give'),
|
|
| 62 | + )), |
|
| 63 | 63 | ), |
| 64 | 64 | array( |
| 65 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 66 | - 'description' => __( 'This is the set donation amount for this form.', 'give' ), |
|
| 67 | - 'id' => $prefix . 'set_price', |
|
| 65 | + 'name' => __('Set Donation', 'give'),
|
|
| 66 | + 'description' => __('This is the set donation amount for this form.', 'give'),
|
|
| 67 | + 'id' => $prefix.'set_price', |
|
| 68 | 68 | 'type' => 'text_small', |
| 69 | 69 | 'row_classes' => 'give-subfield', |
| 70 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 71 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 70 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 71 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 72 | 72 | 'attributes' => array( |
| 73 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 73 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 74 | 74 | 'value' => $price, |
| 75 | 75 | 'class' => 'cmb-type-text-small give-money-field', |
| 76 | 76 | ), |
| 77 | 77 | ), |
| 78 | 78 | //Donation levels: Header |
| 79 | 79 | array( |
| 80 | - 'id' => $prefix . 'levels_header', |
|
| 80 | + 'id' => $prefix.'levels_header', |
|
| 81 | 81 | 'type' => 'levels_repeater_header', |
| 82 | 82 | ), |
| 83 | 83 | //Donation Levels: Repeatable CMB2 Group |
| 84 | 84 | array( |
| 85 | - 'id' => $prefix . 'donation_levels', |
|
| 85 | + 'id' => $prefix.'donation_levels', |
|
| 86 | 86 | 'type' => 'group', |
| 87 | 87 | 'row_classes' => 'give-subfield', |
| 88 | 88 | 'options' => array( |
| 89 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 90 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
| 89 | + 'add_button' => __('Add Level', 'give'),
|
|
| 90 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'),
|
|
| 91 | 91 | 'sortable' => true, // beta |
| 92 | 92 | ), |
| 93 | 93 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
| 94 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 94 | + 'fields' => apply_filters('give_donation_levels_table_row', array(
|
|
| 95 | 95 | array( |
| 96 | - 'name' => __( 'ID', 'give' ), |
|
| 97 | - 'id' => $prefix . 'id', |
|
| 96 | + 'name' => __('ID', 'give'),
|
|
| 97 | + 'id' => $prefix.'id', |
|
| 98 | 98 | 'type' => 'levels_id', |
| 99 | 99 | ), |
| 100 | 100 | array( |
| 101 | - 'name' => __( 'Amount', 'give' ), |
|
| 102 | - 'id' => $prefix . 'amount', |
|
| 101 | + 'name' => __('Amount', 'give'),
|
|
| 102 | + 'id' => $prefix.'amount', |
|
| 103 | 103 | 'type' => 'text_small', |
| 104 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 105 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 104 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 105 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 106 | 106 | 'attributes' => array( |
| 107 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 107 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 108 | 108 | 'class' => 'cmb-type-text-small give-money-field', |
| 109 | 109 | ), |
| 110 | 110 | 'before' => 'give_format_admin_multilevel_amount', |
| 111 | 111 | ), |
| 112 | 112 | array( |
| 113 | - 'name' => __( 'Text', 'give' ), |
|
| 114 | - 'id' => $prefix . 'text', |
|
| 113 | + 'name' => __('Text', 'give'),
|
|
| 114 | + 'id' => $prefix.'text', |
|
| 115 | 115 | 'type' => 'text', |
| 116 | 116 | 'attributes' => array( |
| 117 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 117 | + 'placeholder' => __('Donation Level', 'give'),
|
|
| 118 | 118 | 'rows' => 3, |
| 119 | 119 | ), |
| 120 | 120 | ), |
| 121 | 121 | array( |
| 122 | - 'name' => __( 'Default', 'give' ), |
|
| 123 | - 'id' => $prefix . 'default', |
|
| 122 | + 'name' => __('Default', 'give'),
|
|
| 123 | + 'id' => $prefix.'default', |
|
| 124 | 124 | 'type' => 'give_default_radio_inline' |
| 125 | 125 | ), |
| 126 | - ) ), |
|
| 126 | + )), |
|
| 127 | 127 | ), |
| 128 | 128 | //Display Style |
| 129 | 129 | array( |
| 130 | - 'name' => __( 'Display Style', 'give' ), |
|
| 131 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 132 | - 'id' => $prefix . 'display_style', |
|
| 130 | + 'name' => __('Display Style', 'give'),
|
|
| 131 | + 'description' => __('Set how the donations levels will display on the form.', 'give'),
|
|
| 132 | + 'id' => $prefix.'display_style', |
|
| 133 | 133 | 'type' => 'radio_inline', |
| 134 | 134 | 'default' => 'buttons', |
| 135 | 135 | 'options' => array( |
| 136 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 137 | - 'radios' => __( 'Radios', 'give' ), |
|
| 138 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 136 | + 'buttons' => __('Buttons', 'give'),
|
|
| 137 | + 'radios' => __('Radios', 'give'),
|
|
| 138 | + 'dropdown' => __('Dropdown', 'give'),
|
|
| 139 | 139 | ), |
| 140 | 140 | ), |
| 141 | 141 | //Custom Amount |
| 142 | 142 | array( |
| 143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 145 | - 'id' => $prefix . 'custom_amount', |
|
| 143 | + 'name' => __('Custom Amount', 'give'),
|
|
| 144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
|
|
| 145 | + 'id' => $prefix.'custom_amount', |
|
| 146 | 146 | 'type' => 'radio_inline', |
| 147 | 147 | 'default' => 'no', |
| 148 | 148 | 'options' => array( |
| 149 | - 'yes' => __( 'Yes', 'give' ), |
|
| 150 | - 'no' => __( 'No', 'give' ), |
|
| 149 | + 'yes' => __('Yes', 'give'),
|
|
| 150 | + 'no' => __('No', 'give'),
|
|
| 151 | 151 | ), |
| 152 | 152 | ), |
| 153 | 153 | array( |
| 154 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 155 | - 'description' => __( 'This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give' ), |
|
| 156 | - 'id' => $prefix . 'custom_amount_text', |
|
| 154 | + 'name' => __('Custom Amount Text', 'give'),
|
|
| 155 | + 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'),
|
|
| 156 | + 'id' => $prefix.'custom_amount_text', |
|
| 157 | 157 | 'type' => 'text', |
| 158 | 158 | 'row_classes' => 'give-subfield', |
| 159 | 159 | 'attributes' => array( |
| 160 | 160 | 'rows' => 3, |
| 161 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 161 | + 'placeholder' => __('Give a Custom Amount', 'give'),
|
|
| 162 | 162 | ), |
| 163 | 163 | ), |
| 164 | 164 | //Goals |
| 165 | 165 | array( |
| 166 | - 'name' => __( 'Set Goal?', 'give' ), |
|
| 167 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 168 | - 'id' => $prefix . 'goal_option', |
|
| 166 | + 'name' => __('Set Goal?', 'give'),
|
|
| 167 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'),
|
|
| 168 | + 'id' => $prefix.'goal_option', |
|
| 169 | 169 | 'type' => 'radio_inline', |
| 170 | 170 | 'default' => 'no', |
| 171 | 171 | 'options' => array( |
| 172 | - 'yes' => __( 'Yes', 'give' ), |
|
| 173 | - 'no' => __( 'No', 'give' ), |
|
| 172 | + 'yes' => __('Yes', 'give'),
|
|
| 173 | + 'no' => __('No', 'give'),
|
|
| 174 | 174 | ), |
| 175 | 175 | ), |
| 176 | 176 | array( |
| 177 | - 'name' => __( 'Set Goal', 'give' ), |
|
| 178 | - 'description' => __( 'This is the goal you want to achieve for this form.', 'give' ), |
|
| 179 | - 'id' => $prefix . 'set_goal', |
|
| 177 | + 'name' => __('Set Goal', 'give'),
|
|
| 178 | + 'description' => __('This is the goal you want to achieve for this form.', 'give'),
|
|
| 179 | + 'id' => $prefix.'set_goal', |
|
| 180 | 180 | 'type' => 'text_small', |
| 181 | 181 | 'row_classes' => 'give-subfield', |
| 182 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 183 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 182 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 183 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 184 | 184 | 'attributes' => array( |
| 185 | - 'placeholder' => give_format_amount( '0.00' ), |
|
| 186 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
| 185 | + 'placeholder' => give_format_amount('0.00'),
|
|
| 186 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
| 187 | 187 | 'class' => 'cmb-type-text-small give-money-field', |
| 188 | 188 | ), |
| 189 | 189 | ), |
| 190 | 190 | array( |
| 191 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
| 192 | - 'id' => $prefix . 'goal_color', |
|
| 191 | + 'name' => __('Goal Progress Bar Color', 'give'),
|
|
| 192 | + 'id' => $prefix.'goal_color', |
|
| 193 | 193 | 'type' => 'colorpicker', |
| 194 | 194 | 'row_classes' => 'give-subfield', |
| 195 | 195 | 'default' => '#2bc253', |
| 196 | 196 | ), |
| 197 | 197 | ) |
| 198 | 198 | ) |
| 199 | - ) ); |
|
| 199 | + )); |
|
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Content Field |
| 204 | 204 | */ |
| 205 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
| 205 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
|
|
| 206 | 206 | 'id' => 'form_content_options', |
| 207 | - 'title' => __( 'Form Content', 'give' ), |
|
| 208 | - 'object_types' => array( 'give_forms' ), |
|
| 207 | + 'title' => __('Form Content', 'give'),
|
|
| 208 | + 'object_types' => array('give_forms'),
|
|
| 209 | 209 | 'context' => 'normal', |
| 210 | 210 | 'priority' => 'high', //Show above Content WYSIWYG |
| 211 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 211 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
|
|
| 212 | 212 | //Donation Option |
| 213 | 213 | array( |
| 214 | - 'name' => __( 'Display Content', 'give' ), |
|
| 215 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
| 216 | - 'id' => $prefix . 'content_option', |
|
| 214 | + 'name' => __('Display Content', 'give'),
|
|
| 215 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
|
|
| 216 | + 'id' => $prefix.'content_option', |
|
| 217 | 217 | 'type' => 'select', |
| 218 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 219 | - 'none' => __( 'No content', 'give' ), |
|
| 220 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
| 221 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
| 218 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 219 | + 'none' => __('No content', 'give'),
|
|
| 220 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'),
|
|
| 221 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
|
|
| 222 | 222 | ) |
| 223 | 223 | ), |
| 224 | 224 | 'default' => 'none', |
| 225 | 225 | ), |
| 226 | 226 | array( |
| 227 | - 'name' => __( 'Content', 'give' ), |
|
| 228 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 229 | - 'id' => $prefix . 'form_content', |
|
| 227 | + 'name' => __('Content', 'give'),
|
|
| 228 | + 'description' => __('This content will display on the single give form page.', 'give'),
|
|
| 229 | + 'id' => $prefix.'form_content', |
|
| 230 | 230 | 'row_classes' => 'give-subfield', |
| 231 | 231 | 'type' => 'wysiwyg' |
| 232 | 232 | ), |
| 233 | 233 | ) |
| 234 | 234 | ) |
| 235 | - ) ); |
|
| 235 | + )); |
|
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | 239 | * Display Options |
| 240 | 240 | */ |
| 241 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
| 241 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
|
|
| 242 | 242 | 'id' => 'form_display_options', |
| 243 | - 'title' => __( 'Form Display Options', 'give' ), |
|
| 244 | - 'object_types' => array( 'give_forms' ), |
|
| 243 | + 'title' => __('Form Display Options', 'give'),
|
|
| 244 | + 'object_types' => array('give_forms'),
|
|
| 245 | 245 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
| 246 | 246 | 'priority' => 'high', //Show above Content WYSIWYG |
| 247 | 247 | 'show_names' => true, // Show field names on the left |
| 248 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 248 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
|
|
| 249 | 249 | array( |
| 250 | - 'name' => __( 'Payment Fields', 'give' ), |
|
| 251 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
| 252 | - 'id' => $prefix . 'payment_display', |
|
| 250 | + 'name' => __('Payment Fields', 'give'),
|
|
| 251 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
|
|
| 252 | + 'id' => $prefix.'payment_display', |
|
| 253 | 253 | 'type' => 'select', |
| 254 | 254 | 'options' => array( |
| 255 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
| 256 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
| 257 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
| 255 | + 'onpage' => __('Show on Page', 'give'),
|
|
| 256 | + 'reveal' => __('Reveal Upon Click', 'give'),
|
|
| 257 | + 'modal' => __('Modal Window Upon Click', 'give'),
|
|
| 258 | 258 | ), |
| 259 | 259 | 'default' => 'onpage', |
| 260 | 260 | ), |
| 261 | 261 | array( |
| 262 | - 'id' => $prefix . 'reveal_label', |
|
| 263 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
| 264 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
| 262 | + 'id' => $prefix.'reveal_label', |
|
| 263 | + 'name' => __('Reveal / Modal Open Text', 'give'),
|
|
| 264 | + 'desc' => __('The button label for completing the donation.', 'give'),
|
|
| 265 | 265 | 'type' => 'text_small', |
| 266 | 266 | 'row_classes' => 'give-subfield', |
| 267 | 267 | 'attributes' => array( |
| 268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 268 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 269 | 269 | ), |
| 270 | 270 | ), |
| 271 | 271 | array( |
| 272 | - 'id' => $prefix . 'checkout_label', |
|
| 273 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
| 274 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 272 | + 'id' => $prefix.'checkout_label', |
|
| 273 | + 'name' => __('Complete Donation Text', 'give'),
|
|
| 274 | + 'desc' => __('The button label for completing a donation.', 'give'),
|
|
| 275 | 275 | 'type' => 'text_small', |
| 276 | 276 | 'attributes' => array( |
| 277 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 277 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 278 | 278 | ), |
| 279 | 279 | ), |
| 280 | 280 | array( |
| 281 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 282 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 283 | - 'id' => $prefix . 'default_gateway', |
|
| 281 | + 'name' => __('Default Gateway', 'give'),
|
|
| 282 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
|
|
| 283 | + 'id' => $prefix.'default_gateway', |
|
| 284 | 284 | 'type' => 'default_gateway' |
| 285 | 285 | ), |
| 286 | 286 | array( |
| 287 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
| 288 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
| 289 | - 'id' => $prefix . 'logged_in_only', |
|
| 287 | + 'name' => __('Disable Guest Donations', 'give'),
|
|
| 288 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
|
|
| 289 | + 'id' => $prefix.'logged_in_only', |
|
| 290 | 290 | 'type' => 'checkbox' |
| 291 | 291 | ), |
| 292 | 292 | array( |
| 293 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
| 294 | - 'desc' => __( 'Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give' ), |
|
| 295 | - 'id' => $prefix . 'show_register_form', |
|
| 293 | + 'name' => __('Register / Login Form', 'give'),
|
|
| 294 | + 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'),
|
|
| 295 | + 'id' => $prefix.'show_register_form', |
|
| 296 | 296 | 'type' => 'select', |
| 297 | 297 | 'options' => array( |
| 298 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
| 299 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
| 300 | - 'login' => __( 'Login Form Only', 'give' ), |
|
| 301 | - 'none' => __( 'None', 'give' ), |
|
| 298 | + 'both' => __('Registration and Login Forms', 'give'),
|
|
| 299 | + 'registration' => __('Registration Form Only', 'give'),
|
|
| 300 | + 'login' => __('Login Form Only', 'give'),
|
|
| 301 | + 'none' => __('None', 'give'),
|
|
| 302 | 302 | ), |
| 303 | 303 | 'default' => 'none', |
| 304 | 304 | ), |
| 305 | 305 | array( |
| 306 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 307 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
| 308 | - 'id' => $prefix . 'form_floating_labels', |
|
| 306 | + 'name' => __('Floating Labels', 'give'),
|
|
| 307 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
|
|
| 308 | + 'id' => $prefix.'form_floating_labels', |
|
| 309 | 309 | 'type' => 'select', |
| 310 | 310 | 'options' => array( |
| 311 | - '' => __( 'Use the global setting', 'give' ), |
|
| 312 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 313 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 311 | + '' => __('Use the global setting', 'give'),
|
|
| 312 | + 'enabled' => __('Enabled', 'give'),
|
|
| 313 | + 'disabled' => __('Disabled', 'give'),
|
|
| 314 | 314 | ), |
| 315 | 315 | 'default' => 'none', |
| 316 | 316 | ) |
@@ -322,47 +322,47 @@ discard block |
||
| 322 | 322 | /** |
| 323 | 323 | * Terms & Conditions |
| 324 | 324 | */ |
| 325 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
| 325 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
|
|
| 326 | 326 | 'id' => 'form_terms_options', |
| 327 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 328 | - 'object_types' => array( 'give_forms' ), |
|
| 327 | + 'title' => __('Terms and Conditions', 'give'),
|
|
| 328 | + 'object_types' => array('give_forms'),
|
|
| 329 | 329 | 'context' => 'normal', |
| 330 | 330 | 'priority' => 'high', //Show above Content WYSIWYG |
| 331 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 331 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
|
|
| 332 | 332 | //Donation Option |
| 333 | 333 | array( |
| 334 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 335 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
| 336 | - 'id' => $prefix . 'terms_option', |
|
| 334 | + 'name' => __('Terms and Conditions', 'give'),
|
|
| 335 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
|
|
| 336 | + 'id' => $prefix.'terms_option', |
|
| 337 | 337 | 'type' => 'select', |
| 338 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 339 | - 'none' => __( 'No', 'give' ), |
|
| 340 | - 'yes' => __( 'Yes', 'give' ), |
|
| 338 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 339 | + 'none' => __('No', 'give'),
|
|
| 340 | + 'yes' => __('Yes', 'give'),
|
|
| 341 | 341 | ) |
| 342 | 342 | ), |
| 343 | 343 | 'default' => 'none', |
| 344 | 344 | ), |
| 345 | 345 | array( |
| 346 | - 'id' => $prefix . 'agree_label', |
|
| 347 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
| 348 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 346 | + 'id' => $prefix.'agree_label', |
|
| 347 | + 'name' => __('Agree to Terms Label', 'give'),
|
|
| 348 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
|
|
| 349 | 349 | 'type' => 'text', |
| 350 | 350 | 'row_classes' => 'give-subfield', |
| 351 | 351 | 'size' => 'regular', |
| 352 | 352 | 'attributes' => array( |
| 353 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 353 | + 'placeholder' => __('Agree to Terms?', 'give'),
|
|
| 354 | 354 | ), |
| 355 | 355 | ), |
| 356 | 356 | array( |
| 357 | - 'id' => $prefix . 'agree_text', |
|
| 357 | + 'id' => $prefix.'agree_text', |
|
| 358 | 358 | 'row_classes' => 'give-subfield', |
| 359 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 360 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 359 | + 'name' => __('Agreement Text', 'give'),
|
|
| 360 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
|
|
| 361 | 361 | 'type' => 'wysiwyg' |
| 362 | 362 | ), |
| 363 | 363 | ) |
| 364 | 364 | ) |
| 365 | - ) ); |
|
| 365 | + )); |
|
| 366 | 366 | |
| 367 | 367 | return $meta_boxes; |
| 368 | 368 | |
@@ -371,18 +371,18 @@ discard block |
||
| 371 | 371 | /** |
| 372 | 372 | * Repeatable Levels Custom Field |
| 373 | 373 | */ |
| 374 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
| 374 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
|
|
| 375 | 375 | function give_cmb_render_levels_repeater_header() {
|
| 376 | 376 | ?> |
| 377 | 377 | |
| 378 | 378 | <div class="table-container"> |
| 379 | 379 | <div class="table-row"> |
| 380 | - <div class="table-cell col-id"><?php _e( 'ID', 'give' ); ?></div> |
|
| 381 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
| 382 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
| 383 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
| 384 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
| 385 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
| 380 | + <div class="table-cell col-id"><?php _e('ID', 'give'); ?></div>
|
|
| 381 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
|
|
| 382 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
|
|
| 383 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
|
|
| 384 | + <?php do_action('give_donation_levels_table_head'); ?>
|
|
| 385 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
|
|
| 386 | 386 | |
| 387 | 387 | </div> |
| 388 | 388 | </div> |
@@ -397,22 +397,22 @@ discard block |
||
| 397 | 397 | * @description: Custom CMB2 incremental Levels ID Field |
| 398 | 398 | * @since 1.0 |
| 399 | 399 | */ |
| 400 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
| 401 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 400 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
|
|
| 401 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 402 | 402 | |
| 403 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
| 403 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
| 404 | 404 | |
| 405 | 405 | $field_options_array = array( |
| 406 | 406 | 'class' => 'give-hidden give-level-id-input', |
| 407 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
| 408 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
| 407 | + 'name' => $field_type_object->_name('[level_id]'),
|
|
| 408 | + 'id' => $field_type_object->_id('_level_id'),
|
|
| 409 | 409 | 'value' => $escaped_value, |
| 410 | 410 | 'type' => 'number', |
| 411 | 411 | 'desc' => '', |
| 412 | 412 | ); |
| 413 | 413 | |
| 414 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
| 415 | - echo $field_type_object->input( $field_options_array ); |
|
| 414 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
| 415 | + echo $field_type_object->input($field_options_array); |
|
| 416 | 416 | |
| 417 | 417 | } |
| 418 | 418 | |
@@ -420,10 +420,10 @@ discard block |
||
| 420 | 420 | /** |
| 421 | 421 | * CMB2 Repeatable Default ID Field |
| 422 | 422 | */ |
| 423 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
| 424 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 425 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
| 426 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
| 423 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
|
|
| 424 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 425 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
|
|
| 426 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
| 427 | 427 | |
| 428 | 428 | } |
| 429 | 429 | |
@@ -435,20 +435,20 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | function give_add_shortcode_to_publish_metabox() {
|
| 437 | 437 | |
| 438 | - if ( 'give_forms' !== get_post_type() ) {
|
|
| 438 | + if ('give_forms' !== get_post_type()) {
|
|
| 439 | 439 | return false; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | global $post; |
| 443 | 443 | |
| 444 | 444 | //Only enqueue scripts for CPT on post type screen |
| 445 | - if ( 'give_forms' === $post->post_type ) {
|
|
| 445 | + if ('give_forms' === $post->post_type) {
|
|
| 446 | 446 | //Shortcode column with select all input |
| 447 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
| 448 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
| 447 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
|
|
| 448 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
|
|
| 449 | 449 | |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
| 454 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
|
|
@@ -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 | |
@@ -28,66 +28,66 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
| 32 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
| 31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
| 32 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
| 33 | 33 | return; |
| 34 | 34 | } // Make sure that payments are only completed once |
| 35 | 35 | |
| 36 | 36 | // Make sure the payment completion is only processed when new status is complete |
| 37 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
| 37 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
| 42 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
| 43 | - $completed_date = give_get_payment_completed_date( $payment_id ); |
|
| 44 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 45 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
| 46 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 41 | + $payment_meta = give_get_payment_meta($payment_id); |
|
| 42 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
| 43 | + $completed_date = give_get_payment_completed_date($payment_id); |
|
| 44 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 45 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
| 46 | + $amount = give_get_payment_amount($payment_id); |
|
| 47 | 47 | |
| 48 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
| 48 | + do_action('give_pre_complete_purchase', $payment_id); |
|
| 49 | 49 | |
| 50 | - $price_id = isset( $_POST['give-price-id'] ) ? (int) $_POST['give-price-id'] : false; |
|
| 50 | + $price_id = isset($_POST['give-price-id']) ? (int) $_POST['give-price-id'] : false; |
|
| 51 | 51 | |
| 52 | 52 | // Ensure these actions only run once, ever |
| 53 | - if ( empty( $completed_date ) ) { |
|
| 53 | + if (empty($completed_date)) { |
|
| 54 | 54 | |
| 55 | - if ( ! give_is_test_mode() || apply_filters( 'give_log_test_payment_stats', false ) ) { |
|
| 55 | + if ( ! give_is_test_mode() || apply_filters('give_log_test_payment_stats', false)) { |
|
| 56 | 56 | |
| 57 | - give_record_sale_in_log( $payment_meta['form_id'], $payment_id, $price_id, $creation_date ); |
|
| 58 | - give_increase_purchase_count( $payment_meta['form_id'] ); |
|
| 59 | - give_increase_earnings( $payment_meta['form_id'], $amount ); |
|
| 57 | + give_record_sale_in_log($payment_meta['form_id'], $payment_id, $price_id, $creation_date); |
|
| 58 | + give_increase_purchase_count($payment_meta['form_id']); |
|
| 59 | + give_increase_earnings($payment_meta['form_id'], $amount); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - do_action( 'give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta ); |
|
| 63 | + do_action('give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | // Clear the total earnings cache |
| 68 | - delete_transient( 'give_earnings_total' ); |
|
| 68 | + delete_transient('give_earnings_total'); |
|
| 69 | 69 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
| 70 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 71 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
| 70 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 71 | + delete_transient(md5('give_earnings_todaytoday')); |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | // Increase the donor's purchase stats |
| 75 | - Give()->customers->increment_stats( $donor_id, $amount ); |
|
| 75 | + Give()->customers->increment_stats($donor_id, $amount); |
|
| 76 | 76 | |
| 77 | - give_increase_total_earnings( $amount ); |
|
| 77 | + give_increase_total_earnings($amount); |
|
| 78 | 78 | |
| 79 | 79 | // Ensure this action only runs once ever |
| 80 | - if ( empty( $completed_date ) ) { |
|
| 80 | + if (empty($completed_date)) { |
|
| 81 | 81 | |
| 82 | 82 | // Save the completed date |
| 83 | - give_update_payment_meta( $payment_id, '_give_completed_date', current_time( 'mysql' ) ); |
|
| 83 | + give_update_payment_meta($payment_id, '_give_completed_date', current_time('mysql')); |
|
| 84 | 84 | |
| 85 | - do_action( 'give_complete_purchase', $payment_id ); |
|
| 85 | + do_action('give_complete_purchase', $payment_id); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
| 90 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
| 104 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
| 105 | 105 | |
| 106 | 106 | // Get the list of statuses so that status in the payment note can be translated |
| 107 | 107 | $stati = give_get_payment_statuses(); |
| 108 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
| 109 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
| 108 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
| 109 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
| 110 | 110 | |
| 111 | - $status_change = sprintf( __( 'Status changed from %s to %s', 'give' ), $old_status, $new_status ); |
|
| 111 | + $status_change = sprintf(__('Status changed from %s to %s', 'give'), $old_status, $new_status); |
|
| 112 | 112 | |
| 113 | - give_insert_payment_note( $payment_id, $status_change ); |
|
| 113 | + give_insert_payment_note($payment_id, $status_change); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
| 116 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Reduces earnings and donation stats when a donation is refunded |
@@ -126,40 +126,40 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | -function give_undo_donation_on_refund( $payment_id, $new_status, $old_status ) { |
|
| 129 | +function give_undo_donation_on_refund($payment_id, $new_status, $old_status) { |
|
| 130 | 130 | |
| 131 | - if ( 'publish' != $old_status && 'revoked' != $old_status ) { |
|
| 131 | + if ('publish' != $old_status && 'revoked' != $old_status) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( 'refunded' != $new_status ) { |
|
| 135 | + if ('refunded' != $new_status) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Set necessary vars |
| 140 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
| 141 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 140 | + $payment_meta = give_get_payment_meta($payment_id); |
|
| 141 | + $amount = give_get_payment_amount($payment_id); |
|
| 142 | 142 | |
| 143 | 143 | // Undo this purchase |
| 144 | - give_undo_purchase( $payment_meta['form_id'], $payment_id ); |
|
| 144 | + give_undo_purchase($payment_meta['form_id'], $payment_id); |
|
| 145 | 145 | |
| 146 | 146 | // Decrease total earnings |
| 147 | - give_decrease_total_earnings( $amount ); |
|
| 147 | + give_decrease_total_earnings($amount); |
|
| 148 | 148 | |
| 149 | 149 | // Decrement the stats for the donor |
| 150 | - $donor_id = give_get_payment_customer_id( $payment_id ); |
|
| 150 | + $donor_id = give_get_payment_customer_id($payment_id); |
|
| 151 | 151 | |
| 152 | - if ( $donor_id ) { |
|
| 152 | + if ($donor_id) { |
|
| 153 | 153 | |
| 154 | - Give()->customers->decrement_stats( $donor_id, $amount ); |
|
| 154 | + Give()->customers->decrement_stats($donor_id, $amount); |
|
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Clear the This Month earnings (this_monththis_month is NOT a typo) |
| 159 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 159 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -add_action( 'give_update_payment_status', 'give_undo_donation_on_refund', 100, 3 ); |
|
| 162 | +add_action('give_update_payment_status', 'give_undo_donation_on_refund', 100, 3); |
|
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | * @param $new_status the status of the payment, probably "publish" |
| 173 | 173 | * @param $old_status the status of the payment prior to being marked as "complete", probably "pending" |
| 174 | 174 | */ |
| 175 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
| 176 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 175 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
| 176 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
| 177 | 177 | |
| 178 | - delete_transient( 'give_user_' . $user_info['id'] . '_purchases' ); |
|
| 178 | + delete_transient('give_user_'.$user_info['id'].'_purchases'); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
| 181 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * Updates all old payments, prior to 1.2, with new |
@@ -192,32 +192,32 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @return void |
| 194 | 194 | */ |
| 195 | -function give_update_old_payments_with_totals( $data ) { |
|
| 196 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
| 195 | +function give_update_old_payments_with_totals($data) { |
|
| 196 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
| 200 | + if (get_option('give_payment_totals_upgraded')) { |
|
| 201 | 201 | return; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $payments = give_get_payments( array( |
|
| 204 | + $payments = give_get_payments(array( |
|
| 205 | 205 | 'offset' => 0, |
| 206 | - 'number' => - 1, |
|
| 206 | + 'number' => -1, |
|
| 207 | 207 | 'mode' => 'all' |
| 208 | - ) ); |
|
| 208 | + )); |
|
| 209 | 209 | |
| 210 | - if ( $payments ) { |
|
| 211 | - foreach ( $payments as $payment ) { |
|
| 212 | - $meta = give_get_payment_meta( $payment->ID ); |
|
| 213 | - give_update_payment_meta( $payment->ID, '_give_payment_total', $meta['amount'] ); |
|
| 210 | + if ($payments) { |
|
| 211 | + foreach ($payments as $payment) { |
|
| 212 | + $meta = give_get_payment_meta($payment->ID); |
|
| 213 | + give_update_payment_meta($payment->ID, '_give_payment_total', $meta['amount']); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
| 217 | + add_option('give_payment_totals_upgraded', 1); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
| 220 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Updates week-old+ 'pending' orders to 'abandoned' |
@@ -228,21 +228,21 @@ discard block |
||
| 228 | 228 | function give_mark_abandoned_donations() { |
| 229 | 229 | $args = array( |
| 230 | 230 | 'status' => 'pending', |
| 231 | - 'number' => - 1, |
|
| 231 | + 'number' => -1, |
|
| 232 | 232 | 'fields' => 'ids' |
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
| 235 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
| 236 | 236 | |
| 237 | - $payments = give_get_payments( $args ); |
|
| 237 | + $payments = give_get_payments($args); |
|
| 238 | 238 | |
| 239 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
| 239 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
| 240 | 240 | |
| 241 | - if ( $payments ) { |
|
| 242 | - foreach ( $payments as $payment ) { |
|
| 243 | - give_update_payment_status( $payment, 'abandoned' ); |
|
| 241 | + if ($payments) { |
|
| 242 | + foreach ($payments as $payment) { |
|
| 243 | + give_update_payment_status($payment, 'abandoned'); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
| 249 | 248 | \ No newline at end of file |
| 249 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
| 250 | 250 | \ No newline at end of file |
@@ -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 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @see Give_Cron::weekly_events() |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
| 33 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
| 32 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
| 33 | + add_action('wp', array($this, 'schedule_Events')); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | - public function add_schedules( $schedules = array() ) { |
|
| 45 | + public function add_schedules($schedules = array()) { |
|
| 46 | 46 | // Adds once weekly to the existing schedules. |
| 47 | 47 | $schedules['weekly'] = array( |
| 48 | 48 | 'interval' => 604800, |
| 49 | - 'display' => __( 'Once Weekly', 'easy-digital-downloads' ) |
|
| 49 | + 'display' => __('Once Weekly', 'easy-digital-downloads') |
|
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | return $schedules; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | private function weekly_events() { |
| 75 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
| 76 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
| 75 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
| 76 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | 87 | private function daily_events() { |
| 88 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
| 89 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
| 88 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
| 89 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_show_upgrade_notices() { |
| 27 | 27 | |
| 28 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
| 28 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
| 29 | 29 | return; |
| 30 | 30 | } // Don't show notices on the upgrades page |
| 31 | 31 | |
| 32 | - $give_version = get_option( 'give_version' ); |
|
| 32 | + $give_version = get_option('give_version'); |
|
| 33 | 33 | |
| 34 | - if ( ! $give_version ) { |
|
| 34 | + if ( ! $give_version) { |
|
| 35 | 35 | // 1.0 is the first version to use this option so we must add it |
| 36 | 36 | $give_version = '1.0'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 39 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 40 | 40 | |
| 41 | 41 | /* |
| 42 | 42 | * NOTICE: |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | 49 | //v1.3.2 Upgrades |
| 50 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' )) { |
|
| 50 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
| 51 | 51 | printf( |
| 52 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
| 53 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
| 52 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
| 53 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
| 54 | 54 | ); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
| 63 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Triggers all upgrade functions |
@@ -72,26 +72,26 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function give_trigger_upgrades() { |
| 74 | 74 | |
| 75 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 76 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 75 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 76 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $give_version = get_option( 'give_version' ); |
|
| 79 | + $give_version = get_option('give_version'); |
|
| 80 | 80 | |
| 81 | - if ( ! $give_version ) { |
|
| 81 | + if ( ! $give_version) { |
|
| 82 | 82 | // 1.0 is the first version to use this option so we must add it |
| 83 | 83 | $give_version = '1.0'; |
| 84 | - add_option( 'give_version', $give_version ); |
|
| 84 | + add_option('give_version', $give_version); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 87 | + update_option('give_version', GIVE_VERSION); |
|
| 88 | 88 | |
| 89 | - if ( DOING_AJAX ) { |
|
| 90 | - die( 'complete' ); |
|
| 89 | + if (DOING_AJAX) { |
|
| 90 | + die('complete'); |
|
| 91 | 91 | } // Let AJAX know that the upgrade is complete |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
| 94 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Check if the upgrade routine has been run for a specific action |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @return bool If the action has been added to the completed actions array |
| 104 | 104 | */ |
| 105 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
| 105 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
| 106 | 106 | |
| 107 | - if ( empty( $upgrade_action ) ) { |
|
| 107 | + if (empty($upgrade_action)) { |
|
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $completed_upgrades = give_get_completed_upgrades(); |
| 112 | 112 | |
| 113 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
| 113 | + return in_array($upgrade_action, $completed_upgrades); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @return bool If the function was successfully added |
| 125 | 125 | */ |
| 126 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
| 126 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
| 127 | 127 | |
| 128 | - if ( empty( $upgrade_action ) ) { |
|
| 128 | + if (empty($upgrade_action)) { |
|
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | $completed_upgrades[] = $upgrade_action; |
| 134 | 134 | |
| 135 | 135 | // Remove any blanks, and only show uniques |
| 136 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
| 136 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
| 137 | 137 | |
| 138 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
| 138 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | function give_get_completed_upgrades() { |
| 148 | 148 | |
| 149 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
| 149 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
| 150 | 150 | |
| 151 | - if ( false === $completed_upgrades ) { |
|
| 151 | + if (false === $completed_upgrades) { |
|
| 152 | 152 | $completed_upgrades = array(); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -167,27 +167,27 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | function give_v132_upgrade_give_payment_customer_id() { |
| 169 | 169 | global $wpdb; |
| 170 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 171 | - wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 170 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 171 | + wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - ignore_user_abort( true ); |
|
| 174 | + ignore_user_abort(true); |
|
| 175 | 175 | |
| 176 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 177 | - @set_time_limit( 0 ); |
|
| 176 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 177 | + @set_time_limit(0); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | //UPDATE DB METAKEYS |
| 181 | 181 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
| 182 | - $query = $wpdb->query( $sql ); |
|
| 182 | + $query = $wpdb->query($sql); |
|
| 183 | 183 | |
| 184 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 185 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
| 186 | - delete_option( 'give_doing_upgrade' ); |
|
| 187 | - wp_redirect( admin_url() ); |
|
| 184 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 185 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
| 186 | + delete_option('give_doing_upgrade'); |
|
| 187 | + wp_redirect(admin_url()); |
|
| 188 | 188 | exit; |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
| 193 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|