X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=83819d095071f678df7bb3f298bf9777884a421a;hb=fc27edb6d76765cd9b85d29a3c41f23f17c6ca41;hp=376ac473de28fab45394501bd45ca15e813f7ffe;hpb=b1dacd6d838ecf75fe828279e57c2e7a866be22f;p=friendica.git diff --git a/include/text.php b/include/text.php index 376ac473de..83819d0950 100644 --- a/include/text.php +++ b/include/text.php @@ -280,6 +280,31 @@ function paginate(&$a) { return $o; }} +if(! function_exists('alt_pager')) { +function alt_pager(&$a, $i) { + $o = ''; + $stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string); + $stripped = str_replace('q=','',$stripped); + $stripped = trim($stripped,'/'); + $pagenum = $a->pager['page']; + $url = $a->get_baseurl() . '/' . $stripped; + + $o .= '
'; + + if($a->pager['page']>1) + $o .= "pager['page'] - 1).'">' . t('newer') . ''; + if($i>0) { + if($a->pager['page']>1) + $o .= " - "; + $o .= "pager['page'] + 1).'">' . t('older') . ''; + } + + + $o .= '
'."\r\n"; + + return $o; +}} + // Turn user/group ACLs stored as angle bracketed text into arrays if(! function_exists('expand_acl')) { @@ -656,6 +681,10 @@ function search($s,$id='search-box',$url='/search',$save = false) { if(! function_exists('valid_email')) { function valid_email($x){ + + if(get_config('system','disable_email_validation')) + return true; + if(preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) return true; return false; @@ -750,40 +779,40 @@ function smilies($s, $sample = false) { ); $icons = array( - '<3', - '</3', - '<\\3', - ':-)', - ';-)', - ':-(', - ':-P', - ':-p', - ':-\', - ':-\', - ':-x', - ':-X', - ':-D', - '8-|', - '8-O', - ':-O', - '\\o/', - 'o.O', - 'O.o', - 'o_O', - 'O_o', - ':\'(', - ':-!', - ':-/', - ':-[', - '8-)', - ':beer', - ':homebrew', - ':coffee', - ':facepalm', - ':like', - ':dislike', - '~friendika ~friendika', - '~friendica ~friendica' + '<3', + '</3', + '<\\3', + ':-)', + ';-)', + ':-(', + ':-P', + ':-p', + ':-\', + ':-\', + ':-x', + ':-X', + ':-D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + 'o_O', + 'O_o', + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', + ':beer', + ':homebrew', + ':coffee', + ':facepalm', + ':like', + ':dislike', + '~friendika ~friendika', + '~friendica ~friendica' ); $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); @@ -823,7 +852,7 @@ function preg_heart($x) { return $x[0]; $t = ''; for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) - $t .= '<3'; + $t .= '<3'; $r = str_replace($x[0],$t,$x[0]); return $r; } @@ -891,6 +920,7 @@ function prepare_body($item,$attach = false) { } else $s = prepare_text($item['body']); + $prep_arr = array('item' => $item, 'html' => $s); call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; @@ -1058,12 +1088,13 @@ function feed_salmonlinks($nick) { if(! function_exists('get_plink')) { function get_plink($item) { $a = get_app(); - if (x($item,'plink') && (! $item['private'])){ + if (x($item,'plink') && ($item['private'] != 1)) { return array( 'href' => $item['plink'], 'title' => t('link to source'), ); - } else { + } + else { return false; } }} @@ -1254,13 +1285,13 @@ function bb_translate_video($s) { function html2bb_video($s) { - $s = preg_replace('#]+>(.*?)https+://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)#ism', + $s = preg_replace('#]+>(.*?)https?://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)#ism', '[youtube]$2[/youtube]', $s); - $s = preg_replace('#](.*?)https+://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)#ism', + $s = preg_replace('#](.*?)https?://www.youtube.com/embed/([A-Za-z0-9\-_=]+)(.*?)#ism', '[youtube]$2[/youtube]', $s); - $s = preg_replace('#](.*?)https+://player.vimeo.com/video/([0-9]+)(.*?)#ism', + $s = preg_replace('#](.*?)https?://player.vimeo.com/video/([0-9]+)(.*?)#ism', '[vimeo]$2[/vimeo]', $s); return $s; @@ -1540,3 +1571,16 @@ function protect_sprintf($s) { return(str_replace('%','%%',$s)); } + +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) + return true; + } + } + return false; +}