This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function html_truncate($text, $length, $suffix = '…', $isHTML = true) | |
{ | |
$i = 0; | |
$simpleTags = ['br' => true, 'hr' => true, 'input' => true, 'image' => true, 'link' => true, 'meta' => true]; | |
$tags = []; | |
if ($isHTML) { | |
preg_match_all('/<[^>]+>([^<]*)/', $text, $m, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); | |
foreach ($m as $o) { | |
if ($o[0][1] - $i >= $length) { | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function nextMonths( $date ){ | |
$dateArray = [0 => $date]; | |
for( $i=1; $i<=12; $i++){ | |
$new_date = date('Y-m-d', strtotime('+'.$i.' months', strtotime($date) ) ); | |
$next_month = date('Y-m-d', strtotime('last day of next month', strtotime( end($dateArray) ) )); | |
if ( date('m', strtotime($new_date) ) != date('m', strtotime($next_month)) ){ | |
$dateArray[] = $next_month; | |
} else { | |
$dateArray[] = $new_date; |