$value = $object->locale;
}
}
}
}
}
return $value;
}
/**
* Get all terms in one taxonomy for all languages
*
* @param string $taxonomy
*
* @return array of WP_Term objects
*/
public static function getTermsInAllLangs( $taxonomy ) {
$terms = array();
if ( self::isWPML() ) {
$currentLang = self::getCurrentLanguage();
$usedIds = array();
foreach ( self::getLanguages() as $lang ) {
do_action( 'wpml_switch_language', $lang );
$args = array(
'taxonomy' => $taxonomy,
'hide_empty' => true,
'suppress_filters' => false
);
$termsInLang = get_terms( apply_filters( 'dgwt/wcas/search/' . $taxonomy . '/args', $args ) );
if ( ! empty( $termsInLang ) && is_array( $termsInLang ) ) {
foreach ( $termsInLang as $termInLang ) {
if ( ! in_array( $termInLang->term_id, $usedIds ) ) {
$terms[] = $termInLang;
$usedIds[] = $termInLang->term_id;
}
}
}
}
do_action( 'wpml_switch_language', $currentLang );
}
if ( self::isPolylang() ) {
$terms = get_terms( array(
'taxonomy' => $taxonomy,
'hide_empty' => true,
'lang' => '', // query terms in all languages
) );
}
$terms = apply_filters( 'dgwt/wcas/multilingual/terms-in-all-languages', $terms, $taxonomy );
return $terms;
}
/**
* Get terms in specific language
*
* @param array $args
* @param string $lang
*
* @return \WP_Term[]
*/
public static function getTermsInLang( $args = array(), $lang = '' ) {
$terms = array();
if ( empty( $lang ) ) {
$lang = self::getDefaultLanguage();
}
if ( self::isWPML() ) {
$currentLang = self::getCurrentLanguage();
$usedIds = array();
do_action( 'wpml_switch_language', $lang );
$args = wp_parse_args( $args, array(
'taxonomy' => '',
'hide_empty' => true,
'suppress_filters' => false
) );
$termsInLang = get_terms( apply_filters( 'dgwt/wcas/search/' . $args['taxonomy'] . '/args', $args ) );
if ( ! empty( $termsInLang ) && is_array( $termsInLang ) ) {
foreach ( $termsInLang as $termInLang ) {
if ( ! in_array( $termInLang->term_id, $usedIds ) ) {
$terms[] = $termInLang;
$usedIds[] = $termInLang->term_id;
}
}
}
do_action( 'wpml_switch_language', $currentLang );
}
if ( self::isPolylang() ) {
$args = wp_parse_args( $args, array(
'taxonomy' => '',
'hide_empty' => true,
'lang' => $lang,
) );
$terms = get_terms( $args );
}
$terms = apply_filters( 'dgwt/wcas/multilingual/terms-in-language', $terms, $args, $lang );
return $terms;
}
public static function searchTerms( $taxonomy, $query, $lang = '' ) {
$terms = array();
if ( empty( $lang ) ) {
$lang = self::getDefaultLanguage();
}
$args = array(
'taxonomy' => $taxonomy,
'hide_empty' => false,
'search' => $query,
);
$terms = get_terms( $args );
}
/**
* Get term in specific language
*
* @param int $termID
* @param string $taxonomy
* @param string $lang
*
* @return object WP_Term
*/
public static function getTerm( $termID, $taxonomy, $lang ) {
$term = null;
if ( self::isWPML() ) {
$currentLang = self::getCurrentLanguage();
do_action( 'wpml_switch_language', $lang );
$term = get_term( $termID, $taxonomy );
do_action( 'wpml_switch_language', $currentLang );
}
if ( self::isPolylang() ) {
$termID = pll_get_term( $termID, $lang );
if ( $termID ) {
$term = get_term( $termID, $taxonomy );
}
}
$term = apply_filters( 'dgwt/wcas/multilingual/term', $term, $termID, $taxonomy, $lang );
return $term;
}
/**
* Check if multicurrency module is enabled
*
* @return bool
*/
public static function isMultiCurrency() {
$multiCurrency = false;
if ( self::isWPML() && function_exists( 'wcml_is_multi_currency_on' ) && wcml_is_multi_currency_on() ) {
$multiCurrency = true;
}
return $multiCurrency;
}
/**
* Get currency code assigned to language
*
* @param string $lang
*
* @return string
*/
public static function getCurrencyForLang( $lang ) {
$currencyCode = '';
if ( self::isWPML() ) {
global $woocommerce_wpml;
if ( ! empty( $woocommerce_wpml ) && is_object( $woocommerce_wpml ) && ! empty( $lang ) ) {
if ( ! empty( $woocommerce_wpml->settings['default_currencies'][ $lang ] ) ) {
$currencyCode = $woocommerce_wpml->settings['default_currencies'][ $lang ];
}
}
}
return $currencyCode;
}
/**
* Set currenct currency
*
* @return void
*/
public static function setCurrentCurrency( $currency ) {
self::$currentCurrency = $currency;
}
/**
* Get currenct currency
*
* @return string
*/
public static function getCurrentCurrency() {
return self::$currentCurrency;
}
/**
* Switch language
*
* @param $lang
*/
public static function switchLanguage( $lang ) {
if ( self::isWPML() && ! empty( $lang ) ) {
do_action( 'wpml_switch_language', $lang );
}
do_action( 'dgwt/wcas/multilingual/switch-language', $lang );
}
}
Fatal error: Uncaught Error: Class 'DgoraWcas\Multilingual' not found in /home/arasetne/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php:75
Stack trace:
#0 /home/arasetne/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php(379): DGWT_WC_Ajax_Search::getInstance()
#1 /home/arasetne/public_html/wp-includes/class-wp-hook.php(324): DGWT_WCAS('')
#2 /home/arasetne/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /home/arasetne/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /home/arasetne/public_html/wp-settings.php(550): do_action('plugins_loaded')
#5 /home/arasetne/public_html/wp-config.php(188): require_once('/home/arasetne/...')
#6 /home/arasetne/public_html/wp-load.php(50): require_once('/home/arasetne/...')
#7 /home/arasetne/public_html/wp-blog-header.php(13): require_once('/home/arasetne/...')
#8 /home/arasetne/public_html/index.php(17): require('/home/arasetne/...')
#9 {main}
th in /home/arasetne/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php on line 75