X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=3783d2accd9dbbce3d8bdf3fac9056d7897c98e4;hb=f433158bedee99dd52c47c35e8e19e601027da11;hp=f408e0df6977df32d1b4c59dabb078ec4b96a4e7;hpb=24e85c95b66dac2bd046ebec5c90bb7f2e2de0b8;p=friendica.git
diff --git a/include/text.php b/include/text.php
index f408e0df69..3783d2accd 100644
--- a/include/text.php
+++ b/include/text.php
@@ -70,7 +70,7 @@ function notags($string) {
if(! function_exists('escape_tags')) {
function escape_tags($string) {
- return(htmlspecialchars($string));
+ return(htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false));
}}
@@ -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 .= '
'."\r\n";
+
+ return $o;
+}}
+
// Turn user/group ACLs stored as angle bracketed text into arrays
if(! function_exists('expand_acl')) {
@@ -378,7 +403,7 @@ function load_view_file($s) {
return file_get_contents("$d/$lang/$b");
$theme = current_theme();
-
+
if(file_exists("$d/theme/$theme/$b"))
return file_get_contents("$d/theme/$theme/$b");
@@ -479,6 +504,10 @@ function get_tags($s) {
$s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
+ // ignore anything in a bbtag
+
+ $s = preg_replace('/\[(.*?)\]/sm','',$s);
+
// Match full names against @tags including the space between first and last
// We will look these up afterward to see if they are full names or not recognisable.
@@ -656,6 +685,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;
@@ -677,6 +710,55 @@ function linkify($s) {
return($s);
}}
+function get_poke_verbs() {
+
+ // index is present tense verb
+ // value is array containing past tense verb, translation of present, translation of past
+
+ $arr = array(
+ 'poke' => array( 'poked', t('poke'), t('poked')),
+ 'ping' => array( 'pinged', t('ping'), t('pinged')),
+ 'prod' => array( 'prodded', t('prod'), t('prodded')),
+ 'slap' => array( 'slapped', t('slap'), t('slapped')),
+ 'finger' => array( 'fingered', t('finger'), t('fingered')),
+ 'rebuff' => array( 'rebuffed', t('rebuff'), t('rebuffed')),
+ );
+ call_hooks('poke_verbs', $arr);
+ return $arr;
+}
+
+function get_mood_verbs() {
+
+ // index is present tense verb
+ // value is array containing past tense verb, translation of present, translation of past
+
+ $arr = array(
+ 'happy' => t('happy'),
+ 'sad' => t('sad'),
+ 'mellow' => t('mellow'),
+ 'tired' => t('tired'),
+ 'perky' => t('perky'),
+ 'angry' => t('angry'),
+ 'stupefied' => t('stupified'),
+ 'puzzled' => t('puzzled'),
+ 'interested' => t('interested'),
+ 'bitter' => t('bitter'),
+ 'cheerful' => t('cheerful'),
+ 'alive' => t('alive'),
+ 'annoyed' => t('annoyed'),
+ 'anxious' => t('anxious'),
+ 'cranky' => t('cranky'),
+ 'disturbed' => t('disturbed'),
+ 'frustrated' => t('frustrated'),
+ 'motivated' => t('motivated'),
+ 'relaxed' => t('relaxed'),
+ 'surprised' => t('surprised'),
+ );
+
+ call_hooks('mood_verbs', $arr);
+ return $arr;
+}
+
/**
*
@@ -750,40 +832,40 @@ function smilies($s, $sample = false) {
);
$icons = array(
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '
',
- '~friendika
',
- '~friendica
'
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '~friendika
',
+ '~friendica
'
);
$params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
@@ -823,7 +905,7 @@ function preg_heart($x) {
return $x[0];
$t = '';
for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
- $t .= '
';
+ $t .= '
';
$r = str_replace($x[0],$t,$x[0]);
return $r;
}
@@ -1059,12 +1141,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;
}
}}
@@ -1255,13 +1338,13 @@ function bb_translate_video($s) {
function html2bb_video($s) {
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[youtube]$2[/youtube]', $s);
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[youtube]$2[/youtube]', $s);
- $s = preg_replace('##ism',
+ $s = preg_replace('##ism',
'[vimeo]$2[/vimeo]', $s);
return $s;
@@ -1532,7 +1615,7 @@ function undo_post_tagging($s) {
function fix_mce_lf($s) {
$s = str_replace("\r\n","\n",$s);
- $s = str_replace("\n\n","\n",$s);
+// $s = str_replace("\n\n","\n",$s);
return $s;
}