Ejemplo n.º 1
0
function simplekaltura_init()
{
    $plugin_root = dirname(__FILE__);
    elgg_register_library('simplekaltura', "{$plugin_root}/lib/simplekaltura_lib.php");
    elgg_register_library('KalturaClient', "{$plugin_root}/vendors/kaltura_client/KalturaClient.php");
    elgg_load_library('simplekaltura');
    // helper libs
    $libs = array('swfobject', 'html5', 'utility', 'thumbs');
    foreach ($libs as $lib) {
        $url = elgg_get_simplecache_url('js', "simplekaltura/{$lib}");
        elgg_register_js("simplekaltura:{$lib}", $url);
    }
    // Register SKUploader
    elgg_register_external_view('js/simplekaltura/SKUploader.js', TRUE);
    // Include html5 js library
    elgg_load_js('simplekaltura:html5');
    elgg_load_js('simplekaltura:utility');
    elgg_extend_view('css/elgg', 'simplekaltura/css');
    // If plugin is properly configured
    if (simplekaltura_is_configured()) {
        // Add to main menu
        $item = new ElggMenuItem('simplekaltura', elgg_get_plugin_setting('kaltura_entity_title', 'simplekaltura'), 'videos');
        elgg_register_menu_item('site', $item);
        // Register page handler
        elgg_register_page_handler('videos', 'simplekaltura_page_handler');
    } else {
        elgg_add_admin_notice('simpkaltura_not_configured', elgg_echo('simplekaltura:error:pluginnotconfigured'));
    }
    // add the group pages tool option
    add_group_tool_option('simplekaltura', elgg_echo('groups:enablesimplekaltura'), TRUE);
    // Profile block hook
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'simplekaltura_owner_block_menu');
    // Modify entity menu for addional video items
    elgg_register_plugin_hook_handler('register', 'menu:entity', 'simplekaltura_setup_entity_menu');
    // notifications
    elgg_register_notification_event('object', 'simplekaltura_video', array('create'));
    elgg_register_plugin_hook_handler('prepare', 'notification:publish:object:simplekaltura_video', 'simplekaltura_prepare_notification');
    // actions
    $actions_root = "{$plugin_root}/actions/simplekaltura";
    elgg_register_action('simplekaltura/save', "{$actions_root}/save.php");
    elgg_register_action('simplekaltura/update', "{$actions_root}/update.php");
    elgg_register_action('simplekaltura/get_embed', "{$actions_root}/get_embed.php");
    elgg_register_action('simplekaltura/featured', "{$actions_root}/featured.php", 'admin');
    elgg_register_action('videos/delete', "{$actions_root}/delete.php");
    elgg_register_action('simplekaltura/migrate', "{$actions_root}/migrate.php", 'admin');
    // entity url and icon handlers
    elgg_register_plugin_hook_handler('entity:url', 'object', 'simplekaltura_url_handler');
    elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'simplekaltura_icon_url_override');
    // Register type
    elgg_register_entity_type('object', 'simplekaltura_video');
    // register CRON hook to poll video plays/duration/etc..
    elgg_register_plugin_hook_handler('cron', 'fifteenmin', 'simplekaltura_bulk_update');
    // Most Played Sidebar
    elgg_extend_view('simplekaltura/sidebar', 'simplekaltura/featured');
    elgg_extend_view('simplekaltura/sidebar', 'simplekaltura/most_played');
    // Whitelist ajax views
    elgg_register_ajax_view('simplekaltura/popup');
    return TRUE;
}
Ejemplo n.º 2
0
function developers_init()
{
    elgg_register_event_handler('pagesetup', 'system', 'developers_setup_menu');
    elgg_extend_view('admin.css', 'developers/css');
    elgg_extend_view('elgg.css', 'developers/css');
    elgg_register_page_handler('theme_sandbox', 'developers_theme_sandbox_controller');
    elgg_register_external_view('developers/ajax');
    // for lightbox in sandbox
    $sandbox_css = elgg_get_simplecache_url('theme_sandbox.css');
    elgg_register_css('dev.theme_sandbox', $sandbox_css);
    $action_base = __DIR__ . '/actions/developers';
    elgg_register_action('developers/settings', "{$action_base}/settings.php", 'admin');
}
Ejemplo n.º 3
0
Archivo: start.php Proyecto: elgg/elgg
function developers_init()
{
    elgg_register_plugin_hook_handler('register', 'menu:page', '_developers_page_menu');
    elgg_extend_view('admin.css', 'developers/css');
    elgg_extend_view('elgg.css', 'developers/css');
    elgg_register_page_handler('theme_sandbox', 'developers_theme_sandbox_controller');
    elgg_register_page_handler('developers_ajax_demo', 'developers_ajax_demo_controller');
    elgg_register_external_view('developers/ajax');
    // for lightbox in sandbox
    $sandbox_css = elgg_get_simplecache_url('theme_sandbox.css');
    elgg_register_css('dev.theme_sandbox', $sandbox_css);
    elgg_register_ajax_view('forms/developers/ajax_demo');
    elgg_register_ajax_view('theme_sandbox/components/tabs/ajax_demo');
}
Ejemplo n.º 4
0
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');
}
Ejemplo n.º 5
0
Archivo: elgglib.php Proyecto: n8b/VMN
/**
 * Elgg's main init.
 *
 * Handles core actions for comments, the JS pagehandler, and the shutdown function.
 *
 * @elgg_event_handler init system
 * @return void
 * @access private
 */
function _elgg_init()
{
    global $CONFIG;
    elgg_register_action('comment/save');
    elgg_register_action('comment/delete');
    elgg_register_page_handler('js', '_elgg_js_page_handler');
    elgg_register_page_handler('css', '_elgg_css_page_handler');
    elgg_register_page_handler('ajax', '_elgg_ajax_page_handler');
    elgg_register_page_handler('favicon.ico', '_elgg_favicon_page_handler');
    elgg_register_page_handler('manifest.json', function () {
        $site = elgg_get_site_entity();
        $resource = new \Elgg\Http\WebAppManifestResource($site);
        header('Content-Type: application/json');
        echo json_encode($resource->get());
        return true;
    });
    elgg_register_plugin_hook_handler('head', 'page', function ($hook, $type, array $result) {
        $result['links']['manifest'] = ['rel' => 'manifest', 'href' => elgg_normalize_url('/manifest.json')];
        return $result;
    });
    elgg_register_js('elgg.autocomplete', 'js/lib/ui.autocomplete.js');
    elgg_register_js('jquery.ui.autocomplete.html', 'vendors/jquery/jquery.ui.autocomplete.html.js');
    elgg_define_js('jquery.ui.autocomplete.html', array('src' => '/vendors/jquery/jquery.ui.autocomplete.html.js', 'deps' => array('jquery.ui')));
    elgg_register_external_view('js/elgg/UserPicker.js', true);
    elgg_register_js('elgg.friendspicker', 'js/lib/ui.friends_picker.js');
    elgg_register_js('elgg.avatar_cropper', 'js/lib/ui.avatar_cropper.js');
    elgg_register_js('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect/scripts/jquery.imgareaselect.min.js');
    elgg_register_js('elgg.ui.river', 'js/lib/ui.river.js');
    elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect/css/imgareaselect-deprecated.css');
    // Trigger the shutdown:system event upon PHP shutdown.
    register_shutdown_function('_elgg_shutdown_hook');
    // Sets a blacklist of words in the current language.
    // This is a comma separated list in word:blacklist.
    // @todo possibly deprecate
    $CONFIG->wordblacklist = array();
    $list = explode(',', elgg_echo('word:blacklist'));
    if ($list) {
        foreach ($list as $l) {
            $CONFIG->wordblacklist[] = trim($l);
        }
    }
}
Ejemplo n.º 6
0
/**
 * Register a view to be available for ajax calls
 *
 * @warning Only views that begin with 'js/' and 'css/' have their content
 * type set to 'text/javascript' and 'text/css'. Other views are served as
 * 'text/html'.
 *
 * @param string $view The view name
 * @return void
 * @since 1.8.3
 */
