Constants

TABLE_PREFIX

TABLE_PREFIX

A prefix for all tables used by this plugin

PLUGIN_DB_VERSION

PLUGIN_DB_VERSION

A database schema version. This should be an incrementing index (read: should not include minor version numbers), and doesn't need to match the plugin code version number.

MENU_TITLE

MENU_TITLE

Provide titles for menu items

MENU_TITLE_APPSTORE

MENU_TITLE_APPSTORE

MENU_TITLE_CONTENT

MENU_TITLE_CONTENT

MENU_SLUG

MENU_SLUG

Provide unique slugs for menu items The first two are the same to avoid a duplicate submenu item

MENU_SLUG_APPSTORE

MENU_SLUG_APPSTORE

MENU_SLUG_CONTENT

MENU_SLUG_CONTENT

IMAGICK_PATH_DEV

IMAGICK_PATH_DEV

Paths to image magick in different environments

IMAGICK_PATH_PROD

IMAGICK_PATH_PROD

TMP_DIR

TMP_DIR

TAG_URL

TAG_URL

Properties

$pluginUrl

$pluginUrl : string

The URL of the plugin path

Type

string

$imagickPath

$imagickPath : string

The path to ImageMagick

Type

string

$wpdb

$wpdb : object

A local copy of the $wpdb object

Type

object

$inputArray

$inputArray : array

Serves as a top-level configuration that holds field names for various inputs

Type

array

$dbPrefix

$dbPrefix : string

The prefix to the SF Church App tables-typically wp_sf_churchapp_

Type

string

Methods

__construct()

__construct() 

Class constructor

creationSql()

creationSql() : array

Gets the SQL needed to setup the initial database schema

Returns

array

installDb()

installDb() : string

Installs the necessary database tables

Returns

string

tablePrefix()

tablePrefix() : string

Glues together the defined wordpress table prefix with this plugin's prefix

Returns

string

setupTable()

setupTable() : string

Gets the name of the setup table

Returns

string

imagesTable()

imagesTable() : string

Gets the name of the images table

Returns

string

imageVariationsTable()

imageVariationsTable() : string

Gets the name of the imagevariations table

Returns

string

sectionsTable()

sectionsTable() : string

Gets the name of the sections table

Returns

string

sectionMetaTable()

sectionMetaTable() : string

Gets the name of the sectionmeta table

Returns

string

pushLookupTable()

pushLookupTable() : string

Gets the name of the pushlookup table

Returns

string

unsavedChangesTable()

unsavedChangesTable() : string

Gets the name of the unsavedchanges table

Returns

string

adminMenuItems()

adminMenuItems() 

Sets up the administration menu

Uncomment the contents of this method to get a wp-admin menu

loadEnqueues()

loadEnqueues() 

Enqueue scripts and styles

urlFromComponents()

urlFromComponents(string  $path, string  $url) : string

Parses a section URL (e.g. the "uploads" directory) and a full file path and produces the URL to the file

Parameters

string $path

The full path to the file

string $url

The URL to a section

Returns

string

saveTempNameAndDescrition()

saveTempNameAndDescrition(array  $input) 

Saves the input values of the "name and description" admin screen into the "unsaved" table.

Assumes that appropriate input checking has already been performed

Parameters

array $input

An array of input to save (key/value pairs)

saveTempIconTheme()

saveTempIconTheme(string  $type, string  $value) 

Saves the selection values of icon theme and style to the "unsaved" table

Parameters

string $type

'theme' or 'style'

string $value

The value to store

saveOrUpdate()

saveOrUpdate(string  $table, array  $matchArray, array  $input, array  $format = null) : integer

Creates a new record unless doing so would create a duplicate, in which case, the existing record is updated

Returns the ID of the inserted or updated record

Parameters

string $table

The database table into which the data should be saved

array $matchArray

An array of key/value pairs that we will use to determine if this is an update or an insert

array $input

An array of key/value pairs to save in the database

array $format

An array of format specifiers for the update/insert

Returns

integer

getMeta()

getMeta(string  $table, string  $keyField, string  $valueField, array  $keyArray,   $htmlEscape = false) : array

Gets a key/value pair array of meta_key/meta_values from the requested table

Parameters

string $table

The database table from which the data should be read

string $keyField

The name of the field holding the key

string $valueField

The name of the field holding the values

array $keyArray

An array of keys for which we hope to find values. This assumes only one result is ever received

$htmlEscape

Returns

array

storeImageInfo()

storeImageInfo(array  $input, integer  $parentId, boolean  $removePreviousImage = false) : integer

Saves information about a newly added image to the database.

Returns the ID of the new or updated record

Parameters

array $input

Input array of data to save

integer $parentId

The ID of the image in the main table if this is a variation. 0 if this is a base image (not a variation)

boolean $removePreviousImage

true to remove any previously recorded image of this type from the database and file system. Has no affect on image variations. Call removeImageVariations() for that.

Returns

integer

removeImageVariations()

removeImageVariations(integer  $imageId) : void

Removes variations of an image from the database and file system

Parameters

integer $imageId

The ID of the image in the main table

getImages()

getImages(array  $types, string  $key, boolean  $allowUnsaved) : array

Hub for retrieving urls to image variations

Parameters

array $types

An array of images table image_type entries to get. The image_type value is the key of the returned array

string $key

The meta_key of the variation to retrieve

boolean $allowUnsaved

Set TRUE to have "unsaved" changes override the saved values where they exist

Returns

array