MP_Addon_OfflineConversions_Leads

Class MP_Addon_OfflineConversions_Leads.


Description Description

See also See also


Top ↑

Source Source

File: calculator-offline-conversions-add-on/inc/MP_Addon_OfflineConversions_Leads.php

class MP_Addon_OfflineConversions_Leads extends MP_BaseLeadSettings {


	/**
	 * Leads.
	 *
	 * @var array
	 *
	 * @since 1.0.0
	 * @access private
	 */
	private $lead;


	/**
	 * Leads constructor.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function __construct() {

		$this->lead = array(
			MortgagePlatform::$lead,
			MortgagePlatform::$abandoned_lead,
		);
	}


	/**
	 * Add lead value field.
	 *
	 * @since 1.0.0
	 * @access public
	 */
	public function add_lead_value_field() {

		add_meta_box(
			MortgagePlatform::$prefix . 'value',
			__( 'Value', 'mortgage_platform' ),
			array( $this, 'lead_input_field' ),
			$this->lead,
			'normal',
			'core'
		);
	}



	/**
	 * Save value field.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @param int|string $post_id post id
	 */
	public function save_value_field( $post_id ) {

		if ( ! isset( $_POST[ MortgagePlatform::$prefix . 'value' ] ) ) {
			return;
		}
		if ( ! wp_verify_nonce( $_POST[ MortgagePlatform::$prefix . 'leads' ], plugin_basename( __FILE__ ) ) ) {
			return;
		}
		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
			return;
		}
		if ( ! current_user_can( 'edit_post', $post_id ) ) {
			return;
		}

		$value = sanitize_text_field( $_POST[ MortgagePlatform::$prefix . 'value' ] );

		update_post_meta( $post_id, MortgagePlatform::$prefix . 'value', $value );

	}




}

Top ↑

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.