Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
360 changed files
with
25,001 additions
and
457 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
|
||
|
||
|
||
function contact_remove($id) { | ||
q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1", | ||
intval($id) | ||
); | ||
q("DELETE FROM `item` WHERE `contact-id` = %d ", | ||
intval($id) | ||
); | ||
q("DELETE FROM `photo` WHERE `contact-id` = %d ", | ||
intval($id) | ||
); | ||
} | ||
|
||
|
||
// Contact has refused to recognise us as a friend. We will start a countdown. | ||
// If they still don't recognise us in 32 days, the relationship is over, | ||
// and we won't waste any more time trying to communicate with them. | ||
// This provides for the possibility that their database is temporarily messed | ||
// up or some other transient event and that there's a possibility we could recover from it. | ||
|
||
if(! function_exists('mark_for_death')) { | ||
function mark_for_death($contact) { | ||
if($contact['term-date'] == '0000-00-00 00:00:00') { | ||
q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1", | ||
dbesc(datetime_convert()), | ||
intval($contact['id']) | ||
); | ||
} | ||
else { | ||
$expiry = $contact['term-date'] . ' + 32 days '; | ||
if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) { | ||
|
||
// relationship is really truly dead. | ||
|
||
contact_remove($contact['id']); | ||
|
||
} | ||
} | ||
|
||
}} | ||
|
||
if(! function_exists('unmark_for_death')) { | ||
function unmark_for_death($contact) { | ||
// It's a miracle. Our dead contact has inexplicably come back to life. | ||
q("UPDATE `contact` SET `term-date = '%s' WHERE `id` = %d LIMIT 1", | ||
dbesc('0000-00-00 00:00:00'), | ||
intval($contact['id']) | ||
); | ||
}} | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
|
||
function html2bbcode($s) { | ||
|
||
|
||
// Tags to Find | ||
$htmltags = array( | ||
'/\<b\>(.*?)\<\/b\>/is', | ||
'/\<i\>(.*?)\<\/i\>/is', | ||
'/\<u\>(.*?)\<\/u\>/is', | ||
'/\<ul\>(.*?)\<\/ul\>/is', | ||
'/\<li\>(.*?)\<\/li\>/is', | ||
'/\<img(.*?) src=\"(.*?)\" (.*?)\>/is', | ||
'/\<div(.*?)\>(.*?)\<\/div\>/is', | ||
'/\<br(.*?)\>/is', | ||
'/\<strong\>(.*?)\<\/strong\>/is', | ||
'/\<a href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is', | ||
'/\<code\>(.*?)\<\/code\>/is', | ||
'/\<font color=(.*?)\>(.*?)\<\/font\>', | ||
'/\<font color=\"(.*?)\"\>(.*?)\<\/font\>', | ||
'/\<blockquote\>(.*?)\<\/blockquote\>/is', | ||
|
||
); | ||
|
||
// Replace with | ||
$bbtags = array( | ||
'[b]$1[/b]', | ||
'[i]$1[/i]', | ||
'[u]$1[/u]', | ||
'[list]$1[/list]', | ||
'[*]$1', | ||
'[img]$2[/img]', | ||
'$2', | ||
'\n', | ||
'[b]$1[/b]', | ||
'[url=$1]$3[/url]', | ||
'[code]$1[/code], | ||
'[color="$1"]$2[/color]', | ||
'[color="$1"]$2[/color]', | ||
'[quote]$1[/quote]', | ||
); | ||
|
||
// Replace $htmltags in $text with $bbtags | ||
$text = preg_replace ($htmltags, $bbtags, $s); | ||
|
||
// Strip all other HTML tags | ||
$text = strip_tags($text); | ||
return $text; | ||
} |
Oops, something went wrong.