ExtensionLib Class Reference

Public library for all extensions of exblog. More...

#include "/include/extension.php"


Public Member Functions

 getSystemConfig ()
 get configure about the core
 _initDatabaseConnection ()
 Init connection to a database.
 _loadLanguage ($language_name)
 load a language file
 _initHtml ($template_path, $other_param= '')
 init HTML handler
 loadConfigForExtension ($extension_name)
 Load configure about a extension.
 loadSettingForExtension ($extension_name)
 Load setting about a extension from a configure file.
 checkUser ($user_level)
 Detect whether a user could use this function.
 _walkDir ($dir_path, $only_dir=TRUE)
 traversal a directory
 setModuleName ($module_name)
 Set module name for ACL driver.
 _showError ($errors="", $return_url="")
 Show error messages.
 initRequired ($config_file, $plugin_name, $plugin_language)
 A group of codes required during initalizing.
 heavyerInit ()
 More heavy for initalizing.
 _formatDirName ($dir_name)
 Format name of a directory.
 _getVariables ()
 Get all variables, included COOKIE, SESSION, POST and GET data.
 _addTopMenu ($menu_text, $menu_url= '', $selected=FALSE)
 Add a item into top menu bar.
 _getStatInfo ()
 Get stat information about this system.
 _getSorts ()
 Get a list of all sorts.
 _getLastestArticles ($num, $field_names= '*')
 Get last x articles.
 _getLatestRecords ($table_name, $num=0, $order_fields="", $conditions="", $fields_list="*", $offset=0, $return_only_first=FALSE)
 Get last x records from a select table.
 _getCalendar ($year, $month)
 Calendar.
 _getPigeonhole ($year)
 Get a list of archives' date.
 _getBlogDate ($start_time, $end_time)
 Get a list of articles in a period of time.
 _countBlogsByDate ($blog_dates, $start_time, $end_time)
 Get number of articles in a period of time.
 _isBlogHang ()
 Detect whether the blog is hang.

Public Attributes

 $_errors = array()
 Error message-bus.
 $_html = 0
 HTML handler.
 $_dbop = 0
 Database handler.
 $_config = array()
 All configure.
 $_input = array()
 All input data.


Detailed Description

Public library for all extensions of exblog.

Author:
$Author$
Date:
: $Date$
$Id$


Member Function Documentation

ExtensionLib::_addTopMenu (  $  menu_text,
$  menu_url = '',
$  selected = FALSE
) 
 

Add a item into top menu bar.

Parameters:
$menu_text Description of a menu, show on the menu
$menu_url Link of a menu
$selected Whether the menu had been selected

ExtensionLib::_countBlogsByDate (  $  blog_dates,
$  start_time,
$  end_time
) 
 

Get number of articles in a period of time.

Parameters:
$blog_dates A list of date for articles
$start_time Start time
$end_time End time
Returns:
TRUE if number of articles was great than 0, else return FALSE

ExtensionLib::_formatDirName (  $  dir_name  ) 
 

Format name of a directory.

Parameters:
$dir_name Real name of a directory
Returns:
a formatted name of a directory

ExtensionLib::_getBlogDate (  $  start_time,
$  end_time
) 
 

Get a list of articles in a period of time.

Parameters:
$start_time Start time
$end_time End time

ExtensionLib::_getCalendar (  $  year,
$  month
) 
 

Calendar.

Parameters:
$year year
$month month

ExtensionLib::_getLastestArticles (  $  num,
$  field_names = '*'
) 
 

Get last x articles.

Parameters:
$num How many articles would be fetched
$field_names which fields would be return. default was all fields
Returns:
a list of articles

ExtensionLib::_getLatestRecords (  $  table_name,
$  num = 0,
$  order_fields = "",
$  conditions = "",
$  fields_list = "*",
$  offset = 0,
$  return_only_first = FALSE
) 
 

Get last x records from a select table.

