本文整理汇总了PHP中Gdn_Format::html方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::html方法的具体用法?PHP Gdn_Format::html怎么用?PHP Gdn_Format::html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::html方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkTable
/**
*
*
* @param $Data
*/
function _checkTable($Data)
{
echo "<table class='Data' width='100%' style='table-layout: fixed;'>\n";
echo "<thead><tr><td width='20%'>Field</td><td width='45%'>Current</td><td width='35%'>File</td></tr></thead>";
$First = true;
foreach ($Data as $Key => $Value) {
if (stringBeginsWith($Key, 'File_') || is_array($Value) || $Key == 'Name') {
continue;
}
$Value = Gdn_Format::html($Value);
$FileValue = Gdn_Format::html(val('File_' . $Key, $Data));
if ($Key == 'MD5') {
$Value = substr($Value, 0, 10);
$FileValue = substr($FileValue, 0, 10);
}
if ($Key == 'FileSize') {
$Value = Gdn_Upload::FormatFileSize($Value);
}
echo "<tr><td>{$Key}</td><td>{$Value}</td>";
if ($Error = val('File_Error', $Data)) {
if ($First) {
echo '<td rowspan="4">', htmlspecialchars($Error), '</td>';
}
} else {
echo "<td>{$FileValue}</td></tr>";
}
echo "\n";
$First = false;
}
echo '</table>';
}
示例2: addonDiscussionPrefix
/**
* Add prefix to the passed controller's discussion names when they are re: an addon.
*
* Ex: [AddonName] Discussion original name
*
* @param array $Discussion
*/
public function addonDiscussionPrefix($Discussion)
{
$Addon = val('Addon', $Discussion);
if ($Addon) {
$Slug = AddonModel::slug($Addon, false);
$Url = "/addon/{$Slug}";
$AddonName = val('Name', $Addon);
echo ' ' . wrap(anchor(Gdn_Format::html($AddonName), $Url), 'span', array('class' => 'Tag Tag-Addon')) . ' ';
}
}
示例3: rssHtml
/**
* Format some text in a way suitable for passing into an rss/atom feed.
* @since 2.1
* @param string $Text The text to format.
* @param string $Format The current format of the text.
* @return string
*/
public static function rssHtml($Text, $Format = 'Html')
{
if (!in_array($Text, array('Html', 'Raw'))) {
$Text = Gdn_Format::to($Text, $Format);
}
if (function_exists('FormatRssHtmlCustom')) {
return FormatRssHtmlCustom($Text);
} else {
return Gdn_Format::html($Text);
}
}
示例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);
//.........这里部分代码省略.........
示例5: t
echo $Form->label('Page', 'Page');
echo '<div class="Info2">', t('Select the location of the pocket.', 'Select the location of the pocket.'), '</div>';
echo $Form->dropdown('Page', $this->data('Pages'));
?>
</li>
<li>
<?php
echo $Form->label('Location', 'Location');
echo '<div class="Info2">', t('Select the location of the pocket.', 'Select the location of the pocket.'), '</div>';
echo $Form->dropdown('Location', array_merge(array('' => '(' . sprintf(T('Select a %s'), t('Location')) . ')'), $this->data('LocationsArray')));
// Write the help for each location type.
foreach ($this->data('Locations') as $Location => $Options) {
if (!array_key_exists('Description', $Options)) {
continue;
}
echo '<div class="Info LocationInfo ' . $Location . 'Info">', Gdn_Format::html($Options['Description']), '</div>';
}
?>
</li>
<li class="js-repeat">
<?php
echo $Form->label('Repeat', 'RepeatType');
echo '<div>', $Form->radio('RepeatType', 'Before', array('Value' => Pocket::REPEAT_BEFORE, 'Default' => true)), '</div>';
echo '<div>', $Form->radio('RepeatType', 'After', array('Value' => Pocket::REPEAT_AFTER)), '</div>';
echo '<div>', $Form->radio('RepeatType', 'Repeat Every', array('Value' => Pocket::REPEAT_EVERY)), '</div>';
// Options for repeat every.
echo '<div class="RepeatOptions RepeatEveryOptions P">', '<div class="Info2">', t('Enter numbers starting at 1.'), '</div>', $Form->label('Frequency', 'EveryFrequency', array('Class' => 'SubLabel')), $Form->textBox('EveryFrequency', array('Class' => 'SmallInput')), ' <br /> ' . $Form->label('Begin At', 'EveryBegin', array('Class' => 'SubLabel')), $Form->textBox('EveryBegin', array('Class' => 'SmallInput')), '</div>';
echo '<div>', $Form->radio('RepeatType', 'Given Indexes', array('Value' => Pocket::REPEAT_INDEX)), '</div>';
// Options for repeat indexes.
echo '<div class="RepeatOptions RepeatIndexesOptions P">', '<div class="Info2">', t('Enter a comma-delimited list of indexes, starting at 1.'), '</div>', $Form->label('Indexes', 'Indexes', array('Class' => 'SubLabel')), $Form->textBox('Indexes'), '</div>';
?>
示例6: save
/**
* Save the addon data.
*
* @param array $Stub
* @param bool|array $Settings Not used; for signature compatibility.
* @return bool|Gdn_DataSet|mixed|object|string
*/
public function save($Stub, $Settings = false)
{
trace('AddonModel->Save()');
$Session = Gdn::session();
$this->defineSchema();
// Most of the values come from the file itself.
if (isset($Stub['Path'])) {
$Path = $Stub['Path'];
} elseif (val('Checked', $Stub)) {
$Addon = $Stub;
} elseif (isset($Stub['File'])) {
$Path = combinePaths(array(PATH_UPLOADS, $Stub['File']));
} else {
if (!$Session->checkPermission('Addons.Addon.Manage') && isset($Stub['Filename'])) {
// Only admins can modify plugin attributes without the file.
$this->Validation->addValidationResult('Filename', 'ValidateRequired');
return false;
}
}
// Analyze and fix the file.
if (!isset($Addon)) {
if (isset($Path)) {
try {
$Addon = UpdateModel::analyzeAddon($Path, false);
} catch (Exception $Ex) {
$Addon = false;
$this->Validation->addValidationResult('File', '@' . $Ex->getMessage());
}
if (!is_array($Addon)) {
$this->Validation->addValidationResult('File', 'Could not analyze the addon file.');
return false;
}
$Addon = array_merge($Stub, $Addon);
} else {
$Addon = $Stub;
if (isset($Path)) {
$Addon['MD5'] = md5_file($Path);
$Addon['FileSize'] = filesize($Path);
}
}
}
// Get an existing addon.
if (isset($Addon['AddonID'])) {
$CurrentAddon = $this->getID($Addon['AddonID'], false, ['GetVersions' => true]);
} elseif (isset($Addon['AddonKey']) && isset($Addon['AddonTypeID'])) {
$CurrentAddon = $this->getID(array($Addon['AddonKey'], $Addon['AddonTypeID']), false, ['GetVersions' => true]);
} else {
$CurrentAddon = false;
}
trace($CurrentAddon, 'CurrentAddon');
$Insert = !$CurrentAddon;
if ($Insert) {
$this->addInsertFields($Addon);
}
$this->addUpdateFields($Addon);
// always add update fields
if (!$this->validate($Addon, $Insert)) {
trace('Addon did not validate');
return false;
}
// Search for the current version.
$MaxVersion = false;
$CurrentVersion = false;
if ($CurrentAddon && isset($Addon['Version'])) {
// Search for a current version.
foreach ($CurrentAddon['Versions'] as $Index => $Version) {
if (isset($Addon['AddonVersionID'])) {
if ($Addon['AddonVersionID'] == $Version['AddonVersionID']) {
$CurrentVersion = $Version;
}
} elseif (version_compare($Addon['Version'], $Version['Version']) == 0) {
$CurrentVersion = $Version;
}
// Only check for a current version if the version has been checked.
if (!$Version['Checked']) {
continue;
}
if (!$MaxVersion || version_compare($MaxVersion['Version'], $Version['Version'], '<')) {
$MaxVersion = $Version;
}
}
}
// Save the addon.
$Fields = $this->filterSchema($Addon);
if ($Insert) {
$AddonID = $this->SQL->insert($this->Name, $Fields);
// Add the activity.
$ActivityModel = new ActivityModel();
$Activity = array('ActivityType' => 'Addon', 'ActivityUserID' => $Fields['InsertUserID'], 'NotifyUserID' => ActivityModel::NOTIFY_PUBLIC, 'HeadlineFormat' => '{ActivityUserID,user} added the <a href="{Url,html}">{Data.Name}</a> addon.', 'Story' => Gdn_Format::html($Fields['Description']), 'Route' => '/addon/' . rawurlencode(self::slug($Fields, false)), 'Data' => array('Name' => $Fields['Name']));
$ActivityModel->save($Activity);
} else {
$AddonID = val('AddonID', $CurrentAddon);
// Only save the addon if it is the current version.
//.........这里部分代码省略.........
示例7: anchor
$links .= '<li>' . anchor(t('Statistics Documentation'), 'http://docs.vanillaforums.com/addons/statistics/') . '</li>';
$links .= '</ul>';
helpAsset(sprintf(t('About %s'), t('Vanilla Statistics')), $desc);
helpAsset(t('Need More Help?'), $links);
?>
<?php
if ($this->data('NotifyMessage') !== FALSE) {
?>
<div class="padded alert alert-info">
<strong><?php
echo t('Last time your forum communicated with the statistics server it received the following message:');
?>
</strong>
<p><i><?php
echo Gdn_Format::html($this->data('NotifyMessage'));
?>
</i></p>
</div>
<?php
}
?>
<?php
echo $this->Form->open();
echo $this->Form->errors();
?>
<div class="js-form">
<?php
echo $this->fetchView($this->data('FormView'), 'statistics', 'dashboard');
示例8: message
private function message()
{
return Gdn::session()->isValid() ? '' : '<div class="DismissMessage CasualMessage signup-cta Hidden">' . wrap(Gdn_Format::html(c('registercta.message', $this->defaultMessage)), 'p') . anchor(t('Register'), 'entry/register', 'Button Primary') . ' <button class="Button later">' . t('Ask me later') . '</button>' . '</div>';
}
示例9: foreach
foreach ($this->data('Versions') as $Version) {
$VersionSlug = urlencode($SlugBase . '-' . $Version['Version']);
?>
<item>
<title><?php
echo Gdn_Format::text($this->data('Name') . ' ' . $Version['Version']);
?>
</title>
<link><?php
echo url('/addon/' . $VersionSlug, TRUE);
?>
</link>
<pubDate><?php
echo date(DATE_RSS, Gdn_Format::toTimeStamp($Version['DateInserted']));
?>
</pubDate>
<dc:creator><?php
echo Gdn_Format::text($this->data('InsertName'));
?>
</dc:creator>
<guid isPermaLink="true"><?php
echo Url('/addons/addon/' . $VersionSlug, TRUE);
?>
</guid>
<description><![CDATA[<?php
echo Gdn_Format::html($this->data('Description'));
?>
]]></description>
</item>
<?php
}