prefix . 'visitors_edits'; $edit = $wpdb->get_row("SELECT * FROM ".$table_name." WHERE edit_id=".$_GET["edit"]); $edit->edit_content=stripcslashes($edit->edit_content); $edit->post=get_post($edit->post_id); $options=get_option( "visitors_edits_options", [ "advanced_merge"=>null ]); //Fix nl //$edit->post->post_content=str_replace(["\r\n", "\r", "\n"], "
",$edit->post->post_content); //$edit->post_content=str_replace(["\r\n", "\r", "\n"], "
",$edit->post_content); //$edit->edit_content=str_replace(["\r\n", "\r", "\n"], "
",$edit->edit_content); $edit->post->post_content=nl2br($edit->post->post_content); $edit->post_content=nl2br($edit->post_content); $edit->edit_content=nl2br($edit->edit_content); if($options["advanced_merge"]!=null){ $diff1=visitors_editsDIFF($edit->post_content,$edit->edit_content); $conv_diff1=encodeDiff($diff1); $diff=visitors_editsDIFF($conv_diff1["html"],$edit->post->post_content); $diff=cleanEncodedDiff($diff); $diff=decodeDiff($diff,$conv_diff1["codes"]); }else{ $diff=visitors_editsDIFF($edit->post->post_content,$edit->edit_content); } $diff=cleanDiff($diff); echo ''; showEditor($edit); }else{ noData("Select a visitor contribution"); ?> "Thanks for your contribution to our blog, your contribution was reviewed and approved." ]); ?>

Review a contribution

Delete this contribution
false, "quicktags"=>false, "textarea_name"=>"post_content", "tinymce"=>[ "mode" => "textareas", "theme" => "modern" ] ]); ?>

.*?#i","", $content); } function addAttrTag($tag,$attr,$content){ return preg_replace("#<".$tag."(.*?)>#i","<".$tag." ".$attr."='1'$1>", $content); } function clearTagName($tag,$content){ return preg_replace("##i", "", $content); } function replaceTag($origin,$replace,$content){ return preg_replace("#(<(/*)(".$origin.")(.*?)>)#i", '[$2'.$replace.'$4]', $content); } function encodeDiff($diff){ //composer require paquettg/php-html-parser require_once "parser.php"; $html=str_get_html($diff); $encoded=[ "html"=>"", "codes"=>[ "INS"=>[], "DEL"=>[] ] ]; $id=0; foreach($html->find('ins') as $ins){ $encoded["codes"]["INS"][$id]=$ins->outertext; $ins->outertext="%INS".$id."%"; $id++; } $id=0; foreach($html->find('del') as $del){ $encoded["codes"]["DEL"][$id]=$del->outertext; $del->outertext="%DEL".$id."%"; $id++; } $encoded["html"]=$html->outertext; return $encoded; } function cleanDiff($content){ require_once "parser.php"; $html=str_get_html($content); foreach($html->find('ul') as $ul){ foreach($ul->find("br") as $br){ $br->outertext=""; } } foreach($html->find('ol') as $ol){ foreach($ol->find("br") as $br){ $br->outertext=""; } } return $html; } function cleanEncodedDiff($content){ $html=str_get_html($content); $delete_next=false; $diffs = $html->find('ins, del'); for ($i=0; $i < count($diffs); $i++) { $diff=$diffs[$i]; if($delete_next){ $diff->outertext=""; $delete_next=false; coutinue; }else{ $isSpecial=preg_match("#%(INS|DEL)\d*?%#", $diff->innertext); if ($isSpecial){ //is important if(preg_match("#diffmod#",$diff->outertext)){ $delete_next=true; } $diff->outertext=$diff->innertext; }else{ if($diff->tag==="ins"){ $diff->outertext=$diff->innertext; }else{ $diff->outertext=""; } } } } return $html; } function decodeDiff($content,$codes){ foreach ($codes["INS"] as $id => $code) { $content=str_replace("%INS".$id."%", $code, $content); } foreach ($codes["DEL"] as $id => $code) { $content=str_replace("%DEL".$id."%", $code, $content); } return $content; }