[dw-free] Move cgi-bin/ljhooks.pl to LJ::Hooks module
[commit: http://hg.dwscoalition.org/dw-free/rev/780a3e3275f7]
http://bugs.dwscoalition.org/show_bug.cgi?id=2246
Move ljhooks.pl to LJ::Hooks module, update all callers. All hail find+sed.
Patch by
mark.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2246
Move ljhooks.pl to LJ::Hooks module, update all callers. All hail find+sed.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/moveucluster.pl
- bin/worker/incoming-email
- cgi-bin/Apache/LiveJournal.pm
- cgi-bin/DW/Hooks/Changelog.pm
- cgi-bin/DW/Hooks/Display.pm
- cgi-bin/DW/Hooks/HolidayPromotion.pm
- cgi-bin/DW/Hooks/NavStrip.pm
- cgi-bin/DW/Hooks/SSL.pm
- cgi-bin/DW/Hooks/SiteSearch.pm
- cgi-bin/DW/Shop/Cart.pm
- cgi-bin/DW/Widget/QuickUpdate.pm
- cgi-bin/DW/Widget/ShopCartStatusBar.pm
- cgi-bin/LJ/CleanHTML.pm
- cgi-bin/LJ/Console/Command/BanSet.pm
- cgi-bin/LJ/Console/Command/BanUnset.pm
- cgi-bin/LJ/Console/Command/ChangeJournalType.pm
- cgi-bin/LJ/Console/Command/Finduser.pm
- cgi-bin/LJ/Console/Command/SetBadpassword.pm
- cgi-bin/LJ/Customize.pm
- cgi-bin/LJ/EmbedModule.pm
- cgi-bin/LJ/Entry.pm
- cgi-bin/LJ/Event/Birthday.pm
- cgi-bin/LJ/Hooks.pm
- cgi-bin/LJ/Hooks/Setters.pm
- cgi-bin/LJ/Lang.pm
- cgi-bin/LJ/Message.pm
- cgi-bin/LJ/NotificationInbox.pm
- cgi-bin/LJ/NotificationMethod.pm
- cgi-bin/LJ/NotificationMethod/Email.pm
- cgi-bin/LJ/NotificationMethod/IM.pm
- cgi-bin/LJ/Poll.pm
- cgi-bin/LJ/QotD.pm
- cgi-bin/LJ/S2.pm
- cgi-bin/LJ/S2/DayPage.pm
- cgi-bin/LJ/S2/EntryPage.pm
- cgi-bin/LJ/S2/FriendsPage.pm
- cgi-bin/LJ/S2/RecentPage.pm
- cgi-bin/LJ/S2/ReplyPage.pm
- cgi-bin/LJ/Setting/Display/DomainMapping.pm
- cgi-bin/LJ/Setting/EmailPosting.pm
- cgi-bin/LJ/Setting/NavStrip.pm
- cgi-bin/LJ/Talk.pm
- cgi-bin/LJ/UniqCookie.pm
- cgi-bin/LJ/User.pm
- cgi-bin/LJ/Userpic.pm
- cgi-bin/LJ/Widget/AddQotD.pm
- cgi-bin/LJ/Widget/Browse.pm
- cgi-bin/LJ/Widget/CreateAccount.pm
- cgi-bin/LJ/Widget/CurrentTheme.pm
- cgi-bin/LJ/Widget/IPPU/SettingProd.pm
- cgi-bin/LJ/Widget/LinksList.pm
- cgi-bin/LJ/Widget/Login.pm
- cgi-bin/LJ/Widget/ManageQotD.pm
- cgi-bin/LJ/Widget/MoodThemeChooser.pm
- cgi-bin/LJ/Widget/PageNotice.pm
- cgi-bin/LJ/Widget/QotD.pm
- cgi-bin/LJ/Widget/S2PropGroup.pm
- cgi-bin/LJ/Widget/SubmitRequest.pm
- cgi-bin/LJ/Widget/ThemeChooser.pm
- cgi-bin/LJ/Widget/ThemeNav.pm
- cgi-bin/communitylib.pl
- cgi-bin/ljcapabilities.pl
- cgi-bin/ljcmdbuffer.pl
- cgi-bin/ljfeed.pl
- cgi-bin/ljhooks.pl
- cgi-bin/ljlib.pl
- cgi-bin/ljprotocol.pl
- cgi-bin/ljrelation.pl
- cgi-bin/ljtextutil.pl
- cgi-bin/ljuserpics.pl
- cgi-bin/modperl_subs.pl
- cgi-bin/weblib.pl
- htdocs/accountstatus.bml
- htdocs/admin/faq/faqedit.bml
- htdocs/admin/spamreports.bml
- htdocs/admin/userlog.bml
- htdocs/allpics.bml
- htdocs/changeemail.bml
- htdocs/changepassword.bml
- htdocs/community/create.bml
- htdocs/community/join.bml
- htdocs/community/manage.bml
- htdocs/community/pending.bml
- htdocs/community/search.bml
- htdocs/community/settings.bml
- htdocs/customize/advanced/index.bml
- htdocs/customize/advanced/layerbrowse.bml
- htdocs/customize/advanced/layeredit.bml
- htdocs/customize/advanced/layers.bml
- htdocs/customize/advanced/styles.bml
- htdocs/directory.bml
- htdocs/editjournal.bml
- htdocs/editpics.bml
- htdocs/extcss/index.bml
- htdocs/inbox/compose.bml
- htdocs/interests.bml
- htdocs/login.bml
- htdocs/logout.bml
- htdocs/lostinfo.bml
- htdocs/manage/circle/invite.bml
- htdocs/manage/emailpost.bml
- htdocs/manage/index.bml
- htdocs/manage/moodthemes.bml
- htdocs/manage/profile/index.bml
- htdocs/manage/settings/index.bml
- htdocs/moodlist.bml
- htdocs/multisearch.bml
- htdocs/poll/create.bml
- htdocs/postreg/index.bml
- htdocs/preview/entry.bml
- htdocs/register.bml
- htdocs/stats.bml
- htdocs/stc/fck/editor/dialog/imguploadrte.bml
- htdocs/support/append_request.bml
- htdocs/support/faqbrowse.bml
- htdocs/support/see_request.bml
- htdocs/syn/index.bml
- htdocs/talkpost.bml
- htdocs/talkread.bml
- htdocs/tools/endpoints/changerelation.bml
- htdocs/tools/endpoints/ctxpopup.bml
- htdocs/tools/endpoints/directorysearch.bml
- htdocs/tools/endpoints/esn_inbox.bml
- htdocs/translate/editpage.bml
- htdocs/update.bml
- t/00-compile.t
-------------------------------------------------------------------------------- diff -r b3b4673366b0 -r 780a3e3275f7 bin/moveucluster.pl --- a/bin/moveucluster.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/bin/moveucluster.pl Wed Dec 23 17:32:02 2009 +0000 @@ -554,7 +554,7 @@ sub moveUser { } else { die "Could not load module LJ::Event::UserExpunged: $@"; } - LJ::run_hooks('purged_user', $u); + LJ::Hooks::run_hooks('purged_user', $u); return 1; } diff -r b3b4673366b0 -r 780a3e3275f7 bin/worker/incoming-email --- a/bin/worker/incoming-email Wed Dec 23 09:57:04 2009 -0600 +++ b/bin/worker/incoming-email Wed Dec 23 17:32:02 2009 +0000 @@ -121,14 +121,14 @@ sub work { return dequeue("Virus found") if virus_check($entity); # see if a hook is registered to handle this message - if (LJ::are_hooks("incoming_email_handler")) { + if (LJ::Hooks::are_hooks("incoming_email_handler")) { my $errmsg = ""; my $retry = 0; # incoming_email_handler hook will return a true value # if it chose to handle this incoming email - my $rv = LJ::run_hook("incoming_email_handler", + my $rv = LJ::Hooks::run_hook("incoming_email_handler", entity => $entity, errmsg => \$errmsg, retry => \$retry); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/Apache/LiveJournal.pm --- a/cgi-bin/Apache/LiveJournal.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/Apache/LiveJournal.pm Wed Dec 23 17:32:02 2009 +0000 @@ -283,7 +283,7 @@ sub trans my $lang = $LJ::DEFAULT_LANG || $LJ::LANGS[0]; BML::set_language($lang, \&LJ::Lang::get_text); - my $is_ssl = $LJ::IS_SSL = LJ::run_hook("ssl_check", { + my $is_ssl = $LJ::IS_SSL = LJ::Hooks::run_hook("ssl_check", { r => $r, }); @@ -352,7 +352,7 @@ sub trans } else { return FORBIDDEN; } - } elsif (LJ::run_hook("set_alternate_statimg")) { + } elsif (LJ::Hooks::run_hook("set_alternate_statimg")) { # do nothing, hook did it. } else { $LJ::DEBUG_HOOK{'pre_restore_bak_stats'}->() if $LJ::DEBUG_HOOK{'pre_restore_bak_stats'}; @@ -429,7 +429,7 @@ sub trans return OK; } } - if ( LJ::run_hook( "forbid_request", $r ) ) { + if ( LJ::Hooks::run_hook( "forbid_request", $r ) ) { $r->handler( "perl-script" ); $r->push_handlers( PerlResponseHandler => \&blocked_bot ); return OK; @@ -600,7 +600,7 @@ sub trans $r->notes->{journalid} = $u->{userid}; } - my $file = LJ::run_hook("profile_bml_file"); + my $file = LJ::Hooks::run_hook("profile_bml_file"); $file ||= $LJ::PROFILE_BML_FILE || "userinfo.bml"; if ($args =~ /\bver=(\w+)\b/) { $file = $LJ::ALT_PROFILE_BML_FILE{$1} if $LJ::ALT_PROFILE_BML_FILE{$1}; @@ -634,7 +634,7 @@ sub trans $r->push_handlers(PerlResponseHandler => \&customview_content); return OK; } - if (my $handler = LJ::run_hook("data_handler:$mode", $RQ{'user'}, $path)) { + if (my $handler = LJ::Hooks::run_hook("data_handler:$mode", $RQ{'user'}, $path)) { $r->handler("perl-script"); $r->push_handlers(PerlResponseHandler => $handler); return OK; @@ -824,7 +824,7 @@ sub trans unless ($uri =~ m!^/(\w{1,25})(/.*)?$!) { return DECLINED if $uri eq "/favicon.ico"; - my $redir = LJ::run_hook("journal_subdomain_redirect_url", + my $redir = LJ::Hooks::run_hook("journal_subdomain_redirect_url", $host, $uri); return redir($r, $redir) if $redir; return 404; @@ -927,7 +927,7 @@ sub trans # custom interface handler if ($uri =~ m!^/interface/([\w\-]+)$!) { - my $inthandle = LJ::run_hook("interface_handler", { + my $inthandle = LJ::Hooks::run_hook("interface_handler", { int => $1, r => $r, bml_handler => $bml_handler, @@ -1256,7 +1256,7 @@ sub files_trans return 404 unless $r->uri =~ m!^/(\w{1,25})/(\w+)(/\S+)!; my ($user, $domain, $rest) = ($1, $2, $3); - if (my $handler = LJ::run_hook("files_handler:$domain", $user, $rest)) { + if (my $handler = LJ::Hooks::run_hook("files_handler:$domain", $user, $rest)) { $r->notes->{codepath} = "files.$domain"; $r->handler("perl-script"); $r->push_handlers(PerlResponseHandler => $handler); @@ -1278,7 +1278,7 @@ sub journal_content $u->preload_props("opt_blockrobots", "adult_content"); $r->content_type("text/plain"); - my @extra = LJ::run_hook("robots_txt_extra", $u), (); + my @extra = LJ::Hooks::run_hook("robots_txt_extra", $u), (); $r->print($_) foreach @extra; $r->print("User-Agent: *\n"); if ($u->should_block_robots) { @@ -1367,7 +1367,7 @@ sub journal_content my $html = LJ::make_journal($user, $RQ{'mode'}, $remote, $opts); # Allow to add extra http-header or even modify html - LJ::run_hooks("after_journal_content_created", $opts, \$html) unless $handle_with_siteviews; + LJ::Hooks::run_hooks("after_journal_content_created", $opts, \$html) unless $handle_with_siteviews; return redir($r, $opts->{'redir'}) if $opts->{'redir'}; return $opts->{'handler_return'} if defined $opts->{'handler_return'}; @@ -1511,8 +1511,8 @@ sub journal_content # add crap before </body> my $before_body_close = ""; - LJ::run_hooks("insert_html_before_body_close", \$before_body_close); - LJ::run_hooks("insert_html_before_journalctx_body_close", \$before_body_close); + LJ::Hooks::run_hooks("insert_html_before_body_close", \$before_body_close); + LJ::Hooks::run_hooks("insert_html_before_journalctx_body_close", \$before_body_close); # Insert pagestats HTML and Javascript $before_body_close .= LJ::pagestats_obj()->render('journal'); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/Changelog.pm --- a/cgi-bin/DW/Hooks/Changelog.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/Changelog.pm Wed Dec 23 17:32:02 2009 +0000 @@ -14,8 +14,9 @@ package DW::Hooks::Changelog;; package DW::Hooks::Changelog;; use strict; +use LJ::Hooks; -LJ::register_hook( 'post_noauth', sub { +LJ::Hooks::register_hook( 'post_noauth', sub { my $req = shift; # enable or not diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/Display.pm --- a/cgi-bin/DW/Hooks/Display.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/Display.pm Wed Dec 23 17:32:02 2009 +0000 @@ -16,12 +16,15 @@ package DW::Hooks::Display; +use strict; +use LJ::Hooks; + # Displays extra info on finduser results. Called as: -# LJ::run_hooks("finduser_extrainfo", $u }) +# LJ::Hooks::run_hooks("finduser_extrainfo", $u }) # Currently used to return paid status, expiration date, and number of # unused invite codes. -LJ::register_hook( 'finduser_extrainfo', sub { +LJ::Hooks::register_hook( 'finduser_extrainfo', sub { my $u = shift; my $ret; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/HolidayPromotion.pm --- a/cgi-bin/DW/Hooks/HolidayPromotion.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/HolidayPromotion.pm Wed Dec 23 17:32:02 2009 +0000 @@ -16,9 +16,10 @@ package DW::Hooks::HolidayPromotion; package DW::Hooks::HolidayPromotion; use strict; +use LJ::Hooks; # promotion HTML -LJ::register_hook( 'shop_cart_status_bar', sub { +LJ::Hooks::register_hook( 'shop_cart_status_bar', sub { my ( $shop, $cart, $retref ) = @_; # anonymous sessions can't benefit from the promotion @@ -33,7 +34,7 @@ LJ::register_hook( 'shop_cart_status_bar } ); # hook to add a new item when they purchase somethign eligibile -LJ::register_hook( 'shop_cart_added_item', sub { +LJ::Hooks::register_hook( 'shop_cart_added_item', sub { my ( $cart, $item ) = @_; # ignore promo linked items so we don't loop forever @@ -68,7 +69,7 @@ LJ::register_hook( 'shop_cart_added_item } ); # when they remove an item ... -LJ::register_hook( 'shop_cart_removed_item', sub { +LJ::Hooks::register_hook( 'shop_cart_removed_item', sub { my ( $cart, $item ) = @_; # don't do anything if we're removing a promo item diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/NavStrip.pm --- a/cgi-bin/DW/Hooks/NavStrip.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/NavStrip.pm Wed Dec 23 17:32:02 2009 +0000 @@ -17,7 +17,10 @@ package DW::Hooks::NavStrip; -LJ::register_hook( 'page_control_strip_options', sub { +use strict; +use LJ::Hooks; + +LJ::Hooks::register_hook( 'page_control_strip_options', sub { # if you add to the middle of the list, existing preferences will *break* return qw( journal.this @@ -26,7 +29,7 @@ LJ::register_hook( 'page_control_strip_o ); }); -LJ::register_hook( 'show_control_strip', sub { +LJ::Hooks::register_hook( 'show_control_strip', sub { return undef unless $LJ::USE_CONTROL_STRIP; return undef unless LJ::is_enabled( 'control_strip' ); @@ -40,7 +43,7 @@ LJ::register_hook( 'show_control_strip', # don't display if any of these are unavailable return undef unless $r && $journal; - my @pageoptions = LJ::run_hook( 'page_control_strip_options' ); + my @pageoptions = LJ::Hooks::run_hook( 'page_control_strip_options' ); return undef unless @pageoptions; my %pagemask = map { $pageoptions[$_] => 1 << $_ } 0..$#pageoptions; @@ -69,7 +72,7 @@ LJ::register_hook( 'show_control_strip', return undef; }); -LJ::register_hook( 'control_strip_stylesheet_link', sub { +LJ::Hooks::register_hook( 'control_strip_stylesheet_link', sub { my $remote = LJ::get_remote(); my $r = DW::Request->get; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/SSL.pm --- a/cgi-bin/DW/Hooks/SSL.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/SSL.pm Wed Dec 23 17:32:02 2009 +0000 @@ -15,8 +15,9 @@ package DW::Hooks::SSL; package DW::Hooks::SSL; use strict; +use LJ::Hooks; -LJ::register_hook( 'ssl_check', sub { +LJ::Hooks::register_hook( 'ssl_check', sub { my $r = $_[0]->{r} or return 0; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Hooks/SiteSearch.pm --- a/cgi-bin/DW/Hooks/SiteSearch.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Hooks/SiteSearch.pm Wed Dec 23 17:32:02 2009 +0000 @@ -17,8 +17,9 @@ package DW::Hooks::SiteSearch; package DW::Hooks::SiteSearch; use strict; +use LJ::Hooks; -LJ::register_hook( 'setprop', sub { +LJ::Hooks::register_hook( 'setprop', sub { my %opts = @_; return unless $opts{prop} eq 'opt_blockglobalsearch'; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Shop/Cart.pm --- a/cgi-bin/DW/Shop/Cart.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Shop/Cart.pm Wed Dec 23 17:32:02 2009 +0000 @@ -283,7 +283,7 @@ sub add_item { $self->{total} += $item->cost; # now call out to the hook system in case anybody wants to munge with us - LJ::run_hooks( 'shop_cart_added_item', $self, $item ); + LJ::Hooks::run_hooks( 'shop_cart_added_item', $self, $item ); # save to db and return $self->save || return( 0, 'Unable to save cart.' ); @@ -315,7 +315,7 @@ sub remove_item { $self->save; # now run the hook, this is later so that we've updated the cart already - LJ::run_hooks( 'shop_cart_removed_item', $self, $removed ); + LJ::Hooks::run_hooks( 'shop_cart_removed_item', $self, $removed ); return 1; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Widget/QuickUpdate.pm --- a/cgi-bin/DW/Widget/QuickUpdate.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Widget/QuickUpdate.pm Wed Dec 23 17:32:02 2009 +0000 @@ -28,7 +28,7 @@ sub render_body { or return; my $ret = "<h2>" . $class->ml( 'widget.quickupdate.title' ) . "</h2>"; - $ret .= "<div class='sidebar'>" . LJ::run_hook( 'entryforminfo', $remote->user, $remote ) . "</div>"; + $ret .= "<div class='sidebar'>" . LJ::Hooks::run_hook( 'entryforminfo', $remote->user, $remote ) . "</div>"; $ret .= "<div class='contents'>"; # not using the LJ::Widget form of the HTML methods, because we're directing this to update.bml diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/DW/Widget/ShopCartStatusBar.pm --- a/cgi-bin/DW/Widget/ShopCartStatusBar.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/DW/Widget/ShopCartStatusBar.pm Wed Dec 23 17:32:02 2009 +0000 @@ -53,7 +53,7 @@ sub render_body { } # call out to hooks to see if they want to munge with the content - LJ::run_hooks( 'shop_cart_status_bar', $shop, $cart, \$ret ); + LJ::Hooks::run_hooks( 'shop_cart_status_bar', $shop, $cart, \$ret ); return $ret; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/CleanHTML.pm --- a/cgi-bin/LJ/CleanHTML.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/CleanHTML.pm Wed Dec 23 17:32:02 2009 +0000 @@ -300,7 +300,7 @@ sub clean # can pass in tokens to override passing the hook the @capture array my ($token, $override_capture) = @_; my $capture = $override_capture ? [$token] : \@capture; - my $expanded = ($name =~ /^\w+$/) ? LJ::run_hook("expand_template_$name", $capture) : ""; + my $expanded = ($name =~ /^\w+$/) ? LJ::Hooks::run_hook("expand_template_$name", $capture) : ""; $newdata .= $expanded || "<b>[Error: unknown template '" . LJ::ehtml($name) . "']</b>"; }; @@ -316,17 +316,17 @@ sub clean # Capture object and embed tags to possibly transform them into something else. if ($tag eq "object" || $tag eq "embed") { - if (LJ::are_hooks("transform_embed") && !$noexpand_embedded) { + if (LJ::Hooks::are_hooks("transform_embed") && !$noexpand_embedded) { # XHTML style open/close tags done as a singleton shouldn't actually # start a capture loop, because there won't be a close tag. if ($attr->{'/'}) { - $newdata .= LJ::run_hook("transform_embed", [$token], + $newdata .= LJ::Hooks::run_hook("transform_embed", [$token], nocheck => $transform_embed_nocheck, wmode => $transform_embed_wmode) || ""; next TOKEN; } $start_capture->($tag, $token, sub { - my $expanded = LJ::run_hook("transform_embed", \@capture, + my $expanded = LJ::Hooks::run_hook("transform_embed", \@capture, nocheck => $transform_embed_nocheck, wmode => $transform_embed_wmode); $newdata .= $expanded || ""; }); @@ -345,7 +345,7 @@ sub clean if (($tag eq "div" || $tag eq "span") && lc $attr->{class} eq "ljvideo") { $start_capture->($tag, $token, sub { - my $expanded = LJ::run_hook("expand_template_video", \@capture); + my $expanded = LJ::Hooks::run_hook("expand_template_video", \@capture); $newdata .= $expanded || "<b>[Error: unknown template 'video']</b>"; }); next TOKEN; @@ -469,7 +469,7 @@ sub clean if ( LJ::is_enabled('css_cleaner') ) { my $cleaner = LJ::CSS::Cleaner->new; $style = $cleaner->clean($style); - LJ::run_hook('css_cleaner_transform', \$style); + LJ::Hooks::run_hook('css_cleaner_transform', \$style); if ($LJ::IS_DEV_SERVER) { $style = "/* cleaned */\n" . $style; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Console/Command/BanSet.pm --- a/cgi-bin/LJ/Console/Command/BanSet.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Console/Command/BanSet.pm Wed Dec 23 17:32:02 2009 +0000 @@ -62,7 +62,7 @@ sub execute { LJ::set_rel($journal, $banuser, 'B'); $journal->log_event('ban_set', { actiontarget => $banuser->id, remote => $remote }); - LJ::run_hooks('ban_set', $journal, $banuser); + LJ::Hooks::run_hooks('ban_set', $journal, $banuser); return $self->print("User " . $banuser->user . " banned from " . $journal->user); } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Console/Command/BanUnset.pm --- a/cgi-bin/LJ/Console/Command/BanUnset.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Console/Command/BanUnset.pm Wed Dec 23 17:32:02 2009 +0000 @@ -58,7 +58,7 @@ sub execute { LJ::clear_rel($journal, $banuser, 'B'); $journal->log_event('ban_unset', { actiontarget => $banuser->id, remote => $remote }); - LJ::run_hooks('ban_unset', $journal, $banuser); + LJ::Hooks::run_hooks('ban_unset', $journal, $banuser); return $self->print("User " . $banuser->user . " unbanned from " . $journal->user); } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Console/Command/ChangeJournalType.pm --- a/cgi-bin/LJ/Console/Command/ChangeJournalType.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Console/Command/ChangeJournalType.pm Wed Dec 23 17:32:02 2009 +0000 @@ -130,7 +130,7 @@ sub execute { LJ::set_rel_multi( [$u->id, $ou->id, 'A'], [$u->id, $ou->id, 'P'] ); } - LJ::run_hook("change_journal_type", $u); + LJ::Hooks::run_hook("change_journal_type", $u); ############################# # update the user info diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Console/Command/Finduser.pm --- a/cgi-bin/LJ/Console/Command/Finduser.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Console/Command/Finduser.pm Wed Dec 23 17:32:02 2009 +0000 @@ -113,7 +113,7 @@ sub execute { $self->info(" Last updated: " . ($timeupdate->{$userid} ? LJ::time_to_http($timeupdate->{$userid}) : "Never")) if $opt eq 'timeupdate'; - foreach (LJ::run_hooks("finduser_extrainfo", $u)) { + foreach (LJ::Hooks::run_hooks("finduser_extrainfo", $u)) { next unless $_->[0]; $self->info($_) foreach (split(/\n/, $_->[0])); } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Console/Command/SetBadpassword.pm --- a/cgi-bin/LJ/Console/Command/SetBadpassword.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Console/Command/SetBadpassword.pm Wed Dec 23 17:32:02 2009 +0000 @@ -79,7 +79,7 @@ sub execute { LJ::statushistory_add($u, $remote, "set_badpassword", $msg); # run the hook - my $hres = LJ::run_hook("set_badpassword", { + my $hres = LJ::Hooks::run_hook("set_badpassword", { 'user' => $u, 'on' => $on, 'reason' => $reason, diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Customize.pm --- a/cgi-bin/LJ/Customize.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Customize.pm Wed Dec 23 17:32:02 2009 +0000 @@ -256,7 +256,7 @@ sub get_layouts_for_dropdown { } sort { $pub->{$a}->{'name'} cmp $pub->{$b}->{'name'} } grep { my $tmp = $_; - my $is_active = LJ::run_hook("layer_is_active", $pub->{$tmp}->{uniq}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$tmp}->{uniq}); $tmp =~ /^\d+$/ && $pub->{$tmp}->{'type'} eq "layout" && $pub->{$tmp}->{'uniq'} ne "s1shortcomings/layout" && @@ -266,7 +266,7 @@ sub get_layouts_for_dropdown { # add custom layouts push @layouts, $class->get_custom_layouts_for_dropdown($u); - LJ::run_hook("modify_layout_list", \@layouts, user => $u, add_seps => 1); + LJ::Hooks::run_hook("modify_layout_list", \@layouts, user => $u, add_seps => 1); unshift @layouts, 0, LJ::Lang::ml('customize.layouts_for_dropdown.choose'); @@ -342,8 +342,8 @@ sub get_search_keywords_for_js { my @themes = LJ::S2Theme->load_all($u); foreach my $theme (@themes) { next unless $theme; - if (LJ::are_hooks("layer_is_active")) { - next unless LJ::run_hook("layer_is_active", $theme->uniq) && LJ::run_hook("layer_is_active", $theme->layout_uniq); + if (LJ::Hooks::are_hooks("layer_is_active")) { + next unless LJ::Hooks::run_hook("layer_is_active", $theme->uniq) && LJ::Hooks::run_hook("layer_is_active", $theme->layout_uniq); } my $theme_name = LJ::ejs($theme->name); @@ -684,7 +684,7 @@ sub get_cats { ); - LJ::run_hooks("modify_cat_list", \@categories, user => $u,); + LJ::Hooks::run_hooks("modify_cat_list", \@categories, user => $u,); return @categories; } @@ -824,11 +824,11 @@ sub get_moodtheme_select_list my @themes; while (my $moodtheme = $sth->fetchrow_hashref) { - my $is_active = LJ::run_hook("mood_theme_is_active", $moodtheme->{moodthemeid}); + my $is_active = LJ::Hooks::run_hook("mood_theme_is_active", $moodtheme->{moodthemeid}); next unless !defined $is_active || $is_active; push @themes, $moodtheme; } - LJ::run_hook('modify_mood_theme_list', \@themes, user => $u, add_seps => 1); + LJ::Hooks::run_hook('modify_mood_theme_list', \@themes, user => $u, add_seps => 1); unshift @themes, { 'moodthemeid' => 0, 'name' => '(None)' }; ### user's private themes diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/EmbedModule.pm --- a/cgi-bin/LJ/EmbedModule.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/EmbedModule.pm Wed Dec 23 17:32:02 2009 +0000 @@ -286,7 +286,7 @@ sub module_iframe_tag { ['E', 'lj-template', {}], ); - $embedcodes = LJ::run_hook('expand_template_video', \@tags); + $embedcodes = LJ::Hooks::run_hook('expand_template_video', \@tags); $found_embed = 1 if $embedcodes; $found_embed &&= $embedcodes !~ /Invalid video/i; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Entry.pm --- a/cgi-bin/LJ/Entry.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Entry.pm Wed Dec 23 17:32:02 2009 +0000 @@ -225,7 +225,7 @@ sub url { croak "Unknown args passed to url: " . join(",", keys %opts) if %opts; - my $override = LJ::run_hook("entry_permalink_override", $self, %opts); + my $override = LJ::Hooks::run_hook("entry_permalink_override", $self, %opts); return $override if $override; my $url = $u->journal_base . "/" . $self->ditemid . ".html"; @@ -928,7 +928,7 @@ sub is_special_qotd_entry { my $qotdid = $self->qotdid; my $poster = $self->poster; - if ($qotdid && $poster && LJ::run_hook("show_qotd_title_change", $poster)) { + if ($qotdid && $poster && LJ::Hooks::run_hook("show_qotd_title_change", $poster)) { return 1; } @@ -1872,7 +1872,7 @@ sub delete_entry LJ::MemCache::delete( [ $jid, "activeentries:$jid" ] ); LJ::MemCache::decr([$jid, "log2ct:$jid"]) if $dc > 0; LJ::memcache_kill($jid, "dayct2"); - LJ::run_hooks("deletepost", $jid, $jitemid, $anum); + LJ::Hooks::run_hooks("deletepost", $jid, $jitemid, $anum); # if this is running the second time (started by the cmd buffer), # the log2 row will already be gone and we shouldn't check for it. @@ -2127,7 +2127,7 @@ sub expand_embedded my ($u, $ditemid, $remote, $eventref, %opts) = @_; LJ::Poll->expand_entry($eventref) unless $opts{preview}; LJ::EmbedModule->expand_entry($u, $eventref, %opts); - LJ::run_hooks("expand_embedded", $u, $ditemid, $remote, $eventref, %opts); + LJ::Hooks::run_hooks("expand_embedded", $u, $ditemid, $remote, $eventref, %opts); } # <LJFUNC> diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Event/Birthday.pm --- a/cgi-bin/LJ/Event/Birthday.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Event/Birthday.pm Wed Dec 23 17:32:02 2009 +0000 @@ -134,7 +134,7 @@ sub _as_email { { 'esn.post_happy_bday' => [ 1, "$LJ::SITEROOT/update" ], }, - LJ::run_hook('birthday_notif_extra_' . ($is_html ? 'html' : 'plaintext'), $u) + LJ::Hooks::run_hook('birthday_notif_extra_' . ($is_html ? 'html' : 'plaintext'), $u) ); } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Hooks.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Hooks.pm Wed Dec 23 17:32:02 2009 +0000 @@ -0,0 +1,107 @@ +# This code was forked from the LiveJournal project owned and operated +# by Live Journal, Inc. The code has been modified and expanded by +# Dreamwidth Studios, LLC. These files were originally licensed under +# the terms of the license supplied by Live Journal, Inc, which can +# currently be found at: +# +# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt +# +# In accordance with the original license, this code and all its +# modifications are provided under the GNU General Public License. +# A copy of that license can be found in the LICENSE file included as +# part of this distribution. + +package LJ::Hooks; + +use strict; +use LJ::ModuleLoader; + +my $hooks_dir_scanned = 0; # bool: if we've loaded everything from cgi-bin/LJ/Hooks/ + +# <LJFUNC> +# name: LJ::Hooks::are_hooks +# des: Returns true if the site has one or more hooks installed for +# the given hookname. +# args: hookname +# </LJFUNC> +sub are_hooks { + my $hookname = shift; + _load_hooks_dir() unless $hooks_dir_scanned; + return defined $LJ::HOOKS{$hookname}; +} + +# <LJFUNC> +# name: LJ::Hooks::run_hooks +# des: Runs all the site-specific hooks of the given name. +# returns: list of arrayrefs, one for each hook ran, their +# contents being their own return values. +# args: hookname, args* +# des-args: Arguments to be passed to hook. +# </LJFUNC> +sub run_hooks { + my ($hookname, @args) = @_; + _load_hooks_dir() unless $hooks_dir_scanned; + + my @ret; + foreach my $hook (@{$LJ::HOOKS{$hookname} || []}) { + push @ret, [ $hook->(@args) ]; + } + return @ret; +} + +# <LJFUNC> +# name: LJ::Hooks::run_hook +# des: Runs single site-specific hook of the given name. +# returns: return value from hook +# args: hookname, args* +# des-args: Arguments to be passed to hook. +# </LJFUNC> +sub run_hook { + my ($hookname, @args) = @_; + _load_hooks_dir() unless $hooks_dir_scanned; + + return undef unless @{$LJ::HOOKS{$hookname} || []}; + return $LJ::HOOKS{$hookname}->[0]->(@args); +} + +# <LJFUNC> +# name: LJ::register_hook +# des: Installs a site-specific hook. +# info: Installing multiple hooks per hookname is valid. +# They're run later in the order they're registered. +# args: hookname, subref +# des-subref: Subroutine reference to run later. +# </LJFUNC> +sub register_hook { + my ( $hookname, $subref ) = @_; + push @{$LJ::HOOKS{$hookname} ||= []}, $subref; +} + +# loads all of the hooks in the hooks directory +sub _load_hooks_dir { + return if $hooks_dir_scanned++; + + # eh, not actually subclasses... just files named $class.pm + # $a::$b ==> cgi-bin/$a/$b + foreach my $class (LJ::ModuleLoader->module_subclasses("LJ::Hooks"), + LJ::ModuleLoader->module_subclasses("DW::Hooks")) { + eval "use $class;"; + die "Error loading $class: $@" if $@; + } +} + +# <LJFUNC> +# name: LJ::register_setter +# des: Installs code to run for the "set" command in the console. +# info: Setters can be general or site-specific. +# args: key, subref +# des-key: Key to set. +# des-subref: Subroutine reference to run later. +# </LJFUNC> +sub register_setter { + my ( $key, $subref ) = @_; + $LJ::SETTER{$key} = $subref; +} + + +1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Hooks/Setters.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Hooks/Setters.pm Wed Dec 23 17:32:02 2009 +0000 @@ -0,0 +1,132 @@ +# This code was forked from the LiveJournal project owned and operated +# by Live Journal, Inc. The code has been modified and expanded by +# Dreamwidth Studios, LLC. These files were originally licensed under +# the terms of the license supplied by Live Journal, Inc, which can +# currently be found at: +# +# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt +# +# In accordance with the original license, this code and all its +# modifications are provided under the GNU General Public License. +# A copy of that license can be found in the LICENSE file included as +# part of this distribution. + +package LJ; + +use strict; +use LJ::Hooks; + +LJ::Hooks::register_setter('synlevel', sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(title|cut|summary|full)$/) { + $$err = "Illegal value. Must be 'title', 'cut', 'summary', or 'full'"; + return 0; + } + + $u->set_prop("opt_synlevel", $value); + return 1; +}); + +LJ::Hooks::register_setter("newpost_minsecurity", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(public|access|members|private|friends)$/) { + $$err = "Illegal value. Must be 'public', 'access' (for personal journals), 'members' (for communities), or 'private'"; + return 0; + } + # Don't let commmunities be access-locked + if ( $u->is_community ) { + if ( $value eq "access" ) { + $$err = "newpost_minsecurity cannot be access-locked for communities (use 'members' instead)"; + return 0; + } + } + if ( $u->is_individual && $value eq "members" ) { + $$err = "newpost_minsecurity members not applicable to non-community journals. (use 'access' instead)"; + return 0; + } + + $value = "" if $value eq "public"; + $value = "friends" if $value eq "access" || $value eq "members"; + + $u->set_prop("newpost_minsecurity", $value); + return 1; +}); + +LJ::Hooks::register_setter("maximagesize", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ m/^(\d+)[x,|](\d+)$/) { + $$err = "Illegal value. Must be width,height."; + return 0; + } + $value = "$1|$2"; + $u->set_prop("opt_imagelinks", $value); + return 1; +}); + +LJ::Hooks::register_setter("opt_cut_disable_journal", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(0|1)$/) { + $$err = "Illegal value. Must be '0' or '1'"; + return 0; + } + $u->set_prop( "opt_cut_disable_journal", $value ); + return 1; +}); + +LJ::Hooks::register_setter("opt_cut_disable_reading", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(0|1)$/) { + $$err = "Illegal value. Must be '0' or '1'"; + return 0; + } + $u->set_prop( "opt_cut_disable_reading", $value ); + return 1; +}); + +LJ::Hooks::register_setter("disable_quickreply", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(0|1)$/) { + $$err = "Illegal value. Must be '0' or '1'"; + return 0; + } + $u->set_prop("opt_no_quickreply", $value); + return 1; +}); + +LJ::Hooks::register_setter("icbm", sub { + my ($u, $key, $value, $err) = @_; + my $loc = eval { LJ::Location->new(coords => $value); }; + unless ($loc) { + $u->set_prop("icbm", ""); # unset + $$err = "Illegal value. Not a recognized format." if $value; + return 0; + } + $u->set_prop("icbm", $loc->as_posneg_comma); + return 1; +}); + +LJ::Hooks::register_setter("no_mail_alias", sub { + my ($u, $key, $value, $err) = @_; + + unless ($value =~ /^[01]$/) { + $$err = "Illegal value. Must be '0' or '1'."; + return 0; + } + + $u->set_prop( "no_mail_alias", $value ); + $value ? $u->delete_email_alias : $u->update_email_alias; + + return 1; +}); + +LJ::Hooks::register_setter("latest_optout", sub { + my ($u, $key, $value, $err) = @_; + unless ($value =~ /^(?:yes|no)$/i) { + $$err = "Illegal value. Must be 'yes' or 'no'."; return 0; + } + $value = lc $value eq 'yes' ? 1 : 0; + $u->set_prop("latest_optout", $value); + return 1; +}); + +1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Lang.pm --- a/cgi-bin/LJ/Lang.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Lang.pm Wed Dec 23 17:32:02 2009 +0000 @@ -149,7 +149,7 @@ sub get_root_lang my $dom = shift; # from, say, get_dom return undef unless ref $dom eq "HASH"; - my $lang_override = LJ::run_hook("root_lang_override", $dom); + my $lang_override = LJ::Hooks::run_hook("root_lang_override", $dom); return get_lang($lang_override) if $lang_override; foreach (keys %{$dom->{'langs'}}) { @@ -355,8 +355,8 @@ sub web_set_text { my $resp = ''; my $hook_ran = 0; - if (LJ::are_hooks('web_set_text')) { - $hook_ran = LJ::run_hook('web_set_text', $dmid, $lncode, $itcode, $text, $opts); + if (LJ::Hooks::are_hooks('web_set_text')) { + $hook_ran = LJ::Hooks::run_hook('web_set_text', $dmid, $lncode, $itcode, $text, $opts); } # save in the db diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Message.pm --- a/cgi-bin/LJ/Message.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Message.pm Wed Dec 23 17:32:02 2009 +0000 @@ -404,7 +404,7 @@ sub can_send { # Will this message put sender over rate limit unless ($self->rate_multiple && $ou->rate_check('usermessage', $self->rate_multiple)) { my $up; - $up = LJ::run_hook('upgrade_message', $ou, 'message'); + $up = LJ::Hooks::run_hook('upgrade_message', $ou, 'message'); $up = "<br />$up" if ($up); push @$errors, "This message will exceed your limit and cannot be sent.$up"; return 0; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/NotificationInbox.pm --- a/cgi-bin/LJ/NotificationInbox.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/NotificationInbox.pm Wed Dec 23 17:32:02 2009 +0000 @@ -116,7 +116,7 @@ sub non_usermsg_items { UserMessageSent ); - @usermsg_events = (@usermsg_events, (LJ::run_hook('usermsg_notification_types') || ())); + @usermsg_events = (@usermsg_events, (LJ::Hooks::run_hook('usermsg_notification_types') || ())); my %usermsg_events = map { "LJ::Event::" . $_ => 1 } @usermsg_events; return grep { !$usermsg_events{$_->event->class} } $self->items; @@ -708,7 +708,7 @@ sub friend_event_list { CommunityInvite NewUserpic ); - @events = (@events, (LJ::run_hook('friend_notification_types') || ())); + @events = (@events, (LJ::Hooks::run_hook('friend_notification_types') || ())); return @events; } @@ -721,7 +721,7 @@ sub friendplus_event_list { NewUserpic Birthday ); - @events = (@events, (LJ::run_hook('friend_notification_types') || ())); + @events = (@events, (LJ::Hooks::run_hook('friend_notification_types') || ())); return @events; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/NotificationMethod.pm --- a/cgi-bin/LJ/NotificationMethod.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/NotificationMethod.pm Wed Dec 23 17:32:02 2009 +0000 @@ -42,7 +42,7 @@ sub available_for_user { sub available_for_user { my ($class, $u) = @_; - my $available = LJ::run_hook('notificationmethod_available_for_user', $class, $u); + my $available = LJ::Hooks::run_hook('notificationmethod_available_for_user', $class, $u); return defined $available ? $available : 1; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/NotificationMethod/Email.pm --- a/cgi-bin/LJ/NotificationMethod/Email.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/NotificationMethod/Email.pm Wed Dec 23 17:32:02 2009 +0000 @@ -80,17 +80,17 @@ sub notify { foreach my $ev (@events) { croak "invalid event passed" unless ref $ev; - $vars->{'hook'} = LJ::run_hook("esn_email_footer", $ev, $u); + $vars->{'hook'} = LJ::Hooks::run_hook("esn_email_footer", $ev, $u); my $footer = LJ::Lang::get_text($lang, 'esn.footer.text', undef, $vars); - my $plain_body = LJ::run_hook("esn_email_plaintext", $ev, $u); + my $plain_body = LJ::Hooks::run_hook("esn_email_plaintext", $ev, $u); unless ($plain_body) { $plain_body = $ev->as_email_string($u) or next; $plain_body .= $footer; } # run transform hook on plain body - LJ::run_hook("esn_email_text_transform", event => $ev, rcpt_u => $u, bodyref => \$plain_body); + LJ::Hooks::run_hook("esn_email_text_transform", event => $ev, rcpt_u => $u, bodyref => \$plain_body); my %headers = ( "X-LJ-Recipient" => $u->user, @@ -99,7 +99,7 @@ sub notify { ); my $email_subject = - LJ::run_hook("esn_email_subject", $ev, $u) || + LJ::Hooks::run_hook("esn_email_subject", $ev, $u) || $ev->as_email_subject($u); if ($LJ::_T_EMAIL_NOTIFICATION) { @@ -117,12 +117,12 @@ sub notify { }) or die "unable to send notification email"; } else { - my $html_body = LJ::run_hook("esn_email_html", $ev, $u); + my $html_body = LJ::Hooks::run_hook("esn_email_html", $ev, $u); unless ($html_body) { $html_body = $ev->as_email_html($u) or next; $html_body =~ s/\n/\n<br\/>/g unless $html_body =~ m!<br!i; - my $html_footer = LJ::run_hook('esn_email_html_footer', event => $ev, rcpt_u => $u ); + my $html_footer = LJ::Hooks::run_hook('esn_email_html_footer', event => $ev, rcpt_u => $u ); unless ($html_footer) { $html_footer = LJ::auto_linkify($footer); $html_footer =~ s/\n/\n<br\/>/g; @@ -133,7 +133,7 @@ sub notify { $html_body .= $html_footer; # run transform hook on html body - LJ::run_hook("esn_email_html_transform", event => $ev, rcpt_u => $u, bodyref => \$html_body); + LJ::Hooks::run_hook("esn_email_html_transform", event => $ev, rcpt_u => $u, bodyref => \$html_body); } LJ::send_mail({ diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/NotificationMethod/IM.pm --- a/cgi-bin/LJ/NotificationMethod/IM.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/NotificationMethod/IM.pm Wed Dec 23 17:32:02 2009 +0000 @@ -104,7 +104,7 @@ sub url { sub url { my $class = shift; - return LJ::run_hook('jabber_link'); + return LJ::Hooks::run_hook('jabber_link'); } 1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Poll.pm --- a/cgi-bin/LJ/Poll.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Poll.pm Wed Dec 23 17:32:02 2009 +0000 @@ -260,13 +260,13 @@ sub new_from_html { $popts{whoview} = "trusted" if $popts{whoview} eq "friends"; my $journal = LJ::load_userid($iteminfo->{posterid}); - if (LJ::run_hook("poll_unique_prop_is_enabled", $journal)) { + if (LJ::Hooks::run_hook("poll_unique_prop_is_enabled", $journal)) { $popts{props}->{unique} = $opts->{unique} ? 1 : 0; } - if (LJ::run_hook("poll_createdate_prop_is_enabled", $journal)) { + if (LJ::Hooks::run_hook("poll_createdate_prop_is_enabled", $journal)) { $popts{props}->{createdate} = $opts->{createdate} || undef; } - LJ::run_hook('get_more_options_from_poll', finalopts => \%popts, givenopts => $opts, journalu => $journal); + LJ::Hooks::run_hook('get_more_options_from_poll', finalopts => \%popts, givenopts => $opts, journalu => $journal); if ($popts{'whovote'} ne "all" && $popts{'whovote'} ne "trusted") @@ -716,14 +716,14 @@ sub is_unique { sub is_unique { my $self = shift; - return LJ::run_hook("poll_unique_prop_is_enabled", $self->poster) && $self->prop("unique") ? 1 : 0; + return LJ::Hooks::run_hook("poll_unique_prop_is_enabled", $self->poster) && $self->prop("unique") ? 1 : 0; } # poll requires voters to be created on or before a certain date sub is_createdate_restricted { my $self = shift; - return LJ::run_hook("poll_createdate_prop_is_enabled", $self->poster) && $self->prop("createdate") ? 1 : 0; + return LJ::Hooks::run_hook("poll_createdate_prop_is_enabled", $self->poster) && $self->prop("createdate") ? 1 : 0; } # do we have a valid poll? @@ -1155,7 +1155,7 @@ sub can_vote { } } - my $can_vote_override = LJ::run_hook("can_vote_poll_override", $self); + my $can_vote_override = LJ::Hooks::run_hook("can_vote_poll_override", $self); return 0 unless !defined $can_vote_override || $can_vote_override; return 1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/QotD.pm --- a/cgi-bin/LJ/QotD.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/QotD.pm Wed Dec 23 17:32:02 2009 +0000 @@ -176,7 +176,7 @@ sub filter_by_eff_class { my $u = shift; my @questions = @_; - my $eff_class = LJ::run_hook("qotd_get_eff_class", $u); + my $eff_class = LJ::Hooks::run_hook("qotd_get_eff_class", $u); return @questions unless $eff_class; my @questions_ret; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2.pm Wed Dec 23 17:32:02 2009 +0000 @@ -74,7 +74,7 @@ sub make_journal } my $lang = $remote && $remote->prop( "browselang" ); - LJ::run_hook('set_s2bml_lang', $ctx, \$lang); + LJ::Hooks::run_hook('set_s2bml_lang', $ctx, \$lang); # note that's it's very important to pass LJ::Lang::get_text here explicitly # rather than relying on BML::set_language's fallback mechanism, which won't @@ -152,7 +152,7 @@ sub make_journal return $page if $page && ref $page ne 'HASH'; # Include any head stc or js head content - LJ::run_hooks("need_res_for_journals", $u); + LJ::Hooks::run_hooks("need_res_for_journals", $u); my $extra_js = LJ::statusvis_message_js($u); $page->{head_content} .= LJ::res_includes() . $extra_js; @@ -533,7 +533,7 @@ sub get_layers_of_user { my ($u, $is_system, $infokeys) = @_; - my $subst_user = LJ::run_hook("substitute_s2_layers_user", $u); + my $subst_user = LJ::Hooks::run_hook("substitute_s2_layers_user", $u); if (defined $subst_user && LJ::isu($subst_user)) { $u = $subst_user; } @@ -845,7 +845,7 @@ sub escape_prop_value { } elsif ($mode eq 'css') { my $clean = $css_c->clean($_[0]); - LJ::run_hook('css_cleaner_transform', \$clean); + LJ::Hooks::run_hook('css_cleaner_transform', \$clean); $_[0] = $clean; } elsif ($mode eq 'css-attrib') { @@ -1478,7 +1478,7 @@ sub get_layout_themes next unless /^\d+$/; my $v = $src->{$_}; $v->{b2layer} = $src->{$src->{$_}->{b2lid}}; # include layout information - my $is_active = LJ::run_hook("layer_is_active", $v->{'uniq'}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $v->{'uniq'}); push @themes, $v if ($v->{type} eq "theme" && $layid && @@ -1573,7 +1573,7 @@ sub can_use_layer my ($u, $uniq) = @_; # $uniq = redist_uniq value return 1 if $u->can_create_s2_styles; return 0 unless $uniq; - return 1 if LJ::run_hook('s2_can_use_layer', { + return 1 if LJ::Hooks::run_hook('s2_can_use_layer', { u => $u, uniq => $uniq, }); @@ -1832,7 +1832,7 @@ sub Entry $e->{'mood_icon'} = Image($pic{'pic'}, $pic{'w'}, $pic{'h'}) if LJ::get_mood_picture($theme, $mid, \%pic); if (my $mood = LJ::mood_name($mid)) { - my $extra = LJ::run_hook("current_mood_extra", $theme) || ""; + my $extra = LJ::Hooks::run_hook("current_mood_extra", $theme) || ""; $e->{'metadata'}->{'mood'} = "$mood$extra"; } } @@ -2090,8 +2090,8 @@ sub Page $p->{'head_content'} .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $opts->{'saycharset'} . "\" />\n"; } - if (LJ::are_hooks('s2_head_content_extra')) { - $p->{head_content} .= LJ::run_hook('s2_head_content_extra', $remote, $opts->{r}); + if (LJ::Hooks::are_hooks('s2_head_content_extra')) { + $p->{head_content} .= LJ::Hooks::run_hook('s2_head_content_extra', $remote, $opts->{r}); } # Automatic Discovery of RSS/Atom @@ -2114,9 +2114,9 @@ sub Page $p->{head_content} .= qq{<link rel="help" href="$LJ::SITEROOT/support/faq" />\n}; # Control strip - my $show_control_strip = LJ::run_hook( 'show_control_strip' ); + my $show_control_strip = LJ::Hooks::run_hook( 'show_control_strip' ); if ($show_control_strip) { - LJ::run_hook( 'control_strip_stylesheet_link' ); + LJ::Hooks::run_hook( 'control_strip_stylesheet_link' ); $p->{'head_content'} .= LJ::control_strip_js_inject( user => $u->{user} ); } @@ -2409,7 +2409,7 @@ sub end_css { my $cleaner = LJ::CSS::Cleaner->new; my $clean = $cleaner->clean($css); - LJ::run_hook('css_cleaner_transform', \$clean); + LJ::Hooks::run_hook('css_cleaner_transform', \$clean); $sc->{_start_css_pout}->("/* Cleaned CSS: */\n" . $clean . @@ -2599,7 +2599,7 @@ sub viewer_sees_control_strip return 0 unless $LJ::USE_CONTROL_STRIP; my $r = BML::get_request(); - return LJ::run_hook( 'show_control_strip' ); + return LJ::Hooks::run_hook( 'show_control_strip' ); } # maintained only for compatibility with core1, eventually these can be removed @@ -2620,7 +2620,7 @@ sub control_strip_logged_out_userpic_css my $u = LJ::load_userid($r->notes->{journalid}); return '' unless $u; - return LJ::run_hook('control_strip_userpic', $u); + return LJ::Hooks::run_hook('control_strip_userpic', $u); } sub control_strip_logged_out_full_userpic_css @@ -2629,7 +2629,7 @@ sub control_strip_logged_out_full_userpi my $u = LJ::load_userid($r->notes->{journalid}); return '' unless $u; - return LJ::run_hook('control_strip_loggedout_userpic', $u); + return LJ::Hooks::run_hook('control_strip_loggedout_userpic', $u); } sub weekdays @@ -2682,11 +2682,11 @@ sub style_is_active { my $themeid = $ctx->[S2::LAYERLIST]->[2]; my $pub = LJ::S2::get_public_layers(); - my $layout_is_active = LJ::run_hook("layer_is_active", $pub->{$layoutid}->{uniq}); + my $layout_is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$layoutid}->{uniq}); return 0 unless !defined $layout_is_active || $layout_is_active; if (defined $themeid) { - my $theme_is_active = LJ::run_hook("layer_is_active", $pub->{$themeid}->{uniq}); + my $theme_is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$themeid}->{uniq}); return 0 unless !defined $theme_is_active || $theme_is_active; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2/DayPage.pm --- a/cgi-bin/LJ/S2/DayPage.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2/DayPage.pm Wed Dec 23 17:32:02 2009 +0000 @@ -119,7 +119,7 @@ sub DayPage # add S2 Entry object to page push @{$p->{entries}}, $entry; - LJ::run_hook('notify_event_displayed', $entry_obj); + LJ::Hooks::run_hook('notify_event_displayed', $entry_obj); } if (@{$p->{'entries'}}) { diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2/EntryPage.pm --- a/cgi-bin/LJ/S2/EntryPage.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2/EntryPage.pm Wed Dec 23 17:32:02 2009 +0000 @@ -95,7 +95,7 @@ sub EntryPage )); $p->{'entry'} = $s2entry; - LJ::run_hook('notify_event_displayed', $entry); + LJ::Hooks::run_hook('notify_event_displayed', $entry); # add the comments my $view_arg = $get->{'view'} || ""; @@ -489,7 +489,7 @@ sub EntryPage_entry while (my ($kwid, $kw) = each %$tag_map) { push @taglist, Tag($u, $kwid => $kw); } - LJ::run_hooks('augment_s2_tag_list', u => $u, jitemid => $itemid, tag_list => \@taglist); + LJ::Hooks::run_hooks('augment_s2_tag_list', u => $u, jitemid => $itemid, tag_list => \@taglist); @taglist = sort { $a->{name} cmp $b->{name} } @taglist; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2/FriendsPage.pm --- a/cgi-bin/LJ/S2/FriendsPage.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2/FriendsPage.pm Wed Dec 23 17:32:02 2009 +0000 @@ -205,7 +205,7 @@ sub FriendsPage push @{$p->{'entries'}}, $entry; $eventnum++; - LJ::run_hook('notify_event_displayed', $entry_obj); + LJ::Hooks::run_hook('notify_event_displayed', $entry_obj); } # end while # set the new_day and end_day members. diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2/RecentPage.pm --- a/cgi-bin/LJ/S2/RecentPage.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2/RecentPage.pm Wed Dec 23 17:32:02 2009 +0000 @@ -177,7 +177,7 @@ sub RecentPage push @{$p->{entries}}, $entry; - LJ::run_hook('notify_event_displayed', $entry_obj); + LJ::Hooks::run_hook('notify_event_displayed', $entry_obj); } # mark last entry as closing. diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/S2/ReplyPage.pm --- a/cgi-bin/LJ/S2/ReplyPage.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/S2/ReplyPage.pm Wed Dec 23 17:32:02 2009 +0000 @@ -69,7 +69,7 @@ sub ReplyPage } $p->{'entry'} = $s2entry; - LJ::run_hook('notify_event_displayed', $entry); + LJ::Hooks::run_hook('notify_event_displayed', $entry); # setup the replying item my $replyto = $s2entry; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Setting/Display/DomainMapping.pm --- a/cgi-bin/LJ/Setting/Display/DomainMapping.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Setting/Display/DomainMapping.pm Wed Dec 23 17:32:02 2009 +0000 @@ -32,8 +32,8 @@ sub actionlink { my ($class, $u) = @_; my $has_domain = $u->prop("journaldomain") ? 1 : 0; - my $upgrade_url = LJ::run_hook("upgrade_link", $u, "plus", url_only => 1) || ""; - my $upgrade_link = LJ::run_hook("upgrade_link", $u, "plus") || ""; + my $upgrade_url = LJ::Hooks::run_hook("upgrade_link", $u, "plus", url_only => 1) || ""; + my $upgrade_link = LJ::Hooks::run_hook("upgrade_link", $u, "plus") || ""; if ( $u->can_map_domains ) { return "<a href='$LJ::SITEROOT/manage/domain?authas=" . $u->user . "'>" . $class->ml('setting.display.domainmapping.actionlink') . "</a>"; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Setting/EmailPosting.pm --- a/cgi-bin/LJ/Setting/EmailPosting.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Setting/EmailPosting.pm Wed Dec 23 17:32:02 2009 +0000 @@ -39,7 +39,7 @@ sub option { my $key = $class->pkgkey; my $can_emailpost = $u->can_emailpost; - my $upgrade_link = $can_emailpost ? "" : LJ::run_hook("upgrade_link", $u, "plus"); + my $upgrade_link = $can_emailpost ? "" : LJ::Hooks::run_hook("upgrade_link", $u, "plus"); my $addrlist = LJ::Emailpost::get_allowed_senders($u); my @addresses = sort keys %$addrlist; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Setting/NavStrip.pm --- a/cgi-bin/LJ/Setting/NavStrip.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Setting/NavStrip.pm Wed Dec 23 17:32:02 2009 +0000 @@ -46,7 +46,7 @@ sub option { my ( $class, $u, $errs, $args ) = @_; my $key = $class->pkgkey; - my @pageoptions = LJ::run_hook( 'page_control_strip_options' ); + my @pageoptions = LJ::Hooks::run_hook( 'page_control_strip_options' ); return undef unless @pageoptions; my %pagemask = map { $pageoptions[$_] => 1 << $_ } 0..$#pageoptions; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Talk.pm --- a/cgi-bin/LJ/Talk.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Talk.pm Wed Dec 23 17:32:02 2009 +0000 @@ -1292,7 +1292,7 @@ sub talkform { # special link to create an account my $create_link; if (!$remote || defined $oid_identity) { - $create_link = LJ::run_hook("override_create_link_on_talkpost_form", $journalu); + $create_link = LJ::Hooks::run_hook("override_create_link_on_talkpost_form", $journalu); $ret .= $create_link; } @@ -2318,7 +2318,7 @@ sub mail_comments { # it is possible to register a hook which will intercept this entire conditional block # and do its own logic... if that's the case and the hook returns true, then we'll # skip creating the email notification - && ! LJ::run_hook("talklib_email_parent_comment_poster", + && ! LJ::Hooks::run_hook("talklib_email_parent_comment_poster", user => $paru, journal => $journalu, talkid => $comment->{talkid} ) ) @@ -3161,7 +3161,7 @@ sub init { } if ($up) { - if ($up->{'status'} eq "N" && !$up->is_identity && !LJ::run_hook("journal_allows_unvalidated_commenting", $journalu)) { + if ($up->{'status'} eq "N" && !$up->is_identity && !LJ::Hooks::run_hook("journal_allows_unvalidated_commenting", $journalu)) { $err->(BML::ml("$SC.error.noverify2", {'aopts' => "href='$LJ::SITEROOT/register'"})); } @@ -3448,7 +3448,7 @@ sub post_comment { # cluster tracking LJ::mark_user_active($comment->{u}, 'comment'); - LJ::run_hooks('new_comment', $journalu->{userid}, $item->{itemid}, $jtalkid); + LJ::Hooks::run_hooks('new_comment', $journalu->{userid}, $item->{itemid}, $jtalkid); return 1; } @@ -3513,7 +3513,7 @@ sub edit_comment { # send some emails mail_comments($entryu, $journalu, $parent, $comment, $item); - LJ::run_hooks('edit_comment', $journalu->{userid}, $item->{itemid}, $comment->{talkid}); + LJ::Hooks::run_hooks('edit_comment', $journalu->{userid}, $item->{itemid}, $comment->{talkid}); return 1; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/UniqCookie.pm --- a/cgi-bin/LJ/UniqCookie.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/UniqCookie.pm Wed Dec 23 17:32:02 2009 +0000 @@ -414,8 +414,8 @@ sub ensure_cookie_value { my $new_cookie_value = "$uniq:$now"; my $hook_saved_mapping = 0; - if (LJ::are_hooks('transform_ljuniq_value')) { - $new_cookie_value = LJ::run_hook + if (LJ::Hooks::are_hooks('transform_ljuniq_value')) { + $new_cookie_value = LJ::Hooks::run_hook ('transform_ljuniq_value', { value => $new_cookie_value, extra => $uniq_extra, diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/User.pm Wed Dec 23 17:32:02 2009 +0000 @@ -106,8 +106,8 @@ sub can_expunge { return 0 unless $u->statusvisdate_unix < time() - 86400*$expunge_days; my $hook_rv = 0; - if (LJ::are_hooks("can_expunge_user", $u)) { - $hook_rv = LJ::run_hook("can_expunge_user", $u); + if (LJ::Hooks::are_hooks("can_expunge_user", $u)) { + $hook_rv = LJ::Hooks::run_hook("can_expunge_user", $u); return $hook_rv ? 1 : 0; } @@ -179,7 +179,7 @@ sub create { } } - LJ::run_hooks("post_create", { + LJ::Hooks::run_hooks("post_create", { 'userid' => $userid, 'user' => $username, 'code' => undef, @@ -222,7 +222,7 @@ sub create_personal { $u->set_next_birthday; # Set the default style - LJ::run_hook('set_default_style', $u); + LJ::Hooks::run_hook('set_default_style', $u); if ( $opts{inviter} ) { # store inviter, if there was one @@ -466,7 +466,7 @@ sub set_deleted { my $res = $u->set_statusvis('D'); # run any account cancellation hooks - LJ::run_hooks("account_delete", $u); + LJ::Hooks::run_hooks("account_delete", $u); return $res; } @@ -542,9 +542,9 @@ sub set_suspended { LJ::statushistory_add($u, $who, "suspend", $reason); - LJ::run_hooks("account_cancel", $u); - - if (my $err = LJ::run_hook("cdn_purge_userpics", $u)) { + LJ::Hooks::run_hooks("account_cancel", $u); + + if (my $err = LJ::Hooks::run_hook("cdn_purge_userpics", $u)) { $$errref = $err if ref $errref and $err; return 0; } @@ -628,7 +628,7 @@ sub info_for_js { # Without url_message "Send Message" link should not display $ret{url_message} = $u->message_url unless ($u->opt_usermsg eq 'N'); - LJ::run_hook("extra_info_for_js", $u, \%ret); + LJ::Hooks::run_hook("extra_info_for_js", $u, \%ret); my $up = $u->userpic; @@ -1001,7 +1001,7 @@ sub make_login_session { # run some hooks my @sopts; - LJ::run_hooks("login_add_opts", { + LJ::Hooks::run_hooks("login_add_opts", { "u" => $u, "form" => {}, "opts" => \@sopts @@ -1010,7 +1010,7 @@ sub make_login_session { $sess->flags($sopts); my $etime = $sess->expiration_time; - LJ::run_hooks("post_login", { + LJ::Hooks::run_hooks("post_login", { "u" => $u, "form" => {}, "expiretime" => $etime, @@ -1762,8 +1762,8 @@ sub add_to_class { # call add_to_class hook before we modify the # current $u, so it can make inferences from the # old $u caps vs the new we say we'll be adding - if (LJ::are_hooks('add_to_class')) { - LJ::run_hooks('add_to_class', $u, $class); + if (LJ::Hooks::are_hooks('add_to_class')) { + LJ::Hooks::run_hooks('add_to_class', $u, $class); } return LJ::modify_caps($u, [$bit], []); @@ -2046,7 +2046,7 @@ sub control_strip_display { # otherwise, return the default: all options checked my $ret; - my @pageoptions = LJ::run_hook( 'page_control_strip_options' ); + my @pageoptions = LJ::Hooks::run_hook( 'page_control_strip_options' ); for ( my $i = 0; $i < scalar @pageoptions; $i++ ) { $ret |= 1 << $i; } @@ -2288,7 +2288,7 @@ sub large_journal_icon { # hook will return image to use if it cares about # the $u it's been passed - my $hook_img = LJ::run_hook("large_journal_icon", $u); + my $hook_img = LJ::Hooks::run_hook("large_journal_icon", $u); return $wrap_img->($hook_img) if $hook_img; if ($u->is_comm) { @@ -2504,8 +2504,8 @@ sub remove_from_class { # call remove_from_class hook before we modify the # current $u, so it can make inferences from the # old $u caps vs what we'll be removing - if (LJ::are_hooks('remove_from_class')) { - LJ::run_hooks('remove_from_class', $u, $class); + if (LJ::Hooks::are_hooks('remove_from_class')) { + LJ::Hooks::run_hooks('remove_from_class', $u, $class); } return LJ::modify_caps($u, [], [$bit]); @@ -2686,7 +2686,7 @@ sub display_name { require Net::OpenID::Consumer; $url = $id->value; $name = Net::OpenID::VerifiedIdentity::DisplayOfURL($url, $LJ::IS_DEV_SERVER); - $name = LJ::run_hook("identity_display_name", $name) || $name; + $name = LJ::Hooks::run_hook("identity_display_name", $name) || $name; ## Unescape %xx sequences $name =~ s/%([\dA-Fa-f]{2})/chr(hex($1))/ge; @@ -2964,7 +2964,7 @@ sub ban_user_multi { my $us = LJ::load_userids(@banlist); foreach my $banuid (@banlist) { $u->log_event('ban_set', { actiontarget => $banuid, remote => LJ::get_remote() }); - LJ::run_hooks('ban_set', $u, $us->{$banuid}) if $us->{$banuid}; + LJ::Hooks::run_hooks('ban_set', $u, $us->{$banuid}) if $us->{$banuid}; } return 1; @@ -2987,7 +2987,7 @@ sub unban_user_multi { my $us = LJ::load_userids(@unbanlist); foreach my $banuid (@unbanlist) { $u->log_event('ban_unset', { actiontarget => $banuid, remote => LJ::get_remote() }); - LJ::run_hooks('ban_unset', $u, $us->{$banuid}) if $us->{$banuid}; + LJ::Hooks::run_hooks('ban_unset', $u, $us->{$banuid}) if $us->{$banuid}; } return 1; @@ -4401,7 +4401,7 @@ sub set_interests { push @new_intids, $intid; } } - LJ::run_hooks("set_interests", $u, \%int_del, \@new_intids); # interest => intid + LJ::Hooks::run_hooks("set_interests", $u, \%int_del, \@new_intids); # interest => intid # do migrations to clean up userinterests vs comminterests conflicts $u->lazy_interests_cleanup; @@ -4938,7 +4938,7 @@ sub show_control_strip { sub show_control_strip { my $u = shift; - LJ::run_hook('control_strip_propcheck', $u, 'show_control_strip') if LJ::is_enabled('control_strip_propcheck'); + LJ::Hooks::run_hook('control_strip_propcheck', $u, 'show_control_strip') if LJ::is_enabled('control_strip_propcheck'); my $prop = $u->raw_prop('show_control_strip'); return 0 if $prop =~ /^off/; @@ -4952,7 +4952,7 @@ sub view_control_strip { sub view_control_strip { my $u = shift; - LJ::run_hook('control_strip_propcheck', $u, 'view_control_strip') if LJ::is_enabled('control_strip_propcheck'); + LJ::Hooks::run_hook('control_strip_propcheck', $u, 'view_control_strip') if LJ::is_enabled('control_strip_propcheck'); my $prop = $u->raw_prop('view_control_strip'); return 0 if $prop =~ /^off/; @@ -6559,7 +6559,7 @@ sub update_user } # log this updates - LJ::run_hooks("update_user", userid => $_, fields => $ref) + LJ::Hooks::run_hooks("update_user", userid => $_, fields => $ref) for @uid; return 1; @@ -6833,7 +6833,7 @@ sub ljuser my $url = $u->journal_base . "/"; my $head_size = $opts->{head_size}; - if (my ($icon, $size) = LJ::run_hook("head_icon", $u, head_size => $head_size)) { + if (my ($icon, $size) = LJ::Hooks::run_hook("head_icon", $u, head_size => $head_size)) { return $make_tag->($icon, $url, $size || 16) if $icon; } @@ -7075,12 +7075,12 @@ sub modify_caps { my %cap_del_mod = (); # convert capnames to bit numbers - if (LJ::are_hooks("get_cap_bit")) { + if (LJ::Hooks::are_hooks("get_cap_bit")) { foreach my $bit (@$cap_add, @$cap_del) { next if $bit =~ /^\d+$/; # bit is a magical reference into the array - $bit = LJ::run_hook("get_cap_bit", $bit); + $bit = LJ::Hooks::run_hook("get_cap_bit", $bit); } } @@ -7107,8 +7107,8 @@ sub modify_caps { } # run hooks for modified bits - if (LJ::are_hooks("modify_caps")) { - $res = LJ::run_hook("modify_caps", + if (LJ::Hooks::are_hooks("modify_caps")) { + $res = LJ::Hooks::run_hook("modify_caps", { 'u' => $u, 'newcaps' => $newcaps, 'oldcaps' => $u->{'caps'}, @@ -7161,7 +7161,7 @@ sub set_userprop foreach $propname (keys %$hash) { # call all hooks, since we don't look at the return values. we expect anybody who # uses this hook to do extra work a property needs when it is set. - LJ::run_hooks( 'setprop', prop => $propname, u => $u, value => $value ); + LJ::Hooks::run_hooks( 'setprop', prop => $propname, u => $u, value => $value ); my $p = LJ::get_prop("user", $propname) or die "Invalid userprop $propname passed to LJ::set_userprop."; @@ -8066,7 +8066,7 @@ sub journal_base { my ($user, $vhost) = @_; - if (! isu($user) && LJ::are_hooks("journal_base")) { + if (! isu($user) && LJ::Hooks::are_hooks("journal_base")) { my $u = LJ::load_user($user); $user = $u if $u; } @@ -8074,7 +8074,7 @@ sub journal_base if (isu($user)) { my $u = $user; - my $hookurl = LJ::run_hook("journal_base", $u, $vhost); + my $hookurl = LJ::Hooks::run_hook("journal_base", $u, $vhost); return $hookurl if $hookurl; $user = $u->user; @@ -8246,7 +8246,7 @@ sub make_journal } my $forceflag = 0; - LJ::run_hooks("force_s1", $u, \$forceflag); + LJ::Hooks::run_hooks("force_s1", $u, \$forceflag); # if none of the above match, they fall through to here if ( !$forceflag && $u->{'stylesys'} == 2 ) { @@ -8343,7 +8343,7 @@ sub make_journal } if ($view eq "network" && ! LJ::get_cap($u, "friendsfriendsview")) { my $inline; - if ($inline .= LJ::run_hook("cprod_inline", $u, 'FriendsFriendsInline')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'FriendsFriendsInline')) { return $inline; } else { return BML::ml('cprod.friendsfriendsinline.text3.v1'); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Userpic.pm --- a/cgi-bin/LJ/Userpic.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Userpic.pm Wed Dec 23 17:32:02 2009 +0000 @@ -291,7 +291,7 @@ sub url { sub url { my $self = shift; - if (my $hook_path = LJ::run_hook('construct_userpic_url', $self)) { + if (my $hook_path = LJ::Hooks::run_hook('construct_userpic_url', $self)) { return $hook_path; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/AddQotD.pm --- a/cgi-bin/LJ/Widget/AddQotD.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/AddQotD.pm Wed Dec 23 17:32:02 2009 +0000 @@ -182,7 +182,7 @@ sub render_body { value => $impression_url ) . "<br />"; $ret .= "<small>Use <code>[[uniq]]</code> in the URL to have a unique identifier placed there automatically.</small></td></tr>"; - my $hook_rv = LJ::run_hook("qotd_class_checkboxes", class => $class, classes => \@classes, show_logged_out => $show_logged_out); + my $hook_rv = LJ::Hooks::run_hook("qotd_class_checkboxes", class => $class, classes => \@classes, show_logged_out => $show_logged_out); if ($hook_rv) { $ret .= "<tr><td valign='top'>$hook_rv"; @@ -267,7 +267,7 @@ sub handle_post { die "Invalid user: $from_user" unless LJ::isu($from_u); } - LJ::run_hook("qotd_class_checkboxes_post", $post); + LJ::Hooks::run_hook("qotd_class_checkboxes_post", $post); # Make sure at least one class was given die "At least one class of users must be given." diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/Browse.pm --- a/cgi-bin/LJ/Widget/Browse.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/Browse.pm Wed Dec 23 17:32:02 2009 +0000 @@ -54,7 +54,7 @@ sub render_body { $ret .= "<p><a href='$LJ::SITEROOT/random'><strong>" . $class->ml('widget.browse.extras.random') . "</strong></a><br />"; $ret .= $class->ml('widget.browse.extras.random.desc') . "</p>"; $ret .= "</div>"; - $ret .= LJ::run_hook('browse_widget_extras'); + $ret .= LJ::Hooks::run_hook('browse_widget_extras'); $ret .= "</div>"; $ret .= "</div>"; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/CreateAccount.pm --- a/cgi-bin/LJ/Widget/CreateAccount.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/CreateAccount.pm Wed Dec 23 17:32:02 2009 +0000 @@ -546,7 +546,7 @@ sub handle_post { customizeurl => "$LJ::SITEROOT/customize/", postentryurl => "$LJ::SITEROOT/update", setsecreturl => "$LJ::SITEROOT/set_secret", - LJ::run_hook('extra_fields_in_postreg_esn'), + LJ::Hooks::run_hook('extra_fields_in_postreg_esn'), }); LJ::send_mail({ @@ -579,7 +579,7 @@ sub handle_post { my $stop_output; my $body; my $redirect = $opts{ret}; - LJ::run_hook('underage_redirect', { + LJ::Hooks::run_hook('underage_redirect', { u => $nu, redirect => \$redirect, ret => \$body, @@ -588,7 +588,7 @@ sub handle_post { return BML::redirect($redirect) if $redirect; return $body if $stop_output; - $redirect = LJ::run_hook('rewrite_redirect_after_create', $nu); + $redirect = LJ::Hooks::run_hook('rewrite_redirect_after_create', $nu); return BML::redirect($redirect) if $redirect; return BML::redirect( "$LJ::SITEROOT/create/setup" ); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/CurrentTheme.pm --- a/cgi-bin/LJ/Widget/CurrentTheme.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/CurrentTheme.pm Wed Dec 23 17:32:02 2009 +0000 @@ -35,7 +35,7 @@ sub render_body { my $showarg = $opts{show} != 12 ? "&show=$opts{show}" : ""; my $no_theme_chooser = defined $opts{no_theme_chooser} ? $opts{no_theme_chooser} : 0; - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $u); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $u); my $theme = LJ::Customize->get_current_theme($u); my $userlay = LJ::S2::get_layers_of_user($u); @@ -53,7 +53,7 @@ sub render_body { $ret .= "<p class='theme-current-desc'>"; if ($designer) { my $designer_link = "<a href='$LJ::SITEROOT/customize/$getextra${getsep}designer=" . LJ::eurl($designer) . "$showarg' class='theme-current-designer'>$designer</a>"; - if (LJ::run_hook("layer_is_special", $theme->uniq)) { + if (LJ::Hooks::run_hook("layer_is_special", $theme->uniq)) { $ret .= $class->ml('widget.currenttheme.specialdesc', {'aopts' => $special_link_opts, 'designer' => $designer_link}); } else { $ret .= $class->ml('widget.currenttheme.desc', {'layout' => $layout_link, 'designer' => $designer_link}); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/IPPU/SettingProd.pm --- a/cgi-bin/LJ/Widget/IPPU/SettingProd.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/IPPU/SettingProd.pm Wed Dec 23 17:32:02 2009 +0000 @@ -54,7 +54,7 @@ sub render_body { "</span></p>"; my $ret; - LJ::run_hooks('campaign_tracking', \$ret, + LJ::Hooks::run_hooks('campaign_tracking', \$ret, { cname => 'Popup Setting Display' } ); $body .= $ret; @@ -79,7 +79,7 @@ sub handle_post { my $xtra; my $postvars = join(",", $setting_class->settings($post)); - LJ::run_hooks('campaign_tracking', \$xtra, + LJ::Hooks::run_hooks('campaign_tracking', \$xtra, { cname => 'Popup Setting Submitted', trackvars => "$postvars", } ); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/LinksList.pm --- a/cgi-bin/LJ/Widget/LinksList.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/LinksList.pm Wed Dec 23 17:32:02 2009 +0000 @@ -91,7 +91,7 @@ sub render_body { } my $inline; if ($ct >= $caplinks) { - if ($inline .= LJ::run_hook("cprod_inline", $u, 'Links')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'Links')) { $ret .= $inline; } else { $ret .= "</td></tr><tr><td colspan='2'> </td><td>" . LJ::Lang::ml('cprod.links.text3.v1'); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/Login.pm --- a/cgi-bin/LJ/Widget/Login.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/Login.pm Wed Dec 23 17:32:02 2009 +0000 @@ -44,7 +44,7 @@ sub render_body { } my $root = $LJ::IS_SSL ? $LJ::SSLROOT : $LJ::SITEROOT; - my $form_class = LJ::run_hook("login_form_class_name_$opts{mode}"); + my $form_class = LJ::Hooks::run_hook("login_form_class_name_$opts{mode}"); $form_class = "lj_login_form pkg" unless $form_class; $ret .= "<form action='$root/login$getextra' method='post' class='$form_class'>\n"; $ret .= LJ::form_auth(); @@ -68,7 +68,7 @@ sub render_body { $ret .= LJ::html_hidden('returnto', $opts{returnto}); } - my $hook_rv = LJ::run_hook("login_form_$opts{mode}", create_link => $opts{create_link}); + my $hook_rv = LJ::Hooks::run_hook("login_form_$opts{mode}", create_link => $opts{create_link}); if ($hook_rv) { $ret .= $hook_rv; } else { @@ -130,10 +130,10 @@ sub render_body { } $ret .= LJ::help_icon('securelogin', ' '); - if (LJ::are_hooks("login_formopts")) { + if (LJ::Hooks::are_hooks("login_formopts")) { $ret .= "<table>"; $ret .= "<tr><td>" . LJ::Lang::ml('/login.bml.login.otheropts') . "</td><td style='white-space: nowrap'>\n"; - LJ::run_hooks("login_formopts", { 'ret' => \$ret }); + LJ::Hooks::run_hooks("login_formopts", { 'ret' => \$ret }); $ret .= "</td></tr></table>"; } } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/ManageQotD.pm --- a/cgi-bin/LJ/Widget/ManageQotD.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/ManageQotD.pm Wed Dec 23 17:32:02 2009 +0000 @@ -90,7 +90,7 @@ sub table_display { $ret .= "<th>Domain</th><th>Who Sees Question</th><th>Countries</th><th>Tags</th><th>Submitted By</th><th>Start Date</th><th>End Date</th><th colspan='2'>Active Status</th><th>Edit</th></tr>"; foreach my $row (@questions) { my @classes = LJ::classes_from_mask($row->{cap_mask}); - @classes = LJ::run_hook("qotd_filter_classes", @classes); + @classes = LJ::Hooks::run_hook("qotd_filter_classes", @classes); push @classes, "logged out" if $row->{show_logged_out} eq 'Y'; my $class_list = join(', ', @classes); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/MoodThemeChooser.pm --- a/cgi-bin/LJ/Widget/MoodThemeChooser.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/MoodThemeChooser.pm Wed Dec 23 17:32:02 2009 +0000 @@ -63,7 +63,7 @@ sub render_body { $ret .= "</ul>"; $ret .= "</div>"; - my $moodtheme_extra = LJ::run_hook("mood_theme_extra_content", $u, \@themes); + my $moodtheme_extra = LJ::Hooks::run_hook("mood_theme_extra_content", $u, \@themes); my $show_special = $moodtheme_extra ? "special" : "nospecial"; LJ::load_mood_theme($preview_moodthemeid); diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/PageNotice.pm --- a/cgi-bin/LJ/Widget/PageNotice.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/PageNotice.pm Wed Dec 23 17:32:02 2009 +0000 @@ -25,7 +25,7 @@ sub render_body { my $ret; my $remote = LJ::get_remote(); - my $content = LJ::run_hook("page_notice_content", notice_key => $opts{notice_key}); + my $content = LJ::Hooks::run_hook("page_notice_content", notice_key => $opts{notice_key}); if ($content) { $ret .= $class->html_hidden({ name => "notice_key", value => $opts{notice_key}, id => "notice_key" }); @@ -47,7 +47,7 @@ sub should_render_for_remote { my $notice_key = $opts{notice_key}; return 0 unless $notice_key; - return 0 unless LJ::run_hook("page_notice_content", notice_key => $notice_key); + return 0 unless LJ::Hooks::run_hook("page_notice_content", notice_key => $notice_key); return 1 unless $remote; return $remote->has_dismissed_page_notice($notice_key) ? 0 : 1; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/QotD.pm --- a/cgi-bin/LJ/Widget/QotD.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/QotD.pm Wed Dec 23 17:32:02 2009 +0000 @@ -39,7 +39,7 @@ sub render_body { return "" unless @questions; unless ($embed || $archive) { - my $title = LJ::run_hook("qotd_title", $u) || $class->ml('widget.qotd.title'); + my $title = LJ::Hooks::run_hook("qotd_title", $u) || $class->ml('widget.qotd.title'); $ret .= "<h2>$title"; } @@ -117,7 +117,7 @@ sub qotd_display_embed { } my $extra_text; - if ($q->{extra_text} && LJ::run_hook('show_qotd_extra_text', $remote)) { + if ($q->{extra_text} && LJ::Hooks::run_hook('show_qotd_extra_text', $remote)) { $extra_text = $q->{extra_text}; LJ::CleanHTML::clean_event(\$extra_text); } @@ -195,7 +195,7 @@ sub qotd_display { LJ::CleanHTML::clean_event(\$text); my $extra_text; - if ($q->{extra_text} && LJ::run_hook('show_qotd_extra_text', $remote)) { + if ($q->{extra_text} && LJ::Hooks::run_hook('show_qotd_extra_text', $remote)) { $ml_key = $class->ml_key("$q->{qid}.extra_text"); $extra_text = $class->ml($ml_key); LJ::CleanHTML::clean_event(\$extra_text); @@ -236,7 +236,7 @@ sub qotd_display { } # show promo on vertical pages - $ret .= LJ::run_hook("promo_with_qotd", $opts{domain}); + $ret .= LJ::Hooks::run_hook("promo_with_qotd", $opts{domain}); $ret .= "</div>"; } @@ -249,7 +249,7 @@ sub answer_link { my %opts = @_; my $url = $class->answer_url($question, user => $opts{user}); - my $txt = LJ::run_hook("qotd_answer_txt", $opts{user}) || $class->ml('widget.qotd.answer'); + my $txt = LJ::Hooks::run_hook("qotd_answer_txt", $opts{user}) || $class->ml('widget.qotd.answer'); my $dis = $opts{button_disabled} ? "disabled='disabled'" : ""; my $onclick = qq{onclick="document.location.href='$url'"}; @@ -273,7 +273,7 @@ sub subject_text { my %opts = @_; my $ml_key = $class->ml_key("$question->{qid}.subject"); - my $subject = LJ::run_hook("qotd_subject", $opts{user}, $class->ml($ml_key)) || + my $subject = LJ::Hooks::run_hook("qotd_subject", $opts{user}, $class->ml($ml_key)) || $class->ml('widget.qotd.entry.subject', {'subject' => $class->ml($ml_key)}); return $subject; @@ -296,7 +296,7 @@ sub event_text { my $event = $class->ml($ml_key); my $from_user = $question->{from_user}; - my $extra_text = LJ::run_hook('show_qotd_extra_text', $remote) ? $question->{extra_text} : ""; + my $extra_text = LJ::Hooks::run_hook('show_qotd_extra_text', $remote) ? $question->{extra_text} : ""; if ($from_user || $extra_text) { $event .= "\n<span style='font-size: smaller;'>"; @@ -328,7 +328,7 @@ sub impression_img { $impression_url = LJ::PromoText->parse_url( qid => $question->{qid}, url => $question->{impression_url} ); } - return $impression_url && LJ::run_hook("should_see_special_content", LJ::get_remote()) ? "<img src=\"$impression_url\" border='0' width='1' height='1' alt='' />" : ""; + return $impression_url && LJ::Hooks::run_hook("should_see_special_content", LJ::get_remote()) ? "<img src=\"$impression_url\" border='0' width='1' height='1' alt='' />" : ""; } sub questions_exist_for_user { diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/S2PropGroup.pm --- a/cgi-bin/LJ/Widget/S2PropGroup.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/S2PropGroup.pm Wed Dec 23 17:32:02 2009 +0000 @@ -267,7 +267,7 @@ sub skip_prop { return 1 if $prop_name eq "control_strip_bordercolor"; return 1 if $prop_name eq "control_strip_linkcolor"; - my $hook_rv = LJ::run_hook("skip_prop_override", $prop_name, user => $opts{user}, theme => $theme, style => $opts{style}); + my $hook_rv = LJ::Hooks::run_hook("skip_prop_override", $prop_name, user => $opts{user}, theme => $theme, style => $opts{style}); return $hook_rv if $hook_rv; return 0; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/SubmitRequest.pm --- a/cgi-bin/LJ/Widget/SubmitRequest.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/SubmitRequest.pm Wed Dec 23 17:32:02 2009 +0000 @@ -81,7 +81,7 @@ sub render_body { } $ret .= $class->html_select(name => 'spcatid', list => \@choices, selected => $post->{spcatid}); - $ret .= LJ::run_hook("support_request_cat_extra_text"); + $ret .= LJ::Hooks::run_hook("support_request_cat_extra_text"); $ret .= "</p></div>"; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/ThemeChooser.pm --- a/cgi-bin/LJ/Widget/ThemeChooser.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/ThemeChooser.pm Wed Dec 23 17:32:02 2009 +0000 @@ -92,12 +92,12 @@ sub render_body { sort { lc $a->name cmp lc $b->name } @themes; } - LJ::run_hooks("modify_theme_list", \@themes, user => $u, cat => $cat); + LJ::Hooks::run_hooks("modify_theme_list", \@themes, user => $u, cat => $cat); # remove any themes from the array that are not defined or whose layout or theme is not active for (my $i = 0; $i < @themes; $i++) { - my $layout_is_active = LJ::run_hook("layer_is_active", $themes[$i]->layout_uniq); - my $theme_is_active = LJ::run_hook("layer_is_active", $themes[$i]->uniq); + my $layout_is_active = LJ::Hooks::run_hook("layer_is_active", $themes[$i]->layout_uniq); + my $theme_is_active = LJ::Hooks::run_hook("layer_is_active", $themes[$i]->uniq); unless ((defined $themes[$i]) && (!defined $layout_is_active || $layout_is_active) && @@ -151,14 +151,14 @@ sub render_body { $theme_types{current} = 1 if $theme->layoutid == $current_theme->layoutid; } $theme_types{upgrade} = 1 if !$theme->available_to($u); - $theme_types{special} = 1 if LJ::run_hook("layer_is_special", $theme->uniq); + $theme_types{special} = 1 if LJ::Hooks::run_hook("layer_is_special", $theme->uniq); my ($theme_class, $theme_options, $theme_icons) = ("", "", ""); $theme_icons .= "<div class='theme-icons'>" if $theme_types{upgrade} || $theme_types{special}; if ($theme_types{current}) { - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $u); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $u); $theme_class .= " current"; $theme_options .= "<strong><a href='$LJ::SITEROOT/customize/options$getextra'>" . $class->ml('widget.themechooser.theme.customize') . "</a></strong>"; @@ -174,12 +174,12 @@ sub render_body { if ($theme_types{upgrade}) { $theme_class .= " upgrade"; $theme_options .= "<br />" if $theme_options; - $theme_options .= LJ::run_hook("customize_special_options", $u, $theme); - $theme_icons .= LJ::run_hook("customize_special_icons", $u, $theme); + $theme_options .= LJ::Hooks::run_hook("customize_special_options", $u, $theme); + $theme_icons .= LJ::Hooks::run_hook("customize_special_icons", $u, $theme); } if ($theme_types{special}) { - $theme_class .= " special" if $viewing_featured && LJ::run_hook("should_see_special_content", $u); - $theme_icons .= LJ::run_hook("customize_available_until", $theme); + $theme_class .= " special" if $viewing_featured && LJ::Hooks::run_hook("should_see_special_content", $u); + $theme_icons .= LJ::Hooks::run_hook("customize_available_until", $theme); } $theme_icons .= "</div><!-- end .theme-icons -->" if $theme_icons; @@ -339,7 +339,7 @@ sub handle_post { my $layoutid = $post->{apply_layoutid}+0; # we need to load sponsor's themes for sponsored users - my $substitue_user = LJ::run_hook("substitute_s2_layers_user", $u); + my $substitue_user = LJ::Hooks::run_hook("substitute_s2_layers_user", $u); my $effective_u = defined $substitue_user ? $substitue_user : $u; my $theme; if ($themeid) { @@ -351,7 +351,7 @@ sub handle_post { } LJ::Customize->apply_theme($u, $theme); - LJ::run_hooks('apply_theme', $u); + LJ::Hooks::run_hooks('apply_theme', $u); return; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/LJ/Widget/ThemeNav.pm --- a/cgi-bin/LJ/Widget/ThemeNav.pm Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/LJ/Widget/ThemeNav.pm Wed Dec 23 17:32:02 2009 +0000 @@ -118,7 +118,7 @@ sub render_body { $ret .= "<ul class='theme-nav-small nostyle'>"; $ret .= "<li class='first'><a href='$LJ::SITEROOT/customize/advanced/'>" . $class->ml('widget.themenav.developer') . "</a>"; - $ret .= LJ::run_hook('customize_advanced_area_upsell', $u) . "</li>"; + $ret .= LJ::Hooks::run_hook('customize_advanced_area_upsell', $u) . "</li>"; $ret .= "</ul>"; $ret .= "</div>"; @@ -151,8 +151,8 @@ sub print_cat_list { my @special_themes = LJ::S2Theme->load_by_cat("special"); my $special_themes_exist = 0; foreach my $special_theme (@special_themes) { - my $layout_is_active = LJ::run_hook("layer_is_active", $special_theme->layout_uniq); - my $theme_is_active = LJ::run_hook("layer_is_active", $special_theme->uniq); + my $layout_is_active = LJ::Hooks::run_hook("layer_is_active", $special_theme->layout_uniq); + my $theme_is_active = LJ::Hooks::run_hook("layer_is_active", $special_theme->uniq); if ($layout_is_active && $theme_is_active) { $special_themes_exist = 1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/communitylib.pl --- a/cgi-bin/communitylib.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/communitylib.pl Wed Dec 23 17:32:02 2009 +0000 @@ -577,7 +577,7 @@ sub maintainer_linkbar { my $username = $comm->user; my @links; - my %manage_link_info = LJ::run_hook('community_manage_link_info', $username); + my %manage_link_info = LJ::Hooks::run_hook('community_manage_link_info', $username); if (keys %manage_link_info) { push @links, $page eq "account" ? "<strong>$manage_link_info{text}</strong>" : diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljcapabilities.pl --- a/cgi-bin/ljcapabilities.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljcapabilities.pl Wed Dec 23 17:32:02 2009 +0000 @@ -134,9 +134,9 @@ sub caps_string { # </LJFUNC> sub user_caps_icon { - return undef unless LJ::are_hooks("user_caps_icon"); + return undef unless LJ::Hooks::are_hooks("user_caps_icon"); my $caps = shift; - return LJ::run_hook("user_caps_icon", $caps); + return LJ::Hooks::run_hook("user_caps_icon", $caps); } # <LJFUNC> @@ -206,11 +206,11 @@ sub get_cap } # is there a hook for this cap name? - if (! $opts->{no_hook} && LJ::are_hooks("check_cap_$cname")) { + if (! $opts->{no_hook} && LJ::Hooks::are_hooks("check_cap_$cname")) { die "Hook 'check_cap_$cname' requires full user object" unless LJ::isu($u); - my $val = LJ::run_hook("check_cap_$cname", $u); + my $val = LJ::Hooks::run_hook("check_cap_$cname", $u); return $val if defined $val; # otherwise fall back to standard means diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljcmdbuffer.pl --- a/cgi-bin/ljcmdbuffer.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljcmdbuffer.pl Wed Dec 23 17:32:02 2009 +0000 @@ -156,8 +156,8 @@ sub get_property { return $c->{$prop}; } - if (LJ::are_hooks("cmdbuf:$cmd:$prop")) { - return LJ::run_hook("cmdbuf:$cmd:$prop"); + if (LJ::Hooks::are_hooks("cmdbuf:$cmd:$prop")) { + return LJ::Hooks::run_hook("cmdbuf:$cmd:$prop"); } return undef; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljfeed.pl --- a/cgi-bin/ljfeed.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljfeed.pl Wed Dec 23 17:32:02 2009 +0000 @@ -305,7 +305,7 @@ sub create_view_rss # header $ret .= "<?xml version='1.0' encoding='$opts->{'saycharset'}' ?>\n"; - $ret .= LJ::run_hook("bot_director", "<!-- ", " -->") . "\n"; + $ret .= LJ::Hooks::run_hook("bot_director", "<!-- ", " -->") . "\n"; $ret .= "<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' " . "xmlns:atom10='http://www.w3.org/2005/Atom'>\n"; @@ -370,7 +370,7 @@ sub create_view_rss } $ret .= " <category>$_</category>\n" foreach map { LJ::exml($_) } @{$it->{tags} || []}; # support 'podcasting' enclosures - $ret .= LJ::run_hook( "pp_rss_enclosure", + $ret .= LJ::Hooks::run_hook( "pp_rss_enclosure", { userid => $u->{userid}, ppid => $it->{ppid} }) if $it->{ppid}; # TODO: add author field with posterid's email address, respect communities $ret .= " <lj:music>" . LJ::exml($it->{music}) . "</lj:music>\n" if $it->{music}; @@ -450,7 +450,7 @@ sub create_view_atom $xml->getDocumentElement->setAttribute( "idx:index", "no" ); } - $xml->insertBefore( $xml->createComment( LJ::run_hook("bot_director") ), $xml->documentElement()); + $xml->insertBefore( $xml->createComment( LJ::Hooks::run_hook("bot_director") ), $xml->documentElement()); # attributes $feed->id( "urn:lj:$LJ::DOMAIN:atom1:$u->{user}" ); @@ -636,7 +636,7 @@ sub create_view_foaf { # create bare foaf document, for now $ret = "<?xml version='1.0'?>\n"; - $ret .= LJ::run_hook("bot_director", "<!-- ", " -->"); + $ret .= LJ::Hooks::run_hook("bot_director", "<!-- ", " -->"); $ret .= "<rdf:RDF\n"; $ret .= " xml:lang=\"en\"\n"; $ret .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; @@ -847,7 +847,7 @@ sub create_view_yadis { # Local site-specific content # TODO: Give these hooks access to $view somehow? - LJ::run_hook("yadis_service_descriptors", \$ret); + LJ::Hooks::run_hook("yadis_service_descriptors", \$ret); $println->('</XRD></xrds:XRDS>'); return $ret; @@ -888,7 +888,7 @@ sub create_view_userpics { $xml->getDocumentElement->setAttribute( "idx:index", "no" ); } - my $bot = LJ::run_hook("bot_director"); + my $bot = LJ::Hooks::run_hook("bot_director"); $xml->insertBefore( $xml->createComment( $bot ), $xml->documentElement()) if $bot; @@ -1001,7 +1001,7 @@ sub create_view_comments my $ret; $ret .= "<?xml version='1.0' encoding='$opts->{'saycharset'}' ?>\n"; - $ret .= LJ::run_hook("bot_director", "<!-- ", " -->") . "\n"; + $ret .= LJ::Hooks::run_hook("bot_director", "<!-- ", " -->") . "\n"; $ret .= "<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>\n"; # channel attributes diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljhooks.pl --- a/cgi-bin/ljhooks.pl Wed Dec 23 09:57:04 2009 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -# This code was forked from the LiveJournal project owned and operated -# by Live Journal, Inc. The code has been modified and expanded by -# Dreamwidth Studios, LLC. These files were originally licensed under -# the terms of the license supplied by Live Journal, Inc, which can -# currently be found at: -# -# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt -# -# In accordance with the original license, this code and all its -# modifications are provided under the GNU General Public License. -# A copy of that license can be found in the LICENSE file included as -# part of this distribution. - -package LJ; -use strict; -use LJ::ModuleLoader; - -my $hooks_dir_scanned = 0; # bool: if we've loaded everything from cgi-bin/LJ/Hooks/ - -# <LJFUNC> -# name: LJ::are_hooks -# des: Returns true if the site has one or more hooks installed for -# the given hookname. -# args: hookname -# </LJFUNC> -sub are_hooks -{ - my $hookname = shift; - load_hooks_dir() unless $hooks_dir_scanned; - return defined $LJ::HOOKS{$hookname}; -} - -# <LJFUNC> -# name: LJ::run_hooks -# des: Runs all the site-specific hooks of the given name. -# returns: list of arrayrefs, one for each hook ran, their -# contents being their own return values. -# args: hookname, args* -# des-args: Arguments to be passed to hook. -# </LJFUNC> -sub run_hooks -{ - my ($hookname, @args) = @_; - load_hooks_dir() unless $hooks_dir_scanned; - - my @ret; - foreach my $hook (@{$LJ::HOOKS{$hookname} || []}) { - push @ret, [ $hook->(@args) ]; - } - return @ret; -} - -# <LJFUNC> -# name: LJ::run_hook -# des: Runs single site-specific hook of the given name. -# returns: return value from hook -# args: hookname, args* -# des-args: Arguments to be passed to hook. -# </LJFUNC> -sub run_hook -{ - my ($hookname, @args) = @_; - load_hooks_dir() unless $hooks_dir_scanned; - - return undef unless @{$LJ::HOOKS{$hookname} || []}; - return $LJ::HOOKS{$hookname}->[0]->(@args); -} - -# <LJFUNC> -# name: LJ::register_hook -# des: Installs a site-specific hook. -# info: Installing multiple hooks per hookname is valid. -# They're run later in the order they're registered. -# args: hookname, subref -# des-subref: Subroutine reference to run later. -# </LJFUNC> -sub register_hook -{ - my $hookname = shift; - my $subref = shift; - push @{$LJ::HOOKS{$hookname}}, $subref; -} - -sub load_hooks_dir { - return if $hooks_dir_scanned++; - - # eh, not actually subclasses... just files named $class.pm - # $a::$b ==> cgi-bin/$a/$b - foreach my $class (LJ::ModuleLoader->module_subclasses("LJ::Hooks"), - LJ::ModuleLoader->module_subclasses("DW::Hooks")) { - eval "use $class;"; - die "Error loading $class: $@" if $@; - } -} - -# <LJFUNC> -# name: LJ::register_setter -# des: Installs code to run for the "set" command in the console. -# info: Setters can be general or site-specific. -# args: key, subref -# des-key: Key to set. -# des-subref: Subroutine reference to run later. -# </LJFUNC> -sub register_setter -{ - my $key = shift; - my $subref = shift; - $LJ::SETTER{$key} = $subref; -} - -register_setter('synlevel', sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(title|cut|summary|full)$/) { - $$err = "Illegal value. Must be 'title', 'cut', 'summary', or 'full'"; - return 0; - } - - $u->set_prop("opt_synlevel", $value); - return 1; -}); - -register_setter("newpost_minsecurity", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(public|access|members|private|friends)$/) { - $$err = "Illegal value. Must be 'public', 'access' (for personal journals), 'members' (for communities), or 'private'"; - return 0; - } - # Don't let commmunities be access-locked - if ( $u->is_community ) { - if ( $value eq "access" ) { - $$err = "newpost_minsecurity cannot be access-locked for communities (use 'members' instead)"; - return 0; - } - } - if ( $u->is_individual && $value eq "members" ) { - $$err = "newpost_minsecurity members not applicable to non-community journals. (use 'access' instead)"; - return 0; - } - - $value = "" if $value eq "public"; - $value = "friends" if $value eq "access" || $value eq "members"; - - $u->set_prop("newpost_minsecurity", $value); - return 1; -}); - -register_setter("maximagesize", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ m/^(\d+)[x,|](\d+)$/) { - $$err = "Illegal value. Must be width,height."; - return 0; - } - $value = "$1|$2"; - $u->set_prop("opt_imagelinks", $value); - return 1; -}); - -register_setter("opt_cut_disable_journal", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(0|1)$/) { - $$err = "Illegal value. Must be '0' or '1'"; - return 0; - } - $u->set_prop( "opt_cut_disable_journal", $value ); - return 1; -}); - -register_setter("opt_cut_disable_reading", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(0|1)$/) { - $$err = "Illegal value. Must be '0' or '1'"; - return 0; - } - $u->set_prop( "opt_cut_disable_reading", $value ); - return 1; -}); - -register_setter("disable_quickreply", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(0|1)$/) { - $$err = "Illegal value. Must be '0' or '1'"; - return 0; - } - $u->set_prop("opt_no_quickreply", $value); - return 1; -}); - -register_setter("icbm", sub { - my ($u, $key, $value, $err) = @_; - my $loc = eval { LJ::Location->new(coords => $value); }; - unless ($loc) { - $u->set_prop("icbm", ""); # unset - $$err = "Illegal value. Not a recognized format." if $value; - return 0; - } - $u->set_prop("icbm", $loc->as_posneg_comma); - return 1; -}); - -register_setter("no_mail_alias", sub { - my ($u, $key, $value, $err) = @_; - - unless ($value =~ /^[01]$/) { - $$err = "Illegal value. Must be '0' or '1'."; - return 0; - } - - $u->set_prop( "no_mail_alias", $value ); - $value ? $u->delete_email_alias : $u->update_email_alias; - - return 1; -}); - -register_setter("latest_optout", sub { - my ($u, $key, $value, $err) = @_; - unless ($value =~ /^(?:yes|no)$/i) { - $$err = "Illegal value. Must be 'yes' or 'no'."; return 0; - } - $value = lc $value eq 'yes' ? 1 : 0; - $u->set_prop("latest_optout", $value); - return 1; -}); - -1; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljlib.pl --- a/cgi-bin/ljlib.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljlib.pl Wed Dec 23 17:32:02 2009 +0000 @@ -37,6 +37,7 @@ use Digest::MD5 (); use Digest::MD5 (); use Digest::SHA1 (); use HTTP::Date (); +use LJ::Hooks; use LJ::MemCache; use LJ::Error; use LJ::User; # has a bunch of pkg LJ, non-OO methods at bottom @@ -119,7 +120,6 @@ require "ljtimeutil.pl"; require "ljtimeutil.pl"; require "ljcapabilities.pl"; require "ljmood.pl"; -require "ljhooks.pl"; require "ljrelation.pl"; require "ljuserpics.pl"; @@ -1394,7 +1394,7 @@ sub start_request if $LJ::IS_DEV_SERVER; } - LJ::run_hooks("start_request"); + LJ::Hooks::run_hooks("start_request"); return 1; } @@ -1447,7 +1447,7 @@ sub get_cluster_description { sub get_cluster_description { my ($cid) = shift; $cid += 0; - my $text = LJ::run_hook('cluster_description', $cid); + my $text = LJ::Hooks::run_hook('cluster_description', $cid); return $text if $text; # default behavior just returns clusterid @@ -1821,7 +1821,7 @@ sub delete_comments { foreach my $talkid (@talkids) { my $cmt = LJ::Comment->new($u, jtalkid => $talkid); push @jobs, LJ::EventLogRecord::DeleteComment->new($cmt)->fire_job; - LJ::run_hooks('delete_comment', $jid, $nodeid, $talkid); # jitemid, jtalkid + LJ::Hooks::run_hooks('delete_comment', $jid, $nodeid, $talkid); # jitemid, jtalkid } my $sclient = LJ::theschwartz(); @@ -2101,7 +2101,7 @@ sub alloc_global_counter # $dom can come as a direct argument or as a string to be mapped via hook my $dom_unmod = $dom; unless ( $dom =~ /^[ESLPAHCMFKI]$/ ) { - $dom = LJ::run_hook('map_global_counter_domain', $dom); + $dom = LJ::Hooks::run_hook('map_global_counter_domain', $dom); } return LJ::errobj("InvalidParameters", params => { dom => $dom_unmod })->cond_throw unless defined $dom; @@ -2153,7 +2153,7 @@ sub alloc_global_counter # the maximum used item id is $newmax = 0; } else { - $newmax = LJ::run_hook('global_counter_init_value', $dom); + $newmax = LJ::Hooks::run_hook('global_counter_init_value', $dom); die "No alloc_global_counter initalizer for domain '$dom'" unless defined $newmax; } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljprotocol.pl Wed Dec 23 17:32:02 2009 +0000 @@ -314,7 +314,7 @@ sub getfriendspage delete $_->{posterid}; } - LJ::run_hooks("getfriendspage", { 'userid' => $u->userid, }); + LJ::Hooks::run_hooks("getfriendspage", { 'userid' => $u->userid, }); return { 'entries' => [ @res ] }; } @@ -1050,7 +1050,7 @@ sub postevent $flags->{no_xpost} = 1; } - return undef unless LJ::run_hook('post_noauth', $req) || authenticate($req, $err, $flags); + return undef unless LJ::Hooks::run_hook('post_noauth', $req) || authenticate($req, $err, $flags); # if going through mod queue, then we know they're permitted to post at least this entry return undef unless check_altusage($req, $err, $flags) || $flags->{nomod}; @@ -1559,7 +1559,7 @@ sub postevent } # run local site-specific actions - LJ::run_hooks("postpost", { + LJ::Hooks::run_hooks("postpost", { 'itemid' => $jitemid, 'anum' => $anum, 'journal' => $uowner, @@ -2007,7 +2007,7 @@ sub editevent my @jobs; LJ::Feed::generate_hubbub_jobs( $uowner, \@jobs ) unless $uowner->is_syndicated; - LJ::run_hooks( "editpost", $entry, \@jobs ); + LJ::Hooks::run_hooks( "editpost", $entry, \@jobs ); my $sclient = LJ::theschwartz(); if ( $sclient && @jobs ) { @@ -2703,7 +2703,7 @@ sub hash_menus 'url' => "$LJ::SITEROOT/support/", } ]; - LJ::run_hooks("modify_login_menu", { + LJ::Hooks::run_hooks("modify_login_menu", { 'menu' => $menu, 'u' => $u, 'user' => $user, diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljrelation.pl --- a/cgi-bin/ljrelation.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljrelation.pl Wed Dec 23 17:32:02 2009 +0000 @@ -60,7 +60,7 @@ sub get_reluser_id { }->{$type}+0; return $val if $val; return 0 unless $type =~ /^local-/; - return LJ::run_hook('get_reluser_id', $type)+0; + return LJ::Hooks::run_hook('get_reluser_id', $type)+0; } # <LJFUNC> diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljtextutil.pl --- a/cgi-bin/ljtextutil.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljtextutil.pl Wed Dec 23 17:32:02 2009 +0000 @@ -264,8 +264,8 @@ sub is_utf8 { sub is_utf8 { my $text = shift; - if (LJ::are_hooks("is_utf8")) { - return LJ::run_hook("is_utf8", $text); + if (LJ::Hooks::are_hooks("is_utf8")) { + return LJ::Hooks::run_hook("is_utf8", $text); } require Unicode::CheckUTF8; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/ljuserpics.pl --- a/cgi-bin/ljuserpics.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/ljuserpics.pl Wed Dec 23 17:32:02 2009 +0000 @@ -146,7 +146,7 @@ sub expunge_userpic { LJ::Userpic->delete_cache( $u ); # call the hook and get out of here - my @rval = LJ::run_hooks( 'expunge_userpic', $picid, $u->userid ); + my @rval = LJ::Hooks::run_hooks( 'expunge_userpic', $picid, $u->userid ); return ( $u->userid, map {$_->[0]} grep {$_ && @$_ && $_->[0]} @rval ); } diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/modperl_subs.pl --- a/cgi-bin/modperl_subs.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/modperl_subs.pl Wed Dec 23 17:32:02 2009 +0000 @@ -38,6 +38,7 @@ use Image::Size (); use Image::Size (); use POSIX (); +use LJ::Hooks; use LJ::Blob; use LJ::Captcha; use LJ::Faq; @@ -102,7 +103,7 @@ require "$LJ::HOME/cgi-bin/modperl_subs- # defer loading of hooks, better that in the future, the hook loader # will be smarter and only load in the *.pm files it needs to fulfill # the hooks to be run -LJ::load_hooks_dir() unless LJ::is_from_test(); +LJ::Hooks::_load_hooks_dir() unless LJ::is_from_test(); $LJ::IMGPREFIX_BAK = $LJ::IMGPREFIX; $LJ::STATPREFIX_BAK = $LJ::STATPREFIX; diff -r b3b4673366b0 -r 780a3e3275f7 cgi-bin/weblib.pl --- a/cgi-bin/weblib.pl Wed Dec 23 09:57:04 2009 -0600 +++ b/cgi-bin/weblib.pl Wed Dec 23 17:32:02 2009 +0000 @@ -1348,7 +1348,7 @@ sub entry_form { ### Other Posting Options { $out .= "<div id='infobox'>\n"; - $out .= LJ::run_hook('entryforminfo', $opts->{'usejournal'}, $opts->{'remote'}); + $out .= LJ::Hooks::run_hook('entryforminfo', $opts->{'usejournal'}, $opts->{'remote'}); $out .= "</div><!-- end #infobox -->\n\n"; } @@ -1748,7 +1748,7 @@ MOODS } ### Other Posting Options - $out .= LJ::run_hook('add_extra_entryform_fields', { opts => $opts, tabindex => $tabindex }); + $out .= LJ::Hooks::run_hook('add_extra_entryform_fields', { opts => $opts, tabindex => $tabindex }); $out .= "<span class='inputgroup-right'>"; # extra submit button so make sure it posts the form when person presses enter key @@ -2255,7 +2255,7 @@ sub entry_form_decode } # process site-specific options - LJ::run_hooks('decode_entry_form', $POST, $req); + LJ::Hooks::run_hooks('decode_entry_form', $POST, $req); return $req; } @@ -2562,7 +2562,7 @@ sub control_strip my $journal = LJ::load_user($user); my $show_strip = 1; - $show_strip = LJ::run_hook( "show_control_strip" ) if ( LJ::are_hooks( "show_control_strip" ) ); + $show_strip = LJ::Hooks::run_hook( "show_control_strip" ) if ( LJ::Hooks::are_hooks( "show_control_strip" ) ); return "" unless $show_strip; @@ -2576,7 +2576,7 @@ sub control_strip my $uri = $baseuri ? "http://$baseuri" : "http://" . $r->header_in('Host') . $r->uri; $uri .= "$querysep$args"; my $euri = LJ::eurl($uri); - my $create_link = LJ::run_hook("override_create_link_on_navstrip", $journal) || "<a href='$LJ::SITEROOT/create'>" . BML::ml('web.controlstrip.links.create', {'sitename' => $LJ::SITENAMESHORT}) . "</a>"; + my $create_link = LJ::Hooks::run_hook("override_create_link_on_navstrip", $journal) || "<a href='$LJ::SITEROOT/create'>" . BML::ml('web.controlstrip.links.create', {'sitename' => $LJ::SITENAMESHORT}) . "</a>"; # Build up some common links my %links = ( @@ -2589,7 +2589,7 @@ sub control_strip 'invite_friends' => "<a href='$LJ::SITEROOT/manage/circle/invite'>$BML::ML{'web.controlstrip.links.invitefriends'}</a>", 'create_account' => $create_link, 'syndicated_list' => "<a href='$LJ::SITEROOT/syn/list'>$BML::ML{'web.controlstrip.links.popfeeds'}</a>", - 'learn_more' => LJ::run_hook('control_strip_learnmore_link') || "<a href='$LJ::SITEROOT/'>$BML::ML{'web.controlstrip.links.learnmore'}</a>", + 'learn_more' => LJ::Hooks::run_hook('control_strip_learnmore_link') || "<a href='$LJ::SITEROOT/'>$BML::ML{'web.controlstrip.links.learnmore'}</a>", 'explore' => "<a href='$LJ::SITEROOT/explore/'>" . BML::ml('web.controlstrip.links.explore', { sitenameabbrev => $LJ::SITENAMEABBREV }) . "</a>", 'confirm' => "<a href='$LJ::SITEROOT/register'>$BML::ML{'web.controlstrip.links.confirm'}</a>", ); @@ -2874,17 +2874,17 @@ sub control_strip $ret .= " "; } - $ret .= LJ::run_hook('control_strip_logo', $remote, $journal); + $ret .= LJ::Hooks::run_hook('control_strip_logo', $remote, $journal); $ret .= "</td>"; } else { - my $show_login_form = LJ::run_hook("show_control_strip_login_form", $journal); + my $show_login_form = LJ::Hooks::run_hook("show_control_strip_login_form", $journal); $show_login_form = 1 if !defined $show_login_form; if ($show_login_form) { my $chal = LJ::challenge_generate(300); - my $contents = LJ::run_hook('control_strip_userpic_contents', $euri) || " "; + my $contents = LJ::Hooks::run_hook('control_strip_userpic_contents', $euri) || " "; $ret .= <<"LOGIN_BAR"; <td id='lj_controlstrip_userpic'>$contents</td> <td id='lj_controlstrip_login' style='background-image: none;' nowrap='nowrap'><form id="login" class="lj_login_form" action="$LJ::SITEROOT/login?ret=1" method="post"><div> @@ -2909,7 +2909,7 @@ LOGIN_BAR $ret .= '</div></form></td>'; } else { - my $contents = LJ::run_hook('control_strip_loggedout_userpic_contents', $euri) || " "; + my $contents = LJ::Hooks::run_hook('control_strip_loggedout_userpic_contents', $euri) || " "; $ret .= "<td id='lj_controlstrip_loggedout_userpic'>$contents</td>"; } @@ -2934,7 +2934,7 @@ LOGIN_BAR $ret .= "<br />"; $ret .= "$links{'login'} " unless $show_login_form; $ret .= "$links{'create_account'} $links{'learn_more'}"; - $ret .= LJ::run_hook('control_strip_logo', $remote, $journal); + $ret .= LJ::Hooks::run_hook('control_strip_logo', $remote, $journal); $ret .= "</td>"; } @@ -3264,7 +3264,7 @@ sub subscribe_interface { my $altrow_class = $sub_count % 2 == 1 ? "altrow" : ""; my $hidden = $pending_sub->selected($u) ? "" : " style='visibility: hidden;'"; my $sub_title = " " . $pending_sub->htmlcontrol_label($u); - $sub_title = LJ::run_hook("disabled_esn_sub", $u) . $sub_title if $pending_sub->disabled($u); + $sub_title = LJ::Hooks::run_hook("disabled_esn_sub", $u) . $sub_title if $pending_sub->disabled($u); $cat_html .= "<tr class='$disabled_class $altrow_class'>"; $cat_html .= "<td>" . $pending_sub->htmlcontrol($u) . "$sub_title*</td>"; @@ -3291,7 +3291,7 @@ sub subscribe_interface { my $subscribed = ! $pending_sub->pending; unless ($pending_sub->enabled) { - $title = LJ::run_hook("disabled_esn_sub", $u) . $title; + $title = LJ::Hooks::run_hook("disabled_esn_sub", $u) . $title; } next if ! $pending_sub->event_class->is_visible && $showtracking; @@ -3643,7 +3643,7 @@ function sendForm (formid, checkuser) # returns HTML which should appear before </body> sub final_body_html { my $before_body_close = ""; - LJ::run_hooks('insert_html_before_body_close', \$before_body_close); + LJ::Hooks::run_hooks('insert_html_before_body_close', \$before_body_close); my $pagestats_obj = LJ::pagestats_obj(); $before_body_close .= $pagestats_obj->render @@ -3673,7 +3673,7 @@ sub pageview_unique_string { # </LJFUNC> sub site_schemes { my @schemes = @LJ::SCHEMES; - LJ::run_hooks('modify_scheme_list', \@schemes); + LJ::Hooks::run_hooks('modify_scheme_list', \@schemes); @schemes = grep { !$_->{disabled} } @schemes; return @schemes; } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/accountstatus.bml --- a/htdocs/accountstatus.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/accountstatus.bml Wed Dec 23 17:32:02 2009 +0000 @@ -145,7 +145,7 @@ body<= } # optional stuff that gets printed after deletion - $ret .= LJ::run_hook("accountstatus.bml_after_deletion", $u, \%POST); + $ret .= LJ::Hooks::run_hook("accountstatus.bml_after_deletion", $u, \%POST); } return $ret; @@ -170,7 +170,7 @@ body<= $ret .= "<?p $ML{'.delete.openid'} 'p?>" if $u->is_identity && $u->statusvis ne "D"; - $ret .= LJ::run_hook("accountstatus_delete_text", $u); + $ret .= LJ::Hooks::run_hook("accountstatus_delete_text", $u); $ret .= "<div style='margin-left: 30px'>$ML{'.journalstatus.select.head'}\n"; $ret .= LJ::html_select({ 'name' => 'statusvis', 'selected' => $u->statusvis }, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/admin/faq/faqedit.bml --- a/htdocs/admin/faq/faqedit.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/admin/faq/faqedit.bml Wed Dec 23 17:32:02 2009 +0000 @@ -180,11 +180,11 @@ body<= # from false to true. Should that be checked/enforced here instead? # FIXME: do we even need that hook? It looks like LJ only ever used # it to add stuff to LJ Talk FAQs, for Gizmo sponsorship. - LJ::run_hook( "faq.$id.transform", $remote, answer => \$a_html, + LJ::Hooks::run_hook( "faq.$id.transform", $remote, answer => \$a_html, question => \$q_html, summary => \$s_html, display_summary => \$display_summary, display_answer => \$display_answer ) - if LJ::are_hooks( "faq.$id.transform" ); + if LJ::Hooks::are_hooks( "faq.$id.transform" ); # display output $ret .= "<hr /><?h1 $q_html h1?>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/admin/spamreports.bml --- a/htdocs/admin/spamreports.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/admin/spamreports.bml Wed Dec 23 17:32:02 2009 +0000 @@ -180,7 +180,7 @@ } # see if we should call a hook for extra actions? - $body .= LJ::run_hook('spamreport_notification', $remote, { $by => $what }) + $body .= LJ::Hooks::run_hook('spamreport_notification', $remote, { $by => $what }) if $state eq 'open' && $by eq 'posterid'; # now the general info gathering diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/admin/userlog.bml --- a/htdocs/admin/userlog.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/admin/userlog.bml Wed Dec 23 17:32:02 2009 +0000 @@ -114,7 +114,7 @@ FORM } elsif ( $row->{action} eq 'impersonator' ) { my $u = LJ::load_userid( $row->{actiontarget} ); $action = "Did impersonate on " . ( $u ? $u->ljuser_display : "(no target)" ) . ": " . LJ::ehtml( $extra->{reason} ); - } elsif (my $info = LJ::run_hook('userlog_rows', $row)) { + } elsif (my $info = LJ::Hooks::run_hook('userlog_rows', $row)) { $action = $info; } else { $action = "Unknown action ($row->{action})"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/allpics.bml --- a/htdocs/allpics.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/allpics.bml Wed Dec 23 17:32:02 2009 +0000 @@ -161,7 +161,7 @@ $body .= "<?h1 $ML{'.current'} h1?><?p "; if ($can_manage) { $body .= BML::ml('.pics.owner', {'user' => LJ::ljuser($u),}); - my $hook_text = LJ::run_hook('allpics_upsell_text', $u, $getextra); + my $hook_text = LJ::Hooks::run_hook('allpics_upsell_text', $u, $getextra); if ($hook_text eq "") { $body .= ' ' . BML::ml('.edit4', {'aopts' => "href='$LJ::SITEROOT/editpics$getextra'"}); } else { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/changeemail.bml --- a/htdocs/changeemail.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/changeemail.bml Wed Dec 23 17:32:02 2009 +0000 @@ -129,7 +129,7 @@ body<= $u->log_event('email_change', { remote => $remote, new => $POST{'email'} }); - LJ::run_hook('post_email_change', + LJ::Hooks::run_hook('post_email_change', { user => $u, newemail => $POST{'email'}, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/changepassword.bml --- a/htdocs/changepassword.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/changepassword.bml Wed Dec 23 17:32:02 2009 +0000 @@ -191,13 +191,13 @@ body<= # if they were logged in, tell them to relogin $body .= "<?p " . BML::ml('.relogin', { 'aopts' => "href='/login'" }) . " p?>" if $remote; - LJ::run_hooks("post_changepassword", { + LJ::Hooks::run_hooks("post_changepassword", { "u" => $u, "newpassword" => $POST{'newpass1'}, "oldpassword" => $u->password, }); - LJ::run_hook('user_login', $u); + LJ::Hooks::run_hook('user_login', $u); } return $body; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/create.bml --- a/htdocs/community/create.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/create.bml Wed Dec 23 17:32:02 2009 +0000 @@ -98,7 +98,7 @@ SUBMIT: my $ret; my $redirect; my $stop_output; - LJ::run_hooks("create.bml_postsession", { + LJ::Hooks::run_hooks("create.bml_postsession", { post => \%POST, u => $u, type => 'community', @@ -171,7 +171,7 @@ SUBMIT: $ret .= "<label for='memclosed'> $ML{'/community/settings.bml.label.closedmemb2'}</label></p>"; $ret .= "</div></div></li>"; - LJ::run_hooks("create.bml_opts", { + LJ::Hooks::run_hooks("create.bml_opts", { post => \%POST, get => \%GET, ret => \$ret, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/join.bml --- a/htdocs/community/join.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/join.bml Wed Dec 23 17:32:02 2009 +0000 @@ -78,8 +78,8 @@ body<= $next_links .= "<li><a href=\'" . $cu->journal_base . "'>". BML::ml('.label.read_recent_entries', {'user' => $cu->user}) . "</a></li>"; $next_links .= "<li><a href=\'" . $cu->profile_url . "'>" . BML::ml('.label.read_comm_info', {'user' => $cu->user}) . "</a></li>"; $next_links .= "<li><a href='$LJ::SITEROOT/community/search'>".BML::ml('.label.search_other') . "</a></li>"; - $next_links .= LJ::run_hook("join_comm_extra") - if LJ::are_hooks("join_comm_extra"); + $next_links .= LJ::Hooks::run_hook("join_comm_extra") + if LJ::Hooks::are_hooks("join_comm_extra"); $next_links .= "</ul>"; # can't join closed communities diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/manage.bml --- a/htdocs/community/manage.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/manage.bml Wed Dec 23 17:32:02 2009 +0000 @@ -102,7 +102,7 @@ body<= if ($admin{$id}) { $ret .= BML::ml('Actionlink', { 'link'=>"<a href='/update?usejournal=$user'>$ML{'.commlist.post'}</a>"}) . " "; - $ret .= LJ::run_hook('community_manage_actionlink', $user); + $ret .= LJ::Hooks::run_hook('community_manage_actionlink', $user); $ret .= BML::ml('Actionlink', { 'link'=>"<a href='/manage/profile/?authas=$user'>$ML{'.commlist.actinfo2'}</a>"}) . " "; $ret .= BML::ml('Actionlink', { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/pending.bml --- a/htdocs/community/pending.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/pending.bml Wed Dec 23 17:32:02 2009 +0000 @@ -89,7 +89,7 @@ body<= } else { LJ::set_rel($c, $us->{$id}, 'B'); $c->log_event('ban_set', { actiontarget => $id, remote => $remote }); - LJ::run_hooks('ban_set', $c, $us->{$id}); + LJ::Hooks::run_hooks('ban_set', $c, $us->{$id}); $banned++; LJ::reject_pending_member($cid, $id); # only in case of successful ban diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/search.bml --- a/htdocs/community/search.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/search.bml Wed Dec 23 17:32:02 2009 +0000 @@ -27,8 +27,8 @@ body<= <?_code { my $remote = LJ::get_remote(); - if (LJ::are_hooks("cprod_redirect_user")) { - return LJ::run_hook("cprod_redirect_user", $remote); + if (LJ::Hooks::are_hooks("cprod_redirect_user")) { + return LJ::Hooks::run_hook("cprod_redirect_user", $remote); } return; } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/community/settings.bml --- a/htdocs/community/settings.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/community/settings.bml Wed Dec 23 17:32:02 2009 +0000 @@ -146,7 +146,7 @@ body<= # ... and migrate their interests to the right table $cu->lazy_interests_cleanup; - LJ::run_hook("change_journal_type", $cu); + LJ::Hooks::run_hook("change_journal_type", $cu); my $moderated = $POST{moderated} ? 1 : 0; my $hidejoinpostlink = $POST{showjoinpostlink} ? 0 : 1; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/customize/advanced/index.bml --- a/htdocs/customize/advanced/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/customize/advanced/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -6,7 +6,7 @@ body<= LJ::set_active_crumb('advcustomize'); my $u = LJ::get_effective_remote(); - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $u); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $u); if ($no_layer_edit) { return $ML{'.error.advanced.editing.denied'}; } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/customize/advanced/layerbrowse.bml --- a/htdocs/customize/advanced/layerbrowse.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/customize/advanced/layerbrowse.bml Wed Dec 23 17:32:02 2009 +0000 @@ -58,7 +58,7 @@ if ($lay->{'type'} eq 'layout' && $GET{'expand'} != $lid) { my $num_children = 0; foreach my $child (@{$lay->{'children'}}) { - my $is_active = LJ::run_hook("layer_is_active", $pub->{$child}->{uniq}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$child}->{uniq}); $num_children++ if !defined $is_active || $is_active; } $body .= "<ul><li>[<a href='layerbrowse?expand=$lid'>"; @@ -75,7 +75,7 @@ # expand children $body .= "<ul>"; foreach (@children) { - my $is_active = LJ::run_hook("layer_is_active", $pub->{$_}->{uniq}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$_}->{uniq}); next unless !defined $is_active || $is_active; $self->($self, $_); } @@ -87,7 +87,7 @@ # iterate through core layers $body .= "<ul>"; foreach (grep { $pub->{$_}->{'b2lid'} == 0 } grep { /^\d+$/ } keys %$pub) { - my $is_active = LJ::run_hook("layer_is_active", $pub->{$_}->{uniq}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $pub->{$_}->{uniq}); next unless !defined $is_active || $is_active; $recurse->($recurse, $_); # start from the top } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/customize/advanced/layeredit.bml --- a/htdocs/customize/advanced/layeredit.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/customize/advanced/layeredit.bml Wed Dec 23 17:32:02 2009 +0000 @@ -18,7 +18,7 @@ return $err->("You must be logged in to edit layers.") unless $remote; - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $remote); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $remote); return $err->($ML{'/customize/advanced/index.bml.error.advanced.editing.denied'}) if $no_layer_edit; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/customize/advanced/layers.bml --- a/htdocs/customize/advanced/layers.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/customize/advanced/layers.bml Wed Dec 23 17:32:02 2009 +0000 @@ -38,7 +38,7 @@ return $err->($ML{'.error.notloggedin'}) unless $remote; - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $remote); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $remote); return $err->($ML{'/customize/advanced/index.bml.error.advanced.editing.denied'}) if $no_layer_edit; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/customize/advanced/styles.bml --- a/htdocs/customize/advanced/styles.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/customize/advanced/styles.bml Wed Dec 23 17:32:02 2009 +0000 @@ -53,7 +53,7 @@ $ML{'.error.usercantuseadvanced'} ) unless $u->can_create_s2_styles || $viewall; - my $no_layer_edit = LJ::run_hook("no_theme_or_layer_edit", $u); + my $no_layer_edit = LJ::Hooks::run_hook("no_theme_or_layer_edit", $u); return $err->($ML{'/customize/advanced/index.bml.error.advanced.editing.denied'}) if $no_layer_edit; @@ -103,7 +103,7 @@ # save to db and update user object LJ::set_userprop($u, "stylesys", '2'); LJ::set_userprop($u, "s2_style", $id); - LJ::run_hooks('apply_theme', $u); + LJ::Hooks::run_hooks('apply_theme', $u); return BML::redirect("styles$getextra"); } @@ -364,7 +364,7 @@ my $ref = shift; return sort { $ref->{$a}->{'name'} cmp $ref->{$b}->{'name'} || $a <=> $b} grep { - my $is_active = LJ::run_hook("layer_is_active", $ref->{$_}->{uniq}); + my $is_active = LJ::Hooks::run_hook("layer_is_active", $ref->{$_}->{uniq}); $ref->{$_}->{'type'} eq $type && $ref->{$_}->{'b2lid'} == $b2lid && (!defined $is_active || $is_active) && diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/directory.bml --- a/htdocs/directory.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/directory.bml Wed Dec 23 17:32:02 2009 +0000 @@ -223,7 +223,7 @@ body<= $ret .= qq {\n<div id="FilterSearch">$ML{'.new_search_show'} $all_search | }; $ret .= qq {$community_search | $user_search | $identity_search</div>\n}; - if (LJ::run_hook("interest_search_ignore", query => $GET{int_like})) { + if (LJ::Hooks::run_hook("interest_search_ignore", query => $GET{int_like})) { $ret .= $ML{'.unable_find_users'}; return $ret; } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/editjournal.bml --- a/htdocs/editjournal.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/editjournal.bml Wed Dec 23 17:32:02 2009 +0000 @@ -278,7 +278,7 @@ body<= $result .= "<?p $ML{'.success.deletespam'} p?>" if $POST{'action:deletespam'}; $result .= $xpost_result; - my $deleted_extras = LJ::run_hook('entry_deleted_page_extras'); + my $deleted_extras = LJ::Hooks::run_hook('entry_deleted_page_extras'); $result .= $deleted_extras if defined $deleted_extras; } else { $result .= "<?p $ML{'.success.edited'} p?>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/editpics.bml --- a/htdocs/editpics.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/editpics.bml Wed Dec 23 17:32:02 2009 +0000 @@ -232,7 +232,7 @@ use strict; ## see if they have too many pictures uploaded my $inline; if ($userpic_count >= $max) { - if ($inline .= LJ::run_hook("cprod_inline", $u, 'EditPicsMax')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'EditPicsMax')) { push @info, $inline; $no_errors = 0; } else { @@ -441,7 +441,7 @@ use strict; } else { $body .= "<div id='limit'>\n"; my $inline; - if ($inline .= LJ::run_hook("cprod_inline", $u, 'EditPicsMax')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'EditPicsMax')) { $body .= $inline; } else { $body .= BML::ml('.error.toomanypics_standout', { num => $max }); @@ -468,7 +468,7 @@ use strict; $body .= "<p><strong>" . BML::ml('.piclimitstatus', {current => scalar @userpics, max => $max}) . "</strong></p>";; if (scalar @userpics >= $max) { my $inline; - if ($inline .= LJ::run_hook("cprod_inline", $u, 'EditPics')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'EditPics')) { $body .= "<?warningbar" . $inline . "warningbar?>"; } else { $body .= "<p>".BML::ml('cprod.editpics.text7.v1',{ "num" => $max })."</p>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/extcss/index.bml --- a/htdocs/extcss/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/extcss/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -64,7 +64,7 @@ my $cleaner = LJ::CSS::Cleaner->new; my $clean = $cleaner->clean($unclean); - LJ::run_hook('css_cleaner_transform', \$clean); + LJ::Hooks::run_hook('css_cleaner_transform', \$clean); LJ::MemCache::set($memkey, $clean, 300) unless $nocache; # 5 minute caching return $clean; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/inbox/compose.bml --- a/htdocs/inbox/compose.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/inbox/compose.bml Wed Dec 23 17:32:02 2009 +0000 @@ -124,7 +124,7 @@ body<= # This is only necessary if there are multiple recipients if (scalar(@msg_list) > 1) { my $up; - $up = LJ::run_hook('upgrade_message', $remote, 'message'); + $up = LJ::Hooks::run_hook('upgrade_message', $remote, 'message'); $up = "<br />$up" if ($up); push @errors, BML::ml( ".error.rate.limit", { up => $up } ) unless LJ::Message::ratecheck_multi(userid => $remote_id, msg_list => \@msg_list) diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/interests.bml --- a/htdocs/interests.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/interests.bml Wed Dec 23 17:32:02 2009 +0000 @@ -372,7 +372,7 @@ body<= my ( $interest, $intcount ) = LJ::get_interest( $intid ); my $check_int = $GET{int} || $interest; - if (LJ::run_hook("interest_search_ignore", query => $check_int, intid => $intid)) { + if (LJ::Hooks::run_hook("interest_search_ignore", query => $check_int, intid => $intid)) { return "<?h1 $ML{'Error'} h1?><?p $ML{'.error.ignored'} p?>"; } @@ -407,7 +407,7 @@ body<= $intid += 0; ### hook - LJ::run_hooks("interests_bml", { + LJ::Hooks::run_hooks("interests_bml", { 'intid' => $intid, 'int' => $interest, 'ret' => \$ret, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/login.bml --- a/htdocs/login.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/login.bml Wed Dec 23 17:32:02 2009 +0000 @@ -64,7 +64,7 @@ my $redir_host = $1 if $POST{ret} =~ m#^http://([\.:\w-]+)#i; if ($LJ::REDIRECT_ALLOWED{$redir_host} || $redir_host eq $LJ::DOMAIN_WEB) { - LJ::run_hook('login_redirect_extra', $redir_host); + LJ::Hooks::run_hook('login_redirect_extra', $redir_host); BML::redirect($POST{ret}); return 1; } @@ -226,7 +226,7 @@ $remote = undef; $cursess = undef; LJ::set_remote(undef); - LJ::run_hooks("post_logout"); + LJ::Hooks::run_hooks("post_logout"); }; if (LJ::did_post()) { @@ -348,7 +348,7 @@ my $bindip = ($POST{'bindip'} eq "yes") ? BML::get_remote_ip() : ""; $u->make_login_session($exptype, $bindip); - LJ::run_hook('user_login', $u); + LJ::Hooks::run_hook('user_login', $u); $cursess = $u->session; return if $want_success_redirect->(); diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/logout.bml --- a/htdocs/logout.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/logout.bml Wed Dec 23 17:32:02 2009 +0000 @@ -20,7 +20,7 @@ my $username = $u ? $u->display_username : $user; my $old_remote = LJ::load_user($username); return BML::redirect("$LJ::SITEROOT/") unless $old_remote; - my $html = LJ::run_hook("logout_page_html", $old_remote, get_ret => $GET{ret}, post_ret => $POST{ret}, nojs => $nojs); + my $html = LJ::Hooks::run_hook("logout_page_html", $old_remote, get_ret => $GET{ret}, post_ret => $POST{ret}, nojs => $nojs); if ($html) { $title = $ML{'.title.loggedout'}; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/lostinfo.bml --- a/htdocs/lostinfo.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/lostinfo.bml Wed Dec 23 17:32:02 2009 +0000 @@ -172,7 +172,7 @@ body<= my $add_message = ''; if ( LJ::is_enabled('secret_question') ) { - my ($redir, $ml_key, $param) = LJ::run_hook('use_secret', $u); + my ($redir, $ml_key, $param) = LJ::Hooks::run_hook('use_secret', $u); return BML::redirect($redir) if $redir ne ''; $add_message = "<?p " . BML::ml($ml_key, { datetime => strftime("%d.%m.%Y %H:%M", gmtime($param)) } ) . " p?>" if $ml_key ne ''; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/circle/invite.bml --- a/htdocs/manage/circle/invite.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/circle/invite.bml Wed Dec 23 17:32:02 2009 +0000 @@ -75,7 +75,7 @@ my $ct = $dbh->selectrow_array("SELECT COUNT(*) FROM email WHERE email = ?", undef, $email); if ($ct > 0) { - my $findfriends_userhasaccount = LJ::run_hook("findfriends_invite_user_has_account"); + my $findfriends_userhasaccount = LJ::Hooks::run_hook("findfriends_invite_user_has_account"); if ($findfriends_userhasaccount) { $bogus->("email", $findfriends_userhasaccount); } else { @@ -185,7 +185,7 @@ } } - my $findfriends_intro = LJ::run_hook("findfriends_invite_intro"); + my $findfriends_intro = LJ::Hooks::run_hook("findfriends_invite_intro"); if ($findfriends_intro) { $body .= $findfriends_intro; } elsif ( $LJ::USE_ACCT_CODES ) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/emailpost.bml --- a/htdocs/manage/emailpost.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/emailpost.bml Wed Dec 23 17:32:02 2009 +0000 @@ -431,7 +431,7 @@ body<= $ret .= LJ::html_submit( $ML{'.save'} ); $ret .= " standout?>"; $ret .= "</form>"; - $ret .= LJ::run_hook('sms_footer'); + $ret .= LJ::Hooks::run_hook('sms_footer'); return $ret; } _code?> diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/index.bml --- a/htdocs/manage/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -117,7 +117,7 @@ _code?> _code?> <?_code - return LJ::run_hook('extra_manage_setting'); + return LJ::Hooks::run_hook('extra_manage_setting'); _code?> <?_code @@ -206,7 +206,7 @@ block?> <?_code { my $u = $BMLCodeBlock::u; my $ret; - LJ::run_hook('control_panel_column', $u, \$ret); + LJ::Hooks::run_hook('control_panel_column', $u, \$ret); return $ret; } _code?> @@ -256,7 +256,7 @@ pretitle<= my $u = $BMLCodeBlock::u; my $ret; # user switcher - LJ::run_hook('control_panel_extra_info', $u, \$ret) if $u; + LJ::Hooks::run_hook('control_panel_extra_info', $u, \$ret) if $u; return $ret; } _code?> diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/moodthemes.bml --- a/htdocs/manage/moodthemes.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/moodthemes.bml Wed Dec 23 17:32:02 2009 +0000 @@ -392,7 +392,7 @@ body<= $ret .= LJ::make_authas_select($remote, { 'authas' => $GET{'authas'} }); $ret .= "</form>\n\n"; - my $moodtheme_upsell = LJ::run_hook("moodtheme_upsell"); + my $moodtheme_upsell = LJ::Hooks::run_hook("moodtheme_upsell"); unless ( $u->can_create_moodthemes ) { if ($moodtheme_upsell) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/profile/index.bml --- a/htdocs/manage/profile/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/profile/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -349,8 +349,8 @@ body<= $u->{'gizmo'} = $u->gizmo_account(); - my $ljtalk_title = '<a href="' . LJ::run_hook('jabber_link') . '">' . - LJ::run_hook('jabber_title') . '</a>'; + my $ljtalk_title = '<a href="' . LJ::Hooks::run_hook('jabber_link') . '">' . + LJ::Hooks::run_hook('jabber_title') . '</a>'; foreach my $p ( ["ljtalk", $ljtalk_title, 40], @@ -379,7 +379,7 @@ body<= $ret .= "<label for='opt_showljtalk' style='font-size: 10px;'>$ML{'.showljtalk'}</label>"; # Jabber Online Status - my $jabber_title = LJ::run_hook("jabber_title") || $ML{'/manage/settings/index.bml.jabber.title'}; + my $jabber_title = LJ::Hooks::run_hook("jabber_title") || $ML{'/manage/settings/index.bml.jabber.title'}; $ret .= "<br />"; $ret .= BML::ml('/manage/settings/index.bml.jabber', {'jabbertitle' => $jabber_title}) . " "; $ret .= LJ::html_select({ 'name' => 'opt_showonlinestatus', @@ -408,7 +408,7 @@ body<= $ret .= "<a name='txtmsg'></a><div class='section_head'>$ML{'.section.textmsg'}\n"; unless ( $u->can_use_textmessaging ) { my $inline; - if ($inline .= LJ::run_hook("cprod_inline", $u, 'TextMessaging')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'TextMessaging')) { $ret .= "</div>$inline"; } else { $ret .= "</div>".BML::ml('cprod.textmessaging.text3.v1'); @@ -487,7 +487,7 @@ body<= $ret .= "</table>\n"; - $ret .= LJ::run_hook("profile_settings_extra", $u); + $ret .= LJ::Hooks::run_hook("profile_settings_extra", $u); # ending submit block $ret .= "<?standout " . LJ::html_submit(undef, $ML{'.save_button'}) . " standout?>\n"; @@ -717,8 +717,8 @@ body<= $u->set_interests( \%interests, \@valid_ints ); } - LJ::run_hooks('profile_save', $u); - LJ::run_hook('set_profile_settings_extra', $u, \%POST); + LJ::Hooks::run_hooks('profile_save', $u); + LJ::Hooks::run_hook('set_profile_settings_extra', $u, \%POST); # tell the user all is well my $base = $u->journal_base; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/manage/settings/index.bml --- a/htdocs/manage/settings/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/manage/settings/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -148,7 +148,7 @@ body<= }, ); - LJ::run_hook("settings_extra_cats", \@cats_order, \%cats_with_settings, user => $u); + LJ::Hooks::run_hook("settings_extra_cats", \@cats_order, \%cats_with_settings, user => $u); my $given_cat = $GET{cat}; if ($u) { @@ -406,7 +406,7 @@ body<= $ret .= $cats_with_settings{$given_cat}->{form} ? LJ::html_submit($ML{'.btn.save'}) : " "; $ret .= "</div>"; - my $my_account_extra = LJ::run_hook('subscriptions_manage_my_account_extra', $u); + my $my_account_extra = LJ::Hooks::run_hook('subscriptions_manage_my_account_extra', $u); # set up default subscriptions for users that have not managed ESN stuff if (!$u->prop('esn_has_managed') && !$u->subscription_count) { @@ -476,7 +476,7 @@ body<= LJ::Subscription::Pending->new($u, event => 'Birthday', ), - (LJ::run_hook('subscriptions_manage_friend_pending_extra', $u) || ()), + (LJ::Hooks::run_hook('subscriptions_manage_friend_pending_extra', $u) || ()), ], }, ); @@ -516,7 +516,7 @@ body<= $ret .= "</table>"; if ($given_cat eq "account") { - my $account_stats = LJ::run_hook("settings_account_stats", $u); + my $account_stats = LJ::Hooks::run_hook("settings_account_stats", $u); if ($account_stats) { $ret .= "<div class='account_stats'>"; $ret .= $account_stats; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/moodlist.bml --- a/htdocs/moodlist.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/moodlist.bml Wed Dec 23 17:32:02 2009 +0000 @@ -53,12 +53,12 @@ body<= $sth->execute; my @themes = (); while (my $moodtheme = $sth->fetchrow_hashref) { - my $is_active = LJ::run_hook("mood_theme_is_active", $moodtheme->{moodthemeid}); + my $is_active = LJ::Hooks::run_hook("mood_theme_is_active", $moodtheme->{moodthemeid}); next unless !defined $is_active || $is_active; push @themes, $moodtheme; } @themes = sort { lc($a->{name}) cmp lc($b->{name}) } @themes; - my @special_themes = LJ::run_hook('modify_mood_theme_list', \@themes, user => $u); + my @special_themes = LJ::Hooks::run_hook('modify_mood_theme_list', \@themes, user => $u); my $do_mood_list = sub { # Setup the paging bar @@ -88,7 +88,7 @@ body<= my $special = shift; if ($special) { - my $author = LJ::run_hook("mood_theme_author", $theme->{moodthemeid}); + my $author = LJ::Hooks::run_hook("mood_theme_author", $theme->{moodthemeid}); $ret .= "<tr class='standout-border standout-background'><td style='padding-left: 5px;'>$theme->{'name'}"; $ret .= "<br /><span style='font-size: smaller;'>" . BML::ml('.moodtheme.byauthor', {'author' => $author}) . "</span>" if $author; $ret .= "</td>\n"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/multisearch.bml --- a/htdocs/multisearch.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/multisearch.bml Wed Dec 23 17:32:02 2009 +0000 @@ -247,7 +247,7 @@ if ($type) { # TODO: check return value of this hook, and fall back to another # hook that shows the results here, rather than redirecting to another page - return LJ::run_hook('multisearch_custom_search_redirect', { + return LJ::Hooks::run_hook('multisearch_custom_search_redirect', { type => $type, query => $q, }); } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/poll/create.bml --- a/htdocs/poll/create.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/poll/create.bml Wed Dec 23 17:32:02 2009 +0000 @@ -108,7 +108,7 @@ $body .= "</form>\n\n"; # show pregenerate options - $body .= LJ::run_hook('poll_pregeneration_html', $u, $authas); + $body .= LJ::Hooks::run_hook('poll_pregeneration_html', $u, $authas); } # does the remote or selected user have the 'makepoll' cap? @@ -704,7 +704,7 @@ # should we pregenerate something? if (my $pgid = $GET{'pregen'}+0) { - $poll = LJ::run_hook('pregenerate_poll', $u, $pgid); + $poll = LJ::Hooks::run_hook('pregenerate_poll', $u, $pgid); } # process post input diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/postreg/index.bml --- a/htdocs/postreg/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/postreg/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -47,7 +47,7 @@ body<= unless LJ::Setting->save_had_errors($save_rv); } - $ret .= LJ::run_hook('add_extra_fields_in_postreg_settings', $remote); + $ret .= LJ::Hooks::run_hook('add_extra_fields_in_postreg_settings', $remote); # either no form has been submitted, or we had errors in the form $ret .= "<form method='POST'>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/preview/entry.bml --- a/htdocs/preview/entry.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/preview/entry.bml Wed Dec 23 17:32:02 2009 +0000 @@ -57,7 +57,7 @@ my $get_styleinfo = sub { if ( $u->{'stylesys'} == 2 ) { my $forceflag = 0; - LJ::run_hooks("force_s1", $u, \$forceflag); + LJ::Hooks::run_hooks("force_s1", $u, \$forceflag); # check whether to use custom comment pages $ctx = LJ::S2::s2_context( $u->{s2_style} ); diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/register.bml --- a/htdocs/register.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/register.bml Wed Dec 23 17:32:02 2009 +0000 @@ -109,7 +109,7 @@ body<= LJ::update_user($u, { status => 'A' }); $u->update_email_alias; - LJ::run_hook('email_verified', $u); + LJ::Hooks::run_hook('email_verified', $u); if ($u->{'status'} eq "T") { $ret .= "<?h1 $ML{'.trans.header'} h1?><?p $ML{'.trans.body'} p?>"; @@ -135,7 +135,7 @@ body<= $ret .= "</div><!-- end .columns-2 -->"; } - LJ::run_hook('post_email_change', + LJ::Hooks::run_hook('post_email_change', { user => $u, newemail => $aa->{arg1}, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/stats.bml --- a/htdocs/stats.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/stats.bml Wed Dec 23 17:32:02 2009 +0000 @@ -80,7 +80,7 @@ body<= } $ret .= "</ul>\n"; - LJ::run_hook('statspage', { + LJ::Hooks::run_hook('statspage', { stat => \%stat, ret => \$ret, }); diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/stc/fck/editor/dialog/imguploadrte.bml --- a/htdocs/stc/fck/editor/dialog/imguploadrte.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/stc/fck/editor/dialog/imguploadrte.bml Wed Dec 23 17:32:02 2009 +0000 @@ -163,7 +163,7 @@ $ret .= "<div id='filediv'><input type='file' name='file1' id='fromfileentry' size='50' $disabled /></div>"; - my $msg = LJ::run_hook('update_insobj_fb', $fbenabled) || "Upload a file from your computer"; + my $msg = LJ::Hooks::run_hook('update_insobj_fb', $fbenabled) || "Upload a file from your computer"; $ret .= "<div class='ex'>$msg</div>"; $ret .= "</td></tr>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/support/append_request.bml --- a/htdocs/support/append_request.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/support/append_request.bml Wed Dec 23 17:32:02 2009 +0000 @@ -240,7 +240,7 @@ body<= $status .= "Changing from $catkey => $cats->{$newcat}->{'catkey'}\n\n"; $sp->{'spcatid'} = $newcat; # update category so IC e-mail goes to right place - LJ::run_hook("support_changecat_extra_actions", spid => $spid, catkey => $cats->{$newcat}->{catkey}); + LJ::Hooks::run_hook("support_changecat_extra_actions", spid => $spid, catkey => $cats->{$newcat}->{catkey}); } ## approving a screened response diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/support/faqbrowse.bml --- a/htdocs/support/faqbrowse.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/support/faqbrowse.bml Wed Dec 23 17:32:02 2009 +0000 @@ -169,10 +169,10 @@ body<= # from false to true. Should that be checked/enforced here instead? # FIXME: do we even need that hook? It looks like LJ only ever used # it to add stuff to LJ Talk FAQs, for Gizmo sponsorship. - LJ::run_hook( "faq.$faqid.transform", $remote, question => \$question, + LJ::Hooks::run_hook( "faq.$faqid.transform", $remote, question => \$question, summary => \$summary, display_summary => \$display_summary, answer => \$answer, display_answer => \$display_answer) - if LJ::are_hooks( "faq.$faqid.transform" ); + if LJ::Hooks::are_hooks( "faq.$faqid.transform" ); # display output if ($faqcatarg) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/support/see_request.bml --- a/htdocs/support/see_request.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/support/see_request.bml Wed Dec 23 17:32:02 2009 +0000 @@ -395,7 +395,7 @@ body<= $ret .= "(User on S1; why?) "; } - LJ::run_hooks("support_see_request_info_rows", { + LJ::Hooks::run_hooks("support_see_request_info_rows", { 'u' => $u, 'email' => $email, 'sp' => $sp, @@ -509,7 +509,7 @@ body<= ### end request info table - LJ::run_hooks("support_see_request_html", { + LJ::Hooks::run_hooks("support_see_request_html", { 'u' => $u, 'email' => $email, 'sp' => $sp, diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/syn/index.bml --- a/htdocs/syn/index.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/syn/index.bml Wed Dec 23 17:32:02 2009 +0000 @@ -211,7 +211,7 @@ body<= $ret .= "<?h1 $ML{'.add.byurl.title'} h1?><?p $ML{'.add.byurl.text'} p?>"; unless ( $u->can_create_feeds ) { my $inline; - if ($inline .= LJ::run_hook("cprod_inline", $u, 'Syn')) { + if ($inline .= LJ::Hooks::run_hook("cprod_inline", $u, 'Syn')) { $ret .= $inline; } else { $ret .= "<p>".BML::ml('cprod.syn.text.v1')."</p>"; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/talkpost.bml --- a/htdocs/talkpost.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/talkpost.bml Wed Dec 23 17:32:02 2009 +0000 @@ -65,7 +65,7 @@ body<= } } - LJ::run_hooks("need_res_for_journals", $u); + LJ::Hooks::run_hooks("need_res_for_journals", $u); my $ret = ""; @@ -205,7 +205,7 @@ body<= $ret .= "<table id='poster'><tr>"; my $pickw = $init->{'replyto'} ? $parpost->{'picture_keyword'} : $props->{'picture_keyword'}; - LJ::run_hook('notify_event_displayed', $entry); + LJ::Hooks::run_hook('notify_event_displayed', $entry); my $userpic; if ($init->{'replyto'}) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/talkread.bml --- a/htdocs/talkread.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/talkread.bml Wed Dec 23 17:32:02 2009 +0000 @@ -193,7 +193,7 @@ body<= # See if we should inject QuickReply javascript LJ::load_user_props($remote, "opt_no_quickreply"); - LJ::run_hooks("need_res_for_journals", $u); + LJ::Hooks::run_hooks("need_res_for_journals", $u); LJ::need_res( qw( js/thread_expander.js stc/talkpage.css ) ); if (($remote && !$remote->{'opt_no_quickreply'}) && !$nocomments) { @@ -246,7 +246,7 @@ body<= $ret .= "<table id='poster'><tr>"; my $userpic = $entry->userpic; - LJ::run_hook('notify_event_displayed', $entry); + LJ::Hooks::run_hook('notify_event_displayed', $entry); # Build the userpic image tag for the entry's userpic my %userpics; diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/tools/endpoints/changerelation.bml --- a/htdocs/tools/endpoints/changerelation.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/tools/endpoints/changerelation.bml Wed Dec 23 17:32:02 2009 +0000 @@ -79,7 +79,7 @@ my $ban_user = LJ::load_user($target); $success = $remote->ban_user($ban_user); - LJ::run_hooks('ban_set', $remote, $ban_user); + LJ::Hooks::run_hooks('ban_set', $remote, $ban_user); #$ret{is_banned} = $remote->is_banned($ban_user) ? 1 : 0; } elsif ( $action eq 'setUnban' ) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/tools/endpoints/ctxpopup.bml --- a/htdocs/tools/endpoints/ctxpopup.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/tools/endpoints/ctxpopup.bml Wed Dec 23 17:32:02 2009 +0000 @@ -121,7 +121,7 @@ } sleep(1.5) if $LJ::IS_DEV_SERVER; - my %extrainfo = LJ::run_hook("ctxpopup_extra_info", $u); + my %extrainfo = LJ::Hooks::run_hook("ctxpopup_extra_info", $u); %ret = (%ret, %extrainfo); $ret{is_banned} = LJ::is_banned($u,$remote) ? 1 : 0 diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/tools/endpoints/directorysearch.bml --- a/htdocs/tools/endpoints/directorysearch.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/tools/endpoints/directorysearch.bml Wed Dec 23 17:32:02 2009 +0000 @@ -88,7 +88,7 @@ foreach my $constraint (@constraints) { next unless $constraint->isa('LJ::Directory::Constraint::Interest'); - if (LJ::run_hook("interest_search_ignore", intid => $constraint->intid)) { + if (LJ::Hooks::run_hook("interest_search_ignore", intid => $constraint->intid)) { return $err->("Sorry, we're unable to help you find users matching the interests you've provided."); } } diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/tools/endpoints/esn_inbox.bml --- a/htdocs/tools/endpoints/esn_inbox.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/tools/endpoints/esn_inbox.bml Wed Dec 23 17:32:02 2009 +0000 @@ -83,7 +83,7 @@ $ret{unread_count} = $u->notification_inbox->unread_count; } elsif ($action eq 'toggle_bookmark') { my $up; - $up = LJ::run_hook('upgrade_message', $u, 'bookmark'); + $up = LJ::Hooks::run_hook('upgrade_message', $u, 'bookmark'); $up = "<br />$up" if ($up); foreach my $item (@items) { diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/translate/editpage.bml --- a/htdocs/translate/editpage.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/translate/editpage.bml Wed Dec 23 17:32:02 2009 +0000 @@ -3,7 +3,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?_code { - LJ::run_hook('trans_editpage_bml_postsave_begin'); + LJ::Hooks::run_hook('trans_editpage_bml_postsave_begin'); return LJ::res_includes(); } _code?> @@ -335,8 +335,8 @@ push @errors, $msg; } - push @info, LJ::run_hook('trans_editpage_bml_postsave', $opts) - if LJ::are_hooks('trans_editpage_bml_postsave'); + push @info, LJ::Hooks::run_hook('trans_editpage_bml_postsave', $opts) + if LJ::Hooks::are_hooks('trans_editpage_bml_postsave'); } $dbh ||= LJ::get_db_writer(); diff -r b3b4673366b0 -r 780a3e3275f7 htdocs/update.bml --- a/htdocs/update.bml Wed Dec 23 09:57:04 2009 -0600 +++ b/htdocs/update.bml Wed Dec 23 17:32:02 2009 +0000 @@ -57,7 +57,7 @@ } if ( $remote->can_post_disabled ) { - unless (LJ::run_hook("update.bml_disable_can_post", { + unless (LJ::Hooks::run_hook("update.bml_disable_can_post", { title => $title, body => $body, })) { $$title = $ML{'.error.disabled.title'}; @@ -70,7 +70,7 @@ my %res = (); # see if we need to do any transformations - LJ::run_hooks("transform_update_$POST{transform}", \%GET, \%POST) if $POST{transform}; + LJ::Hooks::run_hooks("transform_update_$POST{transform}", \%GET, \%POST) if $POST{transform}; LJ::need_res('stc/display_none.css', 'stc/lj_base.css', 'stc/entry.css', 'js/inputcomplete.js'); @@ -113,7 +113,7 @@ } # try to call a hook to fill in the fields - my $override_fields = LJ::run_hook('update_fields', \%GET); + my $override_fields = LJ::Hooks::run_hook('update_fields', \%GET); my $opt_preformatted = 0; if ($override_fields) { $event = $override_fields->{'event'} if exists($override_fields->{'event'}); @@ -488,11 +488,11 @@ my $writersblocklink = ''; - if ($qid && LJ::run_hook('show_qotd_extra_text', $remote)) { + if ($qid && LJ::Hooks::run_hook('show_qotd_extra_text', $remote)) { $writersblocklink = "<li><a href=\"$LJ::SITEROOT/misc/latestqotd?qid=$qid\">View answers to Writer's Block</a></li>"; } - my @after_entry_post_extra_options = LJ::run_hooks('after_entry_post_extra_options', user => $ju, itemlink => $itemlink); + my @after_entry_post_extra_options = LJ::Hooks::run_hooks('after_entry_post_extra_options', user => $ju, itemlink => $itemlink); my $after_entry_post_extra_options = join('', map {$_->[0]} @after_entry_post_extra_options) || ''; $$body .= " p?><?p $ML{'.success.links'} p?><ul>" . $writersblocklink . @@ -507,7 +507,7 @@ $$body .= "</td><td style=\"padding-left: 2em;\">"; $$body .= "</td></tr></table>"; - $$body .= LJ::run_hook('after_entry_post_extra_html', user => $ju, itemlink => $itemlink, request => \%req); + $$body .= LJ::Hooks::run_hook('after_entry_post_extra_html', user => $ju, itemlink => $itemlink, request => \%req); return; } } diff -r b3b4673366b0 -r 780a3e3275f7 t/00-compile.t --- a/t/00-compile.t Wed Dec 23 09:57:04 2009 -0600 +++ b/t/00-compile.t Wed Dec 23 17:32:02 2009 +0000 @@ -23,14 +23,6 @@ my %SKIP = ( 'DW/User/Edges/WatchTrust.pm' => 'Bareword "LJ::BMAX_GRPNAME2"', 'DW/User/Edges.pm' => 'Bareword "LJ::BMAX_GRPNAME2"', 'DW/External/XPostProtocol/LJXMLRPC.pm' => 'Cant locate object method "new" via package "DW::External::XPostProtocol::LJXMLRPC"', - - 'DW/Hooks/NavStrip.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/SiteScheme.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/SSL.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/Display.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/Changelog.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/EntryForm.pm' => 'Undefined subroutine &LJ::register_hook', - 'DW/Hooks/SiteSearch.pm' => 'Undefined subroutine &LJ::register_hook', 'LJ/Test/AtomAPI.pm' => 'needs Apache/Constants', 'Test/FakeApache.pm' => 'needs Apache/Constants.pm', --------------------------------------------------------------------------------
no subject
2). I see a bunch of hooks in there that I think might be specifically to hook into ljcom stuff that we don't/won't have. Worth going through, identifying all the hooks called in code, and removing the ones that we don't have and don't want?
no subject
2) The thing about those hooks is basically, if LJ found it useful to add a hook there (because they wanted to customize that flow), then maybe another site will. Do you have a specific example? Maybe there are things we can remove.
no subject
no subject
no subject
no subject
no subject