Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1U trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/S2.pm =================================================================== --- trunk/cgi-bin/LJ/S2.pm 2012-10-09 12:37:04 UTC (rev 23074) +++ trunk/cgi-bin/LJ/S2.pm 2012-10-09 12:41:25 UTC (rev 23075) @@ -4057,9 +4057,7 @@ } } return $null_link unless LJ::u_equals($remote, $real_user); - } - - if ($key eq "edit_entry") { + } elsif ($key eq "edit_entry") { return $null_link if (LJ::is_enabled('entry_reference') && $this->{'real_itemid'}); return $null_link unless $remote && ( LJ::u_equals( $remote, $journalu ) || @@ -4088,14 +4086,10 @@ return LJ::S2::Link("$LJ::SITEROOT/edittags.bml?journal=$journal&itemid=$this->{'itemid'}", $ctx->[S2::PROPS]->{"text_edit_tags"}, LJ::S2::Image("$LJ::IMGPREFIX/btn_edittags.gif", 24, 24)); - } - - if ($key eq "tell_friend") { + } elsif ($key eq "tell_friend") { # after share this! has been nuked, this one is gone too return $null_link; - } - - if ( $key eq 'share') { + } elsif ( $key eq 'share') { return $null_link unless LJ::is_enabled('sharing') && $entry->is_public; @@ -4107,55 +4101,41 @@ $link->{'_raw'} = LJ::Share->render_js( { 'entry' => $entry } ); return $link; - } - - if ($key eq "share_facebook") { - + } elsif ($key eq "share_facebook") { return $null_link unless $entry->security eq 'public'; my $entry_url = LJ::eurl($entry->url); my $url = "http://www.facebook.com/sharer.php?u=$entry_url"; my $link = LJ::S2::Link($url, $ctx->[S2::PROPS]->{"text_share_facebook"}, LJ::S2::Image("$LJ::IMGPREFIX/btn_facebook.gif", 24, 24)); return $link; - } - - if ($key eq "share_twitter") { - + } elsif ($key eq "share_twitter") { return $null_link unless $entry->security eq 'public'; my $post_id = $entry->journalid . ':' . $entry->ditemid; my $entry_url = LJ::eurl($entry->url); my $entry_title = LJ::eurl($entry->subject_text); my $link = LJ::S2::Link("http://twitter.com/share?url=$entry_url&text=$entry_title", $ctx->[S2::PROPS]->{"text_share_twitter"}, LJ::S2::Image("$LJ::IMGPREFIX/twitter.gif", 24, 24)); return $link; - } + } elsif ($key eq "share_email") { - if ($key eq "share_email") { - return $null_link unless $entry->security eq 'public'; my $entry_url = LJ::eurl($entry->url); my $entry_title = LJ::eurl($entry->subject_text); my $url = "http://api.addthis.com/oexchange/0.8/forward/email/offer?username=internal&url=$entry_url&title=$entry_title"; my $link = LJ::S2::Link($url, $ctx->[S2::PROPS]->{"text_share_email"}, LJ::S2::Image("$LJ::IMGPREFIX/btn_email.gif", 24, 24)); return $link; - } + } elsif ($key eq "facebook_like") { - if ($key eq "facebook_like") { - return $null_link unless $entry->security eq 'public'; my $entry_url = LJ::eurl($entry->url); my $url = "http://www.facebook.com/plugins/like.php?href=$entry_url&layout=button_count&show_faces=false&width=150&action=like&colorscheme=dark&height=21"; my $link = LJ::S2::Link($url, 'caption unused', LJ::S2::Image("$LJ::IMGPREFIX/btn_facebook.gif", 24, 24)); $link->{_raw} = qq|<iframe src="$url" scrolling="no" frameborder="0" style="border:none;overflow:hidden;width:150px;height:21px;" allowTransparency="true"></iframe>|; return $link; - } - - if ($key eq "mem_add") { + } elsif ($key eq "mem_add") { return $null_link if ($LJ::DISABLED{'memories'} || $this->{delayedid}); return LJ::S2::Link("$LJ::SITEROOT/tools/memadd.bml?journal=$journal&itemid=$this->{'itemid'}", $ctx->[S2::PROPS]->{"text_mem_add"}, LJ::S2::Image("$LJ::IMGPREFIX/btn_memories.gif", 24, 24)); - } - - if ($key eq "nav_prev") { + } elsif ($key eq "nav_prev") { my $options = { 'use_sticky' => 1, 'itemid' => int($this->{'itemid'}/256), '_preview' => $this->{'_preview'}, @@ -4170,9 +4150,7 @@ } else { return $null_link; } - } - - if ($key eq "nav_next") { + } elsif ($key eq "nav_next") { my $options = { 'use_sticky' => 1, 'itemid' => int($this->{'itemid'}/256), }; @@ -4186,18 +4164,14 @@ } else { return $null_link; } - } - - if ($key eq "flag") { + } elsif ($key eq "flag") { return $null_link unless LJ::is_enabled("content_flag"); return $null_link unless $remote && $remote->can_see_content_flag_button( content => $entry ); return LJ::S2::Link(LJ::ContentFlag->adult_flag_url($entry), $ctx->[S2::PROPS]->{"text_flag"}, LJ::S2::Image("$LJ::IMGPREFIX/button-flag.gif", 24, 24)); - } - - if ($key eq "give_button") { + } elsif ($key eq "give_button") { return $null_link; }