https://t.me/RX1948
Server : nginx/1.24.0
System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
Directory :  /var/www/html/wp-content/envato-elements.off/vendor/template-kit-import/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/wp-content/envato-elements.off/vendor/template-kit-import/inc/class-delete.php
<?php
/**
 * Template Kit Delete:
 *
 * Deletes the template kit from wp_posts and cleans up the uploaded
 * folders and files.
 *
 * @package Envato/Envato_Template_Kit_Delete
 * @since 1.0.1
 */

namespace Envato_Template_Kit_Import;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Delete templage kit and cleanup.
 *
 * @since 1.0.1
 */
class Delete extends Base {

	public function __construct() {
		parent::__construct();
		add_action( 'before_delete_post', array( $this, 'cleanup_template_delete' ) );
	}

	/**
	 * Deletes a template kit when called via ajax
	 *
	 * @since 1.0.1
	 */
	public function delete_template_kit($template_kit_id) {
		wp_delete_post( $template_kit_id, true );
	}

	/**
	 * Clean up from template delete
	 *
	 * @since 1.0.1
	 * @param int $post_id The post id to let the things happen.
	 */
	public function cleanup_template_delete( $post_id ) {
		$post = get_post( $post_id );

		if ( CPT_Kits::get_instance()->cpt_slug === $post->post_type ) {
			require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
			require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
			$file_system_direct = new \WP_Filesystem_Direct( false );

			$get_upload_dir       = wp_upload_dir();
			$template_kit_path    = $get_upload_dir ['basedir'] . '/template-kits/';
			$template_kit_id_path = get_post_meta( $post_id, 'envato_tk_folder_name', true );

			if ( ! $template_kit_id_path ) {
				return;
			}

			$full_template_kit_id_path = $template_kit_path . $template_kit_id_path;
			$file_system_direct->rmdir( $full_template_kit_id_path, true );
		}
	}
}

https://t.me/RX1948 - 2025