From 27fe6081cb0dd27be0f8032d53769baf950106e7 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 28 Nov 2018 22:10:41 +0100 Subject: [PATCH] Open graph with Facebook APP ID and bug fixes --- bl-plugins/opengraph/languages/bg_BG.json | 4 +++- bl-plugins/opengraph/languages/de_CH.json | 3 ++- bl-plugins/opengraph/languages/de_DE.json | 3 ++- bl-plugins/opengraph/languages/en.json | 3 ++- bl-plugins/opengraph/languages/es.json | 3 ++- bl-plugins/opengraph/languages/fr_FR.json | 4 +++- bl-plugins/opengraph/languages/it.json | 3 ++- bl-plugins/opengraph/languages/ja_JP.json | 4 +++- bl-plugins/opengraph/languages/nl_NL.json | 4 +++- bl-plugins/opengraph/languages/pl_PL.json | 4 +++- bl-plugins/opengraph/languages/ru_RU.json | 4 +++- bl-plugins/opengraph/languages/tr.json | 3 ++- bl-plugins/opengraph/languages/uk_UA.json | 4 +++- bl-plugins/opengraph/languages/zh_TW.json | 4 +++- bl-plugins/opengraph/plugin.php | 22 +++++++++++++++++----- 15 files changed, 53 insertions(+), 19 deletions(-) diff --git a/bl-plugins/opengraph/languages/bg_BG.json b/bl-plugins/opengraph/languages/bg_BG.json index b8f89d08..3de9b7a6 100644 --- a/bl-plugins/opengraph/languages/bg_BG.json +++ b/bl-plugins/opengraph/languages/bg_BG.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Open Graph ви позволява да свържете вашето съдържание със социални мрежи." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/de_CH.json b/bl-plugins/opengraph/languages/de_CH.json index d6366488..8c8f554e 100644 --- a/bl-plugins/opengraph/languages/de_CH.json +++ b/bl-plugins/opengraph/languages/de_CH.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "Plugin zur Verwendung des Open Graph Protocols (beispielsweise für Facebook)." }, - "default-image": "Standardbild" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/de_DE.json b/bl-plugins/opengraph/languages/de_DE.json index d6366488..8c8f554e 100644 --- a/bl-plugins/opengraph/languages/de_DE.json +++ b/bl-plugins/opengraph/languages/de_DE.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "Plugin zur Verwendung des Open Graph Protocols (beispielsweise für Facebook)." }, - "default-image": "Standardbild" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/en.json b/bl-plugins/opengraph/languages/en.json index d81d03e3..bb52a537 100644 --- a/bl-plugins/opengraph/languages/en.json +++ b/bl-plugins/opengraph/languages/en.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "The Open Graph protocol enables any web page to become a rich object in a social graph." }, - "default-image": "Default image" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/es.json b/bl-plugins/opengraph/languages/es.json index 79076f8f..ba687031 100644 --- a/bl-plugins/opengraph/languages/es.json +++ b/bl-plugins/opengraph/languages/es.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "Este complemento mejora las publicaciones en las redes sociales con este plugin." }, - "default-image": "Imagen predeterminada" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/fr_FR.json b/bl-plugins/opengraph/languages/fr_FR.json index adcade7d..12367051 100644 --- a/bl-plugins/opengraph/languages/fr_FR.json +++ b/bl-plugins/opengraph/languages/fr_FR.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Permets à n’importe quelle page web de devenir l’objet enrichi d’un graphe social. Par exemple, il est utilisé sur Facebook pour permettre à une page web de bénéficier des mêmes fonctionnalités que n’importe quel autre objet sur Facebook." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/it.json b/bl-plugins/opengraph/languages/it.json index 81d68ea2..042370c3 100644 --- a/bl-plugins/opengraph/languages/it.json +++ b/bl-plugins/opengraph/languages/it.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "Il protocollo Open Graph permette a qualsiasi pagina web di diventare un rich object in un social graph." }, - "default-image": "Immagine predefinita" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/ja_JP.json b/bl-plugins/opengraph/languages/ja_JP.json index bfa01ff9..817533e8 100644 --- a/bl-plugins/opengraph/languages/ja_JP.json +++ b/bl-plugins/opengraph/languages/ja_JP.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Open Graph protocol(OGP)を有効にすると、Webページがソーシャルグラフ上のリッチなオブジェクトになります。" - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/nl_NL.json b/bl-plugins/opengraph/languages/nl_NL.json index f490d38d..85c531c2 100644 --- a/bl-plugins/opengraph/languages/nl_NL.json +++ b/bl-plugins/opengraph/languages/nl_NL.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "De Open Graph protocol kan van elke webpagina een rich object in een sociale grafiek maken." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/pl_PL.json b/bl-plugins/opengraph/languages/pl_PL.json index 41b92e0a..310169fc 100644 --- a/bl-plugins/opengraph/languages/pl_PL.json +++ b/bl-plugins/opengraph/languages/pl_PL.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Protokół Open Graph zezwala stronie na stosowanie meta tagów używanych w serwisach społecznościowych." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/languages/ru_RU.json b/bl-plugins/opengraph/languages/ru_RU.json index f88f1371..832eccbb 100644 --- a/bl-plugins/opengraph/languages/ru_RU.json +++ b/bl-plugins/opengraph/languages/ru_RU.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Протокол Open Graph дает возможность связывать свой контент с социальными сетями." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/tr.json b/bl-plugins/opengraph/languages/tr.json index e9755235..86fa9791 100644 --- a/bl-plugins/opengraph/languages/tr.json +++ b/bl-plugins/opengraph/languages/tr.json @@ -4,5 +4,6 @@ "name": "Open Graph", "description": "Open Graph protokolü sosyal bir grafikte zengin bir nesne halinde herhangi bir web sayfasını sağlar." }, - "default-image": "Varsayılan resim" + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/uk_UA.json b/bl-plugins/opengraph/languages/uk_UA.json index 01fc7398..bd668a04 100644 --- a/bl-plugins/opengraph/languages/uk_UA.json +++ b/bl-plugins/opengraph/languages/uk_UA.json @@ -3,5 +3,7 @@ { "name": "Open Graph", "description": "Протокол Open Graph дозволяє ділитися будь-якою веб-сторінкою у соціальних мережах." - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } diff --git a/bl-plugins/opengraph/languages/zh_TW.json b/bl-plugins/opengraph/languages/zh_TW.json index 0a59b71d..014fb6ea 100644 --- a/bl-plugins/opengraph/languages/zh_TW.json +++ b/bl-plugins/opengraph/languages/zh_TW.json @@ -3,5 +3,7 @@ { "name": "開放社交關係圖", "description": "開放社交關係圖協定可以讓任何網頁變成豐富的物件" - } + }, + "set-a-default-image-for-content": "Set a default image for the content without pictures.", + "set-your-facebook-app-id": "Set your Facebook App ID." } \ No newline at end of file diff --git a/bl-plugins/opengraph/plugin.php b/bl-plugins/opengraph/plugin.php index 3d1132c3..3928dac3 100644 --- a/bl-plugins/opengraph/plugin.php +++ b/bl-plugins/opengraph/plugin.php @@ -6,7 +6,8 @@ class pluginOpenGraph extends Plugin { { // Fields and default values for the database of this plugin $this->dbFields = array( - 'defaultImage'=>'' + 'defaultImage'=>'', + 'fbAppId'=>'' ); } @@ -21,7 +22,13 @@ class pluginOpenGraph extends Plugin { $html .= '
'; $html .= ''; $html .= ''; - $html .= 'Set a default image for the content without pictures.'; + $html .= ''.$L->g('set-a-default-image-for-content').''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$L->g('set-your-facebook-app-id').''; $html .= '
'; return $html; @@ -60,8 +67,10 @@ class pluginOpenGraph extends Plugin { // The user is in the homepage default: $pageContent = ''; - // The image it's from the first page - if (isset($content[0]) ) { + if (Text::isNotEmpty($this->getValue('defaultImage'))) { + $og['image'] = $this->getValue('defaultImage'); + } + elseif (isset($content[0]) ) { $og['image'] = $content[0]->coverImage($absolute=true); $pageContent = $content[0]->content(); } @@ -74,7 +83,7 @@ class pluginOpenGraph extends Plugin { $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; - $html .= ''.PHP_EOL; + $html .= ''.PHP_EOL; // If the page doesn't have a coverImage try to get an image from the HTML content if (empty($og['image'])) { @@ -90,6 +99,9 @@ class pluginOpenGraph extends Plugin { } $html .= ''.PHP_EOL; + if (Text::isNotEmpty($this->getValue('fbAppId'))) { + $html .= ''.PHP_EOL; + } return $html; }