HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpmuhibbah_err/wp-content/plugins/meow-gallery/classes/orderby.php
<?php

class Meow_MGL_OrderBy {

	public $admin = null;

	static function run( $images, $orderby = null, $order = 'asc' ) {
		$sqlOrderBy = '';
		$order = strtolower( $order );

		// Check params
		switch ( $orderby ) {
			case 'ids':
				$order === 'asc' ? sort( $images ) : rsort( $images );
				break;
		
			case 'random':
				shuffle( $images );
				return $images;
				break;
		
			case 'date':
				$sqlOrderBy = $order === 'asc'
					? ' ORDER BY p.post_date ASC'
					: ' ORDER BY p.post_date DESC';
				break;
		
			case 'modified':
				$sqlOrderBy = $order === 'asc'
					? ' ORDER BY p.post_modified ASC'
					: ' ORDER BY p.post_modified DESC';
				break;

			case 'filename':
			case 'title':
				$sqlOrderBy = $order === 'asc'
					? ' ORDER BY p.post_title ASC'
					: ' ORDER BY p.post_title DESC';
				break;
		
			case 'menu':
				$sqlOrderBy = $order === 'asc'
					? ' ORDER BY p.menu_order ASC'
					: ' ORDER BY p.menu_order DESC';
				break;
		
			case 'none':
				return $images;
		
			default:
				// no ordering
				break;
		}

		// Apply sort
		if ( !empty( $sqlOrderBy ) ) {
			global $wpdb;
			$wpIdsPlaceHolders = array_fill( 0, count( $images ), '%d' );
			$wpIdsPlaceHolders = implode( ', ', $wpIdsPlaceHolders );
			$query = $wpdb->prepare( "SELECT p.ID
				FROM $wpdb->posts p
				WHERE p.ID IN ($wpIdsPlaceHolders)" . $sqlOrderBy, $images );
			$images = $wpdb->get_col( $query );
			
		}
		return $images;
	}

}

?>