File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ function check_requirements() : bool {
6969 return false ;
7070 }
7171
72+ if ( ! ini_get ( 'allow_url_fopen ' ) ) {
73+ if ( is_admin () && ! defined ( 'DOING_AJAX ' ) ) {
74+ add_action ( 'admin_notices ' , __NAMESPACE__ . '\\url_fopen_disabled_notice ' );
75+ }
76+
77+ return false ;
78+ }
79+
7280 return true ;
7381}
7482
@@ -84,6 +92,17 @@ function outdated_php_version_notice() {
8492 );
8593}
8694
95+ /**
96+ * Print an admin notice when the PHP version is not high enough.
97+ *
98+ * This has to be a named function for compatibility with PHP 5.2.
99+ */
100+ function url_fopen_disabled_notice () {
101+ 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> ' ,
102+ 'https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen '
103+ );
104+ }
105+
87106/**
88107 * Print an admin notice when the WP version is not high enough.
89108 *
You can’t perform that action at this time.
0 commit comments