Ejemplo n.º 1
0
 public function setPattern($arr, $page)
 {
     global $foot_explain, $vars;
     list(, $body) = $this->splice($arr);
     // Recover of notes(miko)
     if (count($foot_explain) === 0) {
         self::$note_id = 0;
     }
     $script = !self::ALLOW_RELATIVE_FOOTNOTE_ANCHOR ? Factory::Wiki($page)->uri() : '';
     $id = ++self::$note_id;
     $note = InlineFactory::factory($body);
     $page = isset($vars['page']) ? rawurlencode($vars['page']) : null;
     // Footnote
     $foot_explain[$id] = '<li id="notefoot_' . $id . '">' . '<a href="' . $script . '#notetext_' . $id . '" class="note_super">' . RendererDefines::FOOTNOTE_ANCHOR_ICON . $id . '</a>' . $note . '</li>';
     if (!IS_MOBILE) {
         // A hyperlink, content-body to footnote
         if (!is_numeric(self::FOOTNOTE_TITLE_MAX) || self::FOOTNOTE_TITLE_MAX <= 0) {
             $title = '';
         } else {
             $title = strip_tags($note);
             $count = mb_strlen($title, SOURCE_ENCODING);
             $title = mb_substr($title, 0, self::FOOTNOTE_TITLE_MAX, SOURCE_ENCODING);
             $abbr = mb_strlen($title) < $count ? '...' : '';
             $title = ' title="' . $title . $abbr . '"';
         }
         $name = '<a id="notetext_' . $id . '" href="' . $script . '#notefoot_' . $id . '" class="note_super"' . $title . '>' . RendererDefines::FOOTNOTE_ANCHOR_ICON . $id . '</a>';
     } else {
         // モバイルは、ツールチップで代用
         $name = '<span class="note_super" aria-describedby="tooltip" data-msgtext="' . strip_tags($note) . '">' . RendererDefines::FOOTNOTE_ANCHOR_ICON . $id . '</span>';
     }
     return parent::setParam($page, $name, $body);
 }
Ejemplo n.º 2
0
 public function setPattern($arr, $page)
 {
     list($name) = $this->splice($arr);
     // Ignore pages listed, or Expire ones not found
     if (in_array($name, $this->forceignorepages) || !is_page($name)) {
         return FALSE;
     }
     return parent::setParam($page, $name, null, 'pagename', $name);
 }
Ejemplo n.º 3
0
 public function setPattern($arr, $page)
 {
     list($name) = $this->splice($arr);
     // Ignore words listed
     if (in_array($name, $this->forceignorepages)) {
         return FALSE;
     }
     return parent::setParam($page, $name, null, 'pagename', $name);
 }
Ejemplo n.º 4
0
 public function setPattern($arr, $page)
 {
     list($all, $this->plain, $name, $this->param, $body) = $this->splice($arr);
     // Re-get true plugin name and patameters (for PHP 4.1.2)
     $matches = array();
     if (preg_match('/^' . $this->pattern . '/x', $all, $matches) && $matches[1] != $this->plain) {
         list(, $this->plain, $name, $this->param) = $matches;
     }
     return parent::setParam($page, $name, $body, 'plugin');
 }
Ejemplo n.º 5
0
 public function setPattern($arr, $page)
 {
     list(, $alias, , $this->interwikiname, $this->param) = $this->splice($arr);
     $matches = array();
     if (preg_match('/^([^#]+)(#[A-Za-z][\\w-]*)$/', $this->param, $matches)) {
         list(, $this->param, $this->anchor) = $matches;
     }
     $url = self::getInterWikiUrl($this->interwikiname, $this->param);
     if ($url === FALSE) {
         return $this->interwikiname . ':' . $this->param;
     }
     $this->url = Utility::htmlsc($url);
     return parent::setParam($page, Utility::htmlsc($this->interwikiname . ':' . $this->param), null, 'InterWikiName', empty($alias) ? $this->interwikiname . ':' . $this->param : $alias);
 }
Ejemplo n.º 6
0
 public function setPattern($arr, $page)
 {
     list(, $alias, $toname, $host) = $this->splice($arr);
     $name = $orginalname = $toname . $host;
     if (extension_loaded('intl')) {
         // 国際化ドメイン対応
         if (preg_match('/[^A-Za-z0-9.-]/', $host)) {
             $name = $toname . idn_to_ascii($host);
         } else {
             if (!$alias && strtolower(substr($host, 0, 4)) === 'xn--') {
                 $orginalname = $toname . idn_to_utf8($host);
             }
         }
     }
     return parent::setParam($page, $name, '', 'mailto', $alias === '' ? $orginalname : $alias);
 }
Ejemplo n.º 7
0
 public function setPattern($arr, $page)
 {
     list(, $alias, , $name, $this->anchor) = $this->splice($arr);
     if (empty($name) && empty($this->anchor)) {
         return FALSE;
     }
     if (empty($name) || !Utility::isWikiName($name)) {
         if (empty($alias)) {
             $alias = $name . $this->anchor;
         }
         if (!empty($name)) {
             $name = self::getFullname($name, $page);
             if (!empty($name) && !Factory::Wiki($name)->isValied()) {
                 return FALSE;
             }
         }
     }
     return parent::setParam($page, $name, null, 'pagename', $alias);
 }
Ejemplo n.º 8
0
 public function setPattern($arr, $page)
 {
     list(, $bracket, $alias, $scheme, $mail, $host, $uri) = $this->splice($arr);
     $this->has_bracket = substr($bracket, 0, 2) === '[[';
     $this->host = $host;
     if (extension_loaded('intl') && $host !== '/' && preg_match('/[^A-Za-z0-9.-]/', $host)) {
         $host = idn_to_ascii($host);
     }
     $name = $scheme . $mail . $host;
     // https?:/// -> $this->cont['ROOT_URL']
     $name = preg_replace('#^(?:site:|https?:/)//#', ROOT_URI, $name) . $uri;
     if (!$alias) {
         // Punycode化されたドメインかを判別
         $alias = extension_loaded('intl') && strtolower(substr($host, 0, 4)) === 'xn--' ? $scheme . $mail . idn_to_utf8($host) . $uri : $name;
         if (strpos($alias, '%') !== FALSE) {
             // TODO:mb_convert_encoding(): Unable to detect character encodingが出るので@を付加
             $alias = @mb_convert_encoding(rawurldecode($alias), SOURCE_ENCODING, 'AUTO');
         }
     }
     $this->alias = $alias;
     return parent::setParam($page, $name, null, $mail ? 'mailto' : 'url', $alias);
 }
Ejemplo n.º 9
0
 public function setPattern($arr, $page)
 {
     list(, $this->param, $body) = $this->splice($arr);
     $this->param = trim($this->param);
     return parent::setParam($page, 'ref', $body, 'plugin');
 }
Ejemplo n.º 10
0
 public function setPattern($arr, $page)
 {
     list(, $alias, $tel) = $this->splice($arr);
     $name = $orginalname = $tel;
     return parent::setParam($page, $name, '', 'tel', $alias === '' ? $orginalname : $alias);
 }
Ejemplo n.º 11
0
 public function setPattern($arr, $page)
 {
     list(, $name, $alias) = $this->splice($arr);
     return parent::setParam($page, Utility::htmlsc($name), null, 'url', $alias);
 }
Ejemplo n.º 12
0
 public function setPattern($arr, $page)
 {
     list($name) = $this->splice($arr);
     return parent::setParam($page, $name, null, 'pagename', $name);
 }