url_to_file_system() public static method

Takes a url and figures out its place based in the file system based on path NOTE: Not fool-proof, makes a lot of assumptions about the file path matching the URL path
public static url_to_file_system ( string $url ) : string
$url string
return string
示例#1
0
 /**
  * Deletes the auto-generated files for resize and letterboxing created by Timber
  * @param string  $local_file   ex: /var/www/wp-content/uploads/2015/my-pic.jpg
  *	                            or: http://example.org/wp-content/uploads/2015/my-pic.jpg
  */
 static function delete_generated_files($local_file)
 {
     if (URLHelper::is_absolute($local_file)) {
         $local_file = URLHelper::url_to_file_system($local_file);
     }
     $info = pathinfo($local_file);
     $dir = $info['dirname'];
     $ext = $info['extension'];
     $filename = $info['filename'];
     self::process_delete_generated_files($filename, $ext, $dir, '-[0-9999999]*', '-[0-9]*x[0-9]*-c-[a-z]*.');
     self::process_delete_generated_files($filename, $ext, $dir, '-lbox-[0-9999999]*', '-lbox-[0-9]*x[0-9]*-[a-zA-Z0-9]*.');
     self::process_delete_generated_files($filename, 'jpg', $dir, '-tojpg.*');
     self::process_delete_generated_files($filename, 'jpg', $dir, '-tojpg-[0-9999999]*');
 }