| Server IP : 87.98.154.146 / Your IP : 216.73.216.165 Web Server : Apache System : Linux webm004.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : ohklomafyi ( 52085) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/ohklomafyi/www/wp-content/plugins/templately/includes/Core/Importer/ |
Upload File : |
<?php
namespace Templately\Core\Importer;
use Exception;
use FluentForm\App\Services\Transfer\TransferService;
use FluentForm\Framework\Request\File;
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 ) {
case 'fluent-forms' && is_plugin_active( 'fluentform/fluentform.php' ) :
$fileObject = new File( $this->file, '' );
$importer = new TransferService();
$inserted = $importer->importForms( $fileObject );
$results = key( $inserted['inserted_forms'] );
break;
default:
break;
}
return $results;
} catch ( Exception $e ) {
return null;
}
}
}