Open-Source PHP Framework - Designed for rapid development of performance-oriented scalable applications

Tools helper

API >> mvc >> helpers >> tools
This helper provides simplified access to 3rd party tools to enhance your application

youtube(array $args)

Displays an embedded YouTube video. Valid $args keys are:

  • id - (Required) the YouTube video ID - this is in the URL of every YouTube page
  • width - optional, if omitted 425px will be used (the YouTube default)
  • height - optional, if omitted 344px will be used (the YouTube default)

adSense(array $args)

Displays an AdSense unit. You must have the GOOGLE_AD_CLIENT constant set in the .config for this helper to work. Required argument keys are height and width plus either slot or channel (you can get all of these values from the sample code that is generated by AdSense when you create your ad unit.

twitterLink($tweet, $text = null, array $args = array())

Generates a link so users can click to Tweet your $tweet message on Twitter.
This has the same signature as $html->link() except that the first argument is your Tweet text instead of link URL.

googleMap($location, array $args = array())

Generate a Google map.
Valid $args keys:

  • mapType - Options are: HYBRID (default), ROADMAP, SATELLITE, TERRAIN
  • height
  • width
  • zoom - valid zoom levels are 1-19
  • marker - marker used for your position on the map, takes an array of marker arguments (defined below)
  • markers - array of additional positions on the map, can be array(location1location2, ...) or array(location1 => array('icon' => 'iconurl', ...), location2 => array('shadow' => 'shadowurl', ...), ...)
  • options (array sent to the Google Map as args)
  • dontAjax - disable the Google AJAX API load accelerator

Marker arguments are defined by the Google API at http://code.google.com/apis/maps/documentation/v3/reference.html#Marker plus Vork adds an extra option of info to populate the popup baloon that opens when a marker is clicked

googleMapUrl($address)

Generate a link to a location on Google maps.

googleTranslateById($id = null, $to = null, $from = '')

Translate the innerHTML of an HTML container or the value of a form text input by its ID
All arguments can be omitted, in which case this method will only initialize the translate engine, you will need to call the translation function from the page via JavaScript: vork.translateById('id''to''from')
  • $to - Language code (eg. es, ru, etc.)
  • $id - ID of an HTML container or form text element
  • $from - Optional language code, if omitted this will auto-detect
More info on the AJAX translation example page

googleTranslateUrl($to, $url = null, $from = null, $headerLanguage = null)

Generate a link to translate a page using Google Translate.
  • $to Language code to translate to
  • $url Optional, current page will be used if omitted
  • $from Original language code of the page getting translated, omit for automatic selection
  • $headerLanguage Optional, language of the Google Header, if Google does not support the header language then it will use English in the header instead

qrCode($str, array $args = array())

Valid $args keys:
  • size (in px) - this is the size of your image, actual QR size may be smaller (with a white margin) depending on QR version which is automatically determined mathetmatically by a combination of size, ecLevel, string length and string complexity
  • margin (in px)
  • ecLevel - valid options are L, M, Q, H

tagCloud(array $tags, array $args = array())

$tags Array key is the tag, value is the tag weight
Valid $args keys:
  • noCss (Boolean) - if true, you will need to set styles for .cloud0, .cloud1 ... .cloud9
  • multiplier - Used to generate the CSS font sizes
  • baseUrl - this will be prepended to each tag to form the link URL
  • standardDeviation (Boolean) - a Standard Deviation is applied to clouds with at least 6 tags to better balance their sizes

tagCloudTags(array $tags, array $args = array())

Generates a PHP array of tags; this method provides more display control but requires you generate the cloud from the PHP array. Most users would probably be better off using tagCloud()

flickrBall($feedId, array $args = array())

Generates a 3D ball of your Flick feed (will only display for users with Flash installed)
$feedId should look something like 12341234@N00
Valid $args keys:
  • bgcolor
  • width
  • height
  • params - same as Flash params
  • object - same as Flash object

mp3Player($mp3files, array $args = array())

Embeds an MP3 player.
$mp3files can be a string or an array of strings or key => val pairs (mp3file => title)
Valid $args keys:
  • bgcolor
  • bgcolor2 (for gradient effect)
  • height
  • width
  • autoplay (Boolean)
  • loop (Boolean)
  • hidePlaylist (Boolean) - if omitted or false then a playlist is added automatically when more than one MP3 file is included
  • FlashVars (direct entry to the FlashVars property, full features at http://flash-mp3-player.net/players/multi/generator)

chart(array $args)

Builds a chart using Google Chart. $args are sent to Google Chart directly, reference their API at http://code.google.com/apis/chart

addThis(array $args = array())

Creates an AddThis widget. Requires setting the ADD_THIS constant to your AddThis publisher code in the .config file. $args are all optional and can be any parameters defined in the AddThis API.

shareThis(array $services = array(...))

Creates a ShareThis widget. Requires setting the SHARE_THIS constant to your ShareThis publisher code in the .config file. $services are all optional, the following default set of services will be used if ommitted:

  • twitter
  • linkedin
  • facebook
  • digg
  • ybuzz
  • stumbleupon
  • delicious
  • technorati
  • google_bmarks
  • myspace
  • windows_live
  • slashdot
  • blogger
  • wordpress
  • typepad
  • reddit
  • newsvine
  • mixx
  • fark
  • bus_exchange
  • propeller
  • livejournal
  • friendfeed
  • yahoo_bmarks