pein0119 / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

HTML and PHP problem. #165

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
<?php
require('phpQuery.php');

$HTMLSTRING =  file_get_contents('http://pastebin.com/raw.php?i=wD6jUPXe');

$doc = phpQuery::newDocumentPHP($HTMLSTRING);
echo $doc;
exit;
?>
Result is:
http://pastebin.com/raw.php?i=Lc2Xz9vC

this is different text.

<?php
require('phpQuery.php');

$HTMLSTRING =  file_get_contents('http://pastebin.com/raw.php?i=wD6jUPXe');

$doc = phpQuery::newDocument($HTMLSTRING);
echo $doc;
exit;
?>
Result is:
http://pastebin.com/raw.php?i=Xg6AZ9yU
&gt; i can replace to >, but
"$result .= "<li><a href="%22.%24URLS%5B" script>"  is very hard to repair :<

Original issue reported on code.google.com by KBord...@gmail.com on 6 Jan 2011 at 6:00

GoogleCodeExporter commented 8 years ago
    public static function phpToMarkup($php, $charset = 'utf-8') {
            $php = preg_replace_callback(
                    "/<\?php(.*?)\?>/si",
                    array('phpQuery', '_phpToMarkupCallback'),
                    $php
                );
        return $php;
    }
    public static function _phpToMarkupCallback($php, $charset = 'utf-8') {
        return "<php><!--PHP".htmlspecialchars($php[1], ENT_QUOTES|ENT_NOQUOTES, $charset).' PHP--></php>';
    }

This is fixed code for this problem. 

Original comment by KBord...@gmail.com on 6 Jan 2011 at 9:16

GoogleCodeExporter commented 8 years ago
ahhh, and replace :

    public static function _markupToPHPCallback($m) {
        return "<"."?php ".htmlspecialchars_decode($m[1], ENT_QUOTES|ENT_NOQUOTES)." ?".">";
    }

Original comment by KBord...@gmail.com on 6 Jan 2011 at 9:20

GoogleCodeExporter commented 8 years ago
Fixed code 
http://code.google.com/p/xvweb/source/browse/trunk/%20xvweb/core/libraries/phpQu
ery/phpQuery.php

Original comment by KBord...@gmail.com on 13 Feb 2011 at 12:02