Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. {% if cart['shipping'] %}
  2. {% for line in cart['shipping'] %}
  3. <tr>
  4. <td colspan="7">Shipping ({{ line['text'] }})</td>
  5. <td>US${{ line['money'] }}</td>
  6. </tr>
  7. {% endfor %}
  8. {% endif %}
  9.  
  10. <html>
  11. <body>
  12. <h3>Order #{{ purchase.number }} was cancelled</h3>
  13. <p>Order content:</p>
  14. <table>
  15. <tr>
  16. <th>Line</th>
  17. <th>Item #</th>
  18. <th>Product Name</th>
  19. <th>Shipping</th>
  20. <th>UOM</th>
  21. <th>Unit Price</th>
  22. <th>Quantity</th>
  23. <th>Subtotal</th>
  24. </tr>
  25. {% for line in cart['cart'] %}
  26. <tr>
  27. <td>{{ line['LineNo'] }}</td>
  28. <td>{{ line['ItemNo'] }}</td>
  29. <td>{{ line['ProductName'] }}</td>
  30. <td>{{ line['Shipping'] }}</td>
  31. <td>{{ line['UOM'] }}</td>
  32. <td>US${{ line['UnitPrice'] }}</td>
  33. <td>{{ line['Quantity'] }}</td>
  34. <td>US${{ line['Subtotal'] }}</td>
  35. </tr>
  36. {% endfor %}
  37. {% if cart['shipping'] %}
  38. {% for line in cart['shipping'] %}
  39. <tr>
  40. <td colspan="7">Shipping ({{ line['text'] }})</td>
  41. <td>US${{ line['money'] }}</td>
  42. </tr>
  43. {% endfor %}
  44. {% endif %}
  45. <tr>
  46. <td colspan="7"><b>Order Item Total:</b></td>
  47. <td>US${{ cart['total'] }}</td>
  48. </tr>
  49. </table>
  50. </body>
  51. </html>
  52.  
  53. <h3>Order #{{ purchase.number }} was cancelled</h3>
  54.  
  55. <p>Order content:</p>
  56. {% for line in cart[&#39;cart&#39;] %} {% endfor %} {% if cart[&#39;shipping&#39;] %} {% for line in cart[&#39;shipping&#39;] %} {% endfor %} {% endif %}
  57.  
  58. <table>
  59. <tbody>
  60. <tr>
  61. <th>Line</th>
  62. <th>Item #</th>
  63. <th>Product Name</th>
  64. <th>Shipping</th>
  65. <th>UOM</th>
  66. <th>Unit Price</th>
  67. <th>Quantity</th>
  68. <th>Subtotal</th>
  69. </tr>
  70. <tr>
  71. <td>{{ line[&#39;LineNo&#39;] }}</td>
  72. <td>{{ line[&#39;ItemNo&#39;] }}</td>
  73. <td>{{ line[&#39;ProductName&#39;] }}</td>
  74. <td>{{ line[&#39;Shipping&#39;] }}</td>
  75. <td>{{ line[&#39;UOM&#39;] }}</td>
  76. <td>US${{ line[&#39;UnitPrice&#39;] }}</td>
  77. <td>{{ line[&#39;Quantity&#39;] }}</td>
  78. <td>US${{ line[&#39;Subtotal&#39;] }}</td>
  79. </tr>
  80. <tr>
  81. <td colspan="7">Shipping ({{ line[&#39;text&#39;] }})</td>
  82. <td>US${{ line[&#39;money&#39;] }}</td>
  83. </tr>
  84. <tr>
  85. <td colspan="7"><b>Order Item Total:</b></td>
  86. <td>US${{ cart[&#39;total&#39;] }}</td>
  87. </tr>
  88. </tbody>
  89. </table>
  90.  
  91. {% if cart['shipping'] %}
  92. {% for line in cart['shipping'] %}
  93. <tr>
  94.  
  95. {% for line in cart[&#39;cart&#39;] %} {% endfor %} {% if cart[&#39;shipping&#39;] %} {% for line in cart[&#39;shipping&#39;] %} {% endfor %} {% endif %}
  96.  
  97. CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
  98. CKEDITOR.config.entities = false;
  99.  
  100. CKEDITOR.config.forcePasteAsPlainText = false; // default so content won't be manipulated on load
  101. CKEDITOR.config.basicEntities = true;
  102. CKEDITOR.config.entities = true;
  103. CKEDITOR.config.entities_latin = false;
  104. CKEDITOR.config.entities_greek = false;
  105. CKEDITOR.config.entities_processNumerical = false;
  106. CKEDITOR.config.fillEmptyBlocks = function (element) {
  107. return true; // DON'T DO ANYTHING!!!!!
  108. };
  109.  
  110. CKEDITOR.config.protectedSource.push(/{%s.+s%}/g);
  111.  
  112. CKEDITOR.config.protectedSource.push(/{{s.+s}}/g);
  113. CKEDITOR.config.protectedSource.push(/{%s.+s%}/g);
  114.  
  115. /**
  116. * Before we persist the data, we need to clean up any twig tags in there as the editor encodes html entities...
  117. *
  118. * @param Request $request
  119. * @param $form
  120. * @param EmailTemplates $entity
  121. */
  122. public function onBeforePersist(Request $request, $form, $entity)
  123. {
  124. $template = $entity->getView();
  125.  
  126. $re = '/{({|%)([^{}]|(?R))*(}|%)}/';
  127. preg_match_all($re, $template, $matches, PREG_SET_ORDER, 0);
  128.  
  129. // We only want the first element of each match - I don't like closures as a rule on readability grounds, but this is small enough to be ok.
  130. array_walk($matches,function(&$value) {
  131. if (array($value)) {
  132. $value = $value[0];
  133. }
  134. });
  135.  
  136. // Now do a replace on them
  137. foreach ($matches as $match) {
  138. $decoded = html_entity_decode($match,ENT_QUOTES);
  139. if ($match != $decoded) {
  140. // Only replace if we have actually changed the string
  141. $template = str_replace($match, $decoded, $template);
  142. }
  143. }
  144.  
  145. // Update the View...
  146. $entity->setView($template);
  147. }
  148.  
  149. CKEDITOR.config.protectedSource = [
  150. /{{[sS]*?}}/g,
  151. /{%[sS]*?%}/g,
  152. /{#[sS]*?#}/g,
  153. ];
  154.  
  155. CKEDITOR.config.entities = false;
  156. CKEDITOR.config.entities = true;
  157.  
  158. CKEDITOR.config.protectedSource.push(/{{[sS]*?}}/g);
  159. CKEDITOR.config.protectedSource.push(/{%[sS]*?%}/g);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement