403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.5/wp-content/plugins/mailchimp-for-wp/integrations/wpforms/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.5/wp-content/plugins/mailchimp-for-wp/integrations/wpforms/class-wpforms.php
<?php

defined('ABSPATH') or exit;

/**
 * Class MC4WP_WPForms_Integration
 *
 * @ignore
 */
class MC4WP_WPForms_Integration extends MC4WP_Integration
{
    /**
     * @var string
     */
    public $name = 'WPForms';

    /**
     * @var string
     */
    public $description = 'Subscribe visitors from your WPForms forms.';


    /**
     * Add hooks
     */
    public function add_hooks()
    {
        add_action('wpforms_process', [$this, 'listen_to_wpforms'], 20, 3);
    }

    /**
     * @return bool
     */
    public function is_installed()
    {
        return defined('WPFORMS_VERSION');
    }

    /**
     * @since 3.0
     * @return array
     */
    public function get_ui_elements()
    {
        return [];
    }

    public function listen_to_wpforms($fields, $entry, $form_data)
    {
        foreach ($fields as $field_id => $field) {
            if ($field['type'] === 'mailchimp' && (int) $field['value_raw'] === 1) {
                return $this->subscribe_from_wpforms($field_id, $fields, $form_data);
            }
        }
    }

    public function subscribe_from_wpforms($checkbox_field_id, $fields, $form_data)
    {
        foreach ($fields as $field) {
            if ($field['type'] === 'email') {
                $email_address = $field['value'];
            }
        }

        $field_config     = $form_data['fields'][$checkbox_field_id];
        $mailchimp_list_id = $field_config['mailchimp_list'];
        $double_optin      = isset($field_config['mailchimp_double_optin']) ? $field_config['mailchimp_double_optin'] : $this->options['double_optin'];

        // Override integration settings with per-field options
        $orig_options                  = $this->options;
        $this->options['lists']        = [$mailchimp_list_id];
        $this->options['double_optin'] = $double_optin;

        $result = false;
        if (! empty($email_address)) {
            $result = $this->subscribe(['EMAIL' => $email_address], $form_data['id']);
        }

        // Restore original options to avoid side effects
        $this->options = $orig_options;
        return $result;
    }

    /**
     * @param int $form_id
     * @return string
     */
    public function get_object_link($form_id)
    {
        return '<a href="' . admin_url(sprintf('admin.php?page=wpforms-builder&view=fields&form_id=%d', $form_id)) . '">WPForms</a>';
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit