Skip to content
Snippets Groups Projects
Commit 0dd3b7e0 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

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
parent 9ec1cb93
No related branches found
No related tags found
No related merge requests found
Showing
with 26 additions and 45 deletions
......@@ -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;
......
declare module "prosemirror-markdown";
declare module "prosemirror-example-setup";
declare module "leaflet.markercluster";
import "@github/markdown-toolbar-element";
import "./modules/markdown-preview";
import "./modules/markdown-write-preview";
import "core-js";
export {};
import "core-js";
declare const DrawCharts: () => void;
export default DrawCharts;
declare const ClientTimezone: () => void;
export default ClientTimezone;
declare const Clipboard: () => void;
export default Clipboard;
import "flatpickr/dist/flatpickr.min.css";
declare const DateTimePicker: () => void;
export default DateTimePicker;
declare const Dropdown: () => void;
export default Dropdown;
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;
declare const DrawMaps: () => void;
export default DrawMaps;
declare const Modal: () => void;
export default Modal;
declare const MultiSelect: () => void;
export default MultiSelect;
declare const PublishMessageWarning: () => void;
export default PublishMessageWarning;
declare const Select: () => void;
export default Select;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment