Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r10145: LJSUP-7915 (Native sharing server side)

Committer: ailyin
LJSUP-7915 (Native sharing server side)
A   trunk/cgi-bin/LJ/Hooks/Share.pm
U   trunk/cgi-bin/LJ/Worker/Repost.pm
Added: trunk/cgi-bin/LJ/Hooks/Share.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Share.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Hooks/Share.pm	2011-03-02 04:34:02 UTC (rev 10145)
@@ -0,0 +1,33 @@
+package LJ::Hooks::Share;
+use strict;
+use warnings;
+
+use LJ::SUP;
+
+LJ::register_hook( 'alter_sharing_params' => sub {
+    my ( $params ) = @_;
+
+    if ( LJ::SUP->is_remote_sup ) {
+        $params->{'links'} = [ qw(
+            livejournal facebook vkontakte
+            odnoklassniki moimir twitter email
+        ) ];
+    } else {
+        $params->{'links'} = [ qw(
+            facebook twitter digg
+            tumblr stumbleupon email
+        ) ];
+    }
+
+    while ( my ( $name, $service ) = each %{ $params->{'services'} } ) {
+        $service->{'bindLink'} = "$LJ::SITEROOT/redirect/SHARING_$name?"
+                               . 'url=' . LJ::eurl($service->{'bindLink'});
+
+        # because JS uses {param} for substituting data, and eurl escapes
+        # these, let's unescape them here
+        $service->{'bindLink'} =~ s/%7B/{/g;
+        $service->{'bindLink'} =~ s/%7D/}/g;
+    }
+});
+
+1;

Modified: trunk/cgi-bin/LJ/Worker/Repost.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/Repost.pm	2011-03-02 04:22:23 UTC (rev 10144)
+++ trunk/cgi-bin/LJ/Worker/Repost.pm	2011-03-02 04:34:02 UTC (rev 10145)
@@ -17,14 +17,7 @@
 sub cleanup {
     my ($class, $what) = @_;
 
-    LJ::CleanHTML::clean_comment(\$what);
-
-    $what =~ s/<.*?>/ /g;
-    $what =~ s/\s+/ /g;
-    $what =~ s/^\s+//;
-    $what =~ s/\s+$//;
-
-    return $what;
+    return LJ::Text->drop_html($what);
 }
 
 sub shorten_url {

Tags: andy, ljcom, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments