fisharebest /
webtrees
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * webtrees: online genealogy |
||
| 5 | * Copyright (C) 2025 webtrees development team |
||
| 6 | * This program is free software: you can redistribute it and/or modify |
||
| 7 | * it under the terms of the GNU General Public License as published by |
||
| 8 | * the Free Software Foundation, either version 3 of the License, or |
||
| 9 | * (at your option) any later version. |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | * GNU General Public License for more details. |
||
| 14 | * You should have received a copy of the GNU General Public License |
||
| 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
| 16 | */ |
||
| 17 | |||
| 18 | declare(strict_types=1); |
||
| 19 | |||
| 20 | namespace Fisharebest\Webtrees\Module; |
||
| 21 | |||
| 22 | use Fisharebest\Webtrees\I18N; |
||
|
0 ignored issues
–
show
|
|||
| 23 | |||
| 24 | /** |
||
| 25 | * Class GoogleSearchConsole - add support for Google Search Console (formerly Google Webmaster Tools). |
||
| 26 | */ |
||
| 27 | class GoogleSearchConsole extends AbstractModule implements ModuleAnalyticsInterface, ModuleConfigInterface, ModuleExternalUrlInterface, ModuleGlobalInterface |
||
| 28 | { |
||
| 29 | use ModuleAnalyticsTrait; |
||
| 30 | use ModuleConfigTrait; |
||
| 31 | use ModuleExternalUrlTrait; |
||
| 32 | use ModuleGlobalTrait; |
||
| 33 | |||
| 34 | public function title(): string |
||
| 35 | { |
||
| 36 | return I18N::translate('Googleâ„¢ Search Console'); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function isEnabledByDefault(): bool |
||
| 40 | { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Is this a tracker, as opposed to just a site-verification. |
||
| 46 | * |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function isTracker(): bool |
||
| 50 | { |
||
| 51 | return false; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Form fields to edit the parameters. |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function analyticsFormFields(): string |
||
| 60 | { |
||
| 61 | return view('modules/google-webmaster-tools/form', $this->analyticsParameters()); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Home page for the service. |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | public function externalUrl(): string |
||
| 70 | { |
||
| 71 | return 'https://search.google.com/search-console'; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * The parameters that need to be embedded in the snippet. |
||
| 76 | * |
||
| 77 | * @return array<string> |
||
| 78 | */ |
||
| 79 | public function analyticsParameters(): array |
||
| 80 | { |
||
| 81 | return [ |
||
| 82 | 'GOOGLE_WEBMASTER_ID' => $this->getPreference('GOOGLE_WEBMASTER_ID') |
||
| 83 | ]; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Embed placeholders in the snippet. |
||
| 88 | * |
||
| 89 | * @param array<string> $parameters |
||
| 90 | * |
||
| 91 | * @return string |
||
| 92 | */ |
||
| 93 | public function analyticsSnippet(array $parameters): string |
||
| 94 | { |
||
| 95 | return view('modules/google-webmaster-tools/snippet', $parameters); |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * Raw content, to be added at the end of the <head> element. |
||
| 100 | * Typically, this will be <link> and <meta> elements. |
||
| 101 | * |
||
| 102 | * @return string |
||
| 103 | */ |
||
| 104 | public function headContent(): string |
||
| 105 | { |
||
| 106 | if ($this->analyticsCanShow()) { |
||
| 107 | return $this->analyticsSnippet($this->analyticsParameters()); |
||
| 108 | } |
||
| 109 | |||
| 110 | return ''; |
||
| 111 | } |
||
| 112 | } |
||
| 113 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths