Documentation

FWHtAccess
in package

Class FWHtAccess

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Cloudrexx Development Team info@cloudrexx.com

access

public

version
2.1.0
subpackage

lib_framework

Table of Contents

Properties

$arrContrexxDirectives  : array<string|int, mixed>
A multi-dimensional array containing all directives of the Cloudrexx sections.
$arrDirectives  : array<string|int, mixed>
An array containing all directives of the loaded HtAccess file.
$arrSectionOrder  : array<string|int, mixed>
Cloudrexx directive sections
$document_root  : mixed
$HtAccessLoaded  : bool
Status if there is a HtAccess file loaded
$objHtAccess  : object
An instance of the PEAR class File_HtAccess.
$path_offset  : mixed
$rewriteEngine  : bool
Status if the rewrite engine has been activated in the loaded HtAccess file.

Methods

__construct()  : mixed
Constructor
checkForApacheServer()  : bool
Check if the System is running on a Apache webserver
checkForModRewriteModul()  : bool
Check if the Apache modul mod_rewrite is loaded
getSection()  : mixed
Get directives of a section
isHtAccessFileLoaded()  : bool
Returns either TRUE or FALSE depending on if the HtAccess file had successfully been loaded.
isRewriteEngineInUse()  : bool
Returns either TRUE or FALSE depending on if the Rewrite Engine is activated in the HtAccess file.
loadHtAccessFile()  : mixed
Load HtAccess file
removeSection()  : mixed
Remove section specified by $section from the HtAccess file.
setSection()  : mixed
Set directives of a section
write()  : bool
Write the HtAccess file
prepareFileAccess()  : bool
Prepare file access
serialize()  : array<string|int, mixed>
Serialize a multi-dimensional array into a single-dimensional array
sortContrexxSections()  : int
Sort method used by usort() to sort the sections according to the order in $this->arrSortOrder.

Properties

$arrContrexxDirectives

A multi-dimensional array containing all directives of the Cloudrexx sections.

private array<string|int, mixed> $arrContrexxDirectives = array()
Tags
access

private

$arrDirectives

An array containing all directives of the loaded HtAccess file.

private array<string|int, mixed> $arrDirectives = array()

The directives of Cloudrexx sections are represented as a whole by one entry which uses the section name as value.

Tags
access

private

$arrSectionOrder

Cloudrexx directive sections

private array<string|int, mixed> $arrSectionOrder = array('contrexx__core_modules__alias', 'contrexx__core__language')

This list is used to sort the sections within a HtAccess file.

Tags
access

private

$HtAccessLoaded

Status if there is a HtAccess file loaded

private bool $HtAccessLoaded = \false
Tags
access

private

$objHtAccess

An instance of the PEAR class File_HtAccess.

private object $objHtAccess

This object provides an improved handling of HtAccess files.

Tags
access

private

$rewriteEngine

Status if the rewrite engine has been activated in the loaded HtAccess file.

private bool $rewriteEngine = \false
Tags
access

private

Methods

__construct()

Constructor

public __construct(mixed $document_root, mixed $path_offset) : mixed

Initializes an object of the PEAR class File_HtAccess.

Parameters
$document_root : mixed
$path_offset : mixed

checkForApacheServer()

Check if the System is running on a Apache webserver

public checkForApacheServer() : bool
Return values
bool

checkForModRewriteModul()

Check if the Apache modul mod_rewrite is loaded

public checkForModRewriteModul() : bool
Return values
bool

getSection()

Get directives of a section

public getSection(string $section) : mixed

Returns all directives that are part of the section specified by $section.

Parameters
$section : string
Return values
mixed

Returns FALSE if the HtAccess file hasn't been loaded. Otherwise it returns an array containing the HtAccess directives.

isHtAccessFileLoaded()

Returns either TRUE or FALSE depending on if the HtAccess file had successfully been loaded.

public isHtAccessFileLoaded() : bool
Return values
bool

isRewriteEngineInUse()

Returns either TRUE or FALSE depending on if the Rewrite Engine is activated in the HtAccess file.

public isRewriteEngineInUse() : bool
Return values
bool

loadHtAccessFile()

Load HtAccess file

public loadHtAccessFile(string $filename[, bool $prepareFileAccess = true ]) : mixed

Loads the content of the HtAccess file specified by $filename. The content gets seperated into Cloudrexx related directives and other directives. If the param $prepareFileAccess is set to TRUE, the HtAccess file will be created if it doesn't exist. As well will any write-protection mode on the file be removed.

Parameters
$filename : string
$prepareFileAccess : bool = true
Tags
global

array

Return values
mixed

Returns TRUE on success, otherwise a string containing an appropriate error message.

removeSection()

Remove section specified by $section from the HtAccess file.

public removeSection(string $section) : mixed
Parameters
$section : string

setSection()

Set directives of a section

public setSection(string $section, array<string|int, mixed> $arrDirectives) : mixed

Sets the directives specified by $arrDirectives of the section specified by $section. It also sorts the sections according to the oder in $this->arrSortOrder.

Parameters
$section : string
$arrDirectives : array<string|int, mixed>

write()

Write the HtAccess file

public write() : bool
Return values
bool

prepareFileAccess()

Prepare file access

private prepareFileAccess(string $path) : bool

Creates the file specified by $path if it doesn't exist and removes the write-protection mode on the file if there's one.

Parameters
$path : string
Return values
bool

Returns TRUE if the specified file exists and has no write-protection on it at the end. Returns FALSE if something fails.

serialize()

Serialize a multi-dimensional array into a single-dimensional array

private serialize(array<string|int, mixed> $array[, array<string|int, mixed> $return = array() ][, int $level = 2 ]) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$return : array<string|int, mixed> = array()
$level : int = 2
Return values
array<string|int, mixed>

sortContrexxSections()

Sort method used by usort() to sort the sections according to the order in $this->arrSortOrder.

private sortContrexxSections(string $a, string $b) : int
Parameters
$a : string
$b : string
Return values
int

        
On this page

Search results