Nav apraksta

Template.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. <?php
  2. namespace MailPoet\WooCommerce\TransactionalEmails;
  3. if (!defined('ABSPATH')) exit;
  4. use MailPoet\Config\Env;
  5. class Template {
  6. public function create($wcEmailSettings) {
  7. $socialIconUrl = Env::$assetsUrl . '/img/newsletter_editor/social-icons';
  8. return [
  9. 'content' =>
  10. [
  11. 'type' => 'container',
  12. 'columnLayout' => false,
  13. 'orientation' => 'vertical',
  14. 'image' =>
  15. [
  16. 'src' => null,
  17. 'display' => 'scale',
  18. ],
  19. 'styles' =>
  20. [
  21. 'block' =>
  22. [
  23. 'backgroundColor' => 'transparent',
  24. ],
  25. ],
  26. 'blocks' =>
  27. [
  28. 0 =>
  29. [
  30. 'type' => 'container',
  31. 'columnLayout' => false,
  32. 'orientation' => 'horizontal',
  33. 'image' =>
  34. [
  35. 'src' => null,
  36. 'display' => 'scale',
  37. ],
  38. 'styles' =>
  39. [
  40. 'block' =>
  41. [
  42. 'backgroundColor' => 'transparent',
  43. ],
  44. ],
  45. 'blocks' =>
  46. [
  47. 0 =>
  48. [
  49. 'type' => 'container',
  50. 'columnLayout' => false,
  51. 'orientation' => 'vertical',
  52. 'image' =>
  53. [
  54. 'src' => null,
  55. 'display' => 'scale',
  56. ],
  57. 'styles' =>
  58. [
  59. 'block' =>
  60. [
  61. 'backgroundColor' => 'transparent',
  62. ],
  63. ],
  64. 'blocks' =>
  65. [
  66. 0 =>
  67. [
  68. 'type' => 'spacer',
  69. 'styles' =>
  70. [
  71. 'block' =>
  72. [
  73. 'backgroundColor' => 'transparent',
  74. 'height' => '20px',
  75. ],
  76. ],
  77. ],
  78. 1 =>
  79. [
  80. 'type' => 'image',
  81. 'link' => '',
  82. 'src' => $wcEmailSettings['header_image'],
  83. 'alt' => '',
  84. 'fullWidth' => false,
  85. 'width' => '180px',
  86. 'height' => '362px',
  87. 'styles' =>
  88. [
  89. 'block' =>
  90. [
  91. 'textAlign' => 'center',
  92. ],
  93. ],
  94. ],
  95. 2 =>
  96. [
  97. 'type' => 'spacer',
  98. 'styles' =>
  99. [
  100. 'block' =>
  101. [
  102. 'backgroundColor' => 'transparent',
  103. 'height' => '20px',
  104. ],
  105. ],
  106. ],
  107. ],
  108. ],
  109. ],
  110. ],
  111. 1 =>
  112. [
  113. 'type' => 'woocommerceHeading',
  114. ],
  115. 2 =>
  116. [
  117. 'type' => 'container',
  118. 'columnLayout' => false,
  119. 'orientation' => 'horizontal',
  120. 'image' =>
  121. [
  122. 'src' => null,
  123. 'display' => 'scale',
  124. ],
  125. 'styles' =>
  126. [
  127. 'block' =>
  128. [
  129. 'backgroundColor' => 'transparent',
  130. ],
  131. ],
  132. 'blocks' =>
  133. [
  134. 0 =>
  135. [
  136. 'type' => 'container',
  137. 'columnLayout' => false,
  138. 'orientation' => 'vertical',
  139. 'image' =>
  140. [
  141. 'src' => null,
  142. 'display' => 'scale',
  143. ],
  144. 'styles' =>
  145. [
  146. 'block' =>
  147. [
  148. 'backgroundColor' => 'transparent',
  149. ],
  150. ],
  151. 'blocks' =>
  152. [
  153. 0 =>
  154. [
  155. 'type' => 'spacer',
  156. 'styles' =>
  157. [
  158. 'block' =>
  159. [
  160. 'backgroundColor' => 'transparent',
  161. 'height' => '20px',
  162. ],
  163. ],
  164. ],
  165. ],
  166. ],
  167. ],
  168. ],
  169. 3 =>
  170. [
  171. 'type' => 'woocommerceContent',
  172. ],
  173. 4 =>
  174. [
  175. 'type' => 'container',
  176. 'columnLayout' => false,
  177. 'orientation' => 'horizontal',
  178. 'image' =>
  179. [
  180. 'src' => null,
  181. 'display' => 'scale',
  182. ],
  183. 'styles' =>
  184. [
  185. 'block' =>
  186. [
  187. 'backgroundColor' => 'transparent',
  188. ],
  189. ],
  190. 'blocks' =>
  191. [
  192. 0 =>
  193. [
  194. 'type' => 'container',
  195. 'columnLayout' => false,
  196. 'orientation' => 'vertical',
  197. 'image' =>
  198. [
  199. 'src' => null,
  200. 'display' => 'scale',
  201. ],
  202. 'styles' =>
  203. [
  204. 'block' =>
  205. [
  206. 'backgroundColor' => 'transparent',
  207. ],
  208. ],
  209. 'blocks' =>
  210. [
  211. 0 =>
  212. [
  213. 'type' => 'spacer',
  214. 'styles' =>
  215. [
  216. 'block' =>
  217. [
  218. 'backgroundColor' => 'transparent',
  219. 'height' => '20px',
  220. ],
  221. ],
  222. ],
  223. ],
  224. ],
  225. ],
  226. ],
  227. 5 =>
  228. [
  229. 'type' => 'container',
  230. 'columnLayout' => false,
  231. 'orientation' => 'horizontal',
  232. 'image' =>
  233. [
  234. 'src' => null,
  235. 'display' => 'scale',
  236. ],
  237. 'styles' =>
  238. [
  239. 'block' =>
  240. [
  241. 'backgroundColor' => 'transparent',
  242. ],
  243. ],
  244. 'blocks' =>
  245. [
  246. 0 =>
  247. [
  248. 'type' => 'container',
  249. 'columnLayout' => false,
  250. 'orientation' => 'vertical',
  251. 'image' =>
  252. [
  253. 'src' => null,
  254. 'display' => 'scale',
  255. ],
  256. 'styles' =>
  257. [
  258. 'block' =>
  259. [
  260. 'backgroundColor' => 'transparent',
  261. ],
  262. ],
  263. 'blocks' =>
  264. [
  265. 0 =>
  266. [
  267. 'type' => 'spacer',
  268. 'styles' =>
  269. [
  270. 'block' =>
  271. [
  272. 'backgroundColor' => 'transparent',
  273. 'height' => '20px',
  274. ],
  275. ],
  276. ],
  277. 1 =>
  278. [
  279. 'type' => 'text',
  280. 'text' => '<p style="text-align: center;">' . $wcEmailSettings['footer_text'] . '</p>',
  281. ],
  282. ],
  283. ],
  284. ],
  285. ],
  286. ],
  287. ],
  288. 'globalStyles' =>
  289. [
  290. 'text' =>
  291. [
  292. 'fontColor' => $wcEmailSettings['text_color'],
  293. 'fontFamily' => 'Arial',
  294. 'fontSize' => '14px',
  295. 'lineHeight' => '1.6',
  296. ],
  297. 'h1' =>
  298. [
  299. 'fontColor' => $wcEmailSettings['base_color'],
  300. 'fontFamily' => 'Source Sans Pro',
  301. 'fontSize' => '36px',
  302. 'lineHeight' => '1.6',
  303. ],
  304. 'h2' =>
  305. [
  306. 'fontColor' => $wcEmailSettings['base_color'],
  307. 'fontFamily' => 'Verdana',
  308. 'fontSize' => '24px',
  309. 'lineHeight' => '1.6',
  310. ],
  311. 'h3' =>
  312. [
  313. 'fontColor' => $wcEmailSettings['base_color'],
  314. 'fontFamily' => 'Trebuchet MS',
  315. 'fontSize' => '22px',
  316. 'lineHeight' => '1.6',
  317. ],
  318. 'link' =>
  319. [
  320. 'fontColor' => $wcEmailSettings['link_color'],
  321. 'textDecoration' => 'underline',
  322. ],
  323. 'wrapper' =>
  324. [
  325. 'backgroundColor' => $wcEmailSettings['body_background_color'],
  326. ],
  327. 'body' =>
  328. [
  329. 'backgroundColor' => $wcEmailSettings['background_color'],
  330. ],
  331. 'woocommerce' =>
  332. [
  333. 'brandingColor' => $wcEmailSettings['base_color'],
  334. 'headingFontColor' => $wcEmailSettings['base_text_color'],
  335. ],
  336. ],
  337. 'blockDefaults' =>
  338. [
  339. 'automatedLatestContent' =>
  340. [
  341. 'amount' => '5',
  342. 'withLayout' => false,
  343. 'contentType' => 'post',
  344. 'inclusionType' => 'include',
  345. 'displayType' => 'excerpt',
  346. 'titleFormat' => 'h1',
  347. 'titleAlignment' => 'left',
  348. 'titleIsLink' => false,
  349. 'imageFullWidth' => false,
  350. 'featuredImagePosition' => 'belowTitle',
  351. 'showAuthor' => 'no',
  352. 'authorPrecededBy' => 'Author:',
  353. 'showCategories' => 'no',
  354. 'categoriesPrecededBy' => 'Categories:',
  355. 'readMoreType' => 'button',
  356. 'readMoreText' => 'Read more',
  357. 'readMoreButton' =>
  358. [
  359. 'text' => 'Read more',
  360. 'url' => '[postLink]',
  361. 'context' => 'automatedLatestContent.readMoreButton',
  362. 'styles' =>
  363. [
  364. 'block' =>
  365. [
  366. 'backgroundColor' => '#2ea1cd',
  367. 'borderColor' => '#0074a2',
  368. 'borderWidth' => '1px',
  369. 'borderRadius' => '5px',
  370. 'borderStyle' => 'solid',
  371. 'width' => '180px',
  372. 'lineHeight' => '40px',
  373. 'fontColor' => '#ffffff',
  374. 'fontFamily' => 'Verdana',
  375. 'fontSize' => '18px',
  376. 'fontWeight' => 'normal',
  377. 'textAlign' => 'center',
  378. ],
  379. ],
  380. ],
  381. 'sortBy' => 'newest',
  382. 'showDivider' => true,
  383. 'divider' =>
  384. [
  385. 'context' => 'automatedLatestContent.divider',
  386. 'styles' =>
  387. [
  388. 'block' =>
  389. [
  390. 'backgroundColor' => 'transparent',
  391. 'padding' => '13px',
  392. 'borderStyle' => 'solid',
  393. 'borderWidth' => '3px',
  394. 'borderColor' => '#aaaaaa',
  395. ],
  396. ],
  397. ],
  398. 'backgroundColor' => '#ffffff',
  399. 'backgroundColorAlternate' => '#eeeeee',
  400. ],
  401. 'automatedLatestContentLayout' =>
  402. [
  403. 'amount' => '5',
  404. 'withLayout' => true,
  405. 'contentType' => 'post',
  406. 'inclusionType' => 'include',
  407. 'displayType' => 'excerpt',
  408. 'titleFormat' => 'h1',
  409. 'titleAlignment' => 'left',
  410. 'titleIsLink' => false,
  411. 'imageFullWidth' => false,
  412. 'featuredImagePosition' => 'alternate',
  413. 'showAuthor' => 'no',
  414. 'authorPrecededBy' => 'Author:',
  415. 'showCategories' => 'no',
  416. 'categoriesPrecededBy' => 'Categories:',
  417. 'readMoreType' => 'button',
  418. 'readMoreText' => 'Read more',
  419. 'readMoreButton' =>
  420. [
  421. 'text' => 'Read more',
  422. 'url' => '[postLink]',
  423. 'context' => 'automatedLatestContentLayout.readMoreButton',
  424. 'styles' =>
  425. [
  426. 'block' =>
  427. [
  428. 'backgroundColor' => '#2ea1cd',
  429. 'borderColor' => '#0074a2',
  430. 'borderWidth' => '1px',
  431. 'borderRadius' => '5px',
  432. 'borderStyle' => 'solid',
  433. 'width' => '180px',
  434. 'lineHeight' => '40px',
  435. 'fontColor' => '#ffffff',
  436. 'fontFamily' => 'Verdana',
  437. 'fontSize' => '18px',
  438. 'fontWeight' => 'normal',
  439. 'textAlign' => 'center',
  440. ],
  441. ],
  442. ],
  443. 'sortBy' => 'newest',
  444. 'showDivider' => true,
  445. 'divider' =>
  446. [
  447. 'context' => 'automatedLatestContentLayout.divider',
  448. 'styles' =>
  449. [
  450. 'block' =>
  451. [
  452. 'backgroundColor' => 'transparent',
  453. 'padding' => '13px',
  454. 'borderStyle' => 'solid',
  455. 'borderWidth' => '3px',
  456. 'borderColor' => '#aaaaaa',
  457. ],
  458. ],
  459. ],
  460. 'backgroundColor' => '#ffffff',
  461. 'backgroundColorAlternate' => '#eeeeee',
  462. ],
  463. 'button' =>
  464. [
  465. 'text' => 'Button',
  466. 'url' => '',
  467. 'styles' =>
  468. [
  469. 'block' =>
  470. [
  471. 'backgroundColor' => '#2ea1cd',
  472. 'borderColor' => '#0074a2',
  473. 'borderWidth' => '1px',
  474. 'borderRadius' => '5px',
  475. 'borderStyle' => 'solid',
  476. 'width' => '180px',
  477. 'lineHeight' => '40px',
  478. 'fontColor' => '#ffffff',
  479. 'fontFamily' => 'Verdana',
  480. 'fontSize' => '18px',
  481. 'fontWeight' => 'normal',
  482. 'textAlign' => 'center',
  483. ],
  484. ],
  485. ],
  486. 'divider' =>
  487. [
  488. 'styles' =>
  489. [
  490. 'block' =>
  491. [
  492. 'backgroundColor' => 'transparent',
  493. 'padding' => '13px',
  494. 'borderStyle' => 'solid',
  495. 'borderWidth' => '3px',
  496. 'borderColor' => '#aaaaaa',
  497. ],
  498. ],
  499. ],
  500. 'footer' =>
  501. [
  502. 'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Add your postal address here!</p>',
  503. 'styles' =>
  504. [
  505. 'block' =>
  506. [
  507. 'backgroundColor' => 'transparent',
  508. ],
  509. 'text' =>
  510. [
  511. 'fontColor' => '#222222',
  512. 'fontFamily' => 'Arial',
  513. 'fontSize' => '12px',
  514. 'textAlign' => 'center',
  515. ],
  516. 'link' =>
  517. [
  518. 'fontColor' => '#6cb7d4',
  519. 'textDecoration' => 'none',
  520. ],
  521. ],
  522. ],
  523. 'posts' =>
  524. [
  525. 'amount' => '10',
  526. 'withLayout' => true,
  527. 'contentType' => 'post',
  528. 'postStatus' => 'publish',
  529. 'inclusionType' => 'include',
  530. 'displayType' => 'excerpt',
  531. 'titleFormat' => 'h1',
  532. 'titleAlignment' => 'left',
  533. 'titleIsLink' => false,
  534. 'imageFullWidth' => false,
  535. 'featuredImagePosition' => 'alternate',
  536. 'showAuthor' => 'no',
  537. 'authorPrecededBy' => 'Author:',
  538. 'showCategories' => 'no',
  539. 'categoriesPrecededBy' => 'Categories:',
  540. 'readMoreType' => 'link',
  541. 'readMoreText' => 'Read more',
  542. 'readMoreButton' =>
  543. [
  544. 'text' => 'Read more',
  545. 'url' => '[postLink]',
  546. 'context' => 'posts.readMoreButton',
  547. 'styles' =>
  548. [
  549. 'block' =>
  550. [
  551. 'backgroundColor' => '#2ea1cd',
  552. 'borderColor' => '#0074a2',
  553. 'borderWidth' => '1px',
  554. 'borderRadius' => '5px',
  555. 'borderStyle' => 'solid',
  556. 'width' => '180px',
  557. 'lineHeight' => '40px',
  558. 'fontColor' => '#ffffff',
  559. 'fontFamily' => 'Verdana',
  560. 'fontSize' => '18px',
  561. 'fontWeight' => 'normal',
  562. 'textAlign' => 'center',
  563. ],
  564. ],
  565. ],
  566. 'sortBy' => 'newest',
  567. 'showDivider' => true,
  568. 'divider' =>
  569. [
  570. 'context' => 'posts.divider',
  571. 'styles' =>
  572. [
  573. 'block' =>
  574. [
  575. 'backgroundColor' => 'transparent',
  576. 'padding' => '13px',
  577. 'borderStyle' => 'solid',
  578. 'borderWidth' => '3px',
  579. 'borderColor' => '#aaaaaa',
  580. ],
  581. ],
  582. ],
  583. 'backgroundColor' => '#ffffff',
  584. 'backgroundColorAlternate' => '#eeeeee',
  585. ],
  586. 'products' =>
  587. [
  588. 'amount' => '10',
  589. 'withLayout' => true,
  590. 'contentType' => 'product',
  591. 'postStatus' => 'publish',
  592. 'inclusionType' => 'include',
  593. 'displayType' => 'excerpt',
  594. 'titleFormat' => 'h1',
  595. 'titleAlignment' => 'left',
  596. 'titleIsLink' => false,
  597. 'imageFullWidth' => false,
  598. 'featuredImagePosition' => 'alternate',
  599. 'pricePosition' => 'below',
  600. 'readMoreType' => 'link',
  601. 'readMoreText' => 'Buy now',
  602. 'readMoreButton' =>
  603. [
  604. 'text' => 'Buy now',
  605. 'url' => '[postLink]',
  606. 'context' => 'posts.readMoreButton',
  607. 'styles' =>
  608. [
  609. 'block' =>
  610. [
  611. 'backgroundColor' => '#2ea1cd',
  612. 'borderColor' => '#0074a2',
  613. 'borderWidth' => '1px',
  614. 'borderRadius' => '5px',
  615. 'borderStyle' => 'solid',
  616. 'width' => '180px',
  617. 'lineHeight' => '40px',
  618. 'fontColor' => '#ffffff',
  619. 'fontFamily' => 'Verdana',
  620. 'fontSize' => '18px',
  621. 'fontWeight' => 'normal',
  622. 'textAlign' => 'center',
  623. ],
  624. ],
  625. ],
  626. 'sortBy' => 'newest',
  627. 'showDivider' => true,
  628. 'divider' =>
  629. [
  630. 'context' => 'posts.divider',
  631. 'styles' =>
  632. [
  633. 'block' =>
  634. [
  635. 'backgroundColor' => 'transparent',
  636. 'padding' => '13px',
  637. 'borderStyle' => 'solid',
  638. 'borderWidth' => '3px',
  639. 'borderColor' => '#aaaaaa',
  640. ],
  641. ],
  642. ],
  643. 'backgroundColor' => '#ffffff',
  644. 'backgroundColorAlternate' => '#eeeeee',
  645. ],
  646. 'social' =>
  647. [
  648. 'iconSet' => 'default',
  649. 'styles' =>
  650. [
  651. 'block' =>
  652. [
  653. 'textAlign' => 'center',
  654. ],
  655. ],
  656. 'icons' =>
  657. [
  658. 0 =>
  659. [
  660. 'type' => 'socialIcon',
  661. 'iconType' => 'facebook',
  662. 'link' => 'http://www.facebook.com',
  663. 'image' => $socialIconUrl . '/01-social/Facebook.png',
  664. 'height' => '32px',
  665. 'width' => '32px',
  666. 'text' => 'Facebook',
  667. ],
  668. 1 =>
  669. [
  670. 'type' => 'socialIcon',
  671. 'iconType' => 'twitter',
  672. 'link' => 'http://www.twitter.com',
  673. 'image' => $socialIconUrl . '/01-social/Twitter.png',
  674. 'height' => '32px',
  675. 'width' => '32px',
  676. 'text' => 'Twitter',
  677. ],
  678. ],
  679. ],
  680. 'spacer' =>
  681. [
  682. 'styles' =>
  683. [
  684. 'block' =>
  685. [
  686. 'backgroundColor' => 'transparent',
  687. 'height' => '20px',
  688. ],
  689. ],
  690. 'type' => 'spacer',
  691. ],
  692. 'header' =>
  693. [
  694. 'text' => 'Display problems?&nbsp;<a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser.</a>',
  695. 'styles' =>
  696. [
  697. 'block' =>
  698. [
  699. 'backgroundColor' => 'transparent',
  700. ],
  701. 'text' =>
  702. [
  703. 'fontColor' => '#222222',
  704. 'fontFamily' => 'Arial',
  705. 'fontSize' => '12px',
  706. 'textAlign' => 'center',
  707. ],
  708. 'link' =>
  709. [
  710. 'fontColor' => '#6cb7d4',
  711. 'textDecoration' => 'underline',
  712. ],
  713. ],
  714. ],
  715. ],
  716. ];
  717. }
  718. }