Uname:Linux server.rehabsharif.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64

Base Dir : /home/nobi37te/public_html

User : nobi37te


403WebShell
403Webshell
Server IP : 172.67.134.116  /  Your IP : 216.73.217.123
Web Server : Apache
System : Linux server.rehabsharif.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : nobi37te ( 1003)
PHP Version : 8.2.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nobi37te/public_html/wp-content/plugins/learndash-certificate-builder/src/traits/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nobi37te/public_html/wp-content/plugins/learndash-certificate-builder/src/traits/io.php
<?php
/**
 * A trait helper for manipulating files.
 *
 * @file
 * @package Learndash_Certificate_Builer
 */

namespace Certificate_Builder\Traits;

/**
 * Trait IO
 *
 * @package Certificate_Builder\Traits
 */
trait IO {

	/**
	 * A simple function to create & return the folder that we can use to write tmp files
	 *
	 * @return string
	 */
	protected function get_tmp_path() {
		$upload_dir = wp_upload_dir()['basedir'];
		$tmp_dir    = $upload_dir . DIRECTORY_SEPARATOR . 'learndash-certificate-builder';
		if ( ! is_dir( $tmp_dir ) ) {
			wp_mkdir_p( $tmp_dir );
		}

		if ( ! is_file( $tmp_dir . DIRECTORY_SEPARATOR . 'index.php' ) ) {
			file_put_contents( $tmp_dir . DIRECTORY_SEPARATOR . 'index.php', '' );
		}

		return $tmp_dir;
	}

	/**
	 * Create the folder that is contains user fonts
	 *
	 * @return string
	 */
	protected function get_user_font_path() {
		$path = $this->get_tmp_path() . DIRECTORY_SEPARATOR . 'user_fonts';
		if ( ! is_dir( $path ) ) {
			wp_mkdir_p( $path );
		}

		return $path;
	}

	/**
	 * The mpdf working path
	 *
	 * @return string
	 */
	public function get_working_path() {
		$working_path = $this->get_tmp_path() . DIRECTORY_SEPARATOR . 'mpdf';
		if ( ! is_dir( $working_path ) ) {
			wp_mkdir_p( $working_path );
		}

		return $working_path;
	}

	/**
	 * Return the log path
	 *
	 * @param string $file_name the filename.
	 *
	 * @return string
	 */
	public function get_log_path( $file_name = '' ) {
		$file = empty( $file_name ) ? 'certificate-builder.log' : $file_name;

		return $this->get_tmp_path() . DIRECTORY_SEPARATOR . $file;
	}

	/**
	 * Delete a folder with every content inside
	 *
	 * @param string $dir The path that should be deleted.
	 *
	 * @return bool
	 */
	public function delete_dir( $dir ) {
		if ( ! is_dir( $dir ) ) {
			return;
		}
		$it    = new \RecursiveDirectoryIterator( $dir, \RecursiveDirectoryIterator::SKIP_DOTS );
		$files = new \RecursiveIteratorIterator(
			$it,
			\RecursiveIteratorIterator::CHILD_FIRST
		);
		foreach ( $files as $file ) {
			if ( $file->isDir() ) {
				$ret = rmdir( $file->getPathname() );
			} else {
				$ret = unlink( $file->getPathname() );
			}
			if ( false === $ret ) {
				return false;
			}
		}
		rmdir( $dir );

		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit