Class: Site
- Package: saf.Site
- Author: John Luxford <lux@simian.ca>
- Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
- License: http://www.sitellite.org/index/license Simian Open Software License
- Version: 2.2, 2002-07-17, $Id: Site.php,v 1.4 2007/10/06 00:06:30 lux Exp $
- Access: public
Site is a class that is used to store information about your site in
a nice and simple location.The Site class contains 3 pieces of information
about your web site, used mainly for input into the Session object. These
include the domain name of your site, which must contain at least 2 periods (.)
in order to function properly; the web path from the document root of the
site, and a 1 or 0 denoting whether or not we're running behind a Secure
Socket Layer (SSL).
The nice part about Site though is that you can store any other properties
you want to in it on the fly, because PHP allows you to do so without
extending the class. This makes Site a nice place to store information
you want to maintain throughout your application.
New in 1.2:
- Added a prefix() method.
New in 1.4:
- Moved the prefix() method to saf.Site.SitelliteSite instead, since it uses
the Sitellite-specific SITELLITE_LEVEL constant.
New in 2.0:
- All new property names, including $webpath, $adminpath, $docroot, and $appdir.
These changes are necessary in order to support sites with code outside of the
document root. Note: The old $wwwpath is now an alias to $webpath, $abspath
is an alias to $docroot, and $path is an alias to $adminpath. Also, the
constructor's parameters have changed.
New in 2.2:
- Moved SitelliteSite::prefix() to this class and made it a property (the method
exists for b/c), so as to consolidate the two packages. SitelliteSite::runmode
is also not used any more by SCS, so that "went West" as they say.
- Added $current property, and site_current ().
Usage Example
<?php
// create a Site object that sits behind SSL
$site = new SitelliteSite (array (
"domain" => "www.yoursite.com",
"docroot" => "/home/yoursite/public_html",
"appdir" => "/home/yoursite/public_html",
"webpath" => "/",
"adminpath" => "/sitellite",
"secure" => 1,
));
// output the site's url
echo $site->url;
?>
Return to Top
Properties
$domain
Contains the domain of the site.
$webpath
Contains the path of the site from the document root.
$adminpath
Contains the path to the admin system from the document root.
$docroot
Contains the absolute path to the document root.
$appdir
Contains the absolute path to the application directory (allows Sitellite
to live outside of the $docroot).
$secure
A 1 or 0 (true or false) denoting whether the site is running
behind SSL.
$url
The url of the web site, including the 'http://' or 'https://',
the domain, and the webpath. Created during the construction of the object.
$prefix
The path of the web site, which is essentially the webpath.
Created during the construction of the object.
$current
The path of the web site, which is essentially the webpath,
but also including everything but the ?parameters and #anchor.
Created during the construction of the object.
Return to Top
Methods
Site (&$params)
Constructor method.
prefix ($tpl = '')
- Access: public
- Return: string
Returns the $site->webpath if a $conf['Site']['level'] value
is defined as greater than 0, otherwise returns ''. NOTE: DEPRECATED.
Return to Top