stfkolev /
chaospelt
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | /** |
||||||
| 4 | * Abstract class, used as the core for the plugin development. |
||||||
| 5 | * |
||||||
| 6 | * PHP version 7.4 |
||||||
| 7 | * |
||||||
| 8 | * @category Facades |
||||||
| 9 | * @package Chaospelt\Kernel\Facades |
||||||
| 10 | * |
||||||
| 11 | * @author Stf Kolev <[email protected]> |
||||||
| 12 | * @license BSD-3-Clause https://opensource.org/licenses/BSD-3-Clause |
||||||
| 13 | * |
||||||
| 14 | * @link https://github.com/stfkolev/chaospelt |
||||||
| 15 | */ |
||||||
| 16 | |||||||
| 17 | namespace Chaospelt\Kernel; |
||||||
| 18 | |||||||
| 19 | use Chaospelt\Kernel\Traits\Registerable; |
||||||
| 20 | |||||||
| 21 | /** |
||||||
| 22 | * Abstract class, used as the core for the plugin development. |
||||||
| 23 | * |
||||||
| 24 | * PHP version 7.4 |
||||||
| 25 | * |
||||||
| 26 | * @category Facades |
||||||
| 27 | * @package Chaospelt\Kernel\Facades |
||||||
| 28 | * |
||||||
| 29 | * @author Stf Kolev <[email protected]> |
||||||
| 30 | * @license BSD-3-Clause https://opensource.org/licenses/BSD-3-Clause |
||||||
| 31 | * |
||||||
| 32 | * @link https://github.com/stfkolev/chaospelt |
||||||
| 33 | */ |
||||||
| 34 | abstract class Plugin |
||||||
| 35 | { |
||||||
| 36 | use Registerable; |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 37 | |||||||
| 38 | /** |
||||||
| 39 | * Registers activation and deactivation hook for the called class. |
||||||
| 40 | * |
||||||
| 41 | * @param $pluginFile - Plugin File Path. Used for proper Wordpress hooking. |
||||||
|
0 ignored issues
–
show
|
|||||||
| 42 | * |
||||||
| 43 | * @return Plugin object |
||||||
| 44 | */ |
||||||
| 45 | public function __construct($pluginFile) |
||||||
| 46 | { |
||||||
| 47 | $calledClass = get_called_class(); |
||||||
| 48 | |||||||
| 49 | register_activation_hook($pluginFile, $calledClass, 'activate'); |
||||||
|
0 ignored issues
–
show
The function
register_activation_hook was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 50 | register_deactivation_hook($pluginFile, $calledClass, 'deactivate'); |
||||||
|
0 ignored issues
–
show
The function
register_deactivation_hook was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 51 | } |
||||||
| 52 | |||||||
| 53 | /** |
||||||
| 54 | * Used for the activation hook in Wordpress. |
||||||
| 55 | * |
||||||
| 56 | * @return void |
||||||
| 57 | */ |
||||||
| 58 | abstract protected static function activate(); |
||||||
| 59 | |||||||
| 60 | /** |
||||||
| 61 | * Used for the deactivation hook in Wordpress. |
||||||
| 62 | * |
||||||
| 63 | * @return void |
||||||
| 64 | */ |
||||||
| 65 | abstract protected static function deactivate(); |
||||||
| 66 | } |
||||||
| 67 |