wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



apache_mod_loaded › WordPress Function

Da2.5.0
Deprecaton/a
apache_mod_loaded ( $mod, $default_value = false )
Parametri: (2)
  • (string) $mod The module, e.g. mod_rewrite.
    Richiesto:
  • (bool) $default_value Optional. The default return value if the module is not found. Default false.
    Richiesto: No
    Default: false
Ritorna:
  • (bool) Whether the specified module is loaded.
Definito a:
Codex:

Determines whether the specified module exist in the Apache config.



Sorgenti

function apache_mod_loaded( $mod, $default_value = false ) {
	global $is_apache;

	if ( ! $is_apache ) {
		return false;
	}

	$loaded_mods = array();

	if ( function_exists( 'apache_get_modules' ) ) {
		$loaded_mods = apache_get_modules();

		if ( in_array( $mod, $loaded_mods, true ) ) {
			return true;
		}
	}

	if ( empty( $loaded_mods )
		&& function_exists( 'phpinfo' )
		&& ! str_contains( ini_get( 'disable_functions' ), 'phpinfo' )
	) {
		ob_start();
		phpinfo( INFO_MODULES );
		$phpinfo = ob_get_clean();

		if ( str_contains( $phpinfo, $mod ) ) {
			return true;
		}
	}

	return $default_value;
}