tp TouchPointWP TouchPointWP_AdminAPI - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\TouchPointWP_AdminAPI

Admin API class.

  • Class name: TouchPointWP_AdminAPI
  • Namespace: \tp\TouchPointWP
  • This class implements: tp\TouchPointWP\api

Constants

API_ENDPOINT_SCRIPTZIP

const API_ENDPOINT_SCRIPTZIP = "scriptzip"

Methods

__construct

mixed tp\TouchPointWP\TouchPointWP_AdminAPI::__construct()

Constructor function

  • Visibility: public

Returns

  • mixed

api

bool tp\TouchPointWP\api::api(array uri)

Handle API requests

Arguments

  • uri array - The request URI already parsed by parse_url()

Returns

  • bool - False if endpoint is not found. Should print the result.

displayField

string tp\TouchPointWP\TouchPointWP_AdminAPI::displayField(array data, ?\WP_Post post, bool echo)

Generate HTML for displaying fields.

  • Visibility: public

Arguments

  • data array - Data array.
  • post ?\WP_Post - Post object.
  • echo bool - Whether to echo the field HTML or return it.

Returns

  • string -

generatePython

string|array tp\TouchPointWP\TouchPointWP_AdminAPI::generatePython(bool toZip, array filenames)

Generate the python scripts to be uploaded to TouchPoint.

  • Visibility: public

Arguments

  • toZip bool - Set true to combine into a Zip file.
  • filenames array - Indicate which files should be included, based on their repo name. Add '*' to the array to include all files regardless of name.

Returns

  • string|array - If toZip is true, returns the file path of the zip file. If toZip is false, returns an array of filename => content.

showError

mixed tp\TouchPointWP\TouchPointWP_AdminAPI::showError(mixed message)

Display an error when there's something wrong with the TouchPoint connection.

  • Visibility: public
  • This method is static.

Arguments

  • message mixed

Returns

  • mixed