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


PHP eZContentObjectAttribute::hasContent方法代码示例

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


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

示例1: getAttributeData

    /**
     * @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
     * @return array for further processing
     */

    public static function getAttributeData ( eZContentObjectAttribute $contentObjectAttribute )
    {
        $dataTypeIdentifier = $contentObjectAttribute->attribute( 'data_type_string' );
        $contentClassAttribute = eZContentClassAttribute::fetch( $contentObjectAttribute->attribute( 'contentclassattribute_id' ) );
        $attributeHandler =  $dataTypeIdentifier . 'SolrStorage';
        // prefill the array with generic metadata first
        $target = array (
            'data_type_identifier' => $dataTypeIdentifier,
            'version_format' => self::STORAGE_VERSION_FORMAT,
            'attribute_identifier' => $contentClassAttribute->attribute( 'identifier' ),
            'has_content' => $contentObjectAttribute->hasContent(),

            );
        if ( class_exists( $attributeHandler ) )
        {
            $attributeContent = call_user_func( array( $attributeHandler, 'getAttributeContent' ),
                     $contentObjectAttribute, $contentClassAttribute );
            return array_merge( $target, $attributeContent, array( 'content_method' => self::CONTENT_METHOD_CUSTOM_HANDLER ) );

        }
        else
        {
            $target = array_merge( $target, array(
                'content_method' => self::CONTENT_METHOD_TOSTRING,
                'content' => $contentObjectAttribute->toString(),
                'has_rendered_content' => false,
                'rendered' => null
                ));
            return $target;
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:36,代码来源:ezfsolrstorage.php

示例2: getAttributeContent

 /**
  * @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
  * @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
  * @return json encoded string for further processing
  * required first level elements 'method', 'version_format', 'data_type_identifier', 'content'
  * optional first level element is 'rendered' which should store (template) rendered xhtml snippets
  */
 public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
 {
     $dataTypeIdentifier = $contentObjectAttribute->attribute('data_type_string');
     $attributeContents = $contentObjectAttribute->content();
     $doc = new DOMDocument('1.0');
     $doc->loadXML($attributeContents->attribute('xml_data'));
     $xpath = new DOMXPath($doc);
     $content = $doc->saveXML($xpath->query('/*')->item(0));
     $target = array('content' => $content, 'has_rendered_content' => $contentObjectAttribute->hasContent(), 'rendered' => $attributeContents->attribute('output')->attribute('output_text'));
     return $target;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ezxmltextsolrstorage.php

示例3: getAttributeContent

 /**
  * @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
  * @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
  * @return json encoded string for further processing
  * required first level elements 'method', 'version_format', 'data_type_identifier', 'content'
  * optional first level element is 'rendered' which should store (template) rendered xhtml snippets
  */
 public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
 {
     $dataTypeIdentifier = $contentObjectAttribute->attribute('data_type_string');
     $attributeID = $contentObjectAttribute->attribute("id");
     $version = $contentObjectAttribute->attribute("version");
     if (!$contentObjectAttribute->hasContent()) {
         $content = null;
     } else {
         $binaryFile = eZBinaryFile::fetch($attributeID, $version);
         $content = $binaryFile->storedFileInfo();
     }
     // This is not really the place, but for now initiate the safeguarding of the file itself here
     $archiveFileHandler = ezpFileArchiveFactory::getFileArchiveHandler('filesystem');
     // todo: insert check if handler is really returned and of the right class before calling the archive action
     // maybe use the attribute id as prefix as well, may be useful for bookkeeping/recovery and potentially easier restore as well
     $archiveResult = $archiveFileHandler->archiveFile($content['filepath'], array($content['filepath']), $attributeID, 'ezbinaryfile');
     $target = array('content' => $content, 'has_rendered_content' => false, 'rendered' => null, 'archived' => true, 'archive' => $archiveResult);
     return $target;
 }
开发者ID:netbliss,项目名称:ezfind,代码行数:26,代码来源:ezbinaryfilesolrstorage.php


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