PHP code for javascript obsfucation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    PHP code for javascript obsfucation

    I downloaded a PHP code for minification of Javascript from here >> JSMin (PHP)

    Along with, I made a php file to use that PHP class and minify the required js file, like this:
    [PHP]<?php
    //file name: minify.php
    if (!isset($_POST['Submit']))
    {
    ?>
    <html>
    <form action=minify.p hp method=post enctype="multip art/form-data">
    <input type=file name=js></input>
    <input type=submit name=Submit value=Minify>
    </form>
    </html>
    <?php
    }
    else
    {
    include('jsmin-1.1.0.php');

    if ($_FILES['js']['error']>0)
    die ('Error Uploading File');

    $file_js = fopen($_FILES['js']['tmp_name'],"r");
    $js = fread($file_js, $_FILES['js']['size']);
    //echo $js;

    $min = new JSMin;

    $minified = $min->minify($js);

    //echo $minified;
    }
    ?>[/PHP]
    But it gives this warning...

    Missing argument 1 for JSMin::__constr uct()

    What to do... ?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Originally posted by hsriat
    I downloaded a PHP code for minification of Javascript from here >> JSMin (PHP)

    Along with, I made a php file to use that PHP class and minify the required js file, like this:
    [PHP]<?php
    //file name: minify.php
    if (!isset($_POST['Submit']))
    {
    ?>
    <html>
    <form action=minify.p hp method=post enctype="multip art/form-data">
    <input type=file name=js></input>
    <input type=submit name=Submit value=Minify>
    </form>
    </html>
    <?php
    }
    else
    {
    include('jsmin-1.1.0.php');

    if ($_FILES['js']['error']>0)
    die ('Error Uploading File');

    $file_js = fopen($_FILES['js']['tmp_name'],"r");
    $js = fread($file_js, $_FILES['js']['size']);
    //echo $js;

    $min = new JSMin;

    $minified = $min->minify($js);

    //echo $minified;
    }
    ?>[/PHP]
    But it gives this warning...

    Missing argument 1 for JSMin::__constr uct()

    What to do... ?
    [PHP]


    $min = new JSMin(); // there should be something in parenthesis. check that class , search for class JSMIN { and look at the constructor: either __construct or function JSMin() { }





    [/PHP]

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by dlite922
      [PHP]

      $min = new JSMin(); // there should be something in parenthesis. check that class , search for class JSMIN { and look at the constructor: either __construct or function JSMin() { }

      [/PHP]
      You are right....
      it was [php]$min = new JSMin($js);[/php]

      Thanks.. :)

      Comment

      Working...