Skip to content
You are here: Home arrow SOBI2 arrow Plugin Interface
Plugin Interface of SOBI2
Plugin Files
  Front-end Plugin Files
  Back-end Plugin Files
Installation Files

Plugin Files


Front-end plugin files


Plugin initialization file "myplugin_init.php"

Front-end initialization file example syntax:

<?php  
/* Frontend initialization file example syntax: */
/* Very important */
defined( '_VALID_MOS' ) or die( 'Restricted access' );
 
global $config;
/* here a language file can be included */
if (file_exists("{$config->S2_pluginsPath}/myplugin/{$config->sobi2Language}.php"))
{
  require_once("{$config->S2_pluginsPath}/myplugin/{$config->sobi2Language}.php" );
}
else {
    require_once("{$config->S2_pluginsPath}/myplugin/english.php" );
}
 
/* include class definition */
require_once("{$config->S2_pluginsPath}/myplugin/myplugin.class.php");
 
/* create an object */
$sobi_myplugin = new sobi_myplugin();
/* put the object to the plugins array */
/* $plugin->name_id is defined in sobi2.php */
$config->S2_plugins[$plugin->name_id] = $sobi_myplugin;
?>

Plugin class definition file "myplugin.class.php"

The plugin object has to define the following methods and attributes:

Attributes:

string $name - in front-end displayed name of the plugin. Can be null.
string $listingStyle - CSS class name for displaying the plugin in the category view. Can be null.

Methods:

void onSobiStart ()

Function which will be executed after start of SOBI2 component.

boolean customTask (string $sobi2Task)

Gets sobi2Task as argument.

Function to execute different operations. This method is called every time a sobi2Task doesn't belong to any SOBI2 actions. That means, if SOBI2 is called for example like "index2.php?option=com_sobi2&sobi2Task=top_rated", SOBI2 will ask all plugins if they have an action for the task "top_rated". If your plugin has an action for this task, it has to return "true" in this case.

Example:

function customTask($sobi2Task) {
    switch($sobi2Task) {
    case "top_rated":
      doSomething();
      $ret = true;
      break;
    default:
      $ret = false;
      break;
  }
  return $ret;
}

void Main ()

(Deprecated, use customTask() instead)

Function to execute different operations. This method is called every time like this "index2.php?option=com_sobi2&sobi2Task=pluginMain&S_plugin=myplugin&..."

string showDetails (string $sobi2Id)

Gets id of the entry as argument.

Will be called in details view. Has to return what you want to display as a string. If you don't want to show anything there, this function should return null.

string showListing (int $sobi2Id)

Gets id of the entry as argument.

Will be called in category view. Has to return what you want to display as a string. If you don't want to show anything there, this function should return null.

string editForm (string $sobi2Id)

Gets id of the entry as argument.

Will be called in the new/edit entry function within the existing form. Has to return what you want to display as a string. If you don't need to show anything there, this function should return null.

array save (array $input, int $sobi2Id)
array update (array $input, int $sobi2Id)

These both functions are identical. But the first will be called on saving a new entry, and the second on updating (edit) an entry. The first argument is an array with two fields:

array $input['msg']
Gets the message which will be displayed after saving/updating. You can add your own message or change it.
array $input['fees']

Contains the array with selected non free options. You can add something to this array if your plugin provides also some non free options like this:

$input['fees'] += array("Fees for myplugin option" => 10);

This function has always to return the $input array, even if your plugin doesn't use it.

void onSearchStart (string &$searchString, string &$phrase, array &$dropListsArray)

This method will be executed after the user starts the search function. In this moment the drop down boxes are already created.

string &$searchString
Reference to the string to search. If the search function has started at first time, this string is empty.
string &$phrase
Reference to the phrase. The part of search function which said "Search For All" or "Search For Any" or "Search For Exact"
array &$dropListsArray
Reference to the array with all drop down boxes. This array is build like this $dropListsArray[label to display] => mosHTML::selectList

void onSearchResult (array &$items, array &$dataForFields, string &$pluginsOutput)

This method will be executed after the search has been executed and before the results are displayed. So this function allows to modify the search results.

array &$items
Reference to the array with all found entries using the basic SOBI2 search function. Here you can add own results, or remove some others.
array &$dataForFields
Reference to the array with selected options for the drop down boxes. All values within this array will be added to the url for the page navigation. So if you want to transfer some values to the next search page, you should add them to this array. This array is build up like the $dataForFields[name] => value.
string &$pluginsOutput
Reference to string with custom plugin output.

