Skip to content

Commit fb64374

Browse files
committed
Merge branch 'release/1.1.4'
2 parents a686c7c + 901eed1 commit fb64374

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ jobs:
66
PHPCS:
77
runs-on: ubuntu-latest
88
steps:
9+
- name: Set default PHP version
10+
run: sudo update-alternatives --set php /usr/bin/php7.4
11+
- name: Set Composer version
12+
run: sudo composer self-update --1
913
- name: Checkout
1014
uses: actions/checkout@v2
1115
- name: Install dependencies
@@ -27,16 +31,17 @@ jobs:
2731
- 3306
2832
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2933
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v2
32-
- name: Install dependencies
33-
run: composer install --no-progress
3434
- name: Setup PHP
3535
uses: shivammathur/setup-php@v1
3636
with:
3737
php-version: ${{ matrix.php }}
3838
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
3939
coverage: none
40+
tools: composer:v1
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
- name: Install dependencies
44+
run: composer install --no-progress
4045
- name: PHPUnit
4146
run: |
4247
chmod 777 bin/install-wp-tests.sh

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 1.1.4
5+
6+
### Changed:
7+
- Allows mkdir method to get empty parameter.
8+
9+
## 1.1.3 - 15.06.2020
10+
11+
### Fixed:
12+
- WP_CONTENT_URL not returning proper protocol. Replaced with `content_url()`, thanks to @matt-bernhardt
13+
414
## 1.1.3 - 15.06.2020
515

616
### Fixed:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ echo $filesystem->url();
5656
// https://my.plugin/wp-content/plugins/my-plugin/
5757

5858
echo $filesystem->url( 'assets/images/logo.svg' );
59-
// https://my.plugin/wp-content/plugins/my-plugin/'assets/images/logo.svg
59+
// https://my.plugin/wp-content/plugins/my-plugin/assets/images/logo.svg
6060
```
6161

6262
Convert image file to base64 URL.
6363

6464
```php
65-
echo '<img src="' . $filesystem->image_to_base64( 'assets/images/logo.svg' ) . '">';
65+
printf( '<img src="%s">', $filesystem->image_to_base64( 'assets/images/logo.svg' ) );
6666
// <img src="data:image/svg+xml;base64,m8q76v7wy4guiev...">
6767
```
6868

src/Filesystem.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
/**
1111
* Filesystem class
1212
*
13-
* @see Available methods: https://developer.wordpress.org/reference/classes/wp_filesystem_base/#methods
13+
* @see https://developer.wordpress.org/reference/classes/wp_filesystem_base/#methods
14+
* @mixin \WP_Filesystem_Base
1415
*/
1516
class Filesystem {
1617

@@ -24,7 +25,7 @@ class Filesystem {
2425
/**
2526
* WP Filesystem object
2627
*
27-
* @var WP_Filesystem_*
28+
* @var \WP_Filesystem_Base
2829
*/
2930
protected static $wp_filesystem;
3031

@@ -84,7 +85,7 @@ public function __construct( $base_dir ) {
8485
*/
8586
private static function init_wp_filesystem() {
8687

87-
if ( self::$wp_filesystem ) {
88+
if ( isset( self::$wp_filesystem ) ) {
8889
return;
8990
}
9091

@@ -135,7 +136,7 @@ public function __call( $method_name, $arguments ) {
135136
* @param bool $recursive Whether to act recursively.
136137
* @return bool True on success, false on failure.
137138
*/
138-
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false, $recursive = false ) {
139+
public function mkdir( $path = '', $chmod = false, $chown = false, $chgrp = false, $recursive = false ) {
139140

140141
if ( ! self::$wp_filesystem instanceof \WP_Filesystem_Direct ) {
141142
if ( $recursive ) {
@@ -147,9 +148,6 @@ public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false, $r
147148

148149
// Safe mode fails with a trailing slash under certain PHP versions.
149150
$path = untrailingslashit( $path );
150-
if ( empty( $path ) ) {
151-
return false;
152-
}
153151

154152
if ( ! $chmod ) {
155153
$chmod = FS_CHMOD_DIR;
@@ -230,7 +228,7 @@ public function image_to_base64( $image_path ) {
230228

231229
$type = pathinfo( $this->path( $image_path ), PATHINFO_EXTENSION );
232230

233-
// SVG mime type fix.
231+
// Fix SVG MIME type.
234232
if ( 'svg' === $type ) {
235233
$type = 'svg+xml';
236234
}

0 commit comments

Comments
 (0)