sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r20023: OPSC-351: lj-app tag extended

Committer: vtroitsky
OPSC-351: lj-app tag extended
U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2011-09-13 02:12:10 UTC (rev 20022)
+++ trunk/cgi-bin/cleanhtml.pl	2011-09-13 06:25:18 UTC (rev 20023)
@@ -677,9 +677,21 @@
             {
                 next TOKEN if $LJ::DISABLED{'userapps'};
                 my %app_attr = map { $_ => Encode::encode_utf8($attr->{$_}) } keys %$attr;
-                my $app = LJ::UserApps->get_application( %app_attr );
+                my $app = LJ::UserApps->get_application( id => delete $app_attr{id}, key => delete $app_attr{key} );
                 next TOKEN unless $app && $app->can_show_restricted;
-                $newdata .= Encode::decode_utf8($app->ljapp_display($app_attr{extra}, $app_attr{title}), Encode::FB_QUIET);
+
+                # Gain all context data
+                my %context;
+                $context{posterid} = $opts->{posterid} if($opts->{posterid});
+                $context{journalid} = $opts->{journalid} if($opts->{journalid});
+                if($opts->{entry_url}) {
+                    my $entry = LJ::Entry->new_from_url($opts->{entry_url});
+                    if ($entry && $entry->valid) {
+                        $context{ditemid} = $entry->ditemid;
+                    }
+                }
+
+                $newdata .= Encode::decode_utf8($app->ljapp_display(viewer => LJ::get_remote(), owner => $poster, attrs => \%app_attr, context => \%context), Encode::FB_QUIET);
                 next TOKEN;
             }
             elsif ($tag eq "lj")

Tags: livejournal, pl, sunnyman
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