<?php
/**
 * Name: Media Library Infinite Scroll
 * Description: Re-enable infinite scrolling in media library grid view to automatically load more images as you scroll instead of pagination buttons for browsing
 * Category: Media
 * Icon: -
 * UseCases: [
 *   {
 *     "title": "Large Media Libraries",
 *     "description": "Scroll through 2000+ images in media library without clicking pagination buttons every 20 items for faster browsing."
 *   },
 *   {
 *     "title": "Faster Image Selection",
 *     "description": "Find images quickly while editing posts by scrolling continuously instead of guessing which pagination page contains the image."
 *   },
 *   {
 *     "title": "Improved User Experience",
 *     "description": "Restore WordPress's original infinite scroll behavior for clients familiar with older WordPress versions."
 *   }
 * ]
 * Added: 2025-08-22
 * Tags: media, infinite-scroll, library, grid, ux
 * WhereToFind: {
 *   "location": "Media Library (Grid View)",
 *   "url": "upload.php?mode=grid",
 *   "instructions": "Scroll down in grid view - images load automatically",
 *   "newTab": false
 * }
 */

// Prevent direct access
if (!defined('ABSPATH')) exit;

class SwitchboardMediaInfiniteScroll {

    public function __construct() {
        add_filter('media_library_infinite_scrolling', '__return_true');
    }

    /**
     * Register data locations for cleanup system
     *
     * @return array Data storage locations
     */
    public function register_data_locations() {
        return [
            'options' => [],
            'option_patterns' => [],
            'tables' => [],
            'post_meta' => [],
            'user_meta' => [],
        ];
    }
}

// Initialize and register with data system
$switchboard_instance = new SwitchboardMediaInfiniteScroll();
Switchboard_Data_Registry::get_instance()->auto_register($switchboard_instance, __FILE__);
