fix(rss): do not escape podcast and episode titles in the xml

- add parameter to prevent escaping value in SimpleRSSElement's addChild method
- clean prosemirror residue (typedef + DEPENDENCIES.md)
- remove type definition generation in tsconfig

fixes #138, #71
This commit is contained in:
Yassine Doghri 2021-07-29 10:46:51 +00:00
parent 9ec1cb93da
commit 0dd3b7e0bf
31 changed files with 28 additions and 95 deletions

View File

@ -39,8 +39,6 @@ Javascript dependencies:
([MIT License](https://github.com/rollup/rollup/blob/master/LICENSE.md))
- [tailwindcss](https://tailwindcss.com/)
([MIT License](https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE))
- [ProseMirror](https://prosemirror.net/)
([MIT License](https://github.com/ProseMirror/prosemirror/blob/master/LICENSE))
- [amCharts 4](https://github.com/amcharts/amcharts4)
([Free amCharts license](https://github.com/amcharts/amcharts4/blob/master/dist/script/LICENSE))
- [Choices.js](https://joshuajohnson.co.uk/Choices/)

View File

@ -226,7 +226,8 @@ if (! function_exists('form_dropdown')) {
}
$form .= "</optgroup>\n";
} else {
$form .= '<option value="' . htmlspecialchars($key) . '"'
/** @noRector RecastingRemovalRector */
$form .= '<option value="' . htmlspecialchars((string) $key) . '"'
. (in_array($key, $selected, true) ? ' selected="selected"' : '') . '>'
. $val . "</option>\n";
}

View File

@ -51,7 +51,7 @@ if (! function_exists('get_rss_feed')) {
$channel->addChild('docs', 'https://cyber.harvard.edu/rss/rss.html');
$channel->addChild('guid', $podcast->guid, $podcastNamespace);
$channel->addChild('title', $podcast->title);
$channel->addChild('title', $podcast->title, null, false);
$channel->addChildWithCDATA('description', $podcast->description_html);
$itunesImage = $channel->addChild('image', null, $itunesNamespace);
@ -189,7 +189,7 @@ if (! function_exists('get_rss_feed')) {
$image = $channel->addChild('image');
$image->addChild('url', $podcast->image->feed_url);
$image->addChild('title', $podcast->title);
$image->addChild('title', $podcast->title, null, false);
$image->addChild('link', $podcast->link);
if ($podcast->custom_rss !== null) {
@ -200,7 +200,7 @@ if (! function_exists('get_rss_feed')) {
foreach ($episodes as $episode) {
$item = $channel->addChild('item');
$item->addChild('title', $episode->title);
$item->addChild('title', $episode->title, null, false);
$enclosure = $item->addChild('enclosure');
$enclosure->addAttribute(

View File

@ -29,8 +29,12 @@ class SimpleRSSElement extends SimpleXMLElement
if ($newChild !== null) {
$node = dom_import_simplexml($newChild);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($value));
if ($node !== null) {
$no = $node->ownerDocument;
if ($no !== null) {
$node->appendChild($no->createCDATASection($value));
}
}
}
return $newChild;
@ -43,17 +47,29 @@ class SimpleRSSElement extends SimpleXMLElement
* @param string $name The name of the child element to add.
* @param string $value [optional] If specified, the value of the child element.
* @param string $namespace [optional] If specified, the namespace to which the child element belongs.
* @param boolean $escape [optional] The value is escaped by default, can be set to false.
*
* @return static The addChild method returns a SimpleXMLElement object representing the child added to the XML node.
*/
public function addChild($name, $value = null, $namespace = null)
public function addChild($name, $value = null, $namespace = null, $escape = true)
{
$newChild = parent::addChild($name, '', $namespace);
if ($newChild !== null) {
$node = dom_import_simplexml($newChild);
$no = $node->ownerDocument;
$node->appendChild($no->createTextNode((string) esc($value)));
if ($node !== null) {
$no = $node->ownerDocument;
$value = $escape ? esc($value ?? '') : $value ?? '';
if ($no === null) {
return $newChild;
}
if (is_array($value)) {
return $newChild;
}
/** @noRector RecastingRemovalRector */
$node->appendChild($no->createTextNode((string) $value));
return $newChild;
}
}
return $newChild;

View File

@ -1,3 +1 @@
declare module "prosemirror-markdown";
declare module "prosemirror-example-setup";
declare module "leaflet.markercluster";

View File

@ -1,3 +0,0 @@
import "@github/markdown-toolbar-element";
import "./modules/markdown-preview";
import "./modules/markdown-write-preview";

View File

@ -1 +0,0 @@
import "core-js";

View File

@ -1 +0,0 @@
export {};

View File

@ -1 +0,0 @@
import "core-js";

View File

@ -1,2 +0,0 @@
declare const DrawCharts: () => void;
export default DrawCharts;

View File

@ -1,2 +0,0 @@
declare const ClientTimezone: () => void;
export default ClientTimezone;

View File

@ -1,2 +0,0 @@
declare const Clipboard: () => void;
export default Clipboard;

View File

@ -1,3 +0,0 @@
import "flatpickr/dist/flatpickr.min.css";
declare const DateTimePicker: () => void;
export default DateTimePicker;

View File

@ -1,2 +0,0 @@
declare const Dropdown: () => void;
export default Dropdown;

View File

@ -1,5 +0,0 @@
import "leaflet.markercluster/dist/MarkerCluster.css";
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
import "leaflet/dist/leaflet.css";
declare const DrawEpisodesMaps: () => void;
export default DrawEpisodesMaps;

View File

@ -1,2 +0,0 @@
declare const DrawMaps: () => void;
export default DrawMaps;

View File

@ -1,2 +0,0 @@
declare const Modal: () => void;
export default Modal;

View File

@ -1,2 +0,0 @@
declare const MultiSelect: () => void;
export default MultiSelect;

View File

@ -1,2 +0,0 @@
declare const PublishMessageWarning: () => void;
export default PublishMessageWarning;

View File

@ -1,2 +0,0 @@
declare const Select: () => void;
export default Select;

View File

@ -1,2 +0,0 @@
declare const SidebarToggler: () => void;
export default SidebarToggler;

View File

@ -1,2 +0,0 @@
declare const Slugify: () => void;
export default Slugify;

View File

@ -1,2 +0,0 @@
declare const Soundbites: () => void;
export default Soundbites;

View File

@ -1,2 +0,0 @@
declare const ThemePicker: () => void;
export default ThemePicker;

View File

@ -1,2 +0,0 @@
declare const Time: () => void;
export default Time;

View File

@ -1,2 +0,0 @@
declare const Toggler: () => void;
export default Toggler;

View File

@ -1,2 +0,0 @@
declare const Tooltip: () => void;
export default Tooltip;

View File

@ -1,13 +0,0 @@
import MarkdownToolbarElement from "@github/markdown-toolbar-element";
import { LitElement, TemplateResult } from "lit";
export declare class MarkdownPreview extends LitElement {
for: string;
_textarea: HTMLTextAreaElement;
_markdownToolbar: MarkdownToolbarElement;
_show: boolean;
connectedCallback(): void;
hide(): void;
show(): void;
markdownToHtml(): string;
render(): TemplateResult<1>;
}

View File

@ -1,13 +0,0 @@
import { LitElement, TemplateResult } from "lit";
import { MarkdownPreview } from "./markdown-preview";
export declare class MarkdownWritePreview extends LitElement {
for: string;
_textarea: HTMLTextAreaElement | null;
_markdownPreview: MarkdownPreview;
_write: NodeListOf<HTMLButtonElement>;
_preview: NodeListOf<HTMLButtonElement>;
connectedCallback(): void;
write(): void;
preview(): void;
render(): TemplateResult<1>;
}

View File

@ -1 +0,0 @@
export {};

View File

@ -2,15 +2,8 @@
"compilerOptions": {
/* Basic Options */
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
] /* Specify library files to be included in the compilation. */,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "app/Resources/types",
"rootDir": "app/Resources",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"noEmit": true,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,