コード例 #1
0
ファイル: NMenu.php プロジェクト: subashemphasize/test_site
 protected function getInlineStyle($id, $offset = 10)
 {
     $spriteOffset = Am_View::getSpriteOffset($id);
     if ($spriteOffset === false) {
         return '';
     }
     $realOffset = $offset - $spriteOffset;
     return sprintf(' style="background-position: %spx center;" ', $realOffset);
 }
コード例 #2
0
ファイル: AdminMenuCollapsed.php プロジェクト: grlf/eyedock
 protected function getInlineStyle($id, $offset = 10)
 {
     $spriteOffset = Am_View::getSpriteOffset($id);
     if ($spriteOffset !== false) {
         $realOffset = $offset - $spriteOffset;
         return sprintf(' style="background-position: %spx center;" ', $realOffset);
     } elseif ($src = $this->view->_scriptImg('icons/' . $id . '.png')) {
         return sprintf(' style="background-position: %spx center; background-image:url(\'%s\')" ', $offset, $src);
     } else {
         return false;
     }
 }
コード例 #3
0
ファイル: Icon.php プロジェクト: subashemphasize/test_site
 public function icon($name, $alt = '', $source = 'icon')
 {
     $arr = is_string($alt) ? array('alt' => $alt) : (array) $alt;
     $attrs = "";
     foreach ($arr as $k => $v) {
         $attrs .= $this->view->escape($k) . '="' . $this->view->escape($v) . '" ';
     }
     $spriteOffset = Am_View::getSpriteOffset($name, $source);
     if ($spriteOffset !== false) {
         if (!empty($arr['alt'])) {
             $attrs .= ' title="' . $this->view->escape($arr['alt']) . '"';
         }
         $res = sprintf('<div class="glyph sprite-%s" style="background-position: %spx center;" %s></div>', $source, -1 * $spriteOffset, $attrs);
     } elseif ($src = $this->view->_scriptImg('icons/' . $name . '.png')) {
         $res = sprintf('<img src="%s" ' . $attrs . ' />', $src);
     } else {
         if (!empty($arr['alt'])) {
             $res = $arr['alt'];
         } else {
             $res = null;
         }
     }
     return $res;
 }