Permalink
Browse files

Coding conventions fixes (mostly line length)

  • Loading branch information...
chillu committed Oct 2, 2012
1 parent 4035f50 commit 51c7d9e2ef78a461f41c0c79bf69ceb0ba1b57e5
@@ -30,17 +30,26 @@ function init() {
} else {
$this->owner->Locale = Translatable::default_locale();
if ($this->owner->class == 'CMSPagesController') {
- // the CMSPagesController always needs to have the locale set, otherwise page editing will cause an extra
+ // the CMSPagesController always needs to have the locale set,
+ // otherwise page editing will cause an extra
// ajax request which looks weird due to multiple "loading"-flashes
return $this->owner->redirect($this->owner->Link());
}
}
Translatable::set_current_locale($this->owner->Locale);
// if a locale is set, it needs to match to the current record
- $requestLocale = $req->requestVar("Locale") ? $req->requestVar("Locale") : $req->requestVar("locale");
+ if($req->requestVar("Locale")) {
+ $requestLocale = $req->requestVar("Locale");
+ } else {
+ $requestLocale = $req->requestVar("locale");
+ }
+
$page = $this->owner->currentPage();
- if($requestLocale && $page && $page->hasExtension('Translatable') && $page->Locale != $requestLocale) {
+ if(
+ $requestLocale && $page && $page->hasExtension('Translatable')
+ && $page->Locale != $requestLocale
+ ) {
$transPage = $page->getTranslation($requestLocale);
if($transPage) {
Translatable::set_current_locale($transPage->Locale);
@@ -61,7 +70,10 @@ function init() {
// collect languages for TinyMCE spellchecker plugin.
// see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
$langName = i18n::get_locale_name($this->owner->Locale);
- HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->owner->Locale}");
+ HtmlEditorConfig::get('cms')->setOption(
+ 'spellchecker_languages',
+ "+{$langName}={$this->owner->Locale}"
+ );
Requirements::javascript('translatable/javascript/CMSMain.Translatable.js');
Requirements::css('translatable/css/CMSMain.Translatable.css');
@@ -98,7 +110,8 @@ function createtranslation($data, $form) {
// to the usual "create page" pattern of storing the record
// in-memory until a "save" is performed by the user, mainly
// to simplify things a bit.
- // @todo Allow in-memory creation of translations that don't persist in the database before the user requests it
+ // @todo Allow in-memory creation of translations that don't
+ // persist in the database before the user requests it
$translatedRecord = $record->createTranslation($langCode);
$url = Controller::join_links(
@@ -12,10 +12,14 @@ class LanguageDropdownField extends GroupedDropdownField {
* @param string $name
* @param string $title
* @param array $excludeLocales List of locales that won't be included
- * @param string $translatingClass Name of the class with translated instances where to look for used languages
- * @param string $list Indicates the source language list. Can be either Common-English, Common-Native, Locale-English, Locale-Native
+ * @param string $translatingClass Name of the class with translated instances
+ * where to look for used languages
+ * @param string $list Indicates the source language list.
+ * Can be either Common-English, Common-Native, Locale-English, Locale-Native
*/
- function __construct($name, $title, $excludeLocales = array(), $translatingClass = 'SiteTree', $list = 'Common-English', $instance = null) {
+ function __construct($name, $title, $excludeLocales = array(),
+ $translatingClass = 'SiteTree', $list = 'Common-English', $instance = null
+ ) {
$usedLocalesWithTitle = Translatable::get_existing_content_languages($translatingClass);
$usedLocalesWithTitle = array_diff_key($usedLocalesWithTitle, $excludeLocales);
@@ -25,7 +29,9 @@ function __construct($name, $title, $excludeLocales = array(), $translatingClass
else if('Locale-Native' == $list) $allLocalesWithTitle = i18n::get_common_locales(true);
else $allLocalesWithTitle = i18n::get_locale_list();
- if(isset($allLocales[Translatable::default_locale()])) unset($allLocales[Translatable::default_locale()]);
+ if(isset($allLocales[Translatable::default_locale()])) {
+ unset($allLocales[Translatable::default_locale()]);
+ }
// Limit to allowed locales if defined
// Check for canTranslate() if an $instance is given
Oops, something went wrong.

0 comments on commit 51c7d9e

Please sign in to comment.