[geeklog-cvs] geeklog: newpro: Made the theme aware of the language direction

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Mar 23 16:36:53 EDT 2012


changeset 8554:26812a66e857
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/26812a66e857
user: Rouslan Placella <rouslan at placella.com>
date: Fri Mar 23 20:22:26 2012 +0000
description:
newpro: Made the theme aware of the language direction

diffstat:

 public_html/layout/newpro/functions.php |   2 +-
 public_html/layout/newpro/style.css.php |  23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r e9f1f3fb357d -r 26812a66e857 public_html/layout/newpro/functions.php
--- a/public_html/layout/newpro/functions.php	Fri Mar 23 19:37:20 2012 +0000
+++ b/public_html/layout/newpro/functions.php	Fri Mar 23 20:22:26 2012 +0000
@@ -8,7 +8,7 @@
 $_IMAGE_TYPE = 'png';
 
 // Add Theme CSS File to scripts class
-$_SCRIPTS->setCSSFile('theme', '/layout/' . $_CONF['theme'] . '/style.css.php');
+$_SCRIPTS->setCSSFile('theme', '/layout/' . $_CONF['theme'] . '/style.css.php?dir=' . $LANG_DIRECTION);
 
 $_SCRIPTS->setJavaScriptLibrary('jquery');
 
diff -r e9f1f3fb357d -r 26812a66e857 public_html/layout/newpro/style.css.php
--- a/public_html/layout/newpro/style.css.php	Fri Mar 23 19:37:20 2012 +0000
+++ b/public_html/layout/newpro/style.css.php	Fri Mar 23 20:22:26 2012 +0000
@@ -72,17 +72,38 @@
     "tooltips/tooltips.css"
 );
 
+// Create directions for RTL support
+$left = 'left';
+$right = 'right';
+if ($_GET['dir'] == 'rtl') {
+    $left = 'right';
+    $right = 'left';
+}
+
 // Output the contents of each file
 foreach ($files as $file) {
     $css = file_get_contents("css/$file");
     $css = preg_replace("@/\*.*?\*/@sm", "", $css); // strip comments
     $css = preg_replace("@\s*\n+\s*@sm", "\n", $css); // strip indentation
+    // Replace {right} and {left} placeholders with actual values.
+    // Used for RTL support.
+    $css = preg_replace("@\{right\}@", $right, $css);
+    $css = preg_replace("@\{left\}@", $left, $css);
+    // Output
+    echo "\n/* $file */\n";
     echo $css;
 }
 
 // Also output the contents of the custom CSS file, if it's available
 if (is_readable("css/custom.css")) {
-    echo file_get_contents("css/custom.css");
+    $css = file_get_contents("css/custom.css");
+    // Replace {right} and {left} placeholders with actual values.
+    // Used for RTL support.
+    $css = preg_replace("@\{right\}@", $right, $css);
+    $css = preg_replace("@\{left\}@", $left, $css);
+    // Output
+    echo "\n/* $file */\n";
+    echo $css;
 }
 
 ?>



More information about the geeklog-cvs mailing list