- Added function isEmptyString to fhc_helper

- Added function isEmptyArray to fhc_helper
- Adapted the code in application/* to use as much as possible this two new functions
- Removed the php function empty almost everywhere
This commit is contained in:
Paolo
2018-06-27 15:06:04 +02:00
parent d04b0450da
commit 25e66bf9dd
23 changed files with 214 additions and 200 deletions
+19
View File
@@ -148,3 +148,22 @@ function loadResource($path, $resources = null, $subdir = false)
}
}
}
/**
* Returns true if the given string is empty
* Empty means that the parameter string is null or made of space, tab, vertical tab, line feed, carriage return
* and form feed characters.
*/
function isEmptyString($string)
{
return ($string == null) || ($string != null && ctype_space($string) === true);
}
/**
* Returns true if the given array is empty
* Empty means that is null, or is not null and it is not an array, or it is an array but without elements
*/
function isEmptyArray($array)
{
return ($array == null) || ($array != null && !is_array($array) || (is_array($array) && count($array) == 0));
}
+4 -4
View File
@@ -35,7 +35,7 @@ function sendMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DE
$ci =& get_instance();
$ci->load->library('email');
$ci->load->library('MailLib');
$sanchoHeader_img = 'skin/images/sancho/'. $headerImg;
$sanchoFooter_img = 'skin/images/sancho/sancho_footer.jpg';
@@ -49,7 +49,7 @@ function sendMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DE
// Set specific mail content into specific content template
$content = _parseMailContent($vorlage_kurzbz, $vorlage_data);
// overall main content data array
$layout = array(
'CID_header' => $cid_header,
@@ -75,14 +75,14 @@ function _parseMailContent($vorlage_kurzbz, $vorlage_data)
{
$ci =& get_instance();
$ci->load->library('VorlageLib');
$result = $ci->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
if (isSuccess($result))
{
// If the text and the subject of the template are not empty
if (is_array($result->retval) && count($result->retval) > 0 &&
!empty($result->retval[0]->text))
!isEmptyString($result->retval[0]->text))
{
// Parses template text
$parsedText = $ci->vorlagelib->parseVorlagetext($result->retval[0]->text, $vorlage_data);