Gets the user's menus list (text-value form)

@param string $k_text The key used for the text. Default: 'text'
@param string $k_value The key used for the value. Default 'value'
@return array
14892
public function get_menus($k_text = 'text', $k_value = 'value'): ?array
  {
    $c = $this->pref->get_class_cfg();
    return array_map(function($e) use($c, $k_text, $k_value){
      return [
        $k_text => $e[$c['arch']['user_options']['text']],
        $k_value => $e[$c['arch']['user_options']['id']],
        $c['arch']['user_options']['public'] => $e[$c['arch']['user_options']['public']],
        $c['arch']['user_options']['id_user'] => $e[$c['arch']['user_options']['id_user']],
        $c['arch']['user_options']['id_group'] => $e[$c['arch']['user_options']['id_group']]
      ];
    }, $this->pref->get_all(self::get_appui_option_id('menus')));
  }
677264
public function menu($items, $default = null, $title = 'Choose an item')
    {
        if (isset($items[$default]) && strpos($title, '[') === false) {
            $title .= ' [default: ' . $items[$default] . ']';
        }

        $this->line(sprintf('%s: ', $title));

        $i = 1;
        $keys = array();

        foreach ($items as $key => $item) {
            $keys[$i] = $key;
            $this->line(sprintf('  %d. %s', $i, $item));
            $i++;
        }

        $selected = $this->in();

        if ($selected === '') {
            return $default;
        }

        if (isset($keys[$selected])) {
            return $keys[$selected];
        }

        return $selected;
    }
625095
private function getAccessibleMenuItems(HCUser $user, array $menus): array
    {
        foreach ($menus as $key => $menu) {
            if (!array_key_exists('aclPermission', $menu) || $user->cannot($menu['aclPermission'])) {
                unset($menus[$key]);
            }
        }

        return array_values($menus);
    }
775335
public function user_getTreeList()
    {
        $pidList = $this->getTSFE()->register['tt_content_shortcut_recursive']
            ? $this->cObj->getTreeList(
                $this->cObj->data['uid'],
                $this->getTSFE()->register['tt_content_shortcut_recursive']
            )
            : '';
        $this->getTSFE()->register['pidInList'] = trim($this->cObj->data['uid'] . ',' . $pidList, ',');
    }
125429
public List<String> getAppMenu(String consumerKey, String consumerSecret,
			String accessToken, String accessTokenSecret)
			throws ConnectionException {
		try {
			List<String> menulist;
			httpClient = new PlatformHttpClient(consumerKey, consumerSecret,
					accessToken, accessTokenSecret);
			menulist = this.httpClient.getAppMenu();
			return menulist;
		} catch (ConnectionException conEx) {
			throw conEx;
		} catch (Exception e) {
			throw new ConnectionException("Failed to fetch appmenu: "
					+ e.getMessage());
		}
	}
811214
public function addSubMenuItem(string $k, string $v = '', string $prefix = P)
    {
        // Check if may be added if disables
        if (!$this->isAddingItemsAllowed()) {
            return $this;
        }

        // set value as key if not provided
        if (!$v) {
            $v = $k;
        }

        // Check that menu for this submenu item exists
        if (!isset($this->_menu[$prefix])) {
            return $this;
        }

        // Check if submenu item already exists
        if (isset($this->_menu[$prefix][$k])) {
            return $this;
        }

        // Check if have access to main menu item
        if (!Users::getInstance()->checkAccess($prefix, $k)) {
            return $this;
        }

        // Make main menu as array to add submenu items
        if (!is_array($this->_menu[$prefix])) {
            $this->_menu[$prefix] = [
                $prefix => $this->_menu[$prefix],
            ];
        }

        // Add submenu item
        $this->_menu[$prefix][$k] = $v;

        return $this;
    }
1119005
def get_kbd_values(kbname, searchwith=""):
    
    kb = get_kb_by_name(kbname)
    kbid = kb.id
    if not kbid:
        return []
    kbtype = kb.kbtype
    if not kbtype:
        return []
    if kbtype != 'd':
        return []
    return get_kbd_values_by_def(kb.kbdefs.to_dict(), searchwith)
209010
static function snippet($text, $keywords, $limit, $max_length, $around = array('<b>', '</b>'))
	{
		$result = array();

		$keywords = self::normalize($keywords);
		list($pre, $post) = $around;
		$prev = array();
		$after = false;

		foreach(self::normalize_hash($text) as $word_orig => $word_norm)
		{
			$is_kw = false;
			if(in_array($word_norm, $keywords))
			{
				$prev[] = $pre.$word_orig.$post;
				$is_kw = true;
			}
			else
				$prev[] = $word_orig;

			if($is_kw)
			{
				if($after)
				{
					$result = array_merge($result, $prev);
					$prev = array();
				}
				else
				{
					$result = array_merge($result, count($prev) > $limit ? array('&#133') : array(), array_slice($prev, -$limit-1));
					$prev = array();
				}

				$after = true;
			}
			else
			{
				if($after && count($prev) >= $limit)
				{
					$after = false;
					$result = array_merge($result, $prev);
					$prev = array();
				}
			}
		}

		if($after)
			$result = array_merge($result, array('&#133'), $prev);

		return strip_text(join(' ', $result).'&#133;', $max_length);
	}
484400
def menu_text(self, request=None):
        """"""
        source_field_name = settings.PAGE_FIELD_FOR_MENU_ITEM_TEXT
        if(
            source_field_name != 'menu_text' and
            hasattr(self, source_field_name)
        ):
            return getattr(self, source_field_name)
        return self.title
958188
def list():
    
    choice_len = max(map(len, _input_choices.keys()))
    tmpl = "  {:<%d}: {}\n" % choice_len
    text = ''.join(map(
        lambda k_v: tmpl.format(k_v[0], k_v[1][0]), six.iteritems(_input_choices)))
    click.echo(text)
452554
public function get($key, $default_value = null)
    {
        if (strpos($key, '.') !== false) {
            $setting = $this->getSubValue($key);
        } else {
            if ($this->hasByKey($key)) {
                $setting = $this->getByKey($key);
            } else {
                $setting = $default_value;
            }
        }
        $this->resetLang();

        if (is_null($setting)) {
            $setting = $default_value;
        }

        return $setting;
    }
1244339
public function lists($value)
    {
        return array_map(function ($item) use ($value) {
            return isset($item[$value]) ? $item[$value] : null;
        }, $this->items);
    }
979291
def menu_tree mt, pm = self
      mt.each_pair { |ch, code| 
        if code.is_a? Canis::MenuTree
          item = pm.add(ch, code.value, "") 
          current = PromptMenu.new @caller, code.value
          item.action = current
          menu_tree code, current
        else
          item = pm.add(ch, code.to_s, "", code) 
        end
      }
    end
649063
public static function headersToArray($header_text)
    {
        $headers = array();


        foreach (explode("\r\n", $header_text) as $i => $line)
            if ($i === 0)
                $headers['http_code'] = $line;
            else
            {
                if(!empty($line) && strpos($line, ':') !== false){
                    list ($key, $value) = explode(': ', $line);

                    $headers['headers'][] = array(
                        'key' => $key,
                        'value' => $value,
                    );
                }
            }

        return $headers;
    }
119363
public static function getMenuNotAllowAll(): array
    {
        $setor = !empty($_SESSION['userlogin']) ? $_SESSION['userlogin']['setor'] : "0";
        $path = "public/dash/-menu.json";
        $pathSession = !empty($setor) ? "public/dash/{$setor}/-menu.json" : "";
        $file = [];

        //public base
        if (file_exists(PATH_HOME . $path))
            $file = self::addNotShow(PATH_HOME . $path, $file);

        //public session
        if (!empty($pathSession) && file_exists(PATH_HOME . $pathSession))
            $file = self::addNotShow(PATH_HOME . $pathSession, $file);

        //para cada biblioteca
        foreach (Helper::listFolder(PATH_HOME . VENDOR) as $lib) {
            $base = PATH_HOME . VENDOR . "{$lib}/";

            //lib base
            if (file_exists($base . $path))
                $file = self::addNotShow($base . $path, $file, $base);

            //lib session
            if (!empty($pathSession) && file_exists($base . $pathSession))
                $file = self::addNotShow($base . $pathSession, $file, $base);
        }

        return $file;
    }
395608
public function getListElements( core_kernel_classes_Class $listClass, $sort = true)
    {
        $returnValue = array();

    	if($sort){
        	$levelProperty = new core_kernel_classes_Property(TaoOntology::PROPERTY_LIST_LEVEL);
        	foreach ($listClass->getInstances(false) as $element) {
        	    $literal = $element->getOnePropertyValue($levelProperty);
        	    $level = is_null($literal) ? 0 : (string) $literal;
        	    while (isset($returnValue[$level])) {
        	        $level++;
        	    }
        	    $returnValue[$level] = $element;
        	}
			uksort($returnValue, 'strnatcasecmp');
    	}
    	else{
    		$returnValue = $listClass->getInstances(false);
    	}

        return (array) $returnValue;
    }
924353
public static ColorStateList getTextColorStateList(int text_color, int selected_text_color) {
        return new ColorStateList(
                new int[][]{
                        new int[]{android.R.attr.state_selected},
                        new int[]{}
                },
                new int[]{
                        selected_text_color,
                        text_color
                }
        );
    }