[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.119.19.18: ~ $
<?php
namespace ElementorPro\Modules\Forms\Classes;

use Elementor\Controls_Manager;
use ElementorPro\Core\Utils;
use ElementorPro\Modules\Forms\Classes\Ajax_Handler;
use ElementorPro\Modules\Forms\Classes\Form_Record;
use ElementorPro\Modules\Forms\Widgets\Form;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Akismet {

	public function __construct() {
		add_action( 'elementor/element/form/section_steps_settings/after_section_end', [ $this, 'register_settings_section' ] );
		add_action( 'elementor_pro/forms/validation', [ $this, 'validation' ], 10, 2 );
	}

	/**
	 * @param Form $form
	 */
	public function register_settings_section( $form ) {
		if ( ! $this->is_akismet_active() ) {
			return;
		}

		$form->start_controls_section(
			'section_akismet',
			[
				'label' => esc_html__( 'Akismet Spam Protection', 'elementor-pro' ),
			]
		);

		$form->add_control(
			'akismet_info',
			[
				'type' => Controls_Manager::ALERT,
				'alert_type' => 'info',
				'content' => sprintf(
					/* translators: 1: Link opening tag, 2: Link closing tag. */
					esc_html__( 'Assign shortcodes to the fields below to enable spam protection on your form. %1$sShow me how%2$s', 'elementor-pro' ),
					'<a href="http://go.elementor.com/widget-form-akismet/" target="_blank">',
					'</a>'
				),
			]
		);

		$form->add_control(
			'akismet_author',
			[
				'label' => esc_html__( 'Name', 'elementor-pro' ),
				'type' => Controls_Manager::TEXT,
				'placeholder' => 'e.g. [field id="name"]',
				'ai' => [
					'active' => false,
				],
				'label_block' => true,
				'render_type' => 'none',
			]
		);

		$form->add_control(
			'akismet_author_url',
			[
				'label' => esc_html__( 'URL', 'elementor-pro' ),
				'type' => Controls_Manager::TEXT,
				'placeholder' => 'e.g. [field id="url"]',
				'ai' => [
					'active' => false,
				],
				'label_block' => true,
				'render_type' => 'none',
			]
		);

		$form->add_control(
			'akismet_author_email',
			[
				'label' => esc_html__( 'Email', 'elementor-pro' ),
				'type' => Controls_Manager::TEXT,
				'placeholder' => 'e.g. [field id="email"]',
				'ai' => [
					'active' => false,
				],
				'label_block' => true,
				'render_type' => 'none',
			]
		);

		$form->add_control(
			'akismet_content',
			[
				'label' => esc_html__( 'Message', 'elementor-pro' ),
				'type' => Controls_Manager::TEXT,
				'placeholder' => 'e.g. [field id="message"]',
				'ai' => [
					'active' => false,
				],
				'label_block' => true,
				'render_type' => 'none',
			]
		);

		$form->end_controls_section();
	}

	private function is_akismet_active() : bool {
		$akismet_key = \Akismet::get_api_key();

		return ! empty( $akismet_key );
	}

	/**
	 * @param Form_Record  $record
	 * @param Ajax_Handler $ajax_handler
	 */
	public function validation( $record, $ajax_handler ) {
		if ( ! $this->is_akismet_active() ) {
			return;
		}

		if ( ! $this->is_spammed( $record ) ) {
			return;
		}

		$ajax_handler->add_error_message(
			esc_html__( 'We couldn’t submit your responses because they seem like spam.', 'elementor-pro' )
		);

		$ajax_handler->add_error( 'akismet', esc_html__( 'Spam detected', 'elementor-pro' ) );
	}

	private function is_spammed( Form_Record $record ) : bool {
		$settings = $record->get( 'form_settings' );

		$params = [];

		$params['comment_author'] = $this->get_parsed_content( $record, $settings['akismet_author'] );
		$params['comment_author_email'] = $this->get_parsed_content( $record, $settings['akismet_author_email'] );
		$params['comment_author_url'] = $this->get_parsed_content( $record, $settings['akismet_author_url'] );
		$params['comment_content'] = $this->get_parsed_content( $record, $settings['akismet_content'] );

		$params['blog'] = get_option( 'home' );
		$params['blog_lang'] = get_locale();
		$params['blog_charset'] = get_option( 'blog_charset' );

		$params['user_ip'] = Utils::get_client_ip();
		$params['referrer'] = wp_get_referer();

		if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
			$params['user_agent'] = sanitize_textarea_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
		}

		// http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
		$params['comment_type'] = 'contact-form';

		$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
		foreach ( $_SERVER as $key => $value ) {
			if ( ! in_array( $key, $ignore ) && is_string( $value ) ) {
				$params[ $key ] = $value;
			}
		}

		return $this->remote_check_is_spam( $params );
	}

	private function get_parsed_content( $record, $content ) {
		$setting = trim( $content );

		return $record->replace_setting_shortcodes( $setting );
	}

	private function remote_check_is_spam( $params ) {
		$response = \Akismet::http_post( _http_build_query( $params, '', '&' ), 'comment-check' );

		return ( 'true' === $response[1] );
	}
}

Filemanager

Name Type Size Permission Actions
action-base.php File 812 B 0644
activecampaign-handler.php File 3.07 KB 0644
ajax-handler.php File 8.97 KB 0644
akismet.php File 4.73 KB 0644
convertkit-handler.php File 2.61 KB 0644
drip-handler.php File 2.01 KB 0644
form-base.php File 8.17 KB 0644
form-record.php File 9.43 KB 0644
getresponse-handler.php File 3.03 KB 0644
honeypot-handler.php File 2.73 KB 0644
integration-base.php File 2.44 KB 0644
mailchimp-handler.php File 4.32 KB 0644
mailerlite-handler.php File 2.56 KB 0644
recaptcha-handler.php File 8.78 KB 0644
recaptcha-v3-handler.php File 4.55 KB 0644
rest-client.php File 4.33 KB 0644