From 6d4155f995cc4c0b6456e37e453cd2f874630b85 Mon Sep 17 00:00:00 2001 From: Michael Bemmerl Date: Tue, 29 Mar 2022 18:15:18 +0000 Subject: [PATCH] [GithubTrendingBridge] Fix bridge: not all languages worked (#1615) * [GithubTrendingBridge] Fix bridge: not all languages worked Languages with more than one word (like "Common Lisp") were not working. Looks like GitHub changed the parameter format: white space is encoded with dashes. This prompted me to update all languages while I was at it. This also fixed the bug that the C# & F# languages were not working, because the # has to be URL encoded, which is now done in the parameter value. The language "Ren'Py" was commented out. Probably because the single quote was not escaped? I also fixed that. * [GithubTrendingBridge] Fix PHP notice. A repo owner can leave the repo description empty, which means the HTML element isn't there. In this case the code produced a PHP notice. This is fixed by checking for null. * Changed getName() to retrieve the language name directly from the PARAMETERS. Co-authored-by: dag --- bridges/GithubTrendingBridge.php | 256 +++++++++++++++---------------- 1 file changed, 126 insertions(+), 130 deletions(-) diff --git a/bridges/GithubTrendingBridge.php b/bridges/GithubTrendingBridge.php index e91b114e..16705b80 100644 --- a/bridges/GithubTrendingBridge.php +++ b/bridges/GithubTrendingBridge.php @@ -8,41 +8,39 @@ class GithubTrendingBridge extends BridgeAbstract { const CACHE_TIMEOUT = 43200; // 12hr const DESCRIPTION = 'See what the GitHub community is most excited repos.'; const PARAMETERS = array( + // If you are changing context and/or parameter names, change them also in getName(). 'By language' => array( 'language' => array( 'name' => 'Select language', 'type' => 'list', 'values' => array( 'All languages' => '', - 'C++' => 'c++', 'HTML' => 'html', - 'Java' => 'java', - 'JavaScript' => 'javascript', 'PHP' => 'php', 'Python' => 'python', - 'Ruby' => 'ruby', - 'Unknown languages' => 'unknown languages', - '1C Enterprise' => '1c enterprise', + 'Shell' => 'shell', + 'Unknown languages' => 'unknown', + '1C Enterprise' => '1c-enterprise', '4D' => '4d', 'ABAP' => 'abap', 'ABNF' => 'abnf', 'ActionScript' => 'actionscript', 'Ada' => 'ada', - 'Adobe Font Metrics' => 'adobe font metrics', + 'Adobe Font Metrics' => 'adobe-font-metrics', 'Agda' => 'agda', - 'AGS Script' => 'ags script', + 'AGS Script' => 'ags-script', 'Alloy' => 'alloy', - 'Alpine Abuild' => 'alpine abuild', - 'Altium Designer' => 'altium designer', + 'Alpine Abuild' => 'alpine-abuild', + 'Altium Designer' => 'altium-designer', 'AMPL' => 'ampl', 'AngelScript' => 'angelscript', - 'Ant Build System' => 'ant build system', + 'Ant Build System' => 'ant-build-system', 'ANTLR' => 'antlr', 'ApacheConf' => 'apacheconf', 'Apex' => 'apex', - 'API Blueprint' => 'api blueprint', + 'API Blueprint' => 'api-blueprint', 'APL' => 'apl', - 'Apollo Guidance Computer' => 'apollo guidance computer', + 'Apollo Guidance Computer' => 'apollo-guidance-computer', 'AppleScript' => 'applescript', 'Arc' => 'arc', 'AsciiDoc' => 'asciidoc', @@ -71,11 +69,12 @@ class GithubTrendingBridge extends BridgeAbstract { 'Brightscript' => 'brightscript', 'Zeek' => 'zeek', 'C' => 'c', - 'C#' => 'c#', + 'C#' => 'c%23', // already URL encoded 'C++' => 'c++', 'C-ObjDump' => 'c-objdump', - 'C2hs Haskell' => 'c2hs haskell', - 'Cabal Config' => 'cabal config', + 'C2hs Haskell' => 'c2hs-haskell', + 'Cabal Config' => 'cabal-config', + 'Cap\'n Proto' => 'cap\'n-proto', 'CartoCSS' => 'cartocss', 'Ceylon' => 'ceylon', 'Chapel' => 'chapel', @@ -87,18 +86,18 @@ class GithubTrendingBridge extends BridgeAbstract { 'Click' => 'click', 'CLIPS' => 'clips', 'Clojure' => 'clojure', - 'Closure Templates' => 'closure templates', - 'Cloud Firestore Security Rules' => 'cloud firestore security rules', + 'Closure Templates' => 'closure-templates', + 'Cloud Firestore Security Rules' => 'cloud-firestore-security-rules', 'CMake' => 'cmake', 'COBOL' => 'cobol', 'CodeQL' => 'codeql', 'CoffeeScript' => 'coffeescript', 'ColdFusion' => 'coldfusion', - 'ColdFusion CFC' => 'coldfusion cfc', + 'ColdFusion CFC' => 'coldfusion-cfc', 'COLLADA' => 'collada', - 'Common Lisp' => 'common lisp', - 'Common Workflow Language' => 'common workflow language', - 'Component Pascal' => 'component pascal', + 'Common Lisp' => 'common-lisp', + 'Common Workflow Language' => 'common-workflow-language', + 'Component Pascal' => 'component-pascal', 'CoNLL-U' => 'conll-u', 'Cool' => 'cool', 'Coq' => 'coq', @@ -107,28 +106,28 @@ class GithubTrendingBridge extends BridgeAbstract { 'Crystal' => 'crystal', 'CSON' => 'cson', 'Csound' => 'csound', - 'Csound Document' => 'csound document', - 'Csound Score' => 'csound score', + 'Csound Document' => 'csound-document', + 'Csound Score' => 'csound-score', 'CSS' => 'css', 'CSV' => 'csv', 'Cuda' => 'cuda', - 'cURL Config' => 'curl config', + 'cURL Config' => 'curl-config', 'CWeb' => 'cweb', 'Cycript' => 'cycript', 'Cython' => 'cython', 'D' => 'd', 'D-ObjDump' => 'd-objdump', - 'Darcs Patch' => 'darcs patch', + 'Darcs Patch' => 'darcs-patch', 'Dart' => 'dart', 'DataWeave' => 'dataweave', 'desktop' => 'desktop', 'Dhall' => 'dhall', 'Diff' => 'diff', - 'DIGITAL Command Language' => 'digital command language', + 'DIGITAL Command Language' => 'digital-command-language', 'dircolors' => 'dircolors', - 'DirectX 3D File' => 'directx 3d file', + 'DirectX 3D File' => 'directx-3d-file', 'DM' => 'dm', - 'DNS Zone' => 'dns zone', + 'DNS Zone' => 'dns-zone', 'Dockerfile' => 'dockerfile', 'Dogescript' => 'dogescript', 'DTrace' => 'dtrace', @@ -138,29 +137,29 @@ class GithubTrendingBridge extends BridgeAbstract { 'Easybuild' => 'easybuild', 'EBNF' => 'ebnf', 'eC' => 'ec', - 'Ecere Projects' => 'ecere projects', + 'Ecere Projects' => 'ecere-projects', 'ECL' => 'ecl', 'ECLiPSe' => 'eclipse', 'EditorConfig' => 'editorconfig', - 'Edje Data Collection' => 'edje data collection', + 'Edje Data Collection' => 'edje-data-collection', 'edn' => 'edn', 'Eiffel' => 'eiffel', 'EJS' => 'ejs', 'Elixir' => 'elixir', 'Elm' => 'elm', - 'Emacs Lisp' => 'emacs lisp', + 'Emacs Lisp' => 'emacs-lisp', 'EmberScript' => 'emberscript', 'EML' => 'eml', 'EQ' => 'eq', 'Erlang' => 'erlang', - 'F#' => 'f#', + 'F#' => 'f%23', // already URL encoded 'F*' => 'f*', 'Factor' => 'factor', 'Fancy' => 'fancy', 'Fantom' => 'fantom', 'Faust' => 'faust', - 'FIGlet Font' => 'figlet font', - 'Filebench WML' => 'filebench wml', + 'FIGlet Font' => 'figlet-font', + 'Filebench WML' => 'filebench-wml', 'Filterscript' => 'filterscript', 'fish' => 'fish', 'FLUX' => 'flux', @@ -170,25 +169,25 @@ class GithubTrendingBridge extends BridgeAbstract { 'FreeMarker' => 'freemarker', 'Frege' => 'frege', 'G-code' => 'g-code', - 'Game Maker Language' => 'game maker language', + 'Game Maker Language' => 'game-maker-language', 'GAML' => 'gaml', 'GAMS' => 'gams', 'GAP' => 'gap', - 'GCC Machine Description' => 'gcc machine description', + 'GCC Machine Description' => 'gcc-machine-description', 'GDB' => 'gdb', 'GDScript' => 'gdscript', 'Genie' => 'genie', 'Genshi' => 'genshi', - 'Gentoo Ebuild' => 'gentoo ebuild', - 'Gentoo Eclass' => 'gentoo eclass', - 'Gerber Image' => 'gerber image', - 'Gettext Catalog' => 'gettext catalog', + 'Gentoo Ebuild' => 'gentoo-ebuild', + 'Gentoo Eclass' => 'gentoo-eclass', + 'Gerber Image' => 'gerber-image', + 'Gettext Catalog' => 'gettext-catalog', 'Gherkin' => 'gherkin', - 'Git Attributes' => 'git attributes', - 'Git Config' => 'git config', + 'Git Attributes' => 'git-attributes', + 'Git Config' => 'git-config', 'GLSL' => 'glsl', 'Glyph' => 'glyph', - 'Glyph Bitmap Distribution Format' => 'glyph bitmap distribution format', + 'Glyph Bitmap Distribution Format' => 'glyph-bitmap-distribution-format', 'GN' => 'gn', 'Gnuplot' => 'gnuplot', 'Go' => 'go', @@ -196,12 +195,12 @@ class GithubTrendingBridge extends BridgeAbstract { 'Gosu' => 'gosu', 'Grace' => 'grace', 'Gradle' => 'gradle', - 'Grammatical Framework' => 'grammatical framework', - 'Graph Modeling Language' => 'graph modeling language', + 'Grammatical Framework' => 'grammatical-framework', + 'Graph Modeling Language' => 'graph-modeling-language', 'GraphQL' => 'graphql', - 'Graphviz (DOT)' => 'graphviz (dot)', + 'Graphviz (DOT)' => 'graphviz-(dot)', 'Groovy' => 'groovy', - 'Groovy Server Pages' => 'groovy server pages', + 'Groovy Server Pages' => 'groovy-server-pages', 'Hack' => 'hack', 'Haml' => 'haml', 'Handlebars' => 'handlebars', @@ -213,7 +212,6 @@ class GithubTrendingBridge extends BridgeAbstract { 'HiveQL' => 'hiveql', 'HLSL' => 'hlsl', 'HolyC' => 'holyc', - 'HTML' => 'html', 'HTML+Django' => 'html+django', 'HTML+ECR' => 'html+ecr', 'HTML+EEX' => 'html+eex', @@ -226,39 +224,39 @@ class GithubTrendingBridge extends BridgeAbstract { 'HyPhy' => 'hyphy', 'IDL' => 'idl', 'Idris' => 'idris', - 'Ignore List' => 'ignore list', - 'IGOR Pro' => 'igor pro', - 'Inform 7' => 'inform 7', + 'Ignore List' => 'ignore-list', + 'IGOR Pro' => 'igor-pro', + 'Inform 7' => 'inform-7', 'INI' => 'ini', - 'Inno Setup' => 'inno setup', + 'Inno Setup' => 'inno-setup', 'Io' => 'io', 'Ioke' => 'ioke', - 'IRC log' => 'irc log', + 'IRC log' => 'irc-log', 'Isabelle' => 'isabelle', - 'Isabelle ROOT' => 'isabelle root', + 'Isabelle ROOT' => 'isabelle-root', 'J' => 'j', 'Jasmin' => 'jasmin', 'Java' => 'java', - 'Java Properties' => 'java properties', - 'Java Server Pages' => 'java server pages', + 'Java Properties' => 'java-properties', + 'Java Server Pages' => 'java-server-pages', 'JavaScript' => 'javascript', 'JavaScript+ERB' => 'javascript+erb', 'JFlex' => 'jflex', 'Jison' => 'jison', - 'Jison Lex' => 'jison lex', + 'Jison Lex' => 'jison-lex', 'Jolie' => 'jolie', 'JSON' => 'json', - 'JSON with Comments' => 'json with comments', + 'JSON with Comments' => 'json-with-comments', 'JSON5' => 'json5', 'JSONiq' => 'jsoniq', 'JSONLD' => 'jsonld', 'Jsonnet' => 'jsonnet', 'JSX' => 'jsx', 'Julia' => 'julia', - 'Jupyter Notebook' => 'jupyter notebook', - 'KiCad Layout' => 'kicad layout', - 'KiCad Legacy Layout' => 'kicad legacy layout', - 'KiCad Schematic' => 'kicad schematic', + 'Jupyter Notebook' => 'jupyter-notebook', + 'KiCad Layout' => 'kicad-layout', + 'KiCad Legacy Layout' => 'kicad-legacy-layout', + 'KiCad Schematic' => 'kicad-schematic', 'Kit' => 'kit', 'Kotlin' => 'kotlin', 'KRL' => 'krl', @@ -271,12 +269,12 @@ class GithubTrendingBridge extends BridgeAbstract { 'LFE' => 'lfe', 'LilyPond' => 'lilypond', 'Limbo' => 'limbo', - 'Linker Script' => 'linker script', - 'Linux Kernel Module' => 'linux kernel module', + 'Linker Script' => 'linker-script', + 'Linux Kernel Module' => 'linux-kernel-module', 'Liquid' => 'liquid', - 'Literate Agda' => 'literate agda', - 'Literate CoffeeScript' => 'literate coffeescript', - 'Literate Haskell' => 'literate haskell', + 'Literate Agda' => 'literate-agda', + 'Literate CoffeeScript' => 'literate-coffeescript', + 'Literate Haskell' => 'literate-haskell', 'LiveScript' => 'livescript', 'LLVM' => 'llvm', 'Logos' => 'logos', @@ -285,7 +283,7 @@ class GithubTrendingBridge extends BridgeAbstract { 'LookML' => 'lookml', 'LoomScript' => 'loomscript', 'LSL' => 'lsl', - 'LTspice Symbol' => 'ltspice symbol', + 'LTspice Symbol' => 'ltspice-symbol', 'Lua' => 'lua', 'M' => 'm', 'M4' => 'm4', @@ -297,7 +295,7 @@ class GithubTrendingBridge extends BridgeAbstract { 'Mask' => 'mask', 'Mathematica' => 'mathematica', 'MATLAB' => 'matlab', - 'Maven POM' => 'maven pom', + 'Maven POM' => 'maven-pom', 'Max' => 'max', 'MAXScript' => 'maxscript', 'mcfunction' => 'mcfunction', @@ -305,19 +303,19 @@ class GithubTrendingBridge extends BridgeAbstract { 'Mercury' => 'mercury', 'Meson' => 'meson', 'Metal' => 'metal', - 'Microsoft Developer Studio Project' => 'microsoft developer studio project', + 'Microsoft Developer Studio Project' => 'microsoft-developer-studio-project', 'MiniD' => 'minid', 'Mirah' => 'mirah', - 'mIRC Script' => 'mirc script', + 'mIRC Script' => 'mirc-script', 'MLIR' => 'mlir', 'Modelica' => 'modelica', 'Modula-2' => 'modula-2', 'Modula-3' => 'modula-3', - 'Module Management System' => 'module management system', + 'Module Management System' => 'module-management-system', 'Monkey' => 'monkey', 'Moocode' => 'moocode', 'MoonScript' => 'moonscript', - 'Motorola 68K Assembly' => 'motorola 68k assembly', + 'Motorola 68K Assembly' => 'motorola-68k-assembly', 'MQL4' => 'mql4', 'MQL5' => 'mql5', 'MTML' => 'mtml', @@ -342,12 +340,12 @@ class GithubTrendingBridge extends BridgeAbstract { 'Nit' => 'nit', 'Nix' => 'nix', 'NL' => 'nl', - 'NPM Config' => 'npm config', + 'NPM Config' => 'npm-config', 'NSIS' => 'nsis', 'Nu' => 'nu', 'NumPy' => 'numpy', 'ObjDump' => 'objdump', - 'Object Data Instance Notation' => 'object data instance notation', + 'Object Data Instance Notation' => 'object-data-instance-notation', 'Objective-C' => 'objective-c', 'Objective-C++' => 'objective-c++', 'Objective-J' => 'objective-j', @@ -358,14 +356,14 @@ class GithubTrendingBridge extends BridgeAbstract { 'ooc' => 'ooc', 'Opa' => 'opa', 'Opal' => 'opal', - 'Open Policy Agent' => 'open policy agent', + 'Open Policy Agent' => 'open-policy-agent', 'OpenCL' => 'opencl', - 'OpenEdge ABL' => 'openedge abl', + 'OpenEdge ABL' => 'openedge-abl', 'OpenQASM' => 'openqasm', - 'OpenRC runscript' => 'openrc runscript', + 'OpenRC runscript' => 'openrc-runscript', 'OpenSCAD' => 'openscad', - 'OpenStep Property List' => 'openstep property list', - 'OpenType Feature File' => 'opentype feature file', + 'OpenStep Property List' => 'openstep-property-list', + 'OpenType Feature File' => 'opentype-feature-file', 'Org' => 'org', 'Ox' => 'ox', 'Oxygene' => 'oxygene', @@ -374,13 +372,12 @@ class GithubTrendingBridge extends BridgeAbstract { 'Pan' => 'pan', 'Papyrus' => 'papyrus', 'Parrot' => 'parrot', - 'Parrot Assembly' => 'parrot assembly', - 'Parrot Internal Representation' => 'parrot internal representation', + 'Parrot Assembly' => 'parrot-assembly', + 'Parrot Internal Representation' => 'parrot-internal-representation', 'Pascal' => 'pascal', 'Pawn' => 'pawn', 'Pep8' => 'pep8', 'Perl' => 'perl', - 'PHP' => 'php', 'Pic' => 'pic', 'Pickle' => 'pickle', 'PicoLisp' => 'picolisp', @@ -389,29 +386,28 @@ class GithubTrendingBridge extends BridgeAbstract { 'PLpgSQL' => 'plpgsql', 'PLSQL' => 'plsql', 'Pod' => 'pod', - 'Pod 6' => 'pod 6', + 'Pod 6' => 'pod-6', 'PogoScript' => 'pogoscript', 'Pony' => 'pony', 'PostCSS' => 'postcss', 'PostScript' => 'postscript', - 'POV-Ray SDL' => 'pov-ray sdl', + 'POV-Ray SDL' => 'pov-ray-sdl', 'PowerBuilder' => 'powerbuilder', 'PowerShell' => 'powershell', 'Prisma' => 'prisma', 'Processing' => 'processing', 'Proguard' => 'proguard', 'Prolog' => 'prolog', - 'Propeller Spin' => 'propeller spin', - 'Protocol Buffer' => 'protocol buffer', - 'Public Key' => 'public key', + 'Propeller Spin' => 'propeller-spin', + 'Protocol Buffer' => 'protocol-buffer', + 'Public Key' => 'public-key', 'Pug' => 'pug', 'Puppet' => 'puppet', - 'Pure Data' => 'pure data', + 'Pure Data' => 'pure-data', 'PureBasic' => 'purebasic', 'PureScript' => 'purescript', - 'Python' => 'python', - 'Python console' => 'python console', - 'Python traceback' => 'python traceback', + 'Python console' => 'python-console', + 'Python traceback' => 'python-traceback', 'q' => 'q', 'QMake' => 'qmake', 'QML' => 'qml', @@ -422,30 +418,30 @@ class GithubTrendingBridge extends BridgeAbstract { 'Raku' => 'raku', 'RAML' => 'raml', 'Rascal' => 'rascal', - 'Raw token data' => 'raw token data', + 'Raw token data' => 'raw-token-data', 'RDoc' => 'rdoc', - 'Readline Config' => 'readline config', + 'Readline Config' => 'readline-config', 'REALbasic' => 'realbasic', 'Reason' => 'reason', 'Rebol' => 'rebol', 'Red' => 'red', 'Redcode' => 'redcode', - 'Regular Expression' => 'regular expression', - // 'Ren'Py' => 'ren'py', + 'Regular Expression' => 'regular-expression', + 'Ren\'Py' => 'ren\'py', 'RenderScript' => 'renderscript', 'reStructuredText' => 'restructuredtext', 'REXX' => 'rexx', 'RHTML' => 'rhtml', - 'Rich Text Format' => 'rich text format', + 'Rich Text Format' => 'rich-text-format', 'Ring' => 'ring', 'Riot' => 'riot', 'RMarkdown' => 'rmarkdown', 'RobotFramework' => 'robotframework', 'Roff' => 'roff', - 'Roff Manpage' => 'roff manpage', + 'Roff Manpage' => 'roff-manpage', 'Rouge' => 'rouge', 'RPC' => 'rpc', - 'RPM Spec' => 'rpm spec', + 'RPM Spec' => 'rpm-spec', 'Ruby' => 'ruby', 'RUNOFF' => 'runoff', 'Rust' => 'rust', @@ -461,7 +457,6 @@ class GithubTrendingBridge extends BridgeAbstract { 'sed' => 'sed', 'Self' => 'self', 'ShaderLab' => 'shaderlab', - 'Shell' => 'shell', 'ShellSession' => 'shellsession', 'Shen' => 'shen', 'Slash' => 'slash', @@ -475,20 +470,20 @@ class GithubTrendingBridge extends BridgeAbstract { 'Solidity' => 'solidity', 'SourcePawn' => 'sourcepawn', 'SPARQL' => 'sparql', - 'Spline Font Database' => 'spline font database', + 'Spline Font Database' => 'spline-font-database', 'SQF' => 'sqf', 'SQL' => 'sql', 'SQLPL' => 'sqlpl', 'Squirrel' => 'squirrel', - 'SRecode Template' => 'srecode template', - 'SSH Config' => 'ssh config', + 'SRecode Template' => 'srecode-template', + 'SSH Config' => 'ssh-config', 'Stan' => 'stan', - 'Standard ML' => 'standard ml', + 'Standard ML' => 'standard-ml', 'Starlark' => 'starlark', 'Stata' => 'stata', 'STON' => 'ston', 'Stylus' => 'stylus', - 'SubRip Text' => 'subrip text', + 'SubRip Text' => 'subrip-text', 'SugarSS' => 'sugarss', 'SuperCollider' => 'supercollider', 'Svelte' => 'svelte', @@ -505,7 +500,7 @@ class GithubTrendingBridge extends BridgeAbstract { 'Text' => 'text', 'Textile' => 'textile', 'Thrift' => 'thrift', - 'TI Program' => 'ti program', + 'TI Program' => 'ti-program', 'TLA' => 'tla', 'TOML' => 'toml', 'TSQL' => 'tsql', @@ -514,11 +509,11 @@ class GithubTrendingBridge extends BridgeAbstract { 'Turtle' => 'turtle', 'Twig' => 'twig', 'TXL' => 'txl', - 'Type Language' => 'type language', + 'Type Language' => 'type-language', 'TypeScript' => 'typescript', - 'Unified Parallel C' => 'unified parallel c', - 'Unity3D Asset' => 'unity3d asset', - 'Unix Assembly' => 'unix assembly', + 'Unified Parallel C' => 'unified-parallel-c', + 'Unity3D Asset' => 'unity3d-asset', + 'Unix Assembly' => 'unix-assembly', 'Uno' => 'uno', 'UnrealScript' => 'unrealscript', 'UrWeb' => 'urweb', @@ -529,33 +524,33 @@ class GithubTrendingBridge extends BridgeAbstract { 'VCL' => 'vcl', 'Verilog' => 'verilog', 'VHDL' => 'vhdl', - 'Vim script' => 'vim script', - 'Vim Snippet' => 'vim snippet', - 'Visual Basic .NET' => 'visual basic .net', - 'Visual Basic .NET' => 'visual basic .net', + 'Vim script' => 'vim-script', + 'Vim Snippet' => 'vim-snippet', + 'Visual Basic .NET' => 'visual-basic-.net', + 'Visual Basic .NET' => 'visual-basic-.net', 'Volt' => 'volt', 'Vue' => 'vue', - 'Wavefront Material' => 'wavefront material', - 'Wavefront Object' => 'wavefront object', + 'Wavefront Material' => 'wavefront-material', + 'Wavefront Object' => 'wavefront-object', 'wdl' => 'wdl', - 'Web Ontology Language' => 'web ontology language', + 'Web Ontology Language' => 'web-ontology-language', 'WebAssembly' => 'webassembly', 'WebIDL' => 'webidl', 'WebVTT' => 'webvtt', - 'Wget Config' => 'wget config', - 'Windows Registry Entries' => 'windows registry entries', + 'Wget Config' => 'wget-config', + 'Windows Registry Entries' => 'windows-registry-entries', 'wisp' => 'wisp', 'Wollok' => 'wollok', - 'World of Warcraft Addon Data' => 'world of warcraft addon data', - 'X BitMap' => 'x bitmap', - 'X Font Directory Index' => 'x font directory index', - 'X PixMap' => 'x pixmap', + 'World of Warcraft Addon Data' => 'world-of-warcraft-addon-data', + 'X BitMap' => 'x-bitmap', + 'X Font Directory Index' => 'x-font-directory-index', + 'X PixMap' => 'x-pixmap', 'X10' => 'x10', 'xBase' => 'xbase', 'XC' => 'xc', 'XCompose' => 'xcompose', 'XML' => 'xml', - 'XML Property List' => 'xml property list', + 'XML Property List' => 'xml-property-list', 'Xojo' => 'xojo', 'XPages' => 'xpages', 'XProc' => 'xproc', @@ -612,7 +607,9 @@ class GithubTrendingBridge extends BridgeAbstract { $item['title'] = str_replace(' ', '', trim(strip_tags($element->find('h1 a', 0)->plaintext))); // Description - $item['content'] = trim(strip_tags($element->find('p', 0)->innertext)); + $description = $element->find('p', 0); + if ($description != null) + $item['content'] = trim(strip_tags($description->innertext)); // Time $item['timestamp'] = time(); @@ -623,10 +620,9 @@ class GithubTrendingBridge extends BridgeAbstract { } public function getName(){ - if($this->getInput('language') == '') { - return self::NAME . ': all'; - } elseif (!is_null($this->getInput('language'))) { - return self::NAME . ': ' . $this->getInput('language'); + if (!is_null($this->getInput('language'))) { + $language = array_search($this->getInput('language'), self::PARAMETERS['By language']['language']['values']); + return self::NAME . ': ' . $language; } return parent::getName();