preserved.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. <?php return array (
  2. '04129a4c69c5a8ade222db08d9721f9c' =>
  3. array (
  4. 'criteria' =>
  5. array (
  6. 'name' => 'fred',
  7. ),
  8. 'object' =>
  9. array (
  10. 'name' => 'fred',
  11. 'path' => '{core_path}components/fred/',
  12. 'assets_path' => '{assets_path}components/fred/',
  13. ),
  14. ),
  15. 'fc273ac310c52306b978d37bea7648ce' =>
  16. array (
  17. 'criteria' =>
  18. array (
  19. 'key' => 'fred.launcher_position',
  20. ),
  21. 'object' =>
  22. array (
  23. 'key' => 'fred.launcher_position',
  24. 'value' => 'bottom_left',
  25. 'xtype' => 'textfield',
  26. 'namespace' => 'fred',
  27. 'area' => 'default',
  28. 'editedon' => NULL,
  29. ),
  30. ),
  31. 'd88e7ea6d8d85302c058041666b66871' =>
  32. array (
  33. 'criteria' =>
  34. array (
  35. 'key' => 'fred.icon_editor',
  36. ),
  37. 'object' =>
  38. array (
  39. 'key' => 'fred.icon_editor',
  40. 'value' => 'IconEditor',
  41. 'xtype' => 'textfield',
  42. 'namespace' => 'fred',
  43. 'area' => 'default',
  44. 'editedon' => NULL,
  45. ),
  46. ),
  47. 'c34523a31af71ace4bad2ba255604b45' =>
  48. array (
  49. 'criteria' =>
  50. array (
  51. 'key' => 'fred.image_editor',
  52. ),
  53. 'object' =>
  54. array (
  55. 'key' => 'fred.image_editor',
  56. 'value' => 'ImageEditor',
  57. 'xtype' => 'textfield',
  58. 'namespace' => 'fred',
  59. 'area' => 'default',
  60. 'editedon' => NULL,
  61. ),
  62. ),
  63. '7631e9928799387322a2102d0cb574d5' =>
  64. array (
  65. 'criteria' =>
  66. array (
  67. 'key' => 'fred.rte',
  68. ),
  69. 'object' =>
  70. array (
  71. 'key' => 'fred.rte',
  72. 'value' => 'TinyMCE',
  73. 'xtype' => 'textfield',
  74. 'namespace' => 'fred',
  75. 'area' => 'default',
  76. 'editedon' => '2018-11-29 05:47:02',
  77. ),
  78. ),
  79. '434d64fb137569682a0495d1c1e3a73b' =>
  80. array (
  81. 'criteria' =>
  82. array (
  83. 'key' => 'fred.element_group_sort',
  84. ),
  85. 'object' =>
  86. array (
  87. 'key' => 'fred.element_group_sort',
  88. 'value' => 'name',
  89. 'xtype' => 'textfield',
  90. 'namespace' => 'fred',
  91. 'area' => 'default',
  92. 'editedon' => NULL,
  93. ),
  94. ),
  95. '00f17ded51254b836d514514a56a017a' =>
  96. array (
  97. 'criteria' =>
  98. array (
  99. 'key' => 'fred.element_sort',
  100. ),
  101. 'object' =>
  102. array (
  103. 'key' => 'fred.element_sort',
  104. 'value' => 'name',
  105. 'xtype' => 'textfield',
  106. 'namespace' => 'fred',
  107. 'area' => 'default',
  108. 'editedon' => NULL,
  109. ),
  110. ),
  111. '2ba0d04599604971601dfe319808e233' =>
  112. array (
  113. 'criteria' =>
  114. array (
  115. 'key' => 'fred.blueprint_category_sort',
  116. ),
  117. 'object' =>
  118. array (
  119. 'key' => 'fred.blueprint_category_sort',
  120. 'value' => 'name',
  121. 'xtype' => 'textfield',
  122. 'namespace' => 'fred',
  123. 'area' => 'default',
  124. 'editedon' => NULL,
  125. ),
  126. ),
  127. '090664b763d26d136ab538ff3f0b97cb' =>
  128. array (
  129. 'criteria' =>
  130. array (
  131. 'key' => 'fred.blueprint_sort',
  132. ),
  133. 'object' =>
  134. array (
  135. 'key' => 'fred.blueprint_sort',
  136. 'value' => 'name',
  137. 'xtype' => 'textfield',
  138. 'namespace' => 'fred',
  139. 'area' => 'default',
  140. 'editedon' => NULL,
  141. ),
  142. ),
  143. '8b35f2ca9134305a444a28327f0e4c85' =>
  144. array (
  145. 'criteria' =>
  146. array (
  147. 'key' => 'fred.secret',
  148. ),
  149. 'object' =>
  150. array (
  151. 'key' => 'fred.secret',
  152. 'value' => '7d4cb8c8e6d4513332b7168a86845062927b701796e404ccb0545799b5f81287e78238a1',
  153. 'xtype' => 'text-password',
  154. 'namespace' => 'fred',
  155. 'area' => 'default',
  156. 'editedon' => '2018-11-29 00:01:43',
  157. ),
  158. ),
  159. 'ff72aa76d1721def64610be2496ad42f' =>
  160. array (
  161. 'criteria' =>
  162. array (
  163. 'category' => 'Fred',
  164. ),
  165. 'object' =>
  166. array (
  167. 'id' => 27,
  168. 'parent' => 0,
  169. 'category' => 'Fred',
  170. 'rank' => 0,
  171. ),
  172. ),
  173. 'd326a485440e71a2c3479466cf4ad432' =>
  174. array (
  175. 'criteria' =>
  176. array (
  177. 'name' => 'Fred',
  178. ),
  179. 'object' =>
  180. array (
  181. 'id' => 14,
  182. 'source' => 0,
  183. 'property_preprocess' => 0,
  184. 'name' => 'Fred',
  185. 'description' => '',
  186. 'editor_type' => 0,
  187. 'category' => 27,
  188. 'cache_type' => 0,
  189. 'plugincode' => '/*
  190. * This file is part of the Fred package.
  191. *
  192. * Copyright (c) MODX, LLC
  193. *
  194. * For the full copyright and license information, please view the LICENSE
  195. * file that was distributed with this source code.
  196. */
  197. $corePath = $modx->getOption(\'fred.core_path\', null, $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/fred/\');
  198. /** @var Fred $fred */
  199. $fred = $modx->getService(
  200. \'fred\',
  201. \'Fred\',
  202. $corePath . \'model/fred/\',
  203. array(
  204. \'core_path\' => $corePath
  205. )
  206. );
  207. switch ($modx->event->name) {
  208. case \'OnDocFormPrerender\':
  209. if(!empty($resource) && !empty($fred->getTheme($resource->template))) {
  210. //Disable ContentBlocks
  211. $isContentBlocks = $resource->getProperty(\'_isContentBlocks\', \'contentblocks\', null);
  212. if($isContentBlocks !== false){
  213. $resource->setProperty(\'_isContentBlocks\', false, \'contentblocks\');
  214. $resource->save();
  215. }
  216. $data = $resource->getProperty(\'data\', \'fred\');
  217. $fingerprint = !empty($data[\'fingerprint\']) ? $data[\'fingerprint\'] : \'\';
  218. //Load Open in Fred button
  219. $modx->lexicon->load(\'fred:default\');
  220. $modx->controller->addLexiconTopic(\'fred:default\');
  221. $modx->controller->addHtml("
  222. <script>
  223. Ext.ComponentMgr.onAvailable(\'modx-resource-content\', function(right) {
  224. right.on(\'beforerender\', function() {
  225. var content = Ext.getCmp(\'ta\'),
  226. contentvalue = content.getValue(),
  227. panel = Ext.getCmp(\'modx-page-update-resource\');
  228. content.destroy();
  229. right.insert(0,{
  230. xtype: \'button\'
  231. ,fieldLabel: _(\'fred.open_in_fred\')
  232. ,hideLabel: true
  233. ,cls: \'primary-button\'
  234. ,style: {padding: \'10px 15px\'}
  235. ,html: _(\'fred.open_in_fred\')
  236. ,handler: function(){
  237. window.open(panel.config.preview_url)
  238. }
  239. });
  240. right.insert(1,{
  241. xtype: \'textarea\'
  242. ,hideLabel: true
  243. ,anchor: \'100%\'
  244. ,grow: true
  245. ,style: {marginTop:\'15px\'}
  246. ,disabled: true
  247. ,value: contentvalue
  248. });
  249. });
  250. right.on(\'afterrender\', function() {
  251. var panel = Ext.getCmp(\'modx-panel-resource\');
  252. panel.on(\'success\', function(){
  253. location.reload();
  254. });
  255. var fingerprint = document.createElement(\'input\');
  256. fingerprint.setAttribute(\'type\', \'hidden\');
  257. fingerprint.setAttribute(\'name\', \'fingerprint\');
  258. fingerprint.setAttribute(\'value\', \'" . $fingerprint . "\');
  259. panel.form.el.dom.appendChild(fingerprint);
  260. });
  261. });
  262. </script>");
  263. }
  264. break;
  265. case \'OnLoadWebDocument\':
  266. $theme = $fred->getTheme($modx->resource->template);
  267. if (!empty($theme)) {
  268. $themeUri = $theme->getThemeFolderUri();
  269. $modx->setPlaceholder(\'+fred.theme_dir\', $themeUri);
  270. $modx->setOption(\'fred.theme_dir\', $themeUri);
  271. }
  272. break;
  273. case \'OnWebPagePrerender\':
  274. $theme = $fred->getTheme($modx->resource->template);
  275. if (!empty($theme)) {
  276. if (!$modx->user) return;
  277. if (!($modx->user->hasSessionContext(\'mgr\') || $modx->user->hasSessionContext($modx->resource->context_key))) return;
  278. if (!$modx->hasPermission(\'fred\')) return;
  279. $modx->lexicon->load(\'fred:fe\');
  280. $fredMode = 1;
  281. if (isset($_SESSION[\'fred\'])) {
  282. $fredMode = intval($_SESSION[\'fred\']);
  283. }
  284. if (isset($_GET[\'fred\'])) {
  285. $fredMode = intval($_GET[\'fred\']);
  286. }
  287. if ($fredMode === 4) {
  288. $fredMode = 0;
  289. $_SESSION[\'fred\'] = 0;
  290. }
  291. if ($fredMode === 1) {
  292. $_SESSION[\'fred\'] = 1;
  293. }
  294. $get = $_GET;
  295. unset($get[$modx->getOption(\'request_param_alias\', [], \'q\')]);
  296. if ($fredMode === 0) {
  297. $button = "<a href=\\"" . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 1]) , \'abs\')) . "\\" title=\\"" . $modx->lexicon(\'fred.fe.turn_on_fred\') . "\\" role=\\"button\\" style=\\"display: block; text-decoration: none; background-color: #4D4D4D; background-image: url(&quot;data:image/svg+xml, %3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'48\' height=\'48\' viewBox=\'-14.584 -8.583 48 48\'%3E%3ClinearGradient id=\'a\' gradientUnits=\'userSpaceOnUse\' x1=\'2164.318\' y1=\'-2519.043\' x2=\'2047.448\' y2=\'-2442.941\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2380c3e6\'/%3E%3Cstop offset=\'1\' stop-color=\'%233380c2\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23a)\' d=\'M22.035 11.468l9.602-15.406H8.488L5.236 1.17z\'/%3E%3Cpath opacity=\'.15\' d=\'M5.236 1.17l1.702-2.633 15.097 12.931z\'/%3E%3ClinearGradient id=\'b\' gradientUnits=\'userSpaceOnUse\' x1=\'2184.769\' y1=\'-2694.977\' x2=\'2097.394\' y2=\'-2637.275\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%23f38649\'/%3E%3Cstop offset=\'.185\' stop-color=\'%23f28147\'/%3E%3Cstop offset=\'.409\' stop-color=\'%23ef7242\'/%3E%3Cstop offset=\'.654\' stop-color=\'%23ea5a3a\'/%3E%3Cstop offset=\'.911\' stop-color=\'%23e4382e\'/%3E%3Cstop offset=\'1\' stop-color=\'%23e12a29\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23b)\' d=\'M27.068 39.416V16.268l-4.957-3.176L11.583 29.74z\'/%3E%3Cpath opacity=\'.15\' d=\'M11.583 29.74l2.632 1.625 7.896-18.273z\'/%3E%3ClinearGradient id=\'c\' gradientUnits=\'userSpaceOnUse\' x1=\'1896.918\' y1=\'-2571.592\' x2=\'2064.08\' y2=\'-2467.137\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2342ab4a\'/%3E%3Cstop offset=\'1\' stop-color=\'%23add155\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23c)\' d=\'M-10.25-8.583v23.148l5.419 3.175 26.866-6.272z\'/%3E%3ClinearGradient id=\'d\' gradientUnits=\'userSpaceOnUse\' x1=\'1933.576\' y1=\'-2758.292\' x2=\'2069.413\' y2=\'-2540.907\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2342ab4a\'/%3E%3Cstop offset=\'1\' stop-color=\'%23add155\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23d)\' d=\'M-4.985 19.52l-9.599 15.093H8.565l13.546-21.521z\'/%3E%3C/svg%3E&quot;); height: 48px; width: 48px; border-radius: 50%; outline: 0; border: none; background-repeat: no-repeat; background-size: 60%; background-position: center; box-shadow: rgba(18,55,100,0.34) 0 4px 8px; margin: 0; padding: 0; text-indent: -9999px; cursor: pointer; position: fixed; z-index: 10010; margin: 32px; bottom: 0; left: 0; opacity: 0.8; transition: .3s; box-sizing: border-box;\\" onmouseover=\\"this.style.transform=\'scale(1.05)\';\\" onmouseout=\\"this.style.transform=\'initial\'\\";>Fred</a>";
  298. $modx->resource->_output = preg_replace(\'/(<\\/body>(?:<\\/body>)?)/i\', "{$button}\\r\\n$1", $modx->resource->_output);
  299. return;
  300. }
  301. if ($fredMode === 3) {
  302. $modx->resource->_output = \'\';
  303. return;
  304. }
  305. $html = Wa72\\HtmlPageDom\\HtmlPageCrawler::create($modx->resource->_output);
  306. $dzs = $html->filter(\'[data-fred-dropzone]\');
  307. $dzs->each(function(Wa72\\HtmlPageDom\\HtmlPageCrawler $node, $i) {
  308. $node->setInnerHtml(\'\');
  309. });
  310. $modx->resource->_output = $html->saveHTML();
  311. if ($fredMode === 2) {
  312. return;
  313. }
  314. $scripts = $html->filter(\'script\');
  315. $scripts->each(function(Wa72\\HtmlPageDom\\HtmlPageCrawler $node, $i) {
  316. $newNode = Wa72\\HtmlPageDom\\HtmlPageCrawler::create(\'<script-fred></script-fred>\');
  317. $attrs = $node->getNode(0)->attributes;
  318. foreach ($attrs as $attr) {
  319. $newNode->attr($attr->nodeName, $attr->nodeValue);
  320. }
  321. $newNode->setAttribute(\'data-fred-script\', $node->getInnerHtml());
  322. $node->replaceWith($newNode);
  323. });
  324. $modx->resource->_output = $html->saveHTML();
  325. $beforeRenderResults = $modx->invokeEvent(\'FredBeforeRender\');
  326. $includes = \'\';
  327. $beforeRender = \'\';
  328. $lexicons = [];
  329. foreach ($beforeRenderResults as $result) {
  330. if ($result[\'includes\']) {
  331. $includes .= $result[\'includes\'];
  332. }
  333. if ($result[\'beforeRender\']) {
  334. $beforeRender .= $result[\'beforeRender\'];
  335. }
  336. if ($result[\'lexicons\'] && is_array($result[\'lexicons\'])) {
  337. $lexicons = array_merge($lexicons, $result[\'lexicons\']);
  338. }
  339. }
  340. /** @var FredElementRTEConfig[] $rteConfigs */
  341. $rteConfigs = $modx->getIterator(\'FredElementRTEConfig\');
  342. $rteConfigString = [];
  343. foreach ($rteConfigs as $rteConfig) {
  344. if (empty($rteConfig->get(\'data\'))) continue;
  345. $rteConfigString[] = $rteConfig->name . \':\' . $rteConfig->data;
  346. }
  347. $rteConfigString = implode(\',\', $rteConfigString);
  348. $payload = [
  349. \'iss\' => $modx->user->id,
  350. \'resource\' => $modx->resource->id,
  351. \'queryParams\' => $_GET
  352. ];
  353. $jwt = \\Firebase\\JWT\\JWT::encode($payload, $fred->getSecret());
  354. $fredContent = \'
  355. <script type="text/javascript" src="\' . $fred->getOption(\'webAssetsUrl\') . \'fred.min.js"></script>
  356. <link rel="stylesheet" href="\' . $fred->getOption(\'webAssetsUrl\') . \'fred.css" type="text/css" />
  357. \' . $includes . \'
  358. <script>
  359. var fred = new Fred({
  360. theme: \' . $theme->id . \',
  361. assetsUrl: "\' . $fred->getOption(\'webAssetsUrl\') . \'",
  362. managerUrl: "\' . MODX_MANAGER_URL . \'",
  363. fredOffUrl: "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 4]) , \'abs\')) . \'",
  364. contextKey: "\' . $modx->resource->context_key. \'",
  365. launcherPosition: "\' . $fred->getOption(\'launcher_position\') . \'",
  366. iconEditor: "\' . $fred->getOption(\'icon_editor\') . \'",
  367. imageEditor: "\' . $fred->getOption(\'image_editor\') . \'",
  368. rte: "\' . $fred->getOption(\'rte\') . \'",
  369. rteConfig: {\' . $rteConfigString . \'},
  370. jwt: "\' . $jwt . \'",
  371. resource: {
  372. "id": \' . $modx->resource->id . \',
  373. "previewUrl": "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 2]) , \'abs\')) . \'",
  374. "emptyUrl": "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 3]) , \'abs\')) . \'",
  375. "save": \' . (int)$modx->resource->checkPolicy(\'save\') . \',
  376. "delete": \' . (int)$modx->resource->checkPolicy(\'delete\') . \',
  377. "undelete": \' . (int)$modx->resource->checkPolicy(\'undelete\') . \',
  378. "publish": \' . (int)$modx->resource->checkPolicy(\'publish\') . \',
  379. "unpublish": \' . (int)$modx->resource->checkPolicy(\'unpublish\') . \',
  380. },
  381. permission: {
  382. "fred_settings": \' . (int)$modx->hasPermission(\'fred_settings\') . \',
  383. "fred_settings_advanced": \' . (int)$modx->hasPermission(\'fred_settings_advanced\') . \',
  384. "fred_settings_tags": \' . (int)$modx->hasPermission(\'fred_settings_tags\') . \',
  385. "fred_settings_tvs": \' . (int)$modx->hasPermission(\'fred_settings_tvs\') . \',
  386. "fred_elements": \' . (int)$modx->hasPermission(\'fred_elements\') . \',
  387. "fred_blueprints": \' . (int)$modx->hasPermission(\'fred_blueprints\') . \',
  388. "fred_element_screenshot": \' . (int)$modx->hasPermission(\'fred_element_screenshot\') . \',
  389. "fred_element_move": \' . (int)$modx->hasPermission(\'fred_element_move\') . \',
  390. "fred_element_delete": \' . (int)$modx->hasPermission(\'fred_element_delete\') . \',
  391. "fred_blueprint_categories_save": \' . (int)$modx->hasPermission(\'fred_blueprint_categories_save\') . \',
  392. "fred_blueprint_categories_create_public": \' . (int)$modx->hasPermission(\'fred_blueprint_categories_create_public\') . \',
  393. "fred_blueprints_save": \' . (int)$modx->hasPermission(\'fred_blueprints_save\') . \',
  394. "fred_blueprints_create_public": \' . (int)$modx->hasPermission(\'fred_blueprints_create_public\') . \',
  395. "save_document": \' . (int)$modx->hasPermission(\'save_document\') . \',
  396. "delete_document" : \' . (int)$modx->hasPermission(\'delete_document\') . \',
  397. "undelete_document" : \' . (int)$modx->hasPermission(\'undelete_document\') . \',
  398. "publish_document" : \' . (int)$modx->hasPermission(\'publish_document\') . \',
  399. "unpublish_document" : \' . (int)$modx->hasPermission(\'unpublish_document\') . \',
  400. "new_document" : \' . (int)$modx->hasPermission(\'new_document\') . \',
  401. "resource_duplicate" : \' . (int)$modx->hasPermission(\'resource_duplicate\') . \',
  402. "new_document_in_root" : \' . (int)$modx->hasPermission(\'new_document_in_root\') . \'
  403. },
  404. lexicons: \' . json_encode($lexicons) . \',
  405. beforeRender: function() {
  406. \' . $beforeRender . \'
  407. }
  408. });
  409. </script>\';
  410. $modx->resource->_output = preg_replace(\'/(<\\/head>(?:<\\/head>)?)/i\', "{$fredContent}\\r\\n$1", $modx->resource->_output);
  411. }
  412. break;
  413. case \'OnBeforeDocFormSave\':
  414. if ($mode !== \'upd\') return;
  415. if (empty($fred->getTheme($resource->template))) return;
  416. $data = $resource->getProperty(\'data\', \'fred\');
  417. if (!empty($data[\'fingerprint\'])) {
  418. if (empty($resource->fingerprint)) {
  419. $modx->event->_output = \'No fingerprint was provided.\';
  420. return;
  421. }
  422. if ($data[\'fingerprint\'] !== $resource->fingerprint) {
  423. $modx->event->_output = \'Your page is outdated, please reload the page.\';
  424. return;
  425. }
  426. }
  427. break;
  428. case \'OnDocFormSave\':
  429. if ($mode !== \'upd\') return;
  430. if (empty($fred->getTheme($resource->template))) return;
  431. $renderResource = new \\Fred\\RenderResource($resource, $modx);
  432. $renderResource->render();
  433. break;
  434. case \'OnTemplateRemove\':
  435. /** @var modTemplate $template */
  436. $templateId = $template->id;
  437. if (!empty($templateId)) {
  438. /** @var FredThemedTemplate $themedTemplate */
  439. $themedTemplate = $modx->getObject(\'FredThemedTemplate\', [\'template\' => $templateId]);
  440. if ($themedTemplate) {
  441. $themedTemplate->remove();
  442. }
  443. }
  444. break;
  445. case \'OnTVInputRenderList\':
  446. $modx->event->output($corePath . \'elements/tvs/input/\');
  447. break;
  448. case \'OnTVInputPropertiesList\':
  449. $modx->event->output($corePath . \'elements/tvs/input/options/\');
  450. break;
  451. case \'OnManagerPageBeforeRender\':
  452. $modx->controller->addLexiconTopic(\'fred:default\');
  453. break;
  454. }
  455. return;',
  456. 'locked' => 0,
  457. 'properties' => 'a:0:{}',
  458. 'disabled' => 0,
  459. 'moduleguid' => '',
  460. 'static' => 0,
  461. 'static_file' => '',
  462. 'content' => '/*
  463. * This file is part of the Fred package.
  464. *
  465. * Copyright (c) MODX, LLC
  466. *
  467. * For the full copyright and license information, please view the LICENSE
  468. * file that was distributed with this source code.
  469. */
  470. $corePath = $modx->getOption(\'fred.core_path\', null, $modx->getOption(\'core_path\', null, MODX_CORE_PATH) . \'components/fred/\');
  471. /** @var Fred $fred */
  472. $fred = $modx->getService(
  473. \'fred\',
  474. \'Fred\',
  475. $corePath . \'model/fred/\',
  476. array(
  477. \'core_path\' => $corePath
  478. )
  479. );
  480. switch ($modx->event->name) {
  481. case \'OnDocFormPrerender\':
  482. if(!empty($resource) && !empty($fred->getTheme($resource->template))) {
  483. //Disable ContentBlocks
  484. $isContentBlocks = $resource->getProperty(\'_isContentBlocks\', \'contentblocks\', null);
  485. if($isContentBlocks !== false){
  486. $resource->setProperty(\'_isContentBlocks\', false, \'contentblocks\');
  487. $resource->save();
  488. }
  489. $data = $resource->getProperty(\'data\', \'fred\');
  490. $fingerprint = !empty($data[\'fingerprint\']) ? $data[\'fingerprint\'] : \'\';
  491. //Load Open in Fred button
  492. $modx->lexicon->load(\'fred:default\');
  493. $modx->controller->addLexiconTopic(\'fred:default\');
  494. $modx->controller->addHtml("
  495. <script>
  496. Ext.ComponentMgr.onAvailable(\'modx-resource-content\', function(right) {
  497. right.on(\'beforerender\', function() {
  498. var content = Ext.getCmp(\'ta\'),
  499. contentvalue = content.getValue(),
  500. panel = Ext.getCmp(\'modx-page-update-resource\');
  501. content.destroy();
  502. right.insert(0,{
  503. xtype: \'button\'
  504. ,fieldLabel: _(\'fred.open_in_fred\')
  505. ,hideLabel: true
  506. ,cls: \'primary-button\'
  507. ,style: {padding: \'10px 15px\'}
  508. ,html: _(\'fred.open_in_fred\')
  509. ,handler: function(){
  510. window.open(panel.config.preview_url)
  511. }
  512. });
  513. right.insert(1,{
  514. xtype: \'textarea\'
  515. ,hideLabel: true
  516. ,anchor: \'100%\'
  517. ,grow: true
  518. ,style: {marginTop:\'15px\'}
  519. ,disabled: true
  520. ,value: contentvalue
  521. });
  522. });
  523. right.on(\'afterrender\', function() {
  524. var panel = Ext.getCmp(\'modx-panel-resource\');
  525. panel.on(\'success\', function(){
  526. location.reload();
  527. });
  528. var fingerprint = document.createElement(\'input\');
  529. fingerprint.setAttribute(\'type\', \'hidden\');
  530. fingerprint.setAttribute(\'name\', \'fingerprint\');
  531. fingerprint.setAttribute(\'value\', \'" . $fingerprint . "\');
  532. panel.form.el.dom.appendChild(fingerprint);
  533. });
  534. });
  535. </script>");
  536. }
  537. break;
  538. case \'OnLoadWebDocument\':
  539. $theme = $fred->getTheme($modx->resource->template);
  540. if (!empty($theme)) {
  541. $themeUri = $theme->getThemeFolderUri();
  542. $modx->setPlaceholder(\'+fred.theme_dir\', $themeUri);
  543. $modx->setOption(\'fred.theme_dir\', $themeUri);
  544. }
  545. break;
  546. case \'OnWebPagePrerender\':
  547. $theme = $fred->getTheme($modx->resource->template);
  548. if (!empty($theme)) {
  549. if (!$modx->user) return;
  550. if (!($modx->user->hasSessionContext(\'mgr\') || $modx->user->hasSessionContext($modx->resource->context_key))) return;
  551. if (!$modx->hasPermission(\'fred\')) return;
  552. $modx->lexicon->load(\'fred:fe\');
  553. $fredMode = 1;
  554. if (isset($_SESSION[\'fred\'])) {
  555. $fredMode = intval($_SESSION[\'fred\']);
  556. }
  557. if (isset($_GET[\'fred\'])) {
  558. $fredMode = intval($_GET[\'fred\']);
  559. }
  560. if ($fredMode === 4) {
  561. $fredMode = 0;
  562. $_SESSION[\'fred\'] = 0;
  563. }
  564. if ($fredMode === 1) {
  565. $_SESSION[\'fred\'] = 1;
  566. }
  567. $get = $_GET;
  568. unset($get[$modx->getOption(\'request_param_alias\', [], \'q\')]);
  569. if ($fredMode === 0) {
  570. $button = "<a href=\\"" . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 1]) , \'abs\')) . "\\" title=\\"" . $modx->lexicon(\'fred.fe.turn_on_fred\') . "\\" role=\\"button\\" style=\\"display: block; text-decoration: none; background-color: #4D4D4D; background-image: url(&quot;data:image/svg+xml, %3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'48\' height=\'48\' viewBox=\'-14.584 -8.583 48 48\'%3E%3ClinearGradient id=\'a\' gradientUnits=\'userSpaceOnUse\' x1=\'2164.318\' y1=\'-2519.043\' x2=\'2047.448\' y2=\'-2442.941\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2380c3e6\'/%3E%3Cstop offset=\'1\' stop-color=\'%233380c2\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23a)\' d=\'M22.035 11.468l9.602-15.406H8.488L5.236 1.17z\'/%3E%3Cpath opacity=\'.15\' d=\'M5.236 1.17l1.702-2.633 15.097 12.931z\'/%3E%3ClinearGradient id=\'b\' gradientUnits=\'userSpaceOnUse\' x1=\'2184.769\' y1=\'-2694.977\' x2=\'2097.394\' y2=\'-2637.275\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%23f38649\'/%3E%3Cstop offset=\'.185\' stop-color=\'%23f28147\'/%3E%3Cstop offset=\'.409\' stop-color=\'%23ef7242\'/%3E%3Cstop offset=\'.654\' stop-color=\'%23ea5a3a\'/%3E%3Cstop offset=\'.911\' stop-color=\'%23e4382e\'/%3E%3Cstop offset=\'1\' stop-color=\'%23e12a29\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23b)\' d=\'M27.068 39.416V16.268l-4.957-3.176L11.583 29.74z\'/%3E%3Cpath opacity=\'.15\' d=\'M11.583 29.74l2.632 1.625 7.896-18.273z\'/%3E%3ClinearGradient id=\'c\' gradientUnits=\'userSpaceOnUse\' x1=\'1896.918\' y1=\'-2571.592\' x2=\'2064.08\' y2=\'-2467.137\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2342ab4a\'/%3E%3Cstop offset=\'1\' stop-color=\'%23add155\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23c)\' d=\'M-10.25-8.583v23.148l5.419 3.175 26.866-6.272z\'/%3E%3ClinearGradient id=\'d\' gradientUnits=\'userSpaceOnUse\' x1=\'1933.576\' y1=\'-2758.292\' x2=\'2069.413\' y2=\'-2540.907\' gradientTransform=\'matrix(.1471 0 0 -.1471 -290.574 -365.794)\'%3E%3Cstop offset=\'0\' stop-color=\'%2342ab4a\'/%3E%3Cstop offset=\'1\' stop-color=\'%23add155\'/%3E%3C/linearGradient%3E%3Cpath fill=\'url(%23d)\' d=\'M-4.985 19.52l-9.599 15.093H8.565l13.546-21.521z\'/%3E%3C/svg%3E&quot;); height: 48px; width: 48px; border-radius: 50%; outline: 0; border: none; background-repeat: no-repeat; background-size: 60%; background-position: center; box-shadow: rgba(18,55,100,0.34) 0 4px 8px; margin: 0; padding: 0; text-indent: -9999px; cursor: pointer; position: fixed; z-index: 10010; margin: 32px; bottom: 0; left: 0; opacity: 0.8; transition: .3s; box-sizing: border-box;\\" onmouseover=\\"this.style.transform=\'scale(1.05)\';\\" onmouseout=\\"this.style.transform=\'initial\'\\";>Fred</a>";
  571. $modx->resource->_output = preg_replace(\'/(<\\/body>(?:<\\/body>)?)/i\', "{$button}\\r\\n$1", $modx->resource->_output);
  572. return;
  573. }
  574. if ($fredMode === 3) {
  575. $modx->resource->_output = \'\';
  576. return;
  577. }
  578. $html = Wa72\\HtmlPageDom\\HtmlPageCrawler::create($modx->resource->_output);
  579. $dzs = $html->filter(\'[data-fred-dropzone]\');
  580. $dzs->each(function(Wa72\\HtmlPageDom\\HtmlPageCrawler $node, $i) {
  581. $node->setInnerHtml(\'\');
  582. });
  583. $modx->resource->_output = $html->saveHTML();
  584. if ($fredMode === 2) {
  585. return;
  586. }
  587. $scripts = $html->filter(\'script\');
  588. $scripts->each(function(Wa72\\HtmlPageDom\\HtmlPageCrawler $node, $i) {
  589. $newNode = Wa72\\HtmlPageDom\\HtmlPageCrawler::create(\'<script-fred></script-fred>\');
  590. $attrs = $node->getNode(0)->attributes;
  591. foreach ($attrs as $attr) {
  592. $newNode->attr($attr->nodeName, $attr->nodeValue);
  593. }
  594. $newNode->setAttribute(\'data-fred-script\', $node->getInnerHtml());
  595. $node->replaceWith($newNode);
  596. });
  597. $modx->resource->_output = $html->saveHTML();
  598. $beforeRenderResults = $modx->invokeEvent(\'FredBeforeRender\');
  599. $includes = \'\';
  600. $beforeRender = \'\';
  601. $lexicons = [];
  602. foreach ($beforeRenderResults as $result) {
  603. if ($result[\'includes\']) {
  604. $includes .= $result[\'includes\'];
  605. }
  606. if ($result[\'beforeRender\']) {
  607. $beforeRender .= $result[\'beforeRender\'];
  608. }
  609. if ($result[\'lexicons\'] && is_array($result[\'lexicons\'])) {
  610. $lexicons = array_merge($lexicons, $result[\'lexicons\']);
  611. }
  612. }
  613. /** @var FredElementRTEConfig[] $rteConfigs */
  614. $rteConfigs = $modx->getIterator(\'FredElementRTEConfig\');
  615. $rteConfigString = [];
  616. foreach ($rteConfigs as $rteConfig) {
  617. if (empty($rteConfig->get(\'data\'))) continue;
  618. $rteConfigString[] = $rteConfig->name . \':\' . $rteConfig->data;
  619. }
  620. $rteConfigString = implode(\',\', $rteConfigString);
  621. $payload = [
  622. \'iss\' => $modx->user->id,
  623. \'resource\' => $modx->resource->id,
  624. \'queryParams\' => $_GET
  625. ];
  626. $jwt = \\Firebase\\JWT\\JWT::encode($payload, $fred->getSecret());
  627. $fredContent = \'
  628. <script type="text/javascript" src="\' . $fred->getOption(\'webAssetsUrl\') . \'fred.min.js"></script>
  629. <link rel="stylesheet" href="\' . $fred->getOption(\'webAssetsUrl\') . \'fred.css" type="text/css" />
  630. \' . $includes . \'
  631. <script>
  632. var fred = new Fred({
  633. theme: \' . $theme->id . \',
  634. assetsUrl: "\' . $fred->getOption(\'webAssetsUrl\') . \'",
  635. managerUrl: "\' . MODX_MANAGER_URL . \'",
  636. fredOffUrl: "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 4]) , \'abs\')) . \'",
  637. contextKey: "\' . $modx->resource->context_key. \'",
  638. launcherPosition: "\' . $fred->getOption(\'launcher_position\') . \'",
  639. iconEditor: "\' . $fred->getOption(\'icon_editor\') . \'",
  640. imageEditor: "\' . $fred->getOption(\'image_editor\') . \'",
  641. rte: "\' . $fred->getOption(\'rte\') . \'",
  642. rteConfig: {\' . $rteConfigString . \'},
  643. jwt: "\' . $jwt . \'",
  644. resource: {
  645. "id": \' . $modx->resource->id . \',
  646. "previewUrl": "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 2]) , \'abs\')) . \'",
  647. "emptyUrl": "\' . str_replace(\'&amp;\', \'&\', $modx->makeUrl($modx->resource->id, \'\', array_merge($get, [\'fred\' => 3]) , \'abs\')) . \'",
  648. "save": \' . (int)$modx->resource->checkPolicy(\'save\') . \',
  649. "delete": \' . (int)$modx->resource->checkPolicy(\'delete\') . \',
  650. "undelete": \' . (int)$modx->resource->checkPolicy(\'undelete\') . \',
  651. "publish": \' . (int)$modx->resource->checkPolicy(\'publish\') . \',
  652. "unpublish": \' . (int)$modx->resource->checkPolicy(\'unpublish\') . \',
  653. },
  654. permission: {
  655. "fred_settings": \' . (int)$modx->hasPermission(\'fred_settings\') . \',
  656. "fred_settings_advanced": \' . (int)$modx->hasPermission(\'fred_settings_advanced\') . \',
  657. "fred_settings_tags": \' . (int)$modx->hasPermission(\'fred_settings_tags\') . \',
  658. "fred_settings_tvs": \' . (int)$modx->hasPermission(\'fred_settings_tvs\') . \',
  659. "fred_elements": \' . (int)$modx->hasPermission(\'fred_elements\') . \',
  660. "fred_blueprints": \' . (int)$modx->hasPermission(\'fred_blueprints\') . \',
  661. "fred_element_screenshot": \' . (int)$modx->hasPermission(\'fred_element_screenshot\') . \',
  662. "fred_element_move": \' . (int)$modx->hasPermission(\'fred_element_move\') . \',
  663. "fred_element_delete": \' . (int)$modx->hasPermission(\'fred_element_delete\') . \',
  664. "fred_blueprint_categories_save": \' . (int)$modx->hasPermission(\'fred_blueprint_categories_save\') . \',
  665. "fred_blueprint_categories_create_public": \' . (int)$modx->hasPermission(\'fred_blueprint_categories_create_public\') . \',
  666. "fred_blueprints_save": \' . (int)$modx->hasPermission(\'fred_blueprints_save\') . \',
  667. "fred_blueprints_create_public": \' . (int)$modx->hasPermission(\'fred_blueprints_create_public\') . \',
  668. "save_document": \' . (int)$modx->hasPermission(\'save_document\') . \',
  669. "delete_document" : \' . (int)$modx->hasPermission(\'delete_document\') . \',
  670. "undelete_document" : \' . (int)$modx->hasPermission(\'undelete_document\') . \',
  671. "publish_document" : \' . (int)$modx->hasPermission(\'publish_document\') . \',
  672. "unpublish_document" : \' . (int)$modx->hasPermission(\'unpublish_document\') . \',
  673. "new_document" : \' . (int)$modx->hasPermission(\'new_document\') . \',
  674. "resource_duplicate" : \' . (int)$modx->hasPermission(\'resource_duplicate\') . \',
  675. "new_document_in_root" : \' . (int)$modx->hasPermission(\'new_document_in_root\') . \'
  676. },
  677. lexicons: \' . json_encode($lexicons) . \',
  678. beforeRender: function() {
  679. \' . $beforeRender . \'
  680. }
  681. });
  682. </script>\';
  683. $modx->resource->_output = preg_replace(\'/(<\\/head>(?:<\\/head>)?)/i\', "{$fredContent}\\r\\n$1", $modx->resource->_output);
  684. }
  685. break;
  686. case \'OnBeforeDocFormSave\':
  687. if ($mode !== \'upd\') return;
  688. if (empty($fred->getTheme($resource->template))) return;
  689. $data = $resource->getProperty(\'data\', \'fred\');
  690. if (!empty($data[\'fingerprint\'])) {
  691. if (empty($resource->fingerprint)) {
  692. $modx->event->_output = \'No fingerprint was provided.\';
  693. return;
  694. }
  695. if ($data[\'fingerprint\'] !== $resource->fingerprint) {
  696. $modx->event->_output = \'Your page is outdated, please reload the page.\';
  697. return;
  698. }
  699. }
  700. break;
  701. case \'OnDocFormSave\':
  702. if ($mode !== \'upd\') return;
  703. if (empty($fred->getTheme($resource->template))) return;
  704. $renderResource = new \\Fred\\RenderResource($resource, $modx);
  705. $renderResource->render();
  706. break;
  707. case \'OnTemplateRemove\':
  708. /** @var modTemplate $template */
  709. $templateId = $template->id;
  710. if (!empty($templateId)) {
  711. /** @var FredThemedTemplate $themedTemplate */
  712. $themedTemplate = $modx->getObject(\'FredThemedTemplate\', [\'template\' => $templateId]);
  713. if ($themedTemplate) {
  714. $themedTemplate->remove();
  715. }
  716. }
  717. break;
  718. case \'OnTVInputRenderList\':
  719. $modx->event->output($corePath . \'elements/tvs/input/\');
  720. break;
  721. case \'OnTVInputPropertiesList\':
  722. $modx->event->output($corePath . \'elements/tvs/input/options/\');
  723. break;
  724. case \'OnManagerPageBeforeRender\':
  725. $modx->controller->addLexiconTopic(\'fred:default\');
  726. break;
  727. }
  728. return;',
  729. ),
  730. ),
  731. 'a0f4192e60d8cc6038bbb32254ad6896' =>
  732. array (
  733. 'criteria' =>
  734. array (
  735. 'pluginid' => 14,
  736. 'event' => 'OnWebPagePrerender',
  737. ),
  738. 'object' =>
  739. array (
  740. 'pluginid' => 14,
  741. 'event' => 'OnWebPagePrerender',
  742. 'priority' => 0,
  743. 'propertyset' => 0,
  744. ),
  745. ),
  746. 'dfaedf785eab506f6b48f37c84e53714' =>
  747. array (
  748. 'criteria' =>
  749. array (
  750. 'pluginid' => 14,
  751. 'event' => 'OnDocFormPrerender',
  752. ),
  753. 'object' =>
  754. array (
  755. 'pluginid' => 14,
  756. 'event' => 'OnDocFormPrerender',
  757. 'priority' => 0,
  758. 'propertyset' => 0,
  759. ),
  760. ),
  761. '501111671ee829b4eb1e037381ebbd95' =>
  762. array (
  763. 'criteria' =>
  764. array (
  765. 'pluginid' => 14,
  766. 'event' => 'OnDocFormSave',
  767. ),
  768. 'object' =>
  769. array (
  770. 'pluginid' => 14,
  771. 'event' => 'OnDocFormSave',
  772. 'priority' => 0,
  773. 'propertyset' => 0,
  774. ),
  775. ),
  776. 'e8f6b20202e9416e30a454a6c1d5888f' =>
  777. array (
  778. 'criteria' =>
  779. array (
  780. 'pluginid' => 14,
  781. 'event' => 'OnBeforeDocFormSave',
  782. ),
  783. 'object' =>
  784. array (
  785. 'pluginid' => 14,
  786. 'event' => 'OnBeforeDocFormSave',
  787. 'priority' => 0,
  788. 'propertyset' => 0,
  789. ),
  790. ),
  791. '51e45e7d35ca8da67bd6512f1c12a5b5' =>
  792. array (
  793. 'criteria' =>
  794. array (
  795. 'pluginid' => 14,
  796. 'event' => 'OnTemplateRemove',
  797. ),
  798. 'object' =>
  799. array (
  800. 'pluginid' => 14,
  801. 'event' => 'OnTemplateRemove',
  802. 'priority' => 0,
  803. 'propertyset' => 0,
  804. ),
  805. ),
  806. 'd40c0e6d1d8d1648c963a68cde3798d4' =>
  807. array (
  808. 'criteria' =>
  809. array (
  810. 'pluginid' => 14,
  811. 'event' => 'OnLoadWebDocument',
  812. ),
  813. 'object' =>
  814. array (
  815. 'pluginid' => 14,
  816. 'event' => 'OnLoadWebDocument',
  817. 'priority' => 0,
  818. 'propertyset' => 0,
  819. ),
  820. ),
  821. '6a7f166b5c0ab6d45db23e30d83c1271' =>
  822. array (
  823. 'criteria' =>
  824. array (
  825. 'pluginid' => 14,
  826. 'event' => 'OnTVInputRenderList',
  827. ),
  828. 'object' =>
  829. array (
  830. 'pluginid' => 14,
  831. 'event' => 'OnTVInputRenderList',
  832. 'priority' => 0,
  833. 'propertyset' => 0,
  834. ),
  835. ),
  836. 'da2e9bb714656f59c006ff47c6d9f864' =>
  837. array (
  838. 'criteria' =>
  839. array (
  840. 'pluginid' => 14,
  841. 'event' => 'OnTVInputPropertiesList',
  842. ),
  843. 'object' =>
  844. array (
  845. 'pluginid' => 14,
  846. 'event' => 'OnTVInputPropertiesList',
  847. 'priority' => 0,
  848. 'propertyset' => 0,
  849. ),
  850. ),
  851. 'ec13d93ab8ec9930ac9afb5f2e60acfb' =>
  852. array (
  853. 'criteria' =>
  854. array (
  855. 'pluginid' => 14,
  856. 'event' => 'OnManagerPageBeforeRender',
  857. ),
  858. 'object' =>
  859. array (
  860. 'pluginid' => 14,
  861. 'event' => 'OnManagerPageBeforeRender',
  862. 'priority' => 0,
  863. 'propertyset' => 0,
  864. ),
  865. ),
  866. '80956ebc997d6cdb547f0466311f2610' =>
  867. array (
  868. 'criteria' =>
  869. array (
  870. 'text' => 'fred.menu.fred',
  871. ),
  872. 'object' =>
  873. array (
  874. 'text' => 'fred.menu.fred',
  875. 'parent' => 'components',
  876. 'action' => 'home',
  877. 'description' => 'fred.menu.fred_desc',
  878. 'icon' => '',
  879. 'menuindex' => 0,
  880. 'params' => '',
  881. 'handler' => '',
  882. 'permissions' => 'fred',
  883. 'namespace' => 'fred',
  884. ),
  885. ),
  886. );