Get all post types for menu panel.

@param  string $lang
@return array
963348
public function menuPanelItems($lang = "")
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('PostType', 'read')) {
            return $this->noPermission();
        }

        // Find post types
        if(Input::input('keyword')) {
            $postTypes = PostType::where('name', 'like', '%test%')->paginate(PostType::$rowsPerPage);
        }else{
            $postTypes = PostType::where("slug", '!=', "post_pages")->paginate(PostType::$rowsPerPage);
        }

        // Append extra attributes
        foreach($postTypes->all() as $postType){
            $postType->belongsTo = 'post_type';
            $postType->belongsToID = $postType->postTypeID;
            $postType->label = $postType->name;
            $postType->menuLinkParameters = $postType->menuLinkParameters();
        }

        // Append columns
        $results = $postTypes->toArray();
        $results['columns'] = [
            'postTypeID' => trans('id'),
            'name' => trans('base.title'),
        ];

        return $results;
    }
944337
public function getBrowserLanguages($accept_langs = [])
    {
        user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6, no longer used', E_USER_DEPRECATED);

        if (empty($this->http_accept_language)) {
            if (empty($accept_langs) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                $accept_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
            } else {
                return $accept_langs;
            }

            $langs = [];

            foreach (explode(',', $accept_langs) as $k => $pref) {
                // split $pref again by ';q='
                // and decorate the language entries by inverted position
                if (false !== ($i = strpos($pref, ';q='))) {
                    $langs[substr($pref, 0, $i)] = [(float)substr($pref, $i + 3), -$k];
                } else {
                    $langs[$pref] = [1, -$k];
                }
            }
            arsort($langs);

            // no need to undecorate, because we're only interested in the keys
            $this->http_accept_language = array_keys($langs);
        }
        return $this->http_accept_language;
    }
390936
public function getLangs(bool $refresh = FALSE) : ObjectCollection
    {
        if (!$this->langs || $refresh)
        {
            $this->langs = LangQuery::create()
                ->find();
        }

        return $this->langs;
    }
63439
public function getAllMessages($language = null) {
	
		$this->loadAllMessages();

		// The array of messages by message, then by language:
		// array(message_key => array(language => message))
		$msgs = array();
	
		$keys = $this->getAllKeys();
	
		$languages = $this->getSupportedLanguages();
	
		foreach ($keys as $key) {
			$msgs[$key] = $this->getMessageForAllLanguages($key, $language);
		}
	
		ksort($msgs);
		$response = array("languages"=>$languages, "msgs"=>$msgs);
		return $response;
	}
1032439
public static function getMetadata($lang)
	{
		$path = self::getLanguagePath(PATH_APP . DS . 'bootstrap' . DS . \App::get('client')->name, $lang);
		$file = $lang . '.xml';

		$result = null;

		if (!is_file("$path/$file"))
		{
			$path = self::getLanguagePath(PATH_CORE . DS . 'bootstrap' . DS . ucfirst(\App::get('client')->name), $lang);
		}

		if (is_file("$path/$file"))
		{
			$result = self::parseXMLLanguageFile("$path/$file");
		}

		if (empty($result))
		{
			return null;
		}

		return $result;
	}
333674
public function postsIndex($lang, $postTypeSlug, $view)
    {
        $postType = PostType::findBySlug($postTypeSlug);
        if(!$postType) {
            return response()->view('errors.404', ['message' => "This post type does not exist!"], 404);
        }

        // check if user has permissions to access this link
        $key = ($view == 'list') ? 'read' : $view;
        if(!User::hasAccess($postTypeSlug, $key)) {
            return view('errors.permissions');
        }

        return view('content');
    }
203793
public static function languageToTerritory($lang) {
        $config = Zend_Registry::get('config');
        $territory = isset($config->resources->locale->territories->{$lang}) ?
            $config->resources->locale->territories->{$lang} :
            Zend_Locale::getLocaleToTerritory($lang);
        return $territory;
    }
261791
public function translationData($lang)
    {
        $translation = $this->translation($lang);

        if ($translation) {
            $data = json_decode($translation->entity_data);

            if (isset($data->blocks)) {
                $data->blocks = json_decode($data->blocks, true);
            }

            return $data;
        }

        return null;
    }
