Overview

Classes

  • Quform
  • Quform_Admin_InsertForm
  • Quform_Admin_Page
  • Quform_Admin_Page_Controller
  • Quform_Admin_Page_Dashboard
  • Quform_Admin_Page_Entries
  • Quform_Admin_Page_Entries_Edit
  • Quform_Admin_Page_Entries_List
  • Quform_Admin_Page_Entries_View
  • Quform_Admin_Page_Factory
  • Quform_Admin_Page_Forms_Add
  • Quform_Admin_Page_Forms_Edit
  • Quform_Admin_Page_Forms_List
  • Quform_Admin_Page_Help
  • Quform_Admin_Page_Preview
  • Quform_Admin_Page_Settings
  • Quform_Admin_Page_Tools
  • Quform_Admin_Page_Tools_ExportEntries
  • Quform_Admin_Page_Tools_ExportForm
  • Quform_Admin_Page_Tools_Home
  • Quform_Admin_Page_Tools_ImportForm
  • Quform_Admin_Page_Tools_Migrate
  • Quform_Admin_Page_Tools_Uninstall
  • Quform_Api
  • Quform_Block
  • Quform_Builder
  • Quform_Captcha
  • Quform_ClassLoader
  • Quform_Confirmation
  • Quform_Container
  • Quform_Dashboard_Widget
  • Quform_Dispatcher
  • Quform_Element
  • Quform_Element_Captcha
  • Quform_Element_Checkbox
  • Quform_Element_Column
  • Quform_Element_Container
  • Quform_Element_Container_Iterator
  • Quform_Element_Date
  • Quform_Element_Email
  • Quform_Element_Factory
  • Quform_Element_Field
  • Quform_Element_File
  • Quform_Element_Group
  • Quform_Element_Hidden
  • Quform_Element_Honeypot
  • Quform_Element_Html
  • Quform_Element_Multi
  • Quform_Element_Multiselect
  • Quform_Element_Name
  • Quform_Element_Page
  • Quform_Element_Password
  • Quform_Element_Radio
  • Quform_Element_Recaptcha
  • Quform_Element_Row
  • Quform_Element_Select
  • Quform_Element_Submit
  • Quform_Element_Text
  • Quform_Element_Textarea
  • Quform_Element_Time
  • Quform_Entry_Controller
  • Quform_Entry_Exporter
  • Quform_Entry_List_Settings
  • Quform_Entry_List_Table
  • Quform_Entry_Processor
  • Quform_Entry_UserSearcher
  • Quform_Filter_Abstract
  • Quform_Filter_Alpha
  • Quform_Filter_AlphaNumeric
  • Quform_Filter_Digits
  • Quform_Filter_Regex
  • Quform_Filter_Static
  • Quform_Filter_StripTags
  • Quform_Filter_Trim
  • Quform_Form
  • Quform_Form_Controller
  • Quform_Form_Exporter
  • Quform_Form_Factory
  • Quform_Form_Importer
  • Quform_Form_Iterator
  • Quform_Form_List_Settings
  • Quform_Form_List_Table
  • Quform_Form_Processor
  • Quform_License
  • Quform_Migrator
  • Quform_NonceRefresher
  • Quform_Notification
  • Quform_Notification_Resender
  • Quform_Options
  • Quform_Permissions
  • Quform_Repository
  • Quform_ScriptLoader
  • Quform_Session
  • Quform_Settings
  • Quform_Shortcode
  • Quform_Themes
  • Quform_TokenReplacer
  • Quform_Toolbar
  • Quform_Translations
  • Quform_Updater
  • Quform_Upgrader
  • Quform_Uploader
  • Quform_Validator_Abstract
  • Quform_Validator_Alpha
  • Quform_Validator_AlphaNumeric
  • Quform_Validator_Array
  • Quform_Validator_Captcha
  • Quform_Validator_Date
  • Quform_Validator_Digits
  • Quform_Validator_Duplicate
  • Quform_Validator_Email
  • Quform_Validator_FileUpload
  • Quform_Validator_GreaterThan
  • Quform_Validator_Honeypot
  • Quform_Validator_Identical
  • Quform_Validator_InArray
  • Quform_Validator_Length
  • Quform_Validator_LessThan
  • Quform_Validator_Recaptcha
  • Quform_Validator_Regex
  • Quform_Validator_Required
  • Quform_Validator_Static
  • Quform_Validator_Time
  • Quform_View
  • Quform_ViewFactory
  • Quform_Widget_Form
  • Quform_Widget_Popup

Interfaces

  • Quform_Attachable
  • Quform_Element_Editable
  • Quform_Filter_Interface
  • Quform_Validator_Interface
  • Overview
  • Class

Class Quform_Repository

Copyright: Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
Located at Quform/Repository.php
Methods summary
public string
# getFormsTableName( )

Get the name of the forms table with the WP prefix added

Get the name of the forms table with the WP prefix added

Returns

string
public string
# getEntriesTableName( )

Get the name of the entries table with the WP prefix added

Get the name of the entries table with the WP prefix added

Returns

string
public string
# getEntryDataTableName( )

Get the name of the entry data table with the WP prefix added

Get the name of the entry data table with the WP prefix added

Returns

string
public string
# getEntryLabelsTableName( )

Get the name of the entry labels table with the WP prefix added

Get the name of the entry labels table with the WP prefix added

Returns

string
public string
# getEntryEntryLabelsTableName( )

Get the name of the entry label mapping table with the WP prefix added

Get the name of the entry label mapping table with the WP prefix added

Returns

string
public array
# all( boolean|null $active = null, string $orderBy = 'id', string $order = 'ASC' )

Get all form rows

Get all form rows

Parameters

$active
Select all (null), only active (true) or inactive (false) forms
$orderBy
Order by this column
$order
Order 'ASC' or 'DESC'

Returns

array
public array
# getFormsForListTable( array $args = array() )

Get form rows, including counts of read and unread entries

Get form rows, including counts of read and unread entries

Deprecated

2.1.0

Parameters

$args
The query args

Returns

array
public array
# getForms( array $args = array() )

Get form rows, including counts of read and unread entries

Get form rows, including counts of read and unread entries

Parameters

$args
The query args

Returns

array
public array
# allForms( boolean|null $active = null )

Get all form configs

Get all form configs

Parameters

$active
Select all (null), only active (true) or inactive (false) forms

Returns

array
public array
# getFormsById( array $ids )

Get the array of form configs with the given IDs

Get the array of form configs with the given IDs

Parameters

$ids

Returns

array
public int[]
# getTrashedFormIds( )

Get the array of form IDs that are trashed

Get the array of form IDs that are trashed

Returns

int[]
public array
# formsToSelectArray( boolean|null $active = null, string $orderBy = 'updated_at', string $order = 'DESC' )

Get the forms list in array format to be easily used by an HTML <select>

Get the forms list in array format to be easily used by an HTML <select>

Parameters

$active
Select all (null), only active (true) or inactive (false) forms
$orderBy
Order by this column
$order
Order 'ASC' or 'DESC'

Returns

array
public integer
# count( boolean|null $active = null, boolean $trashed = false )

Get the count of forms

Get the count of forms

Parameters

$active
Select all (null), only active (true) or inactive (false) forms
$trashed
Select trashed forms

Returns

integer
public boolean
# exists( integer $id )

Does the form exist with the given ID?

Does the form exist with the given ID?

Parameters

$id

Returns

boolean
public boolean
# entryExists( integer $id )

Does the entry exist with the given ID?

Does the entry exist with the given ID?

Parameters

$id

Returns

boolean
public array|null
# find( integer $id )

Find a form by ID

Find a form by ID

Parameters

$id

Returns

array|null
public array|null
# first( )

Get the first non-trashed form row

Get the first non-trashed form row

Returns

array|null
public array|null
# getConfig( integer $id )

Get the config array for the form with the given ID

Get the config array for the form with the given ID

Parameters

$id
The form ID

Returns

array|null
The config array or null if the form doesn't exist
public array|null
# firstConfig( )

Get the config array for the first form in the database

Get the config array for the first form in the database

Returns

array|null
The config array or null if the form doesn't exist
public
# activate( )

On plugin activation - create the database tables

On plugin activation - create the database tables

protected
# createFormsTable( )

Create the forms table

Create the forms table

protected
# createEntriesTable( )

Create the entries table

Create the entries table

protected
# createEntryDataTable( )

Create the entry data table

Create the entry data table

protected
# createEntryLabelsTable( )

Create the entry data table

Create the entry data table

protected
# createEntryEntryLabelsTable( )

Create the entry data table

Create the entry data table

public
# getDbVersion( )

Get the database version from the wpdb object

Get the database version from the wpdb object

public array|boolean
# add( array $config )

Add the form with the given config

Add the form with the given config

Parameters

$config
The form config to add

Returns

array|boolean
The new form config with new auto-generated ID or false on failure
public array
# save( array $config )

Save the form with the given config and return the config

Save the form with the given config and return the config

If the 'id' is present in the config array it will update the form otherwise a new one will be created

Parameters

$config
The config

Returns

array
The updated config array
public array
# saveEntry( array $config, integer|null $entryId = null )

Save the entry with the given configuration

Save the entry with the given configuration

Parameters

$config
The entry config
$entryId
The entry ID if we are updating a saved entry, null for new entries

Returns

array
The entry config with new ID if we are adding a new entry
public
# saveEntryData( integer $entryId, array $data )

Save the given data to the entry with the given ID

Save the given data to the entry with the given ID

Parameters

$entryId
$data
public integer
# activateForms( array $ids )

Activate forms with the given IDs

Activate forms with the given IDs

Parameters

$ids
The array of form IDs

Returns

integer
The number of affected rows
public integer
# deactivateForms( array $ids )

Deactivate forms with the given IDs

Deactivate forms with the given IDs

Parameters

$ids
The array of form IDs

Returns

integer
The number of affected rows
public integer
# trashForms( array $ids )

Trash forms with the given IDs

Trash forms with the given IDs

Parameters

$ids
The array of form IDs

Returns

integer
The number of affected rows
public integer
# untrashForms( array $ids )

Untrash forms with the given IDs

Untrash forms with the given IDs

Parameters

$ids
The array of form IDs

Returns

integer
The number of affected rows
public integer
# deleteForms( array $ids )

Delete the forms with the IDs in the given array

Delete the forms with the IDs in the given array

Parameters

$ids
The array of form IDs

Returns

integer
The number of deleted rows
public array
# duplicateForms( array $ids )

Duplicate the forms with the IDs in the given array

Duplicate the forms with the IDs in the given array

Parameters

$ids
The form ID

Returns

array
The array of new form IDs
protected string
# joinIds( array $ids )

Escape and join an array of IDs for use in an IN clause

Escape and join an array of IDs for use in an IN clause

Parameters

$ids
The array of IDs

Returns

string
The sanitized string for the IN clause
protected string
# prepareIds( array $ids )

Prepare an array of IDs for use in an IN clause

Prepare an array of IDs for use in an IN clause

Parameters

$ids
The array of IDs

Returns

string
The sanitized string for the IN clause
protected array
# sanitizeIds( array $ids )

Sanitize the array of IDs ensuring they are all integers

Sanitize the array of IDs ensuring they are all integers

Parameters

$ids
The array of IDs

Returns

array
The array of sanitized IDs
protected array
# sanitiseIds( array $ids )

Sanitize the array of IDs ensuring they are all integers

Sanitize the array of IDs ensuring they are all integers

Deprecated

2.4.0

Parameters

$ids
The array of IDs

Returns

array
The array of sanitized IDs
public array|null
# getEntries( Quform_Form $form, array $args = array() )

Get the entries for a specific form

Get the entries for a specific form

No longer used internally, but used by custom code examples on Gist.

Parameters

$form
The form instance
$args
The query args

Returns

array|null
public array|null
# listEntries( Quform_Form $form, array $columns, array $args = array() )

Get the entries for a specific form for the list view

Get the entries for a specific form for the list view

Parameters

$form
The form instance
$columns
Limit the query to select only these columns
$args
The query args

Returns

array|null
public integer
# getFoundRows( )

Get the number of found rows from the last query

Get the number of found rows from the last query

Returns

integer
public integer
# getEntryCount( integer $formId, boolean|null $unread = null, string $status = 'normal' )

Get the count of entries for the given form ID

Get the count of entries for the given form ID

Parameters

$formId
$unread
Get the count of all (null), unread (true) or read (false) entries
$status
Filter the result by status

Returns

integer
public int[]
# getEntryIdsByStatus( integer $formId, string $status )

Get the IDs of all entries with the given status for the given form

Get the IDs of all entries with the given status for the given form

Parameters

$formId
The ID of the form
$status
Filter the result by status

Returns

int[]
public array
# getEntryLabels( integer $entryId )

