'nd','ng','nk','nt','rn','rp','rt'];
$noend = ['bl', 'br', 'cl','cr','dr','fl','fr','gl','gr',
- 'kh', 'kl','kr','mn','pl','pr','rh','tr','qu','wh'];
+ 'kh', 'kl','kr','mn','pl','pr','rh','tr','qu','wh','q'];
$start = mt_rand(0,2);
if ($start == 0) {
$word = substr($word,0,$len);
foreach ($noend as $noe) {
- if ((strlen($word) > 2) && (substr($word, -2) == $noe)) {
- $word = substr($word, 0, -1);
+ $noelen = strlen($noe);
+ if ((strlen($word) > $noelen) && (substr($word, -$noelen) == $noe)) {
+ $word = autoname($len);
break;
}
}
- if (substr($word, -1) == 'q') {
- $word = substr($word, 0, -1);
- }
+
return $word;
}
if (is_array($p)) {
$tmp = $p;
} else {
- $tmp = explode(',',$p);
+ $tmp = explode(',', $p);
}
if (is_array($tmp)) {
$r = preg_match_all("/\[video\](.*?)\[\/video\]/ism",$s,$matches,PREG_SET_ORDER);
if ($r) {
foreach ($matches as $mtch) {
- if ((stristr($mtch[1],'youtube')) || (stristr($mtch[1],'youtu.be')))
- $s = str_replace($mtch[0],'[youtube]' . $mtch[1] . '[/youtube]',$s);
- elseif (stristr($mtch[1],'vimeo'))
- $s = str_replace($mtch[0],'[vimeo]' . $mtch[1] . '[/vimeo]',$s);
+ if ((stristr($mtch[1], 'youtube')) || (stristr($mtch[1], 'youtu.be'))) {
+ $s = str_replace($mtch[0], '[youtube]' . $mtch[1] . '[/youtube]', $s);
+ } elseif (stristr($mtch[1], 'vimeo')) {
+ $s = str_replace($mtch[0], '[vimeo]' . $mtch[1] . '[/vimeo]', $s);
+ }
}
}
return $s;
}
// ex. given music,video return <music><video> or [music][video]
-function file_tag_list_to_file($list,$type = 'file') {
+function file_tag_list_to_file($list, $type = 'file') {
$tag_list = '';
if (strlen($list)) {
$list_array = explode(",",$list);
}
// ex. given <music><video>[friends], return music,video or friends
-function file_tag_file_to_list($file,$type = 'file') {
+function file_tag_file_to_list($file, $type = 'file') {
$matches = false;
$list = '';
if ($type == 'file') {
if (!intval($uid)) {
return false;
- }
- if ($file_old == $file_new) {
+ } elseif ($file_old == $file_new) {
return true;
}
$check_new_tags = explode(",",file_tag_file_to_list($file_new,$type));
foreach ($check_new_tags as $tag) {
- if (! stristr($saved,$lbracket . file_tag_encode($tag) . $rbracket))
+ if (! stristr($saved,$lbracket . file_tag_encode($tag) . $rbracket)) {
$new_tags[] = $tag;
+ }
}
$filetags_updated .= file_tag_list_to_file(implode(",",$new_tags),$type);
$check_deleted_tags = explode(",",file_tag_file_to_list($file_old,$type));
foreach ($check_deleted_tags as $tag) {
- if (! stristr($file_new,$lbracket . file_tag_encode($tag) . $rbracket))
+ if (! stristr($file_new,$lbracket . file_tag_encode($tag) . $rbracket)) {
$deleted_tags[] = $tag;
+ }
}
foreach ($deleted_tags as $key => $tag) {
return str_replace('%', '%%', $s);
}
-
+/// @TODO Rewrite this
function is_a_date_arg($s) {
$i = intval($s);
+
if ($i > 1900) {
$y = date('Y');
+
if ($i <= $y + 1 && strpos($s, '-') == 4) {
- $m = intval(substr($s,5));
- if ($m > 0 && $m <= 12)
+ $m = intval(substr($s, 5));
+
+ if ($m > 0 && $m <= 12) {
return true;
+ }
}
}
+
return false;
}
preg_match("|^" . $chr . "*|", $lines[$k], $m);
$count = strlen($m[0]);
}
+
for ($k = 0; $k < count($lines); $k++) {
$lines[$k] = preg_replace("|^" . $chr . "{" . $count . "}|", "", $lines[$k]);
}