friendica/addon
Friendika 96bcaf4331 poormancron - proc_run executing twice, once as function; once as commandline 2011-08-17 18:43:17 -07:00
..
calc Update info comments in all plugins 2011-06-14 15:08:03 +02:00
convert Update info comments in all plugins 2011-06-14 15:08:03 +02:00
facebook honour "post to xxx network by default" when using API 2011-08-14 04:26:41 -07:00
fortunate Update info comments in all plugins 2011-06-14 15:08:03 +02:00
impressum removed the "same as friendika" note from the license line 2011-07-21 11:15:13 +02:00
js_upload js_upload reporting 43k file too big 2011-08-13 16:05:03 -07:00
ldapauth Update info comments in all plugins 2011-06-14 15:08:03 +02:00
oembed update oembed and widgets plugins settings form 2011-06-30 17:00:26 +02:00
piwik removed the "same as friendika" note from the license line 2011-07-21 11:15:13 +02:00
poormancron poormancron - proc_run executing twice, once as function; once as commandline 2011-08-17 18:43:17 -07:00
randplace Update info comments in all plugins 2011-06-14 15:08:03 +02:00
sniper Merge pull request #116 from fabrixxm/admin 2011-06-16 15:27:12 -07:00
statusnet Merge branch 'pull' 2011-08-14 04:27:34 -07:00
tictac Update info comments in all plugins 2011-06-14 15:08:03 +02:00
twitter honour "post to xxx network by default" when using API 2011-08-14 04:26:41 -07:00
widgets update oembed and widgets plugins settings form 2011-06-30 17:00:26 +02:00
LICENSE created license with which to renounce the license 2011-07-18 20:52:35 -07:00
README Add 'jot_tool' hook, plugins can add tool icons. 2011-01-26 16:17:28 +01:00

README

Friendika Addon/Plugin development

This is an early specification and hook details may be subject to change.

Please see the sample addon 'randplace' for a working example of using these features.


You must register plugins with the system in the .htconfig.php file.

$a->config['system']['addon'] = 'plugin1name, plugin2name, another_name';

Plugin names cannot contain spaces and are used as filenames.


Register your plugin hooks during installation. 

	register_hook($hookname, $file, $function);

	$hookname is a string and corresponds to a known Friendika hook
	$file is a pathname relative to the top-level Friendika directory.
		This *should* be 'addon/plugin_name/plugin_name.php' in most cases.
	$function is a string and is the name of the function which will be executed
		when the hook is called.


Your hook functions will be called with at least one and possibly two arguments

	function myhook_function(&$a, &$b) {


	}

If you wish to make changes to the calling data, you must declare them as 
reference variables (with '&') during function declaration. 

$a is the Friendika 'App' class - which contains a wealth of information
about the current state of Friendika, such as which module has been called,
configuration info, the page contents at the point the hook was invoked, profile
and user information, etc. It is recommeded you call this '$a' to match its usage 
elsewhere.

$b can be called anything you like. This is information which is specific to the hook 
currently being processed, and generally contains information that is being immediately
processed or acted on that you can use, display, or alter. Remember to declare it with 
'&' if you wish to alter it.


Current hooks:

'authenticate' - called when a user attempts to login. 
	$b is an array
		'username' => the supplied username
		'password' => the supplied password
		'authenticated' => set this to non-zero to authenticate the user.
		'user_record' => successful authentication must also return a valid user record from the database


'logged_in' - called after a user has successfully logged in.
	$b contains the $a->user array


'display_item' - called when formatting a post for display.
	$b is an array
		'item' => The item (array) details pulled from the database
		'output' => the (string) HTML representation of this item prior to adding it 
			to the page  

'post_local' - called when a status post or comment is entered on the local system
	$b is the item array of the information to be stored in the database
		{Please note: body contents are bbcode - not HTML)

'post_local_end' - called when a local status post or comment has been stored on the local system
	$b is the item array of the information which has just been stored in the database
		{Please note: body contents are bbcode - not HTML)


'post_remote' - called when receiving a post from another source. This may also be used
	to post local activity or system generated messages.
	$b is the item array of information to be stored in the database and the item
	body is bbcode.

'settings_form' - called when generating the HTML for the user Settings page
	$b is the (string) HTML of the settings page before the final '</form>' tag.

'settings_post' - called when the Settings pages are submitted.
	$b is the $_POST array

'plugin_settings' - called when generating the HTML for the addon settings page
	$b is the (string) HTML of the addon settings page before the final '</form>' tag.

'plugin_settings_post' - called when the Addon Settings pages are submitted.
	$b is the $_POST array

'profile_post' - called when posting a profile page.
	$b is the $_POST array

'profile_edit' - called prior to output of profile edit page
	$b is array
		'profile' => profile (array) record from the database
		'entry' => the (string) HTML of the generated entry

'profile_advanced' - called when the HTML is generated for the 'Advanced profile', 
	corresponding to the 'Profile' tab within a person's profile page.
	$b is the (string) HTML representation of the generated profile

'directory_item' - called from the Directory page when formatting an item for display
	$b is an array
		'contact' => contact (array) record for the person from the database
		'entry' => the (string) HTML of the generated entry 

'profile_sidebar_enter' - called prior to generating the sidebar "short" profile for a page
	$b is (array) the person's profile array

'profile_sidebar' - called when generating the sidebar "short" profile for a page
	$b is an array
		'profile' => profile (array) record for the person from the database
		'entry' => the (string) HTML of the generated entry

'contact_block_end' - called when formatting the block of contacts/friends on a 
	profile sidebar has completed
	$b is an array
		'contacts' => contact array of entries
		'output' => the (string) generated HTML of the contact block

'bbcode' - called during conversion of bbcode to html
	$b is (string) converted text

'html2bbcode' - called during conversion of html to bbcode (e.g. remote message posting)
	$b is (string) converted text


'page_header' - called after building the page navigation section
	$b is (string) HTML of nav region


'personal_xrd' - called prior to output of personal XRD file.
	$b is an array
		'user' => the user record for the person
		'xml' => the complete XML to be output
 

'home_content' - called prior to output home page content, shown to unlogged users
	$b is (string) HTML of section region

'contact_edit' - called when editing contact details on an individual from the Contacts page
	$b is (array)
		'contact' => contact record (array) of target contact
		'output' => the (string) generated HTML of the contact edit page

'contact_edit_post' - called when posting the contact edit page
	$b is the $_POST array

'init_1' - called just after DB has been opened and before session start
	$b is not used or passed

'page_end' - called after HTML content functions have completed
    $b is (string) HTML of content div

'jot_plugin' - add tools to jot toolbar
  $b is (string) HTML for tool icon


*** = subject to change





Not yet documented:

'atom_feed' ***

'atom_feed_end' ***

'parse_atom' ***

'atom_author' ***

'atom_entry' ***

'parse_link' ***