<?php
/**
 * Controller for handle get optin form data
 *
 * @package wp-viral-click
 * @author InstaProduct
 * @link http://insta-product.com/
 */

if ( ! class_exists( 'IPJck_Ajax_Getoptin' ))
{
  class IPJck_Ajax_Getoptin
  {
    /**
     * Execution get optin form process
     *
     * @return void
     */
    public function exec()
    {
      if ( ! empty( $_POST['html'] ))
      {
        $html = str_replace( "'", '"', $_POST['html'] );
        $data = IPJck_Form::parse( $html );
        echo json_encode( array(
          'status'    => 1,
          'data'      => $data
        ) );
        die();
      }
      echo json_encode( array(
        'status'  => 0
      ) );
      die();
    }
  }
}
