Changeset 769768
- Timestamp:
- 09/10/2013 03:15:49 PM (13 years ago)
- Location:
- wp-linked-data/trunk
- Files:
-
- 9 added
- 4 edited
-
controller (added)
-
controller/UserProfileController.php (added)
-
model (added)
-
model/RsaPublicKey.php (added)
-
rdf/RdfBuilder.php (modified) (5 diffs)
-
readme.txt (modified) (4 diffs)
-
service (added)
-
service/UserProfileWebIdService.php (added)
-
service/WebIdService.php (added)
-
view (added)
-
view/webId.html (added)
-
wp-linked-data-initialize.php (modified) (2 diffs)
-
wp-linked-data.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-linked-data/trunk/rdf/RdfBuilder.php
r715544 r769768 7 7 */ 8 8 class RdfBuilder { 9 10 private $webIdService; 11 12 public function __construct ($webIdService) { 13 $this->webIdService = $webIdService; 14 } 9 15 10 16 public function buildGraph ($queriedObject, $wpQuery) { … … 44 50 45 51 $author = get_userdata ($post->post_author); 46 $accountUri = $this-> getAccountUri ($author);52 $accountUri = $this->webIdService->getAccountUri ($author); 47 53 $accountResource = $graph->resource ($accountUri, 'sioc:UserAccount'); 48 54 $accountResource->set ('sioc:name', $author->display_name); … … 60 66 } 61 67 62 private function getAuthorUri ($author) {63 return $this->getAuthorDocumentUri ($author) . '#me';64 }65 66 private function getAccountUri ($author) {67 return $this->getAuthorDocumentUri ($author) . '#account';68 }69 70 private function getAuthorDocumentUri ($author) {71 return untrailingslashit (get_author_posts_url ($author->ID));72 }73 74 68 private function getRdfTypeForPost ($queriedObject) { 75 69 if ($queriedObject->post_type == 'post') { … … 80 74 81 75 private function buildGraphForUser ($graph, $user, $wpQuery) { 82 $author_uri = $this-> getAuthorUri($user);83 $account_uri = $this-> getAccountUri ($user);76 $author_uri = $this->webIdService->getWebIdOf ($user); 77 $account_uri = $this->webIdService->getAccountUri ($user); 84 78 $author_resource = $graph->resource ($author_uri, 'foaf:Person'); 85 79 $account_resource = $graph->resource ($account_uri, 'sioc:UserAccount'); … … 95 89 $account_resource->set ('sioc:account_of', $author_resource); 96 90 91 $this->addRsaPublicKey ($user, $graph, $author_resource); 92 $this->addAdditionalRdf ($user, $graph); 93 97 94 $this->linkAllPosts ($wpQuery, $graph, $account_resource, 'sioc:creator_of'); 98 95 return $graph; 96 } 97 98 private function addRsaPublicKey ($user, $graph, $author_resource) { 99 $rsaPublicKey = $this->webIdService->getRsaPublicKey ($user); 100 if ($rsaPublicKey) { 101 $key_resource = $graph->newBNode ('cert:RSAPublicKey'); 102 $key_resource->set ('cert:exponent', new \EasyRdf_Literal_Integer($rsaPublicKey->getExponent ())); 103 $key_resource->set ('cert:modulus', new \EasyRdf_Literal_HexBinary($rsaPublicKey->getModulus ())); 104 $author_resource->set ('cert:key', $key_resource); 105 } 106 } 107 108 private function addAdditionalRdf ($user, $graph) { 109 $rdf = get_the_author_meta ('additionalRdf', $user->ID); 110 if (!empty($rdf)) { 111 $graph->parse ($rdf); 112 } 99 113 } 100 114 -
wp-linked-data/trunk/readme.txt
r715552 r769768 13 13 == Description == 14 14 15 This plugin publishes blog post metadata and data about the author according to the Linked Data Principles defined by Tim Berners-Lee. (http://www.w3.org/DesignIssues/LinkedData.html) 15 === Linked Data === 16 16 17 17 Turtle and RDF/XML documents can be retrieved performing a HTTP GET request with an appropriate HTTP-Accept-Header set. Blog posts and pages are identified by their original document URI appended by the fragment identifier #it. … … 21 21 You may use curl to retrieve Linked Data, e.g.: 22 22 23 curl -H 'Accept: text/turtle' http://example.org/2013/04/my-first-blog-post 23 curl -H 'Accept: text/turtle' http://example.org/2013/04/my-first-blog-post#it 24 24 25 An author, as a person, is identified by the author page URI appended by the fragment identifier #me.25 An author, as a person, is per default identified by the author page URI appended by the fragment identifier #me. 26 26 27 27 E.g. if the authors page is http://example.org/author/alice, the person Alice is identified by http://example.org/author/alice#me … … 30 30 31 31 curl -H 'Accept: text/turtle' http://example.org/author/alice#me 32 33 Instead of using WordPress to host the FOAF-Profile, you are able to link your existing WebID to your WordPress account. (See next section) 34 35 === WebID === 36 37 The Plugin adds a WebID section to the user profile screen in the admin backend. (Note: The section is only available, when editing _your own_ profile). 38 39 ==== WebID Location ==== 40 41 You can choose, where your WebID is hosted: 42 43 1. Locally hosted WebID: The WebID is hosted within your wordpress blog at http://[your-domain]/author/[your-username]#me 44 2. Custom WebID: You may enter whatever your WebID URI is and your WordPress account will be linked to it. 45 46 Whatever option you choose, your wordpress account will always be identified as "http://[your-domain]\>/author/[your-username]>#account". The option only affects, how you, as a person, will be identified. 47 48 If you do not have a WebID yet, choose the first option, or get a WebID at http://my-profile.eu. More Information about WebID: http://webid.info/ 49 50 ==== RSA Public Key ==== 51 52 You may enter the exponent and modulus of the public key of your WebID certificate. This will allow you to use your WordPress WebID for authentication elsewhere on the web. The wp-linked-data plugin is not yet capable of creating WebID certificates, so you will have to create the certificate with another tool (e.g. openssl) and enter the data into this section afterwards. 53 54 ==== Additional RDF Triples ==== 55 56 You may enter any RDF triples as RDF/XML, Turtle or N3. The triples will occur in the RDF representation of your WordPress profile document at at http://[your-domain]/author/[your-username] 32 57 33 58 == Installation == … … 41 66 == Changelog == 42 67 68 = 0.3 = 69 * choose between locally hosted WebID and custom WebID 70 * add RSA public key to your profile 71 * add custom RDF triples to your profile document 72 43 73 = 0.2 = 44 74 * distinguish users (persons) and their user accounts -
wp-linked-data/trunk/wp-linked-data-initialize.php
r705406 r769768 4 4 class WpLinkedDataInitializer { 5 5 6 private $webIdService; 7 6 8 function initialize () { 7 9 $this->registerRdfNamespaces (); 10 $this->webIdService = new \org\desone\wordpress\wpLinkedData\UserProfileWebIdService(); 8 11 $contentNegotiation = $this->getSupportedContentNegotiation (); 9 $rdfBuilder = new \org\desone\wordpress\wpLinkedData\RdfBuilder( );12 $rdfBuilder = new \org\desone\wordpress\wpLinkedData\RdfBuilder($this->webIdService); 10 13 $rdfPrinter = new \org\desone\wordpress\wpLinkedData\RdfPrinter(); 11 14 $interceptor = new \org\desone\wordpress\wpLinkedData\RequestInterceptor( … … 13 16 ); 14 17 return $interceptor; 18 } 19 20 function getUserProfileController () { 21 return new \org\desone\wordpress\wpLinkedData\UserProfileController($this->webIdService); 15 22 } 16 23 -
wp-linked-data/trunk/wp-linked-data.php
r715544 r769768 4 4 Plugin URI: http://wordpress.org/extend/plugins/wp-linked-data/ 5 5 Description: Publishing blog contents as linked data 6 Version: 0. 26 Version: 0.3 7 7 Author: Angelo Veltens 8 8 Author URI: http://me.desone.org/person/aveltens#me … … 24 24 require_once(WP_LINKED_DATA_PLUGIN_DIR_PATH . 'rdf/RdfPrinter.php'); 25 25 require_once(WP_LINKED_DATA_PLUGIN_DIR_PATH . 'lib/EasyRdf.php'); 26 require_once(WP_LINKED_DATA_PLUGIN_DIR_PATH . 'controller/UserProfileController.php'); 27 require_once(WP_LINKED_DATA_PLUGIN_DIR_PATH . 'service/UserProfileWebIdService.php'); 26 28 } 27 29 … … 33 35 if (phpVersionSupported()) { 34 36 add_action('admin_init', array(&$this, 'showWarningIfPeclHttpMissing')); 37 35 38 $interceptor = $wpLinkedDataInitializer->initialize (); 36 39 add_action ('wp', array(&$interceptor, 'intercept')); 40 41 $userProfileController = $wpLinkedDataInitializer->getUserProfileController (); 42 add_action ('show_user_profile', array(&$userProfileController, 'renderWebIdSection')); 43 add_action ('personal_options_update', array(&$userProfileController, 'saveWebIdData')); 37 44 } 38 45 }
Note: See TracChangeset
for help on using the changeset viewer.