PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.16.7
Translate and Go multilingual – Automatic AI translation – wpLingua v2.16.7
2.16.7 2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 1.1.0 All 112 releases
← All changes | inc/cache.php +16 -4 2.12.22.16.7 View file →
@@ -204,9 +204,9 @@
204 204 *
205 205 * @return void
206 206 */
207 207 function wplng_clear_translations_cache() {
208 - delete_transient( 'wplng_cached_translations' );
208 + delete_option( 'wplng_cached_translations' );
209 209 wplng_clear_website_cache();
210 210 }
211 211
212 212
@@ -232,14 +232,14 @@
232 232
233 233 /**
234 234 * Clear cached slugs
235 235 *
236 - * Deletes the slugs transient and clears the website cache.
236 + * Deletes the slugs option and clears the website cache.
237 237 *
238 238 * @return void
239 239 */
240 240 function wplng_clear_slugs_cache() {
241 - delete_transient( 'wplng_cached_slugs' );
241 + delete_option( 'wplng_cached_slugs' );
242 242 wplng_clear_website_cache();
243 243 }
244 244
245 245
@@ -273,8 +273,13 @@
273 273 * @return int|false Number of bytes written, or false on failure.
274 274 */
275 275 function wplng_put_cache_file( $file_name, $data ) {
276 276
277 + // Security: prevent path traversal
278 + if ( wplng_str_contains( $file_name, '..' ) ) {
279 + return false;
280 + }
281 +
277 282 // Create main wpLingua cache folder if not exist
278 283 if ( ! is_dir( WPLNG_CACHE_DIR ) ) {
279 284 if ( ! wp_mkdir_p( WPLNG_CACHE_DIR ) ) {
280 285 return false;
@@ -392,8 +397,13 @@
392 397 * @return string|false File contents, or false if file doesn't exist or isn't readable.
393 398 */
394 399 function wplng_get_cache_file( $file_name ) {
395 400
401 + // Security: prevent path traversal
402 + if ( wplng_str_contains( $file_name, '..' ) ) {
403 + return false;
404 + }
405 +
396 406 $file_path = WPLNG_CACHE_DIR . $file_name;
397 407
398 408 if ( ! is_readable( $file_path ) ) {
399 409 return false;
@@ -416,9 +426,11 @@
416 426 } else {
417 427 $path = wp_normalize_path( WPLNG_CACHE_DIR . $file );
418 428
419 429 // Security: ensure path is within cache directory
420 - if ( strpos( $path, wp_normalize_path( WPLNG_CACHE_DIR ) ) !== 0 ) {
430 + if ( wplng_str_contains( $file, '..' )
431 + || ! wplng_str_starts_with( $path, wp_normalize_path( WPLNG_CACHE_DIR ) )
432 + ) {
421 433 return false;
422 434 }
423 435 }
424 436