Comet Cache - Version 160521

Version Description

= v160416 =

Requires WordPress v4.2+.

Download this release

Release Info

Developer raamdev
Plugin Icon 128x128 Comet Cache
Version 160521
Comparing to
See all releases

Code changes from version 160417 to 160521

Files changed (46) hide show
  1. CHANGELOG.md +12 -0
  2. comet-cache.php +1 -1
  3. readme.txt +11 -3
  4. src/.htaccess +15 -0
  5. src/includes/classes/AbsBase.php +3 -1
  6. src/includes/classes/AbsBaseAp.php +1 -2
  7. src/includes/classes/FeedUtils.php +1 -3
  8. src/includes/classes/MenuPageOptions.php +9 -0
  9. src/includes/classes/Plugin.php +7 -1
  10. src/includes/classes/VsUpgrades.php +19 -0
  11. src/includes/stub.php +1 -1
  12. src/includes/traits/Plugin/WcpOpcacheUtils.php +12 -0
  13. src/includes/traits/Plugin/WcpPluginUtils.php +5 -0
  14. src/includes/traits/Plugin/WcpUpdaterUtils.php +4 -1
  15. src/vendor/autoload.php +1 -1
  16. src/vendor/composer/autoload_real.php +3 -3
  17. src/vendor/composer/installed.json +6 -6
  18. src/vendor/websharks/css-minifier/CHANGELOG.md +0 -3
  19. src/vendor/websharks/css-minifier/LICENSE.txt +0 -674
  20. src/vendor/websharks/css-minifier/README.md +0 -40
  21. src/vendor/websharks/css-minifier/src/includes/classes/Core.php +0 -143
  22. src/vendor/websharks/css-minifier/src/includes/stub.php +0 -9
  23. src/vendor/websharks/html-compressor/CHANGELOG.md +0 -12
  24. src/vendor/websharks/html-compressor/LICENSE.txt +0 -674
  25. src/vendor/websharks/html-compressor/README.md +0 -365
  26. src/vendor/websharks/html-compressor/src/includes/classes/Benchmark.php +0 -119
  27. src/vendor/websharks/html-compressor/src/includes/classes/Core.php +0 -3937
  28. src/vendor/websharks/html-compressor/src/includes/classes/HookApi.php +0 -337
  29. src/vendor/websharks/html-compressor/src/includes/stub.php +0 -9
  30. src/vendor/websharks/js-minifier/CHANGELOG.md +0 -3
  31. src/vendor/websharks/js-minifier/LICENSE.txt +0 -674
  32. src/vendor/websharks/js-minifier/README.md +0 -40
  33. src/vendor/websharks/js-minifier/src/includes/classes/Core.php +0 -358
  34. src/vendor/websharks/js-minifier/src/includes/stub.php +0 -9
  35. src/vendor/websharks/sharkicons/src/.htaccess +15 -0
  36. src/vendor/websharks/sharkicons/src/long-classes.min.css +1 -0
  37. src/vendor/websharks/sharkicons/src/short-classes.min.css +1 -0
  38. src/vendor/websharks/wp-php-rv/.htaccess +15 -0
  39. src/vendor/websharks/wp-php-rv/CHANGELOG.md +19 -0
  40. src/vendor/websharks/wp-php-rv/README.md +12 -24
  41. src/vendor/websharks/wp-php-rv/screenshot.png +0 -0
  42. src/vendor/websharks/wp-php-rv/src/includes/check.php +4 -3
  43. src/vendor/websharks/wp-php-rv/src/includes/functions/.load.php +15 -0
  44. src/vendor/websharks/wp-php-rv/src/includes/functions/checks.php +83 -0
  45. src/vendor/websharks/wp-php-rv/src/includes/functions/notices.php +205 -0
  46. src/vendor/websharks/wp-php-rv/src/includes/functions/wp.php +6 -202
CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  = v160416 =
2
 
3
  - **Enhancement**: Several PHP 5.4+ enhancements, most notably a conversion from PHP Closures to PHP Traits. See [Issue #635](https://github.com/websharks/comet-cache/issues/635).
1
+ = v160521 =
2
+
3
+ - **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752).
4
+ - **Bug Fix**: When the PHP OPCache extension is active, the OPCache is now cleared when a WordPress plugin is upgraded, activated, or deactivated. This works around an issue that could produce a fatal error when the PHP OPCache contains cached PHP code that conflicts with new PHP code introduced by an update. See [Issue #740](https://github.com/websharks/comet-cache/issues/740).
5
+ - **Enhancement** (Pro): It's now possible to disable the WordPress Admin Toolbar when Logged-In User Caching is enabled with a new option in _Comet Cache → Plugin Options → Logged-In Users → Disable the Admin Toolbar for Logged-In Users & Comment Authors?_ Props @renzms and @KTS915. See [Issue #690](https://github.com/websharks/comet-cache/issues/690).
6
+ - **Enhancement**: The the option to automatically clear the cache for Custom Term Archive Views (see _Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?_) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See [Issue #693](https://github.com/websharks/comet-cache/issues/693).
7
+ - **Enhancement** (Pro): A new filter allows overriding the default behavior to clear the user cache upon login and logout when caching for Logged-In Users is enabled. See [this article](https://cometcache.com/r/kb-article-how-can-i-prevent-the-user-cache-from-being-cleared-upon-login-or-logout/) for details. Props @KTS915. See [Issue #756](https://github.com/websharks/comet-cache/issues/756).
8
+
9
+ = v160417 =
10
+
11
+ - **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).
12
+
13
  = v160416 =
14
 
15
  - **Enhancement**: Several PHP 5.4+ enhancements, most notably a conversion from PHP Closures to PHP Traits. See [Issue #635](https://github.com/websharks/comet-cache/issues/635).
comet-cache.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Version: 160417
4
  Text Domain: comet-cache
5
  Plugin Name: Comet Cache
6
  Network: true
1
  <?php
2
  /*
3
+ Version: 160521
4
  Text Domain: comet-cache
5
  Plugin Name: Comet Cache
6
  Network: true
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Comet Cache ===
2
 
3
- Stable tag: 160417
4
  Requires at least: 4.2
5
  Tested up to: 4.6-alpha
6
  Text Domain: comet-cache
@@ -336,9 +336,17 @@ Requires WordPress v4.2+.
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
339
  = v160417 =
340
 
341
- - **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" with introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).
342
 
343
  = v160416 =
344
 
@@ -378,4 +386,4 @@ Requires WordPress v4.2+.
378
  - **Bug Fix (Multisite)**: Fixed a bug where when Comet Cache was Network Activated the plugin settings link would show up in the plugins list for the Main Site and would lead to a 404 error. The settings link is now only shown when viewing the plugins list from the Network Admin. Props @jaswsinc. See [Issue #675](https://github.com/websharks/zencache/issues/675).
379
  - **Enhancement**: Added support-related links to the plugin options page. Props @renzms. See [Issue #612](https://github.com/websharks/zencache/issues/612#issuecomment-186827661).
380
 
381
- For older Changelog entries going back to 2009, please see the `CHANGELOG.md` file.
1
  === Comet Cache ===
2
 
3
+ Stable tag: 160521
4
  Requires at least: 4.2
5
  Tested up to: 4.6-alpha
6
  Text Domain: comet-cache
336
 
337
  == Changelog ==
338
 
339
+ = v160521 =
340
+
341
+ - **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752).
342
+ - **Bug Fix**: When the PHP OPCache extension is active, the OPCache is now cleared when a WordPress plugin is upgraded, activated, or deactivated. This works around an issue that could produce a fatal error when the PHP OPCache contains cached PHP code that conflicts with new PHP code introduced by an update. See [Issue #740](https://github.com/websharks/comet-cache/issues/740).
343
+ - **Enhancement** (Pro): It's now possible to disable the WordPress Admin Toolbar when Logged-In User Caching is enabled with a new option in _Comet Cache → Plugin Options → Logged-In Users → Disable the Admin Toolbar for Logged-In Users & Comment Authors?_ Props @renzms and @KTS915. See [Issue #690](https://github.com/websharks/comet-cache/issues/690).
344
+ - **Enhancement**: The the option to automatically clear the cache for Custom Term Archive Views (see _Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?_) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See [Issue #693](https://github.com/websharks/comet-cache/issues/693).
345
+ - **Enhancement** (Pro): A new filter allows overriding the default behavior to clear the user cache upon login and logout when caching for Logged-In Users is enabled. See [this article](https://cometcache.com/r/kb-article-how-can-i-prevent-the-user-cache-from-being-cleared-upon-login-or-logout/) for details. Props @KTS915. See [Issue #756](https://github.com/websharks/comet-cache/issues/756).
346
+
347
  = v160417 =
348
 
349
+ - **Bug Fix**: Fixed a "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_SCHEME'" introduced by the previous release (v160416). This issue only affected sites where Feed Caching was enabled (_Comet Cache → Plugin Options → RSS, RDF, and Atom Feeds_). Props to MassimoD and @emanwebdev for reporting. See [Issue #739](https://github.com/websharks/comet-cache/issues/739).
350
 
351
  = v160416 =
352
 
386
  - **Bug Fix (Multisite)**: Fixed a bug where when Comet Cache was Network Activated the plugin settings link would show up in the plugins list for the Main Site and would lead to a 404 error. The settings link is now only shown when viewing the plugins list from the Network Admin. Props @jaswsinc. See [Issue #675](https://github.com/websharks/zencache/issues/675).
387
  - **Enhancement**: Added support-related links to the plugin options page. Props @renzms. See [Issue #612](https://github.com/websharks/zencache/issues/612#issuecomment-186827661).
388
 
389
+ For older changelog history going back to 2009, please see [CHANGELOG.md](https://github.com/websharks/comet-cache/blob/master/CHANGELOG.md).
src/.htaccess ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <IfModule authz_core_module>
2
+ Require all denied
3
+ </IfModule>
4
+ <IfModule !authz_core_module>
5
+ deny from all
6
+ </IfModule>
7
+
8
+ <FilesMatch "\.(js|css|map|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">
9
+ <IfModule authz_core_module>
10
+ Require all granted
11
+ </IfModule>
12
+ <IfModule !authz_core_module>
13
+ allow from all
14
+ </IfModule>
15
+ </FilesMatch>
src/includes/classes/AbsBase.php CHANGED
@@ -1,12 +1,14 @@
1
  <?php
2
  namespace WebSharks\CometCache\Classes;
3
 
 
 
4
  /**
5
  * Abstract Base.
6
  *
7
  * @since 150422 Rewrite.
8
  */
9
- abstract class AbsBase
10
  {
11
  /**
12
  * @type null|plugin Plugin reference.
1
  <?php
2
  namespace WebSharks\CometCache\Classes;
3
 
4
+ use WebSharks\CometCache\Interfaces;
5
+
6
  /**
7
  * Abstract Base.
8
  *
9
  * @since 150422 Rewrite.
10
  */
11
+ abstract class AbsBase implements Interfaces\Shared\NcDebugConsts, Interfaces\Shared\CachePathConsts
12
  {
13
  /**
14
  * @type null|plugin Plugin reference.
src/includes/classes/AbsBaseAp.php CHANGED
@@ -2,14 +2,13 @@
2
  namespace WebSharks\CometCache\Classes;
3
 
4
  use WebSharks\CometCache\Traits;
5
- use WebSharks\CometCache\Interfaces;
6
 
7
  /**
8
  * Abstract Base for Advanced Cache and Plugin.
9
  *
10
  * @since 150422 Rewrite.
11
  */
12
- abstract class AbsBaseAp extends AbsBase implements Interfaces\Shared\NcDebugConsts, Interfaces\Shared\CachePathConsts
13
  {
14
  /*[.build.php-auto-generate-use-Traits]*/
15
  use Traits\Shared\BlogUtils;
2
  namespace WebSharks\CometCache\Classes;
3
 
4
  use WebSharks\CometCache\Traits;
 
5
 
6
  /**
7
  * Abstract Base for Advanced Cache and Plugin.
8
  *
9
  * @since 150422 Rewrite.
10
  */
11
+ abstract class AbsBaseAp extends AbsBase
12
  {
13
  /*[.build.php-auto-generate-use-Traits]*/
14
  use Traits\Shared\BlogUtils;
src/includes/classes/FeedUtils.php CHANGED
@@ -1,14 +1,12 @@
1
  <?php
2
  namespace WebSharks\CometCache\Classes;
3
 
4
- use WebSharks\CometCache\Interfaces;
5
-
6
  /**
7
  * Feed Utils.
8
  *
9
  * @since 150422 Rewrite.
10
  */
11
- class FeedUtils extends AbsBase implements Interfaces\Shared\CachePathConsts
12
  {
13
  /**
14
  * @type string WordPress `home_url()`.
1
  <?php
2
  namespace WebSharks\CometCache\Classes;
3
 
 
 
4
  /**
5
  * Feed Utils.
6
  *
7
  * @since 150422 Rewrite.
8
  */
9
+ class FeedUtils extends AbsBase
10
  {
11
  /**
12
  * @type string WordPress `home_url()`.
src/includes/classes/MenuPageOptions.php CHANGED
@@ -615,6 +615,15 @@ class MenuPageOptions extends MenuPage
615
  echo ' <option value="postload"'.selected($this->plugin->options['cdn_when_logged_in'], 'postload', false).'>'.__('Yes, enable Static CDN Filters for logged-in users (recommended) .', 'comet-cache').'</option>'."\n";
616
  echo ' </select></p>'."\n";
617
  echo ' <p class="info">'.__('<strong>Note:</strong> Static CDN Filters serve <em>static</em> resources. Static resources, are, simply put, static. Thus, it is not a problem to cache these resources for any visitor (logged-in or not logged-in). To avoid confusion, this defaults to a value of <code>No</code>, and we ask that you set it to <code>Yes</code> on your own so that you\'ll know to expect this behavior; i.e., that static resources will always be served from the CDN (logged-in or not logged-in) even though Logged-In User caching may be disabled above.', 'comet-cache').'</p>'."\n";
 
 
 
 
 
 
 
 
 
618
  echo ' </div>'."\n";
619
 
620
  echo '</div>'."\n";
615
  echo ' <option value="postload"'.selected($this->plugin->options['cdn_when_logged_in'], 'postload', false).'>'.__('Yes, enable Static CDN Filters for logged-in users (recommended) .', 'comet-cache').'</option>'."\n";
616
  echo ' </select></p>'."\n";
617
  echo ' <p class="info">'.__('<strong>Note:</strong> Static CDN Filters serve <em>static</em> resources. Static resources, are, simply put, static. Thus, it is not a problem to cache these resources for any visitor (logged-in or not logged-in). To avoid confusion, this defaults to a value of <code>No</code>, and we ask that you set it to <code>Yes</code> on your own so that you\'ll know to expect this behavior; i.e., that static resources will always be served from the CDN (logged-in or not logged-in) even though Logged-In User caching may be disabled above.', 'comet-cache').'</p>'."\n";
618
+ echo ' <hr />'."\n";
619
+ echo ' <h3>'.__('Disable the Admin Toolbar for Logged-In Users &amp; Comment Authors?', 'comet-cache').'</h3>'."\n";
620
+ echo ' <p>'.__('When Logged-In User caching is enabled above, it is recommended that you disable the WordPress Admin Toolbar for logged-in users (on the front-end of the site) because the Toolbar is generally NOT cache-compatible. If you want Comet Cache to automatically disable the Toolbar for logged-in users, you can choose that option below. Or, if you use another plugin to control the Admin Toolbar you can leave this option disabled.', 'comet-cache').'</p>'."\n";
621
+ echo ' <p><select name="'.esc_attr(GLOBAL_NS).'[saveOptions][when_logged_in_admin_bar]">'."\n";
622
+ echo ' <option value="0"'.selected($this->plugin->options['when_logged_in_admin_bar'], '0', false).'>'.__('Yes, disable the Admin Toolbar for all logged-in users (recommended option).', 'comet-cache').'</option>'."\n";
623
+ echo ' <option value="1"'.selected($this->plugin->options['when_logged_in_admin_bar'], '1', false).'>'.__('No, don\'t disable the Admin Toolbar for logged-in users.', 'comet-cache').'</option>'."\n";
624
+ echo ' </select></p>'."\n";
625
+
626
+ echo ' <p class="info">'.__('<strong>Note:</strong> If you don\'t disable the Admin Toolbar for logged-in users that will cause WordPress Nonce values to appear in the page source; nonce values are generally NOT cache-compatible. Please see <a href="https://cometcache.com/r/kb-article-what-are-wordpress-nonces-and-why-are-they-not-cache-compatible/" target="_blank">this article</a> for details.', 'comet-cache').'</p>'."\n";
627
  echo ' </div>'."\n";
628
 
629
  echo '</div>'."\n";
src/includes/classes/Plugin.php CHANGED
@@ -191,6 +191,8 @@ class Plugin extends AbsBaseAp
191
  'cache_clear_urls',
192
 
193
  'when_logged_in',
 
 
194
  'version_salt',
195
 
196
  'htmlc_enable',
@@ -300,7 +302,7 @@ class Plugin extends AbsBaseAp
300
 
301
  'cache_clear_term_category_enable' => '1', // `0|1`.
302
  'cache_clear_term_post_tag_enable' => '1', // `0|1`.
303
- 'cache_clear_term_other_enable' => '0', // `0|1`.
304
 
305
  /* Misc. cache behaviors. */
306
 
@@ -341,6 +343,9 @@ class Plugin extends AbsBaseAp
341
  'htmlc_compress_html_code' => '1', // `0|1`.
342
  'htmlc_when_logged_in' => '0', // `0|1`; enable when logged in?
343
 
 
 
 
344
  /* Related to auto-cache engine. */
345
 
346
  'auto_cache_enable' => '0', // `0|1`.
@@ -457,6 +462,7 @@ class Plugin extends AbsBaseAp
457
  add_action('admin_init', [$this, 'autoClearCacheOnSettingChanges']);
458
  add_action('safecss_save_pre', [$this, 'autoClearCacheOnJetpackCustomCss'], 10, 1);
459
  add_action('upgrader_process_complete', [$this, 'autoClearOnUpgraderProcessComplete'], 10, 2);
 
460
 
461
  add_action('switch_theme', [$this, 'autoClearCache']);
462
  add_action('wp_create_nav_menu', [$this, 'autoClearCache']);
191
  'cache_clear_urls',
192
 
193
  'when_logged_in',
194
+ 'when_logged_in_admin_bar',
195
+
196
  'version_salt',
197
 
198
  'htmlc_enable',
302
 
303
  'cache_clear_term_category_enable' => '1', // `0|1`.
304
  'cache_clear_term_post_tag_enable' => '1', // `0|1`.
305
+ 'cache_clear_term_other_enable' => '1', // `0|1`.
306
 
307
  /* Misc. cache behaviors. */
308
 
343
  'htmlc_compress_html_code' => '1', // `0|1`.
344
  'htmlc_when_logged_in' => '0', // `0|1`; enable when logged in?
345
 
346
+ /* Related to Logged-In User Caching */
347
+ 'when_logged_in_admin_bar' => '1', // `0|1`; enable when logged in?
348
+
349
  /* Related to auto-cache engine. */
350
 
351
  'auto_cache_enable' => '0', // `0|1`.
462
  add_action('admin_init', [$this, 'autoClearCacheOnSettingChanges']);
463
  add_action('safecss_save_pre', [$this, 'autoClearCacheOnJetpackCustomCss'], 10, 1);
464
  add_action('upgrader_process_complete', [$this, 'autoClearOnUpgraderProcessComplete'], 10, 2);
465
+ add_action('upgrader_process_complete', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
466
 
467
  add_action('switch_theme', [$this, 'autoClearCache']);
468
  add_action('wp_create_nav_menu', [$this, 'autoClearCache']);
src/includes/classes/VsUpgrades.php CHANGED
@@ -41,6 +41,7 @@ class VsUpgrades extends AbsBase
41
  $this->fromLte151107();
42
  $this->fromLte151114();
43
  $this->fromZenCache();
 
44
  }
45
 
46
  /**
@@ -204,4 +205,22 @@ class VsUpgrades extends AbsBase
204
  );
205
  }
206
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  }
41
  $this->fromLte151107();
42
  $this->fromLte151114();
43
  $this->fromZenCache();
44
+ $this->fromLte160227();
45
  }
46
 
47
  /**
205
  );
206
  }
207
  }
208
+
209
+ /**
210
+ * Before we enabled "Auto-Clear Custom Term Archive Views" by default.
211
+ *
212
+ * @since 160521
213
+ */
214
+ protected function fromLte160227()
215
+ {
216
+ if (version_compare($this->prev_version, '160227', '<=')) {
217
+ if (is_array($existing_options = get_site_option(GLOBAL_NS.'_options'))) {
218
+ $this->plugin->options['cache_clear_term_other_enable'] = $this->plugin->default_options['cache_clear_term_other_enable'];
219
+ if ($this->plugin->options !== $existing_options) {
220
+ $this->plugin->updateOptions($this->plugin->options); // Save/update options.
221
+ $this->plugin->activate(); // Reactivate plugin w/ new options.
222
+ }
223
+ }
224
+ }
225
+ }
226
  }
src/includes/stub.php CHANGED
@@ -13,7 +13,7 @@ if (!defined('WPINC')) {
13
  require_once dirname(__DIR__).'/vendor/autoload.php';
14
  require_once __DIR__.'/functions/i18n-utils.php';
15
 
16
- ${__FILE__}['version'] = '160417'; //version//
17
  ${__FILE__}['plugin'] = dirname(dirname(__DIR__));
18
  ${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php';
19
  ${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path.
13
  require_once dirname(__DIR__).'/vendor/autoload.php';
14
  require_once __DIR__.'/functions/i18n-utils.php';
15
 
16
+ ${__FILE__}['version'] = '160521'; //version//
17
  ${__FILE__}['plugin'] = dirname(dirname(__DIR__));
18
  ${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php';
19
  ${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path.
src/includes/traits/Plugin/WcpOpcacheUtils.php CHANGED
@@ -63,6 +63,18 @@ trait WcpOpcacheUtils
63
  return 0; // Not applicable.
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * Clear AC class file from Opcache (by force).
68
  *
63
  return 0; // Not applicable.
64
  }
65
 
66
+ /**
67
+ * Wipe the Opcache (by force).
68
+ *
69
+ * @since 160521 Improving OPCache support.
70
+ *
71
+ * @return int Total keys cleared.
72
+ */
73
+ public function wipeOpcacheByForce()
74
+ {
75
+ return $this->wipeOpcache(false, false);
76
+ }
77
+
78
  /**
79
  * Clear AC class file from Opcache (by force).
80
  *
src/includes/traits/Plugin/WcpPluginUtils.php CHANGED
@@ -17,12 +17,17 @@ trait WcpPluginUtils
17
  * @param bool True if activating|deactivating network-wide. Defaults to boolean `FALSE` in case parameter is not passed to hook.
18
  *
19
  * @return int Total files wiped|cleared by this routine (if any).
 
 
20
  */
21
  public function autoClearOnPluginActivationDeactivation($plugin, $network_wide = false)
22
  {
23
  if (!$this->applyWpFilters(GLOBAL_NS.'_auto_clear_on_plugin_activation_deactivation', true)) {
24
  return 0; // Nothing to do here.
25
  }
 
 
 
26
  return $this->{($network_wide ? 'autoWipeCache' : 'autoClearCache')}();
27
  }
28
  }
17
  * @param bool True if activating|deactivating network-wide. Defaults to boolean `FALSE` in case parameter is not passed to hook.
18
  *
19
  * @return int Total files wiped|cleared by this routine (if any).
20
+ *
21
+ * @note Also wipes the PHP OPCache.
22
  */
23
  public function autoClearOnPluginActivationDeactivation($plugin, $network_wide = false)
24
  {
25
  if (!$this->applyWpFilters(GLOBAL_NS.'_auto_clear_on_plugin_activation_deactivation', true)) {
26
  return 0; // Nothing to do here.
27
  }
28
+
29
+ add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
30
+
31
  return $this->{($network_wide ? 'autoWipeCache' : 'autoClearCache')}();
32
  }
33
  }
src/includes/traits/Plugin/WcpUpdaterUtils.php CHANGED
@@ -46,11 +46,12 @@ trait WcpUpdaterUtils
46
  }
47
  }
48
  unset($_plugin); // Housekeeping.
49
- } elseif ($single_plugin_update && is_plugin_active($data['plugin'])) {
50
  $upgrading_active_plugin = true;
51
  }
52
  if ($upgrading_active_plugin) {
53
  $counter += $this->autoClearCache();
 
54
  }
55
  break; // Break switch.
56
 
@@ -91,12 +92,14 @@ trait WcpUpdaterUtils
91
 
92
  if ($upgrading_active_theme || $upgrading_active_parent_theme) {
93
  $counter += $this->autoClearCache();
 
94
  }
95
  break; // Break switch.
96
 
97
  case 'core': // Core upgrade.
98
  default: // Or any other sort of upgrade.
99
  $counter += $this->autoClearCache();
 
100
  break; // Break switch.
101
  }
102
  }
46
  }
47
  }
48
  unset($_plugin); // Housekeeping.
49
+ } elseif ($single_plugin_update && ( is_plugin_active($data['plugin']) || $upgrader_instance->skin->upgrader->skin->plugin_active || $upgrader_instance->skin->upgrader->skin->plugin_network_active)) {
50
  $upgrading_active_plugin = true;
51
  }
52
  if ($upgrading_active_plugin) {
53
  $counter += $this->autoClearCache();
54
+ add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
55
  }
56
  break; // Break switch.
57
 
92
 
93
  if ($upgrading_active_theme || $upgrading_active_parent_theme) {
94
  $counter += $this->autoClearCache();
95
+ add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
96
  }
97
  break; // Break switch.
98
 
99
  case 'core': // Core upgrade.
100
  default: // Or any other sort of upgrade.
101
  $counter += $this->autoClearCache();
102
+ add_action('shutdown', [$this, 'wipeOpcacheByForce'], PHP_INT_MAX);
103
  break; // Break switch.
104
  }
105
  }
src/vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314::getLoader();
src/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit1282194a29af7710e5b95305c89863ea', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit42cd68716e26c15cd28e74de3dd5e314', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
src/vendor/composer/installed.json CHANGED
@@ -227,23 +227,23 @@
227
  },
228
  {
229
  "name": "websharks/wp-php-rv",
230
- "version": "150511",
231
- "version_normalized": "150511",
232
  "source": {
233
  "type": "git",
234
  "url": "https://github.com/websharks/wp-php-rv.git",
235
- "reference": "ed0a58f3647e59c740560235da1e61904dca8d84"
236
  },
237
  "dist": {
238
  "type": "zip",
239
- "url": "https://api.github.com/repos/websharks/wp-php-rv/zipball/ed0a58f3647e59c740560235da1e61904dca8d84",
240
- "reference": "ed0a58f3647e59c740560235da1e61904dca8d84",
241
  "shasum": ""
242
  },
243
  "require": {
244
  "php": ">=5.2"
245
  },
246
- "time": "2015-05-10 10:30:04",
247
  "type": "library",
248
  "installation-source": "dist",
249
  "notification-url": "https://packagist.org/downloads/",
227
  },
228
  {
229
  "name": "websharks/wp-php-rv",
230
+ "version": "160504",
231
+ "version_normalized": "160504",
232
  "source": {
233
  "type": "git",
234
  "url": "https://github.com/websharks/wp-php-rv.git",
235
+ "reference": "275e387f582ca8bf96354abe0aa10c3e0d7a3fe8"
236
  },
237
  "dist": {
238
  "type": "zip",
239
+ "url": "https://api.github.com/repos/websharks/wp-php-rv/zipball/275e387f582ca8bf96354abe0aa10c3e0d7a3fe8",
240
+ "reference": "275e387f582ca8bf96354abe0aa10c3e0d7a3fe8",
241
  "shasum": ""
242
  },
243
  "require": {
244
  "php": ">=5.2"
245
  },
246
+ "time": "2016-05-05 07:44:00",
247
  "type": "library",
248
  "installation-source": "dist",
249
  "notification-url": "https://packagist.org/downloads/",
src/vendor/websharks/css-minifier/CHANGELOG.md DELETED
@@ -1,3 +0,0 @@
1
- ## v150510
2
-
3
- - Initial release.
 
 
 
src/vendor/websharks/css-minifier/LICENSE.txt DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/css-minifier/README.md DELETED
@@ -1,40 +0,0 @@
1
- ## CSS Minification
2
-
3
- CSS minifier (i.e., compressor).
4
-
5
- [![](https://img.shields.io/github/license/websharks/css-minifier.svg)](https://github.com/websharks/css-minifier/blob/HEAD/LICENSE.txt)
6
- [![](https://img.shields.io/badge/made-w%2F_100%25_pure_awesome_sauce-AB815F.svg?label=made)](http://websharks-inc.com/)
7
- [![](https://img.shields.io/badge/by-WebSharks_Inc.-656598.svg?label=by)](http://www.websharks-inc.com/team/)
8
- [![](https://img.shields.io/github/release/websharks/css-minifier.svg?label=latest)](https://github.com/websharks/css-minifier/releases)
9
- [![](https://img.shields.io/packagist/v/websharks/css-minifier.svg?label=packagist)](https://packagist.org/packages/websharks/css-minifier)
10
- [![](https://img.shields.io/github/issues/websharks/css-minifier.svg?label=issues)](https://github.com/websharks/css-minifier/issues)
11
- [![](https://img.shields.io/github/forks/websharks/css-minifier.svg?label=forks)](https://github.com/websharks/css-minifier/network)
12
- [![](https://img.shields.io/github/stars/websharks/css-minifier.svg?label=stars)](https://github.com/websharks/css-minifier/stargazers)
13
- [![](https://img.shields.io/github/downloads/websharks/css-minifier/latest/total.svg?label=downloads)](https://github.com/websharks/css-minifier/releases)
14
- [![](https://img.shields.io/packagist/dt/websharks/css-minifier.svg?label=packagist)](https://packagist.org/packages/websharks/css-minifier)
15
-
16
- ---
17
-
18
- ## Installation Instructions (Two Options)
19
-
20
- 1. As a [Composer](https://packagist.org/packages/websharks/css-minifier) Dependency
21
-
22
- ```json
23
- {
24
- "require": {
25
- "websharks/css-minifier": "dev-master"
26
- }
27
- }
28
- ```
29
-
30
- 2. Or, Download the PHAR Binary
31
- See: https://github.com/websharks/css-minifier/releases
32
-
33
- ---
34
-
35
- ## Usage Example
36
-
37
- ```php
38
- $css = '.hello { font-family: World; }';
39
- $compressed_css = WebSharks\CssMinifier\Core::compress($css);
40
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/css-minifier/src/includes/classes/Core.php DELETED
@@ -1,143 +0,0 @@
1
- <?php
2
- namespace WebSharks\CssMinifier;
3
-
4
- /**
5
- * Core.
6
- *
7
- * @since 150510 Initial release.
8
- */
9
- class Core
10
- {
11
- /**
12
- * CSS.
13
- *
14
- * @since 150510 Initial release.
15
- *
16
- * @type string CSS.
17
- */
18
- protected $css;
19
-
20
- /**
21
- * Static cache.
22
- *
23
- * @since 150510 Initial release.
24
- *
25
- * @type array Static cache.
26
- */
27
- protected static $static = array();
28
-
29
- /**
30
- * Constructor.
31
- *
32
- * @since 150510 Initial release.
33
- */
34
- public function __construct($css)
35
- {
36
- $this->css = (string) $css;
37
- }
38
-
39
- /**
40
- * Compressor.
41
- *
42
- * @since 150510 Initial release.
43
- *
44
- * @param string $css Input CSS.
45
- */
46
- public static function compress($css)
47
- {
48
- $css = (string) $css;
49
- try {
50
- $css_minifier = new static($css);
51
- $minified_css = $css_minifier->min();
52
- return $minified_css;
53
- } catch (\Exception $exception) {
54
- return $css;
55
- }
56
- }
57
-
58
- /**
59
- * Minifier.
60
- *
61
- * @since 150510 Initial release.
62
- *
63
- * @return string Output (minified) CSS.
64
- */
65
- public function min()
66
- {
67
- return $this->selfMin();
68
- }
69
-
70
- /**
71
- * Self minifier.
72
- *
73
- * @since 15xxxx Adding SCSS compiler.
74
- *
75
- * @return string Output (minified) CSS.
76
- */
77
- protected function selfMin()
78
- {
79
- if (!$this->css) {
80
- return $this->css;
81
- }
82
- $static = &static::$static[__FUNCTION__.'_map'];
83
-
84
- if (!isset($static['replace'], $static['with'], $static['colors'])) {
85
- $de_spacifiables = array(
86
- '{',
87
- '}',
88
- '!=',
89
- '|=',
90
- '^=',
91
- '$=',
92
- '*=',
93
- '~=',
94
- '=',
95
- '~',
96
- ';',
97
- ',',
98
- '>',
99
- );
100
- $de_spacifiables = array_map(
101
- function ($string) {
102
- return preg_quote($string, '/');
103
- },
104
- $de_spacifiables
105
- );
106
- $de_spacifiables = implode('|', $de_spacifiables);
107
-
108
- $static['replace'] = array(
109
- 'comments' => '/\/\*.*?\*\//s',
110
- 'line_breaks' => '/['."\r\n".']+/',
111
- 'extra_spaces' => '/\s{2,}/',
112
- 'de_spacifiables' => '/ *('.$de_spacifiables.') */',
113
- 'unnecessary_;s' => '/;\}/',
114
- );
115
- $static['with'] = array('', ' ', ' ', '${1}', '}');
116
- $static['colors'] = '/(?P<context>[:,\h]+#)(?P<hex>[a-z0-9]{6})/i';
117
- }
118
- $this->css = preg_replace($static['replace'], $static['with'], $this->css);
119
- $this->css = preg_replace_callback($static['colors'], array($this, 'selfMaybeCompressCssColorCb'), $this->css);
120
- $this->css = trim($this->css);
121
-
122
- return $this->css;
123
- }
124
-
125
- /**
126
- * Compresses HEX color codes.
127
- *
128
- * @since 140417 Initial release.
129
- *
130
- * @param array $m Regular expression matches.
131
- *
132
- * @return string Full match with compressed HEX color code.
133
- */
134
- protected function selfMaybeCompressCssColorCb(array $m)
135
- {
136
- $m['hex'] = strtoupper($m['hex']); // Convert to uppercase for easy comparison.
137
-
138
- if ($m['hex'][0] === $m['hex'][1] && $m['hex'][2] === $m['hex'][3] && $m['hex'][4] === $m['hex'][5]) {
139
- return $m['context'].$m['hex'][0].$m['hex'][2].$m['hex'][4];
140
- }
141
- return $m[0];
142
- }
143
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/css-minifier/src/includes/stub.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- /**
3
- * Stub.
4
- *
5
- * @since 150424 Initial release.
6
- */
7
- namespace WebSharks\CssMinifier;
8
-
9
- require_once dirname(dirname(__FILE__)).'/vendor/autoload.php';
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/CHANGELOG.md DELETED
@@ -1,12 +0,0 @@
1
- ## v150424
2
-
3
- - PSR 1, 2, 4 conformity.
4
- - Composer dependency compat.
5
- - Major restructuring and namespace changes.
6
- - Adding support for JSON compression.
7
- - Bringing back the PHAR file in each release.
8
- - Adding `build.xml` and `composer.json`.
9
-
10
- ## v14xxxx
11
-
12
- - Initial release.
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/LICENSE.txt DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/README.md DELETED
@@ -1,365 +0,0 @@
1
- # HTML-Compressor
2
-
3
- <img src="assets/html-compressor-logo.png" width="300px" align="right" />
4
-
5
- Combines & compresses CSS/JS/HTML code.
6
-
7
- [![](https://img.shields.io/github/license/websharks/html-compressor.svg)](https://github.com/websharks/html-compressor/blob/HEAD/LICENSE.txt)
8
-
9
- [![](https://img.shields.io/badge/made-w%2F_100%25_pure_awesome_sauce-AB815F.svg?label=made)](http://websharks-inc.com/)
10
- [![](https://img.shields.io/badge/by-WebSharks_Inc.-656598.svg?label=by)](http://www.websharks-inc.com/team/)
11
- [![](https://img.shields.io/github/release/websharks/html-compressor.svg?label=latest)](https://github.com/websharks/html-compressor/releases)
12
- [![](https://img.shields.io/packagist/v/websharks/html-compressor.svg?label=packagist)](https://packagist.org/packages/websharks/html-compressor)
13
- [![](https://img.shields.io/github/issues/websharks/html-compressor.svg?label=issues)](https://github.com/websharks/html-compressor/issues)
14
- [![](https://img.shields.io/github/forks/websharks/html-compressor.svg?label=forks)](https://github.com/websharks/html-compressor/network)
15
- [![](https://img.shields.io/github/stars/websharks/html-compressor.svg?label=stars)](https://github.com/websharks/html-compressor/stargazers)
16
- [![](https://img.shields.io/github/downloads/websharks/html-compressor/latest/total.svg?label=downloads)](https://github.com/websharks/html-compressor/releases)
17
- [![](https://img.shields.io/packagist/dt/websharks/html-compressor.svg?label=packagist)](https://packagist.org/packages/websharks/html-compressor)
18
-
19
- ```php
20
- <?php
21
- require_once 'html-compressor.phar';
22
- $html_compressor = new WebSharks\HtmlCompressor\Core();
23
- ob_start(array($html_compressor, 'compress'));
24
- ```
25
-
26
- ----
27
-
28
- ## Installation Instructions (Two Options)
29
-
30
- 1. As a [Composer](https://packagist.org/packages/websharks/html-compressor) Dependency
31
-
32
- ```json
33
- {
34
- "require": {
35
- "websharks/html-compressor": "dev-master"
36
- }
37
- }
38
- ```
39
-
40
- 2. Or, Download the PHAR Binary
41
- See: https://github.com/websharks/html-compressor/releases
42
-
43
- ## Where do I get the PHAR file?
44
-
45
- A PHAR binary is made available for each official release. See: [releases](https://github.com/websharks/html-compressor/releases).
46
-
47
- ## Why did we create the HTML Compressor?
48
-
49
- The HTML Compressor class was developed because all of us here at WebSharks™ are growing tired of seeing WordPress installations out-in-the-wild that are running many different plugins; where each plugin may add a new set of CSS/JS files. This creates a slow-loading site, even if a page caching plugin is active.
50
-
51
- **For example**, if you look at the HTML source code for most sites powered by a publishing platform such as WordPress (or audit one in a web developer console), you will find **a complete mess like this**...
52
-
53
- <link rel="stylesheet" href="theme.css" type="text/css" />
54
- <link rel="stylesheet" href="child-theme.css" type="text/css" />
55
- <link rel="stylesheet" href="theme-variation.css" type="text/css" />
56
- <link rel="stylesheet" href="plugin1.css" type="text/css" />
57
- <link rel="stylesheet" href="plugin2.css" type="text/css" />
58
- <link rel="stylesheet" href="plugin3.css" type="text/css" />
59
- <link rel="stylesheet" href="plugin4.css" type="text/css" />
60
- <link rel="stylesheet" href="plugin5.css" type="text/css" />
61
- ... and on, and on, and on ...
62
-
63
- <script type="text/javascript" src="jquery.js"></script>
64
- <script type="text/javascript" src="jquery-migrate.min.js"></script>
65
- <script type="text/javascript" src="tabs.min.js"></script>
66
- <script type="text/javascript" src="custom.js"></script>
67
- <script type="text/javascript" src="plugin1.js"></script>
68
- <script type="text/javascript" src="plugin2.js"></script>
69
- <script type="text/javascript" src="plugin3.js"></script>
70
- <script type="text/javascript" src="plugin4.js"></script>
71
- <script type="text/javascript" src="plugin5.js"></script>
72
- ... and on, and on, and on ...
73
-
74
- #### ↑ The Problem Here?
75
-
76
- Instead of a single CSS and/or JS file (i.e., one or two HTTP connections); the browser needs to make *several* requests; and it needs to download each of these resources separately. This is not a problem that impacts WordPress alone, we see this issue across many publishing platforms where plugins are brought into the mix.
77
-
78
- Ideally, your publishing platform (or theme) would minimize the number of external resources that it depends on by consolidating those external resources (i.e., CSS/JS files) into just one or two files; and then compress them too. However, not all themes do this. In fact, this is not always possible (even when a theme/plugin developer is aware of the issue).
79
-
80
- For instance, if a theme/plugin developer is working within a set of PHP framework standards (e.g., doing things "the WordPress way"), the end result may not always be optimized in an ideal fashion. We know first-hand that this really bugs developers. Experienced developers don't create a mess by choice, it's just how the framework pulls everything together that can sometimes produce a mess. Also, when a site owner adds plugins to the mix later; where the publishing platform (or theme) is being supplemented by CSS/JS files that are plugin-specific—this is where things can really get crazy; e.g., a new CSS and/or JS file for each plugin.
81
-
82
- ## Solution, the WebSharks™ HTML Compressor!
83
-
84
- **The WebSharks™ HTML Compressor works as an additional layer of functionality that can come in after your publishing platform pieces everything together.** The WebSharks™ HTML Compressor analyzes each page of your site in real-time; i.e., as it's being loaded; inspecting each line of HTML code.
85
-
86
- CSS/JS files are combined (where possible) and compressed (where possible); then it can optimize the HTML code and any inline JavaScript/CSS too. The goal is to speed things up for your visitors and to reduce the number of HTTP connections that your server processes.
87
-
88
- #### Step-by-Step (Detailed Explanation)
89
-
90
- All of these compression options are enabled by default, but you can modify this behavior as you see fit. Toward the bottom of this file you will find a list of all possible configuration options.
91
-
92
- **1.** The HTML Compressor starts by inspecting the `<head>` and `<body>` of the HTML document. An attempt is made to recursively combine all CSS resources (including inline styles, and all remote resources too) into a single CSS file. If `compress_css_code` is enabled (on by default), the code in this single file is also compressed (i.e., extra whitespace is removed, hex color codes are optimized, etc, etc).
93
-
94
- *A few NOTES regarding step `1`.*
95
-
96
- - **NOTE:** The HTML Compressor does its best to remain standards-compliant during this process; thereby reducing the chance of a conflict to an absolute minimum.
97
-
98
- - **NOTE:** An attempt is made to fetch remote resources (e.g., externally hosted resources) or `@import` rules. Any remote resources are simply added to the single CSS file to eliminate any possibility of more than one HTTP connection being required to load the consolidated CSS. The HTML Compressor is also capable of resolving file paths and `url()` references to the proper location during this process.
99
-
100
- - **NOTE:** The HTML Compressor avoids cascading conflicts by intelligently skipping over any exclusions that you define and/or anything that is impossible to consolidate. In some cases 10 files might become 1; in other cases 10 files might become 2 or 3. This could vary from site to site—or from page-to-page even. If 1 file is possible, that's what you'll get. Otherwise, you will get whatever compression is possible.
101
-
102
- - **NOTE:** Under no circumstance will the HTML Compression alter the loading order of the underlying CSS resources. Even when files are combined in multiple sets (or certain exclusions are skipped over), the loading order is always preserved so that CSS conflicts are not introduced by this process.
103
-
104
- - **NOTE:** All CSS `@` rules are preserved by the HTML Compressor too. This includes `@media` specifications (whether they be defined in an `@import` or `<link media="">` tag; or with an embedded `@media` rule). There is only one exception. The `@charset` rule is always forced to a value of `@charset "UTF-8";` (recommended anyway).
105
-
106
- - **NOTE:** Conditional CSS (e.g., `<!--if[]` tags) are always excluded from consolidation so their behavior is not altered. Cascading order is preserved when exclusions are encountered; this goes for `<!--if[]` tags too of course.
107
-
108
- **2.** Next, we inspect the `<head>` of the HTML document. An attempt is made to combine all JS resources in the `<head>` into a single JS file. If `compress_js_code` is enabled (on by default), the code in this single file is also compressed (i.e., extra whitespace is removed, variable names are optimized, etc, etc).
109
-
110
- **3.** Next, we inspect a special area of the source code that can be flagged for compression by wrapping a section with `<!--footer-scripts--><!--footer-scripts-->`. This flagging is only necessary if you have scripts that you intentionally place in the footer. If the HTML Compressor finds a `<!--footer-scripts--><!--footer-scripts-->` section; an attempt is made to combine all JS resources into a single JS file. If `compress_js_code` is enabled (on by default), the code in this single file is also compressed (i.e., extra whitespace is removed, variable names are optimized, etc, etc).
111
-
112
- *A few NOTES regarding steps `2` and `3`.*
113
-
114
- - **NOTE:** The HTML Compressor does its best to remain standards-compliant during this process; thereby reducing the chance of a conflict to an absolute minimum.
115
-
116
- - **NOTE:** An attempt is made to fetch remote resources (e.g., externally hosted JavaScript resources). Any remote resources are simply added to the single JS file to eliminate any possibility of more than one HTTP connection being required to load the consolidated JS. The HTML Compressor is also capable of resolving file paths and references to the proper location during this process.
117
-
118
- - **NOTE:** The HTML Compressor avoids loading order conflicts by intelligently skipping over any exclusions that you define and/or anything that is impossible to consolidate. In some cases 10 files might become 1; in other cases 10 files might become 2 or 3. This could vary from site to site; or from page-to-page even. If 1 file is possible, that's what you'll get. Otherwise, you will get whatever compression is possible.
119
-
120
- - **NOTE:** Under no circumstance will the HTML Compression alter the loading order of the underlying JS resources. Even when files are combined in multiple sets (or certain exclusions are skipped over), the loading order is always preserved so that JS conflicts are not introduced by this process.
121
-
122
- - **NOTE:** All JavaScript `async` indicators are preserved during this process. Asynchronous loading is detected by the `async` and/or `defer` attribute in a `<script>` tag.
123
-
124
- - **NOTE:** Conditional JS (e.g., `<!--if[]` tags) are always excluded from consolidation so their behavior is not altered. Loading order is preserved when exclusions are encountered; this goes for `<!--if[]` tags too of course.
125
-
126
- **4.** Next, we look at the `<body>` for any inline `<script>` tags. While it is not possible to consolidate inline JS; if `compress_inline_js_code` is enabled (on by default) an attempt is made to compress the JavaScript code in these inline code snippets to reduce the amount of overhead they might add.
127
-
128
- **5.** Last, we compress the HTML code itself (i.e., extra whitespace is removed). Care is taken to preserve special tags where raw formatting is important; but you should end up with a much smaller HTML file; and the external resources it depends on will have certainly be reduced to a bare minimum.
129
-
130
- ----
131
-
132
- ## Some Usage Examples
133
-
134
- ### 1. HTML Compressor As An Output Buffer
135
- *This code snippet should be processed BEFORE any other output occurs.*
136
-
137
- ```php
138
- <?php
139
- require_once 'html-compressor.phar';
140
- $html_compressor = new WebSharks\HtmlCompressor\Core();
141
- ob_start(array($html_compressor, 'compress'));
142
- ```
143
-
144
- **TIP:** The `php.ini` directive [auto_prepend_file](http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) is a nice/clean way to integrate the HTML Compressor. You could create a file as seen in this example and specify that as the `auto_prepend_file` to enable compression of every HTML file that you serve; noting that the HTML Compressor will simply pass any non-HTML code through it's buffer without compressing it. The HTML Compressor only attempts to compress data which contains a closing `</html>` tag.
145
-
146
- **IMPORTANT NOTE:** One thing to keep in mind is that the WebSharks™ HTML Compressor works best when it's integrated together with a page caching plugin like ZenCache for WordPress; or another page caching plugin that you might prefer. **Why use a page caching plugin?** The HTML Compressor can be used on any site powered by PHP; but ideally you would cache the optimized HTML that it outputs, thereby removing the need for the HTML Compressor to analyze every single request. Of course, you *can* analyze every single request if you want to *(and the HTML Compressor has a cache of it's own to help keep things sane)*, but it's always better to store (cache) the compressed HTML output by this class. This will reduce server load and make your site even faster.
147
-
148
- **FAQ:** Is `html-compressor.phar` the only file that I need? Yes. The other files that you see in the GitHub repo are already compressed into the PHAR file. The only file you need is the `html-compressor.phar`. A PHAR binary is made available for each official release. See: [releases](https://github.com/websharks/html-compressor/releases).
149
-
150
- ### 2. HTML Compressor as an Output Buffer (w/ Options)
151
- *This just demonstrates how to specify an array of options.*
152
-
153
- ```php
154
- <?php
155
- require_once 'html-compressor.phar';
156
- $html_compressor_options = array(
157
-
158
- 'css_exclusions' => array(),
159
- 'js_exclusions' => array('.php?'),
160
- 'uri_exclusions' => array(),
161
-
162
- 'cache_expiration_time' => '14 days',
163
- 'cache_dir_public' => '/var/www/public_html/htmlc/cache/public',
164
- 'cache_dir_url_public' => 'http://example.com/htmlc/cache/public',
165
- 'cache_dir_private' => '/var/www/public_html/htmlc/cache/private',
166
-
167
- 'compress_combine_head_body_css' => TRUE,
168
- 'compress_combine_head_js' => TRUE,
169
- 'compress_combine_footer_js' => TRUE,
170
- 'compress_inline_js_code' => TRUE,
171
- 'compress_css_code' => TRUE,
172
- 'compress_js_code' => TRUE,
173
- 'compress_html_code' => TRUE,
174
-
175
- 'benchmark' => FALSE,
176
- 'product_title' => 'HTML Compressor',
177
- 'vendor_css_prefixes' => array('moz','webkit','khtml','ms','o')
178
- );
179
- $html_compressor = new WebSharks\HtmlCompressor\Core($html_compressor_options);
180
- ob_start(array($html_compressor, 'compress'));
181
- ```
182
-
183
- ### 3. HTML Compressor on raw HTML Code
184
- *This demonstrates how to run the compressor against arbitrary HTML code.*
185
-
186
- ```php
187
- <?php
188
- require_once 'html-compressor.phar';
189
- $html_compressor_options = array(
190
-
191
- 'css_exclusions' => array(),
192
- 'js_exclusions' => array('.php?'),
193
- 'uri_exclusions' => array(),
194
-
195
- 'cache_expiration_time' => '14 days',
196
- 'cache_dir_public' => '/var/www/public_html/htmlc/cache/public',
197
- 'cache_dir_url_public' => 'http://example.com/htmlc/cache/public',
198
- 'cache_dir_private' => '/var/www/public_html/htmlc/cache/private',
199
-
200
- 'current_url_scheme' => 'http',
201
- 'current_url_host' => 'www.example.com',
202
- 'current_url_uri' => '/raw/file/test.html?one=1&two=2',
203
-
204
- 'compress_combine_head_body_css' => TRUE,
205
- 'compress_combine_head_js' => TRUE,
206
- 'compress_combine_footer_js' => TRUE,
207
- 'compress_inline_js_code' => TRUE,
208
- 'compress_css_code' => TRUE,
209
- 'compress_js_code' => TRUE,
210
- 'compress_html_code' => TRUE,
211
-
212
- 'benchmark' => FALSE,
213
- 'product_title' => 'HTML Compressor',
214
- 'vendor_css_prefixes' => array('moz','webkit','khtml','ms','o')
215
- );
216
- $html = '<html> ... </html>';
217
- $html_compressor = new WebSharks\HtmlCompressor\Core($html_compressor_options);
218
- $html = $html_compressor->compress($html);
219
- ```
220
-
221
- ----
222
-
223
- ## Class Constructor Options
224
-
225
- e.g., `new WebSharks\HtmlCompressor\Core($options);`
226
-
227
- *where `$options` is an associative array with one or more keys listed below.*
228
-
229
- #### Current List of All Possible Options
230
-
231
- ##### The following options allow you to exclude certain CSS/JS files and/or inline snippets.
232
-
233
- **NOTE:** these options only apply if compression is enabled for CSS/JS files.*
234
-
235
- - (array)`css_exclusions` Defaults to `array()`. If you have some CSS files (or inline styles) that should NOT be included by compression routines, please specify an array of search tokens to exclude. Search tokens are compared to external CSS file `href` values (i.e., URLs or paths). Search tokens are also compared to the contents of any inline `<style></style>` tags.
236
-
237
- - (array)`js_exclusions` Defaults to `array()`. If you have some JS files (or inline scripts) that should NOT be included by compression routines, please specify an array of search tokens to exclude. Search tokens are compared to external JS file `src` values (i.e., URLs or paths). Search tokens are also compared to the contents of any inline `<script></script>` tags in cases where compression is possible.
238
-
239
- - (array)`uri_exclusions` Defaults to `array()`. If you have some URLs that should NOT be included by compression routines, please specify an array of search tokens to exclude. Search tokens are compared to the current URI (i.e., everything after the domain name).
240
-
241
- **NOTE:** Search tokens should be string literals. The HTML Compressor currently does NOT support wildcards or regex in search tokens. If you need to use regex patterns instead of search tokens, please use a `regex_` prefix when you define the option key; e.g., `'regex_js_exclusions' => '/\special\-script\.js/i'`. This works for `regex_css_exclusions` and `regex_uri_exclusions` too.
242
-
243
- ----
244
-
245
- - (boolean)`disable_built_in_css_exclusions` Defaults to `FALSE`. There are a few built-in exclusion patterns that are updated (improved) with each new release of the HTML Compressor. It is recommended that you leave these enabled at all times. However, if you prefer to turn them off (i.e., to *only* exclude the patterns you specify), you can set this to a `TRUE` value to disable all of those which are built-in. Built-in exclusions deal with things that should almost always be excluded; for any site. If you'd like to see the list of built-in patterns you can read the `$built_in_regex_css_exclusion_patterns` class property. It's an array of regular expressions that are compared to external CSS file `href` values (i.e., URLs or paths); and they are also compared to the contents of any inline `<style></style>` tags.
246
-
247
- - (boolean)`disable_built_in_js_exclusions` Defaults to `FALSE`. There are a few built-in exclusion patterns that are updated (improved) with each new release of the HTML Compressor. It is recommended that you leave these enabled at all times. However, if you prefer to turn them off (i.e., to *only* exclude the patterns you specify), you can set this to a `TRUE` value to disable all of those which are built-in. Built-in exclusions deal with things that should almost always be excluded; for any site. If you'd like to see the list of built-in patterns you can read the `$built_in_regex_js_exclusion_patterns` class property. It's an array of regular expressions that are compared to external JS file `src` values (i.e., URLs or paths); and they are also compared to the contents of any inline `<script></script>` tags.
248
-
249
- - (boolean)`disable_built_in_uri_exclusions` Defaults to `FALSE`. There are a few built-in exclusion patterns that are updated (improved) with each new release of the HTML Compressor. It is recommended that you leave these enabled at all times. However, if you prefer to turn them off (i.e., to *only* exclude the patterns you specify), you can set this to a `TRUE` value to disable all of those which are built-in. Built-in exclusions deal with things that should almost always be excluded; for any site. If you'd like to see the list of built-in patterns you can read the `$built_in_regex_uri_exclusion_patterns` class property. It's an array of regular expressions that are compared to URIs (i.e., everything after the domain).
250
-
251
- ----
252
-
253
- ##### The following options can be used to setup custom cache directories/URLs.
254
-
255
- *NOTE: under most circumstances, the built-in default values will do just fine.*
256
-
257
- - (string)`cache_expiration_time` Defaults to a value of `14 days`. You can use anything compatible with PHP's `strtotime()` function.
258
- NOTE: This expiration time is mostly irrelevant, because the HTML Compressor uses an internal checksum, and it also checks `filemtime()` before
259
- using an existing cache file. The HTML Compressor class also handles the automatic cleanup of your cache directories to keep it from growing too large over time.
260
- Therefore, unless you have VERY little disk space there is no reason to set this to a lower value (even if your site changes dynamically quite often).
261
- If anything, you might like to increase this value which could help to further reduce server load.
262
-
263
- **There are two scenarios where a cache regeneration occurs.**
264
-
265
- 1. When a cache file expires (based on your expiration time).
266
- 2. A cache file MUST be regenerated because there is a checksum mis-match (e.g., the content changed dynamically).
267
-
268
- In short, `cache_expiration_time` controls the first scenario; i.e., the absolute maximum amount of time that a cache file can ever live (or be used); and this will impact the automatic cleanup routine too of course.
269
-
270
- - (string)`cache_dir_public` Absolute server path to a local cache directory that is available over HTTP (i.e., publicly accessible).
271
- If you exclude this, there are two default handlers. If `WP_CONTENT_DIR` is defined (i.e., you are running this within WordPress),
272
- then your public cache directory will be located under: `wp-content/htmlc/cache/public`. Otherwise, this will default to
273
- a value of `$_SERVER['DOCUMENT_ROOT']/htmlc/cache/public`.
274
-
275
- - (string)`cache_dir_url_public` A publicly available URL which leads to your `cache_dir_public`.
276
- If you exclude this option, an automatic detection is used (i.e., a best guess based on `cache_dir_public`).
277
-
278
- - (string)`cache_dir_private` Absolute server path to a local cache directory that is NOT available over HTTP (i.e., private/hidden).
279
- If you exclude this, there are two default handlers. If `WP_CONTENT_DIR` is defined (i.e., you are running this within WordPress),
280
- then your private cache directory will be located under: `wp-content/htmlc/cache/private`. Otherwise, this will default to
281
- a value of `$_SERVER['DOCUMENT_ROOT']/htmlc/cache/private`.
282
-
283
- - (string)`cache_dir_url_private` Not applicable. This option exists internally but URLs to the private cache directory
284
- are never generated. Therefore, under normal circumstances you can ignore this option value all together.
285
-
286
- - (boolean)`cleanup_cache_dirs` Defaults to TRUE. By default, cache directories are cleaned up automatically
287
- over time; i.e., at semi-random intervals and also based on your `cache_expiration_time`. If you would prefer to cleanup
288
- the cache on your own, you can set this to a FALSE value.
289
-
290
- ----
291
-
292
- ##### The following options can be used to specify the current URL.
293
-
294
- *NOTE: it is normally NOT necessary to supply any of these values.*
295
-
296
- - (string)`current_url_scheme` When this class is running as a web application, we can detect this value automatically.
297
- That said, if you intend to run this class outside of a web server environment you will need to tell the compressor
298
- what the current URL scheme would be if the file you are compressing was being served as a web page.
299
- This should be set to one of `https` or `http`.
300
-
301
- - (string)`current_url_host` When this class is running as a web application, we can detect this value automatically.
302
- That said, if you intend to run this class outside of a web server environment you will need to tell the compressor
303
- what the current URL host would be if the file you are compressing was being served as a web page.
304
- This should be set to something like `www.example.com`.
305
-
306
- - (string)`current_url_uri` When this class is running as a web application, we can detect this value automatically.
307
- That said, if you intend to run this class outside of a web server environment you will need to tell the compressor
308
- what the current URI (i.e., path and query string) would be if the file you are compressing was being served as a web page.
309
- This should be set to something like `/path/to/page/?one=1&two=2`.
310
-
311
- ----
312
-
313
- ##### The following options control compression behavior.
314
-
315
- *NOTE: compression routines are applied in the same order as these options are listed below.*
316
-
317
- - (boolean)`compress_combine_head_body_css` TRUE by default. If you prefer NOT to combine CSS files into a single HTTP connection,
318
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the CSS compress-combine routines.
319
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
320
-
321
- - (boolean)`compress_combine_head_js` TRUE by default. If you prefer NOT to combine JS files into a single HTTP connection,
322
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the JS compress-combine routines.
323
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
324
-
325
- - (boolean)`compress_combine_footer_js` TRUE by default. If you prefer NOT to combine JS files in the footer into a single HTTP connection,
326
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the JS compress-combine routines.
327
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
328
-
329
- - (boolean)`compress_combine_remote_css_js` TRUE by default. If you prefer NOT to combine CSS/JS files from remote resource locations
330
- please set this to a FALSE value. By default, the options: `compress_combine_head_body_css`, `compress_combine_head_js`, `compress_combine_footer_js` will recursively combine all resources (including those from remote locations).
331
- If you set this to a FALSE value, all remote (externally hosted resources; e.g., those from CDNs or other remote URLs) will be excluded automatically to prevent remote off-site connections from taking place.
332
-
333
- - (boolean)`compress_inline_js_code` TRUE by default. If you prefer NOT to compress inline JS code (i.e., minify the contents of inline `<script>` tags),
334
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the inline JS compression routines.
335
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
336
-
337
- - (boolean)`compress_css_code` TRUE by default. If you prefer NOT to compress CSS files (i.e., minify the underlying CSS code),
338
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the CSS compression routines.
339
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
340
-
341
- - (boolean)`compress_js_code` TRUE by default. If you prefer NOT to compress JS files (i.e., minify the underlying JS code),
342
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the JS compression routines.
343
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
344
-
345
- - (boolean)`compress_html_code` TRUE by default. If you prefer NOT to compress HTML markup (i.e., the removal of extra whitespace, etc),
346
- please set this to a FALSE value. This can be helpful if your site (for whatever reason) is incompatible with the HTML compression routines.
347
- NOTE: if you disable this due to an incompatibility, please report it via GitHub so the issue can be resolved for everyone.
348
-
349
- ----
350
-
351
- ##### Other misc. options. These don't really fall into any specific category yet.
352
-
353
- - (boolean|string)`benchmark` Off by default. If enabled, HTML comments are added to the final output with some useful information. If you set this to a `TRUE` value, it simply enables an overall time calculation. If you're debugging, and you need to see many other details too; you can set this to the string: `details` (not recommended in a production environment).
354
-
355
- - (string)`product_title` Define this if you'd like to change the title of a particular HTML Compressor instance (i.e., to change the name from the default "HTML Compressor" to something else you like better). If undefined, this defaults to `HTML Compressor`. Note: this impacts the title of the product displayed in the HTML comments; assuming that `benchmark` is enabled where comments are included in the final output.
356
-
357
- - (array)`vendor_css_prefixes` An array of known vendor-specific CSS prefixes. Defaults to `array('moz','webkit','khtml','ms','o')`.
358
-
359
- ----
360
-
361
- ## License
362
-
363
- Copyright: © 2014 [WebSharks, Inc.](http://websharks-inc.com/) (coded in the USA)
364
-
365
- Released under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl-3.0.html).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/src/includes/classes/Benchmark.php DELETED
@@ -1,119 +0,0 @@
1
- <?php
2
- namespace WebSharks\HtmlCompressor;
3
-
4
- /**
5
- * HTML Compressor (benchmark).
6
- *
7
- * @since 150315 Enhancing debugger.
8
- *
9
- * @property-read $times Read-only access to times.
10
- * @property-read $data Read-only access to data.
11
- */
12
- class Benchmark // For debugging.
13
- {
14
- /*
15
- * Protected Properties
16
- */
17
-
18
- /**
19
- * @type array An array of times.
20
- *
21
- * @since 150315 Enhancing debugger.
22
- */
23
- protected $times = array();
24
-
25
- /**
26
- * @type array An array of data.
27
- *
28
- * @since 150315 Enhancing debugger.
29
- */
30
- protected $data = array();
31
-
32
- /*
33
- * Public API Methods
34
- */
35
-
36
- /**
37
- * Class Constructor.
38
- *
39
- * @since 150315 Enhancing debugger.
40
- *
41
- * @api Constructor is available for public use.
42
- */
43
- public function __construct()
44
- {
45
- }
46
-
47
- /**
48
- * Magic method for access to read-only properties.
49
- *
50
- * @since 150315 Enhancing debugger.
51
- *
52
- * @param string $property Propery by name.
53
- *
54
- * @throws \exception If `$property` does not exist for any reason.
55
- *
56
- * @return mixed Property value.
57
- *
58
- * @internal For internal magic use only.
59
- */
60
- public function __get($property)
61
- {
62
- $property = (string) $property;
63
-
64
- if (property_exists($this, $property)) {
65
- return $this->{$property};
66
- }
67
- throw new \Exception(sprintf('Undefined property: `%1$s`.', $property));
68
- }
69
-
70
- /**
71
- * Logs a new time entry.
72
- *
73
- * @since 150315 Enhancing debugger.
74
- *
75
- * @api This method is available for public use.
76
- *
77
- * @param string $function Caller.
78
- * @param float $start_time Start time; via `microtime(TRUE)`.
79
- * @param string $task Description of the task(s) performed.
80
- */
81
- public function addTime($function, $start_time, $task)
82
- {
83
- if (!($function = trim((string) $function))) {
84
- return; // Not possible.
85
- }
86
- if (($start_time = (float) $start_time) <= 0) {
87
- return; // Not possible.
88
- }
89
- if (($end_time = (float) microtime(true)) <= 0) {
90
- return; // Not possible.
91
- }
92
- if (!($task = trim((string) $task))) {
93
- return; // Not possible.
94
- }
95
- $time = number_format($end_time - $start_time, 5, '.', '');
96
- $this->times[$function] = compact('function', 'time', 'task');
97
- }
98
-
99
- /**
100
- * Logs a new set of data.
101
- *
102
- * @since 150315 Enhancing debugger.
103
- *
104
- * @api This method is available for public use.
105
- *
106
- * @param string $function Caller.
107
- * @param array $data Associative array.
108
- */
109
- public function addData($function, array $data)
110
- {
111
- if (!($function = trim((string) $function))) {
112
- return; // Not possible.
113
- }
114
- if (!$data) {
115
- return; // Not possible.
116
- }
117
- $this->data[$function] = compact('function', 'data');
118
- }
119
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/src/includes/classes/Core.php DELETED
@@ -1,3937 +0,0 @@
1
- <?php
2
- namespace WebSharks\HtmlCompressor;
3
-
4
- /**
5
- * HTML Compressor (core class).
6
- *
7
- * @since 140417 Initial release.
8
- *
9
- * @property-read string $version Read-only access to version string.
10
- * @property-read array $options Read-only access to current options.
11
- * @property-read HookApi $hook_api Read-only access to hook API class.
12
- * @property-read Benchmark $benchmark Read-only access to benchmark class.
13
- */
14
- class Core // Heart of the HTML Compressor.
15
- {
16
- /********************************************************************************************************/
17
-
18
- /*
19
- * Private Properties
20
- */
21
-
22
- /**
23
- * Current product title.
24
- *
25
- * @since 140926 Enhance JS error reporting.
26
- *
27
- * @type string Current product title.
28
- */
29
- protected $product_title = 'HTML Compressor';
30
-
31
- /**
32
- * Current version string.
33
- *
34
- * @since 140418 Version indicates release date.
35
- *
36
- * @type string Dated version string: `YYMMDD`.
37
- */
38
- protected $version = '160118'; //version//
39
-
40
- /**
41
- * An array of class options.
42
- *
43
- * @since 140417 Initial release.
44
- *
45
- * @type array Set dynamically by class constructor.
46
- */
47
- protected $options = array();
48
-
49
- /**
50
- * Hook API class instance.
51
- *
52
- * @since 150321 Adding hook API for plugins.
53
- *
54
- * @type HookApi Hook API class instance.
55
- */
56
- protected $hook_api; // Class instance.
57
-
58
- /**
59
- * Benchmark class instance.
60
- *
61
- * @since 150315 Adding additional benchmarks.
62
- *
63
- * @type Benchmark Filled by various methods.
64
- */
65
- protected $benchmark; // Class instance.
66
-
67
- /**
68
- * Compatible with PHP's `strtotime()` function.
69
- *
70
- * @since 140417 Initial release.
71
- *
72
- * @note This indicates how long cache files can live.
73
- *
74
- * @type string Set dynamically by class constructor.
75
- */
76
- protected $cache_expiration_time = '14 days';
77
-
78
- /**
79
- * Vendor-specific CSS prefixes (regex).
80
- *
81
- * @since 140417 Initial release.
82
- *
83
- * @type string Set dynamically by class constructor.
84
- */
85
- protected $regex_vendor_css_prefixes = '';
86
-
87
- /**
88
- * Default set of CSS exclusions (array).
89
- *
90
- * @since 140417 Initial release.
91
- *
92
- * @type array These are used if no option value is supplied to override them.
93
- */
94
- protected $default_vendor_css_prefixes = array(
95
- 'moz',
96
- 'webkit',
97
- 'khtml',
98
- 'ms',
99
- 'o',
100
- );
101
-
102
- /**
103
- * CSS exclusions (regex).
104
- *
105
- * @since 140417 Initial release.
106
- *
107
- * @type string Set dynamically by class constructor.
108
- */
109
- protected $regex_css_exclusions = '';
110
-
111
- /**
112
- * Default set of CSS exclusions (array).
113
- *
114
- * @since 140417 Initial release.
115
- *
116
- * @type array These are used if no option value is supplied to override them.
117
- */
118
- protected $default_css_exclusions = array();
119
-
120
- /**
121
- * Built-in CSS exclusions (regex).
122
- *
123
- * @since 140422 Changing the way CSS exclusions operate.
124
- *
125
- * @type string Set dynamically by class constructor.
126
- */
127
- protected $built_in_regex_css_exclusions = '';
128
-
129
- /**
130
- * A set of built-in CSS exclusions (regex patterns).
131
- *
132
- * @since 140422 Changing the way CSS exclusions operate.
133
- *
134
- * @type array These are on at all times; UNLESS options dictate otherwise.
135
- * To disable these built-in CSS exclusions pass the option
136
- * `disable_built_in_css_exclusions` as TRUE.
137
- *
138
- * @note These get converted to a regex pattern by the class constructor.
139
- * Reference {@link $built_in_regex_css_exclusions}.
140
- */
141
- protected $built_in_regex_css_exclusion_patterns = array(
142
- '\W#post\-[0-9]+\W',
143
- );
144
-
145
- /**
146
- * JS exclusions (regex).
147
- *
148
- * @since 140417 Initial release.
149
- *
150
- * @type string Set dynamically by class constructor.
151
- */
152
- protected $regex_js_exclusions = '';
153
-
154
- /**
155
- * Default set of JS exclusions (array).
156
- *
157
- * @since 140417 Initial release.
158
- *
159
- * @type array These are used if no option value is supplied to override them.
160
- */
161
- protected $default_js_exclusions = array(
162
- '.php?',
163
- );
164
-
165
- /**
166
- * Built-in JS exclusions (regex).
167
- *
168
- * @since 140422 Changing the way JS exclusions operate.
169
- *
170
- * @type string Set dynamically by class constructor.
171
- */
172
- protected $built_in_regex_js_exclusions = '';
173
-
174
- /**
175
- * A set of built-in JS exclusions (regex patterns).
176
- *
177
- * @since 140422 Changing the way JS exclusions operate.
178
- *
179
- * @type array These are on at all times; UNLESS options dictate otherwise.
180
- * To disable these built-in JS exclusions pass the option
181
- * `disable_built_in_js_exclusions` as TRUE.
182
- *
183
- * @note These get converted to a regex pattern by the class constructor.
184
- * Reference {@link $built_in_regex_js_exclusions}.
185
- */
186
- protected $built_in_regex_js_exclusion_patterns = array(
187
- '\.js#.',
188
- '\.google\-analytics\.com\/',
189
- '\Wga\s*\(',
190
- '\W_gaq\.push\s*\(',
191
- );
192
-
193
- /**
194
- * URI exclusions (regex).
195
- *
196
- * @since 160117 Adding URI exclusion support.
197
- *
198
- * @type string Set dynamically by class constructor.
199
- */
200
- protected $regex_uri_exclusions = '';
201
-
202
- /**
203
- * Default set of URI exclusions (array).
204
- *
205
- * @since 160117 Adding URI exclusion support.
206
- *
207
- * @type array These are used if no option value is supplied to override them.
208
- */
209
- protected $default_uri_exclusions = array();
210
-
211
- /**
212
- * Built-in URI exclusions (regex).
213
- *
214
- * @since 160117 Adding URI exclusion support.
215
- *
216
- * @type string Set dynamically by class constructor.
217
- */
218
- protected $built_in_regex_uri_exclusions = '';
219
-
220
- /**
221
- * A set of built-in URI exclusions (regex patterns).
222
- *
223
- * @since 160117 Adding URI exclusion support.
224
- *
225
- * @type array These are on at all times; UNLESS options dictate otherwise.
226
- * To disable these built-in URI exclusions pass the option
227
- * `disable_built_in_uri_exclusions` as TRUE.
228
- *
229
- * @note These get converted to a regex pattern by the class constructor.
230
- * Reference {@link $built_in_regex_uri_exclusions}.
231
- */
232
- protected $built_in_regex_uri_exclusion_patterns = array();
233
-
234
- /**
235
- * Current base HREF value.
236
- *
237
- * @since 140417 Initial release.
238
- *
239
- * @type string Set by various routines that work together.
240
- */
241
- protected $current_base = '';
242
-
243
- /**
244
- * Current CSS `@media` value.
245
- *
246
- * @since 140519 Improving CSS `@media` query support.
247
- *
248
- * @type string Set by various routines that work together.
249
- */
250
- protected $current_css_media = '';
251
-
252
- /**
253
- * Current global exclusion tokens.
254
- *
255
- * @since 150821 Adding global exclusion tokenizer.
256
- *
257
- * @type array Current global exclusion tokens.
258
- */
259
- protected $current_global_exclusion_tokens = array();
260
-
261
- /**
262
- * Static cache array for this class.
263
- *
264
- * @since 140417 Initial release.
265
- *
266
- * @type array Used by various routines for optimization.
267
- */
268
- protected static $static = array();
269
-
270
- /**
271
- * Data cache for this class instance.
272
- *
273
- * @since 140417 Initial release.
274
- *
275
- * @type array Used by various routines for optimization.
276
- */
277
- protected $cache = array();
278
-
279
- /********************************************************************************************************/
280
-
281
- /*
282
- * Constructor (Accepts Options)
283
- */
284
-
285
- /**
286
- * Class Constructor.
287
- *
288
- * Full instructions and all `$options` are listed in the
289
- * [README.md](http://github.com/WebSharks/HTML-Compressor) file.
290
- * See: <http://github.com/WebSharks/HTML-Compressor>
291
- *
292
- * @since 140417 Initial release.
293
- *
294
- * @api Constructor is available for public use.
295
- *
296
- * @param array $options Optional array of instance options.
297
- * Check README.md for a list of all possible option keys.
298
- * See: <http://github.com/websharks/html-compressor>
299
- */
300
- public function __construct(array $options = array())
301
- {
302
- # Set Options
303
-
304
- $this->options = $options; // Config.
305
-
306
- # Benchmark and Hook API instances.
307
-
308
- $this->benchmark = new Benchmark();
309
- $this->hook_api = new HookApi();
310
-
311
- # Product Title; i.e., White-Label HTML Compressor
312
-
313
- if (!empty($this->options['product_title']) && is_string($this->options['product_title'])) {
314
- $this->product_title = (string) $this->options['product_title'];
315
- }
316
-
317
- # Cache Expiration Time Configuration
318
-
319
- if (!empty($this->options['cache_expiration_time']) && is_string($this->options['cache_expiration_time'])) {
320
- $this->cache_expiration_time = (string) $this->options['cache_expiration_time'];
321
- }
322
-
323
- # Vendor-Specific CSS Prefixes
324
-
325
- if (isset($this->options['vendor_css_prefixes']) && is_array($this->options['vendor_css_prefixes'])) {
326
- $this->regex_vendor_css_prefixes = implode('|', $this->pregQuoteDeep($this->options['vendor_css_prefixes'], '/'));
327
- } else {
328
- $this->regex_vendor_css_prefixes = implode('|', $this->pregQuoteDeep($this->default_vendor_css_prefixes, '/'));
329
- }
330
-
331
- # CSS Exclusions (If Applicable)
332
-
333
- if (isset($this->options['regex_css_exclusions']) && is_string($this->options['regex_css_exclusions'])) {
334
- $this->regex_css_exclusions = $this->options['regex_css_exclusions'];
335
- } elseif (isset($this->options['css_exclusions']) && is_array($this->options['css_exclusions'])) {
336
- if ($this->options['css_exclusions']) {
337
- $this->regex_css_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->options['css_exclusions'], '/')).'/i';
338
- }
339
- } elseif ($this->default_css_exclusions) {
340
- $this->regex_css_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->default_css_exclusions, '/')).'/i';
341
- }
342
- if ($this->built_in_regex_css_exclusion_patterns && empty($this->options['disable_built_in_css_exclusions'])) {
343
- $this->built_in_regex_css_exclusions = '/'.implode('|', $this->built_in_regex_css_exclusion_patterns).'/i';
344
- }
345
-
346
- # JavaScript Exclusions (If Applicable)
347
-
348
- if (isset($this->options['regex_js_exclusions']) && is_string($this->options['regex_js_exclusions'])) {
349
- $this->regex_js_exclusions = $this->options['regex_js_exclusions'];
350
- } elseif (isset($this->options['js_exclusions']) && is_array($this->options['js_exclusions'])) {
351
- if ($this->options['js_exclusions']) {
352
- $this->regex_js_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->options['js_exclusions'], '/')).'/i';
353
- }
354
- } elseif ($this->default_js_exclusions) {
355
- $this->regex_js_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->default_js_exclusions, '/')).'/i';
356
- }
357
- if ($this->built_in_regex_js_exclusion_patterns && empty($this->options['disable_built_in_js_exclusions'])) {
358
- $this->built_in_regex_js_exclusions = '/'.implode('|', $this->built_in_regex_js_exclusion_patterns).'/i';
359
- }
360
-
361
- # URI Exclusions; i.e., Exclude from Everything (If Applicable)
362
-
363
- if (isset($this->options['regex_uri_exclusions']) && is_string($this->options['regex_uri_exclusions'])) {
364
- $this->regex_uri_exclusions = $this->options['regex_uri_exclusions'];
365
- } elseif (isset($this->options['uri_exclusions']) && is_array($this->options['uri_exclusions'])) {
366
- if ($this->options['uri_exclusions']) {
367
- $this->regex_uri_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->options['uri_exclusions'], '/')).'/i';
368
- }
369
- } elseif ($this->default_uri_exclusions) {
370
- $this->regex_uri_exclusions = '/'.implode('|', $this->pregQuoteDeep($this->default_uri_exclusions, '/')).'/i';
371
- }
372
- if ($this->built_in_regex_uri_exclusion_patterns && empty($this->options['disable_built_in_uri_exclusions'])) {
373
- $this->built_in_regex_uri_exclusions = '/'.implode('|', $this->built_in_regex_uri_exclusion_patterns).'/i';
374
- }
375
- }
376
-
377
- /********************************************************************************************************/
378
-
379
- /*
380
- * Public API Methods
381
- */
382
-
383
- /**
384
- * Handles compression. The heart of this class.
385
- *
386
- * Full instructions and all `$options` are listed in the
387
- * [README.md](http://github.com/WebSharks/HTML-Compressor) file.
388
- * See: <http://github.com/WebSharks/HTML-Compressor>
389
- *
390
- * @since 140417 Initial release.
391
- *
392
- * @api This method is available for public use.
393
- *
394
- * @param string $input The input passed into this routine.
395
- *
396
- * @return string Compressed HTML code (if at all possible). Note that `$input` must be HTML code.
397
- * i.e. It must contain a closing `</html>` tag; otherwise no compression will occur.
398
- */
399
- public function compress($input)
400
- {
401
- if (!($input = trim((string) $input))) {
402
- return $input; // Nothing to do.
403
- }
404
- if (stripos($input, '</html>') === false) {
405
- return $input; // Not an HTML doc.
406
- }
407
- if ($this->isCurrentUrlUriExcluded()) {
408
- return $input; // Nothing to do.
409
- }
410
- if (($benchmark = !empty($this->options['benchmark']))) {
411
- $time = microtime(true);
412
- }
413
- $html = &$input; // Let's call this HTML now.
414
- $html = $this->tokenizeGlobalExclusions($html);
415
- $html = $this->maybeCompressCombineHeadBodyCss($html);
416
- $html = $this->maybeCompressCombineHeadJs($html);
417
- $html = $this->maybeCompressCombineFooterJs($html);
418
- $html = $this->maybeCompressInlineJsCode($html);
419
- $html = $this->maybeCompressInlineJsonCode($html);
420
- $html = $this->restoreGlobalExclusions($html);
421
- $html = $this->maybeCompressHtmlCode($html);
422
-
423
- if (!isset($this->options['cleanup_cache_dirs']) || $this->options['cleanup_cache_dirs']) {
424
- if (mt_rand(1, 20) === 1) {
425
- $this->cleanupCacheDirs();
426
- }
427
- }
428
- if ($benchmark && !empty($time)) {
429
- $time = number_format(microtime(true) - $time, 5, '.', '');
430
-
431
- if ($this->benchmark->times) {
432
- $html .= "\n";
433
- }
434
- foreach ($this->benchmark->times as $_benchmark_time) {
435
- $html .= "\n".'<!-- '.sprintf(
436
- '%1$s took %2$s seconds %3$s.',
437
- htmlspecialchars($this->product_title),
438
- htmlspecialchars($_benchmark_time['time']),
439
- htmlspecialchars($_benchmark_time['task'])
440
- ).' -->';
441
- }
442
- unset($_benchmark_time); // Housekeeping.
443
-
444
- $html .= "\n\n".'<!-- '.sprintf(
445
- '%1$s took %2$s seconds (overall).',
446
- htmlspecialchars($this->product_title),
447
- htmlspecialchars($time)
448
- ).' -->';
449
- }
450
- return $html; // HTML markup.
451
- }
452
-
453
- /********************************************************************************************************/
454
-
455
- /*
456
- * Other API/Magic Methods
457
- */
458
-
459
- /**
460
- * Magic method for access to read-only properties.
461
- *
462
- * @since 140418 Initial release.
463
- *
464
- * @param string $property Propery by name.
465
- *
466
- * @throws \Exception If `$property` does not exist for any reason.
467
- *
468
- * @return mixed Property value.
469
- *
470
- * @internal For internal magic use only.
471
- */
472
- public function __get($property)
473
- {
474
- $property = (string) $property;
475
-
476
- if (property_exists($this, $property)) {
477
- return $this->{$property};
478
- }
479
- throw new \Exception(sprintf('Undefined property: `%1$s`.', $property));
480
- }
481
-
482
- /********************************************************************************************************/
483
-
484
- /*
485
- * Exclusion-Related Methods
486
- */
487
-
488
- /**
489
- * Global exclusion tokenizer.
490
- *
491
- * @since 150821 Adding global exclusion tokenizer.
492
- *
493
- * @param string $html Input HTML code.
494
- *
495
- * @return string HTML code, after tokenizing exclusions.
496
- */
497
- protected function tokenizeGlobalExclusions($html)
498
- {
499
- $html = (string) $html;
500
- $_this = $this;
501
- $global_exclusions = array(
502
- '/\<noscript(?:\s[^>]*)?\>.*?\<\/noscript\>/is',
503
- );
504
- $html = preg_replace_callback(
505
- $global_exclusions,
506
- function ($m) use ($_this) {
507
- $_this->current_global_exclusion_tokens[] = $m[0]; // Tokenize.
508
- return '<htmlc-gxt-'.(count($_this->current_global_exclusion_tokens) - 1).' />';
509
- },
510
- $html // Exclusions replaced by tokens.
511
- );
512
- return $html;
513
- }
514
-
515
- /**
516
- * Restore global exclusions.
517
- *
518
- * @since 150821 Adding global exclusion tokenizer.
519
- *
520
- * @param string $html Input HTML code.
521
- *
522
- * @return string HTML code, after restoring exclusions.
523
- */
524
- protected function restoreGlobalExclusions($html)
525
- {
526
- $html = (string) $html;
527
-
528
- if (!$this->current_global_exclusion_tokens) {
529
- return $html; // Nothing to restore.
530
- }
531
- if (stripos($html, '<htmlc-gxt-') === false) {
532
- return $html; // Nothing to restore.
533
- }
534
- foreach (array_reverse($this->current_global_exclusion_tokens, true) as $_token => $_value) {
535
- // Must go in reverse order so nested tokens unfold properly.
536
- $html = str_ireplace('<htmlc-gxt-'.$_token.' />', $_value, $html);
537
- }
538
- unset($_token, $_value); // Housekeeping.
539
- $this->current_global_exclusion_tokens = array();
540
-
541
- return $html;
542
- }
543
-
544
- /********************************************************************************************************/
545
-
546
- /*
547
- * CSS-Related Methods
548
- * ~ See also: CSS Compression Utilities
549
- */
550
-
551
- /**
552
- * Handles possible compression of head/body CSS.
553
- *
554
- * @since 140417 Initial release.
555
- *
556
- * @param string $html Input HTML code.
557
- *
558
- * @return string HTML code, after possible CSS compression.
559
- */
560
- protected function maybeCompressCombineHeadBodyCss($html)
561
- {
562
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
563
- $time = microtime(true);
564
- }
565
- $html = (string) $html; // Force string value.
566
-
567
- if (isset($this->options['compress_combine_head_body_css'])) {
568
- if (!$this->options['compress_combine_head_body_css']) {
569
- $disabled = true; // Disabled flag.
570
- }
571
- }
572
- if (!$html || !empty($disabled)) {
573
- goto finale; // Nothing to do.
574
- }
575
- if (($html_frag = $this->getHtmlFrag($html)) && ($head_frag = $this->getHeadFrag($html))) {
576
- if (($css_tag_frags = $this->getCssTagFrags($html_frag)) && ($css_parts = $this->compileCssTagFragsIntoParts($css_tag_frags, 'head'))) {
577
- $css_tag_frags_all_compiled = $this->compileKeyElementsDeep($css_tag_frags, 'all');
578
- $html = $this->replaceOnce($head_frag['all'], '%%htmlc-head%%', $html);
579
- $html = $this->replaceOnce($css_tag_frags_all_compiled, '', $html);
580
- $cleaned_head_contents = $this->replaceOnce($css_tag_frags_all_compiled, '', $head_frag['contents']);
581
- $cleaned_head_contents = $this->cleanupSelfClosingHtmlTagLines($cleaned_head_contents);
582
-
583
- $compressed_css_tags = array(); // Initialize.
584
-
585
- foreach ($css_parts as $_css_part) {
586
- if (isset($_css_part['exclude_frag'], $css_tag_frags[$_css_part['exclude_frag']]['all'])) {
587
- $compressed_css_tags[] = $css_tag_frags[$_css_part['exclude_frag']]['all'];
588
- } else {
589
- $compressed_css_tags[] = $_css_part['tag'];
590
- }
591
- }
592
- unset($_css_part); // Housekeeping.
593
-
594
- $compressed_css_tags = implode("\n", $compressed_css_tags);
595
- $compressed_head_parts = array($head_frag['open_tag'], $cleaned_head_contents, $compressed_css_tags, $head_frag['closing_tag']);
596
- $html = $this->replaceOnce('%%htmlc-head%%', implode("\n", $compressed_head_parts), $html);
597
-
598
- if ($benchmark) {
599
- $this->benchmark->addData(
600
- __FUNCTION__,
601
- compact(
602
- 'head_frag',
603
- 'css_tag_frags',
604
- 'css_parts',
605
- 'cleaned_head_contents',
606
- 'compressed_css_tags',
607
- 'compressed_head_parts'
608
- )
609
- );
610
- }
611
- }
612
- }
613
- finale: // Target point; finale/return value.
614
-
615
- if ($html) {
616
- $html = trim($html);
617
- } // Trim it up now!
618
-
619
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
620
- $this->benchmark->addTime(
621
- __FUNCTION__,
622
- $time, // Caller, start time, task performed.
623
- sprintf('compressing/combining head/body CSS in checksum: `%1$s`', md5($html))
624
- );
625
- }
626
- return $html; // With possible compression having been applied here.
627
- }
628
-
629
- /**
630
- * Compiles CSS tag fragments into CSS parts with compression.
631
- *
632
- * @since 140417 Initial release.
633
- *
634
- * @param array $css_tag_frags CSS tag fragments.
635
- * @param string $for Where will these parts go? One of `head`, `body`, `foot`.
636
- *
637
- * @throws \Exception If unable to cache CSS parts.
638
- *
639
- * @return array Array of CSS parts, else an empty array on failure.
640
- */
641
- protected function compileCssTagFragsIntoParts(array $css_tag_frags, $for)
642
- {
643
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
644
- $time = microtime(true);
645
- }
646
- $for = (string) $for; // Force string.
647
- $css_parts = array(); // Initialize.
648
- $css_parts_checksum = ''; // Initialize.
649
-
650
- if (!$css_tag_frags) {
651
- goto finale; // Nothing to do.
652
- }
653
- $css_parts_checksum = $this->getTagFragsChecksum($css_tag_frags);
654
- $public_cache_dir = $this->cacheDir($this::DIR_PUBLIC_TYPE, $css_parts_checksum);
655
- $private_cache_dir = $this->cacheDir($this::DIR_PRIVATE_TYPE, $css_parts_checksum);
656
- $public_cache_dir_url = $this->cacheDirUrl($this::DIR_PUBLIC_TYPE, $css_parts_checksum);
657
-
658
- $cache_parts_file = $css_parts_checksum.'-compressor-parts.css-cache';
659
- $cache_parts_file_path = $private_cache_dir.'/'.$cache_parts_file;
660
- $cache_parts_file_path_tmp = $cache_parts_file_path.'.'.uniqid('', true).'.tmp';
661
- // Cache file creation is atomic; i.e. tmp file w/ rename.
662
-
663
- $cache_part_file = '%%code-checksum%%-compressor-part.css';
664
- $cache_part_file_path = $public_cache_dir.'/'.$cache_part_file;
665
- $cache_part_file_url = $public_cache_dir_url.'/'.$cache_part_file;
666
-
667
- if (is_file($cache_parts_file_path) && filemtime($cache_parts_file_path) > strtotime('-'.$this->cache_expiration_time)) {
668
- if (is_array($cached_parts = unserialize(file_get_contents($cache_parts_file_path)))) {
669
- $css_parts = $cached_parts; // Use cached parts.
670
- goto finale; // Using the cache; all done here.
671
- }
672
- }
673
- $_css_part = 0; // Initialize part counter.
674
- $_last_css_tag_frag_media = 'all'; // Initialize.
675
-
676
- foreach ($css_tag_frags as $_css_tag_frag_pos => $_css_tag_frag) {
677
- if ($_css_tag_frag['exclude']) {
678
- if ($_css_tag_frag['link_href'] || $_css_tag_frag['style_css']) {
679
- if ($css_parts) {
680
- ++$_css_part; // Starts new part.
681
- }
682
- $css_parts[$_css_part]['tag'] = '';
683
- $css_parts[$_css_part]['exclude_frag'] = $_css_tag_frag_pos;
684
- ++$_css_part; // Always indicates a new part in the next iteration.
685
- }
686
- } elseif ($_css_tag_frag['link_href']) {
687
- if (($_css_tag_frag['link_href'] = $this->resolveRelativeUrl($_css_tag_frag['link_href']))) {
688
- if (($_css_code = $this->stripUtf8Bom($this->mustGetUrl($_css_tag_frag['link_href'])))) {
689
- $_css_code = $this->resolveCssRelatives($_css_code, $_css_tag_frag['link_href']);
690
- $_css_code = $this->resolveResolvedCssImports($_css_code, $_css_tag_frag['media']);
691
-
692
- if ($_css_code) {
693
- if ($_css_tag_frag['media'] !== $_last_css_tag_frag_media) {
694
- ++$_css_part; // Starts new part; different `@media` spec here.
695
- } elseif (!empty($css_parts[$_css_part]['code']) && stripos($css_parts[$_css_part]['code'], '@import') !== false) {
696
- ++$_css_part; // Starts new part; existing code contains an @import.
697
- }
698
- $css_parts[$_css_part]['media'] = $_css_tag_frag['media'];
699
-
700
- if (!empty($css_parts[$_css_part]['code'])) {
701
- $css_parts[$_css_part]['code'] .= "\n\n".$_css_code;
702
- } else {
703
- $css_parts[$_css_part]['code'] = $_css_code;
704
- }
705
- }
706
- }
707
- }
708
- } elseif ($_css_tag_frag['style_css']) {
709
- $_css_code = $_css_tag_frag['style_css'];
710
- $_css_code = $this->stripUtf8Bom($_css_code);
711
- $_css_code = $this->resolveCssRelatives($_css_code);
712
- $_css_code = $this->resolveResolvedCssImports($_css_code, $_css_tag_frag['media']);
713
-
714
- if ($_css_code) {
715
- if ($_css_tag_frag['media'] !== $_last_css_tag_frag_media) {
716
- ++$_css_part; // Starts new part; different `@media` spec here.
717
- } elseif (!empty($css_parts[$_css_part]['code']) && stripos($css_parts[$_css_part]['code'], '@import') !== false) {
718
- ++$_css_part; // Starts new part; existing code contains an @import.
719
- }
720
- $css_parts[$_css_part]['media'] = $_css_tag_frag['media'];
721
-
722
- if (!empty($css_parts[$_css_part]['code'])) {
723
- $css_parts[$_css_part]['code'] .= "\n\n".$_css_code;
724
- } else {
725
- $css_parts[$_css_part]['code'] = $_css_code;
726
- }
727
- }
728
- }
729
- $_last_css_tag_frag_media = $_css_tag_frag['media'];
730
- }
731
- unset($_css_part, $_last_css_tag_frag_media, $_css_tag_frag_pos, $_css_tag_frag, $_css_code);
732
-
733
- foreach (array_keys($css_parts = array_values($css_parts)) as $_css_part) {
734
- if (!isset($css_parts[$_css_part]['exclude_frag']) && !empty($css_parts[$_css_part]['code'])) {
735
- $_css_media = 'all'; // Default media value; i.e., `all` media queries.
736
- if (!empty($css_parts[$_css_part]['media'])) {
737
- $_css_media = $css_parts[$_css_part]['media'];
738
- }
739
- $_css_code = $css_parts[$_css_part]['code'];
740
- $_css_code = $this->moveSpecialCssAtRulesToTop($_css_code);
741
- $_css_code = $this->stripPrependCssCharsetUtf8($_css_code);
742
- $_css_code = $this->forceAbsRelativePathsInCss($_css_code);
743
- $_css_code = $this->maybeFilterCssUrls($_css_code);
744
- $_css_code_cs = md5($_css_code); // Before compression.
745
- $_css_code = $this->maybeCompressCssCode($_css_code);
746
-
747
- $_css_code_path = str_replace('%%code-checksum%%', $_css_code_cs, $cache_part_file_path);
748
- $_css_code_url = str_replace('%%code-checksum%%', $_css_code_cs, $cache_part_file_url);
749
- $_css_code_url = $this->hook_api->applyFilters('part_url', $_css_code_url, $for);
750
- $_css_code_path_tmp = $_css_code_path.'.'.uniqid('', true).'.tmp';
751
- // Cache file creation is atomic; i.e. tmp file w/ rename.
752
-
753
- if (!(file_put_contents($_css_code_path_tmp, $_css_code) && rename($_css_code_path_tmp, $_css_code_path))) {
754
- throw new \Exception(sprintf('Unable to cache CSS code file: `%1$s`.', $_css_code_path));
755
- }
756
- $css_parts[$_css_part]['tag'] = '<link type="text/css" rel="stylesheet" href="'.htmlspecialchars($_css_code_url, ENT_QUOTES).'" media="'.htmlspecialchars($_css_media, ENT_QUOTES).'" />';
757
-
758
- unset($css_parts[$_css_part]['code']); // Ditch this; no need to cache this code too.
759
- }
760
- }
761
- unset($_css_part, $_css_media, $_css_code, $_css_code_cs, $_css_code_path, $_css_code_path_tmp, $_css_code_url);
762
-
763
- if (!(file_put_contents($cache_parts_file_path_tmp, serialize($css_parts)) && rename($cache_parts_file_path_tmp, $cache_parts_file_path))) {
764
- throw new \Exception(sprintf('Unable to cache CSS parts into: `%1$s`.', $cache_parts_file_path));
765
- }
766
- finale: // Target point; finale/return value.
767
-
768
- if ($benchmark && !empty($time) && $css_parts_checksum) {
769
- $this->benchmark->addTime(
770
- __FUNCTION__,
771
- $time, // Caller, start time, task performed.
772
- sprintf('building parts based on CSS tag frags in checksum: `%1$s`', $css_parts_checksum)
773
- );
774
- }
775
- return $css_parts;
776
- }
777
-
778
- /**
779
- * Parses and returns an array of CSS tag fragments.
780
- *
781
- * @since 140417 Initial release.
782
- *
783
- * @param array $html_frag An HTML tag fragment array.
784
- *
785
- * @return array An array of CSS tag fragments (ready to be converted into CSS parts).
786
- * Else an empty array (i.e. no CSS tag fragments in the HTML fragment array).
787
- *
788
- * @see http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
789
- * @see http://stackoverflow.com/a/12102131
790
- */
791
- protected function getCssTagFrags(array $html_frag)
792
- {
793
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
794
- $time = microtime(true);
795
- }
796
- $css_tag_frags = array(); // Initialize.
797
-
798
- if (!$html_frag) {
799
- goto finale; // Nothing to do.
800
- }
801
- $regex = '/(?P<all>'.// Entire match.
802
- '(?P<if_open_tag>\<\![^[>]*?\[if\W[^\]]*?\][^>]*?\>\s*)?'.
803
- '(?:(?P<link_self_closing_tag>\<link(?:\s+[^>]*?)?\>)'.// Or a <style></style> tag.
804
- '|(?P<style_open_tag>\<style(?:\s+[^>]*?)?\>)(?P<style_css>.*?)(?P<style_closing_tag>\<\/style\>))'.
805
- '(?P<if_closing_tag>\s*\<\![^[>]*?\[endif\][^>]*?\>)?'.
806
- ')/is'; // Dot matches line breaks.
807
-
808
- if (!empty($html_frag['contents']) && preg_match_all($regex, $html_frag['contents'], $_tag_frags, PREG_SET_ORDER)) {
809
- foreach ($_tag_frags as $_tag_frag) {
810
- $_link_href = $_style_css = $_media = ''; // Initialize.
811
-
812
- if (($_link_href = $this->getLinkCssHref($_tag_frag, true))) {
813
- $_media = $this->getLinkCssMedia($_tag_frag, false);
814
- } elseif (($_style_css = $this->getStyleCss($_tag_frag, true))) {
815
- $_media = $this->getStyleCssMedia($_tag_frag, false);
816
- }
817
- if ($_link_href || $_style_css) {
818
- $css_tag_frags[] = array(
819
- 'all' => $_tag_frag['all'],
820
-
821
- 'if_open_tag' => isset($_tag_frag['if_open_tag']) ? $_tag_frag['if_open_tag'] : '',
822
- 'if_closing_tag' => isset($_tag_frag['if_closing_tag']) ? $_tag_frag['if_closing_tag'] : '',
823
-
824
- 'link_self_closing_tag' => isset($_tag_frag['link_self_closing_tag']) ? $_tag_frag['link_self_closing_tag'] : '',
825
- 'link_href_external' => ($_link_href) ? $this->isUrlExternal($_link_href) : false,
826
- 'link_href' => $_link_href, // This could also be empty.
827
-
828
- 'style_open_tag' => isset($_tag_frag['style_open_tag']) ? $_tag_frag['style_open_tag'] : '',
829
- 'style_css' => $_style_css, // This could also be empty.
830
- 'style_closing_tag' => isset($_tag_frag['style_closing_tag']) ? $_tag_frag['style_closing_tag'] : '',
831
-
832
- 'media' => $_media ? $_media : 'all', // Default value.
833
-
834
- 'exclude' => false, // Default value.
835
- );
836
- $_tag_frag_r = &$css_tag_frags[count($css_tag_frags) - 1];
837
-
838
- if ($_tag_frag_r['if_open_tag'] || $_tag_frag_r['if_closing_tag']) {
839
- $_tag_frag_r['exclude'] = true;
840
- } elseif ($_tag_frag_r['link_href'] && $_tag_frag_r['link_href_external'] && isset($this->options['compress_combine_remote_css_js']) && !$this->options['compress_combine_remote_css_js']) {
841
- $_tag_frag_r['exclude'] = true;
842
- } elseif ($this->regex_css_exclusions && preg_match($this->regex_css_exclusions, $_tag_frag_r['link_href'].$_tag_frag_r['style_css'])) {
843
- $_tag_frag_r['exclude'] = true;
844
- } elseif ($this->built_in_regex_css_exclusions && preg_match($this->built_in_regex_css_exclusions, $_tag_frag_r['link_href'].$_tag_frag_r['style_css'])) {
845
- $_tag_frag_r['exclude'] = true;
846
- }
847
- }
848
- }
849
- }
850
- unset($_tag_frags, $_tag_frag, $_tag_frag_r, $_link_href, $_style_css, $_media);
851
-
852
- finale: // Target point; finale/return value.
853
-
854
- if ($benchmark && !empty($time) && $html_frag) {
855
- $this->benchmark->addTime(
856
- __FUNCTION__,
857
- $time, // Caller, start time, task performed.
858
- sprintf('compiling CSS tag frags in checksum: `%1$s`', md5(serialize($html_frag)))
859
- );
860
- }
861
- return $css_tag_frags;
862
- }
863
-
864
- /**
865
- * Test a tag fragment to see if it's CSS.
866
- *
867
- * @since 140922 Improving tag tests.
868
- *
869
- * @param array $tag_frag A tag fragment.
870
- *
871
- * @return bool TRUE if it contains CSS.
872
- */
873
- protected function isLinkTagFragCss(array $tag_frag)
874
- {
875
- if (empty($tag_frag['link_self_closing_tag'])) {
876
- return false; // Nope; missing tag.
877
- }
878
- $type = $rel = ''; // Initialize.
879
-
880
- if (stripos($tag_frag['link_self_closing_tag'], 'type') !== 0) {
881
- if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['link_self_closing_tag'], $_m)) {
882
- $type = $_m['value'];
883
- }
884
- }
885
- unset($_m); // Just a little housekeeping.
886
-
887
- if (stripos($tag_frag['link_self_closing_tag'], 'rel') !== 0) {
888
- if (preg_match('/\srel\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['link_self_closing_tag'], $_m)) {
889
- $rel = $_m['value'];
890
- }
891
- }
892
- unset($_m); // Just a little housekeeping.
893
-
894
- if ($type && stripos($type, 'css') === false) {
895
- return false; // Not CSS.
896
- }
897
- if ($rel && stripos($rel, 'stylesheet') === false) {
898
- return false; // Not CSS.
899
- }
900
- return true; // Yes, this is CSS.
901
- }
902
-
903
- /**
904
- * Test a tag fragment to see if it's CSS.
905
- *
906
- * @since 140922 Improving tag tests.
907
- *
908
- * @param array $tag_frag A tag fragment.
909
- *
910
- * @return bool TRUE if it contains CSS.
911
- */
912
- protected function isStyleTagFragCss(array $tag_frag)
913
- {
914
- if (empty($tag_frag['style_open_tag']) || empty($tag_frag['style_closing_tag'])) {
915
- return false; // Nope; missing open|closing tag.
916
- }
917
- $type = ''; // Initialize.
918
-
919
- if (stripos($tag_frag['style_open_tag'], 'type') !== 0) {
920
- if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['style_open_tag'], $_m)) {
921
- $type = $_m['value'];
922
- }
923
- }
924
- unset($_m); // Just a little housekeeping.
925
-
926
- if ($type && stripos($type, 'css') === false) {
927
- return false; // Not CSS.
928
- }
929
- return true; // Yes, this is CSS.
930
- }
931
-
932
- /**
933
- * Get a CSS link href value from a tag fragment.
934
- *
935
- * @since 140417 Initial release.
936
- *
937
- * @param array $tag_frag A CSS tag fragment.
938
- * @param bool $test_for_css Defaults to a TRUE value.
939
- * If TRUE, we will test tag fragment to make sure it's CSS.
940
- *
941
- * @return string The link href value if possible; else an empty string.
942
- */
943
- protected function getLinkCssHref(array $tag_frag, $test_for_css = true)
944
- {
945
- if ($test_for_css && !$this->isLinkTagFragCss($tag_frag)) {
946
- return ''; // This tag does not contain CSS.
947
- }
948
- if (preg_match('/\shref\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['link_self_closing_tag'], $_m)) {
949
- return trim($this->nUrlAmps($_m['value']));
950
- }
951
- unset($_m); // Just a little housekeeping.
952
-
953
- return ''; // Unable to find an `href` attribute value.
954
- }
955
-
956
- /**
957
- * Get a CSS link media rule from a tag fragment.
958
- *
959
- * @since 140417 Initial release.
960
- *
961
- * @param array $tag_frag A CSS tag fragment.
962
- * @param bool $test_for_css Defaults to a TRUE value.
963
- * If TRUE, we will test tag fragment to make sure it's CSS.
964
- *
965
- * @return string The link media value if possible; else an empty string.
966
- */
967
- protected function getLinkCssMedia(array $tag_frag, $test_for_css = true)
968
- {
969
- if ($test_for_css && !$this->isLinkTagFragCss($tag_frag)) {
970
- return ''; // This tag does not contain CSS.
971
- }
972
- if (preg_match('/\smedia\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['link_self_closing_tag'], $_m)) {
973
- return trim(strtolower($_m['value']));
974
- }
975
- unset($_m); // Just a little housekeeping.
976
-
977
- return ''; // Unable to find a `media` attribute value.
978
- }
979
-
980
- /**
981
- * Get a CSS style media rule from a tag fragment.
982
- *
983
- * @since 140417 Initial release.
984
- *
985
- * @param array $tag_frag A CSS tag fragment.
986
- * @param bool $test_for_css Defaults to a TRUE value.
987
- * If TRUE, we will test tag fragment to make sure it's CSS.
988
- *
989
- * @return string The style media value if possible; else an empty string.
990
- */
991
- protected function getStyleCssMedia(array $tag_frag, $test_for_css = true)
992
- {
993
- if ($test_for_css && !$this->isStyleTagFragCss($tag_frag)) {
994
- return ''; // This tag does not contain CSS.
995
- }
996
- if (preg_match('/\smedia\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['style_open_tag'], $_m)) {
997
- return trim(strtolower($_m['value']));
998
- }
999
- unset($_m); // Just a little housekeeping.
1000
-
1001
- return ''; // Unable to find a `media` attribute value.
1002
- }
1003
-
1004
- /**
1005
- * Get style CSS from a CSS tag fragment.
1006
- *
1007
- * @since 140417 Initial release.
1008
- *
1009
- * @param array $tag_frag A CSS tag fragment.
1010
- * @param bool $test_for_css Defaults to a TRUE value.
1011
- * If TRUE, we will test tag fragment to make sure it's CSS.
1012
- *
1013
- * @return string The style CSS code (if possible); else an empty string.
1014
- */
1015
- protected function getStyleCss(array $tag_frag, $test_for_css = true)
1016
- {
1017
- if (empty($tag_frag['style_css'])) {
1018
- return ''; // Not possible; no CSS code.
1019
- }
1020
- if ($test_for_css && !$this->isStyleTagFragCss($tag_frag)) {
1021
- return ''; // This tag does not contain CSS.
1022
- }
1023
- return trim($tag_frag['style_css']); // CSS code.
1024
- }
1025
-
1026
- /**
1027
- * Strip existing charset rules from CSS code.
1028
- *
1029
- * @since 140417 Initial release.
1030
- *
1031
- * @param string $css CSS code.
1032
- *
1033
- * @return string CSS after having stripped away existing charset rules.
1034
- */
1035
- protected function stripExistingCssCharsets($css)
1036
- {
1037
- if (!($css = (string) $css)) {
1038
- return $css; // Nothing to do.
1039
- }
1040
- $css = preg_replace('/@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?charset(?:\s+[^;]*?)?;/i', '', $css);
1041
- if ($css) {
1042
- $css = trim($css);
1043
- }
1044
- return $css;
1045
- }
1046
-
1047
- /**
1048
- * Strip existing charsets and add a UTF-8 `@charset` rule.
1049
- *
1050
- * @since 140417 Initial release.
1051
- *
1052
- * @param string $css CSS code.
1053
- *
1054
- * @return string CSS code (possibly with a prepended UTF-8 charset rule).
1055
- */
1056
- protected function stripPrependCssCharsetUtf8($css)
1057
- {
1058
- if (!($css = (string) $css)) {
1059
- return $css; // Nothing to do.
1060
- }
1061
- $css = $this->stripExistingCssCharsets($css);
1062
- if ($css) {
1063
- $css = '@charset "UTF-8";'."\n".$css;
1064
- }
1065
- return $css;
1066
- }
1067
-
1068
- /**
1069
- * Moves special CSS `@rules` to the top.
1070
- *
1071
- * @since 140417 Initial release.
1072
- *
1073
- * @param string $css CSS code.
1074
- * @param int $___recursion Internal use only.
1075
- *
1076
- * @return string CSS code after having moved special `@rules` to the top.
1077
- *
1078
- * @see <https://developer.mozilla.org/en-US/docs/Web/CSS/@charset>
1079
- * @see <http://stackoverflow.com/questions/11746581/nesting-media-rules-in-css>
1080
- */
1081
- protected function moveSpecialCssAtRulesToTop($css, $___recursion = 0)
1082
- {
1083
- if (!($css = (string) $css)) {
1084
- return $css; // Nothing to do.
1085
- }
1086
- $max_recursions = 2; // `preg_match_all()` calls.
1087
- if ($___recursion >= $max_recursions) {
1088
- return $css; // All done.
1089
- }
1090
- if (stripos($css, 'charset') === false && stripos($css, 'import') === false) {
1091
- return $css; // Save some time. Nothing to do here.
1092
- }
1093
- if (preg_match_all('/(?P<rule>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?charset(?:\s+[^;]*?)?;)/i', $css, $rules, PREG_SET_ORDER)
1094
- || preg_match_all('/(?P<rule>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import(?:\s+[^;]*?)?;)/i', $css, $rules, PREG_SET_ORDER)
1095
- ) { // Searched in a specific order. Recursion dictates a precise order.
1096
- $top_rules = array(); // Initialize.
1097
- foreach ($rules as $_rule) {
1098
- $top_rules[] = $_rule['rule'];
1099
- }
1100
- unset($_rule); // Just a little housekeeping.
1101
-
1102
- $css = $this->replaceOnce($top_rules, '', $css);
1103
- $css = $this->moveSpecialCssAtRulesToTop($css, $___recursion + 1);
1104
- $css = implode("\n\n", $top_rules)."\n\n".$css;
1105
- }
1106
- return $css; // With special `@rules` to the top.
1107
- }
1108
-
1109
- /**
1110
- * Resolves `@import` rules in CSS code recursively.
1111
- *
1112
- * @since 140417 Initial release.
1113
- *
1114
- * @param string $css CSS code.
1115
- * @param string $media Current media specification.
1116
- * @param bool $___recursion Internal use only.
1117
- *
1118
- * @return string CSS code after all `@import` rules have been resolved recursively.
1119
- */
1120
- protected function resolveResolvedCssImports($css, $media, $___recursion = false)
1121
- {
1122
- if (!($css = (string) $css)) {
1123
- return $css; // Nothing to do.
1124
- }
1125
- $media = $this->current_css_media = (string) $media;
1126
- if (!$media) {
1127
- $media = $this->current_css_media = 'all';
1128
- }
1129
- $import_media_without_url_regex = '/@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s*(["\'])(?P<url>.+?)\\1(?P<media>[^;]*?);/i';
1130
- $import_media_with_url_regex = '/@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s+url\s*\(\s*(["\']?)(?P<url>.+?)\\1\s*\)(?P<media>[^;]*?);/i';
1131
-
1132
- $css = preg_replace_callback($import_media_without_url_regex, array($this, 'resolveResolvedCssImportsCb'), $css);
1133
- $css = preg_replace_callback($import_media_with_url_regex, array($this, 'resolveResolvedCssImportsCb'), $css);
1134
-
1135
- if (preg_match_all($import_media_without_url_regex, $css, $_m)) {
1136
- foreach ($_m['media'] as $_media) {
1137
- if (!$_media || $_media === $this->current_css_media) {
1138
- return $this->resolveResolvedCssImports($css, $this->current_css_media, true);
1139
- }
1140
- }
1141
- } // Recursive.
1142
- unset($_m, $_media); // Housekeeping.
1143
-
1144
- if (preg_match_all($import_media_with_url_regex, $css, $_m)) {
1145
- foreach ($_m['media'] as $_media) {
1146
- if (!$_media || $_media === $this->current_css_media) {
1147
- return $this->resolveResolvedCssImports($css, $this->current_css_media, true);
1148
- }
1149
- }
1150
- } // Recursive.
1151
- unset($_m, $_media); // Housekeeping.
1152
-
1153
- return $css;
1154
- }
1155
-
1156
- /**
1157
- * Callback handler for resolving @ import rules.
1158
- *
1159
- * @since 140417 Initial release.
1160
- *
1161
- * @param array $m An array of regex matches.
1162
- *
1163
- * @return string CSS after import resolution, else an empty string.
1164
- */
1165
- protected function resolveResolvedCssImportsCb(array $m)
1166
- {
1167
- if (empty($m['url'])) {
1168
- return ''; // Nothing to resolve.
1169
- }
1170
- if (!empty($m['media']) && $m['media'] !== $this->current_css_media) {
1171
- return $m[0]; // Not possible; different media.
1172
- }
1173
- if (($css = $this->stripUtf8Bom($this->mustGetUrl($m['url'])))) {
1174
- $css = $this->resolveCssRelatives($css, $m['url']);
1175
- }
1176
- return $css;
1177
- }
1178
-
1179
- /**
1180
- * Resolve relative URLs in CSS code.
1181
- *
1182
- * @since 140417 Initial release.
1183
- *
1184
- * @param string $css CSS code.
1185
- * @param string $base Optional. Base URL to calculate from.
1186
- * Defaults to the current HTTP location for the browser.
1187
- *
1188
- * @return string CSS code after having all URLs resolved.
1189
- */
1190
- protected function resolveCssRelatives($css, $base = '')
1191
- {
1192
- if (!($css = (string) $css)) {
1193
- return $css; // Nothing to do.
1194
- }
1195
- $this->current_base = $base; // Make this available to callback handlers (possible empty string here).
1196
-
1197
- $import_without_url_regex = '/(?P<import>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s*)(?P<open_encap>["\'])(?P<url>.+?)(?P<close_encap>\\2)/i';
1198
- $any_url_regex = '/(?P<url_>url\s*)(?P<open_bracket>\(\s*)(?P<open_encap>["\']?)(?P<url>.+?)(?P<close_encap>\\3)(?P<close_bracket>\s*\))/i';
1199
-
1200
- $css = preg_replace_callback($import_without_url_regex, array($this, 'resolveCssRelativesImportCb'), $css);
1201
- $css = preg_replace_callback($any_url_regex, array($this, 'resolveCssRelativesUrlCb'), $css);
1202
-
1203
- return $css;
1204
- }
1205
-
1206
- /**
1207
- * Callback handler for CSS relative URL resolutions.
1208
- *
1209
- * @since 140417 Initial release.
1210
- *
1211
- * @param array $m An array of regex matches.
1212
- *
1213
- * @return string CSS `@import` rule with relative URL resolved.
1214
- */
1215
- protected function resolveCssRelativesImportCb(array $m)
1216
- {
1217
- return $m['import'].$m['open_encap'].$this->resolveRelativeUrl($m['url'], $this->current_base).$m['close_encap'];
1218
- }
1219
-
1220
- /**
1221
- * Callback handler for CSS relative URL resolutions.
1222
- *
1223
- * @since 140417 Initial release.
1224
- *
1225
- * @param array $m An array of regex matches.
1226
- *
1227
- * @return string CSS `url()` resource with relative URL resolved.
1228
- */
1229
- protected function resolveCssRelativesUrlCb(array $m)
1230
- {
1231
- if (stripos($m['url'], 'data:') === 0) {
1232
- return $m[0]; // Don't resolve `data:` URIs.
1233
- }
1234
- return $m['url_'].$m['open_bracket'].$m['open_encap'].$this->resolveRelativeUrl($m['url'], $this->current_base).$m['close_encap'].$m['close_bracket'];
1235
- }
1236
-
1237
- /**
1238
- * Force absolute relative paths in CSS.
1239
- *
1240
- * @since 150511 Improving CSS handling.
1241
- *
1242
- * @param string $css Raw CSS code.
1243
- *
1244
- * @return string CSS code (possibly altered here).
1245
- */
1246
- protected function forceAbsRelativePathsInCss($css)
1247
- {
1248
- if (!($css = (string) $css)) {
1249
- return $css; // Nothing to do.
1250
- }
1251
- $regex = '/(?:[a-z0-9]+\:)?\/\/'.preg_quote($this->currentUrlHost(), '/').'\//i';
1252
-
1253
- return preg_replace($regex, '/', $css); // Absolute relative paths.
1254
- }
1255
-
1256
- /**
1257
- * Maybe filter URLs in CSS code.
1258
- *
1259
- * @since 150821 Adding URL filter support.
1260
- *
1261
- * @param string $css CSS code.
1262
- *
1263
- * @return string CSS code after having filtered all URLs.
1264
- */
1265
- protected function maybeFilterCssUrls($css)
1266
- {
1267
- if (!($css = (string) $css)) {
1268
- return $css; // Nothing to do.
1269
- }
1270
- if (!$this->hook_api->hasFilter('css_url()')) {
1271
- return $css; // No reason to do this.
1272
- }
1273
- $import_without_url_regex = '/(?P<import>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s*)(?P<open_encap>["\'])(?P<url>.+?)(?P<close_encap>\\2)/i';
1274
- $any_url_regex = '/(?P<url_>url\s*)(?P<open_bracket>\(\s*)(?P<open_encap>["\']?)(?P<url>.+?)(?P<close_encap>\\3)(?P<close_bracket>\s*\))/i';
1275
-
1276
- $css = preg_replace_callback($import_without_url_regex, array($this, 'filterCssUrlImportCb'), $css);
1277
- $css = preg_replace_callback($any_url_regex, array($this, 'filterCssUrlCb'), $css);
1278
-
1279
- return $css;
1280
- }
1281
-
1282
- /**
1283
- * Callback handler for CSS import URL filters.
1284
- *
1285
- * @since 150821 Adding URL filter support.
1286
- *
1287
- * @param array $m An array of regex matches.
1288
- *
1289
- * @return string CSS `@import` rule with filtered URL.
1290
- */
1291
- protected function filterCssUrlImportCb(array $m)
1292
- {
1293
- return $m['import'].$m['open_encap'].$this->hook_api->applyFilters('css_url()', $m['url']).$m['close_encap'];
1294
- }
1295
-
1296
- /**
1297
- * Callback handler for CSS URL filters.
1298
- *
1299
- * @since 150821 Adding URL filter support.
1300
- *
1301
- * @param array $m An array of regex matches.
1302
- *
1303
- * @return string CSS `url()` resource with with filtered URL.
1304
- */
1305
- protected function filterCssUrlCb(array $m)
1306
- {
1307
- if (stripos($m['url'], 'data:') === 0) {
1308
- return $m[0]; // Don't filter `data:` URIs.
1309
- }
1310
- return $m['url_'].$m['open_bracket'].$m['open_encap'].$this->hook_api->applyFilters('css_url()', $m['url']).$m['close_encap'].$m['close_bracket'];
1311
- }
1312
-
1313
- /********************************************************************************************************/
1314
-
1315
- /*
1316
- * JS-Related Methods
1317
- * ~ See also: JS Compression Utilities
1318
- */
1319
-
1320
- /**
1321
- * Handles possible compression of head JS.
1322
- *
1323
- * @since 140417 Initial release.
1324
- *
1325
- * @param string $html Input HTML code.
1326
- *
1327
- * @return string HTML code, after possible JS compression.
1328
- */
1329
- protected function maybeCompressCombineHeadJs($html)
1330
- {
1331
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
1332
- $time = microtime(true);
1333
- }
1334
- $html = (string) $html; // Force string value.
1335
-
1336
- if (isset($this->options['compress_combine_head_js'])) {
1337
- if (!$this->options['compress_combine_head_js']) {
1338
- $disabled = true; // Disabled flag.
1339
- }
1340
- }
1341
- if (!$html || !empty($disabled)) {
1342
- goto finale; // Nothing to do.
1343
- }
1344
- if (($head_frag = $this->getHeadFrag($html)) /* No need to get the HTML frag here; we're operating on the `<head>` only. */) {
1345
- if (($js_tag_frags = $this->getJsTagFrags($head_frag)) && ($js_parts = $this->compileJsTagFragsIntoParts($js_tag_frags, 'head'))) {
1346
- $js_tag_frags_all_compiled = $this->compileKeyElementsDeep($js_tag_frags, 'all');
1347
- $html = $this->replaceOnce($head_frag['all'], '%%htmlc-head%%', $html);
1348
- $cleaned_head_contents = $this->replaceOnce($js_tag_frags_all_compiled, '', $head_frag['contents']);
1349
- $cleaned_head_contents = $this->cleanupSelfClosingHtmlTagLines($cleaned_head_contents);
1350
-
1351
- $compressed_js_tags = array(); // Initialize.
1352
-
1353
- foreach ($js_parts as $_js_part) {
1354
- if (isset($_js_part['exclude_frag'], $js_tag_frags[$_js_part['exclude_frag']]['all'])) {
1355
- $compressed_js_tags[] = $js_tag_frags[$_js_part['exclude_frag']]['all'];
1356
- } else {
1357
- $compressed_js_tags[] = $_js_part['tag'];
1358
- }
1359
- }
1360
- unset($_js_part); // Housekeeping.
1361
-
1362
- $compressed_js_tags = implode("\n", $compressed_js_tags);
1363
- $compressed_head_parts = array($head_frag['open_tag'], $cleaned_head_contents, $compressed_js_tags, $head_frag['closing_tag']);
1364
- $html = $this->replaceOnce('%%htmlc-head%%', implode("\n", $compressed_head_parts), $html);
1365
-
1366
- if ($benchmark) {
1367
- $this->benchmark->addData(
1368
- __FUNCTION__,
1369
- compact(
1370
- 'head_frag',
1371
- 'js_tag_frags',
1372
- 'js_parts',
1373
- 'cleaned_head_contents',
1374
- 'compressed_js_tags',
1375
- 'compressed_head_parts'
1376
- )
1377
- );
1378
- }
1379
- }
1380
- }
1381
- finale: // Target point; finale/return value.
1382
-
1383
- if ($html) {
1384
- $html = trim($html);
1385
- } // Trim it up now!
1386
-
1387
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
1388
- $this->benchmark->addTime(
1389
- __FUNCTION__,
1390
- $time, // Caller, start time, task performed.
1391
- sprintf('compressing/combining head JS in checksum: `%1$s`', md5($html))
1392
- );
1393
- }
1394
- return $html; // With possible compression having been applied here.
1395
- }
1396
-
1397
- /**
1398
- * Handles possible compression of footer JS.
1399
- *
1400
- * @since 140417 Initial release.
1401
- *
1402
- * @param string $html Input HTML code.
1403
- *
1404
- * @return string HTML code, after possible JS compression.
1405
- */
1406
- protected function maybeCompressCombineFooterJs($html)
1407
- {
1408
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
1409
- $time = microtime(true);
1410
- }
1411
- $html = (string) $html; // Force string value.
1412
-
1413
- if (isset($this->options['compress_combine_footer_js'])) {
1414
- if (!$this->options['compress_combine_footer_js']) {
1415
- $disabled = true; // Disabled flag.
1416
- }
1417
- }
1418
- if (!$html || !empty($disabled)) {
1419
- goto finale; // Nothing to do.
1420
- }
1421
- if (($footer_scripts_frag = $this->getFooterScriptsFrag($html)) /* e.g. <!-- footer-scripts --><!-- footer-scripts --> */) {
1422
- if (($js_tag_frags = $this->getJsTagFrags($footer_scripts_frag)) && ($js_parts = $this->compileJsTagFragsIntoParts($js_tag_frags, 'foot'))) {
1423
- $js_tag_frags_all_compiled = $this->compileKeyElementsDeep($js_tag_frags, 'all');
1424
- $html = $this->replaceOnce($footer_scripts_frag['all'], '%%htmlc-footer-scripts%%', $html);
1425
- $cleaned_footer_scripts = $this->replaceOnce($js_tag_frags_all_compiled, '', $footer_scripts_frag['contents']);
1426
-
1427
- $compressed_js_tags = array(); // Initialize.
1428
-
1429
- foreach ($js_parts as $_js_part) {
1430
- if (isset($_js_part['exclude_frag'], $js_tag_frags[$_js_part['exclude_frag']]['all'])) {
1431
- $compressed_js_tags[] = $js_tag_frags[$_js_part['exclude_frag']]['all'];
1432
- } else {
1433
- $compressed_js_tags[] = $_js_part['tag'];
1434
- }
1435
- }
1436
- unset($_js_part); // Housekeeping.
1437
-
1438
- $compressed_js_tags = implode("\n", $compressed_js_tags);
1439
- $compressed_footer_script_parts = array($footer_scripts_frag['open_tag'], $cleaned_footer_scripts, $compressed_js_tags, $footer_scripts_frag['closing_tag']);
1440
- $html = $this->replaceOnce('%%htmlc-footer-scripts%%', implode("\n", $compressed_footer_script_parts), $html);
1441
-
1442
- if ($benchmark) {
1443
- $this->benchmark->addData(
1444
- __FUNCTION__,
1445
- compact(
1446
- 'footer_scripts_frag',
1447
- 'js_tag_frags',
1448
- 'js_parts',
1449
- 'cleaned_footer_scripts',
1450
- 'compressed_js_tags',
1451
- 'compressed_footer_script_parts'
1452
- )
1453
- );
1454
- }
1455
- }
1456
- }
1457
- finale: // Target point; finale/return value.
1458
-
1459
- if ($html) {
1460
- $html = trim($html);
1461
- } // Trim it up now!
1462
-
1463
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
1464
- $this->benchmark->addTime(
1465
- __FUNCTION__,
1466
- $time, // Caller, start time, task performed.
1467
- sprintf('compressing/combining footer JS in checksum: `%1$s`', md5($html))
1468
- );
1469
- }
1470
- return $html; // With possible compression having been applied here.
1471
- }
1472
-
1473
- /**
1474
- * Compiles JS tag fragments into JS parts with compression.
1475
- *
1476
- * @since 140417 Initial release.
1477
- *
1478
- * @param array $js_tag_frags JS tag fragments.
1479
- * @param string $for Where will these parts go? One of `head`, `body`, `foot`.
1480
- *
1481
- * @throws \Exception If unable to cache JS parts.
1482
- *
1483
- * @return array Array of JS parts, else an empty array on failure.
1484
- */
1485
- protected function compileJsTagFragsIntoParts(array $js_tag_frags, $for)
1486
- {
1487
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
1488
- $time = microtime(true);
1489
- }
1490
- $for = (string) $for; // Force string.
1491
- $js_parts = array(); // Initialize.
1492
- $js_parts_checksum = ''; // Initialize.
1493
-
1494
- if (!$js_tag_frags) {
1495
- goto finale; // Nothing to do.
1496
- }
1497
- $js_parts_checksum = $this->getTagFragsChecksum($js_tag_frags);
1498
- $public_cache_dir = $this->cacheDir($this::DIR_PUBLIC_TYPE, $js_parts_checksum);
1499
- $private_cache_dir = $this->cacheDir($this::DIR_PRIVATE_TYPE, $js_parts_checksum);
1500
- $public_cache_dir_url = $this->cacheDirUrl($this::DIR_PUBLIC_TYPE, $js_parts_checksum);
1501
-
1502
- $cache_parts_file = $js_parts_checksum.'-compressor-parts.js-cache';
1503
- $cache_parts_file_path = $private_cache_dir.'/'.$cache_parts_file;
1504
- $cache_parts_file_path_tmp = $cache_parts_file_path.'.'.uniqid('', true).'.tmp';
1505
- // Cache file creation is atomic; i.e. tmp file w/ rename.
1506
-
1507
- $cache_part_file = '%%code-checksum%%-compressor-part.js';
1508
- $cache_part_file_path = $public_cache_dir.'/'.$cache_part_file;
1509
- $cache_part_file_url = $public_cache_dir_url.'/'.$cache_part_file;
1510
-
1511
- if (is_file($cache_parts_file_path) && filemtime($cache_parts_file_path) > strtotime('-'.$this->cache_expiration_time)) {
1512
- if (is_array($cached_parts = unserialize(file_get_contents($cache_parts_file_path)))) {
1513
- $js_parts = $cached_parts; // Use cached parts.
1514
- goto finale; // Using the cache; we're all done here.
1515
- }
1516
- }
1517
- $_js_part = 0; // Initialize part counter.
1518
-
1519
- foreach ($js_tag_frags as $_js_tag_frag_pos => $_js_tag_frag) {
1520
- if ($_js_tag_frag['exclude']) {
1521
- if ($_js_tag_frag['script_src'] || $_js_tag_frag['script_js'] || $_js_tag_frag['script_json']) {
1522
- if ($js_parts) {
1523
- ++$_js_part; // Starts new part.
1524
- }
1525
- $js_parts[$_js_part]['tag'] = '';
1526
- $js_parts[$_js_part]['exclude_frag'] = $_js_tag_frag_pos;
1527
- ++$_js_part; // Always indicates a new part in the next iteration.
1528
- }
1529
- } elseif ($_js_tag_frag['script_src']) {
1530
- if (($_js_tag_frag['script_src'] = $this->resolveRelativeUrl($_js_tag_frag['script_src']))) {
1531
- if (($_js_code = $this->stripUtf8Bom($this->mustGetUrl($_js_tag_frag['script_src'])))) {
1532
- $_js_code = rtrim($_js_code, ';').';';
1533
-
1534
- if ($_js_code) {
1535
- if (!empty($js_parts[$_js_part]['code'])) {
1536
- $js_parts[$_js_part]['code'] .= "\n\n".$_js_code;
1537
- } else {
1538
- $js_parts[$_js_part]['code'] = $_js_code;
1539
- }
1540
- }
1541
- }
1542
- }
1543
- } elseif ($_js_tag_frag['script_js']) {
1544
- $_js_code = $_js_tag_frag['script_js'];
1545
- $_js_code = $this->stripUtf8Bom($_js_code);
1546
- $_js_code = rtrim($_js_code, ';').';';
1547
-
1548
- if ($_js_code) {
1549
- if (!empty($js_parts[$_js_part]['code'])) {
1550
- $js_parts[$_js_part]['code'] .= "\n\n".$_js_code;
1551
- } else {
1552
- $js_parts[$_js_part]['code'] = $_js_code;
1553
- }
1554
- }
1555
- } elseif ($_js_tag_frag['script_json']) {
1556
- if ($js_parts) {
1557
- ++$_js_part; // Starts new part.
1558
- }
1559
- $js_parts[$_js_part]['tag'] = $_js_tag_frag['all'];
1560
- ++$_js_part; // Always indicates a new part in the next iteration.
1561
- }
1562
- }
1563
- unset($_js_part, $_js_tag_frag_pos, $_js_tag_frag, $_js_code);
1564
-
1565
- foreach (array_keys($js_parts = array_values($js_parts)) as $_js_part) {
1566
- if (!isset($js_parts[$_js_part]['exclude_frag']) && !empty($js_parts[$_js_part]['code'])) {
1567
- $_js_code = $js_parts[$_js_part]['code'];
1568
- $_js_code_cs = md5($_js_code); // Before compression.
1569
- $_js_code = $this->maybeCompressJsCode($_js_code);
1570
-
1571
- $_js_code_path = str_replace('%%code-checksum%%', $_js_code_cs, $cache_part_file_path);
1572
- $_js_code_url = str_replace('%%code-checksum%%', $_js_code_cs, $cache_part_file_url);
1573
- $_js_code_url = $this->hook_api->applyFilters('part_url', $_js_code_url, $for);
1574
- $_js_code_path_tmp = $_js_code_path.'.'.uniqid('', true).'.tmp';
1575
- // Cache file creation is atomic; e.g. tmp file w/ rename.
1576
-
1577
- if (!(file_put_contents($_js_code_path_tmp, $_js_code) && rename($_js_code_path_tmp, $_js_code_path))) {
1578
- throw new \Exception(sprintf('Unable to cache JS code file: `%1$s`.', $_js_code_path));
1579
- }
1580
- $js_parts[$_js_part]['tag'] = '<script type="text/javascript" src="'.htmlspecialchars($_js_code_url, ENT_QUOTES).'"></script>';
1581
-
1582
- unset($js_parts[$_js_part]['code']); // Ditch this; no need to cache this code too.
1583
- }
1584
- }
1585
- unset($_js_part, $_js_code, $_js_code_cs, $_js_code_path, $_js_code_path_tmp, $_js_code_url);
1586
-
1587
- if (!(file_put_contents($cache_parts_file_path_tmp, serialize($js_parts)) && rename($cache_parts_file_path_tmp, $cache_parts_file_path))) {
1588
- throw new \Exception(sprintf('Unable to cache JS parts into: `%1$s`.', $cache_parts_file_path));
1589
- }
1590
- finale: // Target point; finale/return value.
1591
-
1592
- if ($benchmark && !empty($time) && $js_parts_checksum) {
1593
- $this->benchmark->addTime(
1594
- __FUNCTION__,
1595
- $time, // Caller, start time, task performed.
1596
- sprintf('building parts based on JS tag frags in checksum: `%1$s`', $js_parts_checksum)
1597
- );
1598
- }
1599
- return $js_parts;
1600
- }
1601
-
1602
- /**
1603
- * Parses and return an array of JS tag fragments.
1604
- *
1605
- * @since 140417 Initial release.
1606
- *
1607
- * @param array $html_frag An HTML tag fragment array.
1608
- *
1609
- * @return array An array of JS tag fragments (ready to be converted into JS parts).
1610
- * Else an empty array (i.e. no JS tag fragments in the HTML fragment array).
1611
- *
1612
- * @see http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
1613
- * @see http://stackoverflow.com/a/12102131
1614
- */
1615
- protected function getJsTagFrags(array $html_frag)
1616
- {
1617
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
1618
- $time = microtime(true);
1619
- }
1620
- $js_tag_frags = array(); // Initialize.
1621
-
1622
- if (!$html_frag) {
1623
- goto finale; // Nothing to do.
1624
- }
1625
- $regex = '/(?P<all>'.// Entire match.
1626
- '(?P<if_open_tag>\<\![^[>]*?\[if\W[^\]]*?\][^>]*?\>\s*)?'.
1627
- '(?P<script_open_tag>\<script(?:\s+[^>]*?)?\>)(?P<script_js>.*?)(?P<script_closing_tag>\<\/script\>)'.
1628
- '(?P<if_closing_tag>\s*\<\![^[>]*?\[endif\][^>]*?\>)?'.
1629
- ')/is'; // Dot matches line breaks.
1630
-
1631
- if (!empty($html_frag['contents']) && preg_match_all($regex, $html_frag['contents'], $_tag_frags, PREG_SET_ORDER)) {
1632
- foreach ($_tag_frags as $_tag_frag) {
1633
- if (isset($_tag_frag['script_js'])) {
1634
- $_tag_frag['script_json'] = $_tag_frag['script_js'];
1635
- } // Assume that this is either/or for the time being.
1636
- $_script_src = $_script_js = $_script_json = $_script_async = ''; // Initialize.
1637
- $_is_js = $this->isScriptTagFragJs($_tag_frag); // JavaScript or JSON?
1638
- $_is_json = !$_is_js && $this->isScriptTagFragJson($_tag_frag);
1639
-
1640
- if ($_is_js || $_is_json) {
1641
- if ($_is_js && ($_script_src = $this->getScriptJsSrc($_tag_frag, false))) {
1642
- $_script_async = $this->getScriptJsAsync($_tag_frag, false);
1643
- } elseif ($_is_js && ($_script_js = $this->getScriptJs($_tag_frag, false))) {
1644
- $_script_async = $this->getScriptJsAsync($_tag_frag, false);
1645
- } elseif ($_is_json && ($_script_json = $this->getScriptJson($_tag_frag, false))) {
1646
- $_script_async = ''; // Not applicable.
1647
- }
1648
- if ($_script_src || $_script_js || $_script_json) {
1649
- $js_tag_frags[] = array(
1650
- 'all' => $_tag_frag['all'],
1651
-
1652
- 'if_open_tag' => isset($_tag_frag['if_open_tag']) ? $_tag_frag['if_open_tag'] : '',
1653
- 'if_closing_tag' => isset($_tag_frag['if_closing_tag']) ? $_tag_frag['if_closing_tag'] : '',
1654
-
1655
- 'script_open_tag' => isset($_tag_frag['script_open_tag']) ? $_tag_frag['script_open_tag'] : '',
1656
- 'script_src_external' => $_is_js && $_script_src ? $this->isUrlExternal($_script_src) : false,
1657
- 'script_src' => $_is_js ? $_script_src : '', // This could also be empty.
1658
- 'script_js' => $_is_js ? $_script_js : '', // This could also be empty.
1659
- 'script_json' => $_is_json ? $_script_json : '', // This could also be empty.
1660
- 'script_async' => $_is_js ? $_script_async : '', // This could also be empty.
1661
- 'script_closing_tag' => isset($_tag_frag['script_closing_tag']) ? $_tag_frag['script_closing_tag'] : '',
1662
-
1663
- 'exclude' => false, // Default value.
1664
- );
1665
- $_tag_frag_r = &$js_tag_frags[count($js_tag_frags) - 1];
1666
-
1667
- if ($_tag_frag_r['if_open_tag'] || $_tag_frag_r['if_closing_tag'] || $_tag_frag_r['script_async']) {
1668
- $_tag_frag_r['exclude'] = true;
1669
- } elseif ($_tag_frag_r['script_src'] && $_tag_frag_r['script_src_external'] && isset($this->options['compress_combine_remote_css_js']) && !$this->options['compress_combine_remote_css_js']) {
1670
- $_tag_frag_r['exclude'] = true;
1671
- } elseif ($this->regex_js_exclusions && preg_match($this->regex_js_exclusions, $_tag_frag_r['script_src'].$_tag_frag_r['script_js'].$_tag_frag_r['script_json'])) {
1672
- $_tag_frag_r['exclude'] = true;
1673
- } elseif ($this->built_in_regex_js_exclusions && preg_match($this->built_in_regex_js_exclusions, $_tag_frag_r['script_src'].$_tag_frag_r['script_js'].$_tag_frag_r['script_json'])) {
1674
- $_tag_frag_r['exclude'] = true;
1675
- }
1676
- }
1677
- }
1678
- }
1679
- unset($_tag_frags, $_tag_frag, $_tag_frag_r, $_script_src, $_script_js, $_script_json, $_script_async, $_is_js, $_is_json);
1680
- }
1681
- finale: // Target point; finale/return value.
1682
-
1683
- if ($benchmark && !empty($time) && $html_frag) {
1684
- $this->benchmark->addTime(
1685
- __FUNCTION__,
1686
- $time, // Caller, start time, task performed.
1687
- sprintf('compiling JS tag frags in checksum: `%1$s`', md5(serialize($html_frag)))
1688
- );
1689
- }
1690
- return $js_tag_frags;
1691
- }
1692
-
1693
- /**
1694
- * Test a script tag fragment to see if it's JavaScript.
1695
- *
1696
- * @since 140922 Improving attribute tests.
1697
- *
1698
- * @param array $tag_frag A JS tag fragment.
1699
- *
1700
- * @return bool TRUE if it contains JavaScript.
1701
- */
1702
- protected function isScriptTagFragJs(array $tag_frag)
1703
- {
1704
- if (empty($tag_frag['script_open_tag']) || empty($tag_frag['script_closing_tag'])) {
1705
- return false; // Nope; missing open|closing tag.
1706
- }
1707
- $type = $language = ''; // Initialize.
1708
-
1709
- if (stripos($tag_frag['script_open_tag'], 'type') !== 0) {
1710
- if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['script_open_tag'], $_m)) {
1711
- $type = $_m['value'];
1712
- }
1713
- }
1714
- unset($_m); // Just a little housekeeping.
1715
-
1716
- if (stripos($tag_frag['script_open_tag'], 'language') !== 0) {
1717
- if (preg_match('/\slanguage\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['script_open_tag'], $_m)) {
1718
- $language = $_m['value'];
1719
- }
1720
- }
1721
- unset($_m); // Just a little housekeeping.
1722
-
1723
- if ($type && stripos($type, 'json') !== false) {
1724
- return false; // JSON; not JavaScript.
1725
- }
1726
- if ($type && stripos($type, 'javascript') === false) {
1727
- return false; // Not JavaScript.
1728
- }
1729
- if ($language && stripos($language, 'json') !== false) {
1730
- return false; // JSON; not JavaScript.
1731
- }
1732
- if ($language && stripos($language, 'javascript') === false) {
1733
- return false; // Not JavaScript.
1734
- }
1735
- return true; // Yes, this is JavaScript.
1736
- }
1737
-
1738
- /**
1739
- * Test a script tag fragment to see if it's JSON.
1740
- *
1741
- * @since 150424 Adding support for JSON compression.
1742
- *
1743
- * @param array $tag_frag A JS tag fragment.
1744
- *
1745
- * @return bool TRUE if it contains JSON.
1746
- */
1747
- protected function isScriptTagFragJson(array $tag_frag)
1748
- {
1749
- if (empty($tag_frag['script_open_tag']) || empty($tag_frag['script_closing_tag'])) {
1750
- return false; // Nope; missing open|closing tag.
1751
- }
1752
- $type = $language = ''; // Initialize.
1753
-
1754
- if (stripos($tag_frag['script_open_tag'], 'type') !== 0) {
1755
- if (preg_match('/\stype\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['script_open_tag'], $_m)) {
1756
- $type = $_m['value'];
1757
- }
1758
- }
1759
- unset($_m); // Just a little housekeeping.
1760
-
1761
- if (stripos($tag_frag['script_open_tag'], 'language') !== 0) {
1762
- if (preg_match('/\slanguage\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['script_open_tag'], $_m)) {
1763
- $language = $_m['value'];
1764
- }
1765
- }
1766
- unset($_m); // Just a little housekeeping.
1767
-
1768
- if (($type && stripos($type, 'javascript') === false) || ($language && stripos($language, 'javascript') === false)) {
1769
- if ($type && stripos($type, 'json') !== false) {
1770
- return true; // Yes, this is JSON.
1771
- }
1772
- if ($language && stripos($language, 'json') !== false) {
1773
- return true; // Yes, this is JSON.
1774
- }
1775
- }
1776
- return false; // No, not JSON.
1777
- }
1778
-
1779
- /**
1780
- * Get script JS src value from a JS tag fragment.
1781
- *
1782
- * @since 140417 Initial release.
1783
- *
1784
- * @param array $tag_frag A JS tag fragment.
1785
- * @param bool $test_for_js Defaults to a TRUE value.
1786
- * If TRUE, we will test tag fragment to make sure it's JavaScript.
1787
- *
1788
- * @return string The script JS src value (if possible); else an empty string.
1789
- */
1790
- protected function getScriptJsSrc(array $tag_frag, $test_for_js = true)
1791
- {
1792
- if ($test_for_js && !$this->isScriptTagFragJs($tag_frag)) {
1793
- return ''; // This script tag does not contain JavaScript.
1794
- }
1795
- if (preg_match('/\ssrc\s*\=\s*(["\'])(?P<value>.+?)\\1/i', $tag_frag['script_open_tag'], $_m)) {
1796
- return trim($this->nUrlAmps($_m['value']));
1797
- }
1798
- unset($_m); // Just a little housekeeping.
1799
-
1800
- return ''; // Unable to find an `src` attribute value.
1801
- }
1802
-
1803
- /**
1804
- * Get script JS async|defer value from a JS tag fragment.
1805
- *
1806
- * @since 140417 Initial release.
1807
- *
1808
- * @param array $tag_frag A JS tag fragment.
1809
- * @param bool $test_for_js Defaults to a TRUE value.
1810
- * If TRUE, we will test tag fragment to make sure it's JavaScript.
1811
- *
1812
- * @return string The script JS async|defer value (if possible); else an empty string.
1813
- */
1814
- protected function getScriptJsAsync(array $tag_frag, $test_for_js = true)
1815
- {
1816
- if ($test_for_js && !$this->isScriptTagFragJs($tag_frag)) {
1817
- return ''; // This script tag does not contain JavaScript.
1818
- }
1819
- if (preg_match('/\s(?:async|defer)(?:\>|\s+[^=]|\s*\=\s*(["\'])(?:1|on|yes|true|async|defer)\\1)/i', $tag_frag['script_open_tag'], $_m)) {
1820
- return 'async'; // Yes, load this asynchronously.
1821
- }
1822
- unset($_m); // Just a little housekeeping.
1823
-
1824
- return ''; // Unable to find a TRUE `async|defer` attribute.
1825
- }
1826
-
1827
- /**
1828
- * Get script JS from a JS tag fragment.
1829
- *
1830
- * @since 140417 Initial release.
1831
- *
1832
- * @param array $tag_frag A JS tag fragment.
1833
- * @param bool $test_for_js Defaults to a TRUE value.
1834
- * If TRUE, we will test tag fragment to make sure it's JavaScript.
1835
- *
1836
- * @return string The script JS code (if possible); else an empty string.
1837
- */
1838
- protected function getScriptJs(array $tag_frag, $test_for_js = true)
1839
- {
1840
- if (empty($tag_frag['script_js'])) {
1841
- return ''; // Not possible; no JavaScript code.
1842
- }
1843
- if ($test_for_js && !$this->isScriptTagFragJs($tag_frag)) {
1844
- return ''; // This script tag does not contain JavaScript.
1845
- }
1846
- return trim($tag_frag['script_js']); // JavaScript code.
1847
- }
1848
-
1849
- /**
1850
- * Get script JSON from a JS tag fragment.
1851
- *
1852
- * @since 150424 Adding support for JSON compression.
1853
- *
1854
- * @param array $tag_frag A JS tag fragment.
1855
- * @param bool $test_for_js Defaults to a TRUE value.
1856
- * If TRUE, we will test tag fragment to make sure it's JSON.
1857
- *
1858
- * @return string The script JSON code (if possible); else an empty string.
1859
- */
1860
- protected function getScriptJson(array $tag_frag, $test_for_json = true)
1861
- {
1862
- if (empty($tag_frag['script_json'])) {
1863
- return ''; // Not possible; no JSON code.
1864
- }
1865
- if ($test_for_json && !$this->isScriptTagFragJson($tag_frag)) {
1866
- return ''; // This script tag does not contain JSON.
1867
- }
1868
- return trim($tag_frag['script_json']); // JSON code.
1869
- }
1870
-
1871
- /********************************************************************************************************/
1872
-
1873
- /*
1874
- * Frag-Related Utilities
1875
- */
1876
-
1877
- /**
1878
- * Build an HTML fragment from HTML source code.
1879
- *
1880
- * @since 140417 Initial release.
1881
- *
1882
- * @param string $html Raw HTML code.
1883
- *
1884
- * @return array An HTML fragment (if possible); else an empty array.
1885
- */
1886
- protected function getHtmlFrag($html)
1887
- {
1888
- if (!($html = (string) $html)) {
1889
- return array(); // Nothing to do.
1890
- }
1891
- if (preg_match('/(?P<all>(?P<open_tag>\<html(?:\s+[^>]*?)?\>)(?P<contents>.*?)(?P<closing_tag>\<\/html\>))/is', $html, $html_frag)) {
1892
- return $this->removeNumericKeysDeep($html_frag);
1893
- }
1894
- return array();
1895
- }
1896
-
1897
- /**
1898
- * Build a head fragment from HTML source code.
1899
- *
1900
- * @since 140417 Initial release.
1901
- *
1902
- * @param string $html Raw HTML code.
1903
- *
1904
- * @return array A head fragment (if possible); else an empty array.
1905
- */
1906
- protected function getHeadFrag($html)
1907
- {
1908
- if (!($html = (string) $html)) {
1909
- return array(); // Nothing to do.
1910
- }
1911
- if (preg_match('/(?P<all>(?P<open_tag>\<head(?:\s+[^>]*?)?\>)(?P<contents>.*?)(?P<closing_tag>\<\/head\>))/is', $html, $head_frag)) {
1912
- return $this->removeNumericKeysDeep($head_frag);
1913
- }
1914
- return array();
1915
- }
1916
-
1917
- /**
1918
- * Build a footer scripts fragment from HTML source code.
1919
- *
1920
- * @since 140417 Initial release.
1921
- *
1922
- * @param string $html Raw HTML code.
1923
- *
1924
- * @return array A footer scripts fragment (if possible); else an empty array.
1925
- */
1926
- protected function getFooterScriptsFrag($html)
1927
- {
1928
- if (!($html = (string) $html)) {
1929
- return array(); // Nothing to do.
1930
- }
1931
- if (preg_match('/(?P<all>(?P<open_tag>\<\!\-\-\s*footer[\s_\-]+scripts\s*\-\-\>)(?P<contents>.*?)(?P<closing_tag>(?P=open_tag)))/is', $html, $head_frag)) {
1932
- return $this->removeNumericKeysDeep($head_frag);
1933
- }
1934
- return array();
1935
- }
1936
-
1937
- /**
1938
- * Construct a checksum for an array of tag fragments.
1939
- *
1940
- * @since 140417 Initial release.
1941
- *
1942
- * @note This routine purposely excludes any "exclusions" from the checksum.
1943
- * All that's important here is an exclusion's position in the array,
1944
- * not its fragmentation; it's excluded anyway.
1945
- *
1946
- * @param array $tag_frags Array of tag fragments.
1947
- *
1948
- * @return string MD5 checksum.
1949
- */
1950
- protected function getTagFragsChecksum(array $tag_frags)
1951
- {
1952
- foreach ($tag_frags as &$_frag) {
1953
- $_frag = $_frag['exclude'] ? array('exclude' => true) : $_frag;
1954
- }
1955
- unset($_frag); // A little housekeeping.
1956
-
1957
- return md5(serialize($tag_frags));
1958
- }
1959
-
1960
- /********************************************************************************************************/
1961
-
1962
- /*
1963
- * HTML Compression Utilities
1964
- */
1965
-
1966
- /**
1967
- * Maybe compress HTML code.
1968
- *
1969
- * @since 140417 Initial release.
1970
- *
1971
- * @param string $html Raw HTML code.
1972
- *
1973
- * @return string Possibly compressed HTML code.
1974
- */
1975
- protected function maybeCompressHtmlCode($html)
1976
- {
1977
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
1978
- $time = microtime(true);
1979
- }
1980
- $html = (string) $html; // Force string value.
1981
-
1982
- if (isset($this->options['compress_html_code'])) {
1983
- if (!$this->options['compress_html_code']) {
1984
- $disabled = true; // Disabled flag.
1985
- }
1986
- }
1987
- if (!$html || !empty($disabled)) {
1988
- goto finale; // Nothing to do.
1989
- }
1990
- if (($compressed_html = $this->compressHtml($html))) {
1991
- $html = $compressed_html; // Use it :-)
1992
- }
1993
- finale: // Target point; finale/return value.
1994
-
1995
- if ($html) {
1996
- $html = trim($html);
1997
- } // Trim it up now!
1998
-
1999
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
2000
- $this->benchmark->addTime(
2001
- __FUNCTION__,
2002
- $time, // Caller, start time, task performed.
2003
- sprintf('compressing HTML w/ checksum: `%1$s`', md5($html))
2004
- );
2005
- }
2006
- return $html; // With possible compression having been applied here.
2007
- }
2008
-
2009
- /**
2010
- * Compresses HTML markup (as quickly as possible).
2011
- *
2012
- * @since 140417 Initial release.
2013
- *
2014
- * @param string $html Any HTML markup (no empty strings please).
2015
- *
2016
- * @return string Compressed HTML markup. With all comments and extra whitespace removed as quickly as possible.
2017
- * This preserves portions of HTML that depend on whitespace. Like `pre/code/script/style/textarea` tags.
2018
- * It also preserves conditional comments and JavaScript `on(click|blur|etc)` attributes.
2019
- *
2020
- * @see http://stackoverflow.com/a/12102131
2021
- */
2022
- protected function compressHtml($html)
2023
- {
2024
- if (!($html = (string) $html)) {
2025
- return $html; // Nothing to do.
2026
- }
2027
- $static = &static::$static[__FUNCTION__];
2028
-
2029
- if (!isset($static['preservations'], $static['compressions'], $static['compress_with'])) {
2030
- $static['preservations'] = array(
2031
- 'special_tags' => '\<(pre|code|script|style|textarea)(?:\s+[^>]*?)?\>.*?\<\/\\2>',
2032
- 'ie_conditional_comments' => '\<\![^[>]*?\[if\W[^\]]*?\][^>]*?\>.*?\<\![^[>]*?\[endif\][^>]*?\>',
2033
- 'special_attributes' => '\s(?:style|on[a-z]+)\s*\=\s*(["\']).*?\\3',
2034
- );
2035
- $static['preservations'] = // Implode for regex capture.
2036
- '/(?P<preservation>'.implode('|', $static['preservations']).')/is';
2037
-
2038
- $static['compressions']['remove_html_comments'] = '/\<\!\-{2}.*?\-{2}\>/is';
2039
- $static['compress_with']['remove_html_comments'] = '';
2040
-
2041
- $static['compressions']['remove_extra_whitespace'] = '/\s+/';
2042
- $static['compress_with']['remove_extra_whitespace'] = ' ';
2043
-
2044
- $static['compressions']['remove_extra_whitespace_in_self_closing_tags'] = '/\s+\/\>/';
2045
- $static['compress_with']['remove_extra_whitespace_in_self_closing_tags'] = '/>';
2046
- }
2047
- if (preg_match_all($static['preservations'], $html, $preservation_matches, PREG_SET_ORDER)) {
2048
- foreach ($preservation_matches as $_preservation_match_key => $_preservation_match) {
2049
- $preservations[] = $_preservation_match['preservation'];
2050
- $preservation_placeholders[] = '%%minify-html-'.$_preservation_match_key.'%%';
2051
- }
2052
- unset($_preservation_match_key, $_preservation_match);
2053
-
2054
- if (isset($preservations, $preservation_placeholders)) {
2055
- $html = $this->replaceOnce($preservations, $preservation_placeholders, $html);
2056
- }
2057
- }
2058
- $html = preg_replace($static['compressions'], $static['compress_with'], $html);
2059
-
2060
- if (isset($preservations, $preservation_placeholders)) {
2061
- $html = $this->replaceOnce($preservation_placeholders, $preservations, $html);
2062
- }
2063
- return $html ? trim($html) : $html;
2064
- }
2065
-
2066
- /********************************************************************************************************/
2067
-
2068
- /*
2069
- * CSS Compression Utilities
2070
- */
2071
-
2072
- /**
2073
- * Maybe compress CSS code.
2074
- *
2075
- * @since 140417 Initial release.
2076
- *
2077
- * @param string $css Raw CSS code.
2078
- *
2079
- * @return string CSS code (possibly compressed).
2080
- */
2081
- protected function maybeCompressCssCode($css)
2082
- {
2083
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
2084
- $time = microtime(true);
2085
- }
2086
- $css = (string) $css; // Force string value.
2087
-
2088
- if (isset($this->options['compress_css_code'])) {
2089
- if (!$this->options['compress_css_code']) {
2090
- $disabled = true; // Disabled flag.
2091
- }
2092
- }
2093
- if (!$css || !empty($disabled)) {
2094
- goto finale; // Nothing to do.
2095
- }
2096
- if (strlen($css) > 1000000) {
2097
- // Exclude VERY large files. Too time-consuming.
2098
- // Should really be compressed ahead-of-time anyway.
2099
- goto finale; // Don't compress HUGE files.
2100
- }
2101
- try { // Catch CSS compression-related exceptions.
2102
- if (!($compressed_css = \WebSharks\CssMinifier\Core::compress($css))) {
2103
- // `E_USER_NOTICE` to avoid a show-stopping problem.
2104
- trigger_error('CSS compression failure.', E_USER_NOTICE);
2105
- } else {
2106
- $css = $this->stripUtf8Bom($compressed_css);
2107
- } // Use compressed CSS file.
2108
- } catch (\Exception $exception) {
2109
- trigger_error($exception->getMessage(), E_USER_NOTICE);
2110
- }
2111
- finale: // Target point; finale/return value.
2112
-
2113
- if ($css) {
2114
- $css = trim($css);
2115
- }
2116
- if ($benchmark && !empty($time) && $css && empty($disabled)) {
2117
- $this->benchmark->addTime(
2118
- __FUNCTION__,
2119
- $time, // Caller, start time, task performed.
2120
- sprintf('compressing CSS w/ checksum: `%1$s`', md5($css))
2121
- );
2122
- }
2123
- return $css;
2124
- }
2125
-
2126
- /********************************************************************************************************/
2127
-
2128
- /*
2129
- * JS Compression Utilities
2130
- */
2131
-
2132
- /**
2133
- * Maybe compress JS code.
2134
- *
2135
- * @since 140417 Initial release.
2136
- *
2137
- * @param string $js Raw JS code.
2138
- *
2139
- * @return string JS code (possibly compressed).
2140
- */
2141
- protected function maybeCompressJsCode($js)
2142
- {
2143
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
2144
- $time = microtime(true);
2145
- }
2146
- $js = (string) $js; // Force string value.
2147
-
2148
- if (isset($this->options['compress_js_code'])) {
2149
- if (!$this->options['compress_js_code']) {
2150
- $disabled = true; // Disabled flag.
2151
- }
2152
- }
2153
- if (!$js || !empty($disabled)) {
2154
- goto finale; // Nothing to do.
2155
- }
2156
- if (strlen($js) > 1000000) {
2157
- // Exclude VERY large files. Too time-consuming.
2158
- // Should really be compressed ahead-of-time anyway.
2159
- goto finale; // Don't compress HUGE files.
2160
- }
2161
- try { // Catch JS compression-related exceptions.
2162
- if (!($compressed_js = \WebSharks\JsMinifier\Core::compress($js))) {
2163
- // `E_USER_NOTICE` to avoid a show-stopping problem.
2164
- trigger_error('JS compression failure.', E_USER_NOTICE);
2165
- } else {
2166
- $js = $compressed_js;
2167
- } // Use compressed JS file.
2168
- } catch (\Exception $exception) {
2169
- trigger_error($exception->getMessage(), E_USER_NOTICE);
2170
- }
2171
- finale: // Target point; finale/return value.
2172
-
2173
- if ($js) {
2174
- $js = trim($js);
2175
- }
2176
- if ($benchmark && !empty($time) && $js && empty($disabled)) {
2177
- $this->benchmark->addTime(
2178
- __FUNCTION__,
2179
- $time, // Caller, start time, task performed.
2180
- sprintf('compressing JS w/ checksum: `%1$s`', md5($js))
2181
- );
2182
- }
2183
- return $js;
2184
- }
2185
-
2186
- /**
2187
- * Maybe compress inline JS code within the HTML source.
2188
- *
2189
- * @since 140417 Initial release.
2190
- *
2191
- * @param string $html Raw HTML code.
2192
- *
2193
- * @return string HTML source code, with possible inline JS compression.
2194
- */
2195
- protected function maybeCompressInlineJsCode($html)
2196
- {
2197
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
2198
- $time = microtime(true);
2199
- }
2200
- $html = (string) $html; // Force string value.
2201
-
2202
- if (isset($this->options['compress_js_code'])) {
2203
- if (!$this->options['compress_js_code']) {
2204
- $disabled = true; // Disabled flag.
2205
- }
2206
- }
2207
- if (isset($this->options['compress_inline_js_code'])) {
2208
- if (!$this->options['compress_inline_js_code']) {
2209
- $disabled = true; // Disabled flag.
2210
- }
2211
- }
2212
- if (!$html || !empty($disabled)) {
2213
- goto finale; // Nothing to do.
2214
- }
2215
- if (($html_frag = $this->getHtmlFrag($html)) && ($js_tag_frags = $this->getJsTagFrags($html_frag))) {
2216
- foreach ($js_tag_frags as $_js_tag_frag_key => $_js_tag_frag) {
2217
- if (!$_js_tag_frag['exclude'] && $_js_tag_frag['script_js']) {
2218
- $js_tag_frags_script_js_parts[] = $_js_tag_frag['all'];
2219
- $js_tag_frags_script_js_part_placeholders[] = '%%htmlc-'.$_js_tag_frag_key.'%%';
2220
- $js_tag_frags_script_js_part_placeholder_key_replacements[] = $_js_tag_frag_key;
2221
- }
2222
- }
2223
- unset($_js_tag_frag_key, $_js_tag_frag); // Housekeeping.
2224
-
2225
- if (isset($js_tag_frags_script_js_parts, $js_tag_frags_script_js_part_placeholders, $js_tag_frags_script_js_part_placeholder_key_replacements)) {
2226
- $html = $this->replaceOnce($js_tag_frags_script_js_parts, $js_tag_frags_script_js_part_placeholders, $html);
2227
-
2228
- foreach ($js_tag_frags_script_js_part_placeholder_key_replacements as &$_js_tag_frag_key_replacement) {
2229
- $_js_tag_frag = $js_tag_frags[$_js_tag_frag_key_replacement];
2230
-
2231
- $_js_tag_frag_key_replacement = $_js_tag_frag['if_open_tag'];
2232
- $_js_tag_frag_key_replacement .= $_js_tag_frag['script_open_tag'];
2233
- $_js_tag_frag_key_replacement .= $this->compressInlineJsCode($_js_tag_frag['script_js']);
2234
- $_js_tag_frag_key_replacement .= $_js_tag_frag['script_closing_tag'];
2235
- $_js_tag_frag_key_replacement .= $_js_tag_frag['if_closing_tag'];
2236
- }
2237
- unset($_js_tag_frag_key_replacement, $_js_tag_frag); // Housekeeping.
2238
-
2239
- $html = $this->replaceOnce($js_tag_frags_script_js_part_placeholders, $js_tag_frags_script_js_part_placeholder_key_replacements, $html);
2240
-
2241
- if ($benchmark) {
2242
- $this->benchmark->addData(
2243
- __FUNCTION__,
2244
- compact(
2245
- 'js_tag_frags',
2246
- 'js_tag_frags_script_js_parts',
2247
- 'js_tag_frags_script_js_part_placeholders',
2248
- 'js_tag_frags_script_js_part_placeholder_key_replacements'
2249
- )
2250
- );
2251
- }
2252
- }
2253
- }
2254
- finale: // Target point; finale/return value.
2255
-
2256
- if ($html) {
2257
- $html = trim($html);
2258
- } // Trim it up now!
2259
-
2260
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
2261
- $this->benchmark->addTime(
2262
- __FUNCTION__,
2263
- $time, // Caller, start time, task performed.
2264
- sprintf('compressing inline JS in checksum: `%1$s`', md5($html))
2265
- );
2266
- }
2267
- return $html; // With possible compression having been applied here.
2268
- }
2269
-
2270
- /**
2271
- * Helper function; compress inline JS code.
2272
- *
2273
- * @since 140417 Initial release.
2274
- *
2275
- * @param string $js Raw JS code.
2276
- *
2277
- * @return string JS code (possibly minified).
2278
- */
2279
- protected function compressInlineJsCode($js)
2280
- {
2281
- if (!($js = (string) $js)) {
2282
- return $js; // Nothing to do.
2283
- }
2284
- if (($compressed_js = \WebSharks\JsMinifier\Core::compress($js))) {
2285
- return '/*<![CDATA[*/'.$compressed_js.'/*]]>*/';
2286
- }
2287
- return $js;
2288
- }
2289
-
2290
- /**
2291
- * Maybe compress inline JSON code within the HTML source.
2292
- *
2293
- * @since 150424 Adding support for JSON compression.
2294
- *
2295
- * @param string $html Raw HTML code.
2296
- *
2297
- * @return string HTML source code, with possible inline JSON compression.
2298
- */
2299
- protected function maybeCompressInlineJsonCode($html)
2300
- {
2301
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
2302
- $time = microtime(true);
2303
- }
2304
- $html = (string) $html; // Force string value.
2305
-
2306
- if (isset($this->options['compress_js_code'])) {
2307
- if (!$this->options['compress_js_code']) {
2308
- $disabled = true; // Disabled flag.
2309
- }
2310
- }
2311
- if (isset($this->options['compress_inline_js_code'])) {
2312
- if (!$this->options['compress_inline_js_code']) {
2313
- $disabled = true; // Disabled flag.
2314
- }
2315
- }
2316
- if (!$html || !empty($disabled)) {
2317
- goto finale; // Nothing to do.
2318
- }
2319
- if (($html_frag = $this->getHtmlFrag($html)) && ($js_tag_frags = $this->getJsTagFrags($html_frag))) {
2320
- foreach ($js_tag_frags as $_js_tag_frag_key => $_js_tag_frag) {
2321
- if (!$_js_tag_frag['exclude'] && $_js_tag_frag['script_json']) {
2322
- $js_tag_frags_script_json_parts[] = $_js_tag_frag['all'];
2323
- $js_tag_frags_script_json_part_placeholders[] = '%%htmlc-'.$_js_tag_frag_key.'%%';
2324
- $js_tag_frags_script_json_part_placeholder_key_replacements[] = $_js_tag_frag_key;
2325
- }
2326
- }
2327
- unset($_js_tag_frag_key, $_js_tag_frag); // Housekeeping.
2328
-
2329
- if (isset($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements)) {
2330
- $html = $this->replaceOnce($js_tag_frags_script_json_parts, $js_tag_frags_script_json_part_placeholders, $html);
2331
-
2332
- foreach ($js_tag_frags_script_json_part_placeholder_key_replacements as &$_json_tag_frag_key_replacement) {
2333
- $_js_tag_frag = $js_tag_frags[$_json_tag_frag_key_replacement];
2334
-
2335
- $_json_tag_frag_key_replacement = $_js_tag_frag['if_open_tag'];
2336
- $_json_tag_frag_key_replacement .= $_js_tag_frag['script_open_tag'];
2337
- $_json_tag_frag_key_replacement .= $this->compressInlineJsonCode($_js_tag_frag['script_json']);
2338
- $_json_tag_frag_key_replacement .= $_js_tag_frag['script_closing_tag'];
2339
- $_json_tag_frag_key_replacement .= $_js_tag_frag['if_closing_tag'];
2340
- }
2341
- unset($_json_tag_frag_key_replacement, $_js_tag_frag); // Housekeeping.
2342
-
2343
- $html = $this->replaceOnce($js_tag_frags_script_json_part_placeholders, $js_tag_frags_script_json_part_placeholder_key_replacements, $html);
2344
-
2345
- if ($benchmark) {
2346
- $this->benchmark->addData(
2347
- __FUNCTION__,
2348
- compact(
2349
- 'js_tag_frags',
2350
- 'js_tag_frags_script_json_parts',
2351
- 'js_tag_frags_script_json_part_placeholders',
2352
- 'js_tag_frags_script_json_part_placeholder_key_replacements'
2353
- )
2354
- );
2355
- }
2356
- }
2357
- }
2358
- finale: // Target point; finale/return value.
2359
-
2360
- if ($html) {
2361
- $html = trim($html);
2362
- } // Trim it up now!
2363
-
2364
- if ($benchmark && !empty($time) && $html && empty($disabled)) {
2365
- $this->benchmark->addTime(
2366
- __FUNCTION__,
2367
- $time, // Caller, start time, task performed.
2368
- sprintf('compressing inline JSON in checksum: `%1$s`', md5($html))
2369
- );
2370
- }
2371
- return $html; // With possible compression having been applied here.
2372
- }
2373
-
2374
- /**
2375
- * Helper function; compress inline JSON code.
2376
- *
2377
- * @since 150424 Adding support for JSON compression.
2378
- *
2379
- * @param string $js Raw JSON code.
2380
- *
2381
- * @return string JSON code (possibly minified).
2382
- */
2383
- protected function compressInlineJsonCode($json)
2384
- {
2385
- if (!($json = (string) $json)) {
2386
- return $json; // Nothing to do.
2387
- }
2388
- if (($compressed_json = \WebSharks\JsMinifier\Core::compress($json))) {
2389
- return '/*<![CDATA[*/'.$compressed_json.'/*]]>*/';
2390
- }
2391
- return $json;
2392
- }
2393
-
2394
- /********************************************************************************************************/
2395
-
2396
- /*
2397
- * Array Utilities
2398
- */
2399
-
2400
- /**
2401
- * Compiles a new array of all `$key` elements (deeply).
2402
- *
2403
- * @since 140417 Initial release.
2404
- *
2405
- * @note This is a recursive scan running deeply into multiple dimensions of arrays.
2406
- *
2407
- * @param array $array An input array to search in.
2408
- * @param string|int|array $keys An array of `key` elements to compile.
2409
- * In other words, elements with one of these array keys, are what we're looking for.
2410
- * A string|integer is also accepted here (if only one key), and it's converted internally to an array.
2411
- * @param bool $preserve_keys Optional. Defaults to a FALSE value.
2412
- * If this is TRUE, the return array WILL preserve numeric/associative keys, instead of forcing a numerically indexed array.
2413
- * This ALSO prevents duplicates in the return array, which may NOT be desirable in certain circumstances.
2414
- * Particularly when/if searching a multidimensional array (where keys could be found in multiple dimensions).
2415
- * In fact, in some cases, this could return data you did NOT want/expect, so please be cautious.
2416
- * @param int $search_dimensions The number of dimensions to search. Defaults to `-1` (infinite).
2417
- * If `$preserve_keys` is TRUE, consider setting this to a value of `1`.
2418
- * @param int $___current_dimension For internal use only; used in recursion.
2419
- *
2420
- * @return array The array of compiled key elements, else an empty array, if no key elements were found.
2421
- * By default, the return array will be indexed numerically (e.g. keys are NOT preserved here).
2422
- * If an associative array is preferred, please set `$preserve_keys` to a TRUE value,
2423
- * and please consider setting `$search_dimensions` to `1`.
2424
- */
2425
- protected function compileKeyElementsDeep(array $array, $keys, $preserve_keys = false, $search_dimensions = -1, $___current_dimension = 1)
2426
- {
2427
- if ($___current_dimension === 1) {
2428
- $keys = (array) $keys;
2429
- $search_dimensions = (integer) $search_dimensions;
2430
- }
2431
- $key_elements = array(); // Initialize.
2432
-
2433
- foreach ($array as $_key => $_value) {
2434
- if (in_array($_key, $keys, true)) {
2435
- if ($preserve_keys) {
2436
- $key_elements[$_key] = $_value;
2437
- } else {
2438
- $key_elements[] = $_value;
2439
- }
2440
- }
2441
- if (($search_dimensions < 1 || $___current_dimension < $search_dimensions) && is_array($_value)
2442
- && ($_key_elements = $this->compileKeyElementsDeep($_value, $keys, $preserve_keys, $search_dimensions, $___current_dimension + 1))
2443
- ) {
2444
- $key_elements = array_merge($key_elements, $_key_elements);
2445
- }
2446
- }
2447
- unset($_key, $_value, $_key_elements);
2448
-
2449
- return $key_elements;
2450
- }
2451
-
2452
- /**
2453
- * Removes all numeric array keys (deeply).
2454
- *
2455
- * @since 140417 Initial release.
2456
- *
2457
- * @note This is a recursive scan running deeply into multiple dimensions of arrays.
2458
- *
2459
- * @param array $array An input array.
2460
- * @param bool $___recursion Internal use only.
2461
- *
2462
- * @return array Output array with only non-numeric keys (deeply).
2463
- */
2464
- protected function removeNumericKeysDeep(array $array, $___recursion = false)
2465
- {
2466
- foreach ($array as $_key => &$_value) {
2467
- if (is_numeric($_key)) {
2468
- unset($array[$_key]);
2469
- } elseif (is_array($_value)) {
2470
- $_value = $this->removeNumericKeysDeep($_value, true);
2471
- }
2472
- }
2473
- unset($_key, $_value);
2474
-
2475
- return $array;
2476
- }
2477
-
2478
- /********************************************************************************************************/
2479
-
2480
- /*
2481
- * String Utilities
2482
- */
2483
-
2484
- /**
2485
- * Removes UTF-8 BOM (Byte Order Marker).
2486
- *
2487
- * @since 15xxxx Correcting bug in CSS compilation.
2488
- *
2489
- * @param string $string Input string to strip.
2490
- *
2491
- * @return string Stripped string.
2492
- */
2493
- protected function stripUtf8Bom($string)
2494
- {
2495
- if (!($string = (string) $string)) {
2496
- return $string;
2497
- }
2498
- return preg_replace('/^\xEF\xBB\xBF/', '', $string);
2499
- }
2500
-
2501
- /**
2502
- * Escapes regex special chars deeply (i.e. `preg_quote()` deeply).
2503
- *
2504
- * @since 140417 Initial release.
2505
- *
2506
- * @note This is a recursive scan running deeply into multiple dimensions of arrays/objects.
2507
- * @note This routine will usually NOT include private, protected or static properties of an object class.
2508
- * However, private/protected properties *will* be included, if the current scope allows access to these private/protected properties.
2509
- * Static properties are NEVER considered by this routine, because static properties are NOT iterated by `foreach()`.
2510
- *
2511
- * @param mixed $value Any value can be converted into a quoted string.
2512
- * Actually, objects can't, but this recurses into objects.
2513
- * @param string $delimiter Same as PHP's `preg_quote()`.
2514
- * @param bool $___recursion Internal use only.
2515
- *
2516
- * @return string|array|object Escaped string, array, object.
2517
- */
2518
- protected function pregQuoteDeep($value, $delimiter = '', $___recursion = false)
2519
- {
2520
- if (is_array($value) || is_object($value)) {
2521
- foreach ($value as &$_value) {
2522
- $_value = $this->pregQuoteDeep($_value, $delimiter, true);
2523
- }
2524
- unset($_value); // Housekeeping.
2525
-
2526
- return $value;
2527
- }
2528
- return preg_quote((string) $value, (string) $delimiter);
2529
- }
2530
-
2531
- /**
2532
- * String replace (ONE time), and deeply into arrays/objects.
2533
- *
2534
- * @since 140417 Initial release.
2535
- *
2536
- * @note This is a recursive scan running deeply into multiple dimensions of arrays/objects.
2537
- * @note This routine will usually NOT include private, protected or static properties of an object class.
2538
- * However, private/protected properties *will* be included, if the current scope allows access to these private/protected properties.
2539
- * Static properties are NEVER considered by this routine, because static properties are NOT iterated by `foreach()`.
2540
- *
2541
- * @param string|array $needle String, or an array of strings, to search for.
2542
- * @param string|array $replace String, or an array of strings, to use as replacements.
2543
- * @param mixed $value Any value can be converted into a string to run replacements on.
2544
- * Actually, objects can't, but this recurses into objects.
2545
- * @param bool $case_insensitive Case insensitive? Defaults to FALSE.
2546
- * If TRUE, the search is NOT case sensitive.
2547
- * @param bool $___recursion Internal use only.
2548
- *
2549
- * @return mixed Values after ONE string replacement (deeply).
2550
- * Any values that were NOT strings|arrays|objects, will be converted to strings by this routine.
2551
- *
2552
- * @see http://stackoverflow.com/questions/8177296/when-to-use-strtr-vs-str-replace
2553
- */
2554
- protected function replaceOnceDeep($needle, $replace, $value, $case_insensitive = false, $___recursion = false)
2555
- {
2556
- if (is_array($value) || is_object($value)) {
2557
- foreach ($value as &$_value) {
2558
- $_value = $this->replaceOnceDeep($needle, $replace, $_value, $case_insensitive, true);
2559
- }
2560
- unset($_value); // Housekeeping.
2561
-
2562
- return $value; // Array or object.
2563
- }
2564
- $value = (string) $value; // Force string value.
2565
- $strpos = $case_insensitive ? 'stripos' : 'strpos';
2566
-
2567
- if (is_array($needle)) {
2568
- if (is_array($replace)) {
2569
- foreach ($needle as $_key => $_needle) {
2570
- if (($_strpos = $strpos($value, ($_needle = (string) $_needle))) !== false) {
2571
- $_length = strlen($_needle);
2572
- $_replace = (isset($replace[$_key])) ? (string) $replace[$_key] : '';
2573
- $value = substr_replace($value, $_replace, $_strpos, $_length);
2574
- }
2575
- }
2576
- unset($_key, $_needle, $_strpos, $_length, $_replace);
2577
-
2578
- return $value; // String value.
2579
- } else {
2580
- $replace = (string) $replace;
2581
-
2582
- foreach ($needle as $_needle) {
2583
- if (($_strpos = $strpos($value, ($_needle = (string) $_needle))) !== false) {
2584
- $_length = strlen($_needle);
2585
- $value = substr_replace($value, $replace, $_strpos, $_length);
2586
- }
2587
- }
2588
- unset($_needle, $_strpos, $_length);
2589
-
2590
- return $value; // String value.
2591
- }
2592
- } else {
2593
- $needle = (string) $needle;
2594
-
2595
- if (($_strpos = $strpos($value, $needle)) !== false) {
2596
- $_length = strlen($needle);
2597
-
2598
- if (is_array($replace)) {
2599
- $_replace = (isset($replace[0])) ? (string) $replace[0] : '';
2600
- } else {
2601
- $_replace = (string) $replace;
2602
- }
2603
- $value = substr_replace($value, $_replace, $_strpos, $_length);
2604
- }
2605
- unset($_strpos, $_length, $_replace);
2606
-
2607
- return $value; // String value.
2608
- }
2609
- }
2610
-
2611
- /**
2612
- * String replace (ONE time).
2613
- *
2614
- * @since 140417 Initial release.
2615
- *
2616
- * @param string|array $needle String, or an array of strings, to search for.
2617
- * @param string|array $replace String, or an array of strings, to use as replacements.
2618
- * @param string $string The subject value to search/replace; i.e. a string.
2619
- * @param bool $case_insensitive Case insensitive? Defaults to FALSE.
2620
- * If TRUE, the search is NOT case sensitive.
2621
- *
2622
- * @return string String value after having been searched/replaced.
2623
- *
2624
- * @see http://stackoverflow.com/questions/8177296/when-to-use-strtr-vs-str-replace
2625
- */
2626
- protected function replaceOnce($needle, $replace, $string, $case_insensitive = false)
2627
- {
2628
- return $this->replaceOnceDeep($needle, $replace, (string) $string, $case_insensitive);
2629
- }
2630
-
2631
- /**
2632
- * Escapes regex backreference chars deeply (i.e. `\\$` and `\\\\`).
2633
- *
2634
- * @since 140417 Initial release.
2635
- *
2636
- * @note This is a recursive scan running deeply into multiple dimensions of arrays/objects.
2637
- * @note This routine will usually NOT include private, protected or static properties of an object class.
2638
- * However, private/protected properties *will* be included, if the current scope allows access to these private/protected properties.
2639
- * Static properties are NEVER considered by this routine, because static properties are NOT iterated by `foreach()`.
2640
- *
2641
- * @param mixed $value Any value can be converted into an escaped string.
2642
- * Actually, objects can't, but this recurses into objects.
2643
- * @param int $times Number of escapes. Defaults to `1`.
2644
- * @param bool $___recursion Internal use only.
2645
- *
2646
- * @return string|array|object Escaped string, array, object.
2647
- */
2648
- protected function escRefsDeep($value, $times = 1, $___recursion = false)
2649
- {
2650
- if (is_array($value) || is_object($value)) {
2651
- foreach ($value as &$_value) {
2652
- $_value = $this->escRefsDeep($_value, $times, true);
2653
- }
2654
- unset($_value); // Housekeeping.
2655
-
2656
- return $value;
2657
- }
2658
- $value = (string) $value;
2659
- $times = abs((integer) $times);
2660
-
2661
- return str_replace(array('\\', '$'), array(str_repeat('\\', $times).'\\', str_repeat('\\', $times).'$'), $value);
2662
- }
2663
-
2664
- /**
2665
- * Escapes regex backreference chars (i.e. `\\$` and `\\\\`).
2666
- *
2667
- * @since 140417 Initial release.
2668
- *
2669
- * @param string $string A string value.
2670
- * @param int $times Number of escapes. Defaults to `1`.
2671
- *
2672
- * @return string Escaped string.
2673
- */
2674
- protected function escRefs($string, $times = 1)
2675
- {
2676
- return $this->escRefsDeep((string) $string, $times);
2677
- }
2678
-
2679
- /**
2680
- * Cleans up self-closing HTML tag lines.
2681
- *
2682
- * @since 140417 Initial release.
2683
- *
2684
- * @param string $html Self-closing HTML tag lines.
2685
- *
2686
- * @return string Cleaned self-closing HTML tag lines.
2687
- */
2688
- protected function cleanupSelfClosingHtmlTagLines($html)
2689
- {
2690
- if (!($html = (string) $html)) {
2691
- return $html; // Nothing to do.
2692
- }
2693
- return trim(preg_replace('/\>\s*?'."[\r\n]+".'\s*\</', ">\n<", $html));
2694
- }
2695
-
2696
- /********************************************************************************************************/
2697
-
2698
- /*
2699
- * Directory Utilities
2700
- */
2701
-
2702
- /**
2703
- * Public directory type.
2704
- *
2705
- * @since 140417 Initial release.
2706
- *
2707
- * @type string Indicates a public directory type.
2708
- *
2709
- * @internal This is for internal use only.
2710
- */
2711
- const DIR_PUBLIC_TYPE = 'public';
2712
-
2713
- /**
2714
- * Private directory type.
2715
- *
2716
- * @since 140417 Initial release.
2717
- *
2718
- * @type string Indicates a private directory type.
2719
- *
2720
- * @internal This is for internal use only.
2721
- */
2722
- const DIR_PRIVATE_TYPE = 'private';
2723
-
2724
- /**
2725
- * Get (and possibly create) the cache dir.
2726
- *
2727
- * @since 140417 Initial release.
2728
- *
2729
- * @param string $type One of `$this::dir_public_type` or `$this::dir_private_type`.
2730
- * @param string $checksum Optional. If supplied, we'll build a nested sub-directory based on the checksum.
2731
- * @param bool $base_only Defaults to a FALSE value. If TRUE, return only the base directory.
2732
- * i.e. Do NOT suffix the directory in any way. No host and no checksum.
2733
- *
2734
- * @throws \Exception If unable to create the cache dir.
2735
- * @throws \Exception If cache directory is not readable/writable.
2736
- *
2737
- * @return string Server path to cache dir.
2738
- */
2739
- protected function cacheDir($type, $checksum = '', $base_only = false)
2740
- {
2741
- if ($type !== $this::DIR_PUBLIC_TYPE) {
2742
- if ($type !== $this::DIR_PRIVATE_TYPE) {
2743
- throw new \Exception('Invalid type.');
2744
- }
2745
- }
2746
- $checksum = (string) $checksum;
2747
-
2748
- if (isset($checksum[4])) {
2749
- $checksum = substr($checksum, 0, 5);
2750
- } else {
2751
- $checksum = ''; // Invalid or empty.
2752
- }
2753
- $cache_key = $type.$checksum.(integer) $base_only;
2754
-
2755
- if (isset($this->cache[__FUNCTION__.'_'.$cache_key])) {
2756
- return $this->cache[__FUNCTION__.'_'.$cache_key];
2757
- }
2758
- if (!empty($this->options['cache_dir_'.$type])) {
2759
- $basedir = $this->nDirSeps($this->options['cache_dir_'.$type]);
2760
- } elseif (defined('WP_CONTENT_DIR')) {
2761
- $basedir = $this->nDirSeps(WP_CONTENT_DIR.'/htmlc/cache/'.$type);
2762
- } elseif (!empty($_SERVER['DOCUMENT_ROOT'])) {
2763
- $basedir = $this->nDirSeps($_SERVER['DOCUMENT_ROOT'].'/htmlc/cache/'.$type);
2764
- } else {
2765
- throw new \Exception(sprintf('Unable to find a good location for the cache directory. Please set option: `%1$s`.', __FUNCTION__.'_'.$type));
2766
- }
2767
- if ($base_only) {
2768
- $dir = $basedir; // Caller wants only the base directory.
2769
- } else {
2770
- $dir = $basedir; // Start with the base directory.
2771
- $dir .= '/'.trim(preg_replace('/[^a-z0-9]/i', '-', $this->currentUrlHost()), '-');
2772
- $dir .= $checksum ? '/'.implode('/', str_split($checksum)) : '';
2773
- }
2774
- if (!is_dir($dir) && mkdir($dir, 0755, true)) {
2775
- if ($type === $this::DIR_PUBLIC_TYPE && !is_file($basedir.'/.htaccess')) {
2776
- if (!file_put_contents($basedir.'/.htaccess', $this->dir_htaccess_allow)) {
2777
- throw new \Exception(sprintf('Unable to create `.htaccess` file in public cache directory: `%1$s`.', $basedir));
2778
- }
2779
- }
2780
- if ($type === $this::DIR_PRIVATE_TYPE && !is_file($basedir.'/.htaccess')) {
2781
- if (!file_put_contents($basedir.'/.htaccess', $this->dir_htaccess_deny)) {
2782
- throw new \Exception(sprintf('Unable to create `.htaccess` file in private cache directory: `%1$s`.', $basedir));
2783
- }
2784
- }
2785
- }
2786
- if (!is_readable($dir) || !is_writable($dir)) {
2787
- throw new \Exception(sprintf('Cache directory not readable/writable: `%1$s`. Failed on `%2$s`.', $basedir, $dir));
2788
- }
2789
- return $this->cache[__FUNCTION__.'_'.$cache_key] = $dir;
2790
- }
2791
-
2792
- /**
2793
- * Get (and possibly create) the cache dir URL.
2794
- *
2795
- * @since 140417 Initial release.
2796
- *
2797
- * @param string $type One of `$this::public_type` or `$this::private_type`.
2798
- * @param string $checksum Optional. If supplied, we'll build a nested sub-directory based on the checksum.
2799
- * @param bool $base_only Defaults to a FALSE value. If TRUE, return only the base directory.
2800
- * i.e. Do NOT suffix the directory in any way. No host and no checksum.
2801
- *
2802
- * @throws \Exception If unable to create the cache dir.
2803
- * @throws \Exception If cache directory is not readable/writable.
2804
- * @throws \Exception If unable to determine the URL for any reason.
2805
- *
2806
- * @return string URL to server-side cache directory.
2807
- */
2808
- protected function cacheDirUrl($type, $checksum = '', $base_only = false)
2809
- {
2810
- if ($type !== $this::DIR_PUBLIC_TYPE) {
2811
- if ($type !== $this::DIR_PRIVATE_TYPE) {
2812
- throw new \Exception('Invalid type.');
2813
- }
2814
- }
2815
- $checksum = (string) $checksum;
2816
-
2817
- if (isset($checksum[4])) {
2818
- $checksum = substr($checksum, 0, 5);
2819
- } else {
2820
- $checksum = ''; // Invalid or empty.
2821
- }
2822
- $cache_key = $type.$checksum.(integer) $base_only;
2823
-
2824
- if (isset($this->cache[__FUNCTION__.'_'.$cache_key])) {
2825
- return $this->cache[__FUNCTION__.'_'.$cache_key];
2826
- }
2827
- $basedir = $this->cacheDir($type, '', true);
2828
-
2829
- if (!empty($this->options['cache_dir_url_'.$type])) {
2830
- $baseurl = $this->setUrlScheme(rtrim($this->options['cache_dir_url_'.$type], '/'));
2831
- } elseif (defined('WP_CONTENT_DIR') && defined('WP_CONTENT_URL') && $basedir === $this->nDirSeps(WP_CONTENT_DIR.'/htmlc/cache/'.$type)) {
2832
- $baseurl = $this->setUrlScheme(rtrim(WP_CONTENT_URL, '/').'/htmlc/cache/'.$type);
2833
- } elseif (!empty($_SERVER['DOCUMENT_ROOT']) && strpos($basedir, $_SERVER['DOCUMENT_ROOT']) === 0) {
2834
- $baseurl = $this->currentUrlScheme().'://'.$this->currentUrlHost();
2835
- $baseurl .= str_replace(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '', $basedir);
2836
- } else {
2837
- throw new \Exception(sprintf('Unable to determine URL to cache directory. Please set option: `%1$s`.', __FUNCTION__.'_'.$type));
2838
- }
2839
- if ($base_only) {
2840
- $url = $baseurl; // Caller wants only the base directory.
2841
- } else {
2842
- $url = $baseurl; // Start with the base URL.
2843
- $url .= '/'.trim(preg_replace('/[^a-z0-9]/i', '-', $this->currentUrlHost()), '-');
2844
- $url .= $checksum ? '/'.implode('/', str_split($checksum)) : '';
2845
- }
2846
- return $this->cache[__FUNCTION__.'_'.$cache_key] = $url;
2847
- }
2848
-
2849
- /**
2850
- * Cache cleanup routine.
2851
- *
2852
- * @since 140417 Initial release.
2853
- *
2854
- * @note This routine is always host-specific.
2855
- * i.e. We cleanup cache files for the current host only.
2856
- */
2857
- protected function cleanupCacheDirs()
2858
- {
2859
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
2860
- $time = microtime(true);
2861
- }
2862
- $public_cache_dir = $this->cacheDir($this::DIR_PUBLIC_TYPE);
2863
- $private_cache_dir = $this->cacheDir($this::DIR_PRIVATE_TYPE);
2864
- $min_mtime = strtotime('-'.$this->cache_expiration_time);
2865
-
2866
- /** @type $_dir_file \RecursiveDirectoryIterator For IDEs. */
2867
- foreach ($this->dirRegexIteration($public_cache_dir, '/\/compressor\-part\..*$/') as $_dir_file) {
2868
- if (($_dir_file->isFile() || $_dir_file->isLink()) && $_dir_file->getMTime() < $min_mtime - 3600) {
2869
- if ($_dir_file->isWritable()) {
2870
- unlink($_dir_file->getPathname());
2871
- }
2872
- }
2873
- }
2874
- /** @type $_dir_file \RecursiveDirectoryIterator For IDEs. */
2875
- foreach ($this->dirRegexIteration($private_cache_dir, '/\/compressor\-parts\..*$/') as $_dir_file) {
2876
- if (($_dir_file->isFile() || $_dir_file->isLink()) && $_dir_file->getMTime() < $min_mtime) {
2877
- if ($_dir_file->isWritable()) {
2878
- unlink($_dir_file->getPathname());
2879
- }
2880
- }
2881
- }
2882
- unset($_dir_file); // Housekeeping.
2883
-
2884
- if ($benchmark && !empty($time)) {
2885
- $this->benchmark->addTime(
2886
- __FUNCTION__,
2887
- $time, // Caller, start time, task performed.
2888
- 'cleaning up the public/private cache directories'
2889
- );
2890
- }
2891
- }
2892
-
2893
- /**
2894
- * Regex directory iterator.
2895
- *
2896
- * @since 140417 Initial release.
2897
- *
2898
- * @param string $dir Path to a directory.
2899
- * @param string $regex Regular expression.
2900
- *
2901
- * @return \RegexIterator
2902
- */
2903
- protected function dirRegexIteration($dir, $regex)
2904
- {
2905
- $dir = (string) $dir;
2906
- $regex = (string) $regex;
2907
-
2908
- $dir_iterator = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_SELF | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS);
2909
- $iterator_iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::CHILD_FIRST);
2910
- $regex_iterator = new \RegexIterator($iterator_iterator, $regex, \RegexIterator::MATCH, \RegexIterator::USE_KEY);
2911
-
2912
- return $regex_iterator;
2913
- }
2914
-
2915
- /**
2916
- * Normalizes directory/file separators.
2917
- *
2918
- * @since 140417 Initial release.
2919
- *
2920
- * @param string $dir_file Directory/file path.
2921
- * @param bool $allow_trailing_slash Defaults to FALSE.
2922
- * If TRUE; and `$dir_file` contains a trailing slash; we'll leave it there.
2923
- *
2924
- * @return string Normalized directory/file path.
2925
- */
2926
- protected function nDirSeps($dir_file, $allow_trailing_slash = false)
2927
- {
2928
- if (($dir_file = (string) $dir_file) === '') {
2929
- return $dir_file; // Nothing to do.
2930
- }
2931
- if (strpos($dir_file, '://' !== false)) {
2932
- if (preg_match('/^(?P<stream_wrapper>[a-z0-9]+)\:\/\//i', $dir_file, $stream_wrapper)) {
2933
- $dir_file = preg_replace('/^(?P<stream_wrapper>[a-z0-9]+)\:\/\//i', '', $dir_file);
2934
- }
2935
- if (strpos($dir_file, ':' !== false)) {
2936
- if (preg_match('/^(?P<drive_letter>[a-z])\:[\/\\\\]/i', $dir_file)) {
2937
- $dir_file = preg_replace_callback('/^(?P<drive_letter>[a-z])\:[\/\\\\]/i', create_function('$m', 'return strtoupper($m[0]);'), $dir_file);
2938
- }
2939
- $dir_file = preg_replace('/\/+/', '/', str_replace(array(DIRECTORY_SEPARATOR, '\\', '/'), '/', $dir_file));
2940
- }
2941
- $dir_file = ($allow_trailing_slash) ? $dir_file : rtrim($dir_file, '/'); // Strip trailing slashes.
2942
- }
2943
- if (!empty($stream_wrapper[0])) {
2944
- $dir_file = strtolower($stream_wrapper[0]).$dir_file;
2945
- }
2946
- return $dir_file; // Normalized now.
2947
- }
2948
-
2949
- /**
2950
- * Apache `.htaccess` denial snippet.
2951
- *
2952
- * @since 140417 Initial release.
2953
- *
2954
- * @type string Compatible with Apache 2.1+. Tested up to 2.4.7.
2955
- */
2956
- protected $dir_htaccess_deny = "<IfModule authz_core_module>\n\tRequire all denied\n</IfModule>\n<IfModule !authz_core_module>\n\tdeny from all\n</IfModule>";
2957
-
2958
- /**
2959
- * Apache `.htaccess` for public files.
2960
- *
2961
- * @since 150321 Improving publicly cacheable files.
2962
- *
2963
- * @type string Compatible with Apache 2.1+. Tested up to 2.4.7.
2964
- */
2965
- protected $dir_htaccess_allow = "<IfModule authz_core_module>\n\tRequire all granted\n</IfModule>\n<IfModule !authz_core_module>\n\tallow from all\n</IfModule>\n\n<IfModule headers_module>\n\t<FilesMatch \"\\.(html|js|css)$\">\n\t\tHeader append Vary: Accept-Encoding\n\t</FilesMatch>\n</IfModule>";
2966
-
2967
- /********************************************************************************************************/
2968
-
2969
- /*
2970
- * URL Utilities
2971
- */
2972
-
2973
- /**
2974
- * Indicates scheme component in a URL.
2975
- *
2976
- * @since 140417 Initial release.
2977
- *
2978
- * @type int Part of a bitmask.
2979
- *
2980
- * @internal Internal use only.
2981
- */
2982
- const URL_SCHEME = 1;
2983
-
2984
- /**
2985
- * Indicates user component in a URL.
2986
- *
2987
- * @since 140417 Initial release.
2988
- *
2989
- * @type int Part of a bitmask.
2990
- *
2991
- * @internal Internal use only.
2992
- */
2993
- const URL_USER = 2;
2994
-
2995
- /**
2996
- * Indicates pass component in a URL.
2997
- *
2998
- * @since 140417 Initial release.
2999
- *
3000
- * @type int Part of a bitmask.
3001
- *
3002
- * @internal Internal use only.
3003
- */
3004
- const URL_PASS = 4;
3005
-
3006
- /**
3007
- * Indicates host component in a URL.
3008
- *
3009
- * @since 140417 Initial release.
3010
- *
3011
- * @type int Part of a bitmask.
3012
- *
3013
- * @internal Internal use only.
3014
- */
3015
- const URL_HOST = 8;
3016
-
3017
- /**
3018
- * Indicates port component in a URL.
3019
- *
3020
- * @since 140417 Initial release.
3021
- *
3022
- * @type int Part of a bitmask.
3023
- *
3024
- * @internal Internal use only.
3025
- */
3026
- const URL_PORT = 16;
3027
-
3028
- /**
3029
- * Indicates path component in a URL.
3030
- *
3031
- * @since 140417 Initial release.
3032
- *
3033
- * @type int Part of a bitmask.
3034
- *
3035
- * @internal Internal use only.
3036
- */
3037
- const URL_PATH = 32;
3038
-
3039
- /**
3040
- * Indicates query component in a URL.
3041
- *
3042
- * @since 140417 Initial release.
3043
- *
3044
- * @type int Part of a bitmask.
3045
- *
3046
- * @internal Internal use only.
3047
- */
3048
- const URL_QUERY = 64;
3049
-
3050
- /**
3051
- * Indicates fragment component in a URL.
3052
- *
3053
- * @since 140417 Initial release.
3054
- *
3055
- * @type int Part of a bitmask.
3056
- *
3057
- * @internal Internal use only.
3058
- */
3059
- const URL_FRAGMENT = 128;
3060
-
3061
- /**
3062
- * Is the current request over SSL?
3063
- *
3064
- * @since 140417 Initial release.
3065
- *
3066
- * @return bool TRUE if over SSL; else FALSE.
3067
- */
3068
- protected function currentUrlSsl()
3069
- {
3070
- if (isset(static::$static[__FUNCTION__])) {
3071
- return static::$static[__FUNCTION__];
3072
- }
3073
- if (!empty($_SERVER['SERVER_PORT'])) {
3074
- if ((integer) $_SERVER['SERVER_PORT'] === 443) {
3075
- return static::$static[__FUNCTION__] = true;
3076
- }
3077
- }
3078
- if (!empty($_SERVER['HTTPS'])) {
3079
- if (filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN)) {
3080
- return static::$static[__FUNCTION__] = true;
3081
- }
3082
- }
3083
- if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
3084
- if (strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0) {
3085
- return static::$static[__FUNCTION__] = true;
3086
- }
3087
- }
3088
- return static::$static[__FUNCTION__] = false;
3089
- }
3090
-
3091
- /**
3092
- * Gets the current scheme (via environment variables).
3093
- *
3094
- * @since 140417 Initial release.
3095
- *
3096
- * @throws \Exception If unable to determine the current scheme.
3097
- *
3098
- * @return string The current scheme, else an exception is thrown on failure.
3099
- */
3100
- protected function currentUrlScheme()
3101
- {
3102
- if (isset(static::$static[__FUNCTION__])) {
3103
- return static::$static[__FUNCTION__];
3104
- }
3105
- if (!empty($this->options['current_url_scheme'])) {
3106
- return static::$static[__FUNCTION__] = $this->nUrlScheme($this->options['current_url_scheme']);
3107
- }/* See https://github.com/websharks/html-compressor/issues/73
3108
- if (!empty($_SERVER['REQUEST_SCHEME'])) {
3109
- return (static::$static[__FUNCTION__] = $this->nUrlScheme($_SERVER['REQUEST_SCHEME']));
3110
- }*/
3111
- return static::$static[__FUNCTION__] = ($this->currentUrlSsl()) ? 'https' : 'http';
3112
- }
3113
-
3114
- /**
3115
- * Gets the current host name (via environment variables).
3116
- *
3117
- * @since 140417 Initial release.
3118
- *
3119
- * @throws \Exception If `$_SERVER['HTTP_HOST']` is empty.
3120
- *
3121
- * @return string The current host name, else an exception is thrown on failure.
3122
- */
3123
- protected function currentUrlHost()
3124
- {
3125
- if (isset(static::$static[__FUNCTION__])) {
3126
- return static::$static[__FUNCTION__];
3127
- }
3128
- if (!empty($this->options['current_url_host'])) {
3129
- return static::$static[__FUNCTION__] = $this->nUrlHost($this->options['current_url_host']);
3130
- }
3131
- if (empty($_SERVER['HTTP_HOST'])) {
3132
- throw new \Exception('Missing required `$_SERVER[\'HTTP_HOST\']`.');
3133
- }
3134
- return static::$static[__FUNCTION__] = $this->nUrlHost($_SERVER['HTTP_HOST']);
3135
- }
3136
-
3137
- /**
3138
- * Gets the current URI (via environment variables).
3139
- *
3140
- * @since 140417 Initial release.
3141
- *
3142
- * @throws \Exception If unable to determine the current URI.
3143
- *
3144
- * @return string The current URI, else an exception is thrown on failure.
3145
- */
3146
- protected function currentUrlUri()
3147
- {
3148
- if (isset(static::$static[__FUNCTION__])) {
3149
- return static::$static[__FUNCTION__];
3150
- }
3151
- if (!empty($this->options['current_url_uri'])) {
3152
- return static::$static[__FUNCTION__] = $this->mustParseUri($this->options['current_url_uri']);
3153
- }
3154
- if (empty($_SERVER['REQUEST_URI'])) {
3155
- throw new \Exception('Missing required `$_SERVER[\'REQUEST_URI\']`.');
3156
- }
3157
- return static::$static[__FUNCTION__] = $this->mustParseUri($_SERVER['REQUEST_URI']);
3158
- }
3159
-
3160
- /**
3161
- * Current URI is excluded?
3162
- *
3163
- * @since 160117 Adding support for URI exclusions.
3164
- *
3165
- * @return bool Returns `TRUE` if current URI matches an exclusion rule.
3166
- */
3167
- protected function isCurrentUrlUriExcluded()
3168
- {
3169
- if ($this->regex_uri_exclusions && preg_match($this->regex_uri_exclusions, $this->currentUrlUri())) {
3170
- return true;
3171
- } elseif ($this->built_in_regex_uri_exclusions && preg_match($this->built_in_regex_uri_exclusions, $this->currentUrlUri())) {
3172
- return true;
3173
- }
3174
- return false;
3175
- }
3176
-
3177
- /**
3178
- * URL to current request.
3179
- *
3180
- * @since 140417 Initial release.
3181
- *
3182
- * @return string The current URL.
3183
- */
3184
- protected function currentUrl()
3185
- {
3186
- if (isset(static::$static[__FUNCTION__])) {
3187
- return static::$static[__FUNCTION__];
3188
- }
3189
- $url = $this->currentUrlScheme().'://';
3190
- $url .= $this->currentUrlHost();
3191
- $url .= $this->currentUrlUri();
3192
-
3193
- return static::$static[__FUNCTION__] = $url;
3194
- }
3195
-
3196
- /**
3197
- * Normalizes a URL scheme.
3198
- *
3199
- * @since 140417 Initial release.
3200
- *
3201
- * @param string $scheme An input URL scheme.
3202
- *
3203
- * @return string A normalized URL scheme (always lowercase).
3204
- */
3205
- protected function nUrlScheme($scheme)
3206
- {
3207
- if (!($scheme = (string) $scheme)) {
3208
- return $scheme; // Nothing to do.
3209
- }
3210
- if (strpos($scheme, ':') !== false) {
3211
- $scheme = strstr($scheme, ':', true);
3212
- }
3213
- return strtolower($scheme);
3214
- }
3215
-
3216
- /**
3217
- * Normalizes a URL host name.
3218
- *
3219
- * @since 140417 Initial release.
3220
- *
3221
- * @param string $host An input URL host name.
3222
- *
3223
- * @return string A normalized URL host name (always lowercase).
3224
- */
3225
- protected function nUrlHost($host)
3226
- {
3227
- if (!($host = (string) $host)) {
3228
- return $host; // Nothing to do.
3229
- }
3230
- return strtolower($host);
3231
- }
3232
-
3233
- /**
3234
- * Converts all ampersand entities in a URL (or a URI/query/fragment only); to just `&`.
3235
- *
3236
- * @since 140417 Initial release.
3237
- *
3238
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3239
- * or only a query string, or only a fragment. Any of these can be normalized here.
3240
- *
3241
- * @return string Input URL (or a URI/query/fragment only); after having been normalized by this routine.
3242
- */
3243
- protected function nUrlAmps($url_uri_query_fragment)
3244
- {
3245
- if (!($url_uri_query_fragment = (string) $url_uri_query_fragment)) {
3246
- return $url_uri_query_fragment; // Nothing to do.
3247
- }
3248
- if (strpos($url_uri_query_fragment, '&') === false) {
3249
- return $url_uri_query_fragment; // Nothing to do.
3250
- }
3251
- return preg_replace('/&amp;|&#0*38;|&#[xX]0*26;/', '&', $url_uri_query_fragment);
3252
- }
3253
-
3254
- /**
3255
- * Normalizes a URL path from a URL (or a URI/query/fragment only).
3256
- *
3257
- * @since 140417 Initial release.
3258
- *
3259
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3260
- * or only a query string, or only a fragment. Any of these can be normalized here.
3261
- * @param bool $allow_trailing_slash Defaults to a FALSE value.
3262
- * If TRUE, and `$url_uri_query_fragment` contains a trailing slash; we'll leave it there.
3263
- *
3264
- * @return string Normalized URL (or a URI/query/fragment only).
3265
- */
3266
- protected function nUrlPathSeps($url_uri_query_fragment, $allow_trailing_slash = false)
3267
- {
3268
- if (($url_uri_query_fragment = (string) $url_uri_query_fragment) === '') {
3269
- return $url_uri_query_fragment; // Nothing to do.
3270
- }
3271
- if (!($parts = $this->parseUrl($url_uri_query_fragment, null, 0))) {
3272
- $parts['path'] = $url_uri_query_fragment;
3273
- }
3274
- if ($parts['path'] !== '') {
3275
- // Normalize directory separators.
3276
- $parts['path'] = $this->nDirSeps($parts['path'], $allow_trailing_slash);
3277
- }
3278
- return $this->unparseUrl($parts, 0); // Back together again.
3279
- }
3280
-
3281
- /**
3282
- * Sets a particular scheme.
3283
- *
3284
- * @since 140417 Initial release.
3285
- *
3286
- * @param string $url A full URL.
3287
- * @param string $scheme Optional. The scheme to use (i.e. `//`, `https`, `http`).
3288
- * Use `//` to use a cross-protocol compatible scheme.
3289
- * Defaults to the current scheme.
3290
- *
3291
- * @return string The full URL w/ `$scheme`.
3292
- */
3293
- protected function setUrlScheme($url, $scheme = '')
3294
- {
3295
- if (!($url = (string) $url)) {
3296
- return $url; // Nothing to do.
3297
- }
3298
- $scheme = (string) $scheme;
3299
-
3300
- if (!$scheme) {
3301
- $scheme = $this->currentUrlScheme();
3302
- }
3303
- if ($scheme !== '//') {
3304
- $scheme = $this->nUrlScheme($scheme).'://';
3305
- }
3306
- return preg_replace('/^(?:[a-z0-9]+\:)?\/\//i', $this->escRefs($scheme), $url);
3307
- }
3308
-
3309
- /**
3310
- * Checks if a given URL is local or external to the current host.
3311
- *
3312
- * @since 140417 Initial release.
3313
- *
3314
- * @note Care should be taken when calling upon this method. We need to be 100% sure
3315
- * we are NOT calling this against a nested remote/relative URL, URI, query or fragment.
3316
- * This method assumes the URL being analyzed is from the HTML source code.
3317
- *
3318
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3319
- * or only a query string, or only a fragment. Any of these can be checked here.
3320
- *
3321
- * @return bool TRUE if external; else FALSE.
3322
- */
3323
- protected function isUrlExternal($url_uri_query_fragment)
3324
- {
3325
- if (strpos($url_uri_query_fragment, '//') === false) {
3326
- return false; // Relative.
3327
- }
3328
- return stripos($url_uri_query_fragment, '//'.$this->currentUrlHost()) === false;
3329
- }
3330
-
3331
- /**
3332
- * Parses a URL (or a URI/query/fragment only) into an array.
3333
- *
3334
- * @since 140417 Initial release.
3335
- *
3336
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3337
- * or only a query string, or only a fragment. Any of these can be parsed here.
3338
- *
3339
- * @note A query string or fragment MUST be prefixed with the appropriate delimiters.
3340
- * This is bad `name=value` (interpreted as path). This is good `?name=value` (query string).
3341
- * This is bad `anchor` (interpreted as path). This is good `#fragment` (fragment).
3342
- *
3343
- * @param null|int $component Same as PHP's `parse_url()` component.
3344
- * Defaults to NULL; which defaults to an internal value of `-1` before we pass to PHP's `parse_url()`.
3345
- * @param null|int $normalize A bitmask. Defaults to NULL (indicating a default bitmask).
3346
- * Defaults include: {@link self::url_scheme}, {@link self::url_host}, {@link self::url_path}.
3347
- * However, we DO allow a trailing slash (even if path is being normalized by this parameter).
3348
- *
3349
- * @return array|string|int|null If a component is requested, returns a string component (or an integer in the case of `PHP_URL_PORT`).
3350
- * If a specific component is NOT requested, this returns a full array, of all component values.
3351
- * Else, this returns NULL on any type of failure (even if a component was requested).
3352
- *
3353
- * @note Arrays returned by this method, will include a value for each component (a bit different from PHP's `parse_url()` function).
3354
- * We start with an array of defaults (i.e. all empty strings, and `0` for the port number).
3355
- * Components found in the URL are then merged into these default values.
3356
- * The array is also sorted by key (e.g. alphabetized).
3357
- */
3358
- protected function parseUrl($url_uri_query_fragment, $component = null, $normalize = null)
3359
- {
3360
- $url_uri_query_fragment = (string) $url_uri_query_fragment;
3361
-
3362
- if (!isset($normalize)) {
3363
- $normalize = $this::URL_SCHEME | $this::URL_HOST | $this::URL_PATH;
3364
- }
3365
- if (strpos($url_uri_query_fragment, '//') === 0) {
3366
- $url_uri_query_fragment = $this->currentUrlScheme().':'.$url_uri_query_fragment; // So URL is parsed properly.
3367
- // Works around a bug in `parse_url()` prior to PHP v5.4.7. See: <http://php.net/manual/en/function.parse-url.php>.
3368
- $x_protocol_scheme = true; // Flag this, so we can remove scheme below.
3369
- } else {
3370
- $x_protocol_scheme = false; // No scheme; or scheme is NOT cross-protocol compatible.
3371
- }
3372
- $parsed = @parse_url($url_uri_query_fragment, !isset($component) ? -1 : $component);
3373
-
3374
- if ($x_protocol_scheme) {
3375
- if (!isset($component) && is_array($parsed)) {
3376
- $parsed['scheme'] = ''; // No scheme.
3377
- } elseif ($component === PHP_URL_SCHEME) {
3378
- $parsed = ''; // No scheme.
3379
- }
3380
- }
3381
- if ($normalize & $this::URL_SCHEME) {
3382
- if (!isset($component) && is_array($parsed)) {
3383
- if (!isset($parsed['scheme'])) {
3384
- $parsed['scheme'] = ''; // No scheme.
3385
- }
3386
- $parsed['scheme'] = $this->nUrlScheme($parsed['scheme']);
3387
- } elseif ($component === PHP_URL_SCHEME) {
3388
- if (!is_string($parsed)) {
3389
- $parsed = ''; // No scheme.
3390
- }
3391
- $parsed = $this->nUrlScheme($parsed);
3392
- }
3393
- }
3394
- if ($normalize & $this::URL_HOST) {
3395
- if (!isset($component) && is_array($parsed)) {
3396
- if (!isset($parsed['host'])) {
3397
- $parsed['host'] = ''; // No host.
3398
- }
3399
- $parsed['host'] = $this->nUrlHost($parsed['host']);
3400
- } elseif ($component === PHP_URL_HOST) {
3401
- if (!is_string($parsed)) {
3402
- $parsed = ''; // No scheme.
3403
- }
3404
- $parsed = $this->nUrlHost($parsed);
3405
- }
3406
- }
3407
- if ($normalize & $this::URL_PATH) {
3408
- if (!isset($component) && is_array($parsed)) {
3409
- if (!isset($parsed['path'])) {
3410
- $parsed['path'] = '/'; // Home directory.
3411
- }
3412
- $parsed['path'] = $this->nUrlPathSeps($parsed['path'], true);
3413
- if (strpos($parsed['path'], '/') !== 0) {
3414
- $parsed['path'] = '/'.$parsed['path'];
3415
- }
3416
- } elseif ($component === PHP_URL_PATH) {
3417
- if (!is_string($parsed)) {
3418
- $parsed = '/'; // Home directory.
3419
- }
3420
- $parsed = $this->nUrlPathSeps($parsed, true);
3421
- if (strpos($parsed, '/') !== 0) {
3422
- $parsed = '/'.$parsed;
3423
- }
3424
- }
3425
- }
3426
- if (in_array(gettype($parsed), array('array', 'string', 'integer'), true)) {
3427
- if (is_array($parsed)) {
3428
- $defaults = array(
3429
- 'fragment' => '',
3430
- 'host' => '',
3431
- 'pass' => '',
3432
- 'path' => '',
3433
- 'port' => 0,
3434
- 'query' => '',
3435
- 'scheme' => '',
3436
- 'user' => '',
3437
- );
3438
- $parsed = array_merge($defaults, $parsed);
3439
- $parsed['port'] = (integer) $parsed['port'];
3440
- ksort($parsed); // Sort by key.
3441
- }
3442
- return $parsed; // A `string|integer|array`.
3443
- }
3444
- return; // Default return value.
3445
- }
3446
-
3447
- /**
3448
- * Parses a URL (or a URI/query/fragment only) into an array.
3449
- *
3450
- * @since 140417 Initial release.
3451
- *
3452
- * @throws \Exception If unable to parse.
3453
- *
3454
- * @return array|string|int|null {@inheritdoc}
3455
- *
3456
- * @see parseUrl()
3457
- * {@inheritdoc} parseUrl()
3458
- */
3459
- protected function mustParseUrl() // Arguments are NOT listed here.
3460
- {
3461
- if (is_null($parsed = call_user_func_array(array($this, 'parseUrl'), func_get_args()))) {
3462
- throw new \Exception(sprintf('Unable to parse: `%1$s`.', (string) func_get_arg(0)));
3463
- }
3464
- return $parsed;
3465
- }
3466
-
3467
- /**
3468
- * Unparses a URL (putting it all back together again).
3469
- *
3470
- * @since 140417 Initial release.
3471
- *
3472
- * @param array $parsed An array with at least one URL component.
3473
- * @param null|int $normalize A bitmask. Defaults to NULL (indicating a default bitmask).
3474
- * Defaults include: {@link self::url_scheme}, {@link self::url_host}, {@link self::url_path}.
3475
- * However, we DO allow a trailing slash (even if path is being normalized by this parameter).
3476
- *
3477
- * @return string A full or partial URL, based on components provided in the `$parsed` array.
3478
- * It IS possible to receive an empty string, when/if `$parsed` does NOT contain any portion of a URL.
3479
- */
3480
- protected function unparseUrl(array $parsed, $normalize = null)
3481
- {
3482
- $unparsed = ''; // Initialize string value.
3483
-
3484
- if (!isset($normalize)) {
3485
- $normalize = $this::URL_SCHEME | $this::URL_HOST | $this::URL_PATH;
3486
- }
3487
- if ($normalize & $this::URL_SCHEME) {
3488
- if (!isset($parsed['scheme'])) {
3489
- $parsed['scheme'] = ''; // No scheme.
3490
- }
3491
- $parsed['scheme'] = $this->nUrlScheme($parsed['scheme']);
3492
- }
3493
- if (!empty($parsed['scheme'])) {
3494
- $unparsed .= $parsed['scheme'].'://';
3495
- } elseif (isset($parsed['scheme']) && !empty($parsed['host'])) {
3496
- $unparsed .= '//'; // Cross-protocol compatible.
3497
- }
3498
- if (!empty($parsed['user'])) {
3499
- $unparsed .= $parsed['user'];
3500
- if (!empty($parsed['pass'])) {
3501
- $unparsed .= ':'.$parsed['pass'];
3502
- }
3503
- $unparsed .= '@';
3504
- }
3505
- if ($normalize & $this::URL_HOST) {
3506
- if (!isset($parsed['host'])) {
3507
- $parsed['host'] = ''; // No host.
3508
- }
3509
- $parsed['host'] = $this->nUrlHost($parsed['host']);
3510
- }
3511
- if (!empty($parsed['host'])) {
3512
- $unparsed .= $parsed['host'];
3513
- }
3514
- if (!empty($parsed['port'])) {
3515
- $unparsed .= ':'.$parsed['port'];
3516
- } // A `0` value is excluded here.
3517
-
3518
- if ($normalize & $this::URL_PATH) {
3519
- if (!isset($parsed['path'])) {
3520
- $parsed['path'] = '/'; // Home directory.
3521
- }
3522
- $parsed['path'] = $this->nUrlPathSeps($parsed['path'], true);
3523
- if (strpos($parsed['path'], '/') !== 0) {
3524
- $parsed['path'] = '/'.$parsed['path'];
3525
- }
3526
- }
3527
- if (isset($parsed['path'])) {
3528
- $unparsed .= $parsed['path'];
3529
- }
3530
- if (!empty($parsed['query'])) {
3531
- $unparsed .= '?'.$parsed['query'];
3532
- }
3533
- if (!empty($parsed['fragment'])) {
3534
- $unparsed .= '#'.$parsed['fragment'];
3535
- }
3536
- return $unparsed;
3537
- }
3538
-
3539
- /**
3540
- * Unparses a URL (putting it all back together again).
3541
- *
3542
- * @since 140417 Initial release.
3543
- *
3544
- * @throws \Exception If unable to unparse.
3545
- *
3546
- * @return string {@inheritdoc}
3547
- *
3548
- * @see unparseUrl()
3549
- * {@inheritdoc} unparseUrl()
3550
- */
3551
- protected function mustUnparseUrl() // Arguments are NOT listed here.
3552
- {
3553
- if (($unparsed = call_user_func_array(array($this, 'unparseUrl'), func_get_args())) === '') {
3554
- throw new \Exception(sprintf('Unable to unparse: `%1$s`.', print_r(func_get_arg(0), true)));
3555
- }
3556
- return $unparsed;
3557
- }
3558
-
3559
- /**
3560
- * Parses URI parts from a URL (or a URI/query/fragment only).
3561
- *
3562
- * @since 140417 Initial release.
3563
- *
3564
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3565
- * or only a query string, or only a fragment. Any of these can be parsed here.
3566
- * @param null|int $normalize A bitmask. Defaults to NULL (indicating a default bitmask).
3567
- * Defaults include: {@link self::url_scheme}, {@link self::url_host}, {@link self::url_path}.
3568
- * However, we DO allow a trailing slash (even if path is being normalized by this parameter).
3569
- *
3570
- * @return array|null An array with the following components, else NULL on any type of failure.
3571
- *
3572
- * • `path`(string) Possible URI path.
3573
- * • `query`(string) A possible query string.
3574
- * • `fragment`(string) A possible fragment.
3575
- */
3576
- protected function parseUriParts($url_uri_query_fragment, $normalize = null)
3577
- {
3578
- if (($parts = $this->parseUrl($url_uri_query_fragment, null, $normalize))) {
3579
- return array('path' => $parts['path'], 'query' => $parts['query'], 'fragment' => $parts['fragment']);
3580
- }
3581
- return; // Default return value.
3582
- }
3583
-
3584
- /**
3585
- * Parses URI parts from a URL (or a URI/query/fragment only).
3586
- *
3587
- * @since 140417 Initial release.
3588
- *
3589
- * @throws \Exception If unable to parse.
3590
- *
3591
- * @return array|null {@inheritdoc}
3592
- *
3593
- * @see parseUriParts()
3594
- * {@inheritdoc} parseUriParts()
3595
- */
3596
- protected function mustParseUriParts() // Arguments are NOT listed here.
3597
- {
3598
- if (is_null($parts = call_user_func_array(array($this, 'parseUriParts'), func_get_args()))) {
3599
- throw new \Exception(sprintf('Unable to parse: `%1$s`.', (string) func_get_arg(0)));
3600
- }
3601
- return $parts;
3602
- }
3603
-
3604
- /**
3605
- * Parses a URI from a URL (or a URI/query/fragment only).
3606
- *
3607
- * @since 140417 Initial release.
3608
- *
3609
- * @param string $url_uri_query_fragment A full URL; or a partial URI;
3610
- * or only a query string, or only a fragment. Any of these can be parsed here.
3611
- * @param null|int $normalize A bitmask. Defaults to NULL (indicating a default bitmask).
3612
- * Defaults include: {@link self::url_scheme}, {@link self::url_host}, {@link self::url_path}.
3613
- * However, we DO allow a trailing slash (even if path is being normalized by this parameter).
3614
- * @param bool $include_fragment Defaults to TRUE. Include a possible fragment?
3615
- *
3616
- * @return string|null A URI (i.e. a URL path), else NULL on any type of failure.
3617
- */
3618
- protected function parseUri($url_uri_query_fragment, $normalize = null, $include_fragment = true)
3619
- {
3620
- if (($parts = $this->parseUriParts($url_uri_query_fragment, $normalize))) {
3621
- if (!$include_fragment) {
3622
- unset($parts['fragment']);
3623
- }
3624
- return $this->unparseUrl($parts, $normalize);
3625
- }
3626
- return; // Default return value.
3627
- }
3628
-
3629
- /**
3630
- * Parses a URI from a URL (or a URI/query/fragment only).
3631
- *
3632
- * @since 140417 Initial release.
3633
- *
3634
- * @throws \Exception If unable to parse.
3635
- *
3636
- * @return string|null {@inheritdoc}
3637
- *
3638
- * @see parseUri()
3639
- * {@inheritdoc} parseUri()
3640
- */
3641
- protected function mustParseUri() // Arguments are NOT listed here.
3642
- {
3643
- if (is_null($parsed = call_user_func_array(array($this, 'parseUri'), func_get_args()))) {
3644
- throw new \Exception(sprintf('Unable to parse: `%1$s`.', (string) func_get_arg(0)));
3645
- }
3646
- return $parsed;
3647
- }
3648
-
3649
- /**
3650
- * Resolves a relative URL into a full URL from a base.
3651
- *
3652
- * @since 140417 Initial release.
3653
- *
3654
- * @param string $relative_url_uri_query_fragment A full URL; or a partial URI;
3655
- * or only a query string, or only a fragment. Any of these can be parsed here.
3656
- * @param string $base_url A base URL. Optional. Defaults to current location.
3657
- * This defaults to the current URL. See: {@link current_url()}.
3658
- *
3659
- * @throws \Exception If unable to parse `$relative_url_uri_query_fragment`.
3660
- * @throws \Exception If there is no `$base`, and we're unable to detect current location.
3661
- * @throws \Exception If unable to parse `$base` (or if `$base` has no host name).
3662
- *
3663
- * @return string A full URL; else an exception will be thrown.
3664
- */
3665
- protected function resolveRelativeUrl($relative_url_uri_query_fragment, $base_url = '')
3666
- {
3667
- $relative_url_uri_query_fragment = (string) $relative_url_uri_query_fragment;
3668
- $base_url = (string) $base_url;
3669
-
3670
- if (!$base_url) {
3671
- $base_url = $this->currentUrl();
3672
- } // Auto-detects current URL/location.
3673
-
3674
- $relative_parts = $this->mustParseUrl($relative_url_uri_query_fragment, null, 0);
3675
- $relative_parts['path'] = $this->nUrlPathSeps($relative_parts['path'], true);
3676
- $base_parts = $parts = $this->mustParseUrl($base_url);
3677
-
3678
- if ($relative_parts['host']) {
3679
- if (!$relative_parts['scheme']) {
3680
- $relative_parts['scheme'] = $base_parts['scheme'];
3681
- }
3682
- return $this->mustUnparseUrl($relative_parts);
3683
- }
3684
- if (!$base_parts['host']) {
3685
- throw new \Exception(sprintf('Unable to parse (missing base host name): `%1$s`.', $base_url));
3686
- }
3687
- if (strlen($relative_parts['path'])) {
3688
- if (strpos($relative_parts['path'], '/') === 0) {
3689
- $parts['path'] = ''; // Reduce to nothing if relative is absolute.
3690
- } else {
3691
- $parts['path'] = preg_replace('/\/[^\/]*$/', '', $parts['path']).'/'; // Reduce to nearest `/`.
3692
- }
3693
- // Replace `/./` and `/foo/../` with `/` (resolve relatives).
3694
- for ($_i = 1, $parts['path'] = $parts['path'].$relative_parts['path']; $_i > 0;) {
3695
- $parts['path'] = preg_replace(array('/\/\.\//', '/\/(?!\.\.)[^\/]+\/\.\.\//'), '/', $parts['path'], -1, $_i);
3696
- }
3697
- unset($_i); // Just a little housekeeping.
3698
-
3699
- // We can ditch any unresolvable `../` patterns now.
3700
- // For instance, if there were too many `../../../../../` back references.
3701
- $parts['path'] = str_replace('../', '', $parts['path']);
3702
-
3703
- $parts['query'] = $relative_parts['query'];
3704
- // Use relative query.
3705
- } elseif (strlen($relative_parts['query'])) {
3706
- $parts['query'] = $relative_parts['query'];
3707
- } // Relative query string supersedes base.
3708
-
3709
- $parts['fragment'] = $relative_parts['fragment']; // Always changes.
3710
-
3711
- return $this->mustUnparseUrl($parts); // Resolved now.
3712
- }
3713
-
3714
- /**
3715
- * Remote HTTP communication.
3716
- *
3717
- * @since 150820 Improving HTTP connection handling.
3718
- *
3719
- * @param string $url A URL to connect to.
3720
- *
3721
- * @throws \Exception If unable to get the URL; i.e., if the response code is >= 400.
3722
- *
3723
- * @return string Output data from the HTTP response; excluding headers (i.e., body only).
3724
- *
3725
- * @note By throwing an exception on any failure, we can avoid a circumstance where
3726
- * multiple failures and/or timeouts occur in succession against the same host.
3727
- * Any connection failure stops compression and a caller should catch the exception
3728
- * and fail softly; using the exception message for debugging purposes.
3729
- */
3730
- protected function mustGetUrl($url)
3731
- {
3732
- $url = (string) $url; // Force string value.
3733
- $response = $this->remote($url, '', 5, 15, array(), '', true, true);
3734
-
3735
- if ($response['code'] >= 400) {
3736
- throw new \Exception(sprintf('HTTP response code: `%1$s`. Unable to get URL: `%2$s`.', $response['code'], $url));
3737
- }
3738
- return $response['body'];
3739
- }
3740
-
3741
- /**
3742
- * Remote HTTP communication.
3743
- *
3744
- * @since 140417 Initial release.
3745
- *
3746
- * @param string $url A URL to connect to.
3747
- * @param string|array $body Optional request body.
3748
- * @param int $max_con_secs Defaults to `20` seconds.
3749
- * @param int $max_stream_secs Defaults to `20` seconds.
3750
- * @param array $headers Any additional headers to send with the request.
3751
- * @param string $cookie_file If cookies are to be collected, store them here.
3752
- * @param bool $fail_on_error Defaults to a value of TRUE; fail on status >= `400`.
3753
- * @param bool $return_array Defaults to a value of FALSE; response body returned only.
3754
- *
3755
- * @throws \Exception If unable to find a workable HTTP transport layer.
3756
- * Supported transports include: `curl` and `fopen`.
3757
- *
3758
- * @return string|array Output data from the HTTP response; excluding headers (i.e., body only).
3759
- */
3760
- protected function remote($url, $body = '', $max_con_secs = 5, $max_stream_secs = 15, array $headers = array(), $cookie_file = '', $fail_on_error = true, $return_array = false)
3761
- {
3762
- $can_follow = !filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN) && !ini_get('open_basedir');
3763
-
3764
- if (($benchmark = !empty($this->options['benchmark']) && $this->options['benchmark'] === 'details')) {
3765
- $time = microtime(true);
3766
- }
3767
- $response_body = ''; // Initialize.
3768
- $response_code = 0; // Initialize.
3769
-
3770
- $custom_request_method = '';
3771
- $url = (string) $url;
3772
- $max_con_secs = (integer) $max_con_secs;
3773
- $max_stream_secs = (integer) $max_stream_secs;
3774
-
3775
- if (!is_array($headers)) {
3776
- $headers = array();
3777
- }
3778
- $cookie_file = (string) $cookie_file;
3779
-
3780
- $custom_request_regex = // e.g.`PUT::http://www.example.com/`
3781
- '/^(?P<custom_request_method>(?:GET|POST|PUT|PATCH|DELETE))\:{2}(?P<url>.+)/i';
3782
-
3783
- if (preg_match($custom_request_regex, $url, $_url_parts)) {
3784
- $url = $_url_parts['url']; // URL after `::`.
3785
- $custom_request_method = strtoupper($_url_parts['custom_request_method']);
3786
- }
3787
- unset($_url_parts); // Housekeeping.
3788
-
3789
- if (is_array($body)) {
3790
- $body = http_build_query($body, '', '&');
3791
- } else {
3792
- $body = (string) $body;
3793
- }
3794
- if (!$url) {
3795
- goto finale;
3796
- } // Nothing to do here.
3797
- /* ---------------------------------------------------------- */
3798
-
3799
- curl_transport: // cURL transport layer (recommended).
3800
-
3801
- if (!extension_loaded('curl') || !is_callable('curl_version')
3802
- || (stripos($url, 'https:') === 0 && !(is_array($curl_version = curl_version())
3803
- && $curl_version['features'] & CURL_VERSION_SSL))
3804
- ) {
3805
- goto fopen_transport; // cURL will not work in this case.
3806
- }
3807
- $curl_opts = array(
3808
- CURLOPT_URL => $url,
3809
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
3810
-
3811
- CURLOPT_CONNECTTIMEOUT => $max_con_secs,
3812
- CURLOPT_TIMEOUT => $max_stream_secs,
3813
- // See: <http://jas.xyz/1gZKj8v>
3814
-
3815
- CURLOPT_FOLLOWLOCATION => $can_follow,
3816
- CURLOPT_MAXREDIRS => $can_follow ? 5 : 0,
3817
-
3818
- CURLOPT_ENCODING => '',
3819
- CURLOPT_HTTPHEADER => $headers,
3820
- CURLOPT_REFERER => $this->currentUrl(),
3821
- CURLOPT_AUTOREFERER => true, // On redirects.
3822
- CURLOPT_USERAGENT => $this->product_title,
3823
-
3824
- CURLOPT_RETURNTRANSFER => true,
3825
- CURLOPT_HEADER => false,
3826
- CURLOPT_VERBOSE => false,
3827
- CURLOPT_SSL_VERIFYPEER => false,
3828
- CURLOPT_FAILONERROR => $fail_on_error,
3829
- );
3830
- if ($body) {
3831
- if ($custom_request_method) {
3832
- $curl_opts += array(CURLOPT_CUSTOMREQUEST => $custom_request_method, CURLOPT_POSTFIELDS => $body);
3833
- } else {
3834
- $curl_opts += array(CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body);
3835
- }
3836
- } elseif ($custom_request_method) {
3837
- $curl_opts += array(CURLOPT_CUSTOMREQUEST => $custom_request_method);
3838
- }
3839
- if ($cookie_file) {
3840
- $curl_opts += array(CURLOPT_COOKIEJAR => $cookie_file, CURLOPT_COOKIEFILE => $cookie_file);
3841
- }
3842
- if (!($curl = curl_init()) || !curl_setopt_array($curl, $curl_opts)) {
3843
- throw new \Exception(sprintf('Failed to initialize cURL for remote connection to: `%1$s`.', $url).
3844
- sprintf(' The following cURL options were necessary: `%1$s`.', print_r($curl_opts, true)));
3845
- }
3846
- $response_body = trim((string) curl_exec($curl));
3847
- $response_code = (integer) curl_getinfo($curl, CURLINFO_HTTP_CODE);
3848
-
3849
- if ($benchmark) {
3850
- $this->benchmark->addData(
3851
- __FUNCTION__,
3852
- array('curl_getinfo' => curl_getinfo($curl))
3853
- );
3854
- }
3855
- curl_close($curl); // Close the resource handle now.
3856
-
3857
- if ($fail_on_error && $response_code >= 400) {
3858
- $response_body = ''; // Fail silently.
3859
- }
3860
- goto finale; // All done here, jump to finale.
3861
-
3862
- /* ---------------------------------------------------------- */
3863
-
3864
- fopen_transport: // Depends on `allow_url_fopen` in `php.ini`.
3865
-
3866
- if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN) || $cookie_file
3867
- || (stripos($url, 'https:') === 0 && !in_array('ssl', stream_get_transports(), true))
3868
- ) {
3869
- throw new \Exception('Unable to find a workable transport layer for remote HTTP communication.'.
3870
- ' Please install the cURL & OpenSSL extensions for PHP.');
3871
- }
3872
- $stream_options = array(
3873
- 'http' => array(
3874
- 'protocol_version' => 1.1,
3875
- 'method' => $custom_request_method
3876
- ? $custom_request_method : ($body ? 'POST' : 'GET'),
3877
-
3878
- 'follow_location' => $can_follow,
3879
- 'max_redirects' => $can_follow ? 5 : 0,
3880
-
3881
- 'header' => array_merge($headers, array('Referer: '.$this->currentUrl())),
3882
- 'user_agent' => $this->product_title,
3883
-
3884
- 'ignore_errors' => $fail_on_error,
3885
- 'timeout' => $max_stream_secs,
3886
-
3887
- 'content' => $body,
3888
- ),
3889
- );
3890
- if (!($stream_context = stream_context_create($stream_options)) || !($stream = fopen($url, 'rb', false, $stream_context))) {
3891
- $response_code = 404; // Connection failure.
3892
- $response_body = ''; // Connection failure; empty.
3893
- goto finale; // All done here, jump to finale.
3894
- }
3895
- $response_body = trim((string) stream_get_contents($stream));
3896
- $stream_meta_data = stream_get_meta_data($stream);
3897
-
3898
- if (!empty($stream_meta_data['timed_out'])) {
3899
- // Based on `$max_stream_secs`.
3900
- $response_code = 408; // Request timeout.
3901
- $response_body = ''; // Connection timed out; ignore.
3902
- } elseif (!empty($stream_meta_data['wrapper_data']) && is_array($stream_meta_data['wrapper_data'])) {
3903
- foreach (array_reverse($stream_meta_data['wrapper_data']) as $_response_header /* Looking for the last one. */) {
3904
- if (is_string($_response_header) && stripos($_response_header, 'HTTP/') === 0 && strpos($_response_header, ' ')) {
3905
- list(, $response_code) = explode(' ', $_response_header, 3);
3906
- $response_code = (integer) trim($response_code);
3907
- break; // Got the last status code.
3908
- }
3909
- }
3910
- }
3911
- if ($benchmark) {
3912
- $this->benchmark->addData(
3913
- __FUNCTION__,
3914
- compact('stream_meta_data')
3915
- );
3916
- }
3917
- fclose($stream); // Close the resource handle now.
3918
-
3919
- if ($fail_on_error && $response_code >= 400) {
3920
- $response_body = ''; // Fail silently.
3921
- }
3922
- goto finale; // All done here, jump to finale.
3923
-
3924
- /* ---------------------------------------------------------- */
3925
-
3926
- finale: // Target point; finale/return value.
3927
-
3928
- if ($benchmark && !empty($time) && $url) {
3929
- $this->benchmark->addTime(
3930
- __FUNCTION__,
3931
- $time, // Caller, start time, task performed.
3932
- sprintf('fetching remote resource: `%1$s`; `%2$s` bytes received;', $url, strlen($response_body))
3933
- );
3934
- }
3935
- return $return_array ? array('code' => $response_code, 'body' => $response_body) : $response_body;
3936
- }
3937
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/src/includes/classes/HookApi.php DELETED
@@ -1,337 +0,0 @@
1
- <?php
2
- namespace WebSharks\HtmlCompressor;
3
-
4
- /**
5
- * HTML Compressor (hook API).
6
- *
7
- * @since 150321 Adding hook API for plugins.
8
- *
9
- * @property-read $times Read-only access to times.
10
- * @property-read $data Read-only access to data.
11
- */
12
- class HookApi // For plugins.
13
- {
14
- /*
15
- * Protected Properties
16
- */
17
-
18
- /**
19
- * @type array An array of hooks.
20
- *
21
- * @since 150321 Adding hook API for plugins.
22
- */
23
- protected $hooks = array();
24
-
25
- /*
26
- * Public API Methods
27
- */
28
-
29
- /**
30
- * Class Constructor.
31
- *
32
- * @since 150321 Adding hook API for plugins.
33
- *
34
- * @api Constructor is available for public use.
35
- */
36
- public function __construct()
37
- {
38
- if (empty($GLOBALS[__NAMESPACE__.'_early_hooks'])) {
39
- return; // Nothing more to do here.
40
- }
41
- $GLOBALS[__NAMESPACE__.'_early_hooks'] = (array) $GLOBALS[__NAMESPACE__.'_early_hooks'];
42
- $early_hooks = &$GLOBALS[__NAMESPACE__.'_early_hooks'];
43
-
44
- foreach ($early_hooks as $_early_hook) {
45
- if (empty($_early_hook['hook'])) {
46
- continue; // Empty; bypass.
47
- }
48
- if (empty($_early_hook['function'])) {
49
- continue; // Empty; bypass.
50
- }
51
- if (!isset($_early_hook['priority'])) {
52
- $_early_hook['priority'] = 10;
53
- }
54
- if (!isset($_early_hook['accepted_args'])) {
55
- $_early_hook['accepted_args'] = 1;
56
- }
57
- $this->addHook(
58
- $_early_hook['hook'],
59
- $_early_hook['function'],
60
- $_early_hook['priority'],
61
- $_early_hook['accepted_args']
62
- );
63
- }
64
- unset($_early_hook); // Just a little housekeeping.
65
-
66
- $early_hooks = array(); // Empty; i.e., reset early hooks.
67
- }
68
-
69
- /**
70
- * Magic method for access to read-only properties.
71
- *
72
- * @since 150321 Adding hook API for plugins.
73
- *
74
- * @param string $property Propery by name.
75
- *
76
- * @throws \exception If `$property` does not exist for any reason.
77
- *
78
- * @return mixed Property value.
79
- *
80
- * @internal For internal magic use only.
81
- */
82
- public function __get($property)
83
- {
84
- $property = (string) $property;
85
-
86
- if (property_exists($this, $property)) {
87
- return $this->{$property};
88
- }
89
- throw new \Exception(sprintf('Undefined property: `%1$s`.', $property));
90
- }
91
-
92
- /**
93
- * Assigns an ID to each callable attached to a hook/filter.
94
- *
95
- * @since 150321 Adding hook API for plugins.
96
- *
97
- * @param string|callable|mixed $function A string or a callable.
98
- *
99
- * @throws \exception If the hook/function is invalid (i.e. it's not possible to generate an ID).
100
- *
101
- * @return string Hook ID for the given `$function`.
102
- */
103
- public function hookId($function)
104
- {
105
- if (is_string($function)) {
106
- return $function;
107
- }
108
- if (is_object($function)) {
109
- $function = array($function, '');
110
- } else {
111
- $function = (array) $function;
112
- }
113
- if (isset($function[0], $function[1])) {
114
- if (is_object($function[0])) {
115
- return spl_object_hash($function[0]).$function[1];
116
- } elseif (is_string($function[0])) {
117
- return $function[0].'::'.$function[1];
118
- }
119
- }
120
- throw new \Exception('Invalid hook.');
121
- }
122
-
123
- /**
124
- * Do we have a specific hook?
125
- *
126
- * @since 150821 Enhancing hook support.
127
- *
128
- * @param string $hook The name of a filter hook.
129
- *
130
- * @return bool True if actions/filters exist on this hook.
131
- */
132
- public function hasHook($hook)
133
- {
134
- $hook = (string) $hook;
135
-
136
- return $hook && !empty($this->hooks[$hook]);
137
- }
138
-
139
- /**
140
- * Do we have a specific action?
141
- *
142
- * @since 150821 Enhancing hook support.
143
- *
144
- * @return bool True if hook exists for this action.
145
- *
146
- * @see hasHook()
147
- */
148
- public function hasAction() // Simple `hasHook()` alias.
149
- {
150
- return call_user_func_array(array($this, 'hasHook'), func_get_args());
151
- }
152
-
153
- /**
154
- * Do we have a specific filter?
155
- *
156
- * @since 150821 Enhancing hook support.
157
- *
158
- * @return bool True if hook exists for this filter.
159
- *
160
- * @see hasHook()
161
- */
162
- public function hasFilter() // Simple `hasHook()` alias.
163
- {
164
- return call_user_func_array(array($this, 'hasHook'), func_get_args());
165
- }
166
-
167
- /**
168
- * Adds a new hook (works with both actions & filters).
169
- *
170
- * @since 150321 Adding hook API for plugins.
171
- *
172
- * @param string $hook The name of a hook to attach to.
173
- * @param string|callable|mixed $function A string or a callable.
174
- * @param int $priority Hook priority; defaults to `10`.
175
- * @param int $accepted_args Max number of args that should be passed to the `$function`.
176
- *
177
- * @return bool This always returns a `TRUE` value.
178
- */
179
- public function addHook($hook, $function, $priority = 10, $accepted_args = 1)
180
- {
181
- $hook = (string) $hook;
182
- $priority = (integer) $priority;
183
- $accepted_args = max(0, (integer) $accepted_args);
184
- $hook_id = $this->hookId($function);
185
-
186
- $this->hooks[$hook][$priority][$hook_id] = array(
187
- 'function' => $function,
188
- 'accepted_args' => (integer) $accepted_args,
189
- );
190
- return true; // Always returns true.
191
- }
192
-
193
- /**
194
- * Adds a new action hook.
195
- *
196
- * @since 150321 Adding hook API for plugins.
197
- *
198
- * @return bool This always returns a `TRUE` value.
199
- *
200
- * @see addHook()
201
- */
202
- public function addAction() // Simple `addHook()` alias.
203
- {
204
- return call_user_func_array(array($this, 'addHook'), func_get_args());
205
- }
206
-
207
- /**
208
- * Adds a new filter.
209
- *
210
- * @since 150321 Adding hook API for plugins.
211
- *
212
- * @return bool This always returns a `TRUE` value.
213
- *
214
- * @see addHook()
215
- */
216
- public function addFilter() // Simple `addHook()` alias.
217
- {
218
- return call_user_func_array(array($this, 'addHook'), func_get_args());
219
- }
220
-
221
- /**
222
- * Removes a hook (works with both actions & filters).
223
- *
224
- * @since 150321 Adding hook API for plugins.
225
- *
226
- * @param string $hook The name of a hook to remove.
227
- * @param string|callable|mixed $function A string or a callable.
228
- * @param int $priority Hook priority; defaults to `10`.
229
- *
230
- * @return bool `TRUE` if removed; else `FALSE` if not removed for any reason.
231
- */
232
- public function removeHook($hook, $function, $priority = 10)
233
- {
234
- $hook = (string) $hook;
235
- $priority = (integer) $priority;
236
- $hook_id = $this->hookId($function);
237
-
238
- if (!isset($this->hooks[$hook][$priority][$hook_id])) {
239
- return false; // Nothing to remove.
240
- }
241
- unset($this->hooks[$hook][$priority][$hook_id]);
242
- if (!$this->hooks[$hook][$priority]) {
243
- unset($this->hooks[$hook][$priority]);
244
- }
245
- return true; // Existed before it was removed.
246
- }
247
-
248
- /**
249
- * Removes an action.
250
- *
251
- * @since 150321 Adding hook API for plugins.
252
- *
253
- * @return bool `TRUE` if removed; else `FALSE` if not removed for any reason.
254
- *
255
- * @see removeHook()
256
- */
257
- public function removeAction() // Simple `removeHook()` alias.
258
- {
259
- return call_user_func_array(array($this, 'removeHook'), func_get_args());
260
- }
261
-
262
- /**
263
- * Removes a filter.
264
- *
265
- * @since 150321 Adding hook API for plugins.
266
- *
267
- * @return bool `TRUE` if removed; else `FALSE` if not removed for any reason.
268
- *
269
- * @see removeHook()
270
- */
271
- public function removeFilter() // Simple `removeHook()` alias.
272
- {
273
- return call_user_func_array(array($this, 'removeHook'), func_get_args());
274
- }
275
-
276
- /**
277
- * Runs any callables attached to an action.
278
- *
279
- * @since 150321 Adding hook API for plugins.
280
- *
281
- * @param string $hook The name of an action hook.
282
- */
283
- public function doAction($hook)
284
- {
285
- $hook = (string) $hook;
286
- if (empty($this->hooks[$hook])) {
287
- return; // No hooks.
288
- }
289
- $hook_actions = $this->hooks[$hook];
290
- $args = func_get_args();
291
- ksort($hook_actions);
292
-
293
- foreach ($hook_actions as $_hook_action) {
294
- foreach ($_hook_action as $_action) {
295
- if (!isset($_action['function'], $_action['accepted_args'])) {
296
- continue; // Not a valid filter in this case.
297
- }
298
- call_user_func_array($_action['function'], array_slice($args, 1, $_action['accepted_args']));
299
- }
300
- }
301
- unset($_hook_action, $_action); // Housekeeping.
302
- }
303
-
304
- /**
305
- * Runs any callables attached to a filter.
306
- *
307
- * @since 150321 Adding hook API for plugins.
308
- *
309
- * @param string $hook The name of a filter hook.
310
- * @param mixed $value The value to filter.
311
- *
312
- * @return mixed The filtered `$value`.
313
- */
314
- public function applyFilters($hook, $value)
315
- {
316
- $hook = (string) $hook;
317
- if (empty($this->hooks[$hook])) {
318
- return $value; // No hooks.
319
- }
320
- $hook_filters = $this->hooks[$hook];
321
- $args = func_get_args();
322
- ksort($hook_filters);
323
-
324
- foreach ($hook_filters as $_hook_filter) {
325
- foreach ($_hook_filter as $_filter) {
326
- if (!isset($_filter['function'], $_filter['accepted_args'])) {
327
- continue; // Not a valid filter in this case.
328
- }
329
- $args[1] = $value; // Continously update the argument `$value`.
330
- $value = call_user_func_array($_filter['function'], array_slice($args, 1, $_filter['accepted_args']));
331
- }
332
- }
333
- unset($_hook_filter, $_filter); // Housekeeping.
334
-
335
- return $value; // With applied filters.
336
- }
337
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/html-compressor/src/includes/stub.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- /**
3
- * Stub.
4
- *
5
- * @since 150421 Improving PHAR support.
6
- */
7
- namespace WebSharks\HtmlCompressor;
8
-
9
- require_once dirname(dirname(__FILE__)).'/vendor/autoload.php';
 
 
 
 
 
 
 
 
 
src/vendor/websharks/js-minifier/CHANGELOG.md DELETED
@@ -1,3 +0,0 @@
1
- ## v15xxxx
2
-
3
- - Initial release.
 
 
 
src/vendor/websharks/js-minifier/LICENSE.txt DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/js-minifier/README.md DELETED
@@ -1,40 +0,0 @@
1
- ## JavaScript Minification
2
-
3
- JavaScript minifier (i.e., compressor).
4
-
5
- [![](https://img.shields.io/github/license/websharks/js-minifier.svg)](https://github.com/websharks/js-minifier/blob/HEAD/LICENSE.txt)
6
- [![](https://img.shields.io/badge/made-w%2F_100%25_pure_awesome_sauce-AB815F.svg?label=made)](http://websharks-inc.com/)
7
- [![](https://img.shields.io/badge/by-WebSharks_Inc.-656598.svg?label=by)](http://www.websharks-inc.com/team/)
8
- [![](https://img.shields.io/github/release/websharks/js-minifier.svg?label=latest)](https://github.com/websharks/js-minifier/releases)
9
- [![](https://img.shields.io/packagist/v/websharks/js-minifier.svg?label=packagist)](https://packagist.org/packages/websharks/js-minifier)
10
- [![](https://img.shields.io/github/issues/websharks/js-minifier.svg?label=issues)](https://github.com/websharks/js-minifier/issues)
11
- [![](https://img.shields.io/github/forks/websharks/js-minifier.svg?label=forks)](https://github.com/websharks/js-minifier/network)
12
- [![](https://img.shields.io/github/stars/websharks/js-minifier.svg?label=stars)](https://github.com/websharks/js-minifier/stargazers)
13
- [![](https://img.shields.io/github/downloads/websharks/js-minifier/latest/total.svg?label=downloads)](https://github.com/websharks/js-minifier/releases)
14
- [![](https://img.shields.io/packagist/dt/websharks/js-minifier.svg?label=packagist)](https://packagist.org/packages/websharks/js-minifier)
15
-
16
- ---
17
-
18
- ## Installation Instructions (Two Options)
19
-
20
- 1. As a [Composer](https://packagist.org/packages/websharks/js-minifier) Dependency
21
-
22
- ```json
23
- {
24
- "require": {
25
- "websharks/js-minifier": "dev-master"
26
- }
27
- }
28
- ```
29
-
30
- 2. Or, Download the PHAR Binary
31
- See: https://github.com/websharks/js-minifier/releases
32
-
33
- ---
34
-
35
- ## Usage Example
36
-
37
- ```php
38
- $js = 'var helloWorld = function() { console.log("Hello World"); };';
39
- $compressed_js = WebSharks\JsMinifier\Core::compress($js);
40
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/js-minifier/src/includes/classes/Core.php DELETED
@@ -1,358 +0,0 @@
1
- <?php
2
- namespace WebSharks\JsMinifier;
3
-
4
- /**
5
- * JS Minifier.
6
- *
7
- * @since 150424 Initial release.
8
- *
9
- * Original JSMin copyright: {@link http://www.crockford.com/javascript/jsmin.html Douglas Crockford}.
10
- * Original PHP port copyright: {@link http://github.com/rgrove/jsmin-php/ Ryan Grove}.
11
- * Enhancements copyright: {@link http://code.google.com/p/minify/ Andrea Giammarchi}.
12
- * Enhancements copyright: {@link http://code.google.com/p/minify/ Steve Clay}.
13
- * Modified by: {@link http://websharks-inc.com/ Jason @ WebSharks, Inc.}.
14
- */
15
- class Core
16
- {
17
- const ORD_LF = 10;
18
- const ORD_SPACE = 32;
19
- const ACTION_KEEP_A = 1;
20
- const ACTION_DELETE_A = 2;
21
- const ACTION_DELETE_A_B = 3;
22
-
23
- protected $a = "\n";
24
- protected $b = '';
25
- protected $input = '';
26
- protected $inputIndex = 0;
27
- protected $inputLength = 0;
28
- protected $lookAhead = null;
29
- protected $output = '';
30
- protected $lastByteOut = '';
31
-
32
- /**
33
- * Class constructor.
34
- *
35
- * @since 150424 Initial release.
36
- *
37
- * @param string $input Uncompressed JS.
38
- */
39
- public function __construct($input)
40
- {
41
- $this->input = (string) $input;
42
- }
43
-
44
- /**
45
- * Minify (Compress) Javascript.
46
- *
47
- * @since 150424 Initial release.
48
- *
49
- * @param string $js Javascript to be minified
50
- *
51
- * @return string Minified JavaScript; else original on failure.
52
- */
53
- public static function compress($js)
54
- {
55
- $js = (string) $js;
56
- try {
57
- $js_minifier = new static($js);
58
- $minified_js = $js_minifier->min();
59
- return $minified_js;
60
- } catch (\Exception $exception) {
61
- return $js;
62
- }
63
- }
64
-
65
- /**
66
- * Perform minification (compression).
67
- *
68
- * @since 150424 Initial release.
69
- *
70
- * @return string Output string; compressed JS.
71
- */
72
- public function min()
73
- {
74
- $this->output = ''; // Initialize.
75
- $mbIntEnc = null; // Initialize.
76
-
77
- if (function_exists('mb_strlen') && ((integer) ini_get('mbstring.func_overload') & 2)) {
78
- $mbIntEnc = mb_internal_encoding();
79
- mb_internal_encoding('8bit');
80
- }
81
- $this->input = str_replace("\r\n", "\n", $this->input);
82
- $this->inputLength = strlen($this->input);
83
-
84
- $this->action(self::ACTION_DELETE_A_B);
85
-
86
- while ($this->a !== null) {
87
- $command = self::ACTION_KEEP_A;
88
- if ($this->a === ' ') {
89
- if (($this->lastByteOut === '+' || $this->lastByteOut === '-') && ($this->b === $this->lastByteOut)) {
90
- } elseif (!$this->isAlphaNum($this->b)) {
91
- $command = self::ACTION_DELETE_A;
92
- }
93
- } elseif ($this->a === "\n") {
94
- if ($this->b === ' ') {
95
- $command = self::ACTION_DELETE_A_B;
96
- } elseif ($this->b === null || (strpos('{[(+-', $this->b) === false && !$this->isAlphaNum($this->b))) {
97
- $command = self::ACTION_DELETE_A;
98
- }
99
- } elseif (!$this->isAlphaNum($this->a)) {
100
- if ($this->b === ' ' || ($this->b === "\n" && strpos('}])+-"\'', $this->a) === false)) {
101
- $command = self::ACTION_DELETE_A_B;
102
- }
103
- }
104
- $this->action($command);
105
- }
106
- $this->output = trim($this->output);
107
-
108
- if ($mbIntEnc !== null) {
109
- mb_internal_encoding($mbIntEnc);
110
- }
111
- return $this->output;
112
- }
113
-
114
- /**
115
- * Action handler.
116
- *
117
- * @since 150424 Initial release.
118
- *
119
- * ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
120
- * ACTION_DELETE_A = Copy B to A. Get the next B.
121
- * ACTION_DELETE_A_B = Get the next B.
122
- *
123
- * @param int $command Action identifier.
124
- *
125
- * @throws Exception On failure.
126
- */
127
- protected function action($command)
128
- {
129
- if ($command === self::ACTION_DELETE_A_B && $this->b === ' ' && ($this->a === '+' || $this->a === '-')) {
130
- if ($this->input[$this->inputIndex] === $this->a) {
131
- $command = self::ACTION_KEEP_A;
132
- }
133
- }
134
- switch ($command) {
135
- case self::ACTION_KEEP_A:
136
- $this->output .= $this->a;
137
- $this->lastByteOut = $this->a;
138
- // Fallthrough to next case.
139
- case self::ACTION_DELETE_A:
140
- $this->a = $this->b;
141
- if ($this->a === "'" || $this->a === '"') {
142
- $str = $this->a;
143
- while (true) {
144
- $this->output .= $this->a;
145
- $this->lastByteOut = $this->a;
146
-
147
- $this->a = $this->get();
148
- if ($this->a === $this->b) {
149
- break;
150
- }
151
- if (ord($this->a) <= self::ORD_LF) {
152
- throw new \Exception('Unterminated String at byte: '.$this->inputIndex.': '.$str);
153
- }
154
- $str .= $this->a;
155
- if ($this->a === '\\') {
156
- $this->output .= $this->a;
157
- $this->lastByteOut = $this->a;
158
-
159
- $this->a = $this->get();
160
- $str .= $this->a;
161
- }
162
- }
163
- }
164
- // Fallthrough to next case.
165
- case self::ACTION_DELETE_A_B:
166
- $this->b = $this->next();
167
- if ($this->b === '/' && $this->isRegexpLiteral()) {
168
- $this->output .= $this->a.$this->b;
169
- $pattern = '/';
170
- while (true) {
171
- $this->a = $this->get();
172
- $pattern .= $this->a;
173
- if ($this->a === '/') {
174
- break;
175
- } elseif ($this->a === '\\') {
176
- $this->output .= $this->a;
177
- $this->a = $this->get();
178
- $pattern .= $this->a;
179
- } elseif (ord($this->a) <= self::ORD_LF) {
180
- throw new \Exception('Unterminated RegExp at byte: '.$this->inputIndex.': '.$pattern);
181
- }
182
- $this->output .= $this->a;
183
- $this->lastByteOut = $this->a;
184
- }
185
- $this->b = $this->next();
186
- }
187
- }
188
- }
189
-
190
- /**
191
- * Utility conditional check.
192
- *
193
- * @since 150424 Initial release.
194
- *
195
- * @return bool `TRUE` if is regex literal.
196
- */
197
- protected function isRegexpLiteral()
198
- {
199
- if (strpos("\n{;(,=:[!&|?", $this->a) !== false) {
200
- return true;
201
- }
202
- if ($this->a === ' ') {
203
- $length = strlen($this->output);
204
- if ($length < 2) {
205
- return true;
206
- }
207
- if (preg_match('/(?:case|else|in|return|typeof)$/', $this->output, $m)) {
208
- if ($this->output === $m[0]) {
209
- return true;
210
- }
211
- $charBeforeKeyword = substr($this->output, $length - strlen($m[0]) - 1, 1);
212
- if (!$this->isAlphaNum($charBeforeKeyword)) {
213
- return true;
214
- }
215
- }
216
- }
217
- return false;
218
- }
219
-
220
- /**
221
- * Get next character.
222
- *
223
- * @since 150424 Initial release.
224
- *
225
- * @return string|null Next char.
226
- */
227
- protected function get()
228
- {
229
- $c = $this->lookAhead;
230
- $this->lookAhead = null;
231
- if ($c === null) {
232
- if ($this->inputIndex < $this->inputLength) {
233
- $c = $this->input[$this->inputIndex];
234
- $this->inputIndex += 1;
235
- } else {
236
- return;
237
- }
238
- }
239
- if ($c === "\r" || $c === "\n") {
240
- return "\n";
241
- }
242
- if (ord($c) < self::ORD_SPACE) {
243
- return ' ';
244
- }
245
- return $c;
246
- }
247
-
248
- /**
249
- * Get next character.
250
- *
251
- * @since 150424 Initial release.
252
- *
253
- * @return string Next char.
254
- */
255
- protected function peek()
256
- {
257
- $this->lookAhead = $this->get();
258
-
259
- return $this->lookAhead;
260
- }
261
-
262
- /**
263
- * Letter, digit, underscore, dollar sign, escape, or non-ASCII?
264
- *
265
- * @since 150424 Initial release.
266
- *
267
- * @param string $c Input character to test.
268
- *
269
- * @return bool `TRUE` if letter, digit, underscore, dollar sign, escape, or non-ASCII?
270
- */
271
- protected function isAlphaNum($c)
272
- {
273
- return preg_match('/^[0-9a-zA-Z_\\$\\\\]$/', $c) || ord($c) > 126;
274
- }
275
-
276
- /**
277
- * Single-line comment handler.
278
- *
279
- * @since 150424 Initial release.
280
- *
281
- * @return string Single-line comment.
282
- */
283
- protected function singleLineComment()
284
- {
285
- $comment = '';
286
- while (true) {
287
- $get = $this->get();
288
- $comment .= $get;
289
- if (ord($get) <= self::ORD_LF) {
290
- if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
291
- return '/'.$comment;
292
- }
293
- return $get;
294
- }
295
- }
296
- return;
297
- }
298
-
299
- /**
300
- * Multi-line comment handler.
301
- *
302
- * @since 150424 Initial release.
303
- *
304
- * @throws Exception On failre.
305
- *
306
- * @return string Multi-line comment.
307
- */
308
- protected function multipleLineComment()
309
- {
310
- $this->get();
311
- $comment = '';
312
- while (true) {
313
- $get = $this->get();
314
- if ($get === '*') {
315
- if ($this->peek() === '/') {
316
- $this->get();
317
- if (strpos($comment, '!') === 0) {
318
- return "\n/*!".substr($comment, 1)."*/\n";
319
- }
320
- if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
321
- return '/*'.$comment.'*/';
322
- }
323
- return ' ';
324
- }
325
- } elseif ($get === null) {
326
- throw new \Exception('Unterminated comment at byte: '.$this->inputIndex.': /*'.$comment);
327
- }
328
- $comment .= $get;
329
- }
330
- return;
331
- }
332
-
333
- /**
334
- * Get the next character, skipping over comments.
335
- * Some comments may be preserved.
336
- *
337
- * @since 150424 Initial release.
338
- *
339
- * @return string Next character (or comment).
340
- */
341
- protected function next()
342
- {
343
- $get = $this->get();
344
- if ($get !== '/') {
345
- return $get;
346
- }
347
- switch ($this->peek()) {
348
- case '/':
349
- return $this->singleLineComment();
350
-
351
- case '*':
352
- return $this->multipleLineComment();
353
-
354
- default:
355
- return $get;
356
- }
357
- }
358
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/vendor/websharks/js-minifier/src/includes/stub.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- /**
3
- * Stub.
4
- *
5
- * @since 150424 Initial release.
6
- */
7
- namespace WebSharks\JsMinifier;
8
-
9
- require_once dirname(dirname(__FILE__)).'/vendor/autoload.php';
 
 
 
 
 
 
 
 
 
src/vendor/websharks/sharkicons/src/.htaccess ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <IfModule authz_core_module>
2
+ Require all denied
3
+ </IfModule>
4
+ <IfModule !authz_core_module>
5
+ deny from all
6
+ </IfModule>
7
+
8
+ <FilesMatch "\.(js|css|map|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">
9
+ <IfModule authz_core_module>
10
+ Require all granted
11
+ </IfModule>
12
+ <IfModule !authz_core_module>
13
+ allow from all
14
+ </IfModule>
15
+ </FilesMatch>
src/vendor/websharks/sharkicons/src/long-classes.min.css CHANGED
@@ -1,2 +1,3 @@
1
  @font-face{font-family:sharkicons;src:url("fonts/sharkicons.eot?v160221");src:url("fonts/sharkicons.eot?#iefix&v160221") format("embedded-opentype"),url("fonts/sharkicons.ttf?v160221") format("truetype"),url("fonts/sharkicons.woff?v160221") format("woff"),url("fonts/sharkicons.svg?v160221#sharkicons") format("svg");font-weight:normal;font-style:normal}.sharkicon::before{font:normal normal normal 14px/1 sharkicons;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;display:inline-block;font-size:inherit;text-decoration:inherit;text-transform:none}.sharkicon-broom::before{content:""}.sharkicon-comment-mail-one::before{content:""}.sharkicon-comment-mail::before{content:""}.sharkicon-s2member::before{content:""}.sharkicon-websharks::before{content:""}.sharkicon-wp-kb-articles::before{content:""}.sharkicon-zencache-logo::before{content:""}.sharkicon-zencache::before{content:""}.sharkicon-wp-sharks::before{content:""}.sharkicon-wp-sharks-fin::before{content:""}.sharkicon-comet-cache::before{content:""}.sharkicon-comet-cache-logo::before{content:""}.sharkicon-comet-cache-comet::before{content:""}.sharkicon-feat-watch::before{content:""}.sharkicon-feat-server::before{content:""}.sharkicon-feat-layers::before{content:""}.sharkicon-feat-box::before{content:""}.sharkicon-feat-ellipsis::before{content:""}.sharkicon-typi-group::before{content:""}.sharkicon-enty-bookmark::before{content:""}.sharkicon-enty-bookmarks::before{content:""}.sharkicon-enty-open-book::before{content:""}.sharkicon-enty-archive::before{content:""}.sharkicon-enty-area-graph::before{content:""}.sharkicon-enty-bucket::before{content:""}.sharkicon-enty-colors::before{content:""}.sharkicon-enty-copy::before{content:""}.sharkicon-enty-drive::before{content:""}.sharkicon-enty-feather::before{content:""}.sharkicon-enty-gauge::before{content:""}.sharkicon-enty-hand::before{content:""}.sharkicon-enty-lab-flask::before{content:""}.sharkicon-enty-mask::before{content:""}.sharkicon-enty-medal::before{content:""}.sharkicon-enty-exclamation::before{content:""}.sharkicon-enty-palette::before{content:""}.sharkicon-enty-ruler::before{content:""}.sharkicon-enty-shop::before{content:""}.sharkicon-enty-basket::before{content:""}.sharkicon-enty-cart::before{content:""}.sharkicon-enty-traffic-cone::before{content:""}.sharkicon-enty-tree::before{content:""}.sharkicon-enty-trophy::before{content:""}.sharkicon-enty-v-card::before{content:""}.sharkicon-enty-google-hangouts::before{content:""}.sharkicon-eleg-line-graph::before{content:""}.sharkicon-eleg-male::before{content:""}.sharkicon-eleg-female::before{content:""}.sharkicon-eleg-atom::before{content:""}.sharkicon-broc-cart::before{content:""}.sharkicon-broc-crap::before{content:""}.sharkicon-broc-atom::before{content:""}.sharkicon-icom-headphones::before{content:""}.sharkicon-icom-barcode::before{content:""}.sharkicon-icom-user::before{content:""}.sharkicon-icom-users::before{content:""}.sharkicon-icom-user-plus::before{content:""}.sharkicon-icom-user-minus::before{content:""}.sharkicon-icom-user-check::before{content:""}.sharkicon-icom-user-tie::before{content:""}.sharkicon-icom-key::before{content:""}.sharkicon-icom-key2::before{content:""}.sharkicon-icom-happy::before{content:""}.sharkicon-icom-happy2::before{content:""}.sharkicon-icom-smile::before{content:""}.sharkicon-icom-smile2::before{content:""}.sharkicon-icom-tongue::before{content:""}.sharkicon-icom-tongue2::before{content:""}.sharkicon-icom-sad::before{content:""}.sharkicon-icom-sad2::before{content:""}.sharkicon-icom-wink::before{content:""}.sharkicon-icom-wink2::before{content:""}.sharkicon-icom-grin::before{content:""}.sharkicon-icom-grin2::before{content:""}.sharkicon-icom-cool::before{content:""}.sharkicon-icom-cool2::before{content:""}.sharkicon-icom-angry::before{content:""}.sharkicon-icom-angry2::before{content:""}.sharkicon-icom-evil::before{content:""}.sharkicon-icom-evil2::before{content:""}.sharkicon-icom-shocked::before{content:""}.sharkicon-icom-shocked2::before{content:""}.sharkicon-icom-baffled::before{content:""}.sharkicon-icom-baffled2::before{content:""}.sharkicon-icom-confused::before{content:""}.sharkicon-icom-confused2::before{content:""}.sharkicon-icom-neutral::before{content:""}.sharkicon-icom-neutral2::before{content:""}.sharkicon-icom-hipster::before{content:""}.sharkicon-icom-hipster2::before{content:""}.sharkicon-icom-wondering::before{content:""}.sharkicon-icom-wondering2::before{content:""}.sharkicon-icom-sleepy::before{content:""}.sharkicon-icom-sleepy2::before{content:""}.sharkicon-icom-frustrated::before{content:""}.sharkicon-icom-frustrated2::before{content:""}.sharkicon-icom-crying::before{content:""}.sharkicon-icom-crying2::before{content:""}.sharkicon-icom-spell-check::before{content:""}.sharkicon-icom-command-key::before{content:""}.sharkicon-icom-shift-key::before{content:""}.sharkicon-icom-control-key::before{content:""}.sharkicon-icom-option-key::before{content:""}.sharkicon-icom-wordpress::before{content:""}.sharkicon-icom-wordpress-square::before{content:""}.sharkicon-icom-yahoo::before{content:""}.sharkicon-icom-linux::before{content:""}.sharkicon-icom-finder::before{content:""}.sharkicon-icom-android::before{content:""}.sharkicon-icom-reddit::before{content:""}.sharkicon-icom-paypal::before{content:""}.sharkicon-icom-git::before{content:""}.sharkicon-octi-alignment-align::before{content:""}.sharkicon-octi-alignment-aligned-to::before{content:""}.sharkicon-octi-alignment-unalign::before{content:""}.sharkicon-octi-bookmark::before{content:""}.sharkicon-octi-broadcast::before{content:""}.sharkicon-octi-browser::before{content:""}.sharkicon-octi-checklist::before{content:""}.sharkicon-octi-circuit-board::before{content:""}.sharkicon-octi-clippy::before{content:""}.sharkicon-octi-cloud-download::before{content:""}.sharkicon-octi-cloud-upload::before{content:""}.sharkicon-octi-comment::before{content:""}.sharkicon-octi-comments::before{content:""}.sharkicon-octi-tach::before{content:""}.sharkicon-octi-device-camera::before{content:""}.sharkicon-octi-device-camera-video::before{content:""}.sharkicon-octi-device-desktop::before{content:""}.sharkicon-octi-diff::before{content:""}.sharkicon-octi-file-binary::before{content:""}.sharkicon-octi-file-media::before{content:""}.sharkicon-octi-file-submodule::before{content:""}.sharkicon-octi-file-symlink-directory::before{content:""}.sharkicon-octi-file-symlink-file::before{content:""}.sharkicon-octi-fold::before{content:""}.sharkicon-octi-git-branch::before{content:""}.sharkicon-octi-git-commit::before{content:""}.sharkicon-octi-git-compare::before{content:""}.sharkicon-octi-git-merge::before{content:""}.sharkicon-octi-git-pull-request::before{content:""}.sharkicon-octi-graph::before{content:""}.sharkicon-octi-home::before{content:""}.sharkicon-octi-horizontal-rule::before{content:""}.sharkicon-octi-key::before{content:""}.sharkicon-octi-light-bulb::before{content:""}.sharkicon-octi-link-external::before{content:""}.sharkicon-octi-lock::before{content:""}.sharkicon-octi-markdown::before{content:""}.sharkicon-octi-microscope::before{content:""}.sharkicon-octi-mirror::before{content:""}.sharkicon-octi-move-down::before{content:""}.sharkicon-octi-move-left::before{content:""}.sharkicon-octi-move-right::before{content:""}.sharkicon-octi-move-up::before{content:""}.sharkicon-octi-mute::before{content:""}.sharkicon-octi-organization::before{content:""}.sharkicon-octi-package::before{content:""}.sharkicon-octi-paintcan::before{content:""}.sharkicon-octi-person::before{content:""}.sharkicon-octi-plug::before{content:""}.sharkicon-octi-podium::before{content:""}.sharkicon-octi-pulse::before{content:""}.sharkicon-octi-puzzle::before{content:""}.sharkicon-octi-repo::before{content:""}.sharkicon-octi-repo-clone::before{content:""}.sharkicon-octi-repo-force-push::before{content:""}.sharkicon-octi-repo-forked::before{content:""}.sharkicon-octi-repo-pull::before{content:""}.sharkicon-octi-repo-push::before{content:""}.sharkicon-octi-rocket::before{content:""}.sharkicon-octi-ruby::before{content:""}.sharkicon-octi-screen-full::before{content:""}.sharkicon-octi-screen-normal::before{content:""}.sharkicon-octi-sign-in::before{content:""}.sharkicon-octi-sign-out::before{content:""}.sharkicon-octi-split::before{content:""}.sharkicon-octi-squirrel::before{content:""}.sharkicon-octi-steps::before{content:""}.sharkicon-octi-tag::before{content:""}.sharkicon-octi-telescope::before{content:""}.sharkicon-octi-terminal::before{content:""}.sharkicon-octi-unfold::before{content:""}.sharkicon-octi-versions::before{content:""}.sharkicon-glass::before{content:""}.sharkicon-music::before{content:""}.sharkicon-search::before{content:""}.sharkicon-envelope-o::before{content:""}.sharkicon-heart::before{content:""}.sharkicon-star::before{content:""}.sharkicon-star-o::before{content:""}.sharkicon-user::before{content:""}.sharkicon-film::before{content:""}.sharkicon-th-large::before{content:""}.sharkicon-th::before{content:""}.sharkicon-th-list::before{content:""}.sharkicon-check::before{content:""}.sharkicon-close::before{content:""}.sharkicon-search-plus::before{content:""}.sharkicon-search-minus::before{content:""}.sharkicon-power-off::before{content:""}.sharkicon-signal::before{content:""}.sharkicon-cog::before{content:""}.sharkicon-trash-o::before{content:""}.sharkicon-home::before{content:""}.sharkicon-file-o::before{content:""}.sharkicon-clock-o::before{content:""}.sharkicon-road::before{content:""}.sharkicon-download::before{content:""}.sharkicon-arrow-circle-o-down::before{content:""}.sharkicon-arrow-circle-o-up::before{content:""}.sharkicon-inbox::before{content:""}.sharkicon-play-circle-o::before{content:""}.sharkicon-repeat::before{content:""}.sharkicon-refresh::before{content:""}.sharkicon-list-alt::before{content:""}.sharkicon-lock::before{content:""}.sharkicon-flag::before{content:""}.sharkicon-headphones::before{content:""}.sharkicon-volume-off::before{content:""}.sharkicon-volume-down::before{content:""}.sharkicon-volume-up::before{content:""}.sharkicon-qrcode::before{content:""}.sharkicon-barcode::before{content:""}.sharkicon-tag::before{content:""}.sharkicon-tags::before{content:""}.sharkicon-book::before{content:""}.sharkicon-bookmark::before{content:""}.sharkicon-print::before{content:""}.sharkicon-camera::before{content:""}.sharkicon-font::before{content:""}.sharkicon-bold::before{content:""}.sharkicon-italic::before{content:""}.sharkicon-text-height::before{content:""}.sharkicon-text-width::before{content:""}.sharkicon-align-left::before{content:""}.sharkicon-align-center::before{content:""}.sharkicon-align-right::before{content:""}.sharkicon-align-justify::before{content:""}.sharkicon-list::before{content:""}.sharkicon-dedent::before{content:""}.sharkicon-indent::before{content:""}.sharkicon-video-camera::before{content:""}.sharkicon-image::before{content:""}.sharkicon-pencil::before{content:""}.sharkicon-map-marker::before{content:""}.sharkicon-adjust::before{content:""}.sharkicon-tint::before{content:""}.sharkicon-edit::before{content:""}.sharkicon-share-square-o::before{content:""}.sharkicon-check-square-o::before{content:""}.sharkicon-arrows::before{content:""}.sharkicon-step-backward::before{content:""}.sharkicon-fast-backward::before{content:""}.sharkicon-backward::before{content:""}.sharkicon-play::before{content:""}.sharkicon-pause::before{content:""}.sharkicon-stop::before{content:""}.sharkicon-forward::before{content:""}.sharkicon-fast-forward::before{content:""}.sharkicon-step-forward::before{content:""}.sharkicon-eject::before{content:""}.sharkicon-chevron-left::before{content:""}.sharkicon-chevron-right::before{content:""}.sharkicon-plus-circle::before{content:""}.sharkicon-minus-circle::before{content:""}.sharkicon-times-circle::before{content:""}.sharkicon-check-circle::before{content:""}.sharkicon-question-circle::before{content:""}.sharkicon-info-circle::before{content:""}.sharkicon-crosshairs::before{content:""}.sharkicon-times-circle-o::before{content:""}.sharkicon-check-circle-o::before{content:""}.sharkicon-ban::before{content:""}.sharkicon-arrow-left::before{content:""}.sharkicon-arrow-right::before{content:""}.sharkicon-arrow-up::before{content:""}.sharkicon-arrow-down::before{content:""}.sharkicon-mail-forward::before{content:""}.sharkicon-expand::before{content:""}.sharkicon-compress::before{content:""}.sharkicon-plus::before{content:""}.sharkicon-minus::before{content:""}.sharkicon-asterisk::before{content:""}.sharkicon-exclamation-circle::before{content:""}.sharkicon-gift::before{content:""}.sharkicon-leaf::before{content:""}.sharkicon-fire::before{content:""}.sharkicon-eye::before{content:""}.sharkicon-eye-slash::before{content:""}.sharkicon-exclamation-triangle::before{content:""}.sharkicon-plane::before{content:""}.sharkicon-calendar::before{content:""}.sharkicon-random::before{content:""}.sharkicon-comment::before{content:""}.sharkicon-magnet::before{content:""}.sharkicon-chevron-up::before{content:""}.sharkicon-chevron-down::before{content:""}.sharkicon-retweet::before{content:""}.sharkicon-shopping-cart::before{content:""}.sharkicon-folder::before{content:""}.sharkicon-folder-open::before{content:""}.sharkicon-arrows-v::before{content:""}.sharkicon-arrows-h::before{content:""}.sharkicon-bar-chart::before{content:""}.sharkicon-twitter-square::before{content:""}.sharkicon-facebook-square::before{content:""}.sharkicon-camera-retro::before{content:""}.sharkicon-key::before{content:""}.sharkicon-cogs::before{content:""}.sharkicon-comments::before{content:""}.sharkicon-thumbs-o-up::before{content:""}.sharkicon-thumbs-o-down::before{content:""}.sharkicon-star-half::before{content:""}.sharkicon-heart-o::before{content:""}.sharkicon-sign-out::before{content:""}.sharkicon-linkedin-square::before{content:""}.sharkicon-thumb-tack::before{content:""}.sharkicon-external-link::before{content:""}.sharkicon-sign-in::before{content:""}.sharkicon-trophy::before{content:""}.sharkicon-github-square::before{content:""}.sharkicon-upload::before{content:""}.sharkicon-lemon-o::before{content:""}.sharkicon-phone::before{content:""}.sharkicon-square-o::before{content:""}.sharkicon-bookmark-o::before{content:""}.sharkicon-phone-square::before{content:""}.sharkicon-twitter::before{content:""}.sharkicon-facebook::before{content:""}.sharkicon-github::before{content:""}.sharkicon-unlock::before{content:""}.sharkicon-credit-card::before{content:""}.sharkicon-feed::before{content:""}.sharkicon-hdd-o::before{content:""}.sharkicon-bullhorn::before{content:""}.sharkicon-bell-o::before{content:""}.sharkicon-certificate::before{content:""}.sharkicon-hand-o-right::before{content:""}.sharkicon-hand-o-left::before{content:""}.sharkicon-hand-o-up::before{content:""}.sharkicon-hand-o-down::before{content:""}.sharkicon-arrow-circle-left::before{content:""}.sharkicon-arrow-circle-right::before{content:""}.sharkicon-arrow-circle-up::before{content:""}.sharkicon-arrow-circle-down::before{content:""}.sharkicon-globe::before{content:""}.sharkicon-wrench::before{content:""}.sharkicon-tasks::before{content:""}.sharkicon-filter::before{content:""}.sharkicon-briefcase::before{content:""}.sharkicon-arrows-alt::before{content:""}.sharkicon-group::before{content:""}.sharkicon-chain::before{content:""}.sharkicon-cloud::before{content:""}.sharkicon-flask::before{content:""}.sharkicon-cut::before{content:""}.sharkicon-copy::before{content:""}.sharkicon-paperclip::before{content:""}.sharkicon-floppy-o::before{content:""}.sharkicon-square::before{content:""}.sharkicon-bars::before{content:""}.sharkicon-list-ul::before{content:""}.sharkicon-list-ol::before{content:""}.sharkicon-strikethrough::before{content:""}.sharkicon-underline::before{content:""}.sharkicon-table::before{content:""}.sharkicon-magic::before{content:""}.sharkicon-truck::before{content:""}.sharkicon-pinterest::before{content:""}.sharkicon-pinterest-square::before{content:""}.sharkicon-google-plus-square::before{content:""}.sharkicon-google-plus::before{content:""}.sharkicon-money::before{content:""}.sharkicon-caret-down::before{content:""}.sharkicon-caret-up::before{content:""}.sharkicon-caret-left::before{content:""}.sharkicon-caret-right::before{content:""}.sharkicon-columns::before{content:""}.sharkicon-sort::before{content:""}.sharkicon-sort-desc::before{content:""}.sharkicon-sort-asc::before{content:""}.sharkicon-envelope::before{content:""}.sharkicon-linkedin::before{content:""}.sharkicon-rotate-left::before{content:""}.sharkicon-gavel::before{content:""}.sharkicon-dashboard::before{content:""}.sharkicon-comment-o::before{content:""}.sharkicon-comments-o::before{content:""}.sharkicon-bolt::before{content:""}.sharkicon-sitemap::before{content:""}.sharkicon-umbrella::before{content:""}.sharkicon-clipboard::before{content:""}.sharkicon-lightbulb-o::before{content:""}.sharkicon-exchange::before{content:""}.sharkicon-cloud-download::before{content:""}.sharkicon-cloud-upload::before{content:""}.sharkicon-user-md::before{content:""}.sharkicon-stethoscope::before{content:""}.sharkicon-suitcase::before{content:""}.sharkicon-bell::before{content:""}.sharkicon-coffee::before{content:""}.sharkicon-cutlery::before{content:""}.sharkicon-file-text-o::before{content:""}.sharkicon-building-o::before{content:""}.sharkicon-hospital-o::before{content:""}.sharkicon-ambulance::before{content:""}.sharkicon-medkit::before{content:""}.sharkicon-fighter-jet::before{content:""}.sharkicon-beer::before{content:""}.sharkicon-h-square::before{content:""}.sharkicon-plus-square::before{content:""}.sharkicon-angle-double-left::before{content:""}.sharkicon-angle-double-right::before{content:""}.sharkicon-angle-double-up::before{content:""}.sharkicon-angle-double-down::before{content:""}.sharkicon-angle-left::before{content:""}.sharkicon-angle-right::before{content:""}.sharkicon-angle-up::before{content:""}.sharkicon-angle-down::before{content:""}.sharkicon-desktop::before{content:""}.sharkicon-laptop::before{content:""}.sharkicon-tablet::before{content:""}.sharkicon-mobile::before{content:""}.sharkicon-circle-o::before{content:""}.sharkicon-quote-left::before{content:""}.sharkicon-quote-right::before{content:""}.sharkicon-spinner::before{content:""}.sharkicon-circle::before{content:""}.sharkicon-mail-reply::before{content:""}.sharkicon-github-alt::before{content:""}.sharkicon-folder-o::before{content:""}.sharkicon-folder-open-o::before{content:""}.sharkicon-smile-o::before{content:""}.sharkicon-frown-o::before{content:""}.sharkicon-meh-o::before{content:""}.sharkicon-gamepad::before{content:""}.sharkicon-keyboard-o::before{content:""}.sharkicon-flag-o::before{content:""}.sharkicon-flag-checkered::before{content:""}.sharkicon-terminal::before{content:""}.sharkicon-code::before{content:""}.sharkicon-mail-reply-all::before{content:""}.sharkicon-star-half-empty::before{content:""}.sharkicon-location-arrow::before{content:""}.sharkicon-crop::before{content:""}.sharkicon-code-fork::before{content:""}.sharkicon-chain-broken::before{content:""}.sharkicon-question::before{content:""}.sharkicon-info::before{content:""}.sharkicon-exclamation::before{content:""}.sharkicon-superscript::before{content:""}.sharkicon-subscript::before{content:""}.sharkicon-eraser::before{content:""}.sharkicon-puzzle-piece::before{content:""}.sharkicon-microphone::before{content:""}.sharkicon-microphone-slash::before{content:""}.sharkicon-shield::before{content:""}.sharkicon-calendar-o::before{content:""}.sharkicon-fire-extinguisher::before{content:""}.sharkicon-rocket::before{content:""}.sharkicon-maxcdn::before{content:""}.sharkicon-chevron-circle-left::before{content:""}.sharkicon-chevron-circle-right::before{content:""}.sharkicon-chevron-circle-up::before{content:""}.sharkicon-chevron-circle-down::before{content:""}.sharkicon-html5::before{content:""}.sharkicon-css3::before{content:""}.sharkicon-anchor::before{content:""}.sharkicon-unlock-alt::before{content:""}.sharkicon-bullseye::before{content:""}.sharkicon-ellipsis-h::before{content:""}.sharkicon-ellipsis-v::before{content:""}.sharkicon-rss-square::before{content:""}.sharkicon-play-circle::before{content:""}.sharkicon-ticket::before{content:""}.sharkicon-minus-square::before{content:""}.sharkicon-minus-square-o::before{content:""}.sharkicon-level-up::before{content:""}.sharkicon-level-down::before{content:""}.sharkicon-check-square::before{content:""}.sharkicon-pencil-square::before{content:""}.sharkicon-external-link-square::before{content:""}.sharkicon-share-square::before{content:""}.sharkicon-compass::before{content:""}.sharkicon-caret-square-o-down::before{content:""}.sharkicon-caret-square-o-up::before{content:""}.sharkicon-caret-square-o-right::before{content:""}.sharkicon-eur::before{content:""}.sharkicon-gbp::before{content:""}.sharkicon-dollar::before{content:""}.sharkicon-inr::before{content:""}.sharkicon-cny::before{content:""}.sharkicon-rouble::before{content:""}.sharkicon-krw::before{content:""}.sharkicon-bitcoin::before{content:""}.sharkicon-file::before{content:""}.sharkicon-file-text::before{content:""}.sharkicon-sort-alpha-asc::before{content:""}.sharkicon-sort-alpha-desc::before{content:""}.sharkicon-sort-amount-asc::before{content:""}.sharkicon-sort-amount-desc::before{content:""}.sharkicon-sort-numeric-asc::before{content:""}.sharkicon-sort-numeric-desc::before{content:""}.sharkicon-thumbs-up::before{content:""}.sharkicon-thumbs-down::before{content:""}.sharkicon-youtube-square::before{content:""}.sharkicon-youtube::before{content:""}.sharkicon-xing::before{content:""}.sharkicon-xing-square::before{content:""}.sharkicon-youtube-play::before{content:""}.sharkicon-dropbox::before{content:""}.sharkicon-stack-overflow::before{content:""}.sharkicon-instagram::before{content:""}.sharkicon-flickr::before{content:""}.sharkicon-adn::before{content:""}.sharkicon-bitbucket::before{content:""}.sharkicon-bitbucket-square::before{content:""}.sharkicon-tumblr::before{content:""}.sharkicon-tumblr-square::before{content:""}.sharkicon-long-arrow-down::before{content:""}.sharkicon-long-arrow-up::before{content:""}.sharkicon-long-arrow-left::before{content:""}.sharkicon-long-arrow-right::before{content:""}.sharkicon-apple::before{content:""}.sharkicon-windows::before{content:""}.sharkicon-android::before{content:""}.sharkicon-linux::before{content:""}.sharkicon-dribbble::before{content:""}.sharkicon-skype::before{content:""}.sharkicon-foursquare::before{content:""}.sharkicon-trello::before{content:""}.sharkicon-female::before{content:""}.sharkicon-male::before{content:""}.sharkicon-gittip::before{content:""}.sharkicon-sun-o::before{content:""}.sharkicon-moon-o::before{content:""}.sharkicon-archive::before{content:""}.sharkicon-bug::before{content:""}.sharkicon-vk::before{content:""}.sharkicon-weibo::before{content:""}.sharkicon-renren::before{content:""}.sharkicon-pagelines::before{content:""}.sharkicon-stack-exchange::before{content:""}.sharkicon-arrow-circle-o-right::before{content:""}.sharkicon-arrow-circle-o-left::before{content:""}.sharkicon-caret-square-o-left::before{content:""}.sharkicon-dot-circle-o::before{content:""}.sharkicon-wheelchair::before{content:""}.sharkicon-vimeo-square::before{content:""}.sharkicon-try::before{content:""}.sharkicon-plus-square-o::before{content:""}.sharkicon-space-shuttle::before{content:""}.sharkicon-slack::before{content:""}.sharkicon-envelope-square::before{content:""}.sharkicon-wordpress::before{content:""}.sharkicon-openid::before{content:""}.sharkicon-bank::before{content:""}.sharkicon-graduation-cap::before{content:""}.sharkicon-yahoo::before{content:""}.sharkicon-google::before{content:""}.sharkicon-reddit::before{content:""}.sharkicon-reddit-square::before{content:""}.sharkicon-stumbleupon-circle::before{content:""}.sharkicon-stumbleupon::before{content:""}.sharkicon-delicious::before{content:""}.sharkicon-digg::before{content:""}.sharkicon-pied-piper::before{content:""}.sharkicon-pied-piper-alt::before{content:""}.sharkicon-drupal::before{content:""}.sharkicon-joomla::before{content:""}.sharkicon-language::before{content:""}.sharkicon-fax::before{content:""}.sharkicon-building::before{content:""}.sharkicon-child::before{content:""}.sharkicon-paw::before{content:""}.sharkicon-spoon::before{content:""}.sharkicon-cube::before{content:""}.sharkicon-cubes::before{content:""}.sharkicon-behance::before{content:""}.sharkicon-behance-square::before{content:""}.sharkicon-steam::before{content:""}.sharkicon-steam-square::before{content:""}.sharkicon-recycle::before{content:""}.sharkicon-automobile::before{content:""}.sharkicon-cab::before{content:""}.sharkicon-tree::before{content:""}.sharkicon-spotify::before{content:""}.sharkicon-deviantart::before{content:""}.sharkicon-soundcloud::before{content:""}.sharkicon-database::before{content:""}.sharkicon-file-pdf-o::before{content:""}.sharkicon-file-word-o::before{content:""}.sharkicon-file-excel-o::before{content:""}.sharkicon-file-powerpoint-o::before{content:""}.sharkicon-file-image-o::before{content:""}.sharkicon-file-archive-o::before{content:""}.sharkicon-file-audio-o::before{content:""}.sharkicon-file-movie-o::before{content:""}.sharkicon-file-code-o::before{content:""}.sharkicon-vine::before{content:""}.sharkicon-codepen::before{content:""}.sharkicon-jsfiddle::before{content:""}.sharkicon-life-bouy::before{content:""}.sharkicon-circle-o-notch::before{content:""}.sharkicon-ra::before{content:""}.sharkicon-empire::before{content:""}.sharkicon-git-square::before{content:""}.sharkicon-git::before{content:""}.sharkicon-hacker-news::before{content:""}.sharkicon-tencent-weibo::before{content:""}.sharkicon-qq::before{content:""}.sharkicon-wechat::before{content:""}.sharkicon-paper-plane::before{content:""}.sharkicon-paper-plane-o::before{content:""}.sharkicon-history::before{content:""}.sharkicon-circle-thin::before{content:""}.sharkicon-header::before{content:""}.sharkicon-paragraph::before{content:""}.sharkicon-sliders::before{content:""}.sharkicon-share-alt::before{content:""}.sharkicon-share-alt-square::before{content:""}.sharkicon-bomb::before{content:""}.sharkicon-futbol-o::before{content:""}.sharkicon-tty::before{content:""}.sharkicon-binoculars::before{content:""}.sharkicon-plug::before{content:""}.sharkicon-slideshare::before{content:""}.sharkicon-twitch::before{content:""}.sharkicon-yelp::before{content:""}.sharkicon-newspaper-o::before{content:""}.sharkicon-wifi::before{content:""}.sharkicon-calculator::before{content:""}.sharkicon-paypal::before{content:""}.sharkicon-google-wallet::before{content:""}.sharkicon-cc-visa::before{content:""}.sharkicon-cc-mastercard::before{content:""}.sharkicon-cc-discover::before{content:""}.sharkicon-cc-amex::before{content:""}.sharkicon-cc-paypal::before{content:""}.sharkicon-cc-stripe::before{content:""}.sharkicon-bell-slash::before{content:""}.sharkicon-bell-slash-o::before{content:""}.sharkicon-trash::before{content:""}.sharkicon-copyright::before{content:""}.sharkicon-at::before{content:""}.sharkicon-eyedropper::before{content:""}.sharkicon-paint-brush::before{content:""}.sharkicon-birthday-cake::before{content:""}.sharkicon-area-chart::before{content:""}.sharkicon-pie-chart::before{content:""}.sharkicon-line-chart::before{content:""}.sharkicon-lastfm::before{content:""}.sharkicon-lastfm-square::before{content:""}.sharkicon-toggle-off::before{content:""}.sharkicon-toggle-on::before{content:""}.sharkicon-bicycle::before{content:""}.sharkicon-bus::before{content:""}.sharkicon-ioxhost::before{content:""}.sharkicon-angellist::before{content:""}.sharkicon-cc::before{content:""}.sharkicon-ils::before{content:""}.sharkicon-meanpath::before{content:""}.sharkicon-buysellads::before{content:""}.sharkicon-connectdevelop::before{content:""}.sharkicon-dashcube::before{content:""}.sharkicon-forumbee::before{content:""}.sharkicon-leanpub::before{content:""}.sharkicon-sellsy::before{content:""}.sharkicon-shirtsinbulk::before{content:""}.sharkicon-simplybuilt::before{content:""}.sharkicon-skyatlas::before{content:""}.sharkicon-cart-plus::before{content:""}.sharkicon-cart-arrow-down::before{content:""}.sharkicon-diamond::before{content:""}.sharkicon-ship::before{content:""}.sharkicon-user-secret::before{content:""}.sharkicon-motorcycle::before{content:""}.sharkicon-street-view::before{content:""}.sharkicon-heartbeat::before{content:""}.sharkicon-venus::before{content:""}.sharkicon-mars::before{content:""}.sharkicon-mercury::before{content:""}.sharkicon-intersex::before{content:""}.sharkicon-transgender-alt::before{content:""}.sharkicon-venus-double::before{content:""}.sharkicon-mars-double::before{content:""}.sharkicon-venus-mars::before{content:""}.sharkicon-mars-stroke::before{content:""}.sharkicon-mars-stroke-v::before{content:""}.sharkicon-mars-stroke-h::before{content:""}.sharkicon-neuter::before{content:""}.sharkicon-genderless::before{content:""}.sharkicon-facebook-official::before{content:""}.sharkicon-pinterest-p::before{content:""}.sharkicon-whatsapp::before{content:""}.sharkicon-server::before{content:""}.sharkicon-user-plus::before{content:""}.sharkicon-user-times::before{content:""}.sharkicon-bed::before{content:""}.sharkicon-viacoin::before{content:""}.sharkicon-train::before{content:""}.sharkicon-subway::before{content:""}.sharkicon-medium::before{content:""}.sharkicon-y-combinator::before{content:""}.sharkicon-optin-monster::before{content:""}.sharkicon-opencart::before{content:""}.sharkicon-expeditedssl::before{content:""}.sharkicon-battery-4::before{content:""}.sharkicon-battery-3::before{content:""}.sharkicon-battery-2::before{content:""}.sharkicon-battery-1::before{content:""}.sharkicon-battery-0::before{content:""}.sharkicon-mouse-pointer::before{content:""}.sharkicon-i-cursor::before{content:""}.sharkicon-object-group::before{content:""}.sharkicon-object-ungroup::before{content:""}.sharkicon-sticky-note::before{content:""}.sharkicon-sticky-note-o::before{content:""}.sharkicon-cc-jcb::before{content:""}.sharkicon-cc-diners-club::before{content:""}.sharkicon-clone::before{content:""}.sharkicon-balance-scale::before{content:""}.sharkicon-hourglass-o::before{content:""}.sharkicon-hourglass-1::before{content:""}.sharkicon-hourglass-2::before{content:""}.sharkicon-hourglass-3::before{content:""}.sharkicon-hourglass::before{content:""}.sharkicon-hand-grab-o::before{content:""}.sharkicon-hand-paper-o::before{content:""}.sharkicon-hand-scissors-o::before{content:""}.sharkicon-hand-lizard-o::before{content:""}.sharkicon-hand-spock-o::before{content:""}.sharkicon-hand-pointer-o::before{content:""}.sharkicon-hand-peace-o::before{content:""}.sharkicon-trademark::before{content:""}.sharkicon-registered::before{content:""}.sharkicon-creative-commons::before{content:""}.sharkicon-gg::before{content:""}.sharkicon-gg-circle::before{content:""}.sharkicon-tripadvisor::before{content:""}.sharkicon-odnoklassniki::before{content:""}.sharkicon-odnoklassniki-square::before{content:""}.sharkicon-get-pocket::before{content:""}.sharkicon-wikipedia-w::before{content:""}.sharkicon-safari::before{content:""}.sharkicon-chrome::before{content:""}.sharkicon-firefox::before{content:""}.sharkicon-opera::before{content:""}.sharkicon-internet-explorer::before{content:""}.sharkicon-television::before{content:""}.sharkicon-contao::before{content:""}.sharkicon-500px::before{content:""}.sharkicon-amazon::before{content:""}.sharkicon-calendar-plus-o::before{content:""}.sharkicon-calendar-minus-o::before{content:""}.sharkicon-calendar-times-o::before{content:""}.sharkicon-calendar-check-o::before{content:""}.sharkicon-industry::before{content:""}.sharkicon-map-pin::before{content:""}.sharkicon-map-signs::before{content:""}.sharkicon-map-o::before{content:""}.sharkicon-map::before{content:""}.sharkicon-commenting::before{content:""}.sharkicon-commenting-o::before{content:""}.sharkicon-houzz::before{content:""}.sharkicon-vimeo::before{content:""}.sharkicon-black-tie::before{content:""}.sharkicon-fonticons::before{content:""}.sharkicon-lg{font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}.sharkicon-2x{font-size:2em}.sharkicon-3x{font-size:3em}.sharkicon-4x{font-size:4em}.sharkicon-5x{font-size:5em}.sharkicon-fw{text-align:center;width:1.28571429em}.sharkicon-border{border-radius:.1em;padding:.2em .25em .15em;border:solid 0.08em}.sharkicon-pull-left{float:left;margin-right:.3em}.sharkicon-pull-right{float:right;margin-left:.3em}.sharkicon-rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.sharkicon-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.sharkicon-rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.sharkicon-flip-horizontal{-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.sharkicon-flip-vertical{-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.sharkicon-inverse{-webkit-filter:invert(100%);filter:invert(100%)}.sharkicon-spin{-webkit-animation:sharkicon-animation-spin 2s infinite linear;-moz-animation:sharkicon-animation-spin 2s infinite linear;animation:sharkicon-animation-spin 2s infinite linear}.sharkicon-pulse{-webkit-animation:sharkicon-animation-spin 1s infinite steps(8);-moz-animation:sharkicon-animation-spin 1s infinite steps(8);animation:sharkicon-animation-spin 1s infinite steps(8)}.sharkicon-ul{padding-left:0;list-style-type:none;margin-left:2.14285714em}.sharkicon-ul>li{position:relative}.sharkicon-ul>li .sharkicon-li{text-align:center;position:absolute;left:-2.14285714em;width:2.14285714em;top:0.14285714em}.sharkicon-ul>li .sharkicon-li .sharkicon-lg{left:-1.85714286em}.sharkicon-stack{width:2em;height:2em;line-height:2em;vertical-align:middle;position:relative;display:inline-block}.sharkicon-stack .sharkicon-stack-1x,.sharkicon-stack .sharkicon-stack-2x{left:0;width:100%;text-align:center;position:absolute}.sharkicon-stack .sharkicon-stack-1x{line-height:inherit}.sharkicon-stack .sharkicon-stack-2x{font-size:2em}@-webkit-keyframes sharkicon-animation-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes sharkicon-animation-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@keyframes sharkicon-animation-spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg);transform:rotate(359deg)}}
2
 
 
1
  @font-face{font-family:sharkicons;src:url("fonts/sharkicons.eot?v160221");src:url("fonts/sharkicons.eot?#iefix&v160221") format("embedded-opentype"),url("fonts/sharkicons.ttf?v160221") format("truetype"),url("fonts/sharkicons.woff?v160221") format("woff"),url("fonts/sharkicons.svg?v160221#sharkicons") format("svg");font-weight:normal;font-style:normal}.sharkicon::before{font:normal normal normal 14px/1 sharkicons;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;display:inline-block;font-size:inherit;text-decoration:inherit;text-transform:none}.sharkicon-broom::before{content:""}.sharkicon-comment-mail-one::before{content:""}.sharkicon-comment-mail::before{content:""}.sharkicon-s2member::before{content:""}.sharkicon-websharks::before{content:""}.sharkicon-wp-kb-articles::before{content:""}.sharkicon-zencache-logo::before{content:""}.sharkicon-zencache::before{content:""}.sharkicon-wp-sharks::before{content:""}.sharkicon-wp-sharks-fin::before{content:""}.sharkicon-comet-cache::before{content:""}.sharkicon-comet-cache-logo::before{content:""}.sharkicon-comet-cache-comet::before{content:""}.sharkicon-feat-watch::before{content:""}.sharkicon-feat-server::before{content:""}.sharkicon-feat-layers::before{content:""}.sharkicon-feat-box::before{content:""}.sharkicon-feat-ellipsis::before{content:""}.sharkicon-typi-group::before{content:""}.sharkicon-enty-bookmark::before{content:""}.sharkicon-enty-bookmarks::before{content:""}.sharkicon-enty-open-book::before{content:""}.sharkicon-enty-archive::before{content:""}.sharkicon-enty-area-graph::before{content:""}.sharkicon-enty-bucket::before{content:""}.sharkicon-enty-colors::before{content:""}.sharkicon-enty-copy::before{content:""}.sharkicon-enty-drive::before{content:""}.sharkicon-enty-feather::before{content:""}.sharkicon-enty-gauge::before{content:""}.sharkicon-enty-hand::before{content:""}.sharkicon-enty-lab-flask::before{content:""}.sharkicon-enty-mask::before{content:""}.sharkicon-enty-medal::before{content:""}.sharkicon-enty-exclamation::before{content:""}.sharkicon-enty-palette::before{content:""}.sharkicon-enty-ruler::before{content:""}.sharkicon-enty-shop::before{content:""}.sharkicon-enty-basket::before{content:""}.sharkicon-enty-cart::before{content:""}.sharkicon-enty-traffic-cone::before{content:""}.sharkicon-enty-tree::before{content:""}.sharkicon-enty-trophy::before{content:""}.sharkicon-enty-v-card::before{content:""}.sharkicon-enty-google-hangouts::before{content:""}.sharkicon-eleg-line-graph::before{content:""}.sharkicon-eleg-male::before{content:""}.sharkicon-eleg-female::before{content:""}.sharkicon-eleg-atom::before{content:""}.sharkicon-broc-cart::before{content:""}.sharkicon-broc-crap::before{content:""}.sharkicon-broc-atom::before{content:""}.sharkicon-icom-headphones::before{content:""}.sharkicon-icom-barcode::before{content:""}.sharkicon-icom-user::before{content:""}.sharkicon-icom-users::before{content:""}.sharkicon-icom-user-plus::before{content:""}.sharkicon-icom-user-minus::before{content:""}.sharkicon-icom-user-check::before{content:""}.sharkicon-icom-user-tie::before{content:""}.sharkicon-icom-key::before{content:""}.sharkicon-icom-key2::before{content:""}.sharkicon-icom-happy::before{content:""}.sharkicon-icom-happy2::before{content:""}.sharkicon-icom-smile::before{content:""}.sharkicon-icom-smile2::before{content:""}.sharkicon-icom-tongue::before{content:""}.sharkicon-icom-tongue2::before{content:""}.sharkicon-icom-sad::before{content:""}.sharkicon-icom-sad2::before{content:""}.sharkicon-icom-wink::before{content:""}.sharkicon-icom-wink2::before{content:""}.sharkicon-icom-grin::before{content:""}.sharkicon-icom-grin2::before{content:""}.sharkicon-icom-cool::before{content:""}.sharkicon-icom-cool2::before{content:""}.sharkicon-icom-angry::before{content:""}.sharkicon-icom-angry2::before{content:""}.sharkicon-icom-evil::before{content:""}.sharkicon-icom-evil2::before{content:""}.sharkicon-icom-shocked::before{content:""}.sharkicon-icom-shocked2::before{content:""}.sharkicon-icom-baffled::before{content:""}.sharkicon-icom-baffled2::before{content:""}.sharkicon-icom-confused::before{content:""}.sharkicon-icom-confused2::before{content:""}.sharkicon-icom-neutral::before{content:""}.sharkicon-icom-neutral2::before{content:""}.sharkicon-icom-hipster::before{content:""}.sharkicon-icom-hipster2::before{content:""}.sharkicon-icom-wondering::before{content:""}.sharkicon-icom-wondering2::before{content:""}.sharkicon-icom-sleepy::before{content:""}.sharkicon-icom-sleepy2::before{content:""}.sharkicon-icom-frustrated::before{content:""}.sharkicon-icom-frustrated2::before{content:""}.sharkicon-icom-crying::before{content:""}.sharkicon-icom-crying2::before{content:""}.sharkicon-icom-spell-check::before{content:""}.sharkicon-icom-command-key::before{content:""}.sharkicon-icom-shift-key::before{content:""}.sharkicon-icom-control-key::before{content:""}.sharkicon-icom-option-key::before{content:""}.sharkicon-icom-wordpress::before{content:""}.sharkicon-icom-wordpress-square::before{content:""}.sharkicon-icom-yahoo::before{content:""}.sharkicon-icom-linux::before{content:""}.sharkicon-icom-finder::before{content:""}.sharkicon-icom-android::before{content:""}.sharkicon-icom-reddit::before{content:""}.sharkicon-icom-paypal::before{content:""}.sharkicon-icom-git::before{content:""}.sharkicon-octi-alignment-align::before{content:""}.sharkicon-octi-alignment-aligned-to::before{content:""}.sharkicon-octi-alignment-unalign::before{content:""}.sharkicon-octi-bookmark::before{content:""}.sharkicon-octi-broadcast::before{content:""}.sharkicon-octi-browser::before{content:""}.sharkicon-octi-checklist::before{content:""}.sharkicon-octi-circuit-board::before{content:""}.sharkicon-octi-clippy::before{content:""}.sharkicon-octi-cloud-download::before{content:""}.sharkicon-octi-cloud-upload::before{content:""}.sharkicon-octi-comment::before{content:""}.sharkicon-octi-comments::before{content:""}.sharkicon-octi-tach::before{content:""}.sharkicon-octi-device-camera::before{content:""}.sharkicon-octi-device-camera-video::before{content:""}.sharkicon-octi-device-desktop::before{content:""}.sharkicon-octi-diff::before{content:""}.sharkicon-octi-file-binary::before{content:""}.sharkicon-octi-file-media::before{content:""}.sharkicon-octi-file-submodule::before{content:""}.sharkicon-octi-file-symlink-directory::before{content:""}.sharkicon-octi-file-symlink-file::before{content:""}.sharkicon-octi-fold::before{content:""}.sharkicon-octi-git-branch::before{content:""}.sharkicon-octi-git-commit::before{content:""}.sharkicon-octi-git-compare::before{content:""}.sharkicon-octi-git-merge::before{content:""}.sharkicon-octi-git-pull-request::before{content:""}.sharkicon-octi-graph::before{content:""}.sharkicon-octi-home::before{content:""}.sharkicon-octi-horizontal-rule::before{content:""}.sharkicon-octi-key::before{content:""}.sharkicon-octi-light-bulb::before{content:""}.sharkicon-octi-link-external::before{content:""}.sharkicon-octi-lock::before{content:""}.sharkicon-octi-markdown::before{content:""}.sharkicon-octi-microscope::before{content:""}.sharkicon-octi-mirror::before{content:""}.sharkicon-octi-move-down::before{content:""}.sharkicon-octi-move-left::before{content:""}.sharkicon-octi-move-right::before{content:""}.sharkicon-octi-move-up::before{content:""}.sharkicon-octi-mute::before{content:""}.sharkicon-octi-organization::before{content:""}.sharkicon-octi-package::before{content:""}.sharkicon-octi-paintcan::before{content:""}.sharkicon-octi-person::before{content:""}.sharkicon-octi-plug::before{content:""}.sharkicon-octi-podium::before{content:""}.sharkicon-octi-pulse::before{content:""}.sharkicon-octi-puzzle::before{content:""}.sharkicon-octi-repo::before{content:""}.sharkicon-octi-repo-clone::before{content:""}.sharkicon-octi-repo-force-push::before{content:""}.sharkicon-octi-repo-forked::before{content:""}.sharkicon-octi-repo-pull::before{content:""}.sharkicon-octi-repo-push::before{content:""}.sharkicon-octi-rocket::before{content:""}.sharkicon-octi-ruby::before{content:""}.sharkicon-octi-screen-full::before{content:""}.sharkicon-octi-screen-normal::before{content:""}.sharkicon-octi-sign-in::before{content:""}.sharkicon-octi-sign-out::before{content:""}.sharkicon-octi-split::before{content:""}.sharkicon-octi-squirrel::before{content:""}.sharkicon-octi-steps::before{content:""}.sharkicon-octi-tag::before{content:""}.sharkicon-octi-telescope::before{content:""}.sharkicon-octi-terminal::before{content:""}.sharkicon-octi-unfold::before{content:""}.sharkicon-octi-versions::before{content:""}.sharkicon-glass::before{content:""}.sharkicon-music::before{content:""}.sharkicon-search::before{content:""}.sharkicon-envelope-o::before{content:""}.sharkicon-heart::before{content:""}.sharkicon-star::before{content:""}.sharkicon-star-o::before{content:""}.sharkicon-user::before{content:""}.sharkicon-film::before{content:""}.sharkicon-th-large::before{content:""}.sharkicon-th::before{content:""}.sharkicon-th-list::before{content:""}.sharkicon-check::before{content:""}.sharkicon-close::before{content:""}.sharkicon-search-plus::before{content:""}.sharkicon-search-minus::before{content:""}.sharkicon-power-off::before{content:""}.sharkicon-signal::before{content:""}.sharkicon-cog::before{content:""}.sharkicon-trash-o::before{content:""}.sharkicon-home::before{content:""}.sharkicon-file-o::before{content:""}.sharkicon-clock-o::before{content:""}.sharkicon-road::before{content:""}.sharkicon-download::before{content:""}.sharkicon-arrow-circle-o-down::before{content:""}.sharkicon-arrow-circle-o-up::before{content:""}.sharkicon-inbox::before{content:""}.sharkicon-play-circle-o::before{content:""}.sharkicon-repeat::before{content:""}.sharkicon-refresh::before{content:""}.sharkicon-list-alt::before{content:""}.sharkicon-lock::before{content:""}.sharkicon-flag::before{content:""}.sharkicon-headphones::before{content:""}.sharkicon-volume-off::before{content:""}.sharkicon-volume-down::before{content:""}.sharkicon-volume-up::before{content:""}.sharkicon-qrcode::before{content:""}.sharkicon-barcode::before{content:""}.sharkicon-tag::before{content:""}.sharkicon-tags::before{content:""}.sharkicon-book::before{content:""}.sharkicon-bookmark::before{content:""}.sharkicon-print::before{content:""}.sharkicon-camera::before{content:""}.sharkicon-font::before{content:""}.sharkicon-bold::before{content:""}.sharkicon-italic::before{content:""}.sharkicon-text-height::before{content:""}.sharkicon-text-width::before{content:""}.sharkicon-align-left::before{content:""}.sharkicon-align-center::before{content:""}.sharkicon-align-right::before{content:""}.sharkicon-align-justify::before{content:""}.sharkicon-list::before{content:""}.sharkicon-dedent::before{content:""}.sharkicon-indent::before{content:""}.sharkicon-video-camera::before{content:""}.sharkicon-image::before{content:""}.sharkicon-pencil::before{content:""}.sharkicon-map-marker::before{content:""}.sharkicon-adjust::before{content:""}.sharkicon-tint::before{content:""}.sharkicon-edit::before{content:""}.sharkicon-share-square-o::before{content:""}.sharkicon-check-square-o::before{content:""}.sharkicon-arrows::before{content:""}.sharkicon-step-backward::before{content:""}.sharkicon-fast-backward::before{content:""}.sharkicon-backward::before{content:""}.sharkicon-play::before{content:""}.sharkicon-pause::before{content:""}.sharkicon-stop::before{content:""}.sharkicon-forward::before{content:""}.sharkicon-fast-forward::before{content:""}.sharkicon-step-forward::before{content:""}.sharkicon-eject::before{content:""}.sharkicon-chevron-left::before{content:""}.sharkicon-chevron-right::before{content:""}.sharkicon-plus-circle::before{content:""}.sharkicon-minus-circle::before{content:""}.sharkicon-times-circle::before{content:""}.sharkicon-check-circle::before{content:""}.sharkicon-question-circle::before{content:""}.sharkicon-info-circle::before{content:""}.sharkicon-crosshairs::before{content:""}.sharkicon-times-circle-o::before{content:""}.sharkicon-check-circle-o::before{content:""}.sharkicon-ban::before{content:""}.sharkicon-arrow-left::before{content:""}.sharkicon-arrow-right::before{content:""}.sharkicon-arrow-up::before{content:""}.sharkicon-arrow-down::before{content:""}.sharkicon-mail-forward::before{content:""}.sharkicon-expand::before{content:""}.sharkicon-compress::before{content:""}.sharkicon-plus::before{content:""}.sharkicon-minus::before{content:""}.sharkicon-asterisk::before{content:""}.sharkicon-exclamation-circle::before{content:""}.sharkicon-gift::before{content:""}.sharkicon-leaf::before{content:""}.sharkicon-fire::before{content:""}.sharkicon-eye::before{content:""}.sharkicon-eye-slash::before{content:""}.sharkicon-exclamation-triangle::before{content:""}.sharkicon-plane::before{content:""}.sharkicon-calendar::before{content:""}.sharkicon-random::before{content:""}.sharkicon-comment::before{content:""}.sharkicon-magnet::before{content:""}.sharkicon-chevron-up::before{content:""}.sharkicon-chevron-down::before{content:""}.sharkicon-retweet::before{content:""}.sharkicon-shopping-cart::before{content:""}.sharkicon-folder::before{content:""}.sharkicon-folder-open::before{content:""}.sharkicon-arrows-v::before{content:""}.sharkicon-arrows-h::before{content:""}.sharkicon-bar-chart::before{content:""}.sharkicon-twitter-square::before{content:""}.sharkicon-facebook-square::before{content:""}.sharkicon-camera-retro::before{content:""}.sharkicon-key::before{content:""}.sharkicon-cogs::before{content:""}.sharkicon-comments::before{content:""}.sharkicon-thumbs-o-up::before{content:""}.sharkicon-thumbs-o-down::before{content:""}.sharkicon-star-half::before{content:""}.sharkicon-heart-o::before{content:""}.sharkicon-sign-out::before{content:""}.sharkicon-linkedin-square::before{content:""}.sharkicon-thumb-tack::before{content:""}.sharkicon-external-link::before{content:""}.sharkicon-sign-in::before{content:""}.sharkicon-trophy::before{content:""}.sharkicon-github-square::before{content:""}.sharkicon-upload::before{content:""}.sharkicon-lemon-o::before{content:""}.sharkicon-phone::before{content:""}.sharkicon-square-o::before{content:""}.sharkicon-bookmark-o::before{content:""}.sharkicon-phone-square::before{content:""}.sharkicon-twitter::before{content:""}.sharkicon-facebook::before{content:""}.sharkicon-github::before{content:""}.sharkicon-unlock::before{content:""}.sharkicon-credit-card::before{content:""}.sharkicon-feed::before{content:""}.sharkicon-hdd-o::before{content:""}.sharkicon-bullhorn::before{content:""}.sharkicon-bell-o::before{content:""}.sharkicon-certificate::before{content:""}.sharkicon-hand-o-right::before{content:""}.sharkicon-hand-o-left::before{content:""}.sharkicon-hand-o-up::before{content:""}.sharkicon-hand-o-down::before{content:""}.sharkicon-arrow-circle-left::before{content:""}.sharkicon-arrow-circle-right::before{content:""}.sharkicon-arrow-circle-up::before{content:""}.sharkicon-arrow-circle-down::before{content:""}.sharkicon-globe::before{content:""}.sharkicon-wrench::before{content:""}.sharkicon-tasks::before{content:""}.sharkicon-filter::before{content:""}.sharkicon-briefcase::before{content:""}.sharkicon-arrows-alt::before{content:""}.sharkicon-group::before{content:""}.sharkicon-chain::before{content:""}.sharkicon-cloud::before{content:""}.sharkicon-flask::before{content:""}.sharkicon-cut::before{content:""}.sharkicon-copy::before{content:""}.sharkicon-paperclip::before{content:""}.sharkicon-floppy-o::before{content:""}.sharkicon-square::before{content:""}.sharkicon-bars::before{content:""}.sharkicon-list-ul::before{content:""}.sharkicon-list-ol::before{content:""}.sharkicon-strikethrough::before{content:""}.sharkicon-underline::before{content:""}.sharkicon-table::before{content:""}.sharkicon-magic::before{content:""}.sharkicon-truck::before{content:""}.sharkicon-pinterest::before{content:""}.sharkicon-pinterest-square::before{content:""}.sharkicon-google-plus-square::before{content:""}.sharkicon-google-plus::before{content:""}.sharkicon-money::before{content:""}.sharkicon-caret-down::before{content:""}.sharkicon-caret-up::before{content:""}.sharkicon-caret-left::before{content:""}.sharkicon-caret-right::before{content:""}.sharkicon-columns::before{content:""}.sharkicon-sort::before{content:""}.sharkicon-sort-desc::before{content:""}.sharkicon-sort-asc::before{content:""}.sharkicon-envelope::before{content:""}.sharkicon-linkedin::before{content:""}.sharkicon-rotate-left::before{content:""}.sharkicon-gavel::before{content:""}.sharkicon-dashboard::before{content:""}.sharkicon-comment-o::before{content:""}.sharkicon-comments-o::before{content:""}.sharkicon-bolt::before{content:""}.sharkicon-sitemap::before{content:""}.sharkicon-umbrella::before{content:""}.sharkicon-clipboard::before{content:""}.sharkicon-lightbulb-o::before{content:""}.sharkicon-exchange::before{content:""}.sharkicon-cloud-download::before{content:""}.sharkicon-cloud-upload::before{content:""}.sharkicon-user-md::before{content:""}.sharkicon-stethoscope::before{content:""}.sharkicon-suitcase::before{content:""}.sharkicon-bell::before{content:""}.sharkicon-coffee::before{content:""}.sharkicon-cutlery::before{content:""}.sharkicon-file-text-o::before{content:""}.sharkicon-building-o::before{content:""}.sharkicon-hospital-o::before{content:""}.sharkicon-ambulance::before{content:""}.sharkicon-medkit::before{content:""}.sharkicon-fighter-jet::before{content:""}.sharkicon-beer::before{content:""}.sharkicon-h-square::before{content:""}.sharkicon-plus-square::before{content:""}.sharkicon-angle-double-left::before{content:""}.sharkicon-angle-double-right::before{content:""}.sharkicon-angle-double-up::before{content:""}.sharkicon-angle-double-down::before{content:""}.sharkicon-angle-left::before{content:""}.sharkicon-angle-right::before{content:""}.sharkicon-angle-up::before{content:""}.sharkicon-angle-down::before{content:""}.sharkicon-desktop::before{content:""}.sharkicon-laptop::before{content:""}.sharkicon-tablet::before{content:""}.sharkicon-mobile::before{content:""}.sharkicon-circle-o::before{content:""}.sharkicon-quote-left::before{content:""}.sharkicon-quote-right::before{content:""}.sharkicon-spinner::before{content:""}.sharkicon-circle::before{content:""}.sharkicon-mail-reply::before{content:""}.sharkicon-github-alt::before{content:""}.sharkicon-folder-o::before{content:""}.sharkicon-folder-open-o::before{content:""}.sharkicon-smile-o::before{content:""}.sharkicon-frown-o::before{content:""}.sharkicon-meh-o::before{content:""}.sharkicon-gamepad::before{content:""}.sharkicon-keyboard-o::before{content:""}.sharkicon-flag-o::before{content:""}.sharkicon-flag-checkered::before{content:""}.sharkicon-terminal::before{content:""}.sharkicon-code::before{content:""}.sharkicon-mail-reply-all::before{content:""}.sharkicon-star-half-empty::before{content:""}.sharkicon-location-arrow::before{content:""}.sharkicon-crop::before{content:""}.sharkicon-code-fork::before{content:""}.sharkicon-chain-broken::before{content:""}.sharkicon-question::before{content:""}.sharkicon-info::before{content:""}.sharkicon-exclamation::before{content:""}.sharkicon-superscript::before{content:""}.sharkicon-subscript::before{content:""}.sharkicon-eraser::before{content:""}.sharkicon-puzzle-piece::before{content:""}.sharkicon-microphone::before{content:""}.sharkicon-microphone-slash::before{content:""}.sharkicon-shield::before{content:""}.sharkicon-calendar-o::before{content:""}.sharkicon-fire-extinguisher::before{content:""}.sharkicon-rocket::before{content:""}.sharkicon-maxcdn::before{content:""}.sharkicon-chevron-circle-left::before{content:""}.sharkicon-chevron-circle-right::before{content:""}.sharkicon-chevron-circle-up::before{content:""}.sharkicon-chevron-circle-down::before{content:""}.sharkicon-html5::before{content:""}.sharkicon-css3::before{content:""}.sharkicon-anchor::before{content:""}.sharkicon-unlock-alt::before{content:""}.sharkicon-bullseye::before{content:""}.sharkicon-ellipsis-h::before{content:""}.sharkicon-ellipsis-v::before{content:""}.sharkicon-rss-square::before{content:""}.sharkicon-play-circle::before{content:""}.sharkicon-ticket::before{content:""}.sharkicon-minus-square::before{content:""}.sharkicon-minus-square-o::before{content:""}.sharkicon-level-up::before{content:""}.sharkicon-level-down::before{content:""}.sharkicon-check-square::before{content:""}.sharkicon-pencil-square::before{content:""}.sharkicon-external-link-square::before{content:""}.sharkicon-share-square::before{content:""}.sharkicon-compass::before{content:""}.sharkicon-caret-square-o-down::before{content:""}.sharkicon-caret-square-o-up::before{content:""}.sharkicon-caret-square-o-right::before{content:""}.sharkicon-eur::before{content:""}.sharkicon-gbp::before{content:""}.sharkicon-dollar::before{content:""}.sharkicon-inr::before{content:""}.sharkicon-cny::before{content:""}.sharkicon-rouble::before{content:""}.sharkicon-krw::before{content:""}.sharkicon-bitcoin::before{content:""}.sharkicon-file::before{content:""}.sharkicon-file-text::before{content:""}.sharkicon-sort-alpha-asc::before{content:""}.sharkicon-sort-alpha-desc::before{content:""}.sharkicon-sort-amount-asc::before{content:""}.sharkicon-sort-amount-desc::before{content:""}.sharkicon-sort-numeric-asc::before{content:""}.sharkicon-sort-numeric-desc::before{content:""}.sharkicon-thumbs-up::before{content:""}.sharkicon-thumbs-down::before{content:""}.sharkicon-youtube-square::before{content:""}.sharkicon-youtube::before{content:""}.sharkicon-xing::before{content:""}.sharkicon-xing-square::before{content:""}.sharkicon-youtube-play::before{content:""}.sharkicon-dropbox::before{content:""}.sharkicon-stack-overflow::before{content:""}.sharkicon-instagram::before{content:""}.sharkicon-flickr::before{content:""}.sharkicon-adn::before{content:""}.sharkicon-bitbucket::before{content:""}.sharkicon-bitbucket-square::before{content:""}.sharkicon-tumblr::before{content:""}.sharkicon-tumblr-square::before{content:""}.sharkicon-long-arrow-down::before{content:""}.sharkicon-long-arrow-up::before{content:""}.sharkicon-long-arrow-left::before{content:""}.sharkicon-long-arrow-right::before{content:""}.sharkicon-apple::before{content:""}.sharkicon-windows::before{content:""}.sharkicon-android::before{content:""}.sharkicon-linux::before{content:""}.sharkicon-dribbble::before{content:""}.sharkicon-skype::before{content:""}.sharkicon-foursquare::before{content:""}.sharkicon-trello::before{content:""}.sharkicon-female::before{content:""}.sharkicon-male::before{content:""}.sharkicon-gittip::before{content:""}.sharkicon-sun-o::before{content:""}.sharkicon-moon-o::before{content:""}.sharkicon-archive::before{content:""}.sharkicon-bug::before{content:""}.sharkicon-vk::before{content:""}.sharkicon-weibo::before{content:""}.sharkicon-renren::before{content:""}.sharkicon-pagelines::before{content:""}.sharkicon-stack-exchange::before{content:""}.sharkicon-arrow-circle-o-right::before{content:""}.sharkicon-arrow-circle-o-left::before{content:""}.sharkicon-caret-square-o-left::before{content:""}.sharkicon-dot-circle-o::before{content:""}.sharkicon-wheelchair::before{content:""}.sharkicon-vimeo-square::before{content:""}.sharkicon-try::before{content:""}.sharkicon-plus-square-o::before{content:""}.sharkicon-space-shuttle::before{content:""}.sharkicon-slack::before{content:""}.sharkicon-envelope-square::before{content:""}.sharkicon-wordpress::before{content:""}.sharkicon-openid::before{content:""}.sharkicon-bank::before{content:""}.sharkicon-graduation-cap::before{content:""}.sharkicon-yahoo::before{content:""}.sharkicon-google::before{content:""}.sharkicon-reddit::before{content:""}.sharkicon-reddit-square::before{content:""}.sharkicon-stumbleupon-circle::before{content:""}.sharkicon-stumbleupon::before{content:""}.sharkicon-delicious::before{content:""}.sharkicon-digg::before{content:""}.sharkicon-pied-piper::before{content:""}.sharkicon-pied-piper-alt::before{content:""}.sharkicon-drupal::before{content:""}.sharkicon-joomla::before{content:""}.sharkicon-language::before{content:""}.sharkicon-fax::before{content:""}.sharkicon-building::before{content:""}.sharkicon-child::before{content:""}.sharkicon-paw::before{content:""}.sharkicon-spoon::before{content:""}.sharkicon-cube::before{content:""}.sharkicon-cubes::before{content:""}.sharkicon-behance::before{content:""}.sharkicon-behance-square::before{content:""}.sharkicon-steam::before{content:""}.sharkicon-steam-square::before{content:""}.sharkicon-recycle::before{content:""}.sharkicon-automobile::before{content:""}.sharkicon-cab::before{content:""}.sharkicon-tree::before{content:""}.sharkicon-spotify::before{content:""}.sharkicon-deviantart::before{content:""}.sharkicon-soundcloud::before{content:""}.sharkicon-database::before{content:""}.sharkicon-file-pdf-o::before{content:""}.sharkicon-file-word-o::before{content:""}.sharkicon-file-excel-o::before{content:""}.sharkicon-file-powerpoint-o::before{content:""}.sharkicon-file-image-o::before{content:""}.sharkicon-file-archive-o::before{content:""}.sharkicon-file-audio-o::before{content:""}.sharkicon-file-movie-o::before{content:""}.sharkicon-file-code-o::before{content:""}.sharkicon-vine::before{content:""}.sharkicon-codepen::before{content:""}.sharkicon-jsfiddle::before{content:""}.sharkicon-life-bouy::before{content:""}.sharkicon-circle-o-notch::before{content:""}.sharkicon-ra::before{content:""}.sharkicon-empire::before{content:""}.sharkicon-git-square::before{content:""}.sharkicon-git::before{content:""}.sharkicon-hacker-news::before{content:""}.sharkicon-tencent-weibo::before{content:""}.sharkicon-qq::before{content:""}.sharkicon-wechat::before{content:""}.sharkicon-paper-plane::before{content:""}.sharkicon-paper-plane-o::before{content:""}.sharkicon-history::before{content:""}.sharkicon-circle-thin::before{content:""}.sharkicon-header::before{content:""}.sharkicon-paragraph::before{content:""}.sharkicon-sliders::before{content:""}.sharkicon-share-alt::before{content:""}.sharkicon-share-alt-square::before{content:""}.sharkicon-bomb::before{content:""}.sharkicon-futbol-o::before{content:""}.sharkicon-tty::before{content:""}.sharkicon-binoculars::before{content:""}.sharkicon-plug::before{content:""}.sharkicon-slideshare::before{content:""}.sharkicon-twitch::before{content:""}.sharkicon-yelp::before{content:""}.sharkicon-newspaper-o::before{content:""}.sharkicon-wifi::before{content:""}.sharkicon-calculator::before{content:""}.sharkicon-paypal::before{content:""}.sharkicon-google-wallet::before{content:""}.sharkicon-cc-visa::before{content:""}.sharkicon-cc-mastercard::before{content:""}.sharkicon-cc-discover::before{content:""}.sharkicon-cc-amex::before{content:""}.sharkicon-cc-paypal::before{content:""}.sharkicon-cc-stripe::before{content:""}.sharkicon-bell-slash::before{content:""}.sharkicon-bell-slash-o::before{content:""}.sharkicon-trash::before{content:""}.sharkicon-copyright::before{content:""}.sharkicon-at::before{content:""}.sharkicon-eyedropper::before{content:""}.sharkicon-paint-brush::before{content:""}.sharkicon-birthday-cake::before{content:""}.sharkicon-area-chart::before{content:""}.sharkicon-pie-chart::before{content:""}.sharkicon-line-chart::before{content:""}.sharkicon-lastfm::before{content:""}.sharkicon-lastfm-square::before{content:""}.sharkicon-toggle-off::before{content:""}.sharkicon-toggle-on::before{content:""}.sharkicon-bicycle::before{content:""}.sharkicon-bus::before{content:""}.sharkicon-ioxhost::before{content:""}.sharkicon-angellist::before{content:""}.sharkicon-cc::before{content:""}.sharkicon-ils::before{content:""}.sharkicon-meanpath::before{content:""}.sharkicon-buysellads::before{content:""}.sharkicon-connectdevelop::before{content:""}.sharkicon-dashcube::before{content:""}.sharkicon-forumbee::before{content:""}.sharkicon-leanpub::before{content:""}.sharkicon-sellsy::before{content:""}.sharkicon-shirtsinbulk::before{content:""}.sharkicon-simplybuilt::before{content:""}.sharkicon-skyatlas::before{content:""}.sharkicon-cart-plus::before{content:""}.sharkicon-cart-arrow-down::before{content:""}.sharkicon-diamond::before{content:""}.sharkicon-ship::before{content:""}.sharkicon-user-secret::before{content:""}.sharkicon-motorcycle::before{content:""}.sharkicon-street-view::before{content:""}.sharkicon-heartbeat::before{content:""}.sharkicon-venus::before{content:""}.sharkicon-mars::before{content:""}.sharkicon-mercury::before{content:""}.sharkicon-intersex::before{content:""}.sharkicon-transgender-alt::before{content:""}.sharkicon-venus-double::before{content:""}.sharkicon-mars-double::before{content:""}.sharkicon-venus-mars::before{content:""}.sharkicon-mars-stroke::before{content:""}.sharkicon-mars-stroke-v::before{content:""}.sharkicon-mars-stroke-h::before{content:""}.sharkicon-neuter::before{content:""}.sharkicon-genderless::before{content:""}.sharkicon-facebook-official::before{content:""}.sharkicon-pinterest-p::before{content:""}.sharkicon-whatsapp::before{content:""}.sharkicon-server::before{content:""}.sharkicon-user-plus::before{content:""}.sharkicon-user-times::before{content:""}.sharkicon-bed::before{content:""}.sharkicon-viacoin::before{content:""}.sharkicon-train::before{content:""}.sharkicon-subway::before{content:""}.sharkicon-medium::before{content:""}.sharkicon-y-combinator::before{content:""}.sharkicon-optin-monster::before{content:""}.sharkicon-opencart::before{content:""}.sharkicon-expeditedssl::before{content:""}.sharkicon-battery-4::before{content:""}.sharkicon-battery-3::before{content:""}.sharkicon-battery-2::before{content:""}.sharkicon-battery-1::before{content:""}.sharkicon-battery-0::before{content:""}.sharkicon-mouse-pointer::before{content:""}.sharkicon-i-cursor::before{content:""}.sharkicon-object-group::before{content:""}.sharkicon-object-ungroup::before{content:""}.sharkicon-sticky-note::before{content:""}.sharkicon-sticky-note-o::before{content:""}.sharkicon-cc-jcb::before{content:""}.sharkicon-cc-diners-club::before{content:""}.sharkicon-clone::before{content:""}.sharkicon-balance-scale::before{content:""}.sharkicon-hourglass-o::before{content:""}.sharkicon-hourglass-1::before{content:""}.sharkicon-hourglass-2::before{content:""}.sharkicon-hourglass-3::before{content:""}.sharkicon-hourglass::before{content:""}.sharkicon-hand-grab-o::before{content:""}.sharkicon-hand-paper-o::before{content:""}.sharkicon-hand-scissors-o::before{content:""}.sharkicon-hand-lizard-o::before{content:""}.sharkicon-hand-spock-o::before{content:""}.sharkicon-hand-pointer-o::before{content:""}.sharkicon-hand-peace-o::before{content:""}.sharkicon-trademark::before{content:""}.sharkicon-registered::before{content:""}.sharkicon-creative-commons::before{content:""}.sharkicon-gg::before{content:""}.sharkicon-gg-circle::before{content:""}.sharkicon-tripadvisor::before{content:""}.sharkicon-odnoklassniki::before{content:""}.sharkicon-odnoklassniki-square::before{content:""}.sharkicon-get-pocket::before{content:""}.sharkicon-wikipedia-w::before{content:""}.sharkicon-safari::before{content:""}.sharkicon-chrome::before{content:""}.sharkicon-firefox::before{content:""}.sharkicon-opera::before{content:""}.sharkicon-internet-explorer::before{content:""}.sharkicon-television::before{content:""}.sharkicon-contao::before{content:""}.sharkicon-500px::before{content:""}.sharkicon-amazon::before{content:""}.sharkicon-calendar-plus-o::before{content:""}.sharkicon-calendar-minus-o::before{content:""}.sharkicon-calendar-times-o::before{content:""}.sharkicon-calendar-check-o::before{content:""}.sharkicon-industry::before{content:""}.sharkicon-map-pin::before{content:""}.sharkicon-map-signs::before{content:""}.sharkicon-map-o::before{content:""}.sharkicon-map::before{content:""}.sharkicon-commenting::before{content:""}.sharkicon-commenting-o::before{content:""}.sharkicon-houzz::before{content:""}.sharkicon-vimeo::before{content:""}.sharkicon-black-tie::before{content:""}.sharkicon-fonticons::before{content:""}.sharkicon-lg{font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}.sharkicon-2x{font-size:2em}.sharkicon-3x{font-size:3em}.sharkicon-4x{font-size:4em}.sharkicon-5x{font-size:5em}.sharkicon-fw{text-align:center;width:1.28571429em}.sharkicon-border{border-radius:.1em;padding:.2em .25em .15em;border:solid 0.08em}.sharkicon-pull-left{float:left;margin-right:.3em}.sharkicon-pull-right{float:right;margin-left:.3em}.sharkicon-rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.sharkicon-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.sharkicon-rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.sharkicon-flip-horizontal{-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.sharkicon-flip-vertical{-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.sharkicon-inverse{-webkit-filter:invert(100%);filter:invert(100%)}.sharkicon-spin{-webkit-animation:sharkicon-animation-spin 2s infinite linear;-moz-animation:sharkicon-animation-spin 2s infinite linear;animation:sharkicon-animation-spin 2s infinite linear}.sharkicon-pulse{-webkit-animation:sharkicon-animation-spin 1s infinite steps(8);-moz-animation:sharkicon-animation-spin 1s infinite steps(8);animation:sharkicon-animation-spin 1s infinite steps(8)}.sharkicon-ul{padding-left:0;list-style-type:none;margin-left:2.14285714em}.sharkicon-ul>li{position:relative}.sharkicon-ul>li .sharkicon-li{text-align:center;position:absolute;left:-2.14285714em;width:2.14285714em;top:0.14285714em}.sharkicon-ul>li .sharkicon-li .sharkicon-lg{left:-1.85714286em}.sharkicon-stack{width:2em;height:2em;line-height:2em;vertical-align:middle;position:relative;display:inline-block}.sharkicon-stack .sharkicon-stack-1x,.sharkicon-stack .sharkicon-stack-2x{left:0;width:100%;text-align:center;position:absolute}.sharkicon-stack .sharkicon-stack-1x{line-height:inherit}.sharkicon-stack .sharkicon-stack-2x{font-size:2em}@-webkit-keyframes sharkicon-animation-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes sharkicon-animation-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@keyframes sharkicon-animation-spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg);transform:rotate(359deg)}}
2
 
3
+ /*# sourceMappingURL=long-classes.min.css.map */
src/vendor/websharks/sharkicons/src/short-classes.min.css CHANGED
@@ -1,2 +1,3 @@
1
  @font-face{font-family:sharkicons;src:url("fonts/sharkicons.eot?v160221");src:url("fonts/sharkicons.eot?#iefix&v160221") format("embedded-opentype"),url("fonts/sharkicons.ttf?v160221") format("truetype"),url("fonts/sharkicons.woff?v160221") format("woff"),url("fonts/sharkicons.svg?v160221#sharkicons") format("svg");font-weight:normal;font-style:normal}.si::before{font:normal normal normal 14px/1 sharkicons;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;display:inline-block;font-size:inherit;text-decoration:inherit;text-transform:none}.si-broom::before{content:""}.si-comment-mail-one::before{content:""}.si-comment-mail::before{content:""}.si-s2member::before{content:""}.si-websharks::before{content:""}.si-wp-kb-articles::before{content:""}.si-zencache-logo::before{content:""}.si-zencache::before{content:""}.si-wp-sharks::before{content:""}.si-wp-sharks-fin::before{content:""}.si-comet-cache::before{content:""}.si-comet-cache-logo::before{content:""}.si-comet-cache-comet::before{content:""}.si-feat-watch::before{content:""}.si-feat-server::before{content:""}.si-feat-layers::before{content:""}.si-feat-box::before{content:""}.si-feat-ellipsis::before{content:""}.si-typi-group::before{content:""}.si-enty-bookmark::before{content:""}.si-enty-bookmarks::before{content:""}.si-enty-open-book::before{content:""}.si-enty-archive::before{content:""}.si-enty-area-graph::before{content:""}.si-enty-bucket::before{content:""}.si-enty-colors::before{content:""}.si-enty-copy::before{content:""}.si-enty-drive::before{content:""}.si-enty-feather::before{content:""}.si-enty-gauge::before{content:""}.si-enty-hand::before{content:""}.si-enty-lab-flask::before{content:""}.si-enty-mask::before{content:""}.si-enty-medal::before{content:""}.si-enty-exclamation::before{content:""}.si-enty-palette::before{content:""}.si-enty-ruler::before{content:""}.si-enty-shop::before{content:""}.si-enty-basket::before{content:""}.si-enty-cart::before{content:""}.si-enty-traffic-cone::before{content:""}.si-enty-tree::before{content:""}.si-enty-trophy::before{content:""}.si-enty-v-card::before{content:""}.si-enty-google-hangouts::before{content:""}.si-eleg-line-graph::before{content:""}.si-eleg-male::before{content:""}.si-eleg-female::before{content:""}.si-eleg-atom::before{content:""}.si-broc-cart::before{content:""}.si-broc-crap::before{content:""}.si-broc-atom::before{content:""}.si-icom-headphones::before{content:""}.si-icom-barcode::before{content:""}.si-icom-user::before{content:""}.si-icom-users::before{content:""}.si-icom-user-plus::before{content:""}.si-icom-user-minus::before{content:""}.si-icom-user-check::before{content:""}.si-icom-user-tie::before{content:""}.si-icom-key::before{content:""}.si-icom-key2::before{content:""}.si-icom-happy::before{content:""}.si-icom-happy2::before{content:""}.si-icom-smile::before{content:""}.si-icom-smile2::before{content:""}.si-icom-tongue::before{content:""}.si-icom-tongue2::before{content:""}.si-icom-sad::before{content:""}.si-icom-sad2::before{content:""}.si-icom-wink::before{content:""}.si-icom-wink2::before{content:""}.si-icom-grin::before{content:""}.si-icom-grin2::before{content:""}.si-icom-cool::before{content:""}.si-icom-cool2::before{content:""}.si-icom-angry::before{content:""}.si-icom-angry2::before{content:""}.si-icom-evil::before{content:""}.si-icom-evil2::before{content:""}.si-icom-shocked::before{content:""}.si-icom-shocked2::before{content:""}.si-icom-baffled::before{content:""}.si-icom-baffled2::before{content:""}.si-icom-confused::before{content:""}.si-icom-confused2::before{content:""}.si-icom-neutral::before{content:""}.si-icom-neutral2::before{content:""}.si-icom-hipster::before{content:""}.si-icom-hipster2::before{content:""}.si-icom-wondering::before{content:""}.si-icom-wondering2::before{content:""}.si-icom-sleepy::before{content:""}.si-icom-sleepy2::before{content:""}.si-icom-frustrated::before{content:""}.si-icom-frustrated2::before{content:""}.si-icom-crying::before{content:""}.si-icom-crying2::before{content:""}.si-icom-spell-check::before{content:""}.si-icom-command-key::before{content:""}.si-icom-shift-key::before{content:""}.si-icom-control-key::before{content:""}.si-icom-option-key::before{content:""}.si-icom-wordpress::before{content:""}.si-icom-wordpress-square::before{content:""}.si-icom-yahoo::before{content:""}.si-icom-linux::before{content:""}.si-icom-finder::before{content:""}.si-icom-android::before{content:""}.si-icom-reddit::before{content:""}.si-icom-paypal::before{content:""}.si-icom-git::before{content:""}.si-octi-alignment-align::before{content:""}.si-octi-alignment-aligned-to::before{content:""}.si-octi-alignment-unalign::before{content:""}.si-octi-bookmark::before{content:""}.si-octi-broadcast::before{content:""}.si-octi-browser::before{content:""}.si-octi-checklist::before{content:""}.si-octi-circuit-board::before{content:""}.si-octi-clippy::before{content:""}.si-octi-cloud-download::before{content:""}.si-octi-cloud-upload::before{content:""}.si-octi-comment::before{content:""}.si-octi-comments::before{content:""}.si-octi-tach::before{content:""}.si-octi-device-camera::before{content:""}.si-octi-device-camera-video::before{content:""}.si-octi-device-desktop::before{content:""}.si-octi-diff::before{content:""}.si-octi-file-binary::before{content:""}.si-octi-file-media::before{content:""}.si-octi-file-submodule::before{content:""}.si-octi-file-symlink-directory::before{content:""}.si-octi-file-symlink-file::before{content:""}.si-octi-fold::before{content:""}.si-octi-git-branch::before{content:""}.si-octi-git-commit::before{content:""}.si-octi-git-compare::before{content:""}.si-octi-git-merge::before{content:""}.si-octi-git-pull-request::before{content:""}.si-octi-graph::before{content:""}.si-octi-home::before{content:""}.si-octi-horizontal-rule::before{content:""}.si-octi-key::before{content:""}.si-octi-light-bulb::before{content:""}.si-octi-link-external::before{content:""}.si-octi-lock::before{content:""}.si-octi-markdown::before{content:""}.si-octi-microscope::before{content:""}.si-octi-mirror::before{content:""}.si-octi-move-down::before{content:""}.si-octi-move-left::before{content:""}.si-octi-move-right::before{content:""}.si-octi-move-up::before{content:""}.si-octi-mute::before{content:""}.si-octi-organization::before{content:""}.si-octi-package::before{content:""}.si-octi-paintcan::before{content:""}.si-octi-person::before{content:""}.si-octi-plug::before{content:""}.si-octi-podium::before{content:""}.si-octi-pulse::before{content:""}.si-octi-puzzle::before{content:""}.si-octi-repo::before{content:""}.si-octi-repo-clone::before{content:""}.si-octi-repo-force-push::before{content:""}.si-octi-repo-forked::before{content:""}.si-octi-repo-pull::before{content:""}.si-octi-repo-push::before{content:""}.si-octi-rocket::before{content:""}.si-octi-ruby::before{content:""}.si-octi-screen-full::before{content:""}.si-octi-screen-normal::before{content:""}.si-octi-sign-in::before{content:""}.si-octi-sign-out::before{content:""}.si-octi-split::before{content:""}.si-octi-squirrel::before{content:""}.si-octi-steps::before{content:""}.si-octi-tag::before{content:""}.si-octi-telescope::before{content:""}.si-octi-terminal::before{content:""}.si-octi-unfold::before{content:""}.si-octi-versions::before{content:""}.si-glass::before{content:""}.si-music::before{content:""}.si-search::before{content:""}.si-envelope-o::before{content:""}.si-heart::before{content:""}.si-star::before{content:""}.si-star-o::before{content:""}.si-user::before{content:""}.si-film::before{content:""}.si-th-large::before{content:""}.si-th::before{content:""}.si-th-list::before{content:""}.si-check::before{content:""}.si-close::before{content:""}.si-search-plus::before{content:""}.si-search-minus::before{content:""}.si-power-off::before{content:""}.si-signal::before{content:""}.si-cog::before{content:""}.si-trash-o::before{content:""}.si-home::before{content:""}.si-file-o::before{content:""}.si-clock-o::before{content:""}.si-road::before{content:""}.si-download::before{content:""}.si-arrow-circle-o-down::before{content:""}.si-arrow-circle-o-up::before{content:""}.si-inbox::before{content:""}.si-play-circle-o::before{content:""}.si-repeat::before{content:""}.si-refresh::before{content:""}.si-list-alt::before{content:""}.si-lock::before{content:""}.si-flag::before{content:""}.si-headphones::before{content:""}.si-volume-off::before{content:""}.si-volume-down::before{content:""}.si-volume-up::before{content:""}.si-qrcode::before{content:""}.si-barcode::before{content:""}.si-tag::before{content:""}.si-tags::before{content:""}.si-book::before{content:""}.si-bookmark::before{content:""}.si-print::before{content:""}.si-camera::before{content:""}.si-font::before{content:""}.si-bold::before{content:""}.si-italic::before{content:""}.si-text-height::before{content:""}.si-text-width::before{content:""}.si-align-left::before{content:""}.si-align-center::before{content:""}.si-align-right::before{content:""}.si-align-justify::before{content:""}.si-list::before{content:""}.si-dedent::before{content:""}.si-indent::before{content:""}.si-video-camera::before{content:""}.si-image::before{content:""}.si-pencil::before{content:""}.si-map-marker::before{content:""}.si-adjust::before{content:""}.si-tint::before{content:""}.si-edit::before{content:""}.si-share-square-o::before{content:""}.si-check-square-o::before{content:""}.si-arrows::before{content:""}.si-step-backward::before{content:""}.si-fast-backward::before{content:""}.si-backward::before{content:""}.si-play::before{content:""}.si-pause::before{content:""}.si-stop::before{content:""}.si-forward::before{content:""}.si-fast-forward::before{content:""}.si-step-forward::before{content:""}.si-eject::before{content:""}.si-chevron-left::before{content:""}.si-chevron-right::before{content:""}.si-plus-circle::before{content:""}.si-minus-circle::before{content:""}.si-times-circle::before{content:""}.si-check-circle::before{content:""}.si-question-circle::before{content:""}.si-info-circle::before{content:""}.si-crosshairs::before{content:""}.si-times-circle-o::before{content:""}.si-check-circle-o::before{content:""}.si-ban::before{content:""}.si-arrow-left::before{content:""}.si-arrow-right::before{content:""}.si-arrow-up::before{content:""}.si-arrow-down::before{content:""}.si-mail-forward::before{content:""}.si-expand::before{content:""}.si-compress::before{content:""}.si-plus::before{content:""}.si-minus::before{content:""}.si-asterisk::before{content:""}.si-exclamation-circle::before{content:""}.si-gift::before{content:""}.si-leaf::before{content:""}.si-fire::before{content:""}.si-eye::before{content:""}.si-eye-slash::before{content:""}.si-exclamation-triangle::before{content:""}.si-plane::before{content:""}.si-calendar::before{content:""}.si-random::before{content:""}.si-comment::before{content:""}.si-magnet::before{content:""}.si-chevron-up::before{content:""}.si-chevron-down::before{content:""}.si-retweet::before{content:""}.si-shopping-cart::before{content:""}.si-folder::before{content:""}.si-folder-open::before{content:""}.si-arrows-v::before{content:""}.si-arrows-h::before{content:""}.si-bar-chart::before{content:""}.si-twitter-square::before{content:""}.si-facebook-square::before{content:""}.si-camera-retro::before{content:""}.si-key::before{content:""}.si-cogs::before{content:""}.si-comments::before{content:""}.si-thumbs-o-up::before{content:""}.si-thumbs-o-down::before{content:""}.si-star-half::before{content:""}.si-heart-o::before{content:""}.si-sign-out::before{content:""}.si-linkedin-square::before{content:""}.si-thumb-tack::before{content:""}.si-external-link::before{content:""}.si-sign-in::before{content:""}.si-trophy::before{content:""}.si-github-square::before{content:""}.si-upload::before{content:""}.si-lemon-o::before{content:""}.si-phone::before{content:""}.si-square-o::before{content:""}.si-bookmark-o::before{content:""}.si-phone-square::before{content:""}.si-twitter::before{content:""}.si-facebook::before{content:""}.si-github::before{content:""}.si-unlock::before{content:""}.si-credit-card::before{content:""}.si-feed::before{content:""}.si-hdd-o::before{content:""}.si-bullhorn::before{content:""}.si-bell-o::before{content:""}.si-certificate::before{content:""}.si-hand-o-right::before{content:""}.si-hand-o-left::before{content:""}.si-hand-o-up::before{content:""}.si-hand-o-down::before{content:""}.si-arrow-circle-left::before{content:""}.si-arrow-circle-right::before{content:""}.si-arrow-circle-up::before{content:""}.si-arrow-circle-down::before{content:""}.si-globe::before{content:""}.si-wrench::before{content:""}.si-tasks::before{content:""}.si-filter::before{content:""}.si-briefcase::before{content:""}.si-arrows-alt::before{content:""}.si-group::before{content:""}.si-chain::before{content:""}.si-cloud::before{content:""}.si-flask::before{content:""}.si-cut::before{content:""}.si-copy::before{content:""}.si-paperclip::before{content:""}.si-floppy-o::before{content:""}.si-square::before{content:""}.si-bars::before{content:""}.si-list-ul::before{content:""}.si-list-ol::before{content:""}.si-strikethrough::before{content:""}.si-underline::before{content:""}.si-table::before{content:""}.si-magic::before{content:""}.si-truck::before{content:""}.si-pinterest::before{content:""}.si-pinterest-square::before{content:""}.si-google-plus-square::before{content:""}.si-google-plus::before{content:""}.si-money::before{content:""}.si-caret-down::before{content:""}.si-caret-up::before{content:""}.si-caret-left::before{content:""}.si-caret-right::before{content:""}.si-columns::before{content:""}.si-sort::before{content:""}.si-sort-desc::before{content:""}.si-sort-asc::before{content:""}.si-envelope::before{content:""}.si-linkedin::before{content:""}.si-rotate-left::before{content:""}.si-gavel::before{content:""}.si-dashboard::before{content:""}.si-comment-o::before{content:""}.si-comments-o::before{content:""}.si-bolt::before{content:""}.si-sitemap::before{content:""}.si-umbrella::before{content:""}.si-clipboard::before{content:""}.si-lightbulb-o::before{content:""}.si-exchange::before{content:""}.si-cloud-download::before{content:""}.si-cloud-upload::before{content:""}.si-user-md::before{content:""}.si-stethoscope::before{content:""}.si-suitcase::before{content:""}.si-bell::before{content:""}.si-coffee::before{content:""}.si-cutlery::before{content:""}.si-file-text-o::before{content:""}.si-building-o::before{content:""}.si-hospital-o::before{content:""}.si-ambulance::before{content:""}.si-medkit::before{content:""}.si-fighter-jet::before{content:""}.si-beer::before{content:""}.si-h-square::before{content:""}.si-plus-square::before{content:""}.si-angle-double-left::before{content:""}.si-angle-double-right::before{content:""}.si-angle-double-up::before{content:""}.si-angle-double-down::before{content:""}.si-angle-left::before{content:""}.si-angle-right::before{content:""}.si-angle-up::before{content:""}.si-angle-down::before{content:""}.si-desktop::before{content:""}.si-laptop::before{content:""}.si-tablet::before{content:""}.si-mobile::before{content:""}.si-circle-o::before{content:""}.si-quote-left::before{content:""}.si-quote-right::before{content:""}.si-spinner::before{content:""}.si-circle::before{content:""}.si-mail-reply::before{content:""}.si-github-alt::before{content:""}.si-folder-o::before{content:""}.si-folder-open-o::before{content:""}.si-smile-o::before{content:""}.si-frown-o::before{content:""}.si-meh-o::before{content:""}.si-gamepad::before{content:""}.si-keyboard-o::before{content:""}.si-flag-o::before{content:""}.si-flag-checkered::before{content:""}.si-terminal::before{content:""}.si-code::before{content:""}.si-mail-reply-all::before{content:""}.si-star-half-empty::before{content:""}.si-location-arrow::before{content:""}.si-crop::before{content:""}.si-code-fork::before{content:""}.si-chain-broken::before{content:""}.si-question::before{content:""}.si-info::before{content:""}.si-exclamation::before{content:""}.si-superscript::before{content:""}.si-subscript::before{content:""}.si-eraser::before{content:""}.si-puzzle-piece::before{content:""}.si-microphone::before{content:""}.si-microphone-slash::before{content:""}.si-shield::before{content:""}.si-calendar-o::before{content:""}.si-fire-extinguisher::before{content:""}.si-rocket::before{content:""}.si-maxcdn::before{content:""}.si-chevron-circle-left::before{content:""}.si-chevron-circle-right::before{content:""}.si-chevron-circle-up::before{content:""}.si-chevron-circle-down::before{content:""}.si-html5::before{content:""}.si-css3::before{content:""}.si-anchor::before{content:""}.si-unlock-alt::before{content:""}.si-bullseye::before{content:""}.si-ellipsis-h::before{content:""}.si-ellipsis-v::before{content:""}.si-rss-square::before{content:""}.si-play-circle::before{content:""}.si-ticket::before{content:""}.si-minus-square::before{content:""}.si-minus-square-o::before{content:""}.si-level-up::before{content:""}.si-level-down::before{content:""}.si-check-square::before{content:""}.si-pencil-square::before{content:""}.si-external-link-square::before{content:""}.si-share-square::before{content:""}.si-compass::before{content:""}.si-caret-square-o-down::before{content:""}.si-caret-square-o-up::before{content:""}.si-caret-square-o-right::before{content:""}.si-eur::before{content:""}.si-gbp::before{content:""}.si-dollar::before{content:""}.si-inr::before{content:""}.si-cny::before{content:""}.si-rouble::before{content:""}.si-krw::before{content:""}.si-bitcoin::before{content:""}.si-file::before{content:""}.si-file-text::before{content:""}.si-sort-alpha-asc::before{content:""}.si-sort-alpha-desc::before{content:""}.si-sort-amount-asc::before{content:""}.si-sort-amount-desc::before{content:""}.si-sort-numeric-asc::before{content:""}.si-sort-numeric-desc::before{content:""}.si-thumbs-up::before{content:""}.si-thumbs-down::before{content:""}.si-youtube-square::before{content:""}.si-youtube::before{content:""}.si-xing::before{content:""}.si-xing-square::before{content:""}.si-youtube-play::before{content:""}.si-dropbox::before{content:""}.si-stack-overflow::before{content:""}.si-instagram::before{content:""}.si-flickr::before{content:""}.si-adn::before{content:""}.si-bitbucket::before{content:""}.si-bitbucket-square::before{content:""}.si-tumblr::before{content:""}.si-tumblr-square::before{content:""}.si-long-arrow-down::before{content:""}.si-long-arrow-up::before{content:""}.si-long-arrow-left::before{content:""}.si-long-arrow-right::before{content:""}.si-apple::before{content:""}.si-windows::before{content:""}.si-android::before{content:""}.si-linux::before{content:""}.si-dribbble::before{content:""}.si-skype::before{content:""}.si-foursquare::before{content:""}.si-trello::before{content:""}.si-female::before{content:""}.si-male::before{content:""}.si-gittip::before{content:""}.si-sun-o::before{content:""}.si-moon-o::before{content:""}.si-archive::before{content:""}.si-bug::before{content:""}.si-vk::before{content:""}.si-weibo::before{content:""}.si-renren::before{content:""}.si-pagelines::before{content:""}.si-stack-exchange::before{content:""}.si-arrow-circle-o-right::before{content:""}.si-arrow-circle-o-left::before{content:""}.si-caret-square-o-left::before{content:""}.si-dot-circle-o::before{content:""}.si-wheelchair::before{content:""}.si-vimeo-square::before{content:""}.si-try::before{content:""}.si-plus-square-o::before{content:""}.si-space-shuttle::before{content:""}.si-slack::before{content:""}.si-envelope-square::before{content:""}.si-wordpress::before{content:""}.si-openid::before{content:""}.si-bank::before{content:""}.si-graduation-cap::before{content:""}.si-yahoo::before{content:""}.si-google::before{content:""}.si-reddit::before{content:""}.si-reddit-square::before{content:""}.si-stumbleupon-circle::before{content:""}.si-stumbleupon::before{content:""}.si-delicious::before{content:""}.si-digg::before{content:""}.si-pied-piper::before{content:""}.si-pied-piper-alt::before{content:""}.si-drupal::before{content:""}.si-joomla::before{content:""}.si-language::before{content:""}.si-fax::before{content:""}.si-building::before{content:""}.si-child::before{content:""}.si-paw::before{content:""}.si-spoon::before{content:""}.si-cube::before{content:""}.si-cubes::before{content:""}.si-behance::before{content:""}.si-behance-square::before{content:""}.si-steam::before{content:""}.si-steam-square::before{content:""}.si-recycle::before{content:""}.si-automobile::before{content:""}.si-cab::before{content:""}.si-tree::before{content:""}.si-spotify::before{content:""}.si-deviantart::before{content:""}.si-soundcloud::before{content:""}.si-database::before{content:""}.si-file-pdf-o::before{content:""}.si-file-word-o::before{content:""}.si-file-excel-o::before{content:""}.si-file-powerpoint-o::before{content:""}.si-file-image-o::before{content:""}.si-file-archive-o::before{content:""}.si-file-audio-o::before{content:""}.si-file-movie-o::before{content:""}.si-file-code-o::before{content:""}.si-vine::before{content:""}.si-codepen::before{content:""}.si-jsfiddle::before{content:""}.si-life-bouy::before{content:""}.si-circle-o-notch::before{content:""}.si-ra::before{content:""}.si-empire::before{content:""}.si-git-square::before{content:""}.si-git::before{content:""}.si-hacker-news::before{content:""}.si-tencent-weibo::before{content:""}.si-qq::before{content:""}.si-wechat::before{content:""}.si-paper-plane::before{content:""}.si-paper-plane-o::before{content:""}.si-history::before{content:""}.si-circle-thin::before{content:""}.si-header::before{content:""}.si-paragraph::before{content:""}.si-sliders::before{content:""}.si-share-alt::before{content:""}.si-share-alt-square::before{content:""}.si-bomb::before{content:""}.si-futbol-o::before{content:""}.si-tty::before{content:""}.si-binoculars::before{content:""}.si-plug::before{content:""}.si-slideshare::before{content:""}.si-twitch::before{content:""}.si-yelp::before{content:""}.si-newspaper-o::before{content:""}.si-wifi::before{content:""}.si-calculator::before{content:""}.si-paypal::before{content:""}.si-google-wallet::before{content:""}.si-cc-visa::before{content:""}.si-cc-mastercard::before{content:""}.si-cc-discover::before{content:""}.si-cc-amex::before{content:""}.si-cc-paypal::before{content:""}.si-cc-stripe::before{content:""}.si-bell-slash::before{content:""}.si-bell-slash-o::before{content:""}.si-trash::before{content:""}.si-copyright::before{content:""}.si-at::before{content:""}.si-eyedropper::before{content:""}.si-paint-brush::before{content:""}.si-birthday-cake::before{content:""}.si-area-chart::before{content:""}.si-pie-chart::before{content:""}.si-line-chart::before{content:""}.si-lastfm::before{content:""}.si-lastfm-square::before{content:""}.si-toggle-off::before{content:""}.si-toggle-on::before{content:""}.si-bicycle::before{content:""}.si-bus::before{content:""}.si-ioxhost::before{content:""}.si-angellist::before{content:""}.si-cc::before{content:""}.si-ils::before{content:""}.si-meanpath::before{content:""}.si-buysellads::before{content:""}.si-connectdevelop::before{content:""}.si-dashcube::before{content:""}.si-forumbee::before{content:""}.si-leanpub::before{content:""}.si-sellsy::before{content:""}.si-shirtsinbulk::before{content:""}.si-simplybuilt::before{content:""}.si-skyatlas::before{content:""}.si-cart-plus::before{content:""}.si-cart-arrow-down::before{content:""}.si-diamond::before{content:""}.si-ship::before{content:""}.si-user-secret::before{content:""}.si-motorcycle::before{content:""}.si-street-view::before{content:""}.si-heartbeat::before{content:""}.si-venus::before{content:""}.si-mars::before{content:""}.si-mercury::before{content:""}.si-intersex::before{content:""}.si-transgender-alt::before{content:""}.si-venus-double::before{content:""}.si-mars-double::before{content:""}.si-venus-mars::before{content:""}.si-mars-stroke::before{content:""}.si-mars-stroke-v::before{content:""}.si-mars-stroke-h::before{content:""}.si-neuter::before{content:""}.si-genderless::before{content:""}.si-facebook-official::before{content:""}.si-pinterest-p::before{content:""}.si-whatsapp::before{content:""}.si-server::before{content:""}.si-user-plus::before{content:""}.si-user-times::before{content:""}.si-bed::before{content:""}.si-viacoin::before{content:""}.si-train::before{content:""}.si-subway::before{content:""}.si-medium::before{content:""}.si-y-combinator::before{content:""}.si-optin-monster::before{content:""}.si-opencart::before{content:""}.si-expeditedssl::before{content:""}.si-battery-4::before{content:""}.si-battery-3::before{content:""}.si-battery-2::before{content:""}.si-battery-1::before{content:""}.si-battery-0::before{content:""}.si-mouse-pointer::before{content:""}.si-i-cursor::before{content:""}.si-object-group::before{content:""}.si-object-ungroup::before{content:""}.si-sticky-note::before{content:""}.si-sticky-note-o::before{content:""}.si-cc-jcb::before{content:""}.si-cc-diners-club::before{content:""}.si-clone::before{content:""}.si-balance-scale::before{content:""}.si-hourglass-o::before{content:""}.si-hourglass-1::before{content:""}.si-hourglass-2::before{content:""}.si-hourglass-3::before{content:""}.si-hourglass::before{content:""}.si-hand-grab-o::before{content:""}.si-hand-paper-o::before{content:""}.si-hand-scissors-o::before{content:""}.si-hand-lizard-o::before{content:""}.si-hand-spock-o::before{content:""}.si-hand-pointer-o::before{content:""}.si-hand-peace-o::before{content:""}.si-trademark::before{content:""}.si-registered::before{content:""}.si-creative-commons::before{content:""}.si-gg::before{content:""}.si-gg-circle::before{content:""}.si-tripadvisor::before{content:""}.si-odnoklassniki::before{content:""}.si-odnoklassniki-square::before{content:""}.si-get-pocket::before{content:""}.si-wikipedia-w::before{content:""}.si-safari::before{content:""}.si-chrome::before{content:""}.si-firefox::before{content:""}.si-opera::before{content:""}.si-internet-explorer::before{content:""}.si-television::before{content:""}.si-contao::before{content:""}.si-500px::before{content:""}.si-amazon::before{content:""}.si-calendar-plus-o::before{content:""}.si-calendar-minus-o::before{content:""}.si-calendar-times-o::before{content:""}.si-calendar-check-o::before{content:""}.si-industry::before{content:""}.si-map-pin::before{content:""}.si-map-signs::before{content:""}.si-map-o::before{content:""}.si-map::before{content:""}.si-commenting::before{content:""}.si-commenting-o::before{content:""}.si-houzz::before{content:""}.si-vimeo::before{content:""}.si-black-tie::before{content:""}.si-fonticons::before{content:""}.si-lg{font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}.si-2x{font-size:2em}.si-3x{font-size:3em}.si-4x{font-size:4em}.si-5x{font-size:5em}.si-fw{text-align:center;width:1.28571429em}.si-border{border-radius:.1em;padding:.2em .25em .15em;border:solid 0.08em}.si-pull-left{float:left;margin-right:.3em}.si-pull-right{float:right;margin-left:.3em}.si-rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.si-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.si-rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.si-flip-horizontal{-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.si-flip-vertical{-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.si-inverse{-webkit-filter:invert(100%);filter:invert(100%)}.si-spin{-webkit-animation:si-animation-spin 2s infinite linear;-moz-animation:si-animation-spin 2s infinite linear;animation:si-animation-spin 2s infinite linear}.si-pulse{-webkit-animation:si-animation-spin 1s infinite steps(8);-moz-animation:si-animation-spin 1s infinite steps(8);animation:si-animation-spin 1s infinite steps(8)}.si-ul{padding-left:0;list-style-type:none;margin-left:2.14285714em}.si-ul>li{position:relative}.si-ul>li .si-li{text-align:center;position:absolute;left:-2.14285714em;width:2.14285714em;top:0.14285714em}.si-ul>li .si-li .si-lg{left:-1.85714286em}.si-stack{width:2em;height:2em;line-height:2em;vertical-align:middle;position:relative;display:inline-block}.si-stack .si-stack-1x,.si-stack .si-stack-2x{left:0;width:100%;text-align:center;position:absolute}.si-stack .si-stack-1x{line-height:inherit}.si-stack .si-stack-2x{font-size:2em}@-webkit-keyframes si-animation-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes si-animation-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@keyframes si-animation-spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg);transform:rotate(359deg)}}
2
 
 
1
  @font-face{font-family:sharkicons;src:url("fonts/sharkicons.eot?v160221");src:url("fonts/sharkicons.eot?#iefix&v160221") format("embedded-opentype"),url("fonts/sharkicons.ttf?v160221") format("truetype"),url("fonts/sharkicons.woff?v160221") format("woff"),url("fonts/sharkicons.svg?v160221#sharkicons") format("svg");font-weight:normal;font-style:normal}.si::before{font:normal normal normal 14px/1 sharkicons;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;display:inline-block;font-size:inherit;text-decoration:inherit;text-transform:none}.si-broom::before{content:""}.si-comment-mail-one::before{content:""}.si-comment-mail::before{content:""}.si-s2member::before{content:""}.si-websharks::before{content:""}.si-wp-kb-articles::before{content:""}.si-zencache-logo::before{content:""}.si-zencache::before{content:""}.si-wp-sharks::before{content:""}.si-wp-sharks-fin::before{content:""}.si-comet-cache::before{content:""}.si-comet-cache-logo::before{content:""}.si-comet-cache-comet::before{content:""}.si-feat-watch::before{content:""}.si-feat-server::before{content:""}.si-feat-layers::before{content:""}.si-feat-box::before{content:""}.si-feat-ellipsis::before{content:""}.si-typi-group::before{content:""}.si-enty-bookmark::before{content:""}.si-enty-bookmarks::before{content:""}.si-enty-open-book::before{content:""}.si-enty-archive::before{content:""}.si-enty-area-graph::before{content:""}.si-enty-bucket::before{content:""}.si-enty-colors::before{content:""}.si-enty-copy::before{content:""}.si-enty-drive::before{content:""}.si-enty-feather::before{content:""}.si-enty-gauge::before{content:""}.si-enty-hand::before{content:""}.si-enty-lab-flask::before{content:""}.si-enty-mask::before{content:""}.si-enty-medal::before{content:""}.si-enty-exclamation::before{content:""}.si-enty-palette::before{content:""}.si-enty-ruler::before{content:""}.si-enty-shop::before{content:""}.si-enty-basket::before{content:""}.si-enty-cart::before{content:""}.si-enty-traffic-cone::before{content:""}.si-enty-tree::before{content:""}.si-enty-trophy::before{content:""}.si-enty-v-card::before{content:""}.si-enty-google-hangouts::before{content:""}.si-eleg-line-graph::before{content:""}.si-eleg-male::before{content:""}.si-eleg-female::before{content:""}.si-eleg-atom::before{content:""}.si-broc-cart::before{content:""}.si-broc-crap::before{content:""}.si-broc-atom::before{content:""}.si-icom-headphones::before{content:""}.si-icom-barcode::before{content:""}.si-icom-user::before{content:""}.si-icom-users::before{content:""}.si-icom-user-plus::before{content:""}.si-icom-user-minus::before{content:""}.si-icom-user-check::before{content:""}.si-icom-user-tie::before{content:""}.si-icom-key::before{content:""}.si-icom-key2::before{content:""}.si-icom-happy::before{content:""}.si-icom-happy2::before{content:""}.si-icom-smile::before{content:""}.si-icom-smile2::before{content:""}.si-icom-tongue::before{content:""}.si-icom-tongue2::before{content:""}.si-icom-sad::before{content:""}.si-icom-sad2::before{content:""}.si-icom-wink::before{content:""}.si-icom-wink2::before{content:""}.si-icom-grin::before{content:""}.si-icom-grin2::before{content:""}.si-icom-cool::before{content:""}.si-icom-cool2::before{content:""}.si-icom-angry::before{content:""}.si-icom-angry2::before{content:""}.si-icom-evil::before{content:""}.si-icom-evil2::before{content:""}.si-icom-shocked::before{content:""}.si-icom-shocked2::before{content:""}.si-icom-baffled::before{content:""}.si-icom-baffled2::before{content:""}.si-icom-confused::before{content:""}.si-icom-confused2::before{content:""}.si-icom-neutral::before{content:""}.si-icom-neutral2::before{content:""}.si-icom-hipster::before{content:""}.si-icom-hipster2::before{content:""}.si-icom-wondering::before{content:""}.si-icom-wondering2::before{content:""}.si-icom-sleepy::before{content:""}.si-icom-sleepy2::before{content:""}.si-icom-frustrated::before{content:""}.si-icom-frustrated2::before{content:""}.si-icom-crying::before{content:""}.si-icom-crying2::before{content:""}.si-icom-spell-check::before{content:""}.si-icom-command-key::before{content:""}.si-icom-shift-key::before{content:""}.si-icom-control-key::before{content:""}.si-icom-option-key::before{content:""}.si-icom-wordpress::before{content:""}.si-icom-wordpress-square::before{content:""}.si-icom-yahoo::before{content:""}.si-icom-linux::before{content:""}.si-icom-finder::before{content:""}.si-icom-android::before{content:""}.si-icom-reddit::before{content:""}.si-icom-paypal::before{content:""}.si-icom-git::before{content:""}.si-octi-alignment-align::before{content:""}.si-octi-alignment-aligned-to::before{content:""}.si-octi-alignment-unalign::before{content:""}.si-octi-bookmark::before{content:""}.si-octi-broadcast::before{content:""}.si-octi-browser::before{content:""}.si-octi-checklist::before{content:""}.si-octi-circuit-board::before{content:""}.si-octi-clippy::before{content:""}.si-octi-cloud-download::before{content:""}.si-octi-cloud-upload::before{content:""}.si-octi-comment::before{content:""}.si-octi-comments::before{content:""}.si-octi-tach::before{content:""}.si-octi-device-camera::before{content:""}.si-octi-device-camera-video::before{content:""}.si-octi-device-desktop::before{content:""}.si-octi-diff::before{content:""}.si-octi-file-binary::before{content:""}.si-octi-file-media::before{content:""}.si-octi-file-submodule::before{content:""}.si-octi-file-symlink-directory::before{content:""}.si-octi-file-symlink-file::before{content:""}.si-octi-fold::before{content:""}.si-octi-git-branch::before{content:""}.si-octi-git-commit::before{content:""}.si-octi-git-compare::before{content:""}.si-octi-git-merge::before{content:""}.si-octi-git-pull-request::before{content:""}.si-octi-graph::before{content:""}.si-octi-home::before{content:""}.si-octi-horizontal-rule::before{content:""}.si-octi-key::before{content:""}.si-octi-light-bulb::before{content:""}.si-octi-link-external::before{content:""}.si-octi-lock::before{content:""}.si-octi-markdown::before{content:""}.si-octi-microscope::before{content:""}.si-octi-mirror::before{content:""}.si-octi-move-down::before{content:""}.si-octi-move-left::before{content:""}.si-octi-move-right::before{content:""}.si-octi-move-up::before{content:""}.si-octi-mute::before{content:""}.si-octi-organization::before{content:""}.si-octi-package::before{content:""}.si-octi-paintcan::before{content:""}.si-octi-person::before{content:""}.si-octi-plug::before{content:""}.si-octi-podium::before{content:""}.si-octi-pulse::before{content:""}.si-octi-puzzle::before{content:""}.si-octi-repo::before{content:""}.si-octi-repo-clone::before{content:""}.si-octi-repo-force-push::before{content:""}.si-octi-repo-forked::before{content:""}.si-octi-repo-pull::before{content:""}.si-octi-repo-push::before{content:""}.si-octi-rocket::before{content:""}.si-octi-ruby::before{content:""}.si-octi-screen-full::before{content:""}.si-octi-screen-normal::before{content:""}.si-octi-sign-in::before{content:""}.si-octi-sign-out::before{content:""}.si-octi-split::before{content:""}.si-octi-squirrel::before{content:""}.si-octi-steps::before{content:""}.si-octi-tag::before{content:""}.si-octi-telescope::before{content:""}.si-octi-terminal::before{content:""}.si-octi-unfold::before{content:""}.si-octi-versions::before{content:""}.si-glass::before{content:""}.si-music::before{content:""}.si-search::before{content:""}.si-envelope-o::before{content:""}.si-heart::before{content:""}.si-star::before{content:""}.si-star-o::before{content:""}.si-user::before{content:""}.si-film::before{content:""}.si-th-large::before{content:""}.si-th::before{content:""}.si-th-list::before{content:""}.si-check::before{content:""}.si-close::before{content:""}.si-search-plus::before{content:""}.si-search-minus::before{content:""}.si-power-off::before{content:""}.si-signal::before{content:""}.si-cog::before{content:""}.si-trash-o::before{content:""}.si-home::before{content:""}.si-file-o::before{content:""}.si-clock-o::before{content:""}.si-road::before{content:""}.si-download::before{content:""}.si-arrow-circle-o-down::before{content:""}.si-arrow-circle-o-up::before{content:""}.si-inbox::before{content:""}.si-play-circle-o::before{content:""}.si-repeat::before{content:""}.si-refresh::before{content:""}.si-list-alt::before{content:""}.si-lock::before{content:""}.si-flag::before{content:""}.si-headphones::before{content:""}.si-volume-off::before{content:""}.si-volume-down::before{content:""}.si-volume-up::before{content:""}.si-qrcode::before{content:""}.si-barcode::before{content:""}.si-tag::before{content:""}.si-tags::before{content:""}.si-book::before{content:""}.si-bookmark::before{content:""}.si-print::before{content:""}.si-camera::before{content:""}.si-font::before{content:""}.si-bold::before{content:""}.si-italic::before{content:""}.si-text-height::before{content:""}.si-text-width::before{content:""}.si-align-left::before{content:""}.si-align-center::before{content:""}.si-align-right::before{content:""}.si-align-justify::before{content:""}.si-list::before{content:""}.si-dedent::before{content:""}.si-indent::before{content:""}.si-video-camera::before{content:""}.si-image::before{content:""}.si-pencil::before{content:""}.si-map-marker::before{content:""}.si-adjust::before{content:""}.si-tint::before{content:""}.si-edit::before{content:""}.si-share-square-o::before{content:""}.si-check-square-o::before{content:""}.si-arrows::before{content:""}.si-step-backward::before{content:""}.si-fast-backward::before{content:""}.si-backward::before{content:""}.si-play::before{content:""}.si-pause::before{content:""}.si-stop::before{content:""}.si-forward::before{content:""}.si-fast-forward::before{content:""}.si-step-forward::before{content:""}.si-eject::before{content:""}.si-chevron-left::before{content:""}.si-chevron-right::before{content:""}.si-plus-circle::before{content:""}.si-minus-circle::before{content:""}.si-times-circle::before{content:""}.si-check-circle::before{content:""}.si-question-circle::before{content:""}.si-info-circle::before{content:""}.si-crosshairs::before{content:""}.si-times-circle-o::before{content:""}.si-check-circle-o::before{content:""}.si-ban::before{content:""}.si-arrow-left::before{content:""}.si-arrow-right::before{content:""}.si-arrow-up::before{content:""}.si-arrow-down::before{content:""}.si-mail-forward::before{content:""}.si-expand::before{content:""}.si-compress::before{content:""}.si-plus::before{content:""}.si-minus::before{content:""}.si-asterisk::before{content:""}.si-exclamation-circle::before{content:""}.si-gift::before{content:""}.si-leaf::before{content:""}.si-fire::before{content:""}.si-eye::before{content:""}.si-eye-slash::before{content:""}.si-exclamation-triangle::before{content:""}.si-plane::before{content:""}.si-calendar::before{content:""}.si-random::before{content:""}.si-comment::before{content:""}.si-magnet::before{content:""}.si-chevron-up::before{content:""}.si-chevron-down::before{content:""}.si-retweet::before{content:""}.si-shopping-cart::before{content:""}.si-folder::before{content:""}.si-folder-open::before{content:""}.si-arrows-v::before{content:""}.si-arrows-h::before{content:""}.si-bar-chart::before{content:""}.si-twitter-square::before{content:""}.si-facebook-square::before{content:""}.si-camera-retro::before{content:""}.si-key::before{content:""}.si-cogs::before{content:""}.si-comments::before{content:""}.si-thumbs-o-up::before{content:""}.si-thumbs-o-down::before{content:""}.si-star-half::before{content:""}.si-heart-o::before{content:""}.si-sign-out::before{content:""}.si-linkedin-square::before{content:""}.si-thumb-tack::before{content:""}.si-external-link::before{content:""}.si-sign-in::before{content:""}.si-trophy::before{content:""}.si-github-square::before{content:""}.si-upload::before{content:""}.si-lemon-o::before{content:""}.si-phone::before{content:""}.si-square-o::before{content:""}.si-bookmark-o::before{content:""}.si-phone-square::before{content:""}.si-twitter::before{content:""}.si-facebook::before{content:""}.si-github::before{content:""}.si-unlock::before{content:""}.si-credit-card::before{content:""}.si-feed::before{content:""}.si-hdd-o::before{content:""}.si-bullhorn::before{content:""}.si-bell-o::before{content:""}.si-certificate::before{content:""}.si-hand-o-right::before{content:""}.si-hand-o-left::before{content:""}.si-hand-o-up::before{content:""}.si-hand-o-down::before{content:""}.si-arrow-circle-left::before{content:""}.si-arrow-circle-right::before{content:""}.si-arrow-circle-up::before{content:""}.si-arrow-circle-down::before{content:""}.si-globe::before{content:""}.si-wrench::before{content:""}.si-tasks::before{content:""}.si-filter::before{content:""}.si-briefcase::before{content:""}.si-arrows-alt::before{content:""}.si-group::before{content:""}.si-chain::before{content:""}.si-cloud::before{content:""}.si-flask::before{content:""}.si-cut::before{content:""}.si-copy::before{content:""}.si-paperclip::before{content:""}.si-floppy-o::before{content:""}.si-square::before{content:""}.si-bars::before{content:""}.si-list-ul::before{content:""}.si-list-ol::before{content:""}.si-strikethrough::before{content:""}.si-underline::before{content:""}.si-table::before{content:""}.si-magic::before{content:""}.si-truck::before{content:""}.si-pinterest::before{content:""}.si-pinterest-square::before{content:""}.si-google-plus-square::before{content:""}.si-google-plus::before{content:""}.si-money::before{content:""}.si-caret-down::before{content:""}.si-caret-up::before{content:""}.si-caret-left::before{content:""}.si-caret-right::before{content:""}.si-columns::before{content:""}.si-sort::before{content:""}.si-sort-desc::before{content:""}.si-sort-asc::before{content:""}.si-envelope::before{content:""}.si-linkedin::before{content:""}.si-rotate-left::before{content:""}.si-gavel::before{content:""}.si-dashboard::before{content:""}.si-comment-o::before{content:""}.si-comments-o::before{content:""}.si-bolt::before{content:""}.si-sitemap::before{content:""}.si-umbrella::before{content:""}.si-clipboard::before{content:""}.si-lightbulb-o::before{content:""}.si-exchange::before{content:""}.si-cloud-download::before{content:""}.si-cloud-upload::before{content:""}.si-user-md::before{content:""}.si-stethoscope::before{content:""}.si-suitcase::before{content:""}.si-bell::before{content:""}.si-coffee::before{content:""}.si-cutlery::before{content:""}.si-file-text-o::before{content:""}.si-building-o::before{content:""}.si-hospital-o::before{content:""}.si-ambulance::before{content:""}.si-medkit::before{content:""}.si-fighter-jet::before{content:""}.si-beer::before{content:""}.si-h-square::before{content:""}.si-plus-square::before{content:""}.si-angle-double-left::before{content:""}.si-angle-double-right::before{content:""}.si-angle-double-up::before{content:""}.si-angle-double-down::before{content:""}.si-angle-left::before{content:""}.si-angle-right::before{content:""}.si-angle-up::before{content:""}.si-angle-down::before{content:""}.si-desktop::before{content:""}.si-laptop::before{content:""}.si-tablet::before{content:""}.si-mobile::before{content:""}.si-circle-o::before{content:""}.si-quote-left::before{content:""}.si-quote-right::before{content:""}.si-spinner::before{content:""}.si-circle::before{content:""}.si-mail-reply::before{content:""}.si-github-alt::before{content:""}.si-folder-o::before{content:""}.si-folder-open-o::before{content:""}.si-smile-o::before{content:""}.si-frown-o::before{content:""}.si-meh-o::before{content:""}.si-gamepad::before{content:""}.si-keyboard-o::before{content:""}.si-flag-o::before{content:""}.si-flag-checkered::before{content:""}.si-terminal::before{content:""}.si-code::before{content:""}.si-mail-reply-all::before{content:""}.si-star-half-empty::before{content:""}.si-location-arrow::before{content:""}.si-crop::before{content:""}.si-code-fork::before{content:""}.si-chain-broken::before{content:""}.si-question::before{content:""}.si-info::before{content:""}.si-exclamation::before{content:""}.si-superscript::before{content:""}.si-subscript::before{content:""}.si-eraser::before{content:""}.si-puzzle-piece::before{content:""}.si-microphone::before{content:""}.si-microphone-slash::before{content:""}.si-shield::before{content:""}.si-calendar-o::before{content:""}.si-fire-extinguisher::before{content:""}.si-rocket::before{content:""}.si-maxcdn::before{content:""}.si-chevron-circle-left::before{content:""}.si-chevron-circle-right::before{content:""}.si-chevron-circle-up::before{content:""}.si-chevron-circle-down::before{content:""}.si-html5::before{content:""}.si-css3::before{content:""}.si-anchor::before{content:""}.si-unlock-alt::before{content:""}.si-bullseye::before{content:""}.si-ellipsis-h::before{content:""}.si-ellipsis-v::before{content:""}.si-rss-square::before{content:""}.si-play-circle::before{content:""}.si-ticket::before{content:""}.si-minus-square::before{content:""}.si-minus-square-o::before{content:""}.si-level-up::before{content:""}.si-level-down::before{content:""}.si-check-square::before{content:""}.si-pencil-square::before{content:""}.si-external-link-square::before{content:""}.si-share-square::before{content:""}.si-compass::before{content:""}.si-caret-square-o-down::before{content:""}.si-caret-square-o-up::before{content:""}.si-caret-square-o-right::before{content:""}.si-eur::before{content:""}.si-gbp::before{content:""}.si-dollar::before{content:""}.si-inr::before{content:""}.si-cny::before{content:""}.si-rouble::before{content:""}.si-krw::before{content:""}.si-bitcoin::before{content:""}.si-file::before{content:""}.si-file-text::before{content:""}.si-sort-alpha-asc::before{content:""}.si-sort-alpha-desc::before{content:""}.si-sort-amount-asc::before{content:""}.si-sort-amount-desc::before{content:""}.si-sort-numeric-asc::before{content:""}.si-sort-numeric-desc::before{content:""}.si-thumbs-up::before{content:""}.si-thumbs-down::before{content:""}.si-youtube-square::before{content:""}.si-youtube::before{content:""}.si-xing::before{content:""}.si-xing-square::before{content:""}.si-youtube-play::before{content:""}.si-dropbox::before{content:""}.si-stack-overflow::before{content:""}.si-instagram::before{content:""}.si-flickr::before{content:""}.si-adn::before{content:""}.si-bitbucket::before{content:""}.si-bitbucket-square::before{content:""}.si-tumblr::before{content:""}.si-tumblr-square::before{content:""}.si-long-arrow-down::before{content:""}.si-long-arrow-up::before{content:""}.si-long-arrow-left::before{content:""}.si-long-arrow-right::before{content:""}.si-apple::before{content:""}.si-windows::before{content:""}.si-android::before{content:""}.si-linux::before{content:""}.si-dribbble::before{content:""}.si-skype::before{content:""}.si-foursquare::before{content:""}.si-trello::before{content:""}.si-female::before{content:""}.si-male::before{content:""}.si-gittip::before{content:""}.si-sun-o::before{content:""}.si-moon-o::before{content:""}.si-archive::before{content:""}.si-bug::before{content:""}.si-vk::before{content:""}.si-weibo::before{content:""}.si-renren::before{content:""}.si-pagelines::before{content:""}.si-stack-exchange::before{content:""}.si-arrow-circle-o-right::before{content:""}.si-arrow-circle-o-left::before{content:""}.si-caret-square-o-left::before{content:""}.si-dot-circle-o::before{content:""}.si-wheelchair::before{content:""}.si-vimeo-square::before{content:""}.si-try::before{content:""}.si-plus-square-o::before{content:""}.si-space-shuttle::before{content:""}.si-slack::before{content:""}.si-envelope-square::before{content:""}.si-wordpress::before{content:""}.si-openid::before{content:""}.si-bank::before{content:""}.si-graduation-cap::before{content:""}.si-yahoo::before{content:""}.si-google::before{content:""}.si-reddit::before{content:""}.si-reddit-square::before{content:""}.si-stumbleupon-circle::before{content:""}.si-stumbleupon::before{content:""}.si-delicious::before{content:""}.si-digg::before{content:""}.si-pied-piper::before{content:""}.si-pied-piper-alt::before{content:""}.si-drupal::before{content:""}.si-joomla::before{content:""}.si-language::before{content:""}.si-fax::before{content:""}.si-building::before{content:""}.si-child::before{content:""}.si-paw::before{content:""}.si-spoon::before{content:""}.si-cube::before{content:""}.si-cubes::before{content:""}.si-behance::before{content:""}.si-behance-square::before{content:""}.si-steam::before{content:""}.si-steam-square::before{content:""}.si-recycle::before{content:""}.si-automobile::before{content:""}.si-cab::before{content:""}.si-tree::before{content:""}.si-spotify::before{content:""}.si-deviantart::before{content:""}.si-soundcloud::before{content:""}.si-database::before{content:""}.si-file-pdf-o::before{content:""}.si-file-word-o::before{content:""}.si-file-excel-o::before{content:""}.si-file-powerpoint-o::before{content:""}.si-file-image-o::before{content:""}.si-file-archive-o::before{content:""}.si-file-audio-o::before{content:""}.si-file-movie-o::before{content:""}.si-file-code-o::before{content:""}.si-vine::before{content:""}.si-codepen::before{content:""}.si-jsfiddle::before{content:""}.si-life-bouy::before{content:""}.si-circle-o-notch::before{content:""}.si-ra::before{content:""}.si-empire::before{content:""}.si-git-square::before{content:""}.si-git::before{content:""}.si-hacker-news::before{content:""}.si-tencent-weibo::before{content:""}.si-qq::before{content:""}.si-wechat::before{content:""}.si-paper-plane::before{content:""}.si-paper-plane-o::before{content:""}.si-history::before{content:""}.si-circle-thin::before{content:""}.si-header::before{content:""}.si-paragraph::before{content:""}.si-sliders::before{content:""}.si-share-alt::before{content:""}.si-share-alt-square::before{content:""}.si-bomb::before{content:""}.si-futbol-o::before{content:""}.si-tty::before{content:""}.si-binoculars::before{content:""}.si-plug::before{content:""}.si-slideshare::before{content:""}.si-twitch::before{content:""}.si-yelp::before{content:""}.si-newspaper-o::before{content:""}.si-wifi::before{content:""}.si-calculator::before{content:""}.si-paypal::before{content:""}.si-google-wallet::before{content:""}.si-cc-visa::before{content:""}.si-cc-mastercard::before{content:""}.si-cc-discover::before{content:""}.si-cc-amex::before{content:""}.si-cc-paypal::before{content:""}.si-cc-stripe::before{content:""}.si-bell-slash::before{content:""}.si-bell-slash-o::before{content:""}.si-trash::before{content:""}.si-copyright::before{content:""}.si-at::before{content:""}.si-eyedropper::before{content:""}.si-paint-brush::before{content:""}.si-birthday-cake::before{content:""}.si-area-chart::before{content:""}.si-pie-chart::before{content:""}.si-line-chart::before{content:""}.si-lastfm::before{content:""}.si-lastfm-square::before{content:""}.si-toggle-off::before{content:""}.si-toggle-on::before{content:""}.si-bicycle::before{content:""}.si-bus::before{content:""}.si-ioxhost::before{content:""}.si-angellist::before{content:""}.si-cc::before{content:""}.si-ils::before{content:""}.si-meanpath::before{content:""}.si-buysellads::before{content:""}.si-connectdevelop::before{content:""}.si-dashcube::before{content:""}.si-forumbee::before{content:""}.si-leanpub::before{content:""}.si-sellsy::before{content:""}.si-shirtsinbulk::before{content:""}.si-simplybuilt::before{content:""}.si-skyatlas::before{content:""}.si-cart-plus::before{content:""}.si-cart-arrow-down::before{content:""}.si-diamond::before{content:""}.si-ship::before{content:""}.si-user-secret::before{content:""}.si-motorcycle::before{content:""}.si-street-view::before{content:""}.si-heartbeat::before{content:""}.si-venus::before{content:""}.si-mars::before{content:""}.si-mercury::before{content:""}.si-intersex::before{content:""}.si-transgender-alt::before{content:""}.si-venus-double::before{content:""}.si-mars-double::before{content:""}.si-venus-mars::before{content:""}.si-mars-stroke::before{content:""}.si-mars-stroke-v::before{content:""}.si-mars-stroke-h::before{content:""}.si-neuter::before{content:""}.si-genderless::before{content:""}.si-facebook-official::before{content:""}.si-pinterest-p::before{content:""}.si-whatsapp::before{content:""}.si-server::before{content:""}.si-user-plus::before{content:""}.si-user-times::before{content:""}.si-bed::before{content:""}.si-viacoin::before{content:""}.si-train::before{content:""}.si-subway::before{content:""}.si-medium::before{content:""}.si-y-combinator::before{content:""}.si-optin-monster::before{content:""}.si-opencart::before{content:""}.si-expeditedssl::before{content:""}.si-battery-4::before{content:""}.si-battery-3::before{content:""}.si-battery-2::before{content:""}.si-battery-1::before{content:""}.si-battery-0::before{content:""}.si-mouse-pointer::before{content:""}.si-i-cursor::before{content:""}.si-object-group::before{content:""}.si-object-ungroup::before{content:""}.si-sticky-note::before{content:""}.si-sticky-note-o::before{content:""}.si-cc-jcb::before{content:""}.si-cc-diners-club::before{content:""}.si-clone::before{content:""}.si-balance-scale::before{content:""}.si-hourglass-o::before{content:""}.si-hourglass-1::before{content:""}.si-hourglass-2::before{content:""}.si-hourglass-3::before{content:""}.si-hourglass::before{content:""}.si-hand-grab-o::before{content:""}.si-hand-paper-o::before{content:""}.si-hand-scissors-o::before{content:""}.si-hand-lizard-o::before{content:""}.si-hand-spock-o::before{content:""}.si-hand-pointer-o::before{content:""}.si-hand-peace-o::before{content:""}.si-trademark::before{content:""}.si-registered::before{content:""}.si-creative-commons::before{content:""}.si-gg::before{content:""}.si-gg-circle::before{content:""}.si-tripadvisor::before{content:""}.si-odnoklassniki::before{content:""}.si-odnoklassniki-square::before{content:""}.si-get-pocket::before{content:""}.si-wikipedia-w::before{content:""}.si-safari::before{content:""}.si-chrome::before{content:""}.si-firefox::before{content:""}.si-opera::before{content:""}.si-internet-explorer::before{content:""}.si-television::before{content:""}.si-contao::before{content:""}.si-500px::before{content:""}.si-amazon::before{content:""}.si-calendar-plus-o::before{content:""}.si-calendar-minus-o::before{content:""}.si-calendar-times-o::before{content:""}.si-calendar-check-o::before{content:""}.si-industry::before{content:""}.si-map-pin::before{content:""}.si-map-signs::before{content:""}.si-map-o::before{content:""}.si-map::before{content:""}.si-commenting::before{content:""}.si-commenting-o::before{content:""}.si-houzz::before{content:""}.si-vimeo::before{content:""}.si-black-tie::before{content:""}.si-fonticons::before{content:""}.si-lg{font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}.si-2x{font-size:2em}.si-3x{font-size:3em}.si-4x{font-size:4em}.si-5x{font-size:5em}.si-fw{text-align:center;width:1.28571429em}.si-border{border-radius:.1em;padding:.2em .25em .15em;border:solid 0.08em}.si-pull-left{float:left;margin-right:.3em}.si-pull-right{float:right;margin-left:.3em}.si-rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.si-rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.si-rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.si-flip-horizontal{-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.si-flip-vertical{-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.si-inverse{-webkit-filter:invert(100%);filter:invert(100%)}.si-spin{-webkit-animation:si-animation-spin 2s infinite linear;-moz-animation:si-animation-spin 2s infinite linear;animation:si-animation-spin 2s infinite linear}.si-pulse{-webkit-animation:si-animation-spin 1s infinite steps(8);-moz-animation:si-animation-spin 1s infinite steps(8);animation:si-animation-spin 1s infinite steps(8)}.si-ul{padding-left:0;list-style-type:none;margin-left:2.14285714em}.si-ul>li{position:relative}.si-ul>li .si-li{text-align:center;position:absolute;left:-2.14285714em;width:2.14285714em;top:0.14285714em}.si-ul>li .si-li .si-lg{left:-1.85714286em}.si-stack{width:2em;height:2em;line-height:2em;vertical-align:middle;position:relative;display:inline-block}.si-stack .si-stack-1x,.si-stack .si-stack-2x{left:0;width:100%;text-align:center;position:absolute}.si-stack .si-stack-1x{line-height:inherit}.si-stack .si-stack-2x{font-size:2em}@-webkit-keyframes si-animation-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes si-animation-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@keyframes si-animation-spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);-moz-transform:rotate(359deg);-ms-transform:rotate(359deg);-o-transform:rotate(359deg);transform:rotate(359deg)}}
2
 
3
+ /*# sourceMappingURL=short-classes.min.css.map */
src/vendor/websharks/wp-php-rv/.htaccess ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <IfModule authz_core_module>
2
+ Require all denied
3
+ </IfModule>
4
+ <IfModule !authz_core_module>
5
+ deny from all
6
+ </IfModule>
7
+
8
+ <FilesMatch "\.(js|css|map|gif|jpg|png|svg|eot|woff|ttf|html|txt|md)$">
9
+ <IfModule authz_core_module>
10
+ Require all granted
11
+ </IfModule>
12
+ <IfModule !authz_core_module>
13
+ allow from all
14
+ </IfModule>
15
+ </FilesMatch>
src/vendor/websharks/wp-php-rv/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ## v15xxxx
2
 
3
  - Initial release.
1
+ ## v160504
2
+
3
+ - Adding support for required bits via `$GLOBALS['wp_php_rv']['bits'] = 64;`
4
+
5
+ ![2016-05-04_23-42-50](https://cloud.githubusercontent.com/assets/1563559/15038648/fb5fb04e-1251-11e6-96d6-af1a563413f1.png)
6
+
7
+ ## v160503
8
+
9
+ - Enhancing display of notice.
10
+ - Reorganizing functions into multiple files.
11
+ - Backward compatibility was preserved in all cases.
12
+
13
+ ![](https://github.com/websharks/wp-php-rv/raw/000000-dev/assets/screenshot.png)
14
+
15
+ ## v160420
16
+
17
+ - Adding `composer.json` and enhancing Composer integration.
18
+ - General cleanup. No significant changes.
19
+
20
  ## v15xxxx
21
 
22
  - Initial release.
src/vendor/websharks/wp-php-rv/README.md CHANGED
@@ -2,7 +2,7 @@
2
 
3
  Stub for WordPress themes/plugins that require PHP vX.x+ (i.e. a minimum version that you define).
4
 
5
- ![screenshot](screenshot.png)
6
 
7
  ---
8
 
@@ -20,23 +20,23 @@ Stub for WordPress themes/plugins that require PHP vX.x+ (i.e. a minimum version
20
  Text Domain: my-plugin
21
  */
22
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+ (you configure this).
23
- if(require('wp-php-rv/src/includes/check.php')) // `TRUE` if running PHP vX.x+.
24
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
25
  else wp_php_rv_notice(); // Creates a nice PHP vX.x+ dashboard notice for the site owner.
26
  ```
27
 
28
  ---
29
 
30
- ### Understanding `if(require('wp-php-rv/src/includes/check.php'))`
31
 
32
- The `check.php` file will automatically return `TRUE` upon using `include()` or `require()` in your scripts; i.e., iff the installation site is running PHP vX.x+ (as configured by `$GLOBALS['wp_php_rv']`). Otherwise it returns `FALSE`. Therefore, the simplest way to run your check is to use `if(require('wp-php-rv/src/includes/check.php'))`. **However**, you could also choose to do it this way.
33
 
34
  ```php
35
  <?php
36
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+.
37
  require 'wp-php-rv/src/includes/check.php'; // Include.
38
 
39
- if(wp_php_rv()) // `TRUE` if running PHP vX.x+.
40
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
41
  else wp_php_rv_notice(); // Creates a nice PHP vX.x+ dashboard notice for the site owner.
42
  ```
@@ -48,24 +48,12 @@ else wp_php_rv_notice(); // Creates a nice PHP vX.x+ dashboard notice for the si
48
  ```php
49
  <?php
50
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+.
51
- if(require('wp-php-rv/src/includes/check.php')) // `TRUE` if running PHP vX.x+.
52
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
53
  else wp_php_rv_notice('My Plugin'); // Dashboard notice mentions your software specifically.
54
  ```
55
 
56
- _NOTE: If you omit the `$software_name` argument, a default value is used instead. The default value is `ucwords('[calling file basedir]')`; e.g., if `/my-plugin/stub.php` calls `wp-php-rv/src/includes/check.php`, the default `$software_name` automatically becomes `My Plugin`. Nice!_
57
-
58
- ---
59
-
60
- ### Using a Custom Dashboard Notice
61
-
62
- ```php
63
- <?php
64
- $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+.
65
- if(require('wp-php-rv/src/includes/check.php')) // `TRUE` if running PHP vX.x+.
66
- require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
67
- else wp_php_rv_custom_notice('My Plugin requires PHP v5.3+'); // Custom Dashboard notice.
68
- ```
69
 
70
  ---
71
 
@@ -92,16 +80,16 @@ Yes, `$GLOBALS['wp_php_rv']` can be either a string with a required version, or
92
 
93
  ```php
94
  <?php
95
- $GLOBALS['wp_php_rv']['rv'] = '5.3';
96
- $GLOBALS['wp_php_rv']['re'] = array('curl', 'mbstring');
 
 
97
 
98
- if(require('wp-php-rv/src/includes/check.php')) // `TRUE` if running PHP vX.x+ w/ all required extensions.
99
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
100
  else wp_php_rv_notice('My Plugin'); // Dashboard notice mentions your software specifically.
101
  ```
102
 
103
- _**Note**: with this technique, the dashboard notice may vary depending on the scenario. If only the required PHP version is missing, the dashboard notice will mention this only. If the required PHP version is satisified, but the PHP installation is missing one or more required PHP extensions, only those required extensions will be mentioned to a site owner. If neither can be satisfied (i.e. the required version of PHP is missing, AND one or more required PHP extensions are missing too), the dashboard notice will mention both the required version of PHP, and include a list of the required PHP extensions they are missing. ~ Also, when/if missing PHP extensions are listed for a site owner, they're automatically linked up, leading a site owner to the relevant section of the manual at PHP.net._
104
-
105
  ---
106
 
107
  Copyright: © 2015 [WebSharks, Inc.](http://www.websharks-inc.com/bizdev/) (coded in the USA)
2
 
3
  Stub for WordPress themes/plugins that require PHP vX.x+ (i.e. a minimum version that you define).
4
 
5
+ ![](assets/screenshot.png)
6
 
7
  ---
8
 
20
  Text Domain: my-plugin
21
  */
22
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+ (you configure this).
23
+ if(require('wp-php-rv/src/includes/check.php')) // `true` if running PHP vX.x+.
24
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
25
  else wp_php_rv_notice(); // Creates a nice PHP vX.x+ dashboard notice for the site owner.
26
  ```
27
 
28
  ---
29
 
30
+ ### Alternate Approach
31
 
32
+ The `check.php` file will automatically return `true` upon using `include()` or `require()` in your scripts; i.e., iff the installation site is running PHP vX.x+ (as configured by `$GLOBALS['wp_php_rv']`). Otherwise it returns `false`. Therefore, the simplest way to run your check is to use `if(require('wp-php-rv/src/includes/check.php'))`. **However**, you could also choose to do it this way.
33
 
34
  ```php
35
  <?php
36
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+.
37
  require 'wp-php-rv/src/includes/check.php'; // Include.
38
 
39
+ if(wp_php_rv()) // `true` if running PHP vX.x+.
40
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
41
  else wp_php_rv_notice(); // Creates a nice PHP vX.x+ dashboard notice for the site owner.
42
  ```
48
  ```php
49
  <?php
50
  $GLOBALS['wp_php_rv'] = '5.3'; // Require PHP vX.x+.
51
+ if(require('wp-php-rv/src/includes/check.php')) // `true` if running PHP vX.x+.
52
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
53
  else wp_php_rv_notice('My Plugin'); // Dashboard notice mentions your software specifically.
54
  ```
55
 
56
+ **Note:** If you omit the `$brand_name` argument, a default value is used instead. The default value is `ucwords('[calling file basedir]')`; e.g., if `/my-plugin/stub.php` calls `wp-php-rv/src/includes/check.php`, the default `$software_name` automatically becomes `My Plugin`. Nice!
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  ---
59
 
80
 
81
  ```php
82
  <?php
83
+ $GLOBALS['wp_php_rv']['min'] = '5.3';
84
+ // $GLOBALS['wp_php_rv']['max'] = '7.0.4';
85
+ // $GLOBALS['wp_php_rv']['bits'] = 64;
86
+ $GLOBALS['wp_php_rv']['extensions'] = array('curl', 'mbstring');
87
 
88
+ if(require('wp-php-rv/src/includes/check.php')) // `true` if running PHP vX.x+ w/ all required extensions.
89
  require dirname(__FILE__).'/my-plugin-code.php'; // It's OK to load your plugin.
90
  else wp_php_rv_notice('My Plugin'); // Dashboard notice mentions your software specifically.
91
  ```
92
 
 
 
93
  ---
94
 
95
  Copyright: © 2015 [WebSharks, Inc.](http://www.websharks-inc.com/bizdev/) (coded in the USA)
src/vendor/websharks/wp-php-rv/screenshot.png DELETED
Binary file
src/vendor/websharks/wp-php-rv/src/includes/check.php CHANGED
@@ -3,14 +3,15 @@
3
  * PHP vX.x Handlers.
4
  *
5
  * @since 141004 First documented version.
6
- * @copyright WebSharks, Inc. <http://www.websharks-inc.com>
 
7
  * @license GNU General Public License, version 3
8
  */
9
  if (!defined('WPINC')) {
10
  exit('Do NOT access this file directly: '.basename(__FILE__));
11
  }
12
  if (!function_exists('wp_php_rv')) {
13
- require_once dirname(__FILE__).'/functions/wp.php';
14
  }
15
  ___wp_php_rv_initialize(); // Run initilization routines.
16
- return wp_php_rv(); // `TRUE` if running PHP vX.x+ w/ required extensions.
3
  * PHP vX.x Handlers.
4
  *
5
  * @since 141004 First documented version.
6
+ *
7
+ * @copyright WebSharks, Inc. <http://websharks-inc.com>
8
  * @license GNU General Public License, version 3
9
  */
10
  if (!defined('WPINC')) {
11
  exit('Do NOT access this file directly: '.basename(__FILE__));
12
  }
13
  if (!function_exists('wp_php_rv')) {
14
+ require_once dirname(__FILE__).'/functions/.load.php';
15
  }
16
  ___wp_php_rv_initialize(); // Run initilization routines.
17
+ return wp_php_rv(); // True if running PHP vX.x+ w/ required extensions.
src/vendor/websharks/wp-php-rv/src/includes/functions/.load.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHP vX.x Handlers.
4
+ *
5
+ * @since 160503 Reorganizing structure.
6
+ *
7
+ * @copyright WebSharks, Inc. <http://websharks-inc.com>
8
+ * @license GNU General Public License, version 3
9
+ */
10
+
11
+ /*
12
+ * Load all functions.
13
+ */
14
+ require_once dirname(__FILE__).'/checks.php';
15
+ require_once dirname(__FILE__).'/notices.php';
src/vendor/websharks/wp-php-rv/src/includes/functions/checks.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHP vX.x Handlers.
4
+ *
5
+ * @since 160503 Reorganizing structure.
6
+ *
7
+ * @copyright WebSharks, Inc. <http://websharks-inc.com>
8
+ * @license GNU General Public License, version 3
9
+ */
10
+
11
+ /**
12
+ * Running a compatible version w/ all required extensions?
13
+ *
14
+ * @since 141004 First documented version.
15
+ *
16
+ * @return bool True if running a compatible version w/ all required extensions.
17
+ */
18
+ function wp_php_rv()
19
+ {
20
+ if (isset($GLOBALS['wp_php_rv'])) {
21
+ ___wp_php_rv_initialize();
22
+ }
23
+ $min_version = $GLOBALS['___wp_php_rv']['min'];
24
+ $max_version = $GLOBALS['___wp_php_rv']['max'];
25
+ $minimum_bits = $GLOBALS['___wp_php_rv']['bits'];
26
+ $required_extensions = $GLOBALS['___wp_php_rv']['extensions'];
27
+
28
+ if ($min_version && version_compare(PHP_VERSION, $min_version, '<')) {
29
+ return false;
30
+ } elseif ($max_version && version_compare(PHP_VERSION, $max_version, '>')) {
31
+ return false;
32
+ } elseif ($minimum_bits && $minimum_bits / 8 > PHP_INT_SIZE) {
33
+ return false;
34
+ } elseif ($required_extensions) {
35
+ foreach ($required_extensions as $_required_extension) {
36
+ if (!extension_loaded($_required_extension)) {
37
+ return false;
38
+ }
39
+ } // unset($_required_extension); // Housekeeping.
40
+ }
41
+ return true;
42
+ }
43
+
44
+ /**
45
+ * Initializes each instance; unsets `$GLOBALS['wp_php_rv']`.
46
+ *
47
+ * @since 141004 First documented version.
48
+ *
49
+ * @note `$GLOBALS['wp_php_rv']` is for the API, we use a different variable internally.
50
+ * The internal global is defined here: `$GLOBALS['___wp_php_rv']`.
51
+ */
52
+ function ___wp_php_rv_initialize()
53
+ {
54
+ $GLOBALS['___wp_php_rv'] = array(
55
+ 'min' => '5.3',
56
+ 'max' => '',
57
+ 'bits' => 0,
58
+ 'extensions' => array(),
59
+ );
60
+ if (!empty($GLOBALS['wp_php_rv'])) {
61
+ if (is_string($GLOBALS['wp_php_rv'])) {
62
+ $GLOBALS['___wp_php_rv']['min'] = $GLOBALS['wp_php_rv'];
63
+ } elseif (is_array($GLOBALS['wp_php_rv'])) {
64
+ if (!empty($GLOBALS['wp_php_rv']['min'])) {
65
+ $GLOBALS['___wp_php_rv']['min'] = (string) $GLOBALS['wp_php_rv']['min'];
66
+ } elseif (!empty($GLOBALS['wp_php_rv']['rv'])) {
67
+ $GLOBALS['___wp_php_rv']['min'] = (string) $GLOBALS['wp_php_rv']['rv'];
68
+ }
69
+ if (!empty($GLOBALS['wp_php_rv']['max'])) {
70
+ $GLOBALS['___wp_php_rv']['max'] = (string) $GLOBALS['wp_php_rv']['max'];
71
+ }
72
+ if (!empty($GLOBALS['wp_php_rv']['bits'])) {
73
+ $GLOBALS['___wp_php_rv']['bits'] = (int) $GLOBALS['wp_php_rv']['bits'];
74
+ }
75
+ if (!empty($GLOBALS['wp_php_rv']['extensions'])) {
76
+ $GLOBALS['___wp_php_rv']['extensions'] = (array) $GLOBALS['wp_php_rv']['extensions'];
77
+ } elseif (!empty($GLOBALS['wp_php_rv']['re'])) {
78
+ $GLOBALS['___wp_php_rv']['extensions'] = (array) $GLOBALS['wp_php_rv']['re'];
79
+ }
80
+ }
81
+ } // End of API conversion to internal global settings.
82
+ unset($GLOBALS['wp_php_rv']); // Unset each time to avoid theme/plugin conflicts.
83
+ }
src/vendor/websharks/wp-php-rv/src/includes/functions/notices.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHP vX.x Handlers.
4
+ *
5
+ * @since 160503 Reorganizing structure.
6
+ *
7
+ * @copyright WebSharks, Inc. <http://websharks-inc.com>
8
+ * @license GNU General Public License, version 3
9
+ */
10
+
11
+ /**
12
+ * Back compat. function (rarely used).
13
+ */
14
+ function wp_php_rv_custom_notice()
15
+ {
16
+ wp_php_rv_notice(___wp_php_rv_notice_brand_name());
17
+ }
18
+
19
+ /**
20
+ * Creates a WP Dashboard notice regarding PHP requirements.
21
+ *
22
+ * @param string $brand_name Name of the calling theme/plugin.
23
+ */
24
+ function wp_php_rv_notice($brand_name = '')
25
+ {
26
+ if (isset($GLOBALS['wp_php_rv'])) {
27
+ ___wp_php_rv_initialize();
28
+ }
29
+ # Only in the admin area.
30
+
31
+ if (!is_admin()) {
32
+ return; // Not applicable.
33
+ }
34
+ # Establish the brand name.
35
+
36
+ if (!($brand_name = (string) $brand_name)) {
37
+ $brand_name = ___wp_php_rv_notice_brand_name();
38
+ } // If brand name detection fails too, use generic.
39
+ $brand_name = $brand_name ? $brand_name : 'This Software';
40
+
41
+ # Current WP Sharks Core versions.
42
+
43
+ $min_version = $GLOBALS['___wp_php_rv']['min'];
44
+ $max_version = $GLOBALS['___wp_php_rv']['max'];
45
+ $minimum_bits = $GLOBALS['___wp_php_rv']['bits'];
46
+ $required_extensions = $GLOBALS['___wp_php_rv']['extensions'];
47
+
48
+ # Determine reason for PHP dependency failure.
49
+
50
+ $missing_extensions = array(); // Initialize.
51
+
52
+ if ($min_version && version_compare(PHP_VERSION, $min_version, '<')) {
53
+ $reason = 'needs-upgrade';
54
+ } elseif ($max_version && version_compare(PHP_VERSION, $max_version, '>')) {
55
+ $reason = 'needs-downgrade';
56
+ } elseif ($minimum_bits && $minimum_bits / 8 > PHP_INT_SIZE) {
57
+ $reason = 'missing-bits';
58
+ } elseif ($required_extensions) {
59
+ foreach ($required_extensions as $_required_extension) {
60
+ if (!extension_loaded($_required_extension)) {
61
+ $reason = 'missing-extensions';
62
+ $missing_extensions[] = $_required_extension;
63
+ }
64
+ } // unset($_required_extension); // Housekeeping.
65
+ }
66
+ if (empty($reason)) {
67
+ return; // Nothing to do here.
68
+ }
69
+ # Fill-in additional variables needed down below.
70
+
71
+ $action = 'all_admin_notices';
72
+ $action_priority = 10; // Default priority.
73
+
74
+ $version = strpos(PHP_VERSION, '+') !== false
75
+ ? strstr(PHP_VERSION, '+', true) : PHP_VERSION;
76
+ // e.g., minus `+donate.sury.org~trusty+1`, etc.
77
+
78
+ # Defined pre-styled icons needed below for markup generation.
79
+
80
+ $arrow = '<span class="dashicons dashicons-editor-break" style="-webkit-transform:scale(-1, 1); transform:scale(-1, 1);"></span>';
81
+ $icon = '<span class="dashicons dashicons-admin-tools" style="display:inline-block; width:64px; height:64px; font-size:64px; float:left; margin:-5px 10px 0 -2px;"></span>';
82
+
83
+ # This allows hooks to alter any variable by reference.
84
+
85
+ foreach (array_keys(get_defined_vars()) as $___var_key) {
86
+ $___refs[$___var_key] = &$$___var_key;
87
+ } // Hooks can alter any variable by reference.
88
+
89
+ do_action('wp_php_rv_notice_refs_before_markup', $___refs);
90
+ unset($___refs, $___var_key); // Housekeeping.
91
+
92
+ # Generate markup for the PHP dependency notice.
93
+
94
+ switch ($reason) { // Based on reason.
95
+
96
+ case 'needs-upgrade': // Upgrade to latest version of PHP.
97
+ $markup = '<p style="font-weight:bold; font-size:125%; margin:.25em 0 0 0;">';
98
+ $markup .= __('PHP Upgrade Required', 'wp-php-rv');
99
+ $markup .= '</p>';
100
+ $markup .= '<p style="margin:0 0 .5em 0;">';
101
+ $markup .= $icon.sprintf(__('<strong>%1$s is not active.</strong> It requires PHP v%2$s (or higher).', 'wp-php-rv'), esc_html($brand_name), esc_html($min_version)).'<br />';
102
+ $markup .= sprintf(__('You\'re currently running the older PHP v%1$s, which is not supported by %2$s.', 'wp-php-rv'), esc_html($version), esc_html($brand_name)).'<br />';
103
+ $markup .= $arrow.' '.__('An update is necessary. <strong>Please contact your hosting company for assistance</strong>.', 'wp-php-rv').'<br />';
104
+ $markup .= sprintf(__('<em style="font-size:80%%; opacity:.7;">To remove this message, upgrade PHP or remove %1$s from WordPress.</em>', 'wp-php-rv'), esc_html($brand_name));
105
+ $markup .= '</p>';
106
+ break; // All done here.
107
+
108
+ case 'needs-downgrade': // Downgrade to older version of PHP.
109
+ $markup = '<p style="font-weight:bold; font-size:125%; margin:.25em 0 0 0;">';
110
+ $markup .= __('PHP Downgrade Required', 'wp-php-rv');
111
+ $markup .= '</p>';
112
+ $markup .= '<p style="margin:0 0 .5em 0;">';
113
+ $markup .= $icon.sprintf(__('<strong>%1$s is not active.</strong> It requires an older version of PHP.', 'wp-php-rv'), esc_html($brand_name)).'<br />';
114
+ $markup .= sprintf(__('This software is compatible up to PHP v%1$s, but you\'re running the newer PHP v%2$s.', 'wp-php-rv'), esc_html($max_version), esc_html($version)).'<br />';
115
+ $markup .= $arrow.' '.__('A downgrade is necessary. <strong>Please contact your hosting company for assistance</strong>.', 'wp-php-rv').'<br />';
116
+ $markup .= sprintf(__('<em style="font-size:80%%; opacity:.7;">To remove this message, downgrade PHP or remove %1$s from WordPress.</em>', 'wp-php-rv'), esc_html($brand_name));
117
+ $markup .= '</p>';
118
+ break; // All done here.
119
+
120
+ case 'missing-bits': // Upgrade to a more powerful architecture.
121
+ $markup = '<p style="font-weight:bold; font-size:125%; margin:.25em 0 0 0;">';
122
+ $markup .= __('System Upgrade Required', 'wp-php-rv');
123
+ $markup .= '</p>';
124
+ $markup .= '<p style="margin:0 0 .5em 0;">';
125
+ $markup .= $icon.sprintf(__('<strong>%1$s is not active.</strong> It requires PHP on a %2$s-bit+ architecture.', 'wp-php-rv'), esc_html($brand_name), esc_html($minimum_bits)).'<br />';
126
+ $markup .= sprintf(__('You\'re running an older %1$s-bit architecture, which is not supported by %2$s.', 'wp-php-rv'), esc_html(PHP_INT_SIZE * 8), esc_html($brand_name)).'<br />';
127
+ $markup .= $arrow.' '.__('An update is necessary. <strong>Please contact your hosting company for assistance</strong>.', 'wp-php-rv').'<br />';
128
+ $markup .= sprintf(__('<em style="font-size:80%%; opacity:.7;">To remove this message, upgrade your system or remove %1$s from WordPress.</em>', 'wp-php-rv'), esc_html($brand_name));
129
+ $markup .= '</p>';
130
+ break; // All done here.
131
+
132
+ case 'missing-extensions': // PHP is missing required extensions.
133
+ $markup = '<p style="font-weight:bold; font-size:125%; margin:.25em 0 0 0;">';
134
+ $markup .= __('PHP Extension(s) Missing', 'wp-php-rv');
135
+ $markup .= '</p>';
136
+ $markup .= '<p style="margin:0 0 .5em 0;">';
137
+ $markup .= $icon.sprintf(__('<strong>%1$s is not active.</strong> It depends on PHP extension(s): %2$s.', 'wp-php-rv'), esc_html($brand_name), '<code>'.implode('</code>, <code>', array_map('esc_html', $missing_extensions)).'</code>').'<br />';
138
+ $markup .= $arrow.' '.__('An action is necessary. <strong>Please contact your hosting company for assistance</strong>.', 'wp-php-rv').'<br />';
139
+ $markup .= sprintf(__('<em style="font-size:80%%; opacity:.7;">To remove this message, enable missing extension(s) or remove %1$s from WordPress.</em>', 'wp-php-rv'), esc_html($brand_name));
140
+ $markup .= '</p>';
141
+ break; // All done here.
142
+
143
+ default: // Default case handler; i.e., anything else.
144
+ return; // Nothing to do here.
145
+ }
146
+ # This allows hooks to alter any variable by reference.
147
+
148
+ foreach (array_keys(get_defined_vars()) as $___var_key) {
149
+ $___refs[$___var_key] = &$$___var_key;
150
+ } // Hooks can alter any variable by reference.
151
+
152
+ do_action('wp_php_rv_notice_refs', $___refs);
153
+ unset($___refs, $___var_key); // Housekeeping.
154
+
155
+ # Attach an action to display the notice now.
156
+
157
+ add_action($action, create_function(/* Closures require PHP 5.3+. */
158
+ '',
159
+ 'if (!current_user_can(\'activate_plugins\')) return;'.
160
+ 'if (!apply_filters(\'wp_php_rv_notice_display\', true, get_defined_vars())) return;'.
161
+
162
+ 'echo \''.// Wrap `$markup` inside a WordPress warning.
163
+ '<div class="notice notice-warning" style="min-height:7.5em;">'.
164
+ str_replace("'", "\\'", $markup).
165
+ '</div>'.
166
+ '\';'
167
+ ), $action_priority); // Priority of the action hook can be filtered above.
168
+ }
169
+
170
+ /**
171
+ * Last-ditch effort to find a brand name.
172
+ *
173
+ * @return string Name of the calling theme/plugin.
174
+ */
175
+ function ___wp_php_rv_notice_brand_name()
176
+ {
177
+ if (!($debug_backtrace = @debug_backtrace())) {
178
+ return ''; // Not possible.
179
+ }
180
+ if (empty($debug_backtrace[1]['file'])) {
181
+ return ''; // Not possible.
182
+ }
183
+ $calling_plugin_theme_dir = ''; // Initialize.
184
+ $_calling_dir = dirname($debug_backtrace[1]['file']);
185
+
186
+ for ($_i = 0; $_i < 10; ++$_i) {
187
+ if (in_array(basename(dirname($_calling_dir)), array('plugins', 'themes'), true)
188
+ && basename(dirname(dirname($_calling_dir))) === 'wp-content') {
189
+ $calling_plugin_theme_dir = $_calling_dir;
190
+ break; // We can stop here.
191
+ } else {
192
+ $_calling_dir = dirname($_calling_dir);
193
+ }
194
+ } // unset($_i, $_calling_dir); // Housekeeping.
195
+
196
+ if (empty($calling_plugin_theme_dir)) {
197
+ return ''; // Not possible.
198
+ }
199
+ $brand_name = strtolower(basename($calling_plugin_theme_dir));
200
+ $brand_name = preg_replace('/[_\-]+(?:lite|pro)$/u', '', $brand_name);
201
+ $brand_name = preg_replace('/[^\p{L}\p{N}]+/u', ' ', $brand_name);
202
+ $brand_name = ucwords(trim($brand_name));
203
+
204
+ return $brand_name;
205
+ }
src/vendor/websharks/wp-php-rv/src/includes/functions/wp.php CHANGED
@@ -1,210 +1,14 @@
1
  <?php
2
  /**
3
- * PHP vX.x Handlers.
4
  *
5
- * @since 141004 First documented version.
6
  *
7
- * @copyright WebSharks, Inc. <http://www.websharks-inc.com>
8
  * @license GNU General Public License, version 3
9
  */
10
 
11
- /**
12
- * This server is running PHP vX.x+ w/ required extensions?
13
- *
14
- * @return bool `TRUE` if running PHP vX.x+ w/ required extensions.
15
- */
16
- function wp_php_rv()
17
- {
18
- if (isset($GLOBALS['wp_php_rv'])) {
19
- ___wp_php_rv_initialize();
20
- }
21
- if (!version_compare(PHP_VERSION, $GLOBALS['___wp_php_rv']['rv'], '>=')) {
22
- return false;
23
- }
24
- foreach ($GLOBALS['___wp_php_rv']['re'] as $_extension) {
25
- if ($_extension && is_string($_extension) && !extension_loaded($_extension)) {
26
- return false; // Missing extension!
27
- }
28
- }
29
- unset($_extension); // Housekeeping.
30
-
31
- return true; // Good-to-go!
32
- }
33
-
34
- /**
35
- * What's missing; i.e., version and/or extensions?
36
- *
37
- * @return array Missing required version and/or extensions.
38
- * An empty array if nothing is missing.
39
  */
40
- function wp_php_rv_missing()
41
- {
42
- if (isset($GLOBALS['wp_php_rv'])) {
43
- ___wp_php_rv_initialize();
44
- }
45
- $missing_rv = // Missing required PHP version?
46
- !version_compare(PHP_VERSION, $GLOBALS['___wp_php_rv']['rv'], '>=');
47
- $missing_rv = $missing_rv ? $GLOBALS['___wp_php_rv']['rv'] : '';
48
-
49
- $missing_re = array(); // Missing extensions.
50
- $missing_re_list = ''; // Initialize default value.
51
-
52
- foreach ($GLOBALS['___wp_php_rv']['re'] as $_extension) {
53
- if ($_extension && is_string($_extension) && !extension_loaded($_extension)) {
54
- $missing_re[] = $_extension; // Missing extension!
55
- }
56
- }
57
- unset($_extension); // Housekeeping.
58
-
59
- if ($missing_re) {
60
- foreach ($missing_re as $_re) {
61
- $missing_re_list .= '<code><a href="http://php.net/manual/en/book.'.urlencode($_re).'.php" target="_blank">'.esc_html($_re).'</a></code>, ';
62
- }
63
- $missing_re_list = trim($missing_re_list, ', ');
64
- unset($_re); // Housekeeping.
65
- }
66
- if ($missing_rv || $missing_re) {
67
- return array('rv' => $missing_rv, 're' => $missing_re, 're_list' => $missing_re_list);
68
- }
69
- return array(); // Nothing missing.
70
- }
71
-
72
- /**
73
- * Creates a WP Dashboard notice regarding PHP requirements.
74
- *
75
- * @param string $software_name Optional. Name of the calling theme/plugin.
76
- * @param string $software_text_domain Optional i18n text domain. Defaults to slugified `$software_name`.
77
- * @param string $notice_cap Optional. Capability to view notice. Defaults to `activate_plugins`.
78
- * @param string $notice_action Optional. Action hook. Defaults to `all_admin_notices`.
79
- * @param string $notice Optional. Custom notice HTML instead of default markup.
80
- */
81
- function wp_php_rv_notice($software_name = '', $software_text_domain = '', $notice_cap = '', $notice_action = '', $notice = '')
82
- {
83
- if (isset($GLOBALS['wp_php_rv'])) {
84
- ___wp_php_rv_initialize();
85
- }
86
- if (!($missing = wp_php_rv_missing()) || (!$missing['rv'] && !$missing['re'])) {
87
- return; // Not missing anything. Stop here.
88
- }
89
- $software_name = trim((string) $software_name);
90
- $software_text_domain = trim((string) $software_text_domain);
91
- $notice_cap = trim((string) $notice_cap);
92
- $notice_action = trim((string) $notice_action);
93
- $notice = trim((string) $notice);
94
-
95
- if (!$notice_cap) {
96
- $notice_cap = 'activate_plugins';
97
- }
98
- if (!$notice_action) {
99
- $notice_action = 'all_admin_notices';
100
- }
101
- if (!$software_name) {
102
- $software_name = 'This Software'; // Default generic value.
103
- // Let's try to do better! We can use the basedir of the calling file.
104
- if (($_debug_backtrace = @debug_backtrace()) && !empty($_debug_backtrace[1]['file'])) {
105
- if (($_calling_file_basedir = strtolower(basename(dirname($_debug_backtrace[1]['file']))))) {
106
- $software_name = ucwords(trim(preg_replace('/[^a-z0-9]+/i', ' ', $_calling_file_basedir)));
107
- }
108
- }
109
- unset($_debug_backtrace, $_calling_file_basedir); // Housekeeping.
110
- }
111
- if (!$software_text_domain) {
112
- $software_text_domain = trim(preg_replace('/[^a-z0-9\-]/i', '-', strtolower($software_name)), '-');
113
- }
114
- if (!$notice) {
115
- // Use the default notice? This will amost always suffice.
116
- $extensions_i18n = _n('extension', 'extensions', count($missing['re']), $software_text_domain); // Singular|plural?
117
- $php_icon_markup = '<a href="http://php.net/" target="_blank" title="PHP.net">'.// PHP icon; linked up with the manual @ PHP.net.
118
- '<img src="//cdn.websharks-inc.com/media/images/php-icon.png" style="width:60px; float:left; margin:0 10px 0 0;" alt="PHP" />'.
119
- '</a>'; // PHP icon served from the WebSharks™ CDN. Supports both `http://` and `https://`.
120
-
121
- if ($missing['rv']) {
122
- $notice = $php_icon_markup; // Start with the floated PHP icon markup.
123
- $notice .= sprintf(__('<strong>%1$s is NOT active. It requires PHP v%2$s+.</strong>', $software_text_domain), esc_html($software_name), esc_html($missing['rv'])).'<br />';
124
- $notice .= sprintf(__('&#8627; You\'re currently running an older copy of PHP v%1$s.', $software_text_domain), esc_html(PHP_VERSION)).'<br />';
125
-
126
- if ($missing['re'] && $missing['re_list']) {
127
- $notice .= sprintf(__('&#8627; You are also missing the following required PHP %1$s: %2$s.', $software_text_domain), esc_html($extensions_i18n), $missing['re_list']).'<br />';
128
- }
129
- $notice .= __('<em>A simple update is necessary. Please ask your hosting company to help resolve this quickly.</em>', $software_text_domain).'<br />';
130
- $notice .= sprintf(__('<em>To remove this message, please upgrade PHP. Or, remove %1$s from WordPress.</em>', $software_text_domain), esc_html($software_name));
131
- } elseif ($missing['re'] && $missing['re_list']) {
132
- $notice = $php_icon_markup; // Start with the floated PHP icon markup.
133
- $notice .= sprintf(__('<strong>%1$s is NOT active. PHP %2$s missing.</strong>', $software_text_domain), esc_html($software_name), esc_html($extensions_i18n)).'<br />';
134
- $notice .= sprintf(__('&#8627; You are missing the following required PHP %1$s: %2$s.', $software_text_domain), esc_html($extensions_i18n), $missing['re_list']).'<br />';
135
- $notice .= __('<em>A simple update is necessary. Please ask your hosting company to help resolve this quickly.</em>', $software_text_domain).'<br />';
136
- $notice .= sprintf(__('<em>To remove this message, please install the required PHP %1$s. Or, remove %2$s from WordPress.</em>', $software_text_domain), esc_html($extensions_i18n), esc_html($software_name));
137
- }
138
- }
139
- if ($notice_action && $notice) {
140
- // Only if there is a notice obviously; i.e., don't show an empty error messsage.
141
- add_action($notice_action, create_function('', 'if(!current_user_can(\''.str_replace("'", "\\'", $notice_cap).'\'))'.
142
- ' return;'."\n".// User missing capability.
143
-
144
- 'echo \''.// Wrap `$notice` inside a WordPress error.
145
-
146
- '<div class="error">'.
147
- ' <p>'.
148
- ' '.str_replace("'", "\\'", $notice).
149
- ' </p>'.
150
- '</div>'.
151
-
152
- '\';'));
153
- }
154
- }
155
-
156
- /**
157
- * Creates a WP Dashboard notice regarding PHP requirements.
158
- *
159
- * @param string $notice Optional. Custom notice HTML instead of default markup.
160
- * @param string $notice_cap Optional. Capability to view notice. Defaults to `activate_plugins`.
161
- * @param string $notice_action Optional. Action hook. Defaults to `all_admin_notices`.
162
- */
163
- function wp_php_rv_custom_notice($notice = '', $notice_cap = '', $notice_action = '')
164
- {
165
- if (isset($GLOBALS['wp_php_rv'])) {
166
- ___wp_php_rv_initialize();
167
- }
168
- wp_php_rv_notice('', '', $notice_cap, $notice_action, $notice);
169
- }
170
-
171
- /**
172
- * Initializes each instance; unsets `$GLOBALS['wp_php_rv']`.
173
- *
174
- * @note `$GLOBALS['wp_php_rv']` is for the API, we use a different variable internally.
175
- * The internal global is defined here: `$GLOBALS['___wp_php_rv']`.
176
- */
177
- function ___wp_php_rv_initialize() // For internal use only.
178
- {
179
- /*
180
- * Internal array of PHP requirements.
181
- *
182
- * @var array Internal array of PHP requirements.
183
- * NOTE: this is for internal use only.
184
- */
185
- $GLOBALS['___wp_php_rv'] = array('rv' => '5.3', 're' => array());
186
-
187
- if (!empty($GLOBALS['wp_php_rv']) && is_string($GLOBALS['wp_php_rv'])) {
188
- /*
189
- * Required PHP version (public API).
190
- * @var string Required PHP version; via string.
191
- */
192
- $GLOBALS['___wp_php_rv']['rv'] = $GLOBALS['wp_php_rv'];
193
- } elseif (!empty($GLOBALS['wp_php_rv']) && is_array($GLOBALS['wp_php_rv'])) {
194
- if (!empty($GLOBALS['wp_php_rv']['rv']) && is_string($GLOBALS['wp_php_rv']['rv'])) {
195
- /*
196
- * Required PHP version (public API).
197
- * @var string Required PHP version; via array.
198
- */
199
- $GLOBALS['___wp_php_rv']['rv'] = $GLOBALS['wp_php_rv']['rv'];
200
- }
201
- if (!empty($GLOBALS['wp_php_rv']['re']) && is_array($GLOBALS['wp_php_rv']['re'])) {
202
- /*
203
- * Required PHP extension(s) (public API).
204
- * @var string Required PHP extension(s); via array.
205
- */
206
- $GLOBALS['___wp_php_rv']['re'] = $GLOBALS['wp_php_rv']['re'];
207
- }
208
- }
209
- unset($GLOBALS['wp_php_rv']); // Unset each time to avoid theme/plugin conflicts.
210
- }
1
  <?php
2
  /**
3
+ * Back compat. file.
4
  *
5
+ * @since 160503 Reorganizing structure.
6
  *
7
+ * @copyright WebSharks, Inc. <http://websharks-inc.com>
8
  * @license GNU General Public License, version 3
9
  */
10
 
11
+ /*
12
+ * Load all functions.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  */
14
+ require_once dirname(__FILE__).'/.load.php';