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


PHP Gdn_Format::display方法代码示例

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


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

示例1: formatContent

 /**
  * Format the content of a log file.
  *
  * @param array $Log The log entry to format.
  * @return string Returns the formatted log entry.
  */
 public function formatContent($Log)
 {
     $Data = $Log['Data'];
     // TODO: Check for a custom log type handler.
     switch ($Log['RecordType']) {
         case 'Activity':
             $Result = $this->formatKey('Story', $Data);
             break;
         case 'Discussion':
             $Result = '<b>' . $this->formatKey('Name', $Data) . '</b><br />' . $this->formatKey('Body', $Data);
             break;
         case 'ActivityComment':
         case 'Comment':
             $Result = $this->formatKey('Body', $Data);
             break;
         case 'Configuration':
             $Result = $this->formatConfiguration($Data);
             break;
         case 'Registration':
         case 'User':
             $Result = $this->formatRecord(['Email', 'Name'], $Data);
             if ($DiscoveryText = val('DiscoveryText', $Data)) {
                 $Result .= '<br /><b>' . t('Why do you want to join?') . '</b><br />' . Gdn_Format::display($DiscoveryText);
             }
             if (val('Banned', $Data)) {
                 $Result .= "<br />" . t('Banned');
             }
             break;
         default:
             $Result = '';
     }
     return $Result;
 }
开发者ID:R-J,项目名称:vanilla,代码行数:39,代码来源:class.logmodel.php

示例2: markdown

 /**
  * Format a string using Markdown syntax. Also purifies the output html.
  *
  * @param mixed $Mixed An object, array, or string to be formatted.
  * @return string
  */
 public static function markdown($Mixed)
 {
     if (!is_string($Mixed)) {
         return self::to($Mixed, 'Markdown');
     } else {
         $Formatter = Gdn::factory('HtmlFormatter');
         if (is_null($Formatter)) {
             return Gdn_Format::display($Mixed);
         } else {
             require_once PATH_LIBRARY . '/vendors/markdown/Michelf/MarkdownExtra.inc.php';
             $Mixed = \Michelf\MarkdownExtra::defaultTransform($Mixed);
             $Mixed = $Formatter->format($Mixed);
             $Mixed = Gdn_Format::links($Mixed);
             $Mixed = Gdn_Format::mentions($Mixed);
             $Mixed = Emoji::instance()->translateToHtml($Mixed);
             return $Mixed;
         }
     }
 }
开发者ID:ringoma,项目名称:vanilla,代码行数:25,代码来源:class.format.php

示例3: markdown

 /**
  * Format a string using Markdown syntax. Also purifies the output HTML.
  *
  * @param mixed $Mixed An object, array, or string to be formatted.
  * @param boolean $Flavored Optional. Parse with Vanilla-flavored settings? Default true
  * @return string
  */
 public static function markdown($Mixed, $Flavored = true)
 {
     if (!is_string($Mixed)) {
         return self::to($Mixed, 'Markdown');
     } else {
         $Formatter = Gdn::factory('HtmlFormatter');
         if (is_null($Formatter)) {
             return Gdn_Format::display($Mixed);
         } else {
             require_once PATH_LIBRARY . '/vendors/markdown/Michelf/MarkdownExtra.inc.php';
             $Markdown = new MarkdownVanilla();
             // Add Vanilla customizations.
             if ($Flavored) {
                 $Markdown->addAllFlavor();
             }
             $Mixed = $Markdown->transform($Mixed);
             $Mixed = $Formatter->format($Mixed);
             $Mixed = Gdn_Format::processHTML($Mixed);
             return $Mixed;
         }
     }
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:29,代码来源:class.format.php

示例4: writeAddonMedia

/**
 * Converts addon info into a media item.
 *
 * @param $addonName
 * @param $addonInfo
 * @param $isEnabled
 * @param $addonType
 * @param $filter
 */
function writeAddonMedia($addonName, $addonInfo, $isEnabled, $addonType, $filter)
{
    $capitalCaseSheme = new \Vanilla\Utility\CapitalCaseScheme();
    $addonInfo = $capitalCaseSheme->convertArrayKeys($addonInfo, ['RegisterPermissions']);
    $screenName = Gdn_Format::display(val('Name', $addonInfo, $addonName));
    $description = Gdn_Format::html(t(val('Name', $addonInfo, $addonName) . ' Description', val('Description', $addonInfo, '')));
    $id = Gdn_Format::url($addonName) . '-addon';
    $media = new MediaItemModule($screenName, '', $description, 'li', ['id' => $id]);
    $media->setView('media-addon');
    // Icon
    $addon = Gdn::addonManager()->lookupAddon($addonName);
    $iconPath = '';
    if ($addon) {
        $iconPath = $addon->getIcon();
    }
    if (!$iconPath) {
        $iconPath = val('IconUrl', $addonInfo, 'applications/dashboard/design/images/addon-placeholder.png');
    }
    $media->setImage($iconPath);
    // Settings button
    $settingsUrl = $isEnabled ? val('SettingsUrl', $addonInfo, '') : '';
    $settingsPopupClass = val('UsePopupSettings', $addonInfo, true) ? ' js-modal' : '';
    if ($settingsUrl != '') {
        $attr['class'] = 'btn btn-icon-border' . $settingsPopupClass;
        $attr['aria-label'] = sprintf(t('Settings for %s'), $screenName);
        $attr['data-reload-page-on-save'] = false;
        $media->addButton(dashboardSymbol('settings'), $settingsUrl, $attr);
    }
    // Toggle
    if ($addonType === 'locales') {
        $action = $isEnabled ? 'disable' : 'enable';
    } else {
        $action = $filter;
    }
    if ($isEnabled) {
        $label = sprintf(t('Disable %s'), $screenName);
    } else {
        $label = sprintf(t('Enable %s'), $screenName);
    }
    $url = '/settings/' . $addonType . '/' . $action . '/' . $addonName;
    $media->setToggle(slugify($addonName), $isEnabled, $url, $label);
    // Meta
    $info = [];
    // Requirements
    $requiredApplications = val('RequiredApplications', $addonInfo, false);
    $requiredPlugins = val('RequiredPlugins', $addonInfo, false);
    $requirements = [];
    if (is_array($requiredApplications)) {
        foreach ($requiredApplications as $requiredApplication => $versionInfo) {
            $requirements[] = sprintf(t('%1$s Version %2$s'), $requiredApplication, $versionInfo);
        }
    }
    if (is_array($requiredPlugins)) {
        foreach ($requiredPlugins as $requiredPlugin => $versionInfo) {
            $requirements[] = sprintf(t('%1$s Version %2$s'), $requiredPlugin, $versionInfo);
        }
    }
    if (!empty($requirements)) {
        $requirementsMeta = sprintf(t('Requires: %s'), implode(', ', $requirements));
        $info[] = $requirementsMeta;
    }
    // Authors
    $author = val('Author', $addonInfo, '');
    $authors = [];
    // Check if singular author is set
    if ($author) {
        $authorUrl = val('AuthorUrl', $addonInfo, '');
        if ($authorUrl) {
            $authors[] = anchor($author, $authorUrl);
        } else {
            $authors[] = $author;
        }
    }
    // Check for multiple authors
    foreach (val('Authors', $addonInfo, []) as $author) {
        if (val('Homepage', $author)) {
            $authors[] = anchor(val('Name', $author), val('Homepage', $author));
        } else {
            $authors[] = val('Name', $author);
        }
    }
    if ($authors) {
        $authors = implode(', ', $authors);
        $info[] = sprintf(t('Created by %s'), $authors);
    }
    // Version Info
    $version = Gdn_Format::display(val('Version', $addonInfo, ''));
    $newVersion = val('NewVersion', $addonInfo, '');
    $upgrade = $newVersion != '' && version_compare($newVersion, $version, '>');
    if ($version != '') {
        $info[] = sprintf(t('Version %s'), $version);
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:helper_functions.php

示例5: formatContent

 /**
  * Format the content of a log file.
  *
  * @param array $Log The log entry to format.
  * @return string Returns the formatted log entry.
  */
 public function formatContent($Log)
 {
     $Data = $Log['Data'];
     $Result = '';
     $this->EventArguments['Log'] = $Log;
     $this->EventArguments['Result'] =& $Result;
     $this->fireEvent('FormatContent');
     if ($Result === '') {
         switch ($Log['RecordType']) {
             case 'Activity':
                 $Result = $this->formatKey('Story', $Data);
                 break;
             case 'Discussion':
                 $Result = '<b>' . $this->formatKey('Name', $Data) . '</b><br />' . $this->formatKey('Body', $Data);
                 break;
             case 'ActivityComment':
             case 'Comment':
                 $Result = $this->formatKey('Body', $Data);
                 break;
             case 'Configuration':
                 $Result = $this->formatConfiguration($Data);
                 break;
             case 'Registration':
             case 'User':
                 $Result = $this->formatRecord(['Email', 'Name'], $Data);
                 if ($DiscoveryText = val('DiscoveryText', $Data)) {
                     $Result .= '<br /><b>' . t('Why do you want to join?') . '</b><br />' . Gdn_Format::display($DiscoveryText);
                 }
                 if (val('Banned', $Data)) {
                     $Result .= "<br />" . t('Banned');
                 }
                 break;
         }
     }
     return $Result;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:42,代码来源:class.logmodel.php


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