2022-12-05 21:39:13 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2022-12-05 21:42:34 +00:00
|
|
|
|
if (!defined('DC_RC_PATH')) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Clearbricks::lib()->autoload([
|
|
|
|
|
'dcTemplator' => __DIR__ . '/inc/class.templator.php',
|
2022-12-07 00:07:56 +00:00
|
|
|
|
'templatorMedia' => __DIR__ . '/inc/class.templator.media.php',
|
2022-12-05 21:42:34 +00:00
|
|
|
|
'pagerTemplator' => __DIR__ . '/inc/admin.pager.templator.php',
|
|
|
|
|
]);
|
2022-12-05 21:39:13 +00:00
|
|
|
|
|
2022-12-05 21:42:34 +00:00
|
|
|
|
dcCore::app()->templator = new dcTemplator();
|
2022-12-05 21:39:13 +00:00
|
|
|
|
|
2022-12-05 21:42:34 +00:00
|
|
|
|
dcCore::app()->addBehavior('initWidgets', ['templatorWidgets', 'initWidgets']);
|
2022-12-05 21:39:13 +00:00
|
|
|
|
|
|
|
|
|
class templatorWidgets
|
|
|
|
|
{
|
2022-12-05 21:42:34 +00:00
|
|
|
|
public static function initWidgets($w)
|
|
|
|
|
{
|
|
|
|
|
$w->create('templatorWidget', __('Templator › Rendering'), ['widgetTemplator', 'getDataTpl']);
|
|
|
|
|
$tpl = [' .html' => ''];
|
|
|
|
|
foreach (dcCore::app()->templator->tpl as $k => $v) {
|
|
|
|
|
if (preg_match('/^widget-(.+)$/', $k)) {
|
|
|
|
|
$tpl = array_merge($tpl, [$k => $k]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$w->templatorWidget->setting('template', __('Template:'), '', 'combo', $tpl);
|
|
|
|
|
}
|
2022-12-05 21:39:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class widgetTemplator
|
|
|
|
|
{
|
2022-12-05 21:42:34 +00:00
|
|
|
|
public static function getDataTpl($w)
|
|
|
|
|
{
|
|
|
|
|
if (dcCore::app()->tpl->getFilePath($w->template)) {
|
|
|
|
|
echo dcCore::app()->tpl->getData($w->template);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-05 21:39:13 +00:00
|
|
|
|
}
|