getTimezone() ); return $compare < $start; } /** * Check if given date is between provided start/end date. * * @since 2.11.1 * * @param DateTime $compare The date to compare against the start/end date. * @param string $start The start date to compare against, in 'Y-m-d H:i:s' format. * @param string $end The end date to compare against, in 'Y-m-d H:i:s' format. * * @return bool Whether the given date is between provided start/end date. */ public static function date_within( DateTime $compare, $start, $end ) { return ! self::date_before( $compare, $start ) && $compare < DateTime::createFromFormat( 'Y-m-d H:i:s', $end, $compare->getTimezone() ); } /** * Get the domains for each language when WPML is enabled. * * @since 2.16.19 * * @return array $language_switcher The array of language code and domains. */ public static function get_wpml_language_domains() { if ( ! self::is_wpml_active() ) { return array(); } global $sitepress; // Get the language switcher settings. $language_switcher = $sitepress->get_setting( 'language_domains', array() ); return $language_switcher; } /** * Check if WPML is enabled. * * If "A different domain per language" is selected for "Language URL format", * only then we are considering WPML is active. For language_negotiation_type setting: * 1 = Different languages in directories; * 2 = A different domain per language; * 3 = Language name added as a parameter. * * @since 2.16.19 * * @return bool True if WPML is active, false otherwise. */ public static function is_wpml_active() { global $sitepress; return defined( 'ICL_SITEPRESS_VERSION' ) && $sitepress && 2 === (int) $sitepress->get_setting( 'language_negotiation_type' ); } }