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

Class: PluginSonotsToc

Source Location: /sonots/toc.class.php

Class PluginSonotsToc

Class Overview

Table of Contents Class

This class tries to gather all information at the constructor including information which may not be used by you because a cache file must contain all information for future. Therefore, there is no setter function unlike PluginSonotsPagelist(), and process $headlines at your codes.

Example)

  1.   $toc new PluginSonotsToc($pagetrue)// use cache
  2.   $headlines $toc->get_headlines();
  3.   // you may do something for $headlines here.
  4.   PluginSonotsToc::display_toc($headlines);

PHP5 has static member variable supports, thus PHP5 allows following smart design, but PHP4 does not

  1.   PluginSonotsToc::syntax['headline''/^(\*{1,5})/';
  2.   $toc1 new PluginSonotsToc($page1true);
  3.   $toc2 new PluginSonotsToc($page2true);
  4.   // $cachefile = PluginSonotsToc::syntax['cachefile']($page1);
To use static member variable in PHP4, I used PHP4 static variable trick and use of this class became as followings:
  1.   $toc new PluginSonotsToc()// this $toc is to set static var
  2.   $toc->syntax['headline''/^(\*{1,5})/';
  3.   $toc1 new PluginSonotsToc($page1true);
  4.   $toc2 new PluginSonotsToc($page2true);
  5.   // $cachefile = $toc->syntax['cachefile']($page1);
Use this form in both PHP4 and PHP5.

Located in /sonots/toc.class.php [line 49]



		
				Author(s):
		
		
		API Tags:
Usedby:  PluginSonotsMetapage::firsthead()
Usedby:  PluginSonotsMetapage::title()
Usedby:  PluginSonotsMetapage::toc()

Information Tags:
Version:  $Id: toc.class.php,v 1.10 2008-07-16 07:23:17Z sonots $
License:  GPL v2

Properties

Methods

[ Top ]
Property Summary
static array   $syntax   Definition of PukiWiki Syntax to be used
array   $extra   Extra information such as line number of #readmore
array   $headlines   Headlines of this page
array   $includes   Including pages
string   $page   Pagename
string   $title   Title of this page (if available, or null)
boolean   $usecache   Use cache or not

[ Top ]
Method Summary
static string   display_toc()   Display Table of Contents
static void   shallow_copy()   Copy members of Toc objects
PluginSonotsToc   PluginSonotsToc()   Constructor
void   compact_depth()   Compact depth of headlines
void   construct_toc()   Read a page and construct Toc (This is THE constructor)
array   expand_includes()   Expand headlines of included pages
array   get_extra()   Get Extra (Direct access is okay, though)
string|null   get_firsthead()   Get First Headline String of this page if available
int|null   get_fromhere()   Get line number of #contents line if available
array   get_headlines()   Get Headlines (Direct access is okay, though)
array   get_includepages()   Get including pages in this page.
array   get_includes()   Get Includes (Direct access is okay, though)
int|null   get_readmore()   Get line number of #readmore line if available
string|null   get_title()   Get TITLE of this page if available
void   init()   True Constructor
void   shrink_includes()   Reverse expand_includes

[ Top ]
Properties
static array   $syntax [line 105]

Definition of PukiWiki Syntax to be used


[ Top ]
array   $extra = array() [line 92]

Extra information such as line number of #readmore


[ Top ]
array   $headlines = array() [line 86]

Headlines of this page

keys are line numbers and values are objects of PluginSonotsHeadline


[ Top ]
array   $includes = array() [line 77]

Including pages

keys are line numbers and values are names of including pages


[ Top ]
string   $page [line 56]

Pagename


[ Top ]
string   $title = null [line 68]

Title of this page (if available, or null)


[ Top ]
boolean   $usecache = null [line 62]

Use cache or not


[ Top ]
Methods
static method display_toc  [line 304]

  static string display_toc( array &$headlines, [string $cssclass = ''], [string $optlink = 'anchor'], boolean $optinclude  )

Display Table of Contents

Parameters:
array   &$headlines: 
string   $cssclass:  css class
string   $optlink:  link option
boolean   $optinclude:  show toc of including pages too or not

API Tags:
Return:  list html
Access:  public


[ Top ]
static method shallow_copy  [line 187]

  static void shallow_copy( PluginSonotsToc $source, PluginSonotsToc &$target  )

Copy members of Toc objects

Parameters:
PluginSonotsToc   $source: 
PluginSonotsToc   &$target: 

API Tags:
Access:  public


[ Top ]
Constructor PluginSonotsToc  [line 119]

  PluginSonotsToc PluginSonotsToc( [string $page = ''], [boolean $usecache = true]  )

Constructor

If a page is given, the true constructor self::init() is called. Otherwise, this only initializes static member variables. PHP4 static member variable trick.

Parameters:
string   $page: 
boolean   $usecache: 

API Tags:
Access:  public
Uses:  PluginSonotsToc::init()


[ Top ]
compact_depth  [line 334]

  void compact_depth( array &$headlines  )

Compact depth of headlines

Parameters:
array   &$headlines: 

API Tags:
Access:  public


[ Top ]
construct_toc  [line 407]

  void construct_toc( $page  )

Read a page and construct Toc (This is THE constructor)

Parameters:
   $page: 

API Tags:
Access:  public

Information Tags:
Todo:  should be able to separate functionalities more

[ Top ]
expand_includes  [line 359]

  array expand_includes( [array $visited = array()]  )

Expand headlines of included pages

$visited is used only inside for recursive call, you do not need to use it.

Parameters:
array   $visited:  a flag to check whether the page is processed already.

API Tags:
See:  PluginSonotsToc::shrink_includes()
Access:  public


[ Top ]
get_extra  [line 240]

  array get_extra( )

Get Extra (Direct access is okay, though)


API Tags:
Return:  extra info
See:  PluginSonotsToc::get_fromhere()
See:  PluginSonotsToc::get_readmore()
Access:  public


[ Top ]
get_firsthead  [line 262]

  string|null get_firsthead( )

Get First Headline String of this page if available


API Tags:
Access:  public


[ Top ]
get_fromhere  [line 287]

  int|null get_fromhere( )

Get line number of #contents line if available


API Tags:
Access:  public


[ Top ]
get_headlines  [line 227]

  array get_headlines( )

Get Headlines (Direct access is okay, though)


API Tags:
Return:  array of PluginSonotsHeadline(s)
See:  PluginSonotsToc::get_firsthead()
Access:  public


[ Top ]
get_includepages  [line 251]

  array get_includepages( )

Get including pages in this page.


API Tags:
Access:  public


[ Top ]
get_includes  [line 215]

  array get_includes( )

Get Includes (Direct access is okay, though)


API Tags:
Return:  array of PluginSonotsInclude(s)
See:  PluginSonotsToc::get_includepages()
Access:  public


[ Top ]
get_readmore  [line 275]

  int|null get_readmore( )

Get line number of #readmore line if available


API Tags:
Access:  public


[ Top ]
get_title  [line 203]

  string|null get_title( )

Get TITLE of this page if available


API Tags:
Access:  public


[ Top ]
init  [line 144]

  void init( string $page, boolean $usecache  )

True Constructor

Parameters:
string   $page: 
boolean   $usecache: 

API Tags:
Access:  private
Usedby:  PluginSonotsToc::PluginSonotsToc()


[ Top ]
shrink_includes  [line 394]

  void shrink_includes( )

Reverse expand_includes


API Tags:
See:  PluginSonotsToc::expand_includes()
Access:  public


[ Top ]

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