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


PHP partial函数代码示例

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


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


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