2 class LibertyHooks
extends Hooks
{
5 * @param OutputPage $out
7 * @param array &$bodyAttrs
9 public static function onOutputPageBodyAttributes( OutputPage
$out, Skin
$sk, &$bodyAttrs ) {
10 if ( $sk->getSkinName() === 'liberty' ) {
11 $bodyAttrs['class'] .= ' Liberty width-size';
17 * @param User $user user
18 * @param Preferences &$preferences preferences
20 public static function onGetPreferences( $user, &$preferences ) {
21 global $wgLibertyAdSetting, $wgLibertyAdGroup;
22 $service = MediaWiki\MediaWikiServices
::getInstance();
23 $usergroupemanager = $service->getUserGroupManager();
24 $userGroups = $usergroupemanager->getUserGroups( $user );
25 $permissionManager = $service->getPermissionManager();
27 $preferences['liberty-layout-width'] = [
29 'label-message' => 'liberty-pref-layout-width',
30 'section' => 'liberty/layout',
32 wfMessage( 'liberty-layout-select-1000' )->text() => '1000px',
33 wfMessage( 'liberty-layout-select-1100' )->text() => '1100px',
34 wfMessage( 'liberty-layout-select-1200' )->text() => null,
35 wfMessage( 'liberty-layout-select-1300' )->text() => '1300px',
36 wfMessage( 'liberty-layout-select-1400' )->text() => '1400px',
37 wfMessage( 'liberty-layout-select-1500' )->text() => '1500px',
38 wfMessage( 'liberty-layout-select-1600' )->text() => '1600px',
40 'help-message' => 'liberty-pref-layout-width-help',
44 $preferences['liberty-layout-navfix'] = [
46 'label-message' => 'liberty-pref-layout-navfix',
47 'section' => 'liberty/layout',
50 $preferences['liberty-layout-sidebar'] = [
52 'label-message' => 'liberty-pref-layout-sidebar',
53 'section' => 'liberty/layout',
56 $preferences['liberty-layout-controlbar'] = [
58 'label-message' => 'liberty-pref-layout-controlbar',
59 'section' => 'liberty/layout',
62 if ( isset( $wgLibertyAdSetting['client'] ) && $wgLibertyAdSetting['client'] &&
63 isset( $wgLibertyAdGroup ) && $wgLibertyAdGroup == 'differ' ) {
64 if ( isset( $wgLibertyAdSetting['belowarticle'] ) && $wgLibertyAdSetting['belowarticle']
65 && $permissionManager->userHasRight( $user, 'blockads-belowarticle' ) ) {
66 $preferences['liberty-ads-morearticle'] = [
68 'label-message' => 'liberty-pref-ads-belowarticle',
69 'section' => 'liberty/ads',
73 if ( isset( $wgLibertyAdSetting['header'] ) && $wgLibertyAdSetting['header'] &&
74 $permissionManager->userHasRight( $user, 'blockads-header' ) ) {
75 $preferences['liberty-ads-header'] = [
77 'label-message' => 'liberty-pref-ads-header',
78 'section' => 'liberty/ads',
82 if ( isset( $wgLibertyAdSetting['right'] ) && $wgLibertyAdSetting['right'] &&
83 $permissionManager->userHasRight( $user, 'blockads-right' ) ) {
84 $preferences['liberty-ads-rightads'] = [
86 'label-message' => 'liberty-pref-ads-right',
87 'section' => 'liberty/ads',
91 if ( isset( $wgLibertyAdSetting['bottom'] ) && $wgLibertyAdSetting['bottom'] &&
92 $permissionManager->userHasRight( $user, 'blockads-bottom' ) ) {
93 $preferences['liberty-ads-bottom'] = [
95 'label-message' => 'liberty-pref-ads-bottom',
96 'section' => 'liberty/ads',
101 $preferences['liberty-color-main'] = [
103 'label-message' => 'liberty-pref-color-main',
104 'section' => 'liberty/color',
105 'help-message' => 'liberty-pref-color-main-help'
108 $preferences['liberty-color-second'] = [
110 'label-message' => 'liberty-pref-color-second',
111 'section' => 'liberty/color',
112 'help-message' => 'liberty-pref-color-second-help'
115 $preferences['liberty-font'] = [
116 'type' => 'selectorother',
117 'label-message' => 'liberty-pref-fonts',
118 'section' => 'liberty/font',
120 wfMessage( 'liberty-font-name-default' )->text() => null,
121 wfMessage( 'liberty-font-name-noto-sans-kr' )->text() => 'Noto Sans KR',
122 wfMessage( 'liberty-font-name-noto-serif-kr' )->text() => 'Noto Serif KR',
123 wfMessage( 'liberty-font-name-spoqa-han-sans' )->text() => 'Spoqa Han Sans',
124 wfMessage( 'liberty-font-name-nanum-gothic' )->text() => 'Nanum Gothic',
125 wfMessage( 'liberty-font-name-nanum-myeongjo' )->text() => 'Nanum Myeongjo',
126 wfMessage( 'liberty-font-name-dokdo' )->text() => 'Dokdo',
127 wfMessage( 'liberty-font-name-gaegu' )->text() => 'Gaegu',
128 wfMessage( 'liberty-font-name-hankc' )->text() => 'Hankc',
129 wfMessage( 'liberty-font-name-youth' )->text() => 'Youth',
130 wfMessage( 'liberty-font-name-malgun-gothic' )->text() => 'Malgun Gothic'
132 'help-message' => 'liberty-pref-fonts-help',
136 $preferences['liberty-dark'] = [
138 'label-message' => 'liberty-pref-dark',
139 'section' => 'liberty/color',
141 wfMessage( 'liberty-dark-default' )->text() => null,
142 wfMessage( 'liberty-dark-dark' )->text() => 'dark',
143 wfMessage( 'liberty-dark-light' )->text() => 'light'
145 'help-message' => 'liberty-pref-dark-help',