Last active
August 24, 2016 10:22
-
-
Save Hounddog/9e99f814e4e65e760b3db699c3653523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(isset($postContent["body"])) { | |
$postContent["body"] = $this->sanitizeCSS($postContent["body"]); | |
} | |
switch( strtolower( $action )){ | |
case 'publish': | |
try{ | |
$post = $objXMLRPClientWordPress->uploadPost( $postContent ); | |
$dossier->ExternalId = $post['postid']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$html = <<<'EOF' | |
[vc_row][vc_column][vc_column_text]<div class="story story_lead" id="C4DCA34C-CEFB-4FC5-B993-00C2047CFA21"><p class="para para_DE%3aDE_Allgemeine_Formate%3a02_Lead%3aDE_Lead"><span class="char char_$ | |
/[No_character_style]">Lead Artikel 1-spaltig Digenihi llorem etur apientium simuscima nusciet lame recabo. Edis reperum quuntum invelit exeria nonsend igenimu scilloreptat enis el earum qui velliqui tempore nulp. Reperum quuntum invelit exeria nonsend igenimu scilloreptat enis el earum qui velliqui tempore</span></p></div>[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]<div class="story story_copy" id="3A2534A5-8A35-47F1-9FC3-463790FDA863"><p class="para para_DE%3aDE_Allgemeine_Formate%3a03_Copy%3aDE_Copy_Initale"><span class="char char_$ID/[No_character_style]">FCopy Artikel, 3-spaltig Endi ut alictiunt idis a nobiti ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper.<br></br></span></p><p class="para para_DE%3aDE_Allgemeine_Formate%3a03_Copy%3aDE_Copy"><span class="char char_Allgemeine_Formate%3aZwischenhead_bold_purple">Endi ut alictiunt idis a nobiti</span><span class="char char_$ID/[No_character_style]"><br></br>Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui apeure quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped qui et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita.<br></br></span><span class="char char_Allgemeine_Formate%3aZwischenhead_bold_purple">Ut aliqui ape et ut eossiminit<br></br></span><span class="char char_$ID/[No_character_style]">Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam.<br></br><br></br></span><span class="char char_Allgemeine_Formate%3aZwischenhead_bold_purple">Quasped quibea doluptatus dionsed</span><span class="char char_$ID/[No_character_style]"><br></br>Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut quibea doluptatus dionsed quodi omnimendita volupta nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea dolulupta sperfer iatus, nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimptatus dionsed quodi omnimendupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea dol quibea doluptatus dionsed quita volupta uptatus dionsed tuspta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut quibea doluptatus dionsed quodi omnimendita volupta nosape dionsed quita volupta a sperfer iatus, voluptature quam, cum recest, si nosaper. </span></p><p class="para para_DE%3aDE_Allgemeine_Formate%3a03_Copy%3aDE_Copy"><span class="char char_$ID/[No_character_style]">Ut aliqui ape et ut quibea doluptatus dionsed quita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. sperfer iatus, voluptature quam.d quibea doluptatus dionsed quodi omnimendita aliqui ape et ut eossims, nimendita volupta sperfer iatus, voluptature quam. init hitias pora sam aliqui ape et ut eossiminit hitias pora sam omnimendita volupta sperfer iatus, voluptature quam.l</span></p></div>[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]<div class="story story_quote" id="F1C00EFA-A86F-4343-B8E3-0B74BD3414CF"><p class="para para_$ID/NormalParagraphStyle"><span class="char char_$ID/[No_character_style]" style="font-size: 14pt; font-family: 'Helvetica Neue LT Std'; "></span><span class="char char_$ID/[No_character_style]" style="font-size: 14pt; font-family: 'Helvetica Neue LT Std'; "> </span></p><p class="para para_$ID/NormalParagraphStyle"><span class="char char_$ID/[No_character_style]" style="font-size: 14pt; font-family: 'Helvetica Neue LT Std'; "></span><span class="char char_$ID/[No_character_style]" style="font-size: 14pt; font-family: 'Helvetica Neue LT Std'; ">Zitat im Fließtext, Uidella quiatquae dollacc ullaut aspient la exerio. </span><span class="char char_$ID/[No_character_style]" style="font-size: 14pt; font-family: 'Helvetica Neue LT Std'; "></span></p></div>[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]<div class="story story_box_headline" id="13795853-F58C-4116-8C49-84B9718CF70B"><p class="para para_DE%3aDE_Allgemeine_Formate%3a06_Textbox%3aDE_Textbox_Headline"><span class="char char_$ID/[No_character_style]">Headline<br></br>Textbox</span></p></div>[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]<div class="story story_box_lead" id="FF43B353-15F2-4700-8B2C-2BBA74337EFF"><p class="para para_DE%3aDE_Allgemeine_Formate%3a06_Textbox%3aDE_Textbox_Lead"><span class="char char_$ID/[No_character_style]">Lead ut volut quae di as as volupis magnatus cus, con rehento beria conet vere es magnistio quam eatiusae dus.</span></p></div>[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]<div class="story story_box_copy" id="DBEFE99B-826B-4502-A662-4076543F2E49"><p class="para para_DE%3aDE_Allgemeine_Formate%3a06_Textbox%3aDE_Textbox_Copy"><span class="char char_$ID/[No_character_style]">some text for copy element</span></p></div>[/vc_column_text][/vc_column][/vc_row][Wed Aug 24 09:42:34.460750 2016] [:error] [pid 11] [client 172.17.0.1:50000] domdocumentDOMDocument Object\n(\n [doctype] => (object value omitted)\n [implementation] => (object value omitted)\n [documentElement] => (object value omitted)\n [actualEncoding] => \n [encoding] => \n [xmlEncoding] => \n [standalone] => 1\n [xmlStandalone] => 1\n [version] => \n [xmlVersion] => \n [strictErrorChecking] => 1\n [documentURI] => \n [config] => \n [formatOutput] => \n [validateOnParse] => \n [resolveExternals] => \n [preserveWhiteSpace] => 1\n [recover] => \n [substituteEntities] => \n [nodeName] => #document\n [nodeValue] => \n [nodeType] => 13\n [parentNode] => \n [childNodes] => (object value omitted)\n [firstChild] => (object value omitted)\n [lastChild] => (object value omitted)\n [previousSibling] => \n [attributes] => \n [ownerDocument] => \n [namespaceURI] => \n [prefix] => \n [localName] => \n [baseURI] => \n [textContent] => [vc_row][vc_column][vc_column_text]Lead Artikel 1-spaltig Digenihi llorem etur apientium simuscima nusciet lame recabo. Edis reperum quuntum invelit exeria nonsend igenimu scilloreptat enis el earum qui velliqui tempore nulp. Reperum quuntum invelit exeria nonsend igenimu scilloreptat enis el earum qui velliqui tempore[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]FCopy Artikel, 3-spaltig Endi ut alictiunt idis a nobiti ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper.Endi ut alictiunt idis a nobitiUt aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui apeure quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped qui et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita.Ut aliqui ape et ut eossiminitUt aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam.Quasped quibea doluptatus dionsedUt aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut quibea doluptatus dionsed quodi omnimendita volupta nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea dolulupta sperfer iatus, nosaper. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea doluptatus dionsed quodi omnimptatus dionsed quodi omnimendupta sperfer iatus, nimendita volupta sperfer iatus, voluptature quam. Ut aliqui ape et ut eossiminit hitias pora sam quasped quibea dol quibea doluptatus dionsed quita volupta uptatus dionsed tuspta sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut quibea doluptatus dionsed quodi omnimendita volupta nosape dionsed quita volupta a sperfer iatus, voluptature quam, cum recest, si nosaper. Ut aliqui ape et ut quibea doluptatus dionsed quita volupta sperfer iatus, voluptature quam, cum recest, si nosaper. sperfer iatus, voluptature quam.d quibea doluptatus dionsed quodi omnimendita aliqui ape et ut eossims, nimendita volupta sperfer iatus, voluptature quam. init hitias pora sam aliqui ape et ut eossiminit hitias pora sam omnimendita volupta sperfer iatus, voluptature quam.l[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text] Zitat im Flie\xc3\x83\xc2\x9ftext, Uidella quiatquae dollacc ullaut aspient la exerio. [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]HeadlineTextbox[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]Lead ut volut quae di as as volupis magnatus cus, con rehento beria conet vere es magnistio quam eatiusae dus.[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]some text for copy element[/vc_column_text][/vc_column][/vc_row] | |
EOF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sanitizeCSS($html) { | |
$doc = new DOMDocument(); | |
$doc->loadHTML($html); | |
$xpath = new DOMXPath($doc); | |
//first find all parts with classes inside html | |
$entries = $xpath->query('//*[contains(@class, "*")]'); | |
foreach ($entries as $entry) { | |
print_r($entry); | |
} | |
return $html; | |
} | |
sanitizeCSS($html); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment