1. <?php
  2. $the_query->the_post();
  3. $title = get_the_title();
  4. $postID = get_the_ID();
  5. $icon = function_exists( 'get_field' ) ? get_field( 'site_icon', $postID ) : null ;
  6. $icon = apply_filters( 'maddos_get_icon', $icon );
  7. // in case site switched to ssl but still using http links:
  8. if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ||
  9. $_SERVER['SERVER_PORT'] == 443) {
  10. $icon = str_replace( 'http:', 'https:', $icon );
  11. }
  12. $site_icon = $icon && filter_var( $icon, FILTER_VALIDATE_URL ) ? "<span class='maddos-icon site-icon'><img width='16' height='16' alt='{$title}' title='{$title}' src='{$icon}' /></span>" : "<span class='maddos-icon site-icon'>{$icon}</span>";
  13. $site_url = function_exists( 'get_field' ) ? get_field( 'site_url', $postID ) : null;
  14. $site_url = apply_filters( 'maddos_get_site_url', $site_url );
  15. $href = $site_url && $flow === 'default' ? $site_url : get_permalink();
  16. $href = apply_filters( 'maddos_directory_post_href', $href, $site_url, $post->ID );
  17. $hover = $show_hover === 'on' && has_post_thumbnail( $postID ) ? get_the_post_thumbnail( $postID, 'hover-thumb', array('class'=>'img-responsive maddos-image-hover') ) : '';
  18. $target = $site_url === $href ? 'target="_blank"' : '';
  19. $target = apply_filters( 'maddos_directory_post_target', $target, $href, $postID );
  20. $rel = ( $site_url === $href ) ? $nofollow === 'on' ? 'rel="nofollow noopener"' : 'rel="noopener"' : '';
  21. $rel = apply_filters( 'maddos_directory_post_rel', $rel, $href, $postID );
  22. $mobile = function_exists( 'get_field' ) && get_field( 'mobile_friendly', $postID ) ? ' <span class="maddos-mobile-friendly-icon"></span>' : '';
  23. $age = ( time() - strtotime( $post->post_date ) ) / 86400;
  24. $new_icon = $age <= $postlink_new ? ' <span class="maddos-new-icon"></span>' : '';
  25. $sticky_icon = is_sticky( $postID ) ? ' <span class="maddos-sticky-icon"></span>' : '';
  26. $add_icon = function_exists( 'get_field' ) ? get_field( 'additional_icon', $postID ) : null;
  27. $add_icon = apply_filters( 'maddos_get_additional_icon', $add_icon );
  28. $additional_icon = $add_icon ? filter_var( $add_icon, FILTER_VALIDATE_URL ) ? " <span class='maddos-icon additional-icon'><img width='16' height='16' alt='{$title}' title='{$title}' src='{$add_icon}' /></span>" : " <span class='maddos-icon additional-icon'>{$add_icon}</span>" : '';
  29. $review_link = apply_filters( 'maddos_get_review_link', get_permalink() );
  30. $review = ( isset( $pdo[0] ) && $pdo[0] === "yes" ) || apply_filters( 'the_content', get_the_content() ) ? "<div class='maddos-review'><a href='" . $review_link . "'><span class='maddos-site-review-icon'></span></a></div>" : '';
  31. $extra = apply_filters( 'maddos_category_post_extra', '' );
  32. printf( '%s <a class="maddos-link" title="%s" %s %s href="%s">%s %s %s %s %s %s %s</a> %s', $site_icon, $title, $target, $rel, $href, $title, $sticky_icon, $additional_icon, $mobile, $new_icon, $extra, $hover, $review );
  33. ?>