Skip to content

Commit

Permalink
Update for Symphony 2.3.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwayakchih committed Jul 27, 2013
1 parent eba468c commit ee50e5b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion LICENCE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2008-2012 Marcin Konicki
Copyright 2008-2013 Marcin Konicki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 4 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Templated Text Formatters

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


Expand All @@ -17,6 +17,7 @@

## Changelog

- **1.9** Update for Symphony 2.3.3. This may break compatibility with Symphony 2.3. Updated Markdown template.
- **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).
- **1.7** New template: XSLT.
- **1.6** Update for Symphony 2.2, fixed few bugs, updated Markdown template, added new template: Makrell, changed this README to Markdown syntax.
Expand Down
2 changes: 2 additions & 0 deletions content/content.edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public function __construct() {
}

public function view() {
Administration::instance()->Page->addScriptToHead(URL . '/extensions/templatedtextformatters/assets/templatedtextformatters.settings.js', 101, false);

$about = array();
if ($this->_context[0] && !is_object($this->formatter)) {
$this->formatter = TextformatterManager::create($this->_context[0]);
Expand Down
4 changes: 2 additions & 2 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public function about() {
return array('name' => __('Templated Text Formatters'),
'version' => '1.8',
'release-date' => '2012-06-22',
'version' => '1.9',
'release-date' => '2013-07-26',
'author' => array('name' => 'Marcin Konicki',
'website' => 'http://ahwayakchih.neoni.net',
'email' => 'ahwayakchih@neoni.net'),
Expand Down
4 changes: 4 additions & 0 deletions extension.meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
</author>
</authors>
<releases>
<release version="1.9" date="2013-07-26" min="2.3.3">
- Update for Symphony 2.3.3. This may break compatibility with Symphony 2.3.
- Updated Markdown template.
</release>
<release version="1.8" date="2012-06-22" min="2.3">
- Update for Symphony 2.3. This drops compatibility with Symphony 2.2.
- Removed Makrell formatter (Makrell project is dead).
Expand Down
3 changes: 2 additions & 1 deletion template/formatter.chain.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
$subsection->appendChild($p);

$ol = new XMLElement('ol');
$ol->setAttribute('id', 'fields-duplicator');
$ol->setAttribute('id', 'formatters-duplicator');
$ol->setAttribute('class', 'templatedtextformatter-duplicator');
$ol->setAttribute('data-add', __('Add formatter'));
$ol->setAttribute('data-remove', __('Remove formatter'));

Expand Down
12 changes: 7 additions & 5 deletions template/formatter.markdown.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
if (!$string) return $string;
if (!isset(self::$_markdown)) {
if (!file_exists(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.5/markdown.php')) {
if (!file_exists(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.7/markdown.php')) {
self::$_markdown = false;
}
else {
@include_once(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.5/markdown.php');
@include_once(EXTENSIONS . '/markdown/lib/php-markdown-extra-1.2.7/markdown.php');
if ($this->_use_markdownextra == 'yes') {
self::$_markdown = new MarkdownExtra_Parser();
self::$_markdown->fn_link_class = $this->_use_link_class;
Expand All @@ -59,13 +59,15 @@
}

if ($this->_use_smartypants == 'yes' && !function_exists('SmartyPants')) {
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');
if (file_exists(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1f/smartypants.php')) {
@include_once(EXTENSIONS . '/markdown/lib/php-smartypants-1.5.1f/smartypants.php');
}
else $this->_use_smartypants = false;
}

if ($this->_use_htmlpurifier == 'yes' && !function_exists('HTMLPurifier')) {
if (file_exists(EXTENSIONS . '/markdown/lib/htmlpurifier-4.4.0-standalone/HTMLPurifier.standalone.php')) {
@include_once(EXTENSIONS . '/markdown/lib/htmlpurifier-4.4.0-standalone/HTMLPurifier.standalone.php');
if (file_exists(EXTENSIONS . '/markdown/lib/htmlpurifier-4.5.0-standalone/HTMLPurifier.standalone.php')) {
@include_once(EXTENSIONS . '/markdown/lib/htmlpurifier-4.5.0-standalone/HTMLPurifier.standalone.php');
self::$_purifier = new HTMLPurifier();
}
else {
Expand Down
32 changes: 21 additions & 11 deletions template/formatter.regex.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,43 @@
// Hook for driver to call when generating edit form
// Add form fields to $form
public function ttf_form(&$form, &$page) {
$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.'));
$p->setAttribute('class', 'help');
$form->appendChild($p);
$subsection = new XMLElement('div');
$subsection->setAttribute('class', 'subsection');
$subsection->setAttribute('class', 'frame');
$p = new XMLElement('p', __('Patterns and replacements'));
$p->setAttribute('class', 'label');
$subsection->appendChild($p);
$ol = new XMLElement('ol');
$ol->setAttribute('id', 'fields-duplicator');
$ol->setAttribute('id', 'regex-duplicator');
$ol->setAttribute('class', 'templatedtextformatter-duplicator');
$ol->setAttribute('data-add', __('Add regex'));
$ol->setAttribute('data-remove', __('Remove regex'));
$temp = $this->_patterns;
$temp[''] = '';
foreach ($temp as $pattern => $replacement) {
$li = new XMLElement('li');
$li->setAttribute('class', ($pattern ? 'unique field-regex' : ' template field-regex'));
$li->appendChild(new XMLElement('h4', __('Replace')));
$li->setAttribute('class', ($pattern ? 'field-regex' : 'template field-regex'));
$li->setAttribute('data-type', 'regex');
$header = new XMLElement('header', NULL, array('class' => 'main', 'data-name' => __('Replace')));
$header->appendChild(new XMLElement('h4', '<strong>' . __('Replace') . '</strong> <span class="type">' . __('regex') . '</span>'));
$li->appendChild($header);
$div = new XMLElement('div');
$div->setAttribute('class', 'group');
$div->setAttribute('class', 'two columns');
$label = Widget::Label(__('Pattern'));
$label = Widget::Label(__('Find with pattern'));
$label->setAttribute('class', 'column');
$label->appendChild(Widget::Input('fields[patterns][]', htmlentities($pattern, ENT_QUOTES, 'UTF-8')));
$div->appendChild($label);
$label = Widget::Label(__('Replacement'));
$label = Widget::Label(__('Replace with'));
$label->setAttribute('class', 'column');
$label->appendChild(Widget::Input('fields[replacements][]', htmlentities($replacement, ENT_QUOTES, 'UTF-8')));
$div->appendChild($label);
Expand All @@ -74,10 +87,6 @@

$subsection->appendChild($ol);
$form->appendChild($subsection);

$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.'));
$p->setAttribute('class', 'help');
$form->appendChild($p);
}

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

Expand Down

0 comments on commit ee50e5b

Please sign in to comment.