Пример #1
0
 /**
  * List flags
  *
  * @param	string	$flag_path	The flag directory path
  * @param	string	$value		Selected flag
  * @return	string	$list		Html code
  */
 public function get_dir_flag_list($flag_path, $value)
 {
     $list = '';
     $this->user->add_lang_ext('ernadoo/phpbbdirectory', 'directory_flags');
     $flags = $this->dir_helper->preg_grep_keys('/^DIR_FLAG_CODE_/i', $this->user->lang);
     if (extension_loaded('intl')) {
         $locale = $this->user->lang['USER_LANG'];
         $col = new \Collator($locale);
         $col->asort($flags);
     } else {
         asort($flags);
     }
     foreach ($flags as $file => $name) {
         $img_file = strtolower(substr(strrchr($file, '_'), 1)) . '.png';
         if (file_exists($flag_path . $img_file)) {
             $list .= '<option value="' . $img_file . '" ' . ($img_file == $value ? 'selected="selected"' : '') . '>' . $name . '</option>';
         }
     }
     return $list;
 }