=== WPGear Debugger ===
Contributors: WPGear
Donate link: https://wpgear.xyz
Tags: debug, debugger
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 5.4
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Stable tag: 1.8

Debug System.

== Description ==
Tool for detailed viewing the processes of performing PHP Scripts Plugins and Themes.

= Futured =
- It is easy to embed in any PHP scripts.
- Easy control.
- Any number of Processes.
- Detailing for each Variable or Object whose values you need to know.
	(Time Stamp, Process name, Function name, Line in the file)
- Selection of Processes for research.
- General stream Process.
- Write the Log in Files for each of the Processes.
- Files tagged Time Stamp.
- Individual Files for each User.
- General statistics of files.
- Remote Control. Remotely remove the Log from the current Date for a specific Data Source. (Use: www.yoursite.com?clear_debug=NameSource)

== Installation ==
Normal automatic installation.

1. Upload.
2. Activate.
3. Enjoy. Go to Settings: WPGear Debugger. Set up the options you need.
4. If you have any problems - please ask for support. 

== Frequently Asked Questions ==
What needs to be done to start using it?

	1. The name of the Data Source.
	Each Plugin or Theme that you want to explore is a Source of Data. Come up with a meaningful Name for him.
	For example: plugin "Hello Dolly" (Sample of the plugin "Hello Dolly" with all working examples can be found in the "sample" folder, File: "hello.txt"):	
		
	Let's call the Data Source: "Hello_Dolly". All Log Processes of this Data Source will contain the "Hello_Dolly" label.
	
	2. Add a function for Debugger.
	You need to insert into the main file of the plugin under explore - a small Function with a unique name for each Source.
	(And if this is a Theme, then insert into the functions.php file)
	For our example, the plugin "Hello Dolly", add the function: "Hellodolly_debugger".
	We will set the invented Name of the Source:
	
		$Source = 'Hello_Dolly';
	
	This is how it looks:
	
	/* Debugger. 
	----------------------------------------------------------------- */
	function HelloDolly_Debugger ($Content, $Subject = null, $Process = null, $Function = '', $Line = '') {
		if (function_exists( 'WPGear_Debugger' )) {
			$Source = 'Hello_Dolly';
			$Description = 'Plugin: Hello_Dolly';
			
			$TimeStamp = true;
			
			$Parameters = array(
				'source' => $Source,
				'description' => $Description,
				'content' => $Content,
				'subject' => esc_html( $Subject ),
				'process' => esc_html( $Process ),
				'function' => esc_html( $Function ),
				'timestamp' => $TimeStamp,
				'line' => esc_html( $Line ),
			);
			
			WPGear_Debugger ($Parameters);
		}
	}
	
	3. Add the Name of the Process.
	In each Function, you can add different meaningful Names of Processes.
	For example, for the Function: "Hello_Dolly ()" from the plugin "Hello Dolly":
	
		$debug_process = 'get_random_sublyric';
		
	4. Add control points.
	For each Variable, the Value of which we need to track (for example: $chosen), we need to add the call of Debugger Function on the new line.
	
		HelloDolly_Debugger ($chosen, '$chosen', $debug_process, __FUNCTION__, __LINE__);
		
	This is how it looks like an example of the Function "Hello_Dolly ()" for plugin "Hello Dolly":
	
	function hello_dolly() {
		$debug_process = 'get_random_sublyric';
		
		$chosen = hello_dolly_get_lyric();
		HelloDolly_Debugger ($chosen, '$chosen', $debug_process, __FUNCTION__, __LINE__);
		
		$lang   = '';
		if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
			$lang = ' lang="en"';
		}

		printf(
			'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
			__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
			$lang,
			$chosen
		);
	}	
	
	5. The result
	This is what will be written in the file "/wp-content/uploads/wpgear_debugger/hello_dolly/2025.02.27-2_hello_dolly.get_random_sublyric":
	
	---- 2025.02.27 17:21:48 ---- 
	"get_random_sublyric", "hello_dolly", Line:58
	$chosen: 'I can tell, Dolly'	
	

== Screenshots ==
1. screenshot-1.png Admin page "Settings".

== Changelog ==
= 1.8 =
	2025.10.10
	* Fix Options Save.
	
= 1.7 =
	2025.10.01
	* Fix Options Save if All Not Selected.

= 1.6 =
	2025.04.22
	* Tested to WP: 6.8.2
	* Fix "Translation loading was triggered too early"

= 1.5 =
	2025.03.14
	* Add "Description" to List of Source.
	
= 1.4 =
	2025.03.14
	* Add Options "Delete Sources if Unused".
	
= 1.3 =
	2025.03.14
	* Change Options Structure. Separate each Source.
	
= 1.2 =
	2025.03.12
	* Add Option "Enable Remote Control".
	
= 1.1 =
	2025.03.12
	* Add Remote Command to Clear Log-Files on Source Debug. Use: www.yoursite.com?clear=NameSource
	* Fix FileName txt Extention.

= 1.0 =
	2025.02.28
	* Initial release
	