本文整理汇总了PHP中elgg_echo函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_echo函数的具体用法?PHP elgg_echo怎么用?PHP elgg_echo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_echo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($page)
{
admin_gatekeeper();
global $CONFIG;
$cshop = new stdClass();
$this->controller = GLOBAL_IZAP_CURRENT_CONTROLLER;
$this->action = 'action' . ucfirst($page[0]);
$this->_page = $page;
$this->url_vars = $this->_page;
$this->page_layout = $this->page_shell = 'admin';
$cshop->view = $this->_view = 'admin/' . implode('/', $page);
$this->page_elements['title'] = elgg_echo("admin:{$page[0]}");
if (count($page) > 1) {
$this->page_elements['title'] .= ' : ' . elgg_echo('admin:' . implode(':', $page));
}
if (method_exists($this, $this->action)) {
elgg_admin_add_plugin_settings_menu();
elgg_set_context('admin');
elgg_unregister_css('elgg');
$url = elgg_get_simplecache_url('js', 'admin');
elgg_register_js('elgg.admin', $url);
elgg_load_js('elgg.admin');
elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js');
elgg_load_js('jquery.jeditable');
}
$CONFIG->cshop = $cshop;
}
示例2: get_entity_list_title
function get_entity_list_title($localtype, $relationship)
{
$title = '';
switch ($localtype) {
case 'national':
$title = elgg_echo('localgroups:regionalgroups');
break;
case 'regional':
if ($relationship == 'parent') {
$title = elgg_echo('localgroups:nationalgroups');
} else {
$title = elgg_echo('localgroups:departementalgroups');
}
break;
case 'departemental':
if ($relationship == 'parent') {
$title = elgg_echo('localgroups:regionalgroups');
} else {
$title = elgg_echo('localgroups:towngroups');
}
break;
case 'town':
$title = elgg_echo('localgroups:departementalgroups');
break;
}
return $title;
}
示例3: content_subscriptions_prepare_comment_notification
/**
* Change the default notification message for comments
*
* @param string $hook the name of the hook
* @param stirng $type the type of the hook
* @param Elgg_Notifications_Notification $return_value the current return value
* @param array $params supplied values
*
* @return Elgg_Notifications_Notification
*/
function content_subscriptions_prepare_comment_notification($hook, $type, $return_value, $params)
{
if (empty($return_value) || !$return_value instanceof \Elgg\Notifications\Notification) {
return $return_value;
}
if (empty($params) || !is_array($params)) {
return $return_value;
}
$event = elgg_extract("event", $params);
if (empty($event) || !$event instanceof \Elgg\Notifications\Event) {
return $return_value;
}
// ignore access for now
$ia = elgg_set_ignore_access(true);
$comment = $event->getObject();
$actor = $event->getActor();
$object = $comment->getContainerEntity();
$language = elgg_extract("language", $params, get_current_language());
$recipient = elgg_extract("recipient", $params);
$return_value->subject = elgg_echo("content_subscriptions:create:comment:subject", array($object->title), $language);
$return_value->body = elgg_echo("content_subscriptions:create:comment:message", array($recipient->name, $actor->name, $object->title, $comment->description, $object->getURL()), $language);
$return_value->summary = elgg_echo("content_subscriptions:create:comment:summary", array($object->title), $language);
// restore access
elgg_set_ignore_access($ia);
return $return_value;
}
示例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: prepare
/**
* Sanitizes and validates user input
* @throws GraphException
* @return Parameter
*/
public function prepare()
{
$this->value = get_input($this->name, $this->default);
if ($this->value !== null) {
if ($this->type == self::TYPE_ENUM) {
if (!in_array($this->value, $this->enum_values)) {
$msg = elgg_echo('Exception:UnsupportedEnumValue', array($this->value, $this->name, implode(', ', $this->enum_values)));
throw new GraphException($msg);
}
} else {
// Cast values to specified type
if (!settype($this->value, $this->type)) {
if (isset($this->default)) {
$this->value = $this->default;
} else {
$msg = elgg_echo('Exception:UnrecognisedTypeCast', array($this->type, $this->name));
throw new GraphException($msg);
}
}
}
}
// Validate required values
if ($this->required) {
if ($this->type == Parameter::TYPE_ARRAY && empty($this->value) || $this->value === '' || $this->value === null) {
$msg = elgg_echo('Exception:MissingParameterInMethod', array($this->name));
throw new GraphException($msg);
}
}
if ($this->name == 'limit' && $this->value > Graph::LIMIT_MAX) {
$this->value = Graph::LIMIT_MAX;
}
return $this;
}
示例6: gvcontact_page_handler
/**
* gvcontact page handler
*
* @param array $page URL segements
* @param string $handler Handler identifier
* @return bool
*/
function gvcontact_page_handler($page, $handler)
{
$title = elgg_echo('gvcontact:contacttitle');
$content = elgg_view_form('gvcontact/contact');
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($title, $body);
}
示例7: outputPluginSettingsForm
/**
* @param ElggPlugin $plugin
* @return string
*/
public function outputPluginSettingsForm($plugin)
{
$translationPrefix = elgg_extract('translationPrefix', $this->options);
$result = '<div>';
foreach ($this->fields as $name => $field) {
$result .= '<div class="mbm">';
$result .= '<label>' . elgg_echo($translationPrefix . $name) . '</label> ';
$description = elgg_extract('description', $field);
if ($description) {
$result .= '<div class="mbs">' . $description . '</div> ';
}
$params = $field;
$type = elgg_extract('type', $field);
$params['name'] = "params[{$name}]";
if ($plugin) {
$params['value'] = $plugin->{$name};
}
if (!isset($params['value']) || $params['value'] === null) {
$params['value'] = elgg_extract('default', $field);
}
$result .= elgg_view('input/' . $type, $params);
$result .= '</div>';
}
$result .= '</div>';
return $result;
}
示例8: pages_tools_init
/**
* Called during system init
*
* @return void
*/
function pages_tools_init()
{
// register DOM PDF as a library
elgg_register_library("dompdf", dirname(__FILE__) . "/vendor/dompdf/dompdf/dompdf_config.inc.php");
// extend site css
elgg_extend_view("css/elgg", "css/pages_tools/site");
// extend site js
elgg_extend_view("js/elgg", "js/pages_tools/site");
// register JS library
elgg_register_js("jquery.tree", elgg_get_site_url() . "mod/pages_tools/vendors/jstree/jquery.tree.min.js");
elgg_register_css("jquery.tree", elgg_get_site_url() . "mod/pages_tools/vendors/jstree/themes/classic/style.css");
// add widgets (overrule default pages widget, to add group support)
elgg_register_widget_type("pages", elgg_echo("pages"), elgg_echo("pages:widget:description"), array("profile", "dashboard", "groups"));
elgg_register_widget_type("index_pages", elgg_echo("pages"), elgg_echo("pages_tools:widgets:index_pages:description"), array("index"), true);
// register plugin hooks
elgg_register_plugin_hook_handler("route", "pages", "pages_tools_route_pages_hook");
elgg_register_plugin_hook_handler("register", "menu:entity", "pages_tools_entity_menu_hook");
elgg_register_plugin_hook_handler("permissions_check:comment", "object", "pages_tools_permissions_comment_hook");
elgg_register_plugin_hook_handler("widget_url", "widget_manager", "pages_tools_widget_url_hook");
elgg_register_plugin_hook_handler("cron", "daily", "pages_tools_daily_cron_hook");
// events
elgg_register_event_handler('create', 'object', 'pages_tools_cache_handler');
elgg_register_event_handler('update', 'object', 'pages_tools_cache_handler');
elgg_register_event_handler('delete', 'object', 'pages_tools_cache_handler');
// register actions
elgg_register_action("pages/export", dirname(__FILE__) . "/actions/export.php", "public");
elgg_register_action("pages/reorder", dirname(__FILE__) . "/actions/reorder.php");
elgg_register_action("pages_tools/update_edit_notice", dirname(__FILE__) . "/actions/update_edit_notice.php");
// overrule action
elgg_register_action("pages/edit", dirname(__FILE__) . "/actions/pages/edit.php");
elgg_register_action("pages/delete", dirname(__FILE__) . "/actions/pages/delete.php");
}
示例9: uservalidationbyadmin_login_event
/**
* Listen to the login event to make sure the user is validated
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param ElggUser $user supplied user
*
* @return bool
*/
function uservalidationbyadmin_login_event($event, $type, $user)
{
$result = false;
// make sure we can see all users
$hidden = access_get_show_hidden_status();
access_show_hidden_entities(true);
// do we actualy have a user
if (!empty($user) && elgg_instanceof($user, "user")) {
// is the user enabled
if ($user->isEnabled()) {
if ($user->isAdmin()) {
// admins are always allowed
$result = true;
} elseif (isset($user->admin_validated)) {
// check if the user is validated
if ($user->admin_validated) {
// user is validated and can login
$result = true;
}
} else {
// user has register before this plugin was activated
$result = true;
}
}
}
// check if the user can login
if (empty($result)) {
// register error
register_error(elgg_echo("uservalidationbyadmin:login:error"));
}
// restore access setting
access_show_hidden_entities($hidden);
return $result;
}
示例10: widget_messages_init
function widget_messages_init()
{
if (elgg_is_active_plugin("messages")) {
elgg_register_widget_type("messages", elgg_echo("messages"), elgg_echo("widgets:messages:description"), "dashboard,index", false);
elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_messages_url");
}
}
示例11: thewire_tools_create_object_event_handler
/**
* This functions performs actions when a wire post is created
*
* @param string $event 'create'
* @param string $type 'object'
* @param ElggObject $object the ElggObject created
*
* @return void
*/
function thewire_tools_create_object_event_handler($event, $type, ElggObject $object)
{
if (empty($object) || !elgg_instanceof($object, "object", "thewire")) {
return;
}
//send out notification to users mentioned in a wire post
$usernames = array();
preg_match_all("/\\@([A-Za-z0-9\\_\\.\\-]+)/i", $object->description, $usernames);
if (empty($usernames)) {
return;
}
$usernames = array_unique($usernames[0]);
$params = array("object" => $object, "action" => "mention");
foreach ($usernames as $username) {
$username = str_ireplace("@", "", $username);
$user = get_user_by_username($username);
if (empty($user) || $user->getGUID() == $object->getOwnerGUID()) {
continue;
}
$setting = thewire_tools_get_notification_settings($user->getGUID());
if (empty($setting)) {
continue;
}
$subject = elgg_echo("thewire_tools:notify:mention:subject");
$message = elgg_echo("thewire_tools:notify:mention:message", array($user->name, $object->getOwnerEntity()->name, elgg_normalize_url("thewire/search/@" . $user->username)));
notify_user($user->getGUID(), $object->getOwnerGUID(), $subject, $message, $params, $setting);
}
}
示例12: categories_pagesetup
/**
* Set up menu items
*
*/
function categories_pagesetup()
{
if (get_context() == 'admin' && isadminloggedin()) {
global $CONFIG;
add_submenu_item(elgg_echo('categories:settings'), $CONFIG->wwwroot . 'mod/categories/settings.php');
}
}
示例13: login_event
/**
* Called on the login user event
* Checks for spammers
*
* @param type $event
* @param type $type
* @param type $user
* @return boolean
*/
function login_event($event, $type, $user)
{
$check_login = elgg_get_plugin_setting('event_login', PLUGIN_ID);
$ip = get_ip();
$user->ip_address = $ip;
if ($check_login != 'no' || !$user->last_login) {
// do it by default
if (!check_spammer($user->email, $ip, true) && !$user->isAdmin()) {
register_error(elgg_echo('spam_login_filter:access_denied_mail_blacklist'));
notify_admin($user->email, $ip, "Existing member identified as spammer has tried to login, check this account");
return false;
}
}
// check user metadata for banned words/phrases
$banned = get_banned_strings();
$metadata = get_metadata_names();
if ($banned && $metadata) {
foreach ($metadata as $m) {
foreach ($banned as $str) {
if (strpos($user->{$m}, $str) !== false) {
return false;
}
}
}
}
}
示例14: triggerMentionNotificationEvent
/**
* This functions performs actions when a wire post is created
*
* @param string $event 'create'
* @param string $type 'object'
* @param \ElggObject $object the ElggObject created
*
* @return void
*/
public static function triggerMentionNotificationEvent($event, $type, \ElggObject $object)
{
if (!elgg_instanceof($object, 'object', 'thewire')) {
return;
}
// @todo replace with decent Elgg 2.0 notification event handling
//send out notification to users mentioned in a wire post
$usernames = [];
preg_match_all("/\\@([A-Za-z0-9\\_\\.\\-]+)/i", $object->description, $usernames);
if (empty($usernames)) {
return;
}
$usernames = array_unique($usernames[0]);
$params = ['object' => $object, 'action' => 'mention'];
foreach ($usernames as $username) {
$username = str_ireplace('@', '', $username);
$user = get_user_by_username($username);
if (empty($user) || $user->getGUID() == $object->getOwnerGUID()) {
continue;
}
$setting = thewire_tools_get_notification_settings($user->getGUID());
if (empty($setting)) {
continue;
}
$subject = elgg_echo('thewire_tools:notify:mention:subject');
$message = elgg_echo('thewire_tools:notify:mention:message', [$user->name, $object->getOwnerEntity()->name, elgg_normalize_url("thewire/search/@{$user->username}")]);
notify_user($user->getGUID(), $object->getOwnerGUID(), $subject, $message, $params, $setting);
}
}
示例15: friend_request_entity_menu_handler
function friend_request_entity_menu_handler($hook, $type, $returnvalue, $params)
{
$result = $returnvalue;
if (!empty($params) && is_array($params) && ($user = elgg_get_logged_in_user_entity())) {
$entity = elgg_extract("entity", $params);
if (elgg_instanceof($entity, "user") && $entity->getGUID() != $user->getGUID()) {
if (!empty($result) && !is_array($result)) {
$result = array($result);
} elseif (empty($result)) {
$result = array();
}
// are we friends
if (!$entity->isFriendOf($user->getGUID())) {
// no, check if pending request
if (check_entity_relationship($user->getGUID(), "friendrequest", $entity->getGUID())) {
// pending request
$result[] = ElggMenuItem::factory(array("name" => "friend_request", "text" => elgg_echo("friend_request:friend:add:pending"), "href" => "friend_request/" . $user->username . "#friend_request_sent_listing", "priority" => 500));
} else {
// add as friend
$result[] = ElggMenuItem::factory(array("name" => "add_friend", "text" => elgg_echo("friend:add"), "href" => "action/friends/add?friend=" . $entity->getGUID(), "is_action" => true, "priority" => 500));
}
} else {
// is friend, se remove friend link
$result[] = ElggMenuItem::factory(array("name" => "remove_friend", "text" => elgg_echo("friend:remove"), "href" => "action/friends/remove?friend=" . $entity->getGUID(), "is_action" => true, "priority" => 500));
}
}
}
return $result;
}