Class Site

Description

Habari Site class Contains functions for getting details about the site directories and URLs.

Located in /system/classes/site.php (line 8)


	
			
Class Constant Summary
Variable Summary
static mixed $config_dir
static mixed $config_path
static mixed $config_type
static mixed $scriptname
Method Summary
static string get_dir (string $name, [bool $trail = false])
static void get_path (string $name, [bool $tail = false])
static string get_url (string $name, [bool $trail = false])
static bool is (string $what)
static void out_dir (string $dir, [bool $trail = false])
static void out_path (string $path, [bool $trail = false])
static void out_url (string $url, [bool $trail = false])
static void script_name ()
Variables
static mixed $config_dir (line 27)
static mixed $config_path (line 26)
  • staticvar: $config_path 0: Filesystem path to config.php
  • staticvar: $config_dir 1: Multisite directory to config.php
  • staticvar: $config_type 2: Installation type (local, subdir, subdomain)
  • staticvar: $scriptname 3: the name of the currently executing script (index.php)
static mixed $config_type = Site::CONFIG_LOCAL (line 28)
static mixed $scriptname (line 29)
Methods
static method get_dir (line 255)

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

  • return: Path
  • access: public
static string get_dir (string $name, [bool $trail = false])
  • string $name: the name of the path item to return
  • bool $trail: whether to include a trailing slash. Default: No
static method get_path (line 206)

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.

'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

  • access: public
static void get_path (string $name, [bool $tail = false])
  • string $name: the name of the path to return
  • bool $tail: whether to include a trailing slash. Default: No
static method get_url (line 121)

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 '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 'system' returns http://www.habariproject.org/system 'scripts' returns http://www.habariproject.org/scripts 'hostname' returns www.habariproject.org

  • return: URL
  • access: public
static string get_url (string $name, [bool $trail = false])
  • string $name: the name of the URL to return
  • bool $trail: whether to include a trailing slash. Default: No
static method is (line 73)

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.

valid values are "main" and "primary" (synonymous) and "multi"

  • return: the result of the check
  • access: public
static bool is (string $what)
  • string $what: The name of the boolean to test
static method out_dir (line 354)

our_dir echos our a filesystem directory

  • access: public
static void out_dir (string $dir, [bool $trail = false])
  • string $dir: the filesystem directory to display
  • bool $trail: whether or not to include a trailing slash. Default: No
static method out_path (line 344)

out_path echos a URL path

  • access: public
static void out_path (string $path, [bool $trail = false])
  • string $path: the URL path to display
  • bool $trail: whether or not to include a trailing slash. Default: No
static method out_url (line 334)

out_url echos out a URL

  • access: public
static void out_url (string $url, [bool $trail = false])
  • string $url: the URL to display
  • bool $trail: whether or not to include a trailing slash. Default: No
static method script_name (line 44)

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']

  • access: public
static void script_name ()
Class Constants
CONFIG_LOCAL = 0 (line 16)

Constants

CONFIG_LOCAL Local installation CONFIG_SUBDIR Subdirectory or multisite installation CONFIG_SUBDOMAIN Subdomain installation

CONFIG_SUBDIR = 1 (line 17)
CONFIG_SUBDOMAIN = 2 (line 18)

Documentation generated on Thu, 30 Oct 2008 20:31:26 +0100 by phpDocumentor 1.3.2