Skip to content

Commit a2ed4b2

Browse files
authored
Merge pull request #47 from nguyenanhung/develop
Develop
2 parents a7c209e + f7f61d7 commit a2ed4b2

File tree

9 files changed

+74
-94
lines changed

9 files changed

+74
-94
lines changed

helpers/array_helper.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ function arrayToObject($array = array())
3131
$object->$name = arrayToObject($value);
3232
}
3333
}
34-
3534
return $object;
3635
}
37-
3836
return false;
3937
}
4038
}
@@ -58,10 +56,8 @@ function arrayToXml($array = array(), $namespace = '', $file_output = null)
5856
$xml_object = new SimpleXMLElement("<?xml version=\"1.0\"?><" . $namespace . "></" . $namespace . ">"); // creating object of SimpleXMLElement
5957
convertArrayToXml($array, $xml_object); // function call to convert array to xml
6058
$xml_file = $file_output !== null ? $xml_object->asXML($file_output) : $xml_object->asXML(); // saving generated xml file
61-
6259
return !empty($xml_file) ? $xml_file : null;
6360
}
64-
6561
return null;
6662
}
6763
}
@@ -112,7 +108,6 @@ function removeArrayElementWithValue($array, $key, $value)
112108
unset($array[$subKey]);
113109
}
114110
}
115-
116111
return $array;
117112
}
118113
}
@@ -131,7 +126,6 @@ function removeArrayElementWithValue($array, $key, $value)
131126
function arrayRecursiveDiff($aArray1, $aArray2)
132127
{
133128
$aReturn = array();
134-
135129
foreach ($aArray1 as $mKey => $mValue) {
136130
if (array_key_exists($mKey, $aArray2)) {
137131
if (is_array($mValue)) {
@@ -146,7 +140,6 @@ function arrayRecursiveDiff($aArray1, $aArray2)
146140
$aReturn[$mKey] = $mValue;
147141
}
148142
}
149-
150143
return $aReturn;
151144
}
152145
}
@@ -185,7 +178,6 @@ function arrayIsAssoc($array)
185178
if (!is_array($array) || $array === array()) {
186179
return false;
187180
}
188-
189181
return array_keys($array) !== range(0, count($array) - 1);
190182
}
191183
}
@@ -301,22 +293,17 @@ function arrayGetElement($key, $array)
301293
{
302294
if (is_string($key) && is_array($array)) {
303295
$keys = explode('.', $key);
304-
305296
while (count($keys) >= 1) {
306297
$k = array_shift($keys);
307-
308298
if (!isset($array[$k])) {
309299
return null;
310300
}
311-
312301
if (count($keys) === 0) {
313302
return $array[$k];
314303
}
315-
316304
$array = &$array[$k];
317305
}
318306
}
319-
320307
return null;
321308
}
322309
}
@@ -385,31 +372,23 @@ function arrayGetElement($key, $array)
385372
function arraySetElement($key, $value, &$array)
386373
{
387374
if (is_string($key) && !empty($key)) {
388-
389375
$keys = explode('.', $key);
390376
$arrTmp = &$array;
391-
392377
while (count($keys) >= 1) {
393378
$k = array_shift($keys);
394-
395379
if (!is_array($arrTmp)) {
396380
$arrTmp = array();
397381
}
398-
399382
if (!isset($arrTmp[$k])) {
400383
$arrTmp[$k] = array();
401384
}
402-
403385
if (count($keys) === 0) {
404386
$arrTmp[$k] = $value;
405-
406387
return true;
407388
}
408-
409389
$arrTmp = &$arrTmp[$k];
410390
}
411391
}
412-
413392
return false;
414393
}
415394
}
@@ -462,11 +441,9 @@ function to_array($var)
462441
if (is_string($var)) {
463442
return str_split($var);
464443
}
465-
466444
if (is_object($var)) {
467445
return json_decode(json_encode($var), true);
468446
}
469-
470447
return null;
471448
}
472449
}
@@ -481,21 +458,17 @@ function to_array($var)
481458
function arrayToAttributes($attr)
482459
{
483460
$attr_str = '';
484-
485461
foreach ((array) $attr as $property => $value) {
486462
// Ignore null/false
487463
if ($value === null || $value === false) {
488464
continue;
489465
}
490-
491466
// If the key is numeric then it must be something like selected="selected"
492467
if (is_numeric($property)) {
493468
$property = $value;
494469
}
495-
496470
$attr_str .= $property . '="' . str_replace('"', '&quot;', $value) . '" ';
497471
}
498-
499472
// We strip off the last space for return
500473
return trim($attr_str);
501474
}

helpers/blogspot_helper.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ function blogspotDescSortWithPublishedTime($item1, $item2)
1313
if ($item1['published']['$t'] === $item2['published']['$t']) {
1414
return 0;
1515
}
16-
1716
return ($item1['published']['$t'] < $item2['published']['$t']) ? 1 : -1;
1817
}
1918
}
2019
if (!function_exists('blogspotUSort')) {
2120
function blogspotUSort($data)
2221
{
2322
usort($data, 'blogspotDescSortWithPublishedTime');
24-
2523
return $data;
2624
}
2725
}
@@ -33,28 +31,23 @@ function blogspotFormatInformationItem($blog)
3331
} else {
3432
$blogThumb = 'https://c2.staticflickr.com/8/7858/32668285888_8da8a3c105_z.jpg';
3533
}
36-
3734
$blogThumb = str_replace(
3835
array('/s72-c-d/', '/s72-c/', '/s72-d/', 'http://'),
3936
array('/s320/', '/s320/', '/s320/', 'https://'),
4037
$blogThumb
4138
);
42-
4339
$blogTitle = trim($blog['title']['$t']);
4440
$cleanBlogTitle = strip_quotes($blogTitle);
4541
$cleanBlogTitle = stripslashes($cleanBlogTitle);
4642
$blogLink = '';
47-
4843
foreach ($blog['link'] as $link) {
4944
if ($link['rel'] === 'alternate') {
5045
$blogLink .= $link['href'];
5146
} else {
5247
$blogLink .= '';
5348
}
5449
}
55-
5650
$blogPublished = trim($blog['published']['$t']);
57-
5851
return array(
5952
'thumb' => $blogThumb,
6053
'name' => $blogTitle,

helpers/byte_helper.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,18 @@ function bytesHumanFormat($size)
2323
if ($size <= 0) {
2424
return '0 bytes';
2525
}
26-
2726
if ($size === 1) {
2827
return '1 byte';
2928
}
30-
3129
if ($size < 1024) {
3230
return $size . ' bytes';
3331
}
34-
3532
$i = 0;
3633
$iec = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
37-
3834
while (($size / 1024) > 1) {
3935
$size /= 1024;
4036
++$i;
4137
}
42-
4338
return number_format($size, 2) . ' ' . $iec[$i];
4439
}
4540
}

helpers/common_helper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function smart_bear_copyright_line()
1818
{
1919
$helper = new \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper();
2020
$author = $helper->getAuthor();
21-
2221
return '&copy; <a href="' . $author['web'] . '" title="' . $author['full_name'] . '">' . $author['name'] . '</a>';
2322
}
2423
}
@@ -27,7 +26,6 @@ function smart_bear_copyright_powered_line()
2726
{
2827
$helper = new \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper();
2928
$author = $helper->getAuthor();
30-
3129
return 'Powered by <a href="' . $author['web'] . '" title="' . $author['full_name'] . '">' . $author['name'] . '</a>';
3230
}
3331
}
@@ -41,7 +39,6 @@ function smart_bear_basic_helper_version()
4139
function smart_bear_basic_helper_author()
4240
{
4341
$helper = new \nguyenanhung\CodeIgniter\BasicHelper\BaseHelper();
44-
4542
return $helper->getAuthor();
4643
}
4744
}

src/BaseHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
class BaseHelper
2121
{
22-
const VERSION = '1.5.9.2';
23-
const LAST_MODIFIED = '2023-10-05';
22+
const VERSION = '1.5.9.3';
23+
const LAST_MODIFIED = '2023-11-24';
2424
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
2525
const AUTHOR_NAME = 'Hung Nguyen';
2626
const AUTHOR_FULL_NAME = 'Hung Nguyen';

0 commit comments

Comments
 (0)