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


PHP wrap函数代码示例

本文整理汇总了PHP中wrap函数的典型用法代码示例。如果您正苦于以下问题:PHP wrap函数的具体用法?PHP wrap怎么用?PHP wrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: smarty_function_nomobile_link

/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_nomobile_link($Params, &$Smarty)
{
    $Path = val('path', $Params, '', true);
    $Text = val('text', $Params, '', true);
    $Wrap = val('wrap', $Params, 'li');
    return Gdn_Theme::link('profile/nomobile', val('text', $Params, t("Full Site")), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
开发者ID:sitexa,项目名称:vanilla,代码行数:14,代码来源:function.nomobile_link.php

示例2: toString

 /**
  * Build HTML.
  *
  * @return string HTML.
  */
 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(val('Name', $User), 'span', array('class' => 'Username')), 'span'), userUrl($User));
         ?>
                 </li>
             <?php 
     }
     ?>
         </ul>
     </div>
     <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:36,代码来源:class.inthisdiscussionmodule.php

示例3: SandboxedString

/** Wrap output value in SandboxString by reference
 *
 * @param   mixed                   $value      Value to wrap
 * @param   PHPSandbox              $sandbox    Sandbox instance of calling code
 *
 * @return  mixed|SandboxedString   Returns the wrapped value
 */
function &wrapByRef(&$value, $sandbox)
{
    if (!$value instanceof SandboxedString && is_object($value) && method_exists($value, '__toString')) {
        $strVal = $value->__toString();
        if (is_callable($strVal)) {
            $value = new SandboxedString($strVal, $sandbox);
        }
    } else {
        if (is_array($value) && count($value)) {
            //save current array pointer
            $current_key = key($value);
            foreach ($value as $key => &$_value) {
                $value[$key] = wrap($_value, $sandbox);
            }
            //rewind array pointer
            reset($value);
            //advance array to saved array pointer
            while (key($value) !== $current_key) {
                next($value);
            }
        } else {
            if (is_string($value) && is_callable($value)) {
                $value = new SandboxedString($value, $sandbox);
            }
        }
    }
    return $value;
}
开发者ID:gbaumgart,项目名称:php-sandbox,代码行数:35,代码来源:functions.php

示例4: tutLink

function tutLink($TutorialCode, $WriteTitle = TRUE, $ThumbnailSize = 'medium', $noGrid = false)
{
    $Tutorial = GetTutorials($TutorialCode);
    if (!$Tutorial) {
        return '';
    }
    $Thumbnail = $ThumbnailSize == 'medium' ? $Tutorial['Thumbnail'] : $Tutorial['LargeThumbnail'];
    $noGrid = $noGrid ? 'no-grid' : '';
    echo '<div class="video label-selector-item ' . $noGrid . '">';
    echo '<div class="image-wrap">';
    echo '<img src="' . $Thumbnail . '" alt="' . $Tutorial['Name'] . '" class = "video-img label-selector-image" />';
    ?>
    <a class="overlay" href="<?php 
    echo url('/settings/tutorials/' . $Tutorial['Code']);
    ?>
">
        <div class="buttons">
            <div class="icon-wrapper"><?php 
    echo dashboardSymbol('play');
    ?>
</div>
        </div>
        <div class="selected"></div>
    </a>
    <?php 
    echo '</div>';
    echo $WriteTitle ? wrap($Tutorial['Name'], 'div', ['class' => 'video-title title']) : '';
    echo '</div>';
}
开发者ID:vanilla,项目名称:vanilla,代码行数:29,代码来源:gettingstarted.php

示例5: base_render_before

 public function base_render_before($sender)
 {
     if ($sender->MasterView == 'admin') {
         return;
     }
     //tell the browser this is a mobile style
     $sender->Head->addTag('meta', array('name' => 'viewport', 'content' => "width=device-width,minimum-scale=1.0,maximum-scale=1.0"));
     /*
             $sender->InformMessage(
                 'This message will stay here until you dismiss it!',
                 array(
                     'CssClass' => 'Dismissable',
                     'DismissCallbackUrl' => '/plugin/dismissmessage/'
                 )
             );
     */
     $sender->Head->addTag('meta', array('name' => 'theme-color', 'content' => "#C08F00"));
     // YOU CAN REMOVE FONT-AWESOME IN ONLINE-VERSION
     $sender->Head->addTag('link', array('rel' => 'stylesheet', 'href' => "https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"));
     //position of the panel
     $sender->CssClass .= c('MinusBaseline.Panel.Left', false) ? ' PanelLeft' : ' PanelRight';
     //add the hamburger menu
     $sender->addAsset('Content', anchor('n', url('#'), 'Hamburger'), 'Hamburger');
     //add the searchbox to the panel
     //copied from library/vendors/SmartyPlugins/function.searchbox.php
     $form = Gdn::factory('Form');
     $form->InputPrefix = '';
     $search = $form->open(array('action' => Url('/search'), 'method' => 'get')) . $form->textBox('Search', array('placeholder' => t('SearchBoxPlaceHolder', 'Search'))) . $form->button('Go', array('Name' => '')) . $form->close();
     $sender->addAsset('Panel', wrap($search, 'div', array('class' => 'SiteSearch')), 'SearchBox');
     //nomobile link to switch to the full site
     $sender->addAsset('Foot', Gdn_Theme::link('/', t(' '), '<div class="LogoFoot"><a href="%url" class="%class">%text</a></div>'), 'LogoFoot');
     //Add logo to button of site
     $sender->addAsset('Foot', Gdn_Theme::link('profile/nomobile', t('Full Site'), '<div class="NoMobile"><a href="%url" class="%class">%text</a></div>'), 'NoMobile');
 }
开发者ID:Nordic-T,项目名称:vanilla-themes,代码行数:34,代码来源:class.minusbaselinethemehooks.php

示例6: roleController_afterRolesInfo_handler

    /**
     *
     *
     * @param $Sender
     */
    public function roleController_afterRolesInfo_handler($Sender)
    {
        if (!Gdn::session()->checkPermission('Garden.Settings.Manage')) {
            return;
        }
        ?>
        <div class="row form-group">
            <div class="label-wrap-wide">
                <div class="label"><?php 
        echo t('Enable Private Communities');
        ?>
</div>
                <div class="info"><?php 
        echo t('Once enabled, only members will see inside your community.');
        ?>
</div>
            </div>
            <div class="input-wrap-right">
                <span id="private-community-toggle">
                    <?php 
        if (c('Garden.PrivateCommunity', false)) {
            echo wrap(anchor('<div class="toggle-well"></div><div class="toggle-slider"></div>', 'settings/privatecommunity/on/' . Gdn::session()->TransientKey()), 'span', array('class' => "toggle-wrap toggle-wrap-on"));
        } else {
            echo wrap(anchor('<div class="toggle-well"></div><div class="toggle-slider"></div>', 'settings/privatecommunity/off/' . Gdn::session()->TransientKey()), 'span', array('class' => "toggle-wrap toggle-wrap-off"));
        }
        ?>
                </span>
            </div>
        </div>

        <?php 
    }
开发者ID:vanilla,项目名称:vanilla,代码行数:37,代码来源:class.privatecommunity.plugin.php

示例7: smarty_function_signin_link

/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_signin_link($Params, &$Smarty)
{
    if (!Gdn::session()->isValid()) {
        $Wrap = val('wrap', $Params, 'li');
        return Gdn_Theme::link('signinout', val('text', $Params, ''), val('format', $Params, wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
    }
}
开发者ID:sitexa,项目名称:vanilla,代码行数:14,代码来源:function.signin_link.php

示例8: discussionController_beforeCommentDisplay_handler

 public function discussionController_beforeCommentDisplay_handler($sender, $args)
 {
     // Find the previous comment.
     if (!$this->previous) {
         $this->previous = $args['Discussion'];
         if ($sender->data('Page', 1) != 1) {
             $this->previous = $sender->CommentModel->get($sender->DiscussionID, 1, $sender->Offset - 1)->firstRow();
         }
     }
     // Calculate the date difference.
     $date = new DateTime($args['Comment']->DateInserted);
     $gap = $date->diff(new DateTime($this->previous->DateInserted))->days;
     $this->previous = $args['Comment'];
     if ($gap < c('TimeGap.MinDays', 7) - 1) {
         return;
     } elseif ($gap < 30) {
         $gap = sprintf(t('%s days later'), (int) $gap);
         $class = 'Days';
     } elseif ($gap < 60) {
         $gap = t('1 month later');
         $class = 'Month';
     } elseif ($gap < 365) {
         $gap = sprintf(t('%s months later'), (int) ($gap / 30));
         $class = 'Months';
     } elseif ($gap < 720) {
         $gap = t('1 year later');
         $class = 'Year';
     } else {
         $gap = sprintf(t('%s years later'), (int) ($gap / 365));
         $class = 'Years';
     }
     echo wrap($gap, 'li', ['class' => 'TimeGap ' . $class]);
 }
开发者ID:bleistivt,项目名称:timegap,代码行数:33,代码来源:class.timegap.plugin.php

示例9: testOptionHelpers

 public function testOptionHelpers()
 {
     $this->assertInstanceOf(Option\Some::class, some($this->initialValue));
     $this->assertInstanceOf(Option\None::class, none());
     $this->assertInstanceOf(Option\Some::class, wrap($this->initialValue, $this->alternativeValue));
     $this->assertInstanceOf(Option\None::class, wrap($this->initialValue, $this->initialValue));
 }
开发者ID:pldin601,项目名称:php-funky,代码行数:7,代码来源:HelperTest.php

示例10: smarty_function_custom_menu

/**
 * A placeholder for future menu items.
 *
 * @param array $Params The parameters passed into the function.
 * @param Smarty $Smarty The smarty object rendering the template.
 * @return string
 */
function smarty_function_custom_menu($Params, &$Smarty)
{
    $Controller = $Smarty->Controller;
    if (is_object($Menu = val('Menu', $Controller))) {
        $Format = val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', val('wrap', $Params, 'li')));
        $Result = '';
        foreach ($Menu->Items as $Group) {
            foreach ($Group as $Item) {
                // Make sure the item is a custom item.
                if (valr('Attributes.Standard', $Item)) {
                    continue;
                }
                // Make sure the user has permission for the item.
                if ($Permission = val('Permission', $Item)) {
                    if (!Gdn::session()->checkPermission($Permission)) {
                        continue;
                    }
                }
                if (($Url = val('Url', $Item)) && ($Text = val('Text', $Item))) {
                    $Attributes = val('Attributes', $Item);
                    $Result .= Gdn_Theme::link($Url, $Text, $Format, $Attributes) . "\r\n";
                }
            }
        }
        return $Result;
    }
    return '';
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:35,代码来源:function.custom_menu.php

示例11: smarty_function_dashboard_link

/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_dashboard_link($Params, &$Smarty)
{
    $Path = val('path', $Params, '', true);
    $Text = val('text', $Params, '', true);
    $Wrap = val('wrap', $Params, 'li');
    return Gdn_Theme::link('dashboard', val('text', $Params, ''), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
开发者ID:korelstar,项目名称:vanilla,代码行数:14,代码来源:function.dashboard_link.php

示例12: discussionController_commentInfo_handler

 /**
  * Add numbering index to discussion's comments.
  *
  * @param DiscussionController $sender Sending controller instance.
  * @param array $args Event arguments.
  */
 public function discussionController_commentInfo_handler($sender, $args)
 {
     static $number = 2;
     $offset = val('Offset', $sender, 0);
     $commentNumber = $offset + $number;
     echo wrap(anchor('#' . $commentNumber, commentUrl($args['Comment'])), 'span', ['Class' => 'MItem PostNumbering Num-' . $commentNumber]);
     $number += 1;
 }
开发者ID:vanilla,项目名称:addons,代码行数:14,代码来源:class.postnumbering.plugin.php

示例13: testWrap

 public function testWrap()
 {
     $timingFunction = wrap(function () {
         return true;
     });
     $result = $timingFunction();
     $this->assertTrue($result);
     $this->assertTrue(is_float(collector()));
 }
开发者ID:camspiers,项目名称:bench,代码行数:9,代码来源:BenchTest.php

示例14: 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']);
}
开发者ID:korelstar,项目名称:vanilla,代码行数:9,代码来源:gettingstarted.php

示例15: writeHomepageOption

function writeHomepageOption($Title, $Url, $iconName, $Current, $Description = '')
{
    $iconPath = 'applications/dashboard/design/images/' . $iconName . '.png';
    $cssClass = '';
    if ($Current == $Url) {
        $cssClass = 'active';
    }
    $cssClass .= ' Choice';
    echo wrap('<div class="image-wrap">' . img($iconPath, ['alt' => $Title, 'class' => 'label-selector-image']) . '<div class="overlay">' . '<div class="buttons">' . anchor(t('Select'), $Url, 'btn btn-overlay', ['title' => $Description, 'rel' => $Url]) . '</div>' . '<div class="selected">' . dashboardSymbol('checkmark') . '</div>' . '</div></div>' . '<div class="title">' . t($Title) . '</div>', 'div', array('class' => $cssClass . ' label-selector-item'));
}
开发者ID:vanilla,项目名称:vanilla,代码行数:10,代码来源:homepage.php


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