<commit_before><?php
/**
 * WordPress Link-making Helpers
 *
 * @author <NAME> <http://maxpanas.com>
 */



/**
 * Class MOZ_Link
 *
 */
class MOZ_Link {


	/**
	 * Get the href from an
	 * acf internal/external
	 * link
	 *
	 * Note: assumes $data is an array like eg:
	 *       [
	 *         'type' => 'internal' or 'custom'
	 *         'internal' => url...
	 *         'custom' => url...
	 *       ]
	 *
	 * @param array $data
	 *
	 * @return bool
	 */
	public static function get_link_href( $data ) {
		return ( isset( $data[ $data['type'] ] ) && ! empty( $data[ $data['type'] ] ) )
			? $data[ $data['type'] ]
			: false;
	}


	/**
	 * Print the href from an
	 * acf internal/external
	 * link
	 *
	 * Note: assumes $data is an array like eg:
	 *       [
	 *         'type' => 'internal' or 'custom'
	 *         'internal' => url...
	 *         'custom' => url...
	 *       ]
	 *<commit_msg>add support for tel and email link types to MOZ_Link::get_link_href<commit_after><?php
/**
 * WordPress Link-making Helpers
 *
 * @author <NAME> <http://maxpanas.com>
 */



/**
 * Class MOZ_Link
 *
 */
class MOZ_Link {


	/**
	 * Get the href from an
	 * acf internal/external
	 * link
	 *
	 * Note: assumes $data is an array like eg:
	 *       [
	 *         'type' => 'internal' or 'custom' or 'tel' or 'email'
	 *         'internal' => url...
	 *         'custom' => url...
	 *         'tel' => text...
	 *         'email' => email...
	 *       ]
	 *
	 * @param array $data
	 *
	 * @return bool
	 */
	public static function get_link_href( $data ) {
		if ( ! isset( $data[ $data['type'] ] ) || empty( $data[ $data['type'] ] ) ){
			return false;
		}

		$href = $data[$data['type']];

		switch ( $data['type'] ) {
			case 'tel': return 'tel:' . MOZ_Utils::get_esc_tel( $href );
			case 'email': return 'mailto:' . MOZ_Utils::get_esc_email( $href );
			default: return $href;
		}
	}


	/**
	 * Print the href from an
	 * acf internal/external
	 * link
	 *
	 * Note: assumes $data is an array like eg:
	 *       [
	 *         'type' => 'internal' or 'custom' or 'tel' or 'email'
	 *         'internal' => url...
	 *         'custom' => url...
	 *         'tel' => text...
	 *         'email' => email...
	 *       ]
	 *
{'fraction_non_alphanumeric': 0.1856368563685637, 'fraction_numerical': 0.0, 'mean_word_length': 1.9183135704874836, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6702873', 'n_tokens_mistral': 835, 'n_tokens_neox': 743, 'n_words': 201}