Translation update done using Pootle.
[phpmyadmin.git] / themes / sprites.css.php
blob5156531dbec96737c80b8bb4850b6eeb33581681
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * This file generates the CSS code for the sprites of a theme
6 * @package PhpMyAdmin-theme
7 */
9 // unplanned execution path
10 if (!defined('PMA_MINIMUM_COMMON')) {
11 exit();
14 $bg = $_SESSION['PMA_Theme']->getImgPath() . 'sprites.png';
16 /* Icon sprites */
17 .icon, .footnotemarker {
18 margin: 0 0.3em;
19 padding: 0 !important;
20 width: 16px;
21 height: 16px;
22 background-image: url('<?php echo $bg; ?>') !important;
23 background-repeat: no-repeat !important;
24 background-position: top left !important;
27 <?php
28 /* Check if there is a valid data file for sprites */
29 if (is_readable($_SESSION['PMA_Theme']->getPath() . '/sprites.lib.php')) {
30 include_once $_SESSION['PMA_Theme']->getPath() . '/sprites.lib.php';
31 $sprites = array();
32 if (function_exists('PMA_sprites')) {
33 $sprites = PMA_sprites();
35 $template = ".ic_%s { background-position: 0 -%upx !important;%s%s }\n";
36 foreach ($sprites as $name => $data) {
37 // generate the CSS code for each icon
38 $width = '';
39 $height = '';
40 // if either the height or width of an icon is 16px,
41 // then it's pointless to set this as a parameter,
42 //since it will be inherited from the "icon" class
43 if ($data['width'] != 16) {
44 $width = " width: " . $data['width'] . "px;";
46 if ($data['height'] != 16) {
47 $height = " height: " . $data['height'] . "px;";
49 printf(
50 $template,
51 $name,
52 ($data['position'] * 16),
53 $width,
54 $height
57 // Here we map some of the classes that we
58 // defined above to other CSS selectors.
59 // The indexes of the array correspond to
60 // already defined classes and the values
61 // are the selectors that we want to map to.
62 $elements = array(
63 's_sortable' => 'img.sortableIcon',
64 's_asc' => 'th.headerSortUp img.sortableIcon',
65 's_desc' => 'th.headerSortDown img.sortableIcon'
67 $template = "%s { background-position: 0 -%upx; "
68 . "height: %upx; width: %upx; }\n";
69 foreach ($elements as $key => $value) {
70 if (isset($sprites[$key])) { // If the CSS class has been defined
71 printf(
72 $template,
73 $value,
74 ($sprites[$key]['position'] * 16),
75 $sprites[$key]['height'],
76 $sprites[$key]['width']