ImageRecycle_image_pdf_optimize - Version 2.0.3

Version Notes

Fix Block error thrown in log file

Download this release

Release Info

Developer ImageRecycle
Extension ImageRecycle_image_pdf_optimize
Version 2.0.3
Comparing to
See all releases


Code changes from version 2.0.2 to 2.0.3

app/code/community/Imagerecycle/Imagerecycle/Block/Notifications.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- Class Imagerecycle_Imagerecycle_Block_Notifications extends Mage_Adminhtml_Block_Template
4
- {
5
- public function _toHtml($className = "notification-global")
6
- {
7
- // Let other extensions add messages
8
- Mage::dispatchEvent('imagerecycle_notifications_before');
9
- // Get the global notification object
10
- $messages = Mage::getSingleton('imagerecycle/notification')->getMessages();
11
- $html = null;
12
- foreach ($messages as $message) {
13
- $html .= "<div class='$className'>" . $message . "</div>";
14
- } /* */
15
- return $html;
16
- }
17
- }
18
 
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_Block_Notifications extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function _toHtml($className = "notification-global")
6
+ {
7
+ // Let other extensions add messages
8
+ Mage::dispatchEvent('imagerecycle_notifications_before');
9
+ // Get the global notification object
10
+ $messages = Mage::getSingleton('imagerecycle/notification')->getMessages();
11
+ $html = null;
12
+ foreach ($messages as $message) {
13
+ $html .= "<div class='$className'>" . $message . "</div>";
14
+ } /* */
15
+ return $html;
16
+ }
17
+ }
18
 
app/code/community/Imagerecycle/Imagerecycle/Block/Settings.php CHANGED
@@ -1,66 +1,66 @@
1
- <?php
2
-
3
- Class Imagerecycle_Imagerecycle_Block_Settings extends Mage_Page_Block_Html {
4
-
5
- private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
6
- private $ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
7
- private $allowedPath = "";
8
-
9
- public function __construct() {
10
- parent::__construct();
11
- //Get settings
12
- $this->settings = array(
13
- 'api_key' => Mage::getStoreConfig('mageio_api_key'),
14
- 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
15
- 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
16
- 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
17
- 'reindex_init' => Mage::getStoreConfig('mageio_reindex_init'),
18
- 'saving_auto' => Mage::getStoreConfig('mageio_saving_auto'),
19
- 'compress_auto' => Mage::getStoreConfig('mageio_compress_auto'),
20
- 'cron_periodicity' => Mage::getStoreConfig('mageio_cron_periodicity'),
21
- 'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
22
- 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
23
- 'min_size' => Mage::getStoreConfig('mageio_min_size'),
24
- 'max_size' => Mage::getStoreConfig('mageio_max_size'),
25
- 'compression_type_pdf' => Mage::getStoreConfig('mageio_compression_type_pdf'),
26
- 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
27
- 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
28
- 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
29
- 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif'),
30
- 'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
31
- );
32
-
33
- $this->allowedPath = explode(',',$this->settings['include_folders']);
34
-
35
- for($i=0;$i<count($this->allowed_ext); $i++) {
36
- $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
37
- if($compression_type=="none") {
38
- unset($this->allowed_ext[$i]);
39
- }
40
- }
41
- $this->allowed_ext = array_values($this->allowed_ext);
42
-
43
- }
44
-
45
- public function formateBytes($data)
46
- {
47
- if($data < 1024)
48
- return round($data, 2).'Bytes';
49
- $data = $data/1024;
50
- if($data < 1024)
51
- return round($data, 2).'KB';
52
- $data = $data/1024;
53
- if($data < 1024)
54
- return round($data, 2).'MB';
55
-
56
- $data = $data/1024;
57
- return round($data, 2).'GB';
58
-
59
- }
60
-
61
- public function senddata()
62
- {
63
- return 'hi';
64
- }
65
- }
66
-
1
+ <?php
2
+
3
+ Class Imagerecycle_Imagerecycle_Block_Settings extends Mage_Page_Block_Html {
4
+
5
+ private $allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
6
+ private $ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
7
+ private $allowedPath = "";
8
+
9
+ public function __construct() {
10
+ parent::__construct();
11
+ //Get settings
12
+ $this->settings = array(
13
+ 'api_key' => Mage::getStoreConfig('mageio_api_key'),
14
+ 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
15
+ 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
16
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
17
+ 'reindex_init' => Mage::getStoreConfig('mageio_reindex_init'),
18
+ 'saving_auto' => Mage::getStoreConfig('mageio_saving_auto'),
19
+ 'compress_auto' => Mage::getStoreConfig('mageio_compress_auto'),
20
+ 'cron_periodicity' => Mage::getStoreConfig('mageio_cron_periodicity'),
21
+ 'resize_auto' => Mage::getStoreConfig('mageio_resize_auto'),
22
+ 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
23
+ 'min_size' => Mage::getStoreConfig('mageio_min_size'),
24
+ 'max_size' => Mage::getStoreConfig('mageio_max_size'),
25
+ 'compression_type_pdf' => Mage::getStoreConfig('mageio_compression_type_pdf'),
26
+ 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
27
+ 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
28
+ 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
29
+ 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif'),
30
+ 'compression_type' => Mage::getStoreConfig('mageio_compression_type'),
31
+ );
32
+
33
+ $this->allowedPath = explode(',',$this->settings['include_folders']);
34
+
35
+ for($i=0;$i<count($this->allowed_ext); $i++) {
36
+ $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
37
+ if($compression_type=="none") {
38
+ unset($this->allowed_ext[$i]);
39
+ }
40
+ }
41
+ $this->allowed_ext = array_values($this->allowed_ext);
42
+
43
+ }
44
+
45
+ public function formateBytes($data)
46
+ {
47
+ if($data < 1024)
48
+ return round($data, 2).'Bytes';
49
+ $data = $data/1024;
50
+ if($data < 1024)
51
+ return round($data, 2).'KB';
52
+ $data = $data/1024;
53
+ if($data < 1024)
54
+ return round($data, 2).'MB';
55
+
56
+ $data = $data/1024;
57
+ return round($data, 2).'GB';
58
+
59
+ }
60
+
61
+ public function senddata()
62
+ {
63
+ return 'hi';
64
+ }
65
+ }
66
+
app/code/community/Imagerecycle/Imagerecycle/Model/Notification.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- class Imagerecycle_Imagerecycle_Model_Notification extends Varien_object{
3
- protected $messages = [ ];
4
-
5
- public function getMessages()
6
- {
7
- return $this->messages;
8
- }
9
-
10
- public function setMessages($messages)
11
- {
12
- $this->messages = $messages;
13
- return $this;
14
- }
15
-
16
- public function addMessage($message)
17
- {
18
- $this->messages[] = $message;
19
- return $this;
20
- }
21
  }
1
+ <?php
2
+ class Imagerecycle_Imagerecycle_Model_Notification extends Varien_object{
3
+ protected $messages = [ ];
4
+
5
+ public function getMessages()
6
+ {
7
+ return $this->messages;
8
+ }
9
+
10
+ public function setMessages($messages)
11
+ {
12
+ $this->messages = $messages;
13
+ return $this;
14
+ }
15
+
16
+ public function addMessage($message)
17
+ {
18
+ $this->messages[] = $message;
19
+ return $this;
20
+ }
21
  }
app/code/community/Imagerecycle/Imagerecycle/controllers/ImageAllController.php CHANGED
@@ -1,381 +1,381 @@
1
- <?php
2
- class Imagerecycle_Imagerecycle_ImageAllController extends Mage_Core_Controller_Front_Action {
3
-
4
- public function indexAction() {
5
- $id = $this->getRequest()->getParam('id');
6
- if($id == 'cronurl')
7
- {
8
- if( Mage::getStoreConfig('mageio_compress_auto')){
9
- $now = time();
10
- if(Mage::getStoreConfig('mageio_autosettig') == 'On')
11
- {
12
- $ao_lastRun = Mage::getStoreConfig('mageio_runtime');
13
- $diff = $now - $ao_lastRun;
14
- if($now - $ao_lastRun < 8000 ) {
15
- exit;
16
- }
17
- }
18
- $coreConfig = Mage::getConfig();
19
- $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('On'));
20
- $coreConfig->saveConfig("mageio_runtime", Mage::helper('core')->escapeHtml($now));
21
- $coreConfig->cleanCache();
22
- }
23
-
24
- }
25
- else{
26
- if(Mage::getstoreConfig('mageio_OptResponse') != 'On'){
27
- echo 'You cannot access!!!';
28
- exit;
29
- }
30
- $this->setStatus('mageio_OptResponse', 'Off');
31
- }
32
- $this->initsetting();
33
- $this->image_auto_optimize();
34
- }
35
-
36
- public function initsetting(){
37
- $this->allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
38
- $this->ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
39
- $this->allowedPath = "";
40
-
41
- $this->totalImages = 0;//
42
- $this->totalFile = 0;//
43
- $this->time_elapsed_secs = 0;//
44
- $this->totalOptimizedImages = 0; //
45
-
46
- $resource = Mage::getSingleton('core/resource');
47
- $this->settings = array(
48
- 'api_key' =>Mage::getStoreConfig('mageio_api_key'),
49
- 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
50
- 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
51
- 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
52
- 'resize_auto' =>Mage::getStoreConfig('mageio_resize_auto'),
53
- 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
54
- 'min_size' => Mage::getStoreConfig('mageio_min_size'),
55
- 'max_size' => Mage::getStoreConfig('mageio_max_size'),
56
- 'compression_type_pdf' =>Mage::getStoreConfig('mageio_compression_type_pdf'),
57
- 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
58
- 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
59
- 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
60
- 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif')
61
- );
62
-
63
- if(empty($this->settings['compression_type']) ) { $this->settings['compression_type'] = 'lossy'; }
64
-
65
- $this->allowedPath = explode(',',$this->settings['include_folders']);
66
-
67
-
68
- for($i=0;$i<count($this->allowed_ext); $i++) {
69
- $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
70
- if($compression_type=="none") {
71
- unset($this->allowed_ext[$i]);
72
- }
73
- }
74
- $this->allowed_ext = array_values($this->allowed_ext);
75
-
76
- }
77
-
78
- /*
79
- Get the local images
80
- @magento database name
81
- @magento table name
82
- */
83
- public function _getLocalImages() {
84
- $optimizedFiles = array();
85
- $resourceR = $this->getCoreRead('imagerecycle/images');
86
-
87
- $sql = "SELECT file,size_before FROM `{$resourceR->tableName}` where `extension` = '1'";
88
- $optimizedFiles = $resourceR->fetchAssoc($sql);
89
- $this->totalOptimizedImages = count($optimizedFiles);
90
-
91
- $min_size = isset($this->settings['min_size']) ? (int)$this->settings['min_size']*1024 : 1* 1024;
92
- $max_size = !empty($this->settings['max_size']) ? (int)$this->settings['max_size'] * 1024 : 10000 * 1024;
93
- $images = array();
94
-
95
- if(Mage::getStoreConfig('mageio_include_folders') == '')
96
- $base_dir = Mage::getBaseDir();
97
- else
98
- $base_dir = Mage::getBaseDir().DIRECTORY_SEPARATOR;
99
- $start = microtime(true);
100
- clearstatcache(); $counter = 0;
101
- foreach($this->allowedPath as $base){
102
- $base = $base_dir . $base;
103
-
104
- if (!file_exists($base)) {
105
- continue;
106
- }
107
- foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($base)) as $filename) {
108
- $continue = false;
109
- $this->totalFile++;
110
-
111
- foreach ($this->ignoredPath as $ignore_path) {// must customize
112
- $ignore_path = DIRECTORY_SEPARATOR . $ignore_path . DIRECTORY_SEPARATOR;
113
- if (strpos(substr($filename, strlen($base)), $ignore_path) === 0 || strpos(substr($filename, strlen($base)), DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR) !== FALSE) {
114
- $continue = true;
115
- continue;
116
- }
117
- }
118
-
119
- if ($continue === true) {
120
- continue;
121
- }
122
- if (!in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->allowed_ext)) {
123
- continue;
124
- }
125
- if(filesize($filename) < $min_size || filesize($filename) > $max_size ) {
126
- continue;
127
- }
128
-
129
- $data = array();
130
-
131
- if(Mage::getStoreConfig('mageio_include_folders') == ''){
132
- $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir) + 1));
133
- }
134
- else{
135
- $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir)));
136
- }
137
-
138
- $data['size'] = filesize($filename);
139
- $data['filetype'] = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
140
-
141
- $filter_name = Mage::getStoreConfig('mageio_all_filter_name');
142
- $filter_type = Mage::getStoreConfig('mageio_all_filter_type');
143
-
144
- if($filter_name || $filter_type)
145
- {
146
- $pos = strpos($data['filename'], $filter_name);
147
- if($pos === false){
148
- continue;
149
- }
150
-
151
- if($filter_type)
152
- {
153
- if($data['filetype'] !== $filter_type) continue;
154
- }
155
- }
156
- if (isset($optimizedFiles[$data['filename']]) ) {
157
-
158
- $data['optimized'] = true;
159
- $data['optimized_datas'] = $optimizedFiles[$data['filename']];
160
- }
161
- else{
162
- $data['optimized'] = false;
163
- }
164
- $this->totalImages++;
165
- $images[] = $data; $counter++;
166
- }
167
- }
168
-
169
- $this->time_elapsed_secs = microtime(true) - $start;
170
- return $images;
171
- }
172
-
173
- /**
174
- * image auto optimize
175
- * @param void
176
- */
177
- public function image_auto_optimize()
178
- {
179
- ignore_user_abort(true);
180
- $returned = -1;
181
- $images = $this->_getLocalImages();
182
- if(empty($images)) {
183
- $this->setStatus('mageio_autosettig', 'Off');
184
- $this->setStatus('mageio_runtime', null);
185
- $this->setStatus('mageio_optfailure', '8');
186
-
187
- $this->setStatus('filter_type', Mage::getStoreConfig('mageio_all_filter_type'));
188
- $this->setStatus('filter_name', Mage::getStoreConfig('mageio_all_filter_name'));
189
- return;
190
- }
191
- include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
192
- foreach ($images as $image) {
193
- if ($image['optimized'] === false) {
194
- $now = time();
195
-
196
- Mage::app()->getConfig()->reinit();
197
- Mage::app()->getCacheInstance()->cleanType('config');
198
- Mage::app()->reinitStores();
199
- if(Mage::getstoreConfig('mageio_autosettig') == 'Off')
200
- {
201
- $this->setStatus('mageio_runtime', null);
202
- break;
203
- }
204
- $this->setStatus( 'mageio_runtime' ,$now);
205
- $returned = $this->optimize($image['filename']);
206
- if($returned){
207
-
208
- $this->setStatus('mageio_optfailure', $returned);
209
- $this->setStatus('mageio_autosettig', 'Off');
210
- $this->setStatus('mageio_runtime', null);
211
- return;
212
- }
213
- }
214
- }
215
- // Now the optimize is ended.
216
- $this->setStatus('mageio_autosettig', 'Off');
217
- $this->setStatus('mageio_runtime', null);
218
- $this->setStatus('mageio_optfailure', $returned);
219
-
220
- $temp = Mage::getStoreConfig('mageio_all_filter_type');
221
- $this->setStatus('filter_type',$temp);
222
-
223
- Mage::app()->getConfig()->reinit();
224
- Mage::app()->getCacheInstance()->cleanType('config');
225
- Mage::app()->reinitStores();
226
-
227
- $temp = Mage::getStoreConfig('mageio_all_filter_name');
228
- $this->setStatus('filter_name', $temp);
229
- return;
230
-
231
- }
232
-
233
- /***************************************************
234
- * Optimize the files
235
- return 1 if success or 0
236
- *
237
- ****************************************************/
238
- public function optimize($image, $savePath='') {
239
-
240
- $file = realpath($image);
241
- if (!in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $this->allowed_ext )) {
242
- return(6);
243
- }
244
- if (!file_exists($file)) {
245
- //if file is in the database
246
- return(1);
247
- }
248
- $resourceW = $this->getCoreWrite('imagerecycle/images');
249
- $ext = substr($file, strrpos($file, '.')+1);
250
- $compressionType= $this->settings['compression_type_'.$ext];
251
- if($compressionType=='none') return;
252
-
253
- if (!$this->settings['api_key'] || !$this->settings['api_secret'] )
254
- {
255
- return(2);
256
- }
257
- $fparams = array("compression_type"=> $compressionType);
258
- $resize_image = $this->settings['resize_image'];
259
- $resize_auto = $this->settings['resize_auto'];
260
- if($resize_image && $resize_auto) {
261
-
262
- $size = @getimagesize($file);
263
- if($size && ($size[0]> $resize_image) ) {
264
- $fparams['resize'] = array("width"=> $resize_image);
265
- }
266
- }
267
- include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
268
- $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
269
- $return = $ioa->uploadFile($file,$fparams);
270
-
271
- if ($return === false || $return === null || is_string($return)) {
272
- $this->checkError();
273
- return(3);
274
- }
275
- $coreConfig = Mage::getConfig();
276
- $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml(null))->cleanCache();
277
- Mage::dispatchEvent('imagerecycle_notifications_before');
278
-
279
- $md5 = md5_file($file);
280
- clearstatcache();
281
- $sizebefore = filesize($file);
282
- $optimizedFileContent = $this->getContent($return->optimized_url);
283
- if ($optimizedFileContent === false) {
284
- return(4);
285
- }
286
-
287
- if (file_put_contents($file, $optimizedFileContent) === false) {
288
- return(5);
289
- }
290
- clearstatcache();
291
- $size_after = filesize($file);
292
- if($savePath=='') { $savePath = $image;}
293
-
294
- $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($savePath));
295
- if (!$id) {
296
-
297
- $name = substr($file, strrpos($file, "/")+1);
298
- $ext = substr($name, strrpos($name, ".")+1);
299
- $name = substr($name, 0, strrpos($name, '.'));
300
-
301
- $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`,`md5`,`api_id`,`size_before`, `size_after`,`date`,`name`, `ext`) VALUES ("
302
- . $resourceW->quote($savePath) . "," . $resourceW->quote($md5) . "," . $resourceW->quote($return->id) . "," . (int) $sizebefore . "," . (int) $size_after . ",'" . date('Y-m-d H:i:s'). "',". $resourceW->quote($name). ",".$resourceW->quote($ext) .")");
303
- }
304
- else {
305
- $resourceW->query("UPDATE `{$resourceW->tableName}` SET `extension` ='1',`api_id` =". $resourceW->quote($return->id) .", `md5` =".$resourceW->quote($md5)." , `size_after` = " . (int) $size_after .",`date` = '".date('Y-m-d H:i:s') . "' WHERE `id` = " . $resourceW->quote($id));
306
- }
307
- return(0);
308
- }
309
-
310
- /**
311
- * Get content of specified resource via curl or file_get_content() function
312
- */
313
- protected function checkError(){
314
- $coreConfig = Mage::getConfig();
315
- $count = Mage::getStoreConfig('mageio_lasterror');
316
- $count++;
317
- if($count >= 3){
318
- $coreConfig->saveConfig("mageio_saving_auto", Mage::helper('core')->escapeHtml('0'));
319
- $coreConfig->saveConfig("mageio_compress_auto", Mage::helper('core')->escapeHtml('0'));
320
- $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml('on'));
321
- Mage::dispatchEvent('imagerecycle_notifications_before');
322
- $count = 0;
323
- }
324
- $coreConfig->saveConfig("mageio_lasterror", Mage::helper('core')->escapeHtml($count));
325
- $coreConfig->cleanCache();
326
- }
327
-
328
- protected function getContent($url) {
329
- if ($url == '') {
330
- return '';
331
- }
332
- if (!function_exists('curl_version')) {
333
- if (!$content = @file_get_contents($url)) {
334
- return '';
335
- }
336
- } else {
337
- $options = array(
338
- CURLOPT_RETURNTRANSFER => true, // return content
339
- CURLOPT_FOLLOWLOCATION => true, // follow redirects
340
- CURLOPT_AUTOREFERER => true, // set referer on redirect
341
- CURLOPT_CONNECTTIMEOUT => 60, // timeout on connect
342
- CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
343
- );
344
- $ch = curl_init($url);
345
- curl_setopt_array($ch, $options);
346
- $content = curl_exec($ch);
347
- curl_close($ch);
348
- }
349
-
350
- return $content;
351
- }
352
-
353
- public function setStatus($mage_key, $val){
354
- $coreConfig = Mage::getConfig();
355
- $coreConfig->saveConfig($mage_key, Mage::helper('core')->escapeHtml($val))->cleanCache();
356
- }
357
- public function getCoreWrite($entityId) {
358
- $resource = Mage::getSingleton('core/resource');
359
- $resourceW = $resource->getConnection('core_write');
360
- $tableName = $resource->getTableName($entityId);
361
- $resourceW->tableName = $tableName;
362
- return $resourceW;
363
- }
364
- public function getCoreRead($entityId) {
365
- $resource = Mage::getSingleton('core/resource');
366
- $resourceR = $resource->getConnection('core_read');
367
- $tableName = $resource->getTableName($entityId);
368
- $resourceR->tableName = $tableName;
369
- return $resourceR;
370
- }
371
-
372
- }
373
- class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
374
- function getChildren() {
375
- try {
376
- return new IgnorantRecursiveDirectoryIterator($this->getPathname());
377
- } catch (UnexpectedValueException $e) {
378
- return new RecursiveArrayIterator(array());
379
- }
380
- }
381
  }
1
+ <?php
2
+ class Imagerecycle_Imagerecycle_ImageAllController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function indexAction() {
5
+ $id = $this->getRequest()->getParam('id');
6
+ if($id == 'cronurl')
7
+ {
8
+ if( Mage::getStoreConfig('mageio_compress_auto')){
9
+ $now = time();
10
+ if(Mage::getStoreConfig('mageio_autosettig') == 'On')
11
+ {
12
+ $ao_lastRun = Mage::getStoreConfig('mageio_runtime');
13
+ $diff = $now - $ao_lastRun;
14
+ if($now - $ao_lastRun < 8000 ) {
15
+ exit;
16
+ }
17
+ }
18
+ $coreConfig = Mage::getConfig();
19
+ $coreConfig->saveConfig("mageio_autosettig", Mage::helper('core')->escapeHtml('On'));
20
+ $coreConfig->saveConfig("mageio_runtime", Mage::helper('core')->escapeHtml($now));
21
+ $coreConfig->cleanCache();
22
+ }
23
+
24
+ }
25
+ else{
26
+ if(Mage::getstoreConfig('mageio_OptResponse') != 'On'){
27
+ echo 'You cannot access!!!';
28
+ exit;
29
+ }
30
+ $this->setStatus('mageio_OptResponse', 'Off');
31
+ }
32
+ $this->initsetting();
33
+ $this->image_auto_optimize();
34
+ }
35
+
36
+ public function initsetting(){
37
+ $this->allowed_ext = array('jpg', 'jpeg', 'png', 'gif','pdf');
38
+ $this->ignoredPath = array('app', 'var', 'cache', 'adminhtml', '.', '..');
39
+ $this->allowedPath = "";
40
+
41
+ $this->totalImages = 0;//
42
+ $this->totalFile = 0;//
43
+ $this->time_elapsed_secs = 0;//
44
+ $this->totalOptimizedImages = 0; //
45
+
46
+ $resource = Mage::getSingleton('core/resource');
47
+ $this->settings = array(
48
+ 'api_key' =>Mage::getStoreConfig('mageio_api_key'),
49
+ 'api_secret' => Mage::getStoreConfig('mageio_api_secret'),
50
+ 'installed_time' => Mage::getStoreConfig('mageio_installed_time'),
51
+ 'include_folders' => Mage::getStoreConfig('mageio_include_folders'),
52
+ 'resize_auto' =>Mage::getStoreConfig('mageio_resize_auto'),
53
+ 'resize_image' => Mage::getStoreConfig('mageio_resize_image'),
54
+ 'min_size' => Mage::getStoreConfig('mageio_min_size'),
55
+ 'max_size' => Mage::getStoreConfig('mageio_max_size'),
56
+ 'compression_type_pdf' =>Mage::getStoreConfig('mageio_compression_type_pdf'),
57
+ 'compression_type_png' => Mage::getStoreConfig('mageio_compression_type_png'),
58
+ 'compression_type_jpg' => Mage::getStoreConfig('mageio_compression_type_jpg'),
59
+ 'compression_type_jpeg' => Mage::getStoreConfig('mageio_compression_type_jpeg'),
60
+ 'compression_type_gif' => Mage::getStoreConfig('mageio_compression_type_gif')
61
+ );
62
+
63
+ if(empty($this->settings['compression_type']) ) { $this->settings['compression_type'] = 'lossy'; }
64
+
65
+ $this->allowedPath = explode(',',$this->settings['include_folders']);
66
+
67
+
68
+ for($i=0;$i<count($this->allowed_ext); $i++) {
69
+ $compression_type = $this->settings['compression_type_'.$this->allowed_ext[$i]];
70
+ if($compression_type=="none") {
71
+ unset($this->allowed_ext[$i]);
72
+ }
73
+ }
74
+ $this->allowed_ext = array_values($this->allowed_ext);
75
+
76
+ }
77
+
78
+ /*
79
+ Get the local images
80
+ @magento database name
81
+ @magento table name
82
+ */
83
+ public function _getLocalImages() {
84
+ $optimizedFiles = array();
85
+ $resourceR = $this->getCoreRead('imagerecycle/images');
86
+
87
+ $sql = "SELECT file,size_before FROM `{$resourceR->tableName}` where `extension` = '1'";
88
+ $optimizedFiles = $resourceR->fetchAssoc($sql);
89
+ $this->totalOptimizedImages = count($optimizedFiles);
90
+
91
+ $min_size = isset($this->settings['min_size']) ? (int)$this->settings['min_size']*1024 : 1* 1024;
92
+ $max_size = !empty($this->settings['max_size']) ? (int)$this->settings['max_size'] * 1024 : 10000 * 1024;
93
+ $images = array();
94
+
95
+ if(Mage::getStoreConfig('mageio_include_folders') == '')
96
+ $base_dir = Mage::getBaseDir();
97
+ else
98
+ $base_dir = Mage::getBaseDir().DIRECTORY_SEPARATOR;
99
+ $start = microtime(true);
100
+ clearstatcache(); $counter = 0;
101
+ foreach($this->allowedPath as $base){
102
+ $base = $base_dir . $base;
103
+
104
+ if (!file_exists($base)) {
105
+ continue;
106
+ }
107
+ foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($base)) as $filename) {
108
+ $continue = false;
109
+ $this->totalFile++;
110
+
111
+ foreach ($this->ignoredPath as $ignore_path) {// must customize
112
+ $ignore_path = DIRECTORY_SEPARATOR . $ignore_path . DIRECTORY_SEPARATOR;
113
+ if (strpos(substr($filename, strlen($base)), $ignore_path) === 0 || strpos(substr($filename, strlen($base)), DIRECTORY_SEPARATOR . 'adminhtml' . DIRECTORY_SEPARATOR) !== FALSE) {
114
+ $continue = true;
115
+ continue;
116
+ }
117
+ }
118
+
119
+ if ($continue === true) {
120
+ continue;
121
+ }
122
+ if (!in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->allowed_ext)) {
123
+ continue;
124
+ }
125
+ if(filesize($filename) < $min_size || filesize($filename) > $max_size ) {
126
+ continue;
127
+ }
128
+
129
+ $data = array();
130
+
131
+ if(Mage::getStoreConfig('mageio_include_folders') == ''){
132
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir) + 1));
133
+ }
134
+ else{
135
+ $data['filename'] = str_replace('\\', '/', substr($filename, strlen($base_dir)));
136
+ }
137
+
138
+ $data['size'] = filesize($filename);
139
+ $data['filetype'] = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
140
+
141
+ $filter_name = Mage::getStoreConfig('mageio_all_filter_name');
142
+ $filter_type = Mage::getStoreConfig('mageio_all_filter_type');
143
+
144
+ if($filter_name || $filter_type)
145
+ {
146
+ $pos = strpos($data['filename'], $filter_name);
147
+ if($pos === false){
148
+ continue;
149
+ }
150
+
151
+ if($filter_type)
152
+ {
153
+ if($data['filetype'] !== $filter_type) continue;
154
+ }
155
+ }
156
+ if (isset($optimizedFiles[$data['filename']]) ) {
157
+
158
+ $data['optimized'] = true;
159
+ $data['optimized_datas'] = $optimizedFiles[$data['filename']];
160
+ }
161
+ else{
162
+ $data['optimized'] = false;
163
+ }
164
+ $this->totalImages++;
165
+ $images[] = $data; $counter++;
166
+ }
167
+ }
168
+
169
+ $this->time_elapsed_secs = microtime(true) - $start;
170
+ return $images;
171
+ }
172
+
173
+ /**
174
+ * image auto optimize
175
+ * @param void
176
+ */
177
+ public function image_auto_optimize()
178
+ {
179
+ ignore_user_abort(true);
180
+ $returned = -1;
181
+ $images = $this->_getLocalImages();
182
+ if(empty($images)) {
183
+ $this->setStatus('mageio_autosettig', 'Off');
184
+ $this->setStatus('mageio_runtime', null);
185
+ $this->setStatus('mageio_optfailure', '8');
186
+
187
+ $this->setStatus('filter_type', Mage::getStoreConfig('mageio_all_filter_type'));
188
+ $this->setStatus('filter_name', Mage::getStoreConfig('mageio_all_filter_name'));
189
+ return;
190
+ }
191
+ include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
192
+ foreach ($images as $image) {
193
+ if ($image['optimized'] === false) {
194
+ $now = time();
195
+
196
+ Mage::app()->getConfig()->reinit();
197
+ Mage::app()->getCacheInstance()->cleanType('config');
198
+ Mage::app()->reinitStores();
199
+ if(Mage::getstoreConfig('mageio_autosettig') == 'Off')
200
+ {
201
+ $this->setStatus('mageio_runtime', null);
202
+ break;
203
+ }
204
+ $this->setStatus( 'mageio_runtime' ,$now);
205
+ $returned = $this->optimize($image['filename']);
206
+ if($returned){
207
+
208
+ $this->setStatus('mageio_optfailure', $returned);
209
+ $this->setStatus('mageio_autosettig', 'Off');
210
+ $this->setStatus('mageio_runtime', null);
211
+ return;
212
+ }
213
+ }
214
+ }
215
+ // Now the optimize is ended.
216
+ $this->setStatus('mageio_autosettig', 'Off');
217
+ $this->setStatus('mageio_runtime', null);
218
+ $this->setStatus('mageio_optfailure', $returned);
219
+
220
+ $temp = Mage::getStoreConfig('mageio_all_filter_type');
221
+ $this->setStatus('filter_type',$temp);
222
+
223
+ Mage::app()->getConfig()->reinit();
224
+ Mage::app()->getCacheInstance()->cleanType('config');
225
+ Mage::app()->reinitStores();
226
+
227
+ $temp = Mage::getStoreConfig('mageio_all_filter_name');
228
+ $this->setStatus('filter_name', $temp);
229
+ return;
230
+
231
+ }
232
+
233
+ /***************************************************
234
+ * Optimize the files
235
+ return 1 if success or 0
236
+ *
237
+ ****************************************************/
238
+ public function optimize($image, $savePath='') {
239
+
240
+ $file = realpath($image);
241
+ if (!in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $this->allowed_ext )) {
242
+ return(6);
243
+ }
244
+ if (!file_exists($file)) {
245
+ //if file is in the database
246
+ return(1);
247
+ }
248
+ $resourceW = $this->getCoreWrite('imagerecycle/images');
249
+ $ext = substr($file, strrpos($file, '.')+1);
250
+ $compressionType= $this->settings['compression_type_'.$ext];
251
+ if($compressionType=='none') return;
252
+
253
+ if (!$this->settings['api_key'] || !$this->settings['api_secret'] )
254
+ {
255
+ return(2);
256
+ }
257
+ $fparams = array("compression_type"=> $compressionType);
258
+ $resize_image = $this->settings['resize_image'];
259
+ $resize_auto = $this->settings['resize_auto'];
260
+ if($resize_image && $resize_auto) {
261
+
262
+ $size = @getimagesize($file);
263
+ if($size && ($size[0]> $resize_image) ) {
264
+ $fparams['resize'] = array("width"=> $resize_image);
265
+ }
266
+ }
267
+ include_once( Mage::getBaseDir('app').'/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
268
+ $ioa = new ioaphp($this->settings['api_key'], $this->settings['api_secret']);
269
+ $return = $ioa->uploadFile($file,$fparams);
270
+
271
+ if ($return === false || $return === null || is_string($return)) {
272
+ $this->checkError();
273
+ return(3);
274
+ }
275
+ $coreConfig = Mage::getConfig();
276
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml(null))->cleanCache();
277
+ Mage::dispatchEvent('imagerecycle_notifications_before');
278
+
279
+ $md5 = md5_file($file);
280
+ clearstatcache();
281
+ $sizebefore = filesize($file);
282
+ $optimizedFileContent = $this->getContent($return->optimized_url);
283
+ if ($optimizedFileContent === false) {
284
+ return(4);
285
+ }
286
+
287
+ if (file_put_contents($file, $optimizedFileContent) === false) {
288
+ return(5);
289
+ }
290
+ clearstatcache();
291
+ $size_after = filesize($file);
292
+ if($savePath=='') { $savePath = $image;}
293
+
294
+ $id = $resourceW->fetchOne("SELECT id FROM {$resourceW->tableName} WHERE `file` = " . $resourceW->quote($savePath));
295
+ if (!$id) {
296
+
297
+ $name = substr($file, strrpos($file, "/")+1);
298
+ $ext = substr($name, strrpos($name, ".")+1);
299
+ $name = substr($name, 0, strrpos($name, '.'));
300
+
301
+ $resourceW->query("INSERT INTO `{$resourceW->tableName}` (`file`,`md5`,`api_id`,`size_before`, `size_after`,`date`,`name`, `ext`) VALUES ("
302
+ . $resourceW->quote($savePath) . "," . $resourceW->quote($md5) . "," . $resourceW->quote($return->id) . "," . (int) $sizebefore . "," . (int) $size_after . ",'" . date('Y-m-d H:i:s'). "',". $resourceW->quote($name). ",".$resourceW->quote($ext) .")");
303
+ }
304
+ else {
305
+ $resourceW->query("UPDATE `{$resourceW->tableName}` SET `extension` ='1',`api_id` =". $resourceW->quote($return->id) .", `md5` =".$resourceW->quote($md5)." , `size_after` = " . (int) $size_after .",`date` = '".date('Y-m-d H:i:s') . "' WHERE `id` = " . $resourceW->quote($id));
306
+ }
307
+ return(0);
308
+ }
309
+
310
+ /**
311
+ * Get content of specified resource via curl or file_get_content() function
312
+ */
313
+ protected function checkError(){
314
+ $coreConfig = Mage::getConfig();
315
+ $count = Mage::getStoreConfig('mageio_lasterror');
316
+ $count++;
317
+ if($count >= 3){
318
+ $coreConfig->saveConfig("mageio_saving_auto", Mage::helper('core')->escapeHtml('0'));
319
+ $coreConfig->saveConfig("mageio_compress_auto", Mage::helper('core')->escapeHtml('0'));
320
+ $coreConfig->saveConfig("mageio_errormessage", Mage::helper('core')->escapeHtml('on'));
321
+ Mage::dispatchEvent('imagerecycle_notifications_before');
322
+ $count = 0;
323
+ }
324
+ $coreConfig->saveConfig("mageio_lasterror", Mage::helper('core')->escapeHtml($count));
325
+ $coreConfig->cleanCache();
326
+ }
327
+
328
+ protected function getContent($url) {
329
+ if ($url == '') {
330
+ return '';
331
+ }
332
+ if (!function_exists('curl_version')) {
333
+ if (!$content = @file_get_contents($url)) {
334
+ return '';
335
+ }
336
+ } else {
337
+ $options = array(
338
+ CURLOPT_RETURNTRANSFER => true, // return content
339
+ CURLOPT_FOLLOWLOCATION => true, // follow redirects
340
+ CURLOPT_AUTOREFERER => true, // set referer on redirect
341
+ CURLOPT_CONNECTTIMEOUT => 60, // timeout on connect
342
+ CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
343
+ );
344
+ $ch = curl_init($url);
345
+ curl_setopt_array($ch, $options);
346
+ $content = curl_exec($ch);
347
+ curl_close($ch);
348
+ }
349
+
350
+ return $content;
351
+ }
352
+
353
+ public function setStatus($mage_key, $val){
354
+ $coreConfig = Mage::getConfig();
355
+ $coreConfig->saveConfig($mage_key, Mage::helper('core')->escapeHtml($val))->cleanCache();
356
+ }
357
+ public function getCoreWrite($entityId) {
358
+ $resource = Mage::getSingleton('core/resource');
359
+ $resourceW = $resource->getConnection('core_write');
360
+ $tableName = $resource->getTableName($entityId);
361
+ $resourceW->tableName = $tableName;
362
+ return $resourceW;
363
+ }
364
+ public function getCoreRead($entityId) {
365
+ $resource = Mage::getSingleton('core/resource');
366
+ $resourceR = $resource->getConnection('core_read');
367
+ $tableName = $resource->getTableName($entityId);
368
+ $resourceR->tableName = $tableName;
369
+ return $resourceR;
370
+ }
371
+
372
+ }
373
+ class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
374
+ function getChildren() {
375
+ try {
376
+ return new IgnorantRecursiveDirectoryIterator($this->getPathname());
377
+ } catch (UnexpectedValueException $e) {
378
+ return new RecursiveArrayIterator(array());
379
+ }
380
+ }
381
  }
app/code/community/Imagerecycle/Imagerecycle/etc/config.xml CHANGED
@@ -132,11 +132,6 @@
132
  <class>Imagerecycle_Imagerecycle_Block</class>
133
 
134
  </imagerecycle>
135
- <core>
136
- <rewrite>
137
- <text>Imagerecycle_Imagerecycle_Block_Core_Text</text>
138
- </rewrite>
139
- </core>
140
  </blocks>
141
 
142
  <helpers>
132
  <class>Imagerecycle_Imagerecycle_Block</class>
133
 
134
  </imagerecycle>
 
 
 
 
 
135
  </blocks>
136
 
137
  <helpers>
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/connect.phtml CHANGED
@@ -1,7 +1,5 @@
1
  <?php
2
- $secret = Mage::getStoreConfig('mageio_api_secret');
3
- $key = Mage::getStoreConfig('mageio_api_key');
4
- if (!empty($secret) && !empty($key)) {
5
  return;
6
  }
7
  $user = Mage::getSingleton('admin/session');
1
  <?php
2
+ if(!empty(Mage::getStoreConfig('mageio_api_secret')) && !empty(Mage::getStoreConfig('mageio_api_key'))){
 
 
3
  return;
4
  }
5
  $user = Mage::getSingleton('admin/session');
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/images.phtml CHANGED
@@ -1,8 +1,6 @@
1
  <div class="imagerecycle-container">
2
  <?php
3
- $secret = Mage::getStoreConfig('mageio_api_secret');
4
- $key = Mage::getStoreConfig('mageio_api_key');
5
- if (empty($secret) || empty($key)) {
6
  return;
7
  }
8
  ?>
1
  <div class="imagerecycle-container">
2
  <?php
3
+ if (empty(Mage::getStoreConfig('mageio_api_secret')) || empty(Mage::getStoreConfig('mageio_api_key'))) {
 
 
4
  return;
5
  }
6
  ?>
app/design/adminhtml/default/default/template/imagerecycle/imagerecycle/settings.phtml CHANGED
@@ -1,389 +1,389 @@
1
- <script>page="config";</script>
2
- <div class="imagerecycle-container">
3
- <div class="content-header">
4
- <h3><?php echo Mage::helper('imagerecycle')->__('Image recycle setttings') ?></h3>
5
- </div>
6
-
7
- <!-- ################### Quota usage information ################## -->
8
-
9
- <h4>Optimization quota usage</h4>
10
-
11
- <?php
12
- include_once(Mage::getBaseDir('app') . '/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
13
- $ioa = new ioaphp(Mage::getStoreConfig('mageio_api_key'), Mage::getStoreConfig('mageio_api_secret'));
14
- $return = $ioa->getAccountInfos();
15
- $percentQuota = 0;
16
- $consumption_text = "";
17
-
18
- if ($return && (floatval($return->quota_allowed) > 0)) {
19
- $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
20
- 'to' . " " . date('d F Y', $return->quota_end) . ":" .
21
- "<b>" . $this->formateBytes(floatval($return->quota_current)) . "/ " .
22
- $this->formateBytes(floatval($return->quota_allowed)) . "</b>";
23
-
24
- $percentQuota = number_format(min(($return->quota_current / $return->quota_allowed), 1) * 100, 2);
25
-
26
- echo '<p>'.$consumption_text . '(' . $percentQuota . '%)</p>';
27
-
28
- echo '<div class="ir-progress-wrap">
29
- <div class="ir-progress-bar" style="width: '.$percentQuota.'%"></div>
30
- <span>'.$percentQuota.'%</span>
31
- </div>';
32
-
33
- } else if ($return) {
34
- $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
35
- 'to' . " " . date('d F Y', $return->quota_end) .
36
- ": " . $this->formateBytes(floatval($return->quota_current));
37
- echo '<p>' . $consumption_text . '</p>';
38
-
39
- } else {
40
- $consumption_text = 'Connection error';
41
- echo '<p>' . $consumption_text . '</p>';
42
-
43
- }
44
- ?>
45
- <a href="https://www.imagerecycle.com/prices" target="_blank" class="get-quota-btn button">
46
- <?php echo Mage::helper("imagerecycle")->__("Get optimization quota") ?>
47
- </a>
48
-
49
- <div class="clear"></div>
50
-
51
- <!-- ################### Main module settings form ################## -->
52
-
53
- <h4>Settings</h4>
54
-
55
- <?php
56
- $compress_auto = !is_null($this->settings['compress_auto']) ? $this->settings['compress_auto'] : 0;
57
- $cron_periodicity = !is_null($this->settings['cron_periodicity']) ? $this->settings['cron_periodicity'] : '5mins';
58
- ?>
59
-
60
- <script type="text/javascript">
61
- var getFolders_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getFolders") ?>?isAjax=true';
62
- var index_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>';
63
- var cron_url = '<?php echo Mage::getBaseUrl() . 'imagerecycle/ImageAll/index?id=cronurl' ?>';
64
- var is_compress_auto = '<?php echo $compress_auto; ?>';
65
- var cron_periodicity = '<?php echo $cron_periodicity; ?>';
66
- var reindex_init_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/reindexInit") ?>';
67
- </script>
68
-
69
-
70
- <div class="ir-setting">
71
- <form action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveSetting"); ?>" method="POST">
72
- <table class="form-table">
73
- <tbody>
74
- <input id="installed_time" class="formData" name="installed_time" type="hidden"
75
- value="<?php echo Mage::getStoreConfig('mageio_installed_time'); ?>" size="50"/>
76
- <tr>
77
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API key : ') ?></th>
78
- <td colspan="2">
79
- <input id="api_key" class="formData" name="api_key" type="text"
80
- value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_key')); ?>" size="50"/>
81
- </td>
82
- </tr>
83
-
84
- <tr>
85
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API secret : ') ?></th>
86
- <td colspan="2">
87
- <input id="api_secret" class="formData" name="api_secret" type="text"
88
- value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_secret')); ?>" size="50"/>
89
- </td>
90
- </tr>
91
-
92
-
93
- <tr>
94
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Include folders : ') ?></th>
95
- <td colspan="2">
96
- <?php
97
-
98
- $include_folders = $this->settings['include_folders'];
99
- $selected_folders = explode(',', $include_folders);
100
-
101
- ?>
102
- <input id="include_folders" class="formData" name="include_folders"
103
- readonly='readonly' type="text" value="<?php echo $this->escapeHtml($include_folders); ?>"
104
- size="50"/>
105
-
106
- <a href="#" class="button" data-reveal-id="myModal"> browse </a>
107
- </td>
108
- </tr>
109
-
110
-
111
- <!-- Optimize Reinitialize index yes and no -->
112
- <tr>
113
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Reinitialize media indexation after') ?></th>
114
- <td colspan="2">
115
- <?php
116
- $reindex_init = !is_null($this->settings['reindex_init']) ? $this->settings['reindex_init'] : 0;
117
- ?>
118
- <select id="reindex_init" name="reindex_init">
119
- <option value="0" <?php if ($reindex_init == 0) {
120
- echo 'selected="selected"';
121
- } ?> >Never
122
- </option>
123
- <option value="5" <?php if ($reindex_init == 5) {
124
- echo 'selected="selected"';
125
- } ?> >5mins
126
- </option>
127
- <option value="10" <?php if ($reindex_init == 10) {
128
- echo 'selected="selected"';
129
- } ?> >10mins
130
- </option>
131
- <option value="20" <?php if ($reindex_init == 20) {
132
- echo 'selected="selected"';
133
- } ?> >20mins
134
- </option>
135
- <option value="30" <?php if ($reindex_init == 30) {
136
- echo 'selected="selected"';
137
- } ?> >30mins
138
- </option>
139
- <option value="60" <?php if ($reindex_init == 60) {
140
- echo 'selected="selected"';
141
- } ?> >1h
142
- </option>
143
- <option value="120" <?php if ($reindex_init == 120) {
144
- echo 'selected="selected"';
145
- } ?> >2h
146
- </option>
147
- <option value="360" <?php if ($reindex_init == 360) {
148
- echo 'selected="selected"';
149
- } ?> >6h
150
- </option>
151
- <option value="720" <?php if ($reindex_init == 720) {
152
- echo 'selected="selected"';
153
- } ?> >12h
154
- </option>
155
- <option value="1440" <?php if ($reindex_init == 1440) {
156
- echo 'selected="selected"';
157
- } ?> >24h
158
- </option>
159
- <option value="2880" <?php if ($reindex_init == 2880) {
160
- echo 'selected="selected"';
161
- } ?> >48h
162
- </option>
163
- </select>
164
- <button class="do-index button" href="#"><?php echo Mage::helper('imagerecycle')->__('Force reindex images') ?></button>
165
- </td>
166
- </tr>
167
-
168
- <!------------------------- This is the current customizing area---------------------------->
169
- <!-- Optimize media on saving yes and no -->
170
- <tr>
171
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Optimize media on saving') ?></th>
172
- <td colspan="2">
173
- <?php
174
- $saving_auto = !is_null($this->settings['saving_auto']) ? $this->settings['saving_auto'] : 0;
175
- ?>
176
-
177
- <select id="saving_auto" name="saving_auto">
178
- <option value="0" <?php if ($saving_auto == 0) {
179
- echo 'selected="selected"';
180
- } ?> >No
181
- </option>
182
- <option value="1" <?php if ($saving_auto == 1) {
183
- echo 'selected="selected"';
184
- } ?> >Yes
185
- </option>
186
- </select>
187
- </td>
188
- </tr>
189
-
190
- <!---------------------- This is the auto compress yes and no ------------------------------->
191
- <tr id='compress_auto_setting'>
192
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Automatic compression') ?></th>
193
- <td colspan="2">
194
-
195
- <select id="compress_auto" name="compress_auto">
196
- <option value="0" <?php if ($compress_auto == 0) {
197
- echo 'selected="selected"';
198
- } ?> >No automatic compression
199
- </option>
200
- <option value="1" <?php if ($compress_auto == 1) {
201
- echo 'selected="selected"';
202
- } ?> >Magento inbuilt cron task
203
- </option>
204
- <option value="2" <?php if ($compress_auto == 2) {
205
- echo 'selected="selected"';
206
- } ?> >Custom cron task
207
- </option>
208
- </select>
209
- </td>
210
- </tr>
211
-
212
-
213
- <!---------------------- ------------------------------->
214
- <tr>
215
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize') ?></th>
216
- <td colspan="2">
217
- <?php
218
- $resize_auto = !is_null($this->settings['resize_auto']) ? $this->settings['resize_auto'] : 0;
219
- ?>
220
-
221
- <select id="resize_auto" name="resize_auto">
222
- <option value="0" <?php if ($resize_auto == 0) {
223
- echo 'selected="selected"';
224
- } ?> >No
225
- </option>
226
- <option value="1" <?php if ($resize_auto == 1) {
227
- echo 'selected="selected"';
228
- } ?> >Yes
229
- </option>
230
- </select>
231
- </td>
232
- </tr>
233
-
234
- <tr>
235
- <td colspan="3">
236
- <?php echo Mage::helper('imagerecycle')->__('<strong>Use with caution!</strong> All new images will size more than setting will be resized automatically on upload') ?>
237
- </td>
238
- </tr>
239
-
240
- <tr>
241
- <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize, max size (px)') ?></th>
242
- <td>
243
- <?php $resize_image = !is_null($this->settings['resize_image']) ? $this->settings['resize_image'] : 1600; ?>
244
- <input id="resize_image" class="formData" name="resize_image" type="text"
245
- value="<?php echo $this->escapeHtml($resize_image); ?>" size="10"/>
246
- </td>
247
- </tr>
248
-
249
- <tr>
250
- <th scope="row">
251
- <?php echo Mage::helper('imagerecycle')->__('Min file size to optimize (Kb)') ?></th>
252
- <td>
253
- <?php $minSize = !is_null($this->settings['min_size']) ? $this->settings['min_size'] : 1; ?>
254
- <input id="min_size" class="formData" name="min_size" type="text"
255
- value="<?php echo $this->escapeHtml($minSize); ?>" size="10"/>
256
- </td>
257
- </th>
258
- </tr>
259
-
260
- <tr>
261
- <th scope="row">
262
- <?php echo Mage::helper('imagerecycle')->__('Max file size to optimize (Kb)') ?></th>
263
- <td>
264
- <?php $maxSize = !is_null($this->settings['max_size']) ? $this->settings['max_size'] : 10000; ?>
265
- <input id="max_size" class="formData" name="max_size" type="text"
266
- value="<?php echo $this->escapeHtml($maxSize); ?>" size="10"/>
267
- </td>
268
- </tr>
269
-
270
-
271
- <tr>
272
- <th scope="row">
273
- <input id="compression_type" class="formData" name="compression_type" type="hidden"
274
- value="lossy" size="50"/>
275
- <?php echo Mage::helper('imagerecycle')->__('Compression type - PDF:') ?> </th>
276
- <td>
277
- <select id="compression_type_pdf" class="formData" name="compression_type_pdf">
278
- <option
279
- value="lossy" <?php if ($this->settings['compression_type_pdf'] == 'lossy') echo 'selected="selected"'; ?> >
280
- Best saving
281
- </option>
282
- <option
283
- value="lossless" <?php if ($this->settings['compression_type_pdf'] == 'lossless') echo 'selected="selected"'; ?>>
284
- Original quality
285
- </option>
286
- <option
287
- value="none" <?php if ($this->settings['compression_type_pdf'] == 'none') echo 'selected="selected"'; ?>>
288
- No compression
289
- </option>
290
- </select>
291
- </td>
292
-
293
- </tr>
294
-
295
- <tr>
296
- <th scope="row">
297
- <?php echo Mage::helper('imagerecycle')->__('Compression type - PNG:') ?> </th>
298
- <td>
299
- <select id="compression_type_png" class="formData" name="compression_type_png">
300
- <option
301
- value="lossy" <?php if ($this->settings['compression_type_png'] == 'lossy') echo 'selected="selected"'; ?> >
302
- Best saving
303
- </option>
304
- <option
305
- value="lossless" <?php if ($this->settings['compression_type_png'] == 'lossless') echo 'selected="selected"'; ?>>
306
- Original quality
307
- </option>
308
- <option
309
- value="none" <?php if ($this->settings['compression_type_png'] == 'none') echo 'selected="selected"'; ?>>
310
- No compression
311
- </option>
312
- </select>
313
- </td>
314
-
315
- </tr>
316
-
317
- <tr>
318
- <th scope="row">
319
- <?php echo Mage::helper('imagerecycle')->__('Compression type - JPG:') ?> </th>
320
- <td>
321
- <select id="compression_type_jpg" class="formData" name="compression_type_jpg">
322
- <option
323
- value="lossy" <?php if ($this->settings['compression_type_jpg'] == 'lossy') echo 'selected="selected"'; ?> >
324
- Best saving
325
- </option>
326
- <option
327
- value="lossless" <?php if ($this->settings['compression_type_jpg'] == 'lossless') echo 'selected="selected"'; ?>>
328
- Original quality
329
- </option>
330
- <option
331
- value="none" <?php if ($this->settings['compression_type_jpg'] == 'none') echo 'selected="selected"'; ?>>
332
- No compression
333
- </option>
334
- </select>
335
- </td>
336
- </tr>
337
-
338
- <tr>
339
- <th scope="row">
340
- <?php echo Mage::helper('imagerecycle')->__('Compression type - GIF:') ?>
341
- </th>
342
-
343
- <td>
344
- <select id="compression_type_gif" class="formData" name="compression_type_gif">
345
- <option
346
- value="lossy" <?php if ($this->settings['compression_type_gif'] == 'lossy') echo 'selected="selected"'; ?> >
347
- Best saving
348
- </option>
349
- <option
350
- value="lossless" <?php if ($this->settings['compression_type_gif'] == 'lossless') echo 'selected="selected"'; ?>>
351
- Original quality
352
- </option>
353
- <option
354
- value="none" <?php if ($this->settings['compression_type_gif'] == 'none') echo 'selected="selected"'; ?>>
355
- No compression
356
- </option>
357
- </select>
358
- </td>
359
- </tr>
360
-
361
-
362
- <tr>
363
-
364
- <td colspan="3">
365
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
366
- <button type="submit" id="ir-setting-save" class="button"><?php echo Mage::helper('imagerecycle')->__('Save') ?></button>
367
- <a id="ir-setting-save" class="button"
368
- href='<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>'>
369
- <?php echo Mage::helper('imagerecycle')->__('Cancel') ?></a>
370
- </td>
371
- </tr>
372
-
373
- </tbody>
374
- </table>
375
- </form>
376
- </div>
377
-
378
-
379
- <!-- Modal window -->
380
- <div id="myModal" class="reveal-modal">
381
-
382
- <script type="text/javascript">
383
- var curFolders = <?php echo json_encode($selected_folders);?>;
384
- </script>
385
- <div id="wpio_foldertree"></div>
386
- <button class="close-reveal-modal button" type="button" onclick="jSelectFolders()">OK</button>
387
- <button class="close-reveal-modal button">Close</button>
388
- </div>
389
  </div>
1
+ <script>page="config";</script>
2
+ <div class="imagerecycle-container">
3
+ <div class="content-header">
4
+ <h3><?php echo Mage::helper('imagerecycle')->__('Image recycle setttings') ?></h3>
5
+ </div>
6
+
7
+ <!-- ################### Quota usage information ################## -->
8
+
9
+ <h4>Optimization quota usage</h4>
10
+
11
+ <?php
12
+ include_once(Mage::getBaseDir('app') . '/code/community/Imagerecycle/Imagerecycle/classes/ioa.class.php');
13
+ $ioa = new ioaphp(Mage::getStoreConfig('mageio_api_key'), Mage::getStoreConfig('mageio_api_secret'));
14
+ $return = $ioa->getAccountInfos();
15
+ $percentQuota = 0;
16
+ $consumption_text = "";
17
+
18
+ if ($return && (floatval($return->quota_allowed) > 0)) {
19
+ $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
20
+ 'to' . " " . date('d F Y', $return->quota_end) . ":" .
21
+ "<b>" . $this->formateBytes(floatval($return->quota_current)) . "/ " .
22
+ $this->formateBytes(floatval($return->quota_allowed)) . "</b>";
23
+
24
+ $percentQuota = number_format(min(($return->quota_current / $return->quota_allowed), 1) * 100, 2);
25
+
26
+ echo '<p>'.$consumption_text . '(' . $percentQuota . '%)</p>';
27
+
28
+ echo '<div class="ir-progress-wrap">
29
+ <div class="ir-progress-bar" style="width: '.$percentQuota.'%"></div>
30
+ <span>'.$percentQuota.'%</span>
31
+ </div>';
32
+
33
+ } else if ($return) {
34
+ $consumption_text = 'Consummated quota from' . " " . date('d F Y', $return->quota_start) . " " .
35
+ 'to' . " " . date('d F Y', $return->quota_end) .
36
+ ": " . $this->formateBytes(floatval($return->quota_current));
37
+ echo '<p>' . $consumption_text . '</p>';
38
+
39
+ } else {
40
+ $consumption_text = 'Connection error';
41
+ echo '<p>' . $consumption_text . '</p>';
42
+
43
+ }
44
+ ?>
45
+ <a href="https://www.imagerecycle.com/prices" target="_blank" class="get-quota-btn button">
46
+ <?php echo Mage::helper("imagerecycle")->__("Get optimization quota") ?>
47
+ </a>
48
+
49
+ <div class="clear"></div>
50
+
51
+ <!-- ################### Main module settings form ################## -->
52
+
53
+ <h4>Settings</h4>
54
+
55
+ <?php
56
+ $compress_auto = !is_null($this->settings['compress_auto']) ? $this->settings['compress_auto'] : 0;
57
+ $cron_periodicity = !is_null($this->settings['cron_periodicity']) ? $this->settings['cron_periodicity'] : '5mins';
58
+ ?>
59
+
60
+ <script type="text/javascript">
61
+ var getFolders_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/getFolders") ?>?isAjax=true';
62
+ var index_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>';
63
+ var cron_url = '<?php echo Mage::getBaseUrl() . 'imagerecycle/ImageAll/index?id=cronurl' ?>';
64
+ var is_compress_auto = '<?php echo $compress_auto; ?>';
65
+ var cron_periodicity = '<?php echo $cron_periodicity; ?>';
66
+ var reindex_init_url = '<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/reindexInit") ?>';
67
+ </script>
68
+
69
+
70
+ <div class="ir-setting">
71
+ <form action="<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/saveSetting"); ?>" method="POST">
72
+ <table class="form-table">
73
+ <tbody>
74
+ <input id="installed_time" class="formData" name="installed_time" type="hidden"
75
+ value="<?php echo Mage::getStoreConfig('mageio_installed_time'); ?>" size="50"/>
76
+ <tr>
77
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API key : ') ?></th>
78
+ <td colspan="2">
79
+ <input id="api_key" class="formData" name="api_key" type="text"
80
+ value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_key')); ?>" size="50"/>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr>
85
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('API secret : ') ?></th>
86
+ <td colspan="2">
87
+ <input id="api_secret" class="formData" name="api_secret" type="text"
88
+ value="<?php echo $this->escapeHtml(Mage::getStoreConfig('mageio_api_secret')); ?>" size="50"/>
89
+ </td>
90
+ </tr>
91
+
92
+
93
+ <tr>
94
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Include folders : ') ?></th>
95
+ <td colspan="2">
96
+ <?php
97
+
98
+ $include_folders = $this->settings['include_folders'];
99
+ $selected_folders = explode(',', $include_folders);
100
+
101
+ ?>
102
+ <input id="include_folders" class="formData" name="include_folders"
103
+ readonly='readonly' type="text" value="<?php echo $this->escapeHtml($include_folders); ?>"
104
+ size="50"/>
105
+
106
+ <a href="#" class="button" data-reveal-id="myModal"> browse </a>
107
+ </td>
108
+ </tr>
109
+
110
+
111
+ <!-- Optimize Reinitialize index yes and no -->
112
+ <tr>
113
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Reinitialize media indexation after') ?></th>
114
+ <td colspan="2">
115
+ <?php
116
+ $reindex_init = !is_null($this->settings['reindex_init']) ? $this->settings['reindex_init'] : 0;
117
+ ?>
118
+ <select id="reindex_init" name="reindex_init">
119
+ <option value="0" <?php if ($reindex_init == 0) {
120
+ echo 'selected="selected"';
121
+ } ?> >Never
122
+ </option>
123
+ <option value="5" <?php if ($reindex_init == 5) {
124
+ echo 'selected="selected"';
125
+ } ?> >5mins
126
+ </option>
127
+ <option value="10" <?php if ($reindex_init == 10) {
128
+ echo 'selected="selected"';
129
+ } ?> >10mins
130
+ </option>
131
+ <option value="20" <?php if ($reindex_init == 20) {
132
+ echo 'selected="selected"';
133
+ } ?> >20mins
134
+ </option>
135
+ <option value="30" <?php if ($reindex_init == 30) {
136
+ echo 'selected="selected"';
137
+ } ?> >30mins
138
+ </option>
139
+ <option value="60" <?php if ($reindex_init == 60) {
140
+ echo 'selected="selected"';
141
+ } ?> >1h
142
+ </option>
143
+ <option value="120" <?php if ($reindex_init == 120) {
144
+ echo 'selected="selected"';
145
+ } ?> >2h
146
+ </option>
147
+ <option value="360" <?php if ($reindex_init == 360) {
148
+ echo 'selected="selected"';
149
+ } ?> >6h
150
+ </option>
151
+ <option value="720" <?php if ($reindex_init == 720) {
152
+ echo 'selected="selected"';
153
+ } ?> >12h
154
+ </option>
155
+ <option value="1440" <?php if ($reindex_init == 1440) {
156
+ echo 'selected="selected"';
157
+ } ?> >24h
158
+ </option>
159
+ <option value="2880" <?php if ($reindex_init == 2880) {
160
+ echo 'selected="selected"';
161
+ } ?> >48h
162
+ </option>
163
+ </select>
164
+ <button class="do-index button" href="#"><?php echo Mage::helper('imagerecycle')->__('Force reindex images') ?></button>
165
+ </td>
166
+ </tr>
167
+
168
+ <!------------------------- This is the current customizing area---------------------------->
169
+ <!-- Optimize media on saving yes and no -->
170
+ <tr>
171
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Optimize media on saving') ?></th>
172
+ <td colspan="2">
173
+ <?php
174
+ $saving_auto = !is_null($this->settings['saving_auto']) ? $this->settings['saving_auto'] : 0;
175
+ ?>
176
+
177
+ <select id="saving_auto" name="saving_auto">
178
+ <option value="0" <?php if ($saving_auto == 0) {
179
+ echo 'selected="selected"';
180
+ } ?> >No
181
+ </option>
182
+ <option value="1" <?php if ($saving_auto == 1) {
183
+ echo 'selected="selected"';
184
+ } ?> >Yes
185
+ </option>
186
+ </select>
187
+ </td>
188
+ </tr>
189
+
190
+ <!---------------------- This is the auto compress yes and no ------------------------------->
191
+ <tr id='compress_auto_setting'>
192
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Automatic compression') ?></th>
193
+ <td colspan="2">
194
+
195
+ <select id="compress_auto" name="compress_auto">
196
+ <option value="0" <?php if ($compress_auto == 0) {
197
+ echo 'selected="selected"';
198
+ } ?> >No automatic compression
199
+ </option>
200
+ <option value="1" <?php if ($compress_auto == 1) {
201
+ echo 'selected="selected"';
202
+ } ?> >Magento inbuilt cron task
203
+ </option>
204
+ <option value="2" <?php if ($compress_auto == 2) {
205
+ echo 'selected="selected"';
206
+ } ?> >Custom cron task
207
+ </option>
208
+ </select>
209
+ </td>
210
+ </tr>
211
+
212
+
213
+ <!---------------------- ------------------------------->
214
+ <tr>
215
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize') ?></th>
216
+ <td colspan="2">
217
+ <?php
218
+ $resize_auto = !is_null($this->settings['resize_auto']) ? $this->settings['resize_auto'] : 0;
219
+ ?>
220
+
221
+ <select id="resize_auto" name="resize_auto">
222
+ <option value="0" <?php if ($resize_auto == 0) {
223
+ echo 'selected="selected"';
224
+ } ?> >No
225
+ </option>
226
+ <option value="1" <?php if ($resize_auto == 1) {
227
+ echo 'selected="selected"';
228
+ } ?> >Yes
229
+ </option>
230
+ </select>
231
+ </td>
232
+ </tr>
233
+
234
+ <tr>
235
+ <td colspan="3">
236
+ <?php echo Mage::helper('imagerecycle')->__('<strong>Use with caution!</strong> All new images will size more than setting will be resized automatically on upload') ?>
237
+ </td>
238
+ </tr>
239
+
240
+ <tr>
241
+ <th scope="row"><?php echo Mage::helper('imagerecycle')->__('Image resize, max size (px)') ?></th>
242
+ <td>
243
+ <?php $resize_image = !is_null($this->settings['resize_image']) ? $this->settings['resize_image'] : 1600; ?>
244
+ <input id="resize_image" class="formData" name="resize_image" type="text"
245
+ value="<?php echo $this->escapeHtml($resize_image); ?>" size="10"/>
246
+ </td>
247
+ </tr>
248
+
249
+ <tr>
250
+ <th scope="row">
251
+ <?php echo Mage::helper('imagerecycle')->__('Min file size to optimize (Kb)') ?></th>
252
+ <td>
253
+ <?php $minSize = !is_null($this->settings['min_size']) ? $this->settings['min_size'] : 1; ?>
254
+ <input id="min_size" class="formData" name="min_size" type="text"
255
+ value="<?php echo $this->escapeHtml($minSize); ?>" size="10"/>
256
+ </td>
257
+ </th>
258
+ </tr>
259
+
260
+ <tr>
261
+ <th scope="row">
262
+ <?php echo Mage::helper('imagerecycle')->__('Max file size to optimize (Kb)') ?></th>
263
+ <td>
264
+ <?php $maxSize = !is_null($this->settings['max_size']) ? $this->settings['max_size'] : 10000; ?>
265
+ <input id="max_size" class="formData" name="max_size" type="text"
266
+ value="<?php echo $this->escapeHtml($maxSize); ?>" size="10"/>
267
+ </td>
268
+ </tr>
269
+
270
+
271
+ <tr>
272
+ <th scope="row">
273
+ <input id="compression_type" class="formData" name="compression_type" type="hidden"
274
+ value="lossy" size="50"/>
275
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - PDF:') ?> </th>
276
+ <td>
277
+ <select id="compression_type_pdf" class="formData" name="compression_type_pdf">
278
+ <option
279
+ value="lossy" <?php if ($this->settings['compression_type_pdf'] == 'lossy') echo 'selected="selected"'; ?> >
280
+ Best saving
281
+ </option>
282
+ <option
283
+ value="lossless" <?php if ($this->settings['compression_type_pdf'] == 'lossless') echo 'selected="selected"'; ?>>
284
+ Original quality
285
+ </option>
286
+ <option
287
+ value="none" <?php if ($this->settings['compression_type_pdf'] == 'none') echo 'selected="selected"'; ?>>
288
+ No compression
289
+ </option>
290
+ </select>
291
+ </td>
292
+
293
+ </tr>
294
+
295
+ <tr>
296
+ <th scope="row">
297
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - PNG:') ?> </th>
298
+ <td>
299
+ <select id="compression_type_png" class="formData" name="compression_type_png">
300
+ <option
301
+ value="lossy" <?php if ($this->settings['compression_type_png'] == 'lossy') echo 'selected="selected"'; ?> >
302
+ Best saving
303
+ </option>
304
+ <option
305
+ value="lossless" <?php if ($this->settings['compression_type_png'] == 'lossless') echo 'selected="selected"'; ?>>
306
+ Original quality
307
+ </option>
308
+ <option
309
+ value="none" <?php if ($this->settings['compression_type_png'] == 'none') echo 'selected="selected"'; ?>>
310
+ No compression
311
+ </option>
312
+ </select>
313
+ </td>
314
+
315
+ </tr>
316
+
317
+ <tr>
318
+ <th scope="row">
319
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - JPG:') ?> </th>
320
+ <td>
321
+ <select id="compression_type_jpg" class="formData" name="compression_type_jpg">
322
+ <option
323
+ value="lossy" <?php if ($this->settings['compression_type_jpg'] == 'lossy') echo 'selected="selected"'; ?> >
324
+ Best saving
325
+ </option>
326
+ <option
327
+ value="lossless" <?php if ($this->settings['compression_type_jpg'] == 'lossless') echo 'selected="selected"'; ?>>
328
+ Original quality
329
+ </option>
330
+ <option
331
+ value="none" <?php if ($this->settings['compression_type_jpg'] == 'none') echo 'selected="selected"'; ?>>
332
+ No compression
333
+ </option>
334
+ </select>
335
+ </td>
336
+ </tr>
337
+
338
+ <tr>
339
+ <th scope="row">
340
+ <?php echo Mage::helper('imagerecycle')->__('Compression type - GIF:') ?>
341
+ </th>
342
+
343
+ <td>
344
+ <select id="compression_type_gif" class="formData" name="compression_type_gif">
345
+ <option
346
+ value="lossy" <?php if ($this->settings['compression_type_gif'] == 'lossy') echo 'selected="selected"'; ?> >
347
+ Best saving
348
+ </option>
349
+ <option
350
+ value="lossless" <?php if ($this->settings['compression_type_gif'] == 'lossless') echo 'selected="selected"'; ?>>
351
+ Original quality
352
+ </option>
353
+ <option
354
+ value="none" <?php if ($this->settings['compression_type_gif'] == 'none') echo 'selected="selected"'; ?>>
355
+ No compression
356
+ </option>
357
+ </select>
358
+ </td>
359
+ </tr>
360
+
361
+
362
+ <tr>
363
+
364
+ <td colspan="3">
365
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
366
+ <button type="submit" id="ir-setting-save" class="button"><?php echo Mage::helper('imagerecycle')->__('Save') ?></button>
367
+ <a id="ir-setting-save" class="button"
368
+ href='<?php echo Mage::helper("adminhtml")->getUrl("imagerecycle/index/index") ?>'>
369
+ <?php echo Mage::helper('imagerecycle')->__('Cancel') ?></a>
370
+ </td>
371
+ </tr>
372
+
373
+ </tbody>
374
+ </table>
375
+ </form>
376
+ </div>
377
+
378
+
379
+ <!-- Modal window -->
380
+ <div id="myModal" class="reveal-modal">
381
+
382
+ <script type="text/javascript">
383
+ var curFolders = <?php echo json_encode($selected_folders);?>;
384
+ </script>
385
+ <div id="wpio_foldertree"></div>
386
+ <button class="close-reveal-modal button" type="button" onclick="jSelectFolders()">OK</button>
387
+ <button class="close-reveal-modal button">Close</button>
388
+ </div>
389
  </div>
package.xml CHANGED
@@ -1,44 +1,43 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ImageRecycle_image_pdf_optimize</name>
4
- <version>2.0.2</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ImageRecycle is an automatic Image and PDF optimizer that speedup the page display</summary>
10
  <description>ImageRecycle is an automatic Image and PDF content optimizer for Magento store. Your customers are waiting for your pages to load, it can takes long, especially on mobile devices. Even content is served fast by the server, slow connection can make your users leaving. &lt;br /&gt;&lt;br /&gt;&#xD;
11
- People are impatient in front a slow loading website, that's the result of a recent study, 4 second loading causing 24% of visitors to leave (Source statistica.com.). Content optimization is more efficient than any other optimization tool.&lt;br /&gt;&lt;br /&gt;&#xD;
12
- &lt;h2&gt;Magento image optimization&lt;/h2&gt;&lt;br /&gt;&#xD;
13
- Images can represent from 60% to 80% of a product page weight, so an optimization can accelerate your shop loading by x3 or more.&#xD;
14
- &#xD;
15
- With an average of 25% of users that leave your website after 4 second of loading page, this is something crucial for your online business. And it's even more important on mobile devices were connection are usually slower.&#xD;
16
- &#xD;
17
- &lt;h2&gt;Reduce image and pdf, not quality&lt;/h2&gt;&lt;br /&gt;&#xD;
18
- &#xD;
19
- The jpg, png, gif optimization algorithm is capable of reducing the image size by up to 85% (5x +), while the resulting photos are visually identical to the originals. We believe that image and pdf compression is a matter preserving the quality then reduce the size. Reducing the image and pdf size can be done using a massive compression of data and result a worsened quality. We detect already compressed media and return original files.&#xD;
20
- &#xD;
21
- &lt;h2&gt;Main features:&lt;/h2&gt;&lt;br /&gt;&#xD;
22
- &#xD;
23
- - Compress automatically new images &amp;amp; pdf&#xD;
24
- &#xD;
25
- - Compress automatically existing images &amp;amp; pdf&#xD;
26
- &#xD;
27
- - Image automatic resizing&#xD;
28
- &#xD;
29
- - Define an optimization quality images per media type&#xD;
30
- &#xD;
31
- - Define a min-max size to optimize&#xD;
32
- &#xD;
33
- - Optimize png, jpg, gif&#xD;
34
- &#xD;
35
- - Define optimization quality per file type, jpg, png, gif</description>
36
- <notes>Update php version required&#xD;
37
- </notes>
38
  <authors><author><name>ImageRecycle</name><user>ImageRecycle</user><email>contact@imagerecycle.com</email></author></authors>
39
- <date>2016-08-03</date>
40
- <time>09:35:47</time>
41
- <contents><target name="magecommunity"><dir name="Imagerecycle"><dir name="Imagerecycle"><dir name="Block"><file name="Images.php" hash="b5916489e428923cbefd494b07c2c0a9"/><file name="Notifications.php" hash="3ae0284429f2ddbcf63cfeea773a2c9f"/><file name="Settings.php" hash="b35eb42fcfa5252d5d5a07183bd3ff7f"/></dir><dir name="Helper"><file name="Data.php" hash="41b4f1948165518f84c1eb61ad8ecf66"/></dir><dir name="Model"><file name="Notification.php" hash="9d4ae12ea06ffe9ccde7ddfe64a1f479"/><file name="Observer.php" hash="2fb2b19fed27ca284a1512f7d6fe8b78"/><dir name="Resource"><file name="Images.php" hash="a6ebc0e96de89452cc683a17fe4e13f8"/><file name="Setup.php" hash="0040a20420dcb2c6c896d7bc56816de7"/></dir></dir><dir name="classes"><file name="ioa.class.php" hash="18f5a6b91ce6b7480b8645a74016a1b6"/></dir><dir name="controllers"><file name="ImageAllController.php" hash="92adafd3cd6f0a89d942935c7c4141c5"/><file name="IndexController.php" hash="7e54baa31d599b9563c171ad5f06b143"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0776ce36332d75b99f558e885877f012"/><file name="config.xml" hash="f8cddfdfa94223c030d77169113d16da"/></dir><dir name="sql"><dir name="imagerecycle_setup"><file name="mysql4-install-1.0.0.php" hash="f6342691d651243edd4406f6ed7da5a0"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="imagerecycle"><dir name="imagerecycle"><file name="config.js" hash="922198a16d9f80b6f016fac1d8b7fe93"/><file name="jaofiletree.js" hash="e20f8412f596837681953a33d574db10"/><file name="jquery.min.js" hash="e1a1b01a12659ff6530a5b8f2dbb18f8"/><file name="jquery.reveal.js" hash="2e4b47ca455e3327414583a0c77f3e33"/><file name="script.js" hash="af1d346d99ff28b143bcd13e6ba96d9a"/><file name="thickbox.js" hash="5512dbf5f17748621fba6673cd02abff"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="imagerecycle"><dir name="imagerecycle"><file name="imagerecycle.css" hash="0ff281c82cd1de54a2f8ab4abcd7fc04"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="application.png" hash="fc517da02d6a64a68e5fea9a5de472f1"/><file name="code.png" hash="c65fadae5a0fc27f401f1a00e66f518f"/><file name="css.png" hash="783f5b06082bf73e9d1eaf79d838162f"/><file name="db.png" hash="03e2b564224bfb58ff20904bda244043"/><file name="directory.png" hash="fbd3929a893b147ae0940d48d533e023"/><file name="doc.png" hash="38af291953d5b90b0aee30dd0d2126a4"/><file name="drive.png" hash="952051985214488bb370ecd21db44c74"/><file name="file.png" hash="a3112ba7e266938321394347e2a6e107"/><file name="film.png" hash="5ad12582e3ca901894737c3dd44a5eb2"/><file name="flash.png" hash="132a505684e7b7b91f50ea29c072112b"/><file name="folder_open.png" hash="bf30d89d69dddfbd8e5f805a199c407f"/><file name="gift-message-collapse.gif" hash="5b710f5faa9c7352a39c10e3ebbee6fc"/><file name="gift-message-expand.gif" hash="fd53a70cbb1ea048754657a63787e9cb"/><file name="grouped_to_order_icon.png" hash="4bdae9a6199655027b8b8aeee8f80ce4"/><file name="html.png" hash="12ace1a918403049a6d2fc152f53baec"/><file name="i_question-mark.png" hash="23201b7ac207eebd9be0776ea44098a4"/><file name="java.png" hash="ac467ef8defc620b6b5eb80d2047bcb7"/><file name="linux.png" hash="73c25b185fb78cc690675cd4a181ee0b"/><file name="loadingAnimation.gif" hash="ce2268030dd2151b63cdf4ffc2f626ba"/><file name="music.png" hash="bd2244ac282a5ada48b0d79cacc59426"/><file name="pdf.png" hash="9c819141f3537f9f3ea181369332be85"/><file name="php.png" hash="48cda2a2a54a31f7a666547c862c12e7"/><file name="picture.png" hash="d2040c34ba1ffd8fa5b72ab37be11eca"/><file name="ppt.png" hash="8c366c11adee3cf2988614df4c96782b"/><file name="psd.png" hash="787a96924e9b114e75f48b540ff480a2"/><file name="ruby.png" hash="661505d2efc05b2347492e4949f564d5"/><file name="script.png" hash="13ad2158a4889c26a851f99b261e4c5c"/><file name="spinner.gif" hash="9a8269421303631316be4ab5e34870e1"/><file name="txt.png" hash="0da66bdb013f9a9d12ce7219e642bc25"/><file name="xls.png" hash="7363cb7630d1d4b441183345fd15ae62"/><file name="zip.png" hash="2eba6780fc7d3663bc44808480c6bd8a"/></dir><file name="jaofiletree.css" hash="6092087d82ceb554b34d75be2ca8bf29"/><file name="reveal.css" hash="21171f730dcf9dc6d4377c88307503c5"/><file name="thickbox.css" hash="f07f045e5a10347a6665a0ac48fda4dc"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagerecycle_imagerecycle.xml" hash="01fca7a6d778a604cb009c603c633e13"/></dir><dir name="template"><dir name="imagerecycle"><dir name="imagerecycle"><file name="connect.phtml" hash="f4a9b616d768bc161a37207c19aee718"/><file name="images.phtml" hash="ba2e3918c19515295c7dfeda6fa0392e"/><file name="listing.phtml" hash="693f22aa6aa7ba43acd69f3fd1b478ec"/><file name="settings.phtml" hash="ae716e4e9cdf3a952d660e94b12b291f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imagerecycle_ImageRecycle.xml" hash="965f7990a669fff8ba5bc3fc06d48801"/></dir></target></contents>
42
  <compatible/>
43
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
44
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ImageRecycle_image_pdf_optimize</name>
4
+ <version>2.0.3</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ImageRecycle is an automatic Image and PDF optimizer that speedup the page display</summary>
10
  <description>ImageRecycle is an automatic Image and PDF content optimizer for Magento store. Your customers are waiting for your pages to load, it can takes long, especially on mobile devices. Even content is served fast by the server, slow connection can make your users leaving. &lt;br /&gt;&lt;br /&gt;&#xD;
11
+ People are impatient in front a slow loading website, that's the result of a recent study, 4 second loading causing 24% of visitors to leave (Source statistica.com.). Content optimization is more efficient than any other optimization tool.&lt;br /&gt;&lt;br /&gt;&#xD;
12
+ &lt;h2&gt;Magento image optimization&lt;/h2&gt;&lt;br /&gt;&#xD;
13
+ Images can represent from 60% to 80% of a product page weight, so an optimization can accelerate your shop loading by x3 or more.&#xD;
14
+ &#xD;
15
+ With an average of 25% of users that leave your website after 4 second of loading page, this is something crucial for your online business. And it's even more important on mobile devices were connection are usually slower.&#xD;
16
+ &#xD;
17
+ &lt;h2&gt;Reduce image and pdf, not quality&lt;/h2&gt;&lt;br /&gt;&#xD;
18
+ &#xD;
19
+ The jpg, png, gif optimization algorithm is capable of reducing the image size by up to 85% (5x +), while the resulting photos are visually identical to the originals. We believe that image and pdf compression is a matter preserving the quality then reduce the size. Reducing the image and pdf size can be done using a massive compression of data and result a worsened quality. We detect already compressed media and return original files.&#xD;
20
+ &#xD;
21
+ &lt;h2&gt;Main features:&lt;/h2&gt;&lt;br /&gt;&#xD;
22
+ &#xD;
23
+ - Compress automatically new images &amp;amp; pdf&#xD;
24
+ &#xD;
25
+ - Compress automatically existing images &amp;amp; pdf&#xD;
26
+ &#xD;
27
+ - Image automatic resizing&#xD;
28
+ &#xD;
29
+ - Define an optimization quality images per media type&#xD;
30
+ &#xD;
31
+ - Define a min-max size to optimize&#xD;
32
+ &#xD;
33
+ - Optimize png, jpg, gif&#xD;
34
+ &#xD;
35
+ - Define optimization quality per file type, jpg, png, gif</description>
36
+ <notes>Fix Block error thrown in log file</notes>
 
37
  <authors><author><name>ImageRecycle</name><user>ImageRecycle</user><email>contact@imagerecycle.com</email></author></authors>
38
+ <date>2017-07-12</date>
39
+ <time>14:13:51</time>
40
+ <contents><target name="magecommunity"><dir name="Imagerecycle"><dir name="Imagerecycle"><dir name="Block"><file name="Images.php" hash="b5916489e428923cbefd494b07c2c0a9"/><file name="Notifications.php" hash="947ec88b65fa80ee2ed7e4853010ba60"/><file name="Settings.php" hash="106143b2a4a3c47d752d55729cf8f450"/></dir><dir name="Helper"><file name="Data.php" hash="41b4f1948165518f84c1eb61ad8ecf66"/></dir><dir name="Model"><file name="Notification.php" hash="461ab1b67987d9735aea35161bdec45b"/><file name="Observer.php" hash="2fb2b19fed27ca284a1512f7d6fe8b78"/><dir name="Resource"><file name="Images.php" hash="a6ebc0e96de89452cc683a17fe4e13f8"/><file name="Setup.php" hash="0040a20420dcb2c6c896d7bc56816de7"/></dir></dir><dir name="classes"><file name="ioa.class.php" hash="18f5a6b91ce6b7480b8645a74016a1b6"/></dir><dir name="controllers"><file name="ImageAllController.php" hash="a9bf0713c11d0f3eb01f0f4292722e2f"/><file name="IndexController.php" hash="7e54baa31d599b9563c171ad5f06b143"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0776ce36332d75b99f558e885877f012"/><file name="config.xml" hash="8625db4b3e6e5b0b14c6e39e0d6b77eb"/></dir><dir name="sql"><dir name="imagerecycle_setup"><file name="mysql4-install-1.0.0.php" hash="f6342691d651243edd4406f6ed7da5a0"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="imagerecycle"><dir name="imagerecycle"><file name="config.js" hash="922198a16d9f80b6f016fac1d8b7fe93"/><file name="jaofiletree.js" hash="e20f8412f596837681953a33d574db10"/><file name="jquery.min.js" hash="e1a1b01a12659ff6530a5b8f2dbb18f8"/><file name="jquery.reveal.js" hash="2e4b47ca455e3327414583a0c77f3e33"/><file name="script.js" hash="af1d346d99ff28b143bcd13e6ba96d9a"/><file name="thickbox.js" hash="5512dbf5f17748621fba6673cd02abff"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="imagerecycle"><dir name="imagerecycle"><file name="imagerecycle.css" hash="0ff281c82cd1de54a2f8ab4abcd7fc04"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="application.png" hash="fc517da02d6a64a68e5fea9a5de472f1"/><file name="code.png" hash="c65fadae5a0fc27f401f1a00e66f518f"/><file name="css.png" hash="783f5b06082bf73e9d1eaf79d838162f"/><file name="db.png" hash="03e2b564224bfb58ff20904bda244043"/><file name="directory.png" hash="fbd3929a893b147ae0940d48d533e023"/><file name="doc.png" hash="38af291953d5b90b0aee30dd0d2126a4"/><file name="drive.png" hash="952051985214488bb370ecd21db44c74"/><file name="file.png" hash="a3112ba7e266938321394347e2a6e107"/><file name="film.png" hash="5ad12582e3ca901894737c3dd44a5eb2"/><file name="flash.png" hash="132a505684e7b7b91f50ea29c072112b"/><file name="folder_open.png" hash="bf30d89d69dddfbd8e5f805a199c407f"/><file name="gift-message-collapse.gif" hash="5b710f5faa9c7352a39c10e3ebbee6fc"/><file name="gift-message-expand.gif" hash="fd53a70cbb1ea048754657a63787e9cb"/><file name="grouped_to_order_icon.png" hash="4bdae9a6199655027b8b8aeee8f80ce4"/><file name="html.png" hash="12ace1a918403049a6d2fc152f53baec"/><file name="i_question-mark.png" hash="23201b7ac207eebd9be0776ea44098a4"/><file name="java.png" hash="ac467ef8defc620b6b5eb80d2047bcb7"/><file name="linux.png" hash="73c25b185fb78cc690675cd4a181ee0b"/><file name="loadingAnimation.gif" hash="ce2268030dd2151b63cdf4ffc2f626ba"/><file name="music.png" hash="bd2244ac282a5ada48b0d79cacc59426"/><file name="pdf.png" hash="9c819141f3537f9f3ea181369332be85"/><file name="php.png" hash="48cda2a2a54a31f7a666547c862c12e7"/><file name="picture.png" hash="d2040c34ba1ffd8fa5b72ab37be11eca"/><file name="ppt.png" hash="8c366c11adee3cf2988614df4c96782b"/><file name="psd.png" hash="787a96924e9b114e75f48b540ff480a2"/><file name="ruby.png" hash="661505d2efc05b2347492e4949f564d5"/><file name="script.png" hash="13ad2158a4889c26a851f99b261e4c5c"/><file name="spinner.gif" hash="9a8269421303631316be4ab5e34870e1"/><file name="txt.png" hash="0da66bdb013f9a9d12ce7219e642bc25"/><file name="xls.png" hash="7363cb7630d1d4b441183345fd15ae62"/><file name="zip.png" hash="2eba6780fc7d3663bc44808480c6bd8a"/></dir><file name="jaofiletree.css" hash="c9305d64123bbbf21537c8e8d2358a0d"/><file name="reveal.css" hash="21171f730dcf9dc6d4377c88307503c5"/><file name="thickbox.css" hash="f07f045e5a10347a6665a0ac48fda4dc"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="imagerecycle_imagerecycle.xml" hash="01fca7a6d778a604cb009c603c633e13"/></dir><dir name="template"><dir name="imagerecycle"><dir name="imagerecycle"><file name="connect.phtml" hash="7801a43adad2371ef655c12ca645641a"/><file name="images.phtml" hash="f871e9da9d3a08f9df553d21f3f65977"/><file name="listing.phtml" hash="693f22aa6aa7ba43acd69f3fd1b478ec"/><file name="settings.phtml" hash="b2605e0606e639931409e6bbb9efde3f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imagerecycle_ImageRecycle.xml" hash="965f7990a669fff8ba5bc3fc06d48801"/></dir></target></contents>
41
  <compatible/>
42
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>curl</name><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
43
  </package>
skin/adminhtml/default/default/imagerecycle/imagerecycle/jaofiletree.css CHANGED
@@ -1,168 +1,168 @@
1
- #wpio_foldertree {
2
- padding: 10px;
3
- }
4
-
5
- ul.wpio_jaofoldertree {
6
- font-family: Verdana, sans-serif;
7
- font-size: 11px;
8
- line-height: 18px;
9
- padding: 0;
10
- margin: 0 !important;
11
- }
12
-
13
- ul.wpio_jaofoldertree li {
14
- list-style: none;
15
- padding: 0px;
16
- padding-left: 20px;
17
- margin: 0px;
18
- white-space: nowrap;
19
- }
20
-
21
- ul.wpio_jaofoldertree a {
22
- color: #333;
23
- text-decoration: none;
24
- display: inline-block;
25
- padding: 0px 2px;
26
- }
27
-
28
- ul.wpio_jaofoldertree a:hover {
29
- font-weight: bold;
30
- }
31
-
32
- ul.wpio_jaofoldertree li.selected > a {
33
- font-weight: bold;
34
- }
35
-
36
- /* Core Styles */
37
- .wpio_jaofoldertree li.wpio_directory { background: url(images/directory.png) left top no-repeat; }
38
- .wpio_jaofoldertree li.expanded { background: url(images/folder_open.png) left top no-repeat; }
39
- .wpio_jaofoldertree li.drive { background: url(images/drive.png) left top no-repeat; }
40
- .wpio_jaofoldertree li.file { background: url(images/file.png) left top no-repeat; }
41
- .wpio_jaofoldertree li.wait { background: url(images/spinner.gif) left top no-repeat; }
42
- /* File Extensions*/
43
- .wpio_jaofoldertree li.ext_3gp { background: url(images/film.png) left top no-repeat; }
44
- .wpio_jaofoldertree li.ext_afp { background: url(images/code.png) left top no-repeat; }
45
- .wpio_jaofoldertree li.ext_afpa { background: url(images/code.png) left top no-repeat; }
46
- .wpio_jaofoldertree li.ext_asp { background: url(images/code.png) left top no-repeat; }
47
- .wpio_jaofoldertree li.ext_aspx { background: url(images/code.png) left top no-repeat; }
48
- .wpio_jaofoldertree li.ext_avi { background: url(images/film.png) left top no-repeat; }
49
- .wpio_jaofoldertree li.ext_bat { background: url(images/application.png) left top no-repeat; }
50
- .wpio_jaofoldertree li.ext_bmp { background: url(images/picture.png) left top no-repeat; }
51
- .wpio_jaofoldertree li.ext_c { background: url(images/code.png) left top no-repeat; }
52
- .wpio_jaofoldertree li.ext_cfm { background: url(images/code.png) left top no-repeat; }
53
- .wpio_jaofoldertree li.ext_cgi { background: url(images/code.png) left top no-repeat; }
54
- .wpio_jaofoldertree li.ext_com { background: url(images/application.png) left top no-repeat; }
55
- .wpio_jaofoldertree li.ext_cpp { background: url(images/code.png) left top no-repeat; }
56
- .wpio_jaofoldertree li.ext_css { background: url(images/css.png) left top no-repeat; }
57
- .wpio_jaofoldertree li.ext_doc { background: url(images/doc.png) left top no-repeat; }
58
- .wpio_jaofoldertree li.ext_exe { background: url(images/application.png) left top no-repeat; }
59
- .wpio_jaofoldertree li.ext_gif { background: url(images/picture.png) left top no-repeat; }
60
- .wpio_jaofoldertree li.ext_fla { background: url(images/flash.png) left top no-repeat; }
61
- .wpio_jaofoldertree li.ext_h { background: url(images/code.png) left top no-repeat; }
62
- .wpio_jaofoldertree li.ext_htm { background: url(images/html.png) left top no-repeat; }
63
- .wpio_jaofoldertree li.ext_html { background: url(images/html.png) left top no-repeat; }
64
- .wpio_jaofoldertree li.ext_jar { background: url(images/java.png) left top no-repeat; }
65
- .wpio_jaofoldertree li.ext_jpg { background: url(images/picture.png) left top no-repeat; }
66
- .wpio_jaofoldertree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
67
- .wpio_jaofoldertree li.ext_js { background: url(images/script.png) left top no-repeat; }
68
- .wpio_jaofoldertree li.ext_lasso { background: url(images/code.png) left top no-repeat; }
69
- .wpio_jaofoldertree li.ext_log { background: url(images/txt.png) left top no-repeat; }
70
- .wpio_jaofoldertree li.ext_m4p { background: url(images/music.png) left top no-repeat; }
71
- .wpio_jaofoldertree li.ext_mov { background: url(images/film.png) left top no-repeat; }
72
- .wpio_jaofoldertree li.ext_mp3 { background: url(images/music.png) left top no-repeat; }
73
- .wpio_jaofoldertree li.ext_mp4 { background: url(images/film.png) left top no-repeat; }
74
- .wpio_jaofoldertree li.ext_mpg { background: url(images/film.png) left top no-repeat; }
75
- .wpio_jaofoldertree li.ext_mpeg { background: url(images/film.png) left top no-repeat; }
76
- .wpio_jaofoldertree li.ext_ogg { background: url(images/music.png) left top no-repeat; }
77
- .wpio_jaofoldertree li.ext_pcx { background: url(images/picture.png) left top no-repeat; }
78
- .wpio_jaofoldertree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
79
- .wpio_jaofoldertree li.ext_php { background: url(images/php.png) left top no-repeat; }
80
- .wpio_jaofoldertree li.ext_png { background: url(images/picture.png) left top no-repeat; }
81
- .wpio_jaofoldertree li.ext_ppt { background: url(images/ppt.png) left top no-repeat; }
82
- .wpio_jaofoldertree li.ext_psd { background: url(images/psd.png) left top no-repeat; }
83
- .wpio_jaofoldertree li.ext_pl { background: url(images/script.png) left top no-repeat; }
84
- .wpio_jaofoldertree li.ext_py { background: url(images/script.png) left top no-repeat; }
85
- .wpio_jaofoldertree li.ext_rb { background: url(images/ruby.png) left top no-repeat; }
86
- .wpio_jaofoldertree li.ext_rbx { background: url(images/ruby.png) left top no-repeat; }
87
- .wpio_jaofoldertree li.ext_rhtml { background: url(images/ruby.png) left top no-repeat; }
88
- .wpio_jaofoldertree li.ext_rpm { background: url(images/linux.png) left top no-repeat; }
89
- .wpio_jaofoldertree li.ext_ruby { background: url(images/ruby.png) left top no-repeat; }
90
- .wpio_jaofoldertree li.ext_sql { background: url(images/db.png) left top no-repeat; }
91
- .wpio_jaofoldertree li.ext_swf { background: url(images/flash.png) left top no-repeat; }
92
- .wpio_jaofoldertree li.ext_tif { background: url(images/picture.png) left top no-repeat; }
93
- .wpio_jaofoldertree li.ext_tiff { background: url(images/picture.png) left top no-repeat; }
94
- .wpio_jaofoldertree li.ext_txt { background: url(images/txt.png) left top no-repeat; }
95
- .wpio_jaofoldertree li.ext_vb { background: url(images/code.png) left top no-repeat; }
96
- .wpio_jaofoldertree li.ext_wav { background: url(images/music.png) left top no-repeat; }
97
- .wpio_jaofoldertree li.ext_wmv { background: url(images/film.png) left top no-repeat; }
98
- .wpio_jaofoldertree li.ext_xls { background: url(images/xls.png) left top no-repeat; }
99
- .wpio_jaofoldertree li.ext_xml { background: url(images/code.png) left top no-repeat; }
100
- .wpio_jaofoldertree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
101
-
102
- .wpio_jaofoldertree input[type="checkbox"] {
103
- width: 0.65rem;
104
- height: 0.65rem;
105
- min-width: 0.65rem;
106
- margin: 4px 4px 0 0 ;
107
- }
108
- .wpio_jaofoldertree input[type=checkbox]:checked:before {
109
- content: none
110
- }
111
-
112
- .wpio_jaofoldertree li.wpio_directory {
113
- position: relative;
114
- }
115
- .wpio_jaofoldertree li.wpio_directory input[type="checkbox"] {
116
- position: absolute;
117
- }
118
- .wpio_jaofoldertree li.wpio_directory span.check {
119
- width: 0.8rem;
120
- height: 0.8rem;
121
- background-color: #FFF;
122
- border: 1px solid #999;
123
- padding: 0px;
124
- position: relative;
125
- display: inline-block;
126
- vertical-align: middle;
127
- }
128
- .wpio_jaofoldertree li.wpio_directory span.check.pchecked {
129
- display: inline-block;
130
- }
131
- .wpio_jaofoldertree span.check.pchecked::after {
132
- position: absolute;
133
- display: block;
134
- content: "";
135
- background-color: #1D1D1D;
136
- height: 0.375rem;
137
- width: 0.375rem;
138
- left: 50%;
139
- top: 50%;
140
- margin-left: -0.1875rem;
141
- margin-top: -0.1875rem;
142
- }
143
- .wpio_jaofoldertree span.check.checked::before {
144
- position: absolute;
145
- vertical-align: middle;
146
- color: transparent;
147
- font-size: 0px;
148
- content: "";
149
- height: 0.3125rem;
150
- width: 0.565rem;
151
- background-color: transparent;
152
- border-left: 0.1875rem solid transparent;
153
- border-bottom: 0.1875rem solid transparent;
154
- border-color: transparent;
155
- left: 50%;
156
- top: 50%;
157
- margin-left: -0.325rem;
158
- margin-top: -0.365rem;
159
- display: block;
160
- transform: rotate(-45deg);
161
- transition: all 0.2s linear 0s;
162
- width: 6px;
163
- height: 3px;
164
- margin-left: -4px;
165
- margin-top: -4px;
166
- border-width: 2px;
167
- border-color: #555;
168
  }
1
+ #wpio_foldertree {
2
+ padding: 10px;
3
+ }
4
+
5
+ ul.wpio_jaofoldertree {
6
+ font-family: Verdana, sans-serif;
7
+ font-size: 11px;
8
+ line-height: 18px;
9
+ padding: 0;
10
+ margin: 0 !important;
11
+ }
12
+
13
+ ul.wpio_jaofoldertree li {
14
+ list-style: none;
15
+ padding: 0px;
16
+ padding-left: 20px;
17
+ margin: 0px;
18
+ white-space: nowrap;
19
+ }
20
+
21
+ ul.wpio_jaofoldertree a {
22
+ color: #333;
23
+ text-decoration: none;
24
+ display: inline-block;
25
+ padding: 0px 2px;
26
+ }
27
+
28
+ ul.wpio_jaofoldertree a:hover {
29
+ font-weight: bold;
30
+ }
31
+
32
+ ul.wpio_jaofoldertree li.selected > a {
33
+ font-weight: bold;
34
+ }
35
+
36
+ /* Core Styles */
37
+ .wpio_jaofoldertree li.wpio_directory { background: url(images/directory.png) left top no-repeat; }
38
+ .wpio_jaofoldertree li.expanded { background: url(images/folder_open.png) left top no-repeat; }
39
+ .wpio_jaofoldertree li.drive { background: url(images/drive.png) left top no-repeat; }
40
+ .wpio_jaofoldertree li.file { background: url(images/file.png) left top no-repeat; }
41
+ .wpio_jaofoldertree li.wait { background: url(images/spinner.gif) left top no-repeat; }
42
+ /* File Extensions*/
43
+ .wpio_jaofoldertree li.ext_3gp { background: url(images/film.png) left top no-repeat; }
44
+ .wpio_jaofoldertree li.ext_afp { background: url(images/code.png) left top no-repeat; }
45
+ .wpio_jaofoldertree li.ext_afpa { background: url(images/code.png) left top no-repeat; }
46
+ .wpio_jaofoldertree li.ext_asp { background: url(images/code.png) left top no-repeat; }
47
+ .wpio_jaofoldertree li.ext_aspx { background: url(images/code.png) left top no-repeat; }
48
+ .wpio_jaofoldertree li.ext_avi { background: url(images/film.png) left top no-repeat; }
49
+ .wpio_jaofoldertree li.ext_bat { background: url(images/application.png) left top no-repeat; }
50
+ .wpio_jaofoldertree li.ext_bmp { background: url(images/picture.png) left top no-repeat; }
51
+ .wpio_jaofoldertree li.ext_c { background: url(images/code.png) left top no-repeat; }
52
+ .wpio_jaofoldertree li.ext_cfm { background: url(images/code.png) left top no-repeat; }
53
+ .wpio_jaofoldertree li.ext_cgi { background: url(images/code.png) left top no-repeat; }
54
+ .wpio_jaofoldertree li.ext_com { background: url(images/application.png) left top no-repeat; }
55
+ .wpio_jaofoldertree li.ext_cpp { background: url(images/code.png) left top no-repeat; }
56
+ .wpio_jaofoldertree li.ext_css { background: url(images/css.png) left top no-repeat; }
57
+ .wpio_jaofoldertree li.ext_doc { background: url(images/doc.png) left top no-repeat; }
58
+ .wpio_jaofoldertree li.ext_exe { background: url(images/application.png) left top no-repeat; }
59
+ .wpio_jaofoldertree li.ext_gif { background: url(images/picture.png) left top no-repeat; }
60
+ .wpio_jaofoldertree li.ext_fla { background: url(images/flash.png) left top no-repeat; }
61
+ .wpio_jaofoldertree li.ext_h { background: url(images/code.png) left top no-repeat; }
62
+ .wpio_jaofoldertree li.ext_htm { background: url(images/html.png) left top no-repeat; }
63
+ .wpio_jaofoldertree li.ext_html { background: url(images/html.png) left top no-repeat; }
64
+ .wpio_jaofoldertree li.ext_jar { background: url(images/java.png) left top no-repeat; }
65
+ .wpio_jaofoldertree li.ext_jpg { background: url(images/picture.png) left top no-repeat; }
66
+ .wpio_jaofoldertree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
67
+ .wpio_jaofoldertree li.ext_js { background: url(images/script.png) left top no-repeat; }
68
+ .wpio_jaofoldertree li.ext_lasso { background: url(images/code.png) left top no-repeat; }
69
+ .wpio_jaofoldertree li.ext_log { background: url(images/txt.png) left top no-repeat; }
70
+ .wpio_jaofoldertree li.ext_m4p { background: url(images/music.png) left top no-repeat; }
71
+ .wpio_jaofoldertree li.ext_mov { background: url(images/film.png) left top no-repeat; }
72
+ .wpio_jaofoldertree li.ext_mp3 { background: url(images/music.png) left top no-repeat; }
73
+ .wpio_jaofoldertree li.ext_mp4 { background: url(images/film.png) left top no-repeat; }
74
+ .wpio_jaofoldertree li.ext_mpg { background: url(images/film.png) left top no-repeat; }
75
+ .wpio_jaofoldertree li.ext_mpeg { background: url(images/film.png) left top no-repeat; }
76
+ .wpio_jaofoldertree li.ext_ogg { background: url(images/music.png) left top no-repeat; }
77
+ .wpio_jaofoldertree li.ext_pcx { background: url(images/picture.png) left top no-repeat; }
78
+ .wpio_jaofoldertree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
79
+ .wpio_jaofoldertree li.ext_php { background: url(images/php.png) left top no-repeat; }
80
+ .wpio_jaofoldertree li.ext_png { background: url(images/picture.png) left top no-repeat; }
81
+ .wpio_jaofoldertree li.ext_ppt { background: url(images/ppt.png) left top no-repeat; }
82
+ .wpio_jaofoldertree li.ext_psd { background: url(images/psd.png) left top no-repeat; }
83
+ .wpio_jaofoldertree li.ext_pl { background: url(images/script.png) left top no-repeat; }
84
+ .wpio_jaofoldertree li.ext_py { background: url(images/script.png) left top no-repeat; }
85
+ .wpio_jaofoldertree li.ext_rb { background: url(images/ruby.png) left top no-repeat; }
86
+ .wpio_jaofoldertree li.ext_rbx { background: url(images/ruby.png) left top no-repeat; }
87
+ .wpio_jaofoldertree li.ext_rhtml { background: url(images/ruby.png) left top no-repeat; }
88
+ .wpio_jaofoldertree li.ext_rpm { background: url(images/linux.png) left top no-repeat; }
89
+ .wpio_jaofoldertree li.ext_ruby { background: url(images/ruby.png) left top no-repeat; }
90
+ .wpio_jaofoldertree li.ext_sql { background: url(images/db.png) left top no-repeat; }
91
+ .wpio_jaofoldertree li.ext_swf { background: url(images/flash.png) left top no-repeat; }
92
+ .wpio_jaofoldertree li.ext_tif { background: url(images/picture.png) left top no-repeat; }
93
+ .wpio_jaofoldertree li.ext_tiff { background: url(images/picture.png) left top no-repeat; }
94
+ .wpio_jaofoldertree li.ext_txt { background: url(images/txt.png) left top no-repeat; }
95
+ .wpio_jaofoldertree li.ext_vb { background: url(images/code.png) left top no-repeat; }
96
+ .wpio_jaofoldertree li.ext_wav { background: url(images/music.png) left top no-repeat; }
97
+ .wpio_jaofoldertree li.ext_wmv { background: url(images/film.png) left top no-repeat; }
98
+ .wpio_jaofoldertree li.ext_xls { background: url(images/xls.png) left top no-repeat; }
99
+ .wpio_jaofoldertree li.ext_xml { background: url(images/code.png) left top no-repeat; }
100
+ .wpio_jaofoldertree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
101
+
102
+ .wpio_jaofoldertree input[type="checkbox"] {
103
+ width: 0.65rem;
104
+ height: 0.65rem;
105
+ min-width: 0.65rem;
106
+ margin: 4px 4px 0 0 ;
107
+ }
108
+ .wpio_jaofoldertree input[type=checkbox]:checked:before {
109
+ content: none
110
+ }
111
+
112
+ .wpio_jaofoldertree li.wpio_directory {
113
+ position: relative;
114
+ }
115
+ .wpio_jaofoldertree li.wpio_directory input[type="checkbox"] {
116
+ position: absolute;
117
+ }
118
+ .wpio_jaofoldertree li.wpio_directory span.check {
119
+ width: 0.8rem;
120
+ height: 0.8rem;
121
+ background-color: #FFF;
122
+ border: 1px solid #999;
123
+ padding: 0px;
124
+ position: relative;
125
+ display: inline-block;
126
+ vertical-align: middle;
127
+ }
128
+ .wpio_jaofoldertree li.wpio_directory span.check.pchecked {
129
+ display: inline-block;
130
+ }
131
+ .wpio_jaofoldertree span.check.pchecked::after {
132
+ position: absolute;
133
+ display: block;
134
+ content: "";
135
+ background-color: #1D1D1D;
136
+ height: 0.375rem;
137
+ width: 0.375rem;
138
+ left: 50%;
139
+ top: 50%;
140
+ margin-left: -0.1875rem;
141
+ margin-top: -0.1875rem;
142
+ }
143
+ .wpio_jaofoldertree span.check.checked::before {
144
+ position: absolute;
145
+ vertical-align: middle;
146
+ color: transparent;
147
+ font-size: 0px;
148
+ content: "";
149
+ height: 0.3125rem;
150
+ width: 0.565rem;
151
+ background-color: transparent;
152
+ border-left: 0.1875rem solid transparent;
153
+ border-bottom: 0.1875rem solid transparent;
154
+ border-color: transparent;
155
+ left: 50%;
156
+ top: 50%;
157
+ margin-left: -0.325rem;
158
+ margin-top: -0.365rem;
159
+ display: block;
160
+ transform: rotate(-45deg);
161
+ transition: all 0.2s linear 0s;
162
+ width: 6px;
163
+ height: 3px;
164
+ margin-left: -4px;
165
+ margin-top: -4px;
166
+ border-width: 2px;
167
+ border-color: #555;
168
  }