rcharamella Posted June 22, 2009 Share Posted June 22, 2009 Hi, I've got some php code that includes a url that passes some parameters to some flash. I'm using the print funtion. The ? get's converted to $253f and the link doesn't work because of it. What do I need to do to have an actual ? print in my code? Thanks Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/ Share on other sites More sharing options...
flyhoney Posted June 22, 2009 Share Posted June 22, 2009 Can you post the code that is causing the problem? <?php print('?'); should work no problem. Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/#findComment-861353 Share on other sites More sharing options...
aggrav8d Posted June 22, 2009 Share Posted June 22, 2009 http://us3.php.net/manual/en/function.html-entity-decode.php Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/#findComment-861355 Share on other sites More sharing options...
rcharamella Posted June 22, 2009 Author Share Posted June 22, 2009 Here's the code that is causing the problem: <?php print swf('http://www.podtrac.com/pts/redirect.mp3?' . $node->field_offsite_mp3[0]['value'], array('params' => array('height' => '24', 'width' => '300', 'bgcolor' => '1A1A1A'))); ?> This is for SWFTools in Drupal. Thanks in advance for your assistance. Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/#findComment-861482 Share on other sites More sharing options...
flyhoney Posted June 22, 2009 Share Posted June 22, 2009 Unfortunately we dont know what is happening inside the swf() function. I imagine drupal is encoding the '?'. You might have better luck asking on a Drupal forum, or finding the swf() function and posting that code here. Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/#findComment-861500 Share on other sites More sharing options...
rcharamella Posted June 22, 2009 Author Share Posted June 22, 2009 Yes, I see that. The SWF() function is 1300 lines long. I believe that the code below is the code that's encoding the '?', but it's a bit beyond me at this point. Any help in how I might edit this to allow the '?' would be greatly appreciated. function _swftools_filter_process_text($text) { $endl = chr(13) ; if (preg_match_all('@(?:<p>)?\[(swflist|swf) (.*?)\](?:</p>)?@s', $text, $match)) { // $match[0][#] .... fully matched string <swf|swflist parm_0="value_0" parm_1="value_1" parm_2="value_2"> // $match[1][#] .... matched tag type ( swf | swflist ) // $match[2][#] .... full params string until the closing '>' $swftools_parameters = array('file', 'params', 'flashvars', 'othervars', 'methods', 'files'); $match_vars = array(); foreach ($match[2] as $key => $passed_parameters) { preg_match_all('/\s+?(\w*)=[\"](.*?)[\"]#?/', $passed_parameters, $match_vars[$key]); // $match_vars[0][#] .... fully matched string // $match_vars[1][#] .... matched parameter, eg flashvars, params // $match_vars[2][#] .... value after the '=' // Process the parameters onto the $prepared array. // Search for standard parameters, parse the values out onto the array. foreach ($match_vars[$key][1] as $vars_key => $vars_name) { // Switch to swf or swflist, based on file or files // Need to tidy up this line, probably use switch/case if ($vars_name == 'file') { $match[1][$key] = 'swf'; } else { if ($vars_name == 'files') { $match[1][$key] = 'swflist'; } } if ($vars_name == 'file') { $prepared[$key][$vars_name] = $match_vars[$key][2][$vars_key]; unset ($match_vars[$key][1][$vars_key]); } elseif (in_array($vars_name, $swftools_parameters)) { $prepared[$key][$vars_name] = swftools_url_parse(str_replace(array('&&', '&&'), '&', $match_vars[$key][2][$vars_key])); unset ($match_vars[$key][1][$vars_key]); } else { $prepared[$key]['othervars'][$vars_name] = $match_vars[$key][2][$vars_key]; } } // Search for remaining parameters, map them as elements of the standard parameters. if (isset($prepared[$key]['methods']['player'])) { $player = strtolower($prepared[$key]['methods']['player']); } else { $player_key = array_search('player', $match_vars[$key][1]); if ($player_key!==FALSE) { $player = strtolower($match_vars[$key][2][$player_key]); } else { $player = FALSE; } } $prepared[$key]['methods']['player'] = $player; if (count($match_vars[$key][1])) { // Find out if a player has been set. foreach ($match_vars[$key][1] as $vars_key => $vars_name) { if ($parent = swftools_get_filter_alias($vars_name, $player)) { if ($parent) { $prepared[$key][$parent][$vars_name] = $match_vars[$key][2][$vars_key]; } } } } // Just assigning parameters as false if not already set on the $prepared array. // Really just to avoid declaration warnings when we call swf and swf_list if (count($prepared[$key])) { foreach ($swftools_parameters AS $swfparameter) { if (!isset($prepared[$key][$swfparameter])) { $prepared[$key][$swfparameter] = FALSE; } } } // Assemble in to an array of options ready to pass $options = array(); $options['params'] = $prepared[$key]['params']; $options['flashvars'] = $prepared[$key]['flashvars']; $options['othervars'] = $prepared[$key]['othervars']; $options['methods'] = $prepared[$key]['methods']; switch ($match[1][$key]) { case 'swf': $replace = swf($prepared[$key]['file'], $options); break; case 'swflist': if ($prepared[$key]['files']) { foreach ($prepared[$key]['files'] AS $name => $filename) { if (!$filename) { $prepared[$key]['files'][$name] = $name; } } $playlist_data = swftools_prepare_playlist_data($prepared[$key]['files']); $replace = swf_list($playlist_data, $options); } else { $replace = '<!-- No files passed to the playlist -->'; } break; } $matched[] = $match[0][$key]; $rewrite[] = $replace; } return str_replace($matched, $rewrite, $text); } return $text; } Link to comment https://forums.phpfreaks.com/topic/163248-include-a-in-my-php-code/#findComment-861547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.