upgrade to Dotclear 2.28
This commit is contained in:
parent
cc1cf73347
commit
3ffacaeb98
@ -1,3 +1,9 @@
|
|||||||
|
cinecturlink2 2.1 - 2023.10.15
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1+
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
cinecturlink2 2.0 - 2023.08.24
|
cinecturlink2 2.0 - 2023.08.24
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
@ -16,7 +16,7 @@ It is hightly based on cinecturlink for Dotclear 1 by Tigroux and maintain by br
|
|||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
* Dotclear 2.27
|
* Dotclear 2.28
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
* Dotclear admin permission for configuration
|
* Dotclear admin permission for configuration
|
||||||
* Dotclear contentadmin permission for management
|
* Dotclear contentadmin permission for management
|
||||||
|
36
_define.php
36
_define.php
@ -1,41 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin cinecturlink2 definition
|
||||||
|
* @ingroup cinecturlink2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup cinecturlink2 Plugin cinecturlink2.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and Contributors
|
* Widgets and pages about books, musics, films, blogs you are interested in
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Taken from cinecturlink for Dotclear 1
|
* Taken from cinecturlink for Dotclear 1
|
||||||
* By Tigroux and Brol
|
* By Tigroux and Brol
|
||||||
* Under GNU GPL 2.0 license
|
* Under GNU GPL 2.0 license
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
if (!defined('DC_RC_PATH')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Cinecturlink 2',
|
'Cinecturlink 2',
|
||||||
'Widgets and pages about books, musics, films, blogs you are interested in',
|
'Widgets and pages about books, musics, films, blogs you are interested in',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'2.0',
|
'2.1',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [['core', '2.28']],
|
||||||
['php', '8.1'],
|
'settings' => ['blog' => '#params.' . basename(__DIR__) . '_params'],
|
||||||
['core', '2.27'],
|
'permissions' => 'My',
|
||||||
],
|
|
||||||
'settings' => [
|
|
||||||
'blog' => '#params.' . basename(__DIR__) . '_params',
|
|
||||||
],
|
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
|
||||||
]),
|
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
|
21
_init.php
21
_init.php
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class initCinecturlink2
|
|
||||||
{
|
|
||||||
public const CINECTURLINK_TABLE_NAME = 'cinecturlink2';
|
|
||||||
public const CATEGORY_TABLE_NAME = 'cinecturlink2_cat';
|
|
||||||
}
|
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="cinecturlink2">
|
<module id="cinecturlink2">
|
||||||
<name>Cinecturlink 2</name>
|
<name>Cinecturlink 2</name>
|
||||||
<version>2.0</version>
|
<version>2.1</version>
|
||||||
<author>Jean-Christian Denis and Contributors</author>
|
<author>Jean-Christian Denis and Contributors</author>
|
||||||
<desc>Widgets and pages about books, musics, films, blogs you are interested in</desc>
|
<desc>Widgets and pages about books, musics, films, blogs you are interested in</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/cinecturlink2/releases/download/v2.0/plugin-cinecturlink2.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/cinecturlink2/releases/download/v2.1/plugin-cinecturlink2.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/cinecturlink2/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/cinecturlink2/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/cinecturlink2/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/cinecturlink2/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcSettings;
|
use Dotclear\Core\BlogSettings;
|
||||||
use Dotclear\Core\Backend\Favorites;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
@ -32,6 +22,13 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 backend class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -47,10 +44,8 @@ class Backend extends Process
|
|||||||
|
|
||||||
My::addBackendMenuItem();
|
My::addBackendMenuItem();
|
||||||
|
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initLinks']);
|
App::behavior()->addBehaviors([
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initCats']);
|
'initWidgets' => Widgets::init(...),
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
|
||||||
'adminColumnsListsV2' => function (ArrayObject $cols) {
|
'adminColumnsListsV2' => function (ArrayObject $cols) {
|
||||||
$cols[My::id()] = [
|
$cols[My::id()] = [
|
||||||
My::name(),
|
My::name(),
|
||||||
@ -89,13 +84,13 @@ class Backend extends Process
|
|||||||
'url' => My::manageUrl() . '#links',
|
'url' => My::manageUrl() . '#links',
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => My::icons(),
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]),
|
'permissions' => App::auth()->makePermissions([App::auth()::PERMISSION_CONTENT_ADMIN]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {
|
'adminBlogPreferencesFormV2' => function (BlogSettings $blog_settings): void {
|
||||||
$s = $blog_settings->get(My::id());
|
$s = $blog_settings->get(My::id());
|
||||||
$url = (string) dcCore::app()->blog?->url . dcCore::app()->url->getBase(My::id());
|
$url = App::blog()->url() . App::url()->getBase(My::id());
|
||||||
$public_nbrpp = (int) $s->get('public_nbrpp');
|
$public_nbrpp = (int) $s->get('public_nbrpp');
|
||||||
if ($public_nbrpp < 1) {
|
if ($public_nbrpp < 1) {
|
||||||
$public_nbrpp = 10;
|
$public_nbrpp = 10;
|
||||||
@ -202,7 +197,7 @@ class Backend extends Process
|
|||||||
->render();
|
->render();
|
||||||
},
|
},
|
||||||
|
|
||||||
'adminBeforeBlogSettingsUpdate' => function (dcSettings $blog_settings): void {
|
'adminBeforeBlogSettingsUpdate' => function (BlogSettings $blog_settings): void {
|
||||||
$s = $blog_settings->get(My::id());
|
$s = $blog_settings->get(My::id());
|
||||||
$active = !empty($_POST[My::id() . 'active']);
|
$active = !empty($_POST[My::id() . 'active']);
|
||||||
$widthmax = abs((int) $_POST[My::id() . 'widthmax']);
|
$widthmax = abs((int) $_POST[My::id() . 'widthmax']);
|
||||||
@ -218,12 +213,12 @@ class Backend extends Process
|
|||||||
$public_nbrpp = 10;
|
$public_nbrpp = 10;
|
||||||
}
|
}
|
||||||
if (empty($folder)) {
|
if (empty($folder)) {
|
||||||
dcCore::app()->error->add(__('You must provide a specific folder for images.'));
|
App::error()->add(__('You must provide a specific folder for images.'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Utils::makePublicDir(
|
Utils::makePublicDir(
|
||||||
DC_ROOT . '/' . dcCore::app()->blog?->settings->get('system')->get('public_path'),
|
App::config()->dotclearRoot() . '/' . App::blog()->settings()->get('system')->get('public_path'),
|
||||||
$folder,
|
$folder,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\Action\Actions;
|
use Dotclear\Core\Backend\Action\Actions;
|
||||||
use Dotclear\Core\Backend\Page;
|
use Dotclear\Core\Backend\Page;
|
||||||
use Dotclear\Database\MetaRecord;
|
use Dotclear\Database\MetaRecord;
|
||||||
@ -25,9 +15,16 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 links action class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class BackendActionsLinks extends Actions
|
class BackendActionsLinks extends Actions
|
||||||
{
|
{
|
||||||
protected $use_render = true;
|
protected bool $use_render = true;
|
||||||
public Utils $utils;
|
public Utils $utils;
|
||||||
|
|
||||||
public function __construct(string $uri, array $redirect_args = [])
|
public function __construct(string $uri, array $redirect_args = [])
|
||||||
@ -49,7 +46,7 @@ class BackendActionsLinks extends Actions
|
|||||||
BackendActionsLinksDefault::addDefaultLinksActions($this);
|
BackendActionsLinksDefault::addDefaultLinksActions($this);
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2AddDefaultLinksActions - BackendActionsLinks
|
# --BEHAVIOR-- cinecturlink2AddDefaultLinksActions - BackendActionsLinks
|
||||||
dcCore::app()->callBehavior('cinecturlink2AddDefaultLinksActions', $this);
|
App::behavior()->callBehavior('cinecturlink2AddDefaultLinksActions', $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beginPage(string $breadcrumb = '', string $head = ''): void
|
public function beginPage(string $breadcrumb = '', string $head = ''): void
|
||||||
@ -75,7 +72,7 @@ class BackendActionsLinks extends Actions
|
|||||||
|
|
||||||
public function error(Exception $e): void
|
public function error(Exception $e): void
|
||||||
{
|
{
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
$this->beginPage(
|
$this->beginPage(
|
||||||
Page::breadcrumb([
|
Page::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -31,21 +21,28 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 links default action class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class BackendActionsLinksDefault
|
class BackendActionsLinksDefault
|
||||||
{
|
{
|
||||||
public static function addDefaultLinksActions(BackendActionsLinks $ap): void
|
public static function addDefaultLinksActions(BackendActionsLinks $ap): void
|
||||||
{
|
{
|
||||||
$ap->addAction(
|
$ap->addAction(
|
||||||
[__('Delete') => 'dellinks'],
|
[__('Delete') => 'dellinks'],
|
||||||
[self::class, 'doDeleteLinks']
|
self::doDeleteLinks(...)
|
||||||
);
|
);
|
||||||
$ap->addAction(
|
$ap->addAction(
|
||||||
[__('Change rating') => 'updlinksnote'],
|
[__('Change rating') => 'updlinksnote'],
|
||||||
[self::class, 'doChangeNote']
|
self::doChangeNote(...)
|
||||||
);
|
);
|
||||||
$ap->addAction(
|
$ap->addAction(
|
||||||
[__('Change category') => 'updlinkscat'],
|
[__('Change category') => 'updlinkscat'],
|
||||||
[self::class, 'doChangeCategory']
|
self::doChangeCategory(...)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +84,7 @@ class BackendActionsLinksDefault
|
|||||||
|
|
||||||
$cat_id = is_numeric($post['upd_cat_id']) ? abs((int) $post['upd_cat_id']) : null;
|
$cat_id = is_numeric($post['upd_cat_id']) ? abs((int) $post['upd_cat_id']) : null;
|
||||||
|
|
||||||
$cur = dcCore::app()->con->openCursor($ap->utils->table);
|
$cur = App::con()->openCursor($ap->utils->table);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur->clean();
|
$cur->clean();
|
||||||
$cur->setField('cat_id', $cat_id == 0 ? null : $cat_id);
|
$cur->setField('cat_id', $cat_id == 0 ? null : $cat_id);
|
||||||
@ -125,7 +122,7 @@ class BackendActionsLinksDefault
|
|||||||
(new Submit('do-action'))
|
(new Submit('do-action'))
|
||||||
->value(__('Save')),
|
->value(__('Save')),
|
||||||
(new Hidden(['action'], 'updlinkscat')),
|
(new Hidden(['action'], 'updlinkscat')),
|
||||||
dcCore::app()->formNonce(false),
|
App::nonce()->formNonce(),
|
||||||
]
|
]
|
||||||
)),
|
)),
|
||||||
|
|
||||||
@ -152,7 +149,7 @@ class BackendActionsLinksDefault
|
|||||||
$link_note = 10;
|
$link_note = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cur = dcCore::app()->con->openCursor($ap->utils->table);
|
$cur = App::con()->openCursor($ap->utils->table);
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$cur->clean();
|
$cur->clean();
|
||||||
$cur->setField('link_note', $link_note);
|
$cur->setField('link_note', $link_note);
|
||||||
@ -190,7 +187,7 @@ class BackendActionsLinksDefault
|
|||||||
(new Submit('do-action'))
|
(new Submit('do-action'))
|
||||||
->value(__('Save')),
|
->value(__('Save')),
|
||||||
(new Hidden(['action'], 'updlinksnote')),
|
(new Hidden(['action'], 'updlinksnote')),
|
||||||
dcCore::app()->formNonce(false),
|
App::nonce()->formNonce(),
|
||||||
]
|
]
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\Filter\Filters;
|
use Dotclear\Core\Backend\Filter\Filters;
|
||||||
use Dotclear\Core\Backend\Listing\{
|
use Dotclear\Core\Backend\Listing\{
|
||||||
Listing,
|
Listing,
|
||||||
@ -33,6 +23,13 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 links list class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class BackendListingLinks extends Listing
|
class BackendListingLinks extends Listing
|
||||||
{
|
{
|
||||||
private string $redir;
|
private string $redir;
|
||||||
@ -56,7 +53,7 @@ class BackendListingLinks extends Listing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager = new Pager((int) $filter->value('page'), $this->rs_count, (int) $filter->value('nb'), 10);
|
$pager = new Pager((int) $filter->value('page'), (int) $this->rs_count, (int) $filter->value('nb'), 10);
|
||||||
|
|
||||||
$cols = new ArrayObject([
|
$cols = new ArrayObject([
|
||||||
'title' => (new Th())
|
'title' => (new Th())
|
||||||
@ -161,7 +158,7 @@ class BackendListingLinks extends Listing
|
|||||||
->text(Html::escapeHTML($this->rs->link_note))
|
->text(Html::escapeHTML($this->rs->link_note))
|
||||||
->class('number'),
|
->class('number'),
|
||||||
'date' => (new Td())
|
'date' => (new Td())
|
||||||
->text(Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->link_upddt, (string) dcCore::app()->auth->getInfo('user_tz'))))
|
->text(Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->link_upddt, (string) App::auth()->getInfo('user_tz'))))
|
||||||
->class('nowrap'),
|
->class('nowrap'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcMedia;
|
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Helper\L10n;
|
use Dotclear\Helper\L10n;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 combo class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Combo
|
class Combo
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -65,10 +61,9 @@ class Combo
|
|||||||
$dir = null;
|
$dir = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dcCore::app()->media = new dcMedia();
|
App::media()->chdir((string) My::settings()->get('folder'));
|
||||||
dcCore::app()->media->chdir(My::settings()->folder);
|
App::media()->getDir();
|
||||||
dcCore::app()->media->getDir();
|
$dir = & App::media()->dir;
|
||||||
$dir = & dcCore::app()->media->dir;
|
|
||||||
|
|
||||||
foreach ($dir['files'] as $file) {
|
foreach ($dir['files'] as $file) {
|
||||||
if (!in_array($file->extension, My::ALLOWED_MEDIA_EXTENSION)) {
|
if (!in_array($file->extension, My::ALLOWED_MEDIA_EXTENSION)) {
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 frontend class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Frontend extends Process
|
class Frontend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -30,8 +27,7 @@ class Frontend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initLinks']);
|
App::behavior()->addBehavior('initWidgets', Widgets::init(...));
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initCats']);
|
|
||||||
|
|
||||||
$values = [
|
$values = [
|
||||||
'c2PageFeedID',
|
'c2PageFeedID',
|
||||||
@ -91,16 +87,17 @@ class Frontend extends Process
|
|||||||
'c2CategoryIf',
|
'c2CategoryIf',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (My::settings()?->active) {
|
if (My::settings()->active) {
|
||||||
foreach ($blocks as $v) {
|
foreach ($blocks as $v) {
|
||||||
dcCore::app()->tpl->addBlock($v, [FrontendTemplate::class, $v]);
|
App::frontend()->template()->addBlock($v, [FrontendTemplate::class, $v]);
|
||||||
}
|
}
|
||||||
foreach ($values as $v) {
|
foreach ($values as $v) {
|
||||||
dcCore::app()->tpl->addValue($v, [FrontendTemplate::class, $v]);
|
App::frontend()->template()->addValue($v, [FrontendTemplate::class, $v]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach (array_merge($blocks, $values) as $v) {
|
foreach (array_merge($blocks, $values) as $v) {
|
||||||
dcCore::app()->tpl->addBlock($v, [FrontendTemplate::class, 'disable']);
|
pdump($v);
|
||||||
|
App::frontend()->template()->addBlock($v, FrontendTemplate::disable(...));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,30 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 frontend contxt class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class FrontendContext
|
class FrontendContext
|
||||||
{
|
{
|
||||||
public static function PaginationNbPages()
|
public static function PaginationNbPages()
|
||||||
{
|
{
|
||||||
if (dcCore::app()->ctx->c2_pagination === null) {
|
if (App::frontend()->context()->c2_pagination === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$nb_posts = dcCore::app()->ctx->c2_pagination->f(0);
|
$nb_posts = App::frontend()->context()->c2_pagination->f(0);
|
||||||
$nb_per_page = dcCore::app()->ctx->c2_params['limit'][1];
|
$nb_per_page = App::frontend()->context()->c2_params['limit'][1];
|
||||||
$nb_pages = ceil($nb_posts / $nb_per_page);
|
$nb_pages = ceil($nb_posts / $nb_per_page);
|
||||||
|
|
||||||
return $nb_pages;
|
return $nb_pages;
|
||||||
@ -72,7 +69,7 @@ class FrontendContext
|
|||||||
|
|
||||||
$args = preg_replace('#(^|/)c2page/([0-9]+)$#', '', $args);
|
$args = preg_replace('#(^|/)c2page/([0-9]+)$#', '', $args);
|
||||||
|
|
||||||
$url = dcCore::app()->blog->url . $args;
|
$url = App::blog()->url() . $args;
|
||||||
|
|
||||||
if ($n > 1) {
|
if ($n > 1) {
|
||||||
$url = preg_replace('#/$#', '', $url);
|
$url = preg_replace('#/$#', '', $url);
|
||||||
@ -89,18 +86,18 @@ class FrontendContext
|
|||||||
|
|
||||||
public static function categoryCurrent()
|
public static function categoryCurrent()
|
||||||
{
|
{
|
||||||
if (!isset(dcCore::app()->ctx->c2_page_params['cat_id'])
|
if (!isset(App::frontend()->context()->c2_page_params['cat_id'])
|
||||||
&& !isset(dcCore::app()->ctx->c2_page_params['cat_title'])
|
&& !isset(App::frontend()->context()->c2_page_params['cat_title'])
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isset(dcCore::app()->ctx->c2_page_params['cat_id'])
|
if (isset(App::frontend()->context()->c2_page_params['cat_id'])
|
||||||
&& dcCore::app()->ctx->c2_page_params['cat_id'] == dcCore::app()->ctx->c2_categories->cat_id
|
&& App::frontend()->context()->c2_page_params['cat_id'] == App::frontend()->context()->c2_categories->cat_id
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isset(dcCore::app()->ctx->c2_page_params['cat_title'])
|
if (isset(App::frontend()->context()->c2_page_params['cat_title'])
|
||||||
&& dcCore::app()->ctx->c2_page_params['cat_title'] == dcCore::app()->ctx->c2_categories->cat_title
|
&& App::frontend()->context()->c2_page_params['cat_title'] == App::frontend()->context()->c2_categories->cat_title
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcTemplate;
|
use Dotclear\Core\Frontend\Tpl;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 frontend template class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class FrontendTemplate
|
class FrontendTemplate
|
||||||
{
|
{
|
||||||
public static function disable(ArrayObject $a, ?string $c = null): string
|
public static function disable(ArrayObject $a, ?string $c = null): string
|
||||||
@ -28,43 +25,43 @@ class FrontendTemplate
|
|||||||
|
|
||||||
public static function c2PageURL(ArrayObject $a): string
|
public static function c2PageURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase(\'cinecturlink2\')') . '; ?>';
|
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($a), 'App::blog()->url().App::url()->getBase(\'cinecturlink2\')') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageTitle(ArrayObject $a): string
|
public static function c2PageTitle(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php \$title = (string) dcCore::app()->blog->settings->cinecturlink2->public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf(dcCore::app()->tpl->getFilters($a), '$title') . '; ?>';
|
return "<?php \$title = (string) App::blog()->settings()->cinecturlink2->public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo " . sprintf(App::frontend()->template()->getFilters($a), '$title') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageFeedURL(ArrayObject $a): string
|
public static function c2PageFeedURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("' . My::id() . '")."/feed/' . (!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom') . '"') . '; ?>';
|
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($a), 'App::blog()->url().App::url()->getBase("' . My::id() . '")."/feed/' . (!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom') . '"') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageFeedID(ArrayObject $a): string
|
public static function c2PageFeedID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5(dcCore::app()->blog->id."' . My::id() . '"); ?>';
|
return 'urn:md5:<?php echo md5(App::blog()->id()."' . My::id() . '"); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PageDescription(ArrayObject $a): string
|
public static function c2PageDescription(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return '<?php $description = (string) dcCore::app()->blog->settings->cinecturlink2->public_description; echo ' . sprintf(dcCore::app()->tpl->getFilters($a), '$description') . '; ?>';
|
return '<?php $description = (string) App::blog()->settings()->cinecturlink2->public_description; echo ' . sprintf(App::frontend()->template()->getFilters($a), '$description') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2If(ArrayObject $a, string $c): string
|
public static function c2If(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
$if = [];
|
$if = [];
|
||||||
|
|
||||||
$operator = isset($a['operator']) ? dcTemplate::getOperator($a['operator']) : '&&';
|
$operator = isset($a['operator']) ? Tpl::getOperator($a['operator']) : '&&';
|
||||||
|
|
||||||
if (isset($a['request_link'])) {
|
if (isset($a['request_link'])) {
|
||||||
$sign = (bool) $a['request_link'] ? '' : '!';
|
$sign = (bool) $a['request_link'] ? '' : '!';
|
||||||
$if[] = $sign . '(isset(dcCore::app()->ctx->c2_page_params["link_id"]) || isset(dcCore::app()->ctx->c2_page_params["link_title"]))';
|
$if[] = $sign . '(isset(App::frontend()->context()->c2_page_params["link_id"]) || isset(App::frontend()->context()->c2_page_params["link_title"]))';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a['request_cat'])) {
|
if (isset($a['request_cat'])) {
|
||||||
$sign = (bool) $a['request_cat'] ? '' : '!';
|
$sign = (bool) $a['request_cat'] ? '' : '!';
|
||||||
$if[] = $sign . '(isset(dcCore::app()->ctx->c2_page_params["cat_id"]) || isset(dcCore::app()->ctx->c2_page_params["cat_title"]))';
|
$if[] = $sign . '(isset(App::frontend()->context()->c2_page_params["cat_id"]) || isset(App::frontend()->context()->c2_page_params["cat_title"]))';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
||||||
@ -106,35 +103,35 @@ class FrontendTemplate
|
|||||||
|
|
||||||
return
|
return
|
||||||
"<?php \n" .
|
"<?php \n" .
|
||||||
"\$params = is_array(dcCore::app()->ctx->c2_page_params) ? dcCore::app()->ctx->c2_page_params : array(); \n" .
|
"\$params = is_array(App::frontend()->context()->c2_page_params) ? App::frontend()->context()->c2_page_params : array(); \n" .
|
||||||
$res .
|
$res .
|
||||||
"dcCore::app()->ctx->c2_params = \$params; unset(\$params);\n" .
|
"App::frontend()->context()->c2_params = \$params; unset(\$params);\n" .
|
||||||
"if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new " . Utils::class . "(); } \n" .
|
"if (!App::frontend()->context()->exists('cinecturlink')) { App::frontend()->context()->cinecturlink = new " . Utils::class . "(); } \n" .
|
||||||
"dcCore::app()->ctx->c2_entries = dcCore::app()->ctx->cinecturlink->getLinks(dcCore::app()->ctx->c2_params); \n" .
|
"App::frontend()->context()->c2_entries = App::frontend()->context()->cinecturlink->getLinks(App::frontend()->context()->c2_params); \n" .
|
||||||
'while (dcCore::app()->ctx->c2_entries->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
'while (App::frontend()->context()->c2_entries->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"dcCore::app()->ctx->pop('c2_entries'); dcCore::app()->ctx->pop('c2_params'); \n" .
|
"App::frontend()->context()->pop('c2_entries'); App::frontend()->context()->pop('c2_params'); \n" .
|
||||||
"?>\n";
|
"?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntriesHeader(ArrayObject $a, string $c): string
|
public static function c2EntriesHeader(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (dcCore::app()->ctx->c2_entries->isStart()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->c2_entries->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntriesFooter(ArrayObject $a, string $c): string
|
public static function c2EntriesFooter(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (dcCore::app()->ctx->c2_entries->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->c2_entries->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIf(ArrayObject $a, string $c): string
|
public static function c2EntryIf(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
$if = [];
|
$if = [];
|
||||||
|
|
||||||
$operator = isset($a['operator']) ? dcTemplate::getOperator($a['operator']) : '&&';
|
$operator = isset($a['operator']) ? Tpl::getOperator($a['operator']) : '&&';
|
||||||
|
|
||||||
if (isset($a['has_category'])) {
|
if (isset($a['has_category'])) {
|
||||||
$sign = (bool) $a['has_category'] ? '!' : '=';
|
$sign = (bool) $a['has_category'] ? '!' : '=';
|
||||||
$if[] = '(dcCore::app()->ctx->exists("c2_entries") && "" ' . $sign . '= dcCore::app()->ctx->c2_entries->cat_title)';
|
$if[] = '(App::frontend()->context()->exists("c2_entries") && "" ' . $sign . '= App::frontend()->context()->c2_entries->cat_title)';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
return empty($if) ? $c : '<?php if(' . implode(' ' . $operator . ' ', $if) . ") : ?>\n" . $c . "<?php endif; ?>\n";
|
||||||
@ -142,105 +139,105 @@ class FrontendTemplate
|
|||||||
|
|
||||||
public static function c2EntryIfFirst(ArrayObject $a): string
|
public static function c2EntryIfFirst(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return '<?php if (dcCore::app()->ctx->c2_entries->index() == 0) { echo "' . (isset($a['return']) ? addslashes(Html::escapeHTML($a['return'])) : 'first') . '"; } ?>';
|
return '<?php if (App::frontend()->context()->c2_entries->index() == 0) { echo "' . (isset($a['return']) ? addslashes(Html::escapeHTML($a['return'])) : 'first') . '"; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryIfOdd(ArrayObject $a): string
|
public static function c2EntryIfOdd(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return '<?php if ((dcCore::app()->ctx->c2_entries->index()+1)%2 == 1) { echo "' . (isset($a['return']) ? addslashes(Html::escapeHTML($a['return'])) : 'odd') . '"; } ?>';
|
return '<?php if ((App::frontend()->context()->c2_entries->index()+1)%2 == 1) { echo "' . (isset($a['return']) ? addslashes(Html::escapeHTML($a['return'])) : 'odd') . '"; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryFeedID(ArrayObject $a): string
|
public static function c2EntryFeedID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5(dcCore::app()->ctx->c2_entries->blog_id.dcCore::app()->ctx->c2_entries->link_id.dcCore::app()->ctx->c2_entries->link_creadt); ?>';
|
return 'urn:md5:<?php echo md5(App::frontend()->context()->c2_entries->blog_id.App::frontend()->context()->c2_entries->link_id.App::frontend()->context()->c2_entries->link_creadt); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryID(ArrayObject $a): string
|
public static function c2EntryID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_id', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryTitle(ArrayObject $a): string
|
public static function c2EntryTitle(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_title', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_title', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryDescription(ArrayObject $a): string
|
public static function c2EntryDescription(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_desc', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_desc', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorCommonName(ArrayObject $a): string
|
public static function c2EntryAuthorCommonName(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)', $a);
|
return self::getGenericValue('App::users()->getUserCN(App::frontend()->context()->c2_entries->user_id,App::frontend()->context()->c2_entries->user_name,App::frontend()->context()->c2_entries->user_firstname,App::frontend()->context()->c2_entries->user_displayname)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorDisplayName(ArrayObject $a): string
|
public static function c2EntryAuthorDisplayName(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_displayname', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->user_displayname', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorID(ArrayObject $a): string
|
public static function c2EntryAuthorID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_id', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->user_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorEmail(ArrayObject $a): string
|
public static function c2EntryAuthorEmail(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? 'dcCore::app()->ctx->c2_entries->user_email' : "strtr(dcCore::app()->ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
|
return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? 'App::frontend()->context()->c2_entries->user_email' : "strtr(App::frontend()->context()->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorLink(ArrayObject $a): string
|
public static function c2EntryAuthorLink(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('sprintf((dcCore::app()->ctx->c2_entries->user_url ? \'<a href="%2$s">%1$s</a>\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN(dcCore::app()->ctx->c2_entries->user_id,dcCore::app()->ctx->c2_entries->user_name,dcCore::app()->ctx->c2_entries->user_firstname,dcCore::app()->ctx->c2_entries->user_displayname)),html::escapeHTML(dcCore::app()->ctx->c2_entries->user_url))', $a);
|
return self::getGenericValue('sprintf((App::frontend()->context()->c2_entries->user_url ? \'<a href="%2$s">%1$s</a>\' : \'%1$s\'),html::escapeHTML(App::users()->getUserCN(App::frontend()->context()->c2_entries->user_id,App::frontend()->context()->c2_entries->user_name,App::frontend()->context()->c2_entries->user_firstname,App::frontend()->context()->c2_entries->user_displayname)),html::escapeHTML(App::frontend()->context()->c2_entries->user_url))', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryAuthorURL(ArrayObject $a): string
|
public static function c2EntryAuthorURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->user_url', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->user_url', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryFromAuthor(ArrayObject $a): string
|
public static function c2EntryFromAuthor(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_author', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_author', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryLang(ArrayObject $a): string
|
public static function c2EntryLang(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_lang', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_lang', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryURL(ArrayObject $a): string
|
public static function c2EntryURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->link_url', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->link_url', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategory(ArrayObject $a): string
|
public static function c2EntryCategory(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_title', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->cat_title', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategoryID(ArrayObject $a): string
|
public static function c2EntryCategoryID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->ctx->c2_entries->cat_id', $a);
|
return self::getGenericValue('App::frontend()->context()->c2_entries->cat_id', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryCategoryURL(ArrayObject $a): string
|
public static function c2EntryCategoryURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dcCore::app()->blog->url.dcCore::app()->url->getBase("' . My::id() . '")."/".dcCore::app()->blog->settings->cinecturlink2->public_caturl."/".urlencode(dcCore::app()->ctx->c2_entries->cat_title)', $a);
|
return self::getGenericValue('App::blog()->url().App::url()->getBase("' . My::id() . '")."/".App::blog()->settings()->cinecturlink2->public_caturl."/".urlencode(App::frontend()->context()->c2_entries->cat_title)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2EntryImg(ArrayObject $a): string
|
public static function c2EntryImg(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
$f = dcCore::app()->tpl->getFilters($a);
|
$f = App::frontend()->template()->getFilters($a);
|
||||||
$style = isset($a['style']) ? Html::escapeHTML($a['style']) : '';
|
$style = isset($a['style']) ? Html::escapeHTML($a['style']) : '';
|
||||||
|
|
||||||
return
|
return
|
||||||
"<?php if (dcCore::app()->ctx->exists('c2_entries')) { " .
|
"<?php if (App::frontend()->context()->exists('c2_entries')) { " .
|
||||||
'$widthmax = (integer) dcCore::app()->blog->settings->cinecturlink2->widthmax; ' .
|
'$widthmax = (integer) App::blog()->settings()->cinecturlink2->widthmax; ' .
|
||||||
"\$img = sprintf('<img src=\"%s\" alt=\"%s\" %s/>'," .
|
"\$img = sprintf('<img src=\"%s\" alt=\"%s\" %s/>'," .
|
||||||
'dcCore::app()->ctx->c2_entries->link_img, ' .
|
'App::frontend()->context()->c2_entries->link_img, ' .
|
||||||
"html::escapeHTML(dcCore::app()->ctx->c2_entries->link_title.' - '.dcCore::app()->ctx->c2_entries->link_author), " .
|
"html::escapeHTML(App::frontend()->context()->c2_entries->link_title.' - '.App::frontend()->context()->c2_entries->link_author), " .
|
||||||
"(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') " .
|
"(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') " .
|
||||||
'); ' .
|
'); ' .
|
||||||
'echo ' . sprintf($f, '$img') . "; unset(\$img); } ?> \n";
|
'echo ' . sprintf($f, '$img') . "; unset(\$img); } ?> \n";
|
||||||
@ -251,13 +248,13 @@ class FrontendTemplate
|
|||||||
$format = !empty($a['format']) ? addslashes($a['format']) : '';
|
$format = !empty($a['format']) ? addslashes($a['format']) : '';
|
||||||
|
|
||||||
if (!empty($a['rfc822'])) {
|
if (!empty($a['rfc822'])) {
|
||||||
$p = 'dt::rfc822(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
|
$p = 'dt::rfc822(strtotime(App::frontend()->context()->c2_entries->link_creadt), App::blog()->settings()->system->blog_timezone)';
|
||||||
} elseif (!empty($a['iso8601'])) {
|
} elseif (!empty($a['iso8601'])) {
|
||||||
$p = 'dt::iso8601(strtotime(dcCore::app()->ctx->c2_entries->link_creadt), dcCore::app()->blog->settings->system->blog_timezone)';
|
$p = 'dt::iso8601(strtotime(App::frontend()->context()->c2_entries->link_creadt), App::blog()->settings()->system->blog_timezone)';
|
||||||
} elseif ($format) {
|
} elseif ($format) {
|
||||||
$p = "dt::dt2str('" . $format . "', dcCore::app()->ctx->c2_entries->link_creadt)";
|
$p = "dt::dt2str('" . $format . "', App::frontend()->context()->c2_entries->link_creadt)";
|
||||||
} else {
|
} else {
|
||||||
$p = 'dt::dt2str(dcCore::app()->blog->settings->system->date_format, dcCore::app()->ctx->c2_entries->link_creadt)';
|
$p = 'dt::dt2str(App::blog()->settings()->system->date_format, App::frontend()->context()->c2_entries->link_creadt)';
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::getGenericValue($p, $a);
|
return self::getGenericValue($p, $a);
|
||||||
@ -265,17 +262,17 @@ class FrontendTemplate
|
|||||||
|
|
||||||
public static function c2EntryTime(ArrayObject $a): string
|
public static function c2EntryTime(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return self::getGenericValue('dt::dt2str(' . (!empty($a['format']) ? "'" . addslashes($a['format']) . "'" : 'dcCore::app()->blog->settings->system->time_format') . ', dcCore::app()->ctx->c2_entries->link_creadt)', $a);
|
return self::getGenericValue('dt::dt2str(' . (!empty($a['format']) ? "'" . addslashes($a['format']) . "'" : 'App::blog()->settings()->system->time_format') . ', App::frontend()->context()->c2_entries->link_creadt)', $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2Pagination(ArrayObject $a, string $c): string
|
public static function c2Pagination(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
$p = "<?php\n" .
|
$p = "<?php\n" .
|
||||||
"\$params = dcCore::app()->ctx->c2_params;\n" .
|
"\$params = App::frontend()->context()->c2_params;\n" .
|
||||||
"dcCore::app()->ctx->c2_pagination = dcCore::app()->ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
|
"App::frontend()->context()->c2_pagination = App::frontend()->context()->cinecturlink->getLinks(\$params,true); unset(\$params);\n" .
|
||||||
"?>\n";
|
"?>\n";
|
||||||
|
|
||||||
return isset($a['no_context']) ? $p . $c : $p . '<?php if (dcCore::app()->ctx->c2_pagination->f(0) > dcCore::app()->ctx->c2_entries->count()) : ?>' . $c . '<?php endif; ?>';
|
return isset($a['no_context']) ? $p . $c : $p . '<?php if (App::frontend()->context()->c2_pagination->f(0) > App::frontend()->context()->c2_entries->count()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2PaginationCounter(ArrayObject $a): string
|
public static function c2PaginationCounter(ArrayObject $a): string
|
||||||
@ -313,21 +310,21 @@ class FrontendTemplate
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
"<?php \n" .
|
"<?php \n" .
|
||||||
"if (!dcCore::app()->ctx->exists('cinecturlink')) { dcCore::app()->ctx->cinecturlink = new " . Utils::class . "(); } \n" .
|
"if (!App::frontend()->context()->exists('cinecturlink')) { App::frontend()->context()->cinecturlink = new " . Utils::class . "(); } \n" .
|
||||||
"dcCore::app()->ctx->c2_categories = dcCore::app()->ctx->cinecturlink->getCategories(); \n" .
|
"App::frontend()->context()->c2_categories = App::frontend()->context()->cinecturlink->getCategories(); \n" .
|
||||||
'while (dcCore::app()->ctx->c2_categories->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
'while (App::frontend()->context()->c2_categories->fetch()) : ?>' . $c . '<?php endwhile; ' . "\n" .
|
||||||
"dcCore::app()->ctx->c2_categories = null; \n" .
|
"App::frontend()->context()->c2_categories = null; \n" .
|
||||||
"?>\n";
|
"?>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoriesHeader(ArrayObject $a, string $c): string
|
public static function c2CategoriesHeader(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (dcCore::app()->ctx->c2_categories->isStart()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->c2_categories->isStart()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoriesFooter(ArrayObject $a, string $c): string
|
public static function c2CategoriesFooter(ArrayObject $a, string $c): string
|
||||||
{
|
{
|
||||||
return '<?php if (dcCore::app()->ctx->c2_categories->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
return '<?php if (App::frontend()->context()->c2_categories->isEnd()) : ?>' . $c . '<?php endif; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryIf(ArrayObject $a, string $c): string
|
public static function c2CategoryIf(ArrayObject $a, string $c): string
|
||||||
@ -340,7 +337,7 @@ class FrontendTemplate
|
|||||||
}
|
}
|
||||||
if (isset($a['first'])) {
|
if (isset($a['first'])) {
|
||||||
$sign = (bool) $a['first'] ? '' : '!';
|
$sign = (bool) $a['first'] ? '' : '!';
|
||||||
$if[] = $sign . 'dcCore::app()->ctx->c2_categories->isStart()';
|
$if[] = $sign . 'App::frontend()->context()->c2_categories->isStart()';
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($if) ? $c : '<?php if(' . implode(' && ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
return empty($if) ? $c : '<?php if(' . implode(' && ', $if) . ') : ?>' . $c . '<?php endif; ?>';
|
||||||
@ -354,36 +351,36 @@ class FrontendTemplate
|
|||||||
$p = 'atom';
|
$p = 'atom';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<?php echo ' . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("' . My::id() . '")."/".dcCore::app()->blog->settings->cinecturlink2->public_caturl."/".urlencode(dcCore::app()->ctx->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
|
return '<?php echo ' . sprintf(App::frontend()->template()->getFilters($a), 'App::blog()->url().App::url()->getBase("' . My::id() . '")."/".App::blog()->settings()->cinecturlink2->public_caturl."/".urlencode(App::frontend()->context()->c2_categories->cat_title)."/feed/' . $p . '"') . '; ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryFeedID(ArrayObject $a): string
|
public static function c2CategoryFeedID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return 'urn:md5:<?php echo md5(dcCore::app()->blog->id."' . My::id() . '".dcCore::app()->ctx->c2_categories->cat_id); ?>';
|
return 'urn:md5:<?php echo md5(App::blog()->id()."' . My::id() . '".App::frontend()->context()->c2_categories->cat_id); ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryID(ArrayObject $a): string
|
public static function c2CategoryID(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php if (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_id') . '; } ?>';
|
return "<?php if (App::frontend()->context()->exists('c2_categories')) { echo " . sprintf(App::frontend()->template()->getFilters($a), 'App::frontend()->context()->c2_categories->cat_id') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryTitle(ArrayObject $a): string
|
public static function c2CategoryTitle(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php if (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_title') . '; } ?>';
|
return "<?php if (App::frontend()->context()->exists('c2_categories')) { echo " . sprintf(App::frontend()->template()->getFilters($a), 'App::frontend()->context()->c2_categories->cat_title') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryDescription(ArrayObject $a): string
|
public static function c2CategoryDescription(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php if (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->ctx->c2_categories->cat_desc') . '; } ?>';
|
return "<?php if (App::frontend()->context()->exists('c2_categories')) { echo " . sprintf(App::frontend()->template()->getFilters($a), 'App::frontend()->context()->c2_categories->cat_desc') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function c2CategoryURL(ArrayObject $a): string
|
public static function c2CategoryURL(ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php if (dcCore::app()->ctx->exists('c2_categories')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), 'dcCore::app()->blog->url.dcCore::app()->url->getBase("' . My::id() . '")."/".dcCore::app()->blog->settings->cinecturlink2->public_caturl."/".urlencode(dcCore::app()->ctx->c2_categories->cat_title)') . '; } ?>';
|
return "<?php if (App::frontend()->context()->exists('c2_categories')) { echo " . sprintf(App::frontend()->template()->getFilters($a), 'App::blog()->url().App::url()->getBase("' . My::id() . '")."/".App::blog()->settings()->cinecturlink2->public_caturl."/".urlencode(App::frontend()->context()->c2_categories->cat_title)') . '; } ?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getGenericValue(string $p, ArrayObject $a): string
|
protected static function getGenericValue(string $p, ArrayObject $a): string
|
||||||
{
|
{
|
||||||
return "<?php if (dcCore::app()->ctx->exists('c2_entries')) { echo " . sprintf(dcCore::app()->tpl->getFilters($a), "$p") . '; } ?>';
|
return "<?php if (App::frontend()->context()->exists('c2_entries')) { echo " . sprintf(App::frontend()->template()->getFilters($a), "$p") . '; } ?>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcUrlHandlers;
|
use Dotclear\Core\Frontend\Url;
|
||||||
use context;
|
|
||||||
use Dotclear\Core\Frontend\Utility;
|
|
||||||
use Dotclear\Helper\File\Path;
|
use Dotclear\Helper\File\Path;
|
||||||
|
|
||||||
class FrontendUrl extends dcUrlHandlers
|
/**
|
||||||
|
* @brief cinecturlink2 frontend URLclass.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
class FrontendUrl extends Url
|
||||||
{
|
{
|
||||||
public static function c2Page(?string $args)
|
public static function c2Page(?string $args)
|
||||||
{
|
{
|
||||||
@ -31,9 +26,9 @@ class FrontendUrl extends dcUrlHandlers
|
|||||||
self::p404();
|
self::p404();
|
||||||
}
|
}
|
||||||
|
|
||||||
$tplset = dcCore::app()->themes->getDefine(dcCore::app()->blog->settings->system->theme)->get('tplset');
|
$tplset = App::themes()->getDefine(App::blog()->settings()->get('system')->get('theme'))->get('tplset');
|
||||||
$tpldir = Path::real(dcCore::app()->plugins->getDefine(My::id())->get('root')) . DIRECTORY_SEPARATOR . Utility::TPL_ROOT . DIRECTORY_SEPARATOR;
|
$tpldir = Path::real(App::plugins()->getDefine(My::id())->get('root')) . DIRECTORY_SEPARATOR . App::frontend()::TPL_ROOT . DIRECTORY_SEPARATOR;
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), $tpldir . (!empty($tplset) && is_dir($tpldir . $tplset) ? $tplset : DC_DEFAULT_TPLSET));
|
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), $tpldir . (!empty($tplset) && is_dir($tpldir . $tplset) ? $tplset : App::config()->defaultTplset()));
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
|
|
||||||
@ -60,12 +55,12 @@ class FrontendUrl extends dcUrlHandlers
|
|||||||
if (!empty($f) && in_array($f, ['atom', 'rss2'])) {
|
if (!empty($f) && in_array($f, ['atom', 'rss2'])) {
|
||||||
$mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
|
$mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
|
||||||
|
|
||||||
//dcCore::app()->ctx->short_feed_items = dcCore::app()->blog->settings->system->short_feed_items;
|
//App::frontend()->context()->short_feed_items = App::blog()->settings()->system->short_feed_items;
|
||||||
|
|
||||||
$params['limit'] = dcCore::app()->blog->settings->system->nb_post_per_feed;
|
$params['limit'] = App::blog()->settings()->get('system')->get('nb_post_per_feed');
|
||||||
dcCore::app()->ctx->c2_page_params = $params;
|
App::frontend()->context()->c2_page_params = $params;
|
||||||
|
|
||||||
header('X-Robots-Tag: ' . context::robotsPolicy(dcCore::app()->blog->settings->system->robots_policy, ''));
|
header('X-Robots-Tag: ' . App::frontend()->context()::robotsPolicy(App::blog()->settings()->get('system')->get('robots_policy'), ''));
|
||||||
self::serveDocument('cinecturlink2-' . $f . '.xml', $mime);
|
self::serveDocument('cinecturlink2-' . $f . '.xml', $mime);
|
||||||
} else {
|
} else {
|
||||||
$d = self::getPageArgs($args, 'c2detail');
|
$d = self::getPageArgs($args, 'c2detail');
|
||||||
@ -78,7 +73,7 @@ class FrontendUrl extends dcUrlHandlers
|
|||||||
}
|
}
|
||||||
|
|
||||||
$params['limit'] = (int) My::settings()->public_nbrpp;
|
$params['limit'] = (int) My::settings()->public_nbrpp;
|
||||||
dcCore::app()->ctx->c2_page_params = $params;
|
App::frontend()->context()->c2_page_params = $params;
|
||||||
|
|
||||||
self::serveDocument('cinecturlink2.html', 'text/html');
|
self::serveDocument('cinecturlink2.html', 'text/html');
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcNamespace;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Database\Structure;
|
use Dotclear\Database\Structure;
|
||||||
use Dotclear\Database\Statement\UpdateStatement;
|
use Dotclear\Database\Statement\UpdateStatement;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 install class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Install extends Process
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -37,7 +33,7 @@ class Install extends Process
|
|||||||
try {
|
try {
|
||||||
self::upgradeSettings();
|
self::upgradeSettings();
|
||||||
|
|
||||||
$s = new Structure(dcCore::app()->con, dcCore::app()->prefix);
|
$s = new Structure(App::con(), App::con()->prefix());
|
||||||
$s->{My::CINECTURLINK_TABLE_NAME}
|
$s->{My::CINECTURLINK_TABLE_NAME}
|
||||||
->link_id('bigint', 0, false)
|
->link_id('bigint', 0, false)
|
||||||
->blog_id('varchar', 32, false)
|
->blog_id('varchar', 32, false)
|
||||||
@ -77,7 +73,7 @@ class Install extends Process
|
|||||||
->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
|
->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
|
||||||
->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
|
->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
|
||||||
|
|
||||||
(new Structure(dcCore::app()->con, dcCore::app()->prefix))->synchronize($s);
|
(new Structure(App::con(), App::con()->prefix()))->synchronize($s);
|
||||||
|
|
||||||
$s = My::settings();
|
$s = My::settings();
|
||||||
$s->put('avtive', true, 'boolean', 'Enable cinecturlink2', false, true);
|
$s->put('avtive', true, 'boolean', 'Enable cinecturlink2', false, true);
|
||||||
@ -92,7 +88,7 @@ class Install extends Process
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -100,7 +96,7 @@ class Install extends Process
|
|||||||
|
|
||||||
private static function upgradeSettings(): void
|
private static function upgradeSettings(): void
|
||||||
{
|
{
|
||||||
if (version_compare((string) dcCore::app()->getVersion(My::id()), '2.0', '<')) {
|
if (version_compare(App::version()->getVersion(My::id()), '2.0', '<')) {
|
||||||
$ids = [
|
$ids = [
|
||||||
'active',
|
'active',
|
||||||
'widthmax',
|
'widthmax',
|
||||||
@ -116,7 +112,7 @@ class Install extends Process
|
|||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$sql = new UpdateStatement();
|
$sql = new UpdateStatement();
|
||||||
$sql
|
$sql
|
||||||
->ref(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME)
|
->ref(App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME)
|
||||||
->column('setting_id')
|
->column('setting_id')
|
||||||
->value($id)
|
->value($id)
|
||||||
->where('setting_id = ' . $sql->quote('cinecturlink2_' . $id))
|
->where('setting_id = ' . $sql->quote('cinecturlink2_' . $id))
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 manage class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Manage extends Process
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -32,6 +22,13 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 manage category class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class ManageCat extends Process
|
class ManageCat extends Process
|
||||||
{
|
{
|
||||||
private static string $module_redir = '';
|
private static string $module_redir = '';
|
||||||
@ -64,7 +61,7 @@ class ManageCat extends Process
|
|||||||
if ($exists) {
|
if ($exists) {
|
||||||
throw new Exception(__('Category with same name already exists.'));
|
throw new Exception(__('Category with same name already exists.'));
|
||||||
}
|
}
|
||||||
$cur = dcCore::app()->con->openCursor($utils->cat_table);
|
$cur = App::con()->openCursor($utils->cat_table);
|
||||||
$cur->setField('cat_title', self::$cattitle);
|
$cur->setField('cat_title', self::$cattitle);
|
||||||
$cur->setField('cat_desc', self::$catdesc);
|
$cur->setField('cat_desc', self::$catdesc);
|
||||||
|
|
||||||
@ -81,7 +78,7 @@ class ManageCat extends Process
|
|||||||
if ($exists) {
|
if ($exists) {
|
||||||
throw new Exception(__('Category with same name already exists.'));
|
throw new Exception(__('Category with same name already exists.'));
|
||||||
}
|
}
|
||||||
$cur = dcCore::app()->con->openCursor($C2->cat_table);
|
$cur = App::con()->openCursor($C2->cat_table);
|
||||||
$cur->setField('cat_title', self::$cattitle);
|
$cur->setField('cat_title', self::$cattitle);
|
||||||
$cur->setField('cat_desc', self::$catdesc);
|
$cur->setField('cat_desc', self::$catdesc);
|
||||||
|
|
||||||
@ -102,7 +99,7 @@ class ManageCat extends Process
|
|||||||
My::redirect(['part' => 'cats']);
|
My::redirect(['part' => 'cats']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -36,6 +26,13 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 manage categories class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class ManageCats extends Process
|
class ManageCats extends Process
|
||||||
{
|
{
|
||||||
private static string $module_redir = '';
|
private static string $module_redir = '';
|
||||||
@ -73,7 +70,7 @@ class ManageCats extends Process
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($catorder as $id) {
|
foreach ($catorder as $id) {
|
||||||
$i++;
|
$i++;
|
||||||
$cur = dcCore::app()->con->openCursor($utils->cat_table);
|
$cur = App::con()->openCursor($utils->cat_table);
|
||||||
$cur->setField('cat_pos', $i);
|
$cur->setField('cat_pos', $i);
|
||||||
$utils->updCategory((int) $id, $cur);
|
$utils->updCategory((int) $id, $cur);
|
||||||
}
|
}
|
||||||
@ -93,7 +90,7 @@ class ManageCats extends Process
|
|||||||
My::redirect(['part' => 'cats']);
|
My::redirect(['part' => 'cats']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -157,7 +154,7 @@ class ManageCats extends Process
|
|||||||
|
|
||||||
Page::openModule(
|
Page::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
(!dcCore::app()->auth->user_prefs?->get('accessibility')->get('nodragdrop') ?
|
(!App::auth()->prefs()->get('accessibility')->get('nodragdrop') ?
|
||||||
Page::jsLoad('js/jquery/jquery-ui.custom.js') .
|
Page::jsLoad('js/jquery/jquery-ui.custom.js') .
|
||||||
Page::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
|
Page::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
|
||||||
My::jsLoad('c2cats')
|
My::jsLoad('c2cats')
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -36,6 +26,13 @@ use Dotclear\Helper\Html\Html;
|
|||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 manage link class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class ManageLink extends Process
|
class ManageLink extends Process
|
||||||
{
|
{
|
||||||
private static string $module_redir = '';
|
private static string $module_redir = '';
|
||||||
@ -69,14 +66,14 @@ class ManageLink extends Process
|
|||||||
self::$linkauthor = $_POST['linkauthor'] ?? '';
|
self::$linkauthor = $_POST['linkauthor'] ?? '';
|
||||||
self::$linkurl = $_POST['linkurl'] ?? '';
|
self::$linkurl = $_POST['linkurl'] ?? '';
|
||||||
self::$linkcat = $_POST['linkcat'] ?? null;
|
self::$linkcat = $_POST['linkcat'] ?? null;
|
||||||
self::$linklang = $_POST['linklang'] ?? dcCore::app()->auth->getInfo('user_lang');
|
self::$linklang = $_POST['linklang'] ?? App::auth()->getInfo('user_lang');
|
||||||
self::$linkimage = $_POST['linkimage'] ?? '';
|
self::$linkimage = $_POST['linkimage'] ?? '';
|
||||||
self::$linknote = $_POST['linknote'] ?? '';
|
self::$linknote = $_POST['linknote'] ?? '';
|
||||||
|
|
||||||
if (!empty($_POST['save'])) {
|
if (!empty($_POST['save'])) {
|
||||||
try {
|
try {
|
||||||
Utils::makePublicDir(
|
Utils::makePublicDir(
|
||||||
DC_ROOT . '/' . dcCore::app()->blog->settings->system->get('public_path'),
|
App::config()->dotclearRoot() . '/' . App::blog()->settings()->system->get('public_path'),
|
||||||
My::settings()->folder
|
My::settings()->folder
|
||||||
);
|
);
|
||||||
if (empty(self::$linktitle)) {
|
if (empty(self::$linktitle)) {
|
||||||
@ -89,7 +86,7 @@ class ManageLink extends Process
|
|||||||
//throw new Exception(__('You must provide a link to an image.'));
|
//throw new Exception(__('You must provide a link to an image.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cur = dcCore::app()->con->openCursor($utils->table);
|
$cur = App::con()->openCursor($utils->table);
|
||||||
$cur->setField('link_title', self::$linktitle);
|
$cur->setField('link_title', self::$linktitle);
|
||||||
$cur->setField('link_desc', self::$linkdesc);
|
$cur->setField('link_desc', self::$linkdesc);
|
||||||
$cur->setField('link_author', self::$linkauthor);
|
$cur->setField('link_author', self::$linkauthor);
|
||||||
@ -130,7 +127,7 @@ class ManageLink extends Process
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +144,7 @@ class ManageLink extends Process
|
|||||||
My::redirect(['part' => 'links']);
|
My::redirect(['part' => 'links']);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +175,7 @@ class ManageLink extends Process
|
|||||||
|
|
||||||
Page::openModule(
|
Page::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
Page::jsVars(['dotclear.c2_lang' => dcCore::app()->auth->getInfo('user_lang')]) .
|
Page::jsVars(['dotclear.c2_lang' => App::auth()->getInfo('user_lang')]) .
|
||||||
My::jsLoad('c2link')
|
My::jsLoad('c2link')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -286,7 +283,7 @@ class ManageLink extends Process
|
|||||||
->items([
|
->items([
|
||||||
(new Link())
|
(new Link())
|
||||||
->class('modal hidden-if-no-js')
|
->class('modal hidden-if-no-js')
|
||||||
->href(dcCore::app()->adminurl->get('admin.media', ['d' => (string) My::settings()->folder]))
|
->href(App::backend()->url()->get('admin.media', ['d' => (string) My::settings()->folder]))
|
||||||
->title(__('Media manager'))
|
->title(__('Media manager'))
|
||||||
->text(__('Go to media manager to add image to cinecturlink path.')),
|
->text(__('Go to media manager to add image to cinecturlink path.')),
|
||||||
]),
|
]),
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Backend\Action\Actions;
|
use Dotclear\Core\Backend\Action\Actions;
|
||||||
use Dotclear\Core\Backend\Filter\{
|
use Dotclear\Core\Backend\Filter\{
|
||||||
Filters,
|
Filters,
|
||||||
@ -39,6 +29,13 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
};
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 manage links class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class ManageLinks extends Process
|
class ManageLinks extends Process
|
||||||
{
|
{
|
||||||
private static Actions $module_action;
|
private static Actions $module_action;
|
||||||
@ -86,7 +83,7 @@ class ManageLinks extends Process
|
|||||||
self::$module_counter = (int) $utils->getLinks($params, true)->f(0);
|
self::$module_counter = (int) $utils->getLinks($params, true)->f(0);
|
||||||
self::$module_listing = new BackendListingLinks($links, self::$module_counter);
|
self::$module_listing = new BackendListingLinks($links, self::$module_counter);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
57
src/My.php
57
src/My.php
@ -1,39 +1,52 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 My helper.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
public const CINECTURLINK_TABLE_NAME = \initCinecturlink2::CINECTURLINK_TABLE_NAME;
|
/**
|
||||||
public const CATEGORY_TABLE_NAME = \initCinecturlink2::CATEGORY_TABLE_NAME;
|
* Link table name.
|
||||||
|
*
|
||||||
|
* @var string CINECTURLINK_TABLE_NAME
|
||||||
|
*/
|
||||||
|
public const CINECTURLINK_TABLE_NAME = 'cinecturlink2';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category table name.
|
||||||
|
*
|
||||||
|
* @var string CATEGORY_TABLE_NAME
|
||||||
|
*/
|
||||||
|
public const CATEGORY_TABLE_NAME = 'cinecturlink2_cat';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowed media extension.
|
||||||
|
*
|
||||||
|
* @var array<int, string> ALLOWED_MEDIA_EXTENSION
|
||||||
|
*/
|
||||||
public const ALLOWED_MEDIA_EXTENSION = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
|
public const ALLOWED_MEDIA_EXTENSION = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
|
||||||
|
|
||||||
public static function checkCustomContext(int $context): ?bool
|
public static function checkCustomContext(int $context): ?bool
|
||||||
{
|
{
|
||||||
if (in_array($context, [My::MENU, My::BACKEND])) {
|
return match ($context) {
|
||||||
return defined('DC_CONTEXT_ADMIN')
|
self::MENU, self::MANAGE, self::BACKEND => App::task()->checkContext('BACKEND')
|
||||||
&& !is_null(dcCore::app()->blog)
|
&& App::blog()->isDefined()
|
||||||
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
&& App::auth()->check(App::auth()->makePermissions([
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
App::auth()::PERMISSION_CONTENT_ADMIN,
|
||||||
]), dcCore::app()->blog->id);
|
]), App::blog()->id()),
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
default => null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Plugin\activityReport\ActivityReport;
|
use Dotclear\Plugin\activityReport\ActivityReport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 activityReport class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class PluginActivityReport
|
class PluginActivityReport
|
||||||
{
|
{
|
||||||
public static function add()
|
public static function add()
|
||||||
@ -30,7 +27,7 @@ class PluginActivityReport
|
|||||||
__('link creation'),
|
__('link creation'),
|
||||||
__('A new cineturlink named "%s" was added by "%s"'),
|
__('A new cineturlink named "%s" was added by "%s"'),
|
||||||
'cinecturlink2AfterAddLink',
|
'cinecturlink2AfterAddLink',
|
||||||
[self::class, 'addLink']
|
self::addLink(...)
|
||||||
);
|
);
|
||||||
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
|
// from BEHAVIOR cinecturlink2AfterUpdLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||||
ActivityReport::instance()->addAction(
|
ActivityReport::instance()->addAction(
|
||||||
@ -39,7 +36,7 @@ class PluginActivityReport
|
|||||||
__('updating link'),
|
__('updating link'),
|
||||||
__('Cinecturlink named "%s" has been updated by "%s"'),
|
__('Cinecturlink named "%s" has been updated by "%s"'),
|
||||||
'cinecturlink2AfterUpdLink',
|
'cinecturlink2AfterUpdLink',
|
||||||
[self::class, 'updLink']
|
self::updLink(...)
|
||||||
);
|
);
|
||||||
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
|
// from BEHAVIOR cinecturlink2BeforeDelLink in cinecturlink2/inc/class.cinecturlink2.php
|
||||||
ActivityReport::instance()->addAction(
|
ActivityReport::instance()->addAction(
|
||||||
@ -48,7 +45,7 @@ class PluginActivityReport
|
|||||||
__('link deletion'),
|
__('link deletion'),
|
||||||
__('Cinecturlink named "%s" has been deleted by "%s"'),
|
__('Cinecturlink named "%s" has been deleted by "%s"'),
|
||||||
'cinecturlink2BeforeDelLink',
|
'cinecturlink2BeforeDelLink',
|
||||||
[self::class, 'delLink']
|
self::delLink(...)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +53,7 @@ class PluginActivityReport
|
|||||||
{
|
{
|
||||||
$logs = [
|
$logs = [
|
||||||
$cur->link_title,
|
$cur->link_title,
|
||||||
dcCore::app()->auth->getInfo('user_cn'),
|
App::auth()->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
ActivityReport::instance()->addLog('cinecturlink2', 'create', $logs);
|
ActivityReport::instance()->addLog('cinecturlink2', 'create', $logs);
|
||||||
}
|
}
|
||||||
@ -68,7 +65,7 @@ class PluginActivityReport
|
|||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->link_title,
|
$rs->link_title,
|
||||||
dcCore::app()->auth->getInfo('user_cn'),
|
App::auth()->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
ActivityReport::instance()->addLog('cinecturlink2', 'update', $logs);
|
ActivityReport::instance()->addLog('cinecturlink2', 'update', $logs);
|
||||||
}
|
}
|
||||||
@ -80,7 +77,7 @@ class PluginActivityReport
|
|||||||
|
|
||||||
$logs = [
|
$logs = [
|
||||||
$rs->link_title,
|
$rs->link_title,
|
||||||
dcCore::app()->auth->getInfo('user_cn'),
|
App::auth()->getInfo('user_cn'),
|
||||||
];
|
];
|
||||||
ActivityReport::instance()->addLog('cinecturlink2', 'delete', $logs);
|
ActivityReport::instance()->addLog('cinecturlink2', 'delete', $logs);
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 sitemaps class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class PluginSitemaps
|
class PluginSitemaps
|
||||||
{
|
{
|
||||||
public static function sitemapsDefineParts($map_parts)
|
public static function sitemapsDefineParts($map_parts)
|
||||||
@ -25,19 +22,19 @@ class PluginSitemaps
|
|||||||
|
|
||||||
public static function sitemapsURLsCollect($sitemaps)
|
public static function sitemapsURLsCollect($sitemaps)
|
||||||
{
|
{
|
||||||
if (dcCore::app()->plugins->moduleExists('cinecturlink2')
|
if (App::plugins()->moduleExists('cinecturlink2')
|
||||||
&& dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_url
|
&& App::blog()->settings()->get('sitemaps')->get('sitemaps_cinecturlink2_url')
|
||||||
) {
|
) {
|
||||||
$freq = $sitemaps->getFrequency(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
|
$freq = $sitemaps->getFrequency(App::blog()->settings()->get('sitemaps')->get('sitemaps_cinecturlink2_fq'));
|
||||||
$prio = $sitemaps->getPriority(dcCore::app()->blog->settings->sitemaps->sitemaps_cinecturlink2_pr);
|
$prio = $sitemaps->getPriority(App::blog()->settings()->get('sitemaps')->get('sitemaps_cinecturlink2_pr'));
|
||||||
$base = dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2');
|
$base = App::blog()->url() . App::url()->getBase('cinecturlink2');
|
||||||
|
|
||||||
$sitemaps->addEntry($base, $prio, $freq);
|
$sitemaps->addEntry($base, $prio, $freq);
|
||||||
|
|
||||||
$C2 = new Utils();
|
$C2 = new Utils();
|
||||||
$cats = $C2->getCategories();
|
$cats = $C2->getCategories();
|
||||||
while ($cats->fetch()) {
|
while ($cats->fetch()) {
|
||||||
$sitemaps->addEntry($base . '/' . dcCore::app()->blog->settings->cinecturlink2->public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
|
$sitemaps->addEntry($base . '/' . My::settings()->get('public_caturl') . '/' . urlencode($cats->cat_title), $prio, $freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 prepend class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Prepend extends Process
|
class Prepend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -30,16 +27,16 @@ class Prepend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->url->register(
|
App::url()->register(
|
||||||
My::id(),
|
My::id(),
|
||||||
'cinecturlink',
|
'cinecturlink',
|
||||||
'^cinecturlink(?:/(.+))?$',
|
'^cinecturlink(?:/(.+))?$',
|
||||||
[FrontendUrl::class, 'c2Page']
|
FrontendUrl::c2Page(...)
|
||||||
);
|
);
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
App::behavior()->addBehaviors([
|
||||||
'sitemapsDefineParts' => [PluginSitemaps::class, 'sitemapsDefineParts'],
|
'sitemapsDefineParts' => PluginSitemaps::sitemapsDefineParts(...),
|
||||||
'sitemapsURLsCollect' => [PluginSitemaps::class, 'sitemapsURLsCollect'],
|
'sitemapsURLsCollect' => PluginSitemaps::sitemapsURLsCollect(...),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (defined('ACTIVITY_REPORT_V2')) {
|
if (defined('ACTIVITY_REPORT_V2')) {
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 uninstall class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Uninstall extends Process
|
class Uninstall extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
@ -27,7 +23,7 @@ class Uninstall extends Process
|
|||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcAuth;
|
|
||||||
use Dotclear\Database\{
|
use Dotclear\Database\{
|
||||||
AbstractHandler,
|
AbstractHandler,
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -27,24 +16,46 @@ use Dotclear\Database\Statement\{
|
|||||||
SelectStatement,
|
SelectStatement,
|
||||||
UpdateStatement
|
UpdateStatement
|
||||||
};
|
};
|
||||||
|
use Dotclear\Interface\Core\ConnectionInterface;
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\Text;
|
use Dotclear\Helper\Text;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup DC_PLUGIN_CINECTURLINK2
|
* @brief cinecturlink2 utils class.
|
||||||
* @brief Share media you like - main methods.
|
* @ingroup cinecturlink2
|
||||||
* @since 2.6
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
/** @var AbstractHandler AbstractHandler instance */
|
/**
|
||||||
|
* Connection instance.
|
||||||
|
*
|
||||||
|
* @var ConnectionInterface $con
|
||||||
|
*/
|
||||||
public $con;
|
public $con;
|
||||||
/** @var string Cinecturlink table name */
|
|
||||||
|
/**
|
||||||
|
* Cinecturlink table name (with prefix).
|
||||||
|
*
|
||||||
|
* @var string $table
|
||||||
|
*/
|
||||||
public $table;
|
public $table;
|
||||||
/** @var string Cinecturlink category table name */
|
|
||||||
|
/**
|
||||||
|
* Cinecturlink category table name (with prefix)
|
||||||
|
*
|
||||||
|
* @var string $cat_table
|
||||||
|
*/
|
||||||
public $cat_table;
|
public $cat_table;
|
||||||
/** @var string Blog ID */
|
|
||||||
|
/**
|
||||||
|
* Current blog ID.
|
||||||
|
*
|
||||||
|
* @var string $blog
|
||||||
|
*/
|
||||||
public $blog;
|
public $blog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,10 +63,10 @@ class Utils
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->con = dcCore::app()->con;
|
$this->con = App::con();
|
||||||
$this->table = dcCore::app()->prefix . My::CINECTURLINK_TABLE_NAME;
|
$this->table = App::con()->prefix() . My::CINECTURLINK_TABLE_NAME;
|
||||||
$this->cat_table = dcCore::app()->prefix . My::CATEGORY_TABLE_NAME;
|
$this->cat_table = App::con()->prefix() . My::CATEGORY_TABLE_NAME;
|
||||||
$this->blog = (string) dcCore::app()->blog?->id;
|
$this->blog = App::blog()->id();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +117,7 @@ class Utils
|
|||||||
->join(
|
->join(
|
||||||
(new JoinStatement())
|
(new JoinStatement())
|
||||||
->inner()
|
->inner()
|
||||||
->from($sql->as(dcCore::app()->prefix . dcAuth::USER_TABLE_NAME, 'U'))
|
->from($sql->as(App::con()->prefix() . App::auth()::USER_TABLE_NAME, 'U'))
|
||||||
->on('U.user_id = L.user_id')
|
->on('U.user_id = L.user_id')
|
||||||
->statement()
|
->statement()
|
||||||
)
|
)
|
||||||
@ -126,7 +137,7 @@ class Utils
|
|||||||
$sql->from($params['from']);
|
$sql->from($params['from']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql->where('L.blog_id = ' . $sql->quote(dcCore::app()->blog->id));
|
$sql->where('L.blog_id = ' . $sql->quote($this->blog));
|
||||||
|
|
||||||
if (isset($params['link_type'])) {
|
if (isset($params['link_type'])) {
|
||||||
if (is_array($params['link_type']) && !empty($params['link_type'])) {
|
if (is_array($params['link_type']) && !empty($params['link_type'])) {
|
||||||
@ -227,7 +238,7 @@ class Utils
|
|||||||
|
|
||||||
$cur->link_id = $this->getNextLinkId();
|
$cur->link_id = $this->getNextLinkId();
|
||||||
$cur->blog_id = $this->blog;
|
$cur->blog_id = $this->blog;
|
||||||
$cur->user_id = dcCore::app()->auth->userID();
|
$cur->user_id = App::auth()->userID();
|
||||||
$cur->link_creadt = date('Y-m-d H:i:s');
|
$cur->link_creadt = date('Y-m-d H:i:s');
|
||||||
$cur->link_upddt = date('Y-m-d H:i:s');
|
$cur->link_upddt = date('Y-m-d H:i:s');
|
||||||
$cur->link_pos = 0;
|
$cur->link_pos = 0;
|
||||||
@ -242,7 +253,7 @@ class Utils
|
|||||||
$this->trigger();
|
$this->trigger();
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2AfterAddLink
|
# --BEHAVIOR-- cinecturlink2AfterAddLink
|
||||||
dcCore::app()->callBehavior('cinecturlink2AfterAddLink', $cur);
|
App::behavior()->callBehavior('cinecturlink2AfterAddLink', $cur);
|
||||||
|
|
||||||
return (int) $cur->link_id;
|
return (int) $cur->link_id;
|
||||||
}
|
}
|
||||||
@ -270,7 +281,7 @@ class Utils
|
|||||||
|
|
||||||
if ($behavior) {
|
if ($behavior) {
|
||||||
# --BEHAVIOR-- cinecturlink2AfterUpdLink
|
# --BEHAVIOR-- cinecturlink2AfterUpdLink
|
||||||
dcCore::app()->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
|
App::behavior()->callBehavior('cinecturlink2AfterUpdLink', $cur, $id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +297,7 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2BeforeDelLink
|
# --BEHAVIOR-- cinecturlink2BeforeDelLink
|
||||||
dcCore::app()->callBehavior('cinecturlink2BeforeDelLink', $id);
|
App::behavior()->callBehavior('cinecturlink2BeforeDelLink', $id);
|
||||||
|
|
||||||
$sql = new DeleteStatement();
|
$sql = new DeleteStatement();
|
||||||
$sql
|
$sql
|
||||||
@ -348,7 +359,7 @@ class Utils
|
|||||||
$sql->from($params['from']);
|
$sql->from($params['from']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql->where('C.blog_id = ' . $sql->quote(dcCore::app()->blog->id));
|
$sql->where('C.blog_id = ' . $sql->quote($this->blog));
|
||||||
|
|
||||||
if (!empty($params['cat_id'])) {
|
if (!empty($params['cat_id'])) {
|
||||||
if (is_array($params['cat_id'])) {
|
if (is_array($params['cat_id'])) {
|
||||||
@ -528,7 +539,7 @@ class Utils
|
|||||||
*/
|
*/
|
||||||
private function trigger(): void
|
private function trigger(): void
|
||||||
{
|
{
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,9 +574,9 @@ class Utils
|
|||||||
public static function getPublicDirs(): array
|
public static function getPublicDirs(): array
|
||||||
{
|
{
|
||||||
$dirs = [];
|
$dirs = [];
|
||||||
$all = Files::getDirList(dcCore::app()->blog->public_path);
|
$all = Files::getDirList(App::blog()->publicPath());
|
||||||
foreach ($all['dirs'] as $dir) {
|
foreach ($all['dirs'] as $dir) {
|
||||||
$dir = substr($dir, strlen(dcCore::app()->blog->public_path) + 1);
|
$dir = substr($dir, strlen(App::blog()->publicPath()) + 1);
|
||||||
$dirs[$dir] = $dir;
|
$dirs[$dir] = $dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cinecturlink2, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cinecturlink2;
|
namespace Dotclear\Plugin\cinecturlink2;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Plugin\widgets\WidgetsStack;
|
use Dotclear\Plugin\widgets\WidgetsStack;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cinecturlink2 widgets class.
|
||||||
|
* @ingroup cinecturlink2
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis (author)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Widgets
|
class Widgets
|
||||||
{
|
{
|
||||||
public static function initLinks(WidgetsStack $w): void
|
public static function init(WidgetsStack $w): void
|
||||||
{
|
{
|
||||||
$categories_combo = array_merge(
|
$categories_combo = array_merge(
|
||||||
Combo::categoriesCombo(),
|
Combo::categoriesCombo(),
|
||||||
@ -44,7 +41,7 @@ class Widgets
|
|||||||
->create(
|
->create(
|
||||||
'cinecturlink2links',
|
'cinecturlink2links',
|
||||||
__('My cinecturlink'),
|
__('My cinecturlink'),
|
||||||
[self::class, 'parseLinks'],
|
self::parseLinks(...),
|
||||||
null,
|
null,
|
||||||
__('Show selection of cinecturlinks')
|
__('Show selection of cinecturlinks')
|
||||||
)
|
)
|
||||||
@ -112,15 +109,12 @@ class Widgets
|
|||||||
->addContentOnly()
|
->addContentOnly()
|
||||||
->addClass()
|
->addClass()
|
||||||
->addOffline();
|
->addOffline();
|
||||||
}
|
|
||||||
|
|
||||||
public static function initCats(WidgetsStack $w): void
|
|
||||||
{
|
|
||||||
$w
|
$w
|
||||||
->create(
|
->create(
|
||||||
'cinecturlink2cats',
|
'cinecturlink2cats',
|
||||||
__('List of categories of cinecturlink'),
|
__('List of categories of cinecturlink'),
|
||||||
[self::class, 'parseCats'],
|
self::parseCats(...),
|
||||||
null,
|
null,
|
||||||
__('List of categories of cinecturlink')
|
__('List of categories of cinecturlink')
|
||||||
)
|
)
|
||||||
@ -148,7 +142,7 @@ class Widgets
|
|||||||
public static function parseLinks(WidgetsElement $w): string
|
public static function parseLinks(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
if (!My::settings()->avtive
|
if (!My::settings()->avtive
|
||||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|| !$w->checkHomeOnly(App::url()->type)
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -216,7 +210,7 @@ class Widgets
|
|||||||
$count = abs((int) $rs->link_count);
|
$count = abs((int) $rs->link_count);
|
||||||
|
|
||||||
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
# --BEHAVIOR-- cinecturlink2WidgetLinks
|
||||||
$bhv = dcCore::app()->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
$bhv = App::behavior()->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
|
||||||
|
|
||||||
$entries[] = '<p style="text-align:center;">' .
|
$entries[] = '<p style="text-align:center;">' .
|
||||||
($w->withlink && !empty($url) ? '<a href="' . $url . '"' . $lang . ' title="' . $cat . '">' : '') .
|
($w->withlink && !empty($url) ? '<a href="' . $url . '"' . $lang . ' title="' . $cat . '">' : '') .
|
||||||
@ -228,7 +222,7 @@ class Widgets
|
|||||||
'</p>' . $bhv;
|
'</p>' . $bhv;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$cur = dcCore::app()->con->openCursor($C2->table);
|
$cur = App::con()->openCursor($C2->table);
|
||||||
$cur->link_count = ($count + 1);
|
$cur->link_count = ($count + 1);
|
||||||
$C2->updLink((int) $rs->link_id, $cur, false);
|
$C2->updLink((int) $rs->link_id, $cur, false);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -240,7 +234,7 @@ class Widgets
|
|||||||
) {
|
) {
|
||||||
shuffle($entries);
|
shuffle($entries);
|
||||||
if (My::settings()->triggeronrandom) {
|
if (My::settings()->triggeronrandom) {
|
||||||
dcCore::app()->blog->triggerBlog();
|
App::blog()->triggerBlog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +245,7 @@ class Widgets
|
|||||||
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . implode(' ', $entries) .
|
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . implode(' ', $entries) .
|
||||||
(
|
(
|
||||||
$w->showpagelink && My::settings()->public_active ?
|
$w->showpagelink && My::settings()->public_active ?
|
||||||
'<p><a href="' . dcCore::app()->blog->url . dcCore::app()->url->getBase(My::id()) . '" title="' . __('view all links') . '">' . __('More links') . '</a></p>' : ''
|
'<p><a href="' . App::blog()->url() . App::url()->getBase(My::id()) . '" title="' . __('view all links') . '">' . __('More links') . '</a></p>' : ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -260,7 +254,7 @@ class Widgets
|
|||||||
{
|
{
|
||||||
if (!My::settings()->avtive
|
if (!My::settings()->avtive
|
||||||
|| !My::settings()->public_active
|
|| !My::settings()->public_active
|
||||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|| !$w->checkHomeOnly(App::url()->type)
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -273,14 +267,14 @@ class Widgets
|
|||||||
|
|
||||||
$res = [];
|
$res = [];
|
||||||
$res[] = '<li><a href="' .
|
$res[] = '<li><a href="' .
|
||||||
dcCore::app()->blog->url . dcCore::app()->url->getBase(My::id()) .
|
App::blog()->url() . App::url()->getBase(My::id()) .
|
||||||
'" title="' . __('view all links') . '">' . __('all links') .
|
'" title="' . __('view all links') . '">' . __('all links') .
|
||||||
'</a>' . ($w->shownumlink ? ' (' . ($C2->getLinks([], true)->f(0)) . ')' : '') .
|
'</a>' . ($w->shownumlink ? ' (' . ($C2->getLinks([], true)->f(0)) . ')' : '') .
|
||||||
'</li>';
|
'</li>';
|
||||||
|
|
||||||
while ($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$res[] = '<li><a href="' .
|
$res[] = '<li><a href="' .
|
||||||
dcCore::app()->blog->url . dcCore::app()->url->getBase('cinecturlink2') . '/' .
|
App::blog()->url() . App::url()->getBase('cinecturlink2') . '/' .
|
||||||
My::settings()->public_caturl . '/' .
|
My::settings()->public_caturl . '/' .
|
||||||
urlencode($rs->cat_title) .
|
urlencode($rs->cat_title) .
|
||||||
'" title="' . __('view links of this category') . '">' .
|
'" title="' . __('view links of this category') . '">' .
|
||||||
|
Loading…
Reference in New Issue
Block a user