svnno****@sourc*****
svnno****@sourc*****
2010年 12月 1日 (水) 03:35:36 JST
Revision: 344 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=344 Author: yoya Date: 2010-12-01 03:35:36 +0900 (Wed, 01 Dec 2010) Log Message: ----------- setActionVaribles のテストスクリプト Added Paths: ----------- trunk/sample/swfsetactionvariables.php -------------- next part -------------- Added: trunk/sample/swfsetactionvariables.php =================================================================== --- trunk/sample/swfsetactionvariables.php (rev 0) +++ trunk/sample/swfsetactionvariables.php 2010-11-30 18:35:36 UTC (rev 344) @@ -0,0 +1,30 @@ +<?php + +if ($argc < 3) { + fprintf(STDERR, "Usage: swfsetactionvariables <swf_file> <key=value> [<key2=value2> [...]]\n"); + exit(1); +} + +$swf_filename = $argv[1]; +$key_value_list = array_splice($argv, 2); +$swfdata = file_get_contents($swf_filename); + +$obj = new SWFEditor(); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} + +$variables = array(); + +foreach ($key_value_list as $key_value) { + list($key, $value) = explode('=', $key_value, 2); + $variables[$key] = $value; +} + +if ($obj->setActionVariables($variables) == false) { + echo "failed\n"; + exit(1); +} + +echo $obj->output();