1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
executer.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\TradingPlatform\Vk\Api;
4
5use Bitrix\Main\ArgumentNullException;
6use Bitrix\Main\Web\Json;
7use Bitrix\Main\IO;
8
9
11{
12 private $api;
13 private $scriptPath;
14
15 public function __construct($api)
16 {
17 if (empty($api))
18 throw new ArgumentNullException('api');
19
20 $this->scriptPath = $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/sale/lib/tradingplatform/vk/api/scripts";
21 $this->api = $api;
22 }
23
24
31 private function getScript($name)
32 {
33 $filePath = $this->scriptPath . '/' . $name . '.vks';
34 if (IO\File::isFileExists($filePath))
35 {
36 $script = IO\File::getFileContents($filePath);
37// $script = file_get_contents($filePath);
38
39 return $script;
40 }
41
42 return NULL;
43 }
44
45
53 public function __call($methodName, $arguments)
54 {
55// prepare METHOD name
56 $methodName = mb_strtolower($methodName);
57 if (mb_strpos($methodName, 'execute') == 0)
58 {
59 $methodName = str_replace("execute", "", $methodName);
60 }
61
62 $script = $this->getScript($methodName);
63 if (count($arguments))
64 {
65 $script = $this->prepareParams($script, $arguments[0]);
66 }
67 $response = $this->api->run('execute', array('code' => $script));
68
69 return $response;
70 }
71
72
81 private function prepareParams($script, $params)
82 {
83 foreach ($params as $key => $value)
84 {
85 if (is_array($value))
86 {
87 $value = \CUtil::PhpToJSObject($value);
88 }
89 $script = str_replace('%'.mb_strtoupper($key) . '%', $value, $script);
90 }
91
92 return $script;
93 }
94
101 private function decodeMultibyteUnicode($str)
102 {
103 $str = preg_replace_callback('/\\\\u(\w{4})/', function ($matches)
104 {
105 return html_entity_decode('&#x' . $matches[1] . ';', null, 'UTF-8');
106 }, $str);
107
108 return $str;
109 }
110}
static getFileContents($path)
Определения file.php:255
__call($methodName, $arguments)
Определения executer.php:53
$str
Определения commerceml2.php:63
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$name
Определения menu_edit.php:35
Определения directory.php:3
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$response
Определения result.php:21
$matches
Определения index.php:22