Processes literal Open Graph metadata

@param eZContentObjectTreeNode $contentNode

@return array
769877
function processGenericData( $contentNode )
    {
        $returnArray = array();

        $siteName = trim( eZINI::instance()->variable( 'SiteSettings', 'SiteName' ) );
        if ( !empty( $siteName ) )
        {
            $returnArray['og:site_name'] = $siteName;
        }

        $urlAlias = $contentNode->urlAlias();
        eZURI::transformURI( $urlAlias, false, 'full' );
        $returnArray['og:url'] = $urlAlias;

        if ( $this->facebookCompatible == 'true' )
        {
            $appID = trim( $this->ogIni->variable( 'GenericData', 'app_id' ) );
            if ( !empty( $appID ) )
            {
                $returnArray['fb:app_id'] = $appID;
            }

            $defaultAdmin = trim( $this->ogIni->variable( 'GenericData', 'default_admin' ) );
            $data = '';
            if ( !empty( $defaultAdmin ) )
            {
                $data = $defaultAdmin;

                $admins = $this->ogIni->variable( 'GenericData', 'admins' );

                if ( !empty( $admins ) )
                {
                    $admins = trim( implode( ',', $admins ) );
                    $data = $data . ',' . $admins;
                }
            }

            if ( !empty( $data ) )
            {
                $returnArray['fb:admins'] = $data;
            }
        }

        return $returnArray;
    }
77756
function contentStructureTree( $rootNodeID, $classFilter, $maxDepth, $maxNodes, $sortArray, $fetchHidden, $unfoldNodeID )
    {
        $contentTree = eZContentStructureTreeOperator::initContentStructureTree( $rootNodeID, $fetchHidden, $classFilter );

        // if root node is invisible then no point to fetch children
        //if ( count( $contentTree ) == 0 )
        //    return $contentTree;

        if ( $contentTree === false)
            return $contentTree;

        $nodesLeft = $maxNodes - 1;
        $depthLeft = $maxDepth - 1;

        eZContentStructureTreeOperator::children( $contentTree, $classFilter, $depthLeft, $nodesLeft, $sortArray, $fetchHidden, $unfoldNodeID );

        return $contentTree;
    }
1080781
public function getType(Content $node)
    {
        $path = $node->getPath() ?: $node->getName();
        $extension = pathinfo($path, PATHINFO_EXTENSION);

        foreach ($this->types as $type) {
            if (in_array($extension, $type->getExtensions())) {
                return $type;
            }
        }

        throw new \RuntimeException("no contentType found for $path");
    }
1329719
function createContentStructureNode( &$treeNode, $childrenCount )
    {
        $node = array( 'node' => array( 'node_id' => $treeNode['node_id'],
                                        'path_identification_string' => $treeNode['path_identification_string'],
                                        'children_count' => $childrenCount,
                                        'sort_array' => eZContentObjectTreeNode::sortArrayBySortFieldAndSortOrder( $treeNode['sort_field'], $treeNode['sort_order'] ),
                                        'path_string' => $treeNode['path_string'],
                                        'depth' => $treeNode['depth'],
                                        'is_hidden' => $treeNode['is_hidden'],
                                        'is_invisible' => $treeNode['is_invisible'] ),
                                        'classes_js_array' => eZContentObjectTreeNode::availableClassListJsArray( array( 'path_string' => $treeNode['path_string'], 'is_container' => $treeNode['is_container'], 'node_id' => $treeNode['node_id'] ) ),
                       'object' => array( 'id' => $treeNode['id'],
                                          'name' => $treeNode['name'],
                                          'class_identifier' => $treeNode['class_identifier'],
                                          'class_name' => eZContentClass::nameFromSerializedString( $treeNode['class_serialized_name_list'] ),
                                          'published' => $treeNode['published'],
                                          'is_container' => ( $treeNode['is_container'] == '1' ),
                                          'language_js_array' => eZContentLanguage::jsArrayByMask( $treeNode['language_mask'] ) ) );
        return $node;
    }
369741
function metaData( $contentObjectAttribute )
    {
        $metaString = "";
        $user = $contentObjectAttribute->content();

        if ( $user instanceof eZUser )
        {
            // create a default user account
            $metaString .= $user->attribute( 'login' ) . " ";
            $metaString .= $user->attribute( 'email' ) . " ";
        }
        return $metaString;
    }
1359073
function serializeContentObjectAttribute( $package, $objectAttribute )
    {

        $DOMNode = $this->createContentObjectAttributeDOMNode( $objectAttribute );
        $xmlString = $objectAttribute->attribute( 'data_text' );

        if ( $xmlString != '' )
        {
            $doc = new DOMDocument( '1.0', 'utf-8' );
            $success = $doc->loadXML( $xmlString );

            /* For all links found in the XML, do the following:
             * - add "href" attribute fetching it from ezurl table.
             * - remove "id" attribute.
             */

            $links = $doc->getElementsByTagName( 'link' );
            $embeds = $doc->getElementsByTagName( 'embed' );
            $objects = $doc->getElementsByTagName( 'object' );
            $embedsInline = $doc->getElementsByTagName( 'embed-inline' );

            eZXMLTextType::transformLinksToRemoteLinks( $links );
            eZXMLTextType::transformLinksToRemoteLinks( $embeds );
            eZXMLTextType::transformLinksToRemoteLinks( $objects );
            eZXMLTextType::transformLinksToRemoteLinks( $embedsInline );

            $importedRootNode = $DOMNode->ownerDocument->importNode( $doc->documentElement, true );
            $DOMNode->appendChild( $importedRootNode );
        }

        return $DOMNode;
    }
850230
protected function create_metadata_resource(cc_i_metadata_resource $met, DOMDocument &$doc, $xmlnode = null) {

        $dnode = $doc->createElementNS($this->ccnamespaces['lom'], "lom");

        !empty($xmlnode) ? $xmlnode->appendChild($dnode) : null;
        !empty($met->arrayeducational) ? $this->create_metadata_educational($met, $doc, $dnode) : null;

        return $dnode;
    }
454423
public function getOpenGraphTags(Content $content)
    {
        try {
            return $this->tagCollector->collect($content);
        } catch (Exception $e) {
            if ($this->throwExceptions || !$this->logger instanceof LoggerInterface) {
                throw $e;
            }

            $this->logger->error($e->getMessage());
        }

        return array();
    }
842995
public function collect(Content $content)
    {
        $metaTags = array();

        $allHandlers = $this->configResolver->hasParameter('global_handlers', 'netgen_open_graph') ?
            $this->configResolver->getParameter('global_handlers', 'netgen_open_graph') :
            array();

        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);
        $contentTypeHandlers = $this->configResolver->hasParameter('content_type_handlers', 'netgen_open_graph') ?
            $this->configResolver->getParameter('content_type_handlers', 'netgen_open_graph') :
            array();

        if (isset($contentTypeHandlers[$contentType->identifier])) {
            $allHandlers = array_merge(
                isset($allHandlers['all_content_types']) ? $allHandlers['all_content_types'] : array(),
                $contentTypeHandlers[$contentType->identifier]
            );
        } else {
            $allHandlers = isset($allHandlers['all_content_types']) ? $allHandlers['all_content_types'] : array();
        }

        foreach ($allHandlers as $handler) {
            $metaTagHandler = $this->metaTagHandlers->getHandler($handler['handler']);
            if ($metaTagHandler instanceof ContentAware) {
                $metaTagHandler->setContent($content);
            }

            $newMetaTags = $metaTagHandler->getMetaTags($handler['tag'], $handler['params']);
            foreach ($newMetaTags as $metaTag) {
                if (!$metaTag instanceof Item) {
                    throw new LogicException(
                        '\'' . $handler['handler'] . '\' handler returned wrong value.' .
                        ' Expected \'Netgen\Bundle\OpenGraphBundle\MetaTag\Item\', got \'' . get_class($metaTag) . '\'.');
                }

                $metaTagValue = $metaTag->getTagValue();
                if (!empty($metaTagValue)) {
                    $metaTags[] = $metaTag;
                }
            }
        }

        return $metaTags;
    }
1004136
function (node) {
        return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes);
      }
595671
protected function _getChildBlockNames($blockNode) {
        Varien_Profiler::start('turpentine::helper::data::_getChildBlockNames');
        if ($blockNode instanceof Mage_Core_Model_Layout_Element) {
            $blockNames = array((string) $blockNode['name']);
            foreach ($blockNode->xpath('./block | ./reference') as $childBlockNode) {
                $blockNames = array_merge($blockNames,
                    $this->_getChildBlockNames($childBlockNode));
                if ($this->getLayout() instanceof Varien_Simplexml_Config) {
                    foreach ($this->getLayout()->getNode()->xpath(sprintf(
                        '//reference[@name=\'%s\']', (string) $childBlockNode['name'] ))
                            as $childBlockLayoutNode) {
                        $blockNames = array_merge($blockNames,
                            $this->_getChildBlockNames($childBlockLayoutNode));

                    }
                }
            }
        } else {
            $blockNames = array();
        }
        Varien_Profiler::stop('turpentine::helper::data::_getChildBlockNames');
        return $blockNames;
    }
515
public function asXml(Shopgate_Model_XmlResultObject $itemNode)
    {
        /**
         * @var Shopgate_Model_XmlResultObject $stockNode
         */
        $identifierNode = $itemNode->addChildWithCDATA('identifier', $this->getValue());
        $identifierNode->addAttribute('uid', $this->getUid());
        $identifierNode->addAttribute('type', $this->getType());

        return $itemNode;
    }
269100
static function objectToOO( $nodeID )
    {
        $node = eZContentObjectTreeNode::fetch( $nodeID );

        if ( !is_object( $node ) )
        {
            return false;
        }

        $ooGenerator = new eZOOGenerator();

        $object = $node->attribute( 'object' );
        $attributes = $object->contentObjectAttributes();

        $supportedDatatypes = array( 'ezstring', 'eztext', 'ezxmltext', 'ezimage', 'ezdate', 'ezdatetime', 'ezmatrix' );

        $odfINI = eZINI::instance( 'odf.ini' );
        $ClassMappingToHeader = ( $odfINI->variable( 'ODFExport', 'ClassAttributeMappingToHeader' ) == 'enabled' ) ? true : false;

        // @bf 2008-08-21: Fetch the current class identifier and the .ini settings for the enabled attributes for this
        $classIdentifier = $object->contentClassIdentifier();
        $enabledClassAttributes = $odfINI->hasVariable( $classIdentifier, 'Attribute' ) ? $odfINI->variable( $classIdentifier, 'Attribute' ) : array();

        foreach ( $attributes as $attribute )
        {
            $datatype = $attribute->attribute( 'data_type_string' );
            $identifier = $attribute->attribute( "contentclass_attribute_identifier" );

            if ( !in_array( $datatype, $supportedDatatypes ) )
            {
                eZDebug::writeError( "Attribute '$identifier' with unsupported datatype '$datatype' for OO conversion" );
                continue;
            }

            // @bf 2008-08-21: Only export attribute if it is enabled
            if ( !array_key_exists( $identifier, $enabledClassAttributes ) )
            {
                continue;
            }

            if( !$ClassMappingToHeader )
            {
                $ooGenerator->startSection( $identifier );
            }
            else
            {
                $ooGenerator->startClassMapHeader( $identifier );
            }

            switch ( $datatype )
            {
                case "ezstring":
                {
                    $text = trim( $attribute->content() );
                    if ( $text != "" )
                    {
                        $ooGenerator->addHeader( $text );
                    }
                } break;

                case "eztext":
                {
                    $ooGenerator->addParagraph( $attribute->content() );

                } break;

                case "ezxmltext":
                {
                    $xmlData = $attribute->attribute( 'data_text' );
                    $dom = new DOMDocument( '1.0', 'UTF-8' );
                    $dom->preserveWhiteSpace = false;
                    $success = $dom->loadXML( $xmlData );
                    if ( $success )
                    {
                        $root = $dom->documentElement;
                        foreach ( $root->childNodes as $node )
                        {
                            self::handleNode( $node, $ooGenerator );
                        }
                    }
                    else
                    {
                        eZDebug::writeError( "Unable to load XML data for attribute '$identifier'" );
                    }
                } break;

                case "ezimage":
                {
                    $originalImage = $attribute->content()->attribute( 'original' );

                    $fileHandler = eZClusterFileHandler::instance( $originalImage['url'] );
                    $uniqueFile = $fileHandler->fetchUnique();

                    $imageArray = array( "FileName" => $uniqueFile,
                                         "Alignment" => "center",
                                         "DisplayWidth" => $originalImage['width'],
                                         "DisplayHeight" => $originalImage['height'] );

                    $ooGenerator->addImage( $imageArray );
                } break;

                case "ezdate":
                {
                    $date = $attribute->content();
                    $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) );
                } break;

                case "ezdatetime":
                {
                    $date = $attribute->content();
                    $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) . " " . $date->attribute( "hour" )  . ":" . $date->attribute( "minute" )  );
                } break;

                case "ezmatrix":
                {
                    $matrix = $attribute->content();
                    $columns = $matrix->attribute( "columns" );

                    $ooGenerator->startTable();

                    foreach ( $columns['sequential'] as $column )
                    {
                        $ooGenerator->addParagraph( $column['name'] );
                        $ooGenerator->nextCell();
                    }

                    $ooGenerator->nextRow( "defaultstyle" );

                    $rows = $matrix->attribute( "rows" );

                    foreach ( $rows['sequential'] as $row )
                    {
                        foreach ( $row['columns'] as $cell )
                        {
                            $ooGenerator->addParagraph( $cell );
                            $ooGenerator->nextCell();
                        }
                        $ooGenerator->nextRow( "defaultstyle" );
                    }

                    $ooGenerator->endTable();
                } break;
            }

            if( !$ClassMappingToHeader )
            {
                $ooGenerator->endSection();
            }
        }

        return $ooGenerator->writeDocument();
    }
864528
public function createSimpleEditForm(ContentNode $contentNode, Node $rootNode = null)
    {
        $contentNodeClassName = get_class($contentNode);

        $contentNodeParser = $this->get('mm_cmf_content.content_parser');

        $simpleFormData = $contentNodeParser->getSimpleForm($contentNodeClassName);
        //set FormType
        if (isset($simpleFormData['type']) && class_exists($simpleFormData['type'])) {
            $simpleFormType = $simpleFormData['type'];
        } else
            $simpleFormType = ContentNodeType::class;


        //get fields to hide
        $hiddenFields = $contentNodeParser->getHiddenFields($contentNodeClassName);

        $templateVars = array(
            'hiddenFields' => $hiddenFields,
            'action' => $this->get('router')->generate('mm_cmf_content_node_simple_update', array(
                'id' => $contentNode->getId()
            ))
        );

        if ($rootNode)
            $templateVars['root_node'] = $rootNode;

        return $this->createForm(
            $simpleFormType,
            $contentNode,
            $templateVars
        );
    }
1251777
function objectAttributeContent( $contentObjectAttribute )
    {
        $paexID = $contentObjectAttribute->attribute( "contentobject_id" );
        $paex = eZPaEx::fetch( $paexID );
        return $paex;
    }
748731
function objectAttributeContent( $contentObjectAttribute )
    {
        $objectID = $contentObjectAttribute->attribute( "data_int" );
        if ( $objectID != 0 )
            $object = eZContentObject::fetch( $objectID );
        else
            $object = null;
        return $object;
    }
735568
function processObject( $contentObject, $returnArray )
    {
        if ( $this->ogIni->hasVariable( $contentObject->contentClassIdentifier(), 'LiteralMap' ) )
        {
            $literalValues = $this->ogIni->variable( $contentObject->contentClassIdentifier(), 'LiteralMap' );
            if ( $this->debug )
            {
                eZDebug::writeDebug( $literalValues, 'LiteralMap' );
            }

            if ( $literalValues )
            {
                foreach ( $literalValues as $key => $value )
                {
                    if ( !empty( $value ) )
                    {
                        $returnArray[$key] = $value;
                    }
                }
            }
        }

        if ( $this->ogIni->hasVariable( $contentObject->contentClassIdentifier(), 'AttributeMap' ) )
        {
            $attributeValues = $this->ogIni->variableArray( $contentObject->contentClassIdentifier(), 'AttributeMap' );
            if ( $this->debug )
            {
                eZDebug::writeDebug( $attributeValues, 'AttributeMap' );
            }

            if ( $attributeValues )
            {
                foreach ( $attributeValues as $key => $value )
                {
                    $contentObjectAttributeArray = $contentObject->fetchAttributesByIdentifier( array( $value[0] ) );
                    if ( !is_array( $contentObjectAttributeArray ) )
                    {
                        continue;
                    }

                    $contentObjectAttributeArray = array_values( $contentObjectAttributeArray );
                    $contentObjectAttribute = $contentObjectAttributeArray[0];

                    if ( $contentObjectAttribute instanceof eZContentObjectAttribute )
                    {
                        $openGraphHandler = ngOpenGraphBase::getInstance( $contentObjectAttribute );

                        if ( count( $value ) == 1 )
                        {
                            $data = $openGraphHandler->getData();
                        }
                        else if ( count( $value ) == 2 )
                        {
                            $data = $openGraphHandler->getDataMember( $value[1] );
                        }
                        else
                        {
                            $data = "";
                        }

                        if ( !empty( $data ) )
                        {
                            $returnArray[$key] = $data;
                        }
                    }
                }
            }
        }

        return $returnArray;
    }