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'] = ''; $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 */ /* End of file config.php */
/* Location: ./application/config/config.php */ /* Location: ./application/config/config.php */

View File

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

View File

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