mirror of
https://github.com/pierre42100/comunic
synced 2025-07-01 14:23:32 +00:00
First commit
This commit is contained in:
112
inc/helpers/assetsHelpers.php
Normal file
112
inc/helpers/assetsHelpers.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Assets Helpers
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the path to an asset
|
||||
*
|
||||
* @param String $file The file researched in the assets
|
||||
*/
|
||||
function path_assets($file = ""){
|
||||
//Path to an asset
|
||||
return siteURL()."assets/".$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the relative path to an asset
|
||||
*
|
||||
* @param String $file The file researched in the assets
|
||||
*/
|
||||
function relativePath_assets($file = ""){
|
||||
//Path to an asset
|
||||
return websiteRelativePath()."assets/".$file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the path to an CSS asset
|
||||
*
|
||||
* @param String $CSSfile The CSS file
|
||||
*/
|
||||
function path_css_asset($CSSfile = ""){
|
||||
return path_assets('css/'.$CSSfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to an JS asset
|
||||
*
|
||||
* @param String $CSSfile The JS file
|
||||
*/
|
||||
function path_js_asset($JSfile = ""){
|
||||
return path_assets('js/'.$JSfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to an Image asset
|
||||
*
|
||||
* @param String $IMGfile The IMG file
|
||||
*/
|
||||
function path_img_asset($IMGfile = ""){
|
||||
return path_assets('img/'.$IMGfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to an audio asset
|
||||
*
|
||||
* @param String $AUDIOfile The audio file
|
||||
*/
|
||||
function path_audio_asset($AUDIOfile = ""){
|
||||
return path_assets('audio/'.$AUDIOfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code to call a css file
|
||||
*
|
||||
* @param String $file The css file to call
|
||||
*/
|
||||
function code_inc_css($file){
|
||||
return '<link rel="stylesheet" href="'.$file.'" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code to call a javascript file
|
||||
*
|
||||
* @param String $file The javascript file to call
|
||||
*/
|
||||
function code_inc_js($file){
|
||||
return '<script type="text/javascript" src="'.$file.'"></script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code to include an image
|
||||
*
|
||||
* @param String $file The image file to call
|
||||
* @param String $name Optionnal - The name of the image
|
||||
* @param String $width Optionnal - The width of the image
|
||||
* @param String $height Optionnal - The height of the image
|
||||
* @param String $style Optionnal - The style attached to the image
|
||||
* @param String $onClick Optionnal - What to do once image is clicked
|
||||
* @param String $class Optionnal - The class of the image
|
||||
*/
|
||||
function code_inc_img($file, $name = "", $width = "", $height = "", $style = "", $onClick="", $class = ""){
|
||||
if($width != "")
|
||||
$width = " width='".$width."' ";
|
||||
|
||||
if($height != "")
|
||||
$height = " height='".$height."' ";
|
||||
|
||||
if($style != "")
|
||||
$style = " style='".$style."' ";
|
||||
|
||||
if($onClick != "")
|
||||
$onClick = ' onClick="'.$onClick.'" ';
|
||||
|
||||
if($class != "")
|
||||
$class = ' onClick="'.$class.'" ';
|
||||
|
||||
//Returning result
|
||||
return '<img src="'.$file.'" name="'.$name.'" alt="'.$name.'" '.$width.$height.$style.$onClick.$class.' />';
|
||||
}
|
15
inc/helpers/callHelpers.php
Normal file
15
inc/helpers/callHelpers.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Calling Helpers
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
//Config helper
|
||||
include('configHelpers.php');
|
||||
|
||||
//Assets Help
|
||||
include('assetsHelpers.php');
|
||||
|
||||
//3rdparty helper
|
||||
include('thirdPartyHelpers.php');
|
84
inc/helpers/configHelpers.php
Normal file
84
inc/helpers/configHelpers.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Config Helpers
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define constants for config
|
||||
*/
|
||||
define('URL_SITE', $urlsite);
|
||||
|
||||
|
||||
/**
|
||||
* Return the path to config
|
||||
*
|
||||
* @param String $file Optionnal - The file researched in website
|
||||
* @return String The path to the config
|
||||
*/
|
||||
function siteURL($file = ""){
|
||||
//Path to an asset
|
||||
return URL_SITE.$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the relative path to the website
|
||||
*
|
||||
* @param String $file Optionnal - The file searched in the website
|
||||
* @return String The relative path to the website
|
||||
*/
|
||||
function websiteRelativePath($file=""){
|
||||
return RELATIVE_PATH.$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the relative path to pages folder
|
||||
*
|
||||
* @param String $file Optionnal - The file searched in the website
|
||||
* @return String The relative path to the folder path
|
||||
*/
|
||||
function pagesRelativePath($file=""){
|
||||
return RELATIVE_PATH."inc/pages/".$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to user data
|
||||
*
|
||||
* @param String $file Optionnal - The file to search in user data
|
||||
* @return String The path to user data (from the URI of website)
|
||||
*/
|
||||
function userDataFolder($file=""){
|
||||
return USER_DATA_FOLDER.$file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns relative path to user data
|
||||
*
|
||||
* @param String $file Optionnal - file to search in user data
|
||||
* @return String Path to user datas
|
||||
*/
|
||||
function relativeUserDataFolder($file=""){
|
||||
return websiteRelativePath().userDataFolder($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns web path to user data
|
||||
*
|
||||
* @param String $file Optionnal - file to search in user data
|
||||
* @return String Path to user datas
|
||||
*/
|
||||
function webUserDataFolder($file=""){
|
||||
return siteURL().userDataFolder($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns relative path to the core elements of the website
|
||||
*
|
||||
* @param String $file Optionnal - file researched in the core of website
|
||||
* @return String Relative path to the core of website
|
||||
*/
|
||||
function websiteCoreFolder($file = ""){
|
||||
return websiteRelativePath().CORE_PATH.$file;
|
||||
}
|
36
inc/helpers/thirdPartyHelpers.php
Normal file
36
inc/helpers/thirdPartyHelpers.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Third party Helpers
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the path to a third party element, from the base of the website
|
||||
*
|
||||
* @param String $file The file in the 3rd Party
|
||||
*/
|
||||
function path_3rdparty($file = ""){
|
||||
//Path to an asset
|
||||
return THIRD_PARTY_FOLDER.$file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the relative path to a third party element, from the base of the website
|
||||
*
|
||||
* @param String $file The file in the 3rd Party
|
||||
*/
|
||||
function relativePath_3rdparty($file = ""){
|
||||
//Path to an asset
|
||||
return websiteRelativePath().path_3rdparty($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url of a Third Party element
|
||||
*
|
||||
* @param String $file The file in the third party
|
||||
* @return String The URL to the third party
|
||||
*/
|
||||
function url_3rdparty($file){
|
||||
return siteURL().path_3rdparty($file);
|
||||
}
|
Reference in New Issue
Block a user