2017 © Pedro Peláez
 

library wp-file

Small class library that facilitates file handling in Wordpress.

image

10quality/wp-file

Small class library that facilitates file handling in Wordpress.

  • Tuesday, June 12, 2018
  • by amostajo
  • Repository
  • 2 Watchers
  • 0 Stars
  • 212 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Wordpress File (wrapper class)

Latest Stable Version Total Downloads License, (*1)

This small class library facilitates file handling for Wordpress custom developments, will provide all functionality to meet Wordpress' standards., (*2)

Features: * Theme Check ready. * Easy to use., (*3)

Installation

With composer

Make the dependecy required in your project:, (*4)

composer require 10quality/wp-file

Alternative

Download or clone the project and load the class with php functions:, (*5)

require_once '[PATH TO CLASS]/File.php';

Usage

The following example will let you see how to use the class:, (*6)

Code to replace, (*7)

$filename = __DIR__.'/myfile.txt';

$file = @fopen( $filename, ,'w+' );

$content = fread( $file );

fwrite( $file, $content );

fclose($file);

Replacement:, (*8)

use TenQuality\WP\File;

$filename = __DIR__.'/myfile.txt';

$content = File::auth()->read( $filename );

File::auth()->write( $filename, $content );

Authentication

Wordpress will require to authenticate a url in order to validate if filesystem credentials are in place., (*9)

If you need to authenticate a specific url, pass it like this:, (*10)

File::auth( $url )->read( $filename );

Folder handling

Methods to handle files:, (*11)

$file = File::auth();

// Use is_dir to check if a path exists or not.
if ( $file->is_dir( $path ) )
    // Use mkdir to create unexistent paths.
    $file->mkdir( $path );
// Use rmdir to remove paths.
$file->rmdir( $path );

Recomendations

Store your files in the uploads folder., (*12)

Coding guidelines

PSR-4., (*13)

LICENSE

The MIT License (MIT), (*14)

Copyright (c) 2016 10Quality., (*15)

The Versions

12/06 2018

v1.0.x-dev

1.0.9999999.9999999-dev

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

12/06 2018

v0.9.4

0.9.4.0

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

12/06 2018

v0.9.3

0.9.3.0

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

26/10 2016

v0.9.2

0.9.2.0

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

23/09 2016

v0.9.1

0.9.1.0

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

22/09 2016

dev-master

9999999-dev

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem

22/09 2016

v0.9.0

0.9.0.0

Small class library that facilitates file handling in Wordpress.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

wordpress file filesystem