$biolink_pages = require APP_PATH . 'includes/biolink_pages.php';
$_POST['page_type'] = !array_key_exists($_POST['page_type'], $biolink_pages) ? false : Database::clean_string($_POST['page_type']);
<select class="language_selector" onchange="switch_language(this.value)">
<?php
$languages = $this->crud_model->get_all_languages();
foreach ($languages as $language): ?>
<?php if (trim($language) != ""): ?>
<option value="<?php echo strtolower($language); ?>" <?php if ($this->session->userdata('language') == $language): ?>selected<?php endif; ?>><?php echo ucwords($language);?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<script type="text/javascript">
function switch_language(language) {
$.ajax({
url: '<?php echo site_url('home/site_language'); ?>',
type: 'post',
data: {language : language},
success: function(response) {
setTimeout(function(){ location.reload(); }, 500);
}
});
}
</script>
<div class="form-group">
<label for="language"><?php echo get_phrase('system_language'); ?></label>
<select class="form-control select2" data-toggle="select2" name="language" id="language">
<?php foreach ($languages as $language): ?>
<option value="<?php echo $language; ?>" <?php if(get_settings('language') == $language) echo 'selected'; ?>><?php echo ucfirst($language); ?></option>
<?php endforeach; ?>
</select>
</div>
public function site_url($uri = '', $protocol = NULL)
{
$base_url = $this->slash_item('base_url');
if (isset($protocol))
{
// For protocol-relative links
if ($protocol === '')
{
$base_url = substr($base_url, strpos($base_url, '//'));
}
else
{
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
}
}
if (empty($uri))
{
return $base_url.$this->item('index_page');
}
$uri = $this->_uri_string($uri);
if ($this->item('enable_query_strings') === FALSE)
{
$suffix = isset($this->config['url_suffix']) ? $this->config['url_suffix'] : '';
if ($suffix !== '')
{
if (($offset = strpos($uri, '?')) !== FALSE)
{
$uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset);
}
else
{
$uri .= $suffix;
}
}
return $base_url.$this->slash_item('index_page').$uri;
}
elseif (strpos($uri, '?') === FALSE)
{
$uri = '?'.$uri;
}
return $base_url.$this->item('index_page').$uri;
}