aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 21:11:36 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-22 21:11:36 +0000
commitd45a24be28b2eb2d0c2731708b589788a5b87215 (patch)
treed73568e65b05c42cc23b8c355a80907684be2cb5
parent46c278c3603765b623fa441e2435274fbeda05ad (diff)
downloadelgg-d45a24be28b2eb2d0c2731708b589788a5b87215.tar.gz
elgg-d45a24be28b2eb2d0c2731708b589788a5b87215.tar.bz2
Merged r6671:6683 from 1.7 branch to trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6847 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/entities.php21
-rw-r--r--engine/lib/metadata.php2
-rw-r--r--engine/lib/output.php20
-rw-r--r--engine/lib/views.php38
-rw-r--r--engine/lib/widgets.php15
-rw-r--r--mod/file/world.php8
6 files changed, 55 insertions, 49 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index b684ae822..1750f12e1 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -212,18 +212,23 @@ abstract class ElggEntity implements
*/
public function set($name, $value) {
if (array_key_exists($name, $this->attributes)) {
- // Check that we're not trying to change the guid!
- if ((array_key_exists('guid', $this->attributes)) && ($name=='guid')) {
- return false;
+ // Certain properties should not be manually changed!
+ switch ($name) {
+ case 'guid':
+ case 'time_created':
+ case 'time_updated':
+ case 'last_action':
+ return FALSE;
+ break;
+ default:
+ $this->attributes[$name] = $value;
+ break;
}
-
- $this->attributes[$name] = $value;
- }
- else {
+ } else {
return $this->setMetaData($name, $value);
}
- return true;
+ return TRUE;
}
/**
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 4d489178f..a6843e598 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -989,7 +989,7 @@ $count = FALSE, $case_sensitive = TRUE) {
* @return string A list of entities suitable for display
*/
function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = ELGG_ENTITIES_ANY_VALUE, $entity_subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true, $case_sensitive = true ) {
- elgg_deprecated_notice('get_entities_from_metadata_multi() was deprecated by elgg_get_entities_from_metadata()!', 1.8);
+ elgg_deprecated_notice('list_entities_from_metadata() was deprecated by elgg_list_entities_from_metadata()!', 1.8);
$offset = (int) get_input('offset');
$limit = (int) $limit;
diff --git a/engine/lib/output.php b/engine/lib/output.php
index 3d08f2a28..640ada1cf 100644
--- a/engine/lib/output.php
+++ b/engine/lib/output.php
@@ -1,7 +1,7 @@
<?php
/**
* Output functions
- * Processing text for output, formatting HTML,
+ * Processing text for output such as pulling out URLs and extracting excerpts
*
* @package Elgg
* @subpackage Core
@@ -46,6 +46,9 @@ function parse_urls($text) {
* Create paragraphs from text with line spacing
* Borrowed from Wordpress.
*
+ * @param string $pee
+ * @param bool $br
+ * @return string
**/
function autop($pee, $br = 1) {
$pee = $pee . "\n"; // just to make things a little easier, pad the end
@@ -185,6 +188,8 @@ function friendly_time($time) {
/**
* Formats a UNIX timestamp in a friendly way (eg "less than a minute ago")
*
+ * @see elgg_view_friendly_time()
+ *
* @param int $time A UNIX epoch timestamp
* @return string The friendly time string
* @since 1.7.2
@@ -243,17 +248,6 @@ function elgg_get_friendly_time($time) {
}
/**
- * Displays a UNIX timestamp in a friendly way
- *
- * @param int $time A UNIX epoch timestamp
- * @return string The friendly time HTML
- * @since 1.7.2
- */
-function elgg_view_friendly_time($time) {
- return elgg_view('output/friendlytime', array('time' => $time));
-}
-
-/**
* Strip tags and offer plugins the chance.
* Plugins register for output:strip_tags plugin hook.
* Original string included in $params['original_string']
@@ -268,4 +262,4 @@ function elgg_strip_tags($string) {
$string = trigger_plugin_hook('format', 'strip_tags', $params, $string);
return $string;
-} \ No newline at end of file
+}
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 68ddf49e1..76d2a57da 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -3,6 +3,7 @@
* Provides interfaces for Elgg's views system
*
* @package Elgg
+ * @subpackage Core
*/
$CURRENT_SYSTEM_VIEWTYPE = "";
@@ -67,6 +68,7 @@ function elgg_get_viewtype() {
* This is useful for alternate html viewtypes (such as for mobile devices)
*
* @param string $viewtype The viewtype to register
+ * @since 1.7.2
*/
function elgg_register_viewtype_fallback($viewtype) {
global $CONFIG;
@@ -87,6 +89,7 @@ function elgg_register_viewtype_fallback($viewtype) {
*
* @param string $viewtype
* @return boolean
+ * @since 1.7.2
*/
function elgg_does_viewtype_fallback($viewtype) {
global $CONFIG;
@@ -351,8 +354,7 @@ function elgg_view_register_simplecache($viewname) {
* Regenerates the simple cache.
*
* @param string $viewtype Optional viewtype to regenerate
- * @see elgg_view_register_simplecache
- *
+ * @see elgg_view_register_simplecache()
*/
function elgg_view_regenerate_simplecache($viewtype = NULL) {
global $CONFIG;
@@ -409,10 +411,8 @@ function elgg_view_regenerate_simplecache($viewtype = NULL) {
/**
* Enables the simple cache.
*
- * @see elgg_view_register_simplecache
- *
+ * @see elgg_view_register_simplecache()
*/
-
function elgg_view_enable_simplecache() {
global $CONFIG;
@@ -424,8 +424,7 @@ function elgg_view_enable_simplecache() {
/**
* Disables the simple cache.
*
- * @see elgg_view_register_simplecache
- *
+ * @see elgg_view_register_simplecache()
*/
function elgg_view_disable_simplecache() {
global $CONFIG;
@@ -449,9 +448,10 @@ function elgg_view_disable_simplecache() {
/**
* Internal function for retrieving views used by elgg_view_tree
*
- * @param unknown_type $dir
- * @param unknown_type $base
- * @return unknown
+ * @param string $dir
+ * @param string $base
+ * @return array
+ * @since 1.7
*/
function elgg_get_views($dir, $base) {
$return = array();
@@ -802,6 +802,19 @@ function elgg_view_title($title, $submenu = false) {
return $title;
}
+/**
+ * Displays a UNIX timestamp in a friendly way
+ *
+ * @see elgg_get_friendly_time()
+ *
+ * @param int $time A UNIX epoch timestamp
+ * @return string The friendly time HTML
+ * @since 1.7.2
+ */
+function elgg_view_friendly_time($time) {
+ return elgg_view('output/friendlytime', array('time' => $time));
+}
+
/**
* Automatically views comments and a comment form relating to the given entity
@@ -848,7 +861,7 @@ function elgg_view_listing($icon, $info) {
*
* function my_template_function(string $view, array $vars = array())
*
- * @see elgg_view
+ * @see elgg_view()
*
* @param string $function_name The name of the function to pass to.
* @return true|false
@@ -1013,7 +1026,8 @@ function autoregister_views($view_base, $folder, $base_location_path, $viewtype)
}
/**
- * Outputs a representation of a full 'page' (which might be an HTML page, RSS file, etc, depending on the current view)
+ * Returns a representation of a full 'page' (which might be an HTML page,
+ * RSS file, etc, depending on the current viewtype)
*
* @param string $title
* @param string $body
diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php
index 7884f263a..1862ef7e4 100644
--- a/engine/lib/widgets.php
+++ b/engine/lib/widgets.php
@@ -201,9 +201,9 @@ function display_widget(ElggObject $widget) {
}
/**
- * Add a new widget
+ * Add a new widget instance
*
- * @param int $user_guid User GUID to associate this widget with
+ * @param int $entity_guid GUID of entity that owns this widget
* @param string $handler The handler for this widget
* @param string $context The page context for this widget
* @param int $order The order to display this widget in
@@ -211,15 +211,15 @@ function display_widget(ElggObject $widget) {
* @param int $access_id If not specified, it is set to the default access level
* @return true|false Depending on success
*/
-function add_widget($user_guid, $handler, $context, $order = 0, $column = 1, $access_id = null) {
- if (empty($user_guid) || empty($context) || empty($handler) || !widget_type_exists($handler)) {
+function add_widget($entity_guid, $handler, $context, $order = 0, $column = 1, $access_id = null) {
+ if (empty($entity_guid) || empty($context) || empty($handler) || !widget_type_exists($handler)) {
return false;
}
- if ($user = get_user($user_guid)) {
+ if ($entity = get_entity($entity_guid)) {
$widget = new ElggWidget;
- $widget->owner_guid = $user_guid;
- $widget->container_guid = $user_guid;
+ $widget->owner_guid = $entity_guid;
+ $widget->container_guid = $entity_guid;
if (isset($access_id)) {
$widget->access_id = $access_id;
} else {
@@ -237,7 +237,6 @@ function add_widget($user_guid, $handler, $context, $order = 0, $column = 1, $ac
// save_widget_location($widget, $order, $column);
return true;
-
}
return false;
diff --git a/mod/file/world.php b/mod/file/world.php
index 38ab4e8ff..735692d79 100644
--- a/mod/file/world.php
+++ b/mod/file/world.php
@@ -12,7 +12,6 @@
$limit = get_input("limit", 10);
$offset = get_input("offset", 0);
- $tag = get_input("tag");
// Get the current page's owner
$page_owner = page_owner_entity();
@@ -27,10 +26,7 @@
$area1 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'file'));
$area1 .= get_filetype_cloud(); // the filter
set_context('search');
- if ($tag != "")
- $area2 .= list_entities_from_metadata('tags',$tag,'object','file',0,10,false);
- else
- $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'limit' => 10, 'offset' => $offset, 'full_view' => FALSE));
+ $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'limit' => $limit, 'offset' => $offset, 'full_view' => FALSE));
set_context('file');
//get the latest comments on all files
@@ -41,6 +37,4 @@
$body = elgg_view_layout('one_column_with_sidebar', $content, $area3);
- // Finally draw the page
page_draw($title, $body);
-?> \ No newline at end of file