Skip to content

Commit ef9f065

Browse files
author
TCSE
committed
Бандл для Dle 15.1
В одном файле правки для DLE 15.1 и для версий DLE 15.0 и ниже. Работает на php 7.3 (вероятно и выше)
1 parent 7c5dd60 commit ef9f065

File tree

2 files changed

+47
-22
lines changed

2 files changed

+47
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ DLE-print-page4amp_v1.0.0.xml
55
DLE-print-page4amp_v1.0.1.xml
66
DLE-print-page4amp_v1.0.0.zip
77
DLE-print-page4amp_v1.0.1.zip
8+
DLE-print-page4amp_v1.0.2.zip
9+
DLE-print-page4amp_v1.0.3.xml

DLE-print-page4amp.xml

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<dleplugin>
33
<name>DLE-print-page4amp</name>
4-
<description>плагин генерации AMP страниц для DLE на основе версии для печати by TCSE.</description>
4+
<description>плагин генерации AMP страниц для DLE на основе версии для печати by TCSE.
5+
Для DLE 15.1</description>
56
<icon>engine/skins/images/amp4dle.png</icon>
6-
<version>1.0.2</version>
7-
<dleversion>13.0</dleversion>
7+
<version>1.0.3</version>
8+
<dleversion>14.0</dleversion>
89
<versioncompare>greater</versioncompare>
910
<upgradeurl>https://online.tcse-cms.com/plugins/DLE-print-page4amp/check-DLE-print-page4amp.php</upgradeurl>
1011
<filedelete>1</filedelete>
@@ -35,23 +36,28 @@
3536
3637
И далее в новостях указывайте Youtube ID ролика.
3738
38-
Страница поддержки [url=https://tcse-cms.com/printpage4amp]tcse-cms.com/printpage4amp[/url]]]></notice>
39-
<file name="engine/engine.php">
40-
<operation action="before">
41-
<searchcode><![CDATA[if ($canonical) {]]></searchcode>
42-
<replacecode><![CDATA[if ($subaction == "showfull") {
43-
$metatags .= <<<HTML
44-
45-
HTML;
39+
Страница поддержки [url=https://tcse-cms.com/printpage4amp]tcse-cms.com/printpage4amp[/url]]]></notice>
40+
<file name="engine/modules/main.php">
41+
<operation action="after">
42+
<searchcode><![CDATA[if ( $dle_module == "showfull" AND $news_found ) {]]></searchcode>
43+
<replacecode><![CDATA[//====== print-page4amp =======
44+
if ($subaction == "showfull") {
4645
$metatags .= <<<HTML
47-
<link rel="amphtml" href="{$print_link}">
48-
HTML;
49-
};]]></replacecode>
50-
</operation>
51-
</file>
52-
<file name="engine/modules/show.full.php">
53-
<operation action="after">
54-
<searchcode><![CDATA[$tpl->set( '{full-story}', $row['full_story'] );]]></searchcode>
46+
47+
HTML;
48+
$metatags .= <<<HTML
49+
<link rel="amphtml" href="{$print_link}">
50+
HTML;
51+
};
52+
//====== .print-page4amp =======]]></replacecode>
53+
<enabled>1</enabled>
54+
<dleversion>15.1</dleversion>
55+
<versioncompare>greater</versioncompare>
56+
</operation>
57+
</file>
58+
<file name="engine/modules/show.full.php">
59+
<operation action="after">
60+
<searchcode><![CDATA[$tpl->set( '{full-story}', $row['full_story'] );]]></searchcode>
5561
<replacecode><![CDATA[//====== print-page4amp =======
5662
if (stripos($tpl->copy_template, "{amp-full-story}") !== false) {
5763
function ampify($html = '')
@@ -61,7 +67,7 @@ if (stripos($tpl->copy_template, "{amp-full-story}") !== false) {
6167
['<amp-img', '<amp-video', '/amp-video>', '<amp-audio', '/amp-audio>'],
6268
$html
6369
);
64-
$html = preg_replace('/<amp-img(.*?)\/?>/', '<amp-img width="320" height="240" $1></amp-img>', $html);
70+
$html = preg_replace('/<amp-img(.*?)\/?>/', '<amp-img width="320" height="240" layout="responsive" $1></amp-img>', $html);
6571
$html = strip_tags($html, '<h1><h2><h3><h4><h5><h6><a><p><ul><ol><li><blockquote><q><cite><ins><del><strong><em><code><pre><svg><table><thead><tbody><tfoot><th><tr><td><dl><dt><dd><article><section><header><footer><aside><figure><time><abbr><div><span><hr><small><br><amp-img><amp-audio><amp-video><amp-ad><amp-anim><amp-carousel><amp-fit-rext><amp-image-lightbox><amp-instagram><amp-lightbox><amp-twitter><amp-youtube>');
6672
6773
return $html;
@@ -71,7 +77,24 @@ if (stripos($tpl->copy_template, "{amp-full-story}") !== false) {
7177
$tpl->set('{amp-full-story}', ampify($row['full_story']));
7278
}
7379
//====== print-page4amp =======
74-
]]></replacecode>
75-
</operation>
80+
]]></replacecode>
81+
<enabled>1</enabled>
82+
</operation>
83+
</file>
84+
<file name="engine/engine.php">
85+
<operation action="before">
86+
<searchcode><![CDATA[if ($canonical) {]]></searchcode>
87+
<replacecode><![CDATA[if ($subaction == "showfull") {
88+
$metatags .= <<<HTML
89+
90+
HTML;
91+
$metatags .= <<<HTML
92+
<link rel="amphtml" href="{$print_link}">
93+
HTML;
94+
};]]></replacecode>
95+
<enabled>1</enabled>
96+
<dleversion>15.0</dleversion>
97+
<versioncompare>less</versioncompare>
98+
</operation>
7699
</file>
77100
</dleplugin>

0 commit comments

Comments
 (0)