Version Description
Download this release
Release Info
Developer | tenpura |
Plugin | WP Multibyte Patch |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.6
- ext/ja/class.php +25 -27
- ext/ja/word-count.dev.js +0 -37
- ext/ja/word-count.js +0 -1
- ext/ja/wplink.js +0 -1
- js/word-count.dev.js +48 -0
- js/word-count.js +1 -0
- {ext/ja → js}/wplink.dev.js +19 -20
- js/wplink.js +1 -0
- languages/wp-multibyte-patch-ja.mo +0 -0
- languages/wp-multibyte-patch-ja.po +20 -14
- languages/wp-multibyte-patch.pot +31 -0
- readme.txt +3 -3
- wp-multibyte-patch.php +133 -115
- wpmp-config-sample-ja.php +91 -0
- wpmp-config-sample.php +0 -34
- wpmp-load.php +12 -1
ext/ja/class.php
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
if(class_exists('multibyte_patch')) :
|
18 |
class multibyte_patch_ext extends multibyte_patch {
|
19 |
|
@@ -144,21 +145,18 @@ class multibyte_patch_ext extends multibyte_patch {
|
|
144 |
echo "\n" . '<link rel="stylesheet" type="text/css" href="' . plugin_dir_url(__FILE__) . 'admin.css' . '" />' . "\n";
|
145 |
}
|
146 |
|
147 |
-
function wplink_js(&$scripts) {
|
148 |
-
$scripts->add('wplink', plugin_dir_url(__FILE__) . "wplink{$this->debug_suffix}.js", array('jquery', 'wpdialogs'), '20111128', 1);
|
149 |
-
}
|
150 |
-
|
151 |
-
function word_count_js(&$scripts) {
|
152 |
-
$scripts->add('word-count', plugin_dir_url(__FILE__) . "word-count{$this->debug_suffix}.js", array('jquery'), '20110515', 1);
|
153 |
-
$this->import_l10n_entry('Word count: %s', 'wp-multibyte-patch');
|
154 |
-
}
|
155 |
-
|
156 |
function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
// auto, JIS, UTF-8
|
158 |
$this->conf['mail_mode'] = 'JIS';
|
159 |
-
|
160 |
-
$this->conf['ascii_threshold'] = 100;
|
161 |
-
$this->debug_suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
162 |
parent::__construct();
|
163 |
}
|
164 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* WP Multibyte Patch Japanese Locale Extension
|
4 |
+
*
|
5 |
+
* @package WP_Multibyte_Patch
|
6 |
+
* @version 1.6
|
7 |
+
* @author Seisuke Kuraishi <210pura@gmail.com>
|
8 |
+
* @copyright Copyright (c) 2012 Seisuke Kuraishi, Tinybit Inc.
|
9 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
10 |
+
* @link http://eastcoder.com/code/wp-multibyte-patch/
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* This class extends multibyte_patch.
|
15 |
+
*
|
16 |
+
* @package WP_Multibyte_Patch
|
17 |
+
*/
|
18 |
if(class_exists('multibyte_patch')) :
|
19 |
class multibyte_patch_ext extends multibyte_patch {
|
20 |
|
145 |
echo "\n" . '<link rel="stylesheet" type="text/css" href="' . plugin_dir_url(__FILE__) . 'admin.css' . '" />' . "\n";
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
function __construct() {
|
149 |
+
// mbstring functions are always required for ja.
|
150 |
+
$this->mbfunctions_required = true;
|
151 |
+
|
152 |
+
$this->conf['patch_wp_mail'] = true;
|
153 |
+
$this->conf['patch_incoming_trackback'] = true;
|
154 |
+
$this->conf['patch_incoming_pingback'] = true;
|
155 |
+
$this->conf['patch_process_search_terms'] = true;
|
156 |
+
$this->conf['patch_admin_custom_css'] = true;
|
157 |
// auto, JIS, UTF-8
|
158 |
$this->conf['mail_mode'] = 'JIS';
|
159 |
+
|
|
|
|
|
160 |
parent::__construct();
|
161 |
}
|
162 |
}
|
ext/ja/word-count.dev.js
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
|
2 |
-
(function($) {
|
3 |
-
wpWordCount = {
|
4 |
-
|
5 |
-
settings : {
|
6 |
-
strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
|
7 |
-
clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
|
8 |
-
count : /\S\s+/g // counting regexp
|
9 |
-
},
|
10 |
-
|
11 |
-
block : 0,
|
12 |
-
|
13 |
-
wc : function(tx) {
|
14 |
-
var t = this, w = $('.word-count'), tc = 0;
|
15 |
-
|
16 |
-
if ( t.block )
|
17 |
-
return;
|
18 |
-
|
19 |
-
t.block = 1;
|
20 |
-
|
21 |
-
setTimeout( function() {
|
22 |
-
if ( tx ) {
|
23 |
-
tx = tx.replace(/ +/g, ' ').replace(/<br[ \/]*> /gi, '');
|
24 |
-
tx = tx.replace(/<[a-zA-Z\/][^<>]*>/g, '').replace(/ | /gi, ' ');
|
25 |
-
tx.replace(/./g, function(){tc++;});
|
26 |
-
}
|
27 |
-
w.html(tc.toString());
|
28 |
-
|
29 |
-
setTimeout( function() { t.block = 0; }, 2000 );
|
30 |
-
}, 1 );
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
$(document).bind( 'wpcountwords', function(e, txt) {
|
35 |
-
wpWordCount.wc(txt);
|
36 |
-
});
|
37 |
-
}(jQuery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ext/ja/word-count.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(a){wpWordCount={settings:{strip:/<[a-zA-Z\/][^<>]*>/g,clean:/[0-9.(),;:!?%#$¿'"_+=\\/-]+/g,count:/\S\s+/g},block:0,wc:function(d){var e=this,c=a(".word-count"),b=0;if(e.block){return}e.block=1;setTimeout(function(){if(d){d=d.replace(/ +/g," ").replace(/<br[ \/]*> /gi,"");d=d.replace(/<[a-zA-Z\/][^<>]*>/g,"").replace(/ | /gi," ");d.replace(/./g,function(){b++})}c.html(b.toString());setTimeout(function(){e.block=0},2000)},1)}};a(document).bind("wpcountwords",function(c,b){wpWordCount.wc(b)})}(jQuery));
|
|
ext/ja/wplink.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.nonce=f("#_ajax_linking_nonce");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){g.preventDefault();wpLink.update()});f("#wp-link-cancel").click(function(g){g.preventDefault();wpLink.close()});f("#internal-toggle").click(wpLink.toggleInternalLinking);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh);b.dialog.bind("wpdialogbeforeopen",wpLink.beforeOpen);b.dialog.bind("wpdialogclose",wpLink.onClose)},beforeOpen:function(){wpLink.range=null;if(!wpLink.isMCE()&&document.selection){wpLink.textarea.focus();wpLink.range=document.selection.createRange()}},open:function(){if(!wpActiveEditor){return}this.textarea=f("#"+wpActiveEditor).get(0);if(!b.dialog.data("wpdialog")){b.dialog.wpdialog({title:wpLinkL10n.title,width:480,height:"auto",modal:true,dialogClass:"wp-dialog",zIndex:300000})}b.dialog.wpdialog("open")},isMCE:function(){return tinyMCEPopup&&(d=tinyMCEPopup.editor)&&!d.isHidden()},refresh:function(){e.search.refresh();e.recent.refresh();if(wpLink.isMCE()){wpLink.mceRefresh()}else{wpLink.setDefaultValues()}b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},mceRefresh:function(){var g;d=tinyMCEPopup.editor;tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(d.dom.getAttrib(g,"href"));b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.prop("checked",true)}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues()}tinyMCEPopup.storeSelection()},close:function(){if(wpLink.isMCE()){tinyMCEPopup.close()}else{b.dialog.wpdialog("close")}},onClose:function(){if(!wpLink.isMCE()){wpLink.textarea.focus();if(wpLink.range){wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select()}}},getAttrs:function(){return{href:b.url.val(),title:b.title.val(),target:b.openInNewTab.prop("checked")?"_blank":""}},update:function(){if(wpLink.isMCE()){wpLink.mceUpdate()}else{wpLink.htmlUpdate()}},htmlUpdate:function(){var i,j,l,h,k,g=wpLink.textarea;if(!g){return}i=wpLink.getAttrs();if(!i.href||i.href=="http://"){return}j='<a href="'+i.href+'"';if(i.title){j+=' title="'+i.title+'"'}if(i.target){j+=' target="'+i.target+'"'}j+=">";if(typeof g.selectionStart!=="undefined"){l=g.selectionStart;h=g.selectionEnd;selection=g.value.substring(l,h);j=j+selection+"</a>";k=l+j.length;if(l==h){k-="</a>".length}g.value=g.value.substring(0,l)+j+g.value.substring(h,g.value.length);g.selectionStart=g.selectionEnd=k}else{if(document.selection&&wpLink.range){g.focus();wpLink.range.text=j+wpLink.range.text+"</a>";wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select();wpLink.range=null}}wpLink.close();g.focus()},mceUpdate:function(){var h=tinyMCEPopup.editor,i=wpLink.getAttrs(),j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("");b.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>1){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:h.stopImmediatePropagation();if(!f(document).triggerHandler("wp_CloseOnEscape",[{event:h,what:"wplink",cb:wpLink.close}])){wpLink.close()}return false;break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:n<o?o-n:l},200)}});h.preventDefault()}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);this.refresh();i.scroll(function(){g.maybeLoad()});i.delegate("li","click",function(j){g.select(f(this),j)})};f.extend(a.prototype,{refresh:function(){this.deselect();this.visible=this.element.is(":visible")},show:function(){if(!this.visible){this.deselect();this.element.show();this.visible=true}},hide:function(){this.element.hide();this.visible=false},select:function(h,k){var j,i,l,g;if(h.hasClass("unselectable")||h==this.selected){return}this.deselect();this.selected=h.addClass("selected");j=h.outerHeight();i=this.element.height();l=h.position().top;g=this.element.scrollTop();if(l<0){this.element.scrollTop(g+l)}else{if(l+j>i){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(h,l){var i="",j=true,g="",k=l.page==1;if(!h){if(k){i+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{f.each(h,function(){g=j?"alternate":"";g+=this["title"]?"":" no-title";i+=g?'<li class="'+g+'">':"<li>";i+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';i+='<span class="item-title">';i+=this["title"]?this["title"]:wpLinkL10n.noTitle;i+='</span><span class="item-info">'+this["info"]+"</span></li>";j=!j})}this.ul[k?"html":"append"](i)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g<this.ul.height()-wpLink.riverBottomThreshold){return}setTimeout(function(){var j=i.scrollTop(),k=j+i.height();if(!h.query.ready()||k<h.ul.height()-wpLink.riverBottomThreshold){return}h.waiting.show();i.scrollTop(j+h.waiting.outerHeight());h.ajax(function(){h.waiting.hide()})},wpLink.timeToTriggerRiver)}});c=function(g){this.page=1;this.allLoaded=false;this.querying=false;this.search=g};f.extend(c.prototype,{ready:function(){return !(this.querying||this.allLoaded)},ajax:function(i){var g=this,h={action:"wp-link-ajax",page:this.page,_ajax_linking_nonce:b.nonce.val()};if(this.search){h.search=this.search}this.querying=true;f.post(ajaxurl,h,function(j){g.page++;g.querying=false;g.allLoaded=!j;i(j,h)},"json")}});f(document).ready(wpLink.init)})(jQuery);
|
|
js/word-count.dev.js
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($,undefined) {
|
2 |
+
wpWordCount = {
|
3 |
+
|
4 |
+
settings : {
|
5 |
+
strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
|
6 |
+
clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
|
7 |
+
count : /\S\s+/g, // word-counting regexp
|
8 |
+
},
|
9 |
+
|
10 |
+
block : 0,
|
11 |
+
|
12 |
+
wc : function(tx, type) {
|
13 |
+
var t = this, w = $('.word-count'), tc = 0;
|
14 |
+
|
15 |
+
if ( type === undefined )
|
16 |
+
type = wordCountL10n.type;
|
17 |
+
if ( type !== 'w' && type !== 'c' )
|
18 |
+
type = 'w';
|
19 |
+
|
20 |
+
if ( t.block )
|
21 |
+
return;
|
22 |
+
|
23 |
+
t.block = 1;
|
24 |
+
|
25 |
+
setTimeout( function() {
|
26 |
+
if ( tx ) {
|
27 |
+
if ( type == 'w' ) { // word-counting
|
28 |
+
tx = tx.replace( t.settings.strip, ' ' ).replace( / | /gi, ' ' );
|
29 |
+
tx = tx.replace( t.settings.clean, '' );
|
30 |
+
tx.replace( t.settings.count, function(){tc++;} );
|
31 |
+
}
|
32 |
+
else if ( type == 'c' ) { // char-counting for asian languages
|
33 |
+
tx = tx.replace( t.settings.strip, '' ).replace( /^ +| +$/gm, '' );
|
34 |
+
tx = tx.replace( / +| | /gi, ' ' );
|
35 |
+
tx.replace( /[\S \u00A0\u3000]/g, function(){tc++;} );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
w.html(tc.toString());
|
39 |
+
|
40 |
+
setTimeout( function() { t.block = 0; }, 2000 );
|
41 |
+
}, 1 );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$(document).bind( 'wpcountwords', function(e, txt) {
|
46 |
+
wpWordCount.wc(txt);
|
47 |
+
});
|
48 |
+
}(jQuery));
|
js/word-count.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(a,b){wpWordCount={settings:{strip:/<[a-zA-Z\/][^<>]*>/g,clean:/[0-9.(),;:!?%#$¿'"_+=\\/-]+/g,count:/\S\s+/g,},block:0,wc:function(e,g){var f=this,d=a(".word-count"),c=0;if(g===b){g=wordCountL10n.type}if(g!=="w"&&g!=="c"){g="w"}if(f.block){return}f.block=1;setTimeout(function(){if(e){if(g=="w"){e=e.replace(f.settings.strip," ").replace(/ | /gi," ");e=e.replace(f.settings.clean,"");e.replace(f.settings.count,function(){c++})}else{if(g=="c"){e=e.replace(f.settings.strip,"").replace(/^ +| +$/gm,"");e=e.replace(/ +| | /gi," ");e.replace(/[\S \u00A0\u3000]/g,function(){c++})}}}d.html(c.toString());setTimeout(function(){f.block=0},2000)},1)}};a(document).bind("wpcountwords",function(d,c){wpWordCount.wc(c)})}(jQuery));
|
{ext/ja → js}/wplink.dev.js
RENAMED
@@ -160,7 +160,7 @@ var wpLink;
|
|
160 |
},
|
161 |
|
162 |
htmlUpdate : function() {
|
163 |
-
var attrs, html,
|
164 |
textarea = wpLink.textarea;
|
165 |
|
166 |
if ( ! textarea )
|
@@ -183,35 +183,34 @@ var wpLink;
|
|
183 |
html += '>';
|
184 |
|
185 |
// Insert HTML
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
end = textarea.selectionEnd;
|
190 |
-
selection = textarea.value.substring(
|
191 |
html = html + selection + '</a>';
|
192 |
-
cursor =
|
193 |
|
194 |
// If no next is selected, place the cursor inside the closing tag.
|
195 |
-
if (
|
196 |
cursor -= '</a>'.length;
|
197 |
|
198 |
-
textarea.value = textarea.value.substring( 0,
|
199 |
+ html
|
200 |
+ textarea.value.substring( end, textarea.value.length );
|
201 |
|
202 |
// Update cursor position
|
203 |
textarea.selectionStart = textarea.selectionEnd = cursor;
|
204 |
-
|
205 |
-
// IE
|
206 |
-
// Note: If no text is selected, IE will not place the cursor
|
207 |
-
// inside the closing tag.
|
208 |
-
} else if ( document.selection && wpLink.range ) {
|
209 |
-
textarea.focus();
|
210 |
-
wpLink.range.text = html + wpLink.range.text + '</a>';
|
211 |
-
wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
|
212 |
-
wpLink.range.select();
|
213 |
-
|
214 |
-
wpLink.range = null;
|
215 |
}
|
216 |
|
217 |
wpLink.close();
|
@@ -243,7 +242,7 @@ var wpLink;
|
|
243 |
|
244 |
if (e == null) {
|
245 |
ed.getDoc().execCommand("unlink", false, null);
|
246 |
-
tinyMCEPopup.execCommand("
|
247 |
|
248 |
tinymce.each(ed.dom.select("a"), function(n) {
|
249 |
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
160 |
},
|
161 |
|
162 |
htmlUpdate : function() {
|
163 |
+
var attrs, html, begin, end, cursor,
|
164 |
textarea = wpLink.textarea;
|
165 |
|
166 |
if ( ! textarea )
|
183 |
html += '>';
|
184 |
|
185 |
// Insert HTML
|
186 |
+
if ( document.selection && wpLink.range ) {
|
187 |
+
// IE
|
188 |
+
// Note: If no text is selected, IE will not place the cursor
|
189 |
+
// inside the closing tag.
|
190 |
+
textarea.focus();
|
191 |
+
wpLink.range.text = html + wpLink.range.text + '</a>';
|
192 |
+
wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
|
193 |
+
wpLink.range.select();
|
194 |
+
|
195 |
+
wpLink.range = null;
|
196 |
+
} else if ( typeof textarea.selectionStart !== 'undefined' ) {
|
197 |
+
// W3C
|
198 |
+
begin = textarea.selectionStart;
|
199 |
end = textarea.selectionEnd;
|
200 |
+
selection = textarea.value.substring( begin, end );
|
201 |
html = html + selection + '</a>';
|
202 |
+
cursor = begin + html.length;
|
203 |
|
204 |
// If no next is selected, place the cursor inside the closing tag.
|
205 |
+
if ( begin == end )
|
206 |
cursor -= '</a>'.length;
|
207 |
|
208 |
+
textarea.value = textarea.value.substring( 0, begin )
|
209 |
+ html
|
210 |
+ textarea.value.substring( end, textarea.value.length );
|
211 |
|
212 |
// Update cursor position
|
213 |
textarea.selectionStart = textarea.selectionEnd = cursor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
wpLink.close();
|
242 |
|
243 |
if (e == null) {
|
244 |
ed.getDoc().execCommand("unlink", false, null);
|
245 |
+
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
246 |
|
247 |
tinymce.each(ed.dom.select("a"), function(n) {
|
248 |
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
js/wplink.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.nonce=f("#_ajax_linking_nonce");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){g.preventDefault();wpLink.update()});f("#wp-link-cancel").click(function(g){g.preventDefault();wpLink.close()});f("#internal-toggle").click(wpLink.toggleInternalLinking);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh);b.dialog.bind("wpdialogbeforeopen",wpLink.beforeOpen);b.dialog.bind("wpdialogclose",wpLink.onClose)},beforeOpen:function(){wpLink.range=null;if(!wpLink.isMCE()&&document.selection){wpLink.textarea.focus();wpLink.range=document.selection.createRange()}},open:function(){if(!wpActiveEditor){return}this.textarea=f("#"+wpActiveEditor).get(0);if(!b.dialog.data("wpdialog")){b.dialog.wpdialog({title:wpLinkL10n.title,width:480,height:"auto",modal:true,dialogClass:"wp-dialog",zIndex:300000})}b.dialog.wpdialog("open")},isMCE:function(){return tinyMCEPopup&&(d=tinyMCEPopup.editor)&&!d.isHidden()},refresh:function(){e.search.refresh();e.recent.refresh();if(wpLink.isMCE()){wpLink.mceRefresh()}else{wpLink.setDefaultValues()}b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},mceRefresh:function(){var g;d=tinyMCEPopup.editor;tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(d.dom.getAttrib(g,"href"));b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.prop("checked",true)}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues()}tinyMCEPopup.storeSelection()},close:function(){if(wpLink.isMCE()){tinyMCEPopup.close()}else{b.dialog.wpdialog("close")}},onClose:function(){if(!wpLink.isMCE()){wpLink.textarea.focus();if(wpLink.range){wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select()}}},getAttrs:function(){return{href:b.url.val(),title:b.title.val(),target:b.openInNewTab.prop("checked")?"_blank":""}},update:function(){if(wpLink.isMCE()){wpLink.mceUpdate()}else{wpLink.htmlUpdate()}},htmlUpdate:function(){var i,j,k,h,l,g=wpLink.textarea;if(!g){return}i=wpLink.getAttrs();if(!i.href||i.href=="http://"){return}j='<a href="'+i.href+'"';if(i.title){j+=' title="'+i.title+'"'}if(i.target){j+=' target="'+i.target+'"'}j+=">";if(document.selection&&wpLink.range){g.focus();wpLink.range.text=j+wpLink.range.text+"</a>";wpLink.range.moveToBookmark(wpLink.range.getBookmark());wpLink.range.select();wpLink.range=null}else{if(typeof g.selectionStart!=="undefined"){k=g.selectionStart;h=g.selectionEnd;selection=g.value.substring(k,h);j=j+selection+"</a>";l=k+j.length;if(k==h){l-="</a>".length}g.value=g.value.substring(0,k)+j+g.value.substring(h,g.value.length);g.selectionStart=g.selectionEnd=l}}wpLink.close();g.focus()},mceUpdate:function(){var h=tinyMCEPopup.editor,i=wpLink.getAttrs(),j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("mceInsertLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");wpLink.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("");b.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>1){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:h.stopImmediatePropagation();if(!f(document).triggerHandler("wp_CloseOnEscape",[{event:h,what:"wplink",cb:wpLink.close}])){wpLink.close()}return false;break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:n<o?o-n:l},200)}});h.preventDefault()}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);this.refresh();i.scroll(function(){g.maybeLoad()});i.delegate("li","click",function(j){g.select(f(this),j)})};f.extend(a.prototype,{refresh:function(){this.deselect();this.visible=this.element.is(":visible")},show:function(){if(!this.visible){this.deselect();this.element.show();this.visible=true}},hide:function(){this.element.hide();this.visible=false},select:function(h,k){var j,i,l,g;if(h.hasClass("unselectable")||h==this.selected){return}this.deselect();this.selected=h.addClass("selected");j=h.outerHeight();i=this.element.height();l=h.position().top;g=this.element.scrollTop();if(l<0){this.element.scrollTop(g+l)}else{if(l+j>i){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(h,l){var i="",j=true,g="",k=l.page==1;if(!h){if(k){i+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{f.each(h,function(){g=j?"alternate":"";g+=this["title"]?"":" no-title";i+=g?'<li class="'+g+'">':"<li>";i+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';i+='<span class="item-title">';i+=this["title"]?this["title"]:wpLinkL10n.noTitle;i+='</span><span class="item-info">'+this["info"]+"</span></li>";j=!j})}this.ul[k?"html":"append"](i)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g<this.ul.height()-wpLink.riverBottomThreshold){return}setTimeout(function(){var j=i.scrollTop(),k=j+i.height();if(!h.query.ready()||k<h.ul.height()-wpLink.riverBottomThreshold){return}h.waiting.show();i.scrollTop(j+h.waiting.outerHeight());h.ajax(function(){h.waiting.hide()})},wpLink.timeToTriggerRiver)}});c=function(g){this.page=1;this.allLoaded=false;this.querying=false;this.search=g};f.extend(c.prototype,{ready:function(){return !(this.querying||this.allLoaded)},ajax:function(i){var g=this,h={action:"wp-link-ajax",page:this.page,_ajax_linking_nonce:b.nonce.val()};if(this.search){h.search=this.search}this.querying=true;f.post(ajaxurl,h,function(j){g.page++;g.querying=false;g.allLoaded=!j;i(j,h)},"json")}});f(document).ready(wpLink.init)})(jQuery);
|
languages/wp-multibyte-patch-ja.mo
CHANGED
Binary file
|
languages/wp-multibyte-patch-ja.po
CHANGED
@@ -1,24 +1,30 @@
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: WP Multibyte Patch
|
4 |
-
"
|
|
|
|
|
|
|
|
|
5 |
"MIME-Version: 1.0\n"
|
6 |
"Content-Type: text/plain; charset=UTF-8\n"
|
7 |
"Content-Transfer-Encoding: 8bit\n"
|
8 |
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
9 |
-
"POT-Creation-Date: \n"
|
10 |
-
"Last-Translator: tenpura <210pura@gmail.com>\n"
|
11 |
-
"Language-Team: \n"
|
12 |
-
|
13 |
-
msgid "Enhances multibyte string I/O functionality of WordPress."
|
14 |
-
msgstr "WP Multibyte Patch は本家版、日本語版 WordPress のマルチバイト文字の取り扱いに関する不具合の累積的修正と強化を行うプラグインです。 <a href=\"http://eastcoder.com/code/wp-multibyte-patch/\">» 詳しい説明を読む</a>"
|
15 |
|
|
|
16 |
msgid "Sorry, WP Multibyte Patch requires WordPress %s or later."
|
17 |
-
msgstr "お使いの WP Multibyte Patch
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
|
1 |
+
# Copyright (C) 2012 WP Multibyte Patch
|
2 |
+
# This file is distributed under the same license as the WP Multibyte Patch package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP Multibyte Patch\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-multibyte-patch\n"
|
7 |
+
"POT-Creation-Date: 2012-06-09 14:33:17+00:00\n"
|
8 |
+
"PO-Revision-Date: 2012-06-09 23:47+0900\n"
|
9 |
+
"Last-Translator: Seisuke Kuraishi <210pura@gmail.com>\n"
|
10 |
+
"Language-Team: \n"
|
11 |
"MIME-Version: 1.0\n"
|
12 |
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
#: wp-multibyte-patch.php:405
|
16 |
msgid "Sorry, WP Multibyte Patch requires WordPress %s or later."
|
17 |
+
msgstr "お使いの WP Multibyte Patch を有効化するには WordPress %s 以上が必要です。"
|
18 |
+
|
19 |
+
#: wp-multibyte-patch.php:409
|
20 |
+
msgid "Sorry, WP Multibyte Patch requires <a href=\"http://www.php.net/manual/en/mbstring.installation.php\" target=\"_blank\">mbstring</a> functions."
|
21 |
+
msgstr "お使いの WP Multibyte Patch を有効化するには PHP の <a href=\"http://www.php.net/manual/ja/mbstring.installation.php\" target=\"_blank\">mbstring</a> 関数が必要です。"
|
22 |
|
23 |
+
#. Plugin URI of the plugin/theme
|
24 |
+
msgid "http://eastcoder.com/code/wp-multibyte-patch/"
|
25 |
+
msgstr "http://eastcoder.com/code/wp-multibyte-patch/"
|
26 |
|
27 |
+
#. Description of the plugin/theme
|
28 |
+
msgid "Multibyte functionality enhancement for the WordPress Japanese package."
|
29 |
+
msgstr "WP Multibyte Patch は、本家版、日本語版 WordPress のマルチバイト文字の取り扱いに関する不具合の累積的修正と強化を行うプラグインです。 <a href=\"http://eastcoder.com/code/wp-multibyte-patch/\">» 詳しい説明を読む</a>"
|
30 |
|
languages/wp-multibyte-patch.pot
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2012 WP Multibyte Patch
|
2 |
+
# This file is distributed under the same license as the WP Multibyte Patch package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WP Multibyte Patch\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-multibyte-patch\n"
|
7 |
+
"POT-Creation-Date: 2012-06-09 14:33:17+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2011-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: wp-multibyte-patch.php:405
|
16 |
+
msgid "Sorry, WP Multibyte Patch requires WordPress %s or later."
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: wp-multibyte-patch.php:409
|
20 |
+
msgid ""
|
21 |
+
"Sorry, WP Multibyte Patch requires <a href=\"http://www.php.net/manual/en/"
|
22 |
+
"mbstring.installation.php\" target=\"_blank\">mbstring</a> functions."
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#. Plugin URI of the plugin/theme
|
26 |
+
msgid "http://eastcoder.com/code/wp-multibyte-patch/"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#. Description of the plugin/theme
|
30 |
+
msgid "Multibyte functionality enhancement for the WordPress Japanese package."
|
31 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WP Multibyte Patch ===
|
2 |
Contributors: tenpura
|
3 |
Tags: multibyte,i18n,wp-multibyte-patch,Japanese
|
4 |
-
Requires at least: 3.
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Multibyte functionality enhancement for the WordPress Japanese package.
|
9 |
|
1 |
=== WP Multibyte Patch ===
|
2 |
Contributors: tenpura
|
3 |
Tags: multibyte,i18n,wp-multibyte-patch,Japanese
|
4 |
+
Requires at least: 3.4-RC2
|
5 |
+
Tested up to: 3.4
|
6 |
+
Stable tag: 1.6
|
7 |
|
8 |
Multibyte functionality enhancement for the WordPress Japanese package.
|
9 |
|
wp-multibyte-patch.php
CHANGED
@@ -1,53 +1,66 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP Multibyte Patch
|
|
|
|
|
4 |
Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/
|
5 |
-
|
6 |
-
Author:
|
7 |
-
|
8 |
-
Author URI: http://eastcoder.com/
|
9 |
Text Domain: wp-multibyte-patch
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
class multibyte_patch {
|
19 |
|
20 |
// Do not edit this section. Use wpmp-config.php instead.
|
21 |
-
|
22 |
var $conf = array(
|
23 |
-
'excerpt_length' => 55,
|
24 |
'excerpt_mblength' => 110,
|
25 |
'excerpt_more' => ' [...]',
|
26 |
-
'comment_excerpt_length' => 20,
|
27 |
'comment_excerpt_mblength' => 40,
|
28 |
-
'
|
29 |
-
'patch_wp_mail' =>
|
30 |
-
'patch_incoming_trackback' =>
|
31 |
-
'patch_incoming_pingback' =>
|
32 |
'patch_wp_trim_excerpt' => true,
|
33 |
'patch_get_comment_excerpt' => true,
|
34 |
-
'
|
35 |
-
'
|
|
|
36 |
'patch_wplink_js' => true,
|
37 |
'patch_word_count_js' => true,
|
|
|
38 |
'patch_sanitize_file_name' => true,
|
39 |
'patch_bp_create_excerpt' => false,
|
40 |
'bp_excerpt_mblength' => 110,
|
41 |
'bp_excerpt_more' => ' [...]'
|
42 |
);
|
43 |
|
44 |
-
var $blog_encoding;
|
45 |
-
var $has_mbfunctions;
|
|
|
|
|
|
|
46 |
var $textdomain = 'wp-multibyte-patch';
|
47 |
var $lang_dir = 'languages';
|
48 |
-
var $required_version = '3.
|
49 |
var $query_based_vars = array();
|
50 |
|
|
|
51 |
function guess_encoding($string, $encoding = '') {
|
52 |
$blog_encoding = $this->blog_encoding;
|
53 |
|
@@ -59,6 +72,7 @@ class multibyte_patch {
|
|
59 |
return $encoding;
|
60 |
}
|
61 |
|
|
|
62 |
function convenc($string, $to_encoding, $from_encoding = '') {
|
63 |
$blog_encoding = $this->blog_encoding;
|
64 |
|
@@ -195,69 +209,20 @@ class multibyte_patch {
|
|
195 |
return $commentdata;
|
196 |
}
|
197 |
|
198 |
-
function is_almost_ascii($string, $encoding) {
|
199 |
-
if(100 === $this->conf['ascii_threshold'])
|
200 |
-
return false;
|
201 |
-
|
202 |
-
return ($this->conf['ascii_threshold'] < round(@(mb_strlen($string, $encoding) / strlen($string)) * 100)) ? true : false;
|
203 |
-
}
|
204 |
-
|
205 |
-
function wp_trim_excerpt($text = '') {
|
206 |
-
$raw_excerpt = $text;
|
207 |
-
|
208 |
-
$blog_encoding = $this->blog_encoding;
|
209 |
-
|
210 |
-
if('' == $text) {
|
211 |
-
$text = get_the_content('');
|
212 |
-
|
213 |
-
$text = strip_shortcodes( $text );
|
214 |
-
|
215 |
-
$text = apply_filters('the_content', $text);
|
216 |
-
$text = str_replace(']]>', ']]>', $text);
|
217 |
-
$text = wp_strip_all_tags($text);
|
218 |
-
$excerpt_length = apply_filters('excerpt_length', $this->conf['excerpt_length']);
|
219 |
-
$excerpt_mblength = apply_filters('excerpt_mblength', $this->conf['excerpt_mblength']);
|
220 |
-
$excerpt_more = apply_filters('excerpt_more', $this->conf['excerpt_more']);
|
221 |
-
|
222 |
-
if($this->is_almost_ascii($text, $blog_encoding)) {
|
223 |
-
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
|
224 |
-
|
225 |
-
if ( count($words) > $excerpt_length ) {
|
226 |
-
array_pop($words);
|
227 |
-
$text = implode(' ', $words);
|
228 |
-
$text = $text . $excerpt_more;
|
229 |
-
} else {
|
230 |
-
$text = implode(' ', $words);
|
231 |
-
}
|
232 |
-
}
|
233 |
-
else {
|
234 |
-
$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
|
235 |
-
|
236 |
-
if(mb_strlen($text, $blog_encoding) > $excerpt_mblength)
|
237 |
-
$text = mb_substr($text, 0, $excerpt_mblength, $blog_encoding) . $excerpt_more;
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
|
242 |
-
}
|
243 |
-
|
244 |
function trim_multibyte_excerpt($text = '', $length = 110, $more = ' [...]', $encoding = 'UTF-8') {
|
245 |
$text = strip_shortcodes($text);
|
246 |
$text = str_replace(']]>', ']]>', $text);
|
247 |
$text = strip_tags($text);
|
248 |
$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
|
249 |
|
250 |
-
if(mb_strlen($text, $encoding) > $length)
|
251 |
$text = mb_substr($text, 0, $length, $encoding) . $more;
|
252 |
|
253 |
return $text;
|
254 |
}
|
255 |
|
256 |
function bp_create_excerpt($text = '') {
|
257 |
-
|
258 |
-
return $text;
|
259 |
-
else
|
260 |
-
return $this->trim_multibyte_excerpt($text, $this->conf['bp_excerpt_mblength'], $this->conf['bp_excerpt_more'], $this->blog_encoding);
|
261 |
}
|
262 |
|
263 |
function bp_get_activity_content_body($content = '') {
|
@@ -269,21 +234,28 @@ class multibyte_patch {
|
|
269 |
$excerpt = preg_replace("/\.\.\.$/", '', $excerpt);
|
270 |
$blog_encoding = $this->blog_encoding;
|
271 |
|
272 |
-
if($this->
|
273 |
-
$words = explode(' ', $excerpt, $this->conf['comment_excerpt_length'] + 1);
|
274 |
-
|
275 |
-
if(count($words) > $this->conf['comment_excerpt_length']) {
|
276 |
-
array_pop($words);
|
277 |
-
$excerpt = implode(' ', $words) . '...';
|
278 |
-
}
|
279 |
-
}
|
280 |
-
elseif(mb_strlen($excerpt, $blog_encoding) > $this->conf['comment_excerpt_mblength']) {
|
281 |
$excerpt = mb_substr($excerpt, 0, $this->conf['comment_excerpt_mblength'], $blog_encoding) . '...';
|
282 |
-
}
|
283 |
|
284 |
return $excerpt;
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
function sanitize_file_name($name) {
|
288 |
$info = pathinfo($name);
|
289 |
$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
|
@@ -293,18 +265,57 @@ class multibyte_patch {
|
|
293 |
return $name;
|
294 |
}
|
295 |
|
296 |
-
function
|
297 |
-
|
298 |
-
return $this->query_based_vars['excerpt_mblength'];
|
299 |
-
else
|
300 |
-
return (int) $length;
|
301 |
}
|
302 |
|
303 |
-
function
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
function query_based_settings() {
|
@@ -319,28 +330,25 @@ class multibyte_patch {
|
|
319 |
}
|
320 |
}
|
321 |
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
327 |
}
|
328 |
|
329 |
function filters() {
|
330 |
-
// remove filter
|
331 |
-
if(false !== $this->conf['patch_wp_trim_excerpt'])
|
332 |
-
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
|
333 |
-
|
334 |
// add filter
|
335 |
add_filter('preprocess_comment', array(&$this, 'preprocess_comment'), 99);
|
336 |
-
add_filter('excerpt_mblength', array(&$this, 'excerpt_mblength'), 9);
|
337 |
-
add_filter('excerpt_more', array(&$this, 'excerpt_more'), 9);
|
338 |
|
339 |
if(false !== $this->conf['patch_incoming_pingback'])
|
340 |
add_filter('pre_remote_source', array(&$this, 'pre_remote_source'), 10, 2);
|
341 |
|
342 |
-
if(false !== $this->conf['patch_wp_trim_excerpt'])
|
343 |
-
add_filter('
|
|
|
|
|
344 |
|
345 |
if(false !== $this->conf['patch_get_comment_excerpt'])
|
346 |
add_filter('get_comment_excerpt', array(&$this, 'get_comment_excerpt'));
|
@@ -351,7 +359,10 @@ class multibyte_patch {
|
|
351 |
if(false !== $this->conf['patch_bp_create_excerpt']) {
|
352 |
add_filter('bp_create_excerpt', array(&$this, 'bp_create_excerpt'), 99);
|
353 |
add_filter('bp_get_activity_content_body', array(&$this, 'bp_get_activity_content_body'), 99);
|
354 |
-
|
|
|
|
|
|
|
355 |
|
356 |
// add action
|
357 |
add_action('wp', array(&$this, 'query_based_settings'));
|
@@ -365,11 +376,14 @@ class multibyte_patch {
|
|
365 |
if(method_exists($this, 'admin_custom_css') && false !== $this->conf['patch_admin_custom_css'])
|
366 |
add_action('admin_head' , array(&$this, 'admin_custom_css'), 99);
|
367 |
|
368 |
-
if(
|
369 |
add_action('wp_default_scripts' , array(&$this, 'wplink_js'), 9);
|
370 |
|
371 |
-
if(
|
372 |
add_action('wp_default_scripts' , array(&$this, 'word_count_js'), 9);
|
|
|
|
|
|
|
373 |
}
|
374 |
|
375 |
function mbfunctions_exist() {
|
@@ -378,8 +392,7 @@ class multibyte_patch {
|
|
378 |
function_exists('mb_convert_kana') &&
|
379 |
function_exists('mb_detect_encoding') &&
|
380 |
function_exists('mb_strcut') &&
|
381 |
-
function_exists('mb_strlen')
|
382 |
-
function_exists('mb_substr')
|
383 |
) ? true : false;
|
384 |
}
|
385 |
|
@@ -389,11 +402,11 @@ class multibyte_patch {
|
|
389 |
|
390 |
if(version_compare(substr($wp_version, 0, strlen($required_version)), $required_version, '<')) {
|
391 |
deactivate_plugins(__FILE__);
|
392 |
-
|
393 |
}
|
394 |
-
elseif(!$this->has_mbfunctions) {
|
395 |
deactivate_plugins(__FILE__);
|
396 |
-
|
397 |
}
|
398 |
}
|
399 |
|
@@ -414,13 +427,18 @@ class multibyte_patch {
|
|
414 |
|
415 |
function __construct() {
|
416 |
$this->load_conf();
|
417 |
-
|
418 |
$this->blog_encoding = get_option('blog_charset');
|
|
|
|
|
|
|
|
|
|
|
419 |
$this->has_mbfunctions = $this->mbfunctions_exist();
|
|
|
|
|
420 |
|
421 |
load_textdomain($this->textdomain, plugin_dir_path(__FILE__) . $this->lang_dir . '/' . $this->textdomain . '-' . get_locale() . '.mo');
|
422 |
register_activation_hook(__FILE__, array(&$this, 'activation_check'));
|
423 |
-
|
424 |
$this->filters();
|
425 |
}
|
426 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP Multibyte Patch
|
4 |
+
Description: Multibyte functionality enhancement for the WordPress Japanese package.
|
5 |
+
Version: 1.6
|
6 |
Plugin URI: http://eastcoder.com/code/wp-multibyte-patch/
|
7 |
+
Author: Seisuke Kuraishi
|
8 |
+
Author URI: http://tinybit.co.jp/
|
9 |
+
License: GPLv2
|
|
|
10 |
Text Domain: wp-multibyte-patch
|
11 |
Domain Path: /languages
|
12 |
*/
|
13 |
|
14 |
+
/**
|
15 |
+
* Multibyte functionality enhancement for the WordPress Japanese package.
|
16 |
+
*
|
17 |
+
* @package WP_Multibyte_Patch
|
18 |
+
* @version 1.6
|
19 |
+
* @author Seisuke Kuraishi <210pura@gmail.com>
|
20 |
+
* @copyright Copyright (c) 2012 Seisuke Kuraishi, Tinybit Inc.
|
21 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GPLv2
|
22 |
+
* @link http://eastcoder.com/code/wp-multibyte-patch/
|
23 |
+
*/
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @package WP_Multibyte_Patch
|
27 |
+
*/
|
28 |
class multibyte_patch {
|
29 |
|
30 |
// Do not edit this section. Use wpmp-config.php instead.
|
|
|
31 |
var $conf = array(
|
|
|
32 |
'excerpt_mblength' => 110,
|
33 |
'excerpt_more' => ' [...]',
|
|
|
34 |
'comment_excerpt_mblength' => 40,
|
35 |
+
'dashboard_recent_drafts_mblength' => 40,
|
36 |
+
'patch_wp_mail' => false,
|
37 |
+
'patch_incoming_trackback' => false,
|
38 |
+
'patch_incoming_pingback' => false,
|
39 |
'patch_wp_trim_excerpt' => true,
|
40 |
'patch_get_comment_excerpt' => true,
|
41 |
+
'patch_dashboard_recent_drafts' => true,
|
42 |
+
'patch_process_search_terms' => false,
|
43 |
+
'patch_admin_custom_css' => false,
|
44 |
'patch_wplink_js' => true,
|
45 |
'patch_word_count_js' => true,
|
46 |
+
'patch_force_character_count' => false,
|
47 |
'patch_sanitize_file_name' => true,
|
48 |
'patch_bp_create_excerpt' => false,
|
49 |
'bp_excerpt_mblength' => 110,
|
50 |
'bp_excerpt_more' => ' [...]'
|
51 |
);
|
52 |
|
53 |
+
var $blog_encoding = 'UTF-8';
|
54 |
+
var $has_mbfunctions = false;
|
55 |
+
var $mbfunctions_required = false;
|
56 |
+
var $has_mb_strlen = false;
|
57 |
+
var $debug_suffix = '';
|
58 |
var $textdomain = 'wp-multibyte-patch';
|
59 |
var $lang_dir = 'languages';
|
60 |
+
var $required_version = '3.4-RC2';
|
61 |
var $query_based_vars = array();
|
62 |
|
63 |
+
// For fallback purpose only. (1.6)
|
64 |
function guess_encoding($string, $encoding = '') {
|
65 |
$blog_encoding = $this->blog_encoding;
|
66 |
|
72 |
return $encoding;
|
73 |
}
|
74 |
|
75 |
+
// For fallback purpose only. (1.6)
|
76 |
function convenc($string, $to_encoding, $from_encoding = '') {
|
77 |
$blog_encoding = $this->blog_encoding;
|
78 |
|
209 |
return $commentdata;
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
function trim_multibyte_excerpt($text = '', $length = 110, $more = ' [...]', $encoding = 'UTF-8') {
|
213 |
$text = strip_shortcodes($text);
|
214 |
$text = str_replace(']]>', ']]>', $text);
|
215 |
$text = strip_tags($text);
|
216 |
$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
|
217 |
|
218 |
+
if($this->mb_strlen($text, $encoding) > $length)
|
219 |
$text = mb_substr($text, 0, $length, $encoding) . $more;
|
220 |
|
221 |
return $text;
|
222 |
}
|
223 |
|
224 |
function bp_create_excerpt($text = '') {
|
225 |
+
return $this->trim_multibyte_excerpt($text, $this->conf['bp_excerpt_mblength'], $this->conf['bp_excerpt_more'], $this->blog_encoding);
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
function bp_get_activity_content_body($content = '') {
|
234 |
$excerpt = preg_replace("/\.\.\.$/", '', $excerpt);
|
235 |
$blog_encoding = $this->blog_encoding;
|
236 |
|
237 |
+
if($this->mb_strlen($excerpt, $blog_encoding) > $this->conf['comment_excerpt_mblength'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
$excerpt = mb_substr($excerpt, 0, $this->conf['comment_excerpt_mblength'], $blog_encoding) . '...';
|
|
|
239 |
|
240 |
return $excerpt;
|
241 |
}
|
242 |
|
243 |
+
function excerpt_mblength() {
|
244 |
+
if(isset($this->query_based_vars['excerpt_mblength']) && (int) $this->query_based_vars['excerpt_mblength'])
|
245 |
+
$length = (int) $this->query_based_vars['excerpt_mblength'];
|
246 |
+
else
|
247 |
+
$length = (int) $this->conf['excerpt_mblength'];
|
248 |
+
|
249 |
+
return apply_filters('excerpt_mblength', $length);
|
250 |
+
}
|
251 |
+
|
252 |
+
function excerpt_more() {
|
253 |
+
if(isset($this->query_based_vars['excerpt_more']))
|
254 |
+
return $this->query_based_vars['excerpt_more'];
|
255 |
+
else
|
256 |
+
return $this->conf['excerpt_more'];
|
257 |
+
}
|
258 |
+
|
259 |
function sanitize_file_name($name) {
|
260 |
$info = pathinfo($name);
|
261 |
$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
|
265 |
return $name;
|
266 |
}
|
267 |
|
268 |
+
function wplink_js(&$scripts) {
|
269 |
+
$scripts->add('wplink', plugin_dir_url(__FILE__) . "js/wplink{$this->debug_suffix}.js", array('jquery', 'wpdialogs'), false, 1 );
|
|
|
|
|
|
|
270 |
}
|
271 |
|
272 |
+
function word_count_js(&$scripts) {
|
273 |
+
$scripts->add('word-count', plugin_dir_url(__FILE__) . "js/word-count{$this->debug_suffix}.js", array('jquery'), false, 1);
|
274 |
+
}
|
275 |
+
|
276 |
+
function force_character_count($translations = '', $text = '', $context = '') {
|
277 |
+
if('word count: words or characters?' == $context && 'words' == $text)
|
278 |
+
return 'characters';
|
279 |
+
return $translations;
|
280 |
+
}
|
281 |
+
|
282 |
+
function wp_dashboard_recent_drafts( $drafts = false ) {
|
283 |
+
if ( !$drafts ) {
|
284 |
+
$drafts_query = new WP_Query( array(
|
285 |
+
'post_type' => 'post',
|
286 |
+
'post_status' => 'draft',
|
287 |
+
'author' => $GLOBALS['current_user']->ID,
|
288 |
+
'posts_per_page' => 5,
|
289 |
+
'orderby' => 'modified',
|
290 |
+
'order' => 'DESC'
|
291 |
+
) );
|
292 |
+
$drafts =& $drafts_query->posts;
|
293 |
+
}
|
294 |
+
|
295 |
+
if ( $drafts && is_array( $drafts ) ) {
|
296 |
+
$list = array();
|
297 |
+
foreach ( $drafts as $draft ) {
|
298 |
+
$url = get_edit_post_link( $draft->ID );
|
299 |
+
$title = _draft_or_post_title( $draft->ID );
|
300 |
+
$item = "<h4><a href='$url' title='" . sprintf( __( 'Edit “%s”' ), esc_attr( $title ) ) . "'>" . esc_html($title) . "</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
|
301 |
+
$item .= '<p>' . $this->trim_multibyte_excerpt($draft->post_content, $this->conf['dashboard_recent_drafts_mblength'], $more = '…', $this->blog_encoding) . '</p>';
|
302 |
+
$list[] = $item;
|
303 |
+
}
|
304 |
+
?>
|
305 |
+
<ul>
|
306 |
+
<li><?php echo join( "</li>\n<li>", $list ); ?></li>
|
307 |
+
</ul>
|
308 |
+
<p class="textright"><a href="edit.php?post_status=draft" ><?php _e('View all'); ?></a></p>
|
309 |
+
<?php
|
310 |
+
} else {
|
311 |
+
_e('There are no drafts at the moment');
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
function dashboard_recent_drafts() {
|
316 |
+
global $wp_meta_boxes;
|
317 |
+
if(!empty($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']['callback']))
|
318 |
+
$wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']['callback'] = array(&$this, 'wp_dashboard_recent_drafts');
|
319 |
}
|
320 |
|
321 |
function query_based_settings() {
|
330 |
}
|
331 |
}
|
332 |
|
333 |
+
// The fallback only works with UTF-8 blog.
|
334 |
+
function mb_strlen($str = '', $encoding = 'UTF-8') {
|
335 |
+
if($this->has_mb_strlen)
|
336 |
+
return mb_strlen($str, $encoding);
|
337 |
+
else
|
338 |
+
return preg_match_all("/./us", $str, $match);
|
339 |
}
|
340 |
|
341 |
function filters() {
|
|
|
|
|
|
|
|
|
342 |
// add filter
|
343 |
add_filter('preprocess_comment', array(&$this, 'preprocess_comment'), 99);
|
|
|
|
|
344 |
|
345 |
if(false !== $this->conf['patch_incoming_pingback'])
|
346 |
add_filter('pre_remote_source', array(&$this, 'pre_remote_source'), 10, 2);
|
347 |
|
348 |
+
if(false !== $this->conf['patch_wp_trim_excerpt']) {
|
349 |
+
add_filter('excerpt_length', array(&$this, 'excerpt_mblength'), 99);
|
350 |
+
add_filter('excerpt_more', array(&$this, 'excerpt_more'), 9);
|
351 |
+
}
|
352 |
|
353 |
if(false !== $this->conf['patch_get_comment_excerpt'])
|
354 |
add_filter('get_comment_excerpt', array(&$this, 'get_comment_excerpt'));
|
359 |
if(false !== $this->conf['patch_bp_create_excerpt']) {
|
360 |
add_filter('bp_create_excerpt', array(&$this, 'bp_create_excerpt'), 99);
|
361 |
add_filter('bp_get_activity_content_body', array(&$this, 'bp_get_activity_content_body'), 99);
|
362 |
+
}
|
363 |
+
|
364 |
+
if(false !== $this->conf['patch_force_character_count'])
|
365 |
+
add_filter('gettext_with_context', array(&$this, 'force_character_count'), 10, 3);
|
366 |
|
367 |
// add action
|
368 |
add_action('wp', array(&$this, 'query_based_settings'));
|
376 |
if(method_exists($this, 'admin_custom_css') && false !== $this->conf['patch_admin_custom_css'])
|
377 |
add_action('admin_head' , array(&$this, 'admin_custom_css'), 99);
|
378 |
|
379 |
+
if(false !== $this->conf['patch_wplink_js'])
|
380 |
add_action('wp_default_scripts' , array(&$this, 'wplink_js'), 9);
|
381 |
|
382 |
+
if(false !== $this->conf['patch_word_count_js'])
|
383 |
add_action('wp_default_scripts' , array(&$this, 'word_count_js'), 9);
|
384 |
+
|
385 |
+
if(false !== $this->conf['patch_dashboard_recent_drafts'])
|
386 |
+
add_action('wp_dashboard_setup' , array(&$this, 'dashboard_recent_drafts'));
|
387 |
}
|
388 |
|
389 |
function mbfunctions_exist() {
|
392 |
function_exists('mb_convert_kana') &&
|
393 |
function_exists('mb_detect_encoding') &&
|
394 |
function_exists('mb_strcut') &&
|
395 |
+
function_exists('mb_strlen')
|
|
|
396 |
) ? true : false;
|
397 |
}
|
398 |
|
402 |
|
403 |
if(version_compare(substr($wp_version, 0, strlen($required_version)), $required_version, '<')) {
|
404 |
deactivate_plugins(__FILE__);
|
405 |
+
exit(sprintf(__('Sorry, WP Multibyte Patch requires WordPress %s or later.', 'wp-multibyte-patch'), $required_version));
|
406 |
}
|
407 |
+
elseif(!$this->has_mbfunctions && $this->mbfunctions_required) {
|
408 |
deactivate_plugins(__FILE__);
|
409 |
+
exit(__('Sorry, WP Multibyte Patch requires <a href="http://www.php.net/manual/en/mbstring.installation.php" target="_blank">mbstring</a> functions.', 'wp-multibyte-patch'));
|
410 |
}
|
411 |
}
|
412 |
|
427 |
|
428 |
function __construct() {
|
429 |
$this->load_conf();
|
|
|
430 |
$this->blog_encoding = get_option('blog_charset');
|
431 |
+
|
432 |
+
// mbstring functions are required for non UTF-8 blog.
|
433 |
+
if(!preg_match("/^utf-?8$/i", $this->blog_encoding))
|
434 |
+
$this->mbfunctions_required = true;
|
435 |
+
|
436 |
$this->has_mbfunctions = $this->mbfunctions_exist();
|
437 |
+
$this->has_mb_strlen = function_exists('mb_strlen');
|
438 |
+
$this->debug_suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
439 |
|
440 |
load_textdomain($this->textdomain, plugin_dir_path(__FILE__) . $this->lang_dir . '/' . $this->textdomain . '-' . get_locale() . '.mo');
|
441 |
register_activation_hook(__FILE__, array(&$this, 'activation_check'));
|
|
|
442 |
$this->filters();
|
443 |
}
|
444 |
}
|
wpmp-config-sample-ja.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WordPress 日本語版用 WP Multibyte Patch 設定ファイル
|
4 |
+
*
|
5 |
+
* このファイルを利用してデフォルトの設定値を任意に上書きすることができます。
|
6 |
+
* 設定を有効化するには、下記の場所へこのファイルを変名コピーして内容を編集してください。
|
7 |
+
*
|
8 |
+
* /wp-content/wpmp-config.php
|
9 |
+
*
|
10 |
+
* マルチサイトインストール環境では、下記ファイル名にすることで各ブログごとに設定ファイルを持つことができます。
|
11 |
+
*
|
12 |
+
* /wp-content/wpmp-config-blog-{BLOG ID}.php
|
13 |
+
*
|
14 |
+
* 設定の詳細は {@link http://eastcoder.com/code/wp-multibyte-patch/} を参照してください。
|
15 |
+
*
|
16 |
+
* @package WP_Multibyte_Patch
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* 投稿抜粋の最大文字数
|
21 |
+
*
|
22 |
+
* この設定は the_excerpt() とその関連の抜粋系関数に適用されます。
|
23 |
+
* この設定は $wpmp_conf['patch_wp_trim_excerpt'] が false の場合は無効となります。
|
24 |
+
*/
|
25 |
+
$wpmp_conf['excerpt_mblength'] = 110;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* 投稿抜粋末尾に出力される more 文字列
|
29 |
+
*
|
30 |
+
* この設定は the_excerpt() とその関連の抜粋系関数に適用されます。
|
31 |
+
* この設定は $wpmp_conf['patch_wp_trim_excerpt'] が false の場合は無効となります。
|
32 |
+
*/
|
33 |
+
$wpmp_conf['excerpt_more'] = ' [...]';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* get_comment_excerpt() 抜粋の最大文字数
|
37 |
+
*
|
38 |
+
* この設定は comment_excerpt() (ダッシュボードの最近のコメントウィジェットの抜粋で利用) に適用されます。
|
39 |
+
* この設定は $wpmp_conf['patch_get_comment_excerpt'] が false の場合は無効となります。
|
40 |
+
*/
|
41 |
+
$wpmp_conf['comment_excerpt_mblength'] = 40;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* ダッシュボード最近の下書きウィジェット抜粋の最大文字数
|
45 |
+
*
|
46 |
+
* この設定は、ダッシュボードの最近の下書きウィジェットの抜粋に適用されます。
|
47 |
+
* この設定は $wpmp_conf['patch_dashboard_recent_drafts'] が false の場合は無効となります。
|
48 |
+
*/
|
49 |
+
$wpmp_conf['dashboard_recent_drafts_mblength'] = 40;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* wp_mail() の文字エンコーディング
|
53 |
+
*
|
54 |
+
* この設定は WordPress から wp_mail() を通して送信されるメールに適用されます。
|
55 |
+
* 指定可能な値は、'JIS'、'UTF-8'、'auto' です。
|
56 |
+
* この設定は $wpmp_conf['patch_wp_mail'] が false の場合は無効となります。
|
57 |
+
*/
|
58 |
+
$wpmp_conf['mail_mode'] = 'JIS';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* BuddyPress bp_create_excerpt() 抜粋の最大文字数
|
62 |
+
*
|
63 |
+
* この設定は BuddyPress の bp_create_excerpt() (アクティビティストリームの抜粋で利用) に適用されます。
|
64 |
+
* この設定は $wpmp_conf['patch_bp_create_excerpt'] が false の場合は無効となります。
|
65 |
+
*/
|
66 |
+
$wpmp_conf['bp_excerpt_mblength'] = 110;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* BuddyPress bp_create_excerpt() 抜粋末尾に出力される more 文字列
|
70 |
+
*
|
71 |
+
* この設定は BuddyPress の bp_create_excerpt() (アクティビティストリームの抜粋で利用) に適用されます。
|
72 |
+
* この設定は $wpmp_conf['patch_bp_create_excerpt'] が false の場合は無効となります。
|
73 |
+
*/
|
74 |
+
$wpmp_conf['bp_excerpt_more'] = ' [...]';
|
75 |
+
|
76 |
+
|
77 |
+
/* 機能を個別に有効化、無効化できます。有効化するには true を、無効化するには false を指定してください。 */
|
78 |
+
$wpmp_conf['patch_wp_mail'] = true;
|
79 |
+
$wpmp_conf['patch_incoming_trackback'] = true;
|
80 |
+
$wpmp_conf['patch_incoming_pingback'] = true;
|
81 |
+
$wpmp_conf['patch_wp_trim_excerpt'] = true;
|
82 |
+
$wpmp_conf['patch_get_comment_excerpt'] = true;
|
83 |
+
$wpmp_conf['patch_dashboard_recent_drafts'] = true;
|
84 |
+
$wpmp_conf['patch_process_search_terms'] = true;
|
85 |
+
$wpmp_conf['patch_admin_custom_css'] = true;
|
86 |
+
$wpmp_conf['patch_wplink_js'] = true;
|
87 |
+
$wpmp_conf['patch_word_count_js'] = true;
|
88 |
+
$wpmp_conf['patch_force_character_count'] = false;
|
89 |
+
$wpmp_conf['patch_sanitize_file_name'] = true;
|
90 |
+
$wpmp_conf['patch_bp_create_excerpt'] = false;
|
91 |
+
|
wpmp-config-sample.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* WP Multibyte Patch global config file */
|
3 |
-
|
4 |
-
// WordPress Settings
|
5 |
-
$wpmp_conf['excerpt_length'] = 55; // Maximum word count for ascii posts.
|
6 |
-
$wpmp_conf['excerpt_mblength'] = 110; // Maximum character count for multibyte posts.
|
7 |
-
$wpmp_conf['excerpt_more'] = ' [...]'; // More string at the end of the excerpt.
|
8 |
-
$wpmp_conf['comment_excerpt_length'] = 20; // Maximum word count for ascii comments.
|
9 |
-
$wpmp_conf['comment_excerpt_mblength'] = 40; // Maximum character count for multibyte comments.
|
10 |
-
|
11 |
-
// BuddyPress Settings
|
12 |
-
$wpmp_conf['bp_excerpt_mblength'] = 110; // Maximum character count for the multibyte text filtered by bp_create_excerpt hook.
|
13 |
-
$wpmp_conf['bp_excerpt_more'] = ' [...]'; // More string for the multibyte excerpt filtered by bp_create_excerpt hook.
|
14 |
-
|
15 |
-
// Each function can be turned off by using the value false.
|
16 |
-
$wpmp_conf['patch_wp_mail'] = true;
|
17 |
-
$wpmp_conf['patch_incoming_trackback'] = true;
|
18 |
-
$wpmp_conf['patch_incoming_pingback'] = true;
|
19 |
-
$wpmp_conf['patch_wp_trim_excerpt'] = true;
|
20 |
-
$wpmp_conf['patch_get_comment_excerpt'] = true;
|
21 |
-
$wpmp_conf['patch_process_search_terms'] = true;
|
22 |
-
$wpmp_conf['patch_admin_custom_css'] = true;
|
23 |
-
$wpmp_conf['patch_wplink_js'] = true;
|
24 |
-
$wpmp_conf['patch_word_count_js'] = true;
|
25 |
-
$wpmp_conf['patch_sanitize_file_name'] = true;
|
26 |
-
$wpmp_conf['patch_bp_create_excerpt'] = false;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Set the encoding for wp_mail().
|
30 |
-
* Available options are "JIS", "UTF-8" and "auto".
|
31 |
-
* "auto" picks "JIS" or "UTF-8" automatically.
|
32 |
-
* This option is specific to Japanese.
|
33 |
-
*/
|
34 |
-
$wpmp_conf['mail_mode'] = 'JIS';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wpmp-load.php
CHANGED
@@ -1,5 +1,16 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
if(!defined('WP_INSTALLING') && defined('WPMU_PLUGIN_DIR') && defined('WPMU_PLUGIN_URL'))
|
4 |
require_once(WPMU_PLUGIN_DIR . '/wp-multibyte-patch/wp-multibyte-patch.php');
|
5 |
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Bootstrap file for mu-plugins directory
|
4 |
+
*
|
5 |
+
* To load WP Multibyte Patch as a must-use plugin, place this file directly under the mu-plugins directory like:
|
6 |
+
*
|
7 |
+
* /wp-content/mu-plugins/wpmp-load.php
|
8 |
+
*
|
9 |
+
* @package WP_Multibyte_Patch
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
*/
|
14 |
if(!defined('WP_INSTALLING') && defined('WPMU_PLUGIN_DIR') && defined('WPMU_PLUGIN_URL'))
|
15 |
require_once(WPMU_PLUGIN_DIR . '/wp-multibyte-patch/wp-multibyte-patch.php');
|
16 |
?>
|