Plugin Directory

Changeset 2747124


Ignore:
Timestamp:
06/23/2022 01:48:54 PM (4 years ago)
Author:
wpmedialibrary
Message:

Update to version 1.4.5 from GitHub

Location:
media-library-organizer
Files:
4 added
4 deleted
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • media-library-organizer/tags/1.4.5/_modules/dashboard/class-wpzincdashboardwidget.php

    r2722863 r2747124  
    374374        wp_register_script( 'wpzinc-admin-autosize', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'autosize' . ( $minified ? '-min' : '' ) . '.js', false, $this->plugin->version, true );
    375375        wp_register_script( 'wpzinc-admin-conditional', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'jquery.form-conditionals' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    376         wp_register_script( 'wpzinc-admin-clipboard', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'clipboard' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    377376        wp_register_script( 'wpzinc-admin-deactivation', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'deactivation' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    378377        wp_register_script( 'wpzinc-admin-inline-search', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'inline-search' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
  • media-library-organizer/tags/1.4.5/includes/global/class-media-library-organizer-common.php

    r2688245 r2747124  
    469469
    470470        // Get hierarchy of Terms.
    471         $hierarchy = _get_term_hierarchy( $taxonomy );
     471        // We don't use _get_term_hierarchy(), as this is a private WordPress function that returns child term IDs ordered by ID, not name.
     472        $hierarchy = $this->get_term_hierarchy( $taxonomy );
    472473
    473474        // Build final term array, comprising of top level terms and all children.
     
    489490        // Return filtered results.
    490491        return $hierarchical_terms;
     492
     493    }
     494
     495    /**
     496     * Modified version of _get_term_hierarchy(), which returns Term IDs ordered by Term Name.
     497     *
     498     * @since   1.4.5
     499     *
     500     * @param   string $taxonomy   Taxonomy.
     501     * @return  array               Child Terms
     502     */
     503    private function get_term_hierarchy( $taxonomy ) {
     504
     505        // Bail if the taxonomy is not hierarchical.
     506        if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
     507            return array();
     508        }
     509
     510        $children = array();
     511        $terms    = get_terms(
     512            array(
     513                'taxonomy'               => $taxonomy,
     514                'get'                    => 'all',
     515                'orderby'                => 'name',
     516                'fields'                 => 'id=>parent',
     517                'update_term_meta_cache' => false,
     518            )
     519        );
     520        foreach ( $terms as $term_id => $parent ) {
     521            if ( $parent > 0 ) {
     522                $children[ $parent ][] = $term_id;
     523            }
     524        }
     525
     526        return $children;
    491527
    492528    }
  • media-library-organizer/tags/1.4.5/includes/global/class-media-library-organizer-media.php

    r2722863 r2747124  
    132132            // Get orderby default from the User's Options, if set to persist.
    133133            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ) {
    134                 $current_orderby = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' );
     134                $current_orderby = $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() );
    135135            } else {
    136136                // Get from Plugin Defaults.
     
    146146            // Get orderby default from the User's Options, if set to persist.
    147147            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ) {
    148                 $current_order = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' );
     148                $current_order = $this->base->get_class( 'user_option' )->get_order( get_current_user_id() );
    149149            } else {
    150150                // Get from Plugin Defaults.
     
    307307                    'orderby' => (
    308308                        $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ?
    309                         $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' ) :
     309                        $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() ) :
    310310                        $this->base->get_class( 'common' )->get_orderby_default()
    311311                    ),
    312312                    'order'   => (
    313313                        $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ?
    314                         $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' ) :
     314                        $this->base->get_class( 'user_option' )->get_order( get_current_user_id() ) :
    315315                        $this->base->get_class( 'common' )->get_order_default()
    316316                    ),
     
    671671            // Get orderby default from the User's Options, if set to persist.
    672672            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ) {
    673                 $orderby = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' );
     673                $orderby = $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() );
    674674            } else {
    675675                // Get from Plugin Defaults.
    676                 $orderby = $this->base->get_class( 'common' )->get_order_default();
     676                $orderby = $this->base->get_class( 'common' )->get_orderby_default();
    677677            }
    678678
     
    691691            // Get orderby default from the User's Options, if set to persist.
    692692            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ) {
    693                 $order = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' );
     693                $order = $this->base->get_class( 'user_option' )->get_order( get_current_user_id() );
    694694            } else {
    695695                // Get from Plugin Defaults.
  • media-library-organizer/tags/1.4.5/includes/global/class-media-library-organizer-settings.php

    r2688245 r2747124  
    302302            // User Options.
    303303            'user-options' => array(
    304                 'orderby_enabled' => 1,
    305                 'order_enabled'   => 1,
     304                'orderby_enabled' => 0,
     305                'order_enabled'   => 0,
    306306            ),
    307307        );
  • media-library-organizer/tags/1.4.5/includes/global/class-media-library-organizer-user-option.php

    r2688245 r2747124  
    4747
    4848    /**
     49     * Returns a User's order by option.
     50     *
     51     * @since   1.4.5
     52     *
     53     * @param   int $user_id        User ID.
     54     * @return  string                 Value
     55     */
     56    public function get_orderby( $user_id ) {
     57
     58        // Get user option.
     59        $value = $this->get_option( $user_id, 'orderby' );
     60
     61        // If the value isn't a permitted order by option, return the default.
     62        if ( ! in_array( $value, array_keys( $this->base->get_class( 'common' )->get_orderby_options() ), true ) ) {
     63            return $this->get_default_option( 'orderby' );
     64        }
     65
     66        // Return user's order by option.
     67        return $value;
     68
     69    }
     70
     71    /**
     72     * Returns a User's order option.
     73     *
     74     * @since   1.4.5
     75     *
     76     * @param   int $user_id        User ID.
     77     * @return  string                 Value
     78     */
     79    public function get_order( $user_id ) {
     80
     81        // Get user option.
     82        $value = $this->get_option( $user_id, 'order' );
     83
     84        // If the value isn't a permitted order by option, return the default.
     85        if ( ! in_array( $value, array_keys( $this->base->get_class( 'common' )->get_order_options() ), true ) ) {
     86            return $this->get_default_option( 'order' );
     87        }
     88
     89        // Return user's order by option.
     90        return $value;
     91
     92    }
     93
     94    /**
    4995     * Returns a User option.
    5096     *
  • media-library-organizer/tags/1.4.5/languages/media-library-organizer.pot

    r2739899 r2747124  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Media Library Organizer 1.4.3\n"
     5"Project-Id-Version: Media Library Organizer 1.4.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/media-library-organizer\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-05-12T15:14:03+00:00\n"
     12"POT-Creation-Date: 2022-06-23T13:43:11+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
  • media-library-organizer/tags/1.4.5/media-library-organizer.php

    r2739899 r2747124  
    99 * Plugin Name: Media Library Organizer
    1010 * Plugin URI: https://wpmedialibrary.com
    11  * Version: 1.4.4
     11 * Version: 1.4.5
    1212 * Author: WP Media Library
    1313 * Author URI: https://wpmedialibrary.com
     
    2222
    2323// Define Plugin version and build date.
    24 define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_VERSION', '1.4.4' );
    25 define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_BUILD_DATE', '2022-06-09 18:00:00' );
     24define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_VERSION', '1.4.5' );
     25define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_BUILD_DATE', '2022-06-23 18:00:00' );
    2626
    2727// Define Plugin paths.
  • media-library-organizer/tags/1.4.5/readme.txt

    r2739899 r2747124  
    173173== Changelog ==
    174174
     175= 1.4.5 (2022-06-23) =
     176* Added: French translations
     177* Fix: Grid View: Category Dropdown Filter: Order child terms by name, not ID
     178* Fix: User Options: Fallback to order by default when User Options > Sort Order is enabled and either the user has no sort order preference defined, or a non-valid sort order was specified
     179
    175180= 1.4.4 (2022-06-09) =
    176181* Added: Support for WordPress 6.0
  • media-library-organizer/trunk/_modules/dashboard/class-wpzincdashboardwidget.php

    r2722863 r2747124  
    374374        wp_register_script( 'wpzinc-admin-autosize', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'autosize' . ( $minified ? '-min' : '' ) . '.js', false, $this->plugin->version, true );
    375375        wp_register_script( 'wpzinc-admin-conditional', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'jquery.form-conditionals' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    376         wp_register_script( 'wpzinc-admin-clipboard', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'clipboard' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    377376        wp_register_script( 'wpzinc-admin-deactivation', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'deactivation' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
    378377        wp_register_script( 'wpzinc-admin-inline-search', $this->dashboard_url . 'js/' . ( $minified ? 'min/' : '' ) . 'inline-search' . ( $minified ? '-min' : '' ) . '.js', array( 'jquery' ), $this->plugin->version, true );
  • media-library-organizer/trunk/includes/global/class-media-library-organizer-common.php

    r2688245 r2747124  
    469469
    470470        // Get hierarchy of Terms.
    471         $hierarchy = _get_term_hierarchy( $taxonomy );
     471        // We don't use _get_term_hierarchy(), as this is a private WordPress function that returns child term IDs ordered by ID, not name.
     472        $hierarchy = $this->get_term_hierarchy( $taxonomy );
    472473
    473474        // Build final term array, comprising of top level terms and all children.
     
    489490        // Return filtered results.
    490491        return $hierarchical_terms;
     492
     493    }
     494
     495    /**
     496     * Modified version of _get_term_hierarchy(), which returns Term IDs ordered by Term Name.
     497     *
     498     * @since   1.4.5
     499     *
     500     * @param   string $taxonomy   Taxonomy.
     501     * @return  array               Child Terms
     502     */
     503    private function get_term_hierarchy( $taxonomy ) {
     504
     505        // Bail if the taxonomy is not hierarchical.
     506        if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
     507            return array();
     508        }
     509
     510        $children = array();
     511        $terms    = get_terms(
     512            array(
     513                'taxonomy'               => $taxonomy,
     514                'get'                    => 'all',
     515                'orderby'                => 'name',
     516                'fields'                 => 'id=>parent',
     517                'update_term_meta_cache' => false,
     518            )
     519        );
     520        foreach ( $terms as $term_id => $parent ) {
     521            if ( $parent > 0 ) {
     522                $children[ $parent ][] = $term_id;
     523            }
     524        }
     525
     526        return $children;
    491527
    492528    }
  • media-library-organizer/trunk/includes/global/class-media-library-organizer-media.php

    r2722863 r2747124  
    132132            // Get orderby default from the User's Options, if set to persist.
    133133            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ) {
    134                 $current_orderby = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' );
     134                $current_orderby = $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() );
    135135            } else {
    136136                // Get from Plugin Defaults.
     
    146146            // Get orderby default from the User's Options, if set to persist.
    147147            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ) {
    148                 $current_order = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' );
     148                $current_order = $this->base->get_class( 'user_option' )->get_order( get_current_user_id() );
    149149            } else {
    150150                // Get from Plugin Defaults.
     
    307307                    'orderby' => (
    308308                        $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ?
    309                         $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' ) :
     309                        $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() ) :
    310310                        $this->base->get_class( 'common' )->get_orderby_default()
    311311                    ),
    312312                    'order'   => (
    313313                        $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ?
    314                         $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' ) :
     314                        $this->base->get_class( 'user_option' )->get_order( get_current_user_id() ) :
    315315                        $this->base->get_class( 'common' )->get_order_default()
    316316                    ),
     
    671671            // Get orderby default from the User's Options, if set to persist.
    672672            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'orderby_enabled' ) ) {
    673                 $orderby = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'orderby' );
     673                $orderby = $this->base->get_class( 'user_option' )->get_orderby( get_current_user_id() );
    674674            } else {
    675675                // Get from Plugin Defaults.
    676                 $orderby = $this->base->get_class( 'common' )->get_order_default();
     676                $orderby = $this->base->get_class( 'common' )->get_orderby_default();
    677677            }
    678678
     
    691691            // Get orderby default from the User's Options, if set to persist.
    692692            if ( $this->base->get_class( 'settings' )->get_setting( 'user-options', 'order_enabled' ) ) {
    693                 $order = $this->base->get_class( 'user_option' )->get_option( get_current_user_id(), 'order' );
     693                $order = $this->base->get_class( 'user_option' )->get_order( get_current_user_id() );
    694694            } else {
    695695                // Get from Plugin Defaults.
  • media-library-organizer/trunk/includes/global/class-media-library-organizer-settings.php

    r2688245 r2747124  
    302302            // User Options.
    303303            'user-options' => array(
    304                 'orderby_enabled' => 1,
    305                 'order_enabled'   => 1,
     304                'orderby_enabled' => 0,
     305                'order_enabled'   => 0,
    306306            ),
    307307        );
  • media-library-organizer/trunk/includes/global/class-media-library-organizer-user-option.php

    r2688245 r2747124  
    4747
    4848    /**
     49     * Returns a User's order by option.
     50     *
     51     * @since   1.4.5
     52     *
     53     * @param   int $user_id        User ID.
     54     * @return  string                 Value
     55     */
     56    public function get_orderby( $user_id ) {
     57
     58        // Get user option.
     59        $value = $this->get_option( $user_id, 'orderby' );
     60
     61        // If the value isn't a permitted order by option, return the default.
     62        if ( ! in_array( $value, array_keys( $this->base->get_class( 'common' )->get_orderby_options() ), true ) ) {
     63            return $this->get_default_option( 'orderby' );
     64        }
     65
     66        // Return user's order by option.
     67        return $value;
     68
     69    }
     70
     71    /**
     72     * Returns a User's order option.
     73     *
     74     * @since   1.4.5
     75     *
     76     * @param   int $user_id        User ID.
     77     * @return  string                 Value
     78     */
     79    public function get_order( $user_id ) {
     80
     81        // Get user option.
     82        $value = $this->get_option( $user_id, 'order' );
     83
     84        // If the value isn't a permitted order by option, return the default.
     85        if ( ! in_array( $value, array_keys( $this->base->get_class( 'common' )->get_order_options() ), true ) ) {
     86            return $this->get_default_option( 'order' );
     87        }
     88
     89        // Return user's order by option.
     90        return $value;
     91
     92    }
     93
     94    /**
    4995     * Returns a User option.
    5096     *
  • media-library-organizer/trunk/languages/media-library-organizer.pot

    r2739899 r2747124  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Media Library Organizer 1.4.3\n"
     5"Project-Id-Version: Media Library Organizer 1.4.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/media-library-organizer\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-05-12T15:14:03+00:00\n"
     12"POT-Creation-Date: 2022-06-23T13:43:11+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
  • media-library-organizer/trunk/media-library-organizer.php

    r2739899 r2747124  
    99 * Plugin Name: Media Library Organizer
    1010 * Plugin URI: https://wpmedialibrary.com
    11  * Version: 1.4.4
     11 * Version: 1.4.5
    1212 * Author: WP Media Library
    1313 * Author URI: https://wpmedialibrary.com
     
    2222
    2323// Define Plugin version and build date.
    24 define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_VERSION', '1.4.4' );
    25 define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_BUILD_DATE', '2022-06-09 18:00:00' );
     24define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_VERSION', '1.4.5' );
     25define( 'MEDIA_LIBRARY_ORGANIZER_PLUGIN_BUILD_DATE', '2022-06-23 18:00:00' );
    2626
    2727// Define Plugin paths.
  • media-library-organizer/trunk/readme.txt

    r2739899 r2747124  
    173173== Changelog ==
    174174
     175= 1.4.5 (2022-06-23) =
     176* Added: French translations
     177* Fix: Grid View: Category Dropdown Filter: Order child terms by name, not ID
     178* Fix: User Options: Fallback to order by default when User Options > Sort Order is enabled and either the user has no sort order preference defined, or a non-valid sort order was specified
     179
    175180= 1.4.4 (2022-06-09) =
    176181* Added: Support for WordPress 6.0
Note: See TracChangeset for help on using the changeset viewer.