當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。