Remove long-deprecated support for filter pages & special properties

Change-Id: Ib5c4b8a8e108c8d298dec367c145b287199557ec
这个提交包含在:
Yaron Koren 2018-12-17 19:53:57 +00:00
父节点 d6688e4c7e
当前提交 b12aa3be07
共有 14 个文件被更改,包括 3 次插入575 次删除

查看文件

@ -17,7 +17,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
}
// Define extension's version
define( 'SD_VERSION', '2.0.2' );
define( 'SD_VERSION', '2.1-alpha' );
// Display extension's information on "Special:Version"
$wgExtensionCredits['semantic'][] = [
@ -30,23 +30,8 @@ $wgExtensionCredits['semantic'][] = [
'license-name' => 'GPL-2.0-or-later'
];
// Constants for special properties - these are all deprecated
// as of version 2.0.
define( 'SD_SP_HAS_FILTER', 1 );
define( 'SD_SP_COVERS_PROPERTY', 2 );
// define( 'SD_SP_HAS_VALUE', 3 );
define( 'SD_SP_GETS_VALUES_FROM_CATEGORY', 4 );
// define( 'SD_SP_USES_TIME_PERIOD', 5 );
define( 'SD_SP_REQUIRES_FILTER', 6 );
define( 'SD_SP_HAS_LABEL', 7 );
define( 'SD_SP_HAS_DRILLDOWN_TITLE', 8 );
// define( 'SD_SP_HAS_INPUT_TYPE', 9 );
define( 'SD_SP_HAS_DISPLAY_PARAMETERS', 10 );
$sdgIP = __DIR__;
require_once $sdgIP . '/languages/SD_Language.php';
$wgMessagesDirs['SemanticDrilldown'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['SemanticDrilldownAlias'] = $sdgIP . '/languages/SD_Aliases.php';
$wgExtensionMessagesFiles['SemanticDrilldownMagic'] = $sdgIP . '/languages/SemanticDrilldown.i18n.magic.php';
@ -65,7 +50,6 @@ $wgAutoloadClasses['TemporaryTableManager'] = "$sdgIP/includes/TemporaryTableMan
// register all special pages and other classes
$wgSpecialPages['BrowseData'] = 'SDBrowseData';
$wgHooks['smwInitProperties'][] = 'sdfInitProperties';
$wgHooks['AdminLinks'][] = 'SDUtils::addToAdminLinks';
$wgHooks['MagicWordwgVariableIDs'][] = 'SDUtils::addMagicWordVariableIDs';
$wgHooks['MakeGlobalVariablesScript'][] = 'SDUtils::setGlobalJSVariables';
@ -82,20 +66,6 @@ $wgHooks['UnitTestsList'][] = 'SDUtils::onUnitTestsList';
$sdgScriptPath = $wgScriptPath . '/extensions/SemanticDrilldown';
# #
# ##
# If you already have custom namespaces on your site, insert
# $sdgNamespaceIndex = ???;
# into your LocalSettings.php *before* including this file.
# The number ??? must be the smallest even namespace number
# that is not in use yet. However, it should not be smaller
# than 170.
# #
if ( !isset( $sdgNamespaceIndex ) ) {
sdfInitNamespaces( 170 );
} else {
sdfInitNamespaces();
}
# ##
# # Variables for display
# ##
@ -112,139 +82,6 @@ $sdgShowCategoriesAsTabs = false;
$sdgMinValuesForComboBox = 40;
$sdgNumRangesForNumberFilters = 6;
/**********************************************/
/***** Global functions *****/
/**********************************************/
/**
* Init the additional namespaces used by Semantic Drilldown.
*/
function sdfInitNamespaces() {
global $sdgNamespaceIndex, $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespacesWithSubpages, $smwgNamespacesWithSemanticLinks;
global $wgLanguageCode, $sdgContLang;
if ( !isset( $sdgNamespaceIndex ) ) {
$sdgNamespaceIndex = 170;
}
define( 'SD_NS_FILTER', $sdgNamespaceIndex );
define( 'SD_NS_FILTER_TALK', $sdgNamespaceIndex + 1 );
sdfInitContentLanguage( $wgLanguageCode );
// Register namespace identifiers
$wgExtraNamespaces = $wgExtraNamespaces + $sdgContLang->getNamespaces();
$wgNamespaceAliases = $wgNamespaceAliases + $sdgContLang->getNamespaceAliases();
// Support subpages only for talk pages by default.
$wgNamespacesWithSubpages[SD_NS_FILTER_TALK] = true;
// Enable semantic links on filter pages.
$smwgNamespacesWithSemanticLinks[SD_NS_FILTER] = true;
$smwgNamespacesWithSemanticLinks[SD_NS_FILTER_TALK] = false;
}
/**********************************************/
/***** language settings *****/
/**********************************************/
/**
* Initialize a global language object for content language. This
* must happen early on, even before user language is known, to
* determine labels for additional namespaces. In contrast, messages
* can be initialized much later when they are actually needed.
*/
function sdfInitContentLanguage( $langcode ) {
global $sdgContLang;
if ( !empty( $sdgContLang ) ) {
return;
}
$sdContLangClass = 'SD_Language' . str_replace( '-', '_', ucfirst( $langcode ) );
if ( file_exists( __DIR__ . '/languages/' . $sdContLangClass . '.php' ) ) {
include_once __DIR__ . '/languages/' . $sdContLangClass . '.php';
}
// fallback if language not supported
if ( !class_exists( $sdContLangClass ) ) {
include_once __DIR__ . '/languages/SD_LanguageEn.php';
$sdContLangClass = 'SD_LanguageEn';
}
$sdgContLang = new $sdContLangClass();
}
/**
* Initialize the global language object for user language. This
* must happen after the content language was initialized, since
* this language is used as a fallback.
*/
function sdfInitUserLanguage( $langcode ) {
global $sdgIP, $sdgLang;
if ( !empty( $sdgLang ) ) {
return;
}
$sdLangClass = 'SD_Language' . str_replace( '-', '_', ucfirst( $langcode ) );
if ( file_exists( $sdgIP . '/languages/' . $sdLangClass . '.php' ) ) {
include_once $sdgIP . '/languages/' . $sdLangClass . '.php';
}
// fallback if language not supported
if ( !class_exists( $sdLangClass ) ) {
include_once $sdgIP . '/languages/SD_LanguageEn.php';
$sdLangClass = 'SD_LanguageEn';
}
$sdgLang = new $sdLangClass();
}
function sdfInitProperties() {
global $sdgContLang, $wgLanguageCode;
$sd_property_vals = [
SD_SP_HAS_FILTER => [ '_SD_F', '_wpg' ],
SD_SP_COVERS_PROPERTY => [ '_SD_CP', '_wpp' ],
// SD_SP_HAS_VALUE => array( '_SD_V', '_str' ),
SD_SP_GETS_VALUES_FROM_CATEGORY => [ '_SD_VC', '_wpc' ],
// SD_SP_USES_TIME_PERIOD => array( '_SD_TP', '_str' ),
// SD_SP_HAS_INPUT_TYPE => array( '_SD_IT', '_str' ),
SD_SP_REQUIRES_FILTER => [ '_SD_RF', '_wpg' ],
SD_SP_HAS_LABEL => [ '_SD_L', '_str' ],
SD_SP_HAS_DRILLDOWN_TITLE => [ '_SD_DT', '_str' ],
SD_SP_HAS_DISPLAY_PARAMETERS => [ '_SD_DP', '_str' ],
];
// register main property labels
$sd_prop_labels = $sdgContLang->getPropertyLabels();
foreach ( $sd_prop_labels as $prop_id => $prop_alias ) {
$prop_vals = $sd_property_vals[$prop_id];
if ( class_exists( '\SMW\PropertyRegistry' ) ) {
\SMW\PropertyRegistry::getInstance()->registerProperty( $prop_vals[0], $prop_vals[1], $prop_alias, true );
} elseif ( class_exists( 'SMWDIProperty' ) ) {
SMWDIProperty::registerProperty( $prop_vals[0], $prop_vals[1], $prop_alias, true );
} else {
SMWPropertyValue::registerProperty( $prop_vals[0], $prop_vals[1], $prop_alias, true );
}
}
// if it's not English, add the English-language aliases as well
if ( $wgLanguageCode != 'en' ) {
$sd_prop_aliases = $sdgContLang->getPropertyAliases();
foreach ( $sd_prop_aliases as $prop_alias => $prop_id ) {
$prop_vals = $sd_property_vals[$prop_id];
if ( class_exists( '\SMW\PropertyRegistry' ) ) {
\SMW\PropertyRegistry::getInstance()->registerPropertyAlias( $prop_vals[0], $prop_alias );
} elseif ( class_exists( 'SMWDIProperty' ) ) {
SMWDIProperty::registerPropertyAlias( $prop_vals[0], $prop_alias );
} else {
SMWPropertyValue::registerPropertyAlias( $prop_vals[0], $prop_alias );
}
}
}
return true;
}
$sdgResourceTemplate = [
'localBasePath' => $sdgIP,
'remoteExtPath' => 'SemanticDrilldown'

查看文件

@ -93,41 +93,6 @@ class SDFilter {
return $filters_ps;
}
/**
* @deprecated as of SD 2.0 - will be removed when the "Filter:"
* namespace goes away.
*/
static function load( $filter_name ) {
$f = new SDFilter();
$f->setName( $filter_name );
$properties_used = SDUtils::getValuesForProperty( $filter_name, SD_NS_FILTER, '_SD_CP', SD_SP_COVERS_PROPERTY, SMW_NS_PROPERTY );
if ( count( $properties_used ) > 0 ) {
$f->setProperty( $properties_used[0] );
// This may not be necessary, or useful.
$f->property_type = 'page';
}
$proptitle = Title::newFromText( $f->property, SMW_NS_PROPERTY );
if ( $proptitle != null ) {
$f->loadPropertyTypeFromProperty();
}
$categories = SDUtils::getValuesForProperty( $filter_name, SD_NS_FILTER, '_SD_VC', SD_SP_GETS_VALUES_FROM_CATEGORY, NS_CATEGORY );
if ( count( $categories ) > 0 ) {
$f->setCategory( $categories[0] );
} elseif ( $f->property_type === 'boolean' ) {
$f->allowed_values = [ '0', '1' ];
} else {
$f->allowed_values = [];
}
// Set list of possible applied filters if allowed values
// array was set.
foreach ( $f->allowed_values as $allowed_value ) {
$f->possible_applied_filters[] = SDAppliedFilter::create( $f, $allowed_value );
}
return $f;
}
function loadPropertyTypeFromProperty() {
// Default the property type to "Page" (matching SMW's
// default), in case there is no type set for this property.

查看文件

@ -138,35 +138,6 @@ class SDUtils {
}
}
/**
* Generic static function - gets all the values that a specific page
* points to with a specific property
*
* @deprecated as of SD 2.0 - will be removed when the "Filter:"
* namespace goes away.
*/
static function getValuesForProperty( $subject, $subjectNamespace, $specialPropID ) {
$store = self::getSMWStore();
$res = self::getSMWPropertyValues( $store, $subject, $subjectNamespace, $specialPropID );
$values = [];
foreach ( $res as $prop_val ) {
// depends on version of SMW
if ( $prop_val instanceof SMWDIWikiPage ) {
$actual_val = $prop_val->getDBkey();
} elseif ( $prop_val instanceof SMWDIString ) {
$actual_val = $prop_val->getString();
} elseif ( $prop_val instanceof SMWDIBlob ) {
$actual_val = $prop_val->getString();
} elseif ( method_exists( $prop_val, 'getValueKey' ) ) {
$actual_val = $prop_val->getValueKey();
} else {
$actual_val = $prop_val->getXSDValue();
}
$values[] = html_entity_decode( str_replace( '_', ' ', $actual_val ) );
}
return $values;
}
/**
* Gets all the filters specified for a category.
*/
@ -207,14 +178,6 @@ class SDUtils {
}
}
// Get "legacy" filters defined via the SMW special property
// "Has filter" and the Filter: namespace.
$filter_names = self::getValuesForProperty( str_replace( ' ', '_', $category ), NS_CATEGORY, '_SD_F' );
foreach ( $filter_names as $filter_name ) {
$filter = SDFilter::load( $filter_name );
$filter->required_filters = self::getValuesForProperty( $filter_name, SD_NS_FILTER, '_SD_RF', SD_SP_REQUIRES_FILTER, SD_NS_FILTER );
$filters[] = $filter;
}
// Read from the Page Schemas schema for this category, if
// it exists, and add any filters defined there.
if ( class_exists( 'PSSchema' ) ) {
@ -248,12 +211,6 @@ class SDUtils {
if ( $row = $dbr->fetchRow( $res ) ) {
return $row['pp_value'];
}
// Get "legacy" title defined via special properties.
$titles_for_category = self::getValuesForProperty( $category, NS_CATEGORY, '_SD_DT', SD_SP_HAS_DRILLDOWN_TITLE, NS_MAIN );
if ( count( $titles_for_category ) > 0 ) {
return str_replace( '_', ' ', $titles_for_category[0] );
}
}
/**
@ -281,12 +238,6 @@ class SDUtils {
$return_display_params[] = explode( ';', $displayParamsStr );
}
// Get "legacy" parameters defined via special properties.
$all_display_params = self::getValuesForProperty( str_replace( ' ', '_', $category ), NS_CATEGORY, '_SD_DP' );
foreach ( $all_display_params as $display_params ) {
$return_display_params[] = explode( ';', $display_params );
}
return $return_display_params;
}

查看文件

@ -1,65 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren
*/
/**
* Base class for all language classes - heavily based on Semantic MediaWiki's
* 'SMW_Language' class
*/
abstract class SD_Language {
protected $m_SpecialProperties;
protected $m_Namespaces;
// By default, every language has English-language aliases for
// special properties and namespaces
protected $m_SpecialPropertyAliases = [
// category properties
'Has filter' => SD_SP_HAS_FILTER,
'Has drilldown title' => SD_SP_HAS_DRILLDOWN_TITLE,
// filter properties
'Covers property' => SD_SP_COVERS_PROPERTY,
'Gets values from category' => SD_SP_GETS_VALUES_FROM_CATEGORY,
'Requires filter' => SD_SP_REQUIRES_FILTER,
'Has label' => SD_SP_HAS_LABEL,
// display properties
'Has display parameters' => SD_SP_HAS_DISPLAY_PARAMETERS,
];
protected $m_NamespaceAliases = [
'Filter' => SD_NS_FILTER,
'Filter_talk' => SD_NS_FILTER_TALK
];
/**
* Function that returns an array of namespace identifiers.
*/
function getNamespaces() {
return $this->m_Namespaces;
}
/**
* Function that returns an array of namespace aliases, if any.
*/
function getNamespaceAliases() {
return $this->m_NamespaceAliases;
}
/**
* Function that returns the labels for the special properties.
*/
function getPropertyLabels() {
return $this->m_SpecialProperties;
}
/**
* Aliases for special properties, if any.
*/
function getPropertyAliases() {
return $this->m_SpecialPropertyAliases;
}
}

查看文件

@ -1,28 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Meno25
*/
class SD_LanguageAr extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'لديه فلتر',
SD_SP_HAS_DRILLDOWN_TITLE => 'لديه عنوان دريل داون',
// filter properties
SD_SP_COVERS_PROPERTY => 'يغطي الخاصية',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'يحصل على القيم من التصنيف',
// SD_SP_USES_TIME_PERIOD => 'يستخدم فترة زمنية',
SD_SP_HAS_LABEL => 'لديه العلامة',
// English stuff, to avoid crashes
SD_SP_REQUIRES_FILTER => 'Requires filter',
SD_SP_HAS_DISPLAY_PARAMETERS => 'Has display parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => 'فلتر',
SD_NS_FILTER_TALK => 'نقاش_الفلتر'
];
}

查看文件

@ -1,27 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Meno25
*/
class SD_LanguageArz extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'لديه فلتر',
SD_SP_HAS_DRILLDOWN_TITLE => 'لديه عنوان دريل داون',
// filter properties
SD_SP_COVERS_PROPERTY => 'يغطى الخاصية',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'يحصل على القيم من التصنيف',
SD_SP_REQUIRES_FILTER => 'يتطلب الفلتر',
SD_SP_HAS_LABEL => 'لديه العلامة',
// English stuff, to avoid crashes
SD_SP_HAS_DISPLAY_PARAMETERS => 'Has display parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => 'فلتر',
SD_NS_FILTER_TALK => 'نقاش_الفلتر'
];
}

查看文件

@ -1,27 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren (Translation: Bernhard Krabina:krabina@cornerstone.at)
*/
class SD_LanguageDe extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'Hat Filter',
SD_SP_HAS_DRILLDOWN_TITLE => 'Hat Drilldown Titel',
// filter properties
SD_SP_COVERS_PROPERTY => 'Betrifft Attribut',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'Erhält Werte aus der Kategorie',
SD_SP_REQUIRES_FILTER => 'Benötigt Filter',
SD_SP_HAS_LABEL => 'Hat Bezeichnung',
// display properties
SD_SP_HAS_DISPLAY_PARAMETERS => 'Hat Anzeigeparameter',
];
var $m_Namespaces = [
SD_NS_FILTER => 'Filter',
SD_NS_FILTER_TALK => 'Filter_Diskussion'
];
}

查看文件

@ -1,27 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren (Translation: Bernhard Krabina:krabina@cornerstone.at)
*/
class SD_LanguageDe_formal extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'Hat Filter',
SD_SP_HAS_DRILLDOWN_TITLE => 'Hat Drilldown Titel',
// filter properties
SD_SP_COVERS_PROPERTY => 'Betrifft Attribut',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'Erhält Werte aus der Kategorie',
SD_SP_REQUIRES_FILTER => 'Benötigt Filter',
SD_SP_HAS_LABEL => 'Hat Bezeichnung',
// display properties
SD_SP_HAS_DISPLAY_PARAMETERS => 'Hat Anzeigeparameter',
];
var $m_Namespaces = [
SD_NS_FILTER => 'Filter',
SD_NS_FILTER_TALK => 'Filter_Diskussion'
];
}

查看文件

@ -1,27 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren
*/
class SD_LanguageEn extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'Has filter',
SD_SP_HAS_DRILLDOWN_TITLE => 'Has drilldown title',
// filter properties
SD_SP_COVERS_PROPERTY => 'Covers property',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'Gets values from category',
SD_SP_REQUIRES_FILTER => 'Requires filter',
SD_SP_HAS_LABEL => 'Has label',
// display properties
SD_SP_HAS_DISPLAY_PARAMETERS => 'Has display parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => 'Filter',
SD_NS_FILTER_TALK => 'Filter_talk'
];
}

查看文件

@ -1,25 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren (Translation:Ghassem Tofighi Email:[MyFamily]@gmail.com, HomePage:http://ght.ir)
*/
class SD_LanguageFa extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'فیلتر دارد',// Has filter
SD_SP_IS_EXCLUDED_FROM_DRILLDOWN => 'از drilldown مستثنی شده است',// Is excluded from drilldown
// filter properties
SD_SP_COVERS_PROPERTY => 'ویژگی را شامل می‌شود',// Covers property
SD_SP_GETS_VALUES_FROM_CATEGORY => 'مقادیر را از رده می‌گیرد',// Gets values from category
SD_SP_REQUIRES_FILTER => 'به فیلتر نیاز دارد',// Requires filter
SD_SP_HAS_LABEL => 'برچسب دارد'// Has label
];
var $m_Namespaces = [
SD_NS_FILTER => 'فیلتر',// Filter
SD_NS_FILTER_TALK => 'بحث_فیلتر'// Filter_talk
];
}

查看文件

@ -1,28 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Siebrand Mazeland
*/
class SD_LanguageNl extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => 'Heeft filter',
SD_SP_HAS_DRILLDOWN_TITLE => 'Heeft drilldownnaam',
// filter properties
SD_SP_COVERS_PROPERTY => 'Omvat eigenschap',
SD_SP_GETS_VALUES_FROM_CATEGORY => 'Haalt waarden uit categorie',
SD_SP_REQUIRES_FILTER => 'Benodigt filter',
SD_SP_HAS_LABEL => 'Heeft label',
// display properties
SD_SP_HAS_DISPLAY_PARAMETERS => 'Heeft weergave parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => 'Filter',
SD_NS_FILTER_TALK => 'Overleg_filter'
];
}

查看文件

@ -1,27 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren 翻译:张致信 本档系以电子字典译自繁体版,请自行修订(Translation: Roc Michael Email:roc.no1@gmail.com. This file is translated from Tradition Chinese by useing electronic dictionary. Please correct the file by yourself.)
*/
class SD_LanguageZh_cn extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => '设置筛选器', // 'Has filter'
// filter properties
SD_SP_COVERS_PROPERTY => '涵盖性质', // 'Covers property',
SD_SP_GETS_VALUES_FROM_CATEGORY => '设分类为筛选值', // 'Gets values from category',
SD_SP_REQUIRES_FILTER => '基础筛选器', // 'Requires filter',
SD_SP_HAS_LABEL => '设置标签', // 'Has label'
// English stuff, to avoid crashes
SD_SP_HAS_DRILLDOWN_TITLE => 'Has drilldown title',
SD_SP_HAS_DISPLAY_PARAMETERS => 'Has display parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => '筛选器',
SD_NS_FILTER_TALK => '筛选器讨论'
];
}

查看文件

@ -1,29 +0,0 @@
<?php
/**
* @ingroup Language
* @ingroup SDLanguage
* @author Yaron Koren 翻譯:張致信(Translation: Roc Michael Email:roc.no1@gmail.com)
*/
class SD_LanguageZh_tw extends SD_Language {
/* private */ var $m_SpecialProperties = [
// always start upper-case
// category properties
SD_SP_HAS_FILTER => '設置篩選器', // 'Has filter'
// filter properties
SD_SP_COVERS_PROPERTY => '涵蓋性質', // 'Covers property',
SD_SP_GETS_VALUES_FROM_CATEGORY => '設分類為篩選值', // 'Gets values from category',
SD_SP_REQUIRES_FILTER => '基礎篩選器', // 'Requires filter',
SD_SP_HAS_LABEL => '設置標籤', // 'Has label'
// English stuff, to avoid crashes
SD_SP_HAS_DRILLDOWN_TITLE => 'Has drilldown title',
SD_SP_HAS_DISPLAY_PARAMETERS => 'Has display parameters',
];
var $m_Namespaces = [
SD_NS_FILTER => '篩選器',
SD_NS_FILTER_TALK => '篩選器討論'
];
}

查看文件

@ -467,20 +467,6 @@ END;
return $text;
}
/**
* @deprecated as of SD 2.0 - will be removed when the "Filter:"
* namespace goes away.
*/
function printFilterLabel( $filter_name ) {
$labels_for_filter = SDUtils::getValuesForProperty( $filter_name, SD_NS_FILTER, '_SD_L', SD_SP_HAS_LABEL, NS_MAIN );
if ( count( $labels_for_filter ) > 0 ) {
$filter_label = $labels_for_filter[0];
} else {
$filter_label = str_replace( '_', ' ', $filter_name );
}
return $filter_label;
}
/**
* Create the full display of the filter line, once the text for
* the "results" (values) for this filter has been created.
@ -488,7 +474,6 @@ END;
function printFilterLine( $filterName, $isApplied, $isNormalFilter, $resultsLine ) {
global $sdgScriptPath;
$filterLabel = $this->printFilterLabel( $filterName );
$text = <<<END
<div class="drilldown-filter">
<div class="drilldown-filter-label">
@ -507,7 +492,7 @@ END;
END;
}
$text .= "\t\t\t\t\t$filterLabel:";
$text .= "\t\t\t\t\t$filterName:";
if ( $isApplied ) {
$add_another_str = wfMessage( 'sd_browsedata_addanothervalue' )->text();
$text .= " <span class=\"drilldown-filter-notes\">($add_another_str)</span>";
@ -1098,7 +1083,7 @@ END;
}
foreach ( $this->applied_filters as $i => $af ) {
$header .= ( ! $this->subcategory && $i == 0 ) ? " > " : "\n <span class=\"drilldown-header-value\">&</span> ";
$filter_label = $this->printFilterLabel( $af->filter->name );
$filter_label = $af->filter->name;
// add an "x" to remove this filter, if it has more
// than one value
if ( count( $this->applied_filters[$i]->values ) > 1 ) {