PHP Class Habari\Site

Contains functions for getting details about the site directories and URLs.
Mostra file Open project: habari/system Class Usage Examples

Public Properties

Property Type Description
$config_dir
$config_path
$config_type
$config_urldir
$habari_url
$scriptname

Public Methods

Method Description
get_dir ( string $name, boolean | string $trail = false ) : string get_dir returns a complete filesystem path to the requested item 'config_file' returns the complete path to the config.php file, including the filename 'config' returns the path of the directory containing config.php 'user' returns the path of the user directory 'theme' returns the path of the site's active theme 'admin_theme' returns the path to the admin directory 'vendor' returns the path to the vendor directory
get_path ( string $name, boolean | string $trail = false ) : mixed get_path returns a relative URL path, without leading protocol or host 'base' returns the URL sub-directory in which Habari is installed, if any.
get_url ( string $name, boolean | string $trail = false ) : string get_url returns a fully-qualified URL 'host' returns http://www.habariproject.org 'habari' returns http://www.habariproject.org/habari, if you have Habari installed into a /habari/ sub-directory 'site' returns http://www.habariproject.org/site if you are installing with a subdirectory path 'user' returns one of the following: http://www.habariproject.org/user http://www.habariproject.org/user/sites/x.y.z 'theme' returns one of the following: http://www.habariproject.org/user/themes/theme_name http://www.habariproject.org/user/sites/x.y.z/themes/theme_name 'admin' returns http://www.habariproject.org/admin 'admin_theme' returns http://www.habariproject.org/system/admin 'login' returns http://www.habariproject.org/auth/login 'logout' returns http://www.habariproject.org/auth/logout 'system' returns http://www.habariproject.org/system 'vendor' returns http://www.habariproject.org/system/vendor 'scripts' returns http://www.habariproject.org/system/vendor '3rdparty' returns http://www.habariproject.org/3rdparty if /3rdparty does not exists, /system/vendor will be returned 'hostname' returns www.habariproject.org
is ( string $what ) : boolean is() returns a boolean value for whether the current site is the primary site, or a multi-site, as determined by the location of the config.php that is in use for this request.
out_dir ( string $dir, boolean $trail = false ) our_dir echos our a filesystem directory
out_path ( string $path, boolean $trail = false ) out_path echos a URL path
out_url ( string $url, boolean | string $trail = false ) out_url echos out a URL
script_name ( ) script_name is a helper function to determine the name of the script not all PHP installations return the same values for $_SERVER['SCRIPT_URL'] and $_SERVER['SCRIPT_NAME']

Private Methods

Method Description
__construct ( ) Constructor This class should not be instantiated

Method Details

get_dir() public static method

get_dir returns a complete filesystem path to the requested item 'config_file' returns the complete path to the config.php file, including the filename 'config' returns the path of the directory containing config.php 'user' returns the path of the user directory 'theme' returns the path of the site's active theme 'admin_theme' returns the path to the admin directory 'vendor' returns the path to the vendor directory
public static get_dir ( string $name, boolean | string $trail = false ) : string
$name string the name of the path item to return
$trail boolean | string whether to include a trailing slash, or a string to use as the trailing value. Default: false
return string Path

get_path() public static method

'habari' returns the path of Habari 'user' returns one of the following: user user/sites/x.y.z 'theme' returns one of the following: user/themes/theme_name user/sites/x.y.z/themes/theme_dir
public static get_path ( string $name, boolean | string $trail = false ) : mixed
$name string the name of the path to return
$trail boolean | string whether to include a trailing slash, or a string to use as the trailing value. Default: false
return mixed

get_url() public static method

get_url returns a fully-qualified URL 'host' returns http://www.habariproject.org 'habari' returns http://www.habariproject.org/habari, if you have Habari installed into a /habari/ sub-directory 'site' returns http://www.habariproject.org/site if you are installing with a subdirectory path 'user' returns one of the following: http://www.habariproject.org/user http://www.habariproject.org/user/sites/x.y.z 'theme' returns one of the following: http://www.habariproject.org/user/themes/theme_name http://www.habariproject.org/user/sites/x.y.z/themes/theme_name 'admin' returns http://www.habariproject.org/admin 'admin_theme' returns http://www.habariproject.org/system/admin 'login' returns http://www.habariproject.org/auth/login 'logout' returns http://www.habariproject.org/auth/logout 'system' returns http://www.habariproject.org/system 'vendor' returns http://www.habariproject.org/system/vendor 'scripts' returns http://www.habariproject.org/system/vendor '3rdparty' returns http://www.habariproject.org/3rdparty if /3rdparty does not exists, /system/vendor will be returned 'hostname' returns www.habariproject.org
public static get_url ( string $name, boolean | string $trail = false ) : string
$name string the name of the URL to return
$trail boolean | string whether to include a trailing slash, or a string to use as the trailing value. Default: false
return string URL

is() public static method

valid values are "main" and "primary" (synonymous) and "multi"
public static is ( string $what ) : boolean
$what string The name of the boolean to test
return boolean the result of the check

out_dir() public static method

our_dir echos our a filesystem directory
public static out_dir ( string $dir, boolean $trail = false )
$dir string the filesystem directory to display
$trail boolean whether or not to include a trailing slash, or a string to use as the trailing value. Default: false

out_path() public static method

out_path echos a URL path
public static out_path ( string $path, boolean $trail = false )
$path string the URL path to display
$trail boolean whether or not to include a trailing slash, or a string to use as the trailing value. Default: false

out_url() public static method

out_url echos out a URL
public static out_url ( string $url, boolean | string $trail = false )
$url string the URL to display
$trail boolean | string whether or not to include a trailing slash, or a string to use as the trailing value. Default: false

script_name() public static method

script_name is a helper function to determine the name of the script not all PHP installations return the same values for $_SERVER['SCRIPT_URL'] and $_SERVER['SCRIPT_NAME']
public static script_name ( )

Property Details

$config_dir static_oe public_oe property

static public $config_dir

$config_path static_oe public_oe property

static public $config_path

$config_type static_oe public_oe property

static public $config_type

$config_urldir static_oe public_oe property

static public $config_urldir

$habari_url static_oe public_oe property

static public $habari_url

$scriptname static_oe public_oe property

static public $scriptname