/**
 * Get an array with commonly supported prefixes.
 *
 * @return array An array of prefixes and URIs
 */
function wl_prefixes()
{
    $items = wl_prefixes_list();
    $prefixes = array();
    foreach ($items as $item) {
        $prefixes[$item['prefix']] = $item['namespace'];
    }
    return $prefixes;
}
 function prepare_items()
 {
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $prefixes = wl_prefixes_list();
     usort($prefixes, array(&$this, 'usort_reorder'));
     $this->items = $prefixes;
 }
 /**
  * Test the Prefixes list table.
  */
 function test_prefixes_list_table()
 {
     $GLOBALS['hook_suffix'] = 'test';
     $prefixes_list_table = new WL_Prefixes_List_Table();
     // Test the columns.
     $columns = $prefixes_list_table->get_columns();
     $this->assertTrue(is_array($columns));
     $this->assertCount(2, $columns);
     // Check that the prepare items returns the same number of items in the prefixes.
     $items = wl_prefixes_list();
     $this->assertGreaterThan(0, sizeof($items));
     $prefixes_list_table->prepare_items();
     $this->assertCount(sizeof($items), $prefixes_list_table->items);
     // Check that we get a return value for each column.
     foreach ($prefixes_list_table->items as $item) {
         foreach ($columns as $key => $value) {
             $this->assertEquals($item[$key], $prefixes_list_table->column_default($item, $key));
         }
     }
 }
 function expand($expr)
 {
     foreach (wl_prefixes_list() as $item) {
         $prefix = $item['prefix'];
         $namespace = $item['namespace'];
         $expr = preg_replace("/(['\"]){$prefix}:/", "\${1}{$namespace}", $expr);
         $expr = preg_replace("/\\.{$prefix}:([^.]+)\\./", "['{$namespace}\${1}']", $expr);
     }
     return $expr;
 }
/**
 * Get the namespace for a prefix.
 *
 * @since 3.0.0
 *
 * @param string $prefix
 *
 * @return string|false The namespace or false if not found.
 */
function wl_prefixes_get($prefix)
{
    // Get the namespace.
    foreach (wl_prefixes_list() as $item) {
        if ($prefix === $item['prefix']) {
            return $item['namespace'];
        }
    }
    // Return false if the prefix is not found.
    return false;
}