aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
committermarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
commit4253581733d4c6c7f0dce5c3ea7566c6af4af936 (patch)
tree1eadff45b06adcac3f93432beea63b7ccd7391ff /include
parent2a9baa1f325b62541ad7a7b68e91455b104677bd (diff)
parent74298c44ae445125bfc2b13d20da91b9d349ce43 (diff)
downloadvolse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.gz
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.bz2
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php10
-rwxr-xr-xinclude/text.php22
2 files changed, 25 insertions, 7 deletions
diff --git a/include/items.php b/include/items.php
index a74c3d460..7b11a1c3c 100755
--- a/include/items.php
+++ b/include/items.php
@@ -822,7 +822,7 @@ function encode_item_xchan($xchan) {
function encode_item_terms($terms) {
$ret = array();
- $allowed_export_terms = array( TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY );
+ $allowed_export_terms = array( TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY, TERM_BOOKMARK );
if($terms) {
foreach($terms as $term) {
@@ -834,7 +834,7 @@ function encode_item_terms($terms) {
}
function termtype($t) {
- $types = array('unknown','hashtag','mention','category','private_category','file','search');
+ $types = array('unknown','hashtag','mention','category','private_category','file','search','thing','bookmark');
return(($types[$t]) ? $types[$t] : 'unknown');
}
@@ -865,6 +865,12 @@ function decode_tags($t) {
case 'search':
$tag['type'] = TERM_SEARCH;
break;
+ case 'thing':
+ $tag['type'] = TERM_THING;
+ break;
+ case 'bookmark':
+ $tag['type'] = TERM_BOOKMARK;
+ break;
default:
case 'unknown':
$tag['type'] = TERM_UNKNOWN;
diff --git a/include/text.php b/include/text.php
index a72989147..dc7d94b6d 100755
--- a/include/text.php
+++ b/include/text.php
@@ -442,7 +442,7 @@ function item_message_id() {
$mid = $hash . '@' . get_app()->get_hostname();
- $r = q("SELECT `id` FROM `item` WHERE `mid` = '%s' LIMIT 1",
+ $r = q("SELECT id FROM item WHERE mid = '%s' LIMIT 1",
dbesc($mid));
if(count($r))
$dups = true;
@@ -459,7 +459,7 @@ function photo_new_resource() {
do {
$found = false;
$resource = hash('md5',uniqid(mt_rand(),true));
- $r = q("SELECT `id` FROM `photo` WHERE `resource_id` = '%s' LIMIT 1",
+ $r = q("SELECT id FROM photo WHERE resource_id = '%s' LIMIT 1",
dbesc($resource)
);
if(count($r))
@@ -593,7 +593,7 @@ function get_tags($s) {
if(substr($mtch,-1,1) === '.')
$mtch = substr($mtch,0,-1);
// ignore strictly numeric tags like #1
- if((strpos($mtch,'#') === 0) && ctype_digit(substr($mtch,1)))
+ if((strpos($mtch,'#') === 0) && ( ctype_digit(substr($mtch,1)) || substr($mtch,1,1) === '^'))
continue;
// try not to catch url fragments
if(strpos($s,$mtch) && preg_match('/[a-zA-z0-9\/]/',substr($s,strpos($s,$mtch)-1,1)))
@@ -601,6 +601,18 @@ function get_tags($s) {
$ret[] = $mtch;
}
}
+
+ // bookmarks
+
+ if(preg_match_all('/#\^\[(url|zrl)=(.*?)\](.*?)\[\/(url|zrl)\]/',$s,$match,PREG_SET_ORDER)) {
+ foreach($match as $mtch) {
+ $ret[] = $mtch[0];
+ }
+ }
+
+
+ // logger('get_tags: ' . print_r($ret,true));
+
return $ret;
}
@@ -1639,10 +1651,10 @@ function item_post_type($item) {
function undo_post_tagging($s) {
$matches = null;
- $cnt = preg_match_all('/([@#])\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER);
+ $cnt = preg_match_all('/([@#])(\!*)\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
+ $s = str_replace($mtch[0], $mtch[1] . $mtch[2] . str_replace(' ','_',$mtch[4]),$s);
}
}
return $s;