diff --git a/public_html/lib/plugins/pagetitle/action.php b/public_html/lib/plugins/pagetitle/action.php
new file mode 100644
index 00000000..dda80b11
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/action.php
@@ -0,0 +1,28 @@
+
+ */
+
+if(!defined('DOKU_INC')) die();
+
+class action_plugin_pagetitle extends DokuWiki_Action_Plugin {
+
+ /**
+ * register the event handlers
+ */
+ public function register(Doku_Event_Handler $controller) {
+ $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'deleteObsoletedSingleClass');
+ }
+
+ /**
+ * Delete syntax.php which is obsoleted since multi-components syntax structure
+ */
+ public function deleteObsoletedSingleClass(Doku_Event $event) {
+ $legacyFile = dirname(__FILE__).'/syntax.php';
+ if (file_exists($legacyFile)) { unlink($legacyFile); }
+ }
+
+}
diff --git a/public_html/lib/plugins/pagetitle/all.css b/public_html/lib/plugins/pagetitle/all.css
new file mode 100644
index 00000000..28406ce5
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/all.css
@@ -0,0 +1,14 @@
+/*
+ * DokuWiki plugin PageTitle
+ */
+
+/* Hierarchical breadcrumbs in pages */
+#dokuwiki__content div.youarehere:empty {
+ display: none;
+}
+#dokuwiki__content .youarehere {
+ font-size: 85%;
+}
+#dokuwiki__content .youarehere:before {
+ content:"⌇";
+}
diff --git a/public_html/lib/plugins/pagetitle/deleted.files b/public_html/lib/plugins/pagetitle/deleted.files
new file mode 100644
index 00000000..2ca72777
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/deleted.files
@@ -0,0 +1,9 @@
+# deleted.files : Page Title plugin for DokuWiki
+#
+# This file contains a list of files that were present in previous
+# plugin releases but were removed later.
+# An up-to-date plugin should not have any of the files installed.
+
+# Since 2015-09-17
+syntax.php
+
diff --git a/public_html/lib/plugins/pagetitle/helper.php b/public_html/lib/plugins/pagetitle/helper.php
new file mode 100644
index 00000000..57545e2f
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/helper.php
@@ -0,0 +1,219 @@
+
+ */
+
+if (!defined('DOKU_INC')) die();
+
+class helper_plugin_pagetitle extends DokuWiki_Plugin {
+
+ /**
+ * Hierarchical breadcrumbs for PageTitle plugin
+ *
+ * @param int $start_depth of hierarchical breadcrumbs
+ * @param bool $print if false return content
+ * @return bool|string html, or false if no data, true if printed
+ */
+ function tpl_youarehere($start_depth = 0, $print = true) {
+ global $lang;
+
+ $out = ''.$lang['youarehere'].'';
+ $out.= $this->html_youarehere($start_depth);
+ if ($print) {
+ echo $out; return (bool) $out;
+ }
+ return $out;
+ }
+
+ function html_youarehere($start_depth = 0) {
+ global $conf, $ID;
+
+ if ($ID == $conf['start']) {
+ $page = '';
+ } elseif (noNS($ID) == $conf['start']) {
+ $page = ':'.getNS($ID); // drop tailing start
+ } else {
+ $page = ':'.$ID;
+ }
+
+ $parts = explode(':', $page);
+ $depth = count($parts) -1;
+
+ $out = '';
+ $ns = '';
+ for ($i = $start_depth; $i < count($parts); $i++) {
+ $ns.= $parts[$i];
+ $id = $ns ?: $conf['start'];
+ resolve_pageid('', $id, $exists);
+ if (!$exists) {
+ $id = $ns.':';
+ resolve_pageid('', $id, $exists);
+ }
+ $name = p_get_metadata($id, 'shorttitle') ?: $parts[$i];
+ $out.= ''.$this->html_pagelink($id, $name, $exists).'';
+ if ($i < $depth) $out.= ' › '; // separator
+ $ns.= ':';
+ }
+ return $out;
+ }
+
+
+ /**
+ * Prints a link to a WikiPage
+ * a customised function based on
+ * tpl_pagelink() defined in inc/template.php,
+ * html_wikilink() defined in inc/html.php,
+ * internallink() defined in inc/parser/xhtml.php
+ *
+ * @param string $id page id
+ * @param string $name the name of the link
+ * @param bool $exists
+ * @param bool $print if false return content
+ * @return bool|string html, or false if no data, true if printed
+ */
+ function tpl_pagelink($id = null, $name = null, $exists = null, $print = true) {
+ global $conf;
+
+ $out = $this->html_pagelink($id, $name, $exists);
+ if ($print) {
+ echo $out; return (bool) $out;
+ }
+ return $out;
+ }
+
+ function html_pagelink($id = null, $name = null, $exists = null) {
+ global $conf, $ID;
+
+ if (is_null($id)) $id = $ID;
+
+ $title = p_get_metadata($id, 'title');
+ if (empty($title)) $title = $id;
+
+ if (is_null($exists)) {
+ $class = (page_exists($id)) ? 'wikilink1' : 'wikilink2';
+ } else {
+ $class = ($exists) ? 'wikilink1' : 'wikilink2';
+ }
+
+ $short_title = $name;
+ if (empty($name)) {
+ $short_title = p_get_metadata($id, 'shorttitle') ?: noNS($id);
+ }
+
+ $out = '';
+ $out.= hsc($short_title).'';
+ return $out;
+ }
+
+
+ /**
+ * builds url of a wikipage
+ * a simplified function of DokuWiki wl() defined inc/common.php
+ *
+ * @param string $id page id
+ * @return string
+ */
+ function wl($id = null) {
+ global $conf;
+
+ if (noNS($id) == $conf['start']) $id = ltrim(getNS($id).':', ':');
+ idfilter($id);
+
+ $xlink = DOKU_BASE;
+
+ switch ($conf['userewrite']) {
+ case 2: // eg. DOKU_BASE/doku.php/wiki:syntax
+ $xlink .= DOKU_SCRIPT.'/'.$id;
+ case 1: // eg. DOKU_BASE/wiki:syntax
+ $xlink .= $id;
+ $xlink = ($xlink == '/') ? '/' : rtrim($xlink,'/');
+ break;
+ default:
+ $xlink .= DOKU_SCRIPT;
+ $xlink .= ($id) ? '?id='.$id : '';
+ }
+ return $xlink;
+ }
+
+
+ /**
+ * Prints or returns the title of the given page (current one if none given)
+ * modified from DokuWiki original function tpl_pagetitle()
+ * defined in inc/template.php
+ * This variant function returns title from metadata, ignoring $conf['useheading']
+ *
+ * @param string $id page id
+ * @param bool $print if false return content
+ * @return bool|string html, or false if no data, true if printed
+ */
+ function tpl_pagetitle($id = null, $print = true) {
+
+ $out = $this->pagetitle($id);
+ if ($print) {
+ echo $out; return (bool) $out;
+ }
+ return $out;
+ }
+
+ function pagetitle($id = null) {
+ global $ACT, $ID, $conf, $lang;
+
+ if (is_null($id)) {
+ $title = (p_get_metadata($ID, 'title')) ?: $ID;
+ } else {
+ $title = (p_get_metadata($id, 'title')) ?: $id;
+ }
+
+ // default page title is the page name, modify with the current action
+ switch ($ACT) {
+ // admin functions
+ case 'adminhomepage' :
+ case 'admin' :
+ $page_title = $lang['btn_admin'];
+ // try to get the plugin name
+ /** @var $plugin DokuWiki_Admin_Plugin */
+ if (function_exists('plugin_getRequestAdminPlugin') &&
+ ($plugin = plugin_getRequestAdminPlugin()) ) {
+ $plugin_title = $plugin->getMenuText($conf['lang']);
+ $page_title = $plugin_title ? $plugin_title : $plugin->getPluginName();
+ }
+ break;
+
+ // user functions
+ case 'login' :
+ case 'profile' :
+ case 'register' :
+ case 'resendpwd' :
+ $page_title = $lang['btn_'.$ACT];
+ break;
+
+ // wiki functions
+ case 'search' :
+ case 'index' :
+ $page_title = $lang['btn_'.$ACT];
+ break;
+
+ // page functions
+ case 'edit' :
+ $page_title = "✎ ".$title;
+ break;
+
+ case 'revisions' :
+ $page_title = $title . ' - ' . $lang['btn_revs'];
+ break;
+
+ case 'backlink' :
+ case 'recent' :
+ case 'subscribe' :
+ $page_title = $title . ' - ' . $lang['btn_'.$ACT];
+ break;
+
+ default : // SHOW and anything else not included
+ $page_title = $title;
+ }
+ return hsc($page_title);
+ }
+}
diff --git a/public_html/lib/plugins/pagetitle/manager.dat b/public_html/lib/plugins/pagetitle/manager.dat
new file mode 100644
index 00000000..ebeaac7c
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/manager.dat
@@ -0,0 +1,2 @@
+downloadurl=https://github.com/ssahara/dw-plugin-pagetitle/zipball/master
+installed=Mon, 05 Sep 2016 13:14:32 +0000
diff --git a/public_html/lib/plugins/pagetitle/plugin.info.txt b/public_html/lib/plugins/pagetitle/plugin.info.txt
index f4673c59..eb09ed47 100644
--- a/public_html/lib/plugins/pagetitle/plugin.info.txt
+++ b/public_html/lib/plugins/pagetitle/plugin.info.txt
@@ -1,7 +1,7 @@
base pagetitle
-name Page title plugin
+name Page Title plugin
author Satoshi Sahara
email sahara.satoshi@gmail.com
-date 2014-08-10
-desc Macro to set the title of the page in metadata.
+date 2016-09-02
+desc Define a title of the wiki page by
tag. This plugin allows to write decorative title on the page with setting plain title text in metadata storage.
url https://www.dokuwiki.org/plugin:pagetitle
diff --git a/public_html/lib/plugins/pagetitle/syntax.php b/public_html/lib/plugins/pagetitle/syntax.php
deleted file mode 100644
index 3fc69d41..00000000
--- a/public_html/lib/plugins/pagetitle/syntax.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- */
-
-if (!defined('DOKU_INC')) die();
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'syntax.php');
-
-class syntax_plugin_pagetitle extends DokuWiki_Syntax_Plugin {
-
- protected $special_pattern = '~~(?:Title|ShortTitle):.*?~~';
-
- public function getType() { return 'substition'; }
- public function getPType(){ return 'block'; }
- public function getSort() { return 990; }
-
- public function connectTo($mode) {
- $this->Lexer->addSpecialPattern($this->special_pattern, $mode,
- implode('_', array('plugin',$this->getPluginName(),))
- );
- }
-
- public function handle($match, $state, $pos, Doku_Handler $handler) {
- return array($state, $match);
- }
-
- public function render($format, Doku_Renderer $renderer, $data) {
-
- list($state, $match) = $data;
- list($key, $value) = explode(':', substr($match, 2, -2), 2);
- $key = strtolower($key);
-
- if ($format == 'metadata') {
- $renderer->meta[$key] = trim($value);
- }
- return true;
- }
-
-}
-
diff --git a/public_html/lib/plugins/pagetitle/syntax/breadcrumb.php b/public_html/lib/plugins/pagetitle/syntax/breadcrumb.php
new file mode 100644
index 00000000..ebea7a87
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/syntax/breadcrumb.php
@@ -0,0 +1,57 @@
+
+ */
+
+if (!defined('DOKU_INC')) die();
+
+class syntax_plugin_pagetitle_breadcrumb extends DokuWiki_Syntax_Plugin {
+
+ protected $special_pattern = '~~ShortTitle:.*?~~';
+ protected $check = array(); // ensure first matched pattern only effective
+ protected $mode;
+
+ function __construct() {
+ $this->mode = substr(get_class($this), 7); // drop 'syntax_' from class name
+ }
+
+ public function getType() { return 'substition'; }
+ public function getPType(){ return 'normal'; }
+ public function getSort() { return 990; }
+
+ public function connectTo($mode) {
+ $this->Lexer->addSpecialPattern($this->special_pattern, $mode, $this->mode);
+ }
+
+ public function handle($match, $state, $pos, Doku_Handler $handler) {
+ global $ID;
+
+ if ($this->check[$ID]++) {
+ return false; // ignore match after once handled
+ }
+
+ list($key, $value) = explode(':', substr($match, 2, -2), 2);
+ $short_title = trim($value);
+ return array($state, $short_title, $ID);
+ }
+
+ public function render($format, Doku_Renderer $renderer, $data) {
+ global $ID;
+
+ list($state, $short_title, $id) = $data;
+ if (strcmp($id, $ID) !== 0) return false;
+
+ switch ($format) {
+ case 'metadata':
+ $renderer->meta['shorttitle'] = $short_title;
+ return true;
+ default:
+ return false;
+ }
+ }
+
+}
diff --git a/public_html/lib/plugins/pagetitle/syntax/decorative.php b/public_html/lib/plugins/pagetitle/syntax/decorative.php
new file mode 100644
index 00000000..3db58541
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/syntax/decorative.php
@@ -0,0 +1,144 @@
+
+ *
+ * The title text can contain wiki formatting markups such as bold,
+ * itlic, subscript and superscript, but title metadata remains simple
+ * plain text without any markup.
+ * example
+ * wiki source: HsO
+ * page (html): H2O
+ * title metadata: H2O
+ */
+
+if (!defined('DOKU_INC')) die();
+
+class syntax_plugin_pagetitle_decorative extends DokuWiki_Syntax_Plugin {
+
+ protected $entry_pattern = '\r\n]*?>(?=.*?)';
+ protected $exit_pattern = '';
+
+ protected $mode, $name;
+ protected $store, $capture;
+ protected $params; // store title tag parameters
+ protected $check = array(); // ensure first title only effective, used in render()
+
+ function __construct() {
+ $this->mode = substr(get_class($this), 7); // drop 'syntax_' from class name
+ $this->name = substr(get_class($this), 14);
+ }
+
+ function getType() { return 'baseonly';}
+ function getPType() { return 'block';}
+ function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); }
+ function getSort() { return 49; }
+
+ // Connect pattern to lexer
+ function connectTo($mode) {
+ $this->Lexer->addEntryPattern($this->entry_pattern, $mode, $this->mode);
+ }
+ function postConnect() {
+ $this->Lexer->addExitPattern($this->exit_pattern, $this->mode);
+ }
+
+
+ /*
+ * Handle the match
+ */
+ function handle($match, $state, $pos, Doku_Handler $handler) {
+ global $ID;
+
+ if ($this->check[$ID] > 0) {
+ return false; // ignore match after once handled
+ }
+
+ switch ($state) {
+ case DOKU_LEXER_ENTER :
+ $params = strtolower(trim(substr($match, strpos($match,' '), -1)));
+ $data = array($state, $ID, $params);
+ $handler->addPluginCall($this->name, $data, $state,$pos,$match);
+ return false;
+ case DOKU_LEXER_UNMATCHED :
+ $handler->_addCall('cdata', array($match), $pos);
+ return false;
+ case DOKU_LEXER_EXIT :
+ $data = array($state, $ID, '');
+ $handler->addPluginCall($this->name, $data, $state,$pos,$match);
+ $this->check[$ID]++;
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * Create output
+ */
+ function render($format, Doku_Renderer $renderer, $data) {
+ global $ID;
+
+ list($state, $id, $params) = $data;
+ switch ($state) {
+ case DOKU_LEXER_ENTER :
+ // store title tag parameters
+ $this->params = $params;
+ // preserve variables
+ $this->store = $renderer->doc;
+ $this->capture = $renderer->capture;
+
+ // set doc blank to store parsed "UNMATHCED" content
+ $renderer->doc = '';
+ // metadata renderer should always parse "UNMATCHED" content
+ if ($format == 'metadata') $renderer->capture = true;
+
+ return true;
+ break;
+ case DOKU_LEXER_EXIT :
+ // retrieve parsed "UNMATCHED" content
+ $decorative_title = trim($renderer->doc);
+
+ // restore variable
+ $renderer->doc = $this->store;
+ if ($format == 'metadata') $renderer->capture = $this->capture;
+ break; // do not return here
+ default:
+ return false; // this should never happen
+ }
+ if (strcmp($id, $ID) !== 0) return false;
+
+ // get plain title
+ $title = htmlspecialchars_decode(strip_tags($decorative_title), ENT_QUOTES);
+ if (empty($title)) return false;
+
+ // output title
+ $method = '_' . $format . '_render';
+ if (method_exists($this, $method)) {
+ return $this->$method($decorative_title, $title, $renderer);
+ }
+ else return false;
+ }
+
+ /**
+ * Revised procedures for renderers
+ */
+ protected function _xhtml_render($decorative_title, $title, $renderer) {
+ if (($wrap = $this->loadHelper('wrap')) != NULL) {
+ $attr = $wrap->buildAttributes($this->params, 'pagetitle');
+ } else $attr = ' class="pagetitle"';
+
+ // even title in , it never shown up in the table of contents (TOC)
+ $renderer->doc .= '';
+ $renderer->doc .= $decorative_title;
+ $renderer->doc .= '
'.DOKU_LF;
+ return true;
+ }
+
+ protected function _metadata_render($decorative_title, $title, $renderer) {
+ $renderer->meta['title'] = $title;
+ return true;
+ }
+
+}
diff --git a/public_html/lib/plugins/pagetitle/syntax/metaonly.php b/public_html/lib/plugins/pagetitle/syntax/metaonly.php
new file mode 100644
index 00000000..db514f82
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/syntax/metaonly.php
@@ -0,0 +1,38 @@
+
+ *
+ */
+
+require_once(dirname(__FILE__).'/decorative.php');
+
+class syntax_plugin_pagetitle_metaonly extends syntax_plugin_pagetitle_decorative {
+
+ protected $entry_pattern = '~~Title:(?=.*?~~)';
+ protected $exit_pattern = '~~';
+
+
+ function getType() { return 'baseonly';}
+ function getPType() { return 'normal';}
+ function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); }
+ function getSort() { return 49; }
+
+
+ /**
+ * Revised procedures for renderers
+ */
+ protected function _xhtml_render($decorative_title, $title, $renderer) {
+ return true;
+ }
+
+ protected function _metadata_render($decorative_title, $title, $renderer) {
+ $renderer->meta['title'] = $title;
+ return true;
+ }
+
+}
diff --git a/public_html/lib/plugins/pagetitle/syntax/youarehere.php b/public_html/lib/plugins/pagetitle/syntax/youarehere.php
new file mode 100644
index 00000000..10984fcc
--- /dev/null
+++ b/public_html/lib/plugins/pagetitle/syntax/youarehere.php
@@ -0,0 +1,45 @@
+
+ */
+
+if (!defined('DOKU_INC')) die();
+
+class syntax_plugin_pagetitle_youarehere extends DokuWiki_Syntax_Plugin {
+
+ protected $special_pattern = '';
+ protected $mode;
+
+ function __construct() {
+ $this->mode = substr(get_class($this), 7); // drop 'syntax_' from class name
+ }
+
+ public function getType() { return 'substition'; }
+ public function getPType(){ return 'block'; }
+ public function getSort() { return 990; }
+
+ public function connectTo($mode) {
+ $this->Lexer->addSpecialPattern($this->special_pattern, $mode, $this->mode);
+ }
+
+ public function handle($match, $state, $pos, Doku_Handler $handler) {
+ return array($state, $match);
+ }
+
+ public function render($format, Doku_Renderer $renderer, $data) {
+
+ list($state, $match) = $data;
+ $template = plugin_load('helper','pagetitle');
+
+ $renderer->doc .= DOKU_LF.$match.DOKU_LF; // html comment
+ $renderer->doc .= '
';
+ $renderer->doc .= $template->html_youarehere(1); // start_depth = 1
+ $renderer->doc .= '
'.DOKU_LF;
+ return true;
+ }
+
+}