Plugins class

The following sections explain each method of the class.

hooks


public static mixed hooks( string $position, string $classes, string $methode, array $args = array())

Gets the method hookShow and hookCall on.

Parameter list
position

Is designed in a way to uniquely identify. Where is integrated the plugin. Here are 2 classes constants are available which can be set.

  • BEFORE - Start
  • AFTER - Finish

classes

In the class of the plugin is called. It is sufficient to class name without specifying namespace.

methode

In the method used in the class, the plugin is called. Here, only the method name without specifying parameters.

args

The parameters to be transmitted to the plugin function. It is important that this is an associative array.

An example might look like this:


<?php
class testClass
{
	public function testMethode($testArgs)
	{
		\package\core\plugins::hooks(\package\core\plugins::BEFORE, 'testClass', 'testMethode', $testArgs);

		//My PHP Code

		\package\core\plugins::hooks(\package\core\plugins::AFTER, 'testClass', 'testMethode', $testArgs);

		return $result;
	}
}
?>

The plugin would then look like this:


<?php
class myPlugin
{
	public function before_testClass_testMethode_show($testArgs)
	{
		//No return
	}

	public function before_testClass_testMethode_call($testArgs)
	{
		return $return;
	}

	public function after_testClass_testMethode_show($testArgs)
	{
		//No return
	}

	public function after_testClass_testMethode_call($testArgs)
	{
		return $return;
	}
}
?>


hookShow


public static void hookShow( string $position, string $classes, string $methode, array $args = array())

Invokes a plug and transmitted data. The plugin must not have a return value. If it still should have one, it is ignored.

Parameter list
position

At which position the method of hook call takes place. BEFORE and AFTER are allowed.

classes

The name of the class is where the hook called. Without namespace.

methode

The method where the hook is called. Without parameters.

args

An associative array of data as a parameter for the executed Plugin.

hookCall


public static mixed hookCall( string $position, string $classes, string $methode, array $args = array())

Gets a hook and returns the result. The result may not null be. Otherwise, it is considered a failed call.

Parameter list
position

The position calling the hooks in the class. Permits are BEFORE and AFTER

classes

The class name is where the hook is called in the method. Without namespace.

methode

The method name is where the hook called. Without parameters.

args

The parameters to be transmitted to the hook. This should be an associative array.


hookTemplate


public static mixed hookTemplate( string $template, string $position, array $args = array())

A hook for template output. Here, the parameters to other methods differ only slightly.

Parameter list
template

The name of the template in which the hook is called.

position

The position of the template. Here are predefined no fixed terms.

args

Parameters that are transmitted to the hook. This should be an associative array.