lib/ezi18n/classes/eztstranslator.php
function handleContextNode( $context )
    {
        $contextName = null;
        $messages = array();
        $context_children = $context->childNodes;

        for( $i = 0; $i < $context_children->length; $i++ )
        {
            $context_child = $context_children->item( $i );
            if ( $context_child->nodeType == XML_ELEMENT_NODE )
            {
                if ( $context_child->tagName == "name" )
                {
                    $name_el = $context_child->firstChild;
                    if ( $name_el )
                    {
                        $contextName = $name_el->nodeValue;
                    }
                }
                break;
            }
        }
        if ( !$contextName )
        {
            eZDebug::writeError( "No context name found, skipping context", __METHOD__ );
            return false;
        }
        foreach( $context_children as $context_child )
        {
            if ( $context_child->nodeType == XML_ELEMENT_NODE )
            {
                $childName = $context_child->tagName;
                if ( $childName == "message" )
                {
                    $this->handleMessageNode( $contextName, $context_child );
                }
                else if ( $childName == "name" )
                {
                    /* Skip name tags */
                }
                else
                {
                    eZDebug::writeError( "Unknown element name: $childName", __METHOD__ );
                }
            }
        }
        if ( $contextName === null )
        {
            eZDebug::writeError( "No context name found, skipping context", __METHOD__ );
            return false;
        }
        if ( !isset( $this->CachedMessages[$contextName] ) )
            $this->CachedMessages[$contextName] = array();

        return true;
    }
function handleContextNode( $context )
    {
        $contextName = null;
        $messages = array();
        $context_children = $context->childNodes;

        for( $i = 0; $i < $context_children->length; $i++ )
        {
            $context_child = $context_children->item( $i );
            if ( $context_child->nodeType == XML_ELEMENT_NODE )
            {
                if ( $context_child->tagName == "name" )
                {
                    $name_el = $context_child->firstChild;
                    if ( $name_el )
                    {
                        $contextName = $name_el->nodeValue;
                    }
                }
                break;
            }
        }
        if ( !$contextName )
        {
            eZDebug::writeError( "No context name found, skipping context", __METHOD__ );
            return false;
        }
        foreach( $context_children as $context_child )
        {
            if ( $context_child->nodeType == XML_ELEMENT_NODE )
            {
                $childName = $context_child->tagName;
                if ( $childName == "message" )
                {
                    $this->handleMessageNode( $contextName, $context_child );
                }
                else if ( $childName == "name" )
                {
                    /* Skip name tags */
                }
                else
                {
                    eZDebug::writeError( "Unknown element name: $childName", __METHOD__ );
                }
            }
        }
        if ( $contextName === null )
        {
            eZDebug::writeError( "No context name found, skipping context", __METHOD__ );
            return false;
        }
        if ( !isset( $this->CachedMessages[$contextName] ) )
            $this->CachedMessages[$contextName] = array();

        return true;
    }
function handleContextNode ( $ context ) { $ contextName = null ; $ messages = array ( ) ; $ context_children = $ context -> childNodes ; for ( $ i = 0 ; $ i < $ context_children -> length ; $ i ++ ) { $ context_child = $ context_children -> item ( $ i ) ; if ( $ context_child -> nodeType == XML_ELEMENT_NODE ) { if ( $ context_child -> tagName == "name" ) { $ name_el = $ context_child -> firstChild ; if ( $ name_el ) { $ contextName = $ name_el -> nodeValue ; } } break ; } } if ( ! $ contextName ) { eZDebug :: writeError ( "No context name found, skipping context" , __METHOD__ ) ; return false ; } foreach ( $ context_children as $ context_child ) { if ( $ context_child -> nodeType == XML_ELEMENT_NODE ) { $ childName = $ context_child -> tagName ; if ( $ childName == "message" ) { $ this -> handleMessageNode ( $ contextName , $ context_child ) ; } else if ( $ childName == "name" ) { /* Skip name tags */ } else { eZDebug :: writeError ( "Unknown element name: $childName" , __METHOD__ ) ; } } } if ( $ contextName === null ) { eZDebug :: writeError ( "No context name found, skipping context" , __METHOD__ ) ; return false ; } if ( ! isset ( $ this -> CachedMessages [ $ contextName ] ) ) $ this -> CachedMessages [ $ contextName ] = array ( ) ; return true ; }
Handles a DOM Context node and the messages it contains
@param DOMNode $context
@return bool
Handles a DOM Context node and the messages it contains