soo_plugin_display

Summary:

Display information about installed plugins

soo_plugin_display version 0.2.4, 12.4 KB
(If it won’t install try the compressed version)

Full plugin help text

Courtesy soo_plugin_display, of course!


soo_plugin_display

This is a plugin for Textpattern. Plugin authors can display code, help text, and other aspects of plugins directly from Textpattern.

Contents

Overview

Display information about installed plugins.

Usage

The soo_plugin_display tag works as a container or with a form that retrieves most of the txp_plugin fields for the plugin specified in the name attribute. Place any of the other tags (soo_plugin_author, etc.) inside the container or form to display your choice of fields.

If name is left blank (the default), soo_plugin_display will retrieve all plugins (optionally restricted by plugin prefix or status). In this case the plugin code and help will not be retrieved, so soo_plugin_code and soo_plugin_help will not produce output.

The plugin is compatible with soo_plugin_pref, allowing you to adjust some of the default tag attribute values.

Tags

All tags (except for soo_plugin_display) must be in a soo_plugin_display container or form to produce output.

soo_plugin_display

Retrieve a named plugin or a list of plugins; iterate over each plugin with the tag contents or specified form.

<txp:soo_plugin_display form="foo" />    <!-- use with a form -->

<txp:soo_plugin_display>                 <!-- or as a container -->
	...
</txp:soo_plugin_display>

Attributes

The remaining attributes are effective only in list mode (i.e., when name is left blank).

soo_plugin_author_uri, soo_plugin_version, soo_plugin_description

No attributes: each simply displays the corresponding field straight from txp_plugin.

<txp:soo_plugin_author_uri />
<txp:soo_plugin_version />
<txp:soo_plugin_description />

soo_plugin_author, soo_plugin_name

As above, but these accept an optional link attribute.

<txp:soo_plugin_author />
<txp:soo_plugin_name />

Attributes

soo_plugin_size

Display the plugin’s installed code size in KB (counting 1 character = 1 byte)

<txp:soo_plugin_size />

Attributes

The plugin outputs the value of format, first replacing any occurrences of ‘{size}’ with the size in KB.

soo_plugin_help

Display the plugin’s help text.

<txp:soo_plugin_help />

Does not work in list mode (i.e., when soo_plugin_display has a blank name attribute).

Attributes

strip_style looks for an opening <style> tag at the very start of the Help section. strip_title looks for the first occurence of <h1>. Both do a non-greedy match looking for the closing tag.

With section_id, display begins from the HTML header element with the specified id. Display continues till the next HTML header with the same or lower level (<h2> considered lower than <h3>, for example) or until the end if no such header is found.

h_plus can be helpful when breaking a long help text into several web pages, in conjuction with section_id. For example, h_plus="-2" will transpose all h6 elements to h4, all h5 elements to h3, etc.

soo_plugin_code

Display plugin source code, by default the whole thing, or selected code determined by the function and/or php_class attributes.

<txp:soo_plugin_code />

Does not work in list mode (i.e., when soo_plugin_display has a blank name attribute).

Attributes

The remaining attributes are effective only when highlighting is enabled.

The function/class search isn’t thorough, and is based on my coding style. In the case of a function (outside a class) or class, it simply stops at the first non-indented closing brace (“}”) that occurs after the function or class name. Same for a method (function inside a class) but with the closing brace indented one tab.

Tabs are converted to spaces, to stay aligned with tab stops as set in plugin preferences or the tag_stop attribute.

Highlighting

The code highlighting is based on the PHP highlight_string() function. The style declarations produced by highlight_string() are replaced by class declarations. The important ones:

Everything will be in a span with one of those class names. The whole thing is wrapped in a code element.

If you prefer to use javascript-based highlighting, such as the excellent SyntaxHighlighter, set highlight="0" (or do this in prefs) to get raw (although still HTML-escaped) code output. In this case line numbers will not be added.

Examples

List all active plugins as a table

showing plugin author (as a link to the plugin author’s website) and description

<txp:soo_plugin_display wraptag="table" break="tr">
<td><txp:soo_plugin_name /></td><td><txp:soo_plugin_description /></td>
</txp:soo_plugin_display>

Display plugin help

<txp:soo_plugin_display name="soo_image">
<txp:soo_plugin_help />
</txp:soo_plugin_display>

Display full source code

leaving off the line numbers

<txp:soo_plugin_display name="soo_plugin_pref">
<txp:soo_plugin_code show_line_numbers="" />
</txp:soo_plugin_display>

Display a single method

renumbering the lines, starting from 1

<txp:soo_plugin_display name="soo_txp_obj">
<txp:soo_plugin_code php_class="soo_html" function="tag" reindex_lines="1" />
</txp:soo_plugin_display>

Preferences

If you have the soo_plugin_pref preference management system installed, you can adjust some of the default tag attribute values. Preference settings:

Version History

0.2.4 (2017-02-15)

0.2.2 (12/20/2010), 0.2.3 (12/27/2010)

0.2.1 (9/17/2010)

0.2.0 (7/11/2010)

Note: If you are upgrading from an earlier version, note that soo_plugin_code has some other format changes (e.g., highlighted output is now wrapped in a pre element), so some CSS changes might be needed.

0.1.4 (7/4/2010)

0.1.3 (9/27/2009)

0.1.2 (9/26/2009)

0.1.1 (9/22/2009)

0.1 (9/18/2009)

Posted 2009-09-21 (last modified 2017-03-13)