diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-01 18:36:43 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-01 18:36:43 +0000 |
commit | 4d8268188b86730360d268b6d14717c694a2ac07 (patch) | |
tree | 6b516310850aa0b2a6bf070696d39656955fd115 /views/foaf/export | |
parent | b7c631899e13dff55a708110461f1a406d91d692 (diff) | |
download | elgg-4d8268188b86730360d268b6d14717c694a2ac07.tar.gz elgg-4d8268188b86730360d268b6d14717c694a2ac07.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Added prototype FOAF view
git-svn-id: https://code.elgg.org/elgg/trunk@618 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/foaf/export')
-rw-r--r-- | views/foaf/export/entity.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/views/foaf/export/entity.php b/views/foaf/export/entity.php new file mode 100644 index 000000000..aea0b7855 --- /dev/null +++ b/views/foaf/export/entity.php @@ -0,0 +1,62 @@ +<?php + /** + * Elgg FOAF Entity export. + * Displays an ElggUser entity as FOAF. + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + global $CONFIG; + + $entity = $vars['entity']; + + if (!($entity instanceof ElggUser)) + exit; + +?> +<rdf:RDF + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:foaf="http://xmlns.com/foaf/0.1/"> + + <foaf:Person> + <foaf:name><?php echo $entity->name; ?></foaf:name> + <foaf:mbox rdf:resource="<?php echo $entity->email; ?>"/> + <foaf:nick><?php echo $entity->username; ?></foaf:nick> + + <!-- TODO : more --> + +<?php + + // Get friends + $friends = get_entities_from_relationship("friend", $entity->guid); + + // Iterate through and generate foaf:knows + if ($friends) + { + echo "<foaf:knows>\n"; + + foreach ($friends as $friend) + { + if ($friend instanceof ElggUser) + { +?> + <foaf:Person> + <foaf:name><?php echo $friend->name; ?></foaf:name> + <foaf:mbox rdf:resource="<?php echo $friend->email; ?>"/> + <rdfs:seeAlso rdf:resource="<?php echo guid_to_uuid($friend->guid); ?>"/> + </foaf:Person> +<?php + } + } + + echo "</foaf:knows>\n"; + } +?> + </foaf:Person> +</rdf:RDF>
\ No newline at end of file |