本文整理汇总了PHP中Theme函数的典型用法代码示例。如果您正苦于以下问题:PHP Theme函数的具体用法?PHP Theme怎么用?PHP Theme使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Theme函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tempSystem
function tempSystem($properties, $operand, $setValue)
{
switch ($operand) {
case 'getIP':
return $_SERVER['REMOTE_ADDR'];
break;
case 'getSESSION':
if ($_SERVER['HTTP_HOST'] == $properties->HTTP_HOST) {
$SESSIONID = $_COOKIE[$properties->_COOKIE_INIT_TEMP_LOCAL_SESSION];
} else {
$SESSIONID = $_COOKIE[$properties->_COOKIE_INIT_TEMP_REMOTE_SESSION];
}
return $SESSIONID;
break;
case '_INIT':
$ipaddress = $_SERVER['REMOTE_ADDR'];
include 'conf/connect.php';
if ($_SERVER['HTTP_HOST'] == $properties->HTTP_HOST) {
$SESSIONID = $_COOKIE[$properties->_COOKIE_INIT_TEMP_LOCAL_SESSION];
} else {
$SESSIONID = $_COOKIE[$properties->_COOKIE_INIT_TEMP_REMOTE_SESSION];
}
$GET_TEMP_BY_IP = mysql_query("SELECT * FROM {$properties->DB_PREFIX}tempsystem WHERE ip='" . $ipaddress . "' AND temp_session='" . $SESSIONID . "'");
if (mysql_num_rows($GET_TEMP_BY_IP) < 1) {
/* Temp User is not found; put a temp user in */
//make logged session id
$lsessionid = str_shuffle($ipaddress . rand("000000000000", "999999999999"));
//set session cookie that will expire in 20 years (it's ok)
if ($_SERVER['HTTP_HOST'] == $properties->HTTP_HOST) {
setcookie($properties->_COOKIE_INIT_TEMP_LOCAL_SESSION, $lsessionid, time() + 20 * 365 * 24 * 60 * 60, "/");
} else {
setcookie($properties->_COOKIE_INIT_TEMP_REMOTE_SESSION, $lsessionid, time() + 20 * 365 * 24 * 60 * 60, "/");
}
// set the defaulted theme in their temp user system table and update the rest
$defaultTheme = Theme($properties, "getDefaultThemeID", "", "");
mysql_query("INSERT INTO {$properties->DB_PREFIX}tempsystem(ip,lptoggle,is_searchable,fb_like,temp_session,themeID) VALUES('" . $ipaddress . "', '1','no','no','" . $lsessionid . "','" . $defaultTheme . "')") or die(mysql_error());
// REFRESH THE PAGE
//header("Refresh: .5"); as of 1.0.4b2 the default theme name gets put into the field in case no session id is found
} else {
while ($FETCH_TEMP_BY_IP = mysql_fetch_array($GET_TEMP_BY_IP)) {
/* GET DATA */
$lpToggle = $FETCH_TEMP_BY_IP['lptoggle'];
}
}
break;
case 'lpToggle':
$ipaddress = $_SERVER['REMOTE_ADDR'];
include 'conf/connect.php';
if ($setValue != "") {
/* set a new lptoggle value */
//if($setValue==1){$setValue="on";}else if($setValue==0){$setValue="off";}
mysql_query("UPDATE {$properties->DB_PREFIX}tempsystem SET lptoggle='" . $setValue . "' WHERE ip='" . $ipaddress . "'") or die(mysql_error());
} else {
$GET_TEMP_BY_IP = mysql_query("SELECT * FROM {$properties->DB_PREFIX}tempsystem WHERE ip=\"" . $ipaddress . "\"") or die(mysql_error());
while ($FETCH_TEMP_BY_IP = mysql_fetch_array($GET_TEMP_BY_IP)) {
$lpToggle = $FETCH_TEMP_BY_IP['lptoggle'];
}
return $lpToggle;
}
break;
}
}
示例2: __construct
/**
* Undocumented method.
*
* @todo Method __construct() needs a description.
*/
public function __construct()
{
$this->Application = '';
$this->ApplicationFolder = '';
$this->Assets = array();
$this->ControllerFolder = '';
$this->CssClass = '';
$this->Head = Gdn::Factory('Dummy');
$this->MasterView = '';
$this->ModuleSortContainer = '';
$this->OriginalRequestMethod = '';
$this->RedirectUrl = '';
$this->RequestMethod = '';
$this->RequestArgs = FALSE;
$this->Request = FALSE;
$this->SelfUrl = '';
$this->SyndicationMethod = SYNDICATION_NONE;
$this->Theme = Theme();
$this->ThemeOptions = Gdn::Config('Garden.ThemeOptions', array());
$this->View = '';
$this->_CssFiles = array();
$this->_JsFiles = array();
$this->_Definitions = array();
$this->_DeliveryMethod = DELIVERY_METHOD_XHTML;
$this->_DeliveryType = DELIVERY_TYPE_ALL;
$this->_FormSaved = '';
$this->_Json = array();
$this->_Headers = array('Cache-Control' => ' private, no-cache, no-store, must-revalidate', 'Expires' => 'Sat, 01 Jan 2000 00:00:00 GMT', 'Pragma' => 'no-cache', 'X-Garden-Version' => APPLICATION . ' ' . APPLICATION_VERSION, 'Content-Type' => Gdn::Config('Garden.ContentType', '') . '; charset=' . Gdn::Config('Garden.Charset', ''));
$this->_ErrorMessages = '';
$this->_InformMessages = array();
$this->StatusMessage = '';
parent::__construct();
$this->ControllerName = strtolower($this->ClassName);
}
示例3: SmartAsset
/**
* Takes the path to an asset (image, js file, css file, etc) and prepends the webroot.
*/
function SmartAsset($Destination = '', $WithDomain = FALSE, $AddVersion = FALSE)
{
$Destination = str_replace('\\', '/', $Destination);
if (substr($Destination, 0, 7) == 'http://' || substr($Destination, 0, 8) == 'https://') {
$Result = $Destination;
} else {
$Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
if (!$WithDomain) {
array_unshift($Parts, '/');
}
$Result = CombinePaths($Parts, '/');
}
if ($AddVersion) {
if (strpos($Result, '?') === FALSE) {
$Result .= '?';
} else {
$Result .= '&';
}
// Figure out which version to put after the asset.
$Version = APPLICATION_VERSION;
if (preg_match('`^/([^/]+)/([^/]+)/`', $Destination, $Matches)) {
$Type = $Matches[1];
$Key = $Matches[2];
static $ThemeVersion = NULL;
switch ($Type) {
case 'plugins':
$PluginInfo = Gdn::PluginManager()->GetPluginInfo($Key);
$Version = GetValue('Version', $PluginInfo, $Version);
break;
case 'themes':
if ($ThemeVersion === NULL) {
$ThemeInfo = Gdn::ThemeManager()->GetThemeInfo(Theme());
if ($ThemeInfo !== FALSE) {
$ThemeVersion = GetValue('Version', $ThemeInfo, $Version);
} else {
$ThemeVersion = $Version;
}
}
$Version = $ThemeVersion;
break;
}
}
$Result .= 'v=' . urlencode($Version);
}
return $Result;
}
示例4: __construct
/**
*
*/
public function __construct()
{
$this->Application = '';
$this->ApplicationFolder = '';
$this->Assets = array();
$this->CssClass = '';
$this->Data = array();
$this->Head = Gdn::factory('Dummy');
$this->internalMethods = array('addasset', 'addbreadcrumb', 'addcssfile', 'adddefinition', 'addinternalmethod', 'addjsfile', 'addmodule', 'allowjsonp', 'canonicalurl', 'clearcssfiles', 'clearjsfiles', 'contenttype', 'cssfiles', 'data', 'definitionlist', 'deliverymethod', 'deliverytype', 'description', 'errormessages', 'fetchview', 'fetchviewlocation', 'finalize', 'getasset', 'getimports', 'getjson', 'getstatusmessage', 'image', 'informmessage', 'intitialize', 'isinternal', 'jsfiles', 'json', 'jsontarget', 'masterview', 'pagename', 'permission', 'removecssfile', 'render', 'xrender', 'renderasset', 'renderdata', 'renderexception', 'rendermaster', 'sendheaders', 'setdata', 'setformsaved', 'setheader', 'setjson', 'setlastmodified', 'statuscode', 'title');
$this->MasterView = '';
$this->ModuleSortContainer = '';
$this->OriginalRequestMethod = '';
$this->RedirectUrl = '';
$this->RequestMethod = '';
$this->RequestArgs = false;
$this->Request = false;
$this->SelfUrl = '';
$this->SyndicationMethod = SYNDICATION_NONE;
$this->Theme = Theme();
$this->ThemeOptions = Gdn::config('Garden.ThemeOptions', array());
$this->View = '';
$this->_CssFiles = array();
$this->_JsFiles = array();
$this->_Definitions = array();
$this->_DeliveryMethod = DELIVERY_METHOD_XHTML;
$this->_DeliveryType = DELIVERY_TYPE_ALL;
$this->_FormSaved = '';
$this->_Json = array();
$this->_Headers = array('X-Garden-Version' => APPLICATION . ' ' . APPLICATION_VERSION, 'Content-Type' => Gdn::config('Garden.ContentType', '') . '; charset=' . C('Garden.Charset', 'utf-8'));
if (Gdn::session()->isValid()) {
$this->_Headers = array_merge($this->_Headers, array('Cache-Control' => 'private, no-cache, max-age=0, must-revalidate', 'Expires' => 'Sat, 01 Jan 2000 00:00:00 GMT', 'Pragma' => 'no-cache'));
}
$this->_ErrorMessages = '';
$this->_InformMessages = array();
$this->StatusMessage = '';
parent::__construct();
$this->ControllerName = strtolower($this->ClassName);
}
示例5: __construct
/**
* Undocumented method.
*
* @todo Method __construct() needs a description.
*/
public function __construct() {
$this->Application = '';
$this->ApplicationFolder = '';
$this->Assets = array();
$this->ControllerFolder = '';
$this->CssClass = '';
$this->Head = Gdn::Factory('Dummy');
$this->MasterView = '';
$this->ModuleSortContainer = '';
$this->OriginalRequestMethod = '';
$this->RedirectUrl = '';
$this->RequestMethod = '';
$this->RequestArgs = FALSE;
$this->Request = FALSE;
$this->SelfUrl = '';
$this->SyndicationMethod = SYNDICATION_NONE;
$this->Theme = Theme();
$this->ThemeOptions = Gdn::Config('Garden.ThemeOptions', array());
$this->View = '';
$this->_CssFiles = array();
$this->_JsFiles = array();
$this->_Definitions = array();
$this->_DeliveryMethod = DELIVERY_METHOD_XHTML;
$this->_DeliveryType = DELIVERY_TYPE_ALL;
$this->_FormSaved = '';
$this->_Json = array();
$this->_Headers = array(
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', // Make sure the client always checks at the server before using it's cached copy.
'X-Garden-Version' => APPLICATION.' '.APPLICATION_VERSION,
'Content-Type' => Gdn::Config('Garden.ContentType', '').'; charset='.Gdn::Config('Garden.Charset', ''), // PROPERLY ENCODE THE CONTENT
'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT' // PREVENT PAGE CACHING: always modified (this can be overridden by specific controllers)
// $Dispatcher->Header('Cache-Control', 'no-cache, must-revalidate'); // PREVENT PAGE CACHING: HTTP/1.1
// $Dispatcher->Header('Pragma', 'no-cache'); // PREVENT PAGE CACHING: HTTP/1.0
);
$this->_ErrorMessages = '';
$this->_InformMessages = array();
$this->StatusMessage = '';
parent::__construct();
$this->ControllerName = strtolower($this->ClassName);
}
示例6: smartAsset
/**
* Takes the path to an asset (image, js file, css file, etc) and prepends the web root.
*
* @param string $Destination The subpath of the asset.
* @param bool|string $WithDomain Whether or not to include the domain in the final URL.
* @param bool $AddVersion Whether or not to add a cache-busting version querystring parameter to the URL.
* @return string Returns the URL of the asset.
*/
function smartAsset($Destination = '', $WithDomain = false, $AddVersion = false)
{
$Destination = str_replace('\\', '/', $Destination);
if (IsUrl($Destination)) {
$Result = $Destination;
} else {
$Result = Gdn::Request()->UrlDomain($WithDomain) . Gdn::Request()->AssetRoot() . '/' . ltrim($Destination, '/');
}
if ($AddVersion) {
if (strpos($Result, '?') === false) {
$Result .= '?';
} else {
$Result .= '&';
}
// Figure out which version to put after the asset.
$Version = APPLICATION_VERSION;
if (preg_match('`^/([^/]+)/([^/]+)/`', $Destination, $Matches)) {
$Type = $Matches[1];
$Key = $Matches[2];
static $ThemeVersion = null;
switch ($Type) {
case 'plugins':
$PluginInfo = Gdn::PluginManager()->GetPluginInfo($Key);
$Version = GetValue('Version', $PluginInfo, $Version);
break;
case 'themes':
if ($ThemeVersion === null) {
$ThemeInfo = Gdn::ThemeManager()->GetThemeInfo(Theme());
if ($ThemeInfo !== false) {
$ThemeVersion = GetValue('Version', $ThemeInfo, $Version);
} else {
$ThemeVersion = $Version;
}
}
$Version = $ThemeVersion;
break;
}
}
$Result .= 'v=' . urlencode($Version);
}
return $Result;
}
示例7: assetVersion
/**
* Get a version string for a given asset.
*
* @param string $destination The path of the asset.
* @param string|null $version A known version for the asset or **null** to grab it from the addon's info array.
* @return string Returns a version string.
*/
function assetVersion($destination, $version = null)
{
static $gracePeriod = 90;
// Figure out which version to put after the asset.
if (is_null($version)) {
$version = APPLICATION_VERSION;
if (preg_match('`^/([^/]+)/([^/]+)/`', $destination, $matches)) {
$type = $matches[1];
$key = $matches[2];
static $themeVersion = null;
switch ($type) {
case 'plugins':
$pluginInfo = Gdn::pluginManager()->getPluginInfo($key);
$version = val('Version', $pluginInfo, $version);
break;
case 'applications':
$applicationInfo = Gdn::applicationManager()->getApplicationInfo(ucfirst($key));
$version = val('Version', $applicationInfo, $version);
break;
case 'themes':
if ($themeVersion === null) {
$themeInfo = Gdn::themeManager()->getThemeInfo(Theme());
if ($themeInfo !== false) {
$themeVersion = val('Version', $themeInfo, $version);
} else {
$themeVersion = $version;
}
}
$version = $themeVersion;
break;
}
}
}
// Add a timestamp component to the version if available.
if ($timestamp = c('Garden.Deployed')) {
$graced = $timestamp + $gracePeriod;
if (time() >= $graced) {
$timestamp = $graced;
}
$version .= '.' . dechex($timestamp);
}
return $version;
}
示例8: __construct
/**
* Undocumented method.
*
* @todo Method __construct() needs a description.
*/
public function __construct()
{
$this->Application = '';
$this->ApplicationFolder = '';
$this->Assets = array();
$this->ControllerFolder = '';
$this->CssClass = '';
$this->Head = Gdn::Factory('Dummy');
$this->MasterView = '';
$this->ModuleSortContainer = '';
$this->OriginalRequestMethod = '';
$this->RedirectUrl = '';
$this->RequestMethod = '';
$this->RequestArgs = FALSE;
$this->Request = FALSE;
$this->SelfUrl = '';
$this->StatusMessage = '';
$this->SyndicationMethod = SYNDICATION_NONE;
$this->Theme = Theme();
$this->ThemeOptions = Gdn::Config('Garden.ThemeOptions', array());
$this->View = '';
$this->_CssFiles = array();
$this->_JsFiles = array();
$this->_Definitions = array();
$this->_DeliveryMethod = DELIVERY_METHOD_XHTML;
$this->_DeliveryType = DELIVERY_TYPE_ALL;
$this->_Json = array();
$this->_Headers = array('Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'X-Garden-Version' => APPLICATION . ' ' . APPLICATION_VERSION, 'Content-Type' => Gdn::Config('Garden.ContentType', '') . '; charset=' . Gdn::Config('Garden.Charset', ''), 'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT');
parent::__construct();
$this->ControllerName = strtolower($this->ClassName);
}
示例9: Theme
if ($logged == 1) {
/* LOGGED IN */
$currthemeid = Theme($properties, "getCurrThemeNameUser", $ip, $SESSIONID);
//get the default themeid and work with that
$GET_THEME = mysql_query("SELECT * FROM {$properties->DB_PREFIX}themes WHERE name='" . $currthemeid . "'");
} else {
if ($logged == 0) {
/* NOT LOGGED IN */
$currthemeid = Theme($properties, "getCurrThemeNameTemp", $ip, $SESSIONID);
//get the default themeid and work with that
$GET_THEME = mysql_query("SELECT * FROM {$properties->DB_PREFIX}themes WHERE name='" . $currthemeid . "'");
}
}
} else {
/* THEME CHANGING IS LOCKED DOWN; D0 BASED ON DEFAULT */
$currthemeid = Theme($properties, "getDefaultThemeID", $ip, $SESSIONID);
//get the default themeid and work with that
$GET_THEME = mysql_query("SELECT * FROM {$properties->DB_PREFIX}themes WHERE id='" . $currthemeid . "'");
}
while ($FETCH_THEME = mysql_fetch_array($GET_THEME)) {
$CURRTHEME = $FETCH_THEME['name'];
}
$directories = array_diff(scandir(@$THEME_NAME . "images/walls/" . getGlobalVars($properties, 'walls_pack_name') . "/"), array('.', '..', '.DS_STORE'));
// this specifies what to get and what not to get
foreach ($directories as $directory) {
$wall .= $directory . ",";
}
//$wall=getGlobalVars($properties,'walls_list');
$wall_list = explode(",", $wall);
$START = rand(0, count($wall_list) - 1);
for ($i = $START; $i < count($wall_list) - 1; $i++) {
示例10: converter
function converter($properties, $content, $type, $operand)
{
@($ip = $_SERVER['REMOTE_ADDR']);
@($SESSIONID = tempSystem($properties, "getSESSION", ""));
if ($_SERVER['HTTP_HOST'] == "localhost") {
$WEBSITE_URL = $properties->WEBSITE_TEST_URL;
} else {
$WEBSITE_URL = $properties->WEBSITE_REMO_URL;
}
switch ($operand) {
case 'to':
switch ($type) {
case 'url':
/* before spaces */
$content = str_replace("-", "[hy]", $content);
/* spaces */
$content = str_replace(" ", "-", $content);
/* special characters */
$content = str_replace("!", "@", $content);
$content = str_replace(".", "~", $content);
$content = str_replace("#", "+", $content);
$content = str_replace("+", "[PLUS]", $content);
$content = str_replace(":", "[colon]", $content);
$content = str_replace("'", "[sq]", $content);
break;
case 'article':
/* INSERT NOTION HERE */
$content = str_replace(" ", " ", $content);
/* READ MORE FUNCTIONAL */
if (strstr($content, "[!--more--]") != "") {
$MOREPOS = strpos($content, "[!--more--]");
$content = substr($content, 0, $MOREPOS);
}
break;
case 'previewarticle':
/* INSERT NOTION HERE */
$content = str_replace(" ", " ", $content);
/* PREVIEW */
$content = substr($content, 0, 200);
$content = str_replace("<h1>", "<strong>", $content);
$content = str_replace("</h1>", "</strong><br />", $content);
$content = str_replace("<h2>", "", $content);
$content = str_replace("</h2>", "", $content);
$content = str_replace("<h3>", "", $content);
$content = str_replace("</h3>", "", $content);
$content = str_replace("<h4>", "", $content);
$content = str_replace("</h4>", "", $content);
$content = str_replace("<h5>", "", $content);
$content = str_replace("</h5>", "", $content);
$content = str_replace("<p>", "", $content);
$content = str_replace("</p>", "", $content);
$content = str_replace("[!--more--]", "", $content);
break;
case 'fullarticle':
/* FULL ARTICLE FUNCTIONAL */
$content = str_replace("[!--more--]", " ", $content);
$content = str_replace("[leftarrow]", "<", $content);
$content = str_replace("[rightarrow]", ">", $content);
break;
case 'basic':
/* INSERT NOTION HERE */
@($launchpad = $_GET['launchpad']);
$content = str_replace("(baseurl)", $WEBSITE_URL, $content);
$content = str_replace("(homelp)", $properties->PADMAIN, $content);
$content = str_replace("(currentlp)", $launchpad, $content);
$content = str_replace("(stylesheet)", Theme($properties, "getCurrThemeName", $ip, $SESSIONID), $content);
$content = str_replace("(entry_name)", @$title, $content);
$content = str_replace("(signature)", getGlobalVars($properties, "autoresponder_closing_line"), $content);
/* READ MORE FUNCTIONAL */
if (strstr($content, "[!--more--]") != "") {
$MOREPOS = strpos($content, "[!--more--]");
$content = substr($content, 0, $MOREPOS);
}
break;
case 'ncode':
/* INSERT NOTION HERE */
$content = str_replace("[code]", "<?php", $content);
$content = str_replace("[/code]", "?> ", $content);
/* READ MORE FUNCTIONAL */
if (strstr($content, "[!--more--]") != "") {
$MOREPOS = strpos($content, "[!--more--]");
$content = substr($content, 0, $MOREPOS);
}
/* YOUTUBE FUNCTIONAL */
//<iframe width="560" height="315" src="http://www.youtube.com/embed/hDlif8Km4S4" frameborder="0" allowfullscreen></iframe>
//get the y_id
//[youtube]fdsafdasf[/youtube]
//0123456789012345678901234567
//count how many appearances of [youtube] in content
$num_of_a_youtube = substr_count($content, "[youtube id=");
if ($num_of_a_youtube > 1) {
/* multiple youtubes */
for ($i = 1; $i <= $num_of_a_youtube; $i++) {
$y_id = substr($content, strpos($content, "[youtube id={$i}") + 14, 11);
$content = str_replace("[youtube id=" . $i . "]" . $y_id . "[/youtube]", "<br /><br /><center><iframe width=\"100%\" height=\"175%\" src=\"http://www.youtube.com/embed/" . $y_id . "\" frameborder=\"0\" allowfullscreen></iframe></center><br /><br />", $content);
}
} else {
/* one youtube */
//$y_id="UYrkQL1bX4A";
$id_of_youtube = substr($content, strpos($content, "[youtube id=") + 12, 1);
//.........这里部分代码省略.........