functions.php
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Deprecated functions from LD 4.1.0
* The functions will be removed in a later version.
*
* @package LearnDash\Deprecated
* @since 4.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'learndash_30_the_currency_symbol' ) ) {
/**
* Outputs the currency symbol.
*
* @deprecated 4.1.0 Please use {@see 'learndash_the_currency_symbol'} instead.
*
* @since 3.0.0
*/
function learndash_30_the_currency_symbol() {
if ( function_exists( '_deprecated_function' ) ) {
_deprecated_function( __FUNCTION__, '4.1.0', 'learndash_the_currency_symbol' );
}
echo wp_kses_post( learndash_30_get_currency_symbol() );
}
}
if ( ! function_exists( 'learndash_30_get_currency_symbol' ) ) {
/**
* Gets the currency symbol.
*
* @deprecated 4.1.0 Please use {@see 'learndash_get_currency_symbol'} instead.
*
* @since 3.0.0
*
* @return string|false Returns currency symbol.
*/
function learndash_30_get_currency_symbol() {
if ( function_exists( '_deprecated_function' ) ) {
_deprecated_function( __FUNCTION__, '4.1.0', 'learndash_get_currency_symbol' );
}
$currency = '';
$options = get_option( 'sfwd_cpt_options' );
$stripe_settings = get_option( 'learndash_stripe_settings' );
if ( class_exists( 'LearnDash_Settings_Section' ) ) {
$paypal_enabled = LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Section_PayPal', 'enabled' );
$paypal_currency = LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Section_PayPal', 'paypal_currency' );
$stripe_connect_enabled = LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Section_Stripe_Connect', 'enabled' );
$stripe_connect_currency = LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Section_Stripe_Connect', 'currency' );
}
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if ( is_plugin_active( 'learndash-stripe/learndash-stripe.php' ) && ! empty( $stripe_settings ) && ! empty( $stripe_settings['currency'] ) ) {
$currency = $stripe_settings['currency'];
} elseif ( isset( $paypal_enabled ) && $paypal_enabled && ! empty( $paypal_currency ) ) {
$currency = $paypal_currency;
} elseif ( isset( $stripe_connect_enabled ) && $stripe_connect_enabled && ! empty( $stripe_connect_currency ) ) {
$currency = $stripe_connect_currency;
} elseif ( isset( $options['modules'] ) && isset( $options['modules']['sfwd-courses_options'] ) && isset( $options['modules']['sfwd-courses_options']['sfwd-courses_paypal_currency'] ) ) {
$currency = $options['modules']['sfwd-courses_options']['sfwd-courses_paypal_currency'];
}
if ( class_exists( 'NumberFormatter' ) ) {
$locale = get_locale();
$number_format = new NumberFormatter( $locale . '@currency=' . $currency, NumberFormatter::CURRENCY );
$currency = $number_format->getSymbol( NumberFormatter::CURRENCY_SYMBOL );
}
return $currency;
}
}