Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Swoole; /** * HTML DOM * HTMLjavascript DOM * getElementById getElement..

Decoded Output download

<?php
namespace Swoole;
/**
 * HTML DOM
 * HTMLjavascript DOM
 * getElementById getElementsByTagName createElement
 * @author Tianfeng.Han
 * @package SwooleSystem
 * @subpackage HTML
 *
 */
class HTML
{
    /**
     * 
     * @param $content
     * @return mixed
     */
    static function removeComment($content)
	{
	    return preg_replace('#<!--[^>]*-->#','',$content);
	}

    /**
     * 
     * @param $current
     * @param $url
     * @return string
     */
    static function  parseRelativePath($current, $url)
    {
        //HTTP
        if (substr($url, 0, 7) !== 'http://' and substr($url, 0, 8) !== 'https://' )
        {
            ///
            if ($url[0] == '/')
            {
                $_u = parse_url($current);
                return $_u['scheme'].'://'.$_u['host'].$url;
            }
            else
            {
                $n = strrpos($current, '/');
                return substr($current, 0, $n + 1).$url;
            }
        }
        else
        {
            return $url;
        }
    }

    /**
     * HTML
     * @param $html
     * @param array $rules
     * @return mixed
     */
    static function  removeTag($html, $rules = array('script', 'style'))
    {
        //file_put_contents('tmp2.html', $html);
        foreach($rules as $r)
        {
            while(1)
            {
                $search1 = '<'.$r;
                $pos1 = stripos($html, $search1);
                if ($pos1 === false)
                {
                    break;
                }
                $search2 = '</'.$r.'>';
                $pos2 = stripos($html, $search2,$pos1);
                $offset = $pos2 + strlen($search2);

                //TODO JSJS
                //if ($html[$offset] == '"' or $html[$offset] == "'")

                if ($pos2 === false)
                {
                    \Swoole::$php->log->warn("$r");
                    break;
                }
                $html = substr($html, 0, $pos1).substr($html, $offset);
            }
        }
        return $html;
    }

    /**
     * HTMLtag
     * @param $html
     * @param array $remove_attrs
     * @return mixed
     */
    static function removeAttr($html, $remove_attrs = array())
    {
        //
        if (!is_array($remove_attrs) or count($remove_attrs) == 0)
        {
            return preg_replace('~<([a-z]+)[^>]*>~i','<$1>', $html);
        }
        //
        else
        {
            foreach($remove_attrs as $attr)
            {
                $regx = '~<([^>]*?)[\s	
]+('.$attr.'[\s	
]*=[\s	
]*([\"\'])[^]*?)([^>]*)>~i';
                $html = preg_replace($regx,'<$1 $4>', $html);
            }

            return $html;
        }
    }
} ?>

Did this file decode correctly?

Original Code

<?php
namespace Swoole;
/**
 * HTML DOM
 * HTMLjavascript DOM
 * getElementById getElementsByTagName createElement
 * @author Tianfeng.Han
 * @package SwooleSystem
 * @subpackage HTML
 *
 */
class HTML
{
    /**
     * 
     * @param $content
     * @return mixed
     */
    static function removeComment($content)
	{
	    return preg_replace('#<!--[^>]*-->#','',$content);
	}

    /**
     * 
     * @param $current
     * @param $url
     * @return string
     */
    static function  parseRelativePath($current, $url)
    {
        //HTTP
        if (substr($url, 0, 7) !== 'http://' and substr($url, 0, 8) !== 'https://' )
        {
            ///
            if ($url[0] == '/')
            {
                $_u = parse_url($current);
                return $_u['scheme'].'://'.$_u['host'].$url;
            }
            else
            {
                $n = strrpos($current, '/');
                return substr($current, 0, $n + 1).$url;
            }
        }
        else
        {
            return $url;
        }
    }

    /**
     * HTML
     * @param $html
     * @param array $rules
     * @return mixed
     */
    static function  removeTag($html, $rules = array('script', 'style'))
    {
        //file_put_contents('tmp2.html', $html);
        foreach($rules as $r)
        {
            while(1)
            {
                $search1 = '<'.$r;
                $pos1 = stripos($html, $search1);
                if ($pos1 === false)
                {
                    break;
                }
                $search2 = '</'.$r.'>';
                $pos2 = stripos($html, $search2,$pos1);
                $offset = $pos2 + strlen($search2);

                //TODO JSJS
                //if ($html[$offset] == '"' or $html[$offset] == "'")

                if ($pos2 === false)
                {
                    \Swoole::$php->log->warn("$r");
                    break;
                }
                $html = substr($html, 0, $pos1).substr($html, $offset);
            }
        }
        return $html;
    }

    /**
     * HTMLtag
     * @param $html
     * @param array $remove_attrs
     * @return mixed
     */
    static function removeAttr($html, $remove_attrs = array())
    {
        //
        if (!is_array($remove_attrs) or count($remove_attrs) == 0)
        {
            return preg_replace('~<([a-z]+)[^>]*>~i','<$1>', $html);
        }
        //
        else
        {
            foreach($remove_attrs as $attr)
            {
                $regx = '~<([^>]*?)[\s\t\r\n]+('.$attr.'[\s\t\r\n]*=[\s\t\r\n]*([\"\'])[^\3]*?\3)([^>]*)>~i';
                $html = preg_replace($regx,'<$1 $4>', $html);
            }

            return $html;
        }
    }
}

Function Calls

None

Variables

None

Stats

MD5 50cf50233df9c03c02e4889aaaad54f6
Eval Count 0
Decode Time 107 ms