????

Your IP : 3.135.183.221


Current Path : /home/ntwf1swzbm0x/public_html/wp-includes/
Upload File :
Current File : /home/ntwf1swzbm0x/public_html/wp-includes/class-wp-list-util.php

<?php
/**
 * WordPress List utility class
 *
 * @package WordPress
 * @since 4.7.0
 */

/**
 * List utility.
 *
 * Utility class to handle operations on an array of objects.
 *
 * @since 4.7.0
 */
class WP_List_Util {
	/**
	 * The input array.
	 *
	 * @since 4.7.0
	 * @var array
	 */
	private $input = array();

	/**
	 * The output array.
	 *
	 * @since 4.7.0
	 * @var array
	 */
	private $output = array();

	/**
	 * Temporary arguments for sorting.
	 *
	 * @since 4.7.0
	 * @var array
	 */
	private $orderby = array();

	/**
	 * Constructor.
	 *
	 * Sets the input array.
	 *
	 * @since 4.7.0
	 *
	 * @param array $input Array to perform operations on.
	 */
	public function __construct( $input ) {
		$this->output = $input;
		$this->input  = $input;
	}

	/**
	 * Returns the original input array.
	 *
	 * @since 4.7.0
	 *
	 * @return array The input array.
	 */
	public function get_input() {
		return $this->input;
	}

	/**
	 * Returns the output array.
	 *
	 * @since 4.7.0
	 *
	 * @return array The output array.
	 */
	public function get_output() {
		return $this->output;
	}

	/**
	 * Filters the list, based on a set of key => value arguments.
	 *
	 * @since 4.7.0
	 *
	 * @param array  $args     Optional. An array of key => value arguments to match
	 *                         against each object. Default empty array.
	 * @param string $operator Optional. The logical operation to perform. 'AND' means
	 *                         all elements from the array must match. 'OR' means only
	 *                         one element needs to match. 'NOT' means no elements may
	 *                         match. Default 'AND'.
	 * @return array Array of found values.
	 */
	public function filter( $args = array(), $operator = 'AND' ) {
		if ( empty( $args ) ) {
			return $this->output;
		}

		$operator = strtoupper( $operator );

		if ( ! in_array( $operator, array( 'AND', 'OR', 'NOT' ), true ) ) {
			return array();
		}

		$count    = count( $args );
		$filtered = array();

		foreach ( $this->output as $key => $obj ) {
			$matched = 0;

			foreach ( $args as $m_key => $m_value ) {
				if ( is_array( $obj ) ) {
					// Treat object as an array.
					if ( array_key_exists( $m_key, $obj ) && ( $m_value == $obj[ $m_key ] ) ) {
						$matched++;
					}
				} elseif ( is_object( $obj ) ) {
					// Treat object as an object.
					if ( isset( $obj->{$m_key} ) && ( $m_value == $obj->{$m_key} ) ) {
						$matched++;
					}
				}
			}

			if ( ( 'AND' === $operator && $matched === $count )
				|| ( 'OR' === $operator && $matched > 0 )
				|| ( 'NOT' === $operator && 0 === $matched )
			) {
				$filtered[ $key ] = $obj;
			}
		}

		$this->output = $filtered;

		return $this->output;
	}

	/**
	 * Plucks a certain field out of each object in the list.
	 *
	 * This has the same functionality and prototype of
	 * array_column() (PHP 5.5) but also supports objects.
	 *
	 * @since 4.7.0
	 *
	 * @param int|string $field     Field from the object to place instead of the entire object
	 * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
	 *                              Default null.
	 * @return array Array of found values. If `$index_key` is set, an array of found values with keys
	 *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
	 *               `$list` will be preserved in the results.
	 */
	public function pluck( $field, $index_key = null ) {
		$newlist = array();

		if ( ! $index_key ) {
			/*
			 * This is simple. Could at some point wrap array_column()
			 * if we knew we had an array of arrays.
			 */
			foreach ( $this->output as $key => $value ) {
				if ( is_object( $value ) ) {
					$newlist[ $key ] = $value->$field;
				} else {
					$newlist[ $key ] = $value[ $field ];
				}
			}

			$this->output = $newlist;

			return $this->output;
		}

		/*
		 * When index_key is not set for a particular item, push the value
		 * to the end of the stack. This is how array_column() behaves.
		 */
		foreach ( $this->output as $value ) {
			if ( is_object( $value ) ) {
				if ( isset( $value->$index_key ) ) {
					$newlist[ $value->$index_key ] = $value->$field;
				} else {
					$newlist[] = $value->$field;
				}
			} else {
				if ( isset( $value[ $index_key ] ) ) {
					$newlist[ $value[ $index_key ] ] = $value[ $field ];
				} else {
					$newlist[] = $value[ $field ];
				}
			}
		}

		$this->output = $newlist;

		return $this->output;
	}

	/**
	 * Sorts the list, based on one or more orderby arguments.
	 *
	 * @since 4.7.0
	 *
	 * @param string|array $orderby       Optional. Either the field name to order by or an array
	 *                                    of multiple orderby fields as $orderby => $order.
	 * @param string       $order         Optional. Either 'ASC' or 'DESC'. Only used if $orderby
	 *                                    is a string.
	 * @param bool         $preserve_keys Optional. Whether to preserve keys. Default false.
	 * @return array The sorted array.
	 */
	public function sort( $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
		if ( empty( $orderby ) ) {
			return $this->output;
		}

		if ( is_string( $orderby ) ) {
			$orderby = array( $orderby => $order );
		}

		foreach ( $orderby as $field => $direction ) {
			$orderby[ $field ] = 'DESC' === strtoupper( $direction ) ? 'DESC' : 'ASC';
		}

		$this->orderby = $orderby;

		if ( $preserve_keys ) {
			uasort( $this->output, array( $this, 'sort_callback' ) );
		} else {
			usort( $this->output, array( $this, 'sort_callback' ) );
		}

		$this->orderby = array();

		return $this->output;
	}

	/**
	 * Callback to sort the list by specific fields.
	 *
	 * @since 4.7.0
	 *
	 * @see WP_List_Util::sort()
	 *
	 * @param object|array $a One object to compare.
	 * @param object|array $b The other object to compare.
	 * @return int 0 if both objects equal. -1 if second object should come first, 1 otherwise.
	 */
	private function sort_callback( $a, $b ) {
		if ( empty( $this->orderby ) ) {
			return 0;
		}

		$a = (array) $a;
		$b = (array) $b;

		foreach ( $this->orderby as $field => $direction ) {
			if ( ! isset( $a[ $field ] ) || ! isset( $b[ $field ] ) ) {
				continue;
			}

			if ( $a[ $field ] == $b[ $field ] ) {
				continue;
			}

			$results = 'DESC' === $direction ? array( 1, -1 ) : array( -1, 1 );

			if ( is_numeric( $a[ $field ] ) && is_numeric( $b[ $field ] ) ) {
				return ( $a[ $field ] < $b[ $field ] ) ? $results[0] : $results[1];
			}

			return 0 > strcmp( $a[ $field ], $b[ $field ] ) ? $results[0] : $results[1];
		}

		return 0;
	}
}

dynamic-content-widget-a6b2991-1 – The Foundry
Apply Now!

Booth Rental

From $ 99 / month
  • 05 x 10 - $99 Per Month
  • 09 x 10 - $149 Per Month
  • 10 X 10 - $159 Per Month
  • 10 X 11 - $169 Per Month
  • 10 X 15 - $224 Per Month
  • 10 X 20 - $270 Per Month
  • 10 X 25 - $325 Per Month

Cases also available

Visit us at The Foundry and speak with a member of our team to discuss the options available to you. If a space is available you can move in straight away! If there is not a space available right away, you can opt to be placed on our vendor waiting list or look at an alternative option such as one of our bespoke display cases. 

No problem! We encourage prospective vendors to move in and start selling as soon as possible. Pro rated booth rent for the remaining period until the first of the following month will be due at contract signing.

Yes. We have a standard form contract which outlines the terms of your rental agreement.

We charge a commission of 10% on all sales.

No! Here at The Foundry we believe that you should discover the best selling environment for you. We have a six month initial term. Following this, we require just a thirty day written notice if you wish to change or terminate your rental agreement. 

Rent is paid in advance starting on the first day of every month. For example: The rent due for August is due on August first.

For the convenience of all our vendors, we automatically process your rent payment from your previous month sales. If you do not have sufficient sales to cover the rent due we will notify you that payment is required. We recommend that all vendors take advantage of our vendor sales tracking system, QuailHQ for $5.00 per month.  

We work in partnership with QuailHQ to provide online access to sales data 24 hours a day, 7 days a week. QuailHQ is available online and as an app for ios and android.

We recommend that all vendors take advantage of our vendor sales tracking system, QuailHQ for $5.00 per month.  

Yes! We operate Social Media accounts on various platforms. In addition to our renowned service, we also regularly feature select merchandise to our social media platforms to increase awareness and bolster vendor sales. Make sure to include interesting an unique merchandise in your booth to be in with a chance to be featured on our social media!

We are open daily from 10:00 AM to 6:00 PM for you to move in and start selling! From all of us at The Foundry, we loom forward to working with you and can’t wait for you to get started!