replace array fix, proto statesystem parameter exchange
This commit is contained in:
parent
01c075f772
commit
69390d4c59
@ -80,10 +80,10 @@ SYSTEM.prototype.load = function(id){
|
|||||||
async: false,
|
async: false,
|
||||||
data: {},
|
data: {},
|
||||||
dataType: 'html',
|
dataType: 'html',
|
||||||
url: entry['url'],
|
url: entry['url']+'&'+window.location.search.substr(1),
|
||||||
success: function(data){
|
success: function(data){
|
||||||
$(entry['div']).html(data);
|
$(entry['div']).html(data);
|
||||||
system.log(system.LOG_INFO,'load page: '+id+entry['div']+' - success');},
|
system.log(system.LOG_INFO,'load page: '+id+entry['div']+' '+entry['url']+'&'+window.location.search.substr(1)+' - success');},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown){system.log(system.LOG_ERROR,errorThrown);}
|
error: function(XMLHttpRequest, textStatus, errorThrown){system.log(system.LOG_ERROR,errorThrown);}
|
||||||
});
|
});
|
||||||
//load css
|
//load css
|
||||||
|
|||||||
@ -1,21 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SYSTEM\PAGE;
|
namespace SYSTEM\PAGE;
|
||||||
|
|
||||||
class replace
|
class replace
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function replace($text, $vars){
|
public static function replace($text, $vars){
|
||||||
if(!$vars){
|
if(!$vars){
|
||||||
$vars = array();}
|
$vars = array();}
|
||||||
$search = array();
|
$search = array();
|
||||||
$replace = array();
|
$replace = array();
|
||||||
|
|
||||||
foreach(array_keys($vars) as $var){
|
foreach($vars as $key=>$value){
|
||||||
$search[] = '/\${'.$var.'}/';}
|
if(!is_array($value)){
|
||||||
|
$search[] = '/\${'.$key.'}/';
|
||||||
foreach($vars as $var){
|
$replace[] = $value;}
|
||||||
$replace[] = $var;}
|
}
|
||||||
return @preg_replace($search, $replace, $text);
|
return @preg_replace($search, $replace, $text);
|
||||||
}
|
}
|
||||||
public static function replaceFile($path, $vars){
|
public static function replaceFile($path, $vars){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user