|
@@ -8,6 +8,16 @@
|
|
|
ini_set('display_startup_errors', 1);
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
|
+//http://www.justin-cook.com/2006/03/31/php-parse-a-string-between-two-strings/
|
|
|
+ function get_string_between($string, $start, $end){
|
|
|
+ $string = " ".$string;
|
|
|
+ $ini = strpos($string,$start);
|
|
|
+ if ($ini == 0) return "";
|
|
|
+ $ini += strlen($start);
|
|
|
+ $len = strpos($string,$end,$ini) - $ini;
|
|
|
+ return substr($string,$ini,$len);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//header('Content-type: image/svg+xml'); //does not play video
|
|
|
|
|
@@ -51,18 +61,21 @@
|
|
|
//Get all Text Nodes
|
|
|
$style = $xpath->query('//svg:text');
|
|
|
$keyValueStore=array();
|
|
|
+ $keyValueStore2=array();
|
|
|
|
|
|
//Get all rect nodes before text nodes and store them in key value store to access them for manipulation
|
|
|
foreach ($style as $result) {
|
|
|
$style2 = $xpath->query('./preceding-sibling::*[1]', $result);
|
|
|
//echo $style2[0]->nodeName;
|
|
|
+ //get Rect
|
|
|
foreach ($style2 as $result3) {
|
|
|
- //echo $result3->nodeName;
|
|
|
+ //echo $result->nodeValue;
|
|
|
+ //echo $result3->getAttribute('transform') . "<br>";
|
|
|
$keyValueStore[$result->nodeValue] = $result3;
|
|
|
+ $keyValueStore2[$result->nodeValue] = $result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//$keyValueStore["*imga"]->setAttribute("fill", "#FFFFFF");
|
|
|
|
|
|
|
|
@@ -99,8 +112,27 @@
|
|
|
if($extension == "mp4"){
|
|
|
|
|
|
$element = $doc->createElement('foreignObject');
|
|
|
- $element->setAttribute("x", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('x'));
|
|
|
- $element->setAttribute("y", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('y'));
|
|
|
+
|
|
|
+ //Notwendig da ab und zu mit transform exportiert wird liegt an der powerpoint version
|
|
|
+ if($result3->getAttribute('transform') != null){
|
|
|
+ $transform = get_string_between($keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('transform'), "matrix(", ")");
|
|
|
+ $matrix = explode(" ", $transform);
|
|
|
+ $videox =$matrix[4];
|
|
|
+ $videoy =$matrix[5];
|
|
|
+
|
|
|
+ $element->setAttribute("x", $videox);
|
|
|
+ $element->setAttribute("y", $videoy);
|
|
|
+ }else{
|
|
|
+ $element->setAttribute("x", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('x'));
|
|
|
+ $element->setAttribute("y", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('y'));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // echo $result->nodeValue;// + result3->getAttribute('x');
|
|
|
+ // echo $result3->getAttribute('transform') . "<br>";
|
|
|
+
|
|
|
+
|
|
|
$element->setAttribute("width", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('width'));
|
|
|
$element->setAttribute("height", $keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->getAttribute('height'));
|
|
|
|
|
@@ -118,6 +150,10 @@
|
|
|
|
|
|
$parent = $doc->getElementsByTagName('svg')->item(0);
|
|
|
$parent->appendChild($element);
|
|
|
+
|
|
|
+
|
|
|
+ //override identifier to be empty
|
|
|
+ $keyValueStore2[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->nodeValue = "";
|
|
|
}
|
|
|
else{
|
|
|
|
|
@@ -169,6 +205,10 @@
|
|
|
$parent = $doc->getElementsByTagName('defs')->item(0);
|
|
|
$parent->appendChild($element3);
|
|
|
$keyValueStore[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->setAttribute("fill", "url(#".$node->getElementsByTagName("abbreviation")[0]->nodeValue.")");
|
|
|
+
|
|
|
+
|
|
|
+ //override identifier to be empty
|
|
|
+ $keyValueStore2[$node->getElementsByTagName("abbreviation")[0]->nodeValue]->nodeValue = "";
|
|
|
}
|
|
|
}
|
|
|
}
|