mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 02:26:00 +03:00 
			
		
		
		
	Move kindToString() method from ThreadProcessor to Thread
This commit is contained in:
		
							parent
							
								
									2ba492d94f
								
							
						
					
					
						commit
						50283a0b21
					
				| @ -334,6 +334,28 @@ Class Thread { | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Return message kind name corresponding to kind code | ||||
| 	 * | ||||
| 	 * @param int $message_kind Message kind. One of the Thread::KIND_* constants | ||||
| 	 * @return string kind's full name or its shortening | ||||
| 	 */ | ||||
| 	public static function kindToString($message_kind) { | ||||
| 		$kind_names = array( | ||||
| 			Thread::KIND_USER => 'user', | ||||
| 			Thread::KIND_AGENT => 'agent', | ||||
| 			Thread::KIND_FOR_AGENT => 'hidden', | ||||
| 			Thread::KIND_INFO => 'inf', | ||||
| 			Thread::KIND_CONN => 'conn', | ||||
| 			Thread::KIND_EVENTS => 'event', | ||||
| 			Thread::KIND_AVATAR => 'avatar' | ||||
| 		); | ||||
| 		if (! array_key_exists($message_kind, $kind_names)) { | ||||
| 			return ''; | ||||
| 		} | ||||
| 		return $kind_names[$message_kind]; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Return next revision number (last revision number plus one) | ||||
| 	 * | ||||
|  | ||||
| @ -224,28 +224,6 @@ class ThreadProcessor extends RequestProcessor { | ||||
| 		return $requests; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Return message kind name corresponding to kind code | ||||
| 	 * | ||||
| 	 * @param int $message_kind Message kind. One of the Thread::KIND_* constants | ||||
| 	 * @return string kind name | ||||
| 	 */ | ||||
| 	protected function kindToString($message_kind) { | ||||
| 		$kind_names = array( | ||||
| 			Thread::KIND_USER => 'user', | ||||
| 			Thread::KIND_AGENT => 'agent', | ||||
| 			Thread::KIND_FOR_AGENT => 'hidden', | ||||
| 			Thread::KIND_INFO => 'inf', | ||||
| 			Thread::KIND_CONN => 'conn', | ||||
| 			Thread::KIND_EVENTS => 'event', | ||||
| 			Thread::KIND_AVATAR => 'avatar' | ||||
| 		); | ||||
| 		if (! array_key_exists($message_kind, $kind_names)) { | ||||
| 			return ''; | ||||
| 		} | ||||
| 		return $kind_names[$message_kind]; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Theme message to display in chat window | ||||
| 	 * | ||||
| @ -262,7 +240,7 @@ class ThreadProcessor extends RequestProcessor { | ||||
| 
 | ||||
| 		// Prepare messages fields
 | ||||
| 		$creation_date = date("H:i:s", $message['created']); | ||||
| 		$kind_name = $this->kindToString($message['ikind']); | ||||
| 		$kind_name = Thread::kindToString($message['ikind']); | ||||
| 		$sender_name = $message['tname'] | ||||
| 			? "<span class='n{$kind_name}'>" . htmlspecialchars($message['tname']) . "</span>: " | ||||
| 			: ''; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user