1080381
public function detailsJSON($lang, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Menu', 'read')) {
            return $this->noPermission();
        }
        // get selected menu
        $menu = Menu::findByID($id);

        // TODO me i marr te dhanat e menu linkave prej cachit
        $this->existingMenuLinks = MenuLink::where('menuID', $id)->orderBy("order", "ASC")->get()->toArray();
        $convertedMenuLinks = $this->convertToParentChild($this->existingMenuLinks);
        $convertedMenuLinks = $this->filterParents($convertedMenuLinks);

        $final = array(
            'list' => $convertedMenuLinks,
            'menu' => $menu,
            'languages' => Language::all()
        );

        // Fire event
        $final['events'] = Event::fire('menu:pre_update', [$final]);

        return $final;
    }
1344675
private function extractDataOfLanguage($lang)
    {
        $found = [];
        // parsing language preference instructions
        // 2_digit_code[-longer_code][;q=coefficient]
        preg_match('/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);
        // 2 digit lang code
        $code = isset($found[1]) ? $found[1] : null;
        // lang code complement
        $morecode = isset($found[3]) ? $found[3] : null;
        // full lang code
        $fullcode = $morecode ? $code.'-'.$morecode : $code;
        // coefficient
        $coef = sprintf('%3.1f', isset($found[5]) ? $found[5] : '1');
        // for sorting by coefficient
        // adding
        return array('code' => $code,'coef' => $coef,'morecode' => $morecode,'fullcode' => $fullcode);
    }
731562
public function getLanguage(string $lang): ResponseInterface
    {
        return $this->client->sendRequest($this->createRequest('GET', $this->createUri("/api/2/language/$lang/")));
    }
1220377
public function findOneLangRoot(Lang $lang, bool $refresh = FALSE) : ?Page
    {
        if (!$this->langRoot || $refresh)
        {
            $langRoot = PageQuery::create()
                ->usePageUrlQuery()
                    ->filterByLang($lang)
                ->endUse()
                ->filterByTreeLevel(1)
                ->orderByTreeLeft()
                ->findTree()
                ->getFirst();

            $this->langRoot = $langRoot;
        }

        return $this->langRoot;
    }
299238
public function getAllPostsOfCategory($lang, $postType, $categoryID)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess($postType, 'read')) {
            return $this->noPermission();
        }
        // order info
        $orderBy = (isset($_GET['order'])) ? $_GET['order'] : 'postID';
        $orderType = (isset($_GET['type'])) ? $_GET['type'] : 'DESC';

        // get postIDs from relations
        $relations = DB::table(categoriesRelationTable($postType))->where('categoryID', $categoryID)->select('postID')->get();
        $postIDs = [];
        foreach ($relations as $postID){
            $postIDs[] = $postID->postID;
        }
        // get post list
        $list = DB::table($postType)->whereIn('postID', $postIDs)->orderBy($orderBy, $orderType)->paginate(Post::$rowsPerPage);
        return Language::filterRows($list);
    }
569727
function &getSuggestions($lang, $word) {
		$sug = array();
		$osug = array();
		$matches = $this->_getMatches($lang, $word);

		if (count($matches) > 0)
			$sug = explode("\t", $this->_unhtmlentities($matches[0][4]));

		// Remove empty
		foreach ($sug as $item) {
			if ($item)
				$osug[] = $item;
		}

		return $osug;
	}
67269
public function lang($lang = NULL)
	{
		if ( ! func_num_args())
		{
			return $this->_lang;
		}
		$this->_lang = $lang;
		return $this;
	}
573790
public function getLocale( $lang = null, $utf8 = true ) {
		$suffixes = $utf8 ? [ '.UTF-8', '.UTF-8', '.utf8' ] : [ '' ];
		$normal = isset( $lang ) ? $lang : $this->getLang();
		$normalUC = strtoupper( $normal );

		// Get 'foo' from 'foo-bar'
		$parts = explode( '-', $normal );
		$short = $parts[0];
		$shortUC = strtoupper( $short );

		$versions = [
			// foo-br or en
			$normal,
			// FOO-BR or EN
			$normalUC,
			// foo_FOO or en_EN
			$short . '_' . $shortUC,
			// foo or en
			$short,
			// FOO or EN
			$shortUC,
		];
		$return = [];
		foreach ( $versions as $version ) {
			foreach ( $suffixes as $suffix ) {
				$return[] = $version . $suffix;
			}
		}
		return array_values( array_unique( $return ) );
	}
409901
public static function get_post_types() {
		$param     = array(
			'_builtin' => false,
			'public'   => true,
		);
		$post_type = get_post_types( $param );

		return array_filter( $post_type, array( __CLASS__, 'is_rewrite_supported_by' ) );

	}