Your IP : 216.73.216.5


Current Path : /home/theafprt/conviviality360.com/wp-content/mu-plugins/ionos-sso/inc/
Upload File :
Current File : /home/theafprt/conviviality360.com/wp-content/mu-plugins/ionos-sso/inc/class-helper.php

<?php
/*
Plugin Name:  IONOS SSO
Plugin URI:   https://www.ionos.com
Description:  SSO for WordPress
Version:
License:      GPLv2 or later
Author:       IONOS
Author URI:   https://www.ionos.com
Text Domain:  ionos-sso
@package ionos-sso
*/

namespace Ionos\SSO;

// Do not allow direct access!

use function defined;
use function plugins_url;

if ( ! defined( 'ABSPATH' ) ) {
	die();
}

/**
 * Helper class
 */
class Helper {
	/**
	 * Get the url of the css folder
	 *
	 * @param  string  $file  // css file name.
	 *
	 * @return string
	 */
	public static function get_css_url( $file = '' ) {
		return plugins_url( 'css/' . $file, __DIR__ );
	}

	/**
	 * Get the url to the js folder.
	 *
	 * @param  string  $file  // js file name.
	 *
	 * @return string
	 */
	public static function get_js_url( $file = '' ) {
		return plugins_url( 'js/' . $file, __DIR__ );
	}

	/**
	 * If the requested domain is a domain of Ionos.
	 *
	 * @param  string  $hostname  // Ionos domain name.
	 *
	 * @return boolean
	 */
	public static function is_ionos_host( $hostname = null ) {
		switch ( $hostname ) :
			case 'mein.ionos.de':
			case 'my.ionos.fr':
			case 'my.ionos.es':
			case 'my.ionos.com':
			case 'my.ionos.ca':
			case 'my.ionos.co.uk':
			case 'my.ionos.mx':
			case 'my.ionos.it':
				$return_value = true;
				break;
			default:
				$return_value = false;
		endswitch;

		return $return_value;
	}

	static function compare_action( $value ) {
		$bool = false;
		if ( isset( $_GET['action'] ) && $_GET['action'] === $value ) {
			$bool = true;
		}

		return $bool;
	}

	static function get_array_value( array $array, string $key ) {
		$returnValue = null;
		if ( isset( $array[ $key ] ) ) {
			$returnValue = $array[ $key ];
		}

		return $returnValue;
	}

	static function is_blacklisted_ionos_domain( $domain ) {
		$blacklist = array(
			'webapps-sso.hosting.ionos.com',
		);

		foreach ( $blacklist as $value ) {
			if ( $value == $domain ) {
				return true;
			}
		}

		return false;
	}
}