b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.10) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: Widget

Source Location: /blogs/inc/_misc/_widget.class.php

Class Widget

Class Overview

Widget class which provides an interface to widget methods for other classes.

It provides a method replace_vars() that can be used to replace object properties in given strings. You can also register global action icons.

Located in /blogs/inc/_misc/_widget.class.php [line 46]



		
				Author(s):
		
API Tags:
Abstract:  

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
Sessions
Form Form class
Results Results class

[ Top ]
Property Summary
mixed   $global_icons   List of registered global action icons that get substituted through '$global_icons$'.
mixed   $title   Title of the widget (to be displayed)

[ Top ]
Method Summary
void   gen_global_icons()   Generate img tags for registered icons, through global_icon().
void   global_icon()   Registers a global action icon
string   replace_callback()   Callback function used to replace only necessary values in template.
string   replace_callback_wrapper()   This is an additional wrapper to replace_vars() that allows to react on the return value of it.
string   replace_vars()   Replaces $vars$ with appropriate values.

[ Top ]
Properties
mixed   $global_icons = array() [line 57]

List of registered global action icons that get substituted through '$global_icons$'.

API Tags:
See:  Widget::global_icon()


[ Top ]
mixed   $title [line 51]

Title of the widget (to be displayed)


[ Top ]
Methods
gen_global_icons  [line 158]

  void gen_global_icons( )

Generate img tags for registered icons, through global_icon().

This is used by the default callback to replace '$global_icons$'.



[ Top ]
global_icon  [line 70]

  void global_icon( string $title, string $icon, string $url, [integer $word = ''], [integer $icon_weight = 3], [array $word_weight = 2], [ $link_attribs = array( 'class'=>'action_icon' )]  )

Registers a global action icon

Parameters:
string   $title:  TITLE text (IMG and A link)
string   $icon:  icon code, see $map_iconfiles
string   $url:  icon code for get_icon()
integer   $word:  1-5: weight of the icon. the icon will be displayed only if its weight is >= than the user setting threshold
integer   $icon_weight:  1-5: weight of the word. the word will be displayed only if its weight is >= than the user setting threshold
array   $word_weight:  Additional attributes to the A tag. See action_icon().
   $link_attribs: 


[ Top ]
replace_callback  [line 134]

  string replace_callback( array $matches  )

Callback function used to replace only necessary values in template.

This gets used by replace_vars() to replace $vars$.

Parameters:
array   $matches:  preg match. Index 1 is the template variable.

API Tags:
Return:  to be substituted


Redefined in descendants as:

[ Top ]
replace_callback_wrapper  [line 114]

  string replace_callback_wrapper( array $match  )

This is an additional wrapper to replace_vars() that allows to react on the return value of it.

Used by replace_callback()

Parameters:
array   $match:  preg match


[ Top ]
replace_vars  [line 95]

  string replace_vars( string $template, [array $replace_params = NULL]  )

Replaces $vars$ with appropriate values.

You can give an alternative string to display, if the substituted variable is empty, like:

  1. $vars "Display if empty"$

Parameters:
string   $template:  template
array   $replace_params:  optional params that are put into $this->replace_params to be accessible by derived replace_callback() methods

API Tags:
Return:  The substituted string


[ Top ]

Documentation generated on Tue, 20 May 2008 01:47:23 +0200 by phpDocumentor 1.4.2