337 lines
12 KiB
Plaintext
337 lines
12 KiB
Plaintext
|
{
|
||
|
'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' => '<!-- Begin comScore Tag -->
|
||
|
<script>
|
||
|
var _comscore = _comscore || [];
|
||
|
_comscore.push({ c1: "2", c2: "10037191" });
|
||
|
(function() {
|
||
|
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
|
||
|
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
|
||
|
el.parentNode.insertBefore(s, el);
|
||
|
})();
|
||
|
</script>
|
||
|
<noscript>
|
||
|
<img src="https://b.scorecardresearch.com/p?c1=2&c2=10037191&cv=2.0&cj=1" />
|
||
|
</noscript>
|
||
|
<!-- End comScore Tag -->',
|
||
|
'convert_nl_br' => 'sub {
|
||
|
my $tags = GT::Template->tags;
|
||
|
foreach (keys %$tags) {
|
||
|
next if ($_ eq \'RelatedArticles\');
|
||
|
$tags->{$_} =~ s/\r//g;
|
||
|
$tags->{$_} =~ s/\n/<br \/>/g;
|
||
|
}
|
||
|
return $tags;
|
||
|
}',
|
||
|
'dans_series' => '- <a href="http://www.slowtwitch.com/News/F.I.S.T._Workshop_schedule_set_957.html">F.I.S.T. Workshops</a>
|
||
|
<br />- <a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a>
|
||
|
<br />- <a href="http://www.slowtwitch.com/retailers/">Retailers</a>
|
||
|
<br />- <a href="http://www.slowtwitch.com/stackreach/index.php">Stack // Reach</a>
|
||
|
<br />- <a href="http://training.slowtwitch.com/">Training Log</a>
|
||
|
<br />- <a href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a>',
|
||
|
'forum_url' => 'sub {
|
||
|
return \'http://forumdev.slowtwitch.com\';
|
||
|
}',
|
||
|
'ga_link_tracker' => '<!--Google Analytics Link Tracker -->
|
||
|
<script type="text/javascript">
|
||
|
function recordOutboundLink(link, category, action) {
|
||
|
_gat._getTrackerByName()._trackEvent(category, action);
|
||
|
setTimeout(\'document.location = "\' + link.href + \'"\', 100);
|
||
|
}
|
||
|
</script>',
|
||
|
'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' => '<a href="mailto:slowman@slowtwitch.com?cc=lars@slowtwitch.com&Subject=Send me a Slowtwitch Media Guide"><img src="http://www.slowtwitch.com/images/advertise_160.png"></a>
|
||
|
',
|
||
|
'google_analytics' => '<!-- Google Analytics -->
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
var _gaq = _gaq || [];
|
||
|
_gaq.push([\'_setAccount\', \'UA-2419103-1\']);
|
||
|
_gaq.push([\'_setDomainName\', \'.slowtwitch.com\']);
|
||
|
_gaq.push([\'_trackPageview\']);
|
||
|
|
||
|
(function() {
|
||
|
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
|
||
|
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
|
||
|
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
|
||
|
})();
|
||
|
|
||
|
</script>',
|
||
|
'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' => '<!--#include virtual="/cgi-bin/ssi_poll.cgi?poll=home" -->',
|
||
|
'quantcast' => '<!-- Quantcast Tag -->
|
||
|
<script type="text/javascript">
|
||
|
var _qevents = _qevents || [];
|
||
|
|
||
|
(function() {
|
||
|
var elem = document.createElement(\'script\');
|
||
|
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
|
||
|
elem.async = true;
|
||
|
elem.type = "text/javascript";
|
||
|
var scpt = document.getElementsByTagName(\'script\')[0];
|
||
|
scpt.parentNode.insertBefore(elem, scpt);
|
||
|
})();
|
||
|
|
||
|
_qevents.push({
|
||
|
qacct:"p-wtcPAHdnETGn_"
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<noscript>
|
||
|
<div style="display:none;">
|
||
|
<img src="//pixel.quantserve.com/pixel/p-wtcPAHdnETGn_.gif" border="0" height="1" width="1" alt="Quantcast"/>
|
||
|
</div>
|
||
|
</noscript>
|
||
|
<!-- End Quantcast tag -->',
|
||
|
'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/<br\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' => '<ul class="sidenav">
|
||
|
<li><a href="http://www.slowtwitch.com/retailers/">Bike Shops</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/coaches/">Coaches</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Bike_Fit/F.I.S.T._2010/11_Schedule_live_1426.html">F.I.S.T. Workshops</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/fitters/">Fitters</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/runshops/">Running Stores</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/stackreach/">Stack // Reach</a></li>
|
||
|
<li><a href="http://training.slowtwitch.com/">Training Log</a></li>
|
||
|
<li><a class="last" href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a></li>
|
||
|
</ul>',
|
||
|
'sidenav_fitter' => '<ul class="sidenav">
|
||
|
<li><a href="http://www.slowtwitch.com/Bike_Fit/index.html">Bike Fit Articles</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Bike_Fit/F_I_S_T__Workshops/index.html">F.I.S.T. Workshops </a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/stackreach/">Stack/Reach Database</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Fit_Calculator/stem_calc.php">Stem Calculator</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Fit_Calculator/bar_bore_calc.php">Bar to HT Calculator</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Tri Geometry Calculator</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/fitters/">Fitters Database</a></li>
|
||
|
<li><a href="http://www.slowtwitch.com/retailers/">Bike Shops Database</a></li>
|
||
|
<li><a class="last" href="http://forum.slowtwitch.com/gforum.cgi?forum=10;">Fitter\'s Forum</a></li>
|
||
|
</ul>',
|
||
|
'site_title' => '<:: Welcome to Slowtwitch.com ::>',
|
||
|
'site_title_short' => 'Slowtwitch.com',
|
||
|
'slowdrive' => '<form action="https://secure.slowtwitch.com/cgi-bin/glist.cgi" method="post" name="subdrive">
|
||
|
<input type="hidden" name="do" value="user_subscribe">
|
||
|
<input type=hidden name="lid" value="158">
|
||
|
<div style="width: 158px; border: 1px solid #000000; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;">
|
||
|
<span style="float: left; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><img src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_top_blugry_160.png" style="padding-bottom: 0px; margin-bottom: 0px;"/></span>
|
||
|
<span style="clear: both; float: left; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><input type="text" id="searchbox" name="email" class="text" style="width: 130px; vertical-align: baseline; margin-top: 8px; margin-left: 4px;"></span>
|
||
|
<span style="float: right; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;"><img src="http://www.slowtwitch.com/images/glinks/clear_shim.gif" height=1 width=4><input type="image" value="Submit" alt="Sign Up!" src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_right_blugry.png"></span>
|
||
|
<img src="http://www.slowtwitch.com/images/glinks/slowtwitch_subdrive_bottom_blugry_160.png" style="border: none; vertical-align: bottom;" /></div>
|
||
|
</form>',
|
||
|
'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
|