mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +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
|
||||
$this->javascript_mode = $javascript_mode;
|
||||
// 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
|
||||
$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
|
||||
$content = preg_replace_callback('!<img([^>]*)widget=([^>]*?)>!is', array($this, 'transWidget'), $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
|
@ -273,16 +273,18 @@ class widgetController extends widget
|
|||
*/
|
||||
function transWidget($matches)
|
||||
{
|
||||
$buff = trim($matches[0]);
|
||||
|
||||
$oXmlParser = new XeXmlParser();
|
||||
$xml_doc = $oXmlParser->parse(trim($buff));
|
||||
|
||||
if($xml_doc->img) $vars = $xml_doc->img->attrs;
|
||||
else $vars = $xml_doc->attrs;
|
||||
|
||||
$vars = new stdClass;
|
||||
$xml = simplexml_load_string(trim($matches[0]));
|
||||
foreach ($xml->img ? $xml->img->attributes() : $xml->attributes() as $key => $val)
|
||||
{
|
||||
$vars->{$key} = strval($val);
|
||||
}
|
||||
|
||||
$widget = $vars->widget;
|
||||
if(!$widget) return $matches[0];
|
||||
if (!$widget)
|
||||
{
|
||||
return $matches[0];
|
||||
}
|
||||
unset($vars->widget);
|
||||
|
||||
return $this->execute($widget, $vars, $this->javascript_mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue