Create more documentation (#7627)

* Documentation, format class, no modification.
This commit is contained in:
frytimo
2025-11-18 21:33:07 -04:00
committed by GitHub
parent e619c97ce6
commit adfc4cc469
104 changed files with 24461 additions and 21721 deletions

View File

@@ -73,6 +73,17 @@
$available_columns[] = 'destination_order';
//define the functions
/**
* Converts an associative or numerical array into a CSV string.
*
* This function takes an array and returns its contents as a properly formatted
* CSV string. If the input array is empty, it will return null.
*
* @param array $array The array to be converted into a CSV string.
* It can be either an associative or numerical array.
*
* @return string A CSV string representation of the input array, or null if the array is empty.
*/
function array2csv(array &$array) {
if (count($array) == 0) {
return null;
@@ -87,6 +98,17 @@
return ob_get_clean();
}
/**
* Sends HTTP headers for a file download.
*
* This function sends the necessary HTTP headers to force the browser to download
* a file instead of displaying it in the browser. The filename specified should be
* a path to the file on the server, not a URL.
*
* @param string $filename The name and path to the file that will be downloaded by the client.
*
* @return void This function does not return anything.
*/
function download_send_headers($filename) {
// disable caching
$now = gmdate("D, d M Y H:i:s");

View File

@@ -38,18 +38,6 @@
$language = new text;
$text = $language->get();
//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduct the functionality but requirs PHP 5.1.0 or higher
if(!function_exists('str_getcsv')) {
function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
$fp = fopen("php://memory", 'r+');
fputs($fp, $input);
rewind($fp);
$data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0
fclose($fp);
return $data;
}
}
//get the http get values and set them as php variables
$action = $_POST["action"] ?? null;
$from_row = $_POST["from_row"] ?? null;
@@ -132,6 +120,14 @@
}
//get the parent table
/**
* Retrieves the parent table of a given table in a database schema.
*
* @param array $schema Database schema containing table information
* @param string $table_name Name of the table for which to retrieve the parent
*
* @return mixed Parent table name, or null if no matching table is found
*/
function get_parent($schema,$table_name) {
foreach ($schema as $row) {
if ($row['table'] == $table_name) {

View File

@@ -79,6 +79,14 @@
$destination_array = $destination->all('dialplan');
//function to return the action names in the order defined
/**
* Returns a list of actions based on the provided destination array and actions.
*
* @param array $destination_array The array containing the data to process.
* @param array $destination_actions The array of actions to apply to the destination array.
*
* @return array A list of actions resulting from the processing of the destination array and actions.
*/
function action_name($destination_array, $destination_actions) {
global $settings;
$actions = [];
@@ -175,8 +183,8 @@
$page = $_GET['page'];
}
if (!isset($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
[$paging_controls, $rows_per_page] = paging($num_rows, $param, $rows_per_page);
[$paging_controls_mini, $rows_per_page] = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;
//get the list