Changeset 1907460
- Timestamp:
- 07/11/2018 06:16:39 AM (8 years ago)
- Location:
- wp-tocjs/trunk
- Files:
-
- 5 edited
-
languages/wp-tocjs-ja.mo (modified) (previous)
-
languages/wp-tocjs-ja.po (modified) (4 diffs)
-
languages/wp-tocjs.pot (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-tocjs.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-tocjs/trunk/languages/wp-tocjs-ja.po
r1848102 r1907460 2 2 msgstr "" 3 3 "Project-Id-Version: WP TocJS\n" 4 "POT-Creation-Date: 2018-0 3-28 10:34+0900\n"5 "PO-Revision-Date: 2018-0 3-28 10:34+0900\n"4 "POT-Creation-Date: 2018-07-11 15:13+0900\n" 5 "PO-Revision-Date: 2018-07-11 15:13+0900\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 79 79 80 80 #: wp-tocjs.php:198 81 msgid "Post type to disable TOC" 82 msgstr "目次を無効にする投稿タイプ" 83 84 #: wp-tocjs.php:206 81 85 msgid "Do not use plugin's CSS" 82 86 msgstr "プラグインのCSSを使わない" 83 87 84 #: wp-tocjs.php:2 0688 #: wp-tocjs.php:214 85 89 msgid "Do not use plugin's JS" 86 90 msgstr "プラグインのJavaScriptを使わない" 87 91 88 #: wp-tocjs.php:22 192 #: wp-tocjs.php:229 89 93 msgid "As the TOC function becomes invalid, please do not usually disable it." 90 94 msgstr "目次機能が無効になります。通常は無効にしないでください。" 91 95 92 #: wp-tocjs.php:2 2796 #: wp-tocjs.php:235 93 97 msgid "" 94 98 "The contents of the element specified here becomes the target area of the " … … 96 100 msgstr "ここで指定した要素内が目次の対象エリアとなります。" 97 101 98 #: wp-tocjs.php:2 28102 #: wp-tocjs.php:236 99 103 msgid "In the format of a jQuery selector." 100 104 msgstr "jQuery(CSS)セレクタの形式で入力ください。" 101 105 102 #: wp-tocjs.php:2 34106 #: wp-tocjs.php:242 103 107 msgid "Please enter the target headings in h1 - h6 separated by comma." 104 108 msgstr "目次の対象とする見出しタグをh1-h6でカンマ区切りで入力してください" 105 109 106 #: wp-tocjs.php:24 0110 #: wp-tocjs.php:248 107 111 msgid "" 108 112 "If the number of target headings is less than or equal to the value, the TOC " … … 110 114 msgstr "目次の対象となる見出しがこの数以下の場合、目次を表示しません。" 111 115 112 #: wp-tocjs.php:2 57116 #: wp-tocjs.php:265 113 117 msgid "Please input as attribute name of class, not selector." 114 118 msgstr "セレクタではなく、クラス名を入力してください。" 115 119 116 #: wp-tocjs.php:3 03120 #: wp-tocjs.php:348 117 121 msgid "Hidden on this page" 118 122 msgstr "このページの目次を表示しない" -
wp-tocjs/trunk/languages/wp-tocjs.pot
r1848102 r1907460 4 4 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 5 5 "Project-Id-Version: WP TocJS\n" 6 "POT-Creation-Date: 2018-0 3-28 10:33+0900\n"6 "POT-Creation-Date: 2018-07-11 15:14+0900\n" 7 7 "PO-Revision-Date: 2018-03-05 13:46+0900\n" 8 8 "Last-Translator: \n" … … 77 77 78 78 #: wp-tocjs.php:198 79 msgid "Post type to disable TOC" 80 msgstr "" 81 82 #: wp-tocjs.php:206 79 83 msgid "Do not use plugin's CSS" 80 84 msgstr "" 81 85 82 #: wp-tocjs.php:2 0686 #: wp-tocjs.php:214 83 87 msgid "Do not use plugin's JS" 84 88 msgstr "" 85 89 86 #: wp-tocjs.php:22 190 #: wp-tocjs.php:229 87 91 msgid "As the TOC function becomes invalid, please do not usually disable it." 88 92 msgstr "" 89 93 90 #: wp-tocjs.php:2 2794 #: wp-tocjs.php:235 91 95 msgid "" 92 96 "The contents of the element specified here becomes the target area of the " … … 94 98 msgstr "" 95 99 96 #: wp-tocjs.php:2 28100 #: wp-tocjs.php:236 97 101 msgid "In the format of a jQuery selector." 98 102 msgstr "" 99 103 100 #: wp-tocjs.php:2 34104 #: wp-tocjs.php:242 101 105 msgid "Please enter the target headings in h1 - h6 separated by comma." 102 106 msgstr "" 103 107 104 #: wp-tocjs.php:24 0108 #: wp-tocjs.php:248 105 109 msgid "" 106 110 "If the number of target headings is less than or equal to the value, the " … … 108 112 msgstr "" 109 113 110 #: wp-tocjs.php:2 57114 #: wp-tocjs.php:265 111 115 msgid "Please input as attribute name of class, not selector." 112 116 msgstr "" 113 117 114 #: wp-tocjs.php:3 03118 #: wp-tocjs.php:348 115 119 msgid "Hidden on this page" 116 120 msgstr "" -
wp-tocjs/trunk/readme.txt
r1903719 r1907460 4 4 Tags: shortcode, quote, quotation, blockquote 5 5 Requires at least: 4.0 6 Tested up to: 4.9. 67 Stable tag: 0. 3.16 Tested up to: 4.9.7 7 Stable tag: 0.4.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 55 55 == Changelog == 56 56 57 = 0.4.0 = 58 59 * Update: Supported Custom Post Types. 60 * カスタム投稿タイプに対応しました。 61 57 62 = 0.3.1 = 58 63 -
wp-tocjs/trunk/wp-tocjs.php
r1903719 r1907460 4 4 Plugin URI: http://e-joint.jp/works/wp-tocjs/ 5 5 Description: A WordPress plugin that makes Table of Contents automatically. 6 Version: 0. 3.16 Version: 0.4.0 7 7 Author: e-JOINT.jp 8 8 Author URI: http://e-joint.jp … … 195 195 196 196 add_settings_field( 197 'disable_post_type', 198 __('Post type to disable TOC', $this->textdomain), 199 array($this, 'disable_post_type_callback'), 200 'wptjs-setting', 201 'wptjs-setting-section-id' 202 ); 203 204 add_settings_field( 197 205 'nocss', 198 206 __('Do not use plugin\'s CSS', $this->textdomain), … … 266 274 $checked = isset($this->options['toc_number']) ? checked($this->options['toc_number'], 1, false) : false; 267 275 ?><input type="checkbox" id="toc-number" name="wptjs-setting[toc_number]" value="1"<?php echo $checked; ?>><?php 276 } 277 278 public function disable_post_type_callback() { 279 $post_types = $this->post_types(); 280 $data = $this->options['disable_post_type']; 281 $html = ''; 282 $html .= '<fieldset>'; 283 284 foreach($post_types as $post_type) { 285 $name = $post_type->name; 286 287 if(is_array($data)) { 288 $checked = in_array($name, $data) ? ' checked="checked"' : ''; 289 } else { 290 $checked = ''; 291 } 292 293 $html .= sprintf('<label><input type="checkbox" name="wptjs-setting[disable_post_type][]" value="%s"%s> %s</label><br>', $name, $checked, $post_type->label); 294 } 295 296 $html .= '</fieldset>'; 297 298 echo $html; 268 299 } 269 300 … … 292 323 // カスタムフィールドの追加 293 324 public function add_custom_field() { 294 add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), 'post', 'side'); 295 add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), 'page', 'side'); 325 $post_types = $this->post_types(); 326 $disable_post_type = $this->options['disable_post_type']; 327 328 if(is_null($disable_post_type)) { 329 foreach($post_types as $post_type) { 330 add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), $post_type->name, 'side'); 331 } 332 } else { 333 foreach($post_types as $post_type) { 334 if(!in_array($post_type->name, $disable_post_type)) { 335 add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), $post_type->name, 'side'); 336 } 337 } 338 } 339 // add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), 'post', 'side'); 340 // add_meta_box('wptjs-setting', 'WP TocJS', array($this, 'custom_field_metabox'), 'page', 'side'); 296 341 } 297 342 … … 321 366 } 322 367 323 public function generate_scripts() { ?> 368 public function generate_scripts() { 369 370 if($this->is_disabled()) { 371 return; 372 } 373 ?> 324 374 <script> 325 375 jQuery("<?php echo $this->default_option('src') ?>").tocjs({ … … 336 386 <?php } 337 387 338 function the_content($content) { 388 protected function post_types() { 389 $post_types = get_post_types('', 'objects'); 390 $unsets = ['attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request']; 391 392 foreach($unsets as $unset) { 393 unset($post_types[$unset]); 394 } 395 396 return $post_types; 397 } 398 399 protected function is_disabled() { 400 $disable_post_type = $this->options['disable_post_type']; 401 $post_type = get_post_type(); 402 403 if(is_null($disable_post_type)) { 404 $disabled = false; 405 406 } else { 407 $disabled = in_array($post_type, $disable_post_type); 408 } 409 410 return $disabled; 411 } 412 413 public function the_content($content) { 414 if($this->is_disabled()) { 415 return $content; 416 } 339 417 340 418 $add_html = do_shortcode('[tocjs]');
Note: See TracChangeset
for help on using the changeset viewer.