function elgg_register_ajax_view($view)
{
    elgg_register_external_view($view, false);
}
Ejemplo n.º 7
0
/**
 * Elgg's main init.
 *
 * Handles core actions for comments, the JS pagehandler, and the shutdown function.
 *
 * @elgg_event_handler init system
 * @return void
 * @access private
 */
function _elgg_init()
{
    global $CONFIG;
    elgg_register_action('comment/save');
    elgg_register_action('comment/delete');
    elgg_register_page_handler('js', '_elgg_js_page_handler');
    elgg_register_page_handler('css', '_elgg_css_page_handler');
    elgg_register_page_handler('ajax', '_elgg_ajax_page_handler');
    elgg_register_js('elgg.autocomplete', 'js/lib/ui.autocomplete.js');
    elgg_register_js('jquery.ui.autocomplete.html', 'vendors/jquery/jquery.ui.autocomplete.html.js');
    elgg_register_external_view('js/elgg/UserPicker.js', true);
    elgg_register_js('elgg.friendspicker', 'js/lib/ui.friends_picker.js');
    elgg_register_js('elgg.avatar_cropper', 'js/lib/ui.avatar_cropper.js');
    elgg_register_js('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect/scripts/jquery.imgareaselect.min.js');
    elgg_register_js('elgg.ui.river', 'js/lib/ui.river.js');
    elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect/css/imgareaselect-deprecated.css');
    // Trigger the shutdown:system event upon PHP shutdown.
    register_shutdown_function('_elgg_shutdown_hook');
    // Sets a blacklist of words in the current language.
    // This is a comma separated list in word:blacklist.
    // @todo possibly deprecate
    $CONFIG->wordblacklist = array();
    $list = explode(',', elgg_echo('word:blacklist'));
    if ($list) {
        foreach ($list as $l) {
            $CONFIG->wordblacklist[] = trim($l);
        }
    }
}
Ejemplo n.º 8
0
 /**
  * Registers a view to simple cache.
  *
  * Simple cache is a caching mechanism that saves the output of
  * a view and its extensions into a file.  If the view is called
  * by the {@link engine/handlers/cache_handler.php} file, the Elgg
  * engine will not be loaded and the contents of the view will returned
  * from file.
  *
  * @warning Simple cached views must take no parameters and return
  * the same content no matter who is logged in.
  *
  * @param string $view_name View name
  *
  * @return void
  * @see elgg_get_simplecache_url()
  */
 function registerView($view_name)
 {
     $view_name = $this->views->canonicalizeViewName($view_name);
     elgg_register_external_view($view_name, true);
 }
Ejemplo n.º 9
0
/**
 * Registers a view to simple cache.
 *
 * Simple cache is a caching mechanism that saves the output of
 * a view and its extensions into a file.  If the view is called
 * by the {@link engine/handlers/cache_handler.php} file, the Elgg
 * engine will not be loaded and the contents of the view will returned
 * from file.
 *
 * @warning Simple cached views must take no parameters and return
 * the same content no matter who is logged in.
 *
 * @param string $view_name View name
 *
 * @return void
 * @see elgg_get_simplecache_url()
 * @since 1.8.0
 */
function elgg_register_simplecache_view($view_name)
{
    elgg_register_external_view($view_name, true);
}
Ejemplo n.º 10
0
 /**
  * Registers a view to simple cache.
  *
  * Simple cache is a caching mechanism that saves the output of
  * a view and its extensions into a file.  If the view is called
  * by the {@link engine/handlers/cache_handler.php} file, the Elgg
  * engine will not be loaded and the contents of the view will returned
  * from file.
  *
  * @warning Simple cached views must take no parameters and return
  * the same content no matter who is logged in.
  *
  * @param string $view_name View name
  *
  * @return void
  * @see elgg_get_simplecache_url()
  */
 function registerView($view_name)
 {
     elgg_register_external_view($view_name, true);
 }