コード例 #1
0
 /**
  * Replace all occurrences of node-placeholders (NODE_...) by their
  * URL-representation.
  * @param   mixed $content  Either a string or an array of strings in which the node-placeholders shall be replaced by their URL-representation.
  * @param   boolean $absoluteUris   Set to TRUE to replace the node-placeholders by absolute URLs.
  * @param   Cx\Core\Net\Model\Entity\Domain $domain Set the domain that shall be used when absolute URLs shall be generated.
  */
 public static function parseTemplate(&$content, $absoluteUris = false, \Cx\Core\Net\Model\Entity\Domain $domain = null)
 {
     $lg = new LinkGenerator($absoluteUris, $domain);
     if (!is_array($content)) {
         $arrTemplates = array(&$content);
     } else {
         $arrTemplates =& $content;
     }
     foreach ($arrTemplates as &$template) {
         $lg->scan($template);
     }
     $lg->fetch(Env::get('em'));
     foreach ($arrTemplates as &$template) {
         $lg->replaceIn($template);
     }
 }