Loading...
 

Create a Zend Wiki Plugin

 

 Note

This is for Tiki 10 onwards, not for Tiki 9

Description

In Tiki 10 (trunk at time of writing) a new style wiki plugin isborn, "Zend Wiki Plugins".  These plugins are object oriented and add a great deal of value to tiki not only in design, but also style-ability.  They cut down on code, and speed up development.

Why useful

The added value of having a standard set of callable plugins isthat there can now be a platform for creating plugins that all reactthe same way to the parser that is calling them. This new typeof plugin system is accessible in both the jison parser and the original parser.

Methods

Although these zend style plugins can have as many methods as needed, only 2 are used generally from the parser that executes them.

  • __construct - where translations need to be done
  • output - where the parser asks the plugin to return something to be displayed in the wiki page

They extend (or inherit) from one of the following base classes:

Types

  • "WikiPlugin_HtmlBase" - which returns an html container with the plugin's contents inside. It accepts all css-style modifiers that are applied to the plugin's base html object, so that it is easily styled.
  • "WikiPlugin_ConditionBase" - returns only the content that is returned from it's method output.

To create a zend wiki plugin called "foo", do the following:

 

Example

<?php
class WikiPlugin_foo extends WikiPlugin_HtmlBase
{
  var $type = 'foo';
  var $validate;
  var $filter = 'rawhtml_unsafe';
  var $icon = 'img/icons/text_list_numbers.png';
  var $tags = array( 'basic' );

  function __construct()
  {
    $this->name = tr('Foo Plugin');
    $this->documentation = 'PluginFoo';
    $this->description = tr('Creates a foo');
    $this->params = array(
      'fooparam' => array(
        'required' => false,
        'name' => tra('Foo Parameter'),
        'description' => tra('A parameter called foo'),
        'filter' => 'text',
        'default' => null,
      ),
    );
  }

  function output(&$data, &$params, &$index, &$parser)
  {
    return "Foo executed, fooparam = " . $params['fooparam'];
  }
}

Please Note

Notice that "foo" is in lower case when the class isdeclared.
Notice that function output uses "&" in front of all 4 variables, $data, $params, $index, and $parser. This is done to prevent the plugin from duplicating these variablesevery time a new plugin is instantiated, ie $plugin = newWikiPlugin_foo();

 

Variable defaults

var $name; //The html name of the plugin
var $type; //The object type used in creation of html object, if set to "foo", the first html object would have an id of "foo0"
var $documentation; //the documentation location on doc.tiki.org
var $description; //the html description
var $format; //Inherited from old plugins, unused
var $prefs = array(); //the prefs associated with the plugin
var $body; //similar to prefs, but the body of the plugin
var $validate; //true or false, if the plugin needs to be validated from the admin or moderator
var $filter = 'rawhtml_unsafe'; //filter type on the plugin's contented
var $icon = 'img/icons/mime/html.png'; //plugin's icon
var $tags = array( 'basic' ); //
var $params = array(); //needed prefs to run the plugin
var $htmlTagType = 'div'; //the type of html node returned to the parser, ie, 
var $hasHtmlBody = true; //
var $htmlAttributes = array(); //
var $np = true; //turns np on or off, no longer needed to bo returned directly from the function created for use in the parser
var $parserLevel = 0; //jison only, allows plugins to be late parsed, for example table of contents.  Set higher than 0 for this to happen.

 

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting 7.x
Administration
Ajax 2.x
Articles & Submissions
Backlinks
Banner
Batch 6.x
BigBlueButton audio/video/chat/screensharing (5.x)
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution 2.x
Cookie
Copyright
Credits 6.x
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs 8.x
DogFood
Draw 7.x
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Group
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping 3.x
Mobile Tiki and Voice Tiki
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Payment 5.x
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Score
Search engine optimization (SEO)
Search
Security
Semantic links 3.x
Share
Shopping Cart 5.x
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags 2.x
Task
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
Theme
TikiTests 2.x
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
WebHelp
Webmail and Groupmail
WebServices 3.x
Wiki 3D
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives 4.x
WYSIWTSN 4.x
WYSIWYCA
WYSIWYG 2.x
XMLRPC




Useful Tools