本文整理汇总了PHP中Skin类的典型用法代码示例。如果您正苦于以下问题:PHP Skin类的具体用法?PHP Skin怎么用?PHP Skin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Skin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeWlhLink
/**
* Make a "what links here" link for a given title
*
* @param Title $title Title to make the link for
* @param Skin $skin Skin to use
* @param object $result Result row
* @return string
*/
private function makeWlhLink($title, $skin, $result)
{
global $wgLang;
$wlh = SpecialPage::getTitleFor('Whatlinkshere');
$label = wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
return $skin->link($wlh, $label, array(), array('target' => $title->getPrefixedText()));
}
示例2: onBeforePageDisplay
public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin)
{
$title = $output->getTitle();
// Disallow commenting on pages without article id
if ($title->getArticleID() == 0) {
return true;
}
if ($title->isSpecialPage()) {
return true;
}
// These could be explicitly allowed in later version
if (!$title->canTalk()) {
return true;
}
if ($title->isTalkPage()) {
return true;
}
if ($title->isMainPage()) {
return true;
}
// Do not display when printing
if ($output->isPrintable()) {
return true;
}
// Disable if not viewing
if ($skin->getRequest()->getVal('action', 'view') != 'view') {
return true;
}
// Blacklist several namespace
if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) {
return true;
}
$output->addModules('ext.pagerating');
return true;
}
示例3: deletefontform_submit
function deletefontform_submit(Pieform $form, $values)
{
global $SESSION;
$fontname = $values['font'];
$result = delete_records('skin_fonts', 'name', $fontname);
if ($result == false) {
$SESSION->add_error_msg(get_string('cantdeletefont', 'skin'));
} else {
// Check to see if the font is being used in a skin. If it is remove it from
// the skin's viewskin data
$skins = get_records_array('skin');
if (is_array($skins)) {
foreach ($skins as $skin) {
$options = unserialize($skin->viewskin);
foreach ($options as $key => $option) {
if (preg_match('/font_family/', $key) && $option == $fontname) {
require_once get_config('docroot') . 'lib/skin.php';
$skinobj = new Skin($skin->id);
$viewskin = $skinobj->get('viewskin');
$viewskin[$key] = 'Arial';
// the default font
$skinobj->set('viewskin', $viewskin);
$skinobj->commit();
}
}
}
}
// Also delete all the files in the appropriate folder and the folder itself...
$fontpath = get_config('dataroot') . 'skins/fonts/' . $fontname;
recurse_remove_dir($fontpath);
$SESSION->add_ok_msg(get_string('fontdeleted', 'skin'));
}
redirect('/admin/site/fonts.php');
}
示例4: onSkinAfterBottomScripts
public static function onSkinAfterBottomScripts(Skin $skin, &$text)
{
global $wgWRGoogleSearchEnableSitelinksSearch, $wgWRGoogleSearchCSEID;
if (!$wgWRGoogleSearchEnableSitelinksSearch || empty($wgWRGoogleSearchCSEID) || !$skin->getTitle()->isMainPage()) {
return true;
}
$mainPageUrl = Title::newFromText(wfMessage('mainpage')->plain())->getFullURL();
$searchUrl = SpecialPage::getTitleFor('WRGoogleSearch')->getFullURL();
$sitelinksSearch = <<<HTML
\t<script type="application/ld+json">
\t\t{
\t\t\t"@context": "http://schema.org",
\t \t\t"@type": "WebSite",
\t\t\t"url": "{$mainPageUrl}",
\t\t\t"potentialAction": {
\t\t\t\t"@type": "SearchAction",
\t\t\t "target": "{$searchUrl}?q={search_term_string}",
\t\t\t "query-input": "required name=search_term_string"
\t \t\t}
\t\t}
\t</script>
HTML;
$text .= $sitelinksSearch;
return true;
}
示例5: getFbPixelScript
private static function getFbPixelScript(Skin $skin)
{
global $egFacebookConversionPixelId;
if (empty($egFacebookConversionPixelId)) {
throw new MWException("You must set \$egFacebookConversionPixelId to the Pixel ID supplied by Facebook");
}
if ($skin->getUser()->isAllowed('noanalytics')) {
return "\n<!-- Facebook Conversion Pixel tracking is disabled for this user -->\n";
}
$script = <<<SCRIPT
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', '{$egFacebookConversionPixelId}']);
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id={$egFacebookConversionPixelId}&ev=PixelInitialized" /></noscript>
SCRIPT;
return $script;
}
开发者ID:kolzchut,项目名称:mediawiki-extensions-FacebookConversionPixel,代码行数:29,代码来源:FacebookConversionPixel.hooks.php
示例6: initializeSkins
public static function initializeSkins()
{
Doctrine::getTable('Location')->getRecordListener()->get('MultiTenant')->setOption('disabled', true);
Doctrine::getTable('User')->getRecordListener()->get('MultiTenant')->setOption('disabled', true);
// Install stock Bluebox skin
$skin = new Skin();
$skin->name = 'Bluebox';
$skin->location = 'skins/bluebox';
$skin->default = TRUE;
$skin->save();
// Map all sites with no skin assigned to this default skin
$sites = Doctrine::getTable('Site')->findAll();
if ($sites) {
foreach ($sites as $site) {
if ($site->skin_id == NULL) {
$site->skin_id = $skin->skin_id;
$site->save();
$site->free(TRUE);
}
}
}
$skin->free(TRUE);
Doctrine::getTable('Location')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
Doctrine::getTable('User')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE);
}
示例7: onSkinBuildSidebar
public static function onSkinBuildSidebar(\Skin $skin, &$bar)
{
$relevUser = $skin->getRelevantUser();
if ($relevUser) {
$bar['sidebar-section-extension'][] = array('text' => wfMsg('sidebar-viewavatar'), 'href' => \SpecialPage::getTitleFor('ViewAvatar')->getLocalURL(array('user' => $relevUser->getName())), 'id' => 'n-viewavatar', 'active' => '');
}
return true;
}
示例8: onSkinAfterBottomScripts
/**
* @brief Adds Wall Notifications script to Monobook pages
*
* @return boolean
*
* @author Liz Lee
*/
public static function onSkinAfterBottomScripts(Skin $skin, &$text)
{
global $wgUser, $wgJsMimeType, $wgResourceBasePath, $wgExtensionsPath;
if ($wgUser instanceof User && $wgUser->isLoggedIn() && $skin->getSkinName() == 'monobook') {
$text .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/jquery/timeago/jquery.timeago.js\"></script>\n" . "<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/WallNotifications/scripts/WallNotifications.js\"></script>\n";
}
return true;
}
示例9: onSkinAfterBottomScripts
/**
* @brief Adds Wall Notifications script to Monobook pages
*
* @return boolean
*
* @author Liz Lee
*/
public function onSkinAfterBottomScripts(Skin $skin, &$text)
{
$app = F::App();
$user = $app->wg->User;
if ($user instanceof User && $user->isLoggedIn() && $skin->getSkinName() == 'monobook') {
$text .= "<script type=\"{$app->wg->JsMimeType}\" src=\"{$app->wg->ResourceBasePath}/resources/wikia/libraries/jquery/timeago/jquery.timeago.js\"></script>\n" . "<script type=\"{$app->wg->JsMimeType}\" src=\"{$app->wg->ExtensionsPath}/wikia/Wall/js/WallNotifications.js\"></script>\n";
}
return true;
}
示例10: fnSetOutput
public static function fnSetOutput(OutputPage &$out, Skin &$skin)
{
global $wpdBundle;
$page_path = explode('/', $skin->getTitle());
for ($pp = 1; count($page_path) >= $pp; $pp++) {
$path_part = implode('/', array_slice($page_path, 0, $pp));
self::$menuhtml .= '<li data-comment="Not removing underscore here"><a href="' . $wpdBundle['root_uri'] . str_replace(' ', '_', $path_part) . '">' . str_replace('_', ' ', $page_path[$pp - 1]) . '</a></li>';
}
return true;
}
示例11: createMenu
/**
* Hook function to draw the wenu
*/
static function createMenu(Skin $skin, &$bar)
{
global $dsmDebug;
$menu = new DynamicSidebarMenu($skin->getRelevantTitle());
$options = array("parent" => "/");
$menu->options($options);
$text = $menu->render();
$bar["DynamicSidebarMenu"] = "<div id=\"DSM\">{$text}</div>";
return true;
}
示例12: onSkinAfterBottomScripts
public static function onSkinAfterBottomScripts(Skin $skin, &$text)
{
$title = $skin->getTitle();
if (TemplateDraftHelper::allowedForTitle($title)) {
$scripts = AssetsManager::getInstance()->getURL('template_draft');
foreach ($scripts as $script) {
$text .= Html::linkedScript($script);
}
}
return true;
}
示例13: get_stylesheets_for_current_page
/**
* Helper function (called by smarty()) to determine what stylesheets to include
* on the page (based on constants, global variables, and $extraconfig)
*
* @param $stylesheets Stylesheets we already know we're going to need
* @param $extraconfig Extra configuration passed to smarty()
* @return array
*/
function get_stylesheets_for_current_page($stylesheets, $extraconfig)
{
global $USER, $SESSION, $THEME, $HEADDATA, $langselectform;
// stylesheet set up - if we're in a plugin also get its stylesheet
$allstylesheets = $THEME->get_url('style/style.css', true);
// determine if we want to include the parent css
if (isset($THEME->overrideparentcss) && $THEME->overrideparentcss && $THEME->parent) {
unset($allstylesheets[$THEME->parent]);
}
$stylesheets = array_merge($stylesheets, array_reverse(array_values($allstylesheets)));
if (defined('SECTION_PLUGINTYPE') && defined('SECTION_PLUGINNAME') && SECTION_PLUGINTYPE != 'core') {
if ($pluginsheets = $THEME->get_url('style/style.css', true, SECTION_PLUGINTYPE . '/' . SECTION_PLUGINNAME)) {
$stylesheets = array_merge($stylesheets, array_reverse($pluginsheets));
}
}
if ($adminsection = in_admin_section()) {
if ($adminsheets = $THEME->get_url('style/admin.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($adminsheets));
}
}
if (get_config('developermode') & DEVMODE_DEBUGCSS) {
$stylesheets[] = get_config('wwwroot') . 'theme/debug.css';
}
// look for extra stylesheets
if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
foreach ($extraconfig['stylesheets'] as $extrasheet) {
if ($sheets = $THEME->get_url($extrasheet, true)) {
$stylesheets = array_merge($stylesheets, array_reverse(array_values($sheets)));
}
}
}
if ($sheets = $THEME->additional_stylesheets()) {
$stylesheets = array_merge($stylesheets, $sheets);
}
// Give the skin a chance to affect the page
if (!empty($extraconfig['skin'])) {
require_once get_config('docroot') . '/lib/skin.php';
$skinobj = new Skin($extraconfig['skin']['skinid']);
$viewid = isset($extraconfig['skin']['viewid']) ? $extraconfig['skin']['viewid'] : null;
$stylesheets = array_merge($stylesheets, $skinobj->get_stylesheets($viewid));
}
$langdirection = get_string('thisdirection', 'langconfig');
// Include rtl.css for right-to-left langs
if ($langdirection == 'rtl') {
$smarty->assign('LANGDIRECTION', 'rtl');
if ($rtlsheets = $THEME->get_url('style/rtl.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($rtlsheets));
}
}
$stylesheets = append_version_number($stylesheets);
return $stylesheets;
}
示例14: deleteskin_submit
function deleteskin_submit(Pieform $form, $values)
{
global $SESSION, $USER, $skinid, $redirect;
$skin = new Skin($skinid, null);
if ($skin->get('owner') == $USER->get('id') || $USER->get('admin')) {
$skin->delete();
unlink(get_config('dataroot') . 'skins/' . $skinid . '.png');
$SESSION->add_ok_msg(get_string('skindeleted', 'skin'));
} else {
$SESSION->add_error_msg(get_string('cantdeleteskin', 'skin'));
}
redirect($redirect);
}
示例15: __construct
/**
* @param IContextSource|Skin $obj
* @throws MWException
*/
public function __construct($obj)
{
if ($obj instanceof Skin) {
// @todo: deprecate constructing with Skin
$context = $obj->getContext();
} else {
if (!$obj instanceof IContextSource) {
throw new MWException('EnhancedChangesList must be constructed with a ' . 'context source or skin.');
}
$context = $obj;
}
parent::__construct($context);
// message is set by the parent ChangesList class
$this->cacheEntryFactory = new RCCacheEntryFactory($context, $this->message);
}