本文整理汇总了PHP中Walker::walk方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker::walk方法的具体用法?PHP Walker::walk怎么用?PHP Walker::walk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker
的用法示例。
在下文中一共展示了Walker::walk方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: walk
function walk($elements, $args = array())
{
$output = '';
$args = wp_parse_args($args, array('value' => 'slug', 'name' => 'lang_choice'));
if (!empty($args['flag'])) {
$current = wp_list_filter($elements, array($args['value'] => $args['selected']));
$lang = reset($current);
$output = sprintf('<span class="pll-select-flag">%s</span>', empty($lang->flag) ? esc_html($lang->slug) : $lang->flag);
}
$output .= sprintf('<select name="%1$s" %2$s%3$s%4$s>' . "\n" . '%5$s' . "\n" . '</select>' . "\n", $name = esc_attr($args['name']), isset($args['id']) && !$args['id'] ? '' : ' id="' . (empty($args['id']) ? $name : esc_attr($args['id'])) . '"', empty($args['class']) ? '' : ' class="' . esc_attr($args['class']) . '"', empty($args['disabled']) ? '' : ' disabled="disabled"', parent::walk($elements, -1, $args));
return $output;
}
示例2: walk
function walk(&$a)
{
$this->line = '';
$this->lastHash = 0;
try {
parent::walk($a);
} catch (\Exception $e) {
}
$this->depthLimited = $this->objectsDepth = array();
'' !== $this->line && $this->dumpLine(0);
if (isset($e)) {
throw $e;
}
$lines = implode("\n", $this->lines);
$this->lines = array();
return $lines;
}
示例3: walk
public function walk()
{
$walked = [];
//walk know pathes
foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
if (isset($this->data[$path->item])) {
if ($path->type == 'container') {
//create walker for container
$walker = new Walker();
$walker->migration = $this->migration;
$walker->map = $this->map;
$walker->data =& $this->data[$path->item];
$walker->curPath = $this->curPath . $path->item . '/';
$walker->mapPath = $path;
$walker->mapPathParent = $this->mapPath;
$walker->migtarionLog = $this->migtarionLog;
$walker->walk();
} elseif ($path->type == 'object') {
//start parse path data
$this->startObjectParse($path->object_id, $this->data[$path->item]);
}
}
$walked[$path->item] = true;
}
//check unparsed paths
foreach ($this->data as $key => &$data) {
//skip parsed and attribtes
if ($key == '@attributes' || !empty($walked[$key])) {
continue;
}
//search object for parse
$object = Migration\Object::get([['code', $key], ['migration_id', $this->migration->id]]);
if ($object) {
//parse as object
$this->startObjectParse($object, $data);
} else {
//create new map path for configure unknown path
$this->mapPath = new Migration\Map\Path();
$this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
$this->mapPath->path = $this->curPath;
$this->mapPath->item = $key;
$this->mapPath->migration_map_id = $this->map->id;
$this->mapPath->save();
}
}
}
示例4: walk
function walk($elements, $args = array())
{
return sprintf('<select name="%1$s" %2$s%3$s>' . "\n" . '%4$s' . "\n" . '</select>' . "\n", $name = empty($args['name']) ? 'lang_choice' : esc_attr($args['name']), isset($args['id']) && !$args['id'] ? '' : ' id="' . (empty($args['id']) ? $name : esc_attr($args['id'])) . '"', empty($args['class']) ? '' : ' class="' . esc_attr($args['class']) . '"', parent::walk($elements, -1, $args));
}
示例5: walk
/**
* Overrides Walker:walk to set depth argument
*
* @since 1.2
*
* @param array $elements elements to display
* @param array $args
* @return string
*/
function walk($elements, $args = array())
{
return parent::walk($elements, -1, $args);
}
示例6: walk
public function walk($elements, $max_depth = 0)
{
$this->all_elements_count = count($elements);
return str_replace('[categories-list]', parent::walk($elements, $max_depth), $this->list_container());
}
示例7: walk
function walk($items, $depth)
{
$this->elements = $this->get_number_of_root_elements($items);
return parent::walk($items, $depth);
}