• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wrap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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')) . ' ';
     }
 }
开发者ID:vanilla,项目名称:community,代码行数:17,代码来源:class.hooks.php


示例17: build_email

function build_email($listing)
{
    $data = (array) $listing;
    if ($email = array_get($data, 'email')) {
        $name = trim("{$data['doctor_title']} {$data['doctor_first_name']} {$data['doctor_last_name']}") . wrap($data['doctor_license_type'], ', ');
        return "{$name} <{$email}>";
    } else {
        return null;
    }
}
开发者ID:nemoDreamer,项目名称:endo,代码行数:10,代码来源:app_bootstrap.php


示例18: add_implicit_braces

 function add_implicit_braces()
 {
     $stack = array();
     $start = NULL;
     $start_indent = 0;
     $self = $this;
     $condition = function (&$token, $i) use(&$self) {
         $list = array();
         for ($j = 0; $j < 3; $j++) {
             $k = $i + 1 + $j;
             $list[$j] = isset($self->tokens[$k]) ? $self->tokens[$k] : array(NULL, NULL);
         }
         list($one, $two, $three) = $list;
         if ($one[0] === t('HERECOMMENT')) {
             return FALSE;
         }
         $tag = $token[0];
         return in_array($tag, t('TERMINATOR', 'OUTDENT')) && !($two[0] === t(':') || $one[0] === t('@') && $three[0] === t(':')) || $tag === t(',') && !is_null($one[0]) && !in_array($one[0], t('IDENTIFIER', 'NUMBER', 'STRING', '@', 'TERMINATOR', 'OUTDENT'));
     };
     $action = function (&$token, $i) use(&$self) {
         $tok = array(t('}'), '}', $token[2], 'generated' => TRUE);
         array_splice($self->tokens, $i, 0, array($tok));
     };
     $this->scan_tokens(function (&$token, $i, &$tokens) use(&$self, &$stack, &$start, &$start_indent, &$condition, &$action) {
         if (in_array($tag = $token[0], t(Rewriter::$EXPRESSION_START))) {
             $stack[] = array($tag === t('INDENT') && $self->tag($i - 1) === t('{') ? t('{') : $tag, $i);
             return 1;
         }
         if (in_array($tag, t(Rewriter::$EXPRESSION_END))) {
             $start = array_pop($stack);
             return 1;
         }
         $len = count($stack) - 1;
         if (!($tag === t(':') && (($ago = $self->tag($i - 2)) === t(':') || (!isset($stack[$len]) || $stack[$len][0] !== t('{'))))) {
             return 1;
         }
         $stack[] = array(t('{'));
         $idx = $ago === t('@') ? $i - 2 : $i - 1;
         while ($self->tag($idx - 2) === t('HERECOMMENT')) {
             $idx -= 2;
         }
         // This doesn't really work in PHP, so we assign 'generatedValue' to the
         // token and handle it in the actual parser (see Lempar.php\Parser\
         // parse()). This is pretty hacky, but it works. (Maybe...)
         //
         // TODO: In the future change this to use the wrap() function as it seems
         // to work without any problems.
         $value = wrap('{');
         $value->generated = TRUE;
         $tok = array(t('{'), $value, $token[2], 'generated' => TRUE, 'generatedValue' => TRUE);
         array_splice($tokens, $idx, 0, array($tok));
         $self->detect_end($i + 2, $condition, $action);
         return 2;
     });
 }
开发者ID:TeigneuX,项目名称:php-websocket,代码行数:55,代码来源:rewriter.php


示例19: fancyize

function fancyize($parts)
{
    $output = '';
    $i = 0;
    // don't work w/ key, because you never know if you're passed a numeric array
    foreach ($parts as $part) {
        $output .= wrap($part, ($i != 1 ? ' ' : '') . '<span class="part part_' . $i . '">', '</span> ');
        $i++;
    }
    return $output;
}
开发者ID:nemoDreamer,项目名称:endo,代码行数:11,代码来源:endo_bootstrap.php


示例20: meModule_flyoutMenu_handler

 /**
  * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu.
  *
  * @since 2.0
  * @access public
  */
 public function meModule_flyoutMenu_handler($Sender)
 {
     // Add "Mark All Viewed" to menu
     if (Gdn::session()->isValid()) {
         echo wrap(Anchor(sprite('SpMarkAllViewed') . ' ' . t('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed'));
         $CategoryID = (int) (empty(Gdn::controller()->CategoryID) ? 0 : Gdn::controller()->CategoryID);
         if ($CategoryID > 0) {
             echo wrap(Anchor(sprite('SpMarkCategoryViewed') . ' ' . t('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed'));
         }
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:17,代码来源:class.allviewed.plugin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wrap_with_site_object函数代码示例发布时间:2022-05-23
下一篇:
PHP wr2x_retina_info函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap