source: extensions/AMetaData/JpegMetaData/TagDefinitions/KnownTags.class.php @ 4686

Last change on this file since 4686 was 4686, checked in by grum, 14 years ago

[Plugin:AMetaData] prepare the directory for a future plugin

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1<?php
2/*
3 * --:: JPEG MetaDatas ::-------------------------------------------------------
4 *
5 *  Author    : Grum
6 *   email    : grum at piwigo.org
7 *   website  : http://photos.grum.fr
8 *
9 *   << May the Little SpaceFrog be with you ! >>
10 *
11 * -----------------------------------------------------------------------------
12 *
13 * -----------------------------------------------------------------------------
14 *
15 * -----------------------------------------------------------------------------
16 */
17
18  define("KNOWN_TAGS_IMPLEMENTED",      0x01);
19  define("KNOWN_TAGS_NOT_IMPLEMENTED",  0x02);
20  define("KNOWN_TAGS_ALL", KNOWN_TAGS_NOT_IMPLEMENTED | KNOWN_TAGS_IMPLEMENTED);
21
22  class KnownTags
23  {
24    protected $label = "";
25    protected $tags = Array();
26
27    function __construct()
28    {
29
30    }
31
32    function __destruct()
33    {
34      unset($this->tags);
35    }
36
37    public function getTags($filter = Array('implemented' => KNOWN_TAGS_ALL, 'schema' => NULL))
38    {
39      if(!array_key_exists('implemented', $filter))
40      {
41        $filter['implemented'] = KNOWN_TAGS_ALL;
42      }
43
44      if(!array_key_exists('schema', $filter))
45      {
46        $filter['schema'] = NULL;
47      }
48
49
50      $returned=Array();
51      foreach($this->tags as $key => $val)
52      {
53        if(( ($val['implemented'] and ($filter['implemented'] & KNOWN_TAGS_IMPLEMENTED)) or
54             (!$val['implemented'] and ($filter['implemented'] & KNOWN_TAGS_NOT_IMPLEMENTED)) ) and
55
56             (is_null($filter['schema']) or
57             (!is_null($filter['schema']) and $val['schema']==$filter['schema']) )
58          )
59        {
60          $returned[$key]=$val;
61        }
62      }
63      return($returned);
64    }
65
66    public function tagIdExists($id)
67    {
68      return(array_key_exists($id, $this->tags));
69    }
70
71
72    public function getTagById($id)
73    {
74      if(array_key_exists($id, $this->tags))
75      {
76        return($this->tags[$id]);
77      }
78      return(false);
79    }
80
81    public function getTagIdByName($name)
82    {
83      foreach($this->tags as $key => $val)
84      {
85        if($val['tagName']==$name)
86         return($key);
87      }
88      return(false);
89    }
90
91    public function getTagByName($name)
92    {
93      $index=$this->getTagIdByName($name);
94      if(index!==false)
95        return($this->tags[$index]);
96      return(false);
97    }
98
99    public function getLabel()
100    {
101      return($this->label);
102    }
103
104  }
105
106?>
Note: See TracBrowser for help on using the repository browser.