HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/mm.paycheckc.com/vendor/electrolinux/phpquery/wiki/PluginsServerSide.md
If you need to write plugin only for simple task, write a **script** using ScriptsPlugin.

## Using plugins
Plugins are loaded using **plugin** method from phpQueryObject or phpQuery static namespace.
```
// all calls to plugin below are equal
phpQuery::plugin('example')
phpQuery::plugin('example', 'example.php')
pq('ul')->plugin('example')
pq('ul')->plugin('example', 'example.php')
```
## Writing plugins
Plugin consist from 2 classes - first extending **phpQueryObjects** (result of pq(); function) and second, extending static **phpQuery::$plugins** namespace. Plugin classes are never intialized, just method calls are forwarded in static way from phpQuery.

#### Extending phpQueryObject
```
/**
 * phpQuery plugin class extending phpQuery object.
 * Methods from this class are callable on every phpQuery object.
 *
 * Class name prefix 'phpQueryObjectPlugin_' must be preserved.
 */
abstract class phpQueryObjectPlugin_example {
	/**
	 * Limit binded methods.
	 *
	 * null means all public.
	 * array means only specified ones.
	 *
	 * @var array|null
	 */
	public static $phpQueryMethods = null;
	/**
	 * Enter description here...
	 *
	 * @param phpQueryObject $self
	 */
	public static function example($self, $arg1) {
		// this method can be called on any phpQuery object, like this:
		// pq('div')->example('$arg1 Value')

		// do something
		$self->append('Im just an example !');
		// change stack of result object
		return $self->find('div');
	}
	protected static function helperFunction() {
		// this method WONT be avaible as phpQuery method,
		// because it isn't publicly callable
	}
}
```
#### Extending phpQuery
```
/**
 * phpQuery plugin class extending phpQuery static namespace.
 * Methods from this class are callable as follows:
 * phpQuery::$plugins->staticMethod()
 *
 * Class name prefix 'phpQueryPlugin_' must be preserved.
 */
abstract class phpQueryPlugin_example {
	/**
	 * Limit binded methods.
	 *
	 * null means all public.
	 * array means only specified ones.
	 *
	 * @var array|null
	 */
	public static $phpQueryMethods = null;
	public static function staticMethod() {
		// this method can be called within phpQuery class namespace, like this:
		// phpQuery::$plugins->staticMethod()
	}
}
```