Skip to content

Commit ee50e5b

Browse files
committed
Update for Symphony 2.3.3.
1 parent eba468c commit ee50e5b

File tree

8 files changed

+43
-23
lines changed

8 files changed

+43
-23
lines changed

LICENCE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2008-2012 Marcin Konicki
1+
Copyright 2008-2013 Marcin Konicki
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.markdown

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Templated Text Formatters
22

3-
- Version: 1.8
3+
- Version: 1.9
44
- Author: Marcin Konicki (http://ahwayakchih.neoni.net)
5-
- Build Date: 22 June 2012
6-
- Requirements: Symphony 2.3 or greater.
5+
- Build Date: 26 July 2013
6+
- Requirements: Symphony 2.3.3 or greater.
77
- Text rendered on screenshots was rendered with Lobster font (http://www.impallari.com/lobster/) created by Pablo Impallari.
88

99

@@ -17,6 +17,7 @@
1717

1818
## Changelog
1919

20+
- **1.9** Update for Symphony 2.3.3. This may break compatibility with Symphony 2.3. Updated Markdown template.
2021
- **1.8** Update for Symphony 2.3. This drops compatibility with Symphony 2.2. Removed Makrell formatter (Makrell project is dead). Fixed a bug in XSLT template (error when there was no utility found).
2122
- **1.7** New template: XSLT.
2223
- **1.6** Update for Symphony 2.2, fixed few bugs, updated Markdown template, added new template: Makrell, changed this README to Markdown syntax.

content/content.edit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public function __construct() {
2121
}
2222

2323
public function view() {
24+
Administration::instance()->Page->addScriptToHead(URL . '/extensions/templatedtextformatters/assets/templatedtextformatters.settings.js', 101, false);
25+
2426
$about = array();
2527
if ($this->_context[0] && !is_object($this->formatter)) {
2628
$this->formatter = TextformatterManager::create($this->_context[0]);

extension.driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
public function about() {
88
return array('name' => __('Templated Text Formatters'),
9-
'version' => '1.8',
10-
'release-date' => '2012-06-22',
9+
'version' => '1.9',
10+
'release-date' => '2013-07-26',
1111
'author' => array('name' => 'Marcin Konicki',
1212
'website' => 'http://ahwayakchih.neoni.net',
1313
'email' => 'ahwayakchih@neoni.net'),

extension.meta.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
</author>
1717
</authors>
1818
<releases>
19+
<release version="1.9" date="2013-07-26" min="2.3.3">
20+
- Update for Symphony 2.3.3. This may break compatibility with Symphony 2.3.
21+
- Updated Markdown template.
22+
</release>
1923
<release version="1.8" date="2012-06-22" min="2.3">
2024
- Update for Symphony 2.3. This drops compatibility with Symphony 2.2.
2125
- Removed Makrell formatter (Makrell project is dead).

template/formatter.chain.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
$subsection->appendChild($p);
9191

9292
$ol = new XMLElement('ol');
93-
$ol->setAttribute('id', 'fields-duplicator');
93+
$ol->setAttribute('id', 'formatters-duplicator');
94+
$ol->setAttribute('class', 'templatedtextformatter-duplicator');
9495
$ol->setAttribute('data-add', __('Add formatter'));
9596
$ol->setAttribute('data-remove', __('Remove formatter'));
9697

template/formatter.markdown.tpl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
if (!$string) return $string;
4545

4646
if (!isset(self::$_markdown)) {
47-
if (!file_exists(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.5/markdown.php')) {
47+
if (!file_exists(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.7/markdown.php')) {
4848
self::$_markdown = false;
4949
}
5050
else {
51-
@include_once(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.5/markdown.php');
51+
@include_once(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.7/markdown.php');
5252
if ($this->_use_markdownextra == 'yes') {
5353
self::$_markdown = new MarkdownExtra_Parser();
5454
self::$_markdown->fn_link_class = $this->_use_link_class;
@@ -59,13 +59,15 @@
5959
}
6060

6161
if ($this->_use_smartypants == 'yes' && !function_exists('SmartyPants')) {
62-
if (file_exists(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1e/smartypants.php')) @include_once(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1e/smartypants.php');
62+
if (file_exists(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1f/smartypants.php')) {
63+
@include_once(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1f/smartypants.php');
64+
}
6365
else $this->_use_smartypants = false;
6466
}
6567

6668
if ($this->_use_htmlpurifier == 'yes' && !function_exists('HTMLPurifier')) {
67-
if (file_exists(EXTENSIONS . '/markdown/lib/htmlpurifier-4.4.0-standalone/HTMLPurifier.standalone.php')) {
68-
@include_once(EXTENSIONS . '/markdown/lib/htmlpurifier-4.4.0-standalone/HTMLPurifier.standalone.php');
69+
if (file_exists(EXTENSIONS . '/markdown/lib/htmlpurifier-4.5.0-standalone/HTMLPurifier.standalone.php')) {
70+
@include_once(EXTENSIONS . '/markdown/lib/htmlpurifier-4.5.0-standalone/HTMLPurifier.standalone.php');
6971
self::$_purifier = new HTMLPurifier();
7072
}
7173
else {

template/formatter.regex.tpl

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,43 @@
4141
// Hook for driver to call when generating edit form
4242
// Add form fields to $form
4343
public function ttf_form(&$form, &$page) {
44+
$p = new XMLElement('p', __('Wrap patterns with slashes, e.g., "/pattern_here/". You can use backreferences in replacement. Syntax for pattern and replacement is exactly the same as in <a href="http://www.php.net/manual/en/function.preg-replace.php" target="_blank">preg_replace()</a> PHP function.'));
45+
$p->setAttribute('class', 'help');
46+
$form->appendChild($p);
47+
4448
$subsection = new XMLElement('div');
45-
$subsection->setAttribute('class', 'subsection');
49+
$subsection->setAttribute('class', 'frame');
4650
$p = new XMLElement('p', __('Patterns and replacements'));
4751
$p->setAttribute('class', 'label');
4852
$subsection->appendChild($p);
4953

5054
$ol = new XMLElement('ol');
51-
$ol->setAttribute('id', 'fields-duplicator');
55+
$ol->setAttribute('id', 'regex-duplicator');
56+
$ol->setAttribute('class', 'templatedtextformatter-duplicator');
57+
$ol->setAttribute('data-add', __('Add regex'));
58+
$ol->setAttribute('data-remove', __('Remove regex'));
5259

5360
$temp = $this->_patterns;
5461
$temp[''] = '';
5562
foreach ($temp as $pattern => $replacement) {
5663
$li = new XMLElement('li');
57-
$li->setAttribute('class', ($pattern ? 'unique field-regex' : ' template field-regex'));
58-
$li->appendChild(new XMLElement('h4', __('Replace')));
64+
$li->setAttribute('class', ($pattern ? 'field-regex' : 'template field-regex'));
65+
$li->setAttribute('data-type', 'regex');
66+
67+
$header = new XMLElement('header', NULL, array('class' => 'main', 'data-name' => __('Replace')));
68+
$header->appendChild(new XMLElement('h4', '<strong>' . __('Replace') . '</strong> <span class="type">' . __('regex') . '</span>'));
69+
$li->appendChild($header);
5970

6071
$div = new XMLElement('div');
61-
$div->setAttribute('class', 'group');
72+
$div->setAttribute('class', 'two columns');
6273

63-
$label = Widget::Label(__('Pattern'));
74+
$label = Widget::Label(__('Find with pattern'));
75+
$label->setAttribute('class', 'column');
6476
$label->appendChild(Widget::Input('fields[patterns][]', htmlentities($pattern, ENT_QUOTES, 'UTF-8')));
6577
$div->appendChild($label);
6678

67-
$label = Widget::Label(__('Replacement'));
79+
$label = Widget::Label(__('Replace with'));
80+
$label->setAttribute('class', 'column');
6881
$label->appendChild(Widget::Input('fields[replacements][]', htmlentities($replacement, ENT_QUOTES, 'UTF-8')));
6982
$div->appendChild($label);
7083

@@ -74,10 +87,6 @@
7487

7588
$subsection->appendChild($ol);
7689
$form->appendChild($subsection);
77-
78-
$p = new XMLElement('p', __('Wrap patterns with slashes, e.g., "/pattern_here/". You can use backreferences in replacement. Syntax for pattern and replacement is exactly the same as in <a href="http://www.php.net/manual/en/function.preg-replace.php" target="_blank">preg_replace()</a> function in PHP.'));
79-
$p->setAttribute('class', 'help');
80-
$form->appendChild($p);
8190
}
8291

8392
// Hook called by TemplatedTextFormatters when generating formatter
@@ -92,6 +101,7 @@
92101
$code = '';
93102
if (!empty($_POST['fields']['patterns']) && count($_POST['fields']['patterns']) == count($_POST['fields']['replacements'])) {
94103
$this->_patterns = array_combine($_POST['fields']['patterns'], $_POST['fields']['replacements']);
104+
unset($this->_patterns['']);
95105
}
96106
}
97107

0 commit comments

Comments
 (0)