' . $fallback_text . ''; } } else { // oEmbed APIからJSON取得 $oembed_url = 'https://publish.twitter.com/oembed?maxwidth=550&dnt=true&url=' . urlencode($tweeturl); $json = @file_get_contents($oembed_url); if ($json !== false) { $data = json_decode($json, true); if ($data && isset($data['html'])) { $html = html_entity_decode($data['html']); // キャッシュに保存 @file_put_contents($cachefile, $json); } else { // JSON取得失敗時はフォールバック $fallback_text = isset($tw[1]) ? htmlspecialchars($tw[1], ENT_QUOTES, 'UTF-8') : ''; $html = '
' . $fallback_text . '
'; } } else { // 通信エラー時はフォールバック $fallback_text = isset($tw[1]) ? htmlspecialchars($tw[1], ENT_QUOTES, 'UTF-8') : ''; $html = '
' . $fallback_text . '
'; } } // widgets.jsの読み込み処理 if (PLUGIN_TWEET_LAZYLOAD) { $script = ''; } else { $script = ''; } if (!in_array($script, $head_tags, true)) { $head_tags[] = $script; } if( in_array('noimg', $tw)){ $twjs4 = 'class="twitter-tweet"'; $twjs5 = 'class="twitter-tweet" data-cards="hidden"'; //画像非表示 $html = str_replace($twjs4, $twjs5, $html); } if( in_array('noconv', $tw)){ $twjs6 = 'class="twitter-tweet"'; $twjs7 = 'class="twitter-tweet" data-conversation="none"'; //リプライを非表示 $html = str_replace($twjs6, $twjs7, $html); } return <<