Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.23 KB | None | 0 0
  1. function get_comment_author_link( $comment_ID = 0 ) {
  2.     /** @todo Only call these functions when they are needed. Include in if... else blocks */
  3.     $url    = get_comment_author_url( $comment_ID );
  4.     $author = get_comment_author( $comment_ID );
  5.  
  6.     if ( empty( $url ) || 'http://' == $url )
  7.         $return = $author;
  8.     else
  9.         $return = "<a class="url" href="$url" rel="external nofollow" data-mce-href="$url">$author</a>";
  10.     return apply_filters('get_comment_author_link', $return);
  11. }
  12.  
  13. ================================================================================================================================
  14. /**
  15.  * Ссылка на сайт комментатора без тега a
  16.  * @param int $comment_ID
  17.  * @return string
  18.  */
  19. function get_my_comment_author_link( $comment_ID = 0 ) {
  20.     $url    = get_comment_author_url( $comment_ID );
  21.     $author = get_comment_author( $comment_ID );
  22.  
  23.     if ( empty( $url ) || 'http://' == $url )
  24.         $return = $author;
  25.     else
  26.         $return = "<span class=\"author-url\" data-url=\"$url\">$author</span>";
  27.     return $return;
  28. }
  29. ==========================================================================================
  30. printf( '<cite class="fn" itemprop="creator">%1$s</cite>',
  31.                         get_my7_comment_author_link(),
  32.                         // Adds Post Author to comments posted by the article writer
  33.                         ( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Post author', 'themonic' ) . '</span>' : ''
  34.                     );
  35.  
  36. ===================================================================
  37. При совпадении в последнем коде должна использоваться функция get_my7_comment_author_link(). Иначе get_comment_author_link().
  38. get_my7_comment_author_link() маскирует ссылки от поисковиков
  39. get_comment_author_link() выводит стандартную открытую ссылку
  40. Получается что то типа белого списка. Указанные адреса (их несколько будет скорее всего) не маскируются, все остальные с маскировкой через функцию get_my7_comment_author_link().
  41. Или я много хочу и так нельзя?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement