Pluck function overview

If you are working on code for pluck (whether this is code for a module, for a theme or you are working on the main code), there are some built in functions you can use. This page lists them in an easy table.

The area listed in the table below, refers to the area in which you can use the function. We have three areas:

  • admin - you can only use the function in the admin center
  • site - you can use the function on the main site only
  • all - you can use the function in both the admin center and in the site
Function What does it do? Introduced in version Area
module_is_compatible($module)
Checks if a module (defined by $module) is compatible witht he current pluck version. Returns TRUE or FALSE. 4.6 all
recursive_remove_directory($dir)
Recursively removes a directory (defined by $dir) and all files/dirs under it. 4.6 all
get_sitetitle()
Returns the site title. It's better to use the $site_title variable. 4.6 all
redirect($url, $time)
Redirects the user to a page (defined by $url) in the number of seconds defined by $time. 4.6 all
read_dir_contents($dir, $mode)
Reads out the files OR dirs in a directory (defined by $dir), and puts them in an array. Set $mode to dirs or files. 4.6 all
get_pagetitle()
Returns the page title of the current page. It's better to use the $page_title variable. 4.6 site
showmenudiv($title, $text, $image, $url, $blank, $more)
Inserts XHTML-code for a menu button, with title being defined by $title, text below the button being defined by $text, the image being defined by $image, the page the button links to being defined by $url, and a small caption defined by $more (optional). An external link can be created by setting $blank to true. 4.6 admin
save_password($password)
Saves a new password, defined by $password. 4.6 admin
save_options($title, $email, $xhtml)
Saves the general settings, with $title being the site title, $email being the user email address and $xhtml (should be true or false) defining the XHTML-compatibility mode. 4.6 admin
save_language($language)
Saves the language, with $language defining the language file (for example en.php). 4.6 admin
save_theme($theme)
Saves the theme, with $theme defining the theme dir. 4.6 admin
save_page($file, $title, $content, $hidden)
Saves a (new) page, with $file defining the file (without extension), $title defining the title of the page, $content defining the content and $hidden defining whether the page should show up in the menu (should be true or false, optional, default=false). 4.6 admin
install_done()
Saves an install.dat file, indicating that pluck has been installed. 4.6 admin
count_trashcan()
Counts and returns number of items in trashcan. 4.6 admin
 
dev/functions.txt · Last modified: 2008/11/10 19:38 by sander
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki