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


PHP Gdn_Format::Links方法代码示例

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


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

示例1: Anchor

<?php

if (!defined('APPLICATION')) {
    exit;
}
$Message = $this->_Message;
if (is_array($Message)) {
    echo '<div class="DismissMessage' . ($Message['CssClass'] == '' ? '' : ' ' . $Message['CssClass']) . '">';
    $Session = Gdn::Session();
    if ($Message['AllowDismiss'] == '1' && $Session->IsValid()) {
        echo Anchor('×', "/dashboard/message/dismiss/{$Message['MessageID']}/" . $Session->TransientKey() . '?Target=' . $this->_Sender->SelfUrl, 'Dismiss');
    }
    // echo Gdn_Format::To($this->_Message->Content, 'Html');
    echo nl2br(Gdn_Format::Links($Message['Content']));
    echo '</div>';
}
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:16,代码来源:message.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 . DS . 'vendors' . DS . 'markdown' . DS . 'markdown.php';
             $Mixed = Markdown($Mixed);
             $Mixed = Gdn_Format::Links($Mixed);
             $Mixed = Gdn_Format::Mentions($Mixed);
             return $Formatter->Format($Mixed);
         }
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:23,代码来源:class.format.php

示例3: Anchor

<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<h1><?php 
echo $this->Data('Title');
?>
</h1>
<div class="padded">
   A site map is an <a href="http://en.wikipedia.org/wiki/XML">xml</a> file that search engines can use to help index your site.
   <ul>
      <li>Your main site map is located here: <?php 
echo Gdn_Format::Links(Url('/sitemapindex.xml', TRUE));
?>
.</li>
      <li>Your <?php 
echo Anchor('robots.txt', Url('/robots.txt', TRUE));
?>
 file contains the location of this site map so that search engines that are aware of your site will know where to look.</li>
   </ul>
</div>
<div class="alert alert-info">
   <?php 
echo '<p>', sprintf(t('Learm more about %s from the following sites:'), t('sitemaps')), '</p>';
echo '<ul>';
echo '<li>', Anchor('sitemaps.org', 'http://www.sitemaps.org/'), '</li>';
echo '<li>', Anchor('Google webmaster center', 'http://www.google.com/webmasters/'), '</li>';
echo '</ul>';
?>
开发者ID:vanilla,项目名称:addons,代码行数:31,代码来源:settings.php

示例4: Wysiwyg

 public static function Wysiwyg($Mixed)
 {
     static $CustomFormatter;
     if (!isset($CustomFormatter)) {
         $CustomFormatter = C('Garden.Format.WysiwygFunction', FALSE);
     }
     if (!is_string($Mixed)) {
         return self::To($Mixed, 'Wysiwyg');
     } elseif (is_callable($CustomFormatter)) {
         return $CustomFormatter($Mixed);
     } else {
         // The text contains html and must be purified.
         $Formatter = Gdn::Factory('HtmlFormatter');
         if (is_null($Formatter)) {
             // If there is no HtmlFormatter then make sure that script injections won't work.
             return self::Display($Mixed);
         }
         // HTML filter first
         $Mixed = $Formatter->Format($Mixed);
         // Links
         $Mixed = Gdn_Format::Links($Mixed);
         // Mentions & Hashes
         $Mixed = Gdn_Format::Mentions($Mixed);
         $Mixed = Emoji::instance()->translateToHtml($Mixed);
         return $Mixed;
     }
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:27,代码来源:class.format.php

示例5: UserInfoModule_OnBasicInfo_Handler

 /**
  * Display custom fields on Profile.
  */
 public function UserInfoModule_OnBasicInfo_Handler($Sender)
 {
     try {
         // Get the custom fields
         $ProfileFields = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Profile.%', 'Profile.');
         // Import from CustomProfileFields if available
         if (!count($ProfileFields) && is_object($Sender->User) && C('Plugins.CustomProfileFields.SuggestedFields', FALSE)) {
             $ProfileFields = Gdn::UserModel()->GetAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             if ($ProfileFields) {
                 // Migrate to UserMeta & delete original
                 Gdn::UserModel()->SetMeta($Sender->User->UserID, $ProfileFields, 'Profile.');
                 Gdn::UserModel()->SaveAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             }
         }
         // Send them off for magic formatting
         $ProfileFields = $this->ParseSpecialFields($ProfileFields);
         // Get all field data, error check
         $AllFields = $this->GetProfileFields();
         if (!is_array($AllFields) || !is_array($ProfileFields)) {
             return;
         }
         // DateOfBirth is special case that core won't handle
         // Hack it in here instead
         if (C('ProfileExtender.Fields.DateOfBirth.OnProfile')) {
             // Do not use Gdn_Format::Date because it shifts to local timezone
             $ProfileFields['DateOfBirth'] = date(T('Birthday Format', 'F j, Y'), Gdn_Format::ToTimestamp($Sender->User->DateOfBirth));
             $AllFields['DateOfBirth'] = array('Label' => T('Birthday'), 'OnProfile' => TRUE);
         }
         // Display all non-hidden fields
         $ProfileFields = array_reverse($ProfileFields);
         foreach ($ProfileFields as $Name => $Value) {
             if (!$Value) {
                 continue;
             }
             if (!GetValue('OnProfile', $AllFields[$Name])) {
                 continue;
             }
             // Non-magic fields must be plain text, but we'll auto-link
             if (!in_array($Name, $this->MagicLabels)) {
                 $Value = Gdn_Format::Links(Gdn_Format::Text($Value));
             }
             echo ' <dt class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Text($AllFields[$Name]['Label']) . '</dt> ';
             echo ' <dd class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Html($Value) . '</dd> ';
         }
     } catch (Exception $ex) {
         // No errors
     }
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:51,代码来源:class.profileextender.plugin.php

示例6: Html

 /**
  * Takes a mixed variable, filters unsafe html and returns it.
  *
  * @param mixed $Mixed An object, array, or string to be formatted.
  * @return string
  */
 public static function Html($Mixed)
 {
     if (!is_string($Mixed)) {
         return self::To($Mixed, 'Html');
     } else {
         $IsHtml = strpos($Mixed, '<') !== FALSE || (bool) preg_match('/&#?[a-z0-9]{1,10};/i', $Mixed);
         if ($IsHtml) {
             // The text contains html and must be purified.
             $Formatter = Gdn::Factory('HtmlFormatter');
             if (is_null($Formatter)) {
                 // If there is no HtmlFormatter then make sure that script injections won't work.
                 return self::Display($Mixed);
             }
             // Allow the code tag to keep all enclosed html encoded.
             $Mixed = preg_replace(array('/<code([^>]*)>(.+?)<\\/code>/sei'), array('\'<code\'.RemoveQuoteSlashes(\'\\1\').\'>\'.htmlspecialchars(RemoveQuoteSlashes(\'\\2\')).\'</code>\''), $Mixed);
             // Links
             $Mixed = Gdn_Format::Links($Mixed);
             // Mentions & Hashes
             $Mixed = Gdn_Format::Mentions($Mixed);
             // nl2br
             $Mixed = preg_replace("/(\r\n)|(\r)|(\n)/", "<br />", $Mixed);
             $Result = $Formatter->Format($Mixed);
             //            $Result = $Result.
             //               "<h3>Html</h3><pre>".nl2br(htmlspecialchars(str_replace("<br />", "\n", $Mixed)))."</pre>".
             //               "<h3>Formatted</h3><pre>".nl2br(htmlspecialchars(str_replace("<br />", "\n", $Result)))."</pre>";
         } else {
             // The text does not contain text and does not have to be purified.
             // This is an optimization because purifying is very slow and memory intense.
             $Result = htmlspecialchars($Mixed);
             $Result = Gdn_Format::Mentions($Result);
             $Result = Gdn_Format::Links($Result);
             $Result = preg_replace("/(\r\n)|(\r)|(\n)/", "<br />", $Result);
         }
         return $Result;
     }
 }
开发者ID:kerphi,项目名称:Garden,代码行数:42,代码来源:class.format.php

示例7: UserInfoModule_OnBasicInfo_Handler

 /**
  * Display custom fields on Profile.
  */
 public function UserInfoModule_OnBasicInfo_Handler($Sender)
 {
     try {
         // Get the custom fields
         $ProfileFields = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Profile.%', 'Profile.');
         // Import from CustomProfileFields if available
         if (!count($ProfileFields) && is_object($Sender->User) && C('Plugins.CustomProfileFields.SuggestedFields', FALSE)) {
             $ProfileFields = Gdn::UserModel()->GetAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             if ($ProfileFields) {
                 // Migrate to UserMeta & delete original
                 Gdn::UserModel()->SetMeta($Sender->User->UserID, $ProfileFields, 'Profile.');
                 Gdn::UserModel()->SaveAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             }
         }
         // Send them off for magic formatting
         $ProfileFields = $this->ParseSpecialFields($ProfileFields);
         // Get all field data, error check
         $AllFields = $this->GetProfileFields();
         if (!is_array($AllFields) || !is_array($ProfileFields)) {
             return;
         }
         // Display all non-hidden fields
         $ProfileFields = array_reverse($ProfileFields);
         foreach ($ProfileFields as $Name => $Value) {
             if (!$Value) {
                 continue;
             }
             if (!GetValue('OnProfile', $AllFields[$Name])) {
                 continue;
             }
             if (!in_array($Name, $this->MagicLabels)) {
                 $Value = Gdn_Format::Links(htmlspecialchars($Value));
             }
             echo ' <dt class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . Gdn_Format::Text($AllFields[$Name]['Label']) . '</dt> ';
             echo ' <dd class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Name) . '">' . $Value . '</dd> ';
         }
     } catch (Exception $ex) {
         // No errors
     }
 }
开发者ID:bishopb,项目名称:vanilla,代码行数:43,代码来源:class.profileextender.plugin.php

示例8: UserInfoModule_OnBasicInfo_Handler

 /**
  * Display custom fields on Profile.
  */
 public function UserInfoModule_OnBasicInfo_Handler($Sender)
 {
     try {
         // Get the custom fields
         $Fields = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Profile.%', 'Profile.');
         // Reorder the custom fields
         // Use order of Plugins.ProfileExtender.ProfileFields first
         $Listed = $this->GetFields('Profile');
         $Fields1 = array();
         foreach ($Listed as $FieldName) {
             if (isset($Fields[$FieldName])) {
                 $Fields1[$FieldName] = $Fields[$FieldName];
             }
         }
         // Then append the user's arbitrary custom fields (if they have any) alphabetically by label
         $Fields2 = array_diff_key($Fields, $Listed);
         ksort($Fields2);
         $Fields = array_merge($Fields1, $Fields2);
         // Import from CustomProfileFields if available
         if (!count($Fields) && is_object($Sender->User) && C('Plugins.CustomProfileFields.SuggestedFields', FALSE)) {
             $Fields = Gdn::UserModel()->GetAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             if ($Fields) {
                 // Migrate to UserMeta & delete original
                 Gdn::UserModel()->SetMeta($Sender->User->UserID, $Fields, 'Profile.');
                 Gdn::UserModel()->SaveAttribute($Sender->User->UserID, 'CustomProfileFields', FALSE);
             }
         }
         // Send them off for magic formatting
         $Fields = $this->ParseSpecialFields($Fields);
         // Display all non-hidden fields
         $HideFields = $this->GetFields('Hide');
         foreach ($Fields as $Label => $Value) {
             if (in_array($Label, $HideFields)) {
                 continue;
             }
             if (!in_array($Label, $this->MagicLabels)) {
                 $Value = Gdn_Format::Links(htmlspecialchars($Value));
             }
             echo ' <dt class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Label) . '">' . Gdn_Format::Text($Label) . '</dt> ';
             echo ' <dd class="ProfileExtend Profile' . Gdn_Format::AlphaNumeric($Label) . '">' . $Value . '</dd> ';
         }
     } catch (Exception $ex) {
         // No errors
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:48,代码来源:class.profileextender.plugin.php


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