Does WordPress have a built in reference to the PHP version its running under?

I have a plugin that has a single method that requires PHP5. How can I code around the fact that the server may have PHP4?

Code is below… (I’m thinking its the DOMDocument object that’s freezing the plugin when running on a PHP4 server.

function rseo_doTheParse($heading, $post){
    $content = $post->post_content;
    if($content=="" || is_php4()) return false;
    $keyword = trim(strtolower(rseo_getKeyword($post)));
    @$dom = new DOMDocument;
    @$dom->loadHTML(strtolower($post->post_content));
    $xPath = new DOMXPath(@$dom);
    switch ($heading)
        {
        case "img-alt": return $xPath->evaluate('boolean(//img[contains(@alt, "'.$keyword.'")])');
        default: return $xPath->evaluate('boolean(/html/body//'.$heading.'[contains(.,"'.$keyword.'")])');
        }
}


function is_php4(){//code here}

Related posts

Leave a Reply

3 comments