From 6e4e569c8de0e2af5afc15d9c17ffdf7d4845bc1 Mon Sep 17 00:00:00 2001
From: Eric Alvares <erica@344430.no-reply.drupal.org>
Date: Thu, 10 Mar 2011 21:54:51 +0100
Subject: [PATCH 1/2] Issue #1012066 one more follow-up by Eric_A: Removed old Chessboard Renderer API, BC, cruft.

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

diff --git a/chessboard_render.php b/chessboard_render.php
index be84000..acc0eb8 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(
@@ -111,10 +111,10 @@ function template_preprocess_chessboard(&$variables) {
 
     // Empty and marked squares
     $table_xhtml = array(
-      '-0' => strtr(theme('image', chessboard_piece_filename('-', 0, $image_directory_path . '/'), '-', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-      '-1' => strtr(theme('image', chessboard_piece_filename('-', 1, $image_directory_path . '/'), '-', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-      'x0' => strtr(theme('image', chessboard_piece_filename('x', 0, $image_directory_path . '/'), 'x', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-      'x1' => strtr(theme('image', chessboard_piece_filename('x', 1, $image_directory_path . '/'), 'x', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+      '-0' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename('-', 0), '-', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+      '-1' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename('-', 1), '-', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+      'x0' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename('x', 0), 'x', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+      'x1' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename('x', 1), 'x', NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
     );
 
     // Pieces
@@ -122,23 +122,23 @@ function template_preprocess_chessboard(&$variables) {
     for ($i=0; $i<6; $i++) {
       $piece = $pieces[$i];
       $table_xhtml += array(
-        strtoupper($piece) . '0' => strtr(theme('image', chessboard_piece_filename(strtoupper($piece), 0, $image_directory_path . '/'), strtoupper($piece), NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-        strtoupper($piece) . '1' => strtr(theme('image', chessboard_piece_filename(strtoupper($piece), 1, $image_directory_path . '/'), strtoupper($piece), NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-        $piece . '0' => strtr(theme('image', chessboard_piece_filename($piece, 0, $image_directory_path . '/'), $piece, NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
-        $piece . '1' => strtr(theme('image', chessboard_piece_filename($piece, 1, $image_directory_path . '/'), $piece, NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+        strtoupper($piece) . '0' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 0), strtoupper($piece), NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+        strtoupper($piece) . '1' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 1), strtoupper($piece), NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+        $piece . '0' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename($piece, 0), $piece, NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
+        $piece . '1' => strtr(theme('image', $image_directory_path . '/' . chessboard_piece_filename($piece, 1), $piece, NULL, $group_attributes['square'], FALSE), array('"  ' => '" ')),
       );
     }
 
     // Borders
     $table_xhtml += array(
-      'T' => strtr(theme('image', chessboard_border_filename('T', $image_directory_path . '/'), '', NULL, $group_attributes['border-h'], FALSE), array('"  ' => '" ')),
-      'B' => strtr(theme('image', chessboard_border_filename('B', $image_directory_path . '/'), '', NULL, $group_attributes['border-h'], FALSE), array('"  ' => '" ')),
-      'L' => strtr(theme('image', chessboard_border_filename('L', $image_directory_path . '/'), '', NULL, $group_attributes['border-v'], FALSE), array('"  ' => '" ')),
-      'R' => strtr(theme('image', chessboard_border_filename('R', $image_directory_path . '/'), '', NULL, $group_attributes['border-v'], FALSE), array('"  ' => '" ')),
-      'TL' => strtr(theme('image', chessboard_border_filename('TL', $image_directory_path . '/'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
-      'TR' => strtr(theme('image', chessboard_border_filename('TR', $image_directory_path . '/'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
-      'BL' => strtr(theme('image', chessboard_border_filename('BL', $image_directory_path . '/'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
-      'BR' => strtr(theme('image', chessboard_border_filename('BR', $image_directory_path . '/'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
+      'T' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('T'), '', NULL, $group_attributes['border-h'], FALSE), array('"  ' => '" ')),
+      'B' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('B'), '', NULL, $group_attributes['border-h'], FALSE), array('"  ' => '" ')),
+      'L' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('L'), '', NULL, $group_attributes['border-v'], FALSE), array('"  ' => '" ')),
+      'R' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('R'), '', NULL, $group_attributes['border-v'], FALSE), array('"  ' => '" ')),
+      'TL' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('TL'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
+      'TR' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('TR'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
+      'BL' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('BL'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
+      'BR' => strtr(theme('image', $image_directory_path . '/' . chessboard_border_filename('BR'), '', NULL, $group_attributes['border-c'], FALSE), array('"  ' => '" ')),
     );
     $tables_xhtml[$image_directory_path] = $table_xhtml;
   }

-- 
1.7.4
