use SVG icon and anonymous functions
This commit is contained in:
parent
945b9403b6
commit
fb95e17566
119
_admin.php
119
_admin.php
@ -18,34 +18,30 @@ require_once __DIR__ . '/_widgets.php';
|
|||||||
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('My cinecturlink'),
|
__('My cinecturlink'),
|
||||||
dcCore::app()->adminurl->get('admin.plugin.cinecturlink2'),
|
cinecturlink2AdminUrl(),
|
||||||
dcPage::getPF('cinecturlink2/icon.png'),
|
cinecturlink2AdminIcon(),
|
||||||
preg_match(
|
preg_match('/' . preg_quote(cinecturlink2AdminUrl()) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||||
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
|
cinecturlink2AdmiPerm(),
|
||||||
$_SERVER['REQUEST_URI']
|
|
||||||
),
|
|
||||||
dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
dcCore::app()->addBehavior(
|
dcCore::app()->addBehavior('adminColumnsListsV2', function (ArrayObject $cols) {
|
||||||
'adminColumnsListsV2',
|
$cols['c2link'] = [
|
||||||
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
|
__('Cinecturlink'),
|
||||||
);
|
[
|
||||||
|
'date' => [true, __('Date')],
|
||||||
|
'cat' => [true, __('Category')],
|
||||||
|
'author' => [true, __('Author')],
|
||||||
|
'desc' => [false, __('Description')],
|
||||||
|
'link' => [true, __('Liens')],
|
||||||
|
'note' => [true, __('Rating')],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
dcCore::app()->addBehavior(
|
dcCore::app()->addBehavior('adminFiltersListsV2', function (ArrayObject $sorts) {
|
||||||
'adminFiltersListsV2',
|
$sorts['c2link'] = [
|
||||||
['cinecturlink2AdminBehaviors', 'adminFiltersLists']
|
__('Cinecturlink'),
|
||||||
);
|
[
|
||||||
dcCore::app()->addBehavior(
|
|
||||||
'adminDashboardFavoritesV2',
|
|
||||||
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
|
|
||||||
);
|
|
||||||
|
|
||||||
class cinecturlink2AdminBehaviors
|
|
||||||
{
|
|
||||||
public static function adminSortbyCombo()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
__('Date') => 'link_upddt',
|
__('Date') => 'link_upddt',
|
||||||
__('Title') => 'link_title',
|
__('Title') => 'link_title',
|
||||||
__('Category') => 'cat_id',
|
__('Category') => 'cat_id',
|
||||||
@ -53,51 +49,34 @@ class cinecturlink2AdminBehaviors
|
|||||||
__('Description') => 'link_desc',
|
__('Description') => 'link_desc',
|
||||||
__('Link') => 'link_url',
|
__('Link') => 'link_url',
|
||||||
__('Rating') => 'link_note',
|
__('Rating') => 'link_note',
|
||||||
];
|
],
|
||||||
}
|
'link_upddt',
|
||||||
|
'desc',
|
||||||
|
[__('Links per page'), 30],
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
public static function adminColumnsLists($cols)
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs) {
|
||||||
{
|
$favs->register('cinecturlink2', [
|
||||||
$cols['c2link'] = [
|
'title' => __('My cinecturlink'),
|
||||||
__('Cinecturlink'),
|
'url' => cinecturlink2AdminUrl() . '#links',
|
||||||
[
|
'small-icon' => cinecturlink2AdminIcon(),
|
||||||
'date' => [true, __('Date')],
|
'large-icon' => cinecturlink2AdminIcon(),
|
||||||
'cat' => [true, __('Category')],
|
'permissions' => cinecturlink2AdmiPerm(),
|
||||||
'author' => [true, __('Author')],
|
]);
|
||||||
'desc' => [false, __('Description')],
|
});
|
||||||
'link' => [true, __('Liens')],
|
|
||||||
'note' => [true, __('Rating')],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function adminFiltersLists($sorts)
|
function cinecturlink2AdminUrl(): string
|
||||||
{
|
{
|
||||||
$sorts['c2link'] = [
|
return dcCore::app()->adminurl->get('admin.plugin.cinecturlink2');
|
||||||
__('Cinecturlink'),
|
}
|
||||||
self::adminSortbyCombo(),
|
|
||||||
'link_upddt',
|
function cinecturlink2AdminIcon(): string
|
||||||
'desc',
|
{
|
||||||
[__('Links per page'), 30],
|
return urldecode(dcPage::getPF('cinecturlink2/icon.svg'));
|
||||||
];
|
}
|
||||||
}
|
|
||||||
|
function cinecturlink2AdmiPerm(): bool
|
||||||
public static function adminDashboardFavorites($favs)
|
{
|
||||||
{
|
return dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id);
|
||||||
$favs->register('cinecturlink2', [
|
|
||||||
'title' => __('My cinecturlink'),
|
|
||||||
'url' => dcCore::app()->adminurl->get('admin.plugin.cinecturlink2') . '#links',
|
|
||||||
'small-icon' => dcPage::getPF('cinecturlink2/icon.png'),
|
|
||||||
'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'),
|
|
||||||
'permissions' => dcCore::app()->auth->check('contentadmin', dcCore::app()->blog->id),
|
|
||||||
'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function adminDashboardFavoritesActive($request, $params)
|
|
||||||
{
|
|
||||||
return $request == 'plugin.php'
|
|
||||||
&& isset($params['p'])
|
|
||||||
&& $params['p'] == 'cinecturlink2';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
BIN
icon-big.png
BIN
icon-big.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
29
icon.svg
Normal file
29
icon.svg
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"> <image id="image0" width="64" height="64" x="0" y="0"
|
||||||
|
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
|
||||||
|
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA81BMVEUAAAACPWIHWIsKbakO
|
||||||
|
fcERi9YUmOloIiiSND2yQErLTFjgVWL0XmsJWIgThMgAGCoMYJIDM1IOZp0GSHARdLEFQ2gEPmEA
|
||||||
|
ChQIT3nivqwDOlsOaqLkysoNZZv////k1+X////k3fH////j2vHi1vHh0/H///3hzeXhv8oIUYjg
|
||||||
|
s6YAGj0FQ3MNZZsAAxQGR3MAHj0KWIgDOlsPbqkPbacABhQAJT0EOlwXo/oarf8cuP//ZXT/bXz/
|
||||||
|
c4MWjtkZmegbo/cZmukYk98SebkXidAUf8ETersXjtcVhcoWidAUgcoTfsoRc7sPbKwQcKwYkNr/
|
||||||
|
//8ebNpyAAAAOHRSTlMAKVV/qdT+KVV/qdT+f/4pqVXUf/5/fxupDXH+YvAquFTwYvDw8Cq4YsYN
|
||||||
|
R6n+KalV1H/+1ClVVUzuRQAAAAABYktHRB5yCiArAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJ
|
||||||
|
TUUH5gsZFyIg072oJgAAAxBJREFUWMPll9la6jAUhS0tnagjxXkAxVlQcAIBhaq1OL7/25xkp5lK
|
||||||
|
S8P5vDond9lk/VlrtwkwN/fvDq2gC6Ogzaw2iqYwisYsDK2A1J3ugzC6HXUGlstqztAVCJrO5EgC
|
||||||
|
g+G6ppFnAm1vMjkyDcMQkDkm6PZ47yLbDXoS++ia0wiabsarDPnJ4WdqmL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lOm1vZGlmeQAyMDIyLTExLTI1VDIyOjM0OjMyKzAxOjAw/+YnMwAAABp0
|
||||||
|
RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTFH80I3AAAAAElFTkSuQmCC" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue
Block a user