preserved.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <?php return array (
  2. '1cc383388ac3c8cc4eedbce2aa261012' =>
  3. array (
  4. 'criteria' =>
  5. array (
  6. 'name' => 'ace',
  7. ),
  8. 'object' =>
  9. array (
  10. 'name' => 'ace',
  11. 'path' => '{core_path}components/ace/',
  12. 'assets_path' => '',
  13. ),
  14. ),
  15. '3c16fe99c74968afb67f73442fcc8b37' =>
  16. array (
  17. 'criteria' =>
  18. array (
  19. 'name' => 'Ace',
  20. ),
  21. 'object' =>
  22. array (
  23. 'id' => 1,
  24. 'source' => 0,
  25. 'property_preprocess' => 0,
  26. 'name' => 'Ace',
  27. 'description' => 'Ace code editor plugin for MODx Revolution',
  28. 'editor_type' => 0,
  29. 'category' => 0,
  30. 'cache_type' => 0,
  31. 'plugincode' => '/**
  32. * Ace Source Editor Plugin
  33. *
  34. * Events: OnManagerPageBeforeRender, OnRichTextEditorRegister, OnSnipFormPrerender,
  35. * OnTempFormPrerender, OnChunkFormPrerender, OnPluginFormPrerender,
  36. * OnFileCreateFormPrerender, OnFileEditFormPrerender, OnDocFormPrerender
  37. *
  38. * @author Danil Kostin <danya.postfactum(at)gmail.com>
  39. *
  40. * @package ace
  41. *
  42. * @var array $scriptProperties
  43. * @var Ace $ace
  44. */
  45. if ($modx->event->name == \'OnRichTextEditorRegister\') {
  46. $modx->event->output(\'Ace\');
  47. return;
  48. }
  49. if ($modx->getOption(\'which_element_editor\', null, \'Ace\') !== \'Ace\') {
  50. return;
  51. }
  52. $ace = $modx->getService(\'ace\', \'Ace\', $modx->getOption(\'ace.core_path\', null, $modx->getOption(\'core_path\').\'components/ace/\').\'model/ace/\');
  53. $ace->initialize();
  54. $extensionMap = array(
  55. \'tpl\' => \'text/x-smarty\',
  56. \'htm\' => \'text/html\',
  57. \'html\' => \'text/html\',
  58. \'css\' => \'text/css\',
  59. \'scss\' => \'text/x-scss\',
  60. \'less\' => \'text/x-less\',
  61. \'svg\' => \'image/svg+xml\',
  62. \'xml\' => \'application/xml\',
  63. \'xsl\' => \'application/xml\',
  64. \'js\' => \'application/javascript\',
  65. \'json\' => \'application/json\',
  66. \'php\' => \'application/x-php\',
  67. \'sql\' => \'text/x-sql\',
  68. \'md\' => \'text/x-markdown\',
  69. \'txt\' => \'text/plain\',
  70. \'twig\' => \'text/x-twig\'
  71. );
  72. // Defines wether we should highlight modx tags
  73. $modxTags = false;
  74. switch ($modx->event->name) {
  75. case \'OnSnipFormPrerender\':
  76. $field = \'modx-snippet-snippet\';
  77. $mimeType = \'application/x-php\';
  78. break;
  79. case \'OnTempFormPrerender\':
  80. $field = \'modx-template-content\';
  81. $modxTags = true;
  82. switch (true) {
  83. case $modx->getOption(\'twiggy_class\'):
  84. $mimeType = \'text/x-twig\';
  85. break;
  86. case $modx->getOption(\'pdotools_fenom_parser\'):
  87. $mimeType = \'text/x-smarty\';
  88. break;
  89. default:
  90. $mimeType = \'text/html\';
  91. break;
  92. }
  93. break;
  94. case \'OnChunkFormPrerender\':
  95. $field = \'modx-chunk-snippet\';
  96. if ($modx->controller->chunk && $modx->controller->chunk->isStatic()) {
  97. $extension = pathinfo($modx->controller->chunk->getSourceFile(), PATHINFO_EXTENSION);
  98. $mimeType = isset($extensionMap[$extension]) ? $extensionMap[$extension] : \'text/plain\';
  99. } else {
  100. $mimeType = \'text/html\';
  101. }
  102. $modxTags = true;
  103. switch (true) {
  104. case $modx->getOption(\'twiggy_class\'):
  105. $mimeType = \'text/x-twig\';
  106. break;
  107. case $modx->getOption(\'pdotools_fenom_default\'):
  108. $mimeType = \'text/x-smarty\';
  109. break;
  110. default:
  111. $mimeType = \'text/html\';
  112. break;
  113. }
  114. break;
  115. case \'OnPluginFormPrerender\':
  116. $field = \'modx-plugin-plugincode\';
  117. $mimeType = \'application/x-php\';
  118. break;
  119. case \'OnFileCreateFormPrerender\':
  120. $field = \'modx-file-content\';
  121. $mimeType = \'text/plain\';
  122. break;
  123. case \'OnFileEditFormPrerender\':
  124. $field = \'modx-file-content\';
  125. $extension = pathinfo($scriptProperties[\'file\'], PATHINFO_EXTENSION);
  126. $mimeType = isset($extensionMap[$extension])
  127. ? $extensionMap[$extension]
  128. : \'text/plain\';
  129. $modxTags = $extension == \'tpl\';
  130. break;
  131. case \'OnDocFormPrerender\':
  132. if (!$modx->controller->resourceArray) {
  133. return;
  134. }
  135. $field = \'ta\';
  136. $mimeType = $modx->getObject(\'modContentType\', $modx->controller->resourceArray[\'content_type\'])->get(\'mime_type\');
  137. switch (true) {
  138. case $mimeType == \'text/html\' && $modx->getOption(\'twiggy_class\'):
  139. $mimeType = \'text/x-twig\';
  140. break;
  141. case $mimeType == \'text/html\' && $modx->getOption(\'pdotools_fenom_parser\'):
  142. $mimeType = \'text/x-smarty\';
  143. break;
  144. }
  145. if ($modx->getOption(\'use_editor\')){
  146. $richText = $modx->controller->resourceArray[\'richtext\'];
  147. $classKey = $modx->controller->resourceArray[\'class_key\'];
  148. if ($richText || in_array($classKey, array(\'modStaticResource\',\'modSymLink\',\'modWebLink\',\'modXMLRPCResource\'))) {
  149. $field = false;
  150. }
  151. }
  152. $modxTags = true;
  153. break;
  154. default:
  155. return;
  156. }
  157. $modxTags = (int) $modxTags;
  158. $script = \'\';
  159. if ($field) {
  160. $script .= "MODx.ux.Ace.replaceComponent(\'$field\', \'$mimeType\', $modxTags);";
  161. }
  162. if ($modx->event->name == \'OnDocFormPrerender\' && !$modx->getOption(\'use_editor\')) {
  163. $script .= "MODx.ux.Ace.replaceTextAreas(Ext.query(\'.modx-richtext\'));";
  164. }
  165. if ($script) {
  166. $modx->controller->addHtml(\'<script>Ext.onReady(function() {\' . $script . \'});</script>\');
  167. }',
  168. 'locked' => 0,
  169. 'properties' => NULL,
  170. 'disabled' => 0,
  171. 'moduleguid' => '',
  172. 'static' => 0,
  173. 'static_file' => 'ace/elements/plugins/ace.plugin.php',
  174. 'content' => '/**
  175. * Ace Source Editor Plugin
  176. *
  177. * Events: OnManagerPageBeforeRender, OnRichTextEditorRegister, OnSnipFormPrerender,
  178. * OnTempFormPrerender, OnChunkFormPrerender, OnPluginFormPrerender,
  179. * OnFileCreateFormPrerender, OnFileEditFormPrerender, OnDocFormPrerender
  180. *
  181. * @author Danil Kostin <danya.postfactum(at)gmail.com>
  182. *
  183. * @package ace
  184. *
  185. * @var array $scriptProperties
  186. * @var Ace $ace
  187. */
  188. if ($modx->event->name == \'OnRichTextEditorRegister\') {
  189. $modx->event->output(\'Ace\');
  190. return;
  191. }
  192. if ($modx->getOption(\'which_element_editor\', null, \'Ace\') !== \'Ace\') {
  193. return;
  194. }
  195. $ace = $modx->getService(\'ace\', \'Ace\', $modx->getOption(\'ace.core_path\', null, $modx->getOption(\'core_path\').\'components/ace/\').\'model/ace/\');
  196. $ace->initialize();
  197. $extensionMap = array(
  198. \'tpl\' => \'text/x-smarty\',
  199. \'htm\' => \'text/html\',
  200. \'html\' => \'text/html\',
  201. \'css\' => \'text/css\',
  202. \'scss\' => \'text/x-scss\',
  203. \'less\' => \'text/x-less\',
  204. \'svg\' => \'image/svg+xml\',
  205. \'xml\' => \'application/xml\',
  206. \'xsl\' => \'application/xml\',
  207. \'js\' => \'application/javascript\',
  208. \'json\' => \'application/json\',
  209. \'php\' => \'application/x-php\',
  210. \'sql\' => \'text/x-sql\',
  211. \'md\' => \'text/x-markdown\',
  212. \'txt\' => \'text/plain\',
  213. \'twig\' => \'text/x-twig\'
  214. );
  215. // Defines wether we should highlight modx tags
  216. $modxTags = false;
  217. switch ($modx->event->name) {
  218. case \'OnSnipFormPrerender\':
  219. $field = \'modx-snippet-snippet\';
  220. $mimeType = \'application/x-php\';
  221. break;
  222. case \'OnTempFormPrerender\':
  223. $field = \'modx-template-content\';
  224. $modxTags = true;
  225. switch (true) {
  226. case $modx->getOption(\'twiggy_class\'):
  227. $mimeType = \'text/x-twig\';
  228. break;
  229. case $modx->getOption(\'pdotools_fenom_parser\'):
  230. $mimeType = \'text/x-smarty\';
  231. break;
  232. default:
  233. $mimeType = \'text/html\';
  234. break;
  235. }
  236. break;
  237. case \'OnChunkFormPrerender\':
  238. $field = \'modx-chunk-snippet\';
  239. if ($modx->controller->chunk && $modx->controller->chunk->isStatic()) {
  240. $extension = pathinfo($modx->controller->chunk->getSourceFile(), PATHINFO_EXTENSION);
  241. $mimeType = isset($extensionMap[$extension]) ? $extensionMap[$extension] : \'text/plain\';
  242. } else {
  243. $mimeType = \'text/html\';
  244. }
  245. $modxTags = true;
  246. switch (true) {
  247. case $modx->getOption(\'twiggy_class\'):
  248. $mimeType = \'text/x-twig\';
  249. break;
  250. case $modx->getOption(\'pdotools_fenom_default\'):
  251. $mimeType = \'text/x-smarty\';
  252. break;
  253. default:
  254. $mimeType = \'text/html\';
  255. break;
  256. }
  257. break;
  258. case \'OnPluginFormPrerender\':
  259. $field = \'modx-plugin-plugincode\';
  260. $mimeType = \'application/x-php\';
  261. break;
  262. case \'OnFileCreateFormPrerender\':
  263. $field = \'modx-file-content\';
  264. $mimeType = \'text/plain\';
  265. break;
  266. case \'OnFileEditFormPrerender\':
  267. $field = \'modx-file-content\';
  268. $extension = pathinfo($scriptProperties[\'file\'], PATHINFO_EXTENSION);
  269. $mimeType = isset($extensionMap[$extension])
  270. ? $extensionMap[$extension]
  271. : \'text/plain\';
  272. $modxTags = $extension == \'tpl\';
  273. break;
  274. case \'OnDocFormPrerender\':
  275. if (!$modx->controller->resourceArray) {
  276. return;
  277. }
  278. $field = \'ta\';
  279. $mimeType = $modx->getObject(\'modContentType\', $modx->controller->resourceArray[\'content_type\'])->get(\'mime_type\');
  280. switch (true) {
  281. case $mimeType == \'text/html\' && $modx->getOption(\'twiggy_class\'):
  282. $mimeType = \'text/x-twig\';
  283. break;
  284. case $mimeType == \'text/html\' && $modx->getOption(\'pdotools_fenom_parser\'):
  285. $mimeType = \'text/x-smarty\';
  286. break;
  287. }
  288. if ($modx->getOption(\'use_editor\')){
  289. $richText = $modx->controller->resourceArray[\'richtext\'];
  290. $classKey = $modx->controller->resourceArray[\'class_key\'];
  291. if ($richText || in_array($classKey, array(\'modStaticResource\',\'modSymLink\',\'modWebLink\',\'modXMLRPCResource\'))) {
  292. $field = false;
  293. }
  294. }
  295. $modxTags = true;
  296. break;
  297. default:
  298. return;
  299. }
  300. $modxTags = (int) $modxTags;
  301. $script = \'\';
  302. if ($field) {
  303. $script .= "MODx.ux.Ace.replaceComponent(\'$field\', \'$mimeType\', $modxTags);";
  304. }
  305. if ($modx->event->name == \'OnDocFormPrerender\' && !$modx->getOption(\'use_editor\')) {
  306. $script .= "MODx.ux.Ace.replaceTextAreas(Ext.query(\'.modx-richtext\'));";
  307. }
  308. if ($script) {
  309. $modx->controller->addHtml(\'<script>Ext.onReady(function() {\' . $script . \'});</script>\');
  310. }',
  311. ),
  312. ),
  313. '5ba400450fc3608124cffc5f71d86c7d' =>
  314. array (
  315. 'criteria' =>
  316. array (
  317. 'pluginid' => 1,
  318. 'event' => 'OnChunkFormPrerender',
  319. ),
  320. 'object' =>
  321. array (
  322. 'pluginid' => 1,
  323. 'event' => 'OnChunkFormPrerender',
  324. 'priority' => 0,
  325. 'propertyset' => 0,
  326. ),
  327. ),
  328. 'cdefa5dc7e8417de6e93a0a3f9b0c204' =>
  329. array (
  330. 'criteria' =>
  331. array (
  332. 'pluginid' => 1,
  333. 'event' => 'OnPluginFormPrerender',
  334. ),
  335. 'object' =>
  336. array (
  337. 'pluginid' => 1,
  338. 'event' => 'OnPluginFormPrerender',
  339. 'priority' => 0,
  340. 'propertyset' => 0,
  341. ),
  342. ),
  343. 'b9f60f578220b135bac50fd9d3a2ad67' =>
  344. array (
  345. 'criteria' =>
  346. array (
  347. 'pluginid' => 1,
  348. 'event' => 'OnSnipFormPrerender',
  349. ),
  350. 'object' =>
  351. array (
  352. 'pluginid' => 1,
  353. 'event' => 'OnSnipFormPrerender',
  354. 'priority' => 0,
  355. 'propertyset' => 0,
  356. ),
  357. ),
  358. 'aa4fb89064629bad2dac8717e22cd5fc' =>
  359. array (
  360. 'criteria' =>
  361. array (
  362. 'pluginid' => 1,
  363. 'event' => 'OnTempFormPrerender',
  364. ),
  365. 'object' =>
  366. array (
  367. 'pluginid' => 1,
  368. 'event' => 'OnTempFormPrerender',
  369. 'priority' => 0,
  370. 'propertyset' => 0,
  371. ),
  372. ),
  373. 'f433f3166c096da221cbd83cdb63c2f8' =>
  374. array (
  375. 'criteria' =>
  376. array (
  377. 'pluginid' => 1,
  378. 'event' => 'OnFileEditFormPrerender',
  379. ),
  380. 'object' =>
  381. array (
  382. 'pluginid' => 1,
  383. 'event' => 'OnFileEditFormPrerender',
  384. 'priority' => 0,
  385. 'propertyset' => 0,
  386. ),
  387. ),
  388. '97bc1dc5244259ec5dd1fbc8c00ba4cb' =>
  389. array (
  390. 'criteria' =>
  391. array (
  392. 'pluginid' => 1,
  393. 'event' => 'OnFileCreateFormPrerender',
  394. ),
  395. 'object' =>
  396. array (
  397. 'pluginid' => 1,
  398. 'event' => 'OnFileCreateFormPrerender',
  399. 'priority' => 0,
  400. 'propertyset' => 0,
  401. ),
  402. ),
  403. '6814073b8475cc101fabcaaaeca82349' =>
  404. array (
  405. 'criteria' =>
  406. array (
  407. 'pluginid' => 1,
  408. 'event' => 'OnDocFormPrerender',
  409. ),
  410. 'object' =>
  411. array (
  412. 'pluginid' => 1,
  413. 'event' => 'OnDocFormPrerender',
  414. 'priority' => 0,
  415. 'propertyset' => 0,
  416. ),
  417. ),
  418. '32e753cbc838cd20e6d1ba3a0b7d6e8c' =>
  419. array (
  420. 'criteria' =>
  421. array (
  422. 'pluginid' => 1,
  423. 'event' => 'OnRichTextEditorRegister',
  424. ),
  425. 'object' =>
  426. array (
  427. 'pluginid' => 1,
  428. 'event' => 'OnRichTextEditorRegister',
  429. 'priority' => 0,
  430. 'propertyset' => 0,
  431. ),
  432. ),
  433. 'e5a11b4aca6bf5c55b25423b2ce1a27a' =>
  434. array (
  435. 'criteria' =>
  436. array (
  437. 'pluginid' => 1,
  438. 'event' => 'OnManagerPageBeforeRender',
  439. ),
  440. 'object' =>
  441. array (
  442. 'pluginid' => 1,
  443. 'event' => 'OnManagerPageBeforeRender',
  444. 'priority' => 0,
  445. 'propertyset' => 0,
  446. ),
  447. ),
  448. '4caa3057b8a121589f8b929563ba3ad8' =>
  449. array (
  450. 'criteria' =>
  451. array (
  452. 'key' => 'ace.theme',
  453. ),
  454. 'object' =>
  455. array (
  456. 'key' => 'ace.theme',
  457. 'value' => 'chrome',
  458. 'xtype' => 'textfield',
  459. 'namespace' => 'ace',
  460. 'area' => 'general',
  461. 'editedon' => NULL,
  462. ),
  463. ),
  464. '820b9ab31f5a24a4017343e4c54816ec' =>
  465. array (
  466. 'criteria' =>
  467. array (
  468. 'key' => 'ace.font_size',
  469. ),
  470. 'object' =>
  471. array (
  472. 'key' => 'ace.font_size',
  473. 'value' => '13px',
  474. 'xtype' => 'textfield',
  475. 'namespace' => 'ace',
  476. 'area' => 'general',
  477. 'editedon' => NULL,
  478. ),
  479. ),
  480. '5b382ba04d48093371fabb11e9ff5717' =>
  481. array (
  482. 'criteria' =>
  483. array (
  484. 'key' => 'ace.word_wrap',
  485. ),
  486. 'object' =>
  487. array (
  488. 'key' => 'ace.word_wrap',
  489. 'value' => '',
  490. 'xtype' => 'combo-boolean',
  491. 'namespace' => 'ace',
  492. 'area' => 'general',
  493. 'editedon' => NULL,
  494. ),
  495. ),
  496. 'b1665b4f7f8889c7a7a5de9eb8be0750' =>
  497. array (
  498. 'criteria' =>
  499. array (
  500. 'key' => 'ace.soft_tabs',
  501. ),
  502. 'object' =>
  503. array (
  504. 'key' => 'ace.soft_tabs',
  505. 'value' => '1',
  506. 'xtype' => 'combo-boolean',
  507. 'namespace' => 'ace',
  508. 'area' => 'general',
  509. 'editedon' => NULL,
  510. ),
  511. ),
  512. '4ce41aa75062da3b3e6460593f90530c' =>
  513. array (
  514. 'criteria' =>
  515. array (
  516. 'key' => 'ace.tab_size',
  517. ),
  518. 'object' =>
  519. array (
  520. 'key' => 'ace.tab_size',
  521. 'value' => '4',
  522. 'xtype' => 'textfield',
  523. 'namespace' => 'ace',
  524. 'area' => 'general',
  525. 'editedon' => NULL,
  526. ),
  527. ),
  528. '112036b86062743fe850666aa81cafb4' =>
  529. array (
  530. 'criteria' =>
  531. array (
  532. 'key' => 'ace.fold_widgets',
  533. ),
  534. 'object' =>
  535. array (
  536. 'key' => 'ace.fold_widgets',
  537. 'value' => '1',
  538. 'xtype' => 'combo-boolean',
  539. 'namespace' => 'ace',
  540. 'area' => 'general',
  541. 'editedon' => NULL,
  542. ),
  543. ),
  544. 'effacef9a05e646790059c40e9353161' =>
  545. array (
  546. 'criteria' =>
  547. array (
  548. 'key' => 'ace.show_invisibles',
  549. ),
  550. 'object' =>
  551. array (
  552. 'key' => 'ace.show_invisibles',
  553. 'value' => '0',
  554. 'xtype' => 'combo-boolean',
  555. 'namespace' => 'ace',
  556. 'area' => 'general',
  557. 'editedon' => NULL,
  558. ),
  559. ),
  560. 'a84c9fe49d5fa47b85604498f96ce309' =>
  561. array (
  562. 'criteria' =>
  563. array (
  564. 'key' => 'ace.snippets',
  565. ),
  566. 'object' =>
  567. array (
  568. 'key' => 'ace.snippets',
  569. 'value' => '',
  570. 'xtype' => 'textarea',
  571. 'namespace' => 'ace',
  572. 'area' => 'general',
  573. 'editedon' => NULL,
  574. ),
  575. ),
  576. '71886e43c858dc3381effb9d9e3f82fa' =>
  577. array (
  578. 'criteria' =>
  579. array (
  580. 'key' => 'ace.height',
  581. ),
  582. 'object' =>
  583. array (
  584. 'key' => 'ace.height',
  585. 'value' => '',
  586. 'xtype' => 'textfield',
  587. 'namespace' => 'ace',
  588. 'area' => 'general',
  589. 'editedon' => NULL,
  590. ),
  591. ),
  592. );