You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
4.3 KiB
167 lines
4.3 KiB
<?php
|
|
function styles_bundle(){
|
|
return base_url().'resources/styles/';
|
|
}
|
|
|
|
function scripts_bundle(){
|
|
return base_url().'resources/scripts/';
|
|
}
|
|
|
|
function plugins_bundle(){
|
|
return base_url().'resources/plugins/';
|
|
}
|
|
|
|
function images_bundle(){
|
|
return base_url().'resources/images/';
|
|
}
|
|
|
|
function app_bundle(){
|
|
return base_url().'resources/app/';
|
|
}
|
|
|
|
function escape($string)
|
|
{
|
|
return htmlspecialchars($string, ENT_QUOTES);
|
|
}
|
|
|
|
function makedir($dirpath, $mode=0777)
|
|
{
|
|
return is_dir($dirpath) || mkdir($dirpath, $mode, true);
|
|
}
|
|
|
|
function unlink_file($full_path)
|
|
{
|
|
unlink($full_path);
|
|
}
|
|
function fo_bundle()
|
|
{
|
|
return base_url().'resources/images/frontoffice/';
|
|
}
|
|
function hstroke_bundle()
|
|
{
|
|
return base_url().'resources/images/frontoffice/heart_stroke/';
|
|
}
|
|
function banner_bundle()
|
|
{
|
|
return base_url().'resources/images/frontoffice/banner/';
|
|
}
|
|
function noshow_bundle()
|
|
{
|
|
return base_url().'resources/images/frontoffice/noshow_imports/';
|
|
}
|
|
function origin_folders($folder_name)
|
|
{
|
|
|
|
switch ( $folder_name ) {
|
|
case 'hstroke':
|
|
return './resources/images/frontoffice/heart_stroke/';
|
|
break;
|
|
|
|
case 'banner':
|
|
return './resources/images/frontoffice/banner/';
|
|
break;
|
|
|
|
case 'events' :
|
|
return './resources/images/frontoffice/events/';
|
|
break;
|
|
case 'sponsors' :
|
|
return './resources/images/frontoffice/sponsors/';
|
|
break;
|
|
default :
|
|
return './resources/images/frontoffice/';
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
function remove_brackets($remove,$variables){
|
|
return str_replace($remove, '', $variables);
|
|
}
|
|
function _empty_prefix($x){
|
|
if(!empty(trim($x))){
|
|
$splitt = explode("]", $x);
|
|
$prefix = explode("[", $splitt[0]);
|
|
return ( strlen(trim($prefix[1])) < 2 ? true : false);
|
|
}
|
|
}
|
|
|
|
function countVal($val){
|
|
if(is_object($val)){
|
|
return count((array) $val);
|
|
} else if(is_array($val)){
|
|
return count($val);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Check 'ANY' variable if properly set or not then return boolean TRUE or FALSE
|
|
*
|
|
* @param [any] $variableKey = Any variable ID, string, table field, database name
|
|
*
|
|
* @return void
|
|
* public function
|
|
*/
|
|
function notSet($variableKey = null)
|
|
{
|
|
return (!isset($variableKey) || empty($variableKey) || is_null($variableKey));
|
|
}
|
|
|
|
/*
|
|
* get ordinal equivalent for the number
|
|
*/
|
|
function getOrdinal($number){
|
|
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
|
|
if (($number %100) >= 11 && ($number%100) <= 13){
|
|
$ordinal = $number. 'th';
|
|
} else {
|
|
$ordinal = $number. $ends[$number % 10];
|
|
}
|
|
return $ordinal;
|
|
}
|
|
|
|
function add_csrf_token($data){
|
|
$CI =& get_instance();
|
|
return array_merge($data, array('csrf' => array(
|
|
'name' => $CI->security->get_csrf_token_name(),
|
|
'hash' => $CI->security->get_csrf_hash())
|
|
)
|
|
);
|
|
}
|
|
|
|
function hash_password($password_string) {
|
|
$options = array(
|
|
'cost' => 12,
|
|
);
|
|
|
|
return password_hash($password_string, PASSWORD_BCRYPT, $options);
|
|
}
|
|
|
|
/**
|
|
* Given a file, i.e. /css/base.css, replaces it with a string containing the
|
|
* file's mtime, i.e. /css/base.1221534296.css.
|
|
*
|
|
* @param string $file The file to be loaded. Must be an absolute path (i.e.
|
|
* starts with slash).
|
|
* @return string
|
|
*/
|
|
function auto_version($file) {
|
|
$file = str_replace('http://', '', $file);
|
|
$file = str_replace('https://', '', $file);
|
|
$file = str_replace($_SERVER['SERVER_NAME'], '', $file);
|
|
$full_file = $_SERVER['DOCUMENT_ROOT'] . $file;
|
|
|
|
if (strpos($file, '/') !== 0 || !file_exists($full_file)) {
|
|
$full_file = substr($_SERVER['SCRIPT_FILENAME'], 0, -strlen($_SERVER['SCRIPT_NAME']));
|
|
$full_file .= $file;
|
|
|
|
if (!file_exists($full_file)) {
|
|
return $file."?v=".strtotime('now');
|
|
}
|
|
}
|
|
|
|
$mtime = filemtime($full_file);
|
|
$new_file = $file."?v=".$mtime;
|
|
return $new_file;
|
|
}
|
|
?>
|
|
|