/** * main function that register everything * * @global <type> $CONFIG */ function init_izap_videos() { global $CONFIG; // render this plugin from izap-elgg-bridge now if (is_plugin_enabled('izap-elgg-bridge')) { func_init_plugin_byizap(array('plugin' => array('name' => GLOBAL_IZAP_VIDEOS_PLUGIN))); } else { register_error('This plugin needs izap-elgg-bridge'); disable_plugin(GLOBAL_IZAP_VIDEOS_PLUGIN); } // for the first time, admin settings are not set so send admin to the setting page, to set the default settings if (isadminloggedin() && (int) datalist_get('izap_videos_installtime') == 0) { datalist_set('izap_videos_installtime', time()); forward($CONFIG->wwwroot . 'pg/videos/adminSettings/' . get_loggedin_user()->username . '?option=settings'); } // extend the views if (is_callable('elgg_extend_view')) { $extend_view = 'elgg_extend_view'; } else { $extend_view = 'extend_view'; } // include the main lib file include dirname(__FILE__) . '/lib/izapLib.php'; // load all the required files izapLoadLib_izap_videos(); // register pagehandler register_page_handler('videos', 'pageHandler_izap_videos'); register_page_handler('izap_videos_files', 'pageHandler_izap_videos_files'); // register the notification hook if (is_callable('register_notification_object')) { register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded')); } $period = get_plugin_setting('izap_cron_time', GLOBAL_IZAP_VIDEOS_PLUGIN); if (isOnserverEnabled() && is_plugin_enabled('crontrigger') && $period != 'none') { register_plugin_hook('cron', $period, 'izap_queue_cron'); } // asking group to include the izap_videos if (is_callable('add_group_tool_option')) { add_group_tool_option('izap_videos', elgg_echo('izap_videos:group:enablevideo'), true); } // register the notification hook if (is_callable('register_notification_object')) { register_notification_object('object', 'izap_videos', elgg_echo('izap_videos:newVideoAdded')); } // skip tags from filteration if (is_old_elgg()) { //allow some tags for elgg lesser than 1.6 $CONFIG->allowedtags['object'] = array('width' => array(), 'height' => array(), 'classid' => array(), 'codebase' => array(), 'data' => array(), 'type' => array()); $CONFIG->allowedtags['param'] = array('name' => array(), 'value' => array()); $CONFIG->allowedtags['embed'] = array('src' => array(), 'type' => array(), 'wmode' => array(), 'width' => array(), 'height' => array()); } else { $allowed_tags = get_plugin_setting('izapHTMLawedTags', GLOBAL_IZAP_VIDEOS_PLUGIN); $CONFIG->htmlawed_config['elements'] = 'object, embed, param, p, img, b, i, ul, li, ol, u, a, s, blockquote, br, strong, em' . ($allowed_tags ? ', ' . $allowed_tags : ''); } run_function_once('izapSetup_izap_videos'); $extend_view('css', 'izap_videos/css/default'); $extend_view('metatags', 'izap_videos/js/javascript'); //$extend_view('profile/menu/links','izap_videos/menu'); $extend_view('groups/right_column', 'izap_videos/gruopVideos', 1); // only if enabled by admin if (izapIncludeIndexWidget_izap_videos()) { $extend_view('index/righthandside', 'izap_videos/customindexVideos'); } // only if enabled by admin if (izapTopBarWidget_izap_videos()) { $extend_view('elgg_topbar/extend', 'izap_videos/navBar'); } // finally lets register the object register_entity_type('object', 'izap_videos'); }
/** * Main function that register everything */ function init_izap_videos() { elgg_extend_view('css/elgg', 'izap_videos/css'); elgg_extend_view('css/admin', 'izap_videos/css'); // Register the main lib $base_dir = elgg_get_plugins_path() . 'izap_videos/lib'; elgg_register_library('izap_videos:core', "{$base_dir}/izapLib.php"); elgg_load_library('izap_videos:core'); // Load all the required libraries izapLoadLib_izap_videos(); elgg_register_ajax_view('izap_videos/admin/getQueue'); elgg_register_ajax_view('izap_videos/playpopup'); // Set up the site menu elgg_register_menu_item('site', array('name' => 'videos', 'href' => 'videos/all', 'text' => elgg_echo('videos'))); // Add admin menu item elgg_register_admin_menu_item('administer', 'izap_videos', 'administer_utilities'); // Add link to owner block elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'izap_videos_owner_block_menu'); // Register for the entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'izap_videos_entity_menu_setup'); // Register pagehandler elgg_register_page_handler('videos', 'izap_videos_pagehandler'); elgg_register_page_handler('izap_videos_files', 'izap_videos_files_pagehandler'); // Register url handler elgg_register_plugin_hook_handler('entity:url', 'object', 'izap_videos_urlhandler'); // Register a plugin hook to allow custom river view for comments made on videos elgg_register_plugin_hook_handler('view', 'river/object/comment/create', 'izap_videos_river_comment'); // Register notification hook elgg_register_notification_event('object', 'izap_videos', array('create')); elgg_register_plugin_hook_handler('prepare', 'notification:create:object:izap_videos', 'izap_videos_notify_message'); $period = izapAdminSettings_izap_videos('izap_cron_time'); if ($period != 'none') { elgg_register_plugin_hook_handler('cron', $period, 'izap_queue_cron'); } // Group videos add_group_tool_option('izap_videos', elgg_echo('izap_videos:group:enablevideo'), true); elgg_extend_view('groups/tool_latest', 'izap_videos/group_module'); // Adding izap_videos widget elgg_register_widget_type('izap_videos', elgg_echo('izap_videos:videos'), elgg_echo('izap_videos:widget')); if (elgg_is_active_plugin('widget_manager')) { //add index widget for Widget Manager plugin elgg_register_widget_type('index_latest_videos', elgg_echo("izap_videos:mostrecent"), elgg_echo('izap_videos:mostrecent:description'), array("index")); //add groups widget for Widget Manager plugin elgg_register_widget_type('groups_latest_videos', elgg_echo("izap_videos:mostrecent"), elgg_echo('izap_videos:mostrecent:group:description'), array("groups")); //register title urls for widgets elgg_register_plugin_hook_handler("entity:url", "object", "izap_videos_widget_urls"); } // Allow liking of videos elgg_register_plugin_hook_handler('likes:is_likable', 'object:izap_videos', 'Elgg\\Values::getTrue'); // Register for search elgg_register_entity_type('object', 'izap_videos'); // Register some actions $action_path = elgg_get_plugins_path() . 'izap_videos/actions/izap_videos'; elgg_register_action('izap_videos/admin/settings', "{$action_path}/admin/settings.php", 'admin'); elgg_register_action('izap_videos/admin/api_keys', "{$action_path}/admin/api_keys.php", 'admin'); elgg_register_action('izap_videos/admin/resetSettings', "{$action_path}/admin/resetSettings.php", 'admin'); elgg_register_action('izap_videos/admin/recycle', "{$action_path}/admin/recycle.php", 'admin'); elgg_register_action('izap_videos/admin/recycle_delete', "{$action_path}/admin/recycle_delete.php", 'admin'); elgg_register_action('izap_videos/admin/reset', "{$action_path}/admin/reset.php", 'admin'); elgg_register_action('izap_videos/admin/upgrade', "{$action_path}/admin/upgrade.php", 'admin'); elgg_register_action('izap_videos/addEdit', "{$action_path}/addEdit.php", 'logged_in'); elgg_register_action('izap_videos/delete', "{$action_path}/delete.php", 'logged_in'); elgg_register_action('izap_videos/favorite_video', "{$action_path}/favorite_video.php", 'logged_in'); }