*xpwiki [#tac42d8f] [[xpwiki>+http://xoops.hypweb.net/modules/xpwiki/]] ~ *xpwiki別窓リンク [#haadb56e] ファイルの編集箇所は[[PukiWikiでの別窓リンク方法>PukiWiki/改良/別窓リンク]]と似ているのだが、編集箇所の一部が違うのでメモ 使い方はPukiWikiでの場合と同じでURLの先頭に”+”を付加する # cd [XOOPS_TRUST_PATH]/modules/xpwiki/class # cp make_link.php make_link.php- # chown root.root make_link.php- # chmod 400 make_link.php- # vi make_link.php ~ 以後の書き換える場所は、バージョン毎によって変化 [[ver 4.x>#vc76c24f]] [[ver 5.x>#g5d8add3]] ~ *xpwiki別窓リンク - ver 4.x [#eb16a933] -&size(16){&font(b){クラス名:XpWikiLink_url extends XpWikiLink};}; -メソッド名:function get_pattern() -( # (3) url - (?:(?:https?|ftp|news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ -) _/_/_/_/_/ +( # (3) url + (?:(?:\+?https?|\+?ftp|\+?news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ +) ~ -メソッド名:function toString() - $img = ($this->is_image)? ' type="img"' : ''; - return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'; _/_/_/_/_/ + $img = ($this->is_image)? ' type="img"' : ''; + if (ereg("^(\+)(.*)", $this->name, $regs)) { + return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>'; + }else{ + return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>'; + } ---- -&size(16){&font(b){クラス名:XpWikiLink_url_i18n extends XpWikiLink};}; -メソッド名:function get_pattern() -( # (3) scheme - (?:(?:https?|ftp|news):\/\/|mailto:) -) _/_/_/_/_/ +( # (3) scheme + (?:(?:\+?https?|\+?ftp|\+?news):\/\/|mailto:) +) ~ -メソッド名:function toString() - return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'.$host; _/_/_/_/_/ + if (ereg("^(\+)(.*)", $this->name, $regs)) { + return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host; + }else{ + return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host; + } ~ *xpwiki別窓リンク - ver 5.x [#uf521f31] -&size(16){&font(b){クラス名:XpWikiLink_url extends XpWikiLink};}; -メソッド名:function get_pattern() -( # (3) url - (?:(?:https?|ftp|news|site):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ -) _/_/_/_/_/ +( # (3) url + (?:(?:\+?https?|\+?ftp|\+?news|\+?site):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+ +) ~ -メソッド名:function toString() - $img = ($this->is_image)? ' type="img"' : ''; - return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'; _/_/_/_/_/ + $img = ($this->is_image)? ' type="img"' : ''; + if (ereg("^(\+)(.*)", $this->name, $regs)) { + return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>'; + }else{ + return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>'; + } ---- -&size(16){&font(b){クラス名:XpWikiLink_url_i18n extends XpWikiLink};}; -メソッド名:function get_pattern() -( # (3) scheme - (?:(?:https?|ftp|news|site):\/\/|mailto:) -) _/_/_/_/_/ +( # (3) scheme + (?:(?:\+?https?|\+?ftp|\+?news|\+?site):\/\/|mailto:) +) ~ -メソッド名:function toString() - return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'.$host; _/_/_/_/_/ + if (ereg("^(\+)(.*)", $this->name, $regs)) { + return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host; + }else{ + return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host; + } ~