Skip to content

Commit

Permalink
Merge branch 'release/1.4.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
GregLeBarbar committed Jun 12, 2019
2 parents f4d01f4 + 2d1c31f commit be66545
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 81 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# CHANGELOG

*1.4.8* (2019-06-05)
- Add 'fr/' for French page, remove unused and confusing func (#214)
- Shortcode News: integration of vimeo short video (#215)

*1.4.7* (2019-06-05)
- Element new version (2.0.6)
- Memento listing update (#213)


*1.4.6* (2019-05-28)
- Update html for styleguide 2.0.5 (#212)
- Shortcode epfl_labs_search: Fix epfl_labs_search loading js an css globally (#211)
Expand Down
2 changes: 1 addition & 1 deletion wp-theme-2018/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.7
1.4.8
39 changes: 1 addition & 38 deletions wp-theme-2018/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,49 +352,12 @@ function get_epfl_home_url () {
$epfl_root = 'https://www.epfl.ch/';

if ($current_language === 'fr') {
return $epfl_root;
return $epfl_root . 'fr/';
} else {
return $epfl_root . 'en/';
}
}

/**
* get_nav_home_url
* returns to the home, with the good langage
* good langage = default value is english, or if possible, french
* @return string
*/
function get_nav_home_url() {
if (class_exists('EPFL\Pod\Site')) {
$site_root = \EPFL\Pod\Site::root()->get_url();
} else {
$site_root = 'https://www.epfl.ch/';
}

$site_root_fr = $site_root;
$site_root_en = $site_root . 'en/';

/* If Polylang installed */
if(function_exists('pll_current_language'))
{
$current_lang = pll_current_language('slug');
// Check if current lang is supported. If not, use default lang
if ($current_lang === 'fr')
{
return $site_root_fr;
} else {
return $site_root_en;
}
} else {
$lang = get_bloginfo("language");

if ($lang === 'fr-FR') {
return $site_root_fr;
} else {
return $site_root_en;
}
}
}

/**
* Remove <p></p> tags around <img src="" alt=""> inputed in the wysiwyg
Expand Down
18 changes: 0 additions & 18 deletions wp-theme-2018/shortcodes/epfl_news/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,4 @@ function epfl_news_get_visual_url($news) {
return $news->visual_url;
}

/**
* Get attachment url by slug
*/
function get_attachment_url_by_slug( $slug ) {

$args = array(
'post_type' => 'attachment',
'name' => sanitize_title($slug),
'posts_per_page' => 1,
'post_status' => 'inherit',
);

$_header = get_posts( $args );
$header = $_header ? array_pop($_header) : null;

return $header ? wp_get_attachment_url($header->ID) : '';
}

?>
39 changes: 17 additions & 22 deletions wp-theme-2018/shortcodes/epfl_news/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@
<?php
foreach($data as $news) {

$is_first_event = ($count==1);
$image_description = epfl_news_get_image_description($news);
$category = epfl_news_get_label_category($news);
$publish_date = epfl_news_get_publish_date($news);
$subtitle = epfl_news_get_subtitle($news);
$visual_url = epfl_news_get_visual_url($news);
$video_name = "teaser_" . str_replace("https://actu.epfl.ch/news/", "", $news->news_url);
$media_url = get_attachment_url_by_slug($video_name);
$is_first_event = ($count==1);
$image_description = epfl_news_get_image_description($news);
$category = epfl_news_get_label_category($news);
$publish_date = epfl_news_get_publish_date($news);
$subtitle = epfl_news_get_subtitle($news);
$visual_url = epfl_news_get_visual_url($news);
$short_vimeo_video_id = $news->short_vimeo_video_id;

if ( !empty($short_vimeo_video_id) ) {
$media_url = "https://player.vimeo.com/video/" . $short_vimeo_video_id . "?autoplay=1&loop=1&muted=1&background=1&quality=720";
}

if (2 == $template and 1 != $count and false == $header) {

$header = true;
echo '<div class="container pb-5 offset-xl-top pt-5 pt-xl-0">';
echo '<div class="row">';
Expand Down Expand Up @@ -96,15 +98,11 @@
<?php
elseif ("3" == $template): // TEMPLATE WWW WITH 1 NEWS
?>

<div class="fullwidth-teaser fullwidth-teaser-horizontal">
<?php if ($media_url): ?>
<div class="embed-responsive embed-responsive-16by9">
<video autoplay muted loop>
<source class="embed-responsive-item" src="<?php echo $media_url; ?>" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</div>
<?php if (!empty($media_url)): ?>
<div class="embed-responsive embed-responsive-16by9">
<iframe src="<?php echo $media_url; ?>" frameborder="1"></iframe>
</div>
<?php else: ?>
<picture>
<img src="<?php echo esc_url($visual_url) ?>" aria-labelledby="background-label" alt="<?php echo esc_attr($image_description) ?>"/>
Expand Down Expand Up @@ -139,12 +137,9 @@
<?php if ($is_first_event): ?>

<div class="fullwidth-teaser fullwidth-teaser-horizontal">
<?php if ($media_url): ?>
<?php if (!empty($media_url)): ?>
<div class="embed-responsive embed-responsive-16by9">
<video autoplay muted loop>
<source class="embed-responsive-item" src="<?php echo $media_url; ?>" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<iframe src="<?php echo $media_url; ?>" frameborder="1"></iframe>
</div>
<?php else: ?>
<picture>
Expand Down
2 changes: 1 addition & 1 deletion wp-theme-2018/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI:
Author: Antistatique.net
Author URI: http://antistatique.net/
Description: Description
Version: 1.4.7
Version: 1.4.8
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: epfl
Expand Down

0 comments on commit be66545

Please sign in to comment.