PHP 8.2.31
Preview: AtBadgeService.php Size: 2.03 KB
/home/nshryvcy/himaltourism.com/wp-content/themes/adventure-tours/includes/classes/AtBadgeService.php

<?php
/**
 * Service for the tour badges rendering.
 *
 * @author    Themedelight
 * @package   Themedelight/AdventureTours
 * @version   1.0.0
 */

class AtBadgeService extends TdComponent
{
	/**
	 * Number of the available badges.
	 *
	 * @var integer
	 */
	public $count = 3;

	/**
	 * Returns badge settings for specific tour.
	 *
	 * @param  integer $tour_id
	 * @param  boolean $ignore_inactive
	 * @return assoc
	 */
	public function get_tour_badge($tour_id, $ignore_inactive = true) {
		$bid = $tour_id ? vp_metabox('tour_tabs_meta.tour_badge', null, $tour_id) : null;

		if ( $this->is_active( $bid ) ) {
			return array(
				'title' => $this->get_title( $bid ),
				'color' => $this->get_color( $bid ),
			);
		}
		return null;
	}

	/**
	 * Returns title for specific badge.
	 *
	 * @param  integer $bid
	 * @return string
	 */
	public function get_title($bid) {
		return $this->get_field( $bid, 'title' );
	}

	/**
	 * Returns color for specific badge.
	 *
	 * @param  integer $bid
	 * @return string
	 */
	public function get_color($bid) {
		return $this->get_field( $bid, 'color' );
	}

	/**
	 * Checks if specific badge is active.
	 *
	 * @param  integer $bid
	 * @return string
	 */
	public function is_active($bid) {
		return $this->get_field( $bid, 'is_active' );
	}

	/**
	 * Returns badge field value.
	 *
	 * @param  integer $bid
	 * @param  string  $field
	 * @return string
	 */
	public function get_field($bid, $field) {
		if ( $bid > 0 && $bid <= $this->count && $field ) {
			$option = "tour_badge_{$bid}_{$field}";
			return adventure_tours_get_option( $option );
		}
		return null;
	}

	/**
	 * Returns count of badges available in system.
	 *
	 * @return integer
	 */
	public function get_count() {
		return $this->count;
	}

	/**
	 * Returns set of active badges.
	 *
	 * @return array
	 */
	public function get_list() {
		static $list;

		if ( null === $list ) {
			$list = array();

			for ( $i = 1; $i <= $this->count; $i++ ) {
				if ( $this->is_active( $i ) ) {
					$list[$i] = $this->get_title( $i );
				}
			}
		}

		return $list;
	}
}

Directory Contents

Dirs: 0 × Files: 29

Name Size Perms Modified Actions
3.14 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
2.03 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
5.75 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
56.69 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
6.90 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
4.39 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
14.96 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
6.15 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
1.56 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
582 B lrw-r--r-- 2022-11-10 06:13:26
Edit Download
945 B lrw-r--r-- 2022-11-10 06:13:26
Edit Download
2.33 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
2.78 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
3.99 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
5.32 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
9.61 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
20.75 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
22.52 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
1.91 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
2.16 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
6.37 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
4.64 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
4.64 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
6.32 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
4.86 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
12.44 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
3.69 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
5.84 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download
12.11 KB lrw-r--r-- 2022-11-10 06:13:26
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).