Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33.7
Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system
Directory :  /nas/content/live/attorneyexperi/wp-content/plugins/duplicate-post/src/ui/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /nas/content/live/attorneyexperi/wp-content/plugins/duplicate-post/src/ui/newsletter.php
<?php

namespace Yoast\WP\Duplicate_Post\UI;

/**
 * Newsletter class.
 */
class Newsletter {

	/**
	 * Renders the newsletter signup form.
	 *
	 * @return string The HTML of the newsletter signup form (escaped).
	 */
	public static function newsletter_signup_form() {

		$newsletter_form_response = self::newsletter_handle_form();


		$copy = \sprintf(
		/* translators: 1: Yoast */
			\esc_html__(
				'If you want to stay up to date about all the exciting developments around Duplicate Post, subscribe to the %1$s newsletter!',
				'duplicate-post'
			),
			'Yoast'
		);

		$email_label = \esc_html__( 'Email address', 'duplicate-post' );

		$copy_privacy_policy = \sprintf(
			/* translators: %1$s and %2$s are replaced by opening and closing anchor tags. */
			\esc_html__(
				'Yoast respects your privacy. Read %1$sour privacy policy%2$s on how we handle your personal information.',
				'duplicate-post'
			),
			'<a href="https://yoa.st/4jf" target="_blank">',
			'</a>'
		);

		$response_html = '';
		if ( \is_array( $newsletter_form_response ) ) {
			$response_status  = $newsletter_form_response['status'];
			$response_message = $newsletter_form_response['message'];

			$response_html = '<div class="newsletter-response-' . $response_status . ' clear" id="newsletter-response" style="margin-top: 6px;">' . $response_message . '</div>';
		}

		$html = '
		<!-- Begin Newsletter Signup Form -->
		<form method="post" id="newsletter-subscribe-form" name="newsletter-subscribe-form" novalidate>
		' . \wp_nonce_field( 'newsletter', 'newsletter_nonce' ) . '
		<p>' . $copy . '</p>
		<div class="newsletter-field-group" style="display: flex; flex-direction: column">
			<label for="newsletter-email" style="margin: 0 0 4px 0;"><strong>' . $email_label . '</strong></label>
			<div>
				<input type="email" value="" name="EMAIL" class="required email" id="newsletter-email" style="margin-right: 4px;">
				<input type="submit" value="' . \esc_attr__( 'Subscribe', 'duplicate-post' ) . '" name="subscribe" id="newsletter-subscribe" class="button">
			</div>
			<p style="font-size: 10px;">' . $copy_privacy_policy . '</p>
		</div>
		' . $response_html . '
		</form>
		<!--End Newsletter Signup Form-->
		';

		return $html;
	}

	/**
	 * Handles and validates Newsletter form.
	 *
	 * @return array|null
	 */
	private static function newsletter_handle_form() {

		//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Already sanitized.
		if ( isset( $_POST['newsletter_nonce'] ) && ! \wp_verify_nonce( \wp_unslash( $_POST['newsletter_nonce'] ), 'newsletter' ) ) {
			return [
				'status'    => 'error',
				'message'   => \esc_html__( 'Something went wrong. Please try again later.', 'duplicate-post' ),
			];
		}

		$email = null;
		if ( isset( $_POST['EMAIL'] ) ) {
			$email = \sanitize_email( \wp_unslash( $_POST['EMAIL'] ) );
		}

		if ( $email === null ) {
			return null;
		}

		if ( ! \is_email( $email ) ) {
			return [
				'status'    => 'error',
				'message'   => \esc_html__( 'Please enter valid e-mail address.', 'duplicate-post' ),
			];
		}

		return self::newsletter_subscribe_to_mailblue( $email );
	}

	/**
	 * Handles subscription request and provides feedback response.
	 *
	 * @param string $email Subscriber email.
	 *
	 * @return array Feedback response.
	 */
	private static function newsletter_subscribe_to_mailblue( $email ) {
		$response = \wp_remote_post(
			'https://my.yoast.com/api/Mailing-list/subscribe',
			[
				'method'      => 'POST',
				'body'        => [
					'customerDetails' => [
						'email'     => $email,
						'firstName' => '',
					],
					'list'            => 'Yoast newsletter',
				],
			]
		);

		$wp_remote_retrieve_response_code = \wp_remote_retrieve_response_code( $response );

		if ( $wp_remote_retrieve_response_code <= 200 || $wp_remote_retrieve_response_code >= 300 ) {
			return [
				'status'    => 'error',
				'message'   => \esc_html__( 'Something went wrong. Please try again later.', 'duplicate-post' ),
			];
		}

		return [
			'status'    => 'success',
			'message'   => \esc_html__( 'You have successfully subscribed to the newsletter. Please check your inbox.', 'duplicate-post' ),
		];
	}
}

Spamworldpro Mini