| 1 |
<?php
|
| 2 |
|
| 3 |
function friendselectric_wrap_content($text) {
|
| 4 |
$text = preg_replace('!<pre>!i', '<div class="pre"><pre>', $text);
|
| 5 |
$text = preg_replace('!</pre>!i', '</pre></div>', $text);
|
| 6 |
return $text;
|
| 7 |
}
|
| 8 |
function friendselectric_wrap_links($link, $n) {
|
| 9 |
$classes = array("lw1", "lw2");
|
| 10 |
$before = $after = "";
|
| 11 |
foreach ($classes as $c) {
|
| 12 |
$before .= '<span class="'. $c .'">';
|
| 13 |
$after .= '</span>';
|
| 14 |
}
|
| 15 |
$link = preg_replace('!<a[^>]*>!i', '\0'. $before, $link);
|
| 16 |
$link = preg_replace('!</a[^>]*>!i', $after . '\0', $link);
|
| 17 |
return $link;
|
| 18 |
}
|
| 19 |
|
| 20 |
function friendselectric_menu_item_link($link) {
|
| 21 |
// $link = l('<span class="lw1">'. check_plain($link['title']) .'</span>', $link['href'], array('html' => TRUE));
|
| 22 |
if (empty($link['options'])) {
|
| 23 |
$link['options'] = array();
|
| 24 |
}
|
| 25 |
|
| 26 |
// If an item is a LOCAL TASK, render it as a tab
|
| 27 |
if ($link['type'] & MENU_IS_LOCAL_TASK) {
|
| 28 |
$link['title'] = '<span class="lw1">' . check_plain($link['title']) . '</span>';
|
| 29 |
$link['options']['html'] = TRUE;
|
| 30 |
}
|
| 31 |
|
| 32 |
if (empty($link['type'])) {
|
| 33 |
$true = TRUE;
|
| 34 |
}
|
| 35 |
|
| 36 |
return l($link['title'], $link['href'], $link['options']);
|
| 37 |
|
| 38 |
return $link;
|
| 39 |
}
|
| 40 |
|
| 41 |
|
| 42 |
function phptemplate_menu_primary_links($primary_links) {
|
| 43 |
foreach ($primary_links as $link) {
|
| 44 |
$links[] = l('<span class="lw3">'. check_plain($link['title']) .'</span>', $link['href'], array('html' => TRUE));
|
| 45 |
}
|
| 46 |
|
| 47 |
return $links;
|
| 48 |
}
|
| 49 |
|
| 50 |
function friendselectric_comment_thread_collapsed($comment) {
|
| 51 |
if ($comment->depth) {
|
| 52 |
$output = '<div style="padding-left:'. ($comment->depth * 25) ."px;\">\n";
|
| 53 |
$output .= theme('comment_view', $comment, '', 0);
|
| 54 |
$output .= "</div>\n";
|
| 55 |
}
|
| 56 |
else {
|
| 57 |
$output .= theme('comment_view', $comment, '', 0);
|
| 58 |
}
|
| 59 |
return $output;
|
| 60 |
}
|
| 61 |
|
| 62 |
function friendselectric_comment_thread_expanded($comment) {
|
| 63 |
$output = '';
|
| 64 |
if ($comment->depth) {
|
| 65 |
$output .= '<div style="padding-left:'. ($comment->depth * 25) ."px;\">\n";
|
| 66 |
}
|
| 67 |
|
| 68 |
$output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
|
| 69 |
|
| 70 |
if ($comment->depth) {
|
| 71 |
$output .= "</div>\n";
|
| 72 |
}
|
| 73 |
return $output;
|
| 74 |
}
|
| 75 |
|
| 76 |
|
| 77 |
/**
|
| 78 |
* Override or insert PHPTemplate variables into the page templates.
|
| 79 |
*
|
| 80 |
* @param $vars
|
| 81 |
* A sequential array of variables to pass to the theme template.
|
| 82 |
* @param $hook
|
| 83 |
* The name of the theme function being called ("page" in this case.)
|
| 84 |
*/
|
| 85 |
function friendselectric_preprocess_page(&$vars, $hook) {
|
| 86 |
drupal_set_message("<strong>Have knowledge in CSS?</strong> Friendselectric needs to be fixed for IE6 (menu bg's), IE7 (box width) and content width across all browsers. If you could lend a hand, please submit a fixed version (patch or zip) via the this <a href=\"http://drupal.org/project/color_soc08\">project page</a> or on this <a href=\"http://drupal.org/node/170948\">issue page</a>. You will get credit and be a hero!", 'status', FALSE);
|
| 87 |
}
|
| 88 |
|
| 89 |
/**
|
| 90 |
* Return the path to the main nista theme directory.
|
| 91 |
*/
|
| 92 |
function path_to_friendselectrictheme() {
|
| 93 |
static $theme_path;
|
| 94 |
if (!isset($theme_path)) {
|
| 95 |
global $theme;
|
| 96 |
if ($theme == 'nista') {
|
| 97 |
$theme_path = path_to_theme();
|
| 98 |
}
|
| 99 |
else {
|
| 100 |
$theme_path = drupal_get_path('theme', 'friendselectric');
|
| 101 |
}
|
| 102 |
}
|
| 103 |
return $theme_path;
|
| 104 |
}
|
| 105 |
|
| 106 |
/**
|
| 107 |
* Implements hook_color() for theme.
|
| 108 |
* Color replacement method(s): 'shift' (base, text, link)
|
| 109 |
* 'tag' custom tag replacement
|
| 110 |
*/
|
| 111 |
function friendselectric_color() {
|
| 112 |
/**
|
| 113 |
* $color = array() (Required)
|
| 114 |
* For essential scheme information.
|
| 115 |
*
|
| 116 |
*/
|
| 117 |
$color = array(
|
| 118 |
/**
|
| 119 |
* 'replacement methods'
|
| 120 |
* Declare replacement replacement methods in the 'replacement methods' array,
|
| 121 |
* in the order you want them to work.
|
| 122 |
* They are comprised different algorithms to change your colors.
|
| 123 |
* replacement methods like 'shift' can accept different options and behave differently.
|
| 124 |
* To change the order of the replacement methods color replacement, put them in order.
|
| 125 |
*/
|
| 126 |
'replacement methods' => array(
|
| 127 |
/**
|
| 128 |
* 'shift' method
|
| 129 |
* Requires 'base', and/or'link' and/or 'text'
|
| 130 |
*/
|
| 131 |
'shift' => array('base', 'text', 'link'),
|
| 132 |
/**
|
| 133 |
* 'tag' method
|
| 134 |
* Replaces custom tags in stylesheet based on fieldname.
|
| 135 |
*/
|
| 136 |
'tag' => TRUE,
|
| 137 |
),
|
| 138 |
|
| 139 |
/**
|
| 140 |
* 'fields' (Required)
|
| 141 |
* The machine-readable names of color fields. The name will help you
|
| 142 |
* and your theme users identify colors.
|
| 143 |
*/
|
| 144 |
'fields' => array('base', 'link', 'top', 'bottom', 'text', 'main-link', 'menu-link'),
|
| 145 |
|
| 146 |
/**
|
| 147 |
* 'premade schemes' (Required)
|
| 148 |
* A list of pre-made schemes that will be available for install by default.
|
| 149 |
* The scheme name, human-readable, is followed by hex values separated by
|
| 150 |
* commas (no spaces). The colors are to be ordered respectable to 'fields'.
|
| 151 |
*/
|
| 152 |
'premade schemes' => array(
|
| 153 |
'Aquamarine' => array(
|
| 154 |
'base' => '#55c0e2', 'link' => '#000000', 'top' => '#085360', 'bottom' => '#007e94', 'text' => '#696969', 'main-link' => '#000000', 'menu-link' => '#085360'),
|
| 155 |
'Ash' => array('base' => '#464849' ,'link' => '#2f416f', 'top' => '#2a2b2d', 'bottom' => '#5d6779', 'text' => '#494949', 'main-link' => '#262626', 'menu-link' => '#2a2b2d'),
|
| 156 |
'Belgian Chocolate' => array('base' => '#d5b048' ,'link' => '#6c420e', 'top' => '#331900', 'bottom' => '#971702,', 'text' => '#494949', 'main-link' => '#6c420e', 'menu-link' => '#331900'),
|
| 157 |
'Blue Lagoon' => array('base' => '#0072b9' ,'link' => '#027ac6', 'top' => '#2385c2', 'bottom' => '#5ab5ee', 'text' => '#494949', 'main-link' => '#027ac6', 'menu-link' => '#2385c2'),
|
| 158 |
'Bluemarine' => array('base' => '#3f3f3f' ,'link' => '#336699', 'top' => '#6598cb', 'bottom' => '#3a71ab', 'text' => '#000000', 'main-link' => '#336699', 'menu-link' => '#6598cb'),
|
| 159 |
'Citrus Blast' => array('base' => '#e25912','link' => '#6f5c06', 'top' => '#f46715', 'bottom' => '#9a5707', 'text' => '#0b2645', 'main-link' => '#6f5c06', 'menu-link' => '#df8920'),
|
| 160 |
'Cold Day' => array('base' => '#0f005c','link' => '#434f8c', 'top' => '#4d91ff', 'bottom' => '#1a1575', 'text' => '#000000', 'main-link' => '#434f8c', 'menu-link' => '#4d91ff'),
|
| 161 |
'Electric' => array('base' => '#D9EEF1','link' => '#255FB7', 'top' => '#78aac7', 'bottom' => '#375d8a', 'text' => '#0b2645', 'main-link' => '#E60A53', 'menu-link' => '#78aac7'),
|
| 162 |
'Greenbeam' => array('base' => '#b7b075','link' => '#0c7a00', 'top' => '#03961e', 'bottom' => '#5fae00', 'text' => '#2f2f2f', 'main-link' => '#0c7a00', 'menu-link' => '#024b0f'),
|
| 163 |
'Majestic' => array('base' => '#5c00b9','link' => '#027ac6', 'top' => '#f028ab', 'bottom' => '#5f009e', 'text' => '#494949', 'main-link' => '#027ac6', 'menu-link' => '#f028ab'),
|
| 164 |
'Mediterrano' => array('base' => '#ffe23d','link' => '#a9290a', 'top' => '#fc6d1d', 'bottom' => '#a30f42', 'text' => '#494949', 'main-link' => '#a9290a', 'menu-link' => '#fc6d1d'),
|
| 165 |
'Nocturnal' => array('base' => '#5b5fa9','link' => '#5b5faa', 'top' => '#0a2352', 'bottom' => '#9fa8d5', 'text' => '#494949', 'main-link' => '#5b5faa', 'menu-link' => '#0a2352'),
|
| 166 |
'Olivia' => array('base' => '#7db323','link' => '#6a9915', 'top' => '#b5d52a', 'bottom' => '#7db323', 'text' => '#191a19', 'main-link' => '#6a9915', 'menu-link' => '#b5d52a'),
|
| 167 |
'Pink Plastic' => array('base' => '#12020b','link' => '#1b1a13', 'top' => '#f391c6', 'bottom' => '#f41063', 'text' => '#898080', 'main-link' => '#1b1a13', 'menu-link' => '#f391c6'),
|
| 168 |
'Shiny Tomato' => array('base' => '#cb1025','link' => '#c70000', 'top' => '#a1443a', 'bottom' => '#f21107', 'text' => '#515d52', 'main-link' => '#c70000', 'menu-link' => '#a1443a'),
|
| 169 |
'Teal Top' => array('base' => '#18583d','link' => '#1b5f42', 'top' => '#34775a', 'bottom' => '#52bf90', 'text' => '#2d2d2d', 'main-link' => '#1b5f42', 'menu-link' => '#34775a'),
|
| 170 |
),
|
| 171 |
|
| 172 |
/**
|
| 173 |
* 'default scheme' (Required)
|
| 174 |
* A scheme name from one in your 'premade schemes' list.
|
| 175 |
*/
|
| 176 |
'default scheme' => 'Electric',
|
| 177 |
|
| 178 |
/**
|
| 179 |
* 'reference scheme' (Required)
|
| 180 |
* A scheme name from one in your 'premade schemes' list.
|
| 181 |
* On schemes which use the 'base', 'link' or 'text' flag, always mention this.
|
| 182 |
* Other schemes will be shifted against the fields of the reference one.
|
| 183 |
*/
|
| 184 |
'reference scheme' => 'Electric',
|
| 185 |
|
| 186 |
/**
|
| 187 |
* 'stylesheets' (Required)
|
| 188 |
* Path to your CSS file relevant to the root of your theme directory.
|
| 189 |
* Can mention an array of stylesheets.
|
| 190 |
*/
|
| 191 |
'stylesheets' => array(
|
| 192 |
'color/friendselectric.css',
|
| 193 |
),
|
| 194 |
|
| 195 |
/**
|
| 196 |
* 'blend target' (Required)
|
| 197 |
* Used as a target color for image and shifting colors to and fro.
|
| 198 |
* Usually #ffffff, #000000, or #666666 can do.
|
| 199 |
*/
|
| 200 |
'blend target' => '#ffffff',
|
| 201 |
);
|
| 202 |
|
| 203 |
/**
|
| 204 |
* $img['images'][imgname] (Required)
|
| 205 |
* Transparent images you wish to fill the BG's of.
|
| 206 |
* And/or slice. List as many as you want, keep the imgname unique.
|
| 207 |
*/
|
| 208 |
$color['images']['header'] = array(
|
| 209 |
/**
|
| 210 |
* 'file' (Required)
|
| 211 |
* Path to your source image in terms of theme's root.
|
| 212 |
*/
|
| 213 |
'file' => 'images/header-mid-blank.png',
|
| 214 |
|
| 215 |
/**
|
| 216 |
* 'fill' (Optional)
|
| 217 |
* Solid: x-coordinate, y-coordinate, width, height, fill color
|
| 218 |
* Gradient: x-coordinate, y-coordinate, width, height, top color, bottom color
|
| 219 |
* You can list as many solid/gradient fills as you want
|
| 220 |
*/
|
| 221 |
'fill' => array(
|
| 222 |
// x coord start, y coord start, width, height, top fieldname, bottom fieldname
|
| 223 |
array('type' => 'y-gradient',
|
| 224 |
'x' => 0,
|
| 225 |
'y' => 0,
|
| 226 |
'width' => 2,
|
| 227 |
'height' => 114,
|
| 228 |
'colors' => array('top', 'bottom'),
|
| 229 |
),
|
| 230 |
),
|
| 231 |
|
| 232 |
/**
|
| 233 |
* 'slices' (Required)
|
| 234 |
* Slice your image up to file destination.
|
| 235 |
* If your slice output file matches a CSS image BG it will be replaced
|
| 236 |
* automatically for you per scheme. :)
|
| 237 |
* file-path according theme root => x-coordinate, y-coordinate, width, height
|
| 238 |
*/
|
| 239 |
'slices' => array(
|
| 240 |
'images/header-mid.png' => array(
|
| 241 |
'x' => 0,
|
| 242 |
'y' => 0,
|
| 243 |
'width' => 2,
|
| 244 |
'height' => 114
|
| 245 |
),
|
| 246 |
),
|
| 247 |
);
|
| 248 |
|
| 249 |
$color['images']['nav-left'] = array(
|
| 250 |
'file' => 'images/nav-left-blank.png',
|
| 251 |
|
| 252 |
/**
|
| 253 |
* 'fill' (Optional)
|
| 254 |
* Solid: x-coordinate, y-coordinate, width, height, fill color
|
| 255 |
* Gradient: x-coordinate, y-coordinate, width, height, top color, bottom color
|
| 256 |
* You can list as many solid/gradient fills as you want
|
| 257 |
*/
|
| 258 |
'fill' => array(
|
| 259 |
array('type' => 'solid',
|
| 260 |
'x' => 0,
|
| 261 |
'y' => 1,
|
| 262 |
'width' => 1,
|
| 263 |
'height' => 16,
|
| 264 |
'colors' => array('top'),
|
| 265 |
),
|
| 266 |
array('type' => 'solid',
|
| 267 |
'x' => 1,
|
| 268 |
'y' => 0,
|
| 269 |
'width' => 4,
|
| 270 |
'height' => 19,
|
| 271 |
'colors' => array('top'),
|
| 272 |
),
|
| 273 |
),
|
| 274 |
|
| 275 |
/**
|
| 276 |
* 'transparent color' (Optional)
|
| 277 |
* A hex color which you want to remain tranparent.
|
| 278 |
* Currently this is used only for keeping blank areas
|
| 279 |
* of transparent PNG's clear.
|
| 280 |
*/
|
| 281 |
'transparent color' => '#000000',
|
| 282 |
|
| 283 |
'slices' => array(
|
| 284 |
'images/nav-left.png' => array(
|
| 285 |
'x' => 0,
|
| 286 |
'y' => 0,
|
| 287 |
'width' => 5,
|
| 288 |
'height' => 19
|
| 289 |
),
|
| 290 |
),
|
| 291 |
);
|
| 292 |
|
| 293 |
$color['images']['nav-right'] = array(
|
| 294 |
'file' => 'images/nav-right-blank.png',
|
| 295 |
'fill' => array(
|
| 296 |
array('type' => 'solid',
|
| 297 |
'x' => 0,
|
| 298 |
'y' => 0,
|
| 299 |
'width' => 3,
|
| 300 |
'height' => 19,
|
| 301 |
'colors' => array('top'),
|
| 302 |
),
|
| 303 |
array('type' => 'solid',
|
| 304 |
'x' => 4,
|
| 305 |
'y' => 1,
|
| 306 |
'width' => 1,
|
| 307 |
'height' => 16,
|
| 308 |
'colors' => array('op'),
|
| 309 |
),
|
| 310 |
),
|
| 311 |
'transparent color' => '#000000',
|
| 312 |
'slices' => array(
|
| 313 |
'images/nav-right.png' => array('x' => 0,
|
| 314 |
'y' => 0,
|
| 315 |
'width' => 5,
|
| 316 |
'height' => 19
|
| 317 |
),
|
| 318 |
),
|
| 319 |
);
|
| 320 |
|
| 321 |
$color['images']['bg-left'] = array(
|
| 322 |
'file' => 'images/bg-left-blank.png',
|
| 323 |
'fill' => array(
|
| 324 |
array('type' => 'solid',
|
| 325 |
'x' => 0,
|
| 326 |
'y' => 0,
|
| 327 |
'width' => 33,
|
| 328 |
'height' => 22,
|
| 329 |
'colors' => array('base'),
|
| 330 |
),
|
| 331 |
),
|
| 332 |
'transparent color' => '#000000',
|
| 333 |
'slices' => array(
|
| 334 |
'images/bg-left.png' => array(
|
| 335 |
'x' => 0,
|
| 336 |
'y' => 0,
|
| 337 |
'width' => 33,
|
| 338 |
'height' => 20
|
| 339 |
),
|
| 340 |
),
|
| 341 |
);
|
| 342 |
|
| 343 |
$color['images']['bg-right'] = array(
|
| 344 |
'file' => 'images/bg-right-blank.png',
|
| 345 |
'fill' => array(
|
| 346 |
array('type' => 'solid',
|
| 347 |
'x' => 0,
|
| 348 |
'y' => 0,
|
| 349 |
'width' => 33,
|
| 350 |
'height' => 20,
|
| 351 |
'colors' => array('base'),
|
| 352 |
),
|
| 353 |
),
|
| 354 |
'transparent color' => '#000000',
|
| 355 |
'slices' => array(
|
| 356 |
'images/bg-right.png' => array('x' => 0,
|
| 357 |
'y' => 0,
|
| 358 |
'width' => 33,
|
| 359 |
'height' => 20
|
| 360 |
),
|
| 361 |
),
|
| 362 |
);
|
| 363 |
|
| 364 |
$color['images']['bg-bottom-left-thin'] = array(
|
| 365 |
'file' => 'images/bottom-left-thin-blank.png',
|
| 366 |
'fill' => array(
|
| 367 |
array('type' => 'solid',
|
| 368 |
'x' => 0,
|
| 369 |
'y' => 0,
|
| 370 |
'width' => 35,
|
| 371 |
'height' => 25,
|
| 372 |
'colors' => array('base'),
|
| 373 |
),
|
| 374 |
),
|
| 375 |
'transparent color' => '#000000',
|
| 376 |
'slices' => array(
|
| 377 |
'images/bottom-left-thin.png' => array('x' => 0,
|
| 378 |
'y' => 0,
|
| 379 |
'height' => 35,
|
| 380 |
'width' => 25,
|
| 381 |
),
|
| 382 |
),
|
| 383 |
);
|
| 384 |
|
| 385 |
$color['images']['bg-bottom-right-thin'] = array(
|
| 386 |
'file' => 'images/bottom-right-thin-blank.png',
|
| 387 |
'fill' => array(
|
| 388 |
array('type' => 'solid',
|
| 389 |
'x' => 0,
|
| 390 |
'y' => 0,
|
| 391 |
'width' => 35,
|
| 392 |
'height' => 25,
|
| 393 |
'colors' => array('base')
|
| 394 |
),
|
| 395 |
),
|
| 396 |
'transparent color' => '#000000',
|
| 397 |
'slices' => array(
|
| 398 |
'images/bottom-right-thin.png' => array(
|
| 399 |
'x' => 0,
|
| 400 |
'y' => 0,
|
| 401 |
'width' => 35,
|
| 402 |
'height' => 25
|
| 403 |
),
|
| 404 |
),
|
| 405 |
|
| 406 |
);
|
| 407 |
|
| 408 |
$color['images']['bg-bottom-left'] = array(
|
| 409 |
'file' => 'images/bottom-left-blank.png',
|
| 410 |
'fill' => array(
|
| 411 |
array('type' => 'solid',
|
| 412 |
'x' => 0,
|
| 413 |
'y' => 0,
|
| 414 |
'width' => 55,
|
| 415 |
'height' => 35,
|
| 416 |
'colors' => array('base'),
|
| 417 |
),
|
| 418 |
),
|
| 419 |
'transparent color' => '#000000',
|
| 420 |
'slices' => array(
|
| 421 |
'images/bottom-left.png' => array('x' => 0,
|
| 422 |
'y' => 0,
|
| 423 |
'width' => 234,
|
| 424 |
'height' => 35
|
| 425 |
),
|
| 426 |
),
|
| 427 |
);
|
| 428 |
|
| 429 |
|
| 430 |
$color['images']['bg-bottom-right'] = array(
|
| 431 |
'file' => 'images/bottom-right-blank.png',
|
| 432 |
'fill' => array(
|
| 433 |
array('type' => 'solid',
|
| 434 |
'x' => 190,
|
| 435 |
'y' => 0,
|
| 436 |
'width' => 55,
|
| 437 |
'height' => 35,
|
| 438 |
'colors' => array('base'),
|
| 439 |
),
|
| 440 |
),
|
| 441 |
'transparent color' => '#000000',
|
| 442 |
'slices' => array(
|
| 443 |
'images/bottom-right.png' => array('x' => 0,
|
| 444 |
'y' => 0,
|
| 445 |
'width' => 234,
|
| 446 |
'height' => 35
|
| 447 |
),
|
| 448 |
),
|
| 449 |
);
|
| 450 |
|
| 451 |
return $color;
|
| 452 |
}
|