Changeset 1726141
- Timestamp:
- 09/07/2017 01:29:34 PM (9 years ago)
- Location:
- improve-pagespeed-today
- Files:
-
- 5 edited
- 13 copied
-
tags/1.1.1 (copied) (copied from improve-pagespeed-today/trunk)
-
tags/1.1.1/LICENSE.txt (copied) (copied from improve-pagespeed-today/trunk/LICENSE.txt)
-
tags/1.1.1/assets (copied) (copied from improve-pagespeed-today/trunk/assets)
-
tags/1.1.1/assets/css/admin.css (copied) (copied from improve-pagespeed-today/trunk/assets/css/admin.css)
-
tags/1.1.1/assets/js/settings.js (copied) (copied from improve-pagespeed-today/trunk/assets/js/settings.js)
-
tags/1.1.1/backups (copied) (copied from improve-pagespeed-today/trunk/backups)
-
tags/1.1.1/improve-pagespeed-today.php (copied) (copied from improve-pagespeed-today/trunk/improve-pagespeed-today.php) (2 diffs)
-
tags/1.1.1/includes (copied) (copied from improve-pagespeed-today/trunk/includes)
-
tags/1.1.1/includes/class-pagespeed-today-settings.php (copied) (copied from improve-pagespeed-today/trunk/includes/class-pagespeed-today-settings.php) (1 diff)
-
tags/1.1.1/includes/class-pagespeed-today.php (modified) (1 diff)
-
tags/1.1.1/index.php (copied) (copied from improve-pagespeed-today/trunk/index.php)
-
tags/1.1.1/lang (copied) (copied from improve-pagespeed-today/trunk/lang)
-
tags/1.1.1/readme.txt (copied) (copied from improve-pagespeed-today/trunk/readme.txt) (2 diffs)
-
tags/1.1.1/tmp (copied) (copied from improve-pagespeed-today/trunk/tmp)
-
trunk/improve-pagespeed-today.php (modified) (2 diffs)
-
trunk/includes/class-pagespeed-today-settings.php (modified) (1 diff)
-
trunk/includes/class-pagespeed-today.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
improve-pagespeed-today/tags/1.1.1/improve-pagespeed-today.php
r1722702 r1726141 2 2 /* 3 3 * Plugin Name: PageSpeed.today 4 * Version: 1.1. 04 * Version: 1.1.1 5 5 * Plugin URI: https://pagespeed.today/ 6 6 * Description: Essential PageSpeed optimization - Image optimization - Minify CSS & JavaScript - PageSpeed.today official WordPress Plugin. … … 132 132 } 133 133 134 /** 135 * Display settings check on plugin settings page 136 */ 137 function admin_notice__settings_check() 138 { 139 $class = 'notice notice-warning'; 140 $message = 'Please enable at least one optimization parameter in "Settings" tab and try again.'; 141 printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class) , $message); 142 } 143 134 144 PageSpeed_today(); -
improve-pagespeed-today/tags/1.1.1/includes/class-pagespeed-today-settings.php
r1722702 r1726141 132 132 */ 133 133 public function process() { 134 if (isset($_POST[$this->parent->_token . '_url']) && !empty($_POST[$this->parent->_token . '_url'])) { 135 $url = urlencode(urlencode(urlencode($_POST[$this->parent->_token . '_url']))); 136 $id = $_POST[$this->parent->_token . '_id']; 137 $response = wp_remote_get('http://api.pagespeed.today/v1/' . $url, array( 138 'timeout' => 120 139 )); 140 if (is_array($response) && !is_wp_error($response) && !empty($response['body'])) { 141 switch ($response['body']) { 142 case 'Done': 143 $filename = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/optimized_contents.zip'; 144 $tmp_folder = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/'; 145 $host = 'http://api.pagespeed.today/tmp/' . md5($url) . '.zip'; 146 $ch = curl_init(); 147 curl_setopt($ch, CURLOPT_URL, $host); 148 curl_setopt($ch, CURLOPT_VERBOSE, 1); 149 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 150 curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 151 curl_setopt($ch, CURLOPT_HEADER, 0); 152 $result = curl_exec($ch); 153 curl_close($ch); 154 if ($result) { 155 $fp = fopen($filename, 'w'); 156 fwrite($fp, $result); 157 fclose($fp); 158 $zip = new Zip(); 159 if ($zip->unzip_file($filename) === true) { 160 $zip->unzip_to($tmp_folder); 161 $manifest = file_get_contents($tmp_folder . 'MANIFEST'); 162 if ($manifest) { 163 $manifest = explode("\n", $manifest); 164 if (sizeof($manifest) > 7) { 165 $backup_dir = $this->make_backup($manifest, $_POST[$this->parent->_token . '_url']); 166 $data = get_option($this->parent->_token . '_data'); 167 $data['backups'][] = ['id' => $_POST[$this->parent->_token . '_id'], 'post_title' => $_POST[$this->parent->_token . '_post_title'], 'url' => $_POST[$this->parent->_token . '_url'], 'date' => date('Y-m-d H:i:s') , 'path' => $backup_dir, ]; 168 if (!isset($data[$id]['count']) || empty($data[$id]['count'])) { 169 $data[$id]['count'] = 0; 170 } 171 172 if (!isset($data[$id]['size']) || empty($data[$id]['size'])) { 173 $data[$id]['size'] = 0; 174 } 175 176 if (!isset($data['total']['size']) || empty($data['total']['size'])) { 177 $data['total']['size'] = 0; 178 } 179 180 if (!isset($data['total']['files']) || empty($data['total']['files'])) { 181 $data['total']['files'] = 0; 182 } 183 184 foreach($manifest as $key => $value) { 185 if ($key > 7) { 186 $value = explode(': ', $value); 187 if (isset($value[1]) && !empty($value[1])) { 188 $folder = explode('/', $value[0]); 189 $value[1] = parse_url($value[1]); 190 if ($value[1]['host'] == $_SERVER['HTTP_HOST']) { 191 if (get_option($this->parent->_token . '_' . $folder[0]) && file_exists(ABSPATH . $value[1]['path']) && $value[1]['path'] != '/') { 192 $data[$id]['count']++; 193 $data['total']['files']++; 194 $data[$id]['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 195 $data['total']['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 196 @unlink(ABSPATH . $value[1]['path']); 197 @copy($tmp_folder . $value[0], ABSPATH . $value[1]['path']); 134 if (get_option($this->parent->_token . '_image') || get_option($this->parent->_token . '_css') || get_option($this->parent->_token . '_js')) { 135 if (isset($_POST[$this->parent->_token . '_url']) && !empty($_POST[$this->parent->_token . '_url'])) { 136 $url = urlencode(urlencode(urlencode($_POST[$this->parent->_token . '_url']))); 137 $id = $_POST[$this->parent->_token . '_id']; 138 $response = wp_remote_get('http://api.pagespeed.today/v1/' . $url, array( 139 'timeout' => 120 140 )); 141 if (is_array($response) && !is_wp_error($response) && !empty($response['body'])) { 142 switch ($response['body']) { 143 case 'Done': 144 $filename = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/optimized_contents.zip'; 145 $tmp_folder = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/'; 146 $host = 'http://api.pagespeed.today/tmp/' . md5($url) . '.zip'; 147 $ch = curl_init(); 148 curl_setopt($ch, CURLOPT_URL, $host); 149 curl_setopt($ch, CURLOPT_VERBOSE, 1); 150 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 151 curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 152 curl_setopt($ch, CURLOPT_HEADER, 0); 153 $result = curl_exec($ch); 154 curl_close($ch); 155 if ($result) { 156 $fp = fopen($filename, 'w'); 157 fwrite($fp, $result); 158 fclose($fp); 159 $zip = new Zip(); 160 if ($zip->unzip_file($filename) === true) { 161 $zip->unzip_to($tmp_folder); 162 $manifest = file_get_contents($tmp_folder . 'MANIFEST'); 163 if ($manifest) { 164 $manifest = explode("\n", $manifest); 165 if (sizeof($manifest) > 7) { 166 $backup_dir = $this->make_backup($manifest, $_POST[$this->parent->_token . '_url']); 167 $data = get_option($this->parent->_token . '_data'); 168 $data['backups'][] = ['id' => $_POST[$this->parent->_token . '_id'], 'post_title' => $_POST[$this->parent->_token . '_post_title'], 'url' => $_POST[$this->parent->_token . '_url'], 'date' => date('Y-m-d H:i:s') , 'path' => $backup_dir, ]; 169 if (!isset($data[$id]['count']) || empty($data[$id]['count'])) { 170 $data[$id]['count'] = 0; 171 } 172 173 if (!isset($data[$id]['size']) || empty($data[$id]['size'])) { 174 $data[$id]['size'] = 0; 175 } 176 177 if (!isset($data['total']['size']) || empty($data['total']['size'])) { 178 $data['total']['size'] = 0; 179 } 180 181 if (!isset($data['total']['files']) || empty($data['total']['files'])) { 182 $data['total']['files'] = 0; 183 } 184 185 foreach($manifest as $key => $value) { 186 if ($key > 7) { 187 $value = explode(': ', $value); 188 if (isset($value[1]) && !empty($value[1])) { 189 $folder = explode('/', $value[0]); 190 $value[1] = parse_url($value[1]); 191 if ($value[1]['host'] == $_SERVER['HTTP_HOST']) { 192 if (get_option($this->parent->_token . '_' . $folder[0]) && file_exists(ABSPATH . $value[1]['path']) && $value[1]['path'] != '/') { 193 $data[$id]['count']++; 194 $data['total']['files']++; 195 $data[$id]['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 196 $data['total']['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 197 @unlink(ABSPATH . $value[1]['path']); 198 @copy($tmp_folder . $value[0], ABSPATH . $value[1]['path']); 199 } 198 200 } 199 201 } 200 202 } 201 203 } 204 205 update_option($this->parent->_token . '_data', $data); 202 206 } 203 204 update_option($this->parent->_token . '_data', $data);205 207 } 208 209 add_action('admin_notices', 'admin_notice__success'); 210 } else { 211 add_action('admin_notices', 'admin_notice__error'); 206 212 } 207 208 add_action('admin_notices', 'admin_notice__success');213 214 $this->rrmdir($tmp_folder); 209 215 } else { 210 add_action('admin_notices', 'admin_notice__e rror');216 add_action('admin_notices', 'admin_notice__empty'); 211 217 } 212 213 $this->rrmdir($tmp_folder); 214 } else { 215 add_action('admin_notices', 'admin_notice__empty'); 216 } 217 break; 218 case 'Delay': 219 add_action('admin_notices', 'admin_notice__delay'); 220 break; 221 case 'Limit': 222 add_action('admin_notices', 'admin_notice__limit'); 223 break; 224 } 225 226 } else { 227 add_action('admin_notices', 'admin_notice__empty'); 228 } 218 break; 219 case 'Delay': 220 add_action('admin_notices', 'admin_notice__delay'); 221 break; 222 case 'Limit': 223 add_action('admin_notices', 'admin_notice__limit'); 224 break; 225 } 226 227 } else { 228 add_action('admin_notices', 'admin_notice__empty'); 229 } 230 } 231 } else { 232 add_action('admin_notices', 'admin_notice__settings_check'); 229 233 } 230 234 } -
improve-pagespeed-today/tags/1.1.1/includes/class-pagespeed-today.php
r1719593 r1726141 74 74 * @return void 75 75 */ 76 public function __construct($file = '', $version = '1. 0.0') {76 public function __construct($file = '', $version = '1.1.1') { 77 77 $this->_version = $version; 78 78 $this->_token = 'pagespeed_today'; -
improve-pagespeed-today/tags/1.1.1/readme.txt
r1722702 r1726141 4 4 License: GPLv3 5 5 License URI: http://www.gnu.org/licenses/gpl.html 6 Tags: SEO, Speed, PageSpeed, Optimization, Minification, Image Optimization6 Tags: SEO, page, speed, optimization, minification, image, compression, browser caching 7 7 Requires at least: 4.6 8 Stable tag: 1.1. 08 Stable tag: 1.1.1 9 9 Tested up to: 4.8.1 10 10 Requires PHP: 5.4 + … … 59 59 == Changelog == 60 60 61 = 1.1.1 = 62 63 Release Date: September 7, 2017 64 65 * Added a warning that pops up when the user hasn't enabled any optimization options in the settings tab. 66 61 67 = 1.1.0 = 62 68 -
improve-pagespeed-today/trunk/improve-pagespeed-today.php
r1722702 r1726141 2 2 /* 3 3 * Plugin Name: PageSpeed.today 4 * Version: 1.1. 04 * Version: 1.1.1 5 5 * Plugin URI: https://pagespeed.today/ 6 6 * Description: Essential PageSpeed optimization - Image optimization - Minify CSS & JavaScript - PageSpeed.today official WordPress Plugin. … … 132 132 } 133 133 134 /** 135 * Display settings check on plugin settings page 136 */ 137 function admin_notice__settings_check() 138 { 139 $class = 'notice notice-warning'; 140 $message = 'Please enable at least one optimization parameter in "Settings" tab and try again.'; 141 printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class) , $message); 142 } 143 134 144 PageSpeed_today(); -
improve-pagespeed-today/trunk/includes/class-pagespeed-today-settings.php
r1722702 r1726141 132 132 */ 133 133 public function process() { 134 if (isset($_POST[$this->parent->_token . '_url']) && !empty($_POST[$this->parent->_token . '_url'])) { 135 $url = urlencode(urlencode(urlencode($_POST[$this->parent->_token . '_url']))); 136 $id = $_POST[$this->parent->_token . '_id']; 137 $response = wp_remote_get('http://api.pagespeed.today/v1/' . $url, array( 138 'timeout' => 120 139 )); 140 if (is_array($response) && !is_wp_error($response) && !empty($response['body'])) { 141 switch ($response['body']) { 142 case 'Done': 143 $filename = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/optimized_contents.zip'; 144 $tmp_folder = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/'; 145 $host = 'http://api.pagespeed.today/tmp/' . md5($url) . '.zip'; 146 $ch = curl_init(); 147 curl_setopt($ch, CURLOPT_URL, $host); 148 curl_setopt($ch, CURLOPT_VERBOSE, 1); 149 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 150 curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 151 curl_setopt($ch, CURLOPT_HEADER, 0); 152 $result = curl_exec($ch); 153 curl_close($ch); 154 if ($result) { 155 $fp = fopen($filename, 'w'); 156 fwrite($fp, $result); 157 fclose($fp); 158 $zip = new Zip(); 159 if ($zip->unzip_file($filename) === true) { 160 $zip->unzip_to($tmp_folder); 161 $manifest = file_get_contents($tmp_folder . 'MANIFEST'); 162 if ($manifest) { 163 $manifest = explode("\n", $manifest); 164 if (sizeof($manifest) > 7) { 165 $backup_dir = $this->make_backup($manifest, $_POST[$this->parent->_token . '_url']); 166 $data = get_option($this->parent->_token . '_data'); 167 $data['backups'][] = ['id' => $_POST[$this->parent->_token . '_id'], 'post_title' => $_POST[$this->parent->_token . '_post_title'], 'url' => $_POST[$this->parent->_token . '_url'], 'date' => date('Y-m-d H:i:s') , 'path' => $backup_dir, ]; 168 if (!isset($data[$id]['count']) || empty($data[$id]['count'])) { 169 $data[$id]['count'] = 0; 170 } 171 172 if (!isset($data[$id]['size']) || empty($data[$id]['size'])) { 173 $data[$id]['size'] = 0; 174 } 175 176 if (!isset($data['total']['size']) || empty($data['total']['size'])) { 177 $data['total']['size'] = 0; 178 } 179 180 if (!isset($data['total']['files']) || empty($data['total']['files'])) { 181 $data['total']['files'] = 0; 182 } 183 184 foreach($manifest as $key => $value) { 185 if ($key > 7) { 186 $value = explode(': ', $value); 187 if (isset($value[1]) && !empty($value[1])) { 188 $folder = explode('/', $value[0]); 189 $value[1] = parse_url($value[1]); 190 if ($value[1]['host'] == $_SERVER['HTTP_HOST']) { 191 if (get_option($this->parent->_token . '_' . $folder[0]) && file_exists(ABSPATH . $value[1]['path']) && $value[1]['path'] != '/') { 192 $data[$id]['count']++; 193 $data['total']['files']++; 194 $data[$id]['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 195 $data['total']['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 196 @unlink(ABSPATH . $value[1]['path']); 197 @copy($tmp_folder . $value[0], ABSPATH . $value[1]['path']); 134 if (get_option($this->parent->_token . '_image') || get_option($this->parent->_token . '_css') || get_option($this->parent->_token . '_js')) { 135 if (isset($_POST[$this->parent->_token . '_url']) && !empty($_POST[$this->parent->_token . '_url'])) { 136 $url = urlencode(urlencode(urlencode($_POST[$this->parent->_token . '_url']))); 137 $id = $_POST[$this->parent->_token . '_id']; 138 $response = wp_remote_get('http://api.pagespeed.today/v1/' . $url, array( 139 'timeout' => 120 140 )); 141 if (is_array($response) && !is_wp_error($response) && !empty($response['body'])) { 142 switch ($response['body']) { 143 case 'Done': 144 $filename = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/optimized_contents.zip'; 145 $tmp_folder = PAGESPEED_TODAY_PLUGIN_DIR . 'tmp/'; 146 $host = 'http://api.pagespeed.today/tmp/' . md5($url) . '.zip'; 147 $ch = curl_init(); 148 curl_setopt($ch, CURLOPT_URL, $host); 149 curl_setopt($ch, CURLOPT_VERBOSE, 1); 150 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 151 curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 152 curl_setopt($ch, CURLOPT_HEADER, 0); 153 $result = curl_exec($ch); 154 curl_close($ch); 155 if ($result) { 156 $fp = fopen($filename, 'w'); 157 fwrite($fp, $result); 158 fclose($fp); 159 $zip = new Zip(); 160 if ($zip->unzip_file($filename) === true) { 161 $zip->unzip_to($tmp_folder); 162 $manifest = file_get_contents($tmp_folder . 'MANIFEST'); 163 if ($manifest) { 164 $manifest = explode("\n", $manifest); 165 if (sizeof($manifest) > 7) { 166 $backup_dir = $this->make_backup($manifest, $_POST[$this->parent->_token . '_url']); 167 $data = get_option($this->parent->_token . '_data'); 168 $data['backups'][] = ['id' => $_POST[$this->parent->_token . '_id'], 'post_title' => $_POST[$this->parent->_token . '_post_title'], 'url' => $_POST[$this->parent->_token . '_url'], 'date' => date('Y-m-d H:i:s') , 'path' => $backup_dir, ]; 169 if (!isset($data[$id]['count']) || empty($data[$id]['count'])) { 170 $data[$id]['count'] = 0; 171 } 172 173 if (!isset($data[$id]['size']) || empty($data[$id]['size'])) { 174 $data[$id]['size'] = 0; 175 } 176 177 if (!isset($data['total']['size']) || empty($data['total']['size'])) { 178 $data['total']['size'] = 0; 179 } 180 181 if (!isset($data['total']['files']) || empty($data['total']['files'])) { 182 $data['total']['files'] = 0; 183 } 184 185 foreach($manifest as $key => $value) { 186 if ($key > 7) { 187 $value = explode(': ', $value); 188 if (isset($value[1]) && !empty($value[1])) { 189 $folder = explode('/', $value[0]); 190 $value[1] = parse_url($value[1]); 191 if ($value[1]['host'] == $_SERVER['HTTP_HOST']) { 192 if (get_option($this->parent->_token . '_' . $folder[0]) && file_exists(ABSPATH . $value[1]['path']) && $value[1]['path'] != '/') { 193 $data[$id]['count']++; 194 $data['total']['files']++; 195 $data[$id]['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 196 $data['total']['size'] += (filesize(ABSPATH . $value[1]['path']) - filesize($tmp_folder . $value[0])); 197 @unlink(ABSPATH . $value[1]['path']); 198 @copy($tmp_folder . $value[0], ABSPATH . $value[1]['path']); 199 } 198 200 } 199 201 } 200 202 } 201 203 } 204 205 update_option($this->parent->_token . '_data', $data); 202 206 } 203 204 update_option($this->parent->_token . '_data', $data);205 207 } 208 209 add_action('admin_notices', 'admin_notice__success'); 210 } else { 211 add_action('admin_notices', 'admin_notice__error'); 206 212 } 207 208 add_action('admin_notices', 'admin_notice__success');213 214 $this->rrmdir($tmp_folder); 209 215 } else { 210 add_action('admin_notices', 'admin_notice__e rror');216 add_action('admin_notices', 'admin_notice__empty'); 211 217 } 212 213 $this->rrmdir($tmp_folder); 214 } else { 215 add_action('admin_notices', 'admin_notice__empty'); 216 } 217 break; 218 case 'Delay': 219 add_action('admin_notices', 'admin_notice__delay'); 220 break; 221 case 'Limit': 222 add_action('admin_notices', 'admin_notice__limit'); 223 break; 224 } 225 226 } else { 227 add_action('admin_notices', 'admin_notice__empty'); 228 } 218 break; 219 case 'Delay': 220 add_action('admin_notices', 'admin_notice__delay'); 221 break; 222 case 'Limit': 223 add_action('admin_notices', 'admin_notice__limit'); 224 break; 225 } 226 227 } else { 228 add_action('admin_notices', 'admin_notice__empty'); 229 } 230 } 231 } else { 232 add_action('admin_notices', 'admin_notice__settings_check'); 229 233 } 230 234 } -
improve-pagespeed-today/trunk/includes/class-pagespeed-today.php
r1719593 r1726141 74 74 * @return void 75 75 */ 76 public function __construct($file = '', $version = '1. 0.0') {76 public function __construct($file = '', $version = '1.1.1') { 77 77 $this->_version = $version; 78 78 $this->_token = 'pagespeed_today'; -
improve-pagespeed-today/trunk/readme.txt
r1722702 r1726141 4 4 License: GPLv3 5 5 License URI: http://www.gnu.org/licenses/gpl.html 6 Tags: SEO, Speed, PageSpeed, Optimization, Minification, Image Optimization6 Tags: SEO, page, speed, optimization, minification, image, compression, browser caching 7 7 Requires at least: 4.6 8 Stable tag: 1.1. 08 Stable tag: 1.1.1 9 9 Tested up to: 4.8.1 10 10 Requires PHP: 5.4 + … … 59 59 == Changelog == 60 60 61 = 1.1.1 = 62 63 Release Date: September 7, 2017 64 65 * Added a warning that pops up when the user hasn't enabled any optimization options in the settings tab. 66 61 67 = 1.1.0 = 62 68
Note: See TracChangeset
for help on using the changeset viewer.