本文整理汇总了PHP中elgg_add_admin_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_add_admin_notice函数的具体用法?PHP elgg_add_admin_notice怎么用?PHP elgg_add_admin_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_add_admin_notice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simplekaltura_init
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;
}
示例2: categories_on_activate
/**
* Add a reminder to set default categories.
*/
function categories_on_activate()
{
$site = elgg_get_site_entity();
if (!$site->categories) {
$url = elgg_normalize_url('admin/plugin_settings/categories');
$message = elgg_echo('categories:on_enable_reminder', array($url));
elgg_add_admin_notice('categories_admin_notice_no_categories', $message);
}
return TRUE;
}
示例3: izap_bridge_init
function izap_bridge_init()
{
global $CONFIG;
//including venders directory in default include paths.
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/vendors/');
// initializes the bridge plugin
izap_plugin_init(GLOBAL_IZAP_ELGG_BRIDGE);
//registering tab view javascript
elgg_register_js('jquery.md5', 'mod/izap-elgg-bridge/vendors/tabs_view.js');
//load library for the bridge(using bridge)
IzapBase::loadLib(array('plugin' => GLOBAL_IZAP_ELGG_BRIDGE, 'lib' => 'init'));
// over-ride "admin" pagehandler
elgg_register_page_handler('admin', GLOBAL_IZAP_PAGEHANDLER);
// register some basic hooks
elgg_register_plugin_hook_handler('register', 'user', 'izap_registration_sniffer');
elgg_register_event_handler('login', 'user', 'izap_login_sniffer');
elgg_register_event_handler('create', 'all', 'izap_entity_creation_sniffer');
elgg_register_event_handler('update', 'all', 'izap_entity_updation_sniffer');
elgg_register_event_handler('delete', 'all', 'izap_entity_deletion_sniffer');
elgg_register_event_handler('ready', 'system', 'system_ready_hook');
elgg_register_plugin_hook_handler('config', 'htmlawed', 'izap_htmlawed_hook');
// set pages for the admin
elgg_register_admin_menu_item('administer', 'marked-spammers', 'users');
// @todo: merge to izap menu
elgg_register_admin_menu_item('administer', 'suspected-spammers', 'users');
// @todo: merge to izap menu
/**
* common horizontal control menu hook registration for all plugins dependent
* on izap-elgg-bridge
*/
elgg_register_plugin_hook_handler('register', 'menu:entity', 'izap_entity_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_mark_spammer');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_unmark_spammer');
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'izap_suspected_spammer');
elgg_extend_view('page/elements/footer', GLOBAL_IZAP_ELGG_BRIDGE . '/our_link');
if (elgg_is_admin_logged_in()) {
if (IzapBase::pluginSetting(array('name' => 'izap_api_key', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)) == '') {
elgg_add_admin_notice('api_key', elgg_echo('izap-bridge:add_api'));
}
}
$global_currency = IzapBase::pluginSetting(array('name' => 'izap_site_currency', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE));
if ($global_currency == '') {
$CONFIG->site_currency_name = 'USD';
$CONFIG->SITE_CURRENCY_SIGN = '$';
} else {
$site_currency = explode(':', $global_currency);
$CONFIG->site_currency_name = $site_currency[0];
$CONFIG->site_currency_sign = $site_currency[1];
}
// regiter antispam with elgg
elgg_register_ajax_view('/js/antispam/userstats');
}
示例4: __construct
/**
* Constructs a geocoder and builds providers from plugin settings
*/
function __construct()
{
if (!isset(self::$adapter)) {
self::$adapter = new GuzzleHttpAdapter();
}
if (!isset(self::$providers)) {
self::$providers = array_filter(array($this->buildFreeGeoIpProvider()));
}
if (!count(self::$providers)) {
elgg_add_admin_notice('geo:providers', elgg_echo('geo:providers:none'));
} else {
if (!isset(self::$geocoder)) {
$geocoder = new Geocoder();
$geocoder->registerProviders(self::$providers);
self::$geocoder = $geocoder;
}
}
}
示例5: __construct
/**
* Constructs a geocoder and builds providers from plugin settings
*/
function __construct()
{
if (!isset(self::$adapter)) {
self::$adapter = new CurlHttpAdapter();
}
if (!isset(self::$providers)) {
self::$providers = array_filter(array($this->buildGoogleMapsProvider(), $this->buildNominatimProvider(), $this->buildYandexProvider(), $this->buildGoogleMapsBusinessProvider()));
}
if (!count(self::$providers)) {
elgg_add_admin_notice('geo:providers', elgg_echo('geo:providers:none'));
} else {
if (!isset(self::$geocoder)) {
$geocoder = new Geocoder();
$chain = new ChainProvider(self::$providers);
$geocoder->registerProvider($chain);
self::$geocoder = $geocoder;
}
}
}
示例6: delete
/**
* Override ElggFile::delete()
*
* After deleting the file delete also the directory.
*
* @return bool
*/
public function delete()
{
$fs = $this->getFilestore();
$dir = $this->getFileDirectory();
// Delete the file on disc
if ($fs->delete($this)) {
// Delete the ElggFile entity
if (parent::delete()) {
// Delete the directory
if (is_dir($dir)) {
if (rmdir($dir)) {
return true;
} else {
elgg_add_admin_notice('video_dir_delete_failed', elgg_echo('video:dir_delete_failed', $dir));
}
}
}
}
return false;
}
示例7: elgg_load_plugins
/**
* Loads all active plugins in the order specified in the tool admin panel.
*
* @note This is called on every page load. If a plugin is active and problematic, it
* will be disabled and a visible error emitted. This does not check the deps system because
* that was too slow.
*
* @return bool
* @since 1.8.0
* @access private
*/
function elgg_load_plugins()
{
$plugins_path = elgg_get_plugins_path();
$start_flags = ELGG_PLUGIN_INCLUDE_START | ELGG_PLUGIN_REGISTER_VIEWS | ELGG_PLUGIN_REGISTER_LANGUAGES | ELGG_PLUGIN_REGISTER_CLASSES;
if (!$plugins_path) {
return false;
}
// temporary disable all plugins if there is a file called 'disabled' in the plugin dir
if (file_exists("{$plugins_path}/disabled")) {
if (elgg_is_admin_logged_in() && elgg_in_context('admin')) {
system_message(elgg_echo('plugins:disabled'));
}
return false;
}
if (elgg_get_config('system_cache_loaded')) {
$start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS;
}
if (elgg_get_config('i18n_loaded_from_cache')) {
$start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES;
}
$return = true;
$plugins = elgg_get_plugins('active');
if ($plugins) {
foreach ($plugins as $plugin) {
try {
$plugin->start($start_flags);
} catch (Exception $e) {
$plugin->deactivate();
$msg = elgg_echo('PluginException:CannotStart', array($plugin->getID(), $plugin->guid, $e->getMessage()));
elgg_add_admin_notice('cannot_start' . $plugin->getID(), $msg);
$return = false;
continue;
}
}
}
return $return;
}
示例8: video_create_thumbnails
/**
* Make thumbnails of given video position. Defaults to beginning of video.
*
* @param Video $video The video object
* @param int $position Video position
*/
function video_create_thumbnails($video, $position = 0)
{
$icon_sizes = elgg_get_config('icon_sizes');
$square = elgg_get_plugin_setting('square_icons', 'video');
// Default to square thumbnail images
if (is_null($square)) {
$square = true;
}
$square = $square == 1 ? true : false;
$dir = $video->getFileDirectory();
$guid = $video->getGUID();
// Use default thumbnail as master
$imagepath = "{$dir}/icon-master.jpg";
try {
$thumbnailer = new VideoThumbnailer();
$thumbnailer->setInputFile($video->getFilenameOnFilestore());
$thumbnailer->setOutputFile($imagepath);
$thumbnailer->setPosition($position);
$thumbnailer->execute();
} catch (exception $e) {
$msg = elgg_echo('VideoException:ThumbnailCreationFailed', array($video->getFilenameOnFilestore(), $e->getMessage(), $thumbnailer->getCommand()));
error_log($msg);
elgg_add_admin_notice('video_thumbnailing_error', $msg);
return false;
}
$files = array();
// Create the thumbnails
foreach ($icon_sizes as $name => $size_info) {
// We have already created master image
if ($name == 'master') {
continue;
}
$resized = get_resized_image_from_existing_file($imagepath, $size_info['w'], $size_info['h'], $square);
if ($resized) {
$file = new ElggFile();
$file->owner_guid = $video->owner_guid;
$file->container_guid = $guid;
$file->setFilename("video/{$guid}/icon-{$name}.jpg");
$file->open('write');
$file->write($resized);
$file->close();
$files[] = $file;
} else {
error_log("ERROR: Failed to create thumbnail '{$name}' for video {$video->getFilenameOnFilestore()}.");
// Delete all images if one fails
foreach ($files as $file) {
$file->delete();
}
return false;
}
}
$video->icontime = time();
return true;
}
示例9: array
<?php
$settings = array('max_users' => 50, 'delete_users' => 0, 'ignore_banned_users' => 1, 'period' => 'fifteenmin', 'max_last_action' => '-90 days', 'max_last_login' => '-90 days', 'max_time_created' => '-90 days', 'max_time_updated' => '-90 days', 'max_objects' => '5', 'max_metadata' => '10', 'max_annotations' => '1', 'offset' => 0);
foreach ($settings as $name => $value) {
if (!elgg_get_plugin_setting($name, 'stale_users')) {
elgg_set_plugin_setting($name, $value, 'stale_users');
}
}
elgg_add_admin_notice('stale_users_enable', elgg_echo('stale_users:activate'));
示例10: elgg_load_plugins
/**
* Loads all active plugins in the order specified in the tool admin panel.
*
* @note This is called on every page load. If a plugin is active and problematic, it
* will be disabled and a visible error emitted. This does not check the deps system because
* that was too slow.
*
* @return bool
* @since 1.8.0
* @access private
*/
function elgg_load_plugins()
{
global $CONFIG;
$plugins_path = elgg_get_plugins_path();
$start_flags = ELGG_PLUGIN_INCLUDE_START | ELGG_PLUGIN_REGISTER_VIEWS | ELGG_PLUGIN_REGISTER_LANGUAGES | ELGG_PLUGIN_REGISTER_CLASSES;
if (!$plugins_path) {
return false;
}
// temporary disable all plugins if there is a file called 'disabled' in the plugin dir
if (file_exists("{$plugins_path}/disabled")) {
return false;
}
// Load view caches if available
$cached_view_paths = elgg_filepath_cache_load('views');
$cached_view_types = elgg_filepath_cache_load('view_types');
$cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types);
if ($cached_view_info) {
$CONFIG->views = unserialize($cached_view_paths);
$CONFIG->view_types = unserialize($cached_view_types);
// don't need to register views
$start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS;
}
$return = true;
$plugins = elgg_get_plugins('active');
if ($plugins) {
foreach ($plugins as $plugin) {
try {
$plugin->start($start_flags);
} catch (Exception $e) {
$plugin->deactivate();
$msg = elgg_echo('PluginException:CannotStart', array($plugin->getID(), $plugin->guid, $e->getMessage()));
elgg_add_admin_notice('cannot_start' . $plugin->getID(), $msg);
$return = false;
continue;
}
}
}
// Cache results
if (!$cached_view_info) {
elgg_filepath_cache_save('views', serialize($CONFIG->views));
elgg_filepath_cache_save('view_types', serialize($CONFIG->view_types));
}
return $return;
}
示例11: video_conversion_cron
/**
* Trigger the video conversion
*/
function video_conversion_cron($hook, $entity_type, $returnvalue, $params)
{
$ia = elgg_set_ignore_access(true);
$videos = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'video', 'limit' => 2, 'metadata_name_value_pairs' => array('name' => 'conversion_done', 'value' => 0)));
elgg_load_library('elgg:video');
foreach ($videos as $video) {
$sources = $video->getSources();
$success = true;
foreach ($sources as $source) {
// Converted sources may exist if previous conversion has been interrupted
if ($source->conversion_done == true) {
continue;
}
try {
$filename = $source->getFilenameOnFilestore();
// Create a new video file to data directory
$converter = new VideoConverter();
$converter->setInputFile($video->getFilenameOnFilestore());
$converter->setOutputFile($filename);
$converter->setResolution($source->resolution);
$converter->setBitrate($source->bitrate);
$result = $converter->convert();
// Save video details
$info = new VideoInfo($source);
$source->resolution = $info->getResolution();
$source->bitrate = $info->getBitrate();
$source->conversion_done = true;
$source->save();
echo "<p>Successfully created video file {$source->getFilename()}</p>";
} catch (Exception $e) {
// Print simple error to screen
echo "<p>Failed to create video file {$source->getFilename()}</p>";
$success = false;
// Print detailed error to error log
$message = elgg_echo('VideoException:ConversionFailed', array($filename, $e->getMessage(), $converter->getCommand()));
error_log($message);
elgg_add_admin_notice('conversion_error', $message);
}
}
if ($success) {
$video->conversion_done = true;
add_to_river('river/object/video/create', 'create', $video->getOwnerGUID(), $video->getGUID());
}
}
elgg_set_ignore_access($ia);
return $returnvalue;
}
示例12: elgg_add_admin_notice
<?php
/**
* Elgg 1.8.3 upgrade 2012041800
* dont_filter_passwords
*
* Add admin notice that password handling has changed and if
* users can't login to have them reset their passwords.
*/
elgg_add_admin_notice('dont_filter_passwords', 'Password handling has been updated to be more secure and flexible. ' . 'This change may prevent a small number of users from logging in with their existing passwords. ' . 'If a user is unable to log in, please advise him or her to reset their password, or reset it as an admin user.');
示例13: update_subtype
<?php
// Register a class for the object/group_request subtype
if (get_subtype_id('object', 'group_request')) {
update_subtype('object', 'group_request', '\\Groups\\Requests\\Request');
} else {
add_subtype('object', 'group_request', '\\Groups\\Requests\\Request');
}
$limited_groups = elgg_get_plugin_setting('limited_groups', 'groups');
// Notify admin if group creation has not been restricted to admins
if ($limited_groups !== 'yes') {
$group_settings = elgg_view('output/url', array('text' => elgg_echo('group_requests:limited_groups:enable'), 'href' => 'admin/plugin_settings/groups'));
elgg_add_admin_notice('limited_groups_disabled', elgg_echo('group_requests:limited_groups:disabled', array($group_settings)));
}
示例14: event_calendar_check_pending_upgrades
function event_calendar_check_pending_upgrades()
{
elgg_load_library('elgg:event_calendar');
elgg_delete_admin_notice('event_calendar_admin_notice_pending_upgrades');
if (event_calendar_is_upgrade_available()) {
$message = elgg_echo('event_calendar:admin_notice_pending_upgrades', array(elgg_normalize_url('admin/plugin_settings/event_calendar')));
elgg_add_admin_notice('event_calendar_admin_notice_pending_upgrades', $message);
}
}
示例15: get_config
<?php
/**
* Prompt the user to add categories after activating
*/
//categories_admin_notice_no_categories
$site = get_config('site');
if (!$site->categories) {
$message = elgg_echo('categories:on_activate_reminder', array(elgg_normalize_url('admin/plugin_settings/categories')));
elgg_add_admin_notice('categories_admin_notice_no_categories', $message);
}