本文整理汇总了PHP中next函数的典型用法代码示例。如果您正苦于以下问题:PHP next函数的具体用法?PHP next怎么用?PHP next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了next函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_form
/**
* {@inheritdoc}
*/
public function prepare_form($request, $template, $user, $row, &$error)
{
$avatar_list = $this->get_avatar_list($user);
$category = $request->variable('avatar_local_cat', key($avatar_list));
foreach ($avatar_list as $cat => $null) {
if (!empty($avatar_list[$cat])) {
$template->assign_block_vars('avatar_local_cats', array('NAME' => $cat, 'SELECTED' => $cat == $category));
}
if ($cat != $category) {
unset($avatar_list[$cat]);
}
}
if (!empty($avatar_list[$category])) {
$template->assign_vars(array('AVATAR_LOCAL_SHOW' => true));
$table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
$row_count = $col_count = $avatar_pos = 0;
$avatar_count = sizeof($avatar_list[$category]);
reset($avatar_list[$category]);
while ($avatar_pos < $avatar_count) {
$img = current($avatar_list[$category]);
next($avatar_list[$category]);
if ($col_count == 0) {
++$row_count;
$template->assign_block_vars('avatar_local_row', array());
}
$template->assign_block_vars('avatar_local_row.avatar_local_col', array('AVATAR_IMAGE' => $this->phpbb_root_path . $this->config['avatar_gallery_path'] . '/' . $img['file'], 'AVATAR_NAME' => $img['name'], 'AVATAR_FILE' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
$template->assign_block_vars('avatar_local_row.avatar_local_option', array('AVATAR_FILE' => $img['filename'], 'S_OPTIONS_AVATAR' => $img['filename'], 'CHECKED' => $img['file'] === $row['avatar']));
$col_count = ($col_count + 1) % $table_cols;
++$avatar_pos;
}
}
return true;
}
示例2: preWrite
/**
* @param cfhCompile_CodeWriter $codeWriter
* @param cfhCompile_Class_Interface $class
* @param unknown_type $sourceCode
* @param cfhCompile_ClassRegistry $classRegistry
* @return String
*/
public function preWrite(cfhCompile_CodeWriter $codeWriter, cfhCompile_Class_Interface $class, $sourceCode, cfhCompile_ClassRegistry $classRegistry)
{
if (is_null($sourceCode)) {
return NULL;
}
$tokens = token_get_all('<?php ' . $sourceCode);
$sourceCode = '';
$lastWasString = FALSE;
while ($token = current($tokens)) {
$nextIsString = is_string(next($tokens));
prev($tokens);
if (is_string($token)) {
$sourceCode .= $token;
$lastWasString = TRUE;
} else {
list($token, $text) = $token;
if ($token == T_WHITESPACE) {
if ($lastWasString === FALSE && $nextIsString === FALSE) {
$sourceCode .= ' ';
}
} else {
$sourceCode .= $text;
}
$lastWasString = FALSE;
}
next($tokens);
}
return trim(substr($sourceCode, 5));
}
示例3: loadData
/**
* Load the data
*/
private function loadData()
{
// get the current page id
$pageId = $this->getContainer()->get('page')->getId();
$navigation = FrontendNavigation::getNavigation();
$pageInfo = FrontendNavigation::getPageInfo($pageId);
$this->navigation = array();
if (isset($navigation['page'][$pageInfo['parent_id']])) {
$pages = $navigation['page'][$pageInfo['parent_id']];
// store
$pagesPrev = $pages;
$pagesNext = $pages;
// check for current id
foreach ($pagesNext as $key => $value) {
if ((int) $key != (int) $pageId) {
// go to next pointer in array
next($pagesNext);
next($pagesPrev);
} else {
break;
}
}
// get previous page
$this->navigation['previous'] = prev($pagesPrev);
// get next page
$this->navigation['next'] = next($pagesNext);
// get parent page
$this->navigation['parent'] = FrontendNavigation::getPageInfo($pageInfo['parent_id']);
}
}
示例4: isValid
public function isValid($sValue)
{
$this->_setValue($sValue);
if (null === self::$_filter) {
require_once 'Zend/Filter/Digits.php';
self::$_filter = new Zend_Filter_Digits();
}
$sValueFiltered = self::$_filter->filter($sValue);
$nLength = strlen($sValueFiltered);
if ($nLength != 10) {
$this->_error(self::LENGTH);
return false;
}
$nMod = 11;
$nSum = 0;
$aWeights = array(6, 5, 7, 2, 3, 4, 5, 6, 7);
preg_match_all("/\\d/", $sValueFiltered, $aDigits);
$aValueFiltered = $aDigits[0];
foreach ($aValueFiltered as $nDigit) {
$nWeight = current($aWeights);
$nSum += $nDigit * $nWeight;
next($aWeights);
}
if (($nSum % $nMod == 10 ? 0 : $nSum % $nMod) != $aValueFiltered[$nLength - 1]) {
$this->_error(self::CHECKSUM, $sValueFiltered);
return false;
}
return true;
}
示例5: _get_select
function _get_select()
{
$exclude = array();
$wlk = $this->_tree_walk_preorder($this->node);
while (!$wlk['recset']->EOF) {
$row = $wlk['recset']->fields;
$exclude[$row['id']] = 'yes';
$wlk['recset']->MoveNext();
}
$mySelect = new CHAW_select($this->key);
$node = $this->_tree_get_group_root_node($this->usergroup);
$attributes = array('name');
$wlk = $this->_tree_walk_preorder($node);
while ($curr = $this->_tree_walk_next($wlk)) {
$level = $this->_tree_walk_level($wlk);
$spaces = str_repeat('--', $level - 1);
$att = reset($attributes);
while ($att) {
if ($level == 0) {
$mySelect->add_option('(seleziona cartella)', $wlk['row']['id']);
} elseif ($wlk['row']['file'] == '' && !isset($exclude[$wlk['row']['id']])) {
$mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id']);
}
$att = next($attributes);
}
}
return $mySelect;
}
示例6: event_save_meta
public static function event_save_meta($result, $EM_Event)
{
if ($result && EM_ML::is_original($EM_Event)) {
//save post meta for all others as well
foreach (EM_ML::get_langs() as $lang_code => $language) {
$event = EM_ML::get_translation($EM_Event, $lang_code);
/* @var $EM_Event EM_Event */
if ($event->event_id != $EM_Event->event_id) {
self::event_merge_original_meta($event, $EM_Event);
//if we execute a meta save here, we will screw up the current em_event_save_meta $wp_filter pointer executed in do_action()
//therefore, we save the current pointer position (priority) and set it back after saving the location further down
global $wp_filter, $wp_current_filter;
$wp_filter_priority = key($wp_filter['em_event_save_meta']);
$tag = end($wp_current_filter);
//save the event meta
$event->save_meta();
//reset save_post pointer in $wp_filter to its original position
reset($wp_filter[$tag]);
do {
if (key($wp_filter[$tag]) == $wp_filter_priority) {
break;
}
} while (next($wp_filter[$tag]) !== false);
}
}
}
return $result;
}
示例7: generateJSON
function generateJSON($auth_key, $guid, $year, $filename)
{
// Get json from API
$url = "http://api.quito.junar.com/datastreams/invoke/" . $guid . "?auth_key=" . $auth_key . "&output=json_array";
$str = file_get_contents($url);
$json = json_decode($str, true);
// Array of Zonales id
$zonales_id = array(1 => "Calderón", 2 => "Eloy Alfaro", 3 => "Eugenio Espejo", 4 => "La Delicia", 5 => "Los Chillos", 6 => "Manuela Saenz", 7 => "Quitumbe", 8 => "Tumbaco", 12 => "Sur", 13 => "Norte", 16 => "Centro");
$datos = array();
// Reading JSON and verify
foreach ($json['result'] as $data) {
$id_zonal = 0;
$zonal = reset($zonales_id);
// Checks if json contains a valid zonal and returns id
while ($zonal = current($zonales_id)) {
if (strpos($zonal, $data[1]) !== false) {
$id_zonal = key($zonales_id);
break;
}
next($zonales_id);
}
// Assings data according to id
if ($id_zonal > 0) {
if ($id_zonal > 10) {
$id_zonal = $id_zonal - 10;
}
$datos[] = array("id" => $id_zonal, "zonal" => html_entity_decode($zonales_id[$id_zonal]), "periodo" => 2014, "dato" => intval($data[14]));
}
}
// Write json
file_put_contents($filename, json_encode($datos));
}
示例8: fromStringWithMessage
public function fromStringWithMessage($string, $message, $messagePrefix = '# ', $extension = null)
{
if (null !== $message) {
$message = explode("\n", $message);
foreach ($message as $line) {
$source[] = $messagePrefix . $line;
}
$source = implode("\n", $source) . PHP_EOL;
} else {
$source = '';
}
$source .= $string;
$res = $this->fromString($source, $extension);
$res = explode("\n", $res);
$line = current($res);
while (0 === strpos($line, $messagePrefix)) {
$line = next($res);
}
$out = [];
while ($line) {
$out[] = $line;
$line = next($res);
}
return implode("\n", $out);
}
示例9: getNewsCommonLink
/**
* 连表查询 公共方法
* @param string $files 查询字段
* @param array $manTable 主表 array('表名'=>'别名')
* @param array $link 关联表 array('$_link'=>'别名')
* @param string $where 查询条件
* @param string $order 排序
* @param string $limit limit
* @param int $type 1:返回一条一维数据 0:默认返回二维数组
* @return array
*/
public function getNewsCommonLink($files = '*', $manTable, $link, $where = '', $order = '', $limit = '', $type = 0)
{
$manTableName = key($manTable);
$manTableAlse = $manTable[$manTableName];
$sql = "SELECT " . $files;
$sql .= " FROM " . $manTableName . " AS " . $manTableAlse;
if ($link) {
while ($key = key($link)) {
$sql .= " LEFT JOIN " . $this->_link[$key]['table'] . " AS " . $link[$key] . " ON " . $link[$key] . "." . $this->_link[$key]['otherKey'] . " = " . $manTableAlse . "." . $this->_link[$key]['selfKey'];
next($link);
}
}
if ($where) {
$sql .= " WHERE " . $where;
}
if ($order) {
$sql .= " ORDER BY " . $order;
}
if ($limit) {
$sql .= " LIMIT " . $limit;
}
$query = $this->db->query($sql);
if ($query->num_rows > 0) {
if (!$type) {
return $query->result_array();
} else {
return $query->row_array();
}
} else {
return array();
}
}
示例10: mergeCodeCoverage
private static function mergeCodeCoverage($left, $right)
{
$coverageMerged = array();
reset($left);
reset($right);
while (current($left) && current($right)) {
$linenr_left = key($left);
$linenr_right = key($right);
if ($linenr_left < $linenr_right) {
$coverageMerged[$linenr_left] = current($left);
next($left);
} elseif ($linenr_right < $linenr_left) {
$coverageMerged[$linenr_right] = current($right);
next($right);
} else {
if (current($left) < 0 || current($right) < 0) {
$coverageMerged[$linenr_right] = current($right);
} else {
$coverageMerged[$linenr_right] = current($left) + current($right);
}
next($left);
next($right);
}
}
while (current($left)) {
$coverageMerged[key($left)] = current($left);
next($left);
}
while (current($right)) {
$coverageMerged[key($right)] = current($right);
next($right);
}
return $coverageMerged;
}
示例11: next
public function next()
{
$isValid = next($this->_collectionItems);
if (false == $isValid) {
$this->_valid = false;
}
}
示例12: next
public function next()
{
$hasNext = next($this->_taxonomiesFromWp);
if (false == $hasNext) {
$this->_hasNext = false;
}
}
示例13: advanceElementIterator
private function advanceElementIterator(\Iterator $element)
{
$element->next();
if (!$element->valid()) {
next($this->fields);
}
}
示例14: SaveArray
function SaveArray($vArray)
{
global $buffer;
// Every array starts with chr(1)+"{"
$buffer .= "{";
// Go through the given array
reset($vArray);
while (true) {
$Current = current($vArray);
$MyKey = addslashes(strval(key($vArray)));
if (is_array($Current)) {
$buffer .= $MyKey . "";
SaveArray($Current);
$buffer .= "";
} else {
$Current = addslashes($Current);
$buffer .= "{$MyKey}{$Current}";
}
++$i;
while (next($vArray) === false) {
if (++$i > count($vArray)) {
break;
}
}
if ($i > count($vArray)) {
break;
}
}
$buffer .= "}";
}
示例15: insertLineComments
static function insertLineComments($scss, $filepath = '')
{
$lines = $scss;
$new_scss_content = array();
$filepath = str_replace('\\', '/', $filepath);
foreach ($lines as $linenumber => $line) {
$line = trim($line);
$nextline = trim(next($lines));
//check if empty
if (empty($line)) {
continue;
}
//check if line is a commment
if (self::isComment($line) || self::$inside_multiline) {
$new_scss_content[] = $line;
continue;
}
//write line numbers for selectors only to reduce overhead
if (self::isSelector($line, $nextline) == FALSE || self::isFunction($line) == TRUE || self::isMixin($line) == TRUE || self::isInclude($line) == TRUE || self::isCondition($line) == TRUE || self::isLoop($line) == TRUE || self::isMap($line) == TRUE) {
$new_scss_content[] = $line;
continue;
}
//output line commment
$new_scss_content[] = self::comment_indicator_start . ' line ' . ($linenumber + 1) . ', ' . $filepath . ' ' . self::comment_indicator_end;
$new_scss_content[] = $line;
}
return implode("\n", $new_scss_content);
}