Changeset 2468385
- Timestamp:
- 02/04/2021 12:12:55 AM (5 years ago)
- Location:
- adjust-admin-categories
- Files:
-
- 7 edited
- 2 copied
-
tags/2.2.4 (copied) (copied from adjust-admin-categories/trunk)
-
tags/2.2.4/adjust-admin-categories.php (modified) (5 diffs)
-
tags/2.2.4/admin/admin.php (copied) (copied from adjust-admin-categories/trunk/admin/admin.php) (6 diffs)
-
tags/2.2.4/includes/class-category-checklist.php (modified) (5 diffs)
-
tags/2.2.4/readme.txt (modified) (1 diff)
-
trunk/adjust-admin-categories.php (modified) (5 diffs)
-
trunk/admin/admin.php (modified) (6 diffs)
-
trunk/includes/class-category-checklist.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
adjust-admin-categories/tags/2.2.4/adjust-admin-categories.php
r2284534 r2468385 5 5 Description: Installing this plugin allows you to adjust the behavior of the area below the posts screen categoryand custom taxonomy box. 6 6 Author: Nakashima Masahiro 7 Version: 2.2. 37 Version: 2.2.4 8 8 Author URI: https://www.kigurumi.asia 9 9 Text Domain: aac 10 10 Domain Path: /languages/ 11 11 */ 12 define( 'AAC_VERSION', '2.2. 3' );12 define( 'AAC_VERSION', '2.2.4' ); 13 13 define( 'AAC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 14 14 define( 'AAC_PLUGIN_NAME', trim( dirname( AAC_PLUGIN_BASENAME ), '/' ) ); … … 29 29 'change_radiolist' => 0, 30 30 'checklist_no_top' => 0, 31 'require s' => 0,31 'required' => 0, 32 32 ) 33 33 ) … … 95 95 $checklist_no_top = true; 96 96 } 97 $Checklist = new AAC_Category_Checklist($change_radiolist, $checklist_no_top); 97 98 //required 99 $required = false; 100 if ( $this->aac_options[$key][$key2]['required'] == true ) { 101 $args['required'] = false; 102 $required = true; 103 } 104 105 $Checklist = new AAC_Category_Checklist($change_radiolist, $checklist_no_top, $required); 98 106 $args['walker'] = $Checklist; 99 107 … … 116 124 if( $key == $post_type ){ 117 125 foreach ( $value as $key2 => $value2) { 118 if( $this->aac_options[$key][$key2]['require s'] ){126 if( $this->aac_options[$key][$key2]['required'] ){ 119 127 $term = get_taxonomy( $key2 ); 120 128 $func_key2 = str_replace('-', '_', $key2); … … 122 130 <script type="text/javascript"> 123 131 (function($){ 132 $('#<?php echo $key2; ?>div > h2.hndle').append(' <span class="rwmb-required">*</span>'); 124 133 $("#post").on("submit", function(event){ 125 if (!check_<?php echo $func_key2; ?>()) { 126 alert("<?php echo $term->labels->name; ?><?php $this->e( ' is required', 'は必須項目です' ) ?>"); 134 $('#<?php echo $key2; ?>-error').remove(); 135 if (!check_<?php echo $func_key2; ?>() && $("input[type=submit][clicked=true]").attr('id') != 'save-post' ) { 136 //$('#<?php echo $key2; ?>div').css('border', '1px dotted red'); 137 $('#taxonomy-<?php echo $key2; ?>').before( '<p id="<?php echo $key2; ?>-error" style="color: #dc3232; margin: 2px 0 5px;"><?php echo __('An','は必須項目です').' '.$term->labels->singular_name; ?><?php $this->e( ' is required', 'は必須項目です' ) ?></p>' ); 127 138 event.preventDefault(); 128 139 event.stopPropagation(); -
adjust-admin-categories/tags/2.2.4/admin/admin.php
r2468384 r2468385 1 <?php 2 require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php'; 1 <?php 2 require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php'; 3 3 4 4 /** … … 21 21 'change_radiolist' => esc_html( $change_radiolist ), 22 22 'checklist_no_top' => esc_html( $checklist_no_top ), 23 'require s' => esc_html( $requires),23 'required' => esc_html( $required ), 24 24 ); 25 25 update_option( 'aac_options', $aac_options ); … … 57 57 58 58 <h2><?php $this->e( 'Adjust Admin Categories Settings', 'Adjust Admin Categories 設定' ) ?></h2> 59 <?php 59 <?php 60 60 /** 61 61 * エラーメッセージ … … 73 73 74 74 <ul class="aac_tab"> 75 <?php foreach($post_types as $post_type) : ?> 75 <?php foreach($post_types as $post_type) : ?> 76 76 <li class="aac_tab-<?php echo $post_type->name;?>"><?php echo $post_type->labels->name;?></li> 77 77 <?php endforeach; ?> 78 78 </ul> 79 79 <div class="aac_contents"> 80 <?php foreach($post_types as $post_type) : ?> 80 <?php foreach($post_types as $post_type) : ?> 81 81 <div class="aac_content"> 82 82 <h3><?php echo $post_type->labels->name;?></h3> 83 83 84 <?php 84 <?php 85 85 $flg_taxonomy = 0; 86 foreach($post_taxonomies as $post_taxonomy) : 86 foreach($post_taxonomies as $post_taxonomy) : 87 87 //オブジェクトタイプがタクソノミーを使用できるか調べる 88 88 if( !is_object_in_taxonomy( $post_type->name, $post_taxonomy->name ) ){ 89 89 continue; 90 90 } 91 ?> 91 ?> 92 92 <form method='post' action='' class="aac_form"> 93 93 <h4 class="taxonomy_title"><?php echo $post_taxonomy->labels->name;?></h4> … … 124 124 <th style="width:300px"><?php $this->e( "Required", '必須項目にする' ) ?></th> 125 125 <td> 126 <select name='require s' id='requires' class='postform'>127 <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'require s', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option>128 <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'require s', 1 ) ?>><?php $this->e( "Activate", '有効化' ) ?></option>126 <select name='required' id='required' class='postform'> 127 <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'required', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option> 128 <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'required', 1 ) ?>><?php $this->e( "Activate", '有効化' ) ?></option> 129 129 </select> 130 130 </td> 131 131 </tr> 132 132 </table> 133 133 134 134 <input type="hidden" name="posttype" value="<?php echo $post_type->name;?>"> 135 135 <input type="hidden" name="posttaxonomy" value="<?php echo $post_taxonomy->name;?>"> 136 136 <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php $this->e( 'Save Changes', '変更を保存' ) ?>" /></p></form> 137 137 </form> 138 <?php 138 <?php 139 139 $flg_taxonomy ++; 140 endforeach; 140 endforeach; 141 141 142 142 //タクソノミーがなければメニューを削除 … … 146 146 jQuery('.aac_tab-<?php echo $post_type->name;?>').hide(); 147 147 </script> 148 <?php 148 <?php 149 149 } 150 150 ?> -
adjust-admin-categories/tags/2.2.4/includes/class-category-checklist.php
r2284534 r2468385 4 4 public $change_radiolist = false; 5 5 public $checklist_no_top = false; 6 public $required = false; 6 7 7 function __construct($change_radiolist, $checklist_no_top ) {8 function __construct($change_radiolist, $checklist_no_top, $required) { 8 9 $this->change_radiolist = $change_radiolist; 9 10 $this->checklist_no_top = $checklist_no_top; 11 $this->required = $required; 10 12 } 11 13 … … 29 31 30 32 $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; 31 $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; 33 34 $class_names = in_array( $category->term_id, $args['popular_cats'] ) ? 'popular-category' : ''; 35 $class_names = apply_filters( 'aac_category_wrapper_class', $class_names, $category ); 36 37 $class = ''; 38 if(!empty($class_names)){ 39 $class = ' class="'.$class_names.'"'; 40 } 32 41 33 42 $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; 43 44 $required = ''; 45 if($this->required == true){ 46 $required = 'required'; 47 } 34 48 35 49 if ( ! empty( $args['list_only'] ) ) { … … 53 67 $input_type = 'radio'; 54 68 } 69 $input_class = 'rwmb-'.$input_type; 70 $input_class = apply_filters( 'aac_category_input_class', $input_class, $category ); 55 71 56 72 if($this->checklist_no_top == true){ … … 63 79 '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . 64 80 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . 65 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .81 disabled( empty( $args['disabled'] ), false, false ) . ' class="'.$input_class.'" '.$required.' /> ' . 66 82 esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; 67 83 } … … 71 87 '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . 72 88 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . 73 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .89 disabled( empty( $args['disabled'] ), false, false ) . ' class="'.$input_class.'" '.$required.'/> ' . 74 90 esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; 75 91 } -
adjust-admin-categories/tags/2.2.4/readme.txt
r2284534 r2468385 4 4 Tags: admin, category 5 5 Requires at least: 3.0 or higher 6 Tested up to: 5. 4.07 Stable tag: 2.2. 36 Tested up to: 5.6.1 7 Stable tag: 2.2.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
adjust-admin-categories/trunk/adjust-admin-categories.php
r2284534 r2468385 5 5 Description: Installing this plugin allows you to adjust the behavior of the area below the posts screen categoryand custom taxonomy box. 6 6 Author: Nakashima Masahiro 7 Version: 2.2. 37 Version: 2.2.4 8 8 Author URI: https://www.kigurumi.asia 9 9 Text Domain: aac 10 10 Domain Path: /languages/ 11 11 */ 12 define( 'AAC_VERSION', '2.2. 3' );12 define( 'AAC_VERSION', '2.2.4' ); 13 13 define( 'AAC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 14 14 define( 'AAC_PLUGIN_NAME', trim( dirname( AAC_PLUGIN_BASENAME ), '/' ) ); … … 29 29 'change_radiolist' => 0, 30 30 'checklist_no_top' => 0, 31 'require s' => 0,31 'required' => 0, 32 32 ) 33 33 ) … … 95 95 $checklist_no_top = true; 96 96 } 97 $Checklist = new AAC_Category_Checklist($change_radiolist, $checklist_no_top); 97 98 //required 99 $required = false; 100 if ( $this->aac_options[$key][$key2]['required'] == true ) { 101 $args['required'] = false; 102 $required = true; 103 } 104 105 $Checklist = new AAC_Category_Checklist($change_radiolist, $checklist_no_top, $required); 98 106 $args['walker'] = $Checklist; 99 107 … … 116 124 if( $key == $post_type ){ 117 125 foreach ( $value as $key2 => $value2) { 118 if( $this->aac_options[$key][$key2]['require s'] ){126 if( $this->aac_options[$key][$key2]['required'] ){ 119 127 $term = get_taxonomy( $key2 ); 120 128 $func_key2 = str_replace('-', '_', $key2); … … 122 130 <script type="text/javascript"> 123 131 (function($){ 132 $('#<?php echo $key2; ?>div > h2.hndle').append(' <span class="rwmb-required">*</span>'); 124 133 $("#post").on("submit", function(event){ 125 if (!check_<?php echo $func_key2; ?>()) { 126 alert("<?php echo $term->labels->name; ?><?php $this->e( ' is required', 'は必須項目です' ) ?>"); 134 $('#<?php echo $key2; ?>-error').remove(); 135 if (!check_<?php echo $func_key2; ?>() && $("input[type=submit][clicked=true]").attr('id') != 'save-post' ) { 136 //$('#<?php echo $key2; ?>div').css('border', '1px dotted red'); 137 $('#taxonomy-<?php echo $key2; ?>').before( '<p id="<?php echo $key2; ?>-error" style="color: #dc3232; margin: 2px 0 5px;"><?php echo __('An','は必須項目です').' '.$term->labels->singular_name; ?><?php $this->e( ' is required', 'は必須項目です' ) ?></p>' ); 127 138 event.preventDefault(); 128 139 event.stopPropagation(); -
adjust-admin-categories/trunk/admin/admin.php
r1299403 r2468385 1 <?php 2 require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php'; 1 <?php 2 require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php'; 3 3 4 4 /** … … 21 21 'change_radiolist' => esc_html( $change_radiolist ), 22 22 'checklist_no_top' => esc_html( $checklist_no_top ), 23 'require s' => esc_html( $requires),23 'required' => esc_html( $required ), 24 24 ); 25 25 update_option( 'aac_options', $aac_options ); … … 57 57 58 58 <h2><?php $this->e( 'Adjust Admin Categories Settings', 'Adjust Admin Categories 設定' ) ?></h2> 59 <?php 59 <?php 60 60 /** 61 61 * エラーメッセージ … … 73 73 74 74 <ul class="aac_tab"> 75 <?php foreach($post_types as $post_type) : ?> 75 <?php foreach($post_types as $post_type) : ?> 76 76 <li class="aac_tab-<?php echo $post_type->name;?>"><?php echo $post_type->labels->name;?></li> 77 77 <?php endforeach; ?> 78 78 </ul> 79 79 <div class="aac_contents"> 80 <?php foreach($post_types as $post_type) : ?> 80 <?php foreach($post_types as $post_type) : ?> 81 81 <div class="aac_content"> 82 82 <h3><?php echo $post_type->labels->name;?></h3> 83 83 84 <?php 84 <?php 85 85 $flg_taxonomy = 0; 86 foreach($post_taxonomies as $post_taxonomy) : 86 foreach($post_taxonomies as $post_taxonomy) : 87 87 //オブジェクトタイプがタクソノミーを使用できるか調べる 88 88 if( !is_object_in_taxonomy( $post_type->name, $post_taxonomy->name ) ){ 89 89 continue; 90 90 } 91 ?> 91 ?> 92 92 <form method='post' action='' class="aac_form"> 93 93 <h4 class="taxonomy_title"><?php echo $post_taxonomy->labels->name;?></h4> … … 124 124 <th style="width:300px"><?php $this->e( "Required", '必須項目にする' ) ?></th> 125 125 <td> 126 <select name='require s' id='requires' class='postform'>127 <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'require s', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option>128 <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'require s', 1 ) ?>><?php $this->e( "Activate", '有効化' ) ?></option>126 <select name='required' id='required' class='postform'> 127 <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'required', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option> 128 <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'required', 1 ) ?>><?php $this->e( "Activate", '有効化' ) ?></option> 129 129 </select> 130 130 </td> 131 131 </tr> 132 132 </table> 133 133 134 134 <input type="hidden" name="posttype" value="<?php echo $post_type->name;?>"> 135 135 <input type="hidden" name="posttaxonomy" value="<?php echo $post_taxonomy->name;?>"> 136 136 <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php $this->e( 'Save Changes', '変更を保存' ) ?>" /></p></form> 137 137 </form> 138 <?php 138 <?php 139 139 $flg_taxonomy ++; 140 endforeach; 140 endforeach; 141 141 142 142 //タクソノミーがなければメニューを削除 … … 146 146 jQuery('.aac_tab-<?php echo $post_type->name;?>').hide(); 147 147 </script> 148 <?php 148 <?php 149 149 } 150 150 ?> -
adjust-admin-categories/trunk/includes/class-category-checklist.php
r2284534 r2468385 4 4 public $change_radiolist = false; 5 5 public $checklist_no_top = false; 6 public $required = false; 6 7 7 function __construct($change_radiolist, $checklist_no_top ) {8 function __construct($change_radiolist, $checklist_no_top, $required) { 8 9 $this->change_radiolist = $change_radiolist; 9 10 $this->checklist_no_top = $checklist_no_top; 11 $this->required = $required; 10 12 } 11 13 … … 29 31 30 32 $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; 31 $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; 33 34 $class_names = in_array( $category->term_id, $args['popular_cats'] ) ? 'popular-category' : ''; 35 $class_names = apply_filters( 'aac_category_wrapper_class', $class_names, $category ); 36 37 $class = ''; 38 if(!empty($class_names)){ 39 $class = ' class="'.$class_names.'"'; 40 } 32 41 33 42 $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; 43 44 $required = ''; 45 if($this->required == true){ 46 $required = 'required'; 47 } 34 48 35 49 if ( ! empty( $args['list_only'] ) ) { … … 53 67 $input_type = 'radio'; 54 68 } 69 $input_class = 'rwmb-'.$input_type; 70 $input_class = apply_filters( 'aac_category_input_class', $input_class, $category ); 55 71 56 72 if($this->checklist_no_top == true){ … … 63 79 '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . 64 80 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . 65 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .81 disabled( empty( $args['disabled'] ), false, false ) . ' class="'.$input_class.'" '.$required.' /> ' . 66 82 esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; 67 83 } … … 71 87 '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . 72 88 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . 73 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .89 disabled( empty( $args['disabled'] ), false, false ) . ' class="'.$input_class.'" '.$required.'/> ' . 74 90 esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; 75 91 } -
adjust-admin-categories/trunk/readme.txt
r2284534 r2468385 4 4 Tags: admin, category 5 5 Requires at least: 3.0 or higher 6 Tested up to: 5. 4.07 Stable tag: 2.2. 36 Tested up to: 5.6.1 7 Stable tag: 2.2.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.