Plugin Directory

Changeset 2468385


Ignore:
Timestamp:
02/04/2021 12:12:55 AM (5 years ago)
Author:
kanakogi
Message:

2.2.4

Location:
adjust-admin-categories
Files:
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • adjust-admin-categories/tags/2.2.4/adjust-admin-categories.php

    r2284534 r2468385  
    55Description: Installing this plugin allows you to adjust the behavior of the area below the posts screen categoryand custom taxonomy box.
    66Author: Nakashima Masahiro
    7 Version: 2.2.3
     7Version: 2.2.4
    88Author URI: https://www.kigurumi.asia
    99Text Domain: aac
    1010Domain Path: /languages/
    1111*/
    12 define( 'AAC_VERSION', '2.2.3' );
     12define( 'AAC_VERSION', '2.2.4' );
    1313define( 'AAC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    1414define( 'AAC_PLUGIN_NAME', trim( dirname( AAC_PLUGIN_BASENAME ), '/' ) );
     
    2929                    'change_radiolist' => 0,
    3030                    'checklist_no_top' => 0,
    31                     'requires' => 0,
     31                    'required' => 0,
    3232                )
    3333            )
     
    9595                            $checklist_no_top = true;
    9696                        }
    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);
    98106                        $args['walker'] = $Checklist;
    99107
     
    116124            if( $key == $post_type ){
    117125                foreach ( $value as $key2 => $value2) {
    118                     if( $this->aac_options[$key][$key2]['requires'] ){
     126                    if( $this->aac_options[$key][$key2]['required'] ){
    119127                        $term = get_taxonomy( $key2 );
    120128                        $func_key2 = str_replace('-', '_', $key2);
     
    122130    <script type="text/javascript">
    123131    (function($){
     132    $('#<?php echo $key2; ?>div > h2.hndle').append(' <span class="rwmb-required">*</span>');
    124133    $("#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>' );
    127138            event.preventDefault();
    128139            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
     2require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php';
    33
    44/**
     
    2121        'change_radiolist' => esc_html( $change_radiolist ),
    2222        'checklist_no_top' => esc_html( $checklist_no_top ),
    23         'requires' => esc_html( $requires ),
     23        'required' => esc_html( $required ),
    2424    );
    2525    update_option( 'aac_options', $aac_options );
     
    5757
    5858<h2><?php $this->e( 'Adjust Admin Categories Settings', 'Adjust Admin Categories 設定' ) ?></h2>
    59 <?php 
     59<?php
    6060/**
    6161 * エラーメッセージ
     
    7373
    7474<ul class="aac_tab">
    75 <?php foreach($post_types as $post_type) : ?>   
     75<?php foreach($post_types as $post_type) : ?>
    7676    <li class="aac_tab-<?php echo $post_type->name;?>"><?php echo $post_type->labels->name;?></li>
    7777<?php endforeach; ?>
    7878</ul>
    7979<div class="aac_contents">
    80 <?php foreach($post_types as $post_type) : ?>   
     80<?php foreach($post_types as $post_type) : ?>
    8181<div class="aac_content">
    8282    <h3><?php echo $post_type->labels->name;?></h3>
    8383
    84 <?php 
     84<?php
    8585$flg_taxonomy = 0;
    86 foreach($post_taxonomies as $post_taxonomy) : 
     86foreach($post_taxonomies as $post_taxonomy) :
    8787    //オブジェクトタイプがタクソノミーを使用できるか調べる
    8888    if( !is_object_in_taxonomy( $post_type->name, $post_taxonomy->name ) ){
    8989        continue;
    9090    }
    91 ?>     
     91?>
    9292<form method='post' action='' class="aac_form">
    9393    <h4 class="taxonomy_title"><?php echo $post_taxonomy->labels->name;?></h4>
     
    124124            <th style="width:300px"><?php $this->e( "Required", '必須項目にする' ) ?></th>
    125125            <td>
    126                 <select name='requires' id='requires' class='postform'>
    127                     <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'requires', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option>
    128                     <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'requires', 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>
    129129                </select>
    130130            </td>
    131131        </tr>
    132132    </table>
    133    
     133
    134134    <input type="hidden" name="posttype" value="<?php echo $post_type->name;?>">
    135135    <input type="hidden" name="posttaxonomy" value="<?php echo $post_taxonomy->name;?>">
    136136    <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php $this->e( 'Save Changes', '変更を保存' ) ?>"  /></p></form>
    137137</form>
    138 <?php 
     138<?php
    139139$flg_taxonomy ++;
    140 endforeach; 
     140endforeach;
    141141
    142142//タクソノミーがなければメニューを削除
     
    146146jQuery('.aac_tab-<?php echo $post_type->name;?>').hide();
    147147</script>
    148 <?php 
     148<?php
    149149}
    150150?>
  • adjust-admin-categories/tags/2.2.4/includes/class-category-checklist.php

    r2284534 r2468385  
    44    public $change_radiolist = false;
    55    public $checklist_no_top = false;
     6    public $required = false;
    67
    7    function __construct($change_radiolist, $checklist_no_top) {
     8   function __construct($change_radiolist, $checklist_no_top, $required) {
    89        $this->change_radiolist = $change_radiolist;
    910        $this->checklist_no_top = $checklist_no_top;
     11        $this->required = $required;
    1012   }
    1113
     
    2931
    3032        $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        }
    3241
    3342        $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
     43
     44        $required = '';
     45        if($this->required == true){
     46            $required = 'required';
     47        }
    3448
    3549        if ( ! empty( $args['list_only'] ) ) {
     
    5367                $input_type = 'radio';
    5468            }
     69            $input_class = 'rwmb-'.$input_type;
     70            $input_class = apply_filters( 'aac_category_input_class', $input_class, $category );
    5571
    5672            if($this->checklist_no_top == true){
     
    6379                        '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
    6480                        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.' /> ' .
    6682                        esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
    6783                }
     
    7187                    '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
    7288                    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.'/> ' .
    7490                    esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
    7591            }
  • adjust-admin-categories/tags/2.2.4/readme.txt

    r2284534 r2468385  
    44Tags: admin, category
    55Requires at least: 3.0 or higher
    6 Tested up to: 5.4.0
    7 Stable tag: 2.2.3
     6Tested up to: 5.6.1
     7Stable tag: 2.2.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • adjust-admin-categories/trunk/adjust-admin-categories.php

    r2284534 r2468385  
    55Description: Installing this plugin allows you to adjust the behavior of the area below the posts screen categoryand custom taxonomy box.
    66Author: Nakashima Masahiro
    7 Version: 2.2.3
     7Version: 2.2.4
    88Author URI: https://www.kigurumi.asia
    99Text Domain: aac
    1010Domain Path: /languages/
    1111*/
    12 define( 'AAC_VERSION', '2.2.3' );
     12define( 'AAC_VERSION', '2.2.4' );
    1313define( 'AAC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    1414define( 'AAC_PLUGIN_NAME', trim( dirname( AAC_PLUGIN_BASENAME ), '/' ) );
     
    2929                    'change_radiolist' => 0,
    3030                    'checklist_no_top' => 0,
    31                     'requires' => 0,
     31                    'required' => 0,
    3232                )
    3333            )
     
    9595                            $checklist_no_top = true;
    9696                        }
    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);
    98106                        $args['walker'] = $Checklist;
    99107
     
    116124            if( $key == $post_type ){
    117125                foreach ( $value as $key2 => $value2) {
    118                     if( $this->aac_options[$key][$key2]['requires'] ){
     126                    if( $this->aac_options[$key][$key2]['required'] ){
    119127                        $term = get_taxonomy( $key2 );
    120128                        $func_key2 = str_replace('-', '_', $key2);
     
    122130    <script type="text/javascript">
    123131    (function($){
     132    $('#<?php echo $key2; ?>div > h2.hndle').append(' <span class="rwmb-required">*</span>');
    124133    $("#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>' );
    127138            event.preventDefault();
    128139            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
     2require_once AAC_PLUGIN_DIR . '/admin/admin-functions.php';
    33
    44/**
     
    2121        'change_radiolist' => esc_html( $change_radiolist ),
    2222        'checklist_no_top' => esc_html( $checklist_no_top ),
    23         'requires' => esc_html( $requires ),
     23        'required' => esc_html( $required ),
    2424    );
    2525    update_option( 'aac_options', $aac_options );
     
    5757
    5858<h2><?php $this->e( 'Adjust Admin Categories Settings', 'Adjust Admin Categories 設定' ) ?></h2>
    59 <?php 
     59<?php
    6060/**
    6161 * エラーメッセージ
     
    7373
    7474<ul class="aac_tab">
    75 <?php foreach($post_types as $post_type) : ?>   
     75<?php foreach($post_types as $post_type) : ?>
    7676    <li class="aac_tab-<?php echo $post_type->name;?>"><?php echo $post_type->labels->name;?></li>
    7777<?php endforeach; ?>
    7878</ul>
    7979<div class="aac_contents">
    80 <?php foreach($post_types as $post_type) : ?>   
     80<?php foreach($post_types as $post_type) : ?>
    8181<div class="aac_content">
    8282    <h3><?php echo $post_type->labels->name;?></h3>
    8383
    84 <?php 
     84<?php
    8585$flg_taxonomy = 0;
    86 foreach($post_taxonomies as $post_taxonomy) : 
     86foreach($post_taxonomies as $post_taxonomy) :
    8787    //オブジェクトタイプがタクソノミーを使用できるか調べる
    8888    if( !is_object_in_taxonomy( $post_type->name, $post_taxonomy->name ) ){
    8989        continue;
    9090    }
    91 ?>     
     91?>
    9292<form method='post' action='' class="aac_form">
    9393    <h4 class="taxonomy_title"><?php echo $post_taxonomy->labels->name;?></h4>
     
    124124            <th style="width:300px"><?php $this->e( "Required", '必須項目にする' ) ?></th>
    125125            <td>
    126                 <select name='requires' id='requires' class='postform'>
    127                     <option class="level-0" value="0" <?php display_selected( $post_type->name, $post_taxonomy->name, 'requires', 0 ) ?>><?php $this->e( "Deactivate", '停止' ) ?></option>
    128                     <option class="level-0" value="1" <?php display_selected( $post_type->name, $post_taxonomy->name, 'requires', 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>
    129129                </select>
    130130            </td>
    131131        </tr>
    132132    </table>
    133    
     133
    134134    <input type="hidden" name="posttype" value="<?php echo $post_type->name;?>">
    135135    <input type="hidden" name="posttaxonomy" value="<?php echo $post_taxonomy->name;?>">
    136136    <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php $this->e( 'Save Changes', '変更を保存' ) ?>"  /></p></form>
    137137</form>
    138 <?php 
     138<?php
    139139$flg_taxonomy ++;
    140 endforeach; 
     140endforeach;
    141141
    142142//タクソノミーがなければメニューを削除
     
    146146jQuery('.aac_tab-<?php echo $post_type->name;?>').hide();
    147147</script>
    148 <?php 
     148<?php
    149149}
    150150?>
  • adjust-admin-categories/trunk/includes/class-category-checklist.php

    r2284534 r2468385  
    44    public $change_radiolist = false;
    55    public $checklist_no_top = false;
     6    public $required = false;
    67
    7    function __construct($change_radiolist, $checklist_no_top) {
     8   function __construct($change_radiolist, $checklist_no_top, $required) {
    89        $this->change_radiolist = $change_radiolist;
    910        $this->checklist_no_top = $checklist_no_top;
     11        $this->required = $required;
    1012   }
    1113
     
    2931
    3032        $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        }
    3241
    3342        $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
     43
     44        $required = '';
     45        if($this->required == true){
     46            $required = 'required';
     47        }
    3448
    3549        if ( ! empty( $args['list_only'] ) ) {
     
    5367                $input_type = 'radio';
    5468            }
     69            $input_class = 'rwmb-'.$input_type;
     70            $input_class = apply_filters( 'aac_category_input_class', $input_class, $category );
    5571
    5672            if($this->checklist_no_top == true){
     
    6379                        '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
    6480                        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.' /> ' .
    6682                        esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
    6783                }
     
    7187                    '<label class="selectit"><input value="' . $category->term_id . '" type="'.$input_type.'" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
    7288                    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.'/> ' .
    7490                    esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
    7591            }
  • adjust-admin-categories/trunk/readme.txt

    r2284534 r2468385  
    44Tags: admin, category
    55Requires at least: 3.0 or higher
    6 Tested up to: 5.4.0
    7 Stable tag: 2.2.3
     6Tested up to: 5.6.1
     7Stable tag: 2.2.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.