承接 10quality/wp-file 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

10quality/wp-file

最新稳定版本:v1.0.0

Composer 安装命令:

composer require 10quality/wp-file

包简介

Small class library that facilitates file handling in WordPress.

README 文档

README

Latest Stable Version Total Downloads License

This small class library facilitates file handling for WordPress custom developments, will provide all functionality to meet WordPress' standards.

Features:

  • Theme Check ready.
  • Easy to use.

Installation

With composer

Make the dependecy required in your project:

composer require 10quality/wp-file

Alternative

Download or clone the project and load the class with php functions:

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

Usage

The following example will let you see how to use the class:

Code to replace

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

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

$content = fread( $file );

fwrite( $file, $content );

fclose($file);

Replacement:

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.

If you need to authenticate a specific url, pass it like this:

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

Other methods

// Returns bool
$isFile = File::auth()->is_file( $filename );
// Returns bool
$fileExists = File::auth()->exists( $filename );

Folder or Path handling

Methods to handle files:

$file = File::auth();

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

Recomendations

Store your files in the uploads folder.

Coding guidelines

PSR-4.

LICENSE

The MIT License (MIT)

Copyright (c) 2016 10Quality.

统计信息

  • 总下载量: 6.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固