Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ function check_requirements() : bool {
return false;
}

if ( ! ini_get( 'allow_url_fopen' ) ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
add_action( 'admin_notices', __NAMESPACE__ . '\\url_fopen_disabled_notice' );
}

return false;
}

return true;
}

Expand All @@ -84,6 +92,17 @@ function outdated_php_version_notice() {
);
}

/**
* Print an admin notice when the PHP version is not high enough.
*
* This has to be a named function for compatibility with PHP 5.2.
*/
function url_fopen_disabled_notice() {
printf( '<div class="error"><p>The S3 Uploads plugin requires PHP option allow_url_fopen to be enabled. <a href="%s" target="_blank" rel="noopener noreferrer">Learn more</a>.</p></div>',
'https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen'
);
}

/**
* Print an admin notice when the WP version is not high enough.
*
Expand Down
Loading