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


PHP Skin::getUser方法代码示例

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


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

示例1: 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}&amp;ev=PixelInitialized" /></noscript>‬
SCRIPT;
        return $script;
    }
开发者ID:kolzchut,项目名称:mediawiki-extensions-FacebookConversionPixel,代码行数:29,代码来源:FacebookConversionPixel.hooks.php

示例2: hookAnalyticsInsideHead

    /**
     * @param Skin $skin
     * @param string $text
     * @return bool
     */
    public static function hookAnalyticsInsideHead(OutputPage &$out, Skin &$skin, &$text = '')
    {
        global $wgGoogleAnalyticsAccount, $wgGoogleAnalyticsAnonymizeIP, $wgGoogleAnalyticsOtherCode, $wgGoogleAnalyticsIgnoreNsIDs, $wgGoogleAnalyticsIgnorePages, $wgGoogleAnalyticsIgnoreSpecials;
        if ($skin->getUser()->isAllowed('noanalytics')) {
            $text .= "<!-- Web analytics code inclusion is disabled for this user. -->\r\n";
            return true;
        }
        if (count(array_filter($wgGoogleAnalyticsIgnoreSpecials, function ($v) use($skin) {
            return $skin->getTitle()->isSpecial($v);
        })) > 0 || in_array($skin->getTitle()->getNamespace(), $wgGoogleAnalyticsIgnoreNsIDs, true) || in_array($skin->getTitle()->getPrefixedText(), $wgGoogleAnalyticsIgnorePages, true)) {
            $text .= "<!-- Web analytics code inclusion is disabled for this page. -->\r\n";
            return true;
        }
        $appended = false;
        if ($wgGoogleAnalyticsAccount !== '') {
            $text .= <<<EOD
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '
EOD
 . $wgGoogleAnalyticsAccount . <<<EOD
', 'auto');

EOD
 . ($wgGoogleAnalyticsAnonymizeIP ? "  ga('set', 'anonymizeIp', true);\r\n" : "") . <<<EOD
  ga('send', 'pageview');

</script>

EOD;
            $appended = true;
        }
        if ($wgGoogleAnalyticsOtherCode !== '') {
            $text .= $wgGoogleAnalyticsOtherCode . "\r\n";
            $appended = true;
        }
        if (!$appended) {
            $text .= "<!-- No web analytics configured. -->\r\n";
        }
        $out->addHeadItem("analytics script", $text);
        return true;
    }
开发者ID:negati-ve,项目名称:mediawiki-google-analytics-extension,代码行数:51,代码来源:googleAnalytics.hooks.php

示例3: onBeforePageDisplay

 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     // Enable only if the user has turned it on in Beta Preferences, or BetaFeatures is not installed.
     // Will only be loaded if PageImages & TextExtracts extensions are installed.
     $registry = ExtensionRegistry::getInstance();
     if (!$registry->isLoaded('TextExtracts') || !class_exists('ApiQueryPageImages')) {
         $logger = LoggerFactory::getInstance('popups');
         $logger->error('Popups requires the PageImages and TextExtracts extensions.');
         return true;
     }
     if (self::getConfig()->get('PopupsBetaFeature') === true) {
         if (!class_exists('BetaFeatures')) {
             $logger = LoggerFactory::getInstance('popups');
             $logger->error('PopupsMode cannot be used as a beta feature unless ' . 'the BetaFeatures extension is present.');
             return true;
         }
         if (!BetaFeatures::isFeatureEnabled($skin->getUser(), 'popups')) {
             return true;
         }
     }
     $out->addModules(array('ext.popups', 'schema.Popups'));
     return true;
 }
开发者ID:webrooms,项目名称:mediawiki-extensions-Popups,代码行数:23,代码来源:Popups.hooks.php

示例4: onSkinEditSectionLinks

 /**
  * Changes the section edit links to add a VE edit link.
  *
  * This is attached to the MediaWiki 'SkinEditSectionLinks' hook.
  *
  * @param $skin Skin
  * @param $title Title
  * @param $section string
  * @param $tooltip string
  * @param $result array
  * @param $lang Language
  * @return bool true
  */
 public static function onSkinEditSectionLinks(Skin $skin, Title $title, $section, $tooltip, &$result, $lang)
 {
     // Only do this if the user has VE enabled
     // (and we're not in parserTests)
     // (and we're not on a foreign file description page)
     if (isset($GLOBALS['wgVisualEditorInParserTests']) || !$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable') || $title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
         return true;
     }
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     $tabMessages = $config->get('VisualEditorTabMessages');
     $veEditSection = $tabMessages['editsection'] !== null ? $tabMessages['editsection'] : 'editsection';
     $sourceEditSection = $tabMessages['editsectionsource'] !== null ? $tabMessages['editsectionsource'] : 'editsection';
     $result['editsection']['text'] = $skin->msg($sourceEditSection)->inLanguage($lang)->text();
     $veLink = array('text' => $skin->msg($veEditSection)->inLanguage($lang)->text(), 'targetTitle' => $title, 'attribs' => $result['editsection']['attribs'] + array('class' => 'mw-editsection-visualeditor'), 'query' => array('veaction' => 'edit', 'vesection' => $section), 'options' => array('noclasses', 'known'));
     $result['veeditsection'] = $veLink;
     if ($config->get('VisualEditorTabPosition') === 'before') {
         krsort($result);
         // TODO: This will probably cause weird ordering if any other extensions added something already.
         // ... wfArrayInsertBefore?
     }
     return true;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:35,代码来源:VisualEditor.hooks.php

示例5: onSkinAfterBottomScripts

 public static function onSkinAfterBottomScripts(Skin $skin, &$text = '')
 {
     global $wgGoogleUniversalAnalyticsOtherCode;
     if ($wgGoogleUniversalAnalyticsOtherCode === null || $skin->getUser()->isAllowed('noanalytics') || self::isIgnoredPage($skin->getTitle())) {
         return true;
     }
     $text .= $wgGoogleUniversalAnalyticsOtherCode . PHP_EOL;
     return true;
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-GoogleUniversalAnalytics,代码行数:9,代码来源:GoogleUniversalAnalytics.hooks.php

示例6: onSkinEditSectionLinks

 /**
  * Changes the section edit links to add a VE edit link.
  *
  * This is attached to the MediaWiki 'SkinEditSectionLinks' hook.
  *
  * @param $skin Skin
  * @param $title Title
  * @param $section string
  * @param $tooltip string
  * @param $result array
  * @param $lang Language
  * @return bool true
  */
 public static function onSkinEditSectionLinks(Skin $skin, Title $title, $section, $tooltip, &$result, $lang)
 {
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     // Exit if we're using the single edit tab.
     if ($config->get('VisualEditorUseSingleEditTab') && $skin->getUser()->getOption('visualeditor-tabs') !== 'multi-tab') {
         return true;
     }
     // Exit if we're in parserTests
     if (isset($GLOBALS['wgVisualEditorInParserTests'])) {
         return true;
     }
     // Exit if the user doesn't have VE enabled
     if (!$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable') || $skin->getUser()->getOption('visualeditor-autodisable') || $config->get('VisualEditorDisableForAnons') && $skin->getUser()->isAnon()) {
         return true;
     }
     // Exit if we're on a foreign file description page
     if ($title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
         return true;
     }
     $tabMessages = $config->get('VisualEditorTabMessages');
     $sourceEditSection = $tabMessages['editsectionsource'] !== null ? $tabMessages['editsectionsource'] : 'editsection';
     $result['editsection']['text'] = $skin->msg($sourceEditSection)->inLanguage($lang)->text();
     $availableNamespaces = $config->get('VisualEditorAvailableNamespaces');
     // add VE edit section in VE available namespaces
     if ($title->inNamespaces(array_keys(array_filter($availableNamespaces)))) {
         $veEditSection = $tabMessages['editsection'] !== null ? $tabMessages['editsection'] : 'editsection';
         $veLink = array('text' => $skin->msg($veEditSection)->inLanguage($lang)->text(), 'targetTitle' => $title, 'attribs' => $result['editsection']['attribs'] + array('class' => 'mw-editsection-visualeditor'), 'query' => array('veaction' => 'edit', 'vesection' => $section), 'options' => array('noclasses', 'known'));
         $result['veeditsection'] = $veLink;
         if ($config->get('VisualEditorTabPosition') === 'before') {
             krsort($result);
             // TODO: This will probably cause weird ordering if any other extensions added something
             // already.
             // ... wfArrayInsertBefore?
         }
     }
     return true;
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:50,代码来源:VisualEditor.hooks.php


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