示例#1
0
 public function get_icon($file)
 {
     global $explorer;
     $shortcut = new phpos_shortcuts();
     if (empty($file['icon'])) {
         if ($this->is_directory($file)) {
             $icon_image = $explorer->config('filetypes_icons_folder_url') . 'folder.png';
         } else {
             $shortcut = new phpos_shortcuts();
             return $shortcut->link_icon($file['extension'], $file['app_id'], null, $file['app_action']);
             if (file_exists($explorer->config('filetypes_icons_folder_dir') . $file['extension'] . '.png')) {
                 $icon_image = $explorer->config('filetypes_icons_folder_url') . $file['extension'] . '.png';
             } else {
                 $icon_image = $explorer->config('filetypes_icons_folder_url') . 'default.png';
             }
         }
     } else {
         $user_icons = new phpos_icons();
         $user_icons_dir = $user_icons->get_icons_dir();
         $user_icons_url = $user_icons->get_icons_url();
         if (file_exists($user_icons_dir . $file['icon'])) {
             $icon_image = $user_icons_url . $file['icon'];
         } else {
             if (file_exists(PHPOS_WEBROOT_DIR . '_phpos/icons/' . $file['icon'])) {
                 $icon_image = PHPOS_WEBROOT_URL . '_phpos/icons/' . $file['icon'];
             } else {
                 $icon_image = PHPOS_WEBROOT_URL . '_phpos/icons/default.png';
             }
         }
     }
     return $icon_image;
     // @returns full url
 }
 public function link_icon($plugin = 'app', $app_id = null, $icon = null, $app_action = null)
 {
     $app = new phpos_app();
     $app->set_app_id($app_id);
     $app->load_config();
     if (!empty($icon)) {
         $user_icons = new phpos_icons();
         $user_icons_dir = $user_icons->get_icons_dir();
         $user_icons_url = $user_icons->get_icons_url();
         if (file_exists($user_icons_dir . $icon)) {
             return $user_icons_url . $icon;
         }
     } else {
         if ($app_id == 'mediaframes') {
             return ICONS . 'mediaframes/' . $app_action . '.png';
         }
         return $app->get_icon();
     }
 }