Class Utils
Useful database utility methods.
Methods summary
public
array
|
#
generatePlaceholders( array $data )
Generate Wordpress WPDB placeholders for inserts/updates, based on
the types of values in the given array.
Generate Wordpress WPDB placeholders for inserts/updates, based on
the types of values in the given array.
See: http://codex.wordpress.org/Class_Reference/wpdb#Placeholders
Parameters
Returns
array Placeholders
|
public
string
|
#
createSlug( string $data, array $unique = array() )
Generate a slug from the given field.
Generate a slug from the given field.
Uses sanitize_title() to create a slug. If $unique is provided, this
method will check if the slug already exists in $unique. If it does,
it will append '-1', '-2' etc to the slug until a unique value is found.
Parameters
- $data
- Data to slugify
- $unique
- Array of values to ensure slug is unique against
Returns
string Generated slug
|