mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-07 19:29:20 +02:00
- add .editorconfig file - format all files to comply with castopod's coding style - switch parsedown dependency with commonmark library to better follow commonmark spec for markdown - add prettier command to format all project files at once closes #16
33 lines
755 B
PHP
33 lines
755 B
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Libraries;
|
|
|
|
use SimpleXMLElement;
|
|
|
|
class SimpleRSSElement extends SimpleXMLElement
|
|
{
|
|
/**
|
|
* Adds a child with $value inside CDATA
|
|
* @param unknown $name
|
|
* @param unknown $value
|
|
*/
|
|
public function addChildWithCDATA($name, $value = null, $namespace = null)
|
|
{
|
|
$new_child = $this->addChild($name, null, $namespace);
|
|
|
|
if ($new_child !== null) {
|
|
$node = dom_import_simplexml($new_child);
|
|
$no = $node->ownerDocument;
|
|
$node->appendChild($no->createCDATASection($value));
|
|
}
|
|
|
|
return $new_child;
|
|
}
|
|
}
|