当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObject::recursionProtectionStart方法代码示例

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


在下文中一共展示了eZContentObject::recursionProtectionStart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: elseif

        $db->commit();
    }

    $validation['processed'] = true;
    $validation['attributes'] = $unvalidatedAttributes;

    $db = eZDB::instance();
    $db->begin();
    $object->setName( $class->contentObjectName( $object, $version->attribute( 'version' ), $EditLanguage ), $version->attribute( 'version' ), $EditLanguage );
    $db->commit();
}
elseif ( $storingAllowed )
{
    if ( !isset( $currentRedirectionURI ) )
        $currentRedirectionURI = $Module->redirectionURI( 'content', 'edit', array( $ObjectID, $EditVersion, $EditLanguage ) );
    eZContentObject::recursionProtectionStart();
    foreach( $contentObjectAttributes as $contentObjectAttribute )
    {
        $object->handleCustomHTTPActions( $contentObjectAttribute,  $attributeDataBaseName,
                                          $customActionAttributeArray,
                                          array( 'module' => $Module,
                                                 'current-redirection-uri' => $currentRedirectionURI ) );
        $contentObjectAttribute->setContent( $contentObjectAttribute->attribute( 'content' ) );
    }
    eZContentObject::recursionProtectionEnd();
}

$invalidNodeAssignmentList = array();
if ( $Module->isCurrentAction( 'Publish' ) )
{
    $mainFound = false;
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:attribute_edit.php

示例2: addObject

 /**
  * Adds object $contentObject to the search database.
  *
  * @param eZContentObject $contentObject Object to add to search engine
  * @param bool $commit Whether to commit after adding the object
  * @return bool True if the operation succeed.
  */
 public function addObject($contentObject, $commit = true)
 {
     $contentObjectID = $contentObject->attribute('id');
     $currentVersion = $contentObject->currentVersion();
     if (!$currentVersion) {
         $errCurrentVersion = $contentObject->attribute('current_version');
         eZDebug::writeError("Failed to fetch \"current version\" ({$errCurrentVersion})" . " of content object (ID: {$contentObjectID})", 'eZSearchEngine');
         return false;
     }
     $indexArray = array();
     $indexArrayOnlyWords = array();
     $wordCount = 0;
     $placement = 0;
     $previousWord = '';
     eZContentObject::recursionProtectionStart();
     foreach ($currentVersion->contentObjectAttributes() as $attribute) {
         $metaData = array();
         $classAttribute = $attribute->contentClassAttribute();
         if ($classAttribute->attribute("is_searchable") == 1) {
             // Fetch attribute translations
             $attributeTranslations = $attribute->fetchAttributeTranslations();
             foreach ($attributeTranslations as $translation) {
                 $tmpMetaData = $translation->metaData();
                 if (!is_array($tmpMetaData)) {
                     $tmpMetaData = array(array('id' => $attribute->attribute('contentclass_attribute_identifier'), 'text' => $tmpMetaData));
                 }
                 $metaData = array_merge($metaData, $tmpMetaData);
             }
             foreach ($metaData as $metaDataPart) {
                 $text = eZSearchEngine::normalizeText(htmlspecialchars($metaDataPart['text'], ENT_NOQUOTES, 'UTF-8'), true);
                 // Split text on whitespace
                 if (is_numeric(trim($text))) {
                     $integerValue = (int) $text;
                 } else {
                     $integerValue = 0;
                 }
                 $wordArray = explode(' ', $text);
                 foreach ($wordArray as $word) {
                     if (trim($word) != "") {
                         // words stored in search index are limited to 150 characters
                         if (strlen($word) > 150) {
                             $word = substr($word, 0, 150);
                         }
                         $indexArray[] = array('Word' => $word, 'ContentClassAttributeID' => $attribute->attribute('contentclassattribute_id'), 'identifier' => $metaDataPart['id'], 'integer_value' => $integerValue);
                         $indexArrayOnlyWords[$word] = 1;
                         $wordCount++;
                         //if we have "www." before word than
                         //treat it as url and add additional entry to the index
                         if (substr(strtolower($word), 0, 4) == 'www.') {
                             $additionalUrlWord = substr($word, 4);
                             $indexArray[] = array('Word' => $additionalUrlWord, 'ContentClassAttributeID' => $attribute->attribute('contentclassattribute_id'), 'identifier' => $metaDataPart['id'], 'integer_value' => $integerValue);
                             $indexArrayOnlyWords[$additionalUrlWord] = 1;
                             $wordCount++;
                         }
                     }
                 }
             }
         }
     }
     eZContentObject::recursionProtectionEnd();
     $wordIDArray = $this->buildWordIDArray(array_keys($indexArrayOnlyWords));
     $db = eZDB::instance();
     $db->begin();
     for ($arrayCount = 0; $arrayCount < $wordCount; $arrayCount += 1000) {
         $placement = $this->indexWords($contentObject, array_slice($indexArray, $arrayCount, 1000), $wordIDArray, $placement);
     }
     $db->commit();
     return true;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:76,代码来源:ezsearchengine.php

示例3: optimize


//.........这里部分代码省略.........
            // Main node gets single valued fields for sorting, using a dedicated prefix
            foreach ( $nodeAttributeValues[$mainNodeID] as $metaInfo )
            {
                $fieldName = 'main_node_' . ezfSolrDocumentFieldBase::generateMetaFieldName( $metaInfo['name'] );
                $doc->addField( $fieldName,
                                    ezfSolrDocumentFieldBase::preProcessValue( $metaInfo['value'],
                                    $metaInfo['fieldType'] ) );
            }


            // Add main url_alias
            $doc->addField( ezfSolrDocumentFieldBase::generateMetaFieldName( 'main_url_alias' ), $mainNode->attribute( 'url_alias' ) );

            // Add main path_string
            $doc->addField( ezfSolrDocumentFieldBase::generateMetaFieldName( 'main_path_string' ), $mainNode->attribute( 'path_string' ) );

            // add nodeid of all parent nodes path elements
            foreach ( $nodePathArray as $pathArray )
            {
                foreach ( $pathArray as $pathNodeID)
                {
                    $doc->addField( ezfSolrDocumentFieldBase::generateMetaFieldName( 'path' ), $pathNodeID );
                }
            }

            // Since eZ Fnd 2.3
            // cannot call metafield field bame constructor as we are creating multiple fields
            foreach ( $mainNodePathArray as $key => $pathNodeID )
            {
                $doc->addField( 'meta_main_path_element_' . $key . '_si', $pathNodeID );

            }

            eZContentObject::recursionProtectionStart();

            // Loop through all eZContentObjectAttributes and add them to the Solr document.
            // @since eZ Find 2.3: look for the attribute storage setting

            $doAttributeStorage = ( ( $this->FindINI->variable( 'IndexOptions', 'EnableSolrAttributeStorage' ) ) === 'true' ) ? true : false;

            if ( $doAttributeStorage )
            {
                $allAttributeData = array();
            }

            foreach ( $currentVersion->contentObjectAttributes( $languageCode ) as $attribute )
            {
                $metaDataText = '';
                $classAttribute = $attribute->contentClassAttribute();
                $attributeIdentifier = $classAttribute->attribute( 'identifier' );
                $combinedIdentifier = $contentClassIdentifier . '/' . $attributeIdentifier;
                $boostAttribute = false;
                if ( isset( $boostAttributes[$attributeIdentifier]) && is_numeric( $boostAttributes[$attributeIdentifier]))
                {
                    $boostAttribute = $boostAttributes[$attributeIdentifier];
                }
                if ( isset( $boostAttributes[$combinedIdentifier]) && is_numeric( $boostAttributes[$combinedIdentifier]))
                {
                    $boostAttribute += $boostAttributes[$combinedIdentifier];
                }
                if ( $classAttribute->attribute( 'is_searchable' ) == 1 )
                {
                    $documentFieldBase = ezfSolrDocumentFieldBase::getInstance( $attribute );
                    $this->addFieldBaseToDoc( $documentFieldBase, $doc, $boostAttribute );
                }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:66,代码来源:ezsolr.php


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