/** * Sets the active language * * @param string|bool */ public static function set_active_language($lang = false) { if (is_string($lang) && !empty($lang)) { self::$active_language = $lang; } // If we have not defined a language, then autodetect if (false == $lang || empty($lang)) { // No need to proceed if both WPML & PLL are inactive if (!self::$is_pll && !self::$is_wpml) { return 'en'; } // Preliminary work for PLL. // Adds the WPML compatibility layer. if (self::$is_pll && function_exists('pll_define_wpml_constants')) { pll_define_wpml_constants(); } // PLL-WPML compatibility is active, we can now work easier. if (defined('ICL_LANGUAGE_CODE')) { self::$active_language = ICL_LANGUAGE_CODE; if ('all' == ICL_LANGUAGE_CODE) { Avada::set_language_is_all(true); if (self::$is_wpml) { global $sitepress; self::$active_language = $sitepress->get_default_language(); } elseif (self::$is_pll) { self::$active_language = pll_default_language('slug'); } } } } }
define('ADMIN_PATH', get_template_directory() . '/framework/admin/'); } if (!defined('ADMIN_DIR')) { define('ADMIN_DIR', get_template_directory_uri() . '/framework/admin/'); } define('ADMIN_IMAGES', ADMIN_DIR . 'assets/images/'); define('LAYOUT_PATH', ADMIN_PATH . 'layouts/'); define('THEMENAME', $theme_name); /* Theme version, uri, and the author uri are not completely necessary, but may be helpful in adding functionality */ define('THEMEVERSION', $theme_version); define('THEMEURI', $theme_uri); define('THEMEAUTHORURI', $author_uri); // Avada Edit $lang = ''; if (function_exists('pll_define_wpml_constants')) { pll_define_wpml_constants(); } if (defined('ICL_LANGUAGE_CODE')) { if (defined('ICL_SITEPRESS_VERSION')) { global $sitepress; } if (function_exists('pll_default_language')) { global $polylang; $pll_languages_obj = $polylang->model->get_languages_list(); $pll_languages = array(); foreach ($pll_languages_obj as $pll_language_obj) { $pll_languages[] = $pll_language_obj->slug; } } if (ICL_LANGUAGE_CODE) { if (ICL_LANGUAGE_CODE != 'en' && ICL_LANGUAGE_CODE != 'all' && array_key_exists(ICL_LANGUAGE_CODE, icl_get_languages('skip_missing=N'))) {