Print list of languages.

@param  string $customView
@param  string $ulClass
@return HtmlString
@throws \Exception
438469
public static function printLanguages($customView = '', $ulClass='')
    {
        return new HtmlString(
            view()->make(
                ($customView ? $customView : "vendor.languages.default"), [
                'languages' => Language::all(),
                'ulClass' => $ulClass,

                ]
            )->render()
        );
    }
1218424
public function render($template, array $locals = [])
    {
        $templatePath = $this->find($template);

        if (!$templatePath) {
            throw new Exception("Unable to find template [$template]");
        }

        // View variables
        $variables = $locals + $this->globals;
        foreach ($variables as $_name => $_value) {
            $$_name = $_value;
        }

        // Shortcut for escaping HTML
        $e = function($string) {
            return htmlspecialchars($string);
        };

        // Shortcut for Language::translate()
        $t = function($string, array $vars = array()) {
            return Language::translate($string, $vars);
        };

        // Shortcut for Language::date()
        $l = function($format, $timestamp = null) {
            return Language::date($format, $timestamp);
        };

        ob_start();
        include($templatePath);
        return ob_get_clean();
    }
540526
@Override
	public String retrieveLocale(String lang) {
		String r = locales.get(lang);
		if (r == null) {
			try {
				URL u = getClass().getResource("/locales-" + lang + ".xml");
				if (u == null) {
					throw new IllegalArgumentException("Unable to load locale " +
							lang + ". Make sure you have a file called " +
							"'/locales-" + lang + ".xml' at the root of your " +
							"classpath. Did you add the CSL locale files to "
							+ "your classpath?");
				}
				r = CSLUtils.readURLToString(u, "UTF-8");
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			locales.put(lang, r);
		}
		return r;
	}
1049251
public function href($routeName = '', $customAttributes = [])
    {
        if(!$routeName) {
            $routeName = 'user.single';
        }
        $getRoute = Route::getRoutes()->getByName($routeName);
        if($getRoute) {
            $routeParams = Route::getRoutes()->getByName($routeName)->parameterNames();

            // translating language
            if($this->getTranslateLanguage()) {
                $languageSlug = $this->getTranslateLanguage();
            }
            else{
                $languageSlug = App::getLocale();
            }

            //set only requested params
            $params = [];
            foreach($routeParams as $name){
                switch ($name){
                case 'authorSlug';
                    $params['authorSlug'] = $this->slug;
                    break;

                case 'lang';
                    // don't show language slug on default language
                    if(config('project.hideDefaultLanguageInURL') && $languageSlug !=  Language::getDefault('slug')) {
                        $params['lang'] = $languageSlug;
                    }
                    break;
                }
            }

            if($customAttributes) {
                $params = array_merge($customAttributes, $params);
            }

            return route($routeName, $params);
        }else{
            throw new \Exception("Route $routeName not found");
        }

    }
218413
private function printAdminBarTree( $tree, $nodes, $ul = true ) {
		if ( is_countable( $tree ) && count( $tree ) > 0 ) {
			if ( $ul ) {
				echo '<ul class="ul-disc">';
			}
			foreach ( $tree as $node ) {
				$title = trim( strip_tags( html_entity_decode( $nodes[ $node['name'] ]->title ) ) );
				$href = $nodes[ $node['name'] ]->href;
				if ( ! empty( $title ) && $href !== '#' ) {
					echo "<li><a href='{$href}'>{$title}</a>";
					$this->printAdminBarTree( $node['children'], $nodes, true );
					echo '</li>';
				} else {
					$this->printAdminBarTree( $node['children'], $nodes, false );
				}
			}
			if ( $ul ) {
				echo '</ul>';
			}
		}
	}
728602
public function render($customAttributes = null)
    {
        if ($customAttributes != null && count($customAttributes) > 0) {
            $attributes = array_merge($this->attributes, $customAttributes);
        } else {
            $attributes = $this->attributes;

            if (count(MenuHelper::getConfig()->getAnchorElementClasses()) > 0) {
                if (!array_key_exists('class', $attributes)) {
                    $attributes['class'] = '';
                }

                foreach (MenuHelper::getConfig()->getAnchorElementClasses() as $listElementClass) {
                    $attributes['class'] .= ' ' . $listElementClass;
                }
            }
        }

        if (empty($this->name)) {
            $content = Html::link('#', $this->title, $attributes);
        } else {
            $content = Html::linkRoute($this->name, $this->title, $this->parameters, $attributes);
        }

        return $content;
    }
109964
public function listGlobalURLAliases($languageCode = null, $offset = 0, $limit = -1)
    {
        $data = $this->gateway->listGlobalEntries($languageCode, $offset, $limit);
        foreach ($data as &$entry) {
            $entry['raw_path_data'] = $this->gateway->loadPathData($entry['id']);
        }

        return $this->mapper->extractUrlAliasListFromData($data);
    }
1364957
public function setCustomResult(CustomResult $customResult)
    {
        $this->checksForCustomObject();
        if (\count($this->responseBody->getMembers()) > 0) {
            throw new \Exception(self::ERROR_CANNOT_USE_CUSTOM_AND_OTHER_RESOURCES);
        }
        $this->responseBody->addMember($customResult->getSerializer());

        $this->isCustom = true;
    }
115250
public function searchLabel($msginstancename = "defaultTranslationService", $selfedit = "false", $search, $language_search = null) {
		$this->msgInstanceName = $msginstancename;
		$this->selfedit = $selfedit;
	
		$array = $this->getAllMessagesFromService(($selfedit == "true"), $msginstancename, $language_search);
		$this->languages = $array["languages"];
		$this->search = $search;
		$this->language_search = $language_search;
		if($search) {
			$this->msgs = $array["msgs"];
	
			
			$regex = $this->stripRegexMetaChars($this->stripAccents($search));
			$this->results = $this->regex_search_array($array["msgs"], $regex);
			
			$this->error = false;
		}
		else
			$this->error = true;

		$webLibriary = new WebLibrary(array(), array('../utils.i18n.fine/src/views/css/style.css'));
		$this->template->getWebLibraryManager()->addLibrary($webLibriary);

		$this->content->addFile('../utils.i18n.fine/src/views/searchLabel.php', $this);
		$this->template->toHtml();
	}
1225180
public function showWSDL()
    {
        //check if it's a legal webservice class
        if (!in_array($this->name, $this->classNameArr)) {
            throw new Exception('No valid webservice class.');
        }

        header('Content-type: text/xml');
        if ($this->useWSDLCache && file_exists($this->wsdlfile)) {
            readfile($this->wsdlfile);
        } else {
            //make sure to refresh PHP WSDL cache system
            ini_set('soap.wsdl_cache_enabled', 0);
            echo $this->createWSDL();
        }
    }
445687
public static function language()
	{
		// Create the batch selector to change the language on a selection list.
		$lines = array(
			'<label id="batch-language-lbl" for="batch-language" class="hasTip" title="' . Lang::txt('JLIB_HTML_BATCH_LANGUAGE_LABEL') . '::' . Lang::txt('JLIB_HTML_BATCH_LANGUAGE_LABEL_DESC') . '">',
			Lang::txt('JLIB_HTML_BATCH_LANGUAGE_LABEL'),
			'</label>',
			'<select name="batch[language_id]" class="inputbox" id="batch-language-id">',
			'<option value="">' . Lang::txt('JLIB_HTML_BATCH_LANGUAGE_NOCHANGE') . '</option>',
			Select::options(ContentLanguage::existing(true, true), 'value', 'text'),
			'</select>'
		);

		return implode("\n", $lines);
	}
736997
public void printHtmlClassInfo(PrintWriter out, String strTag, String strParams, String strData)
    {
        String strClass = ((BasePanel)this.getRecordOwner()).getProperty("name");
        if (strClass != null) if (strClass.length() > 0)
            if (strData != null) if (strData.length() > 0)
        {
            this.parseHtmlClassInfo(out, strTag, strParams, strData, strClass);
        }
    }
957892
protected function renderDataView()
    {
        $data = [];
        if ( !empty( $this->options['data'] ) ) {
            $data = $this->options['data'];
        }
        $basic_columns = [];
        if ( !empty( $this->options['basic_columns'] ) ) {
            $basic_columns = $this->options['basic_columns'];
        }

        if ( empty( $this->options['model'] ) ) {
            throw new HttpException(200, 'Ошибка виджета. Не передана модель для валидации записываемых данных.');
        }
        $model = $this->options['model'];

        if ( empty( $this->options['action_write'] ) ) {
            throw new HttpException(200, 'Ошибка виджета. Не передано имя метода записи данных (action).');
        }
        $action_write = $this->options['action_write'];

        $provider = new ArrayDataProvider([
            'allModels' => $data,
        ]);

        if ( empty( $data[0] ) ) {
            // если нет первого ряда - это xml custom-файл с вложенными узлами, дерево,
            // такой массив нет возможности вывести с помощью GridView
            // просто выведем его как есть
            echo "<pre>";
            return print_r($data);
        }

        // создадим динамическую модель на столько реквизитов сколько колонок в отпарсенном файле
        // в ней пользователь произведет свой выбор
        $header_model = $this->createDynamicModel( $data[0] );

        return $this->render('data',
            ['model' => $data,
                'header_model' => $header_model,
                // список колонок для выбора
                'basic_column' => $basic_columns,
                'write_model' => $model,
                'action_write' => $action_write,
                'dataProvider' => $provider]);
    }
159179
public function single($lang, $view, $id)
    {
        $classNameArr = explode("\\", get_class($this));
        $className = str_replace("Controller", "", $classNameArr[4]);
        // if we are accessing Post Type check if we are are in category or tags and repair the class name and key for them
        $key = $view;
        if($className === "PostType") {
            if(strpos($key, 'category') !== false) {
                $className = 'Categories';
                // make categorylist to list, categoryupdate to update etc
                $key = str_replace('category', '', $key);
            }else if(strpos($key, 'tag') !== false) {
                // make taglist to list, tagupdate to update etc
                $className = 'Tags';
                $key = str_replace('tag', '', $key);
            }
        }

        $key = ($key == "list" || $key == "posts") ? 'read' : $key;
        // check if user has permissions to access this link
        if($key == 'read') {
            if(!User::hasAccess($className, $key)) {
                return view('errors.permissions', compact('lang', 'view', 'id'));
            }
        }else{
            if(!User::hasAccess($className, $key, $id, true)) {
                return view('errors.permissions', compact('lang', 'view', 'id'));
            }
        }

        return view('content');
    }
1267382
public static String getLocalizedDescription( Description description ) throws Exception {
        // try to get the language
        Class< ? > annotationclass = Description.class;
        return getLocalizedString(description, annotationclass);
    }
1137292
public function printSearchForm($customView ='', $formClass="")
    {
        return new HtmlString(
            view()->make(
                ($customView ? $customView : "vendor.search.default"), [
                'keyword' => $this->getKeyword(),
                'formClass' => $formClass
                ]
            )->render()
        );
    }
966435
private function askAboutDefaultLanguage()
    {
        $languageList = [];
        foreach(Language::ISOlist() as $language){
            $languageList[] = $language->name;
        }

        $languageName = $this->anticipate('What is your site\'s primary language?', $languageList, 'English');
        $this->PRIMARY_LANGUAGE = Language::getISOByName($languageName);
        if(!$this->PRIMARY_LANGUAGE) {
            throw  new \Exception('Langauge could not be found in ISO 639.1 list!');
        }
    }