Last active
December 22, 2021 14:49
-
-
Save mlbd/b748ee08ea3995ad2f233b99cc819451 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Import Class | |
* A helper class for support CS to OCDI | |
* | |
*/ | |
if ( !class_exists( 'OCDI_Plugin' ) ) | |
return; | |
class CS_Import_OCDI { | |
public $title; | |
public function __construct($title = 'Codestart Framework data uploaded') { | |
$this->title = $title; | |
add_action('pt-ocdi/after_content_import_execution', array($this, 'cs_import_init'), 3, 99 ); | |
} | |
public function cs_decode_string( $string ) { | |
return unserialize( $string ); | |
} | |
public function cs_import_init( $selected_import_files, $import_files, $selected_index ) { | |
if ( !class_exists( 'CSFramework' ) ) { | |
return; | |
} | |
$downloader = new OCDI\Downloader(); | |
if( ! empty( $import_files[$selected_index]['local_import_cs'] ) ) { | |
foreach( $import_files[$selected_index]['local_import_cs'] as $index => $import ) { | |
$file_path = $import['file_path']; | |
$file_raw = OCDI\Helpers::data_from_file( $file_path ); | |
update_option( $import['option_name'], cs_decode_string( $file_raw, true ) ); | |
} | |
} | |
$ocdi = OCDI\OneClickDemoImport::get_instance(); | |
$log_path = $ocdi->get_log_file_path(); | |
OCDI\Helpers::append_to_file( $this->title, $log_path ); | |
} | |
} | |
$cs_init = new CS_Import_OCDI(); |
Author
mlbd
commented
Apr 25, 2018
•
Hello. I tried these files but it wasn't working for me. Tell me, please, where should I put the code?
@pavlyukpetr you just need to put both of them in your theme functions.php or any other fucntions file you want to
Hi
I try this method, but Ideta import not working, but log file shows it's uploaded?
i change file path (fake path) and test, but fake URL also show as Framework data uploaded in a log file
any suggestions for this?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment