toArray(); $sec = 'gusuarios'; if (is_metaconsole() === true) { $sec = 'advanced'; } $edit_url = 'index.php?sec='.$sec; $edit_url .= '&sec2=godmode/users/configure_token&pure=0'; $edit_url .= '&id_token='.$itemArray['idToken']; $delete_url = 'index.php?sec='.$sec; $delete_url .= '&sec2=godmode/users/token_list'; $delete_url .= '&pure=0&delete_token=1'; $delete_url .= '&id_token='.$itemArray['idToken']; $itemArray['label'] = html_print_anchor( [ 'href' => $edit_url, 'content' => $itemArray['label'], ], true ); if (empty($itemArray['validity']) === true) { $itemArray['validity'] = __('Never'); } else { $itemArray['validity'] = date($config['date_format'], strtotime($itemArray['validity'])); } if (empty($itemArray['lastUsage']) === true) { $itemArray['lastUsage'] = __('Never'); } else { $itemArray['lastUsage'] = human_time_comparation($itemArray['lastUsage']); } $itemArray['options'] = '
'; return $itemArray; }, $return['data'] ); } // Datatables format: RecordsTotal && recordsfiltered. echo json_encode( [ 'data' => $return['data'], 'recordsTotal' => $return['paginationData']['totalRegisters'], 'recordsFiltered' => $return['paginationData']['totalRegisters'], ] ); // Capture output. $response = ob_get_clean(); } catch (Exception $e) { echo json_encode(['error' => $e->getMessage()]); return; } // If not valid, show error with issue. json_decode($response); if (json_last_error() == JSON_ERROR_NONE) { // If valid dump. echo $response; } else { echo json_encode( ['error' => $response] ); } return; }