diff --git a/rich_snippets.apachesolr_legacy.inc b/rich_snippets.apachesolr_legacy.inc index edbb675..4177b49 100644 --- a/rich_snippets.apachesolr_legacy.inc +++ b/rich_snippets.apachesolr_legacy.inc @@ -118,5 +118,8 @@ function apachesolr_get_index_key_map($entity_type) { } } - return $index_key_map[$entity_type]; + if (isset($index_key_map[$entity_type])) { + return $index_key_map[$entity_type]; + } + return false; } diff --git a/rich_snippets.module b/rich_snippets.module index 35ffa14..25002e7 100644 --- a/rich_snippets.module +++ b/rich_snippets.module @@ -333,9 +333,11 @@ function rich_snippets_get_schema_from_predicates(array $rdf_mapping, $field_nam */ function rich_snippets_get_result_schema($entity_type, $bundle) { $mapping = rdf_mapping_load($entity_type, $bundle); - foreach ($mapping['rdftype'] as $typeof) { - if (0 === strpos($typeof, 'schema:')) { - return substr($typeof, 7); + if (isset($mapping['rdftype']) && !empty($mapping['rdftype'])) { + foreach ($mapping['rdftype'] as $typeof) { + if (0 === strpos($typeof, 'schema:')) { + return substr($typeof, 7); + } } } return FALSE; diff --git a/rich_snippets.preprocess.inc b/rich_snippets.preprocess.inc index ad8d3c6..afec902 100644 --- a/rich_snippets.preprocess.inc +++ b/rich_snippets.preprocess.inc @@ -14,13 +14,16 @@ function rich_snippets_default_preprocessor(&$variables) { // Build the date, remove it from search info. - $date = theme('rich_snippets_date', array('date' => $variables['result']['date'])); - $variables['snippet'] = $date . ' ' . $variables['snippet']; - unset($variables['info_split']['date']); - + if (isset($variables['result']['date'])) { + $date = theme('rich_snippets_date', array('date' => $variables['result']['date'])); + $variables['snippet'] = $date . ' ' . $variables['snippet']; + unset($variables['info_split']['date']); + } // Re-format the author info. - $user_args = array('!user' => $variables['info_split']['user']); - $variables['info_split']['user'] = t('By !user', $user_args); + if (isset($variables['info_split']['user'])) { + $user_args = array('!user' => $variables['info_split']['user']); + $variables['info_split']['user'] = t('By !user', $user_args); + } } /**