settings = Plugin::get_settings( 'media' ); if( !empty( $this->settings['media_library_infinite_scrolling'] ) ) { add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] ); } } /** * Enqueues the admin script for infinite scrolling on specific WordPress admin pages. * * @param string $hook The hook suffix for the current admin page. * * @return void */ public function admin_enqueue_scripts( string $hook ): void { if( !in_array( $hook, [ 'upload.php', 'media-new.php', 'post.php', 'post-new.php' ], true ) ) { return; } wp_enqueue_script( 'adminease-infinite-scroll', ADMINEASE_PLUGIN_URL . 'assets/js/adminease-infinite-scrolling.js?time='.time(), [ 'jquery' ], ADMINEASE_VERSION, true ); } }