Changeset 2254079
- Timestamp:
- 03/04/2020 08:55:21 AM (6 years ago)
- Location:
- ezcache
- Files:
-
- 101 added
- 12 edited
-
tags/1.4.1 (added)
-
tags/1.4.1/advanced-cache.php (added)
-
tags/1.4.1/assets (added)
-
tags/1.4.1/assets/dist (added)
-
tags/1.4.1/assets/dist/css (added)
-
tags/1.4.1/assets/dist/css/options.css (added)
-
tags/1.4.1/assets/dist/js (added)
-
tags/1.4.1/assets/dist/js/options.js (added)
-
tags/1.4.1/assets/dist/js/options.js.map (added)
-
tags/1.4.1/assets/images (added)
-
tags/1.4.1/changelog.txt (added)
-
tags/1.4.1/ezcache.php (added)
-
tags/1.4.1/includes (added)
-
tags/1.4.1/includes/Admin.php (added)
-
tags/1.4.1/includes/BackgroundProcesses (added)
-
tags/1.4.1/includes/BackgroundProcesses/ConvertWebpProcess.php (added)
-
tags/1.4.1/includes/Cache.php (added)
-
tags/1.4.1/includes/FileOptimizer (added)
-
tags/1.4.1/includes/FileOptimizer/BaseFileOptimizer.php (added)
-
tags/1.4.1/includes/FileOptimizer/CombineGoogleFonts.php (added)
-
tags/1.4.1/includes/FileOptimizer/CssCombiner.php (added)
-
tags/1.4.1/includes/FileOptimizer/CssMinifier.php (added)
-
tags/1.4.1/includes/FileOptimizer/JsCombiner.php (added)
-
tags/1.4.1/includes/FileOptimizer/JsMinifier.php (added)
-
tags/1.4.1/includes/FileOptimizer/WebpConverter.php (added)
-
tags/1.4.1/includes/LicenseApi.php (added)
-
tags/1.4.1/includes/Rest (added)
-
tags/1.4.1/includes/Rest/CacheController.php (added)
-
tags/1.4.1/includes/Rest/LicenseController.php (added)
-
tags/1.4.1/includes/Rest/SettingsController.php (added)
-
tags/1.4.1/includes/Rest/StatusController.php (added)
-
tags/1.4.1/includes/RestApi.php (added)
-
tags/1.4.1/includes/Settings.php (added)
-
tags/1.4.1/includes/ThirdParty (added)
-
tags/1.4.1/includes/ThirdParty/Minify_CSS_UriRewriter.php (added)
-
tags/1.4.1/includes/ThirdParty/Minify_HTML.php (added)
-
tags/1.4.1/includes/Updater.php (added)
-
tags/1.4.1/includes/Utilities (added)
-
tags/1.4.1/includes/Utilities/Encrypter.php (added)
-
tags/1.4.1/includes/WebpApi.php (added)
-
tags/1.4.1/index.php (added)
-
tags/1.4.1/languages (added)
-
tags/1.4.1/languages/ezcache-he_IL.mo (added)
-
tags/1.4.1/languages/ezcache-he_IL.po (added)
-
tags/1.4.1/languages/ezcache-xx_XX.pot (added)
-
tags/1.4.1/readme.txt (added)
-
tags/1.4.1/uninstall.php (added)
-
tags/1.4.1/vendor (added)
-
tags/1.4.1/vendor/a5hleyrich (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/README.md (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/classes (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/classes/wp-async-request.php (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/classes/wp-background-process.php (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/composer.json (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/license.txt (added)
-
tags/1.4.1/vendor/a5hleyrich/wp-background-processing/wp-background-processing.php (added)
-
tags/1.4.1/vendor/autoload.php (added)
-
tags/1.4.1/vendor/composer (added)
-
tags/1.4.1/vendor/composer/ClassLoader.php (added)
-
tags/1.4.1/vendor/composer/LICENSE (added)
-
tags/1.4.1/vendor/composer/autoload_classmap.php (added)
-
tags/1.4.1/vendor/composer/autoload_namespaces.php (added)
-
tags/1.4.1/vendor/composer/autoload_psr4.php (added)
-
tags/1.4.1/vendor/composer/autoload_real.php (added)
-
tags/1.4.1/vendor/composer/autoload_static.php (added)
-
tags/1.4.1/vendor/composer/installed.json (added)
-
tags/1.4.1/vendor/matthiasmullie (added)
-
tags/1.4.1/vendor/matthiasmullie/minify (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/CONTRIBUTING.md (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/Dockerfile (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/LICENSE (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/bin (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/bin/minifycss (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/bin/minifyjs (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/composer.json (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/keywords_after.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/keywords_before.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/keywords_reserved.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/operators.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/operators_after.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/data/js/operators_before.txt (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/docker-compose.yml (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/CSS.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Exception.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Exceptions (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Exceptions/BasicException.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Exceptions/FileImportException.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Exceptions/IOException.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/JS.php (added)
-
tags/1.4.1/vendor/matthiasmullie/minify/src/Minify.php (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/LICENSE (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/composer.json (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/src (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/src/Converter.php (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/src/ConverterInterface.php (added)
-
tags/1.4.1/vendor/matthiasmullie/path-converter/src/NoConverter.php (added)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/ezcache.php (modified) (8 diffs)
-
trunk/includes/Admin.php (modified) (5 diffs)
-
trunk/includes/Cache.php (modified) (4 diffs)
-
trunk/includes/FileOptimizer/CssCombiner.php (modified) (1 diff)
-
trunk/includes/FileOptimizer/JsCombiner.php (modified) (1 diff)
-
trunk/includes/FileOptimizer/WebpConverter.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/composer/installed.json (modified) (4 diffs)
-
trunk/vendor/matthiasmullie/minify/src/CSS.php (modified) (2 diffs)
-
trunk/vendor/matthiasmullie/minify/src/Minify.php (modified) (1 diff)
-
trunk/vendor/matthiasmullie/path-converter/src/Converter.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ezcache/trunk/changelog.txt
r2247507 r2254079 1 = 1.4.1 = 2 - FIX: Reverted minified CSS position 3 - FIX: Translation will now load correctly 4 - FIX: CSS minification optimization 5 - ADD: WebP now supports <style> tags 6 1 7 = 1.4 = 2 8 - FIX: Clearing cache will delete cache for all languages on a multi language or multisite website -
ezcache/trunk/ezcache.php
r2247507 r2254079 4 4 Description: EzCache is an easy and innovative cache plugin that will help you significantly improve your site speed. 5 5 Plugin URI: https://ezcache.app 6 Version: 1.4 6 Version: 1.4.1 7 7 Author: uPress 8 8 Author URI: https://www.upress.io … … 36 36 define( 'EZCACHE_URL', plugin_dir_url( __FILE__ ) ); 37 37 define( 'EZCACHE_BASEBANE', basename( __FILE__ ) ); 38 define( 'EZCACHE_VERSION', '1.4 ' );38 define( 'EZCACHE_VERSION', '1.4.1' ); 39 39 define( 'EZCACHE_SETTINGS_KEY', 'ezcache' ); 40 40 … … 106 106 107 107 add_action( 'init', [ $this, 'load_translation' ] ); 108 add_action( 'edit_post', [ $this, 'maybe_clear_cache_on_post_update' ], 10, 2 );109 108 add_filter( 'cron_schedules', [ $this, 'add_cron_schedules' ] ); 110 add_filter( 'show_admin_bar', [ $this, 'maybe_show_admin_bar' ], 100 );111 109 112 110 new RestApi($this); … … 117 115 118 116 function load_translation() { 119 load_plugin_textdomain( 'ezcache', false, basename( dirname( EZCACHE_FILE ) ) . '/languages' ); 117 $locale = apply_filters( 'plugin_locale', get_locale(), 'ezcache' ); 118 load_textdomain( 'ezcache', EZCACHE_DIR . "/languages/ezcache-{$locale}.mo" ); 120 119 } 121 120 … … 139 138 } 140 139 141 file_put_contents( $path, $contents );140 @file_put_contents( $path, $contents ); 142 141 143 142 // if the user currently has an advanced-cache file rename it as a backup … … 164 163 } 165 164 166 file_put_contents( $path, $contents );165 @file_put_contents( $path, $contents ); 167 166 168 167 // delete advanced-cache … … 182 181 183 182 $this->ezcache->clear_cache(); 184 }185 186 /**187 * Runs when a post is created, updated, or a comment is left on it188 * @param int $post_id189 * @param WP_Post $post190 */191 function maybe_clear_cache_on_post_update( $post_id, $post ) {192 $settings = Settings::get_settings();193 194 if ( ! $settings->cache_clear_on_post_edit ) {195 return;196 }197 198 $this->ezcache->clear_cache_single( $post_id );199 183 } 200 184 … … 239 223 return $schedules; 240 224 } 241 242 function maybe_show_admin_bar( $show_admin_bar ) {243 $settings = Settings::get_settings();244 245 if ( ! $settings->no_cache_known_users ) {246 return false;247 }248 249 return $show_admin_bar;250 }251 225 } 252 226 -
ezcache/trunk/includes/Admin.php
r2247507 r2254079 25 25 $this->plugin = $plugin; 26 26 27 // skip any admin related stuff when doing ajax, cron or rest 28 if ( (defined( 'DOING_AJAX' ) && DOING_AJAX) || (defined( 'DOING_CRON' ) && DOING_CRON) || (defined( 'REST_REQUEST' ) && REST_REQUEST) ) { 29 return; 30 } 31 32 add_action( 'admin_init', [ $this, 'start_session' ] ); 33 add_action( 'admin_init', [ $this, 'register_settings' ] ); 27 add_filter( 'show_admin_bar', [ $this, 'maybe_show_admin_bar' ], 100 ); 28 add_action( 'admin_init', [ $this, 'admin_init' ] ); 34 29 add_action( 'admin_menu', [ $this, 'register_menu' ] ); 35 30 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); … … 42 37 add_action( 'admin_bar_menu', [ $this, 'add_admin_bar_button' ], 999 ); 43 38 add_action( 'admin_post_wpb_clear_cache', [ $this, 'admin_clear_cache' ] ); 44 add_action( 'admin_post_nopriv_wpb_clear_cache', [ $this, 'admin_clear_cache' ] );45 39 add_action( 'delete_attachment', [ $this, 'delete_webp_image' ] ); 46 add_action( 'admin_init', [ $this, 'maybe_repair_installation' ] );47 40 48 41 add_action( 'init', [ $this, 'register_post_meta' ] ); 49 42 add_action( 'add_meta_boxes', [ $this, 'post_cache_metabox' ] ); 50 43 add_action( 'save_post', [ $this, 'save_post_cache_metabox' ] ); 44 add_action( 'edit_post', [ $this, 'maybe_clear_cache_on_post_update' ], 10, 2 ); 51 45 } 52 46 … … 185 179 186 180 /** 181 * Runs when a post is created, updated, or a comment is left on it 182 * @param int $post_id 183 * @param WP_Post $post 184 */ 185 function maybe_clear_cache_on_post_update( $post_id, $post ) { 186 $settings = Settings::get_settings(); 187 188 if ( ! $settings->cache_clear_on_post_edit ) { 189 return; 190 } 191 192 $this->ezcache->clear_cache_single( $post_id ); 193 } 194 195 /** 187 196 * Add settings link to the plugin action links 188 197 * … … 235 244 } 236 245 237 /** 238 * Make sure we have a session 239 */ 240 function start_session() { 246 function admin_init() { 247 // Make sure we have a session 241 248 if ( session_status() == PHP_SESSION_NONE ) { 242 249 session_start(); 243 250 } 244 } 245 246 /** 247 * Register settings for the plugin 248 */ 249 function register_settings() { 251 252 // Register settings for the plugin 250 253 register_setting( $this->plugin->plugin_settings_key . '_group', $this->plugin->plugin_settings_key ); 254 255 $this->maybe_repair_installation(); 251 256 } 252 257 … … 677 682 $_SESSION['EZCACHE_REPAIRED'] = true; 678 683 } 684 685 function maybe_show_admin_bar( $show_admin_bar ) { 686 $settings = Settings::get_settings(); 687 688 if ( ! $settings->no_cache_known_users ) { 689 return false; 690 } 691 692 return $show_admin_bar; 693 } 679 694 } -
ezcache/trunk/includes/Cache.php
r2247507 r2254079 764 764 public function do_frontend_optimizations() { 765 765 if ( ! $this->should_serve_cached_data() ) { 766 return false;766 return; 767 767 } 768 768 … … 782 782 } 783 783 784 // PHP_INT_MAX to make sure these placeholders are the last script at the end of their respective locations785 add_action( 'wp_head', [ $this, 'cache_placeholder_wp_head' ], PHP_INT_MAX );786 add_action( 'wp_footer', [ $this, 'cache_placeholder_wp_footer' ], PHP_INT_MAX );787 784 788 785 if ( ! empty( $settings->critical_css ) ) { 789 786 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_critical_css' ], PHP_INT_MAX ); 790 787 } 791 }792 793 public function cache_placeholder_wp_head() {794 echo "\n".static::PLACEHOLDER_HEAD."\n";795 }796 797 public function cache_placeholder_wp_footer() {798 echo "\n".static::PLACEHOLDER_FOOTER."\n";799 788 } 800 789 … … 870 859 871 860 if ( $settings->minify_html ) { 861 wp_raise_memory_limit( 'image' ); 862 872 863 $buffer = Minify_HTML::minify( $buffer, [ 873 864 'htmlCleanComments' => $settings->minify_html_comments, … … 879 870 880 871 $minifier = new CSS( $css ); 872 $minifier->setMaxImportSize(0); 873 $minifier->setImportExtensions([]); 881 874 return $minifier->minify(); 882 875 }, -
ezcache/trunk/includes/FileOptimizer/CssCombiner.php
r2247507 r2254079 73 73 74 74 if ( $this->minify_footer ) { 75 $ minify_location_placeholder = false !== stripos( $html, Cache::PLACEHOLDER_FOOTER ) ? Cache::PLACEHOLDER_FOOTER : '</body>';75 $html = str_replace( '</body>', "{$minify_link_tag}\n</body>", $html ); 76 76 } else { 77 $ minify_location_placeholder = false !== stripos( $html, Cache::PLACEHOLDER_HEAD ) ? Cache::PLACEHOLDER_HEAD : '</head>';77 $html = str_replace( '</title>', "</title>\n{$minify_link_tag}", $html ); 78 78 } 79 80 $html = str_replace( $minify_location_placeholder, "{$minify_link_tag}\n{$minify_location_placeholder}", $html );81 79 82 80 $styles = array_filter( $styles ); -
ezcache/trunk/includes/FileOptimizer/JsCombiner.php
r2247507 r2254079 82 82 } 83 83 84 $minify_script_tag = '<script src="' . esc_url( $minify_url ) . '" data-minify="1"></script> </head>';84 $minify_script_tag = '<script src="' . esc_url( $minify_url ) . '" data-minify="1"></script>'; 85 85 86 86 if ( 'head' === $this->in_location ) { 87 $ minify_location_placeholder = false !== stripos( $html, Cache::PLACEHOLDER_HEAD ) ? Cache::PLACEHOLDER_HEAD : '</head>';87 $html = str_replace( '</head>', "{$minify_script_tag}\n</head>", $html ); 88 88 } else { 89 $minify_location_placeholder = false !== stripos( $html, Cache::PLACEHOLDER_FOOTER ) ? Cache::PLACEHOLDER_FOOTER : '</body>'; 90 } 91 92 $html = str_replace( $minify_location_placeholder, "{$minify_script_tag}\n{$minify_location_placeholder}", $html ); 93 89 $html = str_replace( '</body>', "{$minify_script_tag}\n</body>", $html ); 90 } 94 91 95 92 $combine_scripts = array_filter( $combine_scripts ); -
ezcache/trunk/includes/FileOptimizer/WebpConverter.php
r2247507 r2254079 38 38 * <div style="background: url(elva-480w-close-portrait.jpg);"> 39 39 * <div style="background-image: url(elva-480w-close-portrait.jpg);"> 40 * <style>.foo { background-image: url(elva-480w-close-portrait.jpg); }</style> 40 41 */ 41 42 $img_tags = $this->find( '<img\s+([^>]+[\s"\'])?src\s*=\s*[\'"]\s*?([^\'"]+(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?>', $html ); 42 $bg_images = $this->find( ' style=([\'"]).+:\s*url\s*\(\s*([\'"]?)(.+)\2?\s*\).+\1', $html );43 $bg_images = $this->find( 'background(?:-image)\s*:.*url\s*\(\s*([\'"]?)([^\'"]+)\1\s*\)', $html ); 43 44 44 45 if ( ! $img_tags ) { … … 70 71 // for bg images grab the url part 71 72 foreach ( $bg_images as $img ) { 72 $images[] = trim( $img[ 3], ' \t\n\r\0\x0B\'"' );73 $images[] = trim( $img[2], ' \t\n\r\0\x0B\'"' ); 73 74 } 74 75 -
ezcache/trunk/readme.txt
r2247507 r2254079 35 35 36 36 == Changelog == 37 = 1.4.1 = 38 - FIX: Reverted minified CSS position 39 - FIX: Translation will now load correctly 40 - FIX: CSS minification optimization 41 - ADD: WebP now supports <style> tags 42 37 43 = 1.4 = 38 44 - FIX: Clearing cache will delete cache for all languages on a multi language or multisite website -
ezcache/trunk/vendor/composer/installed.json
r2149447 r2254079 40 40 { 41 41 "name": "matthiasmullie/minify", 42 "version": "1.3.6 1",43 "version_normalized": "1.3.6 1.0",42 "version": "1.3.63", 43 "version_normalized": "1.3.63.0", 44 44 "source": { 45 45 "type": "git", 46 46 "url": "https://github.com/matthiasmullie/minify.git", 47 "reference": " d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"47 "reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117" 48 48 }, 49 49 "dist": { 50 50 "type": "zip", 51 "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/ d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",52 "reference": " d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",51 "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/9ba1b459828adc13430f4dd6c49dae4950dc4117", 52 "reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117", 53 53 "shasum": "" 54 54 }, … … 66 66 "psr/cache-implementation": "Cache implementation to use with Minify::cache" 67 67 }, 68 "time": "20 18-11-26T23:10:39+00:00",68 "time": "2020-01-21T20:21:08+00:00", 69 69 "bin": [ 70 70 "bin/minifycss", … … 102 102 { 103 103 "name": "matthiasmullie/path-converter", 104 "version": "1.1. 2",105 "version_normalized": "1.1. 2.0",104 "version": "1.1.3", 105 "version_normalized": "1.1.3.0", 106 106 "source": { 107 107 "type": "git", 108 108 "url": "https://github.com/matthiasmullie/path-converter.git", 109 "reference": " 5e4b121c8b9f97c80835c1d878b0812ba1d607c9"109 "reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9" 110 110 }, 111 111 "dist": { 112 112 "type": "zip", 113 "url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/ 5e4b121c8b9f97c80835c1d878b0812ba1d607c9",114 "reference": " 5e4b121c8b9f97c80835c1d878b0812ba1d607c9",113 "url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/e7d13b2c7e2f2268e1424aaed02085518afa02d9", 114 "reference": "e7d13b2c7e2f2268e1424aaed02085518afa02d9", 115 115 "shasum": "" 116 116 }, … … 122 122 "phpunit/phpunit": "~4.8" 123 123 }, 124 "time": "201 8-10-25T15:19:41+00:00",124 "time": "2019-02-05T23:41:09+00:00", 125 125 "type": "library", 126 126 "installation-source": "dist", -
ezcache/trunk/vendor/matthiasmullie/minify/src/CSS.php
r2149447 r2254079 526 526 527 527 return preg_replace_callback( 528 '/(?<=[: ])('.implode( array_keys($colors), '|').')(?=[; }])/i',528 '/(?<=[: ])('.implode('|', array_keys($colors)).')(?=[; }])/i', 529 529 function ($match) use ($colors) { 530 530 return $colors[strtoupper($match[0])]; … … 709 709 }; 710 710 711 $this->registerPattern('/calc(\(.+?)(?=$|;|calc\()/', $callback); 711 $this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/', $callback); 712 $this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/m', $callback); 712 713 } 713 714 -
ezcache/trunk/vendor/matthiasmullie/minify/src/Minify.php
r2149447 r2254079 95 95 // store data 96 96 $this->data[$key] = $value; 97 } 98 99 return $this; 100 } 101 102 /** 103 * Add a file to be minified. 104 * 105 * @param string|string[] $data 106 * 107 * @return static 108 * 109 * @throws IOException 110 */ 111 public function addFile($data /* $data = null, ... */) 112 { 113 // bogus "usage" of parameter $data: scrutinizer warns this variable is 114 // not used (we're using func_get_args instead to support overloading), 115 // but it still needs to be defined because it makes no sense to have 116 // this function without argument :) 117 $args = array($data) + func_get_args(); 118 119 // this method can be overloaded 120 foreach ($args as $path) { 121 if (is_array($path)) { 122 call_user_func_array(array($this, 'addFile'), $path); 123 continue; 124 } 125 126 // redefine var 127 $path = (string) $path; 128 129 // check if we can read the file 130 if (!$this->canImportFile($path)) { 131 throw new IOException('The file "'.$path.'" could not be opened for reading. Check if PHP has enough permissions.'); 132 } 133 134 $this->add($path); 97 135 } 98 136 -
ezcache/trunk/vendor/matthiasmullie/path-converter/src/Converter.php
r2149447 r2254079 72 72 $path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $path), '/'); 73 73 74 // remove leading current directory. 75 if (substr($path, 0, 2) === './') { 76 $path = substr($path, 2); 77 } 78 79 // remove references to current directory in the path. 80 $path = str_replace('/./', '/', $path); 81 74 82 /* 75 83 * Example:
Note: See TracChangeset
for help on using the changeset viewer.