WP Super Minify - Version 1.5.1

Version Description

Download this release

Release Info

Developer dipakcg
Plugin Icon 128x128 WP Super Minify
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5 to 1.5.1

includes/min/lib/Minify/CSSmin.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Minify_CSSmin
4
+ * @package Minify
5
+ */
6
+
7
+ /**
8
+ * Wrapper for CSSmin
9
+ *
10
+ * This class uses CSSmin and Minify_CSS_UriRewriter to minify CSS and rewrite relative URIs.
11
+ *
12
+ * @package Minify
13
+ * @author Stephen Clay <steve@mrclay.org>
14
+ */
15
+ class Minify_CSSmin {
16
+
17
+ /**
18
+ * Minify a CSS string
19
+ *
20
+ * @param string $css
21
+ *
22
+ * @param array $options available options:
23
+ *
24
+ * 'removeCharsets': (default true) remove all @charset at-rules
25
+ *
26
+ * 'prependRelativePath': (default null) if given, this string will be
27
+ * prepended to all relative URIs in import/url declarations
28
+ *
29
+ * 'currentDir': (default null) if given, this is assumed to be the
30
+ * directory of the current CSS file. Using this, minify will rewrite
31
+ * all relative URIs in import/url declarations to correctly point to
32
+ * the desired files. For this to work, the files *must* exist and be
33
+ * visible by the PHP process.
34
+ *
35
+ * 'symlinks': (default = array()) If the CSS file is stored in
36
+ * a symlink-ed directory, provide an array of link paths to
37
+ * target paths, where the link paths are within the document root. Because
38
+ * paths need to be normalized for this to work, use "//" to substitute
39
+ * the doc root in the link paths (the array keys). E.g.:
40
+ * <code>
41
+ * array('//symlink' => '/real/target/path') // unix
42
+ * array('//static' => 'D:\\staticStorage') // Windows
43
+ * </code>
44
+ *
45
+ * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
46
+ * see Minify_CSS_UriRewriter::rewrite
47
+ *
48
+ * @return string
49
+ */
50
+ public static function minify($css, $options = array())
51
+ {
52
+ $options = array_merge(array(
53
+ 'compress' => true,
54
+ 'removeCharsets' => true,
55
+ 'currentDir' => null,
56
+ 'docRoot' => $_SERVER['DOCUMENT_ROOT'],
57
+ 'prependRelativePath' => null,
58
+ 'symlinks' => array(),
59
+ ), $options);
60
+
61
+ if ($options['removeCharsets']) {
62
+ $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
63
+ }
64
+ if ($options['compress']) {
65
+ $obj = new CSSmin();
66
+ $css = $obj->run($css);
67
+ }
68
+ if (! $options['currentDir'] && ! $options['prependRelativePath']) {
69
+ return $css;
70
+ }
71
+ if ($options['currentDir']) {
72
+ return Minify_CSS_UriRewriter::rewrite(
73
+ $css
74
+ ,$options['currentDir']
75
+ ,$options['docRoot']
76
+ ,$options['symlinks']
77
+ );
78
+ } else {
79
+ return Minify_CSS_UriRewriter::prepend(
80
+ $css
81
+ ,$options['prependRelativePath']
82
+ );
83
+ }
84
+ }
85
+ }
includes/min/lib/Minify/Cache/WinCache.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Minify_Cache_Wincache
4
+ * @package Minify
5
+ */
6
+
7
+ /**
8
+ * WinCache-based cache class for Minify
9
+ *
10
+ * <code>
11
+ * Minify::setCache(new Minify_Cache_WinCache());
12
+ * </code>
13
+ *
14
+ * @package Minify
15
+ * @author Matthias Fax
16
+ **/
17
+ class Minify_Cache_WinCache
18
+ {
19
+
20
+ /**
21
+ * Create a Minify_Cache_Wincache object, to be passed to
22
+ * Minify::setCache().
23
+ *
24
+ *
25
+ * @param int $expire seconds until expiration (default = 0
26
+ * meaning the item will not get an expiration date)
27
+ */
28
+ public function __construct($expire = 0)
29
+ {
30
+ if (!function_exists('wincache_ucache_info')) {
31
+ throw new Exception("WinCache for PHP is not installed to be able to use Minify_Cache_WinCache!");
32
+ }
33
+ $this->_exp = $expire;
34
+ }
35
+
36
+ /**
37
+ * Write data to cache.
38
+ *
39
+ * @param string $id cache id
40
+ *
41
+ * @param string $data
42
+ *
43
+ * @return bool success
44
+ */
45
+ public function store($id, $data)
46
+ {
47
+ return wincache_ucache_set($id, "{$_SERVER['REQUEST_TIME']}|{$data}", $this->_exp);
48
+ }
49
+
50
+ /**
51
+ * Get the size of a cache entry
52
+ *
53
+ * @param string $id cache id
54
+ *
55
+ * @return int size in bytes
56
+ */
57
+ public function getSize($id)
58
+ {
59
+ if (!$this->_fetch($id)) {
60
+ return false;
61
+ }
62
+ return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload') & 2)) ? mb_strlen($this->_data, '8bit') : strlen($this->_data);
63
+ }
64
+
65
+ /**
66
+ * Does a valid cache entry exist?
67
+ *
68
+ * @param string $id cache id
69
+ *
70
+ * @param int $srcMtime mtime of the original source file(s)
71
+ *
72
+ * @return bool exists
73
+ */
74
+ public function isValid($id, $srcMtime)
75
+ {
76
+ return ($this->_fetch($id) && ($this->_lm >= $srcMtime));
77
+ }
78
+
79
+ /**
80
+ * Send the cached content to output
81
+ *
82
+ * @param string $id cache id
83
+ */
84
+ public function display($id)
85
+ {
86
+ echo $this->_fetch($id) ? $this->_data : '';
87
+ }
88
+
89
+ /**
90
+ * Fetch the cached content
91
+ *
92
+ * @param string $id cache id
93
+ *
94
+ * @return string
95
+ */
96
+ public function fetch($id)
97
+ {
98
+ return $this->_fetch($id) ? $this->_data : '';
99
+ }
100
+
101
+ private $_exp = NULL;
102
+
103
+ // cache of most recently fetched id
104
+ private $_lm = NULL;
105
+ private $_data = NULL;
106
+ private $_id = NULL;
107
+
108
+ /**
109
+ * Fetch data and timestamp from WinCache, store in instance
110
+ *
111
+ * @param string $id
112
+ *
113
+ * @return bool success
114
+ */
115
+ private function _fetch($id)
116
+ {
117
+ if ($this->_id === $id) {
118
+ return true;
119
+ }
120
+ $suc = false;
121
+ $ret = wincache_ucache_get($id, $suc);
122
+ if (!$suc) {
123
+ $this->_id = NULL;
124
+ return false;
125
+ }
126
+ list($this->_lm, $this->_data) = explode('|', $ret, 2);
127
+ $this->_id = $id;
128
+ return true;
129
+ }
130
+ }
includes/min/server-info.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Reports server info useful in configuring the options $min_documentRoot, $min_symlinks,
4
+ * and $min_serveOptions['minApp']['allowDirs'].
5
+ *
6
+ * Change to true to expose this info.
7
+ */
8
+ $enabled = false;
9
+
10
+ ///////////////////////
11
+
12
+ if (!$enabled) {
13
+ die('Set $enabled to true to see server info.');
14
+ }
15
+
16
+ header('Content-Type: text/plain');
17
+
18
+ $file = __FILE__;
19
+ $tmp = sys_get_temp_dir();
20
+
21
+ echo <<<EOD
22
+ __FILE__ : $file
23
+ SCRIPT_FILENAME : {$_SERVER['SCRIPT_FILENAME']}
24
+ DOCUMENT_ROOT : {$_SERVER['DOCUMENT_ROOT']}
25
+ SCRIPT_NAME : {$_SERVER['SCRIPT_NAME']}
26
+ REQUEST_URI : {$_SERVER['REQUEST_URI']}
27
+ Cache directory : $tmp
28
+ EOD;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dipakcg
3
  Tags: minify, compress, combine, html, css, javascript, js, performance, load, speed, time, yslow, pagespeed
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
5
  Requires at least: 3.5
