{ 'cat_match' => 'sub { my $fullname = shift || return; my $url = $DB->table(\'Category\')->as_url($fullname); if (index($url, "Bike_Fit") != -1) { return "true"; } else { return "false"; } }', 'category_url' => 'sub { my $fullname = shift || return; my $url = $DB->table(\'Category\')->as_url($fullname); return $url; }', 'comscore' => ' ', 'convert_nl_br' => 'sub { my $tags = GT::Template->tags; foreach (keys %$tags) { next if ($_ eq \'RelatedArticles\'); $tags->{$_} =~ s/\r//g; $tags->{$_} =~ s/\n/
/g; } return $tags; }', 'dans_series' => '- F.I.S.T. Workshops
- Geometry Calculator
- Retailers
- Stack // Reach
- Training Log
- Triathlon Clubs', 'forum_url' => 'sub { return \'http://forumdev.slowtwitch.com\'; }', 'ga_link_tracker' => ' ', 'get_detailed_url' => 'sub { my $id = shift; return $CFG->{build_detail_url} . \'/\' . $DB->table(\'Links\')->detailed_url($id); }', 'get_footer_categories' => 'sub { # usage ($depth, $sb, $so); my $category = $DB->table(\'Category\'); my $depth = shift || 0; my $sb = shift || "Name"; my $so = shift ||"ASC"; my $pos = shift || 1; $category->select_options("ORDER BY $sb $so"); my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos }); my @loop; while (my $link = $sth->fetchrow_hashref) { $link->{URL} = "$CFG->{build_root_url}/" . $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\'); push @loop, $link; } return { \'category_links_loop\' => \@loop }; }', 'get_header_categories' => 'sub { # usage ($depth, $sb, $so); my $category = $DB->table(\'Category\'); my $depth = shift || 0; my $sb = shift || "Name"; my $so = shift ||"ASC"; my $pos = shift || 0; $category->select_options("ORDER BY $sb $so"); my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos }); my @loop; while (my $link = $sth->fetchrow_hashref) { $link->{URL} = "$CFG->{build_root_url}/" . $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\'); push @loop, $link; } return { \'category_links_loop\' => \@loop }; }', 'get_links' => 'sub { # usage ($type, $sb, $so); my $db = $DB->table(\'Links\'); my $type = shift || "editorial"; my $sb = shift || "Add_Date"; my $so = shift ||"DESC"; my $mh = shift || 10; $db->select_options("ORDER BY $sb $so", "LIMIT $mh"); my $sth = $db->select({ Type => $type }, VIEWABLE); my @loop; while (my $link = $sth->fetchrow_hashref) { $link = Links::SiteHTML::tags(\'link\',$link); push @loop, $link; } return { $type . \'_links_loop\' => \@loop }; }', 'get_links_categories' => 'sub { my $links = shift; my @ids = map { $_->{ID} } @$links; my $catlink = $DB->table(\'CatLinks\',\'Category\'); my %names = $catlink->select(\'LinkID\', \'Full_Name\', { LinkID => \@ids })->fetchall_list; return \%names; }', 'glam_widget' => ' ', 'google_analytics' => ' ', 'main_site_url' => 'sub { return \'https://www.slowtwitch.com\'; }', 'old_related_articles' => 'sub { my $related = shift || return; my @ids = split ("\n",$related); my @loop; my $db = $DB->table(\'Links\'); require Links::SiteHTML; foreach my $id (@ids) { my $link = $db->get($id); $link = Links::SiteHTML::tags(\'link\',$link); push @loop, $link; } return { related_articles_loop => \@loop }; }', 'poll' => '', 'quantcast' => ' ', 'related_articles' => 'sub { my $related = shift || return; my @ids = split ("\n",$related); my @loop; my $db = $DB->table(\'Links\'); my $linkid = shift; my $cond = GT::SQL::Condition->new(); $cond->add(\'RelatedArticles\',\'like\', \'%\' . $linkid . \'%\'); my $sth = $db->select($cond); my $seen = {}; while (my $link = $sth->fetchrow_hashref()) { $link = Links::SiteHTML::tags(\'link\',$link); my @rids = split("\n", $link->{RelatedArticles}); my $found = 0; for (@rids) { my $tid = $_; $tid =~ s/\s+//g; $found = 1 if ($tid == $linkid); } push @loop, $link if ($found); $seen->{$link->{ID}} = 1 if ($found); } require Links::SiteHTML; foreach my $id (@ids) { next if ($seen->{$id}); my $rlink = $db->get($id); if ($rlink) { $rlink = Links::SiteHTML::tags(\'link\',$rlink); push @loop, { %$rlink }; } } return { related_articles_loop => \@loop }; } ', 'related_photos' => 'sub { my $related = shift || return; my @ids = split ("\n",$related); my @loop; use lib \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\'; Links::init(\'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\'); require Plugins::SlideShow; my $DBH = new GT::SQL \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin/defs\'; my $db = $DBH->table(\'Links\'); require Links::SiteHTML; foreach my $id (@ids) { my $link = $db->get($id); my $fh = $db->file_info("Image1_thumbnail", $link->{ID}); my $fdir = $fh->File_Directory(); my $full_path = "$fh"; my $rel_path = $full_path; $rel_path =~ s,$fdir,,; $rel_path =~ s,%,%25,g; $link->{Image1_thumbnail_path} = $rel_path; $link = Links::SiteHTML::tags(\'link\',$link); push @loop, $link; } return { related_photos_loop => \@loop }; }', 'replace_line_break' => 'sub { my $text = shift; $text =~ s// /g; return $text; }', 'rewrite_detail_url' => 'sub { my $tags = GT::Template->tags; if ($tags->{detailed_url} and !$IN->param(\'d\')) { $tags->{detailed_url} =~ s/(\d+)\.html$/j$1.html/; } return $tags; }', 'round' => 'sub { my $num = shift; return sprintf("%.1f", $num - 0.05); } ', 'shorten_it' => 'sub { my $str = shift; my $length = shift || 160; if ($length > 0 and length $str > $length) { $str = substr($str,0,$length); $str =~ s/\s+\w+$//g; $str .= " ..."; } return $str; }', 'sidenav' => '', 'sidenav_fitter' => '', 'site_title' => '<:: Welcome to Slowtwitch.com ::>', 'site_title_short' => 'Slowtwitch.com', 'slowdrive' => '
', 'thumbnail' => 'sub { my $link = shift; my $image1_thumbnail_path = shift; if ($image1_thumbnail_path) { return $image1_thumbnail_path; } elsif ($link->{Link_Type} ne \'video\') { return; } if ($link->{Thumbnail_URL} and $link->{Thumbnail_URL} ne \'http://\') { return $link->{Thumbnail_URL}; } else { require Plugins::ConvertVideo; my $field = Plugins::ConvertVideo::get_file_path($link->{ID}, "thumbnail_file_field"); if ($field->{thumbnail_file_field_path}) { return $field->{thumbnail_file_field_path}; } } return; }', 'ticker_loop' => 'sub { my @coupon_links_loop; my $db = $DB->table(\'Ticker\'); my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM glinks_Ticker ORDER BY ticker_text ASC\'); while (my $result = $sth->fetchrow_hashref) { push @coupon_links_loop, { coupon => $result->{ticker_text}, url => $result->{ticker_link} }; } return { \'coupon_links_loop\' => \@coupon_links_loop }; }' }; # vim:syn=perl:ts=4:noet