update core to 7.36

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 19:33:23 +02:00
parent 6de56c702c
commit 802ec0c6f3
271 changed files with 4111 additions and 1227 deletions

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
files[] = rdf.test
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -190,17 +190,33 @@ function _rdf_get_default_mapping($type) {
* An RDF mapping structure or an empty array if no record was found.
*/
function _rdf_mapping_load($type, $bundle) {
$mapping = db_select('rdf_mapping')
->fields(NULL, array('mapping'))
->condition('type', $type)
->condition('bundle', $bundle)
->execute()
->fetchField();
$mappings = _rdf_mapping_load_multiple($type, array($bundle));
return $mappings ? reset($mappings) : array();
}
if (!$mapping) {
return array();
/**
* Helper function to retrieve a set of RDF mappings from the database.
*
* @param $type
* The entity type of the mappings.
* @param $bundles
* The bundles the mappings refer to.
*
* @return
* An array of RDF mapping structures, or an empty array.
*/
function _rdf_mapping_load_multiple($type, array $bundles) {
$mappings = db_select('rdf_mapping')
->fields(NULL, array('bundle', 'mapping'))
->condition('type', $type)
->condition('bundle', $bundles)
->execute()
->fetchAllKeyed();
foreach ($mappings as $bundle => $mapping) {
$mappings[$bundle] = unserialize($mapping);
}
return unserialize($mapping);
return $mappings;
}
/**
@@ -368,10 +384,13 @@ function rdf_modules_uninstalled($modules) {
function rdf_entity_info_alter(&$entity_info) {
// Loop through each entity type and its bundles.
foreach ($entity_info as $entity_type => $entity_type_info) {
if (isset($entity_type_info['bundles'])) {
foreach ($entity_type_info['bundles'] as $bundle => $bundle_info) {
if ($mapping = _rdf_mapping_load($entity_type, $bundle)) {
$entity_info[$entity_type]['bundles'][$bundle]['rdf_mapping'] = $mapping;
if (!empty($entity_type_info['bundles'])) {
$bundles = array_keys($entity_type_info['bundles']);
$mappings = _rdf_mapping_load_multiple($entity_type, $bundles);
foreach ($bundles as $bundle) {
if (isset($mappings[$bundle])) {
$entity_info[$entity_type]['bundles'][$bundle]['rdf_mapping'] = $mappings[$bundle];
}
else {
// If no mapping was found in the database, assign the default RDF
@@ -471,27 +490,17 @@ function rdf_preprocess_node(&$variables) {
$variables['attributes_array']['about'] = empty($variables['node_url']) ? NULL: $variables['node_url'];
$variables['attributes_array']['typeof'] = empty($variables['node']->rdf_mapping['rdftype']) ? NULL : $variables['node']->rdf_mapping['rdftype'];
// Adds RDFa markup to the title of the node. Because the RDFa markup is
// added to the <h2> tag which might contain HTML code, we specify an empty
// datatype to ensure the value of the title read by the RDFa parsers is a
// literal.
$variables['title_attributes_array']['property'] = empty($variables['node']->rdf_mapping['title']['predicates']) ? NULL : $variables['node']->rdf_mapping['title']['predicates'];
$variables['title_attributes_array']['datatype'] = '';
// In full node mode, the title is not displayed by node.tpl.php so it is
// added in the <head> tag of the HTML page.
if ($variables['page']) {
$element = array(
'#tag' => 'meta',
'#attributes' => array(
'content' => $variables['node']->title,
'about' => $variables['node_url'],
// Adds RDFa markup about the title of the node to the title_suffix.
if (!empty($variables['node']->rdf_mapping['title']['predicates'])) {
$variables['title_suffix']['rdf_meta_title'] = array(
'#theme' => 'rdf_metadata',
'#metadata' => array(
array(
'property' => $variables['node']->rdf_mapping['title']['predicates'],
'content' => $variables['node']->title,
),
),
);
if (!empty($variables['node']->rdf_mapping['title']['predicates'])) {
$element['#attributes']['property'] = $variables['node']->rdf_mapping['title']['predicates'];
}
drupal_add_html_head($element, 'rdf_node_title');
}
// Adds RDFa markup for the date.
@@ -511,35 +520,20 @@ function rdf_preprocess_node(&$variables) {
}
// Adds RDFa markup annotating the number of comments a node has.
if (isset($variables['node']->comment_count) && !empty($variables['node']->rdf_mapping['comment_count']['predicates'])) {
// Annotates the 'x comments' link in teaser view.
if (isset($variables['content']['links']['comment']['#links']['comment-comments'])) {
$comment_count_attributes['property'] = $variables['node']->rdf_mapping['comment_count']['predicates'];
$comment_count_attributes['content'] = $variables['node']->comment_count;
$comment_count_attributes['datatype'] = $variables['node']->rdf_mapping['comment_count']['datatype'];
// According to RDFa parsing rule number 4, a new subject URI is created
// from the href attribute if no rel/rev attribute is present. To get the
// original node URL from the about attribute of the parent container we
// set an empty rel attribute which triggers rule number 5. See
// http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
$comment_count_attributes['rel'] = '';
$variables['content']['links']['comment']['#links']['comment-comments']['attributes'] += $comment_count_attributes;
}
// In full node view, the number of comments is not displayed by
// node.tpl.php so it is expressed in RDFa in the <head> tag of the HTML
// page.
if ($variables['page'] && user_access('access comments')) {
$element = array(
'#tag' => 'meta',
'#attributes' => array(
'about' => $variables['node_url'],
if (isset($variables['node']->comment_count) &&
!empty($variables['node']->rdf_mapping['comment_count']['predicates']) &&
user_access('access comments')) {
// Adds RDFa markup for the comment count near the node title as metadata.
$variables['title_suffix']['rdf_meta_comment_count'] = array(
'#theme' => 'rdf_metadata',
'#metadata' => array(
array(
'property' => $variables['node']->rdf_mapping['comment_count']['predicates'],
'content' => $variables['node']->comment_count,
'datatype' => $variables['node']->rdf_mapping['comment_count']['datatype'],
),
);
drupal_add_html_head($element, 'rdf_node_comment_count');
}
),
);
}
}
@@ -865,9 +859,9 @@ function theme_rdf_metadata($variables) {
$output = '';
foreach ($variables['metadata'] as $attributes) {
// Add a class so that developers viewing the HTML source can see why there
// are empty <span> tags in the document. The class can also be used to set
// a CSS display:none rule in a theme where empty spans affect display.
// are empty <span> tags in the document.
$attributes['class'][] = 'rdf-meta';
$attributes['class'][] = 'element-hidden';
// The XHTML+RDFa doctype allows either <span></span> or <span /> syntax to
// be used, but for maximum browser compatibility, W3C recommends the
// former when serving pages using the text/html media type, see

View File

@@ -301,7 +301,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
// Ensure the default bundle mapping for node is used. These attributes come
// from the node default bundle definition.
$blog_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$blog_title = $this->xpath("//div[@about='$url']/span[@property='dc:title' and @content='$node->title']");
$blog_meta = $this->xpath("//div[(@about='$url') and (@typeof='sioct:Weblog')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($blog_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($blog_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
@@ -324,7 +324,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
$this->drupalGet('node/' . $node->nid);
// Ensure the mapping defined in rdf_module.test is used.
$test_bundle_title = $this->xpath('//meta[@property="dc:title" and @content="' . $node->title . '"]');
$test_bundle_title = $this->xpath("//div[@about='$url']/span[@property='dc:title' and @content=\"$node->title\"]");
$test_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'foo:mapping_install1') and contains(@typeof, 'bar:mapping_install2')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($test_bundle_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($test_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
@@ -343,7 +343,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
// Ensure the default bundle mapping for node is used. These attributes come
// from the node default bundle definition.
$random_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$random_bundle_title = $this->xpath("//div[@about='$url']/span[@property='dc:title' and @content='$node->title']");
$random_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'sioc:Item') and contains(@typeof, 'foaf:Document')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
$this->assertTrue(!empty($random_bundle_title), 'Property dc:title is present in meta tag.');
$this->assertTrue(!empty($random_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
@@ -461,15 +461,13 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
// Tests number of comments in teaser view.
$this->drupalGet('node');
$comment_count_teaser = $this->xpath('//div[contains(@typeof, "sioc:Item")]//li[contains(@class, "comment-comments")]/a[contains(@property, "sioc:num_replies") and contains(@content, "2") and @datatype="xsd:integer"]');
$node_url = url('node/' . $this->node1->nid);
$comment_count_teaser = $this->xpath('//div[@about=:node-url]/span[@property="sioc:num_replies" and @content="2" and @datatype="xsd:integer"]', array(':node-url' => $node_url));
$this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on teaser view.');
$comment_count_link = $this->xpath('//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]', array(':url' => url("node/{$this->node1->nid}")));
$this->assertTrue(!empty($comment_count_link), 'Empty rel attribute found in comment count link.');
// Tests number of comments in full node view.
$this->drupalGet('node/' . $this->node1->nid);
$node_url = url('node/' . $this->node1->nid);
$comment_count_teaser = $this->xpath('/html/head/meta[@about=:node-url and @property="sioc:num_replies" and @content="2" and @datatype="xsd:integer"]', array(':node-url' => $node_url));
$comment_count_teaser = $this->xpath('//div[@about=:node-url]/span[@property="sioc:num_replies" and @content="2" and @datatype="xsd:integer"]', array(':node-url' => $node_url));
$this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on full node view.');
}

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"