本文整理汇总了PHP中run_function_once函数的典型用法代码示例。如果您正苦于以下问题:PHP run_function_once函数的具体用法?PHP run_function_once怎么用?PHP run_function_once使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_function_once函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrades
function upgrades()
{
if (elgg_is_admin_logged_in()) {
elgg_load_library(PLUGIN_ID . ':upgrades');
run_function_once(__NAMESPACE__ . '\\upgrade_20150321');
}
}
示例2: event_manager_init
function event_manager_init()
{
// Register subtype
run_function_once("event_manager_run_once_subtypes");
// Register entity_type for search
elgg_register_entity_type("object", Event::SUBTYPE);
elgg_extend_view("css/elgg", "event_manager/css/site");
elgg_extend_view("js/elgg", "js/event_manager/site");
elgg_extend_view("page/elements/head", "event_manager/metatags");
elgg_register_page_handler("events", "event_manager_page_handler");
// Register granular notification for this type
register_notification_object("object", Event::SUBTYPE, elgg_echo("event_manager:notification:subject"));
// Listen to notification events and supply a more useful message
elgg_register_plugin_hook_handler("notify:entity:message", "object", "event_manager_notify_message");
// add site menu item
elgg_register_menu_item("site", array("name" => "event_manager", "text" => elgg_echo("event_manager:menu:title"), "href" => "/events"));
// add group tool option
add_group_tool_option("event_manager", elgg_echo("groups:enableevents"), true);
// add to group profile
elgg_extend_view("groups/tool_latest", "event_manager/group_module");
// add widgets
elgg_register_widget_type("events", elgg_echo("event_manager:widgets:events:title"), elgg_echo("event_manager:widgets:events:description"), "index,dashboard,profile,groups");
elgg_register_plugin_hook_handler("widget_url", "widget_manager", "event_manager_widget_events_url");
// register js libraries
$maps_key = elgg_get_plugin_setting("google_api_key", "event_manager");
elgg_register_simplecache_view("js/event_manager/googlemaps");
$em_maps_js = elgg_get_simplecache_url("js", "event_manager/googlemaps");
elgg_register_js("event_manager.maps.helper", $em_maps_js);
elgg_register_js("event_manager.maps.base", "//maps.googleapis.com/maps/api/js?key=" . $maps_key . "&sensor=true");
elgg_register_js("addthisevent", elgg_get_site_url() . "mod/event_manager/vendors/addthisevent/atemay.js");
}
示例3: sitepages_init
/**
* Start the site pages plugin.
*/
function sitepages_init()
{
require_once dirname(__FILE__) . '/sitepages_functions.php';
global $CONFIG;
// register our subtype
run_function_once('sitepages_runonce');
// Register a page handler, so we can have nice URLs
register_page_handler('sitepages', 'sitepages_page_handler');
// Register a URL handler for external pages
register_entity_url_handler('sitepages_url', 'object', 'sitepages');
elgg_extend_view('footer/links', 'sitepages/footer_menu');
elgg_extend_view('metatags', 'sitepages/metatags');
// Replace the default index page if user has requested
if (get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') {
register_plugin_hook('index', 'system', 'sitepages_custom_index');
}
// parse views for keywords
register_plugin_hook('display', 'view', 'sitepages_parse_view');
// register the views we want to parse for the keyword replacement
// right now this is just the custom front page, but we can
// expand it to the other pages later.
$CONFIG->sitepages_parse_views = array('sitepages/custom_frontpage');
// an example of how to register and respond to the get_keywords trigger
register_plugin_hook('get_keywords', 'sitepages', 'sitepages_keyword_hook');
// grab the list of keywords and their views from plugins
if ($keywords = trigger_plugin_hook('get_keywords', 'sitepages', NULL, array())) {
$CONFIG->sitepages_keywords = $keywords;
}
register_action("sitepages/add", FALSE, $CONFIG->pluginspath . "sitepages/actions/add.php");
register_action("sitepages/addfront", FALSE, $CONFIG->pluginspath . "sitepages/actions/addfront.php");
register_action("sitepages/addmeta", FALSE, $CONFIG->pluginspath . "sitepages/actions/addmeta.php");
register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php");
register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php");
}
示例4: profile_manager_init
/**
* initialization of plugin
*
* @return unknown_type
*/
function profile_manager_init()
{
// Extend CSS
elgg_extend_view("css/admin", "profile_manager/css/global");
elgg_extend_view("css/admin", "profile_manager/css/admin");
elgg_extend_view("css/elgg", "profile_manager/css/global");
elgg_extend_view("css/elgg", "profile_manager/css/site");
elgg_extend_view("js/elgg", "profile_manager/js/site");
elgg_extend_view("js/admin", "profile_manager/js/admin");
// Register Page handler
elgg_register_page_handler("profile_manager", "profile_manager_page_handler");
// admin user add, registered here to overrule default action
elgg_register_action("useradd", dirname(__FILE__) . "/actions/useradd.php", "admin");
// Register all custom field types
register_custom_field_types();
// add profile_completeness widget
if (elgg_get_plugin_setting("enable_profile_completeness_widget", "profile_manager") == "yes") {
elgg_register_widget_type("profile_completeness", elgg_echo("widgets:profile_completeness:title"), elgg_echo("widgets:profile_completeness:description"), "profile,dashboard");
}
// free_text on register form
elgg_extend_view("register/extend_side", "profile_manager/register/free_text");
// where to put extra profile fields
if (elgg_get_plugin_setting("registration_extra_fields", "profile_manager") == "beside") {
// besides the default registration page
elgg_extend_view("register/extend_side", "profile_manager/register/fields");
} else {
// just below the default registration page
elgg_extend_view("register/extend", "profile_manager/register/fields");
}
// Run once function to configure this plugin
run_function_once('profile_manager_run_once', 1287964800);
// 2010-10-25
run_function_once('pm_fix_access_default');
}
示例5: subsite_manager_plugins_boot
function subsite_manager_plugins_boot()
{
// handle run once functions
run_function_once("subsite_manager_runonce");
run_function_once("subsite_manager_runonce_elgg18");
// Check if current user should be a admin of this site
if ($user = elgg_get_logged_in_user_entity()) {
// don't check for super admins
if (!subsite_manager_is_superadmin($user->getGUID())) {
// where are we
if (subsite_manager_on_subsite()) {
// is the user suppose to be an admin
if (elgg_get_site_entity()->isAdmin($user->getGUID())) {
// is the user currently an admin
if (!$user->isAdmin()) {
$user->makeAdmin();
}
} elseif ($user->isAdmin()) {
// user is an admin, but shouldn't be
$user->removeAdmin();
}
} elseif ($user->isAdmin()) {
// user is an admin, but shouldn't be
$user->removeAdmin();
}
}
}
// check the site email address
$config_email = elgg_get_config("siteemail");
$site = elgg_get_site_entity();
if (empty($config_email) || $site->email != $config_email) {
elgg_set_config("siteemail", $site->email);
}
}
示例6: vouchers_init
/**
* Vouchers plugin initialization functions.
*/
function vouchers_init()
{
// register a library of helper functions
elgg_register_library('elgg:vouchers', elgg_get_plugins_path() . 'vouchers/lib/vouchers.php');
// Register subtype
run_function_once('vouchers_manager_run_once_subtypes');
// Register entity_type for search
elgg_register_entity_type('object', Voucher::SUBTYPE);
// Site navigation
$item = new ElggMenuItem('vouchers', elgg_echo('vouchers:menu'), 'vouchers/all');
elgg_register_menu_item('site', $item);
// Extend CSS
elgg_extend_view('css/elgg', 'vouchers/css');
elgg_register_css('vouchers_tooltip_css', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
// Extend js
elgg_register_js('vouchersjs', elgg_get_site_url() . 'mod/vouchers/assets/vouchers.js');
elgg_register_js('vouchers_tooltip_js', '//code.jquery.com/ui/1.11.1/jquery-ui.js');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('vouchers', 'vouchers_page_handler');
// Register a URL handler for voucher
$release = get_version(true);
// Register a URL handler for agora
if ($release < 1.9) {
// version 1.8
elgg_register_entity_url_handler('object', 'vouchers', 'voucher_url');
} else {
// use this since Elgg 1.9
elgg_register_plugin_hook_handler('entity:url', 'object', 'vouchers_set_url');
}
// Register menu item to an ownerblock
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'vouchers_owner_block_menu');
// Register admin transaction log menu under "Utilities"
elgg_register_admin_menu_item('administer', 'vouchers_transactions_log', 'administer_utilities');
// register plugin hooks
elgg_register_plugin_hook_handler("public_pages", "walled_garden", "vouchers_walled_garden_hook");
// Register actions
$action_path = elgg_get_plugins_path() . 'vouchers/actions';
elgg_register_action("vouchers/addvoucher", "{$action_path}/addvoucher.php");
elgg_register_action("vouchers/delete", "{$action_path}/delvoucher.php");
elgg_register_action("vouchers/set_featured", "{$action_path}/vouchers/set_featured.php");
// set a voucher post as featured
elgg_register_action("vouchers/unset_featured", "{$action_path}/vouchers/unset_featured.php");
// unset a voucher post from featured
elgg_register_action("vouchers/get_with_points", "{$action_path}/vouchers/get_with_points.php");
// voucher purchase with points only
elgg_register_action('vouchers/be_interested', "{$action_path}/be_interested.php");
// send interest
elgg_register_action("vouchers/usersettings", "{$action_path}/usersettings.php");
// save user settings
// extend group main page
elgg_extend_view('groups/tool_latest', 'vouchers/group_module');
//elgg_extend_view("print", "printpreview/pageshell/pageshell");
// add the group vouchers tool option
add_group_tool_option('vouchers', elgg_echo('vouchers:group:enablevouchers'), true);
// Add vouchers widgets
elgg_register_widget_type('vouchers', elgg_echo('vouchers:widget'), elgg_echo('vouchers:widget:description'), 'profile,groups,dashboard');
// member's voucher posts
elgg_register_widget_type('vouchers_featured', elgg_echo('vouchers:widget:featured'), elgg_echo('vouchers:widget:featured:description'), 'dashboard');
// featured vouchers for dashboard
}
示例7: roles_init
/**
*
* Initializes the Roles plugin
*/
function roles_init($event, $type, $object)
{
elgg_register_library('roles', elgg_get_plugins_path() . 'roles/lib/roles.php');
elgg_register_library('roles_config', elgg_get_plugins_path() . 'roles/lib/config.php');
elgg_load_library('roles');
elgg_load_library('roles_config');
// Provides default roles by own handler. This should be extended by site specific handlers
elgg_register_plugin_hook_handler('roles:config', 'role', 'roles_get_roles_config');
// Catch all actions and page route requests
elgg_register_plugin_hook_handler('action', 'all', 'roles_actions_permissions');
elgg_register_plugin_hook_handler('route', 'all', 'roles_pages_permissions');
// Due to dynamically created (or extended) menus, we need to catch all 'register' hooks _after_ other modules added/removed their menu items
elgg_register_plugin_hook_handler('register', 'all', 'roles_menus_permissions', 9999);
// Set up roles based hooks and event listener, after all plugin is initialized
elgg_register_event_handler('ready', 'system', 'roles_hooks_permissions');
elgg_register_event_handler('ready', 'system', 'roles_events_permissions');
// Check for role configuration updates
if (elgg_is_admin_logged_in()) {
// @TODO think through if this should rather be a role-based permission
run_function_once('roles_update_100_to_101');
elgg_register_event_handler('ready', 'system', 'roles_check_update');
}
// Set up roles based view management
elgg_register_event_handler('ready', 'system', 'roles_register_views');
}
示例8: translation_editor_plugins_boot_event
function translation_editor_plugins_boot_event()
{
global $CONFIG;
run_function_once("translation_editor_version_053");
// add the custom_keys_locations to language paths
$custom_keys_path = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR;
if (is_dir($custom_keys_path)) {
$CONFIG->language_paths[$custom_keys_path] = true;
}
// force creation of static to prevent reload of unwanted translations
reload_all_translations();
translation_editor_load_custom_languages();
if (elgg_get_context() != "translation_editor") {
// remove disabled languages
translation_editor_unregister_translations();
}
// load custom translations
$user_language = get_current_language();
$elgg_default_language = "en";
$load_languages = array($user_language, $elgg_default_language);
$load_languages = array_unique($load_languages);
$disabled_languages = translation_editor_get_disabled_languages();
foreach ($load_languages as $language) {
if (empty($disabled_languages) || !in_array($language, $disabled_languages)) {
// add custom translations
translation_editor_load_translations($language);
}
}
}
示例9: OhYesChat
/**
* Init the OhYesChat
*
* @access system
* @return null;
*/
function OhYesChat()
{
$plugin = elgg_get_plugins_path() . 'OhYesChat/';
elgg_register_simplecache_view('css/ohyes/ohyeschat');
$ohyescss = elgg_get_simplecache_url('css', 'ohyes/ohyeschat');
elgg_register_css('ohyeschat.css', $ohyescss);
elgg_register_simplecache_view('css/ohyes/ohyeschat.admin');
$ohyescssadmin = elgg_get_simplecache_url('css', 'ohyes/ohyeschat.admin');
elgg_register_css('ohyeschat.admin.css', $ohyescssadmin);
elgg_register_simplecache_view('js/ohyes/ohyescha');
$ohyesjs = elgg_get_simplecache_url('js', 'ohyes/ohyeschat');
elgg_register_js('ohyeschat.js', $ohyesjs);
if (elgg_is_logged_in()) {
elgg_register_page_handler('ohyeschat', 'ohyeschat_page_handler');
elgg_register_page_handler('chat', 'ohyeschat_page_handler');
}
elgg_register_action('ohyes/chat/deletemssages', "{$plugin}actions/admin/deletemssages.php", 'admin');
elgg_extend_view('page/elements/foot', 'ohyes/chat/bar');
elgg_extend_view('page/elements/body', 'ohyes/header/chat', 1);
elgg_extend_view('page/elements/body', 'ohyes/chat/sound');
OhYesChat::loadCss();
OhYesChat::loadJs();
run_function_once('ohyeschat_setup');
//register menu items
OhYesChat::RegisterMenus();
}
示例10: upgrades
function upgrades()
{
if (!elgg_is_admin_logged_in()) {
return;
}
require_once __DIR__ . '/upgrades.php';
run_function_once(__NAMESPACE__ . '\\upgrade20150911');
}
示例11: upgrades
function upgrades()
{
if (!elgg_is_admin_logged_in()) {
return true;
}
elgg_load_library(__NAMESPACE__ . '\\upgrades');
run_function_once(__NAMESPACE__ . '\\upgrade_20141130');
}
示例12: group_tools_init
function group_tools_init()
{
// extend css & js
elgg_extend_view("css/elgg", "group_tools/css/site");
// register JS and CSS libs
elgg_register_js("jquery.autocomplete.min", elgg_get_site_url() . "vendors/jquery/jquery.autocomplete.min.js");
elgg_register_simplecache_view("js/group_tools/autocomplete");
elgg_register_js("group_tools.autocomplete", elgg_get_simplecache_url("js", "group_tools/autocomplete"));
elgg_register_simplecache_view("css/group_tools/autocomplete");
elgg_register_css("group_tools.autocomplete", elgg_get_simplecache_url("css", "group_tools/autocomplete"));
// extend groups page handler
elgg_register_plugin_hook_handler("route", "groups", "group_tools_route_groups_handler");
// hook on title menu
elgg_register_plugin_hook_handler("register", "menu:title", "group_tools_menu_title_handler");
elgg_register_plugin_hook_handler("register", "menu:user_hover", "group_tools_menu_entity_handler");
if (elgg_get_plugin_setting("multiple_admin", "group_tools") == "yes") {
// add group tool option
add_group_tool_option("group_multiple_admin_allow", elgg_echo("group_tools:multiple_admin:group_tool_option"), false);
// register permissions check hook
elgg_register_plugin_hook_handler("permissions_check", "group", "group_tools_multiple_admin_can_edit_hook");
// register on group leave
elgg_register_event_handler("leave", "group", "group_tools_multiple_admin_group_leave");
}
// register group activity widget
// 2012-05-03: restored limited functionality of group activity widget, will be fully restored if Elgg fixes widget settings
elgg_register_widget_type("group_river_widget", elgg_echo("widgets:group_river_widget:title"), elgg_echo("widgets:group_river_widget:description"), "dashboard,profile,index,groups", true);
// unregister dashboard widget
elgg_unregister_widget_type("group_activity");
// register group members widget
elgg_register_widget_type("group_members", elgg_echo("widgets:group_members:title"), elgg_echo("widgets:group_members:description"), "groups", false);
// register groups invitations widget
elgg_register_widget_type("group_invitations", elgg_echo("widgets:group_invitations:title"), elgg_echo("widgets:group_invitations:description"), "index,dashboard", false);
// register featured groups widget
elgg_register_widget_type("featured_groups", elgg_echo("groups:featured"), elgg_echo("widgets:featured_groups:description"), "index");
// group invitation
elgg_register_action("groups/invite", dirname(__FILE__) . "/actions/groups/invite.php");
// manage auto join for groups
elgg_extend_view("groups/edit", "group_tools/forms/auto_join", 400);
elgg_register_event_handler("create", "member_of_site", "group_tools_join_site_handler");
// show group edit as tabbed
elgg_extend_view("groups/edit", "group_tools/group_edit_tabbed", 1);
elgg_extend_view("groups/edit", "group_tools/group_edit_tabbed_js", 999999999);
// show group profile widgets - edit form
elgg_extend_view("groups/edit", "group_tools/forms/profile_widgets", 400);
// show group status in owner block
elgg_extend_view("page/elements/owner_block/extend", "group_tools/owner_block");
// show group status in stats (on group profile)
elgg_extend_view("groups/profile/summary", "group_tools/group_stats");
if (elgg_is_admin_logged_in()) {
run_function_once("group_tools_version_1_3");
}
// group creation can be limited to admins
if (!elgg_is_admin_logged_in() && group_tools_is_group_creation_limited()) {
elgg_unregister_action("groups/edit");
}
// register index widget to show latest discussions
elgg_register_widget_type("index_discussions", elgg_echo("discussion:latest"), elgg_echo("widgets:index_discussions:description"), "index", false);
}
示例13: upgrades
function upgrades()
{
// only allow admin to perform upgrades
if (!elgg_is_admin_logged_in()) {
return true;
}
elgg_load_library('plugins:upgrades');
run_function_once(__NAMESPACE__ . '\\upgrade_20141121');
run_function_once(__NAMESPACE__ . '\\upgrade_20141125');
}
示例14: profile_manager_init
/**
* initialization of plugin
*
* @return void
*/
function profile_manager_init()
{
// register libraries
elgg_register_js("jquery.ui.multiselect", "mod/profile_manager/vendors/jquery_ui_multiselect/jquery.multiselect.js");
// Extend CSS
elgg_extend_view("css/admin", "css/profile_manager/global");
elgg_extend_view("css/admin", "css/profile_manager/admin");
elgg_extend_view("css/admin", "css/profile_manager/multiselect");
elgg_extend_view("css/elgg", "css/profile_manager/multiselect");
elgg_extend_view("css/elgg", "css/profile_manager/global");
elgg_extend_view("css/elgg", "css/profile_manager/site");
elgg_extend_view("js/elgg", "js/profile_manager/site");
elgg_extend_view("js/admin", "js/profile_manager/admin");
// Register Page handler
elgg_register_page_handler("profile_manager", "profile_manager_page_handler");
// admin user add, registered here to overrule default action
elgg_register_action("useradd", dirname(__FILE__) . "/actions/useradd.php", "admin");
// Register all custom field types
profile_manager_register_custom_field_types();
// add profile_completeness widget
if (elgg_get_plugin_setting("enable_profile_completeness_widget", "profile_manager") == "yes") {
elgg_register_widget_type("profile_completeness", elgg_echo("widgets:profile_completeness:title"), elgg_echo("widgets:profile_completeness:description"), array("profile", "dashboard"));
}
elgg_register_widget_type("register", elgg_echo("widgets:register:title"), elgg_echo("widgets:register:description"), array("index"));
// free_text on register form
elgg_extend_view("register/extend_side", "profile_manager/register/free_text");
// where to put extra profile fields
elgg_extend_view("register/extend_side", "profile_manager/register/fields");
elgg_extend_view("register/extend", "profile_manager/register/fields");
// login history
elgg_extend_view('core/settings/statistics', 'profile_manager/account/login_history');
// hook for extending menus
elgg_register_plugin_hook_handler('register', 'menu:entity', 'profile_manager_register_entity_menu', 600);
// extend public pages
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'profile_manager_public_pages');
elgg_register_plugin_hook_handler('permissions_check:annotate', 'site', 'profile_manager_permissions_check_annotate');
// enable username change
elgg_extend_view("forms/account/settings", "profile_manager/account/username", 50);
// positioned at the beginning of the options
// register hook for saving the new username
elgg_register_plugin_hook_handler('usersettings:save', 'user', 'profile_manager_username_change_hook');
// site join event handler
elgg_register_event_handler("create", "member_of_site", "profile_manager_create_member_of_site");
// always cleanup
elgg_register_event_handler("delete", "member_of_site", "profile_manager_delete_member_of_site");
// Run once function to configure this plugin
run_function_once('profile_manager_run_once', 1287964800);
// 2010-10-25
run_function_once('profile_manager_fix_access_default');
// register ajax views
elgg_register_ajax_view("forms/profile_manager/type");
elgg_register_ajax_view("forms/profile_manager/category");
elgg_register_ajax_view("forms/profile_manager/group_field");
elgg_register_ajax_view("forms/profile_manager/profile_field");
}
示例15: roles_pm_init
function roles_pm_init()
{
elgg_register_event_handler('create', 'object', 'roles_pm_event_create');
elgg_register_event_handler('delete', 'object', 'roles_pm_event_delete');
// Listen to profile_manager and change user role when profile type changes
elgg_register_event_handler('all', 'metadata', 'roles_pm_profile_type_change');
// Listen to roles and change profile type when role changes
elgg_register_event_handler('all', 'has_role', 'roles_pm_role_change');
// Initial setup of profile types based on existing roles
run_function_once('roles_pm_create_profile_types_from_roles');
}