Esempio n. 1
0
 protected function createArray($hash)
 {
     global $wgHashTables;
     $hashId = $this->mArrayName;
     $version = null;
     if (defined('ExtHashTables::VERSION')) {
         $version = ExtHashTables::VERSION;
     }
     if ($version !== null && version_compare($version, '0.999', '>=')) {
         // Version 1.0+, doesn't use $wgHashTables anymore
         global $wgParser;
         /** ToDo: is there a way to get the actual parser which has started the query? */
         ExtHashTables::get($wgParser)->createHash($hashId, $hash);
     } elseif (!isset($wgHashTables)) {
         // Hash extension is not installed in this wiki
         return false;
     } elseif ($version !== null && version_compare($version, '0.6', '>=')) {
         // HashTables 0.6 to 1.0
         $wgHashTables->createHash($hashId, $hash);
     } else {
         // old HashTables, dirty way
         $wgHashTables->mHashTables[trim($hashId)] = $hash;
     }
     return true;
 }
 * Thinking about:
 * - Sort function
 * - Search function
 */
if (!defined('MEDIAWIKI')) {
    die;
}
$wgExtensionCredits['parserhook'][] = array('path' => __FILE__, 'name' => 'HashTables', 'descriptionmsg' => 'hashtables-desc', 'version' => ExtHashTables::VERSION, 'author' => '[http://www.mediawiki.org/wiki/User:Danwe Daniel Werner]', 'url' => 'https://www.mediawiki.org/wiki/Extension:HashTables');
// language files:
$wgExtensionMessagesFiles['HashTables'] = ExtHashTables::getDir() . '/HashTables.i18n.php';
$wgExtensionMessagesFiles['HashTablesMagic'] = ExtHashTables::getDir() . '/HashTables.i18n.magic.php';
// hooks registration:
$wgHooks['ParserFirstCallInit'][] = 'ExtHashTables::init';
$wgHooks['ParserClearState'][] = 'ExtHashTables::onParserClearState';
// Include the settings file:
require_once ExtHashTables::getDir() . '/HashTables_Settings.php';
/**
 * Extension class with all the hash table functionality, also serves as store for hash tables per
 * Parser object and offers public accessors for interaction with HashTables extension.
 */
class ExtHashTables
{
    /**
     * Version of the 'HashTables' extension.
     * 
     * @since 0.6.1
     * 
     * @var string
     */
    const VERSION = '1.0 alpha';
    /**