Parameters:
$table_name Name of table
$num How many records would be fetched
$order_fields field order for sort records, include sort order. example: id desc or id desc, name asc, like ORDER in mysql
$conditions condition for fetching records. all records must be matched. like WHERE in mysql
$fields_list which fields would be return. default was all fields
$offset offset number for starting fetching records.
$return_only_first Whether return one record only.
TRUE = yes, FALSE = no. Default was no
If it was TRUE, a array which using field names as key would be return,
else a array which every element was a record in would be return

ExtensionLib::_getPigeonhole (  $  year  ) 
 

Get a list of archives' date.

Parameters:
$year year

ExtensionLib::_getSorts (   ) 
 

Get a list of all sorts.

Returns:
The list
Note:
The list woule be saved into ::$sorts too.

ExtensionLib::_getVariables (   ) 
 

Get all variables, included COOKIE, SESSION, POST and GET data.

Note:
All variables would be saved in ::$_input order by GPCS ,
and every group of variables would be saved into ::$_input using their name as key.

ExtensionLib::_initHtml (  $  template_path,
$  other_param = ''
) 
 

init HTML handler

Parameters:
$template_path path of templates
$other_param the additional parameter to added into template variables

ExtensionLib::_isBlogHang (   ) 
 

Detect whether the blog is hang.

Returns:
Return TRUE if hang, else return FALSE

ExtensionLib::_loadLanguage (  $  language_name  ) 
 

load a language file

Parameters:
$language_name language filename
Note:
The selected language would be saved into global variable $this->_lang.
If $language_name like as name.subname, it would be saved in $this->_lang[name][subname], else $this->_lang[$language_name]

ExtensionLib::_showError (  $  errors = "",
$  return_url = ""
) 
 

Show error messages.

Parameters:
$errors A list of error messages. It could be a string or a array
$return_url Where to go after ouput error messages
Note:
The script would be terminated after call this method!! All codes below the call method could not be executed.

ExtensionLib::_walkDir (  $  dir_path,
$  only_dir = TRUE
) 
 

traversal a directory

Parameters:
$dir_path The directory to traversal
$only_dir Whether get all sub-directories only, default was yes
TRUE = yes, FALSE = no
Returns:
a list of all files and directories, except current directory(.), parent directory(..) and hidden files or directories, if successful, else return a empty list.
The list as below: array( array('path' => '/path/to/file1', 'name' => 'Name_Of_File1'), array('path' => '/path/to/file2', 'name' => 'Name_Of_File2'), ...)

ExtensionLib::checkUser (  $  user_level  ) 
 

Detect whether a user could use this function.

Parameters:
$user_level Maximum level of users to use this function. The users whose level were less than this level could use.
Returns:
If the user could use, return TRUE, else return FALSE

ExtensionLib::initRequired (  $  config_file,
$  plugin_name,
$  plugin_language
) 
 

A group of codes required during initalizing.

Note:
Two Constants were used in it, so you must define them before call this method
  • PLUGIN_LANGUAGE The language package for this extension
  • PLUGIN_NAME Plugin name.same as register in table module

ExtensionLib::loadConfigForExtension (  $  extension_name  ) 
 

Load configure about a extension.

Parameters:
$extension_name Name of a extension
Returns:
If successful, the configure would be return, else return FALSE

ExtensionLib::loadSettingForExtension (  $  extension_name  ) 
 

Load setting about a extension from a configure file.

Parameters:
$extension_name name of a extension
Returns:
NULL

ExtensionLib::setModuleName (  $  module_name  ) 
 

Set module name for ACL driver.

Parameters:
$module_name Module name. It would be same as register in table module during install this extension


Member Data Documentation

ExtensionLib::$_config = array()
 

All configure.

Note:
All elements:
  • global Core configure
  • plugin plugin configure

ExtensionLib::$_input = array()
 

All input data.

See also:
_getVariables()


Generated on Fri Nov 4 01:18:26 2005