mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Replace old XML parser with SimpleXML in widget controller
This commit is contained in:
parent
1a204d8c52
commit
87db7c0371
1 changed files with 13 additions and 11 deletions
|
|
@ -261,9 +261,9 @@ class widgetController extends widget
|
||||||
// Check whether to include information about editing
|
// Check whether to include information about editing
|
||||||
$this->javascript_mode = $javascript_mode;
|
$this->javascript_mode = $javascript_mode;
|
||||||
// Widget code box change
|
// Widget code box change
|
||||||
$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content);
|
$content = preg_replace_callback('!<div([^>]*)widget=([^>]*?)><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content);
|
||||||
// Widget code information byeogyeong
|
// Widget code information byeogyeong
|
||||||
$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
|
$content = preg_replace_callback('!<img([^>]*)widget=([^>]*?)>!is', array($this, 'transWidget'), $content);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
@ -273,16 +273,18 @@ class widgetController extends widget
|
||||||
*/
|
*/
|
||||||
function transWidget($matches)
|
function transWidget($matches)
|
||||||
{
|
{
|
||||||
$buff = trim($matches[0]);
|
$vars = new stdClass;
|
||||||
|
$xml = simplexml_load_string(trim($matches[0]));
|
||||||
$oXmlParser = new XeXmlParser();
|
foreach ($xml->img ? $xml->img->attributes() : $xml->attributes() as $key => $val)
|
||||||
$xml_doc = $oXmlParser->parse(trim($buff));
|
{
|
||||||
|
$vars->{$key} = strval($val);
|
||||||
if($xml_doc->img) $vars = $xml_doc->img->attrs;
|
}
|
||||||
else $vars = $xml_doc->attrs;
|
|
||||||
|
|
||||||
$widget = $vars->widget;
|
$widget = $vars->widget;
|
||||||
if(!$widget) return $matches[0];
|
if (!$widget)
|
||||||
|
{
|
||||||
|
return $matches[0];
|
||||||
|
}
|
||||||
unset($vars->widget);
|
unset($vars->widget);
|
||||||
|
|
||||||
return $this->execute($widget, $vars, $this->javascript_mode);
|
return $this->execute($widget, $vars, $this->javascript_mode);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue