Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite: Fix 3 open bugs, repair readme syntax, consistent whitespace usage #4

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file modified CanonURL.i18n.php
Whitespace-only changes.
38 changes: 16 additions & 22 deletions CanonURL.php
Expand Up @@ -3,46 +3,40 @@
/**
* Initialization file for the CanonURL extension.
*
* Documentation: http://www.mediawiki.org/wiki/Extension:CanonURL
* Support http://www.mediawiki.org/wiki/Extension_talk:CanonURL
* Source code: https://github.com/Abhi-M/CanonURL/
* Source code: https://github.com/Abhi-M/CanonURL
* Documentation: https://www.mediawiki.org/wiki/Extension:CanonURL
* Support: https://github.com/Abhi-M/CanonURL/issues
*
* @file CanonURL.php
* @ingroup CanonURL
*
* @licence GNU GPL v3
*
* @author Abhi M Balakrishnan http://www.mediawiki.org/wiki/User:Abhi_M_Balakrishnan
* @author Abhi M Balakrishnan https://www.mediawiki.org/wiki/User:Abhi_M_Balakrishnan
* @license GNU GPL v3
* @file
* @ingroup Extensions
*/
if ( !defined( 'MEDIAWIKI' ) ) {
echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
die( 1 );
}

define( 'CanonURL_VERSION', '0.1' );
define( 'CanonURL_VERSION', '0.3.0' );

$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'CanonURL',
'author' => array( '[https://www.mediawiki.org/wiki/User:Abhi_M_Balakrishnan Abhi M Balakrishnan]' ),
'version' => CanonURL_VERSION,
'author' => array( '[http://www.mediawiki.org/wiki/User:Abhi_M_Balakrishnan Abhi M Balakrishnan]' ),
'url' => 'https://mediawiki.org/wiki/Extension:CanonURL',
'descriptionmsg' => 'canonurl-desc',
);

$wgExtensionMessagesFiles['CanonURL'] = dirname( __FILE__ ) . '/CanonURL.i18n.php';

global $wgHooks;
$wgHooks['BeforePageDisplay'][] = 'CanonURL';

function CanonURL($out)
{
global $CanonBaseURL;
global $wgRequest;
$pg_title = urlencode($wgRequest->getVal( 'title' ));
$out->addHeadItem( 'canonical',
'<link rel="canonical" href="'.$CanonBaseURL.$pg_title.'" />'."\n"
$wgHooks['BeforePageDisplay'][] = 'efCanonURL';

);
/**
* @param OutputPage $out
* @param Skin $skin
*/
function efCanonURL( $out ) {
$out->setCanonicalUrl( $out->getTitle()->getCanonicalURL() );
return true;
}
37 changes: 18 additions & 19 deletions README
@@ -1,26 +1,25 @@
--------------------------------------------------------------------------
README for the CanonURL extension 0.2
Licenses: GNU General Public Licence (GPL)
GNU Free Documentation License (GFDL)
--------------------------------------------------------------------------
# CanonURL

Adds the canonical links to the head of Mediawiki pages according to Google Canonicalization Content Guidelines.
<https://mediawiki.org/wiki/Extension:CanonURL>
Written by Abhi M Balakrishnan (http://about.me/abhim)

== Prerequisites ==
<https://www.mediawiki.org/wiki/Extension:CanonURL>

Written by Abhi M Balakrishnan (http://about.me/abhim).

## Prerequisites
This version of CanonURL requires MediaWiki 1.19 or later.

== Installing ==
* Copy the CanonURL directory into the extensions folder of your MediaWiki installation.
* Add following lines to your LocalSettings.php file towards the end:
$CanonBaseURL = "http://127.0.0.1/wiki/";
require_once("$IP/extensions/CanonURL/CanonURL.php");
## Installing
Copy the CanonURL directory into the extensions folder of your MediaWiki installation.

== Verifying the installation ==
See [[Special:Version]] and confirm the presence of CanonURL under "Installed extensions", "other" category
## Verifying the installation
See [[Special:Version]] and confirm the presence of CanonURL under "Installed extensions", "other" category.

== Verifying the configuration ==
* Clear the cache of your browser
* Reload any Mediawiki page
* Check the HTML source and confirm the presence of following line before </head>:
## Verifying the configuration
- Clear the cache of your browser
- Reload any Mediawiki page
- Check the HTML source and confirm the presence of following line before </head>:
<link rel="canonical" href="CANONICAL_URL_OF_CURRENT_PAGE" />

## License
This extension is licensed under GNU General Public Licence v3.
29 changes: 0 additions & 29 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md