Skip to content

Commit

Permalink
fix bugs in SEO-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfriend committed Mar 3, 2019
1 parent 459909c commit 7b64797
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 40 deletions.
17 changes: 12 additions & 5 deletions utf8/dev2fun.multidomain/classes/general/Seo.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php
/**
* Created by PhpStorm.
* User: darkfriend <[email protected]>
* Date: 09.01.2018
* Time: 23:46
* Class for SEO
* @author darkfriend <[email protected]>
* @version 0.1.31
*/

namespace Dev2fun\MultiDomain;
Expand All @@ -30,9 +29,15 @@ public static function getInstance() {
public function show($hlId) {
global $APPLICATION;
if(!$hlId) return false;

$seoData = $this->getDomain($hlId);
if(!$seoData) return false;
$APPLICATION->SetTitle($seoData['UF_TITLE']);

$APPLICATION->SetPageProperty('title',$seoData['UF_TITLE']);

// if(!empty($seoData['UF_H1'])) {
// $APPLICATION->SetTitle($seoData['UF_H1']);
// }
if(!empty($seoData['UF_DESCRIPTION'])) {
$APPLICATION->SetPageProperty('description',$seoData['UF_DESCRIPTION']);
}
Expand All @@ -46,6 +51,7 @@ public function getDomain($hlId,$host=false,$path=false) {
$curUrl = $this->getUrl();
if(!$host) $host = $curUrl['host'];
if(!$path) $path = $curUrl['path'];

$domain = $this->getQuery($hlId,$host,$path);
return $domain;
}
Expand All @@ -65,6 +71,7 @@ private function getQuery($hlId,$host,$path) {
'UF_DOMAIN' => $host,
'UF_PATH' => $path,
]);

return (empty($el[0])?false:$el[0]);
}

Expand Down
26 changes: 13 additions & 13 deletions utf8/dev2fun.multidomain/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author dev2fun (darkfriend)
* @copyright darkfriend
* @version 0.1.30
* @version 0.1.31
*/
namespace Dev2fun\MultiDomain;

Expand Down Expand Up @@ -124,20 +124,20 @@ public static function InitSeoDomains() {
}
}

if(!$USER->IsAdmin()) return true;

\CJSCore::Init(['ajax','window','jquery']);
$asset = Asset::getInstance();
$asset->addString('<meta name="dev2fun" content="module:dev2fun.multidomain:SEO">');
// $asset->addString('<script src="http://www.sphereshot.co/wp-content/themes/sphereshot/js/vendor/modernizr-2.8.3.min.js"></script>');
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js" defer></script>', false, AssetLocation::AFTER_JS_KERNEL);
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/seo.js" defer></script>', true, AssetLocation::AFTER_JS_KERNEL);
if(!$USER->IsAdmin()) {
\CJSCore::Init(['ajax','window','jquery']);
$asset = Asset::getInstance();
$asset->addString('<meta name="dev2fun" content="module:dev2fun.multidomain:SEO">');
// $asset->addString('<script src="http://www.sphereshot.co/wp-content/themes/sphereshot/js/vendor/modernizr-2.8.3.min.js"></script>');
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js" defer></script>', false, AssetLocation::AFTER_JS_KERNEL);
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/seo.js" defer></script>', true, AssetLocation::AFTER_JS_KERNEL);

// $asset->addCss('/bitrix/css/'.$moduleId.'/magnific-popup.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js');
// $asset->addCss('/bitrix/css/'.$moduleId.'/magnific-popup.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js');

$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/seo.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/magnific-popup.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/seo.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/magnific-popup.css">');
}

// $asset->addCss('/bitrix/css/'.$moduleId.'/seo.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/seo.js');
Expand Down
4 changes: 2 additions & 2 deletions utf8/dev2fun.multidomain/install/version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$arModuleVersion = array(
"VERSION" => "0.1.30",
"VERSION_DATE" => "2019-02-28 10:00:00",
"VERSION" => "0.1.31",
"VERSION_DATE" => "2019-03-04 10:00:00",
);
?>
17 changes: 12 additions & 5 deletions win1251/dev2fun.multidomain/classes/general/Seo.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php
/**
* Created by PhpStorm.
* User: darkfriend <[email protected]>
* Date: 09.01.2018
* Time: 23:46
* Class for SEO
* @author darkfriend <[email protected]>
* @version 0.1.31
*/

namespace Dev2fun\MultiDomain;
Expand All @@ -30,9 +29,15 @@ public static function getInstance() {
public function show($hlId) {
global $APPLICATION;
if(!$hlId) return false;

$seoData = $this->getDomain($hlId);
if(!$seoData) return false;
$APPLICATION->SetTitle($seoData['UF_TITLE']);

$APPLICATION->SetPageProperty('title',$seoData['UF_TITLE']);

// if(!empty($seoData['UF_H1'])) {
// $APPLICATION->SetTitle($seoData['UF_H1']);
// }
if(!empty($seoData['UF_DESCRIPTION'])) {
$APPLICATION->SetPageProperty('description',$seoData['UF_DESCRIPTION']);
}
Expand All @@ -46,6 +51,7 @@ public function getDomain($hlId,$host=false,$path=false) {
$curUrl = $this->getUrl();
if(!$host) $host = $curUrl['host'];
if(!$path) $path = $curUrl['path'];

$domain = $this->getQuery($hlId,$host,$path);
return $domain;
}
Expand All @@ -65,6 +71,7 @@ private function getQuery($hlId,$host,$path) {
'UF_DOMAIN' => $host,
'UF_PATH' => $path,
]);

return (empty($el[0])?false:$el[0]);
}

Expand Down
26 changes: 13 additions & 13 deletions win1251/dev2fun.multidomain/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @author dev2fun (darkfriend)
* @copyright darkfriend
* @version 0.1.30
* @version 0.1.31
*/
namespace Dev2fun\MultiDomain;

Expand Down Expand Up @@ -124,20 +124,20 @@ public static function InitSeoDomains() {
}
}

if(!$USER->IsAdmin()) return true;

\CJSCore::Init(['ajax','window','jquery']);
$asset = Asset::getInstance();
$asset->addString('<meta name="dev2fun" content="module:dev2fun.multidomain:SEO">');
// $asset->addString('<script src="http://www.sphereshot.co/wp-content/themes/sphereshot/js/vendor/modernizr-2.8.3.min.js"></script>');
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js" defer></script>', false, AssetLocation::AFTER_JS_KERNEL);
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/seo.js" defer></script>', true, AssetLocation::AFTER_JS_KERNEL);
if(!$USER->IsAdmin()) {
\CJSCore::Init(['ajax','window','jquery']);
$asset = Asset::getInstance();
$asset->addString('<meta name="dev2fun" content="module:dev2fun.multidomain:SEO">');
// $asset->addString('<script src="http://www.sphereshot.co/wp-content/themes/sphereshot/js/vendor/modernizr-2.8.3.min.js"></script>');
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js" defer></script>', false, AssetLocation::AFTER_JS_KERNEL);
$asset->addString('<script type="text/javascript" src="/bitrix/js/'.$moduleId.'/seo.js" defer></script>', true, AssetLocation::AFTER_JS_KERNEL);

// $asset->addCss('/bitrix/css/'.$moduleId.'/magnific-popup.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js');
// $asset->addCss('/bitrix/css/'.$moduleId.'/magnific-popup.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/jquery.magnific-popup.min.js');

$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/seo.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/magnific-popup.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/seo.css">');
$asset->addString('<link rel="stylesheet" type="text/css" href="/bitrix/css/'.$moduleId.'/magnific-popup.css">');
}

// $asset->addCss('/bitrix/css/'.$moduleId.'/seo.css');
// $asset->addJs('/bitrix/js/'.$moduleId.'/seo.js');
Expand Down
4 changes: 2 additions & 2 deletions win1251/dev2fun.multidomain/install/version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$arModuleVersion = array(
"VERSION" => "0.1.30",
"VERSION_DATE" => "2019-02-28 10:00:00",
"VERSION" => "0.1.31",
"VERSION_DATE" => "2019-03-04 10:00:00",
);
?>

0 comments on commit 7b64797

Please sign in to comment.