/** * Creates a new weblogs.com pinger * * @param SiteApplication $app * @param BlorgPost $post * @param string $base_href optional. If not specified, the base href is * build from the application. */ public function __construct(SiteApplication $app, BlorgPost $post, $base_href = null) { $this->app = $app; $this->post = $post; if ($base_href === null) { $this->base_href = $app->getBaseHref() . $app->config->blorg->path; } else { $this->base_href = strval($base_href); } $this->client = XML_RPC2_Client::create(self::WEBLOGS_DOT_COM_SERVER, array('prefix' => 'weblogUpdates.', 'encoding' => 'utf-8')); }
/** * Display an ad * * If $config->blorg->ad_referers_only is true, the referer's domain is * checked against the site's domain to ensure the page has been arrived at * via another site. * * @param SiteApplication $app The current application * @param string $ad_type The type of ad to display */ public static function displayAd(SiteApplication $app, $type) { $type_name = 'ad_' . $type; if ($app->config->blorg->{$type_name} != '') { $base_href = $app->getBaseHref(); $referer = SiteApplication::initVar('HTTP_REFERER', null, SiteApplication::VAR_SERVER); // Display ad if referers only is off OR if there is a referer and // it does not start with the app base href. if (!$app->config->blorg->ad_referers_only || $referer !== null && strncmp($referer, $base_href, strlen($base_href)) != 0) { echo '<div class="ad">'; echo $app->config->blorg->{$type_name}; echo '</div>'; } } }