| Server IP : 216.238.66.20 / Your IP : 216.73.216.199 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/plugins/backwpup/inc/ |
Upload File : |
<?php
/**
* Class BackWPup_Sanitize_Path.
*/
class BackWPup_Sanitize_Path {
/**
* Slug Sanitizer Pattern.
*
* @var string The pattern for array keys
*/
public const SLUG_SANITIZE_PATTERN = '/[^a-z0-9\-\_]*/';
/**
* Path Sanitizer Pattern.
*
* @var string The pattern to sanitize the paths
*/
public const PATH_SANITIZE_PATTERN = '/[^a-zA-Z0-9\/\-\_\.]+/';
/**
* Sanitize path.
*
* @param string $path The path to sanitize.
*
* @return string the sanitized path
*/
public static function sanitize_path( $path ) {
while ( false !== strpos( $path, '..' ) ) {
$path = str_replace( '..', '', $path );
}
return ( '/' !== $path ) ? $path : '';
}
/**
* Sanitize Slug By RegExp.
*
* @param string $slug The slug to sanitize.
*
* @return string The sanitize slug. May be empty.
*/
public static function sanitize_slug_reg_exp( $slug ) {
return preg_replace( static::SLUG_SANITIZE_PATTERN, '', $slug );
}
/**
* Sanitize file path By RegExp.
*
* @param string $path The path to sanitize.
*
* @return string The sanitized path
*/
public static function sanitize_path_regexp( $path ) {
// Sanitize template path and remove the path separator.
// locate_template build the path in this way {STYLESHEET|TEMPLATE}PATH . '/' . $template_name.
return self::sanitize_path(
preg_replace( static::PATH_SANITIZE_PATTERN, '', $path )
);
}
}