6
- Tested up to: 4.7
7
- Stable tag: 1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -45,6 +45,9 @@ Pretty much, yeah.
45
  1. Admin Settings
46
 
47
  == Changelog ==
 
 
 
48
  = 1.5, December 30, 2016 =
49
  * Updated min library to it's latest version
50
 
3
  Tags: minify, compress, combine, html, css, javascript, js, performance, load, speed, time, yslow, pagespeed
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
5
  Requires at least: 3.5
6
+ Tested up to: 4.9
7
+ Stable tag: 1.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
45
  1. Admin Settings
46
 
47
  == Changelog ==
48
+ = 1.5.1, March 21, 2017 =
49
+ * Improved Promos, News and Updates, and recommendations area.
50
+
51
  = 1.5, December 30, 2016 =
52
  * Updated min library to it's latest version
53
 
wp-super-minify.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Super Minify
4
  Plugin URI: https://github.com/dipakcg/wp-super-minify
5
  Description: Minifies, caches and combine inline JavaScript and CSS files to improve page load time.
6
- Version: 1.5
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  */
@@ -13,7 +13,7 @@ if (!defined('WPSMY_PLUGIN_VERSION')) {
13
  define('WPSMY_PLUGIN_VERSION', 'wpsmy_plugin_version');
14
  }