Get the entry label data from the given label IDs

Get the entry label data from the given label IDs

Parameters

$entryId

Returns

array
public array
# getFormEntryLabels( integer $formId )

Get the entry labels for the given form

Get the entry labels for the given form

Parameters

$formId

Returns

array
public
# setFormEntryLabels( integer $formId, array $labels )

Set the entry labels for the given form

Set the entry labels for the given form

Parameters

$formId
$labels
public
# deleteFormEntryLabels( integer $formId )

Delete all entry labels for the given form ID

Delete all entry labels for the given form ID

Deprecated

2.2.0

Parameters

$formId
public
# addEntryEntryLabel( integer $entryId, integer $entryLabelId )

Add the given entry label to the given entry

Add the given entry label to the given entry

Parameters

$entryId
$entryLabelId
public
# deleteEntryEntryLabel( integer $entryId, integer $entryLabelId )

Delete the given entry label from the given entry

Delete the given entry label from the given entry

Parameters

$entryId
$entryLabelId
public integer
# getFormIdFromEntryId( integer $entryId )

Get the form ID from the entry ID

Get the form ID from the entry ID

Parameters

$entryId

Returns

integer
public array|null
# findEntry( integer $entryId )

Get the entry with the given ID

Get the entry with the given ID

Parameters

$entryId

Returns

array|null
public boolean
# hasDuplicateEntry( Quform_Element_Field $element )

Is there an existing entry with the same value as the given element

Is there an existing entry with the same value as the given element

Parameters

$element

Returns

boolean
public integer
# readEntries( array $ids )

Mark the entries with the IDs in the given array as read

Mark the entries with the IDs in the given array as read

Parameters

$ids
The array of entry IDs

Returns

integer
The number of affected rows
public integer
# unreadEntries( array $ids )

Mark the entries with the IDs in the given array as unread

Mark the entries with the IDs in the given array as unread

Parameters

$ids
The array of entry IDs

Returns

integer
The number of affected rows
public integer
# trashEntries( array $ids )

Trash the entries with the IDs in the given array

Trash the entries with the IDs in the given array

Parameters

$ids
The array of entry IDs

Returns

integer
The number of deleted rows
public integer
# untrashEntries( array $ids )

Untrash the entries with the IDs in the given array

Untrash the entries with the IDs in the given array

Parameters

$ids
The array of entry IDs

Returns

integer
The number of deleted rows
public integer
# deleteEntries( array $ids )

Delete the entries with the IDs in the given array

Delete the entries with the IDs in the given array

Parameters

$ids
The array of entry IDs

Returns

integer
The number of deleted rows
public integer
# getAllUnreadEntriesCount( )

Get the count of all unread entries

Get the count of all unread entries

Returns

integer
public mixed
# getAllFormsWithUnreadEntries( )

Returns

mixed
public array
# getRecentEntries( integer|null $count = null )

Get the most recent entries

Get the most recent entries

Parameters

$count
Limit to this number of entries

Returns

array
protected array
# addRowDataToConfig( array $row, array $config )

Parameters

$row
$config

Returns

array
public array|null
# exportEntries( Quform_Form $form, string $from = '', string $to = '' )

Get the entry export

Get the entry export

Parameters

$form
$from
$to

Returns

array|null
public array|null
# getFormsByUpdatedAt( )

Get the forms ordered by last updated

Get the forms ordered by last updated

Returns

array|null
public boolean
# entryExistsByFormIdAndCreatedBy( integer $formId, integer $createdBy )

Does an entry exist for the given form and user?

Does an entry exist for the given form and user?

Parameters

$formId
The form ID
$createdBy
The user ID

Returns

boolean
public boolean
# entryExistsByFormIdAndIpAddress( integer $formId, string $ipAddress )

Does an entry exist for the given form and IP address?

Does an entry exist for the given form and IP address?

Parameters

$formId
The form ID
$ipAddress
The IP address

Returns

boolean
public
# uninstall( )

Called when the plugin is uninstalled from the Tools page

Called when the plugin is uninstalled from the Tools page

protected array
# getTables( )

Get the list of database tables

Get the list of database tables

Returns

array
public array
# dropTablesOnSiteDeletion( array $tables )

Drop the database tables when a site is deleted

Drop the database tables when a site is deleted

Parameters

$tables

Returns

array
API documentation generated by ApiGen