本文整理汇总了PHP中eZSys::wwwDir方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::wwwDir方法的具体用法?PHP eZSys::wwwDir怎么用?PHP eZSys::wwwDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::wwwDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eZTemplateImageOperator
function eZTemplateImageOperator($texttoimageName = "texttoimage", $imageName = "image", $imagefileName = "imagefile")
{
$this->Operators = array($texttoimageName, $imageName, $imagefileName);
$ini = eZINI::instance('texttoimage.ini');
$fontDirs = $ini->variable("PathSettings", "FontDir");
$this->FontDir = array();
foreach ($fontDirs as $fontDir) {
$this->FontDir[] = $fontDir;
}
$this->CacheDir = $ini->variable("PathSettings", "CacheDir");
$this->HTMLDir = eZSys::wwwDir() . $ini->variable("PathSettings", "HtmlDir");
$this->DefaultClass = 'default';
$this->Family = "arial";
$this->Colors = array("bgcolor" => array(255, 255, 255), "textcolor" => array(0, 0, 0));
$this->PointSize = 12;
$this->Angle = 0;
$this->XAdjust = 0;
$this->YAdjust = 0;
$this->WAdjust = 0;
$this->HAdjust = 0;
$this->UseCache = true;
if ($ini->variable("ImageSettings", "UseCache") == "disabled") {
$this->UseCache = false;
}
$functions = array("ImageTTFBBox", "ImageCreate", "ImageColorAllocate", "ImageColorAllocate", "ImageTTFText", "ImagePNG", "ImageJPEG", "ImageDestroy");
$this->MissingGDFunctions = array();
foreach ($functions as $function) {
if (!function_exists($function)) {
$this->MissingGDFunctions[] = $function;
}
}
$this->ImageGDSupported = count($this->MissingGDFunctions) == 0;
}
示例2: extension_path
/**
* Loose extension path function for include use originally from ezextension.php
*
* @deprecated Since 4.3
*/
function extension_path($extension, $withWWWDir = false, $withHost = false, $withProtocol = false)
{
$base = eZExtension::baseDirectory();
$path = '';
if ($withProtocol) {
if (is_string($withProtocol)) {
$path .= $withProtocol;
} else {
$path .= eZSys::serverProtocol();
}
$path .= ':';
}
if ($withHost) {
$path .= '//';
if (is_string($withHost)) {
$path .= $withHost;
} else {
$path .= eZSys::hostname();
}
}
if ($withWWWDir) {
$path .= eZSys::wwwDir();
}
if ($withWWWDir) {
$path .= '/' . $base . '/' . $extension;
} else {
$path .= $base . '/' . $extension;
}
return $path;
}
示例3: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case 'parsexml':
$firstParam = $namedParameters['first_param'];
if (trim($operatorValue) != '') {
$dom = new DOMDocument('1.0', 'utf-8');
if ($dom->loadXML($operatorValue)) {
$FileAttributeValue = $dom->getElementsByTagName($firstParam)->item(0)->textContent;
if (!$FileAttributeValue) {
$FileAttributeValue = $dom->getElementsByTagName($firstParam)->item(0)->getAttribute('value');
}
}
$operatorValue = $FileAttributeValue;
}
break;
case 'filecheck':
if (trim($operatorValue) != '') {
$dom = new DOMDocument('1.0', 'utf-8');
if ($dom->loadXML($operatorValue)) {
$FileAttributeValue = $dom->getElementsByTagName('Filename')->item(0)->textContent;
if (!$FileAttributeValue) {
$FileAttributeValue = $dom->getElementsByTagName('Filename')->item(0)->getAttribute('value');
}
}
if (file_exists(eZSys::wwwDir() . $FileAttributeValue)) {
$operatorValue = true;
} else {
$operatorValue = false;
}
}
break;
}
}
示例4: setUserHashCookie
/**
* Sets a cookie with the current user hash
*
* @param bool $unsetCookie controls whether to remove the cookie
*/
public static function setUserHashCookie($unsetCookie = false)
{
$wwwDir = eZSys::wwwDir();
// On host based site accesses this can be empty, causing the cookie to be set for the current dir,
// but we want it to be set for the whole eZ publish site
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
if (eZUser::isCurrentUserRegistered()) {
setcookie('vuserhash', self::getUserHash($newSession), 0, $cookiePath);
} elseif ($unsetCookie) {
//removes cookie
setcookie('vuserhash', '0', 1, $cookiePath);
}
}
示例5: getWwwDir
protected static function getWwwDir()
{
static $wwwDir = null;
if ($wwwDir === null) {
$wwwDir = eZSys::wwwDir() . '/';
}
return $wwwDir;
}
示例6: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case "wordtoimage":
$ini = eZINI::instance("wordtoimage.ini");
$iconRoot = $ini->variable('WordToImageSettings', 'IconRoot');
$replaceText = $ini->variable('WordToImageSettings', 'ReplaceText');
$replaceIcon = $ini->variable('WordToImageSettings', 'ReplaceIcon');
$wwwDirPrefix = "";
if (strlen(eZSys::wwwDir()) > 0) {
$wwwDirPrefix = eZSys::wwwDir() . "/";
}
foreach ($replaceIcon as $icon) {
// Issue 015718, constructing alt text from icon name
$aReplaceIconName = explode('.', $icon);
$altText = $aReplaceIconName[0];
$icons[] = '<img src="' . $wwwDirPrefix . $iconRoot . '/' . $icon . '" alt="' . $altText . '"/>';
}
$operatorValue = str_replace($replaceText, $icons, $operatorValue);
break;
// icon_info( <type> ) => array() containing:
// - repository - Repository path
// - theme - Theme name
// - theme_path - Theme path
// - size_path_list - Associative array of size paths
// - size_info_list - Associative array of size info (width and height)
// - icons - Array of icon files, relative to theme and size path
// - default - Default icon file, relative to theme and size path
// icon_info( <type> ) => array() containing:
// - repository - Repository path
// - theme - Theme name
// - theme_path - Theme path
// - size_path_list - Associative array of size paths
// - size_info_list - Associative array of size info (width and height)
// - icons - Array of icon files, relative to theme and size path
// - default - Default icon file, relative to theme and size path
case 'icon_info':
if (!isset($operatorParameters[0])) {
$tpl->missingParameter($operatorName, 'type');
return;
}
$type = $tpl->elementValue($operatorParameters[0], $rootNamespace, $currentNamespace);
// Check if we have it cached
if (isset($this->IconInfo[$type])) {
$operatorValue = $this->IconInfo[$type];
return;
}
$ini = eZINI::instance('icon.ini');
$repository = $ini->variable('IconSettings', 'Repository');
$theme = $ini->variable('IconSettings', 'Theme');
$groups = array('mimetype' => 'MimeIcons', 'class' => 'ClassIcons', 'classgroup' => 'ClassGroupIcons', 'action' => 'ActionIcons', 'icon' => 'Icons');
$configGroup = $groups[$type];
$mapNames = array('mimetype' => 'MimeMap', 'class' => 'ClassMap', 'classgroup' => 'ClassGroupMap', 'action' => 'ActionMap', 'icon' => 'IconMap');
$mapName = $mapNames[$type];
// Check if the specific icon type has a theme setting
if ($ini->hasVariable($configGroup, 'Theme')) {
$theme = $ini->variable($configGroup, 'Theme');
}
// Load icon settings from the theme
$themeINI = eZINI::instance('icon.ini', $repository . '/' . $theme);
$sizes = $themeINI->variable('IconSettings', 'Sizes');
if ($ini->hasVariable('IconSettings', 'Sizes')) {
$sizes = array_merge($sizes, $ini->variable('IconSettings', 'Sizes'));
}
$sizePathList = array();
$sizeInfoList = array();
if (is_array($sizes)) {
foreach ($sizes as $key => $size) {
$pathDivider = strpos($size, ';');
if ($pathDivider !== false) {
$sizePath = substr($size, $pathDivider + 1);
$size = substr($size, 0, $pathDivider);
} else {
$sizePath = $size;
}
$width = false;
$height = false;
$xDivider = strpos($size, 'x');
if ($xDivider !== false) {
$width = (int) substr($size, 0, $xDivider);
$height = (int) substr($size, $xDivider + 1);
}
$sizePathList[$key] = $sizePath;
$sizeInfoList[$key] = array($width, $height);
}
}
$map = array();
// Load mapping from theme
if ($themeINI->hasVariable($configGroup, $mapName)) {
$map = array_merge($map, $themeINI->variable($configGroup, $mapName));
}
// Load override mappings if they exist
if ($ini->hasVariable($configGroup, $mapName)) {
$map = array_merge($map, $ini->variable($configGroup, $mapName));
}
$default = false;
if ($themeINI->hasVariable($configGroup, 'Default')) {
$default = $themeINI->variable($configGroup, 'Default');
}
if ($ini->hasVariable($configGroup, 'Default')) {
//.........这里部分代码省略.........
示例7: setCookie
public static function setCookie()
{
$ini = eZINI::instance('scachecookie.ini');
$siteIni = eZINI::instance('site.ini');
$hasUserData = false;
$displayedData = $ini->variable('CacheCookieSettings', 'DisplayedData');
$cookieValue = $ini->variable('CacheCookieSettings', 'CookieValue') || 'true';
if ($cookieValue === true) {
$cookieValue = 'true';
}
$useDetailedValue = $ini->variable('CacheCookieSettings', 'DetailedCookieValue') == 'enabled';
$detailedValue = '';
if (in_array('basket', $displayedData)) {
$http = eZHTTPTool::instance();
$sessionID = $http->sessionID();
$basket = eZBasket::fetch($sessionID);
if ($basket) {
if (!$basket->isEmpty()) {
$hasUserData = true;
if ($useDetailedValue) {
$detailedValue .= ',basket';
}
}
}
}
if ((!$hasUserData || $useDetailedValue) && in_array('wishlist', $displayedData)) {
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
$WishListArray = eZPersistentObject::fetchObjectList(eZWishList::definition(), null, array("user_id" => $userID), null, null, true);
if (count($WishListArray) > 0) {
if ($WishListArray[0]->itemCount() > 0) {
$hasUserData = true;
if ($useDetailedValue) {
$detailedValue .= ',wishlist';
}
}
}
}
if (!$hasUserData || $useDetailedValue) {
$prefs = eZPreferences::values();
$hasPrefs = false;
foreach ($prefs as $key => $val) {
if ($key != '') {
if (in_array('preferences', $displayedData) || in_array($key, $displayedData)) {
if ($val != '') {
$hasUserData = true;
if ($useDetailedValue) {
if (in_array('preferences', $displayedData) && !$hasPrefs) {
$detailedValue .= ',preferences';
}
if (in_array($key, $displayedData)) {
$detailedValue .= ",{$key}:{$val}";
}
}
$hasPrefs = true;
}
}
}
}
}
$value = $hasUserData ? $cookieValue . $detailedValue : false;
$wwwDir = eZSys::wwwDir();
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
setcookie($ini->variable('CacheCookieSettings', 'CookieName'), $value, time() + (int) $siteIni->variable('Session', 'SessionTimeout'), $cookiePath);
}
示例8: array
}
$mail->setSubject($subject);
//BEGIN ENHANCED BINARY EXTENSION MAIL CODE ADDITION
$fileAttachments = array();
foreach (array_keys($contentObjectAttributes) as $key) {
if ($contentObjectAttributes[$key]->DataTypeString == "enhancedezbinaryfile") {
$id = $contentObjectAttributes[$key]->attribute('id');
$xmlText = $collectionAttributes[$id]->DataText;
if (trim($xmlText) != '') {
$dom = new DOMDocument('1.0', 'utf-8');
if ($dom->loadXML($xmlText)) {
$OriginalFilename = $dom->getElementsByTagName('OriginalFilename')->item(0)->textContent;
$FileType = $dom->getElementsByTagName('Type')->item(0)->textContent;
$Filename = $dom->getElementsByTagName('Filename')->item(0)->textContent;
if (file_exists(eZSys::wwwDir() . $Filename)) {
$fileAttachments[] = array(eZSys::wwwDir() . $Filename, $OriginalFilename, $FileType);
}
}
}
}
}
if (count($fileAttachments) != 0) {
$mime_boundary = "==Multipart_Boundary_" . md5(time());
//Plain Text part of Message
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; " . eZTextCodec::internalCharset() . "\n" . "Content-Transfer-Encoding: 8bit\n\n";
//Form Result
$message .= $templateResult;
//Attachment(s) part of message
foreach ($fileAttachments as $attacharray) {
$filedata = chunk_split(base64_encode(eZFile::getContents($attacharray[0])));
$message .= "\n\n\n--{$mime_boundary}\n" . "Content-Type: " . $attacharray[2] . ";\n" . " name=\"" . $attacharray[1] . "\"\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: inline;\n" . " filename=\"" . $attacharray[1] . "\"\n\n" . $filedata . "\n";
示例9: createSiteaccessUrls
function createSiteaccessUrls( $params )
{
$urlList = array();
$siteaccessList = $params['siteaccess_list'];
$accessType = $params['access_type'];
$accessTypeValue = $params['access_type_value'];
$excludePortList = isset( $params['exclude_port_list'] ) ? $params['exclude_port_list'] : array();
$hostname = false;
if ( isset( $params['host'] ) && $params['host'] !== '' )
$hostname = $this->extractHostname( $params['host'] );
if ( !$hostname )
$hostname = eZSys::hostname();
$indexFile = eZSys::wwwDir() . eZSys::indexFileName();
switch( $accessType )
{
case 'port':
{
$port = $accessTypeValue;
// build urls
foreach( $siteaccessList as $siteaccess )
{
// skip ports which are already in use
while( in_array( $port, $excludePortList ) )
++$port;
$urlList[$siteaccess]['url'] = "$hostname:$port" . $indexFile;
$urlList[$siteaccess]['port'] = $port;
++$port;
}
}
break;
case 'host':
case 'hostname':
{
$prependSiteAccess = isset( $params['host_prepend_siteaccess'] ) && is_bool( $params['host_prepend_siteaccess'] ) ? $params['host_prepend_siteaccess'] : true;
$hostname = $this->extractHostname( $accessTypeValue );
if ( !$hostname )
$hostname = $accessTypeValue;
foreach( $siteaccessList as $siteaccess )
{
if ( $prependSiteAccess )
{
// replace undescores with dashes( '_' -> '-' );
$hostPrefix = preg_replace( '/(_)/', '-', $siteaccess);
// create url and host
$urlList[$siteaccess]['url'] = $hostPrefix . '.' . $hostname . $indexFile;
$urlList[$siteaccess]['host'] = $hostPrefix . '.' . $hostname;
}
else
{
// create url and host
$urlList[$siteaccess]['url'] = $hostname . $indexFile;
$urlList[$siteaccess]['host'] = $hostname;
}
}
}
break;
case 'url':
case 'uri':
{
foreach( $siteaccessList as $siteaccess )
{
$urlList[$siteaccess]['url'] = $hostname . $indexFile . '/' . $siteaccess;
}
}
break;
default:
break;
}
return $urlList;
}
示例10: run
/**
* Execution point for controller actions
*/
public function run()
{
ob_start();
$this->requestInit();
// send header information
foreach (eZHTTPHeader::headerOverrideArray($this->uri) + array('Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT', 'Cache-Control' => 'no-cache, must-revalidate', 'Pragma' => 'no-cache', 'X-Powered-By' => 'eZ Publish', 'Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Served-by' => $_SERVER["SERVER_NAME"], 'Content-language' => $this->languageCode) as $key => $value) {
header($key . ': ' . $value);
}
try {
$moduleResult = $this->dispatchLoop();
} catch (Exception $e) {
$this->shutdown();
throw $e;
}
$ini = eZINI::instance();
/**
* Ouput an is_logged_in cookie when users are logged in for use by http cache solutions.
*
* @deprecated As of 4.5, since 4.4 added lazy session support (init on use)
*/
if ($ini->variable("SiteAccessSettings", "CheckValidity") !== 'true') {
$currentUser = eZUser::currentUser();
$wwwDir = eZSys::wwwDir();
// On host based site accesses this can be empty, causing the cookie to be set for the current dir,
// but we want it to be set for the whole eZ publish site
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
if ($currentUser->isLoggedIn()) {
// Only set the cookie if it doesnt exist. This way we are not constantly sending the set request in the headers.
if (!isset($_COOKIE['is_logged_in']) || $_COOKIE['is_logged_in'] !== 'true') {
setcookie('is_logged_in', 'true', 0, $cookiePath);
}
} else {
if (isset($_COOKIE['is_logged_in'])) {
setcookie('is_logged_in', false, 0, $cookiePath);
}
}
}
if ($this->module->exitStatus() == eZModule::STATUS_REDIRECT) {
$this->redirect();
}
// Store the last URI for access history for login redirection
// Only if user has session and only if there was no error or no redirects happen
if (eZSession::hasStarted() && $this->module->exitStatus() == eZModule::STATUS_OK) {
$currentURI = $this->completeRequestedURI;
if (strlen($currentURI) > 0 && $currentURI[0] !== '/') {
$currentURI = '/' . $currentURI;
}
$lastAccessedURI = "";
$lastAccessedViewURI = "";
$http = eZHTTPTool::instance();
// Fetched stored session variables
if ($http->hasSessionVariable("LastAccessesURI")) {
$lastAccessedViewURI = $http->sessionVariable("LastAccessesURI");
}
if ($http->hasSessionVariable("LastAccessedModifyingURI")) {
$lastAccessedURI = $http->sessionVariable("LastAccessedModifyingURI");
}
// Update last accessed view page
if ($currentURI != $lastAccessedViewURI && !in_array($this->module->uiContextName(), array('edit', 'administration', 'browse', 'authentication'))) {
$http->setSessionVariable("LastAccessesURI", $currentURI);
}
// Update last accessed non-view page
if ($currentURI != $lastAccessedURI) {
$http->setSessionVariable("LastAccessedModifyingURI", $currentURI);
}
}
eZDebug::addTimingPoint("Module end '" . $this->module->attribute('name') . "'");
if (!is_array($moduleResult)) {
eZDebug::writeError('Module did not return proper result: ' . $this->module->attribute('name'), 'index.php');
$moduleResult = array();
$moduleResult['content'] = false;
}
if (!isset($moduleResult['ui_context'])) {
$moduleResult['ui_context'] = $this->module->uiContextName();
}
$moduleResult['ui_component'] = $this->module->uiComponentName();
$moduleResult['is_mobile_device'] = $this->mobileDeviceDetect->isMobileDevice();
$moduleResult['mobile_device_alias'] = $this->mobileDeviceDetect->getUserAgentAlias();
$templateResult = null;
eZDebug::setUseExternalCSS($this->siteBasics['external-css']);
if ($this->siteBasics['show-page-layout']) {
$tpl = eZTemplate::factory();
if ($tpl->hasVariable('node')) {
$tpl->unsetVariable('node');
}
if (!isset($moduleResult['path'])) {
$moduleResult['path'] = false;
}
$moduleResult['uri'] = eZSys::requestURI();
$tpl->setVariable("module_result", $moduleResult);
$meta = $ini->variable('SiteSettings', 'MetaDataArray');
if (!isset($meta['description'])) {
$metaDescription = "";
if (isset($moduleResult['path']) && is_array($moduleResult['path'])) {
foreach ($moduleResult['path'] as $pathPart) {
if (isset($pathPart['text'])) {
$metaDescription .= $pathPart['text'] . " ";
//.........这里部分代码省略.........
示例11: generateStatistics
static function generateStatistics($as_html = true)
{
$statStartTime = microtime(true);
$stats = '';
if (!eZTemplate::isTemplatesUsageStatisticsEnabled()) {
return $stats;
}
if ($as_html) {
$stats .= "<h2>Templates used to render the page:</h2>";
$stats .= "<table id='templateusage' summary='List of used templates' style='border: 1px dashed black;' cellspacing='0'>" . "<tr><th>Usage count</th>" . "<th>Requested template</th>" . "<th>Template</th>" . "<th>Template loaded</th>" . "<th>Edit</th>" . "<th>Override</th></tr>";
} else {
$formatString = "%-40s%-40s%-40s\n";
$stats .= "Templates usage statistics\n";
$stats .= sprintf($formatString, 'Templates', 'Requested template', 'Template loaded');
}
if ($as_html) {
$iconSizeX = 16;
$iconSizeY = 16;
$templateViewFunction = 'visual/templateview';
eZURI::transformURI($templateViewFunction);
$templateEditFunction = 'visual/templateedit';
eZURI::transformURI($templateEditFunction);
$templateOverrideFunction = 'visual/templatecreate';
eZURI::transformURI($templateOverrideFunction);
$std_base = eZTemplateDesignResource::designSetting('standard');
$wwwDir = eZSys::wwwDir();
$editIconFile = "{$wwwDir}/design/{$std_base}/images/edit.gif";
$overrideIconFile = "{$wwwDir}/design/{$std_base}/images/override-template.gif";
$tdClass = 'used_templates_stats1';
$j = 0;
$currentSiteAccess = $GLOBALS['eZCurrentAccess']['name'];
}
$templatesUsageStatistics = eZTemplate::templatesUsageStatistics();
$alreadyListedTemplate = $templateCounts = array();
//Generate usage count for each unique template first.
foreach ($templatesUsageStatistics as $templateInfo) {
$actualTemplateName = $templateInfo['actual-template-name'];
if (!array_key_exists($actualTemplateName, $templateCounts)) {
$templateCounts[$actualTemplateName] = 1;
} else {
++$templateCounts[$actualTemplateName];
}
}
//Then create the actual listing
foreach ($templatesUsageStatistics as $templateInfo) {
$actualTemplateName = $templateInfo['actual-template-name'];
$requestedTemplateName = $templateInfo['requested-template-name'];
$templateFileName = $templateInfo['template-filename'];
if (!in_array($actualTemplateName, $alreadyListedTemplate)) {
$alreadyListedTemplate[] = $actualTemplateName;
if ($as_html) {
$tdClass = $j % 2 == 0 ? 'used_templates_stats1' : 'used_templates_stats2';
$requestedTemplateViewURI = $templateViewFunction . '/' . $requestedTemplateName;
$actualTemplateViewURI = $templateViewFunction . '/' . $actualTemplateName;
$templateEditURI = $templateEditFunction . '/' . $templateFileName;
$templateOverrideURI = $templateOverrideFunction . '/' . $actualTemplateName;
$actualTemplateNameOutput = $actualTemplateName == $requestedTemplateName ? "<span style=\"font-style: italic;\"><No override></span>" : $actualTemplateName;
$stats .= "<tr><td class=\"{$tdClass}\" style=\"text-align: center;\">{$templateCounts[$actualTemplateName]}</td>" . "<td class=\"{$tdClass}\"><a href=\"{$requestedTemplateViewURI}\">{$requestedTemplateName}</a></td>" . "<td class=\"{$tdClass}\">{$actualTemplateNameOutput}</td>" . "<td class=\"{$tdClass}\">{$templateFileName}</td>" . "<td class=\"{$tdClass}\" align=\"center\"><a href=\"{$templateEditURI}/(siteAccess)/{$currentSiteAccess}\"><img src=\"{$editIconFile}\" width=\"{$iconSizeX}\" height=\"{$iconSizeY}\" alt=\"Edit template\" title=\"Edit template\" /></a></td>" . "<td class=\"{$tdClass}\" align=\"center\"><a href=\"{$templateOverrideURI}/(siteAccess)/{$currentSiteAccess}\"><img src=\"{$overrideIconFile}\" width=\"{$iconSizeX}\" height=\"{$iconSizeY}\" alt=\"Override template\" title=\"Override template\" /></a></td></tr>";
$j++;
} else {
$stats .= sprintf($formatString, $requestedTemplateName, $actualTemplateName, $templateFileName);
}
}
}
$totalTemplatesCount = count($templatesUsageStatistics);
$totalUniqueTemplatesCopunt = count(array_keys($alreadyListedTemplate));
$statEndTime = microtime(true);
$timeUsage = number_format($statEndTime - $statStartTime, 4);
if ($as_html) {
$stats .= "<tr><td class=\"{$tdClass}\"> </td>" . "<td class=\"{$tdClass}\"> </td>" . "<td class=\"{$tdClass}\"> </td>" . "<td class=\"{$tdClass}\"> </td>" . "<td class=\"{$tdClass}\"> </td>" . "<td class=\"{$tdClass}\"> </td></tr>";
$stats .= "<tr><td colspan=\"2\" style=\"text-align: left;\"><b> Number of times templates used: {$totalTemplatesCount}<br /> Number of unique templates used: {$totalUniqueTemplatesCopunt}</b></td></tr>";
$stats .= "<tr><td colspan=\"2\" style=\"text-align: left;\"><b> Time used to render template usage: {$timeUsage} secs</b></td></tr>";
$stats .= "</table>";
} else {
$stats .= "\nTotal templates count: " . $totalTemplatesCount . "\n" . "Total unique templates count: " . $totalUniqueTemplatesCopunt . "\n";
}
return $stats;
}
示例12: getServerURL
public static function getServerURL()
{
if ( self::$serverURL === null )
{
$oeini = eZINI::instance( 'ezoe.ini' );
if ( $oeini->hasVariable( 'SystemSettings', 'RelativeURL' ) &&
$oeini->variable( 'SystemSettings', 'RelativeURL' ) === 'enabled' )
{
self::$serverURL = eZSys::wwwDir();
if ( self::$serverURL === '/' )
self::$serverURL = '';
}
else
{
$domain = eZSys::hostname();
$protocol = 'http';
// Default to https if SSL is enabled
// Check if SSL port is defined in site.ini
$sslPort = 443;
$ini = eZINI::instance();
if ( $ini->hasVariable( 'SiteSettings', 'SSLPort' ) )
$sslPort = $ini->variable( 'SiteSettings', 'SSLPort' );
if ( eZSys::serverPort() == $sslPort )
$protocol = 'https';
self::$serverURL = $protocol . '://' . $domain . eZSys::wwwDir();
}
}
return self::$serverURL;
}
示例13: getDesignFile
/**
* Internal function to get current index dir
*
* @return string
*/
protected static function getDesignFile($file)
{
static $bases = null;
static $wwwDir = null;
if ($bases === null) {
$bases = eZTemplateDesignResource::allDesignBases();
}
if ($wwwDir === null) {
$wwwDir = eZSys::wwwDir() . '/';
}
$triedFiles = array();
$match = eZTemplateDesignResource::fileMatch($bases, '', $file, $triedFiles);
if ($match === false) {
eZDebug::writeWarning("Could not find: {$file}", __METHOD__);
return false;
}
return $wwwDir . htmlspecialchars($match['path']);
}
示例14: generateStatistics
static function generateStatistics($as_html = true)
{
$stats = '';
if (!eZTemplate::isTemplatesUsageStatisticsEnabled()) {
return $stats;
}
if ($as_html) {
$stats .= "<h3>Templates used to render the page:</h3>";
$stats .= "<table id='templateusage' class='debug_resource_usage' title='List of used templates'>" . "<tr><th title='Usage count of this particular template'>Usage</th>" . "<th>Requested template</th>" . "<th>Template</th>" . "<th>Template loaded</th>" . "<th>Edit</th>" . "<th>Override</th></tr>";
} else {
$formatString = "%-40s%-40s%-40s\n";
$stats .= "Templates usage statistics\n";
$stats .= sprintf($formatString, 'Templates', 'Requested template', 'Template loaded');
}
if ($as_html) {
$iconSizeX = 16;
$iconSizeY = 16;
$templateViewFunction = 'visual/templateview';
eZURI::transformURI($templateViewFunction);
$templateEditFunction = 'visual/templateedit';
eZURI::transformURI($templateEditFunction);
$templateOverrideFunction = 'visual/templatecreate';
eZURI::transformURI($templateOverrideFunction);
$std_base = eZTemplateDesignResource::designSetting('standard');
$wwwDir = htmlspecialchars(eZSys::wwwDir(), ENT_COMPAT, 'UTF-8');
$editIconFile = "{$wwwDir}/design/{$std_base}/images/edit.gif";
$overrideIconFile = "{$wwwDir}/design/{$std_base}/images/override-template.gif";
$tdClass = 'used_templates_stats1';
$j = 0;
$currentSiteAccess = $GLOBALS['eZCurrentAccess']['name'];
}
$templatesUsageStatistics = eZTemplate::templatesUsageStatistics();
$alreadyListedTemplate = $templateCounts = array();
//Generate usage count for each unique template first.
foreach ($templatesUsageStatistics as $templateInfo) {
$actualTemplateName = $templateInfo['actual-template-name'];
if (!array_key_exists($actualTemplateName, $templateCounts)) {
$templateCounts[$actualTemplateName] = 1;
} else {
++$templateCounts[$actualTemplateName];
}
}
//Then create the actual listing
foreach ($templatesUsageStatistics as $templateInfo) {
$actualTemplateName = $templateInfo['actual-template-name'];
$requestedTemplateName = $templateInfo['requested-template-name'];
$templateFileName = $templateInfo['template-filename'];
if (!in_array($actualTemplateName, $alreadyListedTemplate)) {
$alreadyListedTemplate[] = $actualTemplateName;
if ($as_html) {
$requestedTemplateViewURI = $templateViewFunction . '/' . $requestedTemplateName;
$actualTemplateViewURI = $templateViewFunction . '/' . $actualTemplateName;
$templateEditURI = $templateEditFunction . '/' . $templateFileName;
$templateOverrideURI = $templateOverrideFunction . '/' . $actualTemplateName;
$actualTemplateNameOutput = $actualTemplateName == $requestedTemplateName ? "<em><No override></em>" : $actualTemplateName;
$stats .= "<tr class='data'><td>{$templateCounts[$actualTemplateName]}</td>" . "<td><a href=\"{$requestedTemplateViewURI}\">{$requestedTemplateName}</a></td>" . "<td>{$actualTemplateNameOutput}</td>" . "<td>{$templateFileName}</td>" . "<td><a href=\"{$templateEditURI}/(siteAccess)/{$currentSiteAccess}\"><img src=\"{$editIconFile}\" width=\"{$iconSizeX}\" height=\"{$iconSizeY}\" alt=\"Edit template\" title=\"Edit template\" /></a></td>" . "<td><a href=\"{$templateOverrideURI}/(siteAccess)/{$currentSiteAccess}\"><img src=\"{$overrideIconFile}\" width=\"{$iconSizeX}\" height=\"{$iconSizeY}\" alt=\"Override template\" title=\"Override template\" /></a></td></tr>";
$j++;
} else {
$stats .= sprintf($formatString, $requestedTemplateName, $actualTemplateName, $templateFileName);
}
}
}
$totalTemplatesCount = count($templatesUsageStatistics);
$totalUniqueTemplatesCopunt = count(array_keys($alreadyListedTemplate));
if ($as_html) {
$stats .= "<tr><td colspan=\"6\"><b> Number of times templates used: {$totalTemplatesCount}<br /> Number of unique templates used: {$totalUniqueTemplatesCopunt}</b></td></tr>";
$stats .= "</table>";
} else {
$stats .= "\nTotal templates count: " . $totalTemplatesCount . "\n" . "Total unique templates count: " . $totalUniqueTemplatesCopunt . "\n";
}
return $stats;
}
示例15: setcookie
$show_page_layout = $moduleResult["pagelayout"];
$GLOBALS['eZCustomPageLayout'] = $moduleResult["pagelayout"];
}
if (isset($moduleResult["external_css"])) {
$use_external_css = $moduleResult["external_css"];
}
}
}
/**
* Ouput an is_logged_in cookie when users are logged in for use by http cache soulutions.
*
* @deprecated As of 4.5, since 4.4 added lazy session support (init on use)
*/
if ($ini->variable("SiteAccessSettings", "CheckValidity") !== 'true') {
$currentUser = eZUser::currentUser();
$wwwDir = eZSys::wwwDir();
// On host based site accesses this can be empty, causing the cookie to be set for the current dir,
// but we want it to be set for the whole eZ publish site
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
if ($currentUser->isLoggedIn()) {
// Only set the cookie if it doesnt exist. This way we are not constantly sending the set request in the headers.
if (!isset($_COOKIE['is_logged_in']) || $_COOKIE['is_logged_in'] != 'true') {
setcookie('is_logged_in', 'true', 0, $cookiePath);
}
} else {
if (isset($_COOKIE['is_logged_in'])) {
setcookie('is_logged_in', false, 0, $cookiePath);
}
}
}
if ($module->exitStatus() == eZModule::STATUS_REDIRECT) {