15
  if (!defined('WPSMY_PLUGIN_VERSION_NUM')) {
16
- define('WPSMY_PLUGIN_VERSION_NUM', '1.5');
17
  }
18
  update_option(WPSMY_PLUGIN_VERSION, WPSMY_PLUGIN_VERSION_NUM);
19
 
@@ -131,7 +131,7 @@ function wpsmy_admin_options() {
131
  <hr style="margin: 2em 0 1.5em 0;" />
132
  <?php
133
  // Promo - Ad contents
134
- $promo_content = wp_remote_fopen("https://cdn.rawgit.com/dipakcg/wp-performance-score-booster/master/promos.html");
135
  echo $promo_content;
136
  ?>
137
  <?php // Bottom - News and Referrals part ?>
@@ -142,31 +142,20 @@ function wpsmy_admin_options() {
142
  <hr />
143
  <div class="wpsmy_rss-widget">
144
  <?php
145
- /* wp_widget_rss_output(array(
146
- 'url' => 'https://dipakgajjar.com/category/news/feed/?refresh='.rand(10,100).'', // feed URL
147
- 'title' => 'News & Updates from Dipak C. Gajjar',
148
- 'items' => 3, // nubmer of posts to display
149
- 'show_summary' => 1,
150
- 'show_author' => 0,
151
- 'show_date' => 0
152
- )); */
153
- /* Load the news content from Github */
154
- $news_content = wp_remote_fopen("https://cdn.rawgit.com/dipakcg/wp-performance-score-booster/master/news-and-updates.html");
155
  echo $news_content;
156
  ?>
157
  </div> </td>
158
  <!-- Referrals -->
159
  <td width="1%"> &nbsp </td>
160
- <td width="50%" valign="top">
161
- <div class="wpsmy_referrals">
162
- Scalable and affordable SSD VPS at DigitalOcean starting from $5 per month. <br /> <br />
163
- <a href="https://www.digitalocean.com" target="_blank" onClick="this.href='https://m.do.co/c/f90a24a27dcc'" ><img src="https://dl.dropboxusercontent.com/u/21966579/do-ssd-virtual-servers-250x250.jpg" alt="Digital Ocean SSD VPS" width="250" height="250" border="0"></a>
164
- </div>
165
- <div class="wpsmy_referrals">
166
- Great managed WordPress hosting at SiteGround starting from $3.95 per month. <br /> <br />
167
- <a href="http://www.siteground.com" target="_blank" onClick="this.href='https://www.siteground.com/wordpress-hosting.htm?afbannercode=783dd6fb6802e26ada6cf20768622fda'" ><img src="https://ua.siteground.com/img/banners/general/best-pack/250x250.gif" alt="WordPress Hosting" width="250" height="250" border="0"></a>
168
- </div>
169
- <?php echo '</td> </tr> </table>'; ?>
170
  <?php
171
  }
172
 
3
  Plugin Name: WP Super Minify
4
  Plugin URI: https://github.com/dipakcg/wp-super-minify
5
  Description: Minifies, caches and combine inline JavaScript and CSS files to improve page load time.
6
+ Version: 1.5.1
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  */
13
  define('WPSMY_PLUGIN_VERSION', 'wpsmy_plugin_version');
14
  }
15
  if (!defined('WPSMY_PLUGIN_VERSION_NUM')) {
16
+ define('WPSMY_PLUGIN_VERSION_NUM', '1.5.1');
17
  }
18
  update_option(WPSMY_PLUGIN_VERSION, WPSMY_PLUGIN_VERSION_NUM);
19
 
131
  <hr style="margin: 2em 0 1.5em 0;" />
132
  <?php
133
  // Promo - Ad contents
134
+ $promo_content = wp_remote_fopen("https://dipakgajjar.com/public/promos.html");
135
  echo $promo_content;
136
  ?>
137
  <?php // Bottom - News and Referrals part ?>
142
  <hr />
143
  <div class="wpsmy_rss-widget">
144
  <?php
145
+ /* Load the news content */
146
+ $news_content = wp_remote_fopen("https://dipakgajjar.com/public/news-and-updates.html");
 
 
 
 
 
 
 
 
147
  echo $news_content;
148
  ?>
149
  </div> </td>
150
  <!-- Referrals -->
151
  <td width="1%"> &nbsp </td>
152
+ <td width="51%" valign="top">
153
+ <?php
154
+ /* Load the referrals content from Github url */
155
+ $referrals_content = wp_remote_fopen("https://dipakgajjar.com/public/recommendations.html");
156
+ echo $referrals_content;
157
+ ?>
158
+ </td> </tr> </table>
 
 
 
159
  <?php
160
  }
161