diff options
26 files changed, 1009 insertions, 1009 deletions
diff --git a/actions/likes/delete.php b/actions/likes/delete.php index a774c06e1..78142e186 100644 --- a/actions/likes/delete.php +++ b/actions/likes/delete.php @@ -1,32 +1,32 @@ -<?php
-/**
- * Elgg delete like action
- *
- * @package Elgg
- * @author Curverider <curverider.co.uk>
- * @link http://elgg.org/
- */
-
-// Ensure we're logged in
-if (!isloggedin()) {
- forward();
-}
-
-// Make sure we can get the comment in question
-$annotation_id = (int) get_input('annotation_id');
-if ($likes = get_annotation($annotation_id)) {
-
- $entity = get_entity($likes->entity_guid);
-
- if ($likes->canEdit()) {
- $likes->delete();
- system_message(elgg_echo("likes:deleted"));
- forward($entity->getURL());
- }
-
-} else {
- $url = "";
-}
-
-register_error(elgg_echo("likes:notdeleted"));
+<?php +/** + * Elgg delete like action + * + * @package Elgg + * @author Curverider <curverider.co.uk> + * @link http://elgg.org/ + */ + +// Ensure we're logged in +if (!isloggedin()) { + forward(); +} + +// Make sure we can get the comment in question +$annotation_id = (int) get_input('annotation_id'); +if ($likes = get_annotation($annotation_id)) { + + $entity = get_entity($likes->entity_guid); + + if ($likes->canEdit()) { + $likes->delete(); + system_message(elgg_echo("likes:deleted")); + forward($entity->getURL()); + } + +} else { + $url = ""; +} + +register_error(elgg_echo("likes:notdeleted")); forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/bookmarks/actions/edit.php b/mod/bookmarks/actions/edit.php index 16e324154..dd0330b2d 100755 --- a/mod/bookmarks/actions/edit.php +++ b/mod/bookmarks/actions/edit.php @@ -1,35 +1,35 @@ -<?php
-/**
- * Elgg bookmarks edit action
- *
- */
-
-gatekeeper();
-action_gatekeeper();
-//set some required variables
-$guid = get_input('guid');
-$title = get_input('title');
-$address = get_input('address');
-$notes = get_input('notes');
-$access = get_input('access');
-$tags = get_input('tags');
-$tagarray = string_to_tag_array($tags);
-
-// Make sure we actually have permission to edit
-$bookmark = get_entity($guid);
-if ($bookmark->getSubtype() == "bookmarks" && $bookmark->canEdit()) {
- $bookmark->title = $title;
- $bookmark->description = $notes;
- $bookmark->address = $address;
- $bookmark->access_id = $access;
- $bookmark->tags = $tagarray;
- if ($bookmark->save()) {
- system_message(elgg_echo('bookmarks:edit:success'));
- } else {
- system_message(elgg_echo('bookmarks:edit:fail'));
- }
-}else{
- system_message(elgg_echo('bookmarks:edit:fail'));
-}
-$account = get_entity($bookmark->container_guid);
+<?php +/** + * Elgg bookmarks edit action + * + */ + +gatekeeper(); +action_gatekeeper(); +//set some required variables +$guid = get_input('guid'); +$title = get_input('title'); +$address = get_input('address'); +$notes = get_input('notes'); +$access = get_input('access'); +$tags = get_input('tags'); +$tagarray = string_to_tag_array($tags); + +// Make sure we actually have permission to edit +$bookmark = get_entity($guid); +if ($bookmark->getSubtype() == "bookmarks" && $bookmark->canEdit()) { + $bookmark->title = $title; + $bookmark->description = $notes; + $bookmark->address = $address; + $bookmark->access_id = $access; + $bookmark->tags = $tagarray; + if ($bookmark->save()) { + system_message(elgg_echo('bookmarks:edit:success')); + } else { + system_message(elgg_echo('bookmarks:edit:fail')); + } +}else{ + system_message(elgg_echo('bookmarks:edit:fail')); +} +$account = get_entity($bookmark->container_guid); forward("pg/bookmarks/" . $account->username);
\ No newline at end of file diff --git a/mod/bookmarks/actions/reference.php b/mod/bookmarks/actions/reference.php index ae79b78cd..515ac1ed1 100755 --- a/mod/bookmarks/actions/reference.php +++ b/mod/bookmarks/actions/reference.php @@ -1,34 +1,34 @@ -<?php
-
-/**
- * Elgg bookmarks add as reference
- * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name
- */
-
-//set some variables
-$object_guid = get_input('object_guid');
-$bookmark_guid = get_input('reference');
-$object = get_entity($object_guid);
-$bookmark = get_entity($bookmark_guid);
-//check both the object and bookmark exist
-if($bookmark && $object){
- //check the user can add a reference
- if($object->canEdit()){
- //create a relationship between the object and bookmark
- if(add_entity_relationship($object_guid, "reference", $bookmark_guid)){
- // Success message
- system_message(elgg_echo("bookmarks:referenceadded"));
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
- }
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
- }
-}else{
- // Failure message
- system_message(elgg_echo("bookmarks:referenceerror"));
-}
-
+<?php + +/** + * Elgg bookmarks add as reference + * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name + */ + +//set some variables +$object_guid = get_input('object_guid'); +$bookmark_guid = get_input('reference'); +$object = get_entity($object_guid); +$bookmark = get_entity($bookmark_guid); +//check both the object and bookmark exist +if($bookmark && $object){ + //check the user can add a reference + if($object->canEdit()){ + //create a relationship between the object and bookmark + if(add_entity_relationship($object_guid, "reference", $bookmark_guid)){ + // Success message + system_message(elgg_echo("bookmarks:referenceadded")); + }else{ + // Failure message + system_message(elgg_echo("bookmarks:referenceerror")); + } + }else{ + // Failure message + system_message(elgg_echo("bookmarks:referenceerror")); + } +}else{ + // Failure message + system_message(elgg_echo("bookmarks:referenceerror")); +} + forward($object->getURL());
\ No newline at end of file diff --git a/mod/bookmarks/actions/remove.php b/mod/bookmarks/actions/remove.php index b8b1ad6a3..f704a5cc3 100755 --- a/mod/bookmarks/actions/remove.php +++ b/mod/bookmarks/actions/remove.php @@ -1,34 +1,34 @@ -<?php
-
-/**
- * Elgg bookmarks remove a reference
- * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name
- */
-
-//set some variables
-$object_guid = get_input('object_guid');
-$bookmark_guid = get_input('bookmark');
-$object = get_entity($object_guid);
-$bookmark = get_entity($bookmark_guid);
-//check both the object and bookmark exist
-if($bookmark && $object){
- //check the user can add a reference
- if($object->canEdit()){
- //remove the relationship between the object and bookmark
- if(remove_entity_relationship($object_guid, "reference", $bookmark_guid)){
- // Success message
- system_message(elgg_echo("bookmarks:removed"));
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
- }
- }else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
- }
-}else{
- // Failure message
- system_message(elgg_echo("bookmarks:removederror"));
-}
-
+<?php + +/** + * Elgg bookmarks remove a reference + * Guid one is the object, guid two is the bookmark, 'reference' is the relationship name + */ + +//set some variables +$object_guid = get_input('object_guid'); +$bookmark_guid = get_input('bookmark'); +$object = get_entity($object_guid); +$bookmark = get_entity($bookmark_guid); +//check both the object and bookmark exist +if($bookmark && $object){ + //check the user can add a reference + if($object->canEdit()){ + //remove the relationship between the object and bookmark + if(remove_entity_relationship($object_guid, "reference", $bookmark_guid)){ + // Success message + system_message(elgg_echo("bookmarks:removed")); + }else{ + // Failure message + system_message(elgg_echo("bookmarks:removederror")); + } + }else{ + // Failure message + system_message(elgg_echo("bookmarks:removederror")); + } +}else{ + // Failure message + system_message(elgg_echo("bookmarks:removederror")); +} + forward($object->getURL());
\ No newline at end of file diff --git a/mod/bookmarks/views/default/bookmarks/stats.php b/mod/bookmarks/views/default/bookmarks/stats.php index 07450fd2e..a9cad12b3 100755 --- a/mod/bookmarks/views/default/bookmarks/stats.php +++ b/mod/bookmarks/views/default/bookmarks/stats.php @@ -1,10 +1,10 @@ -<?php
-/**
- * All site bookmark stats
- **/
-
-$count_bookmarks = elgg_get_entities("object", "bookmarks",0,"",10,0,true,0,null,0,0);
-$count_bookmark_comments = count_annotations(0, "object", "bookmarks","generic_comment");
-
-echo "<h3>Bookmark stats</h3>";
-echo "<p>".$count_bookmarks . " resources bookmarked.</p>";
+<?php +/** + * All site bookmark stats + **/ + +$count_bookmarks = elgg_get_entities("object", "bookmarks",0,"",10,0,true,0,null,0,0); +$count_bookmark_comments = count_annotations(0, "object", "bookmarks","generic_comment"); + +echo "<h3>Bookmark stats</h3>"; +echo "<p>".$count_bookmarks . " resources bookmarked.</p>"; diff --git a/mod/members/views/default/members/members_navigation.php b/mod/members/views/default/members/members_navigation.php index 6abe6f348..1a79c3cfd 100644 --- a/mod/members/views/default/members/members_navigation.php +++ b/mod/members/views/default/members/members_navigation.php @@ -1,23 +1,23 @@ -<?php
-
- /**
- * A simple view to provide the user with group filters and the number of group on the site
- **/
-
- $members = $vars['count'];
- if(!$num_groups)
- $num_groups = 0;
-
- $filter = $vars['filter'];
-
- //url
- $url = $vars['url'] . "mod/members/index.php";
-
-?>
-<div class="elgg_horizontal_tabbed_nav margin_top">
-<ul>
- <li <?php if($filter == "newest") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=newest"><?php echo elgg_echo('members:label:newest'); ?></a></li>
- <li <?php if($filter == "pop") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=pop"><?php echo elgg_echo('members:label:popular'); ?></a></li>
- <li <?php if($filter == "active") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=active"><?php echo elgg_echo('members:label:active'); ?></a></li>
-</ul>
+<?php + + /** + * A simple view to provide the user with group filters and the number of group on the site + **/ + + $members = $vars['count']; + if(!$num_groups) + $num_groups = 0; + + $filter = $vars['filter']; + + //url + $url = $vars['url'] . "mod/members/index.php"; + +?> +<div class="elgg_horizontal_tabbed_nav margin_top"> +<ul> + <li <?php if($filter == "newest") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=newest"><?php echo elgg_echo('members:label:newest'); ?></a></li> + <li <?php if($filter == "pop") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=pop"><?php echo elgg_echo('members:label:popular'); ?></a></li> + <li <?php if($filter == "active") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=active"><?php echo elgg_echo('members:label:active'); ?></a></li> +</ul> </div>
\ No newline at end of file diff --git a/mod/riverdashboard/endpoint/ping.php b/mod/riverdashboard/endpoint/ping.php index c5613dd0c..d41128e1f 100644 --- a/mod/riverdashboard/endpoint/ping.php +++ b/mod/riverdashboard/endpoint/ping.php @@ -1,70 +1,70 @@ -<?php
-/**
- * Check for new activity.
- * Outputs # of new activity items since $_GET['last_checked'] time
- */
-
-// Load Elgg engine will not include plugins
-require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
-
-// check for last checked time
-if (!$seconds_passed = get_input('seconds_passed', 0)) {
- echo '';
- exit;
-}
-
-$last_reload = time() - $seconds_passed;
-
-//grab any new annotations
-$annotations = count_annotations('', '', '', '', '', '', '', $last_reload);
-if(!$annotations)
- $annotations = 0;
-//grab all new objects created
-$entity_creation = elgg_get_entities(array(
- 'count' => TRUE,
- 'created_time_lower' => $last_reload,
- 'wheres' => array('e.type != \'user\'')
-));
-if(!$entity_creation)
- $entity_creation = 0;
-//grab any entities updated
-$entity_update = elgg_get_entities(array(
- 'count' => TRUE,
- 'modified_time_lower' => $last_reload,
- 'wheres' => array('e.type != \'user\'')
-));
-if(!$entity_update)
- $entity_update = 0;
-//get any relationships, such as friending - this is not working quite right yet
-//$relationship_action = elgg_get_entities_from_relationship(array('count' => TRUE));
-//if(!$relationship_action)
-// $relationship_action = 0;
-
-//sum all totals
-$all_activity = $annotations + $entity_creation + $entity_update;
-
-if ($all_activity > 0) {
- $s = ($all_activity == 1) ? '' : 's';
- echo "<a href='' onClick=\"window.location.reload();\" class='update_link'>$all_activity update$s!</a>";
-?>
- <script type="text/javascript">
- $(document).ready(function(){
-
- var pageTitleSubstring;
- var stringStartPosition = document.title.indexOf("]");
-
- if (stringStartPosition == -1) { // we haven't already altered page title
- pageTitleSubstring = document.title;
- } else { // we previously prepended to page title, need to remove it first
- pageTitleSubstring = document.title.substring( (stringStartPosition+2) );
- }
-
- document.title = "[<?php echo $all_activity; ?> update<?php echo $s; ?>] "+pageTitleSubstring;
- });
- </script>
-
-<?php
-} else {
- echo '';
- exit;
-}
+<?php +/** + * Check for new activity. + * Outputs # of new activity items since $_GET['last_checked'] time + */ + +// Load Elgg engine will not include plugins +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + +// check for last checked time +if (!$seconds_passed = get_input('seconds_passed', 0)) { + echo ''; + exit; +} + +$last_reload = time() - $seconds_passed; + +//grab any new annotations +$annotations = count_annotations('', '', '', '', '', '', '', $last_reload); +if(!$annotations) + $annotations = 0; +//grab all new objects created +$entity_creation = elgg_get_entities(array( + 'count' => TRUE, + 'created_time_lower' => $last_reload, + 'wheres' => array('e.type != \'user\'') +)); +if(!$entity_creation) + $entity_creation = 0; +//grab any entities updated +$entity_update = elgg_get_entities(array( + 'count' => TRUE, + 'modified_time_lower' => $last_reload, + 'wheres' => array('e.type != \'user\'') +)); +if(!$entity_update) + $entity_update = 0; +//get any relationships, such as friending - this is not working quite right yet +//$relationship_action = elgg_get_entities_from_relationship(array('count' => TRUE)); +//if(!$relationship_action) +// $relationship_action = 0; + +//sum all totals +$all_activity = $annotations + $entity_creation + $entity_update; + +if ($all_activity > 0) { + $s = ($all_activity == 1) ? '' : 's'; + echo "<a href='' onClick=\"window.location.reload();\" class='update_link'>$all_activity update$s!</a>"; +?> + <script type="text/javascript"> + $(document).ready(function(){ + + var pageTitleSubstring; + var stringStartPosition = document.title.indexOf("]"); + + if (stringStartPosition == -1) { // we haven't already altered page title + pageTitleSubstring = document.title; + } else { // we previously prepended to page title, need to remove it first + pageTitleSubstring = document.title.substring( (stringStartPosition+2) ); + } + + document.title = "[<?php echo $all_activity; ?> update<?php echo $s; ?>] "+pageTitleSubstring; + }); + </script> + +<?php +} else { + echo ''; + exit; +} diff --git a/mod/riverdashboard/index.php b/mod/riverdashboard/index.php index 9fc54dda6..e025850ea 100644 --- a/mod/riverdashboard/index.php +++ b/mod/riverdashboard/index.php @@ -1,62 +1,62 @@ -<?php
-
-/**
- * Elgg river dashboard plugin index page
- */
-
-require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
-
-gatekeeper();
-
-$type = get_input('type');
-$subtype = get_input('subtype');
-$orient = get_input('display');
-if(!$orient)
- $orient = 'all';
-$callback = get_input('callback');
-
-if ($type == 'all') {
- $type = '';
- $subtype = '';
-}
-
-$body = '';
-
-switch($orient) {
- case 'mine':
- $subject_guid = $_SESSION['user']->guid;
- $relationship_type = '';
- $title_wording = elgg_echo('river:mine');
- break;
- case 'friends': $subject_guid = $_SESSION['user']->guid;
- $relationship_type = 'friend';
- $title_wording = elgg_echo('river:friends');
- break;
- default: $subject_guid = 0;
- $relationship_type = '';
- $title_wording = elgg_echo('river:all');
- break;
-}
-
-
-$title = elgg_view_title($title_wording);
-
-$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '', 20, 0, 0, true, false) . "</div>";
-// Replacing callback calls in the nav with something meaningless
-$river = str_replace('callback=true','replaced=88,334',$river);
-
-$nav = elgg_view('riverdashboard/nav',array('type' => $type,'subtype' => $subtype,'orient' => $orient));
-if(isloggedin()){
- $sidebar = elgg_view("riverdashboard/menu",array('type' => $type,'subtype' => $subtype,'orient' => $orient));
- $sidebar .= elgg_view("riverdashboard/sidebar", array("object_type" => 'riverdashboard'));
-}else{
- $sidebar = '';
-}
-set_context('riverdashboard');
-if (empty($callback)) {
- $body .= elgg_view('riverdashboard/container', array('body' => $nav . $river . elgg_view('riverdashboard/js')));
- page_draw($title_wording,elgg_view_layout('one_column_with_sidebar',$title . $body, $sidebar));
-} else {
- header("Content-type: text/html; charset=UTF-8");
- echo $nav . $river . elgg_view('riverdashboard/js');
+<?php + +/** + * Elgg river dashboard plugin index page + */ + +require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php'); + +gatekeeper(); + +$type = get_input('type'); +$subtype = get_input('subtype'); +$orient = get_input('display'); +if(!$orient) + $orient = 'all'; +$callback = get_input('callback'); + +if ($type == 'all') { + $type = ''; + $subtype = ''; +} + +$body = ''; + +switch($orient) { + case 'mine': + $subject_guid = $_SESSION['user']->guid; + $relationship_type = ''; + $title_wording = elgg_echo('river:mine'); + break; + case 'friends': $subject_guid = $_SESSION['user']->guid; + $relationship_type = 'friend'; + $title_wording = elgg_echo('river:friends'); + break; + default: $subject_guid = 0; + $relationship_type = ''; + $title_wording = elgg_echo('river:all'); + break; +} + + +$title = elgg_view_title($title_wording); + +$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '', 20, 0, 0, true, false) . "</div>"; +// Replacing callback calls in the nav with something meaningless +$river = str_replace('callback=true','replaced=88,334',$river); + +$nav = elgg_view('riverdashboard/nav',array('type' => $type,'subtype' => $subtype,'orient' => $orient)); +if(isloggedin()){ + $sidebar = elgg_view("riverdashboard/menu",array('type' => $type,'subtype' => $subtype,'orient' => $orient)); + $sidebar .= elgg_view("riverdashboard/sidebar", array("object_type" => 'riverdashboard')); +}else{ + $sidebar = ''; +} +set_context('riverdashboard'); +if (empty($callback)) { + $body .= elgg_view('riverdashboard/container', array('body' => $nav . $river . elgg_view('riverdashboard/js'))); + page_draw($title_wording,elgg_view_layout('one_column_with_sidebar',$title . $body, $sidebar)); +} else { + header("Content-type: text/html; charset=UTF-8"); + echo $nav . $river . elgg_view('riverdashboard/js'); }
\ No newline at end of file diff --git a/mod/riverdashboard/languages/en.php b/mod/riverdashboard/languages/en.php index 64aabf745..864a8d7a9 100644 --- a/mod/riverdashboard/languages/en.php +++ b/mod/riverdashboard/languages/en.php @@ -1,40 +1,40 @@ -<?php
-$english = array(
- 'mine' => 'Mine',
- 'filter' => 'Filter',
- 'riverdashboard:useasdashboard' => "Replace the default dashboard with this activity river?",
- 'activity' => 'Activity',
- 'riverdashboard:recentmembers' => 'Recent members',
-
- /**
- * Site messages
- **/
-
- 'sitemessages:announcements' => "Site announcements",
- 'sitemessages:posted' => "Posted",
- 'sitemessages:river:created' => "Site admin, %s,",
- 'sitemessages:river:create' => "posted a new site wide message",
- 'sitemessages:add' => "Add a site-wide message to the river page",
- 'sitemessage:deleted' => "Site message deleted",
-
- 'river:widget:noactivity' => 'We could not find any activity.',
- 'river:widget:title' => "Activity",
- 'river:all' => "All activity",
- 'river:mine' => "My activity",
- 'river:friends' => "Friends' activity",
- 'river:widget:description' => "Show your latest activity.",
- 'river:widget:title:friends' => "Friends' activity",
- 'river:widget:description:friends' => "Show what your friends are up to.",
- 'river:widgets:friends' => "Friends",
- 'river:widgets:mine' => "Mine",
- 'river:friends' => "My friends' activity",
- 'river:mine' => "My activity",
- 'river:widget:label:displaynum' => "Number of entries to display:",
- 'river:widget:type' => "Which river would you like to display? One that shows your activity or one that shows your friends activity?",
- 'item:object:sitemessage' => "Site messages",
- 'riverdashboard:avataricon' => "Would you like to use user avatars or icons on your site activity stream?",
- 'option:icon' => 'Icons',
- 'option:avatar' => 'Avatars',
-);
-
+<?php +$english = array( + 'mine' => 'Mine', + 'filter' => 'Filter', + 'riverdashboard:useasdashboard' => "Replace the default dashboard with this activity river?", + 'activity' => 'Activity', + 'riverdashboard:recentmembers' => 'Recent members', + + /** + * Site messages + **/ + + 'sitemessages:announcements' => "Site announcements", + 'sitemessages:posted' => "Posted", + 'sitemessages:river:created' => "Site admin, %s,", + 'sitemessages:river:create' => "posted a new site wide message", + 'sitemessages:add' => "Add a site-wide message to the river page", + 'sitemessage:deleted' => "Site message deleted", + + 'river:widget:noactivity' => 'We could not find any activity.', + 'river:widget:title' => "Activity", + 'river:all' => "All activity", + 'river:mine' => "My activity", + 'river:friends' => "Friends' activity", + 'river:widget:description' => "Show your latest activity.", + 'river:widget:title:friends' => "Friends' activity", + 'river:widget:description:friends' => "Show what your friends are up to.", + 'river:widgets:friends' => "Friends", + 'river:widgets:mine' => "Mine", + 'river:friends' => "My friends' activity", + 'river:mine' => "My activity", + 'river:widget:label:displaynum' => "Number of entries to display:", + 'river:widget:type' => "Which river would you like to display? One that shows your activity or one that shows your friends activity?", + 'item:object:sitemessage' => "Site messages", + 'riverdashboard:avataricon' => "Would you like to use user avatars or icons on your site activity stream?", + 'option:icon' => 'Icons', + 'option:avatar' => 'Avatars', +); + add_translation("en",$english);
\ No newline at end of file diff --git a/mod/riverdashboard/start.php b/mod/riverdashboard/start.php index 6badd8393..1377afc37 100644 --- a/mod/riverdashboard/start.php +++ b/mod/riverdashboard/start.php @@ -1,51 +1,51 @@ -<?php
-/**
- * Elgg river dashboard plugin
- */
-
-function riverdashboard_init() {
- global $CONFIG;
- // Register and optionally replace the dashboard
- if (get_plugin_setting('useasdashboard', 'riverdashboard') == 'yes') {
- register_page_handler('dashboard','riverdashboard_page_handler');
- } else {
- // Activity main menu
- add_menu(elgg_echo('activity'), $CONFIG->wwwroot . "mod/riverdashboard/");
- }
- // Page handler
- register_page_handler('riverdashboard','riverdashboard_page_handler');
- elgg_extend_view('css','riverdashboard/css');
-}
-
-/**
- * Page handler for riverdash
- *
- * @param unknown_type $page
- */
-function riverdashboard_page_handler($page){
- global $CONFIG;
- include(dirname(__FILE__) . "/index.php");
- return true;
-}
-
-function riverdashboard_dashboard() {
- include(dirname(__FILE__) . '/index.php');
-}
-
-/**
- * For users to make a comment on a river item
- *
- * @param ElggEntity $entity The entity to comment on
- * @return string|false The HTML (etc) for the comment form, or false on failure
- */
-function elgg_make_river_comment($entity){
- if (!($entity instanceof ElggEntity)) {
- return false;
- } else {
- //display the comment form
- $comments = elgg_view('riverdashboard/rivercomment',array('entity' => $entity));
- return $comments;
- }
-}
-
-register_elgg_event_handler('init','system','riverdashboard_init');
+<?php +/** + * Elgg river dashboard plugin + */ + +function riverdashboard_init() { + global $CONFIG; + // Register and optionally replace the dashboard + if (get_plugin_setting('useasdashboard', 'riverdashboard') == 'yes') { + register_page_handler('dashboard','riverdashboard_page_handler'); + } else { + // Activity main menu + add_menu(elgg_echo('activity'), $CONFIG->wwwroot . "mod/riverdashboard/"); + } + // Page handler + register_page_handler('riverdashboard','riverdashboard_page_handler'); + elgg_extend_view('css','riverdashboard/css'); +} + +/** + * Page handler for riverdash + * + * @param unknown_type $page + */ +function riverdashboard_page_handler($page){ + global $CONFIG; + include(dirname(__FILE__) . "/index.php"); + return true; +} + +function riverdashboard_dashboard() { + include(dirname(__FILE__) . '/index.php'); +} + +/** + * For users to make a comment on a river item + * + * @param ElggEntity $entity The entity to comment on + * @return string|false The HTML (etc) for the comment form, or false on failure + */ +function elgg_make_river_comment($entity){ + if (!($entity instanceof ElggEntity)) { + return false; + } else { + //display the comment form + $comments = elgg_view('riverdashboard/rivercomment',array('entity' => $entity)); + return $comments; + } +} + +register_elgg_event_handler('init','system','riverdashboard_init'); diff --git a/mod/riverdashboard/views/default/riverdashboard/container.php b/mod/riverdashboard/views/default/riverdashboard/container.php index 2d2d5b069..67e277e99 100644 --- a/mod/riverdashboard/views/default/riverdashboard/container.php +++ b/mod/riverdashboard/views/default/riverdashboard/container.php @@ -1,52 +1,52 @@ -<?php echo $vars['body']; ?>
-
-<script type="text/JavaScript">
-$(document).ready(function(){
- var updates = new thewireUpdateChecker(10000);
- updates.start();
-});
-
-// check for updates on the wire.
-function thewireUpdateChecker(interval) {
- this.intervalID = null;
- this.interval = interval;
- this.url = '<?php echo $vars['url']; ?>mod/riverdashboard/endpoint/ping.php';
- this.seconds_passed = 0;
-
- this.start = function() {
- // needed to complete closure scope.
- var self = this;
-
- this.intervalID = setInterval(function() { self.checkUpdates(); }, this.interval);
- }
-
- this.checkUpdates = function() {
- this.seconds_passed += this.interval / 1000;
- // more closure fun
- var self = this;
- $.ajax({
- 'type': 'GET',
- 'url': this.url,
- 'data': {'seconds_passed': this.seconds_passed},
- 'success': function(data) {
- if (data) {
- $('#riverdashboard_updates').html(data).slideDown();
- // could crank down the interval here.
- // if we change the message to simply "New Posts!"
- // we could stop the polling altogether.
- }
- }
- })
- }
-
- this.stop = function() {
- clearInterval(this.interval);
- }
-
- this.changeInterval = function(interval) {
- this.stop();
- this.interval = interval;
- this.start();
- }
-}
-</script>
+<?php echo $vars['body']; ?> + +<script type="text/JavaScript"> +$(document).ready(function(){ + var updates = new thewireUpdateChecker(10000); + updates.start(); +}); + +// check for updates on the wire. +function thewireUpdateChecker(interval) { + this.intervalID = null; + this.interval = interval; + this.url = '<?php echo $vars['url']; ?>mod/riverdashboard/endpoint/ping.php'; + this.seconds_passed = 0; + + this.start = function() { + // needed to complete closure scope. + var self = this; + + this.intervalID = setInterval(function() { self.checkUpdates(); }, this.interval); + } + + this.checkUpdates = function() { + this.seconds_passed += this.interval / 1000; + // more closure fun + var self = this; + $.ajax({ + 'type': 'GET', + 'url': this.url, + 'data': {'seconds_passed': this.seconds_passed}, + 'success': function(data) { + if (data) { + $('#riverdashboard_updates').html(data).slideDown(); + // could crank down the interval here. + // if we change the message to simply "New Posts!" + // we could stop the polling altogether. + } + } + }) + } + + this.stop = function() { + clearInterval(this.interval); + } + + this.changeInterval = function(interval) { + this.stop(); + this.interval = interval; + this.start(); + } +} +</script> diff --git a/mod/riverdashboard/views/default/riverdashboard/menu.php b/mod/riverdashboard/views/default/riverdashboard/menu.php index bfb0f4172..c5c49f0a3 100644 --- a/mod/riverdashboard/views/default/riverdashboard/menu.php +++ b/mod/riverdashboard/views/default/riverdashboard/menu.php @@ -1,28 +1,28 @@ -<?php
-/**
- * Elgg activity stream menu
- */
-$allselect = ''; $friendsselect = ''; $mineselect = ''; $display_option = '';
-switch($vars['orient']) {
- case 'all': $allselect = 'class="selected"';
- break;
- case 'friends': $friendsselect = 'class="selected"';
- $display_option = '&display=friends';
- break;
- case 'mine': $mineselect = 'class="selected"';
- $display_option = '&display=mine';
- break;
-}
-?>
-<ul class="submenu riverdashboard">
-<?php
- if(isloggedin()){
-?>
- <li <?php echo $allselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/"><?php echo elgg_echo('all'); ?></a></li>
- <li <?php echo $friendsselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/?display=friends"><?php echo elgg_echo('friends'); ?></a></li>
- <li <?php echo $mineselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/?display=mine"><?php echo elgg_echo('mine'); ?></a></li>
-
-<?php
- }
-?>
+<?php +/** + * Elgg activity stream menu + */ +$allselect = ''; $friendsselect = ''; $mineselect = ''; $display_option = ''; +switch($vars['orient']) { + case 'all': $allselect = 'class="selected"'; + break; + case 'friends': $friendsselect = 'class="selected"'; + $display_option = '&display=friends'; + break; + case 'mine': $mineselect = 'class="selected"'; + $display_option = '&display=mine'; + break; +} +?> +<ul class="submenu riverdashboard"> +<?php + if(isloggedin()){ +?> + <li <?php echo $allselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/"><?php echo elgg_echo('all'); ?></a></li> + <li <?php echo $friendsselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/?display=friends"><?php echo elgg_echo('friends'); ?></a></li> + <li <?php echo $mineselect; ?> ><a href="<?php echo $vars['url']; ?>mod/riverdashboard/?display=mine"><?php echo elgg_echo('mine'); ?></a></li> + +<?php + } +?> </ul>
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/nav.php b/mod/riverdashboard/views/default/riverdashboard/nav.php index b38a4e20a..ab4aab10d 100644 --- a/mod/riverdashboard/views/default/riverdashboard/nav.php +++ b/mod/riverdashboard/views/default/riverdashboard/nav.php @@ -1,51 +1,51 @@ -<?php
-
-$contents = array();
-$contents['all'] = 'all';
-if (!empty($vars['config']->registered_entities)) {
- foreach ($vars['config']->registered_entities as $type => $ar) {
- foreach ($vars['config']->registered_entities[$type] as $object) {
- if($object != 'helppage'){
- if (!empty($object )) {
- $keyname = 'item:'.$type.':'.$object;
- } else $keyname = 'item:'.$type;
- $contents[$keyname] = "{$type},{$object}";
- }
- }
- }
-}
-
-$allselect = ''; $friendsselect = ''; $mineselect = ''; $display_option = '';
-switch($vars['orient']) {
- case '': $allselect = 'class="selected"';
- break;
- case 'friends': $friendsselect = 'class="selected"';
- $display_option = '&display=friends';
- break;
- case 'mine': $mineselect = 'class="selected"';
- $display_option = '&display=mine';
- break;
-}
-?>
-<div class="riverdashboard_filtermenu">
- <?php
- $location_filter = "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" name=\"file_filter\" class='Notstyled' >";
- $current = get_input('subtype');
- foreach($contents as $label => $content) {
- $get_values = explode(",", $content);
- //select the current filter
- if($get_values[1] == $current)
- $selected = "SELECTED";
- //set the drop down filter
- if($content[0] && $content[1])
- $location_filter .= "<option {$selected} class='Nomenuoption' value=\"{$CONFIG->url}mod/riverdashboard/index.php?type={$get_values[0]}&subtype={$get_values[1]}{$display_option}\" >" . elgg_echo($label) . "</option>";
- //reset selected
- $selected = '';
- }
- $location_filter .= "</select>";
- echo $location_filter;
- ?>
- <input type="hidden" name="display" id="display" value="<?php echo htmlentities($vars['orient']); ?>" />
-</div>
-
-<div id="riverdashboard_updates" class="clearfloat"></div>
+<?php + +$contents = array(); +$contents['all'] = 'all'; +if (!empty($vars['config']->registered_entities)) { + foreach ($vars['config']->registered_entities as $type => $ar) { + foreach ($vars['config']->registered_entities[$type] as $object) { + if($object != 'helppage'){ + if (!empty($object )) { + $keyname = 'item:'.$type.':'.$object; + } else $keyname = 'item:'.$type; + $contents[$keyname] = "{$type},{$object}"; + } + } + } +} + +$allselect = ''; $friendsselect = ''; $mineselect = ''; $display_option = ''; +switch($vars['orient']) { + case '': $allselect = 'class="selected"'; + break; + case 'friends': $friendsselect = 'class="selected"'; + $display_option = '&display=friends'; + break; + case 'mine': $mineselect = 'class="selected"'; + $display_option = '&display=mine'; + break; +} +?> +<div class="riverdashboard_filtermenu"> + <?php + $location_filter = "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" name=\"file_filter\" class='Notstyled' >"; + $current = get_input('subtype'); + foreach($contents as $label => $content) { + $get_values = explode(",", $content); + //select the current filter + if($get_values[1] == $current) + $selected = "SELECTED"; + //set the drop down filter + if($content[0] && $content[1]) + $location_filter .= "<option {$selected} class='Nomenuoption' value=\"{$CONFIG->url}mod/riverdashboard/index.php?type={$get_values[0]}&subtype={$get_values[1]}{$display_option}\" >" . elgg_echo($label) . "</option>"; + //reset selected + $selected = ''; + } + $location_filter .= "</select>"; + echo $location_filter; + ?> + <input type="hidden" name="display" id="display" value="<?php echo htmlentities($vars['orient']); ?>" /> +</div> + +<div id="riverdashboard_updates" class="clearfloat"></div> diff --git a/mod/riverdashboard/views/default/riverdashboard/rivercomment.php b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php index 61e5c238e..32d1b4675 100644 --- a/mod/riverdashboard/views/default/riverdashboard/rivercomment.php +++ b/mod/riverdashboard/views/default/riverdashboard/rivercomment.php @@ -1,15 +1,15 @@ -<?php
-/**
- * Elgg comments add on river form
- * @uses $vars['entity']
- */
-
-if (isset($vars['entity']) && isloggedin()) {
- $form_body = "<a class=\"river_comment_form_button\">Add comment</a>";
- $form_body .= "<div class=\"river_comment_form\" style=\"display:none;\">";
- $form_body .= elgg_view('input/text',array('internalname' => 'generic_comment', 'value' => 'Add a comment...'));
- $form_body .= elgg_view('input/hidden', array('internalname' => 'entity_guid', 'value' => $vars['entity']->getGUID()));
- $form_body .= elgg_view('input/submit', array('value' => elgg_echo("post")));
- $form_body .= "</div>";
- echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/comments/add"));
+<?php +/** + * Elgg comments add on river form + * @uses $vars['entity'] + */ + +if (isset($vars['entity']) && isloggedin()) { + $form_body = "<a class=\"river_comment_form_button\">Add comment</a>"; + $form_body .= "<div class=\"river_comment_form\" style=\"display:none;\">"; + $form_body .= elgg_view('input/text',array('internalname' => 'generic_comment', 'value' => 'Add a comment...')); + $form_body .= elgg_view('input/hidden', array('internalname' => 'entity_guid', 'value' => $vars['entity']->getGUID())); + $form_body .= elgg_view('input/submit', array('value' => elgg_echo("post"))); + $form_body .= "</div>"; + echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/comments/add")); }
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/riverdashboard/welcome.php b/mod/riverdashboard/views/default/riverdashboard/welcome.php index 3f8d705df..0e83fb63f 100644 --- a/mod/riverdashboard/views/default/riverdashboard/welcome.php +++ b/mod/riverdashboard/views/default/riverdashboard/welcome.php @@ -1,8 +1,8 @@ -<?php
-
- /**
- * Elgg thewire view page
- */
-
-?>
+<?php + + /** + * Elgg thewire view page + */ + +?> <h2><?php echo sprintf(elgg_echo('welcome:user'), $_SESSION['user']->name); ?></h2>
\ No newline at end of file diff --git a/mod/sitepages/actions/addmeta.php b/mod/sitepages/actions/addmeta.php index e5c947776..ec72d6339 100644 --- a/mod/sitepages/actions/addmeta.php +++ b/mod/sitepages/actions/addmeta.php @@ -1,36 +1,36 @@ -<?php
-/**
- * Site pages meta tags and desc page save/edit
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- *
- */
-
-admin_gatekeeper();
-
-$description = get_input('description', '', FALSE);
-$metatags = get_input('metatags', '', FALSE);
-
-// Cache to the session
-$_SESSION['description'] = $description;
-$_SESSION['metatags'] = $metatags;
-
-if (!$sitepage = sitepages_get_sitepage_object('seo')) {
- $sitepage = sitepages_create_sitepage_object('seo');
-}
-
-$sitepage->title = $metatags;
-$sitepage->description = $description;
-
-if ($sitepage->save()) {
- system_message(elgg_echo("sitepages:seocreated"));
- unset($_SESSION['description']); unset($_SESSION['metatags']);
-} else {
- register_error(elgg_echo("sitepages:error"));
-}
-
+<?php +/** + * Site pages meta tags and desc page save/edit + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + * + */ + +admin_gatekeeper(); + +$description = get_input('description', '', FALSE); +$metatags = get_input('metatags', '', FALSE); + +// Cache to the session +$_SESSION['description'] = $description; +$_SESSION['metatags'] = $metatags; + +if (!$sitepage = sitepages_get_sitepage_object('seo')) { + $sitepage = sitepages_create_sitepage_object('seo'); +} + +$sitepage->title = $metatags; +$sitepage->description = $description; + +if ($sitepage->save()) { + system_message(elgg_echo("sitepages:seocreated")); + unset($_SESSION['description']); unset($_SESSION['metatags']); +} else { + register_error(elgg_echo("sitepages:error")); +} + forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/sitepages/sitepages_functions.php b/mod/sitepages/sitepages_functions.php index 20e7cb0b6..bc14d1a54 100644 --- a/mod/sitepages/sitepages_functions.php +++ b/mod/sitepages/sitepages_functions.php @@ -1,225 +1,225 @@ -<?php
-/**
- * Helper functions for Site Pages.
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
-
-/**
- * Returns a single object that holds information about
- * customizations for the $section site page. The object guid
- * is stored as private data on the site entity. This allows the pages
- * to still be searchable as standard entities.
- *
- * @param $type
- * @return mixed ElggSitePage on success, FALSE on fail
- */
-function sitepages_get_sitepage_object($page_type) {
- global $CONFIG;
-
- $page_guid = get_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type");
- $sitepage = get_entity($page_guid);
-
- if ($sitepage instanceof ElggSitePage || $sitepage->page_type == $page_type) {
- return $sitepage;
- }
-
- return FALSE;
-}
-
-/**
- * Creates a site page object.
- *
- * @param str $page_type
- * @return mixed ElggSitePage on success, FALSE on fail.
- */
-function sitepages_create_sitepage_object($page_type) {
- global $CONFIG;
-
- $sitepage = new ElggSitePage();
- $sitepage->page_type = $page_type;
- $sitepage->access_id = ACCESS_PUBLIC;
- $sitepage->save();
-
- if ($sitepage->save() && set_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type", $sitepage->getGUID())) {
- return $sitepage;
- }
-
- return FALSE;
-}
-
-/**
- * Assembles html for edit sections of site pages.
- *
- * @param str $section
- * @return str html
- */
-function sitepages_get_edit_section_content($page_type) {
- set_context('admin');
-
- $keywords = '';
-
- $title = elgg_view_title(elgg_echo('sitepages'));
- $menu = elgg_view('sitepages/menu', array('page_type' => $page_type));
-
- switch ($page_type) {
- case 'front':
- $view = 'sitepages/forms/editfront';
- $keywords = elgg_view('sitepages/keywords');
- break;
-
- case 'seo':
- $view = 'sitepages/forms/editmeta';
- break;
-
- default:
- $view = 'sitepages/forms/edit';
- break;
-
- }
-
- $form .= elgg_view($view, array('page_type' => $page_type));
- $body = $title . $menu . $form;
-
- $content = elgg_view_layout('one_column_with_sidebar', $body, $keywords);
- return $content;
-}
-
-/**
- * Assembles html for displaying site pages
- *
- * @param string $page_type
- * @return string Formatted html
- */
-function sitepages_get_page_content($page_type) {
- $body = elgg_view_title(elgg_echo("sitepages:". strtolower($page_type)));
-
- $sitepage = sitepages_get_sitepage_object($page_type);
-
- if ($sitepage) {
- $body .= elgg_view('page_elements/elgg_content', array('body' => $sitepage->description));
- } else {
- $body .= elgg_view('page_elements/elgg_content', array('body' => elgg_echo('sitepages:notset')));
- }
-
- $content = elgg_view_layout('one_column_with_sidebar', $body);
- return $content;
-}
-
-
-/**
- * Used to determine how to handle special non-static keywords.
- *
- * @param unknown_type $matches
- * @return html
- */
-function sitepages_parse_view_match($matches) {
- $keyword = $matches[0];
- $type = trim($matches[1]);
- $params_string = trim($matches[2]);
-
- switch ($type) {
- case 'entity':
- $options = sitepages_keywords_parse_entity_params($params_string);
- // must use this lower-level function because I missed refactoring
- // the list entity functions for relationships.
- // (which, since you're here, is the only function that runs through all
- // possible options for elgg_get_entities*() functions...)
- $entities = elgg_get_entities_from_relationship($options);
- $content = elgg_view_entity_list($entities, count($entities), $options['offset'],
- $options['limit'], $options['full_view'], $options['view_type_toggle'], $options['pagination']);
- break;
-
- case 'view':
- // parses this into an acceptable array for $vars.
- $info = sitepages_keywords_parse_view_params($params_string);
- $content = elgg_view($info['view'], $info['vars']);
-
- break;
-
- }
-
- return $content;
-}
-
-/**
- * Creates an array from a "name=value, name1=value2" string.
- *
- * @param $string
- * @return array
- */
-function sitepages_keywords_tokenize_params($string) {
- $pairs = array_map('trim', explode(',', $string));
-
- $params = array();
-
- foreach ($pairs as $pair) {
- list($name, $value) = explode('=', $pair);
-
- $name = trim($name);
- $value = trim($value);
- $params[$name] = $value;
- }
-
- return $params;
-}
-
-/**
- *
- * @param $string
- * @return unknown_type
- */
-function sitepages_keywords_parse_view_params($string) {
- $vars = sitepages_keywords_tokenize_params($string);
-
- // the first element key is the view
- $var_keys = array_keys($vars);
- $view = $var_keys[0];
-
- $info = array(
- 'view' => $view,
- 'vars' => $vars
- );
-
- return $info;
-
-}
-
-/**
- * Returns an options array suitable for using in elgg_get_entities()
- *
- * @param string $string "name=value, name2=value2"
- * @return array
- */
-function sitepages_keywords_parse_entity_params($string) {
- $params = sitepages_keywords_tokenize_params($string);
-
- // handle some special cases
- if (isset($params['owner'])) {
- if ($user = get_user_by_username($params['owner'])) {
- $params['owner_guid'] = $user->getGUID();
- }
- }
-
- // @todo probably need to add more for
- // group -> container_guid, etc
- return $params;
-}
-
-
-
-/**
- * Utility object to store site page information.
- */
-class ElggSitePage extends ElggObject {
- public function initialise_attributes() {
- parent::initialise_attributes();
-
- $this->attributes['subtype'] = 'sitepages_page';
- }
+<?php +/** + * Helper functions for Site Pages. + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + +/** + * Returns a single object that holds information about + * customizations for the $section site page. The object guid + * is stored as private data on the site entity. This allows the pages + * to still be searchable as standard entities. + * + * @param $type + * @return mixed ElggSitePage on success, FALSE on fail + */ +function sitepages_get_sitepage_object($page_type) { + global $CONFIG; + + $page_guid = get_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type"); + $sitepage = get_entity($page_guid); + + if ($sitepage instanceof ElggSitePage || $sitepage->page_type == $page_type) { + return $sitepage; + } + + return FALSE; +} + +/** + * Creates a site page object. + * + * @param str $page_type + * @return mixed ElggSitePage on success, FALSE on fail. + */ +function sitepages_create_sitepage_object($page_type) { + global $CONFIG; + + $sitepage = new ElggSitePage(); + $sitepage->page_type = $page_type; + $sitepage->access_id = ACCESS_PUBLIC; + $sitepage->save(); + + if ($sitepage->save() && set_private_setting($CONFIG->site->getGUID(), "sitepages:$page_type", $sitepage->getGUID())) { + return $sitepage; + } + + return FALSE; +} + +/** + * Assembles html for edit sections of site pages. + * + * @param str $section + * @return str html + */ +function sitepages_get_edit_section_content($page_type) { + set_context('admin'); + + $keywords = ''; + + $title = elgg_view_title(elgg_echo('sitepages')); + $menu = elgg_view('sitepages/menu', array('page_type' => $page_type)); + + switch ($page_type) { + case 'front': + $view = 'sitepages/forms/editfront'; + $keywords = elgg_view('sitepages/keywords'); + break; + + case 'seo': + $view = 'sitepages/forms/editmeta'; + break; + + default: + $view = 'sitepages/forms/edit'; + break; + + } + + $form .= elgg_view($view, array('page_type' => $page_type)); + $body = $title . $menu . $form; + + $content = elgg_view_layout('one_column_with_sidebar', $body, $keywords); + return $content; +} + +/** + * Assembles html for displaying site pages + * + * @param string $page_type + * @return string Formatted html + */ +function sitepages_get_page_content($page_type) { + $body = elgg_view_title(elgg_echo("sitepages:". strtolower($page_type))); + + $sitepage = sitepages_get_sitepage_object($page_type); + + if ($sitepage) { + $body .= elgg_view('page_elements/elgg_content', array('body' => $sitepage->description)); + } else { + $body .= elgg_view('page_elements/elgg_content', array('body' => elgg_echo('sitepages:notset'))); + } + + $content = elgg_view_layout('one_column_with_sidebar', $body); + return $content; +} + + +/** + * Used to determine how to handle special non-static keywords. + * + * @param unknown_type $matches + * @return html + */ +function sitepages_parse_view_match($matches) { + $keyword = $matches[0]; + $type = trim($matches[1]); + $params_string = trim($matches[2]); + + switch ($type) { + case 'entity': + $options = sitepages_keywords_parse_entity_params($params_string); + // must use this lower-level function because I missed refactoring + // the list entity functions for relationships. + // (which, since you're here, is the only function that runs through all + // possible options for elgg_get_entities*() functions...) + $entities = elgg_get_entities_from_relationship($options); + $content = elgg_view_entity_list($entities, count($entities), $options['offset'], + $options['limit'], $options['full_view'], $options['view_type_toggle'], $options['pagination']); + break; + + case 'view': + // parses this into an acceptable array for $vars. + $info = sitepages_keywords_parse_view_params($params_string); + $content = elgg_view($info['view'], $info['vars']); + + break; + + } + + return $content; +} + +/** + * Creates an array from a "name=value, name1=value2" string. + * + * @param $string + * @return array + */ +function sitepages_keywords_tokenize_params($string) { + $pairs = array_map('trim', explode(',', $string)); + + $params = array(); + + foreach ($pairs as $pair) { + list($name, $value) = explode('=', $pair); + + $name = trim($name); + $value = trim($value); + $params[$name] = $value; + } + + return $params; +} + +/** + * + * @param $string + * @return unknown_type + */ +function sitepages_keywords_parse_view_params($string) { + $vars = sitepages_keywords_tokenize_params($string); + + // the first element key is the view + $var_keys = array_keys($vars); + $view = $var_keys[0]; + + $info = array( + 'view' => $view, + 'vars' => $vars + ); + + return $info; + +} + +/** + * Returns an options array suitable for using in elgg_get_entities() + * + * @param string $string "name=value, name2=value2" + * @return array + */ +function sitepages_keywords_parse_entity_params($string) { + $params = sitepages_keywords_tokenize_params($string); + + // handle some special cases + if (isset($params['owner'])) { + if ($user = get_user_by_username($params['owner'])) { + $params['owner_guid'] = $user->getGUID(); + } + } + + // @todo probably need to add more for + // group -> container_guid, etc + return $params; +} + + + +/** + * Utility object to store site page information. + */ +class ElggSitePage extends ElggObject { + public function initialise_attributes() { + parent::initialise_attributes(); + + $this->attributes['subtype'] = 'sitepages_page'; + } }
\ No newline at end of file diff --git a/mod/sitepages/views/default/settings/sitepages/edit.php b/mod/sitepages/views/default/settings/sitepages/edit.php index 9705aaae5..8a8a2d271 100644 --- a/mod/sitepages/views/default/settings/sitepages/edit.php +++ b/mod/sitepages/views/default/settings/sitepages/edit.php @@ -1,19 +1,19 @@ -<?php
-/**
- * Settings Site Pages
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-?>
-
-<p>
- <?php echo elgg_echo('sitepages:ownfront'); ?>
- <select name="params[ownfrontpage]">
- <option value="yes" <?php if ($vars['entity']->ownfrontpage == 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:yes'); ?></option>
- <option value="no" <?php if ($vars['entity']->ownfrontpage != 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:no'); ?></option>
- </select>
+<?php +/** + * Settings Site Pages + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ +?> + +<p> + <?php echo elgg_echo('sitepages:ownfront'); ?> + <select name="params[ownfrontpage]"> + <option value="yes" <?php if ($vars['entity']->ownfrontpage == 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:yes'); ?></option> + <option value="no" <?php if ($vars['entity']->ownfrontpage != 'yes') echo " selected=\"yes\" "; ?>><?php echo elgg_echo('option:no'); ?></option> + </select> </p>
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/forms/editmeta.php b/mod/sitepages/views/default/sitepages/forms/editmeta.php index cb67bd41d..b9a454bbf 100644 --- a/mod/sitepages/views/default/sitepages/forms/editmeta.php +++ b/mod/sitepages/views/default/sitepages/forms/editmeta.php @@ -1,43 +1,43 @@ -<?php
-/**
- * Edit form for the custom meta tags and desc
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
-$action = 'sitepages/addmeta';
-
-if ($sitepages_object = sitepages_get_sitepage_object('seo')) {
- $meta_tags = $sitepages_object->title;
- $meta_description = $sitepages_object->description;
-} else {
- $meta_tags = '';
- $meta_description = '';
-}
-
-$input_keywords = elgg_view('input/text', array('internalname' => 'metatags', 'value' => $meta_tags));
-$input_description = elgg_view('input/plaintext', array('internalname' => 'description', 'value' => $meta_description));
-$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
-
-$description = elgg_echo("sitepages:metadescription");
-$metatags = elgg_echo("sitepages:metatags");
-
-$form_body = <<<___EOT
-
-<p><label>$description
-$input_description</p></label>
-
-<p><label>$metatags
-$input_keywords</p></label>
-
-$hidden_guid
-$submit_input
-
-___EOT;
-
-//display the form
+<?php +/** + * Edit form for the custom meta tags and desc + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$action = 'sitepages/addmeta'; + +if ($sitepages_object = sitepages_get_sitepage_object('seo')) { + $meta_tags = $sitepages_object->title; + $meta_description = $sitepages_object->description; +} else { + $meta_tags = ''; + $meta_description = ''; +} + +$input_keywords = elgg_view('input/text', array('internalname' => 'metatags', 'value' => $meta_tags)); +$input_description = elgg_view('input/plaintext', array('internalname' => 'description', 'value' => $meta_description)); +$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); + +$description = elgg_echo("sitepages:metadescription"); +$metatags = elgg_echo("sitepages:metatags"); + +$form_body = <<<___EOT + +<p><label>$description +$input_description</p></label> + +<p><label>$metatags +$input_keywords</p></label> + +$hidden_guid +$submit_input + +___EOT; + +//display the form echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body));
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/keywords.php b/mod/sitepages/views/default/sitepages/keywords.php index 457ab99c7..d7fb8ad97 100644 --- a/mod/sitepages/views/default/sitepages/keywords.php +++ b/mod/sitepages/views/default/sitepages/keywords.php @@ -1,30 +1,30 @@ -<?php
-/**
- * Lists available keywords
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
-$keywords = $vars['config']->sitepages_keywords;
-$title = elgg_echo('sitepages:keywords_title');
-$instructions = elgg_echo('sitepages:keywords_instructions');
-$more_info = elgg_echo('sitepages:keywords_instructions_more');
-
-$keywords_html = '';
-foreach ($keywords as $keyword => $info) {
- $desc = htmlentities($info['description']);
- $keywords_html .= "<li><acronym title=\"$desc\">[[$keyword]]</acronym></li>";
-}
-
-echo "
-<h3>$title</h3>
-<p>$instructions</p>
-$more_info
-<ul>
- $keywords_html
-</ul>
+<?php +/** + * Lists available keywords + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$keywords = $vars['config']->sitepages_keywords; +$title = elgg_echo('sitepages:keywords_title'); +$instructions = elgg_echo('sitepages:keywords_instructions'); +$more_info = elgg_echo('sitepages:keywords_instructions_more'); + +$keywords_html = ''; +foreach ($keywords as $keyword => $info) { + $desc = htmlentities($info['description']); + $keywords_html .= "<li><acronym title=\"$desc\">[[$keyword]]</acronym></li>"; +} + +echo " +<h3>$title</h3> +<p>$instructions</p> +$more_info +<ul> + $keywords_html +</ul> ";
\ No newline at end of file diff --git a/mod/sitepages/views/default/sitepages/metatags.php b/mod/sitepages/views/default/sitepages/metatags.php index d3939f73e..973ab6417 100644 --- a/mod/sitepages/views/default/sitepages/metatags.php +++ b/mod/sitepages/views/default/sitepages/metatags.php @@ -1,39 +1,39 @@ -<?php
-/**
- * Add any additional defined metatags or CSS.
- *
- * @package SitePages
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
-$meta_details = sitepages_get_sitepage_object('seo');
-
-if ($meta_details) {
- $metatags = $meta_details->title;
- $description = $meta_details->description;
-
- echo <<<___END
-
- <meta name="description" content="$description" />
- <meta name="keywords" content="$metatags" />
-
-___END;
-}
-
-// only show on the custom front page.
-if (get_context() == 'sitepages:front') {
- $custom_css = sitepages_get_sitepage_object('front');
-
- if ($custom_css && $custom_css->css) {
- echo <<<___END
-
- <style type="text/css">
- {$custom_css->css}
- </style>
-
-___END;
- }
+<?php +/** + * Add any additional defined metatags or CSS. + * + * @package SitePages + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$meta_details = sitepages_get_sitepage_object('seo'); + +if ($meta_details) { + $metatags = $meta_details->title; + $description = $meta_details->description; + + echo <<<___END + + <meta name="description" content="$description" /> + <meta name="keywords" content="$metatags" /> + +___END; +} + +// only show on the custom front page. +if (get_context() == 'sitepages:front') { + $custom_css = sitepages_get_sitepage_object('front'); + + if ($custom_css && $custom_css->css) { + echo <<<___END + + <style type="text/css"> + {$custom_css->css} + </style> + +___END; + } }
\ No newline at end of file diff --git a/views/default/annotation/annotatelike.php b/views/default/annotation/annotatelike.php index 7c7b1887a..08bac55ae 100644 --- a/views/default/annotation/annotatelike.php +++ b/views/default/annotation/annotatelike.php @@ -1,11 +1,11 @@ -<?php
-
-$performed_by = get_entity($vars['item']->subject_guid);
-$object = get_entity($vars['item']->object_guid);
-$url = $object->getURL();
-$title = $object->title;
-
-$string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a> ";
-$string .= elgg_echo("likes:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> " . friendly_time($object->time_created);
-
+<?php + +$performed_by = get_entity($vars['item']->subject_guid); +$object = get_entity($vars['item']->object_guid); +$url = $object->getURL(); +$title = $object->title; + +$string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a> "; +$string .= elgg_echo("likes:river:annotate") . " <a href=\"{$object->getURL()}\">" . $title . "</a> " . friendly_time($object->time_created); + echo $string;
\ No newline at end of file diff --git a/views/default/annotation/likes.php b/views/default/annotation/likes.php index 8b3505482..4cf27e82b 100644 --- a/views/default/annotation/likes.php +++ b/views/default/annotation/likes.php @@ -1,40 +1,40 @@ -<?php
-/**
- * Elgg show the user who liked the object
- */
-
-$owner = get_user($vars['annotation']->owner_guid);
-
-?>
-<div class="elgg_likes clearfloat">
- <div class="elgg_likes_icon">
- <?php
- echo elgg_view("profile/icon", array(
- 'entity' => $owner,
- 'size' => 'tiny'
- ));
- ?>
- </div>
-
- <div class="elgg_likes_details">
- <?php
- // if the user looking at the like listing can edit, show the delete link
- if ($vars['annotation']->canEdit()) {
- ?>
- <span class="delete_button">
- <?php echo elgg_view("output/confirmlink",array(
- 'href' => $vars['url'] . "action/likes/delete?annotation_id=" . $vars['annotation']->id,
- 'text' => elgg_echo('remove'),
- 'confirm' => elgg_echo('deleteconfirm')
- ));
- ?>
- </span>
- <?php
- } //end of can edit if statement
- ?>
- <p class="elgg_likes_owner">
- <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a> <?php echo elgg_echo('likes:this') .
- " <span class=\"entity_subtext\">" . friendly_time($vars['annotation']->time_created) . "</span>"; ?>
- </p>
- </div>
+<?php +/** + * Elgg show the user who liked the object + */ + +$owner = get_user($vars['annotation']->owner_guid); + +?> +<div class="elgg_likes clearfloat"> + <div class="elgg_likes_icon"> + <?php + echo elgg_view("profile/icon", array( + 'entity' => $owner, + 'size' => 'tiny' + )); + ?> + </div> + + <div class="elgg_likes_details"> + <?php + // if the user looking at the like listing can edit, show the delete link + if ($vars['annotation']->canEdit()) { + ?> + <span class="delete_button"> + <?php echo elgg_view("output/confirmlink",array( + 'href' => $vars['url'] . "action/likes/delete?annotation_id=" . $vars['annotation']->id, + 'text' => elgg_echo('remove'), + 'confirm' => elgg_echo('deleteconfirm') + )); + ?> + </span> + <?php + } //end of can edit if statement + ?> + <p class="elgg_likes_owner"> + <a href="<?php echo $owner->getURL(); ?>"><?php echo $owner->name; ?></a> <?php echo elgg_echo('likes:this') . + " <span class=\"entity_subtext\">" . friendly_time($vars['annotation']->time_created) . "</span>"; ?> + </p> + </div> </div>
\ No newline at end of file diff --git a/views/foaf/search/entity_list.php b/views/foaf/search/entity_list.php index 984efe750..9a88f600a 100644 --- a/views/foaf/search/entity_list.php +++ b/views/foaf/search/entity_list.php @@ -1,15 +1,15 @@ -<?php
-/**
- * Elgg default layout
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-$entities = $vars['entities'];
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
+<?php +/** + * Elgg default layout + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ +$entities = $vars['entities']; +if (is_array($entities) && sizeof($entities) > 0) { + foreach($entities as $entity) { + echo elgg_view_entity($entity); + } }
\ No newline at end of file diff --git a/views/opendd/search/entity_list.php b/views/opendd/search/entity_list.php index 3ea06f40f..40b7cc840 100644 --- a/views/opendd/search/entity_list.php +++ b/views/opendd/search/entity_list.php @@ -1,13 +1,13 @@ -<?php
-/**
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-$entities = $vars['entities'];
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
+<?php +/** + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ +$entities = $vars['entities']; +if (is_array($entities) && sizeof($entities) > 0) { + foreach($entities as $entity) { + echo elgg_view_entity($entity); + } }
\ No newline at end of file diff --git a/views/rss/search/entity_list.php b/views/rss/search/entity_list.php index 05e90904f..72c0676ec 100644 --- a/views/rss/search/entity_list.php +++ b/views/rss/search/entity_list.php @@ -1,14 +1,14 @@ -<?php
-/**
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-
-$entities = $vars['entities'];
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
+<?php +/** + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$entities = $vars['entities']; +if (is_array($entities) && sizeof($entities) > 0) { + foreach($entities as $entity) { + echo elgg_view_entity($entity); + } }
\ No newline at end of file |