added Cat's tag stuff to ijpost

This commit is contained in:
Tony Baldwin 2012-03-17 17:30:21 -04:00
parent f75d96e5bc
commit 06e04aca2f
3 changed files with 11 additions and 2 deletions

View file

@ -150,7 +150,7 @@ function dwpost_send(&$a,&$b) {
if($b['parent'] != $b['id'])
return;
// dreamwidth post in the LJ user's timezone.
// dreamwidth post in the DW user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.

Binary file not shown.

View file

@ -5,6 +5,8 @@
* Description: Post to insanejournal
* Version: 1.0
* Author: Tony Baldwin <https://free-haven.org/profile/tony>
* Author: Michael Johnston
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/
function ijpost_install() {
@ -172,6 +174,7 @@ function ijpost_send(&$a,&$b) {
$title = $b['title'];
$post = bbcode($b['body']);
$post = xmlify($post);
$tags = ijpost_get_tags($b['tag']);
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
$year = intval(substr($date,0,4));
@ -199,7 +202,7 @@ function ijpost_send(&$a,&$b) {
<member><name>props</name>
<value><struct>
<member><name>useragent</name><value><string>Friendica</string></value></member>
<member><name>taglist</name><value><string>friendica</string></value></member>
<member><name>taglist</name><value><string>$tags</string></value></member>
</struct></value></member>
</struct></value>
</param></params>
@ -216,3 +219,9 @@ EOT;
}
}
function ijpost_get_tags($post)
{
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
$tags = implode(', ',$matches[1]);
return $tags;
}