Extension:APF - Advanced Page Functions

What can this extension do?
This extension combines the functionality of many smaller extensions to provide an updated version of some of the most commonly used page functions. The extension comes with files that you can modify if you wish to internationalize messages and function names. The code is currently in beta and new functionality is being added with each monthly release.

On a per page basis users of this extension can:


 * Change the heading that appears at the top of an article.
 * Change the heading that appears in the browser.
 * Set the meta description that will be used in a search engine listing.
 * Set the meta keywords that are used by some search engines.
 * Append to the default meta keywords that are used by some search engines.
 * Add custom meta information.
 * - Add per page inline CSS
 * - Add per page CSS using an external file
 * - Embed a flash movie anywhere on a page
 * Add content from an external file to your page.

Adding / Changing Page Meta Information
Usage

Edit your page and add the following function calls to the top of the edit window:


 * - Sets the page heading
 * - Sets the browser page name
 * - Sets the meta description
 * - Sets the meta keywords
 * - Adds additional meta keywords
 * - Adds custom meta information

Example

Adding / Changing CSS on your page
Usage


 *   - This page function can be used to add additional inline custom CSS styles to a page. To use the function, replace with the CSS style commands, edit your page and place one or more of these page functions anywhere on the page. The CSS will always be added to the top of your MediaWiki page when the page is generated. If you have more than one call then the CSS styles from each call will be added in the order that the functions appear on the page.


 *   - To add CSS styles from a file(s) that you have placed in the /extensions/APF/CSS directory, replace with the name of the file containing your CSS styles, and enter the page function(s) anywhere on your page. If you prefer to store your CSS files in another directory then set the $apfCssDir global variable in your LocalSettings.php file. For example: $apfCssDir = "C:\wamp\www\wiki5\mw\extensions\APF\CSS_FILES";

If you use both of these page functions on a page then the extension will always add the inline CSS styles from the   function calls after the import commands that are generated by the    function calls. This allows you to fine-tune the CSS on the page and override CSS styles that were added from the imported files.

Example

Adding the following page function calls to your page:

Adds this to your page source:

 @import '/wiki5/mw/extensions/APF/CSS/sample.css'; @import '/wiki5/mw/extensions/APF/CSS/sample1.css'; background-color: red; } background-color: black; }
 * 1) content h1,h2,h3 {color: #fff000;}
 * 2) footer {
 * 1) header {

Notes


 * 1) page.cssd - A sanity check on the CSS is performed. This check stops a user from entering various words such as 'expression', 'http', 'https', 'ftp', 'url' etc.
 * 2) page.cssf - When you click save then an error message will be generated if you attempt to use a file not in the /extensions/APF/CSS directory or the directory that you have specified by adding an entry for the $apfCssDir variable in your LocalSettings.php file.

Adding a Flash movie to your page
Usage


 *   - Adds a flash movie from the /images directory to your page. When using this function you can specify any of the following parameters for the flash movie: align, base, bgcolor, classid, codebase, devicefont, file, height, loop, movie, menu, play, quality, salign, scale, src, swliveconnect, width, wmode. Use of any other parameter will result in an error message.

Example

This page function will cause the following code to be inserted into your page:

&lt;object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='400' height='250' id='/wiki5/mw/images/filename.swf' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'&gt; &lt;param name='movie' value='/wiki5/mw/images/filename.swf'&gt; &lt;embed src='/wiki5/mw/images/filename.swf' width='400' height='250' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'&gt; &lt;/embed&gt;&lt;/object&gt;

&lt;object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='400' height='250'&gt; &lt;param name='movie' value='/wiki5/mw/images/filename.swf' /&gt; &lt;!--[if !IE]&gt;--&gt; &lt;object type='application/x-shockwave-flash' data='/wiki5/mw/images/filename.swf' width='400' height='250'&gt; &lt;!--&lt;![endif]--&gt; &lt;p&gt;Alternative content&lt;/p&gt; &lt;!--[if !IE]&gt;--&gt; &lt;/object&gt; &lt;!--&lt;![endif]--&gt; &lt;/object&gt;

Notes


 * You must use the 'file=' parameter to specify the flash movie filename.
 * If you do not specify them then the following defaults apply:
 * height=500px
 * width=500px
 * The default directory searched for swf files is /images. You can specify an alternate directory by setting the $apfSwfDir global variable in your LocalSettings.php file. For example: $apfSwfDir = "C:\wamp\www\wiki5\mw\extensions\APF\SWF_FILES";
 * An error message will be generated if you attempt to use a file not in the /images or user specified directory.

Adding content from a file to your page
Usage


 *   - To add content from a file(s) that you have placed in the /extensions/APF/FILE directory, replace with the name of the file, and enter the page function(s) anywhere on your page. If you prefer to store the files in another directory then you change the source directory by setting $apfFileDir global variable in your LocalSettings.php file. For example: $apfFileDir = "C:\wamp\www\wiki5\mw\extensions\APF\DATA_FILES";

Example

Download Instructions
Please download the zip release containing code files and place the files in the following directory:

/APF.i18n.magic.php /APF.i18n.php /APF_setup.php /CSS/sample.css /FILE/filename.txt /includes/APF.php /includes/APF_HTML.php /includes/APF_Tag.php

Internationalization Instructions
If you need to internationalize this extension make changes to the following files:


 * /APF.i18n.magic.php
 * /APF.i18n.php

Check the contents of the files for more information on what you will need to change to internationalize the functions for your language.

Installation

 * 1) In the directory in $IP/extensions create a new directory APF - where $IP is your MediaWiki installation directory.
 * 2) Copy the extension directories and files into the APF directory you just created
 * 3) Add the following line to the bottom of the LocalSettings.php in your MediaWiki installation directory: require_once('extensions/APF/APF.php');
 * 4) Modify the files: APF.i18n.magic.php and APF.i18n.php if you need to internationalize this extension for another language.
 * 5) If you use the page.cssf function then store your files in the  /extensions/APF/CSS directory
 * 6) If you use the page.swf1 function and if you want to allow users to upload their own swf files then add $wgFileExtensions[] = 'swf'; to LocalSettings.php. Files uploaded by users will be uploaded to the /images directory

Code
You can download zip files containing the extension code and sample files from this page: Download Snapshot.

Bugs, Comments and Feature Requests
At this stage in the development process my focus is on providing additional functionality with each new beta release. If you have a chance to try out this extension then I would very much appreciate your feed back if you are find any bugs. Please use the comment area on this page to notify me about bugs that you find and also tell if you have any feature requests: Bugs, Comments and Feature Requests

Dependency

 * No dependencies when used with MediaWiki 1.14 and above