e157d5f2 by Yokihito Oki

twittercards setImage修正

1 parent 409ad2ce
......@@ -45,7 +45,9 @@ class PlgContentTweetcards extends JPlugin
),
$this->setImage(
$row->images,
$row->text
$row->text,
$context,
$row->category_alias
),
$this->setMetadesc(
$row->metadesc,
......@@ -81,16 +83,16 @@ class PlgContentTweetcards extends JPlugin
*
* @since 0.0.1
*/
protected function setImage($images, $text) {
protected function setImage($images, $text, $context, $category_alias) {
$fullImage = json_decode($images);
preg_match_all('|<img.*?src=[\'"](.*?)[\'"].*?>|i', $text, $matches);
if ( !empty($fullImage->image_fulltext) ) {
$image = JURI::base() . $fullImage->image_fulltext;
// 本文中の画像の自動選択をOFF
// } elseif( !empty($matches[ 1 ][ 0 ]) ) {
// $image = $matches[ 1 ][ 0 ];
// $image = str_replace(JURI::base(), '', $image);
// $image = JURI::base() . $image;
// 本文中の画像の自動選択をカテゴリ:インフォメーションのみ有効化
} elseif( $category_alias == 'target-info' && $context == 'com_content.article' && !empty($matches[ 1 ][ 0 ]) ) {
$image = $matches[ 1 ][ 0 ];
$image = str_replace(JURI::base(), '', $image);
$image = JURI::base() . $image;
} else {
$image = '';
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!