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

PHP partial函数代码示例

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

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



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

示例1: partial

function partial($param, $level = 0, $first = true)
{
    if ($first) {
        echo "\n\r";
    }
    if (is_string($param)) {
        $param = array($param);
    }
    foreach ($param as $key => $item) {
        if (is_int($key)) {
            $filename = $item;
        } else {
            $filename = $key;
        }
        if (@is_file(__ROOT__ . '/partials/' . $filename . '.php')) {
            include __ROOT__ . '/partials/' . $filename . '.php';
        } else {
            echo gTab($level) . '<div class="' . $filename . ' undefinedBlock">' . "\n\r";
            if (is_array($item)) {
                partial($item, $level + 1, false);
            }
            echo gTab($level) . '</div><!--END OF ' . $filename . '-->' . "\n\r";
        }
    }
}
开发者ID:RadiksMan,项目名称:ctr,代码行数:25,代码来源:process.php


示例2: reduce

/**
 * Almost an alias.
 *
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function reduce()
{
    $args = func_get_args();
    $reduce = function (callable $fn, array $xs, $initial = null) {
        return array_reduce($xs, $fn, $initial);
    };
    return call_user_func_array(partial($reduce), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:15,代码来源:reduce.php


示例3: aiga_nebraska_get_search_form

/**
 * Get a search form if the ajax is activated
 * @return string HTML representation of the search form
 */
function aiga_nebraska_get_search_form()
{
    if (pjaxify(true)) {
        partial('searchform', 'ajax');
    } else {
        partial('searchform');
    }
}
开发者ID:aiganebraska,项目名称:The-Show,代码行数:12,代码来源:etc_utils.php


示例4: filter

/**
 * Almost an alias.
 *
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function filter()
{
    $args = func_get_args();
    $filter = function (callable $fn, array $xs) {
        return array_filter($xs, $fn);
    };
    return call_user_func_array(partial($filter), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:15,代码来源:filter.php


示例5: lt

/**
 * Less than
 *
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function lt()
{
    $args = func_get_args();
    $lt = function ($a, $b) {
        return $a < $b;
    };
    return call_user_func_array(partial($lt), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:15,代码来源:lt.php


示例6: take

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function take()
{
    $args = func_get_args();
    $take = function ($n, array $xs) {
        return array_slice($xs, 0, $n);
    };
    return call_user_func_array(partial($take), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:take.php


示例7: gte

/**
 * Greater than or equals to
 *
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function gte()
{
    $args = func_get_args();
    $gte = function ($a, $b) {
        return $a >= $b;
    };
    return call_user_func_array(partial($gte), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:15,代码来源:gte.php


示例8: getForm

 public function getForm()
 {
     $contactForm = config('cms.contact.config.view', 'contact-form-1');
     if (!view()->exists(partial(sprintf('contact::frontend.%s', $contactForm)))) {
         $contactForm = 'contact-form-1';
     }
     return $this->setView(sprintf('frontend.%s', $contactForm), []);
 }
开发者ID:Cysha,项目名称:module-contact,代码行数:8,代码来源:PagesController.php


示例9: drop

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function drop()
{
    $args = func_get_args();
    $drop = function ($n, array $xs) {
        return array_slice($xs, $n);
    };
    return call_user_func_array(partial($drop), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:drop.php


示例10: prepend

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function prepend()
{
    $args = func_get_args();
    $prepend = function ($x, array $xs) {
        return array_merge([$x], $xs);
    };
    return call_user_func_array(partial($prepend), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:prepend.php


示例11: prop

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function prop()
{
    $args = func_get_args();
    $prop = function ($x, array $xs) {
        return get($xs, $x, false);
    };
    return call_user_func_array(partial($prop), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:prop.php


示例12: append

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function append()
{
    $args = func_get_args();
    $append = function ($x, array $xs) {
        return array_merge($xs, [$x]);
    };
    return call_user_func_array(partial($append), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:append.php


示例13: equals

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function equals()
{
    $args = func_get_args();
    $equals = function ($a, $b) {
        return $a === $b;
    };
    return call_user_func_array(partial($equals), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:13,代码来源:equals.php


示例14: mediaplugin_filter

 /**
  * mediaplugin_filter
  *
  * @param xxx $hotpot
  * @param xxx $text
  * @param xxx $options (optional, default=array)
  * @return xxx
  */
 function mediaplugin_filter($hotpot, $text, $options = array())
 {
     global $CFG, $PAGE;
     // Keep track of the id of the current quiz
     // so that eolas_fix.js is only included once in each quiz
     // Note: the cron script calls this method for multiple quizzes
     static $eolas_fix_applied = 0;
     if (!is_string($text)) {
         // non string data can not be filtered anyway
         return $text;
     }
     $newtext = $text;
     // fullclone is slow and not needed here
     foreach (array_keys($this->media_filetypes) as $filetype) {
         // set $adminsetting, the name of the $CFG setting, if any, which enables/disables filtering of this file type
         $adminsetting = '';
         if (preg_match('/^[a-z]+$/', $filetype)) {
             $hotpot_enable = 'hotpot_enable' . $filetype;
             $filter_mediaplugin_enable = 'filter_mediaplugin_enable_' . $filetype;
             if (isset($CFG->{$hotpot_enable})) {
                 $adminsetting = $hotpot_enable;
             } else {
                 if (isset($CFG->{$filter_mediaplugin_enable})) {
                     $adminsetting = $filter_mediaplugin_enable;
                 }
             }
         }
         // set $search and $replace strings
         $search = '/<a.*?href="([^"?>]*\\.' . $filetype . '[^">]*)"[^>]*>.*?<\\/a>/is';
         if ($adminsetting == '' || $CFG->{$adminsetting}) {
             // filtering of this file type is allowed
             $callback = array($this, 'hotpot_mediaplugin_filter');
             $callback = partial($callback, $filetype, $options);
             $newtext = preg_replace_callback($search, $callback, $newtext, -1, $count);
         } else {
             // filtering of this file type is disabled
             $replace = '$1<br />' . get_string('error_disabledfilter', 'hotpot', $adminsetting);
             $newtext = preg_replace($search, $replace, $newtext, -1, $count);
         }
         if ($count > 0) {
             break;
         }
     }
     if (is_null($newtext) || $newtext == $text) {
         // error or not filtered
         return $text;
     }
     if ($eolas_fix_applied == $hotpot->id) {
         // do nothing - the external javascripts have already been included for this quiz
     } else {
         $PAGE->requires->js('/mod/hotpot/mediafilter/ufo.js', true);
         $PAGE->requires->js('/mod/hotpot/mediafilter/eolas_fix.js');
         //$newtext .= "\n".'<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/hotpot/mediafilter/ufo.js"></script>';
         //$newtext .= "\n".'<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/hotpot/mediafilter/eolas_fix.js" defer="defer"></script>';
         $eolas_fix_applied = $hotpot->id;
     }
     return $newtext;
 }
开发者ID:hapaxapah,项目名称:moodle-mod_hotpot,代码行数:66,代码来源:class.php


示例15: remove

 public function remove($commentId)
 {
     // Get the comment
     $comment = $this->repo->getById($commentId);
     // Get the current user (for brevity)
     $user = $this->currentUser;
     $message = ($user->isStaff() or !$user->isStaff() and $user->id == $comment->user_id) ? view('pages.devplans.comments.remove', compact('comment')) : alert('alert-danger', "You do not have permission to remove this comment.");
     return partial('common/modal_content', ['modalHeader' => "Remove Comment", 'modalBody' => $message, 'modalFooter' => false]);
 }
开发者ID:kleitz,项目名称:bjga-scheduler,代码行数:9,代码来源:CommentController.php


示例16: each

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function each()
{
    $args = func_get_args();
    $each = function (callable $fn, array $xs) {
        array_walk($xs, $fn);
        return $xs;
    };
    return call_user_func_array(partial($each), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:14,代码来源:each.php


示例17: concat

/**
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @return mixed
 */
function concat()
{
    $args = func_get_args();
    $concat = function ($a, $b) {
        $rest = array_slice(func_get_args(), 2);
        return call_user_func_array('array_merge', array_merge([$a, $b], $rest));
    };
    return call_user_func_array(partial($concat), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:14,代码来源:concat.php


示例18: comments

 public function comments()
 {
     $output = '';
     if ($this->entity->comments->count() > 0) {
         foreach ($this->entity->comments as $c) {
             $output .= partial('common.blockquote', ['author' => $c->user->present()->name, 'content' => $c->present()->content, 'class' => $c->user->isStaff() ? ' quote-staff' : false]);
         }
     }
     return $output;
 }
开发者ID:kleitz,项目名称:bjga-scheduler,代码行数:10,代码来源:PlanPresenter.php


示例19: remove

 public function remove($itemId, $image)
 {
     // Get the item
     $item = $this->items->find($itemId);
     if ($item) {
         $content = $this->checkPermissions($item) ? View::make('pages.item.images-remove')->withItem($item)->withImage($image) : alert('danger', "You don't have access to manage images for this Xtra.");
     } else {
         $content = alert('danger', "We couldn't find the Xtra you're looking for.");
     }
     return partial('modal_content', ['modalHeader' => "Remove Image", 'modalBody' => $content, 'modalFooter' => false]);
 }
开发者ID:anodyne,项目名称:xtras,代码行数:11,代码来源:ImagesController.php


示例20: get

/**
 * Returns the value mapped to key, $notfound value if key not present.
 *
 * @author Sérgio Rafael Siqueira <[email protected]>
 *
 * @link https://clojuredocs.org/clojure.core/get
 *
 * @return mixed
 */
function get()
{
    $args = func_get_args();
    $get = function (array $xs, $x, $notfound = false) {
        if (array_key_exists($x, $xs)) {
            return $xs[$x];
        }
        return $notfound;
    };
    return call_user_func_array(partial($get), $args);
}
开发者ID:sergiors,项目名称:functional,代码行数:20,代码来源:get.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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