Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit c19e13b

Browse files
committed
Merge branch '3.4.2' into 3.4
2 parents 575fd71 + 8d3f4ec commit c19e13b

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

culturefeed.helpers.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ function culturefeed_acceptance_mode() {
279279
return TRUE;
280280
}
281281

282+
// Check for acc or dev environments that are connected with production
283+
else {
284+
global $base_root;
285+
$dev_ids = array('culturefeed', 'dev.', 'acc.');
286+
foreach($dev_ids as $id) {
287+
if (stripos($base_root, $id) !== false) {
288+
return TRUE;
289+
}
290+
}
291+
return FALSE;
292+
}
293+
282294
}
283295

284296
/**

culturefeed_search/culturefeed_search.module

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ define('CULTUREFEED_SEARCH_DEFAULT_PROXIMITY_RANGE', 20);
1313

1414
module_load_include('inc', 'culturefeed_search', 'includes/helpers');
1515

16+
/**
17+
* Implements hook_init().
18+
*/
19+
function culturefeed_search_init() {
20+
21+
// Set noindex metatag when Search API location points to acceptance.
22+
if (culturefeed_search_acceptance_mode()) {
23+
culturefeed_search_set_noindex_metatag();
24+
}
25+
}
26+
1627
/**
1728
* Implements hook_menu().
1829
*/

culturefeed_search/includes/helpers.inc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,3 +879,45 @@ function culturefeed_search_block_ajaxload($config) {
879879

880880
return $block;
881881
}
882+
883+
/**
884+
* Check if we are connected to acceptance API.
885+
*/
886+
function culturefeed_search_acceptance_mode() {
887+
888+
// Get culturefeed_search_api_location
889+
$location = variable_get('culturefeed_search_api_location');
890+
if (strpos($location,'www') === false) {
891+
return TRUE;
892+
}
893+
894+
// Check for acc or dev environments that are connected with production
895+
else {
896+
global $base_root;
897+
$dev_ids = array('culturefeed', 'dev.', 'acc.');
898+
foreach($dev_ids as $id) {
899+
if (stripos($base_root, $id) !== false) {
900+
return TRUE;
901+
}
902+
}
903+
return FALSE;
904+
}
905+
906+
}
907+
908+
/**
909+
* Set the "noindex, follow" meta tag when needed.
910+
*/
911+
function culturefeed_search_set_noindex_metatag() {
912+
913+
$element = array(
914+
'#tag' => 'meta',
915+
'#attributes' => array(
916+
'name' => 'robots',
917+
'content' => 'noindex, follow',
918+
),
919+
);
920+
921+
drupal_add_html_head($element, 'robots');
922+
923+
}

culturefeed_search_ui/includes/helpers.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function culturefeed_search_ui_set_noindex_metatag() {
165165

166166
// Add the "noindex, follow" meta tag if needed.
167167
if ($noindex) {
168-
culturefeed_set_noindex_metatag();
168+
culturefeed_search_set_noindex_metatag();
169169
}
170170

171171
}

0 commit comments

Comments
 (0)