Ejemplo n.º 1
0
  public static function menu_icon($file, $fallback = true) {
    
    global $wf;

    if (!is_admin()) {
      return new WOOF_Image( MPU::img_path("menu-icon-generic.png"), MPU::img_url("menu-icon-generic.png"));
    }
    
    $ret = new WOOF_Silent(__("The icon is not specified, or does not exist", MASTERPRESS_DOMAIN) );
    
    if ($fallback) {
      $ret = new WOOF_Image( MPU::img_path("menu-icon-generic.png"), MPU::img_url("menu-icon-generic.png"));
    }
    
    if ($file != "") {
      $file_path = MASTERPRESS_CONTENT_MENU_ICONS_DIR.$file;
      
      if (file_exists($file_path)) {
        $ret = new WOOF_Image($file_path, MASTERPRESS_CONTENT_MENU_ICONS_URL.$file);
      } else {
        // check in the plug-in images directory
        $file_path = MASTERPRESS_IMAGES_DIR.$file;
        if (file_exists($file_path)) {
          $ret = new WOOF_Image($file_path, MASTERPRESS_IMAGES_URL.$file);
        }
        
      }
      
    }
    
    return $ret;
  }