if ($tax != 'type') {
            foreach (array('asc', 'desc') as $sort) {
                $sortItem = new stdClass();
                $sortItem->name = $tax;
                $sortItem->sort = $sort;
                $sortItem->order = isset($algolia_registry->sortable[$tax . '_' . $sort]) ? $order = $algolia_registry->sortable[$tax . '_' . $sort]['order'] : 10000 + $i;
                $sortItem->checked = isset($algolia_registry->sortable[$tax . '_' . $sort]);
                $sortItem->label = isset($algolia_registry->sortable[$tax . '_' . $sort]) ? $algolia_registry->sortable[$tax . '_' . $sort]["label"] : "";
                $sortable[] = $sortItem;
                $i++;
            }
        }
    }
}
foreach (get_post_types() as $type) {
    $metas = get_meta_key_list($type);
    if (isset($external_attrs[$type . '_attrs'])) {
        $metas = array_merge($metas, $external_attrs[$type . '_attrs']);
    }
    foreach ($metas as $meta_key) {
        if (is_array($algolia_registry->indexable_types) && in_array($type, array_keys($algolia_registry->indexable_types))) {
            if (isset($algolia_registry->metas[$type]) && in_array($meta_key, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta_key]["indexable"]) {
                foreach (array('asc', 'desc') as $sort) {
                    $sortItem = new stdClass();
                    $sortItem->name = $meta_key;
                    $sortItem->sort = $sort;
                    $sortItem->order = isset($algolia_registry->sortable[$meta_key . '_' . $sort]) ? $order = $algolia_registry->sortable[$meta_key . '_' . $sort]['order'] : 10000 + $i;
                    $sortItem->checked = isset($algolia_registry->sortable[$meta_key . '_' . $sort]);
                    $sortItem->label = isset($algolia_registry->sortable[$meta_key . '_' . $sort]) ? $algolia_registry->sortable[$meta_key . '_' . $sort]["label"] : "";
                    $sortable[] = $sortItem;
                    $i++;
                $sortItem->name = $tax;
                $sortItem->sort = $sort;
                $sortItem->order = isset($algolia_registry->sortable[$tax . '_' . $sort]) ? $order = $algolia_registry->sortable[$tax . '_' . $sort]['order'] : 10000 + $i;
                $sortItem->checked = isset($algolia_registry->sortable[$tax . '_' . $sort]);
                $sortItem->label = isset($algolia_registry->sortable[$tax . '_' . $sort]) ? $algolia_registry->sortable[$tax . '_' . $sort]["label"] : "";
                $sortable[] = $sortItem;
                $i++;
            }
        }
    }
}
foreach (get_post_types() as $type) {
    $type_count = floor(get_meta_key_list_count($type) / $batch_count);
    $metas = array();
    for ($offset = 0; $offset <= $type_count; $offset++) {
        $metas = array_merge($metas, get_meta_key_list($type, $offset * $batch_count, $batch_count));
    }
    foreach ($metas as $meta_key) {
        if (is_array($algolia_registry->indexable_types) && in_array($type, array_keys($algolia_registry->indexable_types))) {
            if (isset($algolia_registry->metas[$type]) && in_array($meta_key, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta_key]["indexable"]) {
                foreach (array('asc', 'desc') as $sort) {
                    $sortItem = new stdClass();
                    $sortItem->name = $meta_key;
                    $sortItem->sort = $sort;
                    $sortItem->order = isset($algolia_registry->sortable[$meta_key . '_' . $sort]) ? $order = $algolia_registry->sortable[$meta_key . '_' . $sort]['order'] : 10000 + $i;
                    $sortItem->checked = isset($algolia_registry->sortable[$meta_key . '_' . $sort]);
                    $sortItem->label = isset($algolia_registry->sortable[$meta_key . '_' . $sort]) ? $algolia_registry->sortable[$meta_key . '_' . $sort]["label"] : "";
                    $sortable[] = $sortItem;
                    $i++;
                }
            }
Ejemplo n.º 3
0
<?php

$extra_metas = array();
$facet_types = array_merge(array("conjunctive" => "Conjunctive", "disjunctive" => "Disjunctive"), $current_theme->facet_types);
$i = 0;
foreach (get_post_types() as $type) {
    if (is_array($algolia_registry->indexable_types) && in_array($type, array_keys($algolia_registry->indexable_types))) {
        $metas = get_meta_key_list($type);
        if (isset($external_attrs[$type . '_attrs'])) {
            $metas = array_merge(get_meta_key_list($type), $external_attrs[$type . '_attrs']);
        }
        foreach ($metas as $meta) {
            $metaItem = new stdClass();
            $metaItem->name = $meta;
            $metaItem->type = $type;
            $metaItem->order = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) ? $order = $algolia_registry->metas[$type][$meta]['order'] : 10000 + $i;
            $metaItem->enabled = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta]["indexable"];
            $metaItem->facetable = isset($algolia_registry->metas[$type]) && isset($algolia_registry->metas[$type][$meta]) && $algolia_registry->metas[$type][$meta]["facetable"];
            $metaItem->facet_type = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) ? $algolia_registry->metas[$type][$meta]["type"] : 'conjunctive';
            $metaItem->label = isset($algolia_registry->metas[$type][$meta]) ? $algolia_registry->metas[$type][$meta]["name"] : "";
            $metaItem->custom_ranking = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta]['custom_ranking'];
            $metaItem->custom_ranking_order = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta]['custom_ranking_order'];
            $metaItem->custom_ranking_sort = isset($algolia_registry->metas[$type]) && in_array($meta, array_keys($algolia_registry->metas[$type])) && $algolia_registry->metas[$type][$meta]['custom_ranking_sort'];
            $extra_metas[] = $metaItem;
            $i++;
        }
    }
}
$taxonomies = array();
$i = 0;
foreach (array_merge($algolia_registry->extras, get_taxonomies()) as $tax) {