Создание плагина для Joomla
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2102
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2435
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2451
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2456
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2461
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2467
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2479
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2496
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2497
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2498
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2499
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2517
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2518
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2519
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2520
Deprecated: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /home/clients/newman_ftp0/domains/wiki.pws.ru/html/includes/Parser.php on line 2550
Материал из Newman's WiKi.
(Различия между версиями)
Версия 12:09, 11 июня 2009 WikiSysop (Обсуждение | вклад) ← К предыдущему изменению |
Текущая версия WikiSysop (Обсуждение | вклад) (→Структура плагина) |
||
Строка 1: | Строка 1: | ||
Описание создания плагина ('''plugin''') для Joomla 1.5 | Описание создания плагина ('''plugin''') для Joomla 1.5 | ||
+ | == Типы плагинов == | ||
+ | *authentication | ||
+ | *content | ||
+ | *editors | ||
+ | *editors-xtd | ||
+ | *search | ||
+ | *system | ||
+ | *user | ||
+ | *xmlrpc | ||
+ | == Структура плагина == | ||
+ | Плагин состоит из двух файлов: файл описания в формате XML и файл PHP скрипта. Файл скрипта имеет следующую структуру: | ||
+ | === Файл описания === | ||
+ | пример для системного плагина test | ||
+ | <pre> | ||
+ | <?xml version="1.0" encoding="utf-8"?> | ||
+ | <install version="1.5.2" type="plugin" group="system" method="upgrade"> | ||
+ | <name>System - Test</name> | ||
+ | <author>Author</author> | ||
+ | <creationDate>Month 2008</creationDate> | ||
+ | <copyright>Copyright (C) 2008 Holder. All rights reserved.</copyright> | ||
+ | <license>GNU General Public License</license> | ||
+ | <authorEmail>email</authorEmail> | ||
+ | <authorUrl>url</authorUrl> | ||
+ | <version>1.0.1</version> | ||
+ | <description>A test system plugin</description> | ||
+ | <files> | ||
+ | <filename plugin="test">test.php</filename> | ||
+ | </files> | ||
+ | <params> | ||
+ | <param name="example" | ||
+ | type="text" | ||
+ | default="" | ||
+ | label="Example" | ||
+ | description="An example text parameter" /> | ||
+ | </params> | ||
+ | </install> | ||
+ | </pre> | ||
+ | === Файл скрипта === | ||
+ | приведен пример системного плагина (system) с именем файла (test.php) | ||
+ | <pre> | ||
+ | defined( '_JEXEC' ) or die( 'Restricted access' ); | ||
+ | |||
+ | jimport( 'joomla.plugin.plugin' ); | ||
+ | |||
+ | class plgSystemTest extends JPlugin | ||
+ | { | ||
+ | function plgSystemTest( &$subject, $config ) | ||
+ | { | ||
+ | parent::__construct( $subject, $config ); | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | Вся основная обработка производится в методах класса с заранее определенными именами. | ||
+ | |||
+ | == Соглашение о имени файла и имени класса == | ||
+ | Имя файла может состоять из любых символов латинского алфавита. Особое внимание следует обратить на имя класса. Оно формируется следующим образом: '''plg<Folder><Filename>''' | ||
+ | |||
+ | где '''plg''' - обязательный префикс, '''<Folder>''' - имя категории к которой относится плагин, '''<Filename>''' - имя файла плагина (без расширения) | ||
+ | |||
+ | == Методы - обработчики событий == | ||
+ | * Authentication | ||
+ | ** onAuthenticate | ||
+ | * Content | ||
+ | ** onPrepareContent | ||
+ | ** onAfterDisplayTitle | ||
+ | ** onBeforeDisplayContent | ||
+ | ** onBeforeContentSave (new in 1.5.4) | ||
+ | ** onAfterContentSave (new in 1.5.4) | ||
+ | *Editors | ||
+ | ** onInit | ||
+ | ** onGetContent | ||
+ | ** onSetContent | ||
+ | ** onSave | ||
+ | ** onDisplay | ||
+ | ** onGetInsertMethod | ||
+ | *Editors XTD (Extended) | ||
+ | ** onDisplay | ||
+ | *Search | ||
+ | ** onSearch | ||
+ | ** onSearchAreas | ||
+ | *System | ||
+ | ** onAfterInitialise | ||
+ | ** onAfterRoute | ||
+ | ** onAfterDispatch | ||
+ | ** onAfterRender | ||
+ | *User | ||
+ | ** onLoginUser | ||
+ | ** onLoginFailure | ||
+ | ** onLogoutUser | ||
+ | ** onLogoutFailure | ||
+ | ** onBeforeStoreUser | ||
+ | ** onAfterStoreUser | ||
+ | ** onBeforeDeleteUser | ||
+ | ** onAfterDeleteUser | ||
+ | *XML-RPC | ||
+ | ** onGetWebServices | ||
[[Категория:Joomla]] | [[Категория:Joomla]] |
Текущая версия
Описание создания плагина (plugin) для Joomla 1.5
Содержание |
[править]
Типы плагинов
- authentication
- content
- editors
- editors-xtd
- search
- system
- user
- xmlrpc
[править]
Структура плагина
Плагин состоит из двух файлов: файл описания в формате XML и файл PHP скрипта. Файл скрипта имеет следующую структуру:
[править]
Файл описания
пример для системного плагина test
<?xml version="1.0" encoding="utf-8"?> <install version="1.5.2" type="plugin" group="system" method="upgrade"> <name>System - Test</name> <author>Author</author> <creationDate>Month 2008</creationDate> <copyright>Copyright (C) 2008 Holder. All rights reserved.</copyright> <license>GNU General Public License</license> <authorEmail>email</authorEmail> <authorUrl>url</authorUrl> <version>1.0.1</version> <description>A test system plugin</description> <files> <filename plugin="test">test.php</filename> </files> <params> <param name="example" type="text" default="" label="Example" description="An example text parameter" /> </params> </install>
[править]
Файл скрипта
приведен пример системного плагина (system) с именем файла (test.php)
defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.plugin.plugin' ); class plgSystemTest extends JPlugin { function plgSystemTest( &$subject, $config ) { parent::__construct( $subject, $config ); } }
Вся основная обработка производится в методах класса с заранее определенными именами.
[править]
Соглашение о имени файла и имени класса
Имя файла может состоять из любых символов латинского алфавита. Особое внимание следует обратить на имя класса. Оно формируется следующим образом: plg<Folder><Filename>
где plg - обязательный префикс, <Folder> - имя категории к которой относится плагин, <Filename> - имя файла плагина (без расширения)
[править]
Методы - обработчики событий
- Authentication
- onAuthenticate
- Content
- onPrepareContent
- onAfterDisplayTitle
- onBeforeDisplayContent
- onBeforeContentSave (new in 1.5.4)
- onAfterContentSave (new in 1.5.4)
- Editors
- onInit
- onGetContent
- onSetContent
- onSave
- onDisplay
- onGetInsertMethod
- Editors XTD (Extended)
- onDisplay
- Search
- onSearch
- onSearchAreas
- System
- onAfterInitialise
- onAfterRoute
- onAfterDispatch
- onAfterRender
- User
- onLoginUser
- onLoginFailure
- onLogoutUser
- onLogoutFailure
- onBeforeStoreUser
- onAfterStoreUser
- onBeforeDeleteUser
- onAfterDeleteUser
- XML-RPC
- onGetWebServices