Plugin Directory

Changeset 3374394


Ignore:
Timestamp:
10/07/2025 12:34:32 PM (5 months ago)
Author:
AlanP57
Message:

Update 8.3.4

Location:
media-library-plus/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • media-library-plus/trunk/media-library-plus.php

    r3363957 r3374394  
    44Plugin URI: https://maxgalleria.com
    55Description: Gives you the ability to adds folders and move files in the WordPress Media Library.
    6 Version: 8.3.3
     6Version: 8.3.4
    77Author: Max Foundry
    88Author URI: https://maxfoundry.com
     
    7676    public function set_global_constants() {   
    7777        define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_KEY', 'maxgalleria_media_library_version');
    78         define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_NUM', '8.3.3');
     78        define('MAXGALLERIA_MEDIA_LIBRARY_VERSION_NUM', '8.3.4');
    7979        define('MAXGALLERIA_MEDIA_LIBRARY_IGNORE_NOTICE', 'maxgalleria_media_library_ignore_notice');
    8080        define('MAXGALLERIA_MEDIA_LIBRARY_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/'));
     
    30593059    global $wpdb, $maxgalleria;
    30603060   
    3061     if (!wp_verify_nonce($_POST['nonce'], MAXGALLERIA_MEDIA_LIBRARY_PRO_NONCE)) {
     3061    if (!wp_verify_nonce($_POST['nonce'], MAXGALLERIA_MEDIA_LIBRARY_NONCE)) {
    30623062      exit(__('missing nonce!', 'maxgalleria-media-library'));
    30633063    }
     
    31123112       
    31133113    die();
    3114   }     
    3115    
     3114  }
     3115 
     3116  public function add_image_to_mg_gallery($attachment_id, $gallery_id) {
     3117   
     3118    global $wpdb, $maxgalleria;
     3119
     3120    $result = $attachment_id;
     3121
     3122    // check for image already in the gallery
     3123    $sql = "SELECT ID FROM $wpdb->prefix" . "posts where post_parent = $gallery_id and post_type = 'attachment' and ID = $attachment_id";
     3124
     3125    $row = $wpdb->get_row($sql);
     3126
     3127    if($row === null) {
     3128
     3129      $menu_order = $maxgalleria->common->get_next_menu_order($gallery_id);     
     3130
     3131      $attachment = get_post( $attachment_id, ARRAY_A );
     3132
     3133      // assign a new value for menu_order
     3134      //$menu_order = $maxgalleria->common->get_next_menu_order($gallery_id);
     3135      $attachment[ 'menu_order' ] = $menu_order;
     3136
     3137      //If the attachment doesn't have a post parent, simply change it to the attachment we're working with and be done with it     
     3138      // assign a new value for menu_order
     3139      if( empty( $attachment[ 'post_parent' ] ) ) {
     3140        wp_update_post(
     3141          array(
     3142            'ID' => $attachment[ 'ID' ],
     3143            'post_parent' => $gallery_id,
     3144            'menu_order' => $menu_order
     3145          )
     3146        );
     3147        $result = $attachment[ 'ID' ];
     3148      } else {
     3149        //Else, unset the attachment ID, change the post parent and insert a new attachment
     3150        unset( $attachment[ 'ID' ] );
     3151        $attachment[ 'post_parent' ] = $gallery_id;
     3152        $new_attachment_id = wp_insert_post( $attachment );
     3153        //$new_attachment_id = $this->mpmlp_insert_post( $attachment );
     3154
     3155        //Now, duplicate all the custom fields. (There's probably a better way to do this)
     3156        $custom_fields = get_post_custom( $attachment_id );
     3157
     3158        foreach( $custom_fields as $key => $value ) {
     3159          //The attachment metadata wasn't duplicating correctly so we do that below instead
     3160          if( $key != '_wp_attachment_metadata' )
     3161            update_post_meta( $new_attachment_id, $key, $value[0] );
     3162        }
     3163
     3164        //Carry over the attachment metadata
     3165        $data = wp_get_attachment_metadata( $attachment_id );
     3166        wp_update_attachment_metadata( $new_attachment_id, $data );
     3167
     3168        $result = $new_attachment_id;
     3169
     3170      }
     3171    }
     3172         
     3173    return $result;
     3174         
     3175  }
     3176     
    31163177  public function search_media () {
    31173178   
     
    50555116  public function mflp_enable_auto_protect() {
    50565117   
    5057     if ( !wp_verify_nonce( $_POST['nonce'], MAXGALLERIA_MEDIA_LIBRARY_PRO_NONCE)) {
     5118    if ( !wp_verify_nonce( $_POST['nonce'], MAXGALLERIA_MEDIA_LIBRARY_NONCE)) {
    50585119      exit(__('missing nonce!','maxgalleria-media-library'));
    50595120    }
  • media-library-plus/trunk/mlp-reset.php

    r3363957 r3374394  
    66Author: Max Foundry
    77Author URI: https://maxfoundry.com
    8 Version: 8.3.3
     8Version: 8.3.4
    99Copyright 2015-2021 Max Foundry, LLC (https://maxfoundry.com)
    1010Text Domain: mlp-reset
  • media-library-plus/trunk/readme.txt

    r3363957 r3374394  
    33Tags: media library folders, media library folders, organize media library
    44Requires at least: 4.0
    5 Tested up to: 6.8.1
    6 Stable tag: 8.3.3
     5Tested up to: 6.8.3
     6Stable tag: 8.3.4
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    233233
    234234== Changelog ==
     235= 8.3.4 =
     236* Fixed issue with adding images to a MaxGallery gallery
     237
    235238= 8.3.3 =
    236239* Added code to fix image alt data causing issues in PHP 8.3
Note: See TracChangeset for help on using the changeset viewer.