Skip to content

Commit

Permalink
Merge pull request #1053 from OpenDevelopmentMekong/impl-1052_2
Browse files Browse the repository at this point in the history
Fixes #1052
  • Loading branch information
Alex Corbi authored Jul 5, 2017
2 parents 62120e3 + 19ff546 commit 3ab7f14
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 37 deletions.
5 changes: 2 additions & 3 deletions inc/templates/post-highlighted-single-1-cols.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@
odm_echo_extras();
endif;

if(echo_downloaded_documents()):
echo_downloaded_documents();
endif;
echo_downloaded_documents();

endif;
?>
</section>
Expand Down
5 changes: 2 additions & 3 deletions inc/templates/post-list-single-1-cols.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@
odm_echo_extras();
endif;

if(echo_downloaded_documents()):
echo_downloaded_documents();
endif;
echo_downloaded_documents();

endif;
?>
</section>
Expand Down
5 changes: 2 additions & 3 deletions inc/templates/post-list-single-2-cols.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@
odm_echo_extras();
endif;

if(echo_downloaded_documents()):
echo_downloaded_documents();
endif;
echo_downloaded_documents();

endif;
?>
</section>
Expand Down
7 changes: 3 additions & 4 deletions inc/templates/post-list-single-4-cols.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@

if ($show_source_meta):
odm_echo_extras();
endif;

if(echo_downloaded_documents()):
echo_downloaded_documents();
endif;

echo_downloaded_documents();

endif;
?>
</section>
Expand Down
41 changes: 23 additions & 18 deletions inc/utils/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,22 +538,27 @@ function echo_downloaded_documents ($postID = "") {
$postID = $postID ? $postID : get_the_ID();
$local_lang = odm_language_manager()->get_the_language_code_by_site();
$current_lang = odm_language_manager()->get_current_language();

//Get Download files
$get_document = get_post_meta($postID, 'upload_document', true);
$get_localized_document = get_post_meta($postID, 'upload_document_'.$local_lang, true);
$document_curent_lang = null;

if (!empty($get_document) || !empty($get_localized_document)):
if (!empty($get_document) && !empty($get_localized_document)):
$document_curent_lang = $current_lang == "en" ? $get_document : $get_localized_document;
if (!empty($get_document) || !empty($get_localized_document)):
if (!empty($get_document) && !empty($get_localized_document)):
$document_curent_lang = $current_lang == "en" ? $get_document : $get_localized_document;
else:
$document_curent_lang = !empty($get_document) ? $get_document : $get_localized_document;
endif;?>
<p class="download_data_buttons"><?php _e('Download:','wp-odm_solr'); ?>
<span class="meta-label pdf"><a target="_blank" href="<?php echo get_bloginfo("url") . '/pdf-viewer/?pdf=files_mf/' . $document_curent_lang ?>">pdf</a></span>
</p>
<?php
endif;
endif;
endif;?>

<?php
if (isset($document_curent_lang)): ?>
<p class="download_data_buttons"><?php _e('Download:','wp-odm_solr'); ?>
<span class="meta-label pdf"><a target="_blank" href="<?php echo get_bloginfo("url") . '/pdf-viewer/?pdf=files_mf/' . $document_curent_lang ?>">pdf</a></span>
</p>
<?php
endif;
}

function available_post_types(){
Expand Down Expand Up @@ -666,7 +671,7 @@ function get_top_level_category_english_name($cat_id) {
function odm_echo_extras($postID = "") {
$postID = $postID ? $postID : get_the_ID();
$news_source_info = null;
if (function_exists('get_post_meta')) :
if (function_exists('get_post_meta')):
$get_author = get_post_meta($postID, 'author', true);
$get_localized_author = get_post_meta($postID, 'author_'.odm_language_manager()->get_current_language(), true);
if ($get_author != '' || $get_localized_author != ''):
Expand All @@ -689,13 +694,13 @@ function odm_echo_extras($postID = "") {
endif;
endif;

if (isset($source) && $source != '') {
if (false === strpos($source, '://')) {
$news_source_info .= '<a href="http://'.$source.'" target="_blank">http://'.$source.'</a>';
} else {
$news_source_info .= '<a href="'.$source.'" target="_blank">'.$source.'</a>';
}
}
if (isset($source) && $source != ''):
if (false === strpos($source, '://')):
$news_source_info .= '<a href="http://'.$source.'" target="_blank">http://'.$source.'</a>';
else:
$news_source_info .= '<a href="'.$source.'" target="_blank">'.$source.'</a>';
endif;
endif;

endif;

Expand Down
9 changes: 3 additions & 6 deletions single.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@
echo "<p>".get_the_content()."</p>";
endif;

if(odm_echo_extras()):
odm_echo_extras();
endif;
odm_echo_extras();

if(echo_downloaded_documents()):
echo_downloaded_documents();
endif;
echo_downloaded_documents();

?>
</div>
</section>
Expand Down

0 comments on commit 3ab7f14

Please sign in to comment.