Skip to content

Commit c17bd21

Browse files
Add timestamp to JS/CSS file links to save up-to-date versions
1 parent a715ae9 commit c17bd21

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ https://help-ru.tilda.cc/wordpress
1414
* Зайдите в панель администрирования сайтом
1515
* Перейдите в раздел управления плагинами (Плагины/Установленные)
1616
* Найдите плагин Tilda Publishing API и нажмите «Активировать»
17-
* Получите публичный и секретный ключ. Для этого в вашем аккаунте откройте вкладку API в настройках проекта в разделе "Действия"
17+
* Получите публичный и секретный ключи. Для этого в вашем аккаунте откройте API Integration в настройках сайта в разделе "Экспорт"
1818
* Перейдите в раздел Настроек плагина (Настройки/Tilda Publishing)
1919
* Нажмите `Добавить API ключ`
2020
* Введите публичный и секретный ключи, сгенерированные на Тильде. Нажмите `Сохранить`.
@@ -39,7 +39,9 @@ https://help-ru.tilda.cc/wordpress
3939
## FAQ
4040

4141
В: Можно ли автоматически обновлять страницу на вордпрессе, после публикации страницы на Тильде?
42+
4243
О: Да, можно. Для этого нужно указать в настройках API Тильды, следующий урл для callback-вызова http://your-wordpress-site.ru/wp-admin/admin-ajax.php?action=tilda_sync_event
4344

4445
В: Можно ли скачать плагин из GIT-репозитория
46+
4547
О: Да, плагин доступен по адресу https://github.com/TildaPublishingOfficial/tilda-wordpress-plugin

class.tilda-admin.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ public static function export_tilda_page( $page_id, $project_id, $post_id ) {
11601160
foreach ( $asyncJsMatches[1] as $key => $match ) {
11611161
if ( substr( $match, - 3 ) === '.js' ) {
11621162
$oDownload = new stdClass();
1163-
$oDownload->from = 'https://static.tildacdn.com/js/' . $match;
1163+
$oDownload->from = 'https://static.tildacdn.com/js/' . $match . '?t=' . time();
11641164
$oDownload->to = $match;
11651165
$tildapage->js[] = $oDownload;
11661166
$tildapage->html = str_replace(
@@ -1229,8 +1229,9 @@ public static function export_tilda_page( $page_id, $project_id, $post_id ) {
12291229
$tildapage->css = [];
12301230
foreach ( $arCSS as $file ) {
12311231
$tildapage->css[] = $upload_path . 'css/' . $file->to;
1232+
$timestamp = substr( $file->from, - 4 ) === '.css' ? ( '?t=' . time() ) : '';
12321233
$arDownload[] = [
1233-
'from_url' => $file->from,
1234+
'from_url' => $file->from . $timestamp,
12341235
'to_dir' => $upload_dir . 'css/' . $file->to,
12351236
];
12361237
}
@@ -1243,9 +1244,9 @@ public static function export_tilda_page( $page_id, $project_id, $post_id ) {
12431244
$tildapage->js = [];
12441245
foreach ( $arJS as $file ) {
12451246
$tildapage->js[] = $upload_path . 'js/' . $file->to;
1246-
1247-
$arDownload[] = [
1248-
'from_url' => $file->from,
1247+
$timestamp = substr( $file->from, - 3 ) === '.js' ? ( '?t=' . time() ) : '';
1248+
$arDownload[] = [
1249+
'from_url' => $file->from . $timestamp,
12491250
'to_dir' => $upload_dir . 'js/' . $file->to,
12501251
];
12511252
}
@@ -1320,7 +1321,7 @@ public static function export_tilda_page( $page_id, $project_id, $post_id ) {
13201321
}
13211322
wp_update_post( $post );
13221323

1323-
$tildapage->html = str_replace('\\', '\\\\', $tildapage->html);
1324+
$tildapage->html = str_replace( '\\', '\\\\', $tildapage->html );
13241325

13251326
$tildapage->sync_time = current_time( 'mysql' );
13261327

readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: tildapublishing
33
Donate link: https://wordpress.org/plugins/tilda-publishing/
44
Tags: blog, post, publishing, tilda, export
55
Requires at least: 3.0.1
6-
Tested up to: 6.4.3
7-
Stable tag: 0.3.26
6+
Tested up to: 6.6.2
7+
Stable tag: 0.3.27
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -62,6 +62,9 @@ A: Please create an issue on the [GitHub page](https://github.com/TildaPublishin
6262

6363
== Changelog ==
6464

65+
= 0.3.27 =
66+
* Add timestamp to JS/CSS file links to save up-to-date versions
67+
6568
= 0.3.26 =
6669
* Fix nonces for new pages, dynamic JS & issue #33
6770

tilda-wordpress-plugin.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
/*
33
Plugin Name: Tilda Publishing
44
Description: Tilda позволяет делать яркую подачу материала, качественную верстку и эффектную типографику, близкую к журнальной. Каким бы ни был ваш контент — Tilda знает, как его показать. С чего начать: 1) Нажмите ссылку «Активировать» слева от этого описания; 2) <a href="http://www.tilda.cc/" target="_blank">Зарегистрируйтесь</a>, чтобы получить API-ключ; 3) Перейдите на страницу настройки Tilda Publishing и введите свой API-ключ. Читайте подробную инструкцию по подключению.
5-
Version: 0.3.26
5+
Version: 0.3.27
6+
Requires PHP: 5.6
7+
Requires at least: 3.0.1
68
Author: Tilda Publishing
79
License: GPLv2 or later
810
Text Domain: api tilda
911
12+
Update 0.3.27 - add timestamp to JS/CSS file links to save up-to-date versions
13+
1014
Update 0.3.26 - fix nonces for new pages, dynamic JS & issue #33
1115
1216
Update 0.3.25 - add some checks to suppress php warnings
@@ -134,8 +138,8 @@
134138
exit;
135139
}
136140

137-
define( 'TILDA_VERSION', '0.3.26' );
138-
define( 'TILDA_MINIMUM_WP_VERSION', '3.1' );
141+
define( 'TILDA_VERSION', '0.3.27' );
142+
define( 'TILDA_MINIMUM_WP_VERSION', '3.0.1' );
139143
define( 'TILDA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
140144
define( 'TILDA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
141145
define( 'TILDA_DELETE_LIMIT', 100000 );

0 commit comments

Comments
 (0)