Changeset 2862 -- 2012-02-05 12:28:52
- Author
よや
- Comment
- - getEditString の実装
- string 型でも cid 指定出来るようにした
Diffs
IO_SWF/trunk/sample/swfgeteditstring.php
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'IO/SWF/Editor.php';
+
+if ($argc != 3) {
+ echo "Usage: php swfgeteditstring.php <swf_file> <id>\n";
+ echo "ex) php swfgeteditstring.php test.swf 1\n";
+ echo "ex) php swfgeteditstring.php test.swf foo\n";
+ exit(1);
+}
+
+assert(is_readable($argv[1]));
+
+$swfdata = file_get_contents($argv[1]);
+$id = $argv[2];
+
+$swf = new IO_SWF_Editor();
+$swf->parse($swfdata);
+
+echo $swf->getEditString($id) . "\n";
+
+exit(0);
属性に変更があったパス: IO_SWF/trunk/sample/swfgeteditstring.php
___________________________________________________________________
追加: svn:keywords
+ Id
追加: svn:eol-style
+ native
IO_SWF/trunk/IO/SWF/Editor.php
@@ -908,7 +908,7 @@
$this->setCharacterId();
foreach ($this->_tags as &$tag) {
if ($tag->code == 37) { // DefineEditText
- if ($tag->characterId === $id) {
+ if ($tag->characterId === (int) $id) {
if ($tag->parseTagContent() === false) {
return false;
}
@@ -930,4 +930,34 @@
trigger_error("Can't found EditText($id)");
return false;
}
+ function getEditString($id) {
+ $this->setCharacterId();
+ foreach ($this->_tags as &$tag) {
+ if ($tag->code == 37) { // DefineEditText
+ if ($tag->characterId === (int) $id) {
+ if ($tag->parseTagContent() === false) {
+ return false;
+ }
+ if (isset($tag->tag->initialText)) {
+ return $tag->tag->initialText;
+ } else {
+ return null;
+ }
+ } else {
+ if ($tag->parseTagContent() === false) {
+ return false;
+ }
+ if ($tag->tag->VariableName === $id) {
+ if (isset($tag->tag->initialText)) {
+ return $tag->tag->initialText;
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+ }
+ trigger_error("Can't found EditText($id)");
+ return false;
+ }
}