plugin updates
This commit is contained in:
@@ -130,13 +130,7 @@ class WC_Product_Download implements ArrayAccess {
|
||||
|
||||
// Validate the file exists.
|
||||
if ( ! $this->file_exists() ) {
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
/* translators: %s: Downloadable file */
|
||||
__( 'The downloadable file %s cannot be used as it does not exist on the server.', 'woocommerce' ),
|
||||
'<code>' . $download_file . '</code>'
|
||||
)
|
||||
);
|
||||
$this->raise_invalid_file_exception( $download_file );
|
||||
}
|
||||
|
||||
$this->approved_directory_checks( $auto_add_to_approved_directory_list );
|
||||
@@ -242,18 +236,31 @@ class WC_Product_Download implements ArrayAccess {
|
||||
}
|
||||
|
||||
if ( ! $valid_storage_directory ) {
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
/* translators: %1$s is the downloadable file path, %2$s is an opening link tag, %3%s is a closing link tag. */
|
||||
__( 'The downloadable file %1$s cannot be used: it is not located in an approved directory. Please contact a site administrator for help. %2$sLearn more.%3$s', 'woocommerce' ),
|
||||
'<code>' . $download_file . '</code>',
|
||||
'<a href="https://woo.com/document/approved-download-directories">',
|
||||
'</a>'
|
||||
)
|
||||
);
|
||||
$this->raise_invalid_file_exception( $download_file );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method, allows us to re-use the same exception messaging from different areas.
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @param string $download_file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function raise_invalid_file_exception( string $download_file ): void {
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
/* translators: %1$s is the downloadable file path, %2$s is an opening link tag, %3%s is a closing link tag. */
|
||||
__( 'The downloadable file %s cannot be used as it does not exist on the server, or is not located within an approved directory. Please contact a site administrator for help. %2$sLearn more.%3$s', 'woocommerce' ),
|
||||
'<code>' . $download_file . '</code>',
|
||||
'<a href="https://woo.com/document/approved-download-directories">',
|
||||
'</a>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Setters
|
||||
|
||||
Reference in New Issue
Block a user