# propertyhive/2.2.5/includes/class-ph-text-substitution.php

Property Hive, version 2.2.5. 43 lines.

- Page: https://pluginprobe.com/plugins/propertyhive/2.2.5/code/includes/class-ph-text-substitution.php
- Raw: https://pluginprobe.com/plugins/propertyhive/2.2.5/raw/includes/class-ph-text-substitution.php
- Modified: 2026-04-14T12:48:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/propertyhive/2.2.5/code/includes/class-ph-text-substitution.php#L10-L20`.

```php
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class PH_Text_Substitution {

	public function __construct() {

		$current_settings = get_option( 'propertyhive_template_assistant', array() );

		if ( isset($current_settings['text_translations']) && is_array($current_settings['text_translations']) && !empty($current_settings['text_translations']) )
        {
			add_filter( 'gettext', array( $this, 'do_text_translation'), 20, 3 );
		}
	}

	public function do_text_translation( $translated_text, $text, $domain )
    {
    	if ( $domain != 'propertyhive' )
    	{
    		return $translated_text;
    	}

    	$current_settings = get_option( 'propertyhive_template_assistant', array() );

    	if ( isset($current_settings['text_translations']) && is_array($current_settings['text_translations']) && !empty($current_settings['text_translations']) )
        {
	        foreach ( $current_settings['text_translations'] as $text_translation )
	        {
	            if ( isset($text_translation['search']) && $text_translation['search'] == $translated_text )
	            {
	                $translated_text = $text_translation['replace'];
	            }
	        }
	    }

        return $translated_text;
    }
}

new PH_Text_Substitution();
```
