Commit bfeb6aea by Scott

Add text direction option

Passed into theme and stored as boolean ‘isRTL’.
parent 19607508
...@@ -1810,7 +1810,7 @@ ...@@ -1810,7 +1810,7 @@
// Finally, instantiate the object // Finally, instantiate the object
$themeclass=new $classname($template, $content, $themeroothtml, $request); $themeclass=new $classname($template, $content, $themeroothtml, $request, qa_opt('site_text_direction'));
return $themeclass; return $themeclass;
} }
......
...@@ -351,6 +351,7 @@ ...@@ -351,6 +351,7 @@
'show_user_points' => 1, 'show_user_points' => 1,
'show_user_titles' => 1, 'show_user_titles' => 1,
'show_when_created' => 1, 'show_when_created' => 1,
'site_text_direction' => 'ltr',
'site_theme' => 'Snow', 'site_theme' => 'Snow',
'smtp_port' => 25, 'smtp_port' => 25,
'sort_answers_by' => 'created', 'sort_answers_by' => 'created',
......
...@@ -261,8 +261,9 @@ ...@@ -261,8 +261,9 @@
'show_when_created' => 'Show age of user posts:', 'show_when_created' => 'Show age of user posts:',
'site_language' => 'Site language:', 'site_language' => 'Site language:',
'site_maintenance' => 'Take site down for temporary maintenance', 'site_maintenance' => 'Take site down for temporary maintenance',
'site_theme_mobile' => 'Theme for mobiles:', 'site_text_direction' => 'Site text direction:',
'site_theme' => 'Site theme:', 'site_theme' => 'Site theme:',
'site_theme_mobile' => 'Theme for mobiles:',
'site_title' => 'Q&A site name:', 'site_title' => 'Q&A site name:',
'site_url' => 'Preferred site URL:', 'site_url' => 'Preferred site URL:',
'smtp_active' => 'Send email via SMTP instead of local mail', 'smtp_active' => 'Send email via SMTP instead of local mail',
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
switch ($adminsection) { switch ($adminsection) {
case 'general': case 'general':
$subtitle = 'admin/general_title'; $subtitle = 'admin/general_title';
$showoptions = array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'tags_or_categories', 'site_maintenance'); $showoptions = array('site_title', 'site_url', 'neat_urls', 'site_language', 'site_theme', 'site_theme_mobile', 'site_text_direction', 'tags_or_categories', 'site_maintenance');
break; break;
case 'emails': case 'emails':
...@@ -1045,6 +1045,11 @@ ...@@ -1045,6 +1045,11 @@
$optionfield['suffix'] = $namehtml.' '.$authorhtml.' '.$updatehtml; $optionfield['suffix'] = $namehtml.' '.$authorhtml.' '.$updatehtml;
break; break;
case 'site_text_direction':
$directions = array('ltr'=>'LTR', 'rtl'=>'RTL');
qa_optionfield_make_select($optionfield, $directions, $value, 'ltr');
break;
case 'tags_or_categories': case 'tags_or_categories':
qa_optionfield_make_select($optionfield, array( qa_optionfield_make_select($optionfield, array(
'' => qa_lang_html('admin/no_classification'), '' => qa_lang_html('admin/no_classification'),
......
...@@ -47,15 +47,17 @@ ...@@ -47,15 +47,17 @@
protected $lines = 0; protected $lines = 0;
protected $context = array(); protected $context = array();
// whether to use new block layout in rankings (true) or fall back to tables (false)
protected $ranking_block_layout = false;
protected $rooturl;
protected $template; protected $template;
protected $content; protected $content;
protected $rooturl;
protected $request; protected $request;
protected $isRTL; // (boolean) whether text direction is Right-To-Left
// whether to use new block layout in rankings (true) or fall back to tables (false)
protected $ranking_block_layout = false;
public function __construct($template, $content, $rooturl, $request) public function __construct($template, $content, $rooturl, $request, $textdir='ltr')
/* /*
Initialize the object and assign local variables Initialize the object and assign local variables
*/ */
...@@ -64,15 +66,16 @@ ...@@ -64,15 +66,16 @@
$this->content = $content; $this->content = $content;
$this->rooturl = $rooturl; $this->rooturl = $rooturl;
$this->request = $request; $this->request = $request;
$this->isRTL = $textdir === 'rtl';
} }
/** /**
* @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct` * @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct`
* function instead. * function instead.
*/ */
public function qa_html_theme_base($template, $content, $rooturl, $request) public function qa_html_theme_base($template, $content, $rooturl, $request, $textdir='ltr')
{ {
self::__construct($template, $content, $rooturl, $request); self::__construct($template, $content, $rooturl, $request, $textdir);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment