Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
 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();
         }
     }
 }
Example #4
0
 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));
 }
Example #5
0
 /**
  * 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);
 }
 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());
 }
Example #7
0
 function walk($items, $depth)
 {
     $this->elements = $this->get_number_of_root_elements($items);
     return parent::walk($items, $depth);
 }