HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/frenchy/www/_trash/wp-content/plugins/advanced-forms/api/api-import-export.php
<?php

/**
 * Prepares a form object for export.
 *
 * @since 1.7.0
 *
 */
function af_export_form( $form ) {
  unset( $form['post_id'] );
  return $form;
}


/**
 * Imports a form object to a form post.
 * A new post will be generated if none exists with the specific key.
 *
 * @since 1.7.0
 *
 */
function af_import_form( $form ) {
  $post = af_form_post_from_key( $form['key'] );

  $post_id = NULL;
  if ( ! $post ) {
    $post_id = wp_insert_post(array(
      'post_title' => '',
      'post_type' => 'af_form',
      'post_status' => 'publish',
    ));

    if ( is_wp_error( $post_id ) ) {
      return false;
    }
  } else {
    $post_id = $post->ID;
  }

  return af_form_to_post( $form, $post_id );
}