psf
 All Classes Functions Variables
inline.php
1 <?php
2 
3 //Part of simple php framework (spf)
4 
5 //This program is free software: you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation, either version 3 of the License, or
8 //(at your option) any later version.
9 
10 //This program is distributed in the hope that it will be useful,
11 //but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 //GNU General Public License for more details.
14 
15 //Copyright Petr Bena 2015
16 
17 if (!defined("PSF_ENTRY_POINT"))
18  die("Not a valid psf entry point");
19 
20 require_once (dirname(__FILE__) . "/css.php");
21 
23 class InlineCSS extends CSS
24 {
25  function __construct($_parent = NULL)
26  {
27  parent::__construct($_parent);
28  }
29 
30  protected function Load()
31  {
32  if ($this->BackgroundColor !== NULL)
33  $this->items['_inline_']['background-color'] = $this->BackgroundColor;
34  }
35 
36  public function SetProperty($name, $value)
37  {
38  $this->items['_inline_'][$name] = $value;
39  }
40 
41  public function GetProperty($name)
42  {
43  return $this->items['_inline_'][$name];
44  }
45 
46  public function ToCss($n = 0)
47  {
48  $this->Load();
49  if (!array_key_exists("_inline_", $this->items))
50  return;
51  $buff = '';
52  foreach ($this->items['_inline_'] as $name => $values)
53  {
54  $buff .= $name . ': ' . $values . ";";
55  }
56  return $buff;
57  }
58 }
59