HEX
Server: Apache/2.4.62 (Debian)
System: Linux plxsite 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64
User: root (0)
PHP: 8.1.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/easy-wp-smtp/src/Compatibility/Plugin/Polylang.php
<?php

namespace EasyWPSMTP\Compatibility\Plugin;

/**
 * Polylang compatibility plugin.
 *
 * @since 2.12.0
 */
class Polylang extends PluginAbstract {

	/**
	 * Class constructor.
	 *
	 * @since 2.12.0
	 */
	public function __construct() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks

		add_action( 'pll_init', [ $this, 'load' ], PHP_INT_MAX );
	}

	/**
	 * Get plugin name.
	 *
	 * @since 2.12.0
	 *
	 * @return string
	 */
	public static function get_name() {

		return 'Polylang';
	}

	/**
	 * Get plugin path.
	 *
	 * @since 2.12.0
	 *
	 * @return string
	 */
	public static function get_path() {

		return 'polylang/polylang.php';
	}

	/**
	 * Execute after the Polylang plugin is loaded.
	 *
	 * @since 2.12.0
	 */
	public function load() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks

		if (
			! function_exists( 'PLL' ) ||
			! property_exists( PLL(), 'options' ) ||
			! isset( PLL()->options['force_lang'] ) ||
			PLL()->options['force_lang'] !== 3
		) {
			return;
		}

		// Use unfiltered site URL for multidomain setup.
		add_filter( 'easy_wp_smtp_wp_get_site_url_unfiltered', '__return_true' );
	}
}