Skip to content
Permalink
Browse files

Update plans.class.php

Plans warning fix
  • Loading branch information...
sergejey committed Mar 1, 2019
1 parent 975023e commit 21c99ca88312b0e4880d5cb6f55366298fbb33b9
Showing with 15 additions and 9 deletions.
  1. +15 −9 modules/plans/plans.class.php
@@ -159,8 +159,10 @@ function usual(&$out)
}
$content=LoadFile(ROOT.'cms/plans/'.$rec['IMAGE']);
$dynData=$this->findDynamicText($content);
foreach($dynData as $dynItem) {
$states[]=$dynItem;
if (is_array($dynData)) {
foreach($dynData as $dynItem) {
$states[]=$dynItem;
}
}
$result = $states;
echo json_encode($result);
@@ -242,16 +244,18 @@ function getPreview($id) {
$out['PLAN_CUSTOM_JAVASCRIPT']=$rec['CUSTOM_JAVASCRIPT'];
$out['PLAN_CUSTOM_CSS']=$rec['CUSTOM_CSS'];
$dynData=$this->findDynamicText($content);
foreach($dynData as $dynItem) {
$content = str_replace($dynItem['TEMPLATE'],$dynItem['CONTENT'],$content);
if (is_array($dynData)) {
foreach($dynData as $dynItem) {
$content = str_replace($dynItem['TEMPLATE'],$dynItem['CONTENT'],$content);
}
}
$out['SVG_CONTENT']=$content;
$p = new parser(DIR_TEMPLATES . $this->name . "/preview.html", $out, $this);
return $p->result;
}
function findDynamicText($content,$process = 1) {
$result = array();
$p = xml_parser_create();
xml_parse_into_struct($p, $content, $vals, $index);
xml_parser_free($p);
@@ -338,10 +342,12 @@ function getWatchedProperties($plans) {
foreach($plans as $rec) {
$content=LoadFile(ROOT.'cms/plans/'.$rec['IMAGE']);
$dynData=$this->findDynamicText($content,false);
foreach($dynData as $dynItem) {
//$content = str_replace($dynItem['TEMPLATE'],$dynItem['CONTENT'],$content);
foreach($dynItem['PROPERTIES'] as $property) {
$properties[]=array('PROPERTY'=>mb_strtolower($property,'UTF-8'),'STATE_ID'=>$dynItem['ITEM'],'TEMPLATE'=>$dynItem['TEMPLATE']);
if (is_array($dynData)) {
foreach($dynData as $dynItem) {
//$content = str_replace($dynItem['TEMPLATE'],$dynItem['CONTENT'],$content);
foreach($dynItem['PROPERTIES'] as $property) {
$properties[]=array('PROPERTY'=>mb_strtolower($property,'UTF-8'),'STATE_ID'=>$dynItem['ITEM'],'TEMPLATE'=>$dynItem['TEMPLATE']);
}
}
}
}

0 comments on commit 21c99ca

Please sign in to comment.
You can’t perform that action at this time.