コード例 #1
0
ファイル: Link.php プロジェクト: jkimdon/cohomeals
 function __construct($page, &$parser)
 {
     global $tikilib, $prefs;
     $this->page = $this->description = $page;
     $this->parser =& $parser;
     $this->namespaceSeparator = $prefs['namespace_separator'];
     if ($prefs['feature_multilingual'] == 'y' && isset($GLOBALS['pageLang'])) {
         $this->language = $GLOBALS['pageLang'];
     }
     // Fetch all externals once
     if (false === self::$externals) {
         self::$externals = $tikilib->fetchMap('SELECT LOWER(`name`), `extwiki` FROM `tiki_extwiki`');
     }
     $this->info = $this->findWikiPage();
 }
コード例 #2
0
ファイル: Handler.php プロジェクト: jkimdon/cohomeals
 /**
  * syntax handler: link, [$content|$content], ((Page)), ((Page|$content)), (type(Page)), (type(Page|$content)), ((external:Page)), ((external:Page|$content))
  *
  * @access  public
  * @param   $type string type, np, wiki, alias (or whatever is "(here(", word
  * @param   $content string found inside detected syntax
  * @param   $includePageAsDataAttribute bool includes the page as an attribute in the link "data-page"
  * @return  string  $content desired output from syntax
  */
 function link($type, $page, $includePageAsDataAttribute = false)
 {
     global $tikilib, $prefs;
     if ($type == 'word' && $prefs['feature_wikiwords'] != 'y') {
         return $page;
     }
     $this->removeEOF($page);
     $wikiExternal = '';
     $parts = explode(':', $page);
     if (isset($parts[1]) && $type != 'external') {
         $wikiExternal = array_shift($parts);
         $page = implode(':', $parts);
     }
     $description = '';
     $parts = explode('|', $page);
     if (isset($parts[1])) {
         $page = array_shift($parts);
         $description = implode('|', $parts);
     }
     if (!empty($description)) {
         $feature_wikiwords = $prefs['feature_wikiwords'];
         $prefs['feature_wikiwords'] = 'n';
         $description = $this->parse($description);
         $this->removeEOF($description);
         $prefs['feature_wikiwords'] = $feature_wikiwords;
     }
     return JisonParser_Wiki_Link::page($page, $this->Parser)->setNamespace($this->getOption('namespace'))->setDescription($description)->setType($type)->setSuppressIcons($this->getOption('suppress_icons'))->setSkipPageCache($this->getOption('skipPageCache'))->setWikiExternal($wikiExternal)->includePageAsDataAttribute($includePageAsDataAttribute)->getHtml();
 }