public $frame_width; // int(11)
public $frame_height; // int(11)
public $frame_style; // TEXT
- public $frame_body; // TEXT
+ public $frame_body; // LONGTEXT
+ public $frame_body_clean; // LONGTEXT
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
+ function convertClean(){
+ $data = $this->frame_body;
+ libxml_use_internal_errors (true);
+ $doc = new DOMDocument();
+ $doc->loadHTML($data);
+ //$doc->loadHTML($data);
+ $xpath = new DOMXpath($doc);
+ }
+ function createAssets(){
+ $data = $this->frame_body;
+ libxml_use_internal_errors (true);
+ $doc = new DOMDocument();
+ $doc->loadHTML($data);
+ //$doc->loadHTML($data);
+ $xpath = new DOMXpath($doc);
+
+ foreach($xpath->query('//link') as $l){
+ $url=parse_url($l->getAttribute("href"));
+ echo print_r($url);
+ $file = '/home/reddit/assets/'. $url["host"] . $url["path"];
+ if(file_exists($file)){
+ echo "file exists already.\n";
+ continue;
+ }
+ $dir = dirname($file);
+ if(!file_exists($dir)){
+ echo "Made directory: ".$dir . "\n";
+ mkdir($dir,0775,true);
+ }
+ file_put_contents($file,file_get_contents($l->getAttribute("href")));
+ }
+
+ $x=0;
+ foreach($xpath->query('//img') as $im){
+ echo "\$x=".$x++."\n";
+ $url=parse_url($im->getAttribute("src"));
+ echo "\n\n".print_r($im->getAttribute("src"))."\n\n";
+ $file = '/home/reddit/assets/'. $url["host"] . $url["path"];
+ if(file_exists($file)){
+ echo "file exists already.";
+ continue;
+ }
+ $dir = dirname($file);
+ if(!file_exists($dir)){
+ echo "Made directory: ".$dir . "\n";
+ mkdir($dir,0775,true);
+ }
+ file_put_contents($file,file_get_contents($im->getAttribute("src")));
+ }
+ }
function convertHTML(){
//var_dump($url);