2022-06-27 13:49:16 +03:00
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Online Appointment Scheduler
|
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
|
|
|
* @since v1.1.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
if (!function_exists('lang')) {
|
2022-06-27 13:49:16 +03:00
|
|
|
/**
|
|
|
|
* Lang
|
|
|
|
*
|
|
|
|
* Fetches a language variable and optionally outputs a form label
|
|
|
|
*
|
|
|
|
* @param string $line The language line.
|
|
|
|
* @param string $for The "for" value (id of the form element).
|
|
|
|
* @param array $attributes Any additional HTML attributes.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function lang(string $line, string $for = '', array $attributes = []): string
|
|
|
|
{
|
|
|
|
/** @var EA_Controller $CI */
|
|
|
|
$CI = get_instance();
|
|
|
|
|
|
|
|
$result = $CI->lang->line($line);
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
if ($for !== '') {
|
2022-06-27 13:49:16 +03:00
|
|
|
$result = '<label for="' . $for . '"' . _stringify_attributes($attributes) . '>' . $result . '</label>';
|
|
|
|
}
|
|
|
|
|
2023-03-13 10:11:01 +03:00
|
|
|
return $result ?: $line;
|
2022-06-27 13:49:16 +03:00
|
|
|
}
|
|
|
|
}
|