admin
8 years ago
api
8 years ago
deprecated
8 years ago
donors
8 years ago
emails
8 years ago
forms
8 years ago
gateways
8 years ago
libraries
8 years ago
payments
8 years ago
actions.php
8 years ago
ajax-functions.php
8 years ago
class-give-async-process.php
8 years ago
class-give-background-updater.php
8 years ago
class-give-cache.php
8 years ago
class-give-cli-commands.php
8 years ago
class-give-cron.php
8 years ago
class-give-db-donor-meta.php
8 years ago
class-give-db-donors.php
8 years ago
class-give-db-form-meta.php
8 years ago
class-give-db-logs-meta.php
8 years ago
class-give-db-logs.php
8 years ago
class-give-db-meta.php
8 years ago
class-give-db-payment-meta.php
8 years ago
class-give-db.php
8 years ago
class-give-donate-form.php
8 years ago
class-give-donor.php
8 years ago
class-give-email-access.php
8 years ago
class-give-gravatars.php
8 years ago
class-give-html-elements.php
8 years ago
class-give-license-handler.php
8 years ago
class-give-logging.php
8 years ago
class-give-roles.php
8 years ago
class-give-session.php
8 years ago
class-give-stats.php
8 years ago
class-give-template-loader.php
9 years ago
class-give-tooltips.php
8 years ago
class-give-translation.php
8 years ago
class-notices.php
8 years ago
country-functions.php
8 years ago
currency-functions.php
8 years ago
error-tracking.php
8 years ago
filters.php
8 years ago
formatting.php
8 years ago
import-functions.php
8 years ago
install.php
8 years ago
login-register.php
8 years ago
misc-functions.php
8 years ago
plugin-compatibility.php
8 years ago
post-types.php
8 years ago
price-functions.php
8 years ago
process-donation.php
8 years ago
scripts.php
8 years ago
shortcodes.php
8 years ago
template-functions.php
8 years ago
user-functions.php
8 years ago
scripts.php
433 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Scripts |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Functions |
| 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 1.0 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Load Scripts |
| 19 | * |
| 20 | * Enqueues the required scripts. |
| 21 | * |
| 22 | * @since 1.0 |
| 23 | * |
| 24 | * @return void |
| 25 | */ |
| 26 | function give_load_scripts() { |
| 27 | |
| 28 | $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
| 29 | $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
| 30 | $scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false; |
| 31 | |
| 32 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 33 | $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 34 | |
| 35 | // Localize / PHP to AJAX vars. |
| 36 | $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
| 37 | 'ajaxurl' => give_get_ajax_url(), |
| 38 | 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), // Do not use this nonce. Its deprecated. |
| 39 | 'currency' => give_get_currency(), |
| 40 | 'currency_sign' => give_currency_filter( '' ), |
| 41 | 'currency_pos' => give_get_currency_position(), |
| 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
| 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
| 44 | 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
| 45 | 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
| 46 | 'general_loading' => __( 'Loading...', 'give' ), |
| 47 | 'purchase_loading' => __( 'Please Wait...', 'give' ), |
| 48 | 'number_decimals' => give_get_price_decimals(), |
| 49 | 'give_version' => GIVE_VERSION, |
| 50 | 'magnific_options' => apply_filters( |
| 51 | 'give_magnific_options', |
| 52 | array( |
| 53 | 'main_class' => 'give-modal', |
| 54 | 'close_on_bg_click' => false, |
| 55 | ) |
| 56 | ), |
| 57 | 'form_translation' => apply_filters( |
| 58 | 'give_form_translation_js', |
| 59 | array( |
| 60 | // Field name Validation message. |
| 61 | 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
| 62 | 'give_first' => __( 'Please enter your first name.', 'give' ), |
| 63 | 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
| 64 | 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
| 65 | 'give_user_pass' => __( 'Enter a password.', 'give' ), |
| 66 | 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
| 67 | 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
| 68 | ) |
| 69 | ), |
| 70 | 'confirm_email_sent_message' => __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), |
| 71 | ) ); |
| 72 | |
| 73 | $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
| 74 | 'ajaxurl' => give_get_ajax_url(), |
| 75 | 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
| 76 | 'loading' => __( 'Loading', 'give' ), |
| 77 | // General loading message. |
| 78 | 'select_option' => __( 'Please select an option', 'give' ), |
| 79 | // Variable pricing error with multi-donation option enabled. |
| 80 | 'default_gateway' => give_get_default_gateway( null ), |
| 81 | 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
| 82 | 'number_decimals' => give_get_price_decimals(), |
| 83 | ) ); |
| 84 | |
| 85 | // DEBUG is On. |
| 86 | if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
| 87 | |
| 88 | if ( give_is_cc_verify_enabled() ) { |
| 89 | wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 90 | wp_enqueue_script( 'give-cc-validator' ); |
| 91 | } |
| 92 | |
| 93 | wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 94 | wp_enqueue_script( 'give-float-labels' ); |
| 95 | |
| 96 | wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 97 | wp_enqueue_script( 'give-blockui' ); |
| 98 | |
| 99 | wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 100 | wp_enqueue_script( 'give-accounting' ); |
| 101 | |
| 102 | wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 103 | wp_enqueue_script( 'give-magnific' ); |
| 104 | |
| 105 | wp_register_script( 'give-checkout-global', $js_dir . 'give-donations' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 106 | wp_enqueue_script( 'give-checkout-global' ); |
| 107 | |
| 108 | wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 109 | wp_enqueue_script( 'give-hint.css' ); |
| 110 | |
| 111 | // General scripts. |
| 112 | wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 113 | wp_enqueue_script( 'give-scripts' ); |
| 114 | |
| 115 | // Load AJAX scripts, if enabled. |
| 116 | wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 117 | wp_enqueue_script( 'give-ajax' ); |
| 118 | |
| 119 | // Localize / Pass AJAX vars from PHP, |
| 120 | wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars ); |
| 121 | wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
| 122 | |
| 123 | } else { |
| 124 | |
| 125 | // DEBUG is OFF (one JS file to rule them all!). |
| 126 | wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
| 127 | wp_enqueue_script( 'give' ); |
| 128 | |
| 129 | // Localize / Pass AJAX vars from PHP. |
| 130 | wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
| 131 | wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
| 132 | |
| 133 | } |
| 134 | |
| 135 | } |
| 136 | |
| 137 | add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
| 138 | |
| 139 | /** |
| 140 | * Register styles. |
| 141 | * |
| 142 | * Checks the styles option and hooks the required filter. |
| 143 | * |
| 144 | * @since 1.0 |
| 145 | * |
| 146 | * @return void |
| 147 | */ |
| 148 | function give_register_styles() { |
| 149 | |
| 150 | if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
| 155 | wp_enqueue_style( 'give-styles' ); |
| 156 | |
| 157 | } |
| 158 | |
| 159 | add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * Get the stylesheet URI. |
| 164 | * |
| 165 | * @since 1.6 |
| 166 | * |
| 167 | * @return string |
| 168 | */ |
| 169 | function give_get_stylesheet_uri() { |
| 170 | |
| 171 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 172 | $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 173 | |
| 174 | // LTR or RTL files. |
| 175 | $direction = ( is_rtl() ) ? '-rtl' : ''; |
| 176 | |
| 177 | $file = 'give' . $direction . $suffix . '.css'; |
| 178 | $templates_dir = give_get_theme_template_dir_name(); |
| 179 | |
| 180 | $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
| 181 | $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
| 182 | $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
| 183 | $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css'; |
| 184 | $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
| 185 | |
| 186 | $uri = false; |
| 187 | |
| 188 | /** |
| 189 | * Look in the child theme directory first, followed by the parent theme, |
| 190 | * followed by the Give core templates directory also look for the min version first, |
| 191 | * followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
| 192 | * This allows users to copy just give.css to their theme. |
| 193 | */ |
| 194 | if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
| 195 | if ( ! empty( $nonmin ) ) { |
| 196 | $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
| 197 | } else { |
| 198 | $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
| 199 | } |
| 200 | } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
| 201 | if ( ! empty( $nonmin ) ) { |
| 202 | $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css'; |
| 203 | } else { |
| 204 | $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
| 205 | } |
| 206 | } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
| 207 | $uri = trailingslashit( give_get_templates_url() ) . $file; |
| 208 | } |
| 209 | |
| 210 | return apply_filters( 'give_get_stylesheet_uri', $uri ); |
| 211 | |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Load Admin Scripts |
| 216 | * |
| 217 | * Enqueues the required admin scripts. |
| 218 | * |
| 219 | * @since 1.0 |
| 220 | * |
| 221 | * @global $post |
| 222 | * |
| 223 | * @param string $hook Page hook. |
| 224 | * |
| 225 | * @return void |
| 226 | */ |
| 227 | function give_load_admin_scripts( $hook ) { |
| 228 | |
| 229 | global $post, $post_type; |
| 230 | |
| 231 | $give_options = give_get_settings(); |
| 232 | |
| 233 | // Directories of assets. |
| 234 | $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
| 235 | $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
| 236 | $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
| 237 | |
| 238 | // Use minified libraries if SCRIPT_DEBUG is turned off. |
| 239 | $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 240 | |
| 241 | // LTR or RTL files. |
| 242 | $direction = ( is_rtl() ) ? '-rtl' : ''; |
| 243 | |
| 244 | // Global Admin. |
| 245 | wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
| 246 | wp_enqueue_style( 'give-admin-bar-notification' ); |
| 247 | |
| 248 | // Give Admin Only. |
| 249 | if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
| 250 | return; |
| 251 | } |
| 252 | |
| 253 | // CSS. |
| 254 | wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
| 255 | wp_enqueue_style( 'jquery-ui-css' ); |
| 256 | wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION ); |
| 257 | wp_enqueue_style( 'give-admin' ); |
| 258 | wp_enqueue_style( 'thickbox' ); |
| 259 | wp_enqueue_style( 'wp-color-picker' ); |
| 260 | |
| 261 | |
| 262 | // JS. |
| 263 | wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 264 | wp_enqueue_script( 'give-selector-cache' ); |
| 265 | |
| 266 | wp_register_script( 'give-ajaxify-fields', $js_plugins . 'give-ajaxify-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 267 | wp_enqueue_script( 'give-ajaxify-fields' ); |
| 268 | |
| 269 | wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
| 270 | wp_enqueue_script( 'jquery-chosen' ); |
| 271 | |
| 272 | wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 273 | wp_enqueue_script( 'give-accounting' ); |
| 274 | |
| 275 | wp_enqueue_script( 'wp-color-picker' ); |
| 276 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 277 | wp_enqueue_script( 'thickbox' ); |
| 278 | |
| 279 | wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false ); |
| 280 | wp_enqueue_script( 'give-admin-scripts' ); |
| 281 | |
| 282 | wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
| 283 | wp_enqueue_script( 'jquery-flot' ); |
| 284 | |
| 285 | wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 286 | wp_enqueue_script( 'give-repeatable-fields' ); |
| 287 | |
| 288 | wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 289 | wp_enqueue_script( 'give-hint.css' ); |
| 290 | |
| 291 | // Forms CPT Script. |
| 292 | if ( $post_type === 'give_forms' ) { |
| 293 | wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 294 | wp_enqueue_script( 'give-admin-forms-scripts' ); |
| 295 | } |
| 296 | |
| 297 | // Settings Scripts. |
| 298 | if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
| 299 | wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
| 300 | wp_enqueue_script( 'give-admin-settings-scripts' ); |
| 301 | } |
| 302 | |
| 303 | // Price Separators. |
| 304 | $thousand_separator = give_get_price_thousand_separator(); |
| 305 | $decimal_separator = give_get_price_decimal_separator(); |
| 306 | |
| 307 | // Localize strings & variables for JS. |
| 308 | wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
| 309 | 'post_id' => isset( $post->ID ) ? $post->ID : null, |
| 310 | 'give_version' => GIVE_VERSION, |
| 311 | 'thousands_separator' => $thousand_separator, |
| 312 | 'decimal_separator' => $decimal_separator, |
| 313 | 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
| 314 | 'delete_payment' => __( 'Are you sure you want to delete this payment?', 'give' ), |
| 315 | 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
| 316 | 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
| 317 | 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
| 318 | 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
| 319 | 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
| 320 | 'one_option' => __( 'Choose a form', 'give' ), |
| 321 | 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
| 322 | 'currency_sign' => give_currency_filter( '' ), |
| 323 | 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
| 324 | 'currency_decimals' => give_get_price_decimals(), |
| 325 | 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
| 326 | 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
| 327 | 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
| 328 | 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
| 329 | 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
| 330 | 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
| 331 | /* translators : %s: Donation form options metabox */ |
| 332 | 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
| 333 | 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
| 334 | 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
| 335 | 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
| 336 | 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
| 337 | 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
| 338 | 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
| 339 | 'unlock_donor_fields' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
| 340 | 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
| 341 | 'donors_bulk_action' => array( |
| 342 | 'no_donor_selected' => __( 'You must choose at least one or more donors to delete.', 'give' ), |
| 343 | 'no_action_selected' => __( 'You must select a bulk action to proceed.', 'give' ), |
| 344 | ), |
| 345 | 'donations_bulk_action' => array( |
| 346 | 'delete' => array( |
| 347 | 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
| 348 | 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
| 349 | 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
| 350 | ), |
| 351 | 'resend-receipt' => array( |
| 352 | 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
| 353 | 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
| 354 | 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
| 355 | ), |
| 356 | 'set-to-status' => array( |
| 357 | 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
| 358 | 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
| 359 | 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
| 360 | ), |
| 361 | ), |
| 362 | 'updates' => array( |
| 363 | 'ajax_error' => __( 'Please reload this page and try again', 'give' ) |
| 364 | ), |
| 365 | 'metabox_fields' => array( |
| 366 | 'media' => array( |
| 367 | 'button_title' => __( 'Choose Image', 'give' ), |
| 368 | ), |
| 369 | 'file' => array( |
| 370 | 'button_title' => __( 'Choose File', 'give' ), |
| 371 | ), |
| 372 | ), |
| 373 | 'chosen' => array( |
| 374 | 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
| 375 | 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
| 376 | ), |
| 377 | 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
| 378 | 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
| 379 | 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
| 380 | 'give_donation_import' => 'give_donation_import', |
| 381 | 'core_settings_import' => 'give_core_settings_import', |
| 382 | 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
| 383 | ) ); |
| 384 | |
| 385 | if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) { |
| 386 | // call for new media manager. |
| 387 | wp_enqueue_media(); |
| 388 | } |
| 389 | |
| 390 | } |
| 391 | |
| 392 | add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
| 393 | |
| 394 | /** |
| 395 | * Admin Give Icon |
| 396 | * |
| 397 | * Echoes the CSS for the Give post type icon. |
| 398 | * |
| 399 | * @since 1.0 |
| 400 | * |
| 401 | * @return void |
| 402 | */ |
| 403 | function give_admin_icon() { |
| 404 | ?> |
| 405 | <style type="text/css" media="screen"> |
| 406 | |
| 407 | <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?> |
| 408 | @font-face { |
| 409 | font-family: 'give-icomoon'; |
| 410 | src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>'); |
| 411 | src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
| 412 | url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
| 413 | url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
| 414 | font-weight: normal; |
| 415 | font-style: normal; |
| 416 | } |
| 417 | |
| 418 | .dashicons-give:before, #adminmenu div.wp-menu-image.dashicons-give:before { |
| 419 | font-family: 'give-icomoon'; |
| 420 | font-size: 18px; |
| 421 | width: 18px; |
| 422 | height: 18px; |
| 423 | content: "\e800"; |
| 424 | } |
| 425 | |
| 426 | <?php } ?> |
| 427 | |
| 428 | </style> |
| 429 | <?php |
| 430 | } |
| 431 | |
| 432 | add_action( 'admin_head', 'give_admin_icon' ); |
| 433 |