phpDocumentor PluginSonots
[ class tree: PluginSonots ] [ index: PluginSonots ] [ all elements ]

Class: Tag

Source Location: /sonots/tag.class.php

Class Tag

Class Overview

Tag Class

When you to use, extend this class to overwrite file configuration functions that determine storage filenames and file format, or you can even overwrite to use DBs.

Tag class reads data from storage dynamically when it is required, thus, users of this class can work as if a tag class object already has all data

Example)

  1.   $tag new Tag();
  2.   $tag->save_tags('Hoge''PukiWiki');
  3.   $tag->save_tags('Joge'array('PukiWiki''Plugin''Plugin'));
  4.   $tag->save_tags('Moge'array('Plugin''Moge'));
  5.   $tag->save_tags('Koge'array('Koge'));
  6.   $tag->display_tags('Hoge');
  7.   $tag->display_tags('Joge');
  8.   $tag->display_tags('Moge');
  9.   $tag->display_tags('Koge');
  10.   $tag->display_items('PukiWiki');
  11.   $tag->display_items('Plugin');
  12.   $tag->display_tagcloud();
  13.   $tag->display_tagcloud(null'Plugin');
  14.   $tag new Tag();
  15.   $tag->display_tagcloud(null'Plugin')// get from storage

Note: All functions should not be accessed statically because this class will be extended into a child class to overwrite filename configuration functions. The overwritten functions are accessible via $this->, but not via Tag::(statically). (Tag:: calls functions in Tag class not in the child.)

Located in /sonots/tag.class.php [line 192]



		
				Author(s):
		
		
		
Information Tags:
Version:  $Id: v 1.0 2008-06-05 07:23:17Z sonots $
License:  GPL v2

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
PluginSonotsTag PukiWiki Tag Class

[ Top ]
Property Summary
static array   $reserved_keys   Reserved keys
array   $items   Items of a tag
array   $tagcloud   Tagcloud
array   $tags   Tags of an item

[ Top ]
Method Summary
Tag   Tag()  
boolean   add_tags()   Add tags into an item
void   display_items()   Display items having a tag
void   display_tagcloud()   Display tagcloud
void   display_tags()   Display tags of an item
array   get_existtags()   Get all existing tags in the sytem
array   get_items()   Get items by a tag
array   get_items_by_tagtok()   Get items by a tag token
string   get_items_filename()   Get filename which stores items by a tag
array   get_items_filenames()   Get all items_filename
array   get_items_from_storage()   Get items by a tag from a storage (file or db)
array   get_related_tags()   Get related tags
array   get_tagcloud()   Get tagcloud
string   get_tagcloud_filename()   Get filename which stores tagcloud
array   get_tagcloud_from_storage()   Get tagcloud from a storage (file or db)
array   get_tags()   Get tags of an item
string   get_tags_filename()   Get filename which stores tags of an item
array   get_tags_filenames()   Get all tags_filename
array   get_tags_from_storage()   Get tags of an item from a storage (file or db)
array   get_tags_in_system()   Get all existing tags in the system
boolean   has_tag()   Check if a tag exists in a certain item
boolean   has_tag_in_system()   Check if a tag exists in the system
string   normalize_tags()   Normalize tags
boolean   remove_tags()   Remove tags from an item
boolean   remove_tags_in_system()   Remove tags from the system (in all items)
boolean   rename_item()   Rename an item
boolean   rename_tag()   Rename a tag
boolean   save_tags()   Save tags into an item (This does more than set_tags)
boolean   set_items()   Set items into a tag
boolean   set_items_into_storage()   Set items into a tag, and store into a storage (file or db)
boolean   set_tagcloud_into_storage()   Store tagcloud into a storage (file or db)
boolean   set_tags()   Set tags into an item
boolean   set_tags_into_storage()   Set tags into an item, and store into a storage (file or db)
boolean   tag_exists()   Check if a tag exists in the system
boolean   update_tagcloud()   Update tagcloud

