Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
exit;
}

UI::init('en'); // For footer

$description = "API for getting the number of links to any page on any Mediawiki project."

?>
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"require": {
"oojs/oojs-ui": "^0.53.1",
"php": ">=8.3"
"php": ">=8.3",
"krinkle/intuition": "^2.3"
},
"scripts": {
"test-win": "vendor\\bin\\phpunit.bat tests",
Expand Down
51 changes: 48 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"@metadata": {
"authors": [
"Brandon Fowler"
]
},
"description": "View the number of links (wikilinks, redirects, transclusions, file links, and category links) to any page on any Wikimedia project.",
"nav-skip": "Skip to results",
"lang-select-label": "Select interface language",
"form-project": "Project",
"form-page": "Page",
"form-namespaces": "Namespaces",
"form-submit": "Submit",
"table-header-type": "Type",
"table-header-all": "All",
"table-header-direct": "Direct",
"table-header-direct-tooltip": "Number of pages that link to the page through a redirect",
"table-header-indirect": "Indirect",
"table-header-indirect-tooltip": "Number of pages that link to page using the actual page name",
"action-link-to-row": "Link to row",
"link-type-filelinks": "File links",
"link-type-categorylinks": "Category links",
"link-type-wikilinks": "Wikilinks",
"link-type-redirects": "Redirects",
"link-type-transclusions": "Transclusions",
"link-what-links-here": "What links here",
"footer-form": "Form",
"footer-api": "API",
"footer-created-by": "Created by $1",
"error": "Error",
"error-page-required": "Page name is required.",
"error-invalid-namespace-ids": "Invalid namespace IDs.",
"error-nonexistent-project": "That project does not exist..."
}
34 changes: 34 additions & 0 deletions i18n/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"@metadata": {
"authors": [
"Brandon Fowler"
]
},
"description": "Voir le nombre de liens (wikiliens, redirections, transclusions, liens de fichiers et liens de catégories) vers n'importe quelle page d'un projet Wikimedia.",
"nav-skip": "Passer aux résultats",
"lang-select-label": "Sélectionner la langue de l'interface",
"form-project": "Projet",
"form-page": "Page",
"form-namespaces": "Espaces de noms",
"form-submit": "Soumettre",
"table-header-type": "Type",
"table-header-all": "Tous",
"table-header-direct": "Direct",
"table-header-direct-tooltip": "Nombre de pages liées via une redirection",
"table-header-indirect": "Indirect",
"table-header-indirect-tooltip": "Nombre de pages liées en utilisant le nom réel de la page",
"action-link-to-row": "Lien vers la ligne",
"link-type-filelinks": "Liens de fichiers",
"link-type-categorylinks": "Liens de catégories",
"link-type-wikilinks": "Wikiliens",
"link-type-redirects": "Redirections",
"link-type-transclusions": "Transclusions",
"link-what-links-here": "Pages liées",
"footer-form": "Formulaire",
"footer-api": "API",
"footer-created-by": "Créé par $1",
"error": "Erreur",
"error-page-required": "Le nom de la page est requis.",
"error-invalid-namespace-ids": "Identifiants d'espace de noms invalides.",
"error-nonexistent-project": "Ce projet n'existe pas...."
}
34 changes: 34 additions & 0 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"@metadata": {
"authors": [
"Brandon Fowler"
]
},
"description": "Description of Link Count's functionality. Shown as a short description at the top of the page and in search results.",
"nav-skip": "Hidden link that allows keyboard users to skip to the tool's results.",
"lang-select-label": "Tooltip for the language selection dropdown that controls the interface language.",
"form-project": "Label for the project input field in the form. This is where users enter the URL of the Wikimedia project they want to analyze.",
"form-page": "Label for the page input field in the form. This is where users enter the name of the page they want to analyze.",
"form-namespaces": "Label for the namespaces input field in the form. This is where users can specify which namespaces to include in the analysis.",
"form-submit": "Text for the submit button in the form.",
"table-header-type": "Header for the 'Type' column in the results table. This column indicates the type of link (wikilink, redirect, etc.).",
"table-header-all": "Header for the 'All' column in the results table. This column shows the total number of links for each type.",
"table-header-direct": "Header for the 'Direct' column in the results table. This column shows the number of pages that link to the analyzed page through a redirect.",
"table-header-direct-tooltip": "Tooltip that explains the 'Direct' column in the results table.",
"table-header-indirect": "Header for the 'Indirect' column in the results table. This column shows the number of pages that link to the analyzed page directly using it's name (rather than through a redirect).",
"table-header-indirect-tooltip": "Tooltip that explains the 'Indirect' column in the results table.",
"action-link-to-row": "Tooltip for a small button that allows users to add a link to the current table row to the clipboard.",
"link-type-filelinks": "Label for the row that shows the number of file links. Should be concise.",
"link-type-categorylinks": "Label for the row that shows the number of category links. Should be concise.",
"link-type-wikilinks": "Label for the row that shows the number of wikilinks (standard internal links). Should be concise.",
"link-type-redirects": "Label for the row that shows the number of redirects. Should be concise.",
"link-type-transclusions": "Label for the row that shows the number of transclusions (pages that use this page as a template). Should be concise.",
"link-what-links-here": "Link to the MediaWiki '{{msg-mw|whatlinkshere-title}}' special page for the analyzed page. Should probably be '{{msg-mw|whatlinkshere}}'.",
"footer-form": "Link to the form page for Link Count.",
"footer-api": "Link to the API page for Link Count.",
"footer-created-by": "Text indicating who authored/created Link Count. $1 is a placeholder for the author's name.",
"error": "Title for an error state.",
"error-page-required": "Error shown when the user submits the form without entering a page name.",
"error-invalid-namespace-ids": "Error shown when the user submits the form with invalid namespace IDs.",
"error-nonexistent-project": "Error shown when the user submits the form with a non-existent MediaWiki project."
}
6 changes: 3 additions & 3 deletions includes/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public function getHtml() {
])->appendContent('BrandonXLF');

$parts = [
(new OOUI\Tag('a'))->setAttributes(['href' => "./{$this->rel}/"])->appendContent('Form'),
(new OOUI\Tag('a'))->setAttributes(['href' => "./{$this->rel}/api/"])->appendContent('API'),
(new OOUI\Tag('a'))->setAttributes(['href' => "./{$this->rel}/"])->appendContent(_('footer-form')),
(new OOUI\Tag('a'))->setAttributes(['href' => "./{$this->rel}/api/"])->appendContent(_('footer-api')),
"$gitHubLink ($revLink)",
"Created by $authorLink"
_html('footer-created-by', [ 'variables' => [ $authorLink ], 'raw-variables' => true ])
];

$content = new OOUI\HtmlSnippet(implode(' | ', $parts));
Expand Down
8 changes: 4 additions & 4 deletions includes/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function getHtml() {
'infusable' => true
]), [
'align' => 'top',
'label' => 'Project'
'label' => _('form-project')
]
),
new OOUI\FieldLayout(
Expand All @@ -25,7 +25,7 @@ public function getHtml() {
'infusable' => true
]), [
'align' => 'top',
'label' => 'Page'
'label' => _('form-page')
]
),
new OOUI\FieldLayout(
Expand All @@ -37,14 +37,14 @@ public function getHtml() {
'infusable' => true
]), [
'align' => 'top',
'label' => 'Namespaces'
'label' => _('form-namespaces')
]
),
new OOUI\FieldLayout(
new OOUI\ButtonInputWidget([
'id' => 'submit',
'type' => 'submit',
'label' => 'Submit',
'label' => _('form-submit'),
'flags' => ['primary', 'progressive'],
'infusable' => true
]), [
Expand Down
2 changes: 0 additions & 2 deletions includes/Global.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

OOUI\Theme::setSingleton(new OOUI\WikimediaUITheme);

function get($param) {
return trim($_GET[$param] ?? '');
}
43 changes: 43 additions & 0 deletions includes/LanguageSelector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Krinkle\Intuition\Intuition;

class LanguageSelector implements HtmlProducer {
public function getHtml() {
/** @global Intuition $I18N */
global $I18N;

$langs = $I18N->getAvailableLangs();
unset($langs['qqq']);

$dropdown = (new OOUI\DropdownInputWidget([
'name' => 'lang',
'value' => $I18N->getLang(),
'options' => array_map(function($name, $key) {
return [
'data' => $key,
'label' => $name,
];
}, $langs, array_keys($langs))
]))->addClasses(['lang-select-cnt']);

$params = $_GET;
unset($params['userlang']);

return (new OOUI\Tag('form'))->setAttributes([
'action' => './setlang/?' . http_build_query($params),
'method' => 'post',
])->addClasses(['lang-select-form'])->appendContent(
(new OOUI\LabelWidget([
'label' => new OOUI\HtmlSnippet('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path>
</svg>')
]))->setAttributes([
'title' => _('lang-select-label'),
'aria-label' => _('lang-select-label'),
'for' => $dropdown->getInputId(),
]),
$dropdown
)->toString();
}
}
Loading
Loading