HEX
Server: Apache
System: Linux iad1-shared-b7-16 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: dh_3gsgvh (5795692)
PHP: 8.2.26
Disabled: NONE
Upload Files
File: /home/dh_3gsgvh/noortax.net/wp-content/plugins/financia-plugin/inc/helpers.php
<?php
/**
 * This file includes helper functions used throughout the plugins.
 *
 * @package financia Plugins
 */

if ( ! function_exists( 'financia_plugin_setting' ) ) {
	/**
	 * Get financia plugin theme mod.
	 *
	 * @param string $key           Theme Mod key.
	 * @param bool   $control_value Whether using control value or not.
	 * @param string $control_attr  Control key from $financia_customizer_settings.
	 * @return mixed
	 */
	function financia_plugin_setting( $key = '', $control_value = false, $control_attr = 'default' ) {
		global $financia_customizer_settings;

		if ( isset( $key ) && ! empty( $key ) ) {
			$default_value = isset( $financia_customizer_settings[ $key ] ) ? $financia_customizer_settings[ $key ][ $control_attr ] : '';
			$theme_mod     = get_theme_mod( $key, $default_value );
			$setting       = $control_value ? $default_value : $theme_mod;

			return empty( $setting ) ? $default_value : $setting;
		}

		/**
		 * Get all settings.
		 */
		$settings = array();

		foreach ( $financia_customizer_settings as $key => $setting ) {
			$default_value    = $setting[ $control_attr ];
			$theme_mod        = get_theme_mod( $key, $default_value );
			$setting          = $control_value ? $default_value : $theme_mod;
			$settings[ $key ] = empty( $setting ) ? $default_value : $setting;
		}

		return $settings;
	}
}