Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетил 16541 программист и 1688 роботов. Сейчас ищут 1573 программиста ...

Telling Pyrus how to load your plugin: <class> and <autoloadpath>

Вернуться к: Creating plugins for Pyrus

Telling Pyrus how to load your plugin: <class> and <autoloadpath>

Pyrus relies upon PHP5's autoloading capabilities to automatically load a plugin class. All plugins should include the <autoloadpath> element to specify a path relative to the php_dir location for the plugin registry. For plugin classes that conform to PEAR2 standards, the autoloadpath should be an empty string:

 <autoloadpath></autoloadpath>

The pyrus autoloader will automatically replace _ and the namespace separator \ with DIRECTORY_SEPARATOR and append .php to determine the class name to load. To instruct Pyrus to prepend a particular relative path, put this path in the <autoloadpath> element. As an example, the following XML will prompt Pyrus to load the file /home/user/.pear/MyPackage/customcommands/Command/Line/Obj.php if the user's plugins_dir is /home/user/.pear:

 <autoloadpath>MyPackage/customcommands</autoloadpath> <class>Command_Line\Obj</class>

The <class> element is used by Pyrus to determine which object to instantiate. If <class> is:

 <class>FooBar_Willy\Dilly</class>

Pyrus will instantiate an object of class FooBar_Willy\Dilly.



Вернуться к: Creating plugins for Pyrus

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware