Skip to content
Mark Vincent edited this page Oct 31, 2017 · 3 revisions

YourCode provides an easy way for developers to extend the functionality of this plugin. By creating single PHP files, and with minimal coding, serious developers and hobbyist alike can create their own BB Code without having to add another plugin to their site.

Module Requirements

YourCode modules use specific conventions to verify to the plugin that they are ready for use. Using a unique modifier throughout the naming processes ensures that no two modules occupy the same space. The first step to designing your own module is to select a name for your addon. This base_name should be alphanumeric and should not contain spaces. Examples would include youtube, youtube_embed, and youtube_embed1.

In the instructional code segments the base name will be example.

function yc_example_info() {
	return array(
		"title" => 'Example',
		"description" => '(optional) description',
		"version" => '1.0',
	);
}

Info Function

YourCode modules must have two functions included that are named according to convention and stored in a PHP file that is locate in the modules directory and named appropriately. The first function is _info(). This function relays information to the plugin needed for handling of the addon.

title - string the title of the plugin
description - string short description
version - string the version number of the module file

function yc_example_parse_message($message) {
	return strtoupper($message);
}

Parse Message Function

The second function is where all the work gets done. In _parse_message() your script can do as it likes with the passed text ($message) and then return the string. This greatly simplifies the creation of unique bb code 'plugins' for your forum or to share with others.

Obviously you might want to do something more useful than the example I'm sharing here.