✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.223
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/SiteVerification/css//class-fusion-languages-updater-api.php
<?php
/**
 * Custom API implementation to automatically update languages for ThemeFusion products.
 *
 * @since 6.1
 * @package Avada
 */

/**
 * Custom API client.
 *
 * @since 6.1
 * @example new Fusion_Languages_Updater( 'plugin', 'fusion-builder', '2.0.2', 'el' );
 */
class Fusion_Languages_Updater_API {

	/**
	 * Plugin or theme?
	 *
	 * @access private
	 * @since 6.1
	 * @var string
	 */
	private $type;

	/**
	 * The slug.
	 *
	 * @access private
	 * @since 6.1
	 * @var string
	 */
	private $slug;

	/**
	 * The language code.
	 *
	 * @access private
	 * @since 6.1
	 * @var string
	 */
	private $lang;

	/**
	 * The version.
	 *
	 * @access private
	 * @since 6.1
	 * @var string
	 */
	private $ver;

	/**
	 * The API response. Decoded from JSON to an array.
	 *
	 * @access private
	 * @since 6.1
	 * @var array
	 */
	private $vendor_api;

	/**
	 * The API URL.
	 *
	 * @access private
	 * @since 6.1
	 * @var string
	 */
	private $api_url = 'https://raw.githubusercontent.com/Theme-Fusion/Localization-l10n/master';

	/**
	 * Constructor.
	 *
	 * @access public
	 * @since 6.1
	 * @param string $type Can be "plugin" or "theme".
	 * @param string $slug The plugin - or theme - slug.
	 * @param string $ver  The version.
	 * @param string $lang The language.
	 */
	public function __construct( $type = 'plugin', $slug = '', $ver = '', $lang = '' ) {

		// Early exit if the user has disabled our API.
		if ( ! fusion_get_option( 'enable_language_updates' ) ) {
			return;
		}

		// Assign object properties.
		$this->type = $type;
		$this->slug = $slug;
		$this->lang = $lang;
		$this->ver  = $ver;

		// If no language was defined, get the current language.
		if ( '' === $this->lang ) {
			$this->lang = get_user_locale();
		}

		// Early exit for en_US.
		if ( 'en_US' === $this->lang ) {
			return;
		}

		// Get the custom API response.
		$this->vendor_api = $this->get_vendor_api();

		// Change the hook for themes/plugins.
		$hook = ( 'theme' === $type ) ? 'site_transient_update_themes' : 'site_transient_update_plugins';

		// Add the filter.
		add_filter( $hook, [ $this, 'modify_api_response' ] );
	}

	/**
	 * Modify the transient based on our API response and the context of this object.
	 *
	 * @access public
	 * @since 6.1
	 * @param object $results The WP API response.
	 * @return object
	 */
	public function modify_api_response( $results ) {

		// Sanity check.
		if ( ! is_object( $results ) || ! $this->should_update() ) {
			return $results;
		}

		// Make sure the translations property is defined in the object.
		if ( ! isset( $results->translations ) || ! is_array( $results->translations ) ) {
			$results->translations = [];
		}

		// Set the translations from our custom API.
		$results->translations[] = [
			'type'       => $this->type,
			'slug'       => $this->slug,
			'language'   => $this->lang,
			'version'    => $this->ver,
			'updated'    => $this->get_updated(),
			'package'    => $this->get_package(),
			'autoupdate' => true,
		];
		return $results;
	}

	/**
	 * Figure out if there's an updated language file or not.
	 *
	 * @access private
	 * @since 6.1
	 * @return bool
	 */
	private function should_update() {

		// Get the translation.
		$translation = $this->get_item_from_api();

		// Only proceed with these checks if translation was found in the API.
		if ( $translation ) {

			// Build the translation path for our checks.
			$translation_path  = WP_LANG_DIR;
			$translation_path .= ( 'theme' === $this->type ) ? '/themes/' : '/plugins/';
			$translation_path .= $this->slug . '-' . $this->lang . '.mo';

			// If translation file does not exist then we should download it.
			if ( ! file_exists( $translation_path ) ) {
				return true;
			}

			// If the existing translation file is older than the one on the API, then we should update it.
			if ( filemtime( $translation_path ) < strtotime( $this->get_updated() ) ) {
				return true;
			}
		}

		// Fallback to false.
		return false;
	}

	/**
	 * Get the vendor API response.
	 *
	 * @access private
	 * @since 6.1
	 * @return array|false Returns the array, or false on failure.
	 */
	private function get_vendor_api() {

		// Try to get the response from cache.
		$transient_name = 'fusion_l10n_api_' . sanitize_key( $this->slug );
		$results        = get_site_transient( $transient_name );

		// If the cache is not populated or expired, get the data.
		if ( ! $results ) {
			$api_url = "{$this->api_url}/api-{$this->slug}.json";

			// Get the server response.
			$response = wp_remote_get( $api_url );

			// Make sure the response was OK and we have a body.
			if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {

				// JSON-decode the response's body.
				$results = json_decode( $response['body'], true );

				// Set cache for a day.
				set_site_transient( $transient_name, $results, DAY_IN_SECONDS );
			}
		}

		// Sanity check: If results is an array return them.
		if ( is_array( $results ) ) {
			return $results;
		}

		// Fallback to returning false.
		return false;
	}

	/**
	 * Get the item we need from the API.
	 *
	 * @access private
	 * @since 6.1
	 * @return array|false
	 */
	private function get_item_from_api() {
		$result = false;

		// Sanity check.
		if ( is_array( $this->vendor_api ) && isset( $this->vendor_api['translations'] ) && is_array( $this->vendor_api['translations'] ) ) {

			// Loop results.
			foreach ( $this->vendor_api['translations'] as $translation ) {

				// Check if item exists for the language and version specified.
				if ( isset( $translation['language'] ) && $this->lang === $translation['language'] && isset( $translation['version'] ) && $this->ver === $translation['version'] ) {
					$result = $translation;
					break;
				}
			}
		}

		// Return the result (falls-back to false if none was found).
		return $result;
	}

	/**
	 * Get the "updated" argument.
	 *
	 * @access private
	 * @since 6.1
	 * @return string|false Datetime or false on fail.
	 */
	private function get_updated() {
		$translation = $this->get_item_from_api();
		return ( $translation && isset( $translation['updated'] ) ) ? $translation['updated'] : false;
	}

	/**
	 * Get the "package" argument.
	 *
	 * @access private
	 * @since 6.1
	 * @return string URL.
	 */
	private function get_package() {
		$translation = $this->get_item_from_api();
		if ( $translation && isset( $translation['package'] ) ) {
			return $translation['package'];
		}

		// Fallback.
		return "{$this->api_url}/{$this->slug}/{$this->slug}-{$this->lang}.zip";
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
22 Sep 2026 6.14 PM
docteuh / users
0755
dynamic
--
9 Sep 2026 9.51 AM
docteuh / users
0755
jquery3
--
13 Sep 2026 3.24 AM
docteuh / users
0755
media
--
9 Sep 2026 9.51 AM
docteuh / users
0755
no-builder
--
18 Sep 2026 7.41 PM
docteuh / users
0755
query
--
12 Sep 2026 12.42 PM
docteuh / users
0755
100-width.php
0.915 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
avada-social-links.css
1.498 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
avada-social-links.min.css
1.315 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
bbpress.min.css
16.249 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
block-editor.css
8.336 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
block-editor.min.css
7.228 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
class-fusion-languages-updater-api.php
6.365 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
contactform7.css
4.555 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
contactform7.min.css
3.938 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
events-calendar-templates-v2.css
61.879 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
events-calendar-templates-v2.min.css
58.501 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
events-calendar.css
54.286 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
events-calendar.min.css
49.319 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
footer-copyright.css
1.235 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
footer-copyright.min.css
1.098 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
fusion-footer-widget-area.css
9.589 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
fusion-footer-widget-area.min.css
8.78 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
fusion-footer.css
1.586 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
fusion-footer.min.css
1.441 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
gravityforms.css
8.189 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
gravityforms.min-20260829055439.css
7.403 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
gravityforms.min.css
7.403 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
header-legacy.css
112.781 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
header-legacy.min.css
102.463 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
icon-redirect-manager.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
page-title-bar.css
4.632 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
page-title-bar.min.css
4.088 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
rtl-header-legacy.css
10.663 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
rtl-header-legacy.min.css
9.664 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
rtl.min.css
38.021 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
search-20260827054547.php
6.188 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
search.php
6.188 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
slidingbar.css
10.538 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
slidingbar.min.css
9.237 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
social-sharing.css
1.253 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
social-sharing.min.css
1.135 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
style.min.css
66.932 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
wc-view-order.php
9.652 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
widgets.css
18.516 KB
20 Nov 2023 7.11 PM
docteuh / users
0644
widgets.min.css
16.425 KB
20 Nov 2023 7.11 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF