/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { $aPrefs = array(); switch ($oVariable->getName()) { case 'DefaultTemplate': $aParams = array('template-path' => BsConfig::get('MW::UEModulePDF::TemplatePath')); $aPrefs = array('type' => 'select', 'options' => BsPDFTemplateProvider::getTemplatesForSelectOptions($aParams)); break; default: break; } return $aPrefs; }
/** * The preferences plugin callback * @param string $sAdapterName * @param BsConfig $oVariable * @return array MediaWiki preferences options array */ public function runPreferencePlugin($sAdapterName, $oVariable) { $aPrefs = array(); switch ($oVariable->getName()) { case 'WidgetNS': $aPrefs = array('type' => 'multiselectex', 'options' => BsNamespaceHelper::getNamespacesForSelectOptions(array(-2, NS_MEDIA, NS_MEDIAWIKI, NS_MEDIAWIKI_TALK, NS_SPECIAL))); break; case 'WidgetSortOdr': $aPrefs = array('options' => array(wfMessage('bs-pagesvisited-pref-sort-time')->plain() => 'time', wfMessage('bs-pagesvisited-pref-sort-pagename')->plain() => 'pagename')); break; default: break; } return $aPrefs; }
/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { $aPrefs = array(); if ($oVariable->getName() === 'DefScopeUser') { $aPrefs = array('options' => array(wfMessage('bs-extendedsearch-pref-scope-text')->plain() => 'text', wfMessage('bs-extendedsearch-pref-scope-title')->plain() => 'title')); } elseif ($oVariable->getName() === 'MltNS') { $aPrefs = array('type' => 'multiselectex', 'options' => BsNamespaceHelper::getNamespacesForSelectOptions(array(NS_SPECIAL, NS_MEDIA))); } return $aPrefs; }
/** * Defines the options for preferences settings of ImageRenderMode and NewEntryFieldPosition * @param string $sAdapterName Key of the adapter, typically MW * @param BsConfig $oVariable Contains the object of the preference that shall be rendered. * @return array Array of preference settings. */ public function runPreferencePlugin($sAdapterName, $oVariable) { $aPrefs = array(); switch ($oVariable->getName()) { case 'ImageRenderMode': $aPrefs = array('options' => array('thumb' => 'thumb', 'full' => 'full', 'none' => 'none')); break; case 'ThumbFloatDirection': $aPrefs = array('options' => array('left' => 'left', 'right' => 'right', 'none' => 'none')); break; case 'NewEntryFieldPosition': $aPrefs = array('options' => array('top' => 'top', 'bottom' => 'bottom')); break; case 'SortBy': $aPrefs = array('options' => array('creation' => 'creation', 'title' => 'title')); break; } return $aPrefs; }
/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { switch ($oVariable->getName()) { case 'ActivatedNamespaces': $aPrefs = array('type' => 'multiselectex', 'options' => BsNamespaceHelper::getNamespacesForSelectOptions(array(-2, -1))); break; case 'AutoPermissions': global $wgGroupPermissions; $aAvailablePermissions = array(); foreach ($wgGroupPermissions as $sGroup => $aPermissions) { foreach ($aPermissions as $sName => $bValue) { if (!in_array($sName, WikiAdmin::get('ExcludeRights'))) { $aAvailablePermissions[$sName] = $sName; } } } natsort($aAvailablePermissions); $aPrefs = array('type' => 'multiselectex', 'options' => array_unique($aAvailablePermissions)); break; } return $aPrefs; }
/** * generates an id string for a BsCOnfig instance for usage in html code * @param BsConfig $var * @return string the field id */ protected function generateFieldId($var) { return $var->getAdapter() . "_" . $var->getExtension() . "_" . $var->getName(); }
/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { $aPrefs = array(); switch ($oVariable->getName()) { case 'CategoryMode': $aPrefs = array('options' => array(wfMessage('bs-smartlist-and')->plain() => 'AND', wfMessage('bs-smartlist-or')->plain() => 'OR')); break; case 'Period': $aPrefs = array('options' => array('-' => '-', wfMessage('bs-smartlist-day')->plain() => 'day', wfMessage('bs-smartlist-week')->plain() => 'week', wfMessage('bs-smartlist-month')->plain() => 'month')); break; case 'Sort': $aPrefs = array('options' => array(wfMessage('bs-smartlist-time')->plain() => 'time', wfMessage('bs-smartlist-title')->plain() => 'title')); break; case 'Order': $aPrefs = array('options' => array(wfMessage('bs-smartlist-sort-asc')->plain() => 'ASC', wfMessage('bs-smartlist-sort-desc')->plain() => 'DESC')); break; } return $aPrefs; }
/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { wfProfileIn('BS::' . __METHOD__); $aPrefs = array(); switch ($oVariable->getName()) { case 'disableNS': global $wgContLang; $aExcludeNmsps = BsConfig::get('MW::VisualEditor::defaultNoContextNS'); foreach ($wgContLang->getNamespaces() as $sNamespace) { $iNsIndex = $wgContLang->getNsIndex($sNamespace); if (!MWNamespace::isTalk($iNsIndex)) { continue; } $aExcludeNmsps[] = $iNsIndex; } $aPrefs['type'] = 'multiselectex'; $aPrefs['options'] = BsNamespaceHelper::getNamespacesForSelectOptions($aExcludeNmsps); break; default: } wfProfileOut('BS::' . __METHOD__); return $aPrefs; }
/** * Sets parameters for more complex options in preferences * @param string $sAdapterName Name of the adapter, e.g. MW * @param BsConfig $oVariable Instance of variable * @return array Preferences options */ public function runPreferencePlugin($sAdapterName, $oVariable) { wfProfileIn('BS::' . __METHOD__); $aPrefs = array(); switch ($oVariable->getName()) { case 'SortTopVars': $aPrefs['type'] = 'multiselectsort'; $aPrefs['options'] = $this->aSortTopVars; break; case 'SortBodyVars': $aPrefs['type'] = 'multiselectsort'; $aPrefs['options'] = $this->aSortBodyVars; break; } wfProfileOut('BS::' . __METHOD__); return $aPrefs; }