Example #1
0
 function getWikihowAdUnit($num)
 {
     global $wgUser, $wgLanguageCode;
     if ($wgLanguageCode == "en") {
         $channelArray = self::getCustomGoogleChannels('adunit' . $num, false);
         $channels = $channelArray[0];
     } else {
         $channels = self::getInternationalChannels();
     }
     $params = self::getCSIParameters($num);
     if ($params['slot'] == null || $params['width'] == null || $params['height'] == null || $params['max_ads'] == null) {
         //we don't have the required information, so lets spit out an error message
         $tmpl = new EasyTemplate(dirname(__FILE__));
         $tmpl->set_vars(array('adId' => $num, 'params' => $params));
         $s = $tmpl->execute('wikihowError.tmpl.php');
     } else {
         $tmpl = new EasyTemplate(dirname(__FILE__));
         $tmpl->set_vars(array('adId' => $num, 'channels' => $channels, 'params' => $params));
         if (wikihowAds::isABTestArticle()) {
             $s = $tmpl->execute('wikihowAdAsync.tmpl.php');
         } else {
             $s = $tmpl->execute('wikihowAdCSI.tmpl.php');
         }
         $s = "<div class='wh_ad'>" . $s . "</div>";
     }
     return $s;
 }