PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | functions/included_first.php +49 -20 1.4.122.12.4 View file →
@@ -1,20 +1,49 @@
1 -<?php
2 -/*
3 - Functions that should be included first
4 -*/
5 -function usces_filter_locale($locale){
6 - if( !is_admin()
7 - || ( isset($_POST['action']) && isset($_POST['mode']) && 'order_item_ajax' == $_POST['action'] && in_array($_POST['mode'], array('completionMail', 'orderConfirmMail', 'changeConfirmMail', 'receiptConfirmMail', 'mitumoriConfirmMail', 'cancelConfirmMail', 'otherConfirmMail')))
8 - || ( isset($_REQUEST['order_action']) && 'pdfout' == $_REQUEST['order_action'] )
9 - ){
10 - $usces_options = get_option('usces');
11 - if( isset($usces_options['system']['front_lang']) && !empty($usces_options['system']['front_lang']) ){
12 - return $usces_options['system']['front_lang'];
13 - }else{
14 - return $locale;
15 - }
16 - }else{
17 - return $locale;
18 - }
19 -}
20 -?>
1 +<?php
2 +/**
3 + * Functions that should be included first
4 + *
5 + * @package Welcart
6 + */
7 +
8 +/**
9 + * Locale
10 + *
11 + * @param string $locale Locale.
12 + * @return string
13 + */
14 +function usces_filter_locale( $locale ) {
15 + $mode = array(
16 + 'completionMail',
17 + 'orderConfirmMail',
18 + 'changeConfirmMail',
19 + 'receiptConfirmMail',
20 + 'mitumoriConfirmMail',
21 + 'cancelConfirmMail',
22 + 'otherConfirmMail',
23 + );
24 + if ( ! is_admin()
25 + || ( isset( $_POST['action'] ) && isset( $_POST['mode'] ) && 'order_item_ajax' == $_POST['action'] && in_array( $_POST['mode'], $mode ) )
26 + || ( isset( $_REQUEST['order_action'] ) && 'pdfout' == $_REQUEST['order_action'] )
27 + ) {
28 + $usces_options = get_option( 'usces', array() );
29 + if ( isset( $usces_options['system']['front_lang'] ) && ! empty( $usces_options['system']['front_lang'] ) ) {
30 + $locale = $usces_options['system']['front_lang'];
31 + }
32 + }
33 + return $locale;
34 +}
35 +
36 +/**
37 + * Dual textdomain
38 + */
39 +function usces_dual_textdomain() {
40 + $locale = get_locale();
41 + $usces_options = get_option( 'usces', array() );
42 + if ( isset( $usces_options['system']['front_lang'] ) && ! empty( $usces_options['system']['front_lang'] ) ) {
43 + $locale = $usces_options['system']['front_lang'];
44 + }
45 + if ( file_exists( USCES_PLUGIN_DIR . '/languages/usces-' . $locale . '.mo' ) ) {
46 + load_textdomain( 'usces_dual', USCES_PLUGIN_DIR . '/languages/usces-' . $locale . '.mo' );
47 + }
48 +}
49 +add_action( 'usces_construct', 'usces_dual_textdomain' );