Example #1
0
File: tools.php Project: gitkv/bash
 public static function extractUrl($match)
 {
     return extract_url(str_replace('@', chr(11), $match[1]));
 }
Example #2
0
function build_ad($type, $content)
{
    global $display_ad;
    global $zone_detail;
    if ($type == 1) {
        $display_ad['available'] = 1;
        $display_ad['ad_id'] = $content['adv_id'];
        $display_ad['campaign_id'] = $content['campaign_id'];
        switch ($zone_detail['zone_type']) {
            case 'banner':
                $display_ad['main_type'] = 'display';
                $display_ad['trackingpixel'] = $content['adv_impression_tracking_url'];
                $display_ad['refresh'] = $zone_detail['zone_refresh'];
                $display_ad['width'] = $content['adv_width'];
                $display_ad['height'] = $content['adv_height'];
                if (MAD_CLICK_ALWAYS_EXTERNAL or $content['adv_click_opentype'] == 'external') {
                    $display_ad['clicktype'] = 'safari';
                    $display_ad['skipoverlay'] = 0;
                    $display_ad['skippreflight'] = 'yes';
                } else {
                    $display_ad['clicktype'] = 'inapp';
                    $display_ad['skipoverlay'] = 0;
                    $display_ad['skippreflight'] = 'no';
                }
                switch ($content['adv_type']) {
                    case 1:
                        $display_ad['type'] = 'hosted';
                        $display_ad['click_url'] = $content['adv_click_url'];
                        $display_ad['image_url'] = get_creative_url($content);
                        /*if ($content['creativeserver_id']==1){
                          $display_ad['image_url']="".MAD_ADSERVING_PROTOCOL . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])."".MAD_CREATIVE_DIR."".$content['unit_hash'].".".$content['adv_creative_extension']."";
                          }
                          else {
                          $server_detail=get_creativeserver($content['creativeserver_id']);
                          $display_ad['image_url']="".$server_detail['server_default_url']."".$content['unit_hash'].".".$content['adv_creative_extension']."";
                          }*/
                        break;
                    case 2:
                        $display_ad['type'] = 'image-url';
                        $display_ad['image_url'] = $content['adv_bannerurl'];
                        $display_ad['click_url'] = $content['adv_click_url'];
                        break;
                    case 3:
                        $display_ad['html_markup'] = $content['adv_chtml'];
                        if ($content['adv_mraid'] == 1) {
                            $display_ad['type'] = 'mraid-markup';
                            $display_ad['skipoverlay'] = 1;
                        } else {
                            $display_ad['type'] = 'markup';
                            if ($display_ad['click_url'] = extract_url($display_ad['html_markup'])) {
                                $display_ad['skipoverlay'] = 0;
                            } else {
                                $display_ad['skipoverlay'] = 1;
                                $display_ad['click_url'] = '';
                            }
                        }
                        break;
                }
                break;
            case 'interstitial':
                $display_ad['main_type'] = 'interstitial';
                $display_ad['type'] = 'interstitial';
                $display_ad['animation'] = 'none';
                $display_ad['interstitial-orientation'] = 'portrait';
                $display_ad['interstitial-preload'] = 0;
                $display_ad['interstitial-autoclose'] = 0;
                $display_ad['interstitial-type'] = 'markup';
                $display_ad['interstitial-skipbutton-show'] = 1;
                $display_ad['interstitial-skipbutton-showafter'] = 0;
                $display_ad['interstitial-navigation-show'] = 0;
                $display_ad['interstitial-navigation-topbar-show'] = 0;
                $display_ad['interstitial-navigation-bottombar-show'] = 0;
                $display_ad['interstitial-navigation-topbar-custombg'] = '';
                $display_ad['interstitial-navigation-bottombar-custombg'] = '';
                $display_ad['interstitial-navigation-topbar-titletype'] = 'fixed';
                $display_ad['interstitial-navigation-topbar-titlecontent'] = '';
                $display_ad['interstitial-navigation-bottombar-backbutton'] = 0;
                $display_ad['interstitial-navigation-bottombar-forwardbutton'] = 0;
                $display_ad['interstitial-navigation-bottombar-reloadbutton'] = 0;
                $display_ad['interstitial-navigation-bottombar-externalbutton'] = 0;
                $display_ad['interstitial-navigation-bottombar-timer'] = 0;
                if (!empty($content['adv_impression_tracking_url'])) {
                    $tracking_pixel_html = generate_trackingpixel($content['adv_impression_tracking_url']);
                } else {
                    $tracking_pixel_html = '';
                }
                switch ($content['adv_type']) {
                    case 1:
                        $display_ad['interstitial-content'] = '<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport" />
<meta name="viewport" content="width=device-width" /><div style="position:absolute;top:0;left:0;"><a href="mfox:external:' . $content['adv_click_url'] . '"><img src="' . get_creative_url($content) . '"></a>' . $tracking_pixel_html . '</div>';
                        break;
                    case 2:
                        $display_ad['interstitial-content'] = '<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport" />
<meta name="viewport" content="width=device-width" /><div style="position:absolute;top:0;left:0;"><a href="mfox:external:' . $content['adv_click_url'] . '"><img src="' . $content['adv_bannerurl'] . '"></a>' . $tracking_pixel_html . '</div>';
                        break;
                    case 3:
                        $display_ad['interstitial-content'] = $content['adv_chtml'] . $tracking_pixel_html;
                        break;
                }
                break;
        }
        return true;
    } else {
        if ($type == 2) {
            $valid_ad = 0;
            $display_ad = $content;
            $display_ad['available'] = 1;
            switch ($display_ad['main_type']) {
                case 'display':
                    switch ($display_ad['type']) {
                        case 'markup':
                            $valid_ad = 1;
                            if (!isset($display_ad['html_markup']) or empty($display_ad['html_markup'])) {
                                return false;
                            }
                            if (!isset($display_ad['click_url']) or empty($display_ad['click_url'])) {
                                if (!($display_ad['click_url'] = extract_url($display_ad['html_markup']))) {
                                    return false;
                                }
                            }
                            if (!isset($display_ad['clicktype']) or empty($display_ad['clicktype'])) {
                                $display_ad['clicktype'] = 'safari';
                            }
                            if (!isset($display_ad['refresh']) or !is_numeric($display_ad['refresh'])) {
                                $display_ad['refresh'] = $zone_detail['zone_refresh'];
                            }
                            if (!isset($display_ad['skipoverlay']) or empty($display_ad['skipoverlay'])) {
                                $display_ad['skipoverlay'] = 0;
                            }
                            if (!isset($display_ad['skippreflight']) or empty($display_ad['skippreflight'])) {
                                $display_ad['skippreflight'] = 'yes';
                            }
                            break;
                        case 'mraid-markup':
                            $valid_ad = 1;
                            if (!isset($display_ad['html_markup']) or empty($display_ad['html_markup'])) {
                                return false;
                            }
                            if (!isset($display_ad['clicktype']) or empty($display_ad['clicktype'])) {
                                $display_ad['clicktype'] = 'safari';
                            }
                            if (!isset($display_ad['refresh']) or !is_numeric($display_ad['refresh'])) {
                                $display_ad['refresh'] = $zone_detail['zone_refresh'];
                            }
                            if (!isset($display_ad['skipoverlay']) or empty($display_ad['skipoverlay'])) {
                                $display_ad['skipoverlay'] = 1;
                            }
                            if (!isset($display_ad['skippreflight']) or empty($display_ad['skippreflight'])) {
                                $display_ad['skippreflight'] = 'yes';
                            }
                            break;
                        case 'image-url':
                            $valid_ad = 1;
                            if (!isset($display_ad['click_url']) or empty($display_ad['click_url'])) {
                                return false;
                            }
                            if (!isset($display_ad['image_url']) or empty($display_ad['image_url'])) {
                                return false;
                            }
                            if (!isset($display_ad['clicktype']) or empty($display_ad['clicktype'])) {
                                $display_ad['clicktype'] = 'safari';
                            }
                            if (!isset($display_ad['refresh']) or !is_numeric($display_ad['refresh'])) {
                                $display_ad['refresh'] = $zone_detail['zone_refresh'];
                            }
                            if (!isset($display_ad['skipoverlay']) or empty($display_ad['skipoverlay'])) {
                                $display_ad['skipoverlay'] = 0;
                            }
                            if (!isset($display_ad['skippreflight']) or empty($display_ad['skippreflight'])) {
                                $display_ad['skippreflight'] = 'yes';
                            }
                            break;
                    }
                    break;
                case 'interstitial':
                    $valid_ad = 1;
                    /*switch ($display_ad['type']){
                          We might add some validation for Interstitials later.
                      }*/
                    break;
            }
            if ($valid_ad != 1) {
                return false;
            }
            return true;
        } else {
            return false;
        }
    }
}
      <header class="article-header">
        <figure class="icon-play helper-image">
          <a href="<?php 
the_permalink();
?>
">
            <?php 
picturefill('dreams-640x400', 'dreams-640x400');
?>
          </a>

          <a href="<?php 
video_url();
?>
" id="openVidOne" data-source="<?php 
extract_url('full');
?>
" class="autoplay"></a>
        </figure>

      </header> <?php 
// end article header
?>


      <aside class="excerpts">
        <h2><?php 
the_title();
?>
</h2>
        <small><?php