Page.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <?php namespace Manage\Lib;
  2. use Dever;
  3. # 通用页面
  4. class Page extends Auth
  5. {
  6. protected $db;
  7. protected $key;
  8. protected $id = 0;
  9. protected $input = false;
  10. protected $recycler = false;
  11. protected $menu = array();
  12. protected $config = array();
  13. protected $field = array();
  14. public $info = array();
  15. public function __construct($key = '', $load = '', $input = true, $config = array())
  16. {
  17. parent::__construct();
  18. $this->key = $key;
  19. $this->input = $input;
  20. $this->id = $this->input('id', 0);
  21. if (!$load) {
  22. $load = Dever::input('load');
  23. }
  24. list($this->db, $this->menu) = Dever::load('common', 'manage')->db($load);
  25. if ($this->menu && $this->menu['show'] == 1) {
  26. $this->checkMenu($this->menu['id'], false);
  27. }
  28. $this->config = $this->db->config['manage'][$key] ?? array();
  29. if ($config) {
  30. $this->config = array_merge($this->config, $config);
  31. }
  32. if ($this->id && !strstr($this->id, ',')) {
  33. $this->info = $this->db->find($this->id);
  34. }
  35. }
  36. public function setting($key, &$data, $struct = true, $type = 'show', $disable = false)
  37. {
  38. if (empty($this->config[$key]) && $struct && isset($this->db->config['struct']) && $this->db->config['struct']) {
  39. $this->config[$key] = $this->db->config['struct'];
  40. }
  41. if (empty($this->config[$key])) {
  42. return;
  43. }
  44. $setting = $this->config[$key];
  45. if (is_string($setting)) {
  46. $setting = explode(',', $setting);
  47. }
  48. $field = $this->input('field', '');
  49. if ($field && is_string($field) && strstr($field, 'dever_')) {
  50. $field = '';
  51. }
  52. return $this->setData($setting, $data, $field, $type, $disable);
  53. }
  54. # 获取某个数据的具体展示值
  55. public function getValue($key, $value, $data, $field = array())
  56. {
  57. if ($key == 'cdate') {
  58. $this->db->config['manage']['update']['field'][$key]['type'] = 'date';
  59. }
  60. $update = $this->db->config['manage']['update']['field'] ?? array();
  61. if ($show = Dever::issets($field, 'show')) {
  62. $value = $this->getShow($show, $data);
  63. } elseif ($value && isset($this->db->config['struct'][$key]['value']) && $this->db->config['struct'][$key]['value']) {
  64. $value = $this->db->value($key, $value);
  65. } elseif ($value && (isset($update[$key]) && isset($update[$key]['type']) && $update[$key]['type'] == 'date')) {
  66. if (isset($update[$key]['date_type']) && $update[$key]['date_type'] == 'year') {
  67. if ($update[$key]['date_type'] == 'year') {
  68. $value = date('Y', $value);
  69. } elseif ($update[$key]['date_type'] == 'month') {
  70. $value = date('Ym', $value);
  71. } else {
  72. $value = date('Ymd', $value);
  73. }
  74. } else {
  75. if (strstr($value, 'T')) {
  76. $value = date('Y-m-d H:i:s', strtotime($value));
  77. } elseif (is_numeric($value)) {
  78. $value = date('Y-m-d H:i:s', $value);
  79. } else {
  80. $value = '-';
  81. }
  82. }
  83. }
  84. return $value;
  85. }
  86. # 获取关联数据
  87. public function getOther($key, $set, $data)
  88. {
  89. $where = $config = array();
  90. if (isset($set['where'])) {
  91. foreach ($set['where'] as $k => $v) {
  92. if (!is_array($v) && isset($data[$v])) {
  93. $where[$k] = $data[$v];
  94. } else {
  95. $where[$k] = $v;
  96. }
  97. }
  98. }
  99. if (isset($set['col'])) {
  100. $config['col'] = $set['col'];
  101. }
  102. if ($where) {
  103. return Dever::db($key)->select($where, $config);
  104. }
  105. return array();
  106. }
  107. public function getShow($show, $data)
  108. {
  109. return \Dever\Helper\Str::val($show, $data);
  110. }
  111. # 获取菜单标题
  112. public function getTitle()
  113. {
  114. return $this->menu['name'];
  115. }
  116. # 获取左侧分栏
  117. protected function column(&$data, $name = '左侧分栏')
  118. {
  119. $data['column'] = false;
  120. if (isset($this->config['column'])) {
  121. if (empty($this->config['column']['hidden'])) {
  122. $data['column'] = $this->config['column'];
  123. if (isset($this->config['column']['add'])) {
  124. $data['column']['add'] = array('name' => $this->config['column']['add'], 'func' => $this->getFunc('column_add', $name . '-' . $this->config['column']['add'], 101));
  125. }
  126. if (isset($this->config['column']['edit'])) {
  127. $data['column']['edit'] = array('name' => '编辑', 'func' => $this->getFunc('column_edit', $name . '-编辑', 102));
  128. }
  129. if (isset($this->config['column']['delete'])) {
  130. $data['column']['delete'] = array('name' => '删除', 'func' => $this->getFunc('column_delete', $name . '-删除', 103));
  131. }
  132. $data['column']['data'] = $this->config['column']['data'];
  133. if (is_string($data['column']['data'])) {
  134. $data['column']['data'] = Dever::call($data['column']['data']);
  135. }
  136. $data['height'] = '100%';
  137. }
  138. if (isset($this->config['column']['active']) && $this->config['column']['where'] == 'id') {
  139. return $this->config['column']['active'];
  140. }
  141. }
  142. }
  143. # 通用的规则验证 一般为更新数据时使用
  144. protected function checkRules($set, $data)
  145. {
  146. if ($set['rules']) {
  147. if (!is_array($set['rules'])) {
  148. $set['rules'] = array
  149. (
  150. array
  151. (
  152. 'required' => true,
  153. 'trigger' => 'blur',
  154. 'message' => $set['name'] . '不能为空',
  155. ),
  156. );
  157. }
  158. foreach ($set['rules'] as $k => $v) {
  159. if (isset($v['required']) && $v['required'] && !$data && $data !== 0) {
  160. Dever::error($v['message']);
  161. }
  162. if ($data || $data === 0) {
  163. if (isset($v['pattern']) && $v['pattern'] && !preg_match('/' . $v['pattern'] . '/', $data)) {
  164. Dever::error($v['message']);
  165. }
  166. if (isset($v['type']) && $v['type']) {
  167. if ($v['type'] == 'number' && !is_numeric($data)) {
  168. Dever::error($v['message']);
  169. } elseif ($v['type'] == 'array' && !is_array($data)) {
  170. Dever::error($v['message']);
  171. } elseif ($v['type'] == 'integer' && !is_int($data)) {
  172. Dever::error($v['message']);
  173. } elseif ($v['type'] == 'float' && !is_float($data)) {
  174. Dever::error($v['message']);
  175. } elseif ($v['type'] == 'string' && !is_string($data)) {
  176. Dever::error($v['message']);
  177. } elseif ($v['type'] == 'boolean' && !is_bool($data)) {
  178. Dever::error($v['message']);
  179. } elseif ($v['type'] == 'url' && !filter_var($data, FILTER_VALIDATE_URL)) {
  180. Dever::error($v['message']);
  181. } elseif ($v['type'] == 'email' && !filter_var($data, FILTER_VALIDATE_EMAIL)) {
  182. Dever::error($v['message']);
  183. } elseif ($v['type'] == 'enum' && isset($v['enum']) && !in_array($data, $v['enum'])) {
  184. Dever::error($v['message']);
  185. }
  186. }
  187. if (isset($v['len']) && $v['len'] && strlen($data) > $v['len']) {
  188. Dever::error($v['message']);
  189. }
  190. if (isset($v['min']) && $v['min'] && strlen($data) < $v['min']) {
  191. Dever::error($v['message']);
  192. }
  193. if (isset($v['max']) && $v['max'] && strlen($data) > $v['max']) {
  194. Dever::error($v['message']);
  195. }
  196. }
  197. }
  198. }
  199. }
  200. private function setData($setting, &$data, $field, $type, $disable)
  201. {
  202. $result = array();
  203. foreach ($setting as $k => $v) {
  204. if (!is_array($v)) {
  205. if (is_numeric($k)) {
  206. $k = $v;
  207. $v = $type;
  208. }
  209. if ($k == 'id') {
  210. $v = array('name' => 'ID', 'type' => $v);
  211. } elseif ($k == 'cdate') {
  212. $v = array('name' => '创建时间', 'type' => $v);
  213. } elseif(isset($this->db->config['struct'][$k])) {
  214. $v = array('name' => $this->db->config['struct'][$k]['name'], 'type' => $v);
  215. } else {
  216. $v = array('name' => $v);
  217. }
  218. } else {
  219. if (isset($v['only'])) {
  220. if ($v['only'] == 'edit' && !$this->id) {
  221. continue;
  222. } elseif ($v['only'] == 'add' && $this->id) {
  223. continue;
  224. }
  225. }
  226. }
  227. if ($field) {
  228. if (is_string($field) && (strstr($field, '{') || strstr($field, '%7B'))) {
  229. $field = htmlspecialchars_decode($field);
  230. $field = Dever::json_decode($field);
  231. }
  232. if (is_array($field)) {
  233. if (isset($field['param'])) {
  234. if (isset($field['param']['set'])) {
  235. $field = array_merge($field, $field['param']['set']);
  236. }
  237. if (isset($field['param']['search'])) {
  238. $field = array_merge($field, $field['param']['search']);
  239. }
  240. } elseif (isset($field['field']) && !Dever::check($field['field'], $k)) {
  241. continue;
  242. }
  243. if (isset($field[$k]) && $field[$k] != $k) {
  244. $v['default'] = $field[$k];
  245. $v['type'] = 'hidden';
  246. }
  247. } elseif (!Dever::check($field, $k)) {
  248. continue;
  249. }
  250. }
  251. $info = $this->setField($data, $k, $v, $field, $type, $disable);
  252. if ($info) {
  253. $result[] = $info;
  254. }
  255. }
  256. return $result;
  257. }
  258. private function setField(&$data, $key, $value, $field, $type = 'show', $disable = false)
  259. {
  260. $value['key'] = $key;
  261. $this->setName($value);
  262. # 对每个字段进行权限设置
  263. if (isset($value['func']) && $value['func']) {
  264. $func = $this->getFunc('field_' . $value['key'], '字段-' . $value['name'], 200);
  265. if (!$func) {
  266. return false;
  267. }
  268. }
  269. if (strpos($key, '/') && $this->key == 'update') {
  270. $this->setType($value, 'table');
  271. $this->setShow($value);
  272. if (strpos($key, '#')) {
  273. $key = str_replace('#', '', $key);
  274. }
  275. $sku = $value['type'] == 'sku' ? true : false;
  276. $value['value'] = $this->getOther($key, $value, $this->info);
  277. if (isset($value['default'])) {
  278. $value['value'] += $value['default'];
  279. }
  280. if (isset($value['field'])) {
  281. list($app, $table) = explode('/', $key);
  282. $set = Dever::project($app);
  283. $manage = @include($set['path'] . 'manage/'.$table.'.php');
  284. if (isset($manage['update']['field'][$value['field']])) {
  285. $value = array_merge($value, $manage['update']['field'][$value['field']]);
  286. }
  287. if ($value['value']) {
  288. $data[$key . '_id'] = array
  289. (
  290. 'key' => $key . '_id',
  291. 'type' => 'hidden',
  292. 'value' => $value['value'][0]['id'],
  293. );
  294. $value['value'] = $value['value'][0][$value['field']];
  295. }
  296. $this->setRules($value);
  297. $this->setForm($value);
  298. $data[] = $value;
  299. return $value['name'] ?? 'test';
  300. }
  301. $update = new \Manage\Api\Page\Update($key, false);
  302. $value['option'] = array();
  303. $value['content'] = $update->get($value['value'], $value['option'], $sku);
  304. $data[] = $value;
  305. return $value['name'];
  306. } else {
  307. $this->setType($value, $type);
  308. $this->setDisable($value, $disable);
  309. if ($this->key == 'update') {
  310. # 一般为更新页面需要的参数
  311. $this->setShow($value);
  312. $this->setRules($value);
  313. } elseif (isset($value['remote'])) {
  314. $value['remote'] = Dever::url($value['remote']);
  315. }
  316. if ($type == 'show') {
  317. if (!isset($value['tip'])) {
  318. $value['tip'] = false;
  319. }
  320. $in = array('switch', 'select', 'input');
  321. if (in_array($value['type'], $in)) {
  322. $value['func'] = $this->getFunc('list_edit_' . $value['key'], '列表更新-' . $value['name'], 104);
  323. if (!$value['func']) {
  324. $value['type'] = 'show';
  325. if (isset($value['show'])) {
  326. unset($value['show']);
  327. }
  328. }
  329. }
  330. if (isset($value['child'])) {
  331. $child = array();
  332. $this->setData($value['child'], $child, $field, $type, $disable);
  333. $value['child'] = $child;
  334. } else {
  335. $this->field[$key] = $value;
  336. }
  337. }
  338. $this->setForm($value);
  339. $data[] = $value;
  340. return $value['name'] ?? 'test';
  341. }
  342. }
  343. private function setShow(&$value)
  344. {
  345. if ($value['type'] == 'hidden') {
  346. $value['show'] = false;
  347. } elseif (!isset($value['show'])) {
  348. $value['show'] = true;
  349. }
  350. }
  351. private function setName(&$value)
  352. {
  353. if (empty($value['name']) && isset($this->db->config['struct'][$value['key']])) {
  354. $value['name'] = $this->db->config['struct'][$value['key']]['name'];
  355. }
  356. if (empty($value['placeholder']) && isset($value['name'])) {
  357. $value['placeholder'] = $value['name'];
  358. }
  359. }
  360. private function setType(&$value, $type)
  361. {
  362. if (empty($value['type'])) {
  363. $value['type'] = $type;
  364. }
  365. if (strpos($value['type'], '(')) {
  366. $value['type'] = $type;
  367. }
  368. if (empty($value['width'])) {
  369. $value['width'] = 'auto';
  370. }
  371. if (isset($value['upload']) && Dever::project('upload')) {
  372. $upload['cate_id'] = 1;
  373. $upload['group_key'] = $this->db->config['table'] . '-' . $value['key'];
  374. $upload['group_name'] = $this->db->config['name'];
  375. $upload['user_token'] = Dever::load('common', 'manage')->getToken();
  376. $upload['user_table'] = $this->user['table'];
  377. $upload['user_id'] = $this->user['id'];
  378. if (is_array($value['upload'])) {
  379. $upload += $value['upload'];
  380. } else {
  381. $upload += array('id' => $value['upload']);
  382. }
  383. if (empty($upload['id'])) {
  384. Dever::error('上传配置错误');
  385. }
  386. $value['config'] = Dever::load('save', 'upload')->get($upload['id']);
  387. $value['yun'] = false;
  388. if ($value['config']['method'] == 2) {
  389. $value['yun'] = true;
  390. }
  391. $value['url'] = Dever::url('upload/save.act', $upload, true);
  392. $upload['wh'] = $value['wh'] ?? '500*500';
  393. $value['set'] = Dever::url('image/manage.set', $upload);
  394. if (isset($value['multiple']) && $value['multiple']) {
  395. $value['limit'] = 10;
  396. } else {
  397. $value['limit'] = 1;
  398. }
  399. }
  400. if (isset($value['editorMenu'])) {
  401. if (isset($value['editorMenu']['uploadImage'])) {
  402. if (!is_array($value['editorMenu']['uploadImage'])) {
  403. $value['editorMenu']['uploadImage'] = array('upload' => $value['editorMenu']['uploadImage']);
  404. }
  405. $value['editorMenu']['uploadImage']['server'] = Dever::url('upload/save.wangEditor', array('id' => $value['editorMenu']['uploadImage']['upload']));
  406. if (empty($value['editorMenu']['uploadImage']['fieldName'])) {
  407. $value['editorMenu']['uploadImage']['fieldName'] = 'file';
  408. }
  409. }
  410. if (isset($value['editorMenu']['uploadVideo'])) {
  411. if (!is_array($value['editorMenu']['uploadVideo'])) {
  412. $value['editorMenu']['uploadVideo'] = array('upload' => $value['editorMenu']['uploadVideo']);
  413. }
  414. $value['editorMenu']['uploadVideo']['server'] = Dever::url('upload/save.wangEditor', array('id' => $value['editorMenu']['uploadVideo']['upload']));
  415. if (empty($value['editorMenu']['uploadImage']['fieldName'])) {
  416. $value['editorMenu']['uploadImage']['fieldName'] = 'file';
  417. }
  418. }
  419. }
  420. if (isset($value['date_type']) && $value['date_type'] == 'datetimerange' && empty($value['default_time'])) {
  421. $value['default_time'] = array(\Dever\Helper\Date::mktime(date('Y-m-d 00:00:00'))*1000, \Dever\Helper\Date::mktime(date('Y-m-d 23:59:59'))*1000);
  422. }
  423. }
  424. private function setDisable(&$value, $disable)
  425. {
  426. if (isset($value['disable'])) {
  427. $disable = $value['disable'];
  428. }
  429. $value['disable'] = $disable;
  430. }
  431. private function setForm(&$value)
  432. {
  433. if (empty($value['value'])) {
  434. $value['value'] = Dever::input('search')[$value['key']] ?? '';
  435. }
  436. if (is_array($value['value'])) {
  437. foreach ($value['value'] as &$v) {
  438. $v = (float) $v;
  439. }
  440. }
  441. if (!$value['value']) {
  442. if (isset($value['default']) && !strstr($value['default'], '{')) {
  443. $value['value'] = $value['default'];
  444. } elseif ($this->key == 'update' && isset($this->db->config['struct'][$value['key']]['default'])) {
  445. $value['value'] = $this->db->config['struct'][$value['key']]['default'];
  446. }
  447. }
  448. if (isset($value['option']) && $value['option']) {
  449. $this->db->config['option'][$value['key']] = $value['option'];
  450. }
  451. $send = $this->info;
  452. $send['table'] = $this->db->config['load'];
  453. if ($option = $this->db->value($value['key'], false, 'id,name', $send)) {
  454. if ($value['type'] == 'checkbox') {
  455. $value['value'] = $value['value'] ? explode(',', $value['value']) : array();
  456. }
  457. $value['option'] = $option;
  458. if ($value['type'] == 'text') {
  459. $value['type'] = 'select';
  460. }
  461. if (!is_array($value['value']) && $value['value']) {
  462. $value['value'] = (float) $value['value'];
  463. }
  464. }
  465. }
  466. private function setRules(&$value)
  467. {
  468. if (isset($value['rules']) && $value['rules']) {
  469. if (!is_array($value['rules'])) {
  470. $value['rules'] = array
  471. (
  472. array
  473. (
  474. 'required' => true,
  475. 'trigger' => 'blur',
  476. 'message' => $value['name'] . '不能为空',
  477. ),
  478. );
  479. }
  480. foreach ($value['rules'] as $k => $v) {
  481. if (isset($v['only'])) {
  482. if ($v['only'] == 'edit' && !$this->id) {
  483. unset($value['rules'][$k]);
  484. break;
  485. } elseif ($v['only'] == 'add' && $this->id) {
  486. unset($value['rules'][$k]);
  487. break;
  488. }
  489. }
  490. }
  491. if (!isset($value['rules'][0])) {
  492. $value['rules'] = array_values($value['rules']);
  493. }
  494. }
  495. }
  496. protected function input($key, $value = '')
  497. {
  498. return $this->input ? Dever::input($key) : $value;
  499. }
  500. public function button($key = 'button', $data = array())
  501. {
  502. $result = array();
  503. if (!isset($this->config[$key])) {
  504. $num = 0;
  505. if (isset($this->db->config['manage']['update']['field'])) {
  506. $num = count($this->db->config['manage']['update']['field']);
  507. } elseif (isset($this->db->config['struct']) && $this->db->config['struct']) {
  508. $num = count($this->db->config['struct']);
  509. }
  510. $fast = 'fast';
  511. if ($num > 8) {
  512. $fast = '';
  513. }
  514. if ($key == 'button') {
  515. $this->config[$key] = array('新增' => $fast . 'add');
  516. } else {
  517. $this->config[$key] = array('编辑' => $fast . 'edit', '删除' => 'recycle');
  518. }
  519. }
  520. $sort = 1;
  521. foreach ($this->config[$key] as $k => $v) {
  522. $d = '';
  523. $p = '';
  524. $i = '';
  525. if (is_array($v)) {
  526. if (isset($v[3]) && $data) {
  527. $d = $v[3];
  528. parse_str($d, $t);
  529. $state = true;
  530. foreach ($t as $k1 => $v1) {
  531. if (!isset($data[$k1]) || (isset($data[$k1]) && $data[$k1] != $v1)) {
  532. $state = false;
  533. }
  534. }
  535. if (!$state) {
  536. continue;
  537. }
  538. }
  539. if (isset($v[2])) {
  540. $i = $v[2];
  541. }
  542. if (isset($v[1])) {
  543. $p = $v[1];
  544. }
  545. $v = $v[0];
  546. }
  547. if (strstr($v, 'add')) {
  548. $icon = 'Plus';
  549. $button = 'primary';
  550. } elseif (strstr($v, 'edit')) {
  551. $icon = 'Edit';
  552. $button = 'primary';
  553. } elseif (strstr($v, 'view')) {
  554. $icon = 'View';
  555. $button = '';
  556. } elseif ($v == 'delete') {
  557. if ($key == 'button') {
  558. if (isset($this->config['layout'])) {
  559. continue;
  560. }
  561. $this->config['selection'] = true;
  562. }
  563. $icon = 'Delete';
  564. $button = 'danger';
  565. } elseif ($v == 'recycle') {
  566. if ($key == 'button') {
  567. if (isset($this->config['layout'])) {
  568. continue;
  569. }
  570. $this->config['selection'] = true;
  571. }
  572. $icon = 'Delete';
  573. $button = 'danger';
  574. } elseif ($v == 'oper') {
  575. if ($key == 'button') {
  576. if (isset($this->config['layout'])) {
  577. continue;
  578. }
  579. $this->config['selection'] = true;
  580. }
  581. $icon = 'Notification';
  582. $button = 'warning';
  583. } elseif ($v == 'api') {
  584. if ($key == 'button') {
  585. if (isset($this->config['layout'])) {
  586. continue;
  587. }
  588. $this->config['selection'] = true;
  589. }
  590. $p = Dever::url($p);
  591. $icon = 'Notification';
  592. $button = 'warning';
  593. } elseif ($v == 'link') {
  594. $icon = 'Link';
  595. $button = 'success';
  596. } elseif ($v == 'route') {
  597. $icon = 'Link';
  598. $button = 'success';
  599. } elseif ($v == 'recover') {
  600. $icon = 'CirclePlus';
  601. $button = 'info';
  602. } else {
  603. continue;
  604. }
  605. # 权限验证
  606. $sort++;
  607. $func = $this->getFunc($v, $k, $sort, $p);
  608. if ($this->menu && $this->menu['show'] == 1 && !$func) {
  609. continue;
  610. }
  611. if ($i) {
  612. $icon = $i;
  613. }
  614. $result[] = array
  615. (
  616. 'name' => $k,
  617. 'type' => $v,
  618. 'param' => $p,
  619. 'icon' => $icon,
  620. 'button' => $button,
  621. 'func' => $func,
  622. );
  623. if (!$this->recycler && $v == 'recycle') {
  624. $this->recycler = true;
  625. }
  626. }
  627. return $result;
  628. }
  629. }