HEX
Server:
System: Linux aac286ea486c 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64
User: root (0)
PHP: 8.2.30
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,disk_free_space,diskfreespace
Upload Files
File: /dom877180/wp-content/plugins/gravityview/future/includes/class-gv-collection-entry-sort.php
<?php
namespace GV;

/** If this file is called directly, abort. */
if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
	die();
}

/**
 * Entry sorting.
 */
class Entry_Sort {

	/**
	 * @var string An enum of sorts, sort direction identifier - ascending.
	 */
	const ASC = 'ASC';

	/**
	 * @var string An enum of sorts, sort direction identifier - descending.
	 */
	const DESC = 'DESC';

	/**
	 * @var string An enum of sorts, sort direction identifier - random.
	 */
	const RAND = 'RAND';

	/**
	 * @var string Numeric sort mode.
	 */
	const NUMERIC = 'NUMERIC';

	/**
	 * @var string Alpabetic sort mode.
	 */
	const ALPHA = 'ALPHA';

	/**
	 * @var \GV\Field The field that this sort is for.
	 */
	public $field;

	/**
	 * @var string The direction (see self::ASC, self::DESC).
	 */
	public $direction;

	/**
	 * @var string The sort mode (see self::NUMERIC, self::ALPHA).
	 */
	public $mode;

	/**
	 * Instantiate a sort for a field.
	 *
	 * @param \GV\Field $field The field we're sorting by.
	 * @param string $direction The direction of this sort (\GV\Entry_Sort::ASC, \GV\Entry_Sort::DESC, etc.). Default: self::ASC.
	 * @param string $mode The sort mode (self::NUMERIC). Default: self::ALPHA.
	 *
	 * @api
	 * @since 2.0
	 *
	 * @return \GV\Entry_Sort An instance of this class, pass to \GV\Entry_Collection::sort()
	 */
	public function __construct( \GV\Field $field, $direction = self::ASC, $mode = self::ALPHA ) {
		$this->field = $field;
		$this->direction = $direction;
		$this->mode = $mode;
	}

	/**
	 * Return search_criteria-compatible array.
	 *
	 * @return array [`key`, `direction`, `is_numeric`]
	 */
	public function to_sorting() {
		if ( $this->field ) {
			return array(
				'key' => $this->field->ID,
				'direction' => $this->direction ? : self::ASC,
				'is_numeric' => self::ALPHA ? true : false,
			);
		}
		return array();
	}
}