Skip to content

Commit

Permalink
外部ブログカードの不具合修正
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Feb 2, 2019
1 parent 3fd9af0 commit 45cdc7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/blog-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ function url_shortcode_to_blog_card($the_content) {
if ( !function_exists( 'url_to_external_blog_card_tag' ) ):
function url_to_external_blog_card_tag($url){
$url = strip_tags($url);//URL
$url = ampersand_urldecode($url);

//サイトの内部リンクは処理しない場合
if ( strpos( $url, get_this_site_domain() ) ) {
Expand Down
10 changes: 10 additions & 0 deletions lib/utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,13 @@ function minusize_number_in_array($number_array){
}
return implode(',', $numbers);
}

//ブログカード用のURLデコード
if ( !function_exists( 'ampersand_urldecode' ) ):
function ampersand_urldecode($url){
//$url = urldecode($url);//urlエンコードされている場合に元に戻す(?が&になっている時など)
$url = str_replace('&', '&', $url);
$url = str_replace('#038;', '&', $url);
return $url;
}
endif;

0 comments on commit 45cdc7d

Please sign in to comment.