Skip to content

Commit b474b91

Browse files
author
hikki
committed
2.6
1 parent 84da16a commit b474b91

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/PlaneHeadAction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PlaneHeadAction extends RowAction
1010
private $title;
1111
private $document_id;
1212

13-
public function __construct($title,$url,$xhr_url=null,$method='POST',$callback='null',$options=[])
13+
public function __construct($title,$url,$xhr_url=null,$method='POST',$callback=null,$options=[])
1414
{
1515
parent::__construct();
1616
$this->title = $title;
@@ -19,6 +19,7 @@ public function __construct($title,$url,$xhr_url=null,$method='POST',$callback='
1919
}
2020
$options = json_encode($options);
2121
$this->document_id = substr(md5($title.$url),16);
22+
$callback = is_string($callback) && preg_match("/function/",$callback) ? $callback : 'null';
2223
Admin::script(<<<EOF
2324
$('#{$this->document_id}').click(function(){
2425
new ComponentPlane('{$url}','{$xhr_url}','{$method}',{$callback},JSON.parse('{$options}'));

src/PlaneRowAction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PlaneRowAction extends RowAction
1010
private $title;
1111
private $document_class;
1212

13-
public function __construct($title,$url,$xhr_url=null,$method='POST',$callback='null',$options=[])
13+
public function __construct($title,$url,$xhr_url=null,$method='POST',$callback=null,$options=[])
1414
{
1515
parent::__construct();
1616
$this->title = $title;
@@ -19,6 +19,7 @@ public function __construct($title,$url,$xhr_url=null,$method='POST',$callback='
1919
}
2020
$options = json_encode($options);
2121
$this->document_class = substr(md5($title.$url),16);
22+
$callback = is_string($callback) && preg_match("/function/",$callback) ? $callback : 'null';
2223
Admin::script(<<<EOF
2324
$('.{$this->document_class}').click(function(){
2425
let url = '$url'.replace('{id}',$(this).attr('data-id'));

0 commit comments

Comments
 (0)