示例#1
0
 /**
  * Retrieve an included page
  * This is recursive and should look for inclusions in any included page.
  *
  * @param      array $matches Pattern matches from includes() method
  * @return     string
  */
 private function _getInclude($matches)
 {
     if (isset($matches[1]) && $matches[1] != '') {
         if (strtolower($matches[1]) != 'include') {
             return $matches[0];
         }
         if (!$this->get('fullparse')) {
             return "'''Includes not allowed.'''";
         }
         $scope = $this->get('domain') ? $this->get('domain') . DS . 'wiki' : $this->get('scope');
         if (strstr($matches[3], '/')) {
             $bits = explode('/', $matches[3]);
             $pagename = array_pop($bits);
             $s = trim(implode('/', $bits));
             $scope .= DS . trim($s, DS);
         } else {
             $pagename = $matches[3];
         }
         // Don't include this page (infinite loop!)
         if ($pagename == $this->get('pagename') && $scope == $this->get('scope')) {
             return '';
         }
         // Load the page
         $p = \Components\Wiki\Tables\Page::getInstance($pagename, $scope);
         if ($p->id) {
             // Parse any nested includes
             return $this->includes($p->getCurrentRevision()->pagetext);
         }
     }
     return '';
 }