Пример #1
0
 protected static function rebuild($icon)
 {
     $set = $_SESSION['tpl'][1];
     $sql = "SELECT `name`, `value` FROM `tbl_iconsets` WHERE `set_id` = {$set}";
     $db = \Model\Base::instance();
     $data = $db->exec($sql);
     foreach ($data as $item) {
         if (strpos($item["name"], "#") === 0) {
             if ($item["name"] == "#pattern" && $item['value'] != NULL) {
                 $pattern = $item["value"];
             } elseif ($item["name"] == "#directory" && $item['value'] != NULL) {
                 $pattern = "<img src=\"{$BASE}/template/iconset/{$item['value']}/@1@\" >";
             }
             if ($item["name"] == "#name") {
                 $icon->_name = $item['value'];
             }
         } else {
             if (strpos($item["name"], ",") !== 0) {
                 $names = explode(",", $item['name']);
                 foreach ($names as $name) {
                     $icon->{$name} = str_replace("@1@", $item["value"], $pattern);
                 }
             } else {
                 $icon->{$item['name']} = str_replace("@1@", $item["value"], $pattern);
             }
         }
     }
     $icon->save();
     return $icon;
 }
Пример #2
0
 /**
  * get the framework instance (singleton)
  * @return static
  */
 public static function getF3()
 {
     return \Base::instance();
 }