function wpmp_ads_widget($args) { if (get_option('wpmp_ads_desktop_disable') && function_exists('wpmp_switcher_outcome') && wpmp_switcher_outcome() == WPMP_SWITCHER_DESKTOP_PAGE) { return; } if (($provider = get_option('wpmp_ads_provider')) != '' && ($publisher_id = get_option('wpmp_ads_publisher_id')) != '') { extract($args); $buffer = $before_widget; if (($title = get_option('wpmp_ads_title')) == '') { $title = __("Mobile ads", 'wpmp'); } //nice to see them in accordions $before_title = str_replace('class="collapsed"', 'class="expanded"', $before_title); $after_title = str_replace('style="display: none;"', 'style="display: block;"', $after_title); $buffer .= $before_title . $title . $after_title; if (strpos($provider, '_') !== false) { $provider = explode('_', $provider, 2); $format = $provider[1]; $provider = $provider[0]; } if (function_exists($function = "wpmp_ads_insertion_{$provider}")) { if (($ad = call_user_func($function, $publisher_id, $format)) != '') { print $buffer; print "<ul><li>{$ad}</li></ul>"; print $after_widget; } } } }
function wpmp_switcher_option_home_siteurl($value) { switch (wpmp_switcher_outcome()) { case WPMP_SWITCHER_MOBILE_PAGE: case WPMP_SWITCHER_MOBILE_INTERSTITIAL: if (($scheme = substr($value, 0, 7)) == "http://" || ($scheme = substr($value, 0, 8)) == "https://") { $path = ""; if (sizeof($parts = explode('/', "{$value}", 4)) == 4) { $path = '/' . array_pop($parts); } if (strpos(get_option('wpmp_switcher_mode'), 'domain') !== false) { $domain = wpmp_switcher_domains('mobile', true); } else { $domain = $_SERVER['HTTP_HOST']; } return $scheme . $domain . $path; } } return $value; }