@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,40 +23,40 @@ discard block |
||
| 23 | 23 | function give_setup_post_types() { |
| 24 | 24 | |
| 25 | 25 | /** Give Forms Post Type */ |
| 26 | - $give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false; |
|
| 26 | + $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false; |
|
| 27 | 27 | |
| 28 | - $give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false; |
|
| 28 | + $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false; |
|
| 29 | 29 | |
| 30 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
| 30 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
| 31 | 31 | //support for old 'GIVE_FORMS_SLUG' constant |
| 32 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
| 32 | + if (defined('GIVE_FORMS_SLUG')) { |
|
| 33 | 33 | $give_forms_slug = GIVE_FORMS_SLUG; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 36 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
| 37 | 37 | 'slug' => $give_forms_slug, |
| 38 | 38 | 'with_front' => false |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
| 42 | - 'name' => __( 'Donation %2$s', 'give' ), |
|
| 41 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
| 42 | + 'name' => __('Donation %2$s', 'give'), |
|
| 43 | 43 | 'singular_name' => '%1$s', |
| 44 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
| 45 | - 'add_new_item' => __( 'Add New Donation %1$s', 'give' ), |
|
| 46 | - 'edit_item' => __( 'Edit Donation %1$s', 'give' ), |
|
| 47 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
| 48 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
| 49 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
| 50 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
| 51 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
| 52 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
| 44 | + 'add_new' => __('Add %1$s', 'give'), |
|
| 45 | + 'add_new_item' => __('Add New Donation %1$s', 'give'), |
|
| 46 | + 'edit_item' => __('Edit Donation %1$s', 'give'), |
|
| 47 | + 'new_item' => __('New %1$s', 'give'), |
|
| 48 | + 'all_items' => __('All %2$s', 'give'), |
|
| 49 | + 'view_item' => __('View %1$s', 'give'), |
|
| 50 | + 'search_items' => __('Search %2$s', 'give'), |
|
| 51 | + 'not_found' => __('No %2$s found', 'give'), |
|
| 52 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
| 53 | 53 | 'parent_item_colon' => '', |
| 54 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
| 55 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ) |
|
| 56 | - ) ); |
|
| 54 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
| 55 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')) |
|
| 56 | + )); |
|
| 57 | 57 | |
| 58 | - foreach ( $give_forms_labels as $key => $value ) { |
|
| 59 | - $give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
| 58 | + foreach ($give_forms_labels as $key => $value) { |
|
| 59 | + $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //Default give_forms supports |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | //Has the user disabled the excerpt |
| 72 | - if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) { |
|
| 73 | - unset( $give_form_supports[2] ); |
|
| 72 | + if (give_get_option('disable_forms_excerpt') === 'on') { |
|
| 73 | + unset($give_form_supports[2]); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | //Has user disabled the featured image? |
| 77 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
| 78 | - unset( $give_form_supports[1] ); |
|
| 79 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
| 77 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
| 78 | + unset($give_form_supports[1]); |
|
| 79 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $give_forms_args = array( |
@@ -92,36 +92,36 @@ discard block |
||
| 92 | 92 | 'has_archive' => $give_forms_archives, |
| 93 | 93 | 'menu_icon' => 'dashicons-give', |
| 94 | 94 | 'hierarchical' => false, |
| 95 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
| 95 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
| 96 | 96 | ); |
| 97 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
| 97 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | /** Give Campaigns Post Type */ |
| 101 | - $give_campaigns_archives = defined( 'GIVE_DISABLE_CAMPAIGNS_ARCHIVE' ) && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
| 102 | - $give_campaigns_slug = defined( 'GIVE_CAMPAIGNS_SLUG' ) ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
| 103 | - $give_campaigns_rewrite = defined( 'GIVE_DISABLE_CAMPAIGNS_REWRITE' ) && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
| 101 | + $give_campaigns_archives = defined('GIVE_DISABLE_CAMPAIGNS_ARCHIVE') && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
| 102 | + $give_campaigns_slug = defined('GIVE_CAMPAIGNS_SLUG') ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
| 103 | + $give_campaigns_rewrite = defined('GIVE_DISABLE_CAMPAIGNS_REWRITE') && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
| 104 | 104 | 'slug' => $give_campaigns_slug, |
| 105 | 105 | 'with_front' => false |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $give_campaigns_labels = apply_filters( 'give_campaign_labels', array( |
|
| 108 | + $give_campaigns_labels = apply_filters('give_campaign_labels', array( |
|
| 109 | 109 | 'name' => '%2$s', |
| 110 | 110 | 'singular_name' => '%1$s', |
| 111 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
| 112 | - 'add_new_item' => __( 'Add New %1$s', 'give' ), |
|
| 113 | - 'edit_item' => __( 'Edit %1$s', 'give' ), |
|
| 114 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
| 115 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
| 116 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
| 117 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
| 118 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
| 119 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
| 111 | + 'add_new' => __('Add %1$s', 'give'), |
|
| 112 | + 'add_new_item' => __('Add New %1$s', 'give'), |
|
| 113 | + 'edit_item' => __('Edit %1$s', 'give'), |
|
| 114 | + 'new_item' => __('New %1$s', 'give'), |
|
| 115 | + 'all_items' => __('All %2$s', 'give'), |
|
| 116 | + 'view_item' => __('View %1$s', 'give'), |
|
| 117 | + 'search_items' => __('Search %2$s', 'give'), |
|
| 118 | + 'not_found' => __('No %2$s found', 'give'), |
|
| 119 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
| 120 | 120 | 'parent_item_colon' => '', |
| 121 | - ) ); |
|
| 121 | + )); |
|
| 122 | 122 | |
| 123 | - foreach ( $give_campaigns_labels as $key => $value ) { |
|
| 124 | - $give_campaigns_labels[ $key ] = sprintf( $value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural() ); |
|
| 123 | + foreach ($give_campaigns_labels as $key => $value) { |
|
| 124 | + $give_campaigns_labels[$key] = sprintf($value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural()); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $give_campaigns_args = array( |
@@ -136,48 +136,48 @@ discard block |
||
| 136 | 136 | 'capability_type' => 'give_campaigns', |
| 137 | 137 | 'has_archive' => $give_campaigns_archives, |
| 138 | 138 | 'hierarchical' => false, |
| 139 | - 'supports' => apply_filters( 'give_campaigns_supports', array( |
|
| 139 | + 'supports' => apply_filters('give_campaigns_supports', array( |
|
| 140 | 140 | 'title', |
| 141 | 141 | 'thumbnail', |
| 142 | 142 | 'excerpt', |
| 143 | 143 | 'revisions', |
| 144 | 144 | 'author' |
| 145 | - ) ), |
|
| 145 | + )), |
|
| 146 | 146 | ); |
| 147 | 147 | // register_post_type( 'give_campaigns', apply_filters( 'give_campaigns_post_type_args', $give_campaigns_args ) ); |
| 148 | 148 | |
| 149 | 149 | /** Payment Post Type */ |
| 150 | 150 | $payment_labels = array( |
| 151 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
| 152 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
| 153 | - 'add_new' => __( 'Add New', 'give' ), |
|
| 154 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
| 155 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
| 156 | - 'new_item' => __( 'New Donation', 'give' ), |
|
| 157 | - 'all_items' => __( 'All Donations', 'give' ), |
|
| 158 | - 'view_item' => __( 'View Donation', 'give' ), |
|
| 159 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
| 160 | - 'not_found' => __( 'No Donations found', 'give' ), |
|
| 161 | - 'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ), |
|
| 151 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
| 152 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
| 153 | + 'add_new' => __('Add New', 'give'), |
|
| 154 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
| 155 | + 'edit_item' => __('Edit Donation', 'give'), |
|
| 156 | + 'new_item' => __('New Donation', 'give'), |
|
| 157 | + 'all_items' => __('All Donations', 'give'), |
|
| 158 | + 'view_item' => __('View Donation', 'give'), |
|
| 159 | + 'search_items' => __('Search Donations', 'give'), |
|
| 160 | + 'not_found' => __('No Donations found', 'give'), |
|
| 161 | + 'not_found_in_trash' => __('No Donations found in Trash', 'give'), |
|
| 162 | 162 | 'parent_item_colon' => '', |
| 163 | - 'menu_name' => __( 'Transactions', 'give' ) |
|
| 163 | + 'menu_name' => __('Transactions', 'give') |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | $payment_args = array( |
| 167 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
| 167 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
| 168 | 168 | 'public' => false, |
| 169 | 169 | 'query_var' => false, |
| 170 | 170 | 'rewrite' => false, |
| 171 | 171 | 'map_meta_cap' => true, |
| 172 | 172 | 'capability_type' => 'give_payment', |
| 173 | - 'supports' => array( 'title' ), |
|
| 173 | + 'supports' => array('title'), |
|
| 174 | 174 | 'can_export' => true |
| 175 | 175 | ); |
| 176 | - register_post_type( 'give_payment', $payment_args ); |
|
| 176 | + register_post_type('give_payment', $payment_args); |
|
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
| 180 | +add_action('init', 'give_setup_post_types', 1); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -190,30 +190,30 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | function give_setup_taxonomies() { |
| 192 | 192 | |
| 193 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
| 193 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
| 194 | 194 | |
| 195 | 195 | /** Categories */ |
| 196 | 196 | $category_labels = array( |
| 197 | - 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
| 198 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
| 199 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
| 200 | - 'all_items' => __( 'All Categories', 'give' ), |
|
| 201 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
| 202 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
| 203 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
| 204 | - 'update_item' => __( 'Update Category', 'give' ), |
|
| 205 | - 'add_new_item' => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ), |
|
| 206 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
| 207 | - 'menu_name' => __( 'Categories', 'give' ), |
|
| 197 | + 'name' => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
| 198 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
| 199 | + 'search_items' => __('Search Categories', 'give'), |
|
| 200 | + 'all_items' => __('All Categories', 'give'), |
|
| 201 | + 'parent_item' => __('Parent Category', 'give'), |
|
| 202 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
| 203 | + 'edit_item' => __('Edit Category', 'give'), |
|
| 204 | + 'update_item' => __('Update Category', 'give'), |
|
| 205 | + 'add_new_item' => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()), |
|
| 206 | + 'new_item_name' => __('New Category Name', 'give'), |
|
| 207 | + 'menu_name' => __('Categories', 'give'), |
|
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
| 210 | + $category_args = apply_filters('give_forms_category_args', array( |
|
| 211 | 211 | 'hierarchical' => true, |
| 212 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
| 212 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
| 213 | 213 | 'show_ui' => true, |
| 214 | 214 | 'query_var' => 'give_forms_category', |
| 215 | 215 | 'rewrite' => array( |
| 216 | - 'slug' => $slug . '/category', |
|
| 216 | + 'slug' => $slug.'/category', |
|
| 217 | 217 | 'with_front' => false, |
| 218 | 218 | 'hierarchical' => true |
| 219 | 219 | ), |
@@ -227,34 +227,34 @@ discard block |
||
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | 229 | //Does the user want categories? |
| 230 | - if ( give_get_option( 'enable_categories' ) == 'on' ) { |
|
| 231 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
| 232 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
| 230 | + if (give_get_option('enable_categories') == 'on') { |
|
| 231 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
| 232 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | /** Tags */ |
| 237 | 237 | $tag_labels = array( |
| 238 | - 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
| 239 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
| 240 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
| 241 | - 'all_items' => __( 'All Tags', 'give' ), |
|
| 242 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
| 243 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
| 244 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
| 245 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
| 246 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
| 247 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
| 248 | - 'menu_name' => __( 'Tags', 'give' ), |
|
| 249 | - 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ), |
|
| 238 | + 'name' => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
| 239 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
| 240 | + 'search_items' => __('Search Tags', 'give'), |
|
| 241 | + 'all_items' => __('All Tags', 'give'), |
|
| 242 | + 'parent_item' => __('Parent Tag', 'give'), |
|
| 243 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
| 244 | + 'edit_item' => __('Edit Tag', 'give'), |
|
| 245 | + 'update_item' => __('Update Tag', 'give'), |
|
| 246 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
| 247 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
| 248 | + 'menu_name' => __('Tags', 'give'), |
|
| 249 | + 'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()), |
|
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
| 252 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
| 253 | 253 | 'hierarchical' => false, |
| 254 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
| 254 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
| 255 | 255 | 'show_ui' => true, |
| 256 | 256 | 'query_var' => 'give_forms_tag', |
| 257 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
| 257 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
| 258 | 258 | 'capabilities' => array( |
| 259 | 259 | 'manage_terms' => 'manage_give_forms_terms', |
| 260 | 260 | 'edit_terms' => 'edit_give_forms_terms', |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | ) |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | - if ( give_get_option( 'enable_tags' ) == 'on' ) { |
|
| 269 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
| 270 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
| 268 | + if (give_get_option('enable_tags') == 'on') { |
|
| 269 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
| 270 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
| 276 | +add_action('init', 'give_setup_taxonomies', 0); |
|
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function give_get_default_form_labels() { |
| 286 | 286 | $defaults = array( |
| 287 | - 'singular' => __( 'Form', 'give' ), |
|
| 288 | - 'plural' => __( 'Forms', 'give' ) |
|
| 287 | + 'singular' => __('Form', 'give'), |
|
| 288 | + 'plural' => __('Forms', 'give') |
|
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
| 291 | + return apply_filters('give_default_form_name', $defaults); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function give_get_default_campaign_labels() { |
| 301 | 301 | $defaults = array( |
| 302 | - 'singular' => __( 'Campaign', 'give' ), |
|
| 303 | - 'plural' => __( 'Campaigns', 'give' ) |
|
| 302 | + 'singular' => __('Campaign', 'give'), |
|
| 303 | + 'plural' => __('Campaigns', 'give') |
|
| 304 | 304 | ); |
| 305 | 305 | |
| 306 | - return apply_filters( 'give_default_campaign_name', $defaults ); |
|
| 306 | + return apply_filters('give_default_campaign_name', $defaults); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string $defaults['singular'] Singular label |
| 317 | 317 | */ |
| 318 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
| 318 | +function give_get_forms_label_singular($lowercase = false) { |
|
| 319 | 319 | $defaults = give_get_default_form_labels(); |
| 320 | 320 | |
| 321 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
| 321 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | * @since 1.0 |
| 328 | 328 | * @return string $defaults['plural'] Plural label |
| 329 | 329 | */ |
| 330 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
| 330 | +function give_get_forms_label_plural($lowercase = false) { |
|
| 331 | 331 | $defaults = give_get_default_form_labels(); |
| 332 | 332 | |
| 333 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
| 333 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | * |
| 343 | 343 | * @return string $defaults['singular'] Singular label |
| 344 | 344 | */ |
| 345 | -function give_get_campaigns_label_singular( $lowercase = false ) { |
|
| 345 | +function give_get_campaigns_label_singular($lowercase = false) { |
|
| 346 | 346 | $defaults = give_get_default_campaign_labels(); |
| 347 | 347 | |
| 348 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
| 348 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | * @since 1.0 |
| 355 | 355 | * @return string $defaults['plural'] Plural label |
| 356 | 356 | */ |
| 357 | -function give_get_campaigns_label_plural( $lowercase = false ) { |
|
| 357 | +function give_get_campaigns_label_plural($lowercase = false) { |
|
| 358 | 358 | $defaults = give_get_default_campaign_labels(); |
| 359 | 359 | |
| 360 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
| 360 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -369,26 +369,26 @@ discard block |
||
| 369 | 369 | * |
| 370 | 370 | * @return string $title New placeholder text |
| 371 | 371 | */ |
| 372 | -function give_change_default_title( $title ) { |
|
| 372 | +function give_change_default_title($title) { |
|
| 373 | 373 | // If a frontend plugin uses this filter (check extensions before changing this function) |
| 374 | - if ( ! is_admin() ) { |
|
| 374 | + if ( ! is_admin()) { |
|
| 375 | 375 | $label = give_get_forms_label_singular(); |
| 376 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
| 376 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
| 377 | 377 | |
| 378 | 378 | return $title; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | $screen = get_current_screen(); |
| 382 | 382 | |
| 383 | - if ( 'give_forms' == $screen->post_type ) { |
|
| 383 | + if ('give_forms' == $screen->post_type) { |
|
| 384 | 384 | $label = give_get_forms_label_singular(); |
| 385 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
| 385 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | return $title; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
| 391 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | 394 | * Registers Custom Post Statuses which are used by the Payments |
@@ -398,50 +398,50 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | function give_register_post_type_statuses() { |
| 400 | 400 | // Payment Statuses |
| 401 | - register_post_status( 'refunded', array( |
|
| 402 | - 'label' => _x( 'Refunded', 'Refunded payment status', 'give' ), |
|
| 401 | + register_post_status('refunded', array( |
|
| 402 | + 'label' => _x('Refunded', 'Refunded payment status', 'give'), |
|
| 403 | 403 | 'public' => true, |
| 404 | 404 | 'exclude_from_search' => false, |
| 405 | 405 | 'show_in_admin_all_list' => true, |
| 406 | 406 | 'show_in_admin_status_list' => true, |
| 407 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
| 408 | - ) ); |
|
| 409 | - register_post_status( 'failed', array( |
|
| 410 | - 'label' => _x( 'Failed', 'Failed payment status', 'give' ), |
|
| 407 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
| 408 | + )); |
|
| 409 | + register_post_status('failed', array( |
|
| 410 | + 'label' => _x('Failed', 'Failed payment status', 'give'), |
|
| 411 | 411 | 'public' => true, |
| 412 | 412 | 'exclude_from_search' => false, |
| 413 | 413 | 'show_in_admin_all_list' => true, |
| 414 | 414 | 'show_in_admin_status_list' => true, |
| 415 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
| 416 | - ) ); |
|
| 417 | - register_post_status( 'revoked', array( |
|
| 418 | - 'label' => _x( 'Revoked', 'Revoked payment status', 'give' ), |
|
| 415 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
| 416 | + )); |
|
| 417 | + register_post_status('revoked', array( |
|
| 418 | + 'label' => _x('Revoked', 'Revoked payment status', 'give'), |
|
| 419 | 419 | 'public' => true, |
| 420 | 420 | 'exclude_from_search' => false, |
| 421 | 421 | 'show_in_admin_all_list' => true, |
| 422 | 422 | 'show_in_admin_status_list' => true, |
| 423 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
| 424 | - ) ); |
|
| 425 | - register_post_status( 'cancelled', array( |
|
| 426 | - 'label' => _x( 'Cancelled', 'Cancelled payment status', 'give' ), |
|
| 423 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
| 424 | + )); |
|
| 425 | + register_post_status('cancelled', array( |
|
| 426 | + 'label' => _x('Cancelled', 'Cancelled payment status', 'give'), |
|
| 427 | 427 | 'public' => true, |
| 428 | 428 | 'exclude_from_search' => false, |
| 429 | 429 | 'show_in_admin_all_list' => true, |
| 430 | 430 | 'show_in_admin_status_list' => true, |
| 431 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ) |
|
| 432 | - ) ); |
|
| 433 | - register_post_status( 'abandoned', array( |
|
| 434 | - 'label' => _x( 'Abandoned', 'Abandoned payment status', 'give' ), |
|
| 431 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give') |
|
| 432 | + )); |
|
| 433 | + register_post_status('abandoned', array( |
|
| 434 | + 'label' => _x('Abandoned', 'Abandoned payment status', 'give'), |
|
| 435 | 435 | 'public' => true, |
| 436 | 436 | 'exclude_from_search' => false, |
| 437 | 437 | 'show_in_admin_all_list' => true, |
| 438 | 438 | 'show_in_admin_status_list' => true, |
| 439 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
| 440 | - ) ); |
|
| 439 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
| 440 | + )); |
|
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
| 444 | +add_action('init', 'give_register_post_type_statuses'); |
|
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Updated Messages |
@@ -454,45 +454,45 @@ discard block |
||
| 454 | 454 | * |
| 455 | 455 | * @return array $messages New post updated messages |
| 456 | 456 | */ |
| 457 | -function give_updated_messages( $messages ) { |
|
| 457 | +function give_updated_messages($messages) { |
|
| 458 | 458 | global $post, $post_ID; |
| 459 | 459 | |
| 460 | - $url1 = '<a href="' . get_permalink( $post_ID ) . '">'; |
|
| 460 | + $url1 = '<a href="'.get_permalink($post_ID).'">'; |
|
| 461 | 461 | $url2 = give_get_forms_label_singular(); |
| 462 | 462 | $url3 = '</a>'; |
| 463 | 463 | |
| 464 | 464 | $messages['give_forms'] = array( |
| 465 | - 1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 466 | - 4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 467 | - 6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 468 | - 7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
| 469 | - 8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ) |
|
| 465 | + 1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 466 | + 4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 467 | + 6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 468 | + 7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
| 469 | + 8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3) |
|
| 470 | 470 | ); |
| 471 | 471 | |
| 472 | 472 | return $messages; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
| 475 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
| 476 | 476 | |
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | 479 | * Setup Post Type Images |
| 480 | 480 | */ |
| 481 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
| 482 | -add_action( 'after_setup_theme', 'give_add_image_sizes', 10 ); |
|
| 481 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
| 482 | +add_action('after_setup_theme', 'give_add_image_sizes', 10); |
|
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | 485 | * Ensure post thumbnail support is turned on |
| 486 | 486 | */ |
| 487 | 487 | function give_add_thumbnail_support() { |
| 488 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
| 488 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
| 489 | 489 | return; |
| 490 | 490 | } |
| 491 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
| 492 | - add_theme_support( 'post-thumbnails' ); |
|
| 491 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
| 492 | + add_theme_support('post-thumbnails'); |
|
| 493 | 493 | } |
| 494 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
| 495 | - add_post_type_support( 'give_campaigns', 'thumbnail' ); |
|
| 494 | + add_post_type_support('give_forms', 'thumbnail'); |
|
| 495 | + add_post_type_support('give_campaigns', 'thumbnail'); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
@@ -501,9 +501,9 @@ discard block |
||
| 501 | 501 | * @since 1.0 |
| 502 | 502 | */ |
| 503 | 503 | function give_add_image_sizes() { |
| 504 | - $give_form_single = give_get_image_size( 'give_form_single' ); |
|
| 504 | + $give_form_single = give_get_image_size('give_form_single'); |
|
| 505 | 505 | |
| 506 | - add_image_size( 'give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop'] ); |
|
| 506 | + add_image_size('give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop']); |
|
| 507 | 507 | |
| 508 | 508 | } |
| 509 | 509 | |
@@ -516,19 +516,19 @@ discard block |
||
| 516 | 516 | function give_widgets_init() { |
| 517 | 517 | |
| 518 | 518 | //Single Give Forms (disabled if single turned off in settings) |
| 519 | - if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) { |
|
| 519 | + if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') { |
|
| 520 | 520 | |
| 521 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
| 522 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
| 521 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
| 522 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
| 523 | 523 | 'id' => 'give-forms-sidebar', |
| 524 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
| 524 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
| 525 | 525 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
| 526 | 526 | 'after_widget' => '</div>', |
| 527 | 527 | 'before_title' => '<h3 class="widgettitle widget-title">', |
| 528 | 528 | 'after_title' => '</h3>', |
| 529 | - ) ) ); |
|
| 529 | + ))); |
|
| 530 | 530 | |
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
| 534 | +add_action('widgets_init', 'give_widgets_init', 999); |
|
@@ -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'; |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - return array_unique( $classes ); |
|
| 237 | + return array_unique($classes); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
| 240 | +add_filter('body_class', 'give_add_body_classes'); |
|
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -253,22 +253,22 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return array |
| 255 | 255 | */ |
| 256 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
| 257 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
| 256 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
| 257 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
| 258 | 258 | return $classes; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
| 262 | 262 | |
| 263 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
| 264 | - unset( $classes[ $key ] ); |
|
| 263 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
| 264 | + unset($classes[$key]); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | return $classes; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
| 271 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
| 271 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * |
| 281 | 281 | * @return array |
| 282 | 282 | */ |
| 283 | -function give_get_image_size( $image_size ) { |
|
| 283 | +function give_get_image_size($image_size) { |
|
| 284 | 284 | |
| 285 | 285 | $size = array( |
| 286 | 286 | 'width' => '300', |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | 'crop' => 1 |
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - return apply_filters( 'give_get_image_size_' . $image_size, $size ); |
|
| 291 | + return apply_filters('give_get_image_size_'.$image_size, $size); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -299,86 +299,86 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function give_get_placeholder_img_src() { |
| 301 | 301 | |
| 302 | - $image_size = give_get_image_size( 'give_form_single' ); |
|
| 302 | + $image_size = give_get_image_size('give_form_single'); |
|
| 303 | 303 | |
| 304 | - $placeholder_url = 'http://placehold.it/' . $image_size['width'] . 'x' . $image_size['height'] . '&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ) . '+(' . $image_size['width'] . 'x' . $image_size['height'] . ')'; |
|
| 304 | + $placeholder_url = 'http://placehold.it/'.$image_size['width'].'x'.$image_size['height'].'&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')).'+('.$image_size['width'].'x'.$image_size['height'].')'; |
|
| 305 | 305 | |
| 306 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
| 306 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | 311 | * Global |
| 312 | 312 | */ |
| 313 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
| 313 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * Output the start of the page wrapper. |
| 317 | 317 | */ |
| 318 | 318 | function give_output_content_wrapper() { |
| 319 | - give_get_template_part( 'global/wrapper-start' ); |
|
| 319 | + give_get_template_part('global/wrapper-start'); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
| 322 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | 325 | * Output the end of the page wrapper. |
| 326 | 326 | */ |
| 327 | 327 | function give_output_content_wrapper_end() { |
| 328 | - give_get_template_part( 'global/wrapper-end' ); |
|
| 328 | + give_get_template_part('global/wrapper-end'); |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
| 333 | 333 | * Single Give Form |
| 334 | 334 | */ |
| 335 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
| 335 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
| 336 | 336 | function give_left_sidebar_pre_wrap() { |
| 337 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
| 337 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
| 341 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
| 342 | 342 | function give_left_sidebar_post_wrap() { |
| 343 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
| 343 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
| 347 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
| 348 | 348 | function give_get_forms_sidebar() { |
| 349 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
| 349 | + give_get_template_part('single-give-form/sidebar'); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
| 353 | +if ( ! function_exists('give_show_form_images')) { |
|
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | 356 | * Output the product image before the single product summary. |
| 357 | 357 | */ |
| 358 | 358 | function give_show_form_images() { |
| 359 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
| 360 | - if ( $featured_image_option !== 'on' ) { |
|
| 361 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
| 359 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
| 360 | + if ($featured_image_option !== 'on') { |
|
| 361 | + give_get_template_part('single-give-form/featured-image'); |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
| 366 | +if ( ! function_exists('give_template_single_title')) { |
|
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Output the product title. |
| 370 | 370 | */ |
| 371 | 371 | function give_template_single_title() { |
| 372 | - give_get_template_part( 'single-give-form/title' ); |
|
| 372 | + give_get_template_part('single-give-form/title'); |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
| 376 | +if ( ! function_exists('give_show_avatars')) { |
|
| 377 | 377 | |
| 378 | 378 | /** |
| 379 | 379 | * Output the product title. |
| 380 | 380 | */ |
| 381 | 381 | function give_show_avatars() { |
| 382 | - echo do_shortcode( '[give_donators_gravatars]' ); |
|
| 382 | + echo do_shortcode('[give_donators_gravatars]'); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | \ No newline at end of file |