LLMS_Post_Model::export()
Trigger an export download of the given post type
Description Description
Return Return
(void)
Source Source
File: includes/abstracts/abstract.llms.post.model.php
public function export() { // if post type doesnt support exporting don't proceed if ( ! $this->is_exportable() ) { return; } $title = str_replace( ' ', '-', $this->get( 'title' ) ); $title = preg_replace( '/[^a-zA-Z0-9-]/', '', $title ); $filename = apply_filters( 'llms_post_model_export_filename', $title . '_' . current_time( 'Ymd' ), $this ); header( 'Content-type: application/json' ); header( 'Content-Disposition: attachment; filename="' . $filename . '.json"' ); header( 'Pragma: no-cache' ); header( 'Expires: 0' ); $this->allowed_post_tags_set(); $arr = $this->toArray(); $arr['_generator'] = 'LifterLMS/Single' . ucwords( $this->model_post_type ) . 'Exporter'; $arr['_source'] = get_site_url(); $arr['_version'] = LLMS()->version; ksort( $arr ); echo json_encode( $arr ); $this->allowed_post_tags_unset(); die(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: