forked from friendica/friendica-addons
Added tags support to LJ and DW connectors. (Friendica tags are converted to LJ/DW tags.)
This commit is contained in:
parent
6995cf87de
commit
f68ba9b87d
BIN
dwpost.tgz
Normal file
BIN
dwpost.tgz
Normal file
Binary file not shown.
|
@ -6,6 +6,7 @@
|
||||||
* Version: 1.0
|
* Version: 1.0
|
||||||
* Author: Tony Baldwin <http://tonybaldwin.me/friendica/profile/tony>
|
* Author: Tony Baldwin <http://tonybaldwin.me/friendica/profile/tony>
|
||||||
* Author: Michael Johnston
|
* Author: Michael Johnston
|
||||||
|
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function dwpost_install() {
|
function dwpost_install() {
|
||||||
|
@ -173,6 +174,7 @@ function dwpost_send(&$a,&$b) {
|
||||||
$title = $b['title'];
|
$title = $b['title'];
|
||||||
$post = bbcode($b['body']);
|
$post = bbcode($b['body']);
|
||||||
$post = xmlify($post);
|
$post = xmlify($post);
|
||||||
|
$tags = dwpost_get_tags($b['tag']);
|
||||||
|
|
||||||
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
||||||
$year = intval(substr($date,0,4));
|
$year = intval(substr($date,0,4));
|
||||||
|
@ -200,7 +202,7 @@ function dwpost_send(&$a,&$b) {
|
||||||
<member><name>props</name>
|
<member><name>props</name>
|
||||||
<value><struct>
|
<value><struct>
|
||||||
<member><name>useragent</name><value><string>Friendica</string></value></member>
|
<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></member>
|
||||||
</struct></value>
|
</struct></value>
|
||||||
</param></params>
|
</param></params>
|
||||||
|
@ -217,3 +219,9 @@ EOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dwpost_get_tags($post)
|
||||||
|
{
|
||||||
|
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
|
||||||
|
$tags = implode(', ',$matches[1]);
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
BIN
ljpost.tgz
BIN
ljpost.tgz
Binary file not shown.
|
@ -6,6 +6,7 @@
|
||||||
* Version: 1.0
|
* Version: 1.0
|
||||||
* Author: Tony Baldwin <http://tonybaldwin.me/friendica/profile/tony>
|
* Author: Tony Baldwin <http://tonybaldwin.me/friendica/profile/tony>
|
||||||
* Author: Michael Johnston
|
* Author: Michael Johnston
|
||||||
|
* Author: Cat Gray <https://free-haven.org/profile/catness>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function ljpost_install() {
|
function ljpost_install() {
|
||||||
|
@ -179,6 +180,7 @@ function ljpost_send(&$a,&$b) {
|
||||||
$title = xmlify($b['title']);
|
$title = xmlify($b['title']);
|
||||||
$post = bbcode($b['body']);
|
$post = bbcode($b['body']);
|
||||||
$post = xmlify($post);
|
$post = xmlify($post);
|
||||||
|
$tags = ljpost_get_tags($b['tag']);
|
||||||
|
|
||||||
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
$date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s');
|
||||||
$year = intval(substr($date,0,4));
|
$year = intval(substr($date,0,4));
|
||||||
|
@ -213,6 +215,10 @@ function ljpost_send(&$a,&$b) {
|
||||||
<name>useragent</name>
|
<name>useragent</name>
|
||||||
<value><string>Friendica</string></value>
|
<value><string>Friendica</string></value>
|
||||||
</member>
|
</member>
|
||||||
|
<member>
|
||||||
|
<name>taglist</name>
|
||||||
|
<value><string>$tags</string></value>
|
||||||
|
</member>
|
||||||
</struct>
|
</struct>
|
||||||
</value>
|
</value>
|
||||||
</member>
|
</member>
|
||||||
|
@ -232,3 +238,9 @@ EOT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ljpost_get_tags($post)
|
||||||
|
{
|
||||||
|
preg_match_all("/\]([^\[#]+)\[/",$post,$matches);
|
||||||
|
$tags = implode(', ',$matches[1]);
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue