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


PHP helper函数代码示例

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


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

示例1: test_call

 public function test_call()
 {
     $this->set_prefix('caller');
     $caller = call();
     $this->test(1, $caller, 'Instance create');
     $this->test(2, call() === $caller, 'Instance retrieval');
     $this->set_prefix('helpers');
     $this->test(1, function_exists('test_useful_test'));
     helper('__useful_test');
     $this->test(2, function_exists('test_useful_test'));
     $this->test(3, test_useful_test());
     $this->test(4, test_useful_test_again());
     $this->test(5, function_exists('test_useful_sub_test_advanced'));
     helper('__useful_sub_test');
     $this->test(6, test_useful_sub_test_advanced());
     $this->set_prefix('do_call');
     $this->test(1, call('__useful_test::get_caller_module_path'));
     $this->test(2, call('__useful_test'));
     $this->test(3, call('__useful_test_again'));
     $this->test(4, call('__useful_sub_test_advanced'));
     $this->set_prefix('direct');
     $this->test(1, call()->__useful_test());
     $this->test(2, call()->__useful_sub_test_advanced());
     $this->test(3, call()->__useful_test->get_caller_module_path());
     $this->test(4, call()->__useful_same->test());
     $this->set_prefix('exception');
     $this->exception_test(1, 'exception_invalid_caller');
 }
开发者ID:rentalhost,项目名称:core,代码行数:28,代码来源:core_caller.php

示例2: helper

function helper($element)
{
    if ($element instanceof DOMText) {
        return htmlspecialchars($element->nodeValue);
    } else {
        $body = '';
        foreach ($element->childNodes as $child) {
            $body .= helper($child);
        }
        if ($element instanceof DOMElement) {
            $attrs = array();
            foreach ($element->attributes as $attr) {
                $attrs[] = htmlspecialchars($attr->name) . '="' . htmlspecialchars($attr->value) . '"';
            }
            if ($attrs) {
                $attrs = ' ' . implode(' ', $attrs);
            } else {
                $attrs = '';
            }
            return '<' . $element->tagName . $attrs . '>' . $body . '</' . $element->tagName . '>';
        } else {
            return $body;
        }
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:25,代码来源:1677.php

示例3: postIndex

 public function postIndex(Request $request)
 {
     if (Auth::attempt(['username' => $request->username, 'password' => $request->password])) {
         return redirect(helper()->urlBackend('/'));
     } else {
         return redirect()->back()->withInput()->withError('Login Failed , Check Your Password or Username');
     }
 }
开发者ID:oblagiolabs,项目名称:core,代码行数:8,代码来源:LoginController.php

示例4: helper

function helper($model, $left, $right)
{
    $middle = $model->get_middle($left[NODE_ID], $right[NODE_ID]);
    if ($middle != NULL) {
        helper($model, $left, $middle[NODE_ID]);
        render($middle, $left);
        helper($model, $middle[NODE_ID], $right_);
    }
}
开发者ID:RichardFish,项目名称:d-ROC,代码行数:9,代码来源:constgraph.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $action = helper()->segmentAction();
     $right = helper()->getRight($action);
     if ($right == 'true' || $right == 'go') {
         return $next($request);
     } else {
         return redirect('401');
     }
 }
开发者ID:oblagiolabs,项目名称:core,代码行数:17,代码来源:Right.php

示例6: __construct

 function __construct()
 {
     helper('string');
     $this->ChannelUnit = new ChannelUnit(intval($this->ChannelID));
     if ($this->ChannelUnit->ChannelInfos['issystem'] != -1) {
         $this->MainTable = '#@__archives';
     } else {
         $this->MainTable = $this->ChannelUnit->ChannelInfos['addtable'];
     }
 }
开发者ID:CMS-CHINA,项目名称:secondary-development-of-Dedecms,代码行数:10,代码来源:baiduxml.class.php

示例7: buildjson

function buildjson($curr)
{
    global $id;
    $result = mysql_query("SELECT * FROM  `{$id}` WHERE  `ID` = {$curr}");
    if (!$result) {
        die(mysql_error());
    }
    $row = mysql_fetch_array($result);
    $tmp = '{id:\\"' . $row['ID'] . '\\",name:\\"' . $row['Title'] . '\\",data:{$color:\\"' . ncolor($row['rNum'], $row['rTotal']) . '\\",$author:\\"' . $row['Author'] . '\\", $content:\\"' . $row['Content'] . '\\"},children:[' . helper($curr) . ']}';
    return $tmp;
}
开发者ID:ruiiiijiiiiang,项目名称:CS292-Project,代码行数:11,代码来源:var.php

示例8: helper

function helper($model, $left, $right)
{
    global $graphstr;
    $middle = $model->get_middle($left[NODE_ID], $right[NODE_ID]);
    if ($middle != NULL) {
        #echo $left[NODE_CONTENT] . "<br/>";
        #echo $middle[NODE_CONTENT] . "<br/>";
        #echo $right[NODE_CONTENT] . "<br/><br/>";
        render($middle[NODE_CONTENT], $left[NODE_CONTENT]);
        helper($model, $left, $middle);
        helper($model, $middle, $right);
    }
}
开发者ID:RichardFish,项目名称:d-ROC,代码行数:13,代码来源:graph.php

示例9: getDelete

 public function getDelete($id)
 {
     $model = $this->model->find($id);
     if (!empty($model->id)) {
         try {
             $model->delete();
             return redirect(helper()->urlAction() . '/index')->withSuccess('Data has been deleted');
         } catch (\Exception $e) {
             return redirect(helper()->urlAction() . '/index')->withSuccess('Data Cannot be deleted');
         }
     } else {
         return redirect('404');
     }
 }
开发者ID:oblagiolabs,项目名称:core,代码行数:14,代码来源:UserController.php

示例10: helper

function helper($root, $target, &$path, &$result)
{
    if ($root == null) {
        return;
    }
    if ($root->left == null && $root->right == null) {
        if ($root->val == $target) {
            $path[] = $root->val;
            $result[] = $path;
            array_pop($path);
        }
        return;
    }
    $path[] = $root->val;
    helper($root->left, $target, $path, $result);
    helper($root->right, $target, $path, $result);
    array_pop($path);
}
开发者ID:braydenxu,项目名称:code-review,代码行数:18,代码来源:FileManager.php

示例11: longestPalindrome

function longestPalindrome($s)
{
    print $s;
    if ($s == "") {
        return;
    }
    if (strlen($s) == 1) {
        return $s;
    }
    $longest = substr($s, 0, 1);
    for ($i = 0; $i < strlen($s); $i++) {
        $tmp = helper($s, $i, $i);
        if (strlen($tmp) > strlen($longest)) {
            $longest = $tmp;
        }
        $tmp = helper($s, $i, $i + 1);
        if (strlen($tmp) > strlen($longest)) {
            $longest = $tmp;
        }
    }
    print $longest;
}
开发者ID:sifxtreme,项目名称:php-coding-exercises,代码行数:22,代码来源:longest_palindrome.php

示例12: getFormvalidation

 public function getFormvalidation()
 {
     $inputs = Input::all();
     $model = $inputs['model'];
     $unique_id = $inputs['unique_id'];
     unset($inputs['model']);
     unset($inputs['unique_id']);
     $modelFix = helper()->injectModel($model);
     if (!$modelFix->messages) {
         $messages = [];
     } else {
         $messages = $modelFix->messages;
     }
     $validation = Validator::make($inputs, $modelFix->rules($unique_id), $messages);
     if ($validation->fails()) {
         $status = 'fails';
         $errors = $validation->getMessageBag()->toArray();
     } else {
         $status = 'true';
         $errors = '';
     }
     return \Response::json(['status' => $status, 'errors' => $errors]);
 }
开发者ID:oblagiolabs,项目名称:core,代码行数:23,代码来源:BackendController.php

示例13: array

?>
                        </td>
                    <? endif; ?>
                    <td>
                        <?php 
echo $debate->created_by_name;
?>
                    </td>
                    <td>
                        <?php 
echo @helper('date.humanize', array('date' => $debate->created_on));
?>
                    </td>
                    <td>
                        <?php 
echo @helper('grid.order', array('row' => $debate, 'total' => $total));
?>
                    </td>
                    <td>
                        <?php 
echo $debate->id;
?>
                    </td>
                </tr>
            <? endforeach; ?>

            <? if (!count($debates)) : ?>
                <tr>
                    <td colspan="10" align="center" style="text-align: center;">
                        <?php 
echo @text('NO_ITEMS');
开发者ID:kedweber,项目名称:com_debates,代码行数:31,代码来源:default.php

示例14: foreach

	<? foreach ($contacts as $contact) : ?>
		<tr>
			<td width="20" align="center">
				<?= @helper('grid.checkbox', array('row' => $contact))?>
			</td>				
			<td align="left">
				<a href="<?= @route('view=contact&id='.$contact->id); ?>">
	   				<?= @escape($contact->name); ?>
	   			</a>
			</td>
			<td align="center">
				<?= @helper('grid.enable', array('row' => $contact)); ?>
            </td>
			<td align="center">
				<?= @helper('grid.order', array('row' => $contact)); ?>
			</td>
			<td align="center">
				<?= @helper('grid.access', array('row' => $contact)) ?>
			</td>
			<td align="left">
				<?  if($contact->user_id) : ?>
				    <a href="<?= @route('option=com_users&view=user&id='.$contact->user_id) ?>">
				       <?= $contact->username; ?>
					</a>
				<? endif; ?>
			</td>
		</tr>
	<? endforeach; ?>
	</tbody>	
</table>
</form>
开发者ID:raeldc,项目名称:com_learn,代码行数:31,代码来源:default.php

示例15: array

<?php 
echo @helper('behavior.validator');
?>

<script src="media://lib_koowa/js/koowa.js" />
<style src="media://lib_koowa/css/koowa.css" />

<form action="" method="post" class="-koowa-form" id="group-form">
    <div class="grid_8">
        <div class="panel title group">
            <input class="inputbox required" type="text" name="name" id="title" size="40" maxlength="255" value="<?php 
echo $group->name;
?>
" placeholder="<?php 
echo @text('Name');
?>
" />
        </div>
        
        <div class="panel">
            <h3><?php 
echo @text('Group');
?>
</h3>
        	<?php 
echo @helper('select.groups', array('name' => 'target_id', 'selected' => $group->parent_id, 'exclude' => $group));
?>
       	</div>
    </div>
</form>
开发者ID:raeldc,项目名称:nooku-server,代码行数:30,代码来源:form.php


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