Merge pull request #367 from Zwixx/master

Added the ability to configure the favorite languages
This commit is contained in:
Claude 2016-07-05 11:13:43 +02:00 committed by GitHub
commit e0680194f1
3 changed files with 43 additions and 23 deletions

View File

@ -414,6 +414,16 @@ $config['rewrite_short_tags'] = FALSE;
*/
$config['proxy_ips'] = '';
/*
|--------------------------------------------------------------------------
| Favorite Languages
|--------------------------------------------------------------------------
|
| The favorite languages, that's at the beginning of the list.
|
*/
$config['favorite_languages'] = array('text', 'html5', 'css', 'javascript', 'php', 'python', 'ruby',
'lua', 'bash', 'erlang', 'go', 'c', 'cpp', 'diff', 'latex', 'sql', 'xml');
/* End of file config.php */
/* Location: ./application/config/config.php */

View File

@ -9,24 +9,6 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
//geshi languages
$config['geshi_languages'] = array(
'text' => 'Plain Text',
'html5' => 'HTML5',
'css' => 'CSS',
'javascript' => 'JavaScript',
'php' => 'PHP',
'python' => 'Python',
'ruby' => 'Ruby',
'lua' => 'Lua',
'bash' => 'Bash',
'erlang' => 'Erlang',
'go' => 'Go',
'c' => 'C',
'cpp' => 'C++',
'diff' => 'Diff-output',
'latex' => 'LaTeX',
'sql' => 'SQL',
'xml' => 'XML',
'' => '', // separator
'4cs' => '4CS',
'6502acme' => 'MOS 6502',
'6502kickass' => 'MOS 6502 Kick Assembler',
@ -51,6 +33,7 @@ $config['geshi_languages'] = array(
'avisynth' => 'AviSynth',
'awk' => 'Awk',
'bascomavr' => 'BASCOM AVR',
'bash' => 'Bash',
'basic4gl' => 'Basic4GL',
'bbcode' => 'BBCode',
'bf' => 'Brainfuck',
@ -58,9 +41,11 @@ $config['geshi_languages'] = array(
'blitzbasic' => 'BlitzBasic',
'bnf' => 'BNF (Backus-Naur form)',
'boo' => 'Boo',
'c' => 'C',
'c_loadrunner' => 'C (for LoadRunner)',
'c_mac' => 'C for Macs',
'c_winapi' => 'C with WiAPI',
'cpp' => 'C++',
'caddcl' => 'CAD DCL (Dialog Control Language)',
'cadlisp' => 'AutoCAD/IntelliCAD Lisp',
'cfdg' => 'CFDG',
@ -74,6 +59,7 @@ $config['geshi_languages'] = array(
'coffeescript' => 'CoffeeScript',
'cpp-winapi' => 'C++ with WinAPI',
'csharp' => 'C#',
'css' => 'CSS',
'cuesheet' => 'Cuesheet',
'd' => 'D',
'dart' => 'Dart',
@ -81,6 +67,7 @@ $config['geshi_languages'] = array(
'dcl' => 'DCL',
'dcpu16' => 'DCPU/16 Assembly',
'delphi' => 'Delphi (Object Pascal)',
'diff' => 'Diff-output',
'div' => 'DIV',
'dos' => 'DOS',
'dot' => 'dot',
@ -89,6 +76,7 @@ $config['geshi_languages'] = array(
'eiffel' => 'Eiffel',
'email' => 'Email (mbox/eml/RFC format)',
'epc' => 'Enerscript',
'erlang' => 'Erlang',
'euphoria' => 'Euphoria',
'ezt' => 'EZT',
'f1' => 'Formula One',
@ -106,6 +94,7 @@ $config['geshi_languages'] = array(
'glsl' => 'glSlang',
'gml' => 'GML',
'gnuplot' => 'Gnuplot script',
'go' => 'Go',
'groovy' => 'Groovy',
'gwbasic' => 'GwBasic',
'haskell' => 'Haskell',
@ -113,6 +102,7 @@ $config['geshi_languages'] = array(
'hicest' => 'HicEst',
'hq9plus' => 'HQ9+',
'html4strict' => 'HTML 4.01 strict',
'html5' => 'HTML5',
'icon' => 'Icon',
'idl' => 'Unoidl',
'ini' => 'INI',
@ -123,12 +113,14 @@ $config['geshi_languages'] = array(
'j' => 'J',
'java' => 'Java',
'java5' => 'Java 5',
'javascript' => 'JavaScript',
'jcl' => 'Job Control Language',
'jquery' => 'jQuery 1.3',
//'kixtart' => 'PHP',
'klonec' => 'KLone with C',
'klonecpp' => 'KLone with C++',
'latex' => 'LaTeX',
'lb' => 'Liberty BASIC',
'ldif' => 'LDIF',
'lisp' => 'Generic Lisp',
@ -141,6 +133,7 @@ $config['geshi_languages'] = array(
'lotusscript' => 'LotusScript',
'lscript' => 'Lightwave Script',
'lsl2' => 'Linden Scripting',
'lua' => 'Lua',
'm68k' => 'Motorola 68000 Assembler',
'magiksf' => 'MagikSF',
'make' => 'Make',
@ -178,6 +171,7 @@ $config['geshi_languages'] = array(
'perl' => 'Perl',
'perl6' => 'Perl 6',
'pf' => 'OpenBSD packet filter',
'php' => 'PHP',
'pic16' => 'PIC16 Assembler',
'pike' => 'Pike',
'pixelbender' => 'Pixel Bender 1.0',
@ -195,6 +189,7 @@ $config['geshi_languages'] = array(
'providex' => 'ProvideX',
'purebasic' => 'PureBasic',
'pys60' => 'Python for S60',
'python' => 'Python',
'q' => 'q/kdb+',
'qbasic' => 'QBasic/QuickBASIC',
'qml' => 'QML',
@ -207,6 +202,7 @@ $config['geshi_languages'] = array(
'robots' => 'robots.txt',
'rpmspec' => 'RPM Spec',
'rsplus' => 'R',
'ruby' => 'Ruby',
'rust' => 'Rust',
'sas' => 'SAS',
'scala' => 'Scala',
@ -218,11 +214,13 @@ $config['geshi_languages'] = array(
'smarty' => 'Smarty template',
'spark' => 'SPARK',
'sparql' => 'SPARQL',
'sql' => 'SQL',
'standardml' => 'StandardML',
'stonescript' => 'StoneScript',
'systemverilog' => 'SystemVerilog IEEE 1800-2009(draft8)',
'tcl' => 'TCL/iTCL',
'teraterm' => 'Tera Term Macro',
'text' => 'Plain Text',
'thinbasic' => 'thinBasic',
'tsql' => 'T-SQL',
'typoscript' => 'TypoScript',
@ -244,6 +242,7 @@ $config['geshi_languages'] = array(
'whois' => 'Whois response (RPSL format)',
'winbatch' => 'WinBatch',
'xbasic' => 'XBasic',
'xml' => 'XML',
'xorg_conf' => 'xorg.conf',
'xpp' => 'Axapta/Dynamics Ax X++',
'yaml' => 'YAML',

View File

@ -16,8 +16,12 @@ class Languages extends CI_Model
function __construct()
{
parent::__construct();
$this->load->config('geshi_languages');
$this->geshi_languages = $this->config->item('geshi_languages');
$this->load->config('config');
$this->favorite_languages = $this->config->item('favorite_languages');
}
function valid_language($lang)
@ -28,13 +32,20 @@ class Languages extends CI_Model
function get_languages()
{
$data = array();
foreach ($this->geshi_languages as $key => $value)
if(is_array($this->favorite_languages))
{
if ($key == '')
foreach ($this->favorite_languages as $key)
{
$data[$key] = $this->geshi_languages[$key];
}
$data["0"] = "-----------------";
}
else
foreach ($this->geshi_languages as $key => $value)
{
if (!in_array($key, $a))
{
$data[$key] = $value;
}