# The Red Matrix: include/plugin.php File Reference

All Classes Namespaces Files Functions Variables Pages
plugin.php File Reference

Some functions to handle addons and themes. More...

## Functions

| unload_plugin ($plugin)
| unloads an addon. More...
| uninstall_plugin ($plugin)
| uninstalls an addon. More...
| install_plugin ($plugin)
| installs an addon. More...
| load_plugin ($plugin)
| loads an addon by it's name. More...
| plugin_is_installed ($name)
| reload_plugins ()
| register_hook ($hook, $file, $function, $priority=0)
| registers a hook. More...
| unregister_hook ($hook, $file, $function)
| unregisters a hook. More...
| load_hooks ()
| insert_hook ($hook, $fn)
| call_hooks ($name, &$data=null)
| get_plugin_info ($plugin)
| parse plugin comment in search of plugin infos. More...
| get_theme_info ($theme)
| parse theme comment in search of theme infos. More...
| get_theme_screenshot ($theme)
| head_add_css ($src, $media= 'screen')
| add CSS to <head> More...
| head_remove_css ($src, $media= 'screen')
| head_get_css ()
| format_css_if_exists ($source)
| script_path ()
| head_add_js ($src)
| head_remove_js ($src)
| head_get_js ()
| head_get_main_js ()
| format_js_if_exists ($source)
| theme_include ($file, $root= '')
| get_intltext_template ($s, $root= '')
| get_markup_template ($s, $root= '')

## Detailed Description

Some functions to handle addons and themes.

## Function Documentation

call_hooks | ( |  | $name,
|  | & | $data = `null`
| ) |  |

Referenced by _well_known_init(), api_login(), atom_author(), atom_entry(), authenticate_success(), avatar_img(), bb2diaspora(), bbcode(), channel_remove(), chat_message(), chatsvc_post(), check_account_email(), check_account_invite(), check_account_password(), connect_content(), connections_post(), connedit_content(), connedit_post(), construct_page(), contact_block(), contact_select(), conversation(), create_identity(), cronhooks_run(), directory_content(), downgrade_accounts(), drop_item(), editblock_content(), editlayout_content(), editpost_content(), editwebpage_content(), event_store_item(), externals_run(), feature_enabled(), gender_selector(), gender_selector_min(), get_all_perms(), get_atom_elements(), get_features(), get_feed_for(), get_mood_verbs(), get_perms(), get_poke_verbs(), get_role_perms(), Item\get_template_data(), App\get_widgets(), group_select(), home_content(), home_init(), hostxrd_init(), html2bbcode(), import_author_xchan(), import_directory_profile(), import_xchan(), item_photo_menu(), item_post(), item_store(), item_store_update(), like_content(), login(), magic_init(), mail_store(), marital_selector(), marital_selector_min(), mood_init(), nav(), network_content(), network_to_name(), new_contact(), notification(), notifier_run(), obj_verbs(), oembed_fetch_url(), openid_content(), parse_url_content(), pdl_selector(), perm_is_allowed(), photo_upload(), photos_content(), ping_init(), poller_run(), populate_acl(), post_activity_item(), post_init(), prepare_body(), probe_well_known(), proc_run(), process_delivery(), profile_content(), profile_sidebar(), profiles_content(), profiles_post(), replace_macros(), rmagic_post(), settings_post(), sexpref_selector(), sexpref_selector_min(), siteinfo_content(), smilies(), subthread_content(), tag_deliver(), validate_channelname(), wfinger_init(), widget_affinity(), xrd_init(), zfinger_init(), zid(), and zid_init().

format_css_if_exists | ( |  | $source | ) |

Referenced by head_get_css().

format_js_if_exists | ( |  | $source | ) |

Referenced by head_get_js(), and head_get_main_js().

get_intltext_template | ( |  | $s,
|  |  | $root = `''`
| ) |  |

Referenced by check_config(), lostpass_content(), lostpass_post(), send_reg_approval_email(), send_verification_email(), setup_post(), user_allow(), and verify_email_address().

get_markup_template | ( |  | $s,
|  |  | $root = `''`
| ) |  |

Referenced by achievements_content(), admin_content(), admin_page_channels(), admin_page_dbsync(), admin_page_hubloc(), admin_page_logs(), admin_page_plugins(), admin_page_profs(), admin_page_site(), admin_page_summary(), admin_page_themes(), admin_page_users(), advanced_profile(), alt_pager(), api_apply_template(), api_content(), app_render(), appman_content(), apps_content(), apw_form(), blocks_content(), blogtheme_form(), App\build_pagehead(), categories_widget(), channel_content(), chat_content(), check_php(), common_content(), common_friends_visitor_widget(), connect_content(), connections_content(), connedit_content(), construct_page(), contact_block(), conversation(), delegate_content(), design_tools(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_mail(), diaspora_send_relay(), diaspora_send_retraction(), diaspora_send_status(), diaspora_share(), diaspora_unshare(), dir_safe_mode(), dir_sort_links(), directory_content(), dirprofile_init(), display_content(), editblock_content(), editlayout_content(), editpost_content(), editwebpage_content(), events_content(), fbrowser_content(), field_timezone(), fileas_widget(), filer_content(), filestorage_content(), findpeople_widget(), format_categories(), format_filer(), RedBrowser\generateDirectoryIndex(), get_birthdays(), Item\get_comment_box(), get_events(), get_feed_for(), group_content(), group_side(), help_content(), hostxrd_init(), RedBrowser\htmlActionsPanel(), identity_selector(), import_content(), invite_content(), lang_selector(), layouts_content(), login(), lostpass_content(), mail_content(), manage_content(), match_content(), menu_content(), menu_render(), message_content(), micropro(), mini_group_select(), mitem_content(), mood_content(), nav(), network_content(), new_channel_content(), notification(), notifications_content(), notify_content(), oembed_format_object(), oexchange_init(), opensearch_init(), p_init(), pagelist_widget(), pdledit_content(), photos_album_widget(), photos_content(), poco_init(), poke_content(), poll_content(), populate_acl(), profile_sidebar(), profiles_content(), rbmark_content(), redbasic_form(), register_content(), removeaccount_content(), removeme_content(), rmagic_content(), rpost_content(), search_content(), setup_content(), siteinfo_content(), sources_content(), suggest_content(), theme_attachments(), thing_content(), vcard_from_xchan(), viewconnections_content(), vote_content(), webpages_content(), widget_affinity(), widget_appselect(), widget_archive(), widget_bookmarkedchats(), widget_chatroom_list(), widget_filer(), widget_follow(), widget_mailmenu(), widget_notes(), widget_savedsearch(), widget_settings_menu(), widget_suggestedchats(), widget_suggestions(), writepages_widget(), and xrd_init().

get_plugin_info | ( |  | $plugin | ) |

parse plugin comment in search of plugin infos.

like

- Name: Plugin
- Description: A plugin which plugs in
- Version: 1.2.3
- Author: John <profile url>="">
- Author: Jane <email>
- Compat: Red [(version)], Friendica [(version)]
- Parameters

    string | $plugin | the name of the plugin

  Returns
    array with the plugin information

Referenced by admin_page_plugins().

get_theme_info | ( |  | $theme | ) |

parse theme comment in search of theme infos.

like

- Name: My Theme
- Description: My Cool Theme
- Version: 1.2.3
- Author: John <profile url>="">
- Maintainer: Jane <profile url>="">
- Compat: Friendica [(version)], Red [(version)]
- Parameters

    string | $theme | the name of the theme

  Returns
    array

Referenced by admin_page_themes(), and pretheme_init().

get_theme_screenshot | ( |  | $theme | ) |

Referenced by admin_page_themes(), and pretheme_init().

head_add_css | ( |  | $src,
|  |  | $media = `'screen'`
| ) |  |

add CSS to <head>

Parameters

  string | $src |
  string | $media | change media attribute (default to 'screen')

Returns
  void

Referenced by construct_page().

head_add_js | ( |  | $src | ) |

Referenced by construct_page().

head_get_css | ( |  | ) |

Referenced by App\build_pagehead().

head_get_js | ( |  | ) |

Referenced by App\build_pagehead().

head_get_main_js | ( |  | ) |

Referenced by App\build_pagehead().

head_remove_css | ( |  | $src,
|  |  | $media = `'screen'`
| ) |  |

head_remove_js | ( |  | $src | ) |

insert_hook | ( |  | $hook,
|  |  | $fn
| ) |  |

insert_hook($hook,$fn)

Insert a short-lived hook into the running page request. Hooks are normally persistent so that they can be called across asynchronous processes such as delivery and poll processes.

insert_hook lets you attach a hook callback immediately which will not persist beyond the life of this page request or the current process.

Parameters

  string | $hook,; | name of hook to attach callback
  string | $fn,; | function name of callback handler

install_plugin | ( |  | $plugin | ) |

installs an addon.

Parameters

  string | $plugin | name of the addon

Returns
  bool

Referenced by admin_page_plugins().

load_hooks | ( |  | ) |

Referenced by check_config(), and cli_startup().

load_plugin | ( |  | $plugin | ) |

loads an addon by it's name.

Parameters

  string | $plugin | name of the addon

Returns
  bool

Referenced by check_config(), and install_plugin().

plugin_is_installed | ( |  | $name | ) |

Referenced by get_system_apps().

register_hook | ( |  | $hook,
|  |  | $file,
|  |  | $function,
|  |  | $priority = `0`
| ) |  |

registers a hook.

Parameters

  string | $hook | the name of the hook
  string | $file | the name of the file that hooks into
  string | $function | the name of the function that the hook will call
  int | $priority | A priority (defaults to 0)

Returns
  mixed|bool

Referenced by blog_install().

reload_plugins | ( |  | ) |

Referenced by poller_run().

script_path | ( |  | ) |

Referenced by format_css_if_exists(), and format_js_if_exists().

theme_include | ( |  | $file,
|  |  | $root = `''`
| ) |  |

Referenced by construct_page(), format_css_if_exists(), format_js_if_exists(), FriendicaSmartyEngine\get_intltext_template(), FriendicaSmartyEngine\get_markup_template(), Template\get_markup_template(), and pdledit_content().

uninstall_plugin | ( |  | $plugin | ) |

uninstalls an addon.

Parameters

  string | $plugin | name of the addon

Returns
  bool

Referenced by admin_page_plugins().

unload_plugin | ( |  | $plugin | ) |

unloads an addon.

Parameters

  string | $plugin | name of the addon

Returns
  void

Referenced by check_config(), and uninstall_plugin().

unregister_hook | ( |  | $hook,
|  |  | $file,
|  |  | $function
| ) |  |

unregisters a hook.

Parameters

  string | $hook | the name of the hook
  string | $file | the name of the file that hooks into
  string | $function | the name of the function that the hook called

Returns
  mixed

Referenced by blog_uninstall().