MP_Addon_Calls_IncomingCalls::get_leads_table_column( string $column_name, int|string $post_id )

Get data from lead to lead columns.


Parameters Parameters

$column_name

(string) (Required) column name

$post_id

(int|string) (Required) post ID


Top ↑

Source Source

File: calculator-calls-add-on/inc/MP_Addon_Calls_IncomingCalls.php

	public function get_leads_table_column( $column_name, $post_id ) {

		if ( MortgagePlatform::$prefix . 'record' === $column_name ) {

			$call_logs = get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_log' ) ? get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_log', true ) : null;

			if ( ! isset( $call_logs ) ) {
				return;
			}
			$calls = array();

			foreach ( $call_logs as $k => $v ) {
				if ( 'admin_call' === $k ) {
					array_push( $calls, $v );
				}
			}

			if ( empty( $calls ) ) {
				return;
			}

			echo '<div class="call_records">';
			foreach ( $calls as $call ) {
				$pattern = '/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'\".,<>?«»""‘’]))/';
				preg_match( $pattern, $call, $matches, PREG_OFFSET_CAPTURE, 0 );

				echo '<audio controls><source src="' . wp_kses( $matches[0][0] , 'post') . '" ></audio>';
			}

			echo '</div>';

		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.