Introduced woocommerce_delete_from_theme_folder filter

This commit is contained in:
Nicola Mustone 2014-12-03 00:52:08 +01:00
parent fcc072abcc
commit 6b03da033d
1 changed files with 4 additions and 2 deletions

View File

@ -503,11 +503,11 @@ class WC_Email extends WC_Settings_API {
// Handle any actions
if ( ! empty( $this->template_html ) || ! empty( $this->template_plain ) ) {
$template_folder = '/' . trim( apply_filters( 'woocommerce_copy_to_theme_folder', 'woocommerce' ), '/' ) . '/';
if ( ! empty( $_GET['move_template'] ) && ( $template = esc_attr( basename( $_GET['move_template'] ) ) ) ) {
if ( ! empty( $this->$template ) ) {
$template_folder = '/' . trim( apply_filters( 'woocommerce_copy_to_theme_folder', 'woocommerce', $this->template ), '/' ) . '/';
if ( wp_mkdir_p( dirname( get_stylesheet_directory() . $template_folder . $this->$template ) ) && ! file_exists( get_stylesheet_directory() . $template_folder . $this->$template ) ) {
@ -534,6 +534,8 @@ class WC_Email extends WC_Settings_API {
if ( ! empty( $_GET['delete_template'] ) && ( $template = esc_attr( basename( $_GET['delete_template'] ) ) ) ) {
if ( ! empty( $this->$template ) ) {
$template_folder = '/' . trim( apply_filters( 'woocommerce_delete_from_theme_folder', 'woocommerce', $this->template ), '/' ) . '/';
if ( file_exists( get_stylesheet_directory() . $template_folder . $this->$template ) ) {
unlink( get_stylesheet_directory() . $template_folder . $this->$template );