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


PHP Walker::walk方法代码示例

本文整理汇总了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;
 }
开发者ID:WordPressArt,项目名称:conisia,代码行数:12,代码来源:walker-dropdown.php

示例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;
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:17,代码来源:Dumper.php

示例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();
         }
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:46,代码来源:Walker.php

示例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));
 }
开发者ID:kivivuori,项目名称:jotain,代码行数:4,代码来源:walker-dropdown.php

示例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);
 }
开发者ID:JoryHogeveen,项目名称:polylang,代码行数:13,代码来源:walker-list.php

示例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());
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:5,代码来源:class-categories-list-walker.php

示例7: walk

 function walk($items, $depth)
 {
     $this->elements = $this->get_number_of_root_elements($items);
     return parent::walk($items, $depth);
 }
开发者ID:evinw,项目名称:project_gg_studios,代码行数:5,代码来源:functions.php


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