|
|
(3 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| __NOEDITSECTION__ | | __NOEDITSECTION__ |
| {{Disclaimer}} | | {{Disclaimer}} |
− | {{MainMenu}} | + | {{MainMenu|Roster}} |
| | | |
− | '''Function Overview'''<br/>
| + | Moved to [[Roster:FunctionsOverview]] |
− | Overview over all functions in the Roster that can be used by Addon Developers.<br/>
| + | |
− | ----
| + | |
− | Latest changes
| + | |
− | *Nefuh | 05.02.2008 03:07 | Created document
| + | |
− | ----
| + | |
− | <br />
| + | |
− | __TOC__
| + | |
− | | + | |
− | =Global functions=
| + | |
− | These function are located in functions.lib.php
| + | |
− | | + | |
− | ==border==
| + | |
− | Parameters: $style, $mode, $header_txt, $width
| + | |
− | Starts or ends fancy bodering containers
| + | |
− | *@param string $style What bordering style to use
| + | |
− | *@param string $mode ( start | end )
| + | |
− | *@param string $header_text Place text in a styled header (default ''null'')
| + | |
− | *@param string $width Set a fixed width for the box
| + | |
− | *@return string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==setTooltip==
| + | |
− | Parameters: $var, $content
| + | |
− | Makes a tootip and places it into the tooltip array
| + | |
− | *@param string $var
| + | |
− | *@param string $content
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==getAllTooltips==
| + | |
− | Gathers all tootips and places them into javascript variables
| + | |
− | *@param array $tooltipArray
| + | |
− | *@return string Tooltips placed in javascript variables
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==sql_highlight==
| + | |
− | Parameters: $sql
| + | |
− | Highlight certain keywords in a SQL query
| + | |
− | *@param string $sql Query string
| + | |
− | *@return string Highlighted string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==die_quietly==
| + | |
− | Parameters: $text, $title, $file, $line, $sql
| + | |
− | Clean replacement for die(), outputs a message with debugging info if needed and ends output
| + | |
− | *@param string $text Text to display on error page
| + | |
− | *@param string $title Title to place on web page (default Message)
| + | |
− | *@param string $file Filename to display
| + | |
− | *@param string $line Line in file to display
| + | |
− | *@param string $sql Any SQL text to display
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==roster_die==
| + | |
− | Parameters: $message, $title, $style
| + | |
− | Draw a message box with the specified border color, then die cleanly
| + | |
− | *@param string $message | The message to display inside the box
| + | |
− | *@param string $title | The box title (default Message )
| + | |
− | *@param string $style | The border style (default sred)
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==ajax_die==
| + | |
− | Parameters: $text, $title, $file, $line, $sql
| + | |
− | Print a roster-ajax XML error message
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==backtrace==
| + | |
− | Print a debug backtrace. This works in PHP4.3.x+, there is an integrated function for this starting PHP5 but I prefer always having the same layout.
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==stripAllHtml==
| + | |
− | Parameters: $string
| + | |
− | This will remove HTML tags, javascript sections and white space. It will also convert some common HTML entities to their text equivalent
| + | |
− | *@param string $file
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==check_if_image==
| + | |
− | Parameters: $filename
| + | |
− | This will check if the given Filename is an image
| + | |
− | *@param imagefile $file
| + | |
− | *@return mixed The extentsion if the filetype is an image, false if it is not
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==colorTooltip==
| + | |
− | Parameters: $tooltip, $caption_color, $locale, $inline_caption
| + | |
− | Tooltip colorizer function with string cleaning. Use only with makeOverlib
| + | |
− | *@param string $tooltip | Tooltip as a string (delimited by "\n" character)
| + | |
− | *@param string $caption_color | (optional) Color for the caption
| + | |
− | *Default is <nowiki>'ffffff'</nowiki> - white
| + | |
− | *@param string $locale | (optional) Locale so color parser can work correctly
| + | |
− | *Default is $roster->config[<nowiki>'locale'</nowiki>]
| + | |
− | *@param bool $inline_caption | (optional) (default 1)
| + | |
− | *Default is true
| + | |
− | *@return string | Formatted tooltip
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==cleanTooltip==
| + | |
− | Parameters: $tooltip, $caption_color, $inline_caption
| + | |
− | Cleans up the tooltip and parses an inline_caption if needed. Use only with [[#makeOverlib]]
| + | |
− | *@param string $tooltip | Tooltip as a string (delimited by "\n" character)
| + | |
− | *@param string $caption_color | (optional) Color for the caption
| + | |
− | *Default is <nowiki>'ffffff'</nowiki> - white
| + | |
− | *@param bool $inline_caption | (optional) (default 1)
| + | |
− | *Default is true
| + | |
− | *@return string | Formatted tooltip
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==makeOverlib==
| + | |
− | Parameters: $tooltip, $caption, $caption_color, $mode, $locale, $extra_parameters
| + | |
− | Easy all in one function to make overlib tooltips. Creates a string for insertion into any html tag that has "onmouseover" and "onmouseout" events
| + | |
− | *@param string $tooltip | Tooltip as a string (delimited by "\n" character)
| + | |
− | *@param string $caption | (optional) Text to set as a true OverLib caption
| + | |
− | *@param string $caption_color | (optional) Color for the caption
| + | |
− | *Default is <nowiki>'ffffff'</nowiki> - white
| + | |
− | *@param bool $mode| (optional) Options 0=colorize,1=clean,2=pass through (default 0)
| + | |
− | *Default 0 (colorize)
| + | |
− | *@param string $locale | Locale so color parser can work correctly
| + | |
− | *Only needed when $colorize is true
| + | |
− | *Default is $roster->config<nowiki>['locale']</nowiki>
| + | |
− | *@param string $extra_parameters | (optional) Extra OverLib parameters you wish to pass
| + | |
− | *@param string $item_id
| + | |
− | *@return unknown
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==messagebox==
| + | |
− | Parameters: $message, $title, $style, $width
| + | |
− | Draw a message box with the specified border color.
| + | |
− | *@param string $message | The message to display inside the box
| + | |
− | *@param string $title | The box title (default message)
| + | |
− | *@param string $style | The border style (default sgray)
| + | |
− | *@param string $width | Set a fixed width
| + | |
− | *@return string $html | The HTML for the messagebox
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==scrollbox==
| + | |
− | Parameters: $message, $title, $style, $width, $height
| + | |
− | Draw a 300x550px scrolling messagebox with the specified border color.
| + | |
− | *@param string $message | The message to display inside the box
| + | |
− | *@param string $title | The box title (default message)
| + | |
− | *@param string $style | The border style (default sgray)
| + | |
− | *@param string $width | Initial width with unit (default 550px)
| + | |
− | *@param string $height | Initial height with unit (default 300px)
| + | |
− | *@return string $html | The HTML for the messagebox
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==messageboxtoggle==
| + | |
− | Parameters: $message, $title, $style, $open, $width
| + | |
− | Draw a message box with the specified border color.
| + | |
− | *@param string $message | The message to display inside the box
| + | |
− | *@param string $title | The box title
| + | |
− | *@param string $style | The border style (default sgray)
| + | |
− | *@param boolean $open | True if initially open (default false)
| + | |
− | *@param string $width | Initial width with unit (default 550px)
| + | |
− | *@return string $html | The HTML for the messagebox
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==scrollboxtoggle==
| + | |
− | Parameters: $message, $title, $style, $open, $width, $height
| + | |
− | Draw a 300x550px scrolling messagebox with the specified border color.
| + | |
− | *@param string $messages | The message to display inside the box
| + | |
− | *@param string $title | The box title (default message)
| + | |
− | *@param string $style | The border style (default sgray)
| + | |
− | *@param string $width | Initial width with unit (default 550px)
| + | |
− | *@param string $height | Initial height with unit (default 300px)
| + | |
− | *@return string $html | The HTML for the messagebox
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==escape_array==
| + | |
− | Parameters: $array
| + | |
− | Recursively escape $array
| + | |
− | *@param array $array | The array to escape
| + | |
− | *@return array | The same array, escaped
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==stripslash_array==
| + | |
− | Parameters: $array
| + | |
− | Recursively stripslash $array
| + | |
− | *@param array $array | The array to escape
| + | |
− | *@return array | The same array, escaped
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==readbleDate==
| + | |
− | Parameters: $datetime, $offset
| + | |
− | Converts a datetime field into a readable date
| + | |
− | *@param string $datetime | datetime field data in DB
| + | |
− | *@param string $offset | Offset in hours to calcuate time returned
| + | |
− | *@return string | formatted date string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==get_file_ext==
| + | |
− | Parameters: $filename
| + | |
− | Gets a file's extention passed as a string
| + | |
− | *@param string $filename
| + | |
− | *@return string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==seconds_to_time==
| + | |
− | Parameters: $seconds
| + | |
− | Converts seconds to a string delimited by time values. Will show w,d,h,m,s
| + | |
− | *@param string $seconds
| + | |
− | *@return string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==getaddon==
| + | |
− | Parameters: $addonname
| + | |
− | Sets up addon data for use in the addon framework
| + | |
− | *@param string $addonname | The name of the addon
| + | |
− | *@return array $addon | The addon's database record
| + | |
− | *@global array $addon_conf | The addon's config data is added to this global array.
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==active_addon==
| + | |
− | Parameters: $name
| + | |
− | Check to see if an addon is active or not
| + | |
− | *@param string $name | Addon basename
| + | |
− | *@return bool
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==urlgrabber==
| + | |
− | Parameters: $url, $timeout, $user_agent, $loopcount
| + | |
− | Handles retrieving the contents of a URL trying multiple methods. Current methods are curl, file_get_contents, fsockopen and will try each in that order
| + | |
− | *@param string $url | URL to retrieve
| + | |
− | *@param int $timeout | Timeout for curl, socket connection timeout for fsock (default 5)
| + | |
− | *@param string $user_agent | Useragent to use for connection (default false)
| + | |
− | *@param int $loopcount | (default 0)
| + | |
− | *@return mixed | False on error, contents on success
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==request_uri==
| + | |
− | Stupid function to create an REQUEST_URI for IIS 5 servers
| + | |
− | *@return string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==file_writer==
| + | |
− | Parameters: $filename, &$content, $mode
| + | |
− | Attempts to write a file to the file system
| + | |
− | *@param string $filename | Name of the file
| + | |
− | *@param string $content | Content of the file
| + | |
− | *@param string $mode | (default wb)
| + | |
− | *@return bool
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==php_as_nobody==
| + | |
− | Parameters: $file
| + | |
− | No Description
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==_aprint==
| + | |
− | Parameters: $arr, $tab
| + | |
− | Debugging function dumps arrays/object formatted. Do Not call this, call [[#aprint|aprint()]]
| + | |
− | *@param array $arr
| + | |
− | *@param int $tab | (default 1)
| + | |
− | *@return string
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==aprint==
| + | |
− | Parameters: $arr, $prefix, $return
| + | |
− | Debugging function dumps arrays/object formatted
| + | |
− | *@param array $arr
| + | |
− | *@param string $prefix
| + | |
− | *@return string | (default false)
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==socketColorEn==
| + | |
− | Parameters: $socket_color, $locale
| + | |
− | Helper function that returns the localized gem color in english
| + | |
− | *@param string $socket_color
| + | |
− | *@return string $color
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==format_microtime==
| + | |
− | Parameters: none
| + | |
− | No Description
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==array_overlay==
| + | |
− | Parameters: $skel, $arr
| + | |
− | A better array_merge()
| + | |
− | *@param array $skel
| + | |
− | *@param array $arr
| + | |
− | *@return array
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==updateCheck==
| + | |
− | Parameters: $addon
| + | |
− | Checks an addon download id on the wowroster.net rss feed. And informs if there is an update.
| + | |
− | *@param string $name | name of the download
| + | |
− | *@param string $url | url
| + | |
− | <br/>[[#Global functions|Top]]
| + | |
− | | + | |
− | ==dummy==
| + | |
− | Parameters: none
| + | |
− | Dummy function. For when you need a callback that doesn't do anything.
| + | |
− | <br/>[[#Global functions|Top]]
| + | |