本文整理汇总了PHP中Wrap函数的典型用法代码示例。如果您正苦于以下问题:PHP Wrap函数的具体用法?PHP Wrap怎么用?PHP Wrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Wrap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_category_link
/**
*/
function smarty_function_category_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('category', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例2: informNotifications
/**
* Grabs all new notifications and adds them to the sender's inform queue.
*
* This method gets called by dashboard's hooks file to display new
* notifications on every pageload.
*
* @since 2.0.18
* @access public
*
* @param Gdn_Controller $Sender The object calling this method.
*/
public static function informNotifications($Sender)
{
$Session = Gdn::session();
if (!$Session->isValid()) {
return;
}
$ActivityModel = new ActivityModel();
// Get five pending notifications.
$Where = array('NotifyUserID' => Gdn::session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
// If we're in the middle of a visit only get very recent notifications.
$Where['DateUpdated >'] = Gdn_Format::toDateTime(strtotime('-5 minutes'));
$Activities = $ActivityModel->getWhere($Where, 0, 5)->resultArray();
$ActivityIDs = array_column($Activities, 'ActivityID');
$ActivityModel->setNotified($ActivityIDs);
$Sender->EventArguments['Activities'] =& $Activities;
$Sender->fireEvent('InformNotifications');
foreach ($Activities as $Activity) {
if ($Activity['Photo']) {
$UserPhoto = anchor(img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
} else {
$UserPhoto = '';
}
$Excerpt = Gdn_Format::plainText($Activity['Story']);
$ActivityClass = ' Activity-' . $Activity['ActivityType'];
$Sender->informMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
}
}
示例3: ToString
public function ToString()
{
if ($this->_UserData->NumRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(T('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例4: toString
/**
* Output locale links.
*
* @return string|void
*/
public function toString()
{
if (!$this->Links) {
$this->Links = $this->BuildLocales();
}
echo Wrap($this->Links, 'div', array('class' => 'LocaleOptions'));
}
示例5: smarty_function_custom_menu
/**
* A placeholder for future menu items.
*
* @param array The parameters passed into the function. This currently takes no parameters.
* @param Smarty The smarty object rendering the template.
* @return
*/
function smarty_function_custom_menu($Params, &$Smarty)
{
$Controller = $Smarty->Controller;
if (is_object($Menu = GetValue('Menu', $Controller))) {
$Format = GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', GetValue('wrap', $Params, 'li')));
$Result = '';
foreach ($Menu->Items as $Group) {
foreach ($Group as $Item) {
// Make sure the item is a custom item.
if (GetValueR('Attributes.Standard', $Item)) {
continue;
}
// Make sure the user has permission for the item.
if ($Permission = GetValue('Permission', $Item)) {
if (!Gdn::Session()->CheckPermission($Permission)) {
continue;
}
}
if (($Url = GetValue('Url', $Item)) && ($Text = GetValue('Text', $Item))) {
$Result .= Gdn_Theme::Link($Url, $Text, $Format);
}
}
}
return $Result;
}
return '';
}
示例6: Base_Render_Before
/**
* Show alternate locale options in Foot.
*/
public function Base_Render_Before($Sender)
{
// Not in Dashboard
// Block guests until guest sessions are restored
if ($Sender->MasterView == 'admin') {
return;
}
// Get locales
$LocaleModel = new LocaleModel();
$Options = $LocaleModel->EnabledLocalePacks();
$Locales = $LocaleModel->AvailableLocalePacks();
// Build & add links
$Links = '';
foreach ($Options as $Slug => $Code) {
$LocaleInfo = GetValue($Slug, $Locales);
$LocaleName = str_replace(' Transifex', '', GetValue('Name', $LocaleInfo));
// No 'Transifex' in names, pls.
$Links .= $this->BuildLocaleLink($LocaleName, $Code);
}
// Hackily add English option
$Links .= $this->BuildLocaleLink('English', 'en-CA');
$LocaleLinks = Wrap($Links, 'div', array('class' => 'languages'));
$Sender->AddAsset('Foot', $LocaleLinks);
// Add a simple style
$Sender->AddAsset('Head', '<style>.Dashboard .LocaleOptions { display: none; }</style>');
$Sender->setData('Locale', substr(Gdn::Locale()->Current(), 0, 2));
}
示例7: smarty_function_nomobile_link
/**
*/
function smarty_function_nomobile_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('profile/nomobile', GetValue('text', $Params, T("Full Site")), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例8: smarty_function_signin_link
/**
*/
function smarty_function_signin_link($Params, &$Smarty)
{
if (!Gdn::Session()->IsValid()) {
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('signinout', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
}
}
示例9: Page
public function Page($Reference)
{
$PageModel = new PageModel();
$Page = $PageModel->GetFullID($Reference);
if (!$Page) {
throw NotFoundException();
}
$this->Page = $Page;
if ($this->Head) {
SetMetaTags($Page, $this);
if ($Page->CustomCss) {
$CustomCss = "\n" . $Page->CustomCss;
if (!StringBeginsWith(trim($CustomCss), '<style', True)) {
$CustomCss = Wrap($CustomCss, 'style', array('type' => 'text/css'));
}
$this->Head->AddString($CustomCss);
}
if ($Page->CustomJs) {
$CustomJs = $Page->CustomJs;
if (!StringBeginsWith(trim($CustomJs), '<script', True)) {
$CustomJs = Wrap($CustomJs, 'script', array('type' => 'text/javascript'));
}
$this->Head->AddString($CustomJs);
}
}
if ($Page->SectionID) {
$this->Section = BuildNode($Page, 'Section');
$this->SectionID = $Page->SectionID;
CandyHooks::AddModules($this, $this->Section);
}
$this->FireEvent('ContentPage');
if ($Page->View) {
$this->View = $this->FetchViewLocation($this->View, False, False, False);
}
if (!$this->View) {
$this->View = $this->FetchViewLocation('view', 'page', '', False);
if (!$this->View) {
$this->View = 'default';
}
}
$this->Title($Page->Title);
$this->SetData('Content', $Page, True);
$this->EventArguments['Format'] =& $Page->Format;
$this->EventArguments['Body'] =& $Page->Body;
$this->FireEvent('BeforeBodyFormat');
$this->ContentBodyHtml = Gdn_Format::To($Page->Body, $Page->Format);
$Doc = PqDocument($this->ContentBodyHtml);
$Header = $Doc->Find('h1');
$CountH1 = count($Header);
if ($CountH1 == 0) {
$this->SetData('Headline', Gdn_Format::Text($Page->Title));
} elseif ($CountH1 == 1) {
$this->SetData('Headline', $Header->Text());
$Header->Remove();
$this->ContentBodyHtml = $Doc->Html();
}
//
$this->AddModule('PageInfoModule');
$this->Render();
}
示例10: DiscussionPollAnswerForm
function DiscussionPollAnswerForm($PollForm, $Poll, $PartialAnswers)
{
echo '<div class="DP_AnswerForm">';
if (GetValue('Title', $Poll) || C('Plugins.DiscussionPolls.DisablePollTitle', FALSE)) {
echo $Poll->Title;
if (trim($Poll->Title) != FALSE) {
echo '<hr />';
}
}
echo $PollForm->Open(array('action' => Url('/discussion/poll/submit/'), 'method' => 'post', 'ajax' => TRUE));
echo $PollForm->Errors();
$m = 0;
// Render poll questions
echo '<ol class="DP_AnswerQuestions">';
foreach ($Poll->Questions as $Question) {
echo '<li class="DP_AnswerQuestion">';
echo $PollForm->Hidden('DP_AnswerQuestions[]', array('value' => $Question->QuestionID));
echo Wrap($Question->Title, 'span');
echo '<ol class="DP_AnswerOptions">';
foreach ($Question->Options as $Option) {
if (GetValue($Question->QuestionID, $PartialAnswers) == $Option->OptionID) {
//fill in partial answer
echo Wrap($PollForm->Radio('DP_Answer' . $m, $Option->Title, array('Value' => $Option->OptionID, 'checked' => 'checked')), 'li');
} else {
echo Wrap($PollForm->Radio('DP_Answer' . $m, $Option->Title, array('Value' => $Option->OptionID)), 'li');
}
}
echo '</ol>';
echo '</li>';
$m++;
}
echo '</ol>';
echo $PollForm->Close('Submit');
echo '</div>';
}
示例11: WriteHomepageOption
function WriteHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
$SpriteClass = $CssClass;
if ($Current == $Url) {
$CssClass .= ' Current';
}
echo Anchor(T($Title) . Wrap(Sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description));
}
示例12: DiscussionController_BeforeDiscussionDisplay_Handler
/**
* Add a mod message to NoIndex discussions.
*/
public function DiscussionController_BeforeDiscussionDisplay_Handler($Sender, $Args)
{
if (!CheckPermission(array('Garden.Moderation.Manage', 'Garden.Curation.Manage'), FALSE)) {
return;
}
if (GetValue('NoIndex', $Sender->Data('Discussion'))) {
echo Wrap(T('Discussion marked as noindex'), 'div', array('class' => 'Warning'));
}
}
示例13: TutLink
function TutLink($TutorialCode, $WriteTitle = TRUE, $ThumbnailSize = 'medium')
{
$Tutorial = GetTutorials($TutorialCode);
if (!$Tutorial) {
return '';
}
$Thumbnail = $ThumbnailSize == 'medium' ? $Tutorial['Thumbnail'] : $Tutorial['LargeThumbnail'];
return Anchor('<img src="' . $Thumbnail . '" alt="' . $Tutorial['Name'] . '" title="' . $Tutorial['Name'] . '" />' . ($WriteTitle ? Wrap($Tutorial['Name']) : ''), 'settings/tutorials/' . $Tutorial['Code']);
}
示例14: writeHomepageOption
function writeHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
$SpriteClass = $CssClass;
if ($Current == $Url) {
$CssClass .= ' Current';
}
$CssClass .= ' Choice';
echo anchor(t($Title) . Wrap(sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description, 'rel' => $Url));
}
示例15: Base_BeforeSignInLink_Handler
public function Base_BeforeSignInLink_Handler($Sender)
{
if (!$this->IsConfigured()) {
return;
}
// if (!IsMobile())
// return;
if (!Gdn::Session()->IsValid()) {
echo "\n" . Wrap($this->_GetButton(), 'li', array('class' => 'Connect FacebookConnect'));
}
}