From fcfee0dc879e605d640bd899e3cef13456250813 Mon Sep 17 00:00:00 2001
From: Eric Alvares <erica@344430.no-reply.drupal.org>
Date: Mon, 7 Mar 2011 22:47:05 +0100
Subject: [PATCH] Issue #1012066 follow-up by Eric_A: Removed old Chessboard Renderer API, BC, cruft.

---
 chessboard_render.php |   52 ++++++++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/chessboard_render.php b/chessboard_render.php
index 880def4..ebcc210 100644
--- a/chessboard_render.php
+++ b/chessboard_render.php
@@ -5,21 +5,21 @@
  * Theme related functions for the Chessboard Renderer module.
  */
 
-function chessboard_border_filename($border, $chessboard_image_path) {
+function chessboard_border_filename($border) {
   // $border: T, B, L, R, TL, TR, BL, BR
   switch ($border) {
     case 'T':
     case 'B':
-      return $chessboard_image_path . 'h.png';
+      return 'h.png';
     case 'L':
     case 'R':
-      return $chessboard_image_path . 'v.png';
+      return 'v.png';
     default:
-      return $chessboard_image_path . 'c.png';
+      return 'c.png';
   }
 }
 
-function chessboard_piece_filename($piece, $square_color, $chessboard_image_path) {
+function chessboard_piece_filename($piece, $square_color) {
   // $piece        : KQBNRPkqbnrp-
   // $square_color : 0 1
   switch ($piece) {
@@ -34,7 +34,7 @@ function chessboard_piece_filename($piece, $square_color, $chessboard_image_path
       break;
   }
 
-  return $chessboard_image_path . $name . ($square_color ? 'd' : 'l') . '.png';
+  return $name . ($square_color ? 'd' : 'l') . '.png';
 }
 
 function template_preprocess_chessboard(&$variables) {
@@ -47,10 +47,10 @@ function template_preprocess_chessboard(&$variables) {
   if (!isset($tables_xhtml[$image_directory_path])) {
     $groups = array('square', 'border-h', 'border-v', 'border-c');
     $test_paths = array(
-      'square' => chessboard_piece_filename('-', 0, $image_directory_path . '/'),
-      'border-h' => chessboard_border_filename('T', $image_directory_path . '/'),
-      'border-v' => chessboard_border_filename('R', $image_directory_path . '/'),
-      'border-c' => chessboard_border_filename('TR', $image_directory_path . '/'),
+      'square' => $image_directory_path . '/' . chessboard_piece_filename('-', 0),
+      'border-h' => $image_directory_path . '/' . chessboard_border_filename('T'),
+      'border-v' => $image_directory_path . '/' . chessboard_border_filename('R'),
+      'border-c' => $image_directory_path . '/' . chessboard_border_filename('TR'),
     );
     $class_attributes = array(
       'square' => array(
@@ -109,10 +109,10 @@ function template_preprocess_chessboard(&$variables) {
 
     // Empty and marked squares
     $table_xhtml = array(
-      '-0' => theme('image', array('path' => chessboard_piece_filename('-', 0, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-', 'title' => '', 'attributes' => $class_attributes['square'])),
-      '-1' => theme('image', array('path' => chessboard_piece_filename('-', 1, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-',  'title' => '', 'attributes' => $class_attributes['square'])),
-      'x0' => theme('image', array('path' => chessboard_piece_filename('x', 0, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
-      'x1' => theme('image', array('path' => chessboard_piece_filename('x', 1, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
+      '-0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('-', 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-', 'title' => '', 'attributes' => $class_attributes['square'])),
+      '-1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('-', 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-',  'title' => '', 'attributes' => $class_attributes['square'])),
+      'x0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('x', 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
+      'x1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('x', 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
     );
 
     // Pieces
@@ -120,23 +120,23 @@ function template_preprocess_chessboard(&$variables) {
     for ($i=0; $i<6; $i++) {
       $piece = $pieces[$i];
       $table_xhtml += array(
-        strtoupper($piece) . '0' => theme('image', array('path' => chessboard_piece_filename(strtoupper($piece), 0, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
-        strtoupper($piece) . '1' => theme('image', array('path' => chessboard_piece_filename(strtoupper($piece), 1, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
-        $piece . '0' => theme('image', array('path' => chessboard_piece_filename($piece, 0, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
-        $piece . '1' => theme('image', array('path' => chessboard_piece_filename($piece, 1, $image_directory_path . '/'), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
+        strtoupper($piece) . '0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
+        strtoupper($piece) . '1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
+        $piece . '0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
+        $piece . '1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
       );
     }
 
     // Borders
     $table_xhtml += array(
-      'T' => theme('image', array('path' => chessboard_border_filename('T', $image_directory_path . '/'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
-      'B' => theme('image', array('path' => chessboard_border_filename('B', $image_directory_path . '/'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
-      'L' => theme('image', array('path' => chessboard_border_filename('L', $image_directory_path . '/'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
-      'R' => theme('image', array('path' => chessboard_border_filename('R', $image_directory_path . '/'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
-      'TL' => theme('image', array('path' => chessboard_border_filename('TL', $image_directory_path . '/'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
-      'TR' => theme('image', array('path' => chessboard_border_filename('TR', $image_directory_path . '/'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
-      'BL' => theme('image', array('path' => chessboard_border_filename('BL', $image_directory_path . '/'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', $class_attributes['border-c'])),
-      'BR' => theme('image', array('path' => chessboard_border_filename('BR', $image_directory_path . '/'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', $class_attributes['border-c'])),
+      'T' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('T'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
+      'B' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('B'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
+      'L' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('L'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
+      'R' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('R'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
+      'TL' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('TL'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
+      'TR' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('TR'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
+      'BL' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('BL'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', $class_attributes['border-c'])),
+      'BR' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('BR'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', $class_attributes['border-c'])),
     );
     $tables_xhtml[$image_directory_path] = $table_xhtml;
   }
-- 
1.7.4

