本文整理汇总了PHP中ezpEvent::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP ezpEvent::getInstance方法的具体用法?PHP ezpEvent::getInstance怎么用?PHP ezpEvent::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezpEvent
的用法示例。
在下文中一共展示了ezpEvent::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eZDisplayResult
/**
* @deprecated Since 5.0
* @param string|null $templateResult
*/
function eZDisplayResult($templateResult)
{
ob_start();
if ($templateResult !== null) {
$classname = eZINI::instance()->variable("OutputSettings", "OutputFilterName");
//deprecated
if (!empty($classname) && class_exists($classname)) {
$templateResult = call_user_func(array($classname, 'filter'), $templateResult);
}
$templateResult = ezpEvent::getInstance()->filter('response/preoutput', $templateResult);
$debugMarker = '<!--DEBUG_REPORT-->';
$pos = strpos($templateResult, $debugMarker);
if ($pos !== false) {
$debugMarkerLength = strlen($debugMarker);
echo substr($templateResult, 0, $pos);
eZDisplayDebug();
echo substr($templateResult, $pos + $debugMarkerLength);
} else {
echo $templateResult, eZDisplayDebug();
}
} else {
eZDisplayDebug();
}
echo ezpEvent::getInstance()->filter('response/output', ob_get_clean());
}
示例2: setUp
public function setUp()
{
parent::setUp();
ezpEvent::resetInstance();
ezpINIHelper::setINISetting('site.ini', 'Event', 'Listeners', array('test/notify@ezpEventTest::helperNotify', 'test/filter@ezpEventTest::helperFilterNotNull'));
$this->event = ezpEvent::getInstance();
}
示例3: gc
public function gc($maxLifeTime)
{
ezpEvent::getInstance()->notify('session/gc', array($maxLifeTime));
$db = eZDB::instance();
eZSession::triggerCallback('gc_pre', array($db, $maxLifeTime));
$sfHandler = $this->storage->getSaveHandler();
if (method_exists($sfHandler, 'gc')) {
$sfHandler->gc($maxLifeTime);
}
eZSession::triggerCallback('gc_post', array($db, $maxLifeTime));
return false;
}
示例4: trashStoredObjectAttribute
function trashStoredObjectAttribute($contentObjectAttribute, $version = null)
{
$imageHandler = $contentObjectAttribute->attribute("content");
$originalAlias = $imageHandler->imageAlias("original");
// check if there is an actual image, 'is_valid' says if there is an image or not
if ($originalAlias['is_valid'] != '1' && empty($originalAlias['filename'])) {
return;
}
$basenameHashed = md5($originalAlias["basename"]);
$trashedFolder = "{$originalAlias["dirpath"]}/trashed";
$imageHandler->updateAliasPath($trashedFolder, $basenameHashed);
if ($imageHandler->isStorageRequired()) {
$imageHandler->store($contentObjectAttribute);
$contentObjectAttribute->store();
}
// Now clean all other aliases, not cleanly registered within the attribute content
// First get all remaining aliases full path to then safely move them to the trashed folder
ezpEvent::getInstance()->notify('image/trashAliases', array($originalAlias['url']));
$aliasNames = array_keys($imageHandler->aliasList());
$aliasesPath = array();
foreach ($aliasNames as $aliasName) {
if ($aliasName === "original") {
continue;
}
$aliasesPath[] = "{$originalAlias["dirpath"]}/{$originalAlias["basename"]}_{$aliasName}.{$originalAlias["suffix"]}";
}
if (empty($aliasesPath)) {
return;
}
$conds = array("contentobject_attribute_id" => $contentObjectAttribute->attribute("id"), "filepath" => array($aliasesPath));
$remainingAliases = eZPersistentObject::fetchObjectList(eZImageFile::definition(), null, $conds);
unset($conds, $remainingAliasesPath);
if (!empty($remainingAliases)) {
foreach ($remainingAliases as $remainingAlias) {
$filename = basename($remainingAlias->attribute("filepath"));
$newFilePath = $trashedFolder . "/" . $basenameHashed . substr($filename, strrpos($filename, '_'));
eZClusterFileHandler::instance($remainingAlias->attribute("filepath"))->move($newFilePath);
// $newFilePath might have already been processed in eZImageFile
// If so, $remainingAlias is a duplicate. We can then remove it safely
$imageFile = eZImageFile::fetchByFilepath(false, $newFilePath, false);
if (empty($imageFile)) {
$remainingAlias->setAttribute("filepath", $newFilePath);
$remainingAlias->store();
} else {
$remainingAlias->remove();
}
}
}
}
示例5: __construct
public function __construct()
{
$this->eventHandler = ezpEvent::getInstance();
$fileINI = eZINI::instance('file.ini');
$this->maxCopyTries = (int) $fileINI->variable('eZDFSClusteringSettings', 'MaxCopyRetries');
if (defined('CLUSTER_METADATA_TABLE_CACHE')) {
$this->metaDataTableCache = CLUSTER_METADATA_TABLE_CACHE;
} else {
if ($fileINI->hasVariable('eZDFSClusteringSettings', 'MetaDataTableNameCache')) {
$this->metaDataTableCache = $fileINI->variable('eZDFSClusteringSettings', 'MetaDataTableNameCache');
}
}
$this->cacheDir = eZINI::instance('site.ini')->variable('FileSettings', 'CacheDir');
$this->storageDir = eZINI::instance('site.ini')->variable('FileSettings', 'StorageDir');
}
示例6: eZDisplayResult
/**
* @deprecated Since 5.0
* @param string|null $templateResult
*/
function eZDisplayResult($templateResult)
{
ob_start();
if ($templateResult !== null) {
$templateResult = ezpEvent::getInstance()->filter('response/preoutput', $templateResult);
$debugMarker = '<!--DEBUG_REPORT-->';
$pos = strpos($templateResult, $debugMarker);
if ($pos !== false) {
$debugMarkerLength = strlen($debugMarker);
echo substr($templateResult, 0, $pos);
eZDisplayDebug();
echo substr($templateResult, $pos + $debugMarkerLength);
} else {
echo $templateResult, eZDisplayDebug();
}
} else {
eZDisplayDebug();
}
echo ezpEvent::getInstance()->filter('response/output', ob_get_clean());
}
示例7: createImageAlias
//.........这里部分代码省略.........
'suffix' => $destinationMimeData['suffix'],
'basename' => $destinationMimeData['basename'],
'alternative_text' => $aliasInfo['alternative_text'],
'name' => $aliasName,
'sub_type' => false,
'timestamp' => time(),
'alias_key' => $aliasKey,
'mime_type' => $destinationMimeData['name'],
'override_mime_type' => false,
'info' => false,
'width' => false,
'height' => false,
'is_valid' => true,
'is_new' => true );
if ( isset( $destinationMimeData['override_mime_type'] ) )
$currentAliasData['override_mime_type'] = $destinationMimeData['override_mime_type'];
if ( isset( $destinationMimeData['info'] ) )
$currentAliasData['info'] = $destinationMimeData['info'];
$currentAliasData['full_path'] = $currentAliasData['url'];
if ( function_exists( 'getimagesize' ) )
{
/**
* we may want to fetch a unique name here, since we won't use
* the data for anything else
*/
$fileHandler = eZClusterFileHandler::instance( $destinationMimeData['url'] );
if ( $tempPath = $fileHandler->fetchUnique() )
{
$info = getimagesize( $tempPath );
if ( $info )
{
list( $currentAliasData['width'], $currentAliasData['height'] ) = $info;
}
else
{
eZDebug::writeError("The size of the generated image {$destinationMimeData['url']} could not be read by getimagesize()", __METHOD__ );
}
$fileHandler->fileDeleteLocal( $tempPath );
}
else
{
eZDebug::writeError( "The destination image {$destinationMimeData['url']} does not exist, cannot figure out image size", __METHOD__ );
}
}
else
{
eZDebug::writeError( "Unknown function 'getimagesize', cannot get image size", __METHOD__ );
}
$existingAliasList[$aliasName] = $currentAliasData;
$convertHandler->endCacheGeneration( false );
// Notify about image alias generation. Parameters are alias
// url and alias name.
ezpEvent::getInstance()->notify( 'image/alias', array( $currentAliasData['url'],
$currentAliasData['name'] ) );
return true;
}
// conversion failed, we abort generation
else
{
$sourceFile = $sourceMimeData['url'];
$destinationDir = $destinationMimeData['dirpath'];
eZDebug::writeError( "Failed converting $sourceFile to alias '$aliasName' in directory '$destinationDir'", __METHOD__ );
$convertHandler->abortCacheGeneration();
return false;
}
}
// we were not granted file generation (someone else is doing it)
// we wait for max. $remainingGenerationTime and check if the
// file has been generated in between
// Actually, we have no clue if the generated file was the one we were
// looking for, and it doesn't seem possible to RELOAD the alias list.
// We don't even know what attribute we're using... CRAP
else
{
eZDebug::writeDebug( "An alias is already being generated for this image, let's wait", __METHOD__ );
while ( true )
{
$startGeneration = $convertHandler->startCacheGeneration();
// generation lock granted: we can start again by breaking to
// the beggining of the while loop
if ( $startGeneration === true )
{
eZDebug::writeDebug( "Got granted generation permission, restarting !", __METHOD__ );
$convertHandler->abortCacheGeneration();
continue 2;
}
else
{
sleep( 1 );
}
}
}
}
return false;
}
示例8: __construct
public function __construct()
{
$this->eventHandler = ezpEvent::getInstance();
}
示例9: cleanup
/**
* Remove all session data (Truncate table)
*
* @return bool
*/
public function cleanup()
{
ezpEvent::getInstance()->notify( 'session/cleanup', array() );
$db = eZDB::instance();
eZSession::triggerCallback( 'cleanup_pre', array( $db ) );
$db->query( 'TRUNCATE TABLE ezsession' );
eZSession::triggerCallback( 'cleanup_post', array( $db ) );
return true;
}
示例10: generateNodeViewData
/**
* Generate result data for a node view
*
* @param eZTemplate $tpl
* @param eZContentObjectTreeNode $node
* @param eZContentObject $object
* @param bool|string $languageCode
* @param string $viewMode
* @param int $offset
* @param array $viewParameters
* @param bool|array $collectionAttributes
* @param bool $validation
* @return array Result array for view
*/
static function generateNodeViewData(eZTemplate $tpl, eZContentObjectTreeNode $node, eZContentObject $object, $languageCode, $viewMode, $offset, array $viewParameters = array('offset' => 0, 'year' => false, 'month' => false, 'day' => false), $collectionAttributes = false, $validation = false)
{
$section = eZSection::fetch($object->attribute('section_id'));
if ($section) {
$navigationPartIdentifier = $section->attribute('navigation_part_identifier');
$sectionIdentifier = $section->attribute('identifier');
} else {
$navigationPartIdentifier = null;
$sectionIdentifier = null;
}
$keyArray = array(array('object', $object->attribute('id')), array('node', $node->attribute('node_id')), array('parent_node', $node->attribute('parent_node_id')), array('class', $object->attribute('contentclass_id')), array('class_identifier', $node->attribute('class_identifier')), array('view_offset', $offset), array('viewmode', $viewMode), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('navigation_part_identifier', $navigationPartIdentifier), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias')), array('class_group', $object->attribute('match_ingroup_id_list')), array('state', $object->attribute('state_id_array')), array('state_identifier', $object->attribute('state_identifier_array')), array('section', $object->attribute('section_id')), array('section_identifier', $sectionIdentifier));
$parentClassID = false;
$parentClassIdentifier = false;
$parentNodeRemoteID = false;
$parentObjectRemoteID = false;
$parentNode = $node->attribute('parent');
if (is_object($parentNode)) {
$parentNodeRemoteID = $parentNode->attribute('remote_id');
$keyArray[] = array('parent_node_remote_id', $parentNodeRemoteID);
$parentObject = $parentNode->attribute('object');
if (is_object($parentObject)) {
$parentObjectRemoteID = $parentObject->attribute('remote_id');
$keyArray[] = array('parent_object_remote_id', $parentObjectRemoteID);
$parentClass = $parentObject->contentClass();
if (is_object($parentClass)) {
$parentClassID = $parentClass->attribute('id');
$parentClassIdentifier = $parentClass->attribute('identifier');
$keyArray[] = array('parent_class', $parentClassID);
$keyArray[] = array('parent_class_identifier', $parentClassIdentifier);
}
}
}
$res = eZTemplateDesignResource::instance();
$res->setKeys($keyArray);
if ($languageCode) {
$oldLanguageCode = $node->currentLanguage();
$node->setCurrentLanguage($languageCode);
}
$tpl->setVariable('node', $node);
$tpl->setVariable('viewmode', $viewMode);
$tpl->setVariable('language_code', $languageCode);
if (isset($viewParameters['_custom'])) {
foreach ($viewParameters['_custom'] as $customVarName => $customValue) {
$tpl->setVariable($customVarName, $customValue);
}
unset($viewParameters['_custom']);
}
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('collection_attributes', $collectionAttributes);
$tpl->setVariable('validation', $validation);
$tpl->setVariable('persistent_variable', false);
$parents = $node->attribute('path');
$path = array();
$titlePath = array();
foreach ($parents as $parent) {
$path[] = array('text' => $parent->attribute('name'), 'url' => '/content/view/full/' . $parent->attribute('node_id'), 'url_alias' => $parent->attribute('url_alias'), 'node_id' => $parent->attribute('node_id'));
}
$titlePath = $path;
$path[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false, 'node_id' => $node->attribute('node_id'));
$titlePath[] = array('text' => $object->attribute('name'), 'url' => false, 'url_alias' => false);
$tpl->setVariable('node_path', $path);
$event = ezpEvent::getInstance();
$event->notify('content/pre_rendering', array($node, $tpl, $viewMode));
$Result = array();
$Result['content'] = $tpl->fetch('design:node/view/' . $viewMode . '.tpl');
$Result['view_parameters'] = $viewParameters;
$Result['path'] = $path;
$Result['title_path'] = $titlePath;
$Result['section_id'] = $object->attribute('section_id');
$Result['node_id'] = $node->attribute('node_id');
$Result['navigation_part'] = $navigationPartIdentifier;
$contentInfoArray = array();
$contentInfoArray['object_id'] = $object->attribute('id');
$contentInfoArray['node_id'] = $node->attribute('node_id');
$contentInfoArray['parent_node_id'] = $node->attribute('parent_node_id');
$contentInfoArray['class_id'] = $object->attribute('contentclass_id');
$contentInfoArray['class_identifier'] = $node->attribute('class_identifier');
$contentInfoArray['remote_id'] = $object->attribute('remote_id');
$contentInfoArray['node_remote_id'] = $node->attribute('remote_id');
$contentInfoArray['offset'] = $offset;
$contentInfoArray['viewmode'] = $viewMode;
$contentInfoArray['navigation_part_identifier'] = $navigationPartIdentifier;
$contentInfoArray['node_depth'] = $node->attribute('depth');
$contentInfoArray['url_alias'] = $node->attribute('url_alias');
$contentInfoArray['current_language'] = $object->attribute('current_language');
$contentInfoArray['language_mask'] = $object->attribute('language_mask');
//.........这里部分代码省略.........
示例11: count
$GroupID = $Params["GroupID"];
}
$class = eZContentClass::fetch($ClassID);
$ClassName = $class->attribute('name');
$classObjects = eZContentObject::fetchSameClassList($ClassID);
$ClassObjectsCount = count($classObjects);
if ($ClassObjectsCount == 0) {
$ClassObjectsCount .= " object";
} else {
$ClassObjectsCount .= " objects";
}
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("ConfirmButton")) {
$class->remove(true);
eZContentClassClassGroup::removeClassMembers($ClassID, 0);
ezpEvent::getInstance()->notify('content/class/cache', array($ClassID));
$Module->redirectTo('/class/classlist/' . $GroupID);
}
if ($http->hasPostVariable("CancelButton")) {
$Module->redirectTo('/class/classlist/' . $GroupID);
}
$Module->setTitle("Deletion of class " . $ClassID);
$tpl = eZTemplate::factory();
$tpl->setVariable("module", $Module);
$tpl->setVariable("GroupID", $GroupID);
$tpl->setVariable("ClassID", $ClassID);
$tpl->setVariable("ClassName", $ClassName);
$tpl->setVariable("ClassObjectsCount", $ClassObjectsCount);
$Result = array();
$Result['content'] = $tpl->fetch("design:class/delete.tpl");
$Result['path'] = array(array('url' => '/class/delete/', 'text' => ezpI18n::tr('kernel/class', 'Remove class')));
示例12: clearObjectViewCacheArray
/**
* Clears view caches of nodes, parent nodes and relating nodes
* of content objects with ids contained in $objectIDList.
* It will use 'viewcache.ini' to determine additional nodes.
*
* @see clearObjectViewCache
*
* @param array $objectIDList List of object ID
*/
public static function clearObjectViewCacheArray(array $objectIDList)
{
eZDebug::accumulatorStart('node_cleanup_list', '', 'Node cleanup list');
$nodeList = array();
foreach ($objectIDList as $objectID) {
$tempNodeList = self::nodeList($objectID, true);
if ($tempNodeList !== false) {
$nodeList = array_merge($nodeList, $tempNodeList);
}
}
$nodeList = array_unique($nodeList);
eZDebug::accumulatorStop('node_cleanup_list');
eZDebugSetting::writeDebug('kernel-content-edit', count($nodeList), "count in nodeList");
if (eZINI::instance()->variable('ContentSettings', 'StaticCache') === 'enabled') {
$staticCacheHandler = eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler')));
$staticCacheHandler->generateAlwaysUpdatedCache();
$staticCacheHandler->generateNodeListCache($nodeList);
}
eZDebug::accumulatorStart('node_cleanup', '', 'Node cleanup');
$nodeList = ezpEvent::getInstance()->filter('content/cache', $nodeList);
eZContentObject::expireComplexViewModeCache();
$cleanupValue = eZContentCache::calculateCleanupValue(count($nodeList));
if (eZContentCache::inCleanupThresholdRange($cleanupValue)) {
eZContentCache::cleanup($nodeList);
} else {
eZDebug::writeDebug("Expiring all view cache since list of nodes({$cleanupValue}) exceeds site.ini\\[ContentSettings]\\CacheThreshold", __METHOD__);
eZContentObject::expireAllViewCache();
}
eZDebug::accumulatorStop('node_cleanup');
return true;
}
示例13: clearObjectViewCache
static function clearObjectViewCache($objectID, $versionNum = true, $additionalNodeList = false)
{
eZDebug::accumulatorStart('node_cleanup_list', '', 'Node cleanup list');
$nodeList = eZContentCacheManager::nodeList($objectID, $versionNum);
if ($nodeList === false and !is_array($additionalNodeList)) {
return false;
}
if ($nodeList === false) {
$nodeList = array();
}
if (is_array($additionalNodeList)) {
array_splice($nodeList, count($nodeList), 0, $additionalNodeList);
}
if (count($nodeList) == 0) {
return false;
}
$nodeList = array_unique($nodeList);
eZDebug::accumulatorStop('node_cleanup_list');
eZDebugSetting::writeDebug('kernel-content-edit', count($nodeList), "count in nodeList");
$ini = eZINI::instance();
if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
$staticCacheHandler->generateAlwaysUpdatedCache();
$staticCacheHandler->generateNodeListCache($nodeList);
}
eZDebug::accumulatorStart('node_cleanup', '', 'Node cleanup');
$nodeList = ezpEvent::getInstance()->filter('content/cache', $nodeList);
eZContentObject::expireComplexViewModeCache();
$cleanupValue = eZContentCache::calculateCleanupValue(count($nodeList));
if (eZContentCache::inCleanupThresholdRange($cleanupValue)) {
eZContentCache::cleanup($nodeList);
} else {
eZDebug::writeDebug("Expiring all view cache since list of nodes({$cleanupValue}) related to object({$objectID}) exeeds site.ini\\[ContentSettings]\\CacheThreshold", __METHOD__);
eZContentObject::expireAllViewCache();
}
eZDebug::accumulatorStop('node_cleanup');
return true;
}
示例14: foreach
}
if ($http->hasPostVariable("ConfirmButton")) {
foreach ($deleteIDArray as $deleteID) {
eZContentClassGroup::removeSelected($deleteID);
eZContentClassClassGroup::removeGroupMembers($deleteID);
foreach ($deleteClassIDList as $deleteClassID) {
$deleteClass = eZContentClass::fetch($deleteClassID);
if ($deleteClass) {
$deleteClass->remove(true);
}
$deleteClass = eZContentClass::fetch($deleteClassID, true, eZContentClass::VERSION_STATUS_TEMPORARY);
if ($deleteClass) {
$deleteClass->remove(true);
}
ezpEvent::getInstance()->notify('content/class/cache', array($deleteClassID));
}
ezpEvent::getInstance()->notify('content/class/group/cache', array($deleteID));
}
$Module->redirectTo('/class/grouplist/');
}
if ($http->hasPostVariable("CancelButton")) {
$Module->redirectTo('/class/grouplist/');
}
$Module->setTitle(ezpI18n::tr('kernel/class', 'Remove class groups') . ' ' . $GroupName);
$tpl = eZTemplate::factory();
$tpl->setVariable("DeleteResult", $deleteResult);
$tpl->setVariable("module", $Module);
$tpl->setVariable("groups_info", $groupsInfo);
$Result = array();
$Result['content'] = $tpl->fetch("design:class/removegroup.tpl");
$Result['path'] = array(array('url' => '/class/grouplist/', 'text' => ezpI18n::tr('kernel/class', 'Class groups')), array('url' => false, 'text' => ezpI18n::tr('kernel/class', 'Remove class groups')));
示例15: array
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier should consist of letters, numbers or \'_\' with letter prefix.');
} else {
$conditions = array('identifier' => $sectionIdentifier, 'id' => array('!=', !empty($SectionID) ? $SectionID : 0));
$existingSection = eZSection::fetchFilteredList($conditions);
if (count($existingSection) > 0) {
$errorMessage = ezpI18n::tr('design/admin/section/edit', 'The identifier has been used in another section.');
}
}
}
$section->setAttribute('identifier', $sectionIdentifier);
$section->setAttribute('navigation_part_identifier', $http->postVariable('NavigationPartIdentifier'));
if ($http->hasPostVariable('Locale')) {
$section->setAttribute('locale', $http->postVariable('Locale'));
}
if ($errorMessage === '') {
$section->store();
eZContentCacheManager::clearContentCacheIfNeededBySectionID($section->attribute('id'));
ezpEvent::getInstance()->notify('content/section/cache', array($section->attribute('id')));
$Module->redirectTo($Module->functionURI('list'));
return;
} else {
$tpl->setVariable('error_message', $errorMessage);
}
}
if ($http->hasPostVariable('CancelButton')) {
$Module->redirectTo($Module->functionURI('list'));
}
$tpl->setVariable("section", $section);
$Result = array();
$Result['content'] = $tpl->fetch("design:section/edit.tpl");
$Result['path'] = array(array('url' => 'section/list', 'text' => ezpI18n::tr('kernel/section', 'Sections')), array('url' => false, 'text' => $section instanceof eZSection ? $section->attribute('name') : $section['name']));