Skip to content

Commit

Permalink
[WikipediaBridge] remove useless code
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Mazière <[email protected]>
  • Loading branch information
Pierre Mazière committed Aug 28, 2016
1 parent a24e6ea commit 792578a
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions bridges/WikipediaBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function getURI(){

public function getName(){
$params=$this->parameters[$this->queriedContext];
$subject = WIKIPEDIA_SUBJECT_TFA;
switch($params['subject']['value']){
case 'tfa':
$subject = WIKIPEDIA_SUBJECT_TFA;
Expand Down Expand Up @@ -80,16 +79,7 @@ public function getName(){

public function collectData(){
$params=$this->parameters[$this->queriedContext];
if(!isset($params['language']['value']))
$this->returnClientError('You must specify a valid language via \'&language=\'!');

if(!$this->CheckLanguageCode(strtolower($params['language']['value'])))
$this->returnClientError('The language code you provided (\'' . $params['language']['value'] . '\') is not supported!');

if(!isset($params['subject']['value']))
$this->returnClientError('You must specify a valid subject via \'&subject=\'!');

$subject = WIKIPEDIA_SUBJECT_TFA;
switch($params['subject']['value']){
case 'tfa':
$subject = WIKIPEDIA_SUBJECT_TFA;
Expand All @@ -102,9 +92,7 @@ public function collectData(){
break;
}

$fullArticle = false;
if(isset($params['fullarticle']['value']))
$fullArticle = $params['fullarticle']['value'];
$fullArticle = $params['fullarticle']['value'];

// This will automatically send us to the correct main page in any language (try it!)
$html = $this->getSimpleHTMLDOM($this->getURI() . '/wiki');
Expand All @@ -128,20 +116,6 @@ public function collectData(){
$this->$function($html, $subject, $fullArticle);
}

/**
* Returns true if the language code is part of the parameters list
*/
private function CheckLanguageCode($languageCode){
$languages = $this->parameters[0]['language']['values'];

$language_names = array();

foreach($languages as $name=>$value)
$language_names[] = $value;

return in_array($languageCode, $language_names);
}

/**
* Replaces all relative URIs with absolute ones
* @param $element A simplehtmldom element
Expand Down

0 comments on commit 792578a

Please sign in to comment.