alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r19247: LJSUP-9016: LJ-like - add donate button

Committer: afedorov
LJSUP-9016: LJ-like - add donate button
LJSUP-9018: Short names for likes buttons

U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/LJ/Widget/EntryForm.pm
U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2011-06-07 08:11:04 UTC (rev 19246)
+++ trunk/cgi-bin/LJ/S2.pm	2011-06-07 08:16:00 UTC (rev 19247)
@@ -1898,7 +1898,6 @@
     push @$link_keyseq, 'watch_comments'    if LJ::is_enabled('esn');
     push @$link_keyseq, 'unwatch_comments'  if LJ::is_enabled('esn');
     push @$link_keyseq, 'flag'              if LJ::is_enabled('content_flag');
-    push @$link_keyseq, 'give_button'       if LJ::is_enabled('give_features');
 
     # Note: nav_prev and nav_next are not included in the keyseq anticipating
     #      that their placement relative to the others will vary depending on

Modified: trunk/cgi-bin/LJ/Widget/EntryForm.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryForm.pm	2011-06-07 08:11:04 UTC (rev 19246)
+++ trunk/cgi-bin/LJ/Widget/EntryForm.pm	2011-06-07 08:16:00 UTC (rev 19247)
@@ -1110,7 +1110,6 @@
         [ 'mood', 'comment_settings' ],
         [ 'location', 'comment_screening' ],
         [ 'music', 'content_flag' ],
-        [ 'blank', 'give_features' ],
         'extra',
         [ 'lastfm_logo', 'spellcheck' ],
     );

Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2011-06-07 08:11:04 UTC (rev 19246)
+++ trunk/cgi-bin/cleanhtml.pl	2011-06-07 08:16:00 UTC (rev 19247)
@@ -724,22 +724,28 @@
                 }
 
                 my $entry_url = $opts->{'entry_url'};
-                my @buttons = qw( facebook google vkontakte );
+                my @buttons = qw( facebook google twitter vkontakte livejournal );
 
                 if ( exists $attr->{'buttons'} && $attr->{'buttons'} ) {
                     my $buttons = $attr->{'buttons'};
 
                     @buttons = ();
                     foreach my $button ( split /,\s*/, $buttons ) {
-                        if ( $button =~ /^f/i ) {
+                        if ( $button =~ /^(?:fb|facebook)$/i ) {
                             push @buttons, 'facebook';
                         }
-                        elsif ( $button =~ /^g/i ) {
+                        elsif ( $button =~ /^(?:go|google)$/i ) {
                             push @buttons, 'google';
                         }
-                        elsif ( $button =~ /^v/i ) {
+                        elsif ( $button =~ /^(?:tw|twitter)$/i ) {
+                            push @buttons, 'twitter';
+                        }
+                        elsif ( $button =~ /^(?:vk|vkontakte)$/i ) {
                             push @buttons, 'vkontakte';
                         }
+                        elsif ( $button =~ /^(?:lj|livejournal)$/i ) {
+                            push @buttons, 'livejournal';
+                        }
                     }
                 }
 
@@ -780,6 +786,21 @@
                             . qq{</script>};
                         $newdata .= qq{<div class="lj-like-item lj-like-item-vkontakte"><x-vk-like id="$uniqid"></div>};
                     }
+
+                    elsif ( $button eq 'livejournal' ) {
+                        my $entry = LJ::Entry->new_from_url($entry_url);
+                        my $give_button = LJ::run_hook("give_button", {
+                            'journal' => $entry->journal->user,
+                            'itemid'  => $entry->ditemid,
+                            'type'    => 'tag',
+                        });
+
+                        if ($give_button) {
+                            $newdata .= qq{<div class="lj-like-item lj-like-item-livejournal">}
+                                      . $give_button
+                                      . qq{</div>};
+                        }
+                    }
                 }
                 $newdata .= '</div>';
             }

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