use svg icon and fix admin url

This commit is contained in:
Jean-Christian Paul Denis 2022-11-26 14:54:16 +01:00
parent f0e2433749
commit b9420e6971
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 39 additions and 24 deletions

View File

@ -45,7 +45,7 @@ if (dcCore::app()->blog->settings->periodical->periodical_active) {
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('Periodical'),
dcCore::app()->adminurl->get('admin.plugin.periodical'),
dcPage::getPF('periodical/icon.png'),
dcPage::getPF('periodical/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.periodical')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
@ -55,7 +55,7 @@ if (dcCore::app()->blog->settings->periodical->periodical_active) {
dcCore::app()->addBehavior(
'adminDashboardFavoritesV2',
['adminPeriodical', 'adminDashboardFavorites']
['adminPeriodical', 'adminDashboardFavoritesV2']
);
dcCore::app()->addBehavior(
'adminPostHeaders',
@ -233,13 +233,13 @@ class adminPeriodical
*
* @param dcFavorites $favs Array of favorites
*/
public static function adminDashboardFavorites(dcFavorites $favs)
public static function adminDashboardFavoritesV2(dcFavorites $favs)
{
$favs->register('periodical', [
'title' => __('Periodical'),
'url' => 'plugin.php?p=periodical',
'small-icon' => 'index.php?pf=periodical/icon.png',
'large-icon' => 'index.php?pf=periodical/icon-big.png',
'url' => dcCore::app()->adminurl->get('admin.plugin.periodical'),
'small-icon' => dcPage::getPF('periodical/icon.svg'),
'large-icon' => dcPage::getPF('periodical/icon.svg'),
'permissions' => dcCore::app()->auth->check(
dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
@ -247,26 +247,9 @@ class adminPeriodical
]),
dcCore::app()->blog->id
),
'active_cb' => [
'adminPeriodical',
'adminDashboardFavoritesActive',
],
]);
}
/**
* Favorites selection.
*
* @param string $request Requested page
* @param array $params Requested parameters
*/
public static function adminDashboardFavoritesActive($request, $params)
{
return $request == 'plugin.php'
&& isset($params['p'])
&& $params['p'] == 'periodical';
}
/**
* Add javascript for toggle
*
@ -274,7 +257,7 @@ class adminPeriodical
*/
public static function adminPostHeaders()
{
return dcPage::jsLoad('index.php?pf=periodical/js/toggle.js');
return dcPage::jsLoad(dcPage::getPF('periodical/js/toggle.js'));
}
/**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

32
icon.svg Normal file
View File

@ -0,0 +1,32 @@
<?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,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZ
cwAADsMAAA7DAcdvqGQAAAAHdElNRQfmCxoPKTrNq9WxAAAE1ElEQVRo3u3Z324b1xHH8Q+5y3+i
pEqWFMmWXSVGrcZRECRACxRFBDa66H3R1ylq+Fly3aJP4IBQ0F60RS9apHCb2LCDGJaVOEQskbK0
5PaCpEmJS3JJmwGMZgAK1GJ/c75nzsw5s0v+3y0z5HreTb/xKwV/80d/dTSF73k/91s/c+ITf/Jv
p0k3hUPBAgVlRSXhUMxxkwsVlQWKgmE+wqHy0JwlJfNyUwPkzFvWMDd8nOERyCooKSkIphq+7b2o
hILssElkR84gKysrM3UEuj5G6M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