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

Commit

Permalink
Merge branch 'develop’. Release v3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnswaanen committed Jul 20, 2017
2 parents 922a7a3 + c2c7028 commit b54a42c
Show file tree
Hide file tree
Showing 46 changed files with 863 additions and 330 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ __[Live demo connecting acceptance API](http://acc.culturefeed.be/) only availab

When you start with a clean Drupal install or just for setting up a quick demo site we created a __[Drupal install profile](https://drupal.org/developing/distributions)__ ("Installation profiles provide specific site features and functions for a specific purpose or type of site distributions"). This included also a shell script (Build.sh) which downloads:

- drupal core (at the moment 7.32)
- drupal core (at the moment 7.56)
- drupal contribs (bootstrap 3.0)
- culturefeed
- culturefeed_bootstrap
Expand Down Expand Up @@ -54,9 +54,11 @@ Afterwards copy the composer.json file from the root of the module suite to the
"description": "CultuurNet culturefeed Drupal module",
"license": "Apache-2.0",
"require": {
"composer/composer": "~1.0",
"mobiledetect/mobiledetectlib": "dev-master",
"cultuurnet/search": "~1.2",
"cultuurnet/cdb": "~2.1",
"cultuurnet/culturefeed-php": "~1.5",
"cultuurnet/culturefeed-php": "~1.6",
"cultuurnet/calendar-summary": "~1.0",
"cultuurnet/sitemap-xml": "~1.0"
},
Expand Down Expand Up @@ -101,7 +103,7 @@ We created 3 tutorials to integrate the most common use cases:
Most of the modules have an dependency on these PHP libraries. See "Install" how to install theme with composer.

###CultuurNet\Cdb
Fluent PHP library for manipulating, serializing and deserializing data present in CultuurNet's CdbXML 3.2 format
Fluent PHP library for manipulating, serializing and deserializing data present in CultuurNet's CdbXML 3.2 or 3.3 format

[https://github.com/cultuurnet/cdb](https://github.com/cultuurnet/cdb)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mobiledetect/mobiledetectlib": "dev-master",
"cultuurnet/search": "~1.2",
"cultuurnet/cdb": "~2.1",
"cultuurnet/culturefeed-php": "~1.5",
"cultuurnet/culturefeed-php": "~1.6",
"cultuurnet/calendar-summary": "~1.0",
"cultuurnet/sitemap-xml": "~1.0"
},
Expand Down
12 changes: 12 additions & 0 deletions culturefeed.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ function culturefeed_admin_settings() {
'#size' => 40,
'#maxlength' => 40,
);
$form['culturefeed_entry_api_location'] = array(
'#type' => 'textfield',
'#title' => t('Entry API location'),
'#description' => t('The URL where the CultureFeed Entry API resides. End with a slash. Example: http://acc.uitid.be/uitid/rest/'),
'#default_value' => variable_get('culturefeed_entry_api_location', CULTUREFEED_API_LOCATION),
);
$form['culturefeed_entry_api_path'] = array(
'#type' => 'textfield',
'#title' => t('Entry API path'),
'#description' => t('The path where the CultureFeed Entry API resides. End with a slash. Example: entry/test.rest.uitdatabank.be/api/v2/'),
'#default_value' => variable_get('culturefeed_entry_api_path', CULTUREFEED_ENTRY_API_PATH),
);

$form['culturefeed_api_uitid_light_permission'] = array(
'#type' => 'checkbox',
Expand Down
22 changes: 13 additions & 9 deletions culturefeed.helpers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -434,22 +434,22 @@ function culturefeed_ui_block_ajaxload($config) {
* Generate an image style url for an external image.
*/
function culturefeed_external_image_style($image_url, $image_style) {

global $base_url;
$curr_url = str_replace('http://', '', $base_url);
$image_url_parts = explode('/', str_replace('http://', '', $image_url));
$curr_url_parts = explode('/', $curr_url);

// Get the URL parts without protocol.
$pattern = '#^https?://#';
$curr_url_parts = explode('/', preg_replace($pattern, '', $base_url));
$image_url_parts = explode('/', preg_replace($pattern, '', $image_url));

$file_directory = variable_get('file_public_path', 'sites/default/files');

// If this file is original of current host, just use the original path.
if ($image_url_parts[0] == $curr_url_parts[0]) {
if ($image_url_parts[0] === $curr_url_parts[0]) {
$local_uri = trim(str_replace($base_url . '/', '', $image_url), '/');
$local_uri = str_replace($file_directory . '/', 'public://', $local_uri);
}
// If the file is of another site, download it locally. This is needed to use imagecache.
else {

$file = new stdClass();
$file->filename = $image_url;
$validation_errors = file_validate_extensions($file, 'jpg jpeg png gif');
Expand All @@ -465,19 +465,23 @@ function culturefeed_external_image_style($image_url, $image_style) {
// Not needed if the file already exists.
if (!file_exists($local_uri)) {
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$image_content = @file_get_contents($image_url);
// Make sure we have a proper protocol in front of the URL.
$image_url_get = $image_url;
if (!preg_match($pattern, $image_url_get)) {
$image_url_get = 'http:' . $image_url_get;
}

$image_content = @file_get_contents($image_url_get);
if ($image_content) {
file_put_contents($directory . '/' . $file_name, $image_content);
}
else {
return;
}
}

}

return image_style_url($image_style, $local_uri);

}

/**
Expand Down
2 changes: 1 addition & 1 deletion culturefeed.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = CultureFeed
description = CultureFeed
package = CultureFeed
version = "7.x-3.5"
version = "7.x-3.10"
core = 7.x

files[] = lib/Drupal/DrupalCultureFeedBase.php
Expand Down
7 changes: 6 additions & 1 deletion culturefeed_agenda/culturefeed_agenda.module
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,12 @@ function culturefeed_agenda_block_configure($delta) {

// sort_direction is no longer a seperate field. Add it to the sort field if variable exists.
$sort_direction = variable_get('agenda_related_activities_sort_direction', '');
$default_sort = variable_get('agenda_related_activities_sort') . ' ' . $sort_direction;
if (!empty($sort_direction)) {
$default_sort = variable_get('agenda_related_activities_sort') . ' ' . $sort_direction;
}
else {
$default_sort = variable_get('agenda_related_activities_sort');
}

$form['agenda_related_activities_sort'] = array(
'#title' => t('Sort field'),
Expand Down
14 changes: 14 additions & 0 deletions culturefeed_agenda/includes/admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ function culturefeed_agenda_admin_settings_form() {
'#description' => t('Check this checkbox if you want to have culturefeed_social links in the template variables.'),
);

$form['culturefeed_agenda_hide_webresources'] = array(
'#title' => t('Hide deprecated links stored as mediatype webresource or website'),
'#type' => 'checkbox',
'#default_value' => variable_get('culturefeed_agenda_hide_webresources', FALSE),
'#description' => t('By enabling this the event detail page will only show url\'s in the contactinfo object of cdbxml.'),
);

$form['culturefeed_agenda_deduplicate_descriptions'] = array(
'#title' => t('Remove duplicate short description on detail pages'),
'#type' => 'checkbox',
'#default_value' => variable_get('culturefeed_agenda_deduplicate_descriptions', TRUE),
'#description' => t('By enabling this, the short description on event detail pages will be removed if they are redundant with the long description.'),
);

$form['gmap'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
Expand Down
4 changes: 2 additions & 2 deletions culturefeed_agenda/includes/blocks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function culturefeed_agenda_block_actor_program() {
$parameters[] = new \CultuurNet\Search\Parameter\Group();
$parameters[] = new \CultuurNet\Search\Parameter\Rows(CULTUREFEED_AGENDA_ACTOR_PROGRAM_NUM_ITEMS);
$parameters[] = new \CultuurNet\Search\Parameter\FilterQuery('"' . $item->getId() . '"');
$parameters[] = new \CultuurNet\Search\Parameter\Sort('startdate', 'asc');
$parameters[] = new \CultuurNet\Search\Parameter\Sort('availableto', 'asc');

try {

Expand Down Expand Up @@ -630,4 +630,4 @@ function culturefeed_agenda_search_map() {
);

return $block;
}
}
20 changes: 10 additions & 10 deletions culturefeed_agenda/includes/helpers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ function _culturefeed_agenda_get_links_from_item(CultureFeed_Cdb_Item_Base $item
$detail = $item->getDetails()->getDetailByLanguage(culturefeed_search_get_preferred_language());

$links = array();
// General links.
if ($detail) {

foreach ($detail->getMedia() as $media) {
if ($media->getMediaType() == CultureFeed_Cdb_Data_File::MEDIA_TYPE_WEBRESOURCE || $media->getMediaType() == CultureFeed_Cdb_Data_File::MEDIA_TYPE_WEBSITE) {
$links[] = $media->getHLink();
}
}
}

// Contact info links.
if (method_exists($item, 'getContactInfo') && $item->getContactInfo()) {
Expand Down Expand Up @@ -100,6 +91,15 @@ function _culturefeed_agenda_get_links_from_item(CultureFeed_Cdb_Item_Base $item
}
}

// General links.
if ($detail && !(variable_get('culturefeed_agenda_hide_webresources', FALSE))) {
foreach ($detail->getMedia() as $media) {
if ($media->getMediaType() == CultureFeed_Cdb_Data_File::MEDIA_TYPE_WEBRESOURCE || $media->getMediaType() == CultureFeed_Cdb_Data_File::MEDIA_TYPE_WEBSITE) {
$links[] = $media->getHLink();
}
}
}

// Cleaning up links.
foreach ($links as $i => $link) {
$links[$i] = rtrim($link, '/');
Expand Down Expand Up @@ -547,7 +547,7 @@ function culturefeed_agenda_load_events_of_production($production, $future_only
$parameters[] = new \CultuurNet\Search\Parameter\FilterQuery('type:event');
$parameters[] = new \CultuurNet\Search\Parameter\Query(implode(' OR ', $cdb_ids));
$parameters[] = new \CultuurNet\Search\Parameter\Group();
$parameters[] = new \CultuurNet\Search\Parameter\Sort('startdate', 'asc');
$parameters[] = new \CultuurNet\Search\Parameter\Sort('availableto', 'asc');

if (!$future_only) {
$parameters[] = new \CultuurNet\Search\Parameter\Parameter('past', 'true');
Expand Down
Loading

0 comments on commit b54a42c

Please sign in to comment.