Now, updated for Tiki 8!
Now accepting new user registrations! Become a contributor.
| More
Join Print Print multiple pages Convert to PDF

Adding Security and Help


What good is creating the perfect Tiki plugin if no one knows how to use it? It is important to always include proper documentation and end-user help for your plugins.

First, we'll add help text that appears when users list the available Tiki plugins.
Plugin help
The plugin's help text.

Creating plugin help

function wikiplugin_pullquote_help() {
    return tra("Create a literary pullquote").":<br />  ~np~{PULLQUOTE(width=###|color=######, float=left|right)}".tra("text")."{PULLQUOTE}~/np~  ";
    }


Now we'll add detailed help information for the Tiki inline plugin help (when users add the plugin through the Tiki help interface.
Plugin help
The detailed help explains the valid values for each option.

Plugin information and security

function wikiplugin_pullquote_info() {
    return array(
        'name' => tra('PULLQUOTE'),
        'description' => tra('Create a literary pullquote in a wiki page.'),
        'validate' => 'all',
        'params' => array(
            'color' => array(
                'required' => false,
                'name' => tra(Color of the pullquote'),
                'description' => tra('Numeric hex color code (default=000000). Do *NOT* include #.'),
                'filter' => 'int',
            ),
            'width' => array(
                'required' => false,
                'name' => tra('Width of the pullquote'),
                'description' => tra('Numeric width in pixels (default=250). Do *NOT* include px.'),
                'filter' => 'int',
            ),
            'float' => array(
                'required' => true,
                'name' => tra('Specify location of the pull quote.'),
                'description' => tra('left | right (default=left)'),
                'filter' => 'alpha',
            ),

        ),
    );
}

Notice the lines highlighted in the sample code, above.
  • 'validate' => 'all': This tells Tiki that a trusted site editor (with the necessary permissions) must validate (that is, approve) the plugin before it becomes active on the page.
  • 'required' => true: The float parameter is required; users must select a position (left or right). Tiki will not allow users to add the plugin to a wiki page without entering this parameter.

NoteNote:
Learn more about all the possible plugin variables on the Tiki Developer website Tiki(external link).


Contributors to this page: Rick Sapir .
Page last modified on Wednesday, November 10, 2010 08:21:42am EST by Rick Sapir.
The content on this page is licensed under the terms of the Copyright Information.

Buy the Books

Tiki Essentials & Tiki for Smarties -- Buy the Books.
Available from Amazon, LuLu, and more as paperback or ebook...

What do you think?

What do you think of this project?



Anti-Bot verification code image Try another code



View Results
(Votes: 20)

"..This is the only Tiki site that explained things enough that I could follow and understand. Thank you!"

Is Essentials helpful?

Essential Readers



Advertising



Powered by Tiki Wiki CMS Groupware
Creative Commons Copyright. Some rights reserved.
Tiki Essentials (this site) is © 2011-2012 by Rick Sapir, published by KeyContent.org, and is licensed
under a Creative Commons Attribution-Share Alike 3.0 United States License. Some rights reserved. Privacy Policy.
Permissions beyond the scope of this license may be available at http://twessentials.keycontent.org/Copyright Information.
Questions, comments, or concerns about this site or the guide? Let me know.
New to Tiki? Try Tiki for Dummies Smarties: A beginner's guide to using Tiki Wiki CMS Groupware.


Feedback Form
Feedback Analytics