| Server IP : 188.114.97.2 / Your IP : 104.23.197.230 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/nicolasj/www/sms.formationlangues.be/application/helpers/ |
Upload File : |
<?php
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
if (! function_exists('get_phrase')) {
function get_phrase($phrase)
{
$CI = &get_instance();
$CI->load->database();
$sessionLang = $CI->session->userdata('current_language');
if (empty($GLOBALS['translate_phrase'])) {
$GLOBALS['translate_phrase'] = $CI->db->get_where('language', array('phrase' => $phrase))->result();
}
if ($sessionLang != "") {
$current_language = $sessionLang;
} else {
$current_language = $CI->db->get_where('settings', array('type' => 'language'))->row()->description;
}
if (empty($current_language)) {
$current_language = 'french';
$CI->session->set_userdata('current_language', $current_language);
}
// query for finding the phrase from array
$row = null;
foreach ($GLOBALS['translate_phrase'] as $entry) {
if ($entry->phrase === $phrase) {
$row = $entry;
break;
}
}
// return the current sessioned language field of according phrase, else return uppercase spaced word
if (isset($row->$current_language) && $row->$current_language != "") {
return $row->$current_language;
} else {
return ucwords(str_replace('_', ' ', $phrase));
}
}
}