public function test_wp_network_query_by_path_order_by_domain_desc()
 {
     $q = new WP_Network_Query();
     $found = $q->query(array('fields' => 'ids', 'path' => '/', 'network__not_in' => get_current_site()->id, 'order' => 'DESC', 'orderby' => 'domain'));
     $expected = array(self::$network_ids['www.wordpress.net/'], self::$network_ids['wordpress.org/'], self::$network_ids['make.wordpress.org/']);
     $this->assertEquals($expected, $found);
 }
Esempio n. 2
0
/**
 * Retrieves a list of networks.
 *
 * @since 4.6.0
 *
 * @param string|array $args Optional. Array or string of arguments. See {@see WP_Network_Query::parse_query()}
 *                           for information on accepted arguments. Default empty.
 * @return int|array List of networks or number of found networks if `$count` argument is true.
 */
function get_networks($args = array())
{
    $query = new WP_Network_Query();
    return $query->query($args);
}
Esempio n. 3
0
 /**
  * Get all networks
  *
  * @since 1.0.0
  * @deprecated since version 4.6.0 WordPress
  *
  * @return array Networks available on the installation
  */
 function get_networks($args = array())
 {
     // Support for WordPress 4.6.0, if you're doing something really weird
     if (class_exists('WP_Network_Query')) {
         $query = new WP_Network_Query();
         return $query->query($args);
     }
     // The original get_networks() function
     return $GLOBALS['wpdb']->get_results("SELECT * FROM {$GLOBALS['wpdb']->site}");
 }