• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ezpEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ezpEvent的典型用法代码示例。如果您正苦于以下问题:PHP ezpEvent类的具体用法?PHP ezpEvent怎么用?PHP ezpEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ezpEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:12,代码来源:ezpevent_test.php


示例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());
}
开发者ID:nlescure,项目名称:ezpublish,代码行数:29,代码来源:global_functions.php


示例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;
 }
开发者ID:nlescure,项目名称:ezpublish,代码行数:12,代码来源:ezpsessionhandlersymfony.php


示例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();
             }
         }
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:49,代码来源:ezimagetype.php


示例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');
 }
开发者ID:heliopsis,项目名称:ezpublish-legacy,代码行数:15,代码来源:mysqli.php


示例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());
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:24,代码来源:global_functions.php


示例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;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:101,代码来源:ezimagemanager.php


示例8: __construct

 public function __construct()
 {
     $this->eventHandler = ezpEvent::getInstance();
 }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:4,代码来源:mysqli.php


示例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;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:16,代码来源:ezpsessionhandlerdb.php


示例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()) {
开发者ID:netbliss,项目名称:eztags,代码行数:31,代码来源:edit.php


示例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');
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:10,代码来源:ezcache.php


示例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;
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:view.php


示例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');
开发者ID:oki34,项目名称:eztags,代码行数:31,代码来源:deletetags.php


示例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;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:40,代码来源:ezcontentcachemanager.php


示例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')));
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:removegroup.php


示例16: array

    if (!$mainTag instanceof eZTagsObject) {
        $error = ezpI18n::tr('extension/eztags/errors', 'Selected target tag is invalid.');
    }
    if (empty($error)) {
        $db = eZDB::instance();
        $db->begin();
        $oldParentTag = false;
        if ($tag->attribute('parent_id') != $mainTag->attribute('parent_id')) {
            $oldParentTag = $tag->getParent(true);
            if ($oldParentTag instanceof eZTagsObject) {
                $oldParentTag->updateModified();
            }
        }
        /* Extended Hook */
        if (class_exists('ezpEvent', false)) {
            ezpEvent::getInstance()->filter('tag/merge', array('tag' => $tag, 'newParentTag' => $mainTag, 'oldParentTag' => $oldParentTag));
        }
        $tag->moveChildrenBelowAnotherTag($mainTag);
        foreach ($tag->getSynonyms(true) as $synonym) {
            $synonym->registerSearchObjects();
            $synonym->transferObjectsToAnotherTag($mainTag);
            $synonym->remove();
        }
        $tag->registerSearchObjects();
        $tag->transferObjectsToAnotherTag($mainTag);
        $tag->remove();
        $mainTag->updateModified();
        $db->commit();
        return $Module->redirectToView('id', array($mainTag->attribute('id')));
    }
}
开发者ID:oki34,项目名称:eztags,代码行数:31,代码来源:merge.php


示例17: 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;
 }
开发者ID:nlescure,项目名称:ezpublish,代码行数:40,代码来源:ezcontentcachemanager.php


