HEX
Server: Apache/2
System: Linux server-80-13-140-150.da.direct 5.14.0-362.24.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 4 22:31:43 UTC 2024 x86_64
User: cpt (1004)
PHP: 8.1.24
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/cpt/public_html/wp-content/plugins/events-manager/multilingual/em-ml-placeholders.php
<?php
/*
 * Since translations of the original event post share certain information such as times, bookings and location, certain placeholders should be manipulated
 * when showing a translation of the event.
 * 
 * At this time, given that times etc. are copied to the translation we don't need to override anything, but you can add your own placeholders here via the 
 * em_ml_placeholders_event_placeholders filter and those placeholders will refer to the original event for data. 
 */
class EM_ML_Placeholders {

	public static $event_placeholders = array();
	
	public static function init(){
	    self::$event_placeholders = apply_filters('em_ml_placeholders_event_placeholders',self::$event_placeholders);
	    if( !empty(self::$event_placeholders) ){
	        add_filter('em_event_output_placeholder','EM_ML_Placeholders::override_placeholders',100,3); //override bookign form
	    }
	}
	
	/**
	 * Certain placeholders, specifically booking placeholders, will take information from the original event, so we generate the 
	 * @param string $replace
	 * @param EM_Event $EM_Event
	 * @param string $full_result
	 * @return string
	 */
	public static function override_placeholders($replace, $EM_Event, $full_result){
		global $em_wpml_original_events_cache;
		if( in_array($full_result, EM_ML_Placeholders::$event_placeholders) ){
			$event = EM_ML::get_original_event($EM_Event); //get the master event info, for later use
			if( $event->event_id != $EM_Event->event_id ){
			    remove_filter('em_event_output_placeholder','EM_ML_Placeholders::override_placeholders',100,3); //override bookign form
				$replace = $event->output($full_result);
			    add_filter('em_event_output_placeholder','EM_ML_Placeholders::override_placeholders',100,3); //override bookign form
			}
		}
		return $replace;
	}
}
EM_ML_Placeholders::init();