منتدى استراحات زايد

منتدى استراحات زايد (http://vb.ma7room.com/index.php)
-   منتدى أخبار المواقع والمنتديات العربية والأجنبية (http://vb.ma7room.com/forumdisplay.php?f=183)
-   -   flash integration problem in main header (using OpenX delivery) (http://vb.ma7room.com/showthread.php?t=231887)

محروم.كوم 09-14-2009 08:20 AM

flash integration problem in main header (using OpenX delivery)
 
Hi guys,

the problems associated with swf and flash delivery seem to be numerous and I have been searching and asking on vb.org and at openx for some time to no avail.

I thought I might beg your indulgence and try to get my head around the problem by coming back to the source so to speak.

I will make every effort to clearly describe my approach and avoid any unnecessary conflict between the openx offering and vB supported/unsupported contexts.

For reference I have been pursuing a solution in these threads:
http://www.vbulletin.org/forum/showthread.php?t=219301
http://www.vbulletin.org/forum/showthread.php?t=217254
http://forum.openx.org/index.php?sho...=503428016&hl=

The problem is simple:
1) I have modified some code that uses openx's localmode to invoke an advertising campaign, delivering a banner to the header thus:
Template: ad_header_logo
Code:

The ad tag is what calls the banner in:
Ad tag callback in template_compile
Code:
if (!function_exists('_tag_callback'))
{
/**
* Callback-function for process_template_tag() which "parses" arguments and returns PHP code for eval
*
* @param string Options/arguments of tag
* @param string Name of function to call
* @param array Associative array of argument names and default values
*
* @return string
*/
function _tag_callback($options, $functionhandle, $arglist)
{
$options = stripslashes($options);
trim($options);
trim($functionhandle);

if (!function_exists('replace_template_variables'))
{
require_once(DIR . '/includes/functions_misc.php');
}

$param = array();
if (is_array($arglist))
{
reset($arglist);
foreach ($arglist AS $key => $val)
{
if (preg_match('#'.$key.'=([\\\]["\'])(.*?)\1#', $options, $matches))
{
$param[] = $matches[2];
}
else
{
// default argument
$param[] = $val;
}
}
}

foreach ($param AS $argument)
{
if ($return == '')
{
$return = '" . ' . $functionhandle . '(';
}
else
{
$return .= ', ';
}
// Surround variables with {} - not failsafe, but should do the job in most cases
$argument = preg_replace('#\$([a-z0-9_>-]+)((\[\'.*?\'\])+)#i', '{$\\1\\2}', $argument);
// {{$foo}} --> {$foo}
$argument = preg_replace('#(\{+)\$(.*?)(\}+)#i', '{$\\2}', $argument);

// Replace legacy variable names in templates with their modern equivalents
$argument = replace_template_variables($argument, true);

$return .= '"' . $argument . '"';
}
$return .= ') . "';
return $return;
}
}

if (!function_exists('process_template_tag'))
{
/**
* Processes user-defined tags into myfunction() PHP code for eval
*
* @param string Title of tag
* @param string Un-parsed template HTML
* @param string Name of function to call
* @param array Associative array of argument names and default values, order must be the same as for the function specified previously
*
* @return string
*/
function process_template_tag($tagname, $text, $functionhandle='', $arglist)
{
if ($functionhandle == '')
{
// No function specified - remove tag
return preg_replace("#|#si", '', $text);
}
else
{
return preg_replace("##sie", "_tag_callback('\\3', \$functionhandle, \$arglist)", $text);
}
}
}

$template = process_template_tag('ad', $template, 'view_ad', array('what' => '', 'clientid' => 0, 'target' => '', 'source' => '', 'withtext' => 0) );
This combines with the view ad function in init_startup
Code:
if (!function_exists('view_ad'))
{
/**
* Calls view_raw function from phpAdsNew either locally or via xml-rpc to get HTML advertisement code, see phpAdsNew for infos.
*
* @param string Zone name (zone:x) or keywords (keyword1|keyword2|...)
* @param integer Client-ID
* @param string Target
* @param string Source
* @param integer Withtext
*
* @return string
*/
function view_ad($what, $clientid = 0, $target = '', $source = '', $withtext = 0)
{
global $vbulletin;
static $panpath;

if (!$panpath)
{
trim($vbulletin->options['panpath']);
$panpath = @parse_url($vbulletin->options['panpath']);
}

// Calculate an identifier for the requested ad - this could be used to cache banners retrieved via xmlrpc in future versions
$adid = sprintf('%u', crc32($what . $clientid . $target . $source . $withtext));

if ($vbulletion->options['addtemplatename'] or $vbulletin->config['Misc']['debug'])
{
// Be verbose
$adcomment = 'id="' . $adid . '" what="' . htmlspecialchars($what) . '" clientid="' . htmlspecialchars($clientid)
. '" target="' . htmlspecialchars($target) . '" source="' . htmlspecialchars($source)
. '" withtext="' . htmlspecialchars($withtext) . '"';
}
else
{
$adcomment = $adid;
}

if ($vbulletin->options['panpath'] == '')
{
// Path to phpAdsNew is empty - disable ads
return "";
}
elseif (strtolower($panpath['scheme']) == 'http')
{
// get banner from phpAdsNew via xml-rpc
/*
// ATTN:
// In phpAdsNew 2.0.6 (and maybe earlier versions) is a tiny bug which prevents xml-rpc from working cleanly.
//
// Patch:
// --- phpAdsNew/misc/samples/xmlrpc/php/lib-xmlrpc.inc.php.orig Tue Aug 16 10:51:26 2005
// +++ phpAdsNew/misc/samples/xmlrpc/php/lib-xmlrpc.inc.php Thu Oct 27 17:12:26 2005
// @@ -76,6 +76,7 @@
// global $xmlrpcStruct;
//
// global $xmlrpcTypes;
// + global $xmlrpc_valid_parents;
// global $xmlEntities;
// global $xmlrpcerr;
// global $xmlrpcstr;
//
// See https://sourceforge.net/tracker/?fun...group_id=11386 for details.
*/

global $xmlrpcbanner, $phpAds_remoteInfo;
require_once(DIR . '/includes/lib-xmlrpc-class.inc.php'); // see misc/samples/xmlrpc/php/ directory of your phpAdsNew installation

if (!$xmlrpcbanner)
{
$xmlrpcbanner = new phpAds_XmlRpc($panpath['host'], $panpath['path'], (intval($panpath['port']) > 0 ? $panpath['port'] : 80));
}

$ad = $xmlrpcbanner->view_raw($what, $clientid, $target, $source, $withtext);

return "{$ad['html']}";
}
else
{
// get banner via direct invocation of phpAdsNew
// this is basically taken from the invocationcode generated by phpAdsNew - it does its own checks to prevent multiple inclusion

global $phpAds_context;

if (@require($vbulletin->options['panpath'] . (strstr($vbulletin->options['panpath'] , '/phpadsnew.inc.php') ? '' : '/phpadsnew.inc.php' )))
{
if (!isset($phpAds_context))
{
$phpAds_context = array();
}

$ad = view_raw($what, $clientid, $target, $source, $withtext, $phpAds_context);

if ($vbulletin->options['panbandupes'])
{
// Remember bannerid to prevent showing banner multiple times on same page
$phpAds_context[] = array('!=' => 'bannerid:'.$ad['bannerid']);
}
OA_setTimeZone('Australia/Sydney');
return "{$ad['html']}";
}
}
}
}
to pull the desired ad.

So... Why is it that the localmode invocation that gets generated when an swf banner is delivered does not display?
The very same invocation code when placed in its own php script delivers and displays correctly - this link illustrates the following code:
http://www.archeli.com.au/forums/localmode.php

PHP Code:


Can anyone see what I need to do to make the ad call back and view plugins overcome the limitation that exists as they are implemented in the vB ad header context. gif and jpg etc all work perfectly - only swf fail and fall back to the static content.
There must be a fundamental wrapper or declaration statement/condition that I need to add to allow swf to be embedded properly.

I would very much appreciate any help with this since I have been searching and researching in vain for some time. I am sure it is something rather trivial that I am missing - when I get it sorted I will write up the process at vb.org so others can benefit.

Please understand that I know this is not core support for vB and I have tried at .org to no avail, openx point to vb since the code works in its own script. given that there are so many questions around flash in headers I thought I might ask. I understand if you won't address the issue however since this is out of scope.

Will


الساعة الآن 12:17 PM

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By Almuhajir


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227