Changeset 3451261
- Timestamp:
- 02/01/2026 07:33:48 AM (2 months ago)
- Location:
- central-media-library-for-network-websites
- Files:
-
- 8 added
- 3 edited
-
tags/1.1.8 (added)
-
tags/1.1.8/central-media-library-for-network-sites.php (added)
-
tags/1.1.8/inc (added)
-
tags/1.1.8/inc/cmlfnw-ajax-actions.php (added)
-
tags/1.1.8/inc/cmlfnw-async-upload.php (added)
-
tags/1.1.8/inc/cmlfnw-class-rest-posts-controller.php (added)
-
tags/1.1.8/inc/cmlfnw-namespace.php (added)
-
tags/1.1.8/readme.txt (added)
-
trunk/central-media-library-for-network-sites.php (modified) (1 diff)
-
trunk/inc/cmlfnw-namespace.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
central-media-library-for-network-websites/trunk/central-media-library-for-network-sites.php
r3451092 r3451261 3 3 * Plugin Name: Central Media Manager for Multisite 4 4 * Description: Enables a central media library across all websites in a WordPress multisite network. 5 * Version: 1.1. 75 * Version: 1.1.8 6 6 * Author: Kirtikumar Solanki 7 7 * Author URI: https://profiles.wordpress.org/solankisoftware/ -
central-media-library-for-network-websites/trunk/inc/cmlfnw-namespace.php
r3451092 r3451261 1272 1272 1273 1273 /** 1274 * Determine whether an Elementor data array represents a media control. 1275 * 1276 * Elementor element arrays commonly include an "id" field for element IDs. 1277 * We only want to validate IDs that belong to media controls (image/gallery/etc.). 1278 * 1279 * @param array $data Elementor data array. 1280 * @return bool True when the array looks like a media control. 1281 */ 1282 function cmlfnw_is_elementor_media_id_context( $data ) { 1283 if ( ! is_array( $data ) ) { 1284 return false; 1285 } 1286 1287 // Element definitions use these keys and should never be treated as media controls. 1288 if ( isset( $data['elType'] ) || isset( $data['elements'] ) || isset( $data['widgetType'] ) ) { 1289 return false; 1290 } 1291 1292 if ( ! isset( $data['id'] ) || ! is_numeric( $data['id'] ) ) { 1293 return false; 1294 } 1295 1296 // Media controls typically include a URL to the uploads folder or source=library. 1297 if ( isset( $data['source'] ) && 'library' === $data['source'] ) { 1298 return true; 1299 } 1300 1301 if ( isset( $data['url'] ) && is_string( $data['url'] ) ) { 1302 return ( strpos( $data['url'], 'wp-content/uploads' ) !== false ); 1303 } 1304 1305 // Some media controls include size/alt metadata. 1306 if ( isset( $data['size'] ) || isset( $data['sizes'] ) || isset( $data['alt'] ) ) { 1307 return true; 1308 } 1309 1310 return false; 1311 } 1312 1313 /** 1274 1314 * Recursively validate attachment IDs in Elementor data structure. 1275 1315 * … … 1284 1324 foreach ( $data as $key => $value ) { 1285 1325 // Check for common attachment ID fields in Elementor. 1286 if ( in_array( $key, array( 'i d', 'image_id', 'thumbnail_id', 'background_image', 'attachment_id' ), true ) && is_numeric( $value ) ) {1326 if ( in_array( $key, array( 'image_id', 'thumbnail_id', 'background_image', 'attachment_id' ), true ) && is_numeric( $value ) ) { 1287 1327 $attachment_id = (int) $value; 1288 1328 // If attachment doesn't exist in central library, remove the reference. 1289 1329 if ( $attachment_id > 0 && ! cmlfnw_verify_attachment_exists( $attachment_id ) ) { 1290 1330 $data[ $key ] = ''; // Clear invalid attachment ID. 1331 } 1332 } elseif ( 'id' === $key && is_numeric( $value ) && cmlfnw_is_elementor_media_id_context( $data ) ) { 1333 $attachment_id = (int) $value; 1334 if ( $attachment_id > 0 && ! cmlfnw_verify_attachment_exists( $attachment_id ) ) { 1335 $data[ $key ] = ''; 1291 1336 } 1292 1337 } elseif ( 'url' === $key && is_string( $value ) && strpos( $value, 'wp-content/uploads' ) !== false ) { -
central-media-library-for-network-websites/trunk/readme.txt
r3451092 r3451261 5 5 Requires at least: 4.7 6 6 Tested up to: 6.9 7 Stable tag: 1.1. 77 Stable tag: 1.1.8 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 63 63 64 64 == Changelog == 65 = 1.1.8 = 66 * Fixed Elementer containers automatic deleted issue 67 65 68 = 1.1.7 = 66 69 * Fixed featured image issue in classic editor
Note: See TracChangeset
for help on using the changeset viewer.