function HookResourceofthedayAllAdjust_item_price($origprice, $resource, $size) { include_once dirname(__FILE__) . "/../inc/rotd_functions.php"; # Discount pipeline support, allow multiple hook calls to modify the price multiple times global $purchase_pipeline_price; if (isset($purchase_pipeline_price[$resource][$size])) { $origprice = $purchase_pipeline_price[$resource][$size]; } # Fetch the current resource of the day. $rotd = get_resource_of_the_day(); if ($rotd === false) { return $origprice; } # No ROTD, return standard pricing always. if ($resource == $rotd) { # Discount the resource of the day. global $rotd_discount; $return = round($origprice * (1 - $rotd_discount / 100), 2); $purchase_pipeline_price[$resource][$size] = $return; # Use this price instead for future hook calls. return $return; } # This isn't the resource of the day. Normal pricing. return $origprice; }
function HookResourceofthedayHomeReplaceslideshow() { include_once dirname(__FILE__) . "/../inc/rotd_functions.php"; global $baseurl, $view_title_field; $rotd = get_resource_of_the_day(); if ($rotd === false) { return false; } # No ROTD, return false to disable hook and display standard slide show. # Get preview width $sizes = get_image_sizes($rotd, true); foreach ($sizes as $size) { if ($size["id"] == "pre") { $width = $size["width"]; break; } } # Fetch title $title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field={$view_title_field}", ""); # Fetch caption $caption = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=18", ""); # Show resource! $pre = get_resource_path($rotd, false, "pre", false, "jpg"); ?> <div class="HomePicturePanel RecordPanel" style="width: <?php echo $width; ?> px; padding-left: 3px;"> <a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl; ?> /pages/view.php?ref=<?php echo $rotd; ?> "><img class="ImageBorder" style="margin-bottom: 10px;" src="<?php echo $pre; ?> " /></a> <br /> <h2 ><?php echo i18n_get_translated(htmlspecialchars($title)); ?> </h2> <?php echo $caption; ?> </div> <?php return true; }
function HookResourceofthedayHomeReplaceslideshow() { include_once dirname(__FILE__) . "/../inc/rotd_functions.php"; $rotd = get_resource_of_the_day(); if ($rotd === false) { return false; } # No ROTD, return false to disable hook and display standard slide show. # Fetch resource data $resource = get_resource_data($rotd); # Fetch title $title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=8", ""); # Fetch caption $caption = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=18", ""); # Show resource! $pre = get_resource_path($rotd, false, "pre", false, "jpg"); ?> <div class="HomePicturePanel RecordPanel" style="width:350px;padding-left:4px;"> <a href="view.php?ref=<?php echo $rotd; ?> "><img class="ImageBorder" style="margin-bottom: 10px;" src="<?php echo $pre; ?> " /></a> <br /> <h2 ><?php echo i18n_get_translated(htmlspecialchars($title)); ?> </h2> <?php echo $caption; ?> </div> <?php return true; }