Skip to content

Commit 2c77e9f

Browse files
committed
phpcc update
1 parent 9fc0869 commit 2c77e9f

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

samples/sample.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
/**
7070
* Add jQuery file and individual compression
7171
*/
72+
// $phpcc->reset();
7273
// $ary_result = $phpcc
7374
// ->add("js/jquery-1.10.2.js")
7475
// ->add("js/1.9/jquery-1.9.1.js")
@@ -79,6 +80,7 @@
7980
/**
8081
* Set Directory path find .js file and combined compression to one file.
8182
*/
83+
// $phpcc->reset();
8284
// $ary_result = $phpcc
8385
// ->setDir("js")
8486
// ->exec("all.js");
@@ -87,6 +89,7 @@
8789
/**
8890
* Set Directory path . Auto find js file and individual compression
8991
*/
92+
// $phpcc->reset();
9093
// $ary_result = $phpcc
9194
// ->setDir("js")
9295
// ->single()
@@ -96,6 +99,7 @@
9699
/**
97100
* Mixed
98101
*/
102+
// $phpcc->reset();
99103
// $ary_result = $phpcc
100104
// ->setDir("js")
101105
// ->add("js/1.9/jquery-1.9.1.js")
@@ -105,6 +109,7 @@
105109
/**
106110
* You can use param() add Closure Compiler command param.
107111
*/
112+
// $phpcc->reset();
108113
// $ary_result = $phpcc
109114
// ->add("js/jquery-1.10.2.js")
110115
// ->param("--angular_pass")

src/PhpCc.class.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
**/
2727
class PhpCc {
2828

29+
static public $VERSION = "v0.5.0";
30+
2931
public function __construct($options)
3032
{
3133

@@ -47,7 +49,7 @@ public function __construct($options)
4749
* Add javascript file to compiler list
4850
*
4951
* @param string $file
50-
* @return class phpcc
52+
* @return self
5153
*/
5254
public function add($file)
5355
{
@@ -70,13 +72,18 @@ public function add($file)
7072
* Execute compiler.
7173
*
7274
* @param string $filename
73-
* @return class phpcc
75+
* @return self
7476
*/
7577
public function exec($filename = 'all.min.js')
7678
{
7779

7880
$str_file = '';
7981

82+
if(substr($this->js_dir, -1)=="/")
83+
{
84+
$this->js_dir = substr($this->js_dir,0, strlen($this->js_dir)-1);
85+
}
86+
8087
if($this->bol_single){
8188

8289
$ary_result = array();
@@ -98,9 +105,9 @@ public function exec($filename = 'all.min.js')
98105
for ($i=0; $i < $num_js; $i++) {
99106

100107
$str_file = ' --js ' . $this->js_files_dir[$i];
101-
echo $this->js_files_dir[$i] ."|" . $this->js_dir . "\n";
108+
102109
$filename = str_replace($this->js_dir, '', $this->js_files_dir[$i]);
103-
echo $filename."\n";
110+
104111
$ary_result[] = $this->_get_argv($str_file,$filename);
105112

106113
}
@@ -151,7 +158,7 @@ public function help()
151158
/**
152159
* Compress all js to one file.
153160
*
154-
* @return class phpcc
161+
* @return self
155162
*/
156163
public function merge()
157164
{
@@ -167,7 +174,7 @@ public function merge()
167174
*
168175
* @param string $param
169176
* @param string $value
170-
* @return class phpcc
177+
* @return self
171178
*/
172179
public function param($param,$value=null)
173180
{
@@ -191,7 +198,7 @@ public function param($param,$value=null)
191198
/**
192199
* Reset all setting.
193200
*
194-
* @return class phpcc
201+
* @return self
195202
*/
196203
public function reset()
197204
{

0 commit comments

Comments
 (0)