void onPaymentScreen ()

This function will be executed on the payment screen if the user chooses some not free options. The output will be shown after the "Bank Transfer" and "PayPal" payment methods.

void onPaymentMailUser (string &$mailTitle, string &$mailMsg, string &$email)

This function can modify the content of the payment email to the user.

string &$mailTitle
Reference to email title
string &$mailMsg
Reference to email content
string &$email
Reference to email address of the user

void onPaymentMailAdmin (string &$AdmMailTitle, string &$AdmMailMsg, 
         string &$AdmEmail, string &$AdmEmail)

This function can modify the content of the payment email to the admin.

string &$AdmMailTitle
Reference to email title
string &$AdmMailMsg
Reference to email content
string &$AdmEmail
Reference to email address of the admin

string replaceMarkers (string $string)

This function will be called every time before an email will be send. Gets the string with the email template as argument. You can search for and replace your self defined place holders. This function has always to return the string with the template, even if your plugin doesn't use it.


Back-end plugin files


Plugin initialization file "admin.myplugin_init.php"

Backend initialization file example syntax:

<?php
/* Backend initialization file example syntax: */
/* Very important */
defined( '_VALID_MOS' ) or die( 'Restricted access' );
 
global $config;
/* include class definition */
require_once("{$config->S2_pluginsAdmPath}/myplugin/admin.myplugin.class.php");
 
/* here a language file can be included */
if (file_exists("{$config->S2_pluginsPath}/myplugin/{$config->sobi2Language}.php")) 
{
  require_once("{$config->S2_pluginsPath}/myplugin/{$config->sobi2Language}.php" );
}
else {
   require_once("{$config->S2_pluginsPath}/myplugin/english.php" );
}
  
/* create an object */
$sobi_myplugin_adm = new sobi_myplugin_adm();
/* put the object to the plugins array */
/* $plugin->name_id is defined in admin.sobi2.php */
$config->S2_plugins[$plugin->name_id] = $sobi_myplugin_adm;
?>

Plugin class definition file "admin.myplugin.class.php"

The plugin object has to define the same methods and attributes like the front-end object so it is good idea that the back-end class is derived from the front-end class (extends the class). Additionally this object has to define the following methods:

void config ()

This function should display inline the configuration menu for the plugin. It will be displayed whthin a "<form>" tag, so you don't have to care about it. Also the save button will be shown. After click on the "save" button the function saveConfig() will be called.

void saveConfig ()

This function should be used to save the configuration settings of the plugin.



Installation Files


XML installation file "myplugin.xml"

File example syntax:

<?xml version="1.0" encoding="UTF-8"?>
<sobi2plugin>
<!-- Few standard information -->
<name>myplugin</name>
<nameId>myplugin_id</nameId>
<description>description of myplugin</description>
<author>You</author>
<authorEmail>info[at]server.com</authorEmail>
<authorUrl>www.server.com</authorUrl>
<creationDate>October 2006</creationDate>
<copyright>(C) 2006 You</copyright>
<license>www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<version>Version Number</version>
 
<!-- Name of initialization file for backend -->
<initFile>myplugin_init.php</initFile>
<!-- All files you want to copy -->  
<!-- Please take notice: 
through the XML installer file, files are copied only to the root.
It will not create any sub directories. If you need to have sub directories 
you have to use the install.php file to create them -->
<files>
<frontend>
<file>myplugin.class.php</file>
<file>myplugin_init.php</file>
<file>file.js</file>
<file>myplugin.css</file>
<file>germani.php</file>
<file>germanf.php</file>
<file>english.php</file>
</frontend>
<backend>
<file>admin.myplugin.class.php</file>
<file>admin.myplugin_init.php</file>
<file>install.php</file>
</backend>
</files>
 
<!-- Database queries -->
<queries>
<!-- The name `#__myplugin` will be replaced with something like 
`jos_sobi2_plugin_myplugin` -->
 
<query table="myplugin">
CREATE TABLE `#__myplugin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`itemid` int(11) NOT NULL default '0',
`something` varchar(30) default NULL,
`somethingElse` varchar(30) default NULL,
PRIMARY KEY (`imgid`));
</query>
<query>INSERT IGNORE INTO 
    `#__sobi2_config` VALUES ('something', '1', 'myplugin', NULL);</query>
<query>INSERT IGNORE INTO 
    `#__sobi2_config` VALUES ('somethingElse', '10', 'myplugin', NULL);</query>
</queries>
</sobi2plugin>

PHP installation file "install.php"

This file will be called (if exists) at last of the installation process. It could be used for some additional operations, like copying some files, creating directories or something else.

Package File

The package file has to be a ZIP file. It has to be named exactly as the XML file (myplugin.xml, myplugin.zip). All files within the package are always extracted to the directory: /administrator/components/com_sobi2/includes/install/myplugin/


Digg!Del.icio.us!Google!Facebook!Slashdot!Netscape!Technorati!Yahoo!Ma.gnolia!
 

User Feedback

Awesome - Monday, 03 December 2007

Holy , this is one of the best J! components on the market - and this for free !
Its a kind of complex but easy to use directory software and fits a wide range of possibilities.
Superb and quick Support via Forum. Rich and useful plugins (Some are commercial). Give it a try and you'll love it...

 
Respect - Wednesday, 14 November 2007

This component is the best free Joomla component. SOBI2 has a framework for endless possibilities. This is the heven for every good developer.
I recommend to every person wanting to build a professional directory. Respect for the developers for the great component and for the best (and free) support I ever seen.

 
1st Class component - Monday, 12 November 2007

Fabulous and offers extras that I hadn´t even thought of using until I saw them.
I´m a Joomla! webmaster novice with only a few months experience and this was simple to install, easy to configure (and the options are multiple and useful) and I think looks great too.

 
Long time user - Thursday, 08 November 2007

What can be said this has to be the most used component on Joomla. If not a very close second :) The community is great, the dev team actually continues to work hard on the project and making changes. I sure hope Joomla is smart enough to change the GPL otherwise we will loose a wonderful component soon.
Oh yeah and its FREE what else can I say!

 
Excellent Directory Component - Tuesday, 30 October 2007

I have played with this component on and off for some time. The latest version is great. Added a couple of thing including the Alpha Index which on a larger directory I think is important. The Captcha code is handy too. The admin is also greatly improved.

 
Free, professional, many functions - Sunday, 07 October 2007

I finally took the moment to register myself here, only to review and rate Sobi2. In the beginning i was lost with this component, so many options!! Taking a moment to read the Sobi2 Wiki, and with the great and fast help of the people (neo and trinity) of the Sobi forum..i got the layout exactly that i needed..this component is much more than some company index..im using it for an music album section! This component is indeed one of the most professional extensions for free! You guys are doing a great job..two thumbs up!!

 
Best ever ... - Monday, 24 September 2007

I just wondering why this extension is not a editors pick.
This is the best extension I ever seen. And not just only this exetnsion is great. The support is much better as many commercial products have. Even if You have problems with SOBI2, you will have the solution for this problem in less than 24 hours.
Thank you very much.

 
Powerful, flexible, and easy to use! - Friday, 21 September 2007

I've used SOBI2 before for the basic business indexing purpose it was built for, and it works great out of the box. There are plenty of settings to tweak and adjust to get your site running exactly how you need.

 
This is an excellent extension - Monday, 17 September 2007

It's simple the best directory component available.
If you want a online directory site, then this is the one to use. It is very simple and fast to install. The support in sisiu forum is really great. Since the RC 2.8.0 this extension has all featured which an directory really need: search in categories, check boxes group with multiple selection, and search in categories. Thanks an Trinity and Neo :-)

 
Best Component EVER!!!! - Wednesday, 08 August 2007

I think my title says it all, this really is the BEST component out there, and I have used many. Not only is the component easy to install, it is also easy to use, easy to customise, and to top it all off - and this is why this is the BEST - it has Excellent support from Trinity and Neo, second to none.

 
Bad Ass Software! - Tuesday, 31 July 2007

We needed a quick and dirty directory for a video based site.
When this project started there was a need for a Business Directory which is why this project started. But now the project is far beyond a business directory. Its way more useful as a multi-media directory.
Took me 1 work day to complete this site!

 
Excellent through and through! - Friday, 06 July 2007

A superb component that just keeps getting better and better! Unbelievable array of configuration options make this a very scalable component indeed.
Quite simple to use considering the amount of options that can be configured, and what can't be done via the admin panel, can (with some basic coding skill) be achieved with simple mods to the very well commented code.

 
Great Extension - Friday, 06 July 2007

I am just going to write a short kudos to the developers here. This is one of the best business directory listing components I have found. I have been searching for quite some time for a component with the features I needed and this one did the job.

 
Outstanding Component! - Thursday, 05 July 2007

After looking for a component like this for quite some time, I am thrilled with my new installation of SOBI 2. The authors have done an incredible job of combining power with ease of use, which is often a difficult task.

 
Kudos to Sigrid and Radek - Wednesday, 30 May 2007

Sobi is flexible, offering broad customization through its backend and CSS templates w/o ever having to enter the arcane world of the files themselves (although, if you are able and willing to go there, the opportunities to express creativity are seemingly boundless). The program produces a wide variety of directories with simplicity or complexity of content and bare-bones or elegancy of appearance limited solely by the user's imagination and effort.

 
Diamond in the rough! - Sunday, 27 May 2007

I use SOBI2 on all my community websites. I have found it to be the most versatile directory component for Joomla, especially with the latest versions' templating system. Also, unlike other directory scripts, SOBI's developers are actively developing the script and participating in their support forums.

 
This is THE directory for Joomla! - Wednesday, 23 May 2007

I have tried quite a few different systems with Joomla! for directories but Sobi2 takes the cake. not only is this an excellent directory component but it also allows you to make a few dollars offering listings. The support forum and general Sobi community is excellent. Get this if you are looking for a directory for your site.

 
Great component - Wednesday, 11 April 2007

Genuinly very very well. A lot of useful work was done. Good and useful features, everything runs without problems.

 
Great work - Friday, 02 March 2007

Haven't seen such a good working component in a while. Everything you need for a Business Index and more. I really like the gallery.
Just download and install. If you get stuck, check the forum. The answers are there, so their support is also awesome. Really guys great job.

 
Excellent Link Directory - Full Options - Wednesday, 07 February 2007

I just downloaded this Component, took a good look at its functionality, and immediately sent a donation to the developers (you should too). I recently did a big time search for a fully-featured, ecommerce ready link directory and bought one for our site.

 
SOBI Should be Editors Pick - Saturday, 02 December 2006

I could only see advantages in using SOBI.
-Active Forum Support. :)
-Easiest way to manage online business directory.
-Most important of all, SOBI is "Always Updated!".

 
Professional Component for Free - Tuesday, 14 November 2006

A few days ago, I was browsing the Joomla! extensions site, seen SOBI for the first time, and decided I would check it out. All I can say is wow! I may need to customize a couple things, but as a free Open source component, I have to admit this is about the most functional and well-built as I have ever seen.

 
Big thank you - Tuesday, 14 November 2006

I can't belive how fast joomla and sobi2 got me up and running with a website. I just needed a very quick and dirty method to store all my business cards to share with my friends, they always like me to refer who I use. Anyhow a big thank you and no hesitations to donate.

 
Comparable to Mosets Tree - Sunday, 12 November 2006

I was definitely initially impressed. The component has a wide range of options, and will work in many situations. From what I see, you could even recreate the Joomla! Extensions site with SOBI2!

 
Wow - Monday, 06 November 2006

I’m very impressed with the amount of thought put in to this extension. The configuration is simple and easy to follow. The layout works great and flows well. For sure one of the best extensions I’ve seen to date.

 
SOBI 2 is Great! - Wednesday, 01 November 2006

I had my doubts about this, but it ended up being excellent. I loaded it and set it up very easily. I had an issue with my sites template script and Trinity figured it out immediately. I am so happy this is a free extension. I look forward to see what they come up with next!

 
Wins the "Quality Crafted" Award.. - Wednesday, 01 November 2006

In a computer driven world, designing for enduser ease of use is imperative. Learning how to write programs/software in a pattern that replicates how users will think and behave (so that using the program/software is easy)is fundamental.

 
Excellent - Wednesday, 01 November 2006

While I haven't spent a lot of time with it yet, it has some very useful configuration options and features, and what is even better is the fact that the component is actively being developed with very useful plugins.

 
Wow - Sunday, 22 October 2006

Sobi 2 is outstanding. I was up and running in no time. Easy install easy use.

 
Stand Up for this component - Wednesday, 18 October 2006

This is a great component well designed, easy interface, and with a lot of help, greetings from Mexico.