Skip to content

Commit

Permalink
fixes for author name + typos + early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
nitriques committed Sep 10, 2014
1 parent 6defe8f commit 7c6c49e
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions events/event.flang_redirect.php
Expand Up @@ -12,21 +12,19 @@

Class eventflang_redirect extends Event {

const ROOTELEMENT = 'flang-redirect';

public static function about(){
return array(
'name' => __('Frontend Localisation Redirect'),
'author' => array(
array(
'name' => 'Deux Huit Huit',
'website' => 'http://www.deuxhuithuit.com',
'email' => 'open-source (at) deuxhuithuit (dot) com'
),
),
'version' => '1.1',
'release-date' => '2012-11-13',
'trigger-condition' => '');
const ROOTELEMENT = 'flang-redirect';

public static function about(){
return array(
'name' => __('Frontend Localisation Redirect'),
'author' => array(
'name' => 'Deux Huit Huit',
'website' => 'http://www.deuxhuithuit.com',
'email' => 'open-source (at) deuxhuithuit (dot) com'
),
'version' => '1.1',
'release-date' => '2012-11-13',
'trigger-condition' => '');
}

public function load(){
Expand All @@ -49,7 +47,12 @@ protected function __trigger(){

// main (default) language
$default_language = FLang::getMainLang();


// exit early if no default is found
if (empty($default_language)) {
return;
}

// url language
$url_language = isset($_REQUEST['fl-language']) ? General::sanitize($_REQUEST['fl-language']) : '';
$url_region = isset($_REQUEST['fl-region']) ? General::sanitize($_REQUEST['fl-region']) : '';
Expand Down Expand Up @@ -119,8 +122,6 @@ protected function __trigger(){
$new_url .= '/';
}

//var_dump($current_query_string);

// if query string is longer than 1 (more than only the ? char)
if (!empty($current_query_string)) {
if ($current_query_string[0] === '?' && strlen($current_query_string) > 1) {
Expand All @@ -130,11 +131,10 @@ protected function __trigger(){
}
}

//var_dump($new_url);
// make sur the domain name is present
// make sure the domain name is present
// fixes #4
redirect(Frontend::Page()->_param['root'].$new_url);
die();
return true;
}

// add XML data for this event
Expand Down

0 comments on commit 7c6c49e

Please sign in to comment.