473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

PHP code for javascript obsfucation

hsriat
1,654 Expert 1GB
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
2 1656
dlite922
1,584 Expert 1GB
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
1,654 Expert 1GB
[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

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

Similar topics

25
by: delerious | last post by:
I see some code examples like this: <DIV onmouseover="this.style.background='blue'"> and other code examples like this: <DIV onmouseover="javascript:this.style.background='blue'"> Which...
3
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
109
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any...
4
by: Carlo Marchesoni | last post by:
I have a button that opens a new Window (some kind of search-window), which is fired using JavaScript (btnSearch.Attributes=".....";) Now I need to run some code behind code BEFORE this JavaScript...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
2
by: Phil Powell | last post by:
One of the websites I manage uses Superstats for tracking, etc., however, each time the Javascript code is included to perform the track, I got this appearing each time at the top of every page: ...
47
by: SOLAV | last post by:
This is the only working way to completely hide your JavaScript code from the client just like PHP or ASP code. Here we'll need the help of PHP. Here is the code: index.php...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.