From 4568d5b01c5cc5e6d16881dbdfae5a50552431cc Mon Sep 17 00:00:00 2001 From: darkfriend Date: Thu, 30 May 2019 00:13:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D0=B2=20=D0=B0=D0=BB=D0=B3?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=82=D0=BC=D0=B5=20"SetPageProperty/SetDirP?= =?UTF-8?q?roperty"=20=D1=81=20og:description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/general/OpenGraph.php | 17 +++++++++++------ utf8/dev2fun.opengraph/install/version.php | 4 ++-- .../classes/general/OpenGraph.php | 17 +++++++++++------ win1251/dev2fun.opengraph/install/version.php | 4 ++-- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/utf8/dev2fun.opengraph/classes/general/OpenGraph.php b/utf8/dev2fun.opengraph/classes/general/OpenGraph.php index 786b538..f064f9f 100644 --- a/utf8/dev2fun.opengraph/classes/general/OpenGraph.php +++ b/utf8/dev2fun.opengraph/classes/general/OpenGraph.php @@ -2,7 +2,7 @@ /** * @author dev2fun * @copyright (c) 2019, darkfriend - * @version 1.3.0 + * @version 1.3.4 */ namespace Dev2fun\Module; @@ -191,10 +191,12 @@ public function saveElement(&$arFields) { if (is_numeric($file)) { $reqFields['image'] = $file; } else { - if (!file_exists($file['tmp_name'])) { + if(empty($file['tmp_name'])) { + $file = \CFile::MakeFileArray($file); + } elseif (!file_exists($file['tmp_name'])) { $upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); $absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; - if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { + if (!empty($file['tmp_name']) && !strpos($file['tmp_name'], $absPath)) { $file['tmp_name'] = $absPath . $file['tmp_name']; } } @@ -263,7 +265,9 @@ public function saveSection(&$arFields) { if (is_numeric($file)) { $reqFields['image'] = $file; } else { - if (!file_exists($file['tmp_name'])) { + if(empty($file['tmp_name'])) { + $file = \CFile::MakeFileArray($file); + } elseif (!file_exists($file['tmp_name'])) { $upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); $absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { @@ -630,7 +634,8 @@ public function setPropertyPropFields($ogData) { // print_pre('PropFields'); // break; case 'og:description' : - $ogValue = $APPLICATION->GetProperty('description'); + $ogValue = $APPLICATION->GetProperty('og:description'); + if(!$ogValue) $ogValue = $APPLICATION->GetProperty('description'); break; case 'og:image' : if (!preg_match('#^(http|https)\:\\\\#', $ogValue)) { @@ -677,7 +682,7 @@ public function setPropertyDefault($ogData) { $url = $oModule->getUrl($APPLICATION->GetCurPage()); $ogValue = $this->getPrepareUrl($url); break; - case 'site_name' : + case 'og:site_name' : $obSite = \CSite::GetByID(SITE_ID); if ($arSite = $obSite->Fetch()) { $ogValue = htmlentities($arSite['SITE_NAME']); diff --git a/utf8/dev2fun.opengraph/install/version.php b/utf8/dev2fun.opengraph/install/version.php index 9dec756..befde8d 100644 --- a/utf8/dev2fun.opengraph/install/version.php +++ b/utf8/dev2fun.opengraph/install/version.php @@ -1,6 +1,6 @@ "1.3.3", - "VERSION_DATE" => "2019-03-04 11:00:00", + "VERSION" => "1.3.4", + "VERSION_DATE" => "2019-05-30 10:00:00", ); ?> \ No newline at end of file diff --git a/win1251/dev2fun.opengraph/classes/general/OpenGraph.php b/win1251/dev2fun.opengraph/classes/general/OpenGraph.php index 786b538..f064f9f 100644 --- a/win1251/dev2fun.opengraph/classes/general/OpenGraph.php +++ b/win1251/dev2fun.opengraph/classes/general/OpenGraph.php @@ -2,7 +2,7 @@ /** * @author dev2fun * @copyright (c) 2019, darkfriend - * @version 1.3.0 + * @version 1.3.4 */ namespace Dev2fun\Module; @@ -191,10 +191,12 @@ public function saveElement(&$arFields) { if (is_numeric($file)) { $reqFields['image'] = $file; } else { - if (!file_exists($file['tmp_name'])) { + if(empty($file['tmp_name'])) { + $file = \CFile::MakeFileArray($file); + } elseif (!file_exists($file['tmp_name'])) { $upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); $absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; - if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { + if (!empty($file['tmp_name']) && !strpos($file['tmp_name'], $absPath)) { $file['tmp_name'] = $absPath . $file['tmp_name']; } } @@ -263,7 +265,9 @@ public function saveSection(&$arFields) { if (is_numeric($file)) { $reqFields['image'] = $file; } else { - if (!file_exists($file['tmp_name'])) { + if(empty($file['tmp_name'])) { + $file = \CFile::MakeFileArray($file); + } elseif (!file_exists($file['tmp_name'])) { $upload_dir = \COption::GetOptionString("main", "upload_dir", "upload"); $absPath = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/tmp"; if (!empty($file['tmp_name']) && !strpos($file['tmp_name'],$absPath)) { @@ -630,7 +634,8 @@ public function setPropertyPropFields($ogData) { // print_pre('PropFields'); // break; case 'og:description' : - $ogValue = $APPLICATION->GetProperty('description'); + $ogValue = $APPLICATION->GetProperty('og:description'); + if(!$ogValue) $ogValue = $APPLICATION->GetProperty('description'); break; case 'og:image' : if (!preg_match('#^(http|https)\:\\\\#', $ogValue)) { @@ -677,7 +682,7 @@ public function setPropertyDefault($ogData) { $url = $oModule->getUrl($APPLICATION->GetCurPage()); $ogValue = $this->getPrepareUrl($url); break; - case 'site_name' : + case 'og:site_name' : $obSite = \CSite::GetByID(SITE_ID); if ($arSite = $obSite->Fetch()) { $ogValue = htmlentities($arSite['SITE_NAME']); diff --git a/win1251/dev2fun.opengraph/install/version.php b/win1251/dev2fun.opengraph/install/version.php index 9dec756..befde8d 100644 --- a/win1251/dev2fun.opengraph/install/version.php +++ b/win1251/dev2fun.opengraph/install/version.php @@ -1,6 +1,6 @@ "1.3.3", - "VERSION_DATE" => "2019-03-04 11:00:00", + "VERSION" => "1.3.4", + "VERSION_DATE" => "2019-05-30 10:00:00", ); ?> \ No newline at end of file