====== Plugin hooks ====== Hooks are places in Instant Update where you can insert your plugin functions. For example, if you want to add custom information in footer of your website, you can make function which writes such information, and then just attach your plugin function to a "[[#iu_page_footer|iu_page_footer]]" hook of Instant Update. After that, when Instant Update generates pages and comes to a footer, it'll execute all functions attached to "iu_page_footer" hook before it continues working. This is a list of hooks currently available in Instant Update: ====== below_dashboard ====== This hook is placed below dashboard and is used to add additional options to your dashboard. You should only use [[functions#add_menu_item|add_menu_item()]] function in plugin functions attached to this hook to add menu items below dashboard. //Exists from version: 3.0// ===== Example ===== //plugin function function iufooterad_add2dash() { if (iu_is_admin()) { add_menu_item("Configure footer Ad", "plugins/iu-footer/iu-footer-config.php", IU_LINK_POPUP, "Footer AD administration", 500, 450); } } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('below_dashboard','iufooterad_add2dash'); } ====== above_dashboard ====== This hook is placed above dashboard and is used to add additional options to your dashboard. You should only use [[functions#add_menu_item|add_menu_item()]] function in plugin functions attached to this hook to add menu items above dashboard. It is same as hook "[[#below_dashboard|below dashboard]]", only this one is placed above dashboard. //Exists from version: 3.0// ===== Example ===== //plugin function function iufooterad_add2dash() { if (iu_is_admin()) { add_menu_item("Configure footer Ad", "plugins/iu-footer/iu-footer-config.php", IU_LINK_POPUP, "Footer AD administration", 500, 450); } } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('above_dashboard','iufooterad_add2dash'); } ====== wysiwyg_buttons_init ====== This hook is used to initialize WYSIWYG buttons and their JavaScript commands, as described [[http://www.instant-update.com/innovastudio-documentation/default_toolbar.htm|here]]. It is used in combination with hook [[#wysiwyg_buttons|wysiwyg_buttons]]. //Exists from version: 3.0// ===== Example ===== //plugin function function addeditorbuttons() { echo "[\"CustomName1\",\"alert('Command 1 here.')\",\"Caption 1 here\",\"btnCustom1.gif\"],"; echo "[\"CustomName2\",\"alert('Command 2 here.')\",\"Caption 2 here\",\"btnCustom1.gif\"]"; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('wysiwyg_buttons_init','addeditorbuttons'); } ====== wysiwyg_buttons ====== This hook is used to add WYSIWYG buttons to a WYSIWYG editor toolbar, as described [[http://www.instant-update.com/innovastudio-documentation/default_toolbar.htm|here]]. It is used in combination with hook [[#wysiwyg_buttons_init|wysiwyg_buttons_init]]. //Exists from version: 3.0// ===== Example ===== //plugin function function addeditorbuttons_toolbar() { echo '"ButtonName1","ButtonName2"'; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('wysiwyg_buttons','addeditorbuttons_toolbar'); } ====== meta ====== This hook is executed between and HTML tags in all Instant Update pages (all pages in **manage/** directory). It is used to add custom JavaScript or CSS files to Instant Update administration. //Exists from version: 3.0// ===== Example ===== //plugin function function add_custom_css() { echo ''; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('meta','add_custom_css'); } ====== editpage_options ====== This hook is executed below [[usage:code_editor|code editor]] in Instant Update and it can be used to add additional options for code editor. //Exists from version: 3.0// ===== Example ===== //plugin function function hello_world() { echo " | hello world"; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('editpage_options','hello_world'); } ====== iu_page_header ====== This hook is executed on your web site's pages when [[install:converting#add_header|IU header]] is executed. //Exists from version: 3.0// ===== Example ===== //plugin function function hello() { echo "This is page header"; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('iu_page_header','hello'); } ====== iu_page_footer ====== This hook is executed on your web site's pages when [[install:converting#add_footer|IU footer]] is executed. //Exists from version: 3.0// ===== Example ===== //plugin function function hello_2() { echo "This is page footer"; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('iu_page_footer','hello_2'); } ====== main_nav ====== This hook is used to add navigation items to Instant Update's main navigation which is found on every IU page header (all pages in **manage/** directory). You should only use [[functions#add_menu_item|add_menu_item()]] function in plugin functions attached to this hook to add menu items to Instant Update's main navigation. //Exists from version: 3.0// ===== Example ===== //plugin function function add_main_nav() { if (iu_is_admin()) { add_menu_item("IU WEBSITE", "http://www.instant-update.com", IU_LINK_BIGPOPUP, "Instant Update website"); } } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('main_nav','add_main_nav'); } ====== content ====== This is special hook which is triggered when content is displayed in web site page. With this hook you can change content on web site in real time. //Exists from version: 3.0// ===== Example ===== //plugin function function iu_bold($content) { return "" . $content . ""; } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('content','iu_bold'); } ====== iu_navigation_menu ====== This hook is used to add items to your [[usage:auto_menus|web site navigation]]. All items added this way will be inserted just before last item in regular navigation. You should only use [[functions#add_navigation_menu_item|add_navigation_menu_item()]] function in plugin functions attached to this hook to add menu items to web site's main navigation. //Exists from version: 3.0// ===== Example ===== //plugin function function iu_menu() { add_navigation_menu_item("Test", "test.php"); } //attach plugin function to a hook if (function_exists('add_hook')) { add_hook('iu_navigation_menu','iu_menu'); }