403Webshell
Server IP : 103.88.176.108  /  Your IP : 216.73.216.211
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux webserver 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/optimole-wp/inc/v2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/optimole-wp/inc/v2/AGENTS.md
# Optimole WordPress Plugin v2 - Agent Instructions

## Dev environment tips
- Use `phpunit tests/test-srcset.php` to run srcset functionality tests.
- Use `php -l inc/v2/PageProfiler/Profile.php` to check PHP syntax before committing.
- Run `phpunit --filter="should_skip_sizes"` to test specific functionality.
- Check the namespace structure: `OptimoleWP\PageProfiler\`, `OptimoleWP\BgOptimizer\`, etc.
- Use `OPTML_DEBUG` constant for debug logging: `do_action( 'optml_log', $message )`.

## Code standards
- **CRITICAL**: All functions, methods, and classes MUST have PHPStan-compatible PHPDoc annotations.
- Always use full namespace paths: `OptimoleWP\PageProfiler\Profile`
- Use constants for device types: `Profile::DEVICE_TYPE_MOBILE` (never hardcode `1`)
- Return `WP_Error` for WordPress-compatible errors, `false` for simple failures.
- Use type hints: `string`, `int`, `bool`, `array`, `object`, union types like `string|false`.

## Testing instructions
- Find the test files in the `tests/` directory.
- Use `phpunit --filter="test_name"` to run specific tests.
- Run `php -l filename.php` to check PHP syntax before committing.
- Fix any test or syntax errors until the whole suite is green.
- Add or update tests for the code you change, even if nobody asked.

## Key components quick reference
- **PageProfiler**: `OptimoleWP\PageProfiler\Profile` - handles page profiling and device data
- **BgOptimizer**: `OptimoleWP\BgOptimizer\Lazyload` - background image lazy loading
- **Offload**: `OptimoleWP\Offload\ImageEditor` - prevents local editing of remote images
- **Preload**: `OptimoleWP\Preload\Links` - manages resource preloading

## Common patterns
- Device types: `Profile::DEVICE_TYPE_MOBILE`, `Profile::DEVICE_TYPE_DESKTOP`, `Profile::DEVICE_TYPE_GLOBAL`
- Storage: Extend `Storage\Base` and implement `store()`, `get()`, `delete()`, `delete_all()`
- Error handling: Return `WP_Error` for WordPress errors, `false` for simple failures
- Debug logging: `do_action( 'optml_log', $message )` when `OPTML_DEBUG` is true

## PR instructions
- Always run `phpunit` and `php -l` before committing
- Ensure all new code has PHPStan-compatible PHPDoc annotations
- Use full namespace paths, never hardcode device type numbers

Youez - 2016 - github.com/yon3zu
LinuXploit