Upload_Directory implements Registerable, Standard_Service

Handles the protection of custom upload directories.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

create_apache_protection_files()  : mixed
Creates the Apache protection files.
get_upload_dir()  : string
Retrives the upload directory path.
maybe_show_nginx_notice()  : void
Show a notice if the user is using Nginx.
register()  : void
{@inheritdoc}
htaccess_exists()  : bool
Checks if the .htaccess file exists.
is_apache()  : bool
Checks if the server is running Nginx.
is_nginx()  : bool
Checks if the server is running Apache.
scan_folders()  : array<string|int, mixed>
Scans all folders inside of /uploads/wpo-uploads

Methods

create_apache_protection_files()

Creates the Apache protection files.

public create_apache_protection_files([bool $force = false ]) : mixed

Graciously borrowed from EDD (GPL).

Parameters
$force : bool = false

Whether to force the creation of the files.

Tags
Return values
mixed

get_upload_dir()

Retrives the upload directory path.

public get_upload_dir() : string
Tags
Return values
string

maybe_show_nginx_notice()

Show a notice if the user is using Nginx.

public maybe_show_nginx_notice() : void
Tags
Return values
void

register()

{@inheritdoc}

public register() : void
Tags
Return values
void

htaccess_exists()

Checks if the .htaccess file exists.

private htaccess_exists() : bool
Tags
Return values
bool

is_apache()

Checks if the server is running Nginx.

private is_apache() : bool
Tags
Return values
bool

is_nginx()

Checks if the server is running Apache.

private is_nginx() : bool
Tags
Return values
bool

scan_folders()

Scans all folders inside of /uploads/wpo-uploads

private scan_folders([string $path = '' ][, array<string|int, mixed> $return = [] ]) : array<string|int, mixed>
Parameters
$path : string = ''

Path to scan

$return : array<string|int, mixed> = []

Results of previous recursion

Tags
Return values
array<string|int, mixed>

$return List of files inside directory

Search results