: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Integration for PirateForms Form
* @copyright Copyright (c) 2023, Code Atlantic LLC
class PUM_Integration_Form_PirateForms extends PUM_Abstract_Integration_Form {
public $key = 'pirateforms';
public function __construct() {
// add_action( 'wpforms_process_complete', array( $this, 'on_success' ), 10, 4 );
public function label() {
public function enabled() {
return defined( 'PIRATE_FORMS_VERSION' ) && PIRATE_FORMS_VERSION;
public function get_forms() {
// Union those arrays, as array_merge() does keys reindexing.
$forms = $this->get_default_forms() + $this->get_pro_forms();
* Pirate Forms has a default form, which doesn't have an ID.
protected function get_default_forms() {
$form = PirateForms_Util::get_form_options();
// Just make sure that it's there and not broken.
return [ 0 => esc_html__( 'Default Form', 'wpforms-lite' ) ];
* Copy-paste from Pro plugin code, it doesn't have API to get this data easily.
protected function get_pro_forms() {
'post_type' => 'pf_form',
'post_status' => 'publish',
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$forms[ get_the_ID() ] = get_the_title();
* Get a single form options.
* @param int $id Form ID.
public function get_form( $id ) {
return PirateForms_Util::get_form_options( (int) $id );
public function get_form_selectlist() {
$forms = $this->get_forms();
foreach ( $forms as $form ) {
$form_selectlist[ $form['ID'] ] = $form['name'];
* @link https://wpforms.com/developers/wpforms_process_complete/
* @param array $fields Sanitized entry field values/properties.
* @param array $entry Original $_POST global.
* @param array $form_data Form data and settings.
* @param int $entry_id Entry ID. Will return 0 if entry storage is disabled or using WPForms Lite.
public function on_success( $fields, $entry, $form_data, $entry_id ) {
if ( ! self::should_process_submission() ) {
$popup_id = self::get_popup_id();
self::increase_conversion( $popup_id );
pum_integrated_form_submission(
'form_provider' => $this->key,
'form_id' => $form_data['id'],
public function custom_scripts( $js = [] ) {
public function custom_styles( $css = [] ) {
'content' => ".pac-container { z-index: 2000000000 !important; }\n",