[ Top ]
Properties
static array   $reserved_keys [line 234]

Reserved keys

Strings which have special meanings. They can not be used for tag strings


[ Top ]
array   $items = array() [line 204]

Items of a tag

Associative array of items whose key is a tag and values are an array of items


[ Top ]
array   $tagcloud = array() [line 224]

Tagcloud

Associative array whose key is a tag and values are the number of items


[ Top ]
array   $tags = array() [line 215]

Tags of an item

Associative array of tags whose key is an item and values are an array of keys


[ Top ]
Methods
Constructor Tag  [line 236]

  Tag Tag( )



[ Top ]
add_tags  [line 378]

  boolean add_tags( string $item, mixed $tags  )

Add tags into an item

Parameters:
string   $item: 
mixed   $tags:  string or array of tag(s)

API Tags:
Return:  Success or Failure
Access:  public
Uses:  Tag::update_tagcloud()
Usedby:  Tag::rename_tag()
Uses:  Tag::set_tags()
Uses:  Tag::set_items()
Uses:  Tag::get_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::get_items()


[ Top ]
display_items  [line 756]

  void display_items( $tag, array $items  )

Display items having a tag

Overwrite Me!

Parameters:
array   $items: 
   $tag: 

API Tags:
Access:  public


[ Top ]
display_tagcloud  [line 771]

  void display_tagcloud( [int $limit = null], [string $relate_tag = null]  )

Display tagcloud

Overwrite Me!

Parameters:
int   $limit:  number of tags to be shown
string   $relate_tag:  show only related tags to this


Redefined in descendants as:

[ Top ]
display_tags  [line 742]

  void display_tags( string $item  )

Display tags of an item

Overwrite Me!

Parameters:
string   $item: 

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
get_existtags  [line 564]

  array get_existtags( [boolean $cache = true]  )

Get all existing tags in the sytem

Syntax Sugar for get_tags_in_system

Parameters:
boolean   $cache:  use memory cache

API Tags:
Access:  public
Uses:  Tag::get_tags_in_system()


[ Top ]
get_items  [line 271]

  array get_items( string $tag, [boolean $cache = true]  )

Get items by a tag

Parameters:
string   $tag: 
boolean   $cache:  use memory cache

API Tags:
Access:  public
Usedby:  Tag::remove_tags_in_system()
Usedby:  Tag::rename_tag()
Usedby:  Tag::remove_tags()
Usedby:  Tag::add_tags()
Usedby:  Tag::save_tags()
Uses:  Tag::get_items_from_storage()


[ Top ]
get_items_by_tagtok  [line 663]

  array get_items_by_tagtok( string $tagtok  )

Get items by a tag token

TagA^TagB => intersection TagA-TagB => subtraction

Parameters:
string   $tagtok: 

API Tags:
Return:  items
Usedby:  PluginSonotsTag::get_taggedpages()


[ Top ]
get_items_filename  [line 787]

  string get_items_filename( string $tag  )

Get filename which stores items by a tag

Overwrite Me! to define the filename

Parameters:
string   $tag: 

API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
get_items_filenames  [line 800]

  array get_items_filenames( )

Get all items_filename

Overwrite Me! if you changed get_items_filename


API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
get_items_from_storage  [line 871]

  array get_items_from_storage( string $tag, [string $filename = null]  )

Get items by a tag from a storage (file or db)

Overwrite Me if you don't like the file format

Parameters:
string   $tag: 
string   $filename: 

API Tags:
Access:  protected
Usedby:  Tag::get_items()


[ Top ]
get_related_tags  [line 641]

  array get_related_tags( [string $tag = null]  )

Get related tags

Parameters:
string   $tag: 

API Tags:
Access:  public


[ Top ]
get_tagcloud  [line 578]

  array get_tagcloud( [integer $limit = null], [string $relate_tag = null], [boolean $cache = true]  )

Get tagcloud

Parameters:
integer   $limit: 
string   $relate_tag: 
boolean   $cache:  use memory cache

API Tags:
Access:  public
Usedby:  Tag::get_tags_in_system()


[ Top ]
get_tagcloud_filename  [line 837]

  string get_tagcloud_filename( )

Get filename which stores tagcloud

Overwrite Me! to define the filename


API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
get_tagcloud_from_storage  [line 887]

  array get_tagcloud_from_storage( )

Get tagcloud from a storage (file or db)

Overwrite Me if you don't like the file format


API Tags:
Access:  protected


[ Top ]
get_tags  [line 252]

  array get_tags( string $item, [boolean $cache = true]  )

Get tags of an item

Parameters:
string   $item: 
boolean   $cache:  use memory cache

API Tags:
Access:  public
Usedby:  Tag::rename_item()
Usedby:  Tag::remove_tags()
Usedby:  Tag::save_tags()
Uses:  Tag::get_tags_from_storage()
Usedby:  Tag::add_tags()


[ Top ]
get_tags_filename  [line 813]

  string get_tags_filename( string $item  )

Get filename which stores tags of an item

Overwrite Me! to define the filename

Parameters:
string   $item: 

API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
get_tags_filenames  [line 825]

  array get_tags_filenames( )

Get all tags_filename

Overwrite Me! if you changed get_tags_filename


API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
get_tags_from_storage  [line 852]

  array get_tags_from_storage( string $item, [string $filename = null]  )

Get tags of an item from a storage (file or db)

Overwrite Me if you don't like the file format

Parameters:
string   $item: 
string   $filename: 

API Tags:
Access:  protected
Usedby:  Tag::get_tags()


[ Top ]
get_tags_in_system  [line 549]

  array get_tags_in_system( [boolean $cache = true]  )

Get all existing tags in the system

Parameters:
boolean   $cache:  use memory cache

API Tags:
Access:  public
Usedby:  Tag::get_existtags()
Uses:  Tag::get_tagcloud()


[ Top ]
has_tag  [line 508]

  boolean has_tag( $item, string $tag  )

Check if a tag exists in a certain item

Parameters:
string   $tag: 
   $item: 

API Tags:
Access:  public


[ Top ]
has_tag_in_system  [line 520]

  boolean has_tag_in_system( string $tag  )

Check if a tag exists in the system

Parameters:
string   $tag: 

API Tags:
Access:  public
Usedby:  Tag::tag_exists()


[ Top ]
normalize_tags  [line 714]

  string normalize_tags( string $tags  )

Normalize tags

Parameters:
string   $tags:  or array $tags

API Tags:
Return:  or array normalized tags
Usedby:  Tag::remove_tags_in_system()
Usedby:  Tag::rename_tag()
Usedby:  Tag::remove_tags()
Usedby:  Tag::add_tags()
Usedby:  Tag::save_tags()
Usedby:  Tag::set_tags()


[ Top ]
remove_tags  [line 408]

  boolean remove_tags( string $item, mixed $tags  )

Remove tags from an item

Parameters:
string   $item: 
mixed   $tags:  string or array of tag(s)

API Tags:
Return:  Success or Failure
Access:  public
Usedby:  Tag::remove_tags_in_system()
Usedby:  Tag::rename_tag()
Uses:  Tag::update_tagcloud()
Uses:  Tag::set_tags()
Uses:  Tag::get_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::set_items()
Uses:  Tag::get_items()


[ Top ]
remove_tags_in_system  [line 436]

  boolean remove_tags_in_system( mixed $tags  )

Remove tags from the system (in all items)

Parameters:
mixed   $tags:  string or array of tag(s)

API Tags:
Return:  Success or Failure
Access:  public
Uses:  Tag::update_tagcloud()
Uses:  Tag::set_items()
Uses:  Tag::remove_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::get_items()


[ Top ]
rename_item  [line 490]

  boolean rename_item( string $old_item, string $new_item  )

Rename an item

Parameters:
string   $old_item: 
string   $new_item: 

API Tags:
Return:  Success or Failure
Access:  public
Uses:  Tag::save_tags()
Uses:  Tag::get_tags()


[ Top ]
rename_tag  [line 463]

  boolean rename_tag( string $old_tag, string $new_tag  )

Rename a tag

Parameters:
string   $old_tag: 
string   $new_tag: 

API Tags:
Return:  Success or Failure
Access:  public
Uses:  Tag::set_items()
Uses:  Tag::remove_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::get_items()
Uses:  Tag::add_tags()


[ Top ]
save_tags  [line 341]

  boolean save_tags( string $item, $new_tags, mixed $tags  )

Save tags into an item (This does more than set_tags)

Parameters:
string   $item: 
mixed   $tags:  string or array of tag(s)
   $new_tags: 

API Tags:
Return:  Success or Failure
Access:  public
Uses:  Tag::update_tagcloud()
Usedby:  Tag::rename_item()
Uses:  Tag::set_tags()
Uses:  Tag::set_items()
Uses:  Tag::get_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::get_items()


[ Top ]
set_items  [line 315]

  boolean set_items( string $tag, array $items, [boolean $storage = true]  )

Set items into a tag

Parameters:
string   $tag: 
array   $items: 
boolean   $storage:  write to storage

API Tags:
Access:  public
Usedby:  Tag::remove_tags_in_system()
Usedby:  Tag::rename_tag()
Usedby:  Tag::remove_tags()
Usedby:  Tag::add_tags()
Usedby:  Tag::save_tags()
Uses:  Tag::set_items_into_storage()


[ Top ]
set_items_into_storage  [line 935]

  boolean set_items_into_storage( string $tag, array $items, [string $filename = null]  )

Set items into a tag, and store into a storage (file or db)

Overwrite Me if you don't like the file format

Parameters:
string   $tag: 
array   $items: 
string   $filename: 

API Tags:
Access:  protected
Usedby:  Tag::set_items()


[ Top ]
set_tagcloud_into_storage  [line 955]

  boolean set_tagcloud_into_storage( array $tagcloud, [string $filename = null]  )

Store tagcloud into a storage (file or db)

Overwrite Me if you don't like the file format

Parameters:
array   $tagcloud: 
string   $filename:  filename

API Tags:
Access:  protected


[ Top ]
set_tags  [line 292]

  boolean set_tags( string $item, array $tags, [boolean $storage = true]  )

Set tags into an item

Parameters:
string   $item: 
array   $tags: 
boolean   $storage:  write to storage

API Tags:
Access:  public
Usedby:  Tag::remove_tags()
Usedby:  Tag::add_tags()
Usedby:  Tag::save_tags()
Uses:  Tag::normalize_tags()
Uses:  Tag::set_tags_into_storage()


[ Top ]
set_tags_into_storage  [line 914]

  boolean set_tags_into_storage( string $item, array $tags, [string $filename = null]  )

Set tags into an item, and store into a storage (file or db)

Overwrite Me if you don't like the file format

Parameters:
string   $item: 
array   $tags: 
string   $filename: 

API Tags:
Access:  protected
Usedby:  Tag::set_tags()


[ Top ]
tag_exists  [line 536]

  boolean tag_exists( string $tag  )

Check if a tag exists in the system

Syntax Sugar for has_tag_in_system

Parameters:
string   $tag: 

API Tags:
Access:  public
Uses:  Tag::has_tag_in_system()


[ Top ]
update_tagcloud  [line 610]

  boolean update_tagcloud( [boolean $cache = true]  )

Update tagcloud

Excute after set_tags and set_items

Parameters:
boolean   $cache:  use memory cache

API Tags:
Access:  public
Usedby:  Tag::remove_tags_in_system()
Usedby:  Tag::remove_tags()
Usedby:  Tag::add_tags()
Usedby:  Tag::save_tags()


[ Top ]

Documentation generated on Sat, 16 Aug 2008 15:27:37 -0400 by phpDocumentor 1.3.2