Plugin Directory

Changeset 2500594


Ignore:
Timestamp:
03/22/2021 02:53:28 AM (5 years ago)
Author:
ko31
Message:

Update to version 2.7.2 from GitHub

Location:
simple-slug-translate
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-slug-translate/tags/2.7.2/readme.txt

    r2500058 r2500594  
    55Requires at least: 4.3
    66Tested up to: 5.7
    7 Stable tag: 2.7.1
     7Stable tag: 2.7.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    110110== Changelog ==
    111111
     112= 2.7.2 =
     113* Add taxonomy settings
     114
    112115= 2.7.1 =
    113116* Fixed bug
  • simple-slug-translate/tags/2.7.2/simple-slug-translate.php

    r2500058 r2500594  
    44 * Plugin URI:      https://github.com/ko31/simple-slug-translate
    55 * Description:     Simple Slug Translate can translate the post, page, category and taxonomy slugs to English automatically.
    6  * Version:         2.7.1
     6 * Version:         2.7.2
    77 * Author:          Ko Takagi
    88 * Author URI:      https://go-sign.info
     
    173173        foreach ( $this->options['post_types'] as $enabled_post_type ) {
    174174            if ( $enabled_post_type == $post_type ) {
     175                return true;
     176            }
     177        }
     178
     179        return false;
     180    }
     181
     182    public function is_taxonomy( $taxonomy ) {
     183        if ( empty( $this->options['taxonomies'] ) ) {
     184            return false;
     185        }
     186
     187        foreach ( $this->options['taxonomies'] as $enabled_taxonomy ) {
     188            if ( $enabled_taxonomy == $taxonomy ) {
    175189                return true;
    176190            }
     
    195209
    196210    public function wp_insert_term_data( $data, $taxonomy, $args ) {
     211        if ( ! $this->is_taxonomy( $taxonomy ) ) {
     212            return $data;
     213        }
     214
    197215        if ( ! empty( $data ) && empty( $args['slug'] ) ) {
    198216            $slug         = $this->call_translate( $data['name'] );
     
    353371            __( 'Enabled post types', $this->text_domain ),
    354372            array( $this, 'post_types_callback' ),
     373            $this->plugin_slug,
     374            'permission_settings'
     375        );
     376
     377        add_settings_field(
     378            'taxonomies',
     379            __( 'Enabled taxonomies', $this->text_domain ),
     380            array( $this, 'taxonomies_callback' ),
    355381            $this->plugin_slug,
    356382            'permission_settings'
     
    458484                />
    459485                <?php echo $post_type->labels->name ?>
     486            </label>
     487        <?php
     488        endforeach;
     489    }
     490
     491    public function taxonomies_callback() {
     492        $taxonomies = get_taxonomies( array(
     493            'show_ui' => true
     494        ), 'objects' );
     495        foreach ( $taxonomies as $taxonomy ) :
     496            ?>
     497            <label>
     498                <input
     499                        type="checkbox"
     500                        name="<?php echo $this->option_name; ?>[taxonomies][]"
     501                        value="<?php echo $taxonomy->name; ?>"
     502                    <?php if ( $this->is_taxonomy( $taxonomy->name ) ) : ?>
     503                        checked="checked"
     504                    <?php endif; ?>
     505                />
     506                <?php echo $taxonomy->labels->name ?>
    460507            </label>
    461508        <?php
  • simple-slug-translate/trunk/readme.txt

    r2500058 r2500594  
    55Requires at least: 4.3
    66Tested up to: 5.7
    7 Stable tag: 2.7.1
     7Stable tag: 2.7.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    110110== Changelog ==
    111111
     112= 2.7.2 =
     113* Add taxonomy settings
     114
    112115= 2.7.1 =
    113116* Fixed bug
  • simple-slug-translate/trunk/simple-slug-translate.php

    r2500058 r2500594  
    44 * Plugin URI:      https://github.com/ko31/simple-slug-translate
    55 * Description:     Simple Slug Translate can translate the post, page, category and taxonomy slugs to English automatically.
    6  * Version:         2.7.1
     6 * Version:         2.7.2
    77 * Author:          Ko Takagi
    88 * Author URI:      https://go-sign.info
     
    173173        foreach ( $this->options['post_types'] as $enabled_post_type ) {
    174174            if ( $enabled_post_type == $post_type ) {
     175                return true;
     176            }
     177        }
     178
     179        return false;
     180    }
     181
     182    public function is_taxonomy( $taxonomy ) {
     183        if ( empty( $this->options['taxonomies'] ) ) {
     184            return false;
     185        }
     186
     187        foreach ( $this->options['taxonomies'] as $enabled_taxonomy ) {
     188            if ( $enabled_taxonomy == $taxonomy ) {
    175189                return true;
    176190            }
     
    195209
    196210    public function wp_insert_term_data( $data, $taxonomy, $args ) {
     211        if ( ! $this->is_taxonomy( $taxonomy ) ) {
     212            return $data;
     213        }
     214
    197215        if ( ! empty( $data ) && empty( $args['slug'] ) ) {
    198216            $slug         = $this->call_translate( $data['name'] );
     
    353371            __( 'Enabled post types', $this->text_domain ),
    354372            array( $this, 'post_types_callback' ),
     373            $this->plugin_slug,
     374            'permission_settings'
     375        );
     376
     377        add_settings_field(
     378            'taxonomies',
     379            __( 'Enabled taxonomies', $this->text_domain ),
     380            array( $this, 'taxonomies_callback' ),
    355381            $this->plugin_slug,
    356382            'permission_settings'
     
    458484                />
    459485                <?php echo $post_type->labels->name ?>
     486            </label>
     487        <?php
     488        endforeach;
     489    }
     490
     491    public function taxonomies_callback() {
     492        $taxonomies = get_taxonomies( array(
     493            'show_ui' => true
     494        ), 'objects' );
     495        foreach ( $taxonomies as $taxonomy ) :
     496            ?>
     497            <label>
     498                <input
     499                        type="checkbox"
     500                        name="<?php echo $this->option_name; ?>[taxonomies][]"
     501                        value="<?php echo $taxonomy->name; ?>"
     502                    <?php if ( $this->is_taxonomy( $taxonomy->name ) ) : ?>
     503                        checked="checked"
     504                    <?php endif; ?>
     505                />
     506                <?php echo $taxonomy->labels->name ?>
    460507            </label>
    461508        <?php
Note: See TracChangeset for help on using the changeset viewer.