PHP 8.2.31
Preview: AtApplication.php Size: 3.14 KB
//proc/self/root/home/nshryvcy/himaltourism.com/wp-content/themes/adventure-tours/includes/classes/AtApplication.php

<?php
/**
 * Main theme component that contains different core functions related to theme.
 *
 * @author    Themedelight
 * @package   Themedelight/AdventureTours
 * @version   3.5.8
 */

class AtApplication extends TdApp
{
	public $bodyClasses = array();

	protected $_bodyClassFilterSet = false;

	/* body classes management */
	/**
	 * Adds specefined class to body.
	 * 
	 * @param string $class
	 * @return  Theme
	 */
	public function addBodyClass($class)
	{
		$this->bodyClasses[] = $class;
		if (!$this->_bodyClassFilterSet) {
			add_filter('body_class',array($this, 'bodyClassFilter'));
			$this->_bodyClassFilterSet = true;
		}
		return $this;
	}

	/**
	 * Filter for wp 'body_class' function.
	 * @param  array $classes
	 * @return array
	 */
	public function bodyClassFilter($classes)
	{
		if ($this->bodyClasses) {
			foreach ($this->bodyClasses as $class) {
				$classes[] = $class;
			}
		}
		return $classes;
	}
	/* end body classes management */

	/* custom css generation */
	public function generateCustomCss($source, array $themeMods, $saveAs = true)
	{
		$result = array();

		//fonts including [start]
		// filtergin all options that ends with "_font", this settings should contain font family settings
		$fontOptions = array();
		foreach ($themeMods as $name => $modValue) {
			if (preg_match('`\_font$`', $name)) {
				$fontOptions[$name] = $modValue;
			}
		}
		if ($fontOptions) {
			$fontManager = new TdFontsManager(array(
				'font_set' => $this->getFontSet(),
			));

			if ($fontDefinitions = $fontManager->generateDefinitions($fontOptions)) {
				foreach ($fontDefinitions as $key => $value) {
					$result['theme-font-' . $key] = $value;
				}
			}
		}
		//fonts including [end]

		$generator = new TdLessProcessor(array(
			'lessFile' => $source,
			'saveAs' => $saveAs,
			'themeBaseDir' => PARENT_DIR,
			'themeBaseUrl' => PARENT_URL,
		));
		if ($generatedElements = $generator->generateCss($themeMods, false, 'adventure-tours-style')) {
			$result = $result ? array_merge($result, $generatedElements) : $generatedElements;
		}
		return $result;
	}

	public function getStyleOptions($customizeMode = false)
	{
		//getting all theme mods
		$result = $themeMods = get_theme_mods();
		if ($customizeMode) {
			$updatedOptions = isset($_POST['customized']) ? json_decode( wp_unslash( $_POST['customized'] ), true ) : null;
			if ($updatedOptions) {
				foreach ($updatedOptions as $optionName => $value) {
					$result[$optionName] = get_theme_mod($optionName);
				}
			}
		}

		$theme_cusomizer = adventure_tours_di( 'theme_customizer' );
		$font_options = $theme_cusomizer->getFontFamilySettings();
		if ( $font_options ) {
			foreach ($font_options as $option_name ) {
				if ( ! isset( $result[$option_name] ) ) {
					$result[$option_name] = $theme_cusomizer->getFontSettingDefaults( $option_name );
				}
			}
		}

		return $result;
	}

	public function getFontSet()
	{
		static $includeCache = null;

		$fs = adventure_tours_di( 'register' )->getVar('font_set', null);
		if (!$fs) {
			if (null == $includeCache) {
				$includeCache = require PARENT_DIR . '/includes/data/font-set.php';
			}
			return $includeCache;
		}
		return $fs;
	}
	/* end custom css generation */
}

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).