示例18: store

 /**
  * Stores the tags to database
  *
  * @param eZContentObjectAttribute $attribute
  */
 function store($attribute)
 {
     if (!($attribute instanceof eZContentObjectAttribute && is_numeric($attribute->attribute('id')))) {
         return;
     }
     $attributeID = $attribute->attribute('id');
     $attributeVersion = $attribute->attribute('version');
     $objectID = $attribute->attribute('contentobject_id');
     $db = eZDB::instance();
     $currentTime = time();
     //get existing tags for object attribute
     $existingTagIDs = array();
     $existingTags = $db->arrayQuery("SELECT DISTINCT keyword_id FROM eztags_attribute_link WHERE objectattribute_id = {$attributeID} AND objectattribute_version = {$attributeVersion}");
     if (is_array($existingTags)) {
         foreach ($existingTags as $t) {
             $existingTagIDs[] = (int) $t['keyword_id'];
         }
     }
     //get tags to delete from object attribute
     $tagsToDelete = array();
     $tempIDArray = array();
     // if for some reason already existing tags are added with ID = 0 with fromString
     // check to see if they really exist, so we don't delete them by mistake
     foreach (array_keys($this->IDArray) as $key) {
         if ($this->IDArray[$key] == 0) {
             $existing = eZTagsObject::fetchList(array('keyword' => array('like', trim($this->KeywordArray[$key])), 'parent_id' => $this->ParentArray[$key]));
             if (is_array($existing) && !empty($existing)) {
                 $tempIDArray[] = $existing[0]->attribute('id');
             }
         } else {
             $tempIDArray[] = $this->IDArray[$key];
         }
     }
     foreach ($existingTagIDs as $tid) {
         if (!in_array($tid, $tempIDArray)) {
             $tagsToDelete[] = $tid;
         }
     }
     //and delete them
     if (!empty($tagsToDelete)) {
         $dbString = $db->generateSQLINStatement($tagsToDelete, 'keyword_id', false, true, 'int');
         $db->query("DELETE FROM eztags_attribute_link WHERE {$dbString} AND eztags_attribute_link.objectattribute_id = {$attributeID} AND eztags_attribute_link.objectattribute_version = {$attributeVersion}");
     }
     //get tags that are new to the object attribute
     $newTags = array();
     $tagsToLink = array();
     foreach (array_keys($this->IDArray) as $key) {
         if (!in_array($this->IDArray[$key], $existingTagIDs)) {
             if ($this->IDArray[$key] == 0) {
                 // We won't allow adding tags to the database that already exist, but instead, we link to the existing tags
                 $existing = eZTagsObject::fetchList(array('keyword' => array('like', trim($this->KeywordArray[$key])), 'parent_id' => $this->ParentArray[$key]));
                 if (is_array($existing) && !empty($existing)) {
                     if (!in_array($existing[0]->attribute('id'), $existingTagIDs)) {
                         $tagsToLink[] = $existing[0]->attribute('id');
                     }
                 } else {
                     $newTags[] = array('id' => $this->IDArray[$key], 'keyword' => $this->KeywordArray[$key], 'parent_id' => $this->ParentArray[$key]);
                 }
             } else {
                 $tagsToLink[] = $this->IDArray[$key];
             }
         }
     }
     //we need to check if user really has access to tags/add, taking into account policy and subtree limits
     $attributeSubTreeLimit = $attribute->contentClassAttribute()->attribute(eZTagsType::SUBTREE_LIMIT_FIELD);
     $userLimitations = eZTagsTemplateFunctions::getSimplifiedUserAccess('tags', 'add');
     if ($userLimitations['accessWord'] != 'no' && !empty($newTags)) {
         //first we need to fetch all locations user has access to
         $userLimitations = isset($userLimitations['simplifiedLimitations']['Tag']) ? $userLimitations['simplifiedLimitations']['Tag'] : array();
         $allowedLocations = self::getAllowedLocations($attributeSubTreeLimit, $userLimitations);
         foreach ($newTags as $t) {
             //and then for each tag check if user can save in one of the allowed locations
             $parentTag = eZTagsObject::fetch($t['parent_id']);
             $pathString = $parentTag instanceof eZTagsObject ? $parentTag->attribute('path_string') : '/';
             $depth = $parentTag instanceof eZTagsObject ? (int) $parentTag->attribute('depth') + 1 : 1;
             if (self::canSave($pathString, $allowedLocations)) {
                 $db->query("INSERT INTO eztags ( parent_id, main_tag_id, keyword, depth, path_string, modified, remote_id ) VALUES ( " . $t['parent_id'] . ", 0, '" . $db->escapeString(trim($t['keyword'])) . "', {$depth}, '{$pathString}', 0, '" . eZTagsObject::generateRemoteID() . "' )");
                 $tagID = (int) $db->lastSerialID('eztags', 'id');
                 $db->query("UPDATE eztags SET path_string = CONCAT(path_string, CAST({$tagID} AS CHAR), '/') WHERE id = {$tagID}");
                 $pathArray = explode('/', trim($pathString, '/'));
                 array_push($pathArray, $tagID);
                 $db->query("UPDATE eztags SET modified = {$currentTime} WHERE " . $db->generateSQLINStatement($pathArray, 'id', false, true, 'int'));
                 $tagsToLink[] = $tagID;
                 if (class_exists('ezpEvent', false)) {
                     ezpEvent::getInstance()->filter('tag/add', array('tag' => eZTagsObject::fetch($tagID), 'parentTag' => $parentTag));
                 }
             }
         }
     }
     //link tags to objects taking into account subtree limit
     if (!empty($tagsToLink)) {
         $dbString = $db->generateSQLINStatement($tagsToLink, 'id', false, true, 'int');
         $tagsToLink = $db->arrayQuery("SELECT id, path_string FROM eztags WHERE {$dbString}");
         if (is_array($tagsToLink) && !empty($tagsToLink)) {
             foreach ($tagsToLink as $t) {
//.........这里部分代码省略.........
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:101,代码来源:eztags.php


示例19: 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')));
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:31,代码来源:delete.php


示例20: clearAllContentCache

 static function clearAllContentCache($ignoreINISettings = false)
 {
     if (!$ignoreINISettings) {
         $ini = eZINI::instance();
         $viewCacheEnabled = $ini->variable('ContentSettings', 'ViewCaching') === 'enabled';
         $templateCacheEnabled = $ini->variable('TemplateSettings', 'TemplateCache') === 'enabled';
     } else {
         $viewCacheEnabled = true;
         $templateCacheEnabled = true;
     }
     if ($viewCacheEnabled || $templateCacheEnabled) {
         // view cache and/or ordinary template block cache
         eZContentObject::expireAllCache();
         ezpEvent::getInstance()->notify('content/cache/all');
         // subtree template block caches
         if ($templateCacheEnabled) {
             eZSubtreeCache::cleanupAll();
         }
     }
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:20,代码来源:ezcontentcachemanager.php



注:本文中的ezpEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ezpI18n类代码示例发布时间:2022-05-23
下一篇:
PHP ezpDatabaseTestCase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap