--=REKLAMA=--

Adaptacja do Joomla 1.5 rozszerzeń napisanych dla Joomla 1.0

Z Joomla!WikiPL

Ikona przetlumacz.png
 Uwaga o zawartości

Ta strona wymaga przetłumaczenia lub jest w trakcie tłumaczenia! Pomoc jest mile widziana. Ostatnio edytowane przez Zwiastun (dyskusja. Data edycji: Thu, 07 Jan 2010 14:08:33 +0000

Dostosowanie rozszerzeń napisanych dla Joomla 1.0 do Joomla 1.5

//To jest pierwszy szkic... Proszę, uzupełniaj bądź komentuj, o co jeszcze uzupełnić .../

Chociaż Joomla 1.5 został zaprojektowany z zachowaniem reguł zgodności wstecznej z Joomla 1.0, jest nieco elementów, które nie są zgodne wstecz i wymagają niewielkich adaptacji. Celem tego dokumentu jest przedstawić zmiany, które muszą być wprowadzone w rozszerzeniach projektowanych dla Joomla 1.0, aby można z nich korzystać w Joomla 1.5.

Komponenty

Global scope

For security enhancement reasons and better encapsulation reasons, the components are not anymore just included from the main index.php, but called from a function. Thus their variables scope is not the global scope anymore. This means that variables created in the main part of a component, which are not declared as "global" before creation belong to the component's main execution, and are not accessible as global from the components functions. The adaptation is trivial: just add one line in the begin of the component: "global ...." enumerating the global variables of the component.

Adaptacja jest trywialnie prosta: wystarczy dodać jedną linię rozpoczynającą komponent: "global" z wyliczeniem globalnych zmiennych komponentu


Request/Post parameters

By default URL parameters are not translated anymore into globals of same name, but should be accessed the standard way. Here too, the change is trivial: instead of looking directly at for instance at $form, do first a:

 $form = mosGetParam( $_REQUEST, 'reportform');
 $form = JRequest::getVar('reportform');

This will prevent SQL injection attacks by the way, as both mosGetParam and JRequest escape the variables for malicious SQL code.

Start of changes in ACL

The tables structure of the used phpGACL has changed slightly, due to an update to latest phpGACL. The $acl->.... methods remain backwards compatible, so components which do not access ACL tables wildly are ok. Please report incompatibilities, so they can be fixed in the core.

Moduły

Moduły wymagają podobnych zmian, jak komponenty oraz dodatkowo:

Ścieżka modułów

Każdy moduł umieszczany jest w odrębnym własnym podkatalogu, jak komponenty, co ma szczególne znaczenie w przypadku, gdy korzystają z grafik lub innych plików.

Dodatki Joomla (poprzednio: boty, mamboty)

Zmiana nazwy

Mamboty (mambots) zostały przemianowane na dodatki (wtyczki - ang. plugins) i zostaly umieszczone w katalogu nazwanym /plugins \\ This remark applies on content plugins vs content mambots\\ \\

    • Uwaga #1**\\

Accordingly with general Joomla changes the old way for deny access for external direct call :\\ \\ \\

defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

\\

defined( '_JEXEC' ) or die( 'Restricted access' );

\\

    • Uwaga #2**\\

Rejestracja zdarzeń\\

\\

$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMybot' );
\\


\\

$mainframe->registerEvent( 'onPrepareContent', 'botMybot' );
\\
\\ 


    • Uwaga #3**\\

A new core class was developed for helping us to manage plugins, this class is JPluginHelper.\\

Może być użyte (na przykład) by dowiedzieć się czy plugin został opublikowany czy też nie. \\

$plugin =& JPluginHelper::getPlugin('content', 'mybot');
if (!$plugin->published){ 
 //plugin not published 
}else  { 
  //plugin published 
}
\\

\\

    • Uwaga #4**\\

A new core class was developed for helping us to manage plugins ,this class is JParameter.\\

It can be used to know plugins paramaters here is an example:\\ \\

$pluginParams = new JParameter( $plugin->params );

\\ Please note that we pass at the constructor the data of instace prevoiusly declared at remark #3 and the we can manage the plugins paramater, for example we assume that the Mybot Plugin have 3 parameter : P1,P2,P3 so retriving paramater values is easy ,

$pluginParams->def( 'P1', 0 );

Inne zmiany

__There is another section covering the joomla plugins... link?__

Here is one: [Community builder in 1.5 legacy mode, while preserving compatibility to Joomla 1.0 and Mambo 4.5.x]


Do strony startowej

Dziękujemy za wkład

» Stefan Wajda [zwiastun],