<?php $path = explode('/', $vars['path']); array_shift($path); $list_type = get_input('list_type', 'list'); set_input('list_type', 'list'); // Check this when #4723 closed. if ($path[0] == '') { $path[0] = 'activity'; } ob_start(); elgg_set_viewtype('json'); page_handler(array_shift($path), implode('/', $path)); elgg_set_viewtype('default'); $out = ob_get_contents(); ob_end_clean(); $json = json_decode($out); switch (get_input('items_type')) { case 'entity': foreach ($json as $child) { foreach ($child as $grandchild) { $json = $grandchild; } } /* Removing duplicates This is unnecessary when #4504 is fixed. */ if (version_compare(get_version(true), '1.8.7', '<')) { $buggy = $json; $json = array(); $guids = array(); foreach ($buggy as $item) {
<?php /** * Elgg page handler * * @package Elgg * @subpackage Core * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd * @copyright Curverider Ltd 2008-2009 * @link http://elgg.org/ */ // Load Elgg engine // define('externalpage',true); require_once "../start.php"; // Get input $handler = get_input('handler'); $page = get_input('page'); // Call the page handler functions if (!page_handler($handler, $page)) { forward(); }
<?php elgg_load_library('elgg:wespot_arlearnservices'); $path = explode('/', $vars['path']); array_shift($path); $page_handler = array_shift($path); $page_params_str = implode('/', $path); ob_start(); elgg_set_viewtype('json'); page_handler($page_handler, $page_params_str); elgg_set_viewtype('default'); $out = ob_get_contents(); ob_end_clean(); $json = json_decode($out); foreach ($json as $child) { foreach ($child as $grandchild) { $json = $grandchild; } } /* Removing duplicates This is unnecessary when #4504 is fixed. */ if (version_compare(get_version(true), '1.8.7', '<')) { $buggy = $json; $json = array(); $guids = array(); foreach ($buggy as $item) { $guids[] = $item->guid; } $guids = array_unique($guids); foreach (array_keys($guids) as $i) { $json[$i] = $buggy[$i];