Guest User

Untitled

a guest
Jan 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // ----------------------
  2. // -- class A
  3. $strId = 'id_1234';
  4. $strClass = 'classname';
  5. $arParams = array('pluginid' => 'monitor', 'title' => 'Monitor', ...);
  6.  
  7. $strClone = 'openForm(desktop(),"'.$strId.'","'.$strClass.'",'.$arParams.');';
  8.  
  9. $this->menu = array( "clone" => $strClone, ... );
  10.  
  11. // ----------------------
  12. // -- class B
  13. // loop through $this->menu, then..
  14. {
  15. eval( $this->menu[$item] );
  16. }
  17.  
  18. // ----------------------
  19. // -- class C
  20. function openForm( $owner, $id, $class, $params )
  21. {
  22. ...
  23. }
  24.  
  25. $ar = array('a' => 'value1', 'b' => 'value2');
  26. $str = "something";
  27.  
  28. $run = " a('".$str."', $ar); "; // this line may be changed
  29.  
  30. // this is done to represent the loss of the variables in another class
  31. unset($ar);
  32. unset($str);
  33.  
  34. // $run is kept
  35. eval( $run );
  36.  
  37. function a($str, $ar) {
  38. echo "$str=" . $str . "<br>";
  39. echo "$ar['a']=" . $ar['a'] . "<br>";
  40. echo "$ar['b']=" . $ar['b'] . "<br>";
  41. }
  42.  
  43. $run = " a('".$str."', $ar); ";
  44.  
  45. $run = " a('$str', ". var_export($ar, true) ."); ";
  46.  
  47. a('something', array(
  48. 'a' => 'value1',
  49. 'b' => 'value2',
  50. ));
  51.  
  52. $arParams = 'array("pluginid" => "monitor", "title" => "Monitor", ...)';
  53.  
  54. $strParams = " array(";
  55. foreach($arParams as $strKey => $strVal) {
  56. $strParams .= "'".$strKey."' => '".$strVal."',";
  57. }
  58. $strParams = substr($strParams, 0, -1) . ") ";
  59.  
  60. // later on
  61. ... => " openForm(desktop(),'".$strId."','".$strClass."',".$strParams."); "
Add Comment
Please, Sign In to add comment