Extension:PollDaddy
This extension is incompatible with MediaWiki 1.39 or any later release! You are advised against using this extension on a live site.
|
<translate> This extension stores its source code on a wiki page.</translate> <translate> Please be aware that this code may be unreviewed or maliciously altered.</translate> <translate> They may contain security holes, outdated interfaces that are no longer compatible etc.</translate> <translate> Note:</translate> <translate> No [[<tvar name=localisation>Special:MyLanguage/Localisation#Translation resources</tvar>|localisation]] updates are provided for this extension by <tvar name=twn>translatewiki.net </tvar>.</translate> |
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
PollDaddy Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | Allows embedding of polldaddy.com polls on a page |
Author(s) | Jabberwock @ Lostpedia |
Latest version | 1.3 (2019-10-11) |
MediaWiki | |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | See the code section |
polldaddy |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The PollDaddy extension allows to insert polldaddy.com polls on a page. It was originally based off of Sylvain Machefert's GoogleVideo and YouTube video extensions, but has been re-written to use parameters within the tag to make it more elegant and secure.
Usage
Put the following code into the page where you want to display a poll, replacing "12345" with the correct poll ID number:
<polldaddy pollid="12345"/>
Installation
- <translate> <tvar name=1>Copy the source code</tvar> and place the file(s) in a directory called <tvar name=name>
PollDaddy
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
require_once "$IP/extensions/PollDaddy/PollDaddy.php";
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Source Code
<?php
/**
* An extension that allows embedding of polldaddy.com polls into MediaWiki
*
* @file
* @ingroup Extensions
*
* @author Jabberwock @ Lostpedia
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
* @link https://www.mediawiki.org/wiki/Extension:PollDaddy Documentation
*
* Version 1.3
*
* Changes: 1.2: --use parameters from tag instead of delimited $input
* 1.3: --polldaddy no longer supporting flash polls. Using javascript instead
* --width and height no longer required
* Oct.11,2019: --update the code to run with the latest crowdsignal(polldaddy) URL
*
* Tag: <polldaddy pollid="12345"/>
*/
# Confirm MW environment
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
// Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'wfPolldaddy';
} else {
$wgExtensionFunctions[] = 'wfPolldaddy';
}
// Extension credits that will show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'name' => 'PollDaddy',
'version' => '1.3',
'description' => 'Display polls from polldaddy.com',
'author' => 'Jabberwock',
'url' => 'https://www.mediawiki.org/wiki/Extension:PollDaddy'
);
function wfPolldaddy() {
global $wgParser;
$wgParser->setHook('polldaddy', 'renderPolldaddy');
return true;
}
# The callback function for converting the input text to HTML output
function renderPolldaddy( $input, $params ) {
//$v = htmlspecialchars($params['v']);
$pollid = htmlspecialchars($params['pollid']);
if( $pollid == null ) {
$output = '<i>Poll Error: no poll specified!</i>';
return $output;
}
$output = '<script type="text/javascript" charset="utf-8" src="https://secure.polldaddy.com/p/'.$pollid.'.js"></script><noscript> <a href ="https://poll.fm/'.$pollid.'/" >Poll!</a> </noscript>';
return $output;
}
See also
- Pages with script errors
- Pages with broken file links
- Extensions incompatible with 1.39
- Extensions which host their code in-wiki
- Unmaintained extensions
- Extensions without an image
- Tag extensions
- Extensions without a compatibility policy
- Extensions without MediaWiki version
- GPL licensed extensions
- ParserFirstCallInit extensions
- All extensions
- Extensions not in ExtensionJson
- Extensions not using extension registration