本文整理汇总了PHP中ezpEvent类的典型用法代码示例。如果您正苦于以下问题:PHP ezpEvent类的具体用法?PHP ezpEvent怎么用?PHP ezpEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezpEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNewInstance
/**
* Test that new instance does not inherit events
* (when not reading from ini settings)
*/
public function testNewInstance()
{
$event = new ezpEvent(false);
// test filter
$this->assertEquals(null, $event->filter('test/filter', null));
// test notify
$this->assertFalse($event->notify('test/notify'));
}
示例2: 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());
}
示例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: array
$tag->setAttribute('parent_id', $newParentID);
$tag->store();
if (!$newParentTag instanceof eZTagsObject) {
$newParentTag = false;
}
if ($updatePathString) {
$tag->updatePathString($newParentTag);
}
if ($updateDepth) {
$tag->updateDepth($newParentTag);
}
$tag->updateModified();
$tag->registerSearchObjects();
/* Extended Hook */
if (class_exists('ezpEvent', false)) {
$tag = ezpEvent::getInstance()->filter('tag/edit', $tag);
}
$db->commit();
return $Module->redirectToView('id', array($tagID));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('tag', $tag);
$tpl->setVariable('warning', $warning);
$tpl->setVariable('error', $error);
$Result = array();
$Result['content'] = $tpl->fetch('design:tags/edit.tpl');
$Result['ui_context'] = 'edit';
$Result['path'] = array();
$tempTag = $tag;
while ($tempTag->hasParent()) {
示例11: clearStateLimitations
/**
* Clears all state limitation cache files.
*/
static function clearStateLimitations($cacheItem)
{
$cachePath = eZSys::cacheDirectory();
$fileHandler = eZClusterFileHandler::instance();
$fileHandler->fileDelete($cachePath, 'statelimitations_');
ezpEvent::getInstance()->notify('content/state/cache/all');
}
示例12: ezpMultivariateTest
if ( $Month )
$Month = (int) $Month;
if ( $Day )
$Day = (int) $Day;
$NodeID = (int) $NodeID;
if ( $NodeID < 2 )
{
return $Module->handleError( eZError::KERNEL_NOT_FOUND, 'kernel' );
}
$ini = eZINI::instance();
// Be able to filter node id for general use
$NodeID = ezpEvent::getInstance()->filter( 'content/view', $NodeID, $ini );
$testingHandler = new ezpMultivariateTest( ezpMultivariateTest::getHandler() );
if ( $testingHandler->isEnabled() )
$NodeID = $testingHandler->execute( $NodeID );
$viewCacheEnabled = ( $ini->variable( 'ContentSettings', 'ViewCaching' ) == 'enabled' );
if ( isset( $Params['ViewCache'] ) )
{
$viewCacheEnabled = $Params['ViewCache'];
}
elseif ( $viewCacheEnabled && !in_array( $ViewMode, $ini->variableArray( 'ContentSettings', 'CachedViewModes' ) ) )
{
$viewCacheEnabled = false;
示例13: array
return $Module->redirectToView('dashboard', array());
} else {
if ($http->hasPostVariable('YesButton')) {
$db = eZDB::instance();
foreach ($tagsList as $tag) {
if ($tag->getSubTreeLimitationsCount() > 0 || $tag->attribute('main_tag_id') != 0) {
continue;
}
$db->begin();
$parentTag = $tag->getParent(true);
if ($parentTag instanceof eZTagsObject) {
$parentTag->updateModified();
}
/* Extended Hook */
if (class_exists('ezpEvent', false)) {
ezpEvent::getInstance()->filter('tag/delete', $tag);
}
$tag->recursivelyDeleteTag();
$db->commit();
}
$http->removeSessionVariable('eZTagsDeleteIDArray');
if ($parentTagID > 0) {
return $Module->redirectToView('id', array($parentTagID));
}
return $Module->redirectToView('dashboard', array());
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('tags', $tagsList);
$Result = array();
$Result['content'] = $tpl->fetch('design:tags/deletetags.tpl');
示例14: 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;
}
示例15: 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')));