LLMS_SendWP::output_js()

Output some quick and dirty inline JS.


Return Return

(void)


Top ↑

Source Source

File: includes/admin/class-llms-sendwp.php

	public function output_js() {

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

		?>
		<script>
			jQuery( '#llms-sendwp-connect' ).on( 'click', function( e ) {

				e.preventDefault();

				LLMS.Spinner.start( jQuery( this ), 'small' );

				var data = {
					action: 'llms_sendwp_remote_install',
					_llms_sendwp_nonce: '<?php echo wp_create_nonce( 'llms-sendwp-install' ); ?>',
				};

				window.llms.emailConnectors.remoteInstall( jQuery( this ), data, function( res ) {

					window.llms.emailConnectors.registerClient( res.register_url, {
						client_name: res.client_name,
						client_secret: res.client_secret,
						client_redirect: res.client_redirect,
						partner_id: res.partner_id,
					} );

				} );

			} );
		</script>
		<?php

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.40.0 Refactored to utilize window.llms.emailConnectors.
3.37.0 Add nonce and replace references to $ with jQuery.
3.36.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.