Contentserv PHP API

CSIncludeUtils
in package

Collection of various convenience methods around the include features of files

This class offers a set of methods that will be helpful to include various types of files

Tags
since
5.0.4

Table of Contents

CSINCLUDEUTILS_ERROR_NOTACSFILE  = 12001
checkIncludePath()  : string
checks whether a given file may be included
includeFile()  : void
includes a file
requireFile()  : void
includes a file (with the required-function)

Constants

CSINCLUDEUTILS_ERROR_NOTACSFILE

public mixed CSINCLUDEUTILS_ERROR_NOTACSFILE = 12001
Tags

Methods

checkIncludePath()

checks whether a given file may be included

public static checkIncludePath(string $file[, string $context = null ][, bool $strictCheck = false ]) : string
Parameters
$file : string

the file to be included. If it is a relative path, it must be relative to the context folder

$context : string = null

the context path of the file, where the include must be within. If it is null, the admin folder CS_ADMIN is used as context

$strictCheck : bool = false

if this flag is set the include is checked in the security library. This must be used e.g. for including passed paths in the HTTP-Request like ?forward=...

Tags
throws
CSException

if the include is not allowed

access

public

Return values
string

$file the absolute path of the file which may be included

includeFile()

includes a file

public static includeFile(string $file[, bool $once = true ][, mixed $context = array() ]) : void
Parameters
$file : string

the file to include

$once : bool = true

if true, the file will be included only once

$context : mixed = array()
Tags
access

public

Return values
void

requireFile()

includes a file (with the required-function)

public static requireFile(string $file[, bool $once = true ][, mixed $context = array() ]) : void
Parameters
$file : string

the file to include

$once : bool = true

if true, the file will be included only once

$context : mixed = array()
Tags
access

public

Return values
void

        

Search results