当前位置: 首页>>代码示例>>PHP>>正文


PHP Skin::getUsableSkins方法代码示例

本文整理汇总了PHP中Skin::getUsableSkins方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::getUsableSkins方法的具体用法?PHP Skin::getUsableSkins怎么用?PHP Skin::getUsableSkins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skin的用法示例。


在下文中一共展示了Skin::getUsableSkins方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateSkinOptions

	/**
	 * @param $user User The User object
	 * @param $context IContextSource
	 * @return Array: text/links to display as key; $skinkey as value
	 */
	static function generateSkinOptions( $user, IContextSource $context ) {
		global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
		$ret = array();

		$mptitle = Title::newMainPage();
		$previewtext = $context->msg( 'skin-preview' )->text();

		# Only show members of Skin::getSkinNames() rather than
		# $skinNames (skins is all skin names from Language.php)
		$validSkinNames = Skin::getUsableSkins();

		# Sort by UI skin name. First though need to update validSkinNames as sometimes
		# the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
		foreach ( $validSkinNames as $skinkey => &$skinname ) {
			$msg = $context->msg( "skinname-{$skinkey}" );
			if ( $msg->exists() ) {
				$skinname = htmlspecialchars( $msg->text() );
			}
		}
		asort( $validSkinNames );

		foreach ( $validSkinNames as $skinkey => $sn ) {
			$linkTools = array();

			# Mark the default skin
			if ( $skinkey == $wgDefaultSkin ) {
				$linkTools[] = $context->msg( 'default' )->escaped();
			}

			# Create preview link
			$mplink = htmlspecialchars( $mptitle->getLocalURL( array( 'useskin' => $skinkey ) ) );
			$linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";

			# Create links to user CSS/JS pages
			if ( $wgAllowUserCss ) {
				$cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
				$linkTools[] = Linker::link( $cssPage, $context->msg( 'prefs-custom-css' )->escaped() );
			}

			if ( $wgAllowUserJs ) {
				$jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
				$linkTools[] = Linker::link( $jsPage, $context->msg( 'prefs-custom-js' )->escaped() );
			}

			$display = $sn . ' ' . $context->msg( 'parentheses', $context->getLanguage()->pipeList( $linkTools ) )->text();
			$ret[$display] = $skinkey;
		}

		return $ret;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:55,代码来源:Preferences.php

示例2: mainPrefsForm


//.........这里部分代码省略.........
                $moreEmail = "<input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label>" . $this->getToggle('ccmeonemails', '', $disableEmailPrefs);
            }
            $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('email'))) . $this->tableRow($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail));
        }
        # </FIXME>
        $wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('fieldset'));
        # Quickbar
        #
        if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n");
            for ($i = 0; $i < count($qbs); ++$i) {
                if ($i == $this->mQuickbar) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = "";
                }
                $wgOut->addHTML("<div><label><input type='radio' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        } else {
            # Need to output a hidden option even if the relevant skin is not in use,
            # otherwise the preference will get reset to 0 on submit
            $wgOut->addHTML(Xml::hidden('wpQuickbar', $this->mQuickbar));
        }
        # Skin
        #
        global $wgAllowUserSkin;
        if ($wgAllowUserSkin) {
            $wgOut->addHTML("<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n");
            $mptitle = Title::newMainPage();
            $previewtext = wfMsg('skin-preview');
            # Only show members of Skin::getSkinNames() rather than
            # $skinNames (skins is all skin names from Language.php)
            $validSkinNames = Skin::getUsableSkins();
            # Sort by UI skin name. First though need to update validSkinNames as sometimes
            # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
            foreach ($validSkinNames as $skinkey => &$skinname) {
                $msgName = "skinname-{$skinkey}";
                $localisedSkinName = wfMsg($msgName);
                if (!wfEmptyMsg($msgName, $localisedSkinName)) {
                    $skinname = $localisedSkinName;
                }
            }
            asort($validSkinNames);
            foreach ($validSkinNames as $skinkey => $sn) {
                $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
                $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}"));
                $previewlink = "(<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>)";
                if ($skinkey == $wgDefaultSkin) {
                    $sn .= ' (' . wfMsg('default') . ')';
                }
                $wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        }
        # Math
        #
        global $wgUseTeX;
        if ($wgUseTeX) {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>');
            foreach ($mathopts as $k => $v) {
                $checked = $k == $this->mMath;
                $wgOut->addHTML(Xml::openElement('div') . Xml::radioLabel(wfMsg($v), 'wpMath', $k, "mw-sp-math-{$k}", $checked) . Xml::closeElement('div') . "\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        }
开发者ID:amjadtbssm,项目名称:website,代码行数:67,代码来源:SpecialPreferences.php

示例3: generateSkinOptions

 /**
  * @param object $user The user object
  * @return array Text/links to display as key; $skinkey as value
  */
 static function generateSkinOptions($user)
 {
     global $wgDefaultSkin, $wgLang, $wgAllowUserCss, $wgAllowUserJs;
     $ret = array();
     $mptitle = Title::newMainPage();
     $previewtext = wfMsgHtml('skin-preview');
     # Only show members of Skin::getSkinNames() rather than
     # $skinNames (skins is all skin names from Language.php)
     $validSkinNames = Skin::getUsableSkins();
     # Sort by UI skin name. First though need to update validSkinNames as sometimes
     # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
     foreach ($validSkinNames as $skinkey => &$skinname) {
         $msgName = "skinname-{$skinkey}";
         $localisedSkinName = wfMsg($msgName);
         if (!wfEmptyMsg($msgName, $localisedSkinName)) {
             $skinname = htmlspecialchars($localisedSkinName);
         }
     }
     asort($validSkinNames);
     $sk = $user->getSkin();
     foreach ($validSkinNames as $skinkey => $sn) {
         $linkTools = array();
         # Mark the default skin
         if ($skinkey == $wgDefaultSkin) {
             $linkTools[] = wfMsgHtml('default');
         }
         # Create preview link
         $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}"));
         $linkTools[] = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>";
         # Create links to user CSS/JS pages
         if ($wgAllowUserCss) {
             $cssPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.css');
             $linkTools[] = $sk->link($cssPage, wfMsgHtml('prefs-custom-css'));
         }
         if ($wgAllowUserJs) {
             $jsPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.js');
             $linkTools[] = $sk->link($jsPage, wfMsgHtml('prefs-custom-js'));
         }
         $display = $sn . ' ' . wfMsg('parentheses', $wgLang->pipeList($linkTools));
         $ret[$display] = $skinkey;
     }
     return $ret;
 }
开发者ID:rocLv,项目名称:conference,代码行数:47,代码来源:Preferences.php

示例4: appendSkins

 public function appendSkins($property)
 {
     $data = array();
     $usable = Skin::getUsableSkins();
     $default = Skin::normalizeKey('default');
     foreach (Skin::getSkinNames() as $name => $displayName) {
         $skin = array('code' => $name);
         ApiResult::setContent($skin, $displayName);
         if (!isset($usable[$name])) {
             $skin['unusable'] = '';
         }
         if ($name === $default) {
             $skin['default'] = '';
         }
         $data[] = $skin;
     }
     $this->getResult()->setIndexedTagName($data, 'skin');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:19,代码来源:ApiQuerySiteinfo.php

示例5: htmlspecialchars

?>
</a></li>
		<li><a href="<?php 
echo SpecialPage::getTitleFor('Specialpages')->escapeLocalURL();
?>
"><?php 
echo htmlspecialchars(wfMsg('specialpages'));
?>
</a></li>
	</ul>
</nav>
<div id=designer-interface>
	<div id=designer-interface-bar class=secondary-bar>
		<?php 
echo htmlspecialchars(wfMsg('themedesigner-interface-skinlabel'));
$validSkinNames = Skin::getUsableSkins();
foreach ($validSkinNames as $skinkey => &$skinname) {
    $msgName = "skinname-{$skinkey}";
    $localisedSkinName = wfMsg($msgName);
    if (!wfEmptyMsg($msgName, $localisedSkinName)) {
        $skinname = htmlspecialchars($localisedSkinName);
    }
}
asort($validSkinNames);
/*		if ( empty($par) || !isset($validSkinNames[strtolower($par)]) ) {
			$par = $GLOBALS["wgUser"]->getSkin()->skinname;
		}
		$skinSelect = new XmlSelect( 'skin', false, strtolower($par) );*/
$skinSelect = new XmlSelect('skin', false, $GLOBALS["wgUser"]->getSkin()->skinname);
$skinSelect->addOptions(array_combine(array_values($validSkinNames), array_keys($validSkinNames)));
echo $skinSelect->getHTML();
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:layout.php


注:本文中的Skin::getUsableSkins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。