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

$wpfs

$wpfs : object

A local copy of the $wp_filesystem object

Type

object

$imageInputArray

$imageInputArray : array

Serves as a top-level configuration that holds acceptable image properties

Type

array

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

pluploadInitArray()

pluploadInitArray(  $dropLayer) : array

Gets an initialization array for a plupload drop zone

Parameters

$dropLayer

Returns

array

pluploadAppStoreHead()

pluploadAppStoreHead(  $doReturn = false,   $targets = array()) 

Generates the js code and initializes the appropriate plupload drop zones for the app store screen. This should only be called from wp->admin_head().

Change the $targets array in here to add/remove target divs as drop zones

Parameters

$doReturn

bool FALSE to echo, TRUE to return

$targets

array An array of target layers. Leave null for all layers.

pluploadHandlerScript()

pluploadHandlerScript(  $target) : string

Abstracts the bulk of the plupload initialization js code creation so that we can re-use it with as little work as possible

Parameters

$target

Returns

string

getValuesForType()

getValuesForType(string  $type, boolean  $allowUnsaved,   $htmlEscape = false) : array

Hub for retrieving stored values for various aspects of the app.

Parameters

string $type

The type of information being requested

boolean $allowUnsaved

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

$htmlEscape

Returns

array

handleUploadReceived()

handleUploadReceived(array  $post, array  $files) : string

Feed file uplaods into this for error checking and processing.

Will return "ok" if everything checks out. An error message otherwise.

Parameters

array $post

Contents of the $_POST array

array $files

Contents of the $_FILES array

Returns

string

processUpload()

processUpload(array  $post, array  $files) : integer

Perform post-upload processing of an uploaded file

Assumes that all error checking has completed.

Returns the database ID of the newly inserted image

Parameters

array $post

Contents of the $_POST array

array $files

Contents of the $_FILES array

Returns

integer

uploadCheck()

uploadCheck(array  $post, array  $files) : string

Perform sanity checks on uploaded files

Parameters

array $post

Contents of the $_POST array

array $files

Contents of the $_FILES array

Returns

string

getPaths()

getPaths() : object

Convenience method for getting WP file paths and url

Returns

object

resizeFromBaseImage()

resizeFromBaseImage(string  $srcPath,   $dstPath, string  $dimensions) : void

Given a base image, creates a copy with a new size

Parameters

string $srcPath

The full path to write the resized file

$dstPath
string $dimensions

Output dimensions as WxH

tagImageWithFile()

tagImageWithFile(string  $srcPath, string  $tagFile) : void

Overlays (currently only the bottom of) an image with another file.

Used for tagging launch images with the sharefaith logo

Parameters

string $srcPath

The full path to the source file

string $tagFile

The full path to file to overlay

sectionIsComplete()

sectionIsComplete(string  $section, string  $returnType = 'bool') : mixed

Tells the caller whether or not the supplied section has complete inofrmation

If the returnType is 'bool' will return true or false. Returns the string 'yes' or 'no' otherwise.

The 'string' return type is for ajax calls

Parameters

string $section

The section to test

string $returnType

Either 'string' or 'bool'

Returns

mixed