preserved.php 17 KB

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