| 1 | <?php |
| 2 | /************************************************************* |
| 3 | # 076 License |
| 4 | |
| 5 | Copyright (c) テクニカル諏訪子 |
| 6 | |
| 7 | Permission is hereby granted to any person obtaining a copy of the software |
| 8 | Little Beast (the "Software") to use, modify, merge, copy, publish, distribute, |
| 9 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 10 | |
| 11 | 1. **Origin Attribution**: |
| 12 | - You must not misrepresent the origin of the Software; you must not claim |
| 13 | you created the original Software. |
| 14 | - If the Software is used in a product, you must either: |
| 15 | a. Provide clear attribution in the product's documentation, user interface, |
| 16 | or other visible areas, **OR** |
| 17 | b. Pay the original developers a fee they specify in writing. |
| 18 | 2. **Usage Restriction**: |
| 19 | - The Software, or any derivative works, dependencies, or libraries |
| 20 | incorporating it, must not be used for censorship or to suppress freedom of |
| 21 | speech, expression, or creativity. Prohibited uses include, but are not |
| 22 | limited to: |
| 23 | - Censorship of so-called "hate speech", visuals, non-mainstream opinions, |
| 24 | ideas, or objective reality. |
| 25 | - Tools or systems designed to restrict access to information or |
| 26 | artistic works. |
| 27 | 3. **Notice Preservation**: |
| 28 | - This license and the above copyright notice must remain intact in all copies |
| 29 | of the source code. |
| 30 | |
| 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
| 32 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
| 33 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 34 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 35 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
| 36 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 37 | */ |
| 38 | namespace Site\Controller; |
| 39 | |
| 40 | trait Mods { |
| 41 | public function getMenu(): array { |
| 42 | $menu = [ |
| 43 | [ |
| 44 | 'class' => 'menu-item', |
| 45 | 'href' => '/', |
| 46 | 'page' => 'blog', |
| 47 | 'text' => 'トップ', |
| 48 | 'show' => true, |
| 49 | ], |
| 50 | [ |
| 51 | 'class' => 'menu-item', |
| 52 | 'href' => '/about', |
| 53 | 'page' => 'about', |
| 54 | 'text' => '自己紹介', |
| 55 | 'show' => true, |
| 56 | ], |
| 57 | [ |
| 58 | 'class' => 'menu-item', |
| 59 | 'href' => '/monero', |
| 60 | 'page' => 'monero', |
| 61 | 'text' => '支援♡', |
| 62 | 'show' => true, |
| 63 | ], |
| 64 | [ |
| 65 | 'class' => 'menu-item', |
| 66 | 'href' => '/secret', |
| 67 | 'page' => 'secret', |
| 68 | 'text' => '秘密のページ', |
| 69 | 'show' => false, |
| 70 | ], |
| 71 | [ |
| 72 | 'class' => 'menu-item', |
| 73 | 'href' => '/memberonly', |
| 74 | 'page' => 'memberonly', |
| 75 | 'text' => 'メンバー限定', |
| 76 | 'show' => true, |
| 77 | ], |
| 78 | [ |
| 79 | 'class' => 'menu-item', |
| 80 | 'href' => '/staffonly', |
| 81 | 'page' => 'staffonly', |
| 82 | 'text' => 'スタッフ限定', |
| 83 | 'show' => true, |
| 84 | ], |
| 85 | ]; |
| 86 | |
| 87 | if (ACTIVITYPUB_MULTIUSER) { |
| 88 | $menu[] = [ |
| 89 | 'class' => 'menu-item', |
| 90 | 'href' => '/microblog', |
| 91 | 'page' => 'microblog', |
| 92 | 'text' => 'マイクロブログ', |
| 93 | 'show' => true, |
| 94 | ]; |
| 95 | } |
| 96 | |
| 97 | if (\Std\Lib\Gitler\Gitler::enabled()) { |
| 98 | $menu[] = [ |
| 99 | 'class' => 'menu-item', |
| 100 | 'href' => '/gitler', |
| 101 | 'page' => 'gitler', |
| 102 | 'text' => 'Gitler', |
| 103 | 'show' => true, |
| 104 | ]; |
| 105 | } |
| 106 | |
| 107 | static $isAdmin = null; |
| 108 | |
| 109 | if (OPENPROVIDER_ENABLED) { |
| 110 | $menu[] = [ |
| 111 | 'class' => 'menu-item', |
| 112 | 'href' => '/openprovider', |
| 113 | 'page' => 'openprovider', |
| 114 | 'text' => 'OpenProvider管理', |
| 115 | 'show' => (new \Std\Lib\Auth())->isAdmin(), |
| 116 | ]; |
| 117 | } |
| 118 | |
| 119 | if (AUTH_ENABLED && defined('ADMIN_ENABLED') && ADMIN_ENABLED) { |
| 120 | // 管理者だけに表示する |
| 121 | $menu[] = [ |
| 122 | 'class' => 'menu-item', |
| 123 | 'href' => '/admin', |
| 124 | 'page' => 'admin', |
| 125 | 'text' => '管理', |
| 126 | 'show' => (new \Std\Lib\Auth())->isAdmin(), |
| 127 | ]; |
| 128 | } |
| 129 | |
| 130 | return $menu; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * フッターの支援のリンク(alt、class、img、href、show) |
| 135 | * LittleBeastのフッターでは使わないが、サイトのフッターで表示する時の為に全部のページで割り当てる |
| 136 | */ |
| 137 | public function getSupport(): array { |
| 138 | return []; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * フッターのSNSのリンク(getSupport()と同じ形) |
| 143 | */ |
| 144 | public function getSns(): array { |
| 145 | return []; |
| 146 | } |
| 147 | } |