Browse Source

Fix регулярного выражения для сохранения в файл (dataX.js) в кодировке UTF-8

master
root 7 years ago
parent
commit
40785d50e8
  1. 2
      README.md
  2. 8
      unicalendar/class.unicalendar.php
  3. 2
      unicalendar/module.php

2
README.md

@ -12,6 +12,8 @@
##### Changelog:
##### 08.09.2017 - обновление модуля - версия 1.2.8 - Fix регулярного выражения для сохранения в файл (dataX.js) в кодировке UTF-8
##### 04.09.2017 - обновление модуля - версия 1.2.7 - Добавлено создание тизера событий из существующих полей в документе (изображение, описание, место)
##### 01.07.2017 - обновление модуля - версия 1.2.6 - Добавлен лимит вывода событий при перелистывании месяцев в календаре (лимит не распространяется на клик по дате с событиями)

8
unicalendar/class.unicalendar.php

@ -186,7 +186,7 @@ class Unicalendar
//получаем данные всех документов из заданной рубрики циклом, формируем строку JSON
foreach ( $results as $k=>$v )
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id']." OR Id=";
}
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"".$uca_dfrm."\", showDescription: ".$uca_descript.", eventsLimit: ".$uca_events_limit.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
@ -230,7 +230,7 @@ class Unicalendar
//получаем данные выбранных документов из заданной рубрики циклом, формируем строку JSON
foreach ( $results as $k=>$v )
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"".$uca_dfrm."\", showDescription: ".$uca_descript.", eventsLimit: ".$uca_events_limit.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
@ -383,7 +383,7 @@ class Unicalendar
//получаем данные всех документов из заданной рубрики циклом, формируем строку JSON
foreach ( $results as $k=>$v )
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id']." OR Id=";
}
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"".$uca_dfrm."\", showDescription: ".$uca_descript.", eventsLimit: ".$uca_events_limit.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
@ -427,7 +427,7 @@ class Unicalendar
//получаем данные выбранных документов из заданной рубрики циклом, формируем строку JSON
foreach ( $results as $k=>$v )
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|s', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"expire_date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_expire']))."\", \"title\": \"".$v['document_title']."\", \"image\": \"".strstr(get_document_field($v['Id'], $uca_img_field), '|', true)."\", \"description\": \"".rtrim(mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_dsc_field))), 0, 255, 'UTF-8'), "!,.-").$ellipsis."\", \"location\": \"".mb_substr(preg_replace('|[\s]+|su', ' ', strip_tags(get_document_field($v['Id'], $uca_place_field))), 0, 300, 'UTF-8')."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"".$uca_dfrm."\", showDescription: ".$uca_descript.", eventsLimit: ".$uca_events_limit.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";

2
unicalendar/module.php

@ -14,7 +14,7 @@ if (defined('ACP'))
{
$modul['ModuleName'] = 'Универсальный календарь событий';
$modul['ModuleSysName'] = 'unicalendar';
$modul['ModuleVersion'] = '1.2.7';
$modul['ModuleVersion'] = '1.2.8';
$modul['ModuleDescription'] = '<br>Модуль позволяет создавать различные календари событий. <br> Для вывода календаря используйте системный тег <strong>[mod_unicalendar:XXX]</strong>';
$modul['ModuleAutor'] = 'Repellent';
$modul['ModuleCopyright'] = '&copy; AVE.cms Team 2017';

Loading…
Cancel
Save