|
|
Line 1: |
Line 1: |
| Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup. | | Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup. |
− |
| |
− | ==hook_attach==
| |
− | hook_attach(plugin file, hook id name)
| |
− |
| |
− |
| |
− | '''Description'''<br>
| |
− | Includes (attaches) your custom script (plugin file) at a pre-designated place (hook id) in the Pro Edition source code.
| |
− |
| |
− |
| |
− | '''Example 1 - What a designated hook looks like in the Pro Edition source code'''<br>
| |
− | ''Taken from in sohoadmin/program/header.php (~line #375 as of v4.9 Beta2)''
| |
− | <pre>eval(hook("header.php:top_javascript", basename(__FILE__)));</pre>
| |
− |
| |
− |
| |
− | '''Example 2 - calling hook attachement() from your install_manifest.php'''<br>
| |
− | ''Taken from QuickEdit Dropdown Menu plugin''
| |
− | <pre>hook_attach("quickedit_js.php", "header.php:top_javascript");</pre>
| |
− |
| |
− |
| |
− | The end-result of examples 1 and 2 is that Pro Edition will include() your script at the designated location (determined by hook id). So when Pro Edition processes header.php and gets to that line with a hook() on it that your plugin has attached to (by calling hook_attach in its install_manifest.php), it basically does this...
| |
− | <pre>include("[path_your_plugin_folder]/quickedit_js.php");</pre>
| |
− |
| |
− | ==hook_overwrite==
| |
− | hook_overwrite(source file name, plugin file name)
| |
− |
| |
− | '''Description'''<br>
| |
− | Completely overwrites a source file with the file you specify.
| |
− |
| |
− | Original source file is renamed to filename.php-[plugin_folder_name]
| |
− |
| |
− |
| |
− | '''Example 1 - calling hook_overwrite from your install_manifest.php'''
| |
− | <pre>hook_overwrite("sohoadmin/program/main_menu.php", "your_modded_main_menu.php");</pre>
| |
− |
| |
− | ==hook_replace==
| |
− | hook_replace(source file name, replacement manifest file name)
| |
− |
| |
− | '''Description'''<br>
| |
− | Reads your replacement manifest file and replaces specified chunk(s) of code in source file with your different (modified) code.
| |
− |
| |
− | Specific replacements for a particular source file should be placed in a dedicated file (this is your replacement manifest).
| |
− |
| |
− |
| |
− | '''Example 1 - Calling hook_replace from your plugin's install manifest'''
| |
− | <pre>hook_replace("sohoadmin/program/main_menu.php", "main_menu-replacements.php");</pre>
| |
− |
| |
− |
| |
− | '''Example 2 - Content of replacement manifest file (main_menu-replacements.php)'''
| |
− |
| |
− | <pre>
| |
− |
| |
− | #new replacement#
| |
− | # Add another title row below the "Basic Features Group" row.
| |
− | <oldcode>
| |
− | <tr>
| |
− | <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
| |
− | </tr>
| |
− | </oldcode>
| |
− |
| |
− | <newcode>
| |
− | <tr>
| |
− | <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
| |
− | </tr>
| |
− | <tr>
| |
− | <td class="fgroup_title">Hello World!</td>
| |
− | </tr>
| |
− | </newcode>
| |
− |
| |
− | #new replacement#
| |
− | # Replace title row with modifed version
| |
− | <oldcode>
| |
− | <tr>
| |
− | <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
| |
− | </tr>
| |
− | </oldcode>
| |
− |
| |
− | <newcode>
| |
− | <tr>
| |
− | <td class="fgroup_title" style="font-style: italic;">Hello World!</td>
| |
− | </tr>
| |
− | </newcode>
| |
− | </pre>
| |
Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup.