Skip to content

Commit

Permalink
Fixed WP_Filesystem initialization and resource file extension
Browse files Browse the repository at this point in the history
- [Fixed] Properly initialized WP_Filesystem
- [Fixed] Changed resource files to use HTML extension
- [Added] New HTML file for admin requirements notice
- [Removed] PHP file for admin requirements notice
  • Loading branch information
smileBeda committed May 26, 2024
1 parent 86689cb commit 70087ec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## ## 2024-05-26
- [Fixed] Properly initialise WP_Filesystem
- [Fixed] Use HTML file extension for resouurce files

## 2024-05-23
- [Removed] Vendor Folder
- [Added] Vendor folder to gitignore
Expand Down
3 changes: 3 additions & 0 deletions src/resources/admin-requirements-notice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="notice notice-error">
<p>%1$s %2$s <a href="%3$s" target="_blank">%4$s</a> %5$s</p>
</div>
18 changes: 0 additions & 18 deletions src/resources/admin-requirements-notice.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/src/admin/class-admin-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Admin_Notifications {
public static function print_requirement_notice(): void {

$notice = ( WP_Filesystem_Utility::get_filesystem() )
->get_contents( Config::get( 'plugin_dir' ) . 'resources/admin-requirements-notice.php' );
->get_contents( Config::get( 'plugin_dir' ) . 'resources/admin-requirements-notice.html' );
printf(
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$notice,
Expand Down
3 changes: 1 addition & 2 deletions src/src/utilities/class-wp-filesystem-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public static function get_filesystem(): object {

if ( null === self::$filesystem ) {

require_once \ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
require_once \ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
WP_Filesystem();
self::$filesystem = new WP_Filesystem_Direct( true );
}

Expand Down

0 comments on commit 70087ec

Please sign in to comment.