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


PHP eZContentObjectTreeNode::fetchByURLPath方法代码示例

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


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

示例1: publishHandlerEmbed

 function publishHandlerEmbed($element, &$params)
 {
     $ret = null;
     $href = $element->getAttribute('href');
     //washing href. single and double quotes replaced with their urlencoded form
     $href = str_replace(array('\'', '"'), array('%27', '%22'), $href);
     if ($href != null) {
         if (preg_match("@^ezobject://[0-9]+\$@", $href)) {
             $objectID = substr(strrchr($href, "/"), 1);
             // protection from self-embedding
             if ($objectID == $this->contentObjectID) {
                 $this->handleError(eZXMLInputParser::ERROR_DATA, ezpI18n::tr('kernel/classes/datatypes/ezxmltext', 'Object %1 can not be embeded to itself.', '', array($objectID)));
                 $element->removeAttribute('href');
                 return $ret;
             }
             $element->setAttribute('object_id', $objectID);
             if (!in_array($objectID, $this->relatedObjectIDArray)) {
                 $this->relatedObjectIDArray[] = $objectID;
             }
         } elseif (preg_match("@^eznode://.+\$@", $href)) {
             $nodePath = substr(strchr($href, "/"), 2);
             if (preg_match("@^[0-9]+\$@", $nodePath)) {
                 $nodeID = $nodePath;
                 $node = eZContentObjectTreeNode::fetch($nodeID, false, false);
                 if (!$node) {
                     $this->handleError(eZXMLInputParser::ERROR_DATA, ezpI18n::tr('kernel/classes/datatypes/ezxmltext', "Node '%1' does not exist.", '', array($nodeID)));
                     $element->removeAttribute('href');
                     return $ret;
                 }
             } else {
                 $node = eZContentObjectTreeNode::fetchByURLPath($nodePath, false);
                 if (!$node) {
                     $this->handleError(eZXMLInputParser::ERROR_DATA, ezpI18n::tr('kernel/classes/datatypes/ezxmltext', 'Node \'%1\' does not exist.', '', array($nodePath)));
                     $element->removeAttribute('href');
                     return $ret;
                 }
                 $nodeID = $node['node_id'];
                 $element->setAttribute('show_path', 'true');
             }
             $element->setAttribute('node_id', $nodeID);
             $objectID = $node['contentobject_id'];
             // protection from self-embedding
             if ($objectID == $this->contentObjectID) {
                 $this->handleError(eZXMLInputParser::ERROR_DATA, ezpI18n::tr('kernel/classes/datatypes/ezxmltext', 'Object %1 can not be embeded to itself.', '', array($objectID)));
                 $element->removeAttribute('href');
                 return $ret;
             }
             if (!in_array($objectID, $this->relatedObjectIDArray)) {
                 $this->relatedObjectIDArray[] = $objectID;
             }
         } else {
             $this->isInputValid = false;
             $this->Messages[] = ezpI18n::tr('kernel/classes/datatypes', 'Invalid reference in &lt;embed&gt; tag. Note that <embed> tag supports only \'eznode\' and \'ezobject\' protocols.');
             $element->removeAttribute('href');
             return $ret;
         }
     }
     $element->removeAttribute('href');
     $this->convertCustomAttributes($element);
     return $ret;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:61,代码来源:ezsimplifiedxmlinputparser.php

示例2: handleParameters


//.........这里部分代码省略.........
             else if ( $optionName == 'node-selected' )
             {
                 $nodeAssignmentType = 'selected';
             }
             else if ( $optionName == 'siteaccess' )
             {
                 $siteAccessList = explode( ',', $optionValue );
             }
             else if ( $optionName == 'language' )
             {
                 $languageList = explode( ',', $optionValue );
             }
             else if ( $optionName == 'current-version' )
             {
                 $versionType = 'current';
             }
             else if ( $optionName == 'all-versions' )
             {
                 $versionType = 'all';
             }
             else if ( $optionName == 'minimal-template-set' )
             {
                 $minimalTemplateSet = true;
             }
         }
         else
         {
             $nodeID = false;
             $subtree = false;
             if ( is_numeric( $argument ) )
             {
                 $nodeID = (int)$argument;
                 $node = eZContentObjectTreeNode::fetch( $nodeID );
                 if ( !is_object( $node ) )
                 {
                     $error = true;
                     $nodeID = false;
                     $cli->notice( "Could not find content-node using ID " . $cli->stylize( 'emphasize', $nodeID ) );
                 }
             }
             else
             {
                 $path = $argument;
                 if ( preg_match( "#(.+)/\*$#", $path, $matches ) )
                 {
                     $path = $matches[1];
                     $subtree = true;
                 }
                 $node = eZContentObjectTreeNode::fetchByURLPath( $path );
                 if ( is_object( $node ) )
                 {
                     $nodeID = $node->attribute( 'node_id' );
                 }
                 else
                 {
                     $cli->notice( "Could not find content-node using path " . $cli->stylize( 'emphasize', $path ) );
                     $error = true;
                 }
             }
             if ( $nodeID )
             {
                 $nodeItem['node-id-list'][] = array( 'id' => $nodeID,
                                                      'subtree' => $subtree,
                                                      'node' => &$node );
             }
             if ( $error )
                 return false;
         }
     }
     if ( count( $nodeItem['node-id-list'] ) > 0 )
     {
         $nodeList[] = $nodeItem;
     }
     if ( count( $nodeList ) == 0 )
     {
         $cli->error( "No objects chosen" );
         return false;
     }
     if ( count( $languageList ) == 0 )
     {
         // The default is to fetch all languages
         $languageList = eZContentLanguage::fetchLocaleList();
     }
     if ( count( $siteAccessList ) == 0 )
     {
         $ini = eZINI::instance();
         $siteAccessList[] = $ini->variable( 'SiteSettings', 'DefaultAccess' );
     }
     return array( 'node-list' => $nodeList,
                   'include-classes' => $includeClasses,
                   'include-templates' => $includeTemplates,
                   'siteaccess-list' => $siteAccessList,
                   'language-list' => $languageList,
                   'node-assignment-type' => $nodeAssignmentType,
                   'related-type' => $relatedObjectType,
                   'embed-type' => $embedObjectType,
                   'version-type' => $versionType,
                   'minimal-template-set' => $minimalTemplateSet,
                   );
 }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:101,代码来源:ezcontentobjectpackagehandler.php

示例3: publishHandlerLink

 /**
  * publishHandlerLink (Publish handler, pass 2 after schema validation)
  * Publish handler for link element, converts href to [object|node|link]_id.
  *
  * @param DOMElement $element
  * @param array $param parameters for xml element
  * @return null|array changes structure if it contains 'result' key
  */
 function publishHandlerLink($element, &$params)
 {
     $ret = null;
     $href = $element->getAttribute('href');
     if ($href) {
         $objectID = false;
         if (strpos($href, 'ezobject') === 0 && preg_match("@^ezobject://([0-9]+)/?(#.+)?@i", $href, $matches)) {
             $objectID = $matches[1];
             if (isset($matches[2])) {
                 $anchorName = substr($matches[2], 1);
             }
             $element->setAttribute('object_id', $objectID);
             if (!eZContentObject::exists($objectID)) {
                 $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Object %1 does not exist.', false, array($objectID));
             }
         } elseif (strpos($href, 'eznode') === 0 && preg_match("@^eznode://([^#]+)(#.+)?@i", $href, $matches)) {
             $nodePath = trim($matches[1], '/');
             if (isset($matches[2])) {
                 $anchorName = substr($matches[2], 1);
             }
             if (is_numeric($nodePath)) {
                 $nodeID = $nodePath;
                 $node = eZContentObjectTreeNode::fetch($nodeID);
                 if (!$node instanceof eZContentObjectTreeNode) {
                     $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node %1 does not exist.', false, array($nodeID));
                 }
             } else {
                 $node = eZContentObjectTreeNode::fetchByURLPath($nodePath);
                 if (!$node instanceof eZContentObjectTreeNode) {
                     $this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node &apos;%1&apos; does not exist.', false, array($nodePath));
                 } else {
                     $nodeID = $node->attribute('node_id');
                 }
                 $element->setAttribute('show_path', 'true');
             }
             if (isset($nodeID) && $nodeID) {
                 $element->setAttribute('node_id', $nodeID);
             }
             if (isset($node) && $node instanceof eZContentObjectTreeNode) {
                 $objectID = $node->attribute('contentobject_id');
             }
         } elseif (strpos($href, '#') === 0) {
             $anchorName = substr($href, 1);
         } else {
             $temp = explode('#', $href);
             $url = $temp[0];
             if (isset($temp[1])) {
                 $anchorName = $temp[1];
             }
             if ($url) {
                 // Protection from XSS attack
                 if (preg_match("/^(java|vb)script:.*/i", $url)) {
                     $this->isInputValid = false;
                     $this->Messages[] = "Using scripts in links is not allowed, '{$url}' has been removed";
                     $element->removeAttribute('href');
                     return $ret;
                 }
                 // Check mail address validity following RFC 5322 and RFC 5321
                 if (preg_match("/^mailto:([^.][a-z0-9!#\$%&'*+-\\/=?`{|}~^]+@([a-z0-9.-]+))/i", $url, $mailAddr)) {
                     if (!eZMail::validate($mailAddr[1])) {
                         $this->isInputValid = false;
                         if ($this->errorLevel >= 0) {
                             $this->Messages[] = ezpI18n::tr('kernel/classes/datatypes/ezxmltext', "Invalid e-mail address: '%1'", false, array($mailAddr[1]));
                         }
                         $element->removeAttribute('href');
                         return $ret;
                     }
                 }
                 // Store urlID instead of href
                 $url = str_replace(array('&amp;', '%28', '%29'), array('&', '(', ')'), $url);
                 $urlID = eZURL::registerURL($url);
                 if ($urlID) {
                     if (!in_array($urlID, $this->urlIDArray)) {
                         $this->urlIDArray[] = $urlID;
                     }
                     $element->setAttribute('url_id', $urlID);
                 }
             }
         }
         if ($objectID && !in_array($objectID, $this->linkedObjectIDArray)) {
             $this->linkedObjectIDArray[] = $objectID;
         }
         if (isset($anchorName) && $anchorName) {
             $element->setAttribute('anchor_name', $anchorName);
         }
     }
     return $ret;
 }
开发者ID:legende91,项目名称:ez,代码行数:96,代码来源:ezoeinputparser.php

示例4: nodeAliasID

 function nodeAliasID($nodeName)
 {
     if (is_numeric($nodeName)) {
         $node = eZContentObjectTreeNode::fetch($nodeName, false, false);
         if (is_array($node)) {
             $result['status'] = eZContentUpload::STATUS_PERMISSION_DENIED;
             $errors[] = array('description' => ezpI18n::tr('kernel/content/upload', 'Permission denied'));
             return $nodeName;
         }
     }
     $uploadINI = eZINI::instance('upload.ini');
     $aliasList = $uploadINI->variable('UploadSettings', 'AliasList');
     if (isset($aliasList[$nodeName])) {
         return $aliasList[$nodeName];
     }
     $contentINI = eZINI::instance('content.ini');
     if ($nodeName == 'content' or $nodeName == 'root') {
         return $contentINI->variable('NodeSettings', 'RootNode');
     } else {
         if ($nodeName == 'users') {
             return $contentINI->variable('NodeSettings', 'UserRootNode');
         } else {
             if ($nodeName == 'media') {
                 return $contentINI->variable('NodeSettings', 'MediaRootNode');
             } else {
                 if ($nodeName == 'setup') {
                     return $contentINI->variable('NodeSettings', 'SetupRootNode');
                 }
             }
         }
     }
     // Check for node path element
     $pathPos = strpos($nodeName, '/');
     if ($pathPos !== false) {
         $node = eZContentObjectTreeNode::fetchByURLPath($nodeName, false);
         if (is_array($node)) {
             return $node['node_id'];
         }
     }
     return false;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:41,代码来源:ezcontentupload.php

示例5: nodeByUrl

    function nodeByUrl( $params )
    {
        $path_identification_string = $params['location'];

        $node = eZContentObjectTreeNode::fetchByURLPath( $path_identification_string );

        if( !is_object( $node ) )
        {
            $this->reportError( "The node '$path_identification_string' doesn't exist", 'eZSiteInstaller::nodeByUrl' );
        }

        return $node;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:13,代码来源:ezsiteinstaller.php

示例6: createCountry

/**
 * Creates a country object and returns it. 
 * Uses both eZContentFunctions::createAndPublishObject and eZContentFunctions::updateAndPublishObject 
 * because eZContentFunctions::createAndPublishObject doesn't take language code into consideration in this version of eZ Publish
 * @param string $countryCode
 * @param string $clusterIdentifier
 * @param string $language
 * @return eZContentObject
 */
function createCountry( $countryCode, $clusterIdentifier, $language )
{
    $countryCode = strtoupper( $countryCode );
    $countriesNode = eZContentObjectTreeNode::fetchByURLPath( 'countries' );
    $options = array(
        'parent_node_id' => $countriesNode->NodeID,
        'class_identifier' => 'country',
        'remote_id' => 'country_' . $clusterIdentifier,
        'attributes' => array(
            'name' => $countryCode,
        )
    );
    $country = eZContentFunctions::createAndPublishObject( $options );
    eZContentFunctions::updateAndPublishObject( $country, array(
        'language' => $language
    ) );

    return $country;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:28,代码来源:build_application_tree.php

示例7: generateNodeListCache

    /**
     * Generates caches for all the urls of nodes in $nodeList.
     *
     * The associative array must have on of these entries:
     * - node_id - ID of the node
     * - path_identification_string - The path_identification_string from the node table, is used to fetch the node ID if node_id is missing.
     *
     * @param array $nodeList An array with node entries, each entry is either the node ID or an associative array.
     */
    public function generateNodeListCache( $nodeList )
    {
        $db = eZDB::instance();

        foreach ( $nodeList as $uri )
        {
            if ( is_array( $uri ) )
            {
                if ( !isset( $uri['node_id'] ) )
                {
                    eZDebug::writeError( "node_id is not set for uri entry " . var_export( $uri ) . ", will need to perform extra query to get node_id" );
                    $node = eZContentObjectTreeNode::fetchByURLPath( $uri['path_identification_string'] );
                    $nodeID = (int)$node->attribute( 'node_id' );
                }
                else
                {
                    $nodeID = (int)$uri['node_id'];
                }
            }
            else
            {
                $nodeID = (int)$uri;
            }
            $elements = eZURLAliasML::fetchByAction( 'eznode', $nodeID, true, true, true );
            foreach ( $elements as $element )
            {
                $path = $element->getPath();
                $this->cacheURL( '/' . $path );
            }
        }
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:40,代码来源:ezstaticcache.php

示例8: explode

    }
    $script->shutdown(0);
} else {
    if ($options['clear-subtree']) {
        $subtreeList = explode(',', $options['clear-subtree']);
        foreach ($subtreeList as $nodeSubtree) {
            if (is_numeric($nodeSubtree)) {
                $nodeID = (int) $nodeSubtree;
                $node = eZContentObjectTreeNode::fetch($nodeID);
                if (!$node) {
                    $cli->output("Node with ID " . $cli->stylize('emphasize', $nodeID) . " does not exist, skipping");
                    continue;
                }
            } else {
                $nodeSubtree = trim($nodeSubtree, '/');
                $node = eZContentObjectTreeNode::fetchByURLPath($nodeSubtree);
                if (!$node) {
                    $cli->output("Node with subtree " . $cli->stylize('emphasize', $nodeSubtree) . " does not exist, skipping");
                    continue;
                }
            }
            $nodeSubtree = $node->attribute('path_identification_string');
            $nodeName = false;
            $object = $node->attribute('object');
            if ($object) {
                $nodeName = $object->attribute('name');
            }
            $cli->output("Clearing cache for subtree {$nodeName} ({$nodeSubtree})");
            $objectID = $node->attribute('contentobject_id');
            $offset = 0;
            $params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array());
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:ezcontentcache.php

示例9: str_replace

/**
 * Created by PhpStorm.
 * User: moeller
 * Date: 20.08.14
 * Time: 18:02
 */
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
$Module = $Params['Module'];
$resultsPerPage = (int) eZINI::instance('scvideo.ini')->variable('Settings', 'ResultsPerPage');
//$Result['content']  = $result;
//$Result['Module']   = $Module;
$Module = $Params['Module'];
$rawUrl = $Params['node_url'];
$url = str_replace(array("|", "-"), array("/", "_"), $rawUrl);
$node = eZContentObjectTreeNode::fetchByURLPath($url);
$startId = (int) $node->attribute('node_id');
$startVideo = null;
// dataMap of the requested video
$startYtId = null;
// youtube-id of the requested video
$parentNodeId = (int) $node->attribute('parent_node_id');
$filterArray = array('ClassFilterType' => 'include', 'ClassFilterArray' => array('yt_video'));
$videos = eZContentObjectTreeNode::subTreeByNodeID($filterArray, $parentNodeId);
$sortedMaps = array();
// use this map at the end
$maps = array();
// array for sorting, keys are the keywords
$maps['noKeyword'] = array();
// unsorted videos
foreach ($videos as $video) {
开发者ID:short-cut,项目名称:scvideogallery,代码行数:31,代码来源:list.php

示例10: updateParameters

 static function updateParameters($classAttribute, $newAttributeXPath)
 {
     switch ($classAttribute->DataTypeString) {
         case "ezstring":
             $maxStringLength = (int) trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezstring/maxstringlength")->item(0)->nodeValue);
             if ($maxStringLength < 1) {
                 $maxStringLength = 1;
             } elseif ($maxStringLength > 255) {
                 $maxStringLength = 255;
             }
             $classAttribute->setAttribute("data_int1", $maxStringLength);
             break;
         case "ezxmltext":
             $numberOfLines = (int) trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezxmltext/numberoflines")->item(0)->nodeValue);
             if ($numberOfLines < 1) {
                 $numberOfLines = 1;
             } elseif ($numberOfLines > 30) {
                 $numberOfLines = 30;
             }
             $classAttribute->setAttribute("data_int1", $numberOfLines);
             break;
         case "ezselection":
             // ripped off from kernel/classes/datatypes/ezselection/ezselectiontype.php
             // build the internal XML representation of the options list, first, build a new xml doc
             $doc = new DOMDocument('1.0', 'utf-8');
             $root = $doc->createElement("ezselection");
             $doc->appendChild($root);
             $options = $doc->createElement("options");
             $root->appendChild($options);
             // then loop through all the options specified in the new attribute xml and update the xml doc
             $nodeList = $newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezselection/options");
             $optionsNode = $nodeList->item(0);
             $numberOfOptions = $optionsNode->childNodes->length;
             if (1 < $numberOfOptions) {
                 for ($m = 0; $m < $numberOfOptions; $m += 1) {
                     $optionNode = $optionsNode->childNodes->item($m);
                     //echo "child value:" . trim( $optionNode->nodeValue ) . "\n";
                     $eZOptionNode = $doc->createElement("option");
                     $eZOptionNode->setAttribute('id', $m);
                     $eZOptionNode->setAttribute('name', trim($optionNode->nodeValue));
                     $options->appendChild($eZOptionNode);
                 }
             }
             // save the options data
             $eZXML = $doc->saveXML();
             $classAttribute->setAttribute("data_text5", $eZXML);
             // set multi-select versus single selection
             if (0 == trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezselection/is_multi_select")->item(0)->nodeValue)) {
                 $classAttribute->setAttribute("data_int1", 1);
             } else {
                 $classAttribute->setAttribute("data_int1", 0);
             }
             break;
         case "ezboolean":
             $defaultValue = trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezboolean/default_value")->item(0)->nodeValue);
             if ("eep-no-content" != $defaultValue) {
                 $classAttribute->setAttribute("data_int3", $defaultValue);
             }
             break;
         case "ezobjectrelation":
             $content = $classAttribute->content();
             // extract the xml
             $xmlValues = array("selection_type" => trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezobjectrelation/selection_type")->item(0)->nodeValue), "fuzzy_match" => trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezobjectrelation/fuzzy_match")->item(0)->nodeValue), "default_selection_node" => trim($newAttributeXPath->query("//newattribute/additional_for_specific_datatype/ezobjectrelation/default_selection_node")->item(0)->nodeValue));
             $content["selection_type"] = $xmlValues["selection_type"];
             $content["fuzzy_match"] = false;
             if ("false" != $xmlValues["fuzzy_match"]) {
                 $content["fuzzy_match"] = true;
             }
             $content["default_selection_node"] = false;
             if ("eep-no-content" != $xmlValues["default_selection_node"]) {
                 if (is_numeric($xmlValues["default_selection_node"])) {
                     $content["default_selection_node"] = $xmlValues["default_selection_node"];
                 } else {
                     $node = eZContentObjectTreeNode::fetchByURLPath($xmlValues["default_selection_node"]);
                     if ($node) {
                         $content["default_selection_node"] = $node->attribute("node_id");
                     }
                 }
             }
             $classAttribute->setContent($content);
             $classAttribute->store();
             break;
         case "ezmatrix":
             /*
             todo, add these to the xml and confirm that they are interpreted correctly upon
             attribute creation
             
             // ezmatrix specific values
             $params['matrix'] = array();
             $params['matrix']['type'] = 'Type';
             $params['matrix']['path'] = 'Path';
             $params['matrix']['title'] = 'Title';
             $params['matrix']['site_name'] = 'Site Name';
             $params['default_row_count'] = 0;
             */
             /*
             note that $params is wrong, and has been replaced by the xpath data
             {
                 $matrix = new eZMatrixDefinition();
                 if( !empty( $params[ "matrix" ] ) )
//.........这里部分代码省略.........
开发者ID:truffo,项目名称:eep,代码行数:101,代码来源:AttributeFunctions.php

示例11: generateNodeListCache

 /**
  * Generates caches for all the urls of nodes in $nodeList.
  *
  * The associative array must have on of these entries:
  * - node_id - ID of the node
  * - path_identification_string - The path_identification_string from the node table, is used to fetch the node ID if node_id is missing.
  *
  * @param array $nodeList An array with node entries, each entry is either the node ID or an associative array.
  */
 public function generateNodeListCache($nodeList)
 {
     $delay = eZINI::instance('staticcache.ini')->variable('CacheSettings', 'CronjobCacheClear') == 'enabled';
     /*
     echo "\n\nNodeList:<br />\n\n";
     print_r($nodeList); //die();
     */
     /*
     foreach ($nodeList as $node)
     {
         $nodeID = (int)$node;
         $elements = eZURLAliasML::fetchByAction( 'eznode', $nodeID, true, true, true );
         foreach ( $elements as $element )
         {
             $path = $element->getPath();
             $nodeListUrls[]='/' . $path;
         }
     }
     echo '<pre>'; print_r($nodeListUrls); echo '</pre>'."\n\n\n";
     die();
     */
     $db = eZDB::instance();
     foreach ($nodeList as $uri) {
         if (is_array($uri)) {
             if (!isset($uri['node_id'])) {
                 eZDebug::writeError("node_id is not set for uri entry " . var_export($uri) . ", will need to perform extra query to get node_id");
                 $node = eZContentObjectTreeNode::fetchByURLPath($uri['path_identification_string']);
                 $nodeID = (int) $node->attribute('node_id');
             } else {
                 $nodeID = (int) $uri['node_id'];
             }
         } else {
             $nodeID = (int) $uri;
         }
         $elements = eZURLAliasML::fetchByAction('eznode', $nodeID, true, true, true);
         foreach ($elements as $element) {
             $path = $element->getPath();
             // print_r("cacheUrl: $path <hr/>\n\n");
             $this->cacheURL('/' . $path, false, false, $delay);
         }
     }
     //die();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:52,代码来源:ezecosystemstaticcache.php

示例12: getNodeFromPath

    /**
     * @param string $nodePath
     * @param eZContentObjectTreeNode[] $publisherFolderNodes
     * @return eZContentObjectTreeNode
     */
    static protected function getNodeFromPath ( $nodePath, $publisherFolderNodes )
    {
        // Remove view parameters
        $nodePath = preg_replace( '#/\([^\)]+\)/.*$#', '', $nodePath );
        $node = false;

        foreach ( $publisherFolderNodes as $publisherFolderNode )
        {
            $nodeFullPath = '/' . $publisherFolderNode->attribute('url_alias') . '/' . $nodePath;
            $node = eZContentObjectTreeNode::fetchByURLPath( $nodeFullPath );

            if (!$node)
            {
                $node = eZContentObjectTreeNode::fetchByPath($nodeFullPath);

                if (!$node)
                {
                    $cleanableHref  = $nodeFullPath;
                    $aliasTranslate = eZURLAliasML::translate($cleanableHref);

                    while ( $aliasTranslate !== true && $aliasTranslate !== false )
                    {
                        $cleanableHref  = $aliasTranslate;
                        $aliasTranslate = eZURLAliasML::translate($cleanableHref);
                    }

                    if ( $aliasTranslate === true )
                    {
                        $lastSlashPosition = strrpos($cleanableHref, '/');

                        if( $lastSlashPosition !== false )
                            $node = eZContentObjectTreeNode::fetch(substr($cleanableHref, $lastSlashPosition+1));
                    }
                }

                if (!$node)
                {
                    $tabNodePath    = explode('/', substr($nodeFullPath, 1));
                    $remoteId       = end($tabNodePath);
                    $nodeRemote     = eZContentObjectTreeNode::fetchByRemoteID($remoteId);

                    if($nodeRemote && $publisherFolderNode)
                    {
                        $rootNodeID     = $publisherFolderNode->attribute('node_id');
                        $tabNodeRemote  = $nodeRemote->pathArray();
                        $nodeId         = $nodeRemote->attribute('node_id');

                        if(in_array($rootNodeID, $tabNodeRemote) && $rootNodeID != $nodeId)
                            $node = $nodeRemote;
                        /*******************************************************************************
                         * TODO : Delete after PF Refactor
                         *******************************************************************************/
                        else
                        {
                            $publisherFolderPathArray = $publisherFolderNode->pathArray();
                            foreach ( $nodeRemote->object()->assignedNodes() as $location )
                            {
                                if ( in_array( $publisherFolderPathArray[2], $location->pathArray() ) )
                                {
                                    $node = $location;
                                    break;
                                }
                            }
                        }
                        /*******************************************************************************
                         * TODO : END : Delete after PF Refactor
                         *******************************************************************************/
                    }
                }
            }
            
            if ($node instanceof eZContentObjectTreeNode)
                break;
        }


        // if we still do not have a node, we try to look in the old locations
        if ( !($node instanceof eZContentObjectTreeNode) )
        {
            $pfrLocation = null;

            if ( preg_match('#node_(?P<node_id>\d+)/?$#', $nodePath, $m) )
            {
                $nodeId = $m['node_id'];
                $pfrLocation = PfrLocation::fetchByNodeId( $nodeId );
            }
            else
            {
                $remoteId = basename( rtrim($nodePath, '/') );
                $pfrLocation = PfrLocation::fetchByRemoteId( $remoteId );
            }

            if ( $pfrLocation instanceof PfrLocation )
            {
                $node = $pfrLocation->node( $publisherFolderNodes );
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:applicationFactory.php


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