Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fenom soft mode. #295

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _build/build.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
define('PKG_NAME', 'pdoTools');
define('PKG_NAME_LOWER', strtolower(PKG_NAME));

define('PKG_VERSION', '2.12.3');
define('PKG_VERSION', '2.13.0');
define('PKG_RELEASE', 'pl');
define('PKG_AUTO_INSTALL', true);

Expand Down
4 changes: 4 additions & 0 deletions _build/data/transport.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
'xtype' => 'combo-boolean',
'value' => false,
),
'fenom_soft_mode' => array(
'xtype' => 'combo-boolean',
'value' => true,
),

'elements_path' => array(
'xtype' => 'textfield',
Expand Down
4 changes: 4 additions & 0 deletions core/components/pdotools/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog for pdoTools.

2.13.0 pl
==============
- Add Fenom soft mode. This option, when compiling a Fenom tag error, enables the output of this tag as is. To inverse JS / JSON.

2.12.3 pl
==============
- Fixed E_NOTICE introduced in #285.
Expand Down
4 changes: 3 additions & 1 deletion core/components/pdotools/lexicon/de/default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
$_lang['setting_pdotools_fenom_cache'] = 'Caching verarbeiteter Chunks';
$_lang['setting_pdotools_fenom_cache_desc'] = 'Wenn Sie große und komplexe Fenom-Chunks verwenden, können Sie das Caching der verarbeiteten Versionen aktivieren. Diese werden nur aktualisiert, wenn Sie den System-Cache leeren. Nicht empfohlen während der Entwicklung der Website.';
$_lang['setting_pdotools_fenom_save_on_errors'] = 'Fehlermeldungen speichern';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Aktivieren Sie diese Einstellung, um die Fenom-Compiler-Fehlermeldungen im Verzeichnis "core/cache/default/pdotools/error" zum späteren Debuggen zu speichern.';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Aktivieren Sie diese Einstellung, um die Fenom-Compiler-Fehlermeldungen im Verzeichnis "core/cache/default/pdotools/error" zum späteren Debuggen zu speichern.';
$_lang['setting_pdotools_fenom_soft_mode'] = 'Fenom soft mode';
$_lang['setting_pdotools_fenom_soft_mode_desc'] = 'Diese Option aktiviert beim Kompilieren eines Fenom-Tag-Fehlers die Ausgabe dieses Tags wie sie ist. Um JS / JSON zu invertieren.';
4 changes: 3 additions & 1 deletion core/components/pdotools/lexicon/en/default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
$_lang['setting_pdotools_fenom_cache'] = 'Caching compiled chunks';
$_lang['setting_pdotools_fenom_cache_desc'] = 'If you use large and complex Fenom chunks, you can enable caching of its compiled versions. They will be updated only when you clear the system cache. Not recommended for the development of the site.';
$_lang['setting_pdotools_fenom_save_on_errors'] = 'Save errors';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Enable this option to save Fenom compilation errors to the "core/cache/default/pdotools/error" directory for later debugging.';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Enable this option to save Fenom compilation errors to the "core/cache/default/pdotools/error" directory for later debugging.';
$_lang['setting_pdotools_fenom_soft_mode'] = 'Fenom soft mode';
$_lang['setting_pdotools_fenom_soft_mode_desc'] = 'This option, when compiling a Fenom tag error, enables the output of this tag as is. To inverse JS / JSON.';
4 changes: 3 additions & 1 deletion core/components/pdotools/lexicon/ru/default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@
$_lang['setting_pdotools_fenom_cache'] = 'Кэширование скомпилированных чанков';
$_lang['setting_pdotools_fenom_cache_desc'] = 'Если вы используете большие и сложные чанки Fenom, то можно включить кэширование их скомпилированных версий. Они будут обновляться только при очистке системного кэша. Не рекомендуется при разработке сайта.';
$_lang['setting_pdotools_fenom_save_on_errors'] = 'Сохранять ошибки';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Включите эту опцию, чтобы сохранять ошибки компиляции Fenom в директорию "core/cache/default/pdotools/error" для последующей отладки.';
$_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Включите эту опцию, чтобы сохранять ошибки компиляции Fenom в директорию "core/cache/default/pdotools/error" для последующей отладки.';
$_lang['setting_pdotools_fenom_soft_mode'] = 'Fenom soft mode';
$_lang['setting_pdotools_fenom_soft_mode_desc'] = 'Эта опция, при ошибки компиляции тега Fenom, включает вывод этого тега как есть. Для иногрирования JS/JSON.';
3 changes: 3 additions & 0 deletions core/components/pdotools/model/pdotools/_fenom.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function __construct(pdoTools $pdoTools)
if (!$pdoTools->config['useFenomPHP']) {
$this->removeAccessor('php');
$options['disable_native_funcs'] = true;
}
if ($pdoTools->config['useFenomSoftMode']) {
$options['modx_soft_mode'] = $pdoTools->config['useFenomSoftMode'];
}
$this->setOptions($options);

Expand Down
10 changes: 9 additions & 1 deletion core/components/pdotools/model/pdotools/pdotools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public function setConfig(array $config = array(), $clean_timings = true)
$this->config['useFenomCache'] = $this->modx->getOption('pdotools_fenom_cache', null, false);
$this->config['useFenomMODX'] = $this->modx->getOption('pdotools_fenom_modx', null, false);
$this->config['useFenomPHP'] = $this->modx->getOption('pdotools_fenom_php', null, false);

$this->config['useFenomSoftMode'] = $this->modx->getOption('pdotools_fenom_soft_mode', null, false);

// Prepare paths
$pl = array(
'core_path' => MODX_CORE_PATH,
Expand Down Expand Up @@ -984,6 +985,13 @@ protected function _compileChunk($content, $name = '')
}
try {
$tpl = $fenom->getRawTemplate()->source($name, $content, true);
if($this->config['useFenomSoftMode']){
if($tpl->getError()){
if($this->modx->getOption('pdotools_fenom_save_on_errors'))
$this->modx->log(modX::LOG_LEVEL_ERROR, 'Error compile Fenom chunk with name "' . $name . '": ' . $tpl->getError());
$this->addTime('Error compile Fenom chunk with name "' . $name . '": ' . $tpl->getError());
}
}
$this->addTime('Compiled Fenom chunk with name "' . $name . '"');
} catch (Exception $e) {
$this->modx->log(modX::LOG_LEVEL_ERROR, $e->getMessage());
Expand Down