HEX
Server: LiteSpeed
System: Linux cms560.hostnegar.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: ngbycoco (1137)
PHP: 8.2.29
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, mail
Upload Files
File: /home/ngbycoco/www/wp-content/themes/enfold/framework/php/class-accessibility.php
<?php
namespace aviaFramework;

/**
 * Helper class that implements fuctions to support accessibilty
 *
 * @author guenter
 * @since 6.0
 */
if( ! defined( 'ABSPATH' ) ) { exit; }

if( ! class_exists( __NAMESPACE__ . '\accessibility', false ) )
{
	class accessibility
	{
		/**
		 * Holds the instance of this class
		 *
		 * @since 6.0
		 * @var aviaFramework\accessibility
		 */
		static private $_instance = null;

		/**
		 * Return the instance of this class
		 *
		 * @since 6.0
		 * @return aviaFramework\accessibility
		 */
		static public function instance()
		{
			if( is_null( accessibility::$_instance ) )
			{
				accessibility::$_instance = new accessibility();
			}

			return accessibility::$_instance;
		}

		/**
		 * @since 6.0
		 */
		protected function __construct()
		{

		}

		/**
		 * Returns markup for screenreader to ignore heading when empty
		 *
		 * @link https://kriesi.at/support/topic/accessibility-compliance-of-forms-and-tab-elements-in-the-enfold-theme/#post-1443669
		 * @since 6.0
		 * @param string $content
		 * @param string $heading_tag
		 * @param string $quote
		 * @return string
		 */
		public function heading_markup( $content, $heading_tag, $quote = '"' )
		{
			if( ! empty( $content ) )
			{
				return '';
			}

			if( ! in_array( $heading_tag, [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ] ) )
			{
				return '';
			}

			if( ! in_array( $quote, [ '"', "'" ] ) )
			{
				$quote = '"';
			}

			return $quote == '"' ? 'aria-hidden="true" tabindex="-1"' : "aria-hidden='true' tabindex='-1'";
		}
	}

	/**
	 * Returns the main instance of aviaFramework\accessibility to prevent the need to use globals
	 *
	 * @since 6.0
	 * @return aviaFramework\accessibility
	 */
	function Accessibility()
	{
		return accessibility::instance();
	}

}