WordPress.org

Support

Support » How-To and Troubleshooting » Enabling PHP in posts

Enabling PHP in posts

Viewing 12 replies - 1 through 12 (of 12 total)
  • should have a look at stevarino I did something for that.

    where do you added the code ?

    I’m getting this error:

    Parse error: parse error, expecting ','' or ‘;” in /home/mserms/public_html/blogtest/my-hacks.php(18) : eval()’d code on line 4

    which errors do you get exactly ?
    Are you using the following code ?

    function run_php($data) {
    if(false !== strpos($data, "<php>")) {
    $data = str_replace(array("\r\n","\r"), "\n", $data);
    $datas = split('</?php>', $data);
    $data = "echo <<<WP_PHP_PARSER0\n" . str_replace(array("\\","\$","\n","\r"), array("\\\\","\\\$","\\n","\\r"), $datas[0]);
    $j = 0;
    for($i = 1; $i < count($datas); $i += 2) {
    $data .= "\nWP_PHP_PARSER$j;\n" . str_replace(array('’', '“', '”'), array("'", '"', '"'), $datas[$i]);
    $j++;
    $data .= "echo <<<WP_PHP_PARSER$j\n" . str_replace(array("\\","\$","\n","\r"), array("\\\\","\\\$","\\n","\\r"), $datas[$i+1]);
    }
    $data .= "\nWP_PHP_PARSER$j;\n return true;";
    ob_start(); // run that data and grab what comes out
    if(! eval($data)){
    $fp = fopen($DOCUMENT_ROOT."wp-php.txt", 'w');
    fwrite($fp, $data);
    fclose($fp);
    }
    $data = ob_get_clean();
    }
    return $data;
    }
    add_filter('the_content', 'run_php');

    I’m getting this error:

    Parse error: parse error, expecting ','' or ‘;” in /home/mserms/public_html/blogtest/my-hacks.php(18) : eval()’d code on line 4

    I’m getting this error:

    Parse error: parse error, expecting ','' or ‘;” in /home/mserms/public_html/blogtest/my-hacks.php(18) : eval()’d code on line 4

    I’m getting this error:

    Parse error: parse error, expecting ','' or ‘;” in /home/mserms/public_html/blogtest/my-hacks.php(18) : eval()’d code on line 4

    just have a look at my version of the stuff here

    I’m getting this error:

    Parse error: parse error, expecting ','' or ‘;” in /home/mserms/public_html/blogtest/my-hacks.php(18) : eval()’d code on line 4

    can we continue this via mail ? Can you provide me your @mail ?

    Sure, much easier.
    mark [at] scottishclimbs.com

    check your inbox… ;o)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Enabling PHP in posts’ is closed to new replies.
Skip to toolbar