mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 13:01:19 +00:00
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:
parent
9ec1cb93da
commit
0dd3b7e0bf
@ -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/)
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
2
app/Resources/js/typings.d.ts
vendored
2
app/Resources/js/typings.d.ts
vendored
@ -1,3 +1 @@
|
||||
declare module "prosemirror-markdown";
|
||||
declare module "prosemirror-example-setup";
|
||||
declare module "leaflet.markercluster";
|
||||
|
3
app/Resources/types/js/admin.d.ts
vendored
3
app/Resources/types/js/admin.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
import "@github/markdown-toolbar-element";
|
||||
import "./modules/markdown-preview";
|
||||
import "./modules/markdown-write-preview";
|
1
app/Resources/types/js/charts.d.ts
vendored
1
app/Resources/types/js/charts.d.ts
vendored
@ -1 +0,0 @@
|
||||
import "core-js";
|
1
app/Resources/types/js/install.d.ts
vendored
1
app/Resources/types/js/install.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
app/Resources/types/js/map.d.ts
vendored
1
app/Resources/types/js/map.d.ts
vendored
@ -1 +0,0 @@
|
||||
import "core-js";
|
2
app/Resources/types/js/modules/Charts.d.ts
vendored
2
app/Resources/types/js/modules/Charts.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const DrawCharts: () => void;
|
||||
export default DrawCharts;
|
@ -1,2 +0,0 @@
|
||||
declare const ClientTimezone: () => void;
|
||||
export default ClientTimezone;
|
@ -1,2 +0,0 @@
|
||||
declare const Clipboard: () => void;
|
||||
export default Clipboard;
|
@ -1,3 +0,0 @@
|
||||
import "flatpickr/dist/flatpickr.min.css";
|
||||
declare const DateTimePicker: () => void;
|
||||
export default DateTimePicker;
|
2
app/Resources/types/js/modules/Dropdown.d.ts
vendored
2
app/Resources/types/js/modules/Dropdown.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Dropdown: () => void;
|
||||
export default Dropdown;
|
@ -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;
|
2
app/Resources/types/js/modules/Map.d.ts
vendored
2
app/Resources/types/js/modules/Map.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const DrawMaps: () => void;
|
||||
export default DrawMaps;
|
2
app/Resources/types/js/modules/Modal.d.ts
vendored
2
app/Resources/types/js/modules/Modal.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Modal: () => void;
|
||||
export default Modal;
|
@ -1,2 +0,0 @@
|
||||
declare const MultiSelect: () => void;
|
||||
export default MultiSelect;
|
@ -1,2 +0,0 @@
|
||||
declare const PublishMessageWarning: () => void;
|
||||
export default PublishMessageWarning;
|
2
app/Resources/types/js/modules/Select.d.ts
vendored
2
app/Resources/types/js/modules/Select.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Select: () => void;
|
||||
export default Select;
|
@ -1,2 +0,0 @@
|
||||
declare const SidebarToggler: () => void;
|
||||
export default SidebarToggler;
|
2
app/Resources/types/js/modules/Slugify.d.ts
vendored
2
app/Resources/types/js/modules/Slugify.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Slugify: () => void;
|
||||
export default Slugify;
|
@ -1,2 +0,0 @@
|
||||
declare const Soundbites: () => void;
|
||||
export default Soundbites;
|
@ -1,2 +0,0 @@
|
||||
declare const ThemePicker: () => void;
|
||||
export default ThemePicker;
|
2
app/Resources/types/js/modules/Time.d.ts
vendored
2
app/Resources/types/js/modules/Time.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Time: () => void;
|
||||
export default Time;
|
2
app/Resources/types/js/modules/Toggler.d.ts
vendored
2
app/Resources/types/js/modules/Toggler.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Toggler: () => void;
|
||||
export default Toggler;
|
2
app/Resources/types/js/modules/Tooltip.d.ts
vendored
2
app/Resources/types/js/modules/Tooltip.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
declare const Tooltip: () => void;
|
||||
export default Tooltip;
|
@ -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>;
|
||||
}
|
@ -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>;
|
||||
}
|
1
app/Resources/types/js/podcast.d.ts
vendored
1
app/Resources/types/js/podcast.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -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. */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user