\Fluent_Demo_Creator

Fluent_Demo_Creator

Summary

Methods
Properties
Constants
__construct()
request_demo()
proccess_demo_from_id()
proccess()
$version
$domain
$url
$args
No constants found
parse_args()
provide()
random_string()
guid()
No protected properties found
N/A
proccess_dir()
replace_array()
default_args()
No private properties found
N/A

Properties

$version

$version : string

Type

string — Class version.

$domain

$domain : string

Type

string — Class text domain.

$url

$url : string

Type

string — fluent url.

$args

$args : array

Type

array — Class args to be run attached after <code>parse_args</code>.

Methods

__construct()

__construct() : \none

Function loaded on class creation. Nothing to see here

Returns

\none

request_demo()

request_demo( $user_email,  $user_first_name,  $user_last_name,  $user_signup) : mixed

Request a demo Function.

Creates a demo draft post and adds the details, then returns the id.

Parameters

$user_email
$user_first_name
$user_last_name
$user_signup

Returns

mixed —

$id. Post id on success, wp_error on failure

proccess_demo_from_id()

proccess_demo_from_id( $id) : mixed

Proccess the demo request.

This function takes a demo post id and proccesses it.

Parameters

$id

Returns

mixed —

$status. Bool or wp_error

proccess()

proccess( $post_id) : mixed

Internal proccess function

The takes the post id and uses the data saved to create the demo. also updates a meta value called status so ajax requests can monitor the proccess.

Parameters

$post_id

Returns

mixed —

$id int on success, wp_error on failure.

parse_args()

parse_args(array $a, array $b, string $filter) : array

Recursive array merging from a default and supplied array.

Very similar function to wp_parse_args except it filters through the whole array tree.

Parameters

array $a

supplied value array.

array $b

default value array.

string $filter

optionally run the array through apply_filters before returning.

Returns

array

provide()

provide(string $key) : array

The provide function is just a shorthand wrapper for suppling a class object and method as array in WordPress actions and filters.

Parameters

string $key

the method name to be added to the array: array( &$this, $key ).

Returns

array

random_string()

random_string(string $length) : string

Helper function used inside the <code>guid()</code> function to generate random strings.

Parameters

string $length

the number of characters to return.

Returns

string

guid()

guid() : string

Guid function used to reformat array index values before sedning them to the fields.

Simply replicates the behaviour found in framework javascript.

Returns

string

proccess_dir()

proccess_dir( $from,  $to,  $meta,  $wp_filesystem)

Parameters

$from
$to
$meta
$wp_filesystem

replace_array()

replace_array( $array,  $from,  $to) : array

Internal functions used to replace urls in serialized data.

Parameters

$array
$from
$to

Returns

array —

$newArray.

default_args()

default_args() : array

Function used across extended classes used in conjunction with <code>parse_args</code> to format supplied arrays and ensure all keys are supplied.

Returns

array