By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

PHP code for javascript obsfucation

hsriat
Expert 100+
P: 1,654
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.php method=post enctype="multipart/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::__construct()

What to do... ?
Feb 18 '08 #1
Share this Question
Share on Google+
2 Replies


dlite922
Expert 100+
P: 1,584
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.php method=post enctype="multipart/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::__construct()

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]
Feb 20 '08 #2

hsriat
Expert 100+
P: 1,654
[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.. :)
Feb 20 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.