本文整理汇总了PHP中elgg_require_js函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_require_js函数的具体用法?PHP elgg_require_js怎么用?PHP elgg_require_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_require_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifier_init
/**
* Initialize the plugin
*
* @return void
*/
function notifier_init()
{
notifier_set_view_listener();
// Add hidden popup module to topbar
elgg_extend_view('page/elements/topbar', 'notifier/popup');
elgg_require_js('notifier/notifier');
elgg_register_page_handler('notifier', 'notifier_page_handler');
// Add css
elgg_extend_view('elgg.css', 'notifier/notifier.css');
elgg_register_notification_method('notifier');
elgg_register_plugin_hook_handler('send', 'notification:notifier', 'notifier_notification_send');
elgg_register_plugin_hook_handler('route', 'friendsof', 'notifier_read_friends_notification');
elgg_register_event_handler('create', 'relationship', 'notifier_relationship_notifications');
elgg_register_event_handler('delete', 'relationship', 'notifier_read_group_invitation_notification');
// Hook handler for cron that removes old messages
elgg_register_plugin_hook_handler('cron', 'daily', 'notifier_cron');
elgg_register_plugin_hook_handler('register', 'menu:topbar', 'notifier_topbar_menu_setup');
elgg_register_event_handler('create', 'user', 'notifier_enable_for_new_user');
elgg_register_event_handler('join', 'group', 'notifier_enable_for_new_group_member');
$action_path = elgg_get_plugins_path() . 'notifier/actions/notifier/';
elgg_register_action('notifier/dismiss', $action_path . 'dismiss.php');
elgg_register_action('notifier/dismiss_one', $action_path . 'dismiss_one.php');
elgg_register_action('notifier/clear', $action_path . 'clear.php');
elgg_register_action('notifier/delete', $action_path . 'delete.php');
}
示例2: views_parse
/**
* parse allowable views and set classes on links for video rendering
*
* @staticvar type $allowable_views
* @param type $hook
* @param type $type
* @param type $return
* @param type $params
* @return type
*/
function views_parse($hook, $type, $return, $params)
{
static $allowable_views, $allow_internal;
if (!is_array($allowable_views)) {
$allowable_views = get_allowable_views();
}
if (!in_array($type, $allowable_views)) {
return $return;
}
if (is_null($allow_internal)) {
$allow_internal = elgg_get_plugin_setting('internal_urls', PLUGIN_ID, 0);
}
// we're potentially adding items
elgg_require_js('embedly_cards/embedly_cards');
// mark all links as embedly-video and let embedly sort it out
libxml_use_internal_errors(true);
$doc = new \DOMDocument();
$doc->loadHTML($return);
foreach ($doc->getElementsByTagName('a') as $tag) {
$href = $tag->hasAttribute('href') ? $tag->getAttribute('href') : null;
if (!$href || strpos($href, 'http') !== 0) {
continue;
}
if (strpos($href, elgg_get_site_url()) === 0 && !$allow_internal) {
continue;
}
$tag->setAttribute('class', ($tag->hasAttribute('class') ? $tag->getAttribute('class') . ' ' : '') . 'embedly-video');
}
libxml_clear_errors();
return $doc->saveHTML();
}
示例3: stripe_init
function stripe_init()
{
// Register Stripe js
//elgg_register_js('stripe.js', 'https://js.stripe.com/v2/', 'head', 50);
//elgg_load_js('stripe.js');
elgg_define_js('stripe', ['src' => 'https://js.stripe.com/v2/stripe.js']);
elgg_require_js('stripe');
elgg_extend_view('js/initialize_elgg', 'js/stripe/config');
elgg_extend_view('js/elgg', 'js/stripe/cards');
elgg_extend_view('css/elgg', 'css/stripe/css');
elgg_extend_view('css/admin', 'css/stripe/css');
// Registering actions
elgg_register_action('stripe/customers/sync', __DIR__ . '/actions/stripe/customers/sync.php', 'admin');
elgg_register_action('stripe/cards/add', __DIR__ . '/actions/stripe/cards/add.php', 'public');
elgg_register_action('stripe/cards/remove', __DIR__ . '/actions/stripe/cards/remove.php');
elgg_register_action('stripe/cards/set_default', __DIR__ . '/actions/stripe/cards/make_default.php');
elgg_register_action('stripe/subscriptions/cancel', __DIR__ . '/actions/stripe/subscriptions/cancel.php');
// Page handler
elgg_register_page_handler('billing', 'stripe_page_handler');
elgg_register_plugin_hook_handler('register', 'menu:stripe-actions', 'stripe_actions_menu');
elgg_register_plugin_hook_handler('ping', 'stripe.events', 'stripe_ping_event');
elgg_register_plugin_hook_handler('customer.created', 'stripe.events', 'stripe_customer_created_event');
elgg_register_plugin_hook_handler('customer.deleted', 'stripe.events', 'stripe_customer_deleted_event');
elgg_register_plugin_hook_handler('charge.succeeded', 'stripe.events', 'stripe_charge_succeeded_event');
elgg_register_plugin_hook_handler('charge.failed', 'stripe.events', 'stripe_charge_failed_event');
elgg_register_plugin_hook_handler('charge.refunded', 'stripe.events', 'stripe_charge_refunded_event');
// Stripe Webhooks
elgg_ws_expose_function('stripe.webhooks', 'stripe_webhook_handler', array('environment' => array('type' => 'string', 'required' => true)), 'Handles webhooks received from Stripe', 'POST', false, false);
// Map newly registered users to their Stripe profiles if any
elgg_register_event_handler('create', 'user', 'stripe_register_user');
}
示例4: tour_init
/**
* Initialize the plugin.
*/
function tour_init()
{
$js_lib = elgg_get_plugin_setting('js_library', 'tour');
if ($js_lib == 'joyride') {
elgg_register_css('joyride', '/mod/tour/vendors/joyride/joyride-2.1.css');
elgg_load_css('joyride');
elgg_define_js('joyride', array('src' => '/mod/tour/vendors/joyride/jquery.joyride-2.1.js', 'exports' => 'joyride'));
} else {
elgg_register_css('hopscotch', '/mod/tour/vendors/hopscotch/css/hopscotch.min.css');
elgg_load_css('hopscotch');
elgg_define_js('hopscotch', array('src' => '/mod/tour/vendors/hopscotch/hopscotch.min.js', 'exports' => 'hopscotch'));
}
elgg_require_js('elgg/tour/display');
//elgg_require_js('elgg/tour/edit');
elgg_register_ajax_view('ajax/tour_stop/save');
elgg_extend_view('page/elements/footer', 'tour/outline');
elgg_extend_view('css/elgg', 'css/tour');
elgg_extend_view('css/admin', 'css/tour_admin');
elgg_register_action('tour_page/save', __DIR__ . '/actions/tour_page/save.php', 'admin');
elgg_register_action('tour_page/reorder', __DIR__ . '/actions/tour_page/reorder.php', 'admin');
elgg_register_action('tour_page/delete', __DIR__ . '/actions/tour_page/delete.php', 'admin');
elgg_register_action('tour_stop/save', __DIR__ . '/actions/tour_stop/save.php', 'admin');
elgg_register_action('tour_stop/delete', __DIR__ . '/actions/tour_stop/delete.php', 'admin');
elgg_register_page_handler('tour', 'tour_page_handler');
elgg_register_page_handler('tour_stop', 'tour_page_handler');
// For convenience
elgg_register_admin_menu_item('administer', 'tour', 'administer_utilities');
elgg_register_menu_item('topbar', array('name' => 'tour', 'href' => '', 'text' => elgg_echo('tour:start'), 'id' => 'tour-start', 'section' => 'alt', 'data-library' => $js_lib));
elgg_register_plugin_hook_handler('register', 'menu:entity', array('Tour\\Page\\EntityMenu', 'setUp'));
elgg_register_plugin_hook_handler('register', 'menu:entity', array('Tour\\Stop\\EntityMenu', 'setUp'));
elgg_register_viewtype('json');
}
示例5: uservalidationbyemail_init
function uservalidationbyemail_init()
{
require_once dirname(__FILE__) . '/lib/functions.php';
// Register page handler to validate users
// This doesn't need to be an action because security is handled by the validation codes.
elgg_register_page_handler('uservalidationbyemail', 'uservalidationbyemail_page_handler');
// mark users as unvalidated and disable when they register
elgg_register_plugin_hook_handler('register', 'user', 'uservalidationbyemail_disable_new_user');
// forward to uservalidationbyemail/emailsent page after register
elgg_register_plugin_hook_handler('forward', 'system', 'uservalidationbyemail_after_registration_url');
// canEdit override to allow not logged in code to disable a user
elgg_register_plugin_hook_handler('permissions_check', 'user', 'uservalidationbyemail_allow_new_user_can_edit');
// prevent users from logging in if they aren't validated
register_pam_handler('uservalidationbyemail_check_auth_attempt', "required");
// prevent the engine from logging in users via login()
elgg_register_event_handler('login:before', 'user', 'uservalidationbyemail_check_manual_login');
// make admin users always validated
elgg_register_event_handler('make_admin', 'user', 'uservalidationbyemail_validate_new_admin_user');
// register Walled Garden public pages
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'uservalidationbyemail_public_pages');
// admin interface to manually validate users
elgg_register_admin_menu_item('administer', 'unvalidated', 'users');
elgg_extend_view('admin.css', 'uservalidationbyemail/css');
// inline module
elgg_extend_view('elgg.js', 'elgg/uservalidationbyemail.js');
elgg_require_js('elgg/uservalidationbyemail');
}
示例6: hydra_theme_init
function hydra_theme_init()
{
elgg_unextend_view('page/elements/header', 'search/header');
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
if (elgg_get_context() != "admin") {
elgg_require_js("lorea_hydra/js");
}
$bower = elgg_get_site_url() . "mod/lorea_hydra/vendors/bower_components/";
elgg_register_css("bootstrap", "{$bower}bootstrap/dist/css/bootstrap.css", 0);
elgg_register_css("bootstrap-select", "{$bower}bootstrap-select/dist/css/bootstrap-select.min.css");
elgg_register_css("jasny", "{$bower}jasny-bootstrap/dist/css/jasny-bootstrap.min.css");
elgg_register_css("lorea_hydra", elgg_get_site_url() . "mod/hydra_theme/css/lorea_hydra.css", 10000);
elgg_define_js("bootstrap", array("src" => "{$bower}bootstrap/dist/js/bootstrap.min.js"));
//elgg_register_js("bootstrap", "{$bower}bootstrap/dist/js/bootstrap.min.js");
elgg_register_js("bootstrap-select", "{$bower}bootstrap-select/dist/js/bootstrap-select.min.js");
elgg_register_js("jasny", "{$bower}jasny-bootstrap/dist/js/jasny-bootstrap.min.js");
elgg_register_js("lorea_hydra", elgg_get_site_url() . "mod/hydra_theme/css/lorea_hydra.css", 10000);
if (elgg_get_context() != "admin") {
elgg_load_css("bootstrap");
elgg_load_css("bootstrap-select");
elgg_load_css("lorea_hydra");
elgg_load_css("jasny");
elgg_load_js("bootstrap");
elgg_load_js("jasny");
elgg_load_js("bootstrap-select");
elgg_load_js("lorea_hydra");
}
}
示例7: elgg_clean_init
function elgg_clean_init()
{
elgg_unextend_view('page/elements/header', 'search/header');
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
if (elgg_get_context() != "admin") {
elgg_require_js("elgg_clean/js");
}
elgg_register_event_handler('pagesetup', 'system', 'elgg_clean_pagesetup', 1000);
elgg_register_plugin_hook_handler('head', 'page', 'elgg_clean_setup_head');
$bower = elgg_get_site_url() . "mod/elgg_clean/vendors/bower_components/";
elgg_register_css("bootstrap", "{$bower}bootstrap/dist/css/bootstrap.css", 0);
elgg_register_css("open", "http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic");
elgg_register_css("passion", "http://fonts.googleapis.com/css?family=Passion+One");
elgg_register_css("elgg_clean", elgg_get_site_url() . "mod/elgg_clean/css/elgg_clean.css", 10000);
elgg_register_css("font-awesome", "{$bower}fontawesome/css/font-awesome.min.css");
elgg_register_css("bootstrap-select", "{$bower}bootstrap-select/dist/css/bootstrap-select.min.css");
elgg_register_css("jasny", "{$bower}jasny-bootstrap/dist/css/jasny-bootstrap.min.css");
elgg_register_css("fuelux", "{$bower}fuelux/dist/css/fuelux.min.css");
elgg_register_css("agency", elgg_get_site_url() . "mod/elgg_clean/css/agency.css", 20000);
elgg_register_css("home", elgg_get_site_url() . "mod/elgg_clean/css/home.css", 30000);
elgg_register_js('respond', '{$bower}respond/src/respond.js');
elgg_define_js("bootstrap", array("src" => "{$bower}bootstrap/dist/js/bootstrap.min.js"));
elgg_register_js("bootstrap-select", "{$bower}bootstrap-select/dist/js/bootstrap-select.min.js");
elgg_register_js("jasny", "{$bower}jasny-bootstrap/dist/js/jasny-bootstrap.min.js");
elgg_register_js("agency", elgg_get_site_url() . "mod/elgg_clean/js/agency.js");
elgg_register_js("cbpAnimatedHeader", elgg_get_site_url() . "mod/elgg_clean/js/cbpAnimatedHeader.js");
elgg_register_js("classie", elgg_get_site_url() . "mod/elgg_clean/js/classie.js");
elgg_register_js("contact_me", elgg_get_site_url() . "mod/elgg_clean/js/contact_me.js");
elgg_register_js("scrollspy", "{$bower}scrollspy/jquery.scrollspy.js");
elgg_register_js("parallax", "{$boder}jquery-parallax/scripts/jquery.parallax-1.13.js");
elgg_register_js("scrollto", "{$bower}jquery-parallax/scripts/jquery.scrollTo-1.4.2-min.js");
elgg_define_js('fuelux', array('src' => "{$bower}fuelux/dist/js/fuelux.min.js"));
if (elgg_get_context() != "admin") {
elgg_load_js('respond');
elgg_load_js("bootstrap");
elgg_load_js("jscolor");
elgg_load_js("elgg_clean");
elgg_load_js("bootstrap-select");
elgg_load_js("jasny");
elgg_load_js("agency");
elgg_load_js("parallax");
elgg_load_js("scrollto");
elgg_require_js("fuelux");
elgg_load_css("bootstrap");
elgg_load_css("open");
elgg_load_css("passion");
elgg_load_css("font-awesome");
elgg_load_css("bootstrap-select");
elgg_load_css("elgg_clean");
elgg_load_css("jasny");
elgg_load_css("fuelux");
elgg_load_css("agency");
}
// non-members do not get visible links to RSS feeds
if (!elgg_is_logged_in()) {
elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
}
elgg_register_action("elgg_clean/contact", elgg_get_plugins_path() . "elgg_clean/actions/contact.php", "public");
}
示例8: elgg_cookieconsent_init
function elgg_cookieconsent_init()
{
if (!elgg_in_context('admin')) {
elgg_require_js('elgg_cookieconsent/cookieconsent_init');
}
elgg_register_simplecache_view('js/elgg_cookieconsent/settings.js');
elgg_extend_view('css/elgg', 'css/cookieconsent.css');
}
示例9: target_blank_init
/**
* Inits the plugin
*
* @return void
*/
function target_blank_init()
{
elgg_require_js('target_blank/target_blank');
// this cached view uses PHP to provide settings from database to javascript
elgg_register_simplecache_view('js/target_blank/settings.js');
elgg_register_action('target_blank/settings/save', dirname(__FILE__) . '/actions/settings/save.php', 'admin');
elgg_register_page_handler('target_blank', function () {
echo elgg_view_resource('target_blank/test');
});
}
示例10: xoxco_tags_init
function xoxco_tags_init()
{
elgg_extend_view('css/elgg', 'xoxco_tags/css/elgg_after', 501);
elgg_extend_view('css/admin', 'xoxco_tags/css/elgg_after', 501);
elgg_define_js('jquery.tagsinput', array('src' => '/mod/xoxco_tags/js/lib/jquery.tagsinput.min.js'));
// Include the feature only if Elgg is displaying the tags input
elgg_register_plugin_hook_handler('view', 'input/tags', function () {
elgg_require_js('xoxco_tags');
});
}
示例11: elgg_tokeninput_init
/**
* Initialize the plugin
*/
function elgg_tokeninput_init()
{
elgg_register_library('elgg.tokeninput', elgg_get_plugins_path() . 'elgg_tokeninput/lib/tokeninput.php');
elgg_define_js('jquery.tokeninput', array('src' => 'mod/elgg_tokeninput/vendors/jquery-tokeninput/build/jquery.tokeninput.min.js', 'deps' => array('jquery')));
elgg_require_js('tokeninput/init');
elgg_extend_view('css/elgg', 'css/tokeninput/stylesheet.css');
elgg_extend_view('css/admin', 'css/tokeninput/stylesheet.css');
elgg_register_plugin_hook_handler('action', 'all', 'elgg_tokeninput_explode_field_values', 1);
elgg_register_page_handler(ELGG_TOKENINPUT_PAGEHANDLER, 'elgg_tokeninput_page_handler');
elgg_extend_view('theme_sandbox/forms', 'theme_sandbox/forms/elgg_tokeninput');
}
示例12: elgg_lightbox_init
/**
* Initialize the plugin
* @return void
*/
function elgg_lightbox_init()
{
if (!elgg_is_active_plugin('mrclay_combiner')) {
elgg_unregister_js('lightbox');
}
elgg_unregister_css('lightbox');
elgg_extend_view('elgg.css', 'colorbox.css');
elgg_extend_view('admin.css', 'colorbox.css');
if (version_compare(elgg_get_version(true), '2.2', '<')) {
elgg_extend_view('elgg.js', 'elgg/lightbox.js');
elgg_require_js('elgg/lightbox');
}
}
示例13: jssor_page_handler
function jssor_page_handler($page)
{
if (!isset($page[0])) {
return false;
}
if ($page[0] == 'album') {
elgg_require_js('jssor/settings');
elgg_require_js('jssor/gallery');
include elgg_get_plugins_path() . 'jssor/pages/jssor/album.php';
return true;
}
return false;
}
示例14: developers_init
function developers_init()
{
elgg_register_event_handler('pagesetup', 'system', 'developers_setup_menu');
elgg_extend_view('css/admin', 'developers/css');
elgg_extend_view('css/elgg', 'developers/css');
elgg_register_page_handler('theme_preview', 'developers_theme_preview_controller');
elgg_register_external_view('developers/ajax');
// for lightbox in sandbox
$action_base = elgg_get_plugins_path() . 'developers/actions/developers';
elgg_register_action('developers/settings', "{$action_base}/settings.php", 'admin');
elgg_register_action('developers/inspect', "{$action_base}/inspect.php", 'admin');
elgg_register_js('jquery.jstree', array('src' => '/mod/developers/vendors/jsTree/jquery.jstree.js', 'location' => 'footer', 'exports' => 'jQuery.fn.jstree', 'deps' => array('jquery')));
elgg_register_css('jquery.jstree', '/mod/developers/vendors/jsTree/themes/default/style.css');
elgg_require_js('elgg/dev');
}
示例15: my_plugin_init
function my_plugin_init()
{
// Rename this function based on the name of your plugin and update the
// elgg_register_event_handler() call accordingly
// Register a script to handle (usually) a POST request (an action)
$base_dir = elgg_get_plugins_path() . 'my_plugin/actions/my_plugin';
elgg_register_action('my_plugin', "{$base_dir}/my_action.php");
// Extend the main CSS file
elgg_extend_view('css/elgg', 'css/my_plugin.css');
// Require your JavaScript AMD module (view "js/my_plugin.js") on every page
elgg_require_js('my_plugin');
// Add a menu item to the main site menu
$item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url');
elgg_register_menu_item('site', $item);
}