KeyFactory
Creats randomly generated strings for use as public and private keys.
-
Static Method
- make public
SecretStore
Manages a stored secret and guarentees that one is always available.
-
Static Method
- getOrCreate public
- Static Method
- validate public
Token
Creates an encoded public/private key hash and validates it.
-
Method
- __construct public
-
Paramstring $privateKey
Method
- create public
-
Paramstring $publicKeyReturnstring
Method
- validate public
-
Paramstring $tokenReturnbool
Method
- hash protected
-
Paramstring $publicKeyReturnstring
TokenFactory
Creates a new token using the stored secret.
-
Static Method
- make public
FieldsBuilder
-
Method
- __construct public
- Method
- get public
- Method
- Method
- toArray protected
FieldsBuilderFactory
-
Method
- make public
- Method
- $field
FormsBuilder
-
Method
- __construct public
- Method
- get public
- Method
- Method
- toArray protected
FormsBuilderFactory
-
Method
- make public
- Method
- $form
SubmissionsBuilder
-
Static Method
- make public
- Method
- __construct public
- Method
- get public
- Method
- toArray protected
- Method
- formatValue protected
- Method
- constructOutputForFieldset protected
-
Construct string representation of fieldset repeater data for block
Paramarray $fieldsetSubmissionValuesReturnstring
Method
- normalizeArrayKeys protected
- Method
- initializeFieldsetRepeater protected
- Isolate construction of FieldsetRepeater
SubmissionsBuilderFactory
-
Method
- make public
-
Paramint $formIDParamint $perPageParamint $pageReturnSubmissionsBuilder
Method
-
Static Method
- flattenPostmeta protected
KeyFactoryTest
-
Method
- testKeyLength public
KeyFactoryTest
-
Method
- get_option
- Method
- update_option
SecretTest
-
Method
- testCreatesASecretIfDoesNotExist public
- Method
- testDefaultDefinedConstant public
- Method
- testWrongTypeSecretSelfCorrects public
HashTest
-
Method
- testTokenValidates public
- Method
- testTokenDoesNotValidate public
FieldsBuilderTest
-
Method
- testReturnsLimitedArray public
- Method
- testReturnsOnlyUserInputFields public
FormsBuilderTest
-
Method
- testReturnsKeyedArray public
FormsBuilderTest
-
Method
- is_serialized
SubmissionsBuilderTest
-
Method
- testReturnsNormalizedKeys public
- Method
- testReturnsFlattenedFileUploads public
NF_AJAX_Controllers_DeleteAllData
-
Method
- __construct public
- Method
- delete_all_data public
- Method
- prepare_in private
NF_AJAX_Controllers_DispatchPoints
-
Method
- __construct public
- Method
- undo_click public
- Method
- form_telemetry public
NF_AJAX_Controllers_Fields
-
Method
- __construct public
- Method
- maybe_delete_field public
- Check if the field has data, if so let the front-end know to show delete field modal
NF_AJAX_Controllers_Form
-
Method
- __construct public
- Method
- plugins_loaded public
- Method
- save public
- Method
- delete public
- Method
- remove_maintenance_mode public
-
This function will take all form out of maintenance mode( in case some
are still in maintenance mode after some required updates )
Since3.4.0
Method
- get_new_nonce public
-
Let's generate a unique nonce for each form render so that we don't get
caught with an expiring nonce accidentally and fail to allow a submission
Since3.2
NF_AJAX_Controllers_FormEndpoints
-
Method
- __construct public
- Method
- get_forms public
- Method
- get_new_form_templates public
- Method
- delete public
- Method
- duplicate public
NF_AJAX_Controllers_JSError
-
Method
- __construct public
- Method
- log_error public
NF_AJAX_Controllers_Preview
-
Method
- __construct public
- Method
- update public
- Method
- filter_action_settings public
- Method
- get_form_data private
- Method
- update_form_data private
NF_AJAX_Controllers_SavedFields
-
Method
- __construct public
- Method
- create public
- Method
- update public
- Method
- delete public
NF_AJAX_Controllers_Submission
-
Method
- __construct public
- Method
- submit public
- Method
- resume public
- Method
- process protected
- Method
- validate_field protected
- Method
- process_field protected
- Method
- maybe_halt protected
- Method
- sort_form_actions protected
- Method
- shutdown public
- Method
- form_data_check protected
- Method
- is_preview protected
- Method
- _respond protected
- Method
- process_repeater_fields_merge_tags protected
-
Process fields merge tags for fields inside a repeater fieldset
Paramobject $field The Repeater Fieldset
NF_AJAX_Processes_NullProcess
-
Method
- task protected
NF_AJAX_Processes_UpdateFields
-
Method
- task protected
NF_AJAX_REST_BatchProcess
-
Method
- __construct public
- Method
- post public
-
POST /forms/
/ Paramarray $request_data [ int $clone_id ]Returnarray $data [ int $new_form_id ]
Method
- get_request_data protected
NF_AJAX_REST_Controller
-
Method
- __construct public
- Setup admin-ajax to access the endpoint router. Method
- route public
- Map admin-ajax requests to the corresponding method callback. Method
- get_request_data protected
-
[OVERRIDE THIS] Get sanitized request data for use in method callbacks.
Returnarray
Method
- shutdown public
- Returns debugging data when a fatal error is triggered.
NF_AJAX_REST_Forms
-
Method
- __construct public
- Method
- post public
-
POST /forms/
/ Paramarray $request_data [ int $clone_id ]Returnarray $data [ int $new_form_id ]
Method
- get public
-
GET forms/
Returnarray [ $forms ]
Method
- delete public
-
DELETE forms/
/ Paramarray $request_data => [ form_id ]Returnarray $data => [ delete => null ]
Method
- get_request_data protected
-
Form ID, Clone ID
Returnarray $request_data
NF_AJAX_REST_NewFormTemplates
-
Method
- get public
-
GET new-form-templates/
Returnarray [ $new_form_templates ]
Method
- cmp private
-
Comparison function used to sort templates alphabetically by title
Since3.2.22Paramarray $a item being comparedParamarray $b item being comparedReturnint
NF_AJAX_REST_RequiredUpdate
-
Method
- __construct public
- Method
- post public
-
POST
Paramarray $request_data [ int $clone_id ]Returnarray $data [ int $new_form_id ]
Method
- get public
-
GET
Param$request_data (Array)Return$data (Array)Since3.4.0
Method
- get_request_data protected
- Method
- get_current_updates private
-
Function to get the list of updates that need to run.
Param$processed (Array) The list of updates that have already run on this install.ReturnArray
Method
- sort_updates private
-
Function to sort the updates to be run.
Param$current (Array) The list of updates to be run.Param$previous (Array) The list of updates that have already been run.ReturnArray
NF_AJAX_Requests_DeleteField
-
Method
- handle protected
NF_AJAX_Requests_NullRequest
-
Method
- handle protected
NF_Abstracts_Action
-
Method
- __construct public
- Constructor Method
- save public
- Save Method
- process abstract
- Method
- get_timing public
-
Get Timing
Returns the timing for an action.
Returnmixed
Method
- get_priority public
-
Get Priority
Returns the priority for an action.
Returnint
Method
- get_name public
-
Get Name
Returns the name of an action.
Returnstring
Method
- get_nicename public
-
Get Nicename
Returns the nicename of an action.
Returnstring
Method
- get_section public
-
Get Section
Returns the drawer section for an action.
Returnstring
Method
- get_image public
-
Get Image
Returns the url of a branded action's image.
Returnstring
Method
- get_settings public
-
Get Settings
Returns the settings for an action.
Returnarray|mixed
Static Method
- sort_actions public
- Method
- load_settings protected
NF_Abstracts_ActionNewsletter
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
- Method
- _get_lists public
- Method
- get_lists protected
- Method
- get_list_settings private
- Method
- cache_lists private
NF_Abstracts_BatchProcess
-
Method
- __construct public
- Constructor Method
- init public
-
Decides whether we need to run startup or restart and then calls processing.
Since3.4.0Returnvoid
Method
- process public
-
Function to loop over the batch.
Since3.4.0Returnvoid
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0Returnvoid
Method
- restart public
-
Function to run any setup steps necessary to begin processing for steps after the first.
Since3.4.0Returnvoid
Method
- get_steps public
-
Returns how many steps we have in this process.
If this method isn't overwritten by a child, it defaults to 1.
Since3.4.0Returnint
Method
- add_error public
-
Adds an error to the response object.
Param$slug (String) The slug for this error code.Param$msg (String) The error message to be displayed.Param$type (String) warning or fatal, depending on the error. Defaults to warning.
Since3.4.11
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a batch process after completion.
Since3.4.0Returnvoid
Method
- batch_complete public
-
Method called when we are finished with this process.
Deletes our "doing" option. Set's our response 'batch_complete' to true. Runs cleanup(). Responds to the JS front-end.
Since3.4.0Returnvoid
Method
- next_step public
-
Method that immediately moves on to the next step.
Used in child methods to stop processing the current step an dmove to the next.
Since3.4.0Returnvoid
Method
- respond public
-
Method that encodes $this->response and sends the data to the front-end.
Since3.4.0 @updated 3.4.11Returnvoid
Method
- flag public
-
Method to check or modify our processor flag.
Since3.5.0Param$flag (String) The flag to checkParam$action (String) The type of interaction to be performedReturnMixed
NF_Abstracts_Controller
-
Method
- __construct public
- NF_Abstracts_Controller constructor. Method
- _respond protected
-
Respond
A wrapper for the WordPress AJAX response pattern.
NF_Abstracts_Element
NF_Abstracts_Extension
-
Static Method
- instance public
- Method
- autoloader public
- Method
- NF_Abstracts_Extension /** * The main function responsible for returning The Highlander Plugin * Instance to functions everywhere. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: <?php $nf = NF_Abstracts_Extension(); ?> * * @since 3.0 * @return Plugin Highlander Instance */
NF_Abstracts_Field
-
Method
- __construct public
- Constructor Method
- validate public
-
Validate
Param$fieldParam$dataReturnarray $errors
Method
- process public
- Method
- admin_form_element public
-
Admin Form Element
Returns the output for editing fields in a submission.
Param$idParam$valueReturnstring
Method
- get_name public
- Method
- get_nicename public
- Method
- get_section public
- Method
- get_icon public
- Method
- get_aliases public
- Method
- get_type public
- Method
- get_parent_type public
- Method
- get_settings public
- Method
- use_merge_tags public
- Method
- get_test_value public
- Method
- get_templates public
- Method
- get_wrap_template public
- Method
- get_old_classname public
- Method
- show_in_builder public
- Method
- load_settings protected
- Static Method
- get_base_template public
- Static Method
- sort_by_order public
- Method
- localize_settings public
NF_Abstracts_FieldOptIn
-
Method
- __construct public
- Method
- addList protected
- Method
- addLists protected
- Method
- get_parent_type public
NF_Abstracts_Input
-
Method
- __construct public
- Method
- get_parent_type public
NF_Abstracts_List
-
Method
- __construct public
- Method
- get_parent_type public
- Method
- admin_form_element public
- Method
- custom_columns public
- Method
- query_string_default public
NF_Abstracts_LogLevel
Describes log levels
NF_Abstracts_Logger
-
Method
- emergency public
-
System is unusable.
Paramstring $messageParamarray $context
Returnnull
Method
- alert public
-
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Paramstring $messageParamarray $context
Returnnull
Method
- critical public
-
Critical conditions.
Example: Application component unavailable, unexpected exception.
Paramstring $messageParamarray $context
Returnnull
Method
- error public
-
Runtime errors that do not require immediate action but should typically
be logged and monitored.
Paramstring $messageParamarray $context
Returnnull
Method
- warning public
-
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Paramstring $messageParamarray $context
Returnnull
Method
- notice public
-
Normal but significant events.
Paramstring $messageParamarray $context
Returnnull
Method
- info public
-
Interesting events.
Example: User logs in, SQL logs.
Paramstring $messageParamarray $context
Returnnull
Method
- debug public
-
Detailed debug information.
Paramstring $messageParamarray $context
Returnnull
NF_Abstracts_Logger
-
Method
- emergency public
-
System is unusable.
Paramstring $messageParamarray $contextReturnnull
Method
- alert public
-
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Paramstring $messageParamarray $contextReturnnull
Method
- critical public
-
Critical conditions.
Example: Application component unavailable, unexpected exception.
Paramstring $messageParamarray $contextReturnnull
Method
- error public
-
Runtime errors that do not require immediate action but should typically
be logged and monitored.
Paramstring $messageParamarray $contextReturnnull
Method
- warning public
-
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Paramstring $messageParamarray $contextReturnnull
Method
- notice public
-
Normal but significant events.
Paramstring $messageParamarray $contextReturnnull
Method
- info public
-
Interesting events.
Example: User logs in, SQL logs.
Paramstring $messageParamarray $contextReturnnull
Method
- debug public
-
Detailed debug information.
Paramstring $messageParamarray $contextReturnnull
Method
- log public
-
Logs with an arbitrary level.
Parammixed $levelParamstring $messageParamarray $contextReturnnull
NF_Abstracts_Menu
-
Method
- __construct public
-
Constructor
Translate text and add the 'admin_menu' action.
Method
- register public
- Register the menu page. Method
- get_page_title public
- Method
- get_menu_title public
- Method
- get_menu_slug public
- Method
- get_capability public
- Method
- display abstract
NF_Abstracts_MergeTags
-
Method
- __construct public
- Method
- action_replace public
- Method
- replace public
- Method
- get_id public
- Method
- get_title public
- Method
- get_merge_tags public
- Method
- is_default_group public
NF_Abstracts_Metabox
-
Method
- __construct public
- Method
- add_meta_boxes public
- Method
- render_metabox public
- Method
- _save_post public
- Method
- save_post protected
NF_Abstracts_Migration
-
Method
- __construct public
-
Constructor method for the NF_Abstracts_Migration class.
Param$table_name (String) The database table name managed by the extension.Param$flag (String) The wp option set to determine if this migration has already been run.Since3.0.0
Method
- table_name public
-
Function to retrieve the full table name of the extension.
Return(String) The full table name, including database prefix.Since3.0.28
Method
- column_exists public
-
Function to check for the existence of a column in the extension's table.
Param$column (String) The name of the column to search for.Return(Boolean) Whether or not the column exists.Since3.4.0
Method
- charset_collate public
-
Funciton to get the charset and collate for migrations.
Param$use_default (Boolean) Whether or not to include the DEFAULT keyword in the return pattern.Return(String) A SQL formatted charset and collate for use by table definition.Since3.0.28 @updated 3.1.14
Method
- _do_upgrade public
-
Function to run our required update functions.
Param$callback (String) The function to be run by this call.Since3.4.0
Method
- _run public
-
Function to run our initial migration.
Since3.0.0
Method
- run abstract
- Method
- _drop public
-
Function to drop the table managed by this migration.
Since3.0.28
Method
- drop protected
-
Protection of inherited function drop.
Since3.0.28
NF_Abstracts_Model
Class NF_Abstracts_Model
-
Method
- __construct public
-
NF_Abstracts_Model constructor.
Param$dbParam$idParam$parent_id
Method
- get_id public
-
Get the Permanent ID
Returnint
Method
- get_tmp_id public
-
Get the Temporary ID
Returnnull|string
Method
- get_type public
-
Get the Type
Returnstring
Method
- get_setting public
-
Get a single setting with a default fallback
Paramstring $settingParambool $default optionalReturnstring|int|bool
Method
- get_settings public
-
Get Settings
Paramstring ...$only returns a subset of the object's settingsReturnarray
Method
- update_setting public
-
Update Setting
Param$keyParam$valueReturnbool|false|int
Method
- update_settings public
-
Update Settings
Param$dataReturnbool
Method
- delete public
-
Delete
Delete the object, its children, and its relationships.
Returnbool
Method
- find public
-
Find
Paramstring $parent_idParamarray $whereReturnarray
Method
- get_object_settings public
- Method
- save public
- Save Method
- _insert_row public
- Method
- cache public
-
Cache Flag
Paramstring $cacheReturn$this
Method
- add_parent public
-
Add Parent
Set the Parent ID and Parent Type properties
Param$parent_idParam$parent_typeReturn$this
Method
- _save_setting protected
-
Save Setting
Save a single setting.
Param$keyParam$valueReturnbool|false|int
Method
- _save_settings protected
-
Save Settings
Save all settings.
Returnbool
Method
- _save_parent_relationship protected
-
Save Parent Relationship
Return$this
Method
- build_meta_query protected
-
Build Meta Query
Paramstring $parent_idParamarray $whereReturnstring
NF_Abstracts_ModelFactory
Class NF_Abstracts_ModelFactory
-
Method
- __construct public
-
NF_Abstracts_ModelFactory constructor.
Param$dbParam$id
Method
- __call public
-
PHP MAGIC method for catching undefined methods.
Use this as a passthrough for methods of the form model.
Param$method (String) The name of the called method.Param$args (Array) The arguments supplied to the method.Return(Mixed) Will match the return type of the supplied method.SinceUPDATE_VERSION_ON_MERGE
Method
- get public
-
Returns the parent object set by the constructor for chained methods.
Returnobject
Method
- get_forms public
-
Get Forms
Returns an array of Form Model Objects.
Paramarray $whereReturnarray|bool
Method
- export_form public
-
Export Form
A wrapper for the Form Model export method.
Parambool|FALSE $returnReturnarray
Method
- import_form public
-
Import Form
A wrapper for the Form Model import method.
Param$importParam$decode_utf8Param$idParam$is_conversion
Method
- field public
-
Sets the parent object for chained methods as a Field.
Paramstring $idReturn$this
Method
- get_field public
-
Returns a field object.
Param$idReturnNF_Database_Models_Field
Method
- get_fields public
-
Returns an array of field objects for the set form (object).
Paramarray $whereParambool|FALSE $freshReturnarray
Method
- import_field public
-
Import Field
A wrapper for the Form Model import method.
Param$import
Method
- action public
-
Sets the parent object for chained methods as an Action.
Paramstring $idReturn$this
Method
- get_action public
-
Returns an action object.
Param$idReturnNF_Database_Models_Action
Method
- get_actions public
-
Returns an array of action objects for the set form (object).
Paramarray $whereParambool|FALSE $freshReturnarray
Method
- object public
-
Sets the parent object for chained methods as an Object.
Paramstring $idReturn$this
Method
- get_object public
-
Returns an object.
Param$idReturnNF_Database_Models_Object
Method
- get_objects public
-
Returns an array of objects for the set object.
Paramarray $whereParambool|FALSE $freshReturnarray
Method
- sub public
-
Submission
Returns a single submission by ID, or an empty submission.
Paramstring $idReturn$this
Method
- get_sub public
-
Get Submission
Returns a single submission by ID.
Param$idReturnNF_Database_Models_Submission
Method
- get_subs public
-
Get Submissions
Returns an array of Submission Model Objects.
Paramarray $whereParambool|FALSE $freshReturnarray
Method
- export_subs public
-
Export Submissions
A wrapper for the Submission Model export method.
Paramarray $sub_idsParambool|FALSE $returnReturnstring
Method
- get_model public
-
Get Model
A generic method call for any object model type.
Param$idParam$typeReturnbool|NF_Database_Models_Action|NF_Database_Models_Field|NF_Database_Models_Form|NF_Database_Models_Object
NF_Abstracts_PaymentGateway
-
Method
- __construct public
- Method
- get_slug public
- Method
- get_name public
- Method
- get_settings public
- Method
- _process public
- Method
- process protected
NF_Abstracts_RequiredUpdate
-
Method
- __construct public
-
Constructor
Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of required updates after completion.
Since3.4.0
Method
- respond public
-
Function to dump our JSON response and kill processing.
Since3.4.0
Method
- migrate protected
-
Function to run our table migrations.
Param$callback (String) The callback function in the migration file.Since3.4.0
Method
- prepare public
-
Function to prepare our query values for insert.
Param$value (Mixed) The value to be escaped for SQL.Return(String) The escaped (and possibly serialized) value of the string.Since3.4.0
Method
- query protected
-
Function used to call queries that are gated by debug.
Param$sql (String) The query to be run.Return(Object) The response to the wpdb query call.Since3.4.0
Method
- confirm_complete protected
-
Function to record the completion of our update in the DB.
Since3.4.0
Method
- enable_maintenance_mode public
-
Enable Maintenance mode
Enables maintenance mode so the form will not render on the front end while updates are running.
Since3.4.0
Param$prefix - the db prefix.Param$form_id - The id of the form.
Method
- disable_maintenance_mode public
-
Disable Maintenance Mode
Disables maintenance mode, so the form will be displayed on the front end..
Since3.4.0
Param$prefix - the db prefix.Param$form_id - The id of the form.
NF_Abstracts_Routes
-
Method
- __construct public
-
Register the API routes
Since3.4.33
Method
- register_routes abstract
NF_Abstracts_Submenu
-
Method
- __construct public
-
Constructor
Translate text and add the 'admin_menu' action.
Method
- register public
- Register the menu page. Method
- get_page_title public
- Method
- get_menu_title public
- Method
- get_menu_slug public
- Method
- get_capability public
- Method
- display abstract
SubmissionHandler
-
Method
- __construct public
-
Registers command to export single submission as PDF
Returnvoid
Method
- constructLabel protected
- Method
- addSubmissionHandler public
- Method
- doesAddHandler protected
- Method
- handle public
-
Perform extra handler action on a single submission
ParamSingleSubmission $singleSubmissionReturnarray
Method
- handleSubmission protected
- Method
- getDownload public
-
Returns payload for download
Returnstring
Method
- getSlug public
-
Return an identifying slug for the handler
Returnstring
Method
- getLabel public
-
Return a label for the handler
Returnstring
Method
- getHandlerClassName public
NF_Abstracts_SubmissionMetabox
-
Method
- __construct public
NF_Abstracts_UserInfo
-
Method
- __construct public
- Method
- filter_default_value public
NF_Actions_Akismet
-
Method
- __construct public
- Constructor Method
- maybe_remove_action public
-
Remove the action registration if Akismet functions not available.
Paramarray $action_type_settings
Returnarray
Method
- akismet_available protected
-
Is Akismet installed and connected with a valid key?
Returnbool
Method
- process public
-
Process the action
Paramarray $action_settingsParamint $form_idParamarray $data
Returnarray
Method
- is_submission_spam protected
-
Verify submission
Param$nameParam$emailParam$urlParam$message
Returnbool
NF_Actions_CollectPayment
-
Method
- __construct public
-
Constructor
Paramstring $cp_nice_nameParamstring $cp_name
Method
- save public
- Method
- process public
- Method
- register_payment_gateways public
- Method
- maybe_remove_action public
NF_Actions_Custom
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
NF_Actions_DeleteDataRequest
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
-
Creates a Erase Personal Data request for the user with the email
provided
Param$action_settingsParam$form_idParam$data
Returnarray
NF_Actions_Email
-
Method
- __construct public
- Constructor Method
- process public
- Method
- sanitize_address_fields protected
-
Sanitizes email address settings
Since3.2.2
Paramarray $action_settingsReturnarray
Method
- check_for_errors protected
- Method
- _get_headers private
- Method
- _get_attachments private
- Method
- _format_from private
- Method
- _format_recipients private
- Method
- _format_recipient private
- Method
- _create_csv private
- Method
- _drop_csv private
- Function to delete csv file from temp directory after Email Action has completed. Method
- _backwards_compatibility private
- Method
- ninja_forms_sub_csv_delimiter public
- Method
- ninja_sub_csv_enclosure public
- Method
- ninja_sub_csv_terminator public
- Method
- ninja_forms_action_email_attachments public
- Method
- format_plain_text_message private
NF_Actions_ExportDataRequest
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
-
Creates a Export Personal Data request for the user with the email
provided
Param$action_settingsParam$form_idParam$data
Returnarray
NF_Actions_Recaptcha
-
Method
- __construct public
- Constructor Method
- set_form_id public
-
Setter method for the form_id and callback for the nf_get_form_id action.
Since3.2.2
Paramstring $form_id The ID of the current form.Returnvoid
Method
- get_form_id public
- Method
- maybe_remove_action public
-
Remove the action registration if Akismet functions not available.
Paramarray $action_type_settings
Returnarray
Method
- is_action_enabled_for_form protected
-
Returnbool
Method
- is_recaptcha_configured protected
-
Is the reCAPTCHA configured correctly
Returnbool
Method
- is_action_configured protected
-
Is the reCAPTCHA action enabled
Returnbool
Method
- maybe_output_field_template public
- Method
- get_field_id_hash protected
- Method
- maybe_remove_v2_field public
-
Remove v2 reCAPTCHA fields if still configured, when using the v3 Action
Paramarray $fields
Returnarray
Method
- maybe_remove_v2_field_from_builder public
-
Don't show the v2 reCAPTCHA field in the builder when using the v3 Action
Parambool $showParamNF_Abstracts_Field $field
Returnbool
Method
- maybe_inject_field public
-
Paramarray $fieldsParamint $form_id
Returnarray
Method
- enqueue_script public
- Method
- maybe_enqueue_recaptcha_js protected
-
Check to not load the Google reCAPTCHA JS if other plugins are doing it
Returnbool
Method
- get_form_data protected
- Method
- get_recaptcha_response protected
- Method
- process public
-
Process the action
Paramarray $action_settingsParamint $form_idParamarray $data
Returnarray
Method
- is_submission_human protected
NF_Actions_Redirect
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
NF_Actions_Save
-
Method
- __construct public
- Constructor Method
- save public
- Method
- submission_expiration_processing public
-
Submission Expiration Processing
Decides if the submission expiration data should be added to the
submission expiration option or not.
Param$action_settings - array.Param$form_id - ( int ) The ID of the Form.
Returnvoid
Method
- compare_expiration_option public
-
Compare Expiration Option
Accepts $expiration_data and checks to see if the values already exist in the array.
Since3.3.2
Paramarray $expiration_value - key/value pair $expiration_value[ 'form_id' ] = form_id(int) $expiration_value[ 'expire_time' ] = subs_expire_time(int)Paramarray $expiration_option - list of key/value pairs of the expiration options.
Returnvoid
Method
- remove_expiration_option public
-
Remove Expiration Option
If the expiration action setting is turned off this helper method
removes the form id and expiration time from the option.
Paramarray $expiration_value - key/value pair $expiration_value[ 'form_id' ] = form_id(int) $expiration_value[ 'expire_time' ] = subs_expire_time(int)Paramarray $expiration_option - list of key/value pairs of the expiration options.
Returnvoid
Method
- process public
NF_Actions_SuccessMessage
-
Method
- __construct public
- Constructor Method
- save public
- Method
- process public
- Method
- import_form_action_success_message public
NF_Adapters_SubmissionsFields
-
Method
- __construct public
- Method
- get_value public
- Method
- offsetSet public
- Method
- offsetExists public
- Method
- offsetUnset public
- Method
- offsetGet public
- Method
- key public
- Method
- current public
- Method
- next public
- Method
- rewind public
- Method
- valid public
NF_Adapters_SubmissionsSubmission
-
Method
- __construct public
- Method
- offsetExists public
- Method
- offsetGet public
- Method
- offsetMaybeCreate protected
- Method
- current public
NF_Admin_AddFormModal
Add a button to tinyMCE editors when eidting posts/pages.
-
Method
- __construct
- Method
- insert_form_tinymce_buttons public
-
Output our tinyMCE field buttons
AccesspublicSince2.8Returnvoid
Method
- output_tinymce_button_js public
-
Output our tinyMCE field buttons
AccesspublicSince2.8Returnvoid
NF_Admin_AllFormsTable
-
Method
- __construct public
- Class constructor Method
- no_items public
- Method
- prepare_items public
-
Prepare the items for the table to process
ReturnVoid
Method
- get_columns public
-
Override the parent columns method. Defines the columns to use in your listing table
ReturnArray
Method
- get_hidden_columns public
-
Define which columns are hidden
ReturnArray
Method
- get_sortable_columns public
-
Define the sortable columns
ReturnArray
Method
- table_data private
-
Get the table data
ReturnArray
Method
- column_default public
-
Define what data to show on each column of the table
ParamArray $item DataParamString $column_name - Current column name
ReturnMixed
Method
- sort_data private
-
Allows you to sort the data by the variables set in the $_GET
ReturnMixed
Method
- column_cb
- Method
- column_title
- Method
- single_row public
- Method
- get_bulk_actions public
-
Returns an associative array containing the bulk action
Returnarray
Static Method
- process_bulk_action public
- Static Method
- delete_item public
NF_Admin_CPT_DownloadAllSubmissions
-
Method
- __construct
- Method
- loading public
- Method
- step public
- Method
- complete public
- Method
- random_filename public
-
Add an integar to the end of our filename to make sure it is unique
AccesspublicSince2.7.6Return$filename
Method
- bulk_admin_footer public
- Method
- get_sub_count
NF_Admin_CPT_Submission
Class NF_Admin_CPT_Submission
-
Method
- __construct public
- Constructor Method
- custom_post_type /** * Custom Post Type */
- Method
- nf_trash_sub public
- Method
- enqueue_scripts public
- Method
- post_row_actions public
- Method
- change_columns public
- Method
- custom_columns public
- Method
- save_nf_sub public
- Method
- add_meta_boxes public
- Meta Boxes Method
- fields_meta_box public
-
Fields Meta Box
Param$post
Static Method
- sort_fields public
- Method
- info_meta_box public
-
Info Meta Box
Param$post
Method
- remove_meta_boxes public
- Remove Meta Boxes Method
- cap_filter public
- Method
- filter_hidden_columns public
-
Filter our hidden columns so that they are handled on a per-form basis.
AccesspublicSince2.7Returnvoid
Method
- convert_hidden_columns private
-
Convert Hidden Columns
Looks for 2.9.x hidden columns formatting and converts it to the formatting 3.0 expects.
Param$form_idParam$hidden_columnsReturnmixed
Method
- hide_columns public
-
Save our hidden columns per form id.
AccesspublicSince2.7Returnvoid
Method
- $field
- Method
- not_found_message private
NF_Admin_FooterMessage
Update the admin footer text for
Ninja Forms pages
-
Method
- __construct public
-
Method
- nf_admin_footer_text public
-
Changes the admin footer text
Adds Ninja Forms review request.
ReturnString
NF_Admin_Menus_AddNew
-
Method
- __construct public
- Method
- nf_upgrade_redirect public
- If we have required updates, unregister the menu item Method
- get_page_title public
- Method
- get_capability public
- Method
- display public
NF_Admin_Menus_Addons
-
Method
- __construct public
- Method
- nf_upgrade_redirect public
- If we have required updates, unregister the menu item Method
- get_page_title public
- Method
- get_capability public
- Method
- display public
- Static Method
- filterItemsByCategroy public
- Method
- Method
NF_Admin_Menus_Dashboard
-
Method
- __construct public
- Method
- get_page_title public
- Method
- get_capability public
- Method
- display public
- Method
- enqueue_dashboard_script public
- Enqueue dashboard page elements
NF_Admin_Menus_Divider
-
Method
- __construct public
- Method
- display public
NF_Admin_Menus_Forms
-
Method
- __construct public
- Method
- nf_upgrade_redirect public
- If we have required updates, redirect to the main Ninja Forms page Method
- body_class public
- Method
- get_page_title public
- Method
- admin_init public
- Method
- display public
- Method
- submenu_separators public
- Method
- import_from_template private
-
TODO: Remove this function and its hook because we are handling template imports via the batch processor.
Since3.0Returnvoid
Method
- _enqueue_the_things private
- Method
- _localize_form_data private
- Method
- null_data_check private
-
Null Data Check
Accepts array of settings and removes null data the array.
Param$settings - a key/value pair of settings.Returnarray
Method
- _localize_field_type_data private
- Method
- _localize_action_type_data private
- Method
- _localize_form_settings protected
- Method
- _localize_merge_tags protected
- Method
- _group_settings protected
- Method
- _unique_settings protected
- Method
- _setting_defaults protected
- Method
- _fetch_action_feed protected
- Method
- _fetch_settings_feed protected
- Method
- _fetch_field_feed protected
- Method
- setting_group_priority protected
- Method
- get_capability public
NF_Admin_Menus_ImportExport
-
Method
- __construct public
- Method
- nf_upgrade_redirect public
- Method
- get_page_title public
- Method
- import_form_listener public
- Method
- export_form_listener public
- Method
- import_fields_listener public
- Method
- sanitizeUnserialize protected
-
Ensure unserialized value is sanitized against malicious objects
Paramstring $serializedValueReturnarray Expected return is indexed array
Method
- export_fields_listener public
- Method
- display public
- Method
- add_meta_boxes public
- Method
- template_import_forms public
- Method
- template_export_forms public
- Method
- template_import_favorite_fields public
- Method
- template_export_favorite_fields public
- Method
- import_fields_backwards_compatibility public
- Method
- upload_error_check private
- Method
- get_capability public
NF_Admin_Menus_Licenses
-
Method
- __construct public
- Method
- submit_listener public
- Method
- register_licenses public
- Method
- add_meta_boxes public
- Method
- display public
- Method
- get_license private
- Method
- activate_license private
- Method
- deactivate_license private
NF_Admin_Menus_MockData
-
Method
- __construct public
- Method
- mock_and_redirect public
- Method
- display public
- Method
- mock_data private
NF_Admin_Menus_Settings
-
Method
- __construct public
- Method
- maybe_hide_rollback public
-
Function to detect installations without 2.9x tables and prevent them from accessing 2.9x.
Since3.5ParamArray $settings The Ninja Forms settings array.ReturnArray
Method
- body_class public
- Method
- ninja_forms_cf7_notice public
-
Function to notify users of CF7 conflict
Since 3.0
Param(array) $noticesReturn(array) $notices
Method
- get_page_title public
- Method
- get_capability public
- Method
- display public
- Method
- update_settings public
- Method
- get_settings private
- Method
- prefix private
NF_Admin_Menus_Submissions
-
Method
- __construct public
- Constructor Method
- remove_legacy_submissions_page public
-
Remove the old Submissions page link when legacy mode is not enabled
Param$screen object of current screen details
Method
- manage_bulk_actions public
- Add an option in the bulk action select field Method
- nf_upgrade_redirect public
- If we have required updates, redirect to the main Ninja Forms page Method
- change_views public
-
Change Views
WordPress hook that modifies the links on our submissions CPT to allow
users to switch between completed and trashed submissions.
Since3.2.17
Param$views The views that are associated with this CPT. $views[ 'view' ]Returnarray Returns modified views to allow our users access to the trash.
Method
- change_columns public
-
Change Columns
Returnarray
Method
- custom_columns public
-
Custom Columns
Param$columnParam$sub_id
Method
- remove_filter_show_all_dates public
-
Remove Filter: Show All Dates
Param$monthsReturnarray
Method
- add_filters public
-
Add Filters
Returnbool
Method
- table_filter public
- Method
- search public
- @updated 3.3.21.2 Method
- remove_bulk_edit public
- Method
- bulk_admin_footer public
- Method
- export_listen public
- Method
- hide_page_title_action public
- Method
- custom_columns_seq_num private
-
Custom Columns: ID
Param$subReturnmixed
Method
- custom_columns_sub_date private
-
Custom Columns: Submission Date
Param$subReturnmixed
Method
- custom_columns_field private
-
Custom Columns: Field
Param$subParam$columnReturnbool
Method
- table_filter_by_form private
- Method
- table_filter_by_date private
- Method
- enqueue_legacy_scripts public
- Method
- get_page_title public
- Method
- display public
- Display Method
- body_class public
- Method
- enqueue_scripts public
- enqueue scripts here Method
- get_capability public
NF_Admin_Menus_SystemStatus
-
Method
- __construct public
- Method
- get_page_title public
- Method
- get_capability public
- Method
- display public
NF_Admin_Metaboxes_AppendAForm
-
Method
- __construct public
- Method
- append_form public
- Method
- save_post public
- Method
- render_metabox public
NF_Admin_Metaboxes_Calculations
-
Method
- __construct public
- Method
- render_metabox public
- Method
- registerReactMetabox protected
-
Register the React metabox for calculations
Returnvoid
Method
- nfAddMetabox public
-
Add a metabox constructor to the react.js submissions page
Paramarray $metaboxHandlersReturnarray
CalculationsReact
Construct Calculations metabox for the React Submissions page
Class must have a public function handle that can receive the $extraValue
and a NF submission.
Output of handle method is a \NinjaForms\Includes\Entities\MetaboxOutputEntity with two properties:
'title' (string output of metabox title/header)
'labelValueCollection' – indexed array of label values
Each label value array has three keys:
'label' – label of the output
'value' – value of that being output
'styling' – currently accepts 'alert' to add an 'alert' class for CSS styling
-
Method
- handle public
-
Given submission '$extra' data and the complete submission, return array
construct for metabox If nothing to output, then return null
If the '$extra' data contains all required information, then simply construct that as label/value/styling arrays.
If your output requires other information from the submission, use the $nfSub to extract the required information.
Note that in this example, we want additional information from the submission for output so we disregard the $extraValue and work directly with the $nfSub to extract the information.Parammixed $extraValueParamNF_Database_Models_Submission $nfSubReturn\NinjaForms\Includes\Entities\MetaboxOutputEntity|null
Static Method
- extractResponses protected
- Method
- isDebugSet protected
-
Determine/return if calc debug is set
Checks for string `&calcs_debug` in URI
Returnboolean
NF_Admin_Metaboxes_Example
-
Method
- __construct public
- Method
- render_metabox public
NF_Admin_Notices
NF_Notices Class
Can be simply used be adding another line into the nf_admin_notices() function under notices.php
Can be extended to create more advanced notices to include triggered events
-
Static Method
- instance public
- Method
- __construct public
- Method
- nf_admin_notice public
- Method
- admin_notice public
- Method
- anti_notice_spam public
- Method
- admin_notice_ignore public
- Method
- admin_notice_temp_ignore public
- Method
- admin_notice_pages_blacklist public
- Method
- admin_notice_pages public
- Method
- required_fields public
- Method
- special_parameters public
NF_Admin_Processes_ChunkPublish
Class NF_Abstracts_Batch_Process
-
Method
- __construct public
- Constructor Method
- process public
-
Function to loop over the batch.
ReturnJSON Str last_response = success/failure Bool batch_complete = true/false Int requesting = x
Method
- startup public
- Function to run any setup steps necessary to begin processing. Method
- cleanup public
- Function to cleanup any lingering temporary elements of a batch process after completion. Method
- get_chunk public
-
Function to get our chunk data from the chunks table.
Param$slug (string) The name of the option in the db.Returnstring or FALSE
Method
- add_chunk public
-
Function to replace update_option.
Param$slug (string) The name of the option in the db.Param$content (string) The data to be stored in the option.
Method
- remove_option public
DeleteBatchFile
Deletes a file given file path
-
Method
- delete public
-
Delete a file, given a filepath
Paramstring $filePathReturnstring Result of the attempt to delete file
NF_Admin_Processes_ExpiredSubmissionCleanup
Class NF_Abstracts_Batch_Process
-
Method
- startup public
- Function to run any setup steps necessary to begin processing. Method
- restart public
-
Function to run any setup steps necessary to begin processing for steps after the first.
Since3.4.0Returnvoid
Method
- process public
-
Function to loop over the batch.
Since3.4.0Returnvoid
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a batch process after completion.
Since3.4.0Returnvoid
Method
- get_steps public
-
Get Steps
Determines the amount of steps needed for the step processors.
Since3.4.0Returnint of the number of steps.
Method
- get_expired_subs public
-
Get Expired Subs
Gathers our expired subs puts them into an array and returns it.
Param$form_id - ( int ) ID of the Form.Param$expiration_time - ( int ) number of days the submissions are set to expire in
Returnarray of all the expired subs that were found.
NF_Admin_Processes_ExportSubmissions
Class NF_Abstracts_Batch_Process
-
Method
- __construct public
-
Override parent construct to pass form Ids
Paramarray $forms
Method
- startup public
- Function to run any setup steps necessary to begin processing. Method
- restart public
-
Function to run any setup steps necessary to begin processing for steps after the first.
Since3.5.0Returnvoid
Method
- process public
-
Function to loop over the batch.
Since3.5.0Returnvoid
Method
- batch_complete public
- Delete temp file before calling parent method @inheritDoc Method
- writeBatch public
- Method
- respond public
-
Method that encodes $this->response and sends the data to the front-end.
Since3.4.0 @updated 3.4.11Returnvoid
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a batch process after completion.
Since3.5.0Returnvoid
Method
- get_steps public
-
Get Steps
Determines the amount of steps needed for the step processors.
Since3.5.0Returnint of the number of steps.
Method
- constructFilepath protected
-
Get the filepath of our constructed csv.
Returnstring
Method
- flag public
-
Overwrites the default flag method to use user options
instead of using the default options.
Since3.5.0Param$flag (String) The flag to checkParam$action (String) The type of interaction to be performedReturnMixed
Method
- getFileUrl public
- Get file URL of downloaded file in default directory Method
- getFilePath public
- Get filepath of downloaded file in default directory
NF_Admin_Processes_ImportForm
Class NF_Abstracts_Batch_Process
-
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0Returnvoid
Method
- sanitize_field_settings public
-
Check field settings data before it is being cached
Since3.6.10Returnarray of $data
Method
- restart public
-
On processing steps after the first, we need to grab our data from our saved option.
Since3.4.0Returnvoid
Method
- process public
-
Function to loop over the batch.
Since3.4.0Returnvoid
Method
- cleanup public
- Function to cleanup any lingering temporary elements of a batch process after completion. Method
- get_steps public
- Method
- insert_form public
-
Insert our form using $this->_db->insert by building an array of column => value pairs and %s, %d types.
Since3.4.0Returnvoid
Method
- insert_form_meta public
-
Insert Form Meta.
Loop over our remaining form settings that we need to insert into meta. Add them to our "Values" string for insertion later.
Since3.4.0Returnvoid
Method
- insert_actions public
-
Insert Actions and Action Meta.
Loop over actions for this form and insert actions and action meta.
Since3.4.0Returnvoid
Method
- insert_fields public
-
If we have a Form ID set, then we've already inserted our Form, Form Meta, Actions, and Action Meta.
All we have left to insert are fields.
Loop over our fields array and insert up to $this->fields_per_step. After we've inserted the field, unset it from our form array. Update our processing option with $this->form. Respond with the remaining steps.
Since3.4.0Returnvoid
Method
- modifyFieldsetIds protected
- Method
- import_form_backwards_compatibility public
- Method
- import_merge_tags_backwards_compatibility public
- Method
- import_action_backwards_compatibility public
- Method
- import_field_backwards_compatibility public
- Method
- base64_decode private
-
Method to obfuscate the global base64_decode method.
Since3.6.10.1ParamString $data A base64 encoded string.ReturnString
NF_Admin_Processes_ImportFormTemplate
Class NF_Abstracts_Batch_Process
-
Method
- startup public
- Function to run any setup steps necessary to begin processing.
NF_Admin_SlimPromo
NF_Slim_Promo Class
-
Method
- __construct public
-
Method
- isNFAdminPage public
- Method
- maybeShowSlimPromo public
-
Check if we should show the slim promo
Returnbool
Method
- setTransient public
-
Set the ninja_forms_disable_slim_promo transient
ReturnVoid
Method
- getNoticeHtml public
-
Echo the html for the notice
ReturnVoid
NF_Admin_UserDataRequests
-
Method
- __construct public
- Class constructor Method
- plugin_register_exporters /** * Register exporter for Plugin user data. * * @param array $exporters * * @return array */
- Method
- plugin_register_erasers /** * Register eraser for Plugin user data. * * @param array $erasers * * @return array */
- Method
- plugin_user_data_exporter /** * Adds Ninja Forms Submission data to the default HTML export file that * WordPress creates on converted request * * @param $email_address * @param int $page * * @return array */
- Method
- plugin_user_data_eraser /** * Eraser for Plugin user data. This will completely erase all Ninja Form * submission data for the user when converted by the admin. * * @param $email_address * @param int $page * * @return array */
- Method
- get_related_subs private
-
Retrieve all submissions related(by author id or email address) to the
given email address
Param$email_address
Returnarray
Method
- get_subs_by_email private
-
Get submission ids where the submission has the give email address as
data
Param$email_address
Returnarray
Method
- delete_submissions private
-
Delete Submissions
Param$subs
Method
- anonymize_submissions private
-
This will (redact) personal data and anonymize submissions
Param$subs
Method
- anonymize_fields private
-
This will anonymize personally identifiable fields and anonymize
submissions submitted by the user with the provided email address
Param$subParam$fields
NF_Admin_UserDataRequests
-
Method
- get_type public
-
Get field type
Returnstring
Method
- get_setting public
-
Get a field setting
Paramstring $settingParammixed $defaultReturnmixed
Method
- get_settings public
-
Get all field settings
Returnarray
Method
- update_setting public
-
Update a field setting
Paramstring $keyParammixed $value
Method
- update_settings public
-
Update all settings
Paramarray $dataReturnField
Method
- delete public
-
Delete field
Returnvoid
Method
- find public
-
Find
Paramstring $parent_idParamarray $whereReturnarray
Method
- get_object_settings public
-
Get object settings
Param[type] $obj_arrayReturnarray
Method
- save public
-
Save field
Returnvoid
Method
- _insert_row public
-
Insert row
Paramarray $dataReturnvoid
Method
- cache public
-
Cache
Paramstring $cacheReturnField
Method
- add_parent public
-
Add parent
Param[type] $parent_idParam[type] $parent_typeReturnField
Static Method
- import public
NF_Admin_UserDataRequests
-
Method
- retrieveSubmissionMeta public
-
Retrieve a collection of submissions meta given filtering args
Paramarray $argsReturnSingleSubmission[]
Method
- retrieveSubmissionValues public
-
Populate with submission values a single submission in a collection
Submission collection may initially only contain submission meta to save time/memory. When called, this method retrieves the complete submission values for the provided SingleSubmision
ParamSingleSubmission $singleSubmissionReturnSingleSubmission
Method
- retrieveSingleSubmission public
-
Retrieve a single submission with values
Absent a previously filtered collection of single submissions within the aggregate, request a single submission, fully populate it, and return.
ParamSingleSubmission $singleSubmissionReturnSingleSubmission
Method
- deleteSubmission public
-
Delete a submission from the data source
ParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- restoreSubmission public
-
Restore a submission from the data source
ParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- updateSubmission public
-
Update a submission from the data source
ParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- getDataSource public
-
Return the dataSource id
Identifies the implementing class, enabling retrieval of submission specifics by calling the implementing classReturnstring
NF_Admin_UserDataRequests
-
Method
- getSlug public
-
Return an identifying slug for the handler
Returnstring
Method
- getLabel public
-
Return a label for the handler
Returnstring
Method
- getHandlerClassName public
-
Return class name of SubmissionHandler
Returnstring
Method
- handle public
-
Perform action on a single submission
ParamSingleSubmission $singleSubmissionReturnvoid
Method
- getDownload public
-
Returns downloadable
Returnstring
CalderaSubmissionDataSource
Retrieves a single Caldera Forms submission by its entry id
-
Method
- retrieveSubmissionMeta public
- @inheritDoc Method
- retrieveSingleSubmission public
- @inheritDoc Method
- applySearchCriterion protected
-
Apply search string filter to submission collection
Runs a WP Query to search for all post Ids with both a form Id from the submission filter and also a search string in any meta value of the same form. It then filters the submission collection to only those submissions that meet these additional requirements.
Returnvoid
Method
- lookupCfFormIdByNfFormId protected
-
Adds CF lookup for given NF form id
If given NF id lookup is not set, checks to see if there is a corresponding CF form. If not, the value is set to `null` so that the instance knows that the form id has been checked.
Paramstring $nfFormIdReturnvoid
Method
- retrieveSubmissionValues public
- @inheritDoc Method
- deleteSubmission public
- @inheritDoc Method
- restoreSubmission public
- @inheritDoc Method
- updateSubmission public
- @inheritDoc Method
- retrieveSubmissionMetaByCfFormId protected
-
Retrieve submissions for a given CF form Id
Returnvoid
Method
- includeByDateFilter protected
-
Boolean to include as per date filter
true=>include, false=>omit
Returnboolean
Method
- getDataSource public
- @inheritDoc
CptSubmissionDataSource
Retrieves a CPT Ninja Forms submission by its form id CPT indicates NF submissions stored as custom post type
-
Method
- retrieveSubmissionMeta public
- @inheritDoc Method
- retrieveSingleSubmission public
- @inheritDoc Method
- retrieveSubmissionValues public
- @inheritDoc Method
- deleteSubmission public
- @inheritDoc Method
- restoreSubmission public
- @inheritDoc Method
- updateSubmission public
- @inheritDoc Method
- getNfSub protected
- Get the NF_Submission for a SingleSubmission entity Method
- fullyPopulateSingleSubmission protected
-
Populate submission values, extra values, handlers
ParamSingleSubmission $singleSubmissionParamNF_Database_Models_Submission $nfSubReturnSingleSubmission
Method
- populateSubmissionValues protected
-
Populate a single submissin with submitted values
ParamSingleSubmission $singleSubmissionParamNF_Database_Models_Submission $nfSubReturnSingleSubmission
Method
- getExtraValueHandlers protected
-
Provide a filtered list of extra value keys storing extra data
Non-core actions can filter the list to provide their keys for retrieval
Returnarray
Method
- retrieveExtraValues protected
-
Retrieve extraValues as constructed into MetaboxOutputEntities
ParamNF_Database_Models_Submission $nfSubParamarray $extraValueHandlersReturnarray
Method
- applySearchCriterion protected
-
Apply search string filter to submission collection
Runs a WP Query to search for all post Ids with both a form Id from the submission filter and also a search string in any meta value of the same form. It then filters the submission collection to only those submissions that meet these additional requirements.
Returnvoid
Method
- retrieveSubmissionMetaByNfFormId protected
-
Retrieve submissions Ids for a given NF form Id
User Id is conditionally added if submission filter's property is explicityly set (-1 is default value, indicating that no filtering on User Id).
WPDB query args is changed from individual args to being passed as array; this makes for cleaner structure when sequence of arguments is variable.
Returnvoid
Method
- includeByDateFilter protected
-
Boolean to include as per date filter
true=>include, false=>omit
Returnboolean
Method
- getDataSource public
- @inheritDoc
NF_Database_FieldsController
-
Method
- __construct public
- Method
- run public
- Method
- get_updated_fields_data public
- Method
- parse_fields private
- Method
- parse_field_meta private
- Method
- get_existing_meta private
- Method
- update_new_field_ids private
- Method
- check_update_new_repeater_field_ids private
- Method
- get_new_field_ids public
- Method
- insert_field private
- Method
- get_insert_fields_query public
- Method
- update_field private
- Method
- get_update_fields_query public
- Method
- insert_field_meta private
- Method
- run_insert_field_meta_query public
- Method
- update_field_meta private
- Method
- run_update_field_meta_query public
NF_Database_FormsController
-
Method
- __construct public
- Method
- setFormsData public
- Method
- getFormsData public
NF_Database_Logger
-
Method
- log public
-
Logs with an arbitrary level.
Parammixed $levelParamstring $messageParamarray $contextReturnnull
Method
- get_current public
-
Get current logs for the request lifecycle
Paramstring $levelReturnarray
Method
- interpolate protected
-
Interpolates context values into the message placeholders.
Param$messageParamarray $contextReturnstring
NF_Database_Migrations
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations class.
Since3.0.0 @updated 3.3.8
Method
- migrate public
-
Function to run each migration on the stack.
Since3.0.0
Method
- do_upgrade public
-
Function to run any required database upgrades.
Param$callback (String) The method this upgrade will call from individual migration files.Since3.4.0
Method
- nuke public
-
This function drops ninja forms tables and options
Param$areYouSure (Boolean)Param$areYouReallySure (Boolean)Param$nuke_multisite (Boolean)Since2.9.34 @updated 3.3.16
Method
- _nuke private
-
Function to handle the actual deletion of tables and caches.
Since3.1.0
Method
- nuke_settings public
-
Function to nuke our 3.0 settings.
Param$areYouSure (Boolean)Param$areYouReallySure (Boolean)Since3.1.0
Method
- _nuke_settings private
-
Function to handle the actual deletion of our 3.0 settings.
Since3.1.0
Method
- nuke_deprecated public
-
Function to nuke our 2.9 database tables.
Param$areYouSure (Boolean)Param$areYouReallySure (Boolean)Since3.1.0
Method
- _nuke_deprecated private
-
Function to handle the actual deletion of deprecated tables and options.
Since3.1.0
NF_Database_Migrations_ActionMeta
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_ActionMeta class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_actions public
-
Function to be run as part of our CacheCollateActions required update.
Since3.3.12 @updated 3.4.0
NF_Database_Migrations_Actions
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Actions class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_actions public
-
Function to be run as part of our CacheCollateActions required update.
Since3.3.12 @updated 3.4.0
NF_Database_Migrations_Chunks
-
Method
- __construct public
- Constructor function for the chunks table migration. Method
- run public
- Function to define the chunks table.
NF_Database_Migrations_FieldMeta
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_FieldMeta class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_fields public
-
Function to run our stage three upgrades.
Since3.3.12 @updated 3.4.0
NF_Database_Migrations_Fields
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Fields class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_fields public
-
Function to run our stage two upgrades.
Since3.3.12 @updated 3.4.0
NF_Database_Migrations_FormMeta
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Actions class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_forms public
-
Function to be run as part of our CacheCollateForms required update.
Since3.4.0
NF_Database_Migrations_Forms
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Actions class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_forms public
-
Function to be run as part of our CacheCollateForms required update.
Since3.4.0
NF_Database_Migrations_ObjectMeta
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_ObjectMeta class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_objects public
-
Function to ensure proper collation of the object_meta table.
Since3.4.0
NF_Database_Migrations_Objects
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Objects class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0 @updated 3.4.0
Method
- cache_collate_objects public
-
Function to ensure proper collation of the objects table.
Since3.4.0
NF_Database_Migrations_Relationships
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Relationships class.
Since3.0.0
Method
- run public
-
Function to run our initial migration.
Since3.0.0
Method
- cache_collate_objects public
-
Function to ensure proper collation of the relationships table.
Since3.4.0
NF_Database_Migrations_Settings
-
Method
- __construct public
- Method
- run public
NF_Database_Migrations_Upgrades
-
Method
- __construct public
-
Constructor method for the NF_Database_Migrations_Fields class.
Since3.3.11
Method
- run public
-
Function to run our initial migration.
Since3.3.11 @updated 3.4.0
Method
- cache_collate_fields public
-
Function to define our maintenance column.
Since3.4.0
NF_Database_MockData
-
Method
- __construct public
- Method
- saved_fields public
- Method
- form_blank_form public
- Method
- form_contact_form_1 public
- Method
- form_contact_form_2 public
- Method
- form_kitchen_sink public
- Method
- form_bathroom_sink public
- Method
- form_long_form public
- Method
- form_email_submission public
- Method
- form_product_1 public
- Method
- form_product_2 public
- Method
- form_product_3 public
- Method
- form_calc_form public
- Method
- _migrate private
NF_Database_Models_Action
-
Method
- __construct public
NF_Database_Models_Field
-
Method
- __construct public
- Method
- delete public
-
Delete
Delete the object, its children, and its relationships.
Also deletes data associated with field
Returnbool
Static Method
- import public
NF_Database_Models_Form
-
Method
- __construct public
- Method
- delete public
- Method
- delete_submissions private
- Method
- prepare_in private
- Static Method
- get_next_sub_seq public
- Static Method
- import public
- Static Method
- import_admin_notice public
- Static Method
- duplicate public
- Static Method
- get_sql_queries private
- Static Method
- export public
- Method
- import_form_backwards_compatibility public
- Method
- import_merge_tags_backwards_compatibility public
- Method
- import_action_backwards_compatibility public
- Method
- import_field_backwards_compatibility public
NF_Database_Models_Object
-
Method
- __construct public
- Method
- save public
NF_Database_Models_Submission
-
Method
- __construct public
- Method
- get_id public
-
Get Submission ID
Returnint
Method
- get_status public
- Method
- get_user public
- Method
- get_form_id public
- Method
- get_form_title public
- Method
- get_seq_num public
- Method
- get_sub_date public
- Method
- get_mod_date public
- Method
- get_field_value public
-
Get Field Value
Returns a single submission value by field ID or field key.
Paramint|string $field_refReturnstring
Method
- get_field_value_for_fieldset_child protected
-
Get field values of a single child field within a fieldset repeater field
get_field_value(), which calls this method, is expected to return a
string. Fieldset Repeater child fields have a unique field reference,
differentiated by their delimiter that ensures that the requesting
external caller knows that it is requesting a fieldset repeater field.
This this method returns a serialized string of values, honoring the
get_field_value() method with the expectation that the external
caller will unserialize this value.
Paramint $fieldsetIdParamint $childFieldId
Method
- get_field_values public
-
Get Field Values
Returnarray|mixed
Method
- update_field_value public
-
Update Field Value
Param$field_refParam$valueReturn$this
Method
- update_field_values public
-
Update Field Values
Param$dataReturn$this
Method
- get_extra_value public
- Method
- get_extra_values public
- Method
- update_extra_value public
- Method
- update_extra_values public
- Method
- find public
-
Find Submissions
Param$form_idParamarray $whereReturnarray
Method
- delete public
- Delete Submission Method
- trash public
- Trash Submission Method
- save public
-
Save Submission
Return$this|NF_Database_Models_Submission|void
Static Method
- export public
- Method
- _save_field_value protected
-
Save Field Value
Param$field_idParam$valueReturn$this
Method
- _save_field_values protected
-
Save Field Values
Return$this|void
Method
- _save_extra_values protected
- Method
- format_meta_query protected
-
Format Meta Query
Paramarray $whereReturnarray
Method
- get_field_id_by_key protected
-
Get Field ID By Key
Param$field_keyReturnmixed
Static Method
- sort_fields public
NF_Database_PublishProcessing
-
Method
- task protected
NF_Database_SubmissionExpirationCron
-
Method
- __construct public
-
NF_Database_SubmissionExpirationCron constructor.
Sets up our our submission expiration CRON job.
Method
- expired_submission_cron public
-
Expired Submission Cron
Checks our subs to see if any are expired and sends them to be
deleted if there are any that need to be removed.
Param$optionsReturnvoid
Method
- get_expired_subs public
-
Get Expired Subs
Gathers our expired subs puts them into an array and returns it.
Param$form_id - ( int ) ID of the Form.Param$expiration_time - ( int ) number of days the submissions are set to expire in
Returnarray of all the expired subs that were found.
Method
- delete_expired_subs public
-
Delete Expired Subs
Helper method that removes our expired subs.
Param$expired_subs - array of sub ids that need to be deleted.Param$cap - The cap of the amount of subs you want deleted at 1 time.
Returnvoid
NF_Dispatcher
-
Method
- should_we_send public
-
Returns bool true if we are opted-in or have a premium add-on.
If a premium add-on is installed, then users have opted into tracked via our terms and conditions.
If no premium add-ons are installed, check to see if the user has opted in or out of anonymous usage tracking.
SinceversionReturnbool
Method
- update_environment_vars public
-
Package up our environment variables and send those to our API endpoint.
Since3.2Returnvoid @updated 3.3.17
Method
- form_data public
-
Package up our form data and send it to our API endpoint.
Since3.2Returnvoid
Method
- send public
-
Sends a campaign slug and data to our API endpoint.
Checks to ensure that the user has 1) opted into tracking or 2) they have a premium add-on installed.
Since3.2Paramstring $slug Campaign slugParamarray $data Array of data being sent. Should NOT already be a JSON string.Returnvoid
NF_Display_Page
-
Method
- __construct public
- Method
- get_content public
-
Returnstring HTML
Method
- get_title abstract
- Method
- get_guid abstract
- Method
- modify_wp_query public
-
Modifies the WP Query to our liking
Returnvoid
NF_Display_PageEmbedForm
-
Method
- __construct public
- Method
- get_content public
-
Returnstring HTML
Method
- get_title public
-
Returnstring
Method
- get_guid public
-
Returnstring
NF_Display_PagePublicLink
-
Method
- __construct public
- Method
- get_content public
-
Returnstring HTML
Method
- get_title public
-
Returnstring
Method
- get_guid public
-
Returnstring
NF_Display_Preview
-
Method
- __construct public
- Method
- pre_get_posts public
- Method
- the_title /** * @return string */
- Method
- the_content /** * @return string */
- Method
- template_include /** * @return string */
- Method
- post_thumbnail_html
NF_Display_Render
-
Static Method
- localize public
- Static Method
- checkRepeaterChildType public
- Static Method
- checkRepeaterChildSetting public
- Static Method
- localize_preview public
- Static Method
- enqueue_scripts public
- Static Method
- enqueue_styles_display public
- Static Method
- load_template public
- Static Method
- output_templates public
- Static Method
- is_template_loaded protected
NF_Display_Shortcodes
-
Method
- __construct public
- Method
- display_form_preview public
- Method
- display_form_front_end public
- Method
- display_no_id private
-
TODO: Extract output to template files.
Returnstring
NF_EmailTelemetry
Measure email throughput to determine the potential scale of email related issues. @TODO: Remove this entire file at a later date.
-
Method
- __construct public
-
Constructor which takes in a paremeter to tell the class whether the site is opted
in for telemetry or not
Param$opted_inSince3.3.21
Method
- setup public
- @hook phpmailer_init The last action before the email is sent. Method
- update_metrics public
- @NOTE No need to return $phpmailer as it is passed in by reference (aka Output Parameter). Method
- maybe_schedule_push public
- Method
- push_telemetry public
MetaboxOutputEntity
Entity holding title and label/value/styling output for metaboxes
-
Static Method
- fromArray public
- Method
- toArray public
- Constructs an array representation Method
- validateLabelValueCollection protected
- Method
- getTitle public
-
Get metabox title
Returnstring
Method
- setTitle public
-
Set metabox title
Paramstring $title Metabox title
ReturnMetaboxOutputEntity
Method
- getLabelValueCollection public
- Get the value of labelValueCollection Method
- setLabelValueCollection public
-
Set the value of labelValueCollection
ReturnMetaboxOutputEntity
SimpleEntity
Simple entity abstract upon which all entities are built
Entities are classes that pass well defined data honoring contracts.
Single parameters and arrays, when passed into an entity, can be relied
upon to provide the data defined by the entity, even if the original data
did not fully define values.
-
Method
- toArray public
- Constructs an array representation Method
- jsonSerialize public
-
Sets data for json_encode
Returnvoid
Method
- __get public
-
Magic method getter for properties
Paramstring $nameReturnvoid
Method
- __set public
-
Magic method setter for properties
Usually does not support setting undefined properties, but this class is enabling that, although it is kept as a separate command in case it must be modified. This is because field definitions can have an undetermined collection of settings and this class will enable setting of all those values, while maintaining the ability to define sets and gets that filter values for proper types.
Paramstring $nameParammixed $valueReturnSimpleEntity
SingleSubmission
Entity defining Single Submission data structure
-
Method
- getSubmissionFieldValue public
-
Get a field value by the field slug
Paramstring $fieldSlugReturnvoid
Static Method
- fromArray public
- Method
- toArray public
- Constructs an array representation Method
- getSubmissionRecordId public
-
Get submission Id
Returnstring
Method
- setSubmissionId public
-
Set submission Id
Paramstring $submissionRecordId Submission Id
Returnself
Method
- getTimestamp public
-
Get submission time stamp
Returnstring
Method
- setTimestamp public
-
Set submission time stamp
Force standard formatParamstring $timestamp Submission time stamp
Returnself
Method
- getFormId public
-
Get form Id to which the submission belongs
Returnstring
Method
- setFormId public
-
Set form Id to which the submission belongs
Paramstring $formId Form Id to which the submission belongs
Returnself
Method
- getDataSource public
-
Get dataSource
Typical locations include NF post, CF table
Returnstring
Method
- setSubmissionFieldCollection public
-
Set submitted values as collection of SubmissionField entities
Paramarray $submissionFieldCollection SubmissionField entities keyed on field slug
ReturnSingleSubmission
Method
- getSubmissionFieldCollection public
-
Get submitted values as collection of SubmissionField entities
Returnarray
Method
- getFieldSlugs public
-
Return array of field slugs for submissionFieldCollection
Returnarray
Method
- getExtraValues public
-
Get extra data values stored with submission
Returnarray
Method
- setExtraValues public
-
Set extra data values stored with submission
Paramarray $extraValues Extra data values stored with submission
ReturnSingleSubmission
Method
- getSubmissionHandlers public
-
Get associative array (string) of classes providing additional submission handling
[slug]=>(string)ClassName implements SubmissionHandlerReturnarray
Method
- setSubmissionHandlers public
-
Set associative array (string) of classes providing additional submission handling
Paramarray $submissionHandlers Associative array (string) of classes providing additional submission handling
ReturnSingleSubmission
Method
- getStatus public
-
Get submission status
Returnarray
Method
- setStatus public
-
Set submission status
Paramarray $status Submission status
ReturnSingleSubmission
SubmissionExtraHandlerResponse
Defines data passed from SubmissionHandlers to submissions page NF>=3.6.1
-
Static Method
- fromArray public
- Method
- getResponseType public
-
Get response type
Returnstring
Method
- setResponseType public
-
Set response type
Paramstring $responseType Response type
ReturnSubmissionExtraHandlerResponse
Method
- getDownload public
-
Get download
Returnstring
Method
- setDownload public
-
Set download
Paramstring $download Download
ReturnSubmissionExtraHandlerResponse
Method
- getBlobType public
-
Get blob type
Returnstring
Method
- setBlobType public
-
Set blob type
Paramstring $blobType Blob type
ReturnSubmissionExtraHandlerResponse
Method
- getResult public
-
Get result
Returnstring
Method
- setResult public
-
Set result
Paramstring $result Result
ReturnSubmissionExtraHandlerResponse
Method
- getFilename public
-
Get filename of the download, including file extension
Returnstring
Method
- setFilename public
-
Set filename of the download, including file extension
Paramstring $filename Filename of the download, including file extension
ReturnSubmissionExtraHandlerResponse
SubmissionField
Entity defining a submission field, including value if present Submission field is the submission value for a single field within a form's field collection
-
Static Method
- fromArray public
- Method
- getId public
-
Get field Id
Returnstring
Method
- setId public
-
Set field database record id
Paramstring $id Field Id
ReturnSubmissionField
Method
- getSlug public
-
Get field slug
Returnstring
Method
- setSlug public
-
Set field slug
Paramstring $slug Field slug
ReturnSubmissionField
Method
- getLabel public
-
Get field label
Returnstring
Method
- setLabel public
-
Set field label
Paramstring $label Field label
ReturnSubmissionField
Method
- getAdminLabel public
-
Get amdin label
Returnstring
Method
- setAdminLabel public
-
Set amdin label
Paramstring $adminLabel Admin label
ReturnSubmissionField
Method
- getType public
-
Get field type
Returnstring
Method
- setType public
-
Set field type
Paramstring $type Field type
ReturnSubmissionField
Method
- getValue public
-
Get submission Value
Returnmixed
Method
- setValue public
-
Set submission Value
Parammixed $value Submission Value
Returnself
Method
- getOptions public
-
Get indexed collection of option label/value/calc
Returnarray
Method
- setOptions public
-
Set indexed collection of option label/value/calc
Paramarray $options Indexed collection of option label/value/calc
ReturnSubmissionField
Method
- getFieldsetRepeaterFields public
-
Get Indexed collection of fieldset repeater fields within parent field
Returnarray
Method
- setFieldsetRepeaterFields public
-
Set Indexed collection of fieldset repeater fields within parent field
ParamSubmissionField[] $fieldsetRepeater Indexed collection of fieldset repeater fields within parent field
ReturnSubmissionField
Method
- getOriginal public
-
Get original field settings as stored in NF DB tables
Returnarray
Method
- setOriginal public
-
Set original source field settings (from NF DB tables)
Paramarray $original Original source is from NF DB tables
ReturnSubmissionField
SubmissionFilter
Define parameters used to filter submissions
-
Static Method
- fromArray public
- Method
- getNfFormIds public
-
Get indexed array of string NF form Ids
Returnarray
Method
- setNfFormIds public
-
Set indexed array of string NF form Ids
Paramarray $nfFormIds Indexed array of string NF form Ids
Returnself
Method
- getStartDate public
-
Get start date for filter submissions
Returnint
Method
- setStartDate public
-
Set start date for filter submissions
Paramint $startDate Start date for filter submissions
ReturnSubmissionFilter
Method
- getEndDate public
-
Get end date for filter submissions
Returnint
Method
- setEndDate public
-
Set end date for filter submissions
Paramint $endDate End date for filter submissions
ReturnSubmissionFilter
Method
- getSearchString public
-
Get search string
Returnstring
Method
- setSearchString public
-
Set search string
Paramstring $searchString Search string
ReturnSubmissionFilter
Method
- getStatus public
-
Get filter submissions by status
Returnarray
Method
- setStatus public
-
Set filter submissions by status
Paramarray $status Filter submissions by status
ReturnSubmissionFilter
Method
- getUserId public
-
Get user Id for filter submissions
Returnint
Method
- setUserId public
-
Set user Id for filter submissions
Paramint $userId User Id for filter submissions
ReturnSubmissionFilter
Method
- getSubmissionsIDs public
-
Get included submission IDs
Returnarray
Method
- setSubmissionsIDs public
-
Set submissions IDs
Paramarray $submissionsIDs of Submissions IDs to include
ReturnSubmissionFilter
NF_Exports_BulkSubmissionEmail
Email exported submissions as an attachment
-
Method
- __construct public
-
Instantiated with BulkSubmissionEmailParameters and string CSV content
ParamBulkSubmissionEmailParameters $bulkSubmissionEmailParametersParamarray $attachmentFilenames Array of string filenames ready for attachment
Method
- setDefaults protected
- Set default properties Method
- handle public
- Generate email, attach content, submit email Method
- sanitizeAddressFields protected
- Put every email address through a sanitizing method Method
- sanitizeEmail protected
-
Sanitize a given email address
Paramstring $incomingReturnstring
Method
- getHeaders private
-
Construct and return header array
Note that variable headers are run through sanitize_header method
Returnarray
Method
- sanitize_header protected
-
Sanitize header to prevent attacker is able to create new headers using charecter encoding.
Paramstring $headerReturnvoid
Method
- getAttachments private
-
Construct and return attachments
Returnarray
Method
- constructRecipientsHeader private
-
Format Reply-To, CC, and BCC address header
Returnarray
Method
- formatAddress private
-
Format address for header
Paramstring $typeParamstring $emailParamstring $nameReturnstring
NF_Exports_BulkSubmissionEmailParameters
Entity to pass bulk export submission parameters
Provides a guarantee that any requested or required parameters have a known
default value and type
-
Method
- getFormat public
-
Get output format
Returnstring
Method
- getFormId public
-
Get form Id
Returnint
Method
- getEmailTo public
-
Get Email `To` addresses string - comma delimited
Returnstring
Method
- getEmailFrom public
-
Get Email `From` address
Returnstring
Method
- getEmailReplyTo public
-
Get Email `Reply To` address
Returnstring
Method
- getEmailSubject public
-
Get Email `Subject`
Returnstring
Method
- setEmailTo public
-
Set Email `To` addresses - comma delimited
Paramstring $emailToReturn$this
Method
- setEmailFrom public
-
Set Email `From` address
Paramstring $emailFromReturn$this
Method
- setEmailReplyTo public
-
Set Email `Reply To` address
Paramstring $emailReplyToReturn$this
Method
- setEmailSubject public
-
Set Email `Subject` address
Paramstring $emailSubjectReturn$this
Method
- setFormId public
-
Set form Id
Paramint $formIdReturnNF_Database_Models_SubmissionExportSettingsParameters
Method
- setFormat public
-
Set output format
Paramstring $formatReturnNF_Database_Models_SubmissionExportSettingsParameters
Method
- toArray public
-
Convert instance to associative array
Returnarray
Static Method
- fromArray public
- Method
- __get public
-
Magic method to return property
Paramstring $nameReturnmixed
Method
- __set public
-
Paramstring $nameParammixed $valueReturnNF_Database_Models_SubmissionCollectionInterfaceParameters
NF_Exports_BulkSubmissionEmailParameters
-
Method
- getFieldValue public
-
Get Field Value
Return a single submission value by field ID or field key.
Paramint|string $field_refReturnstring
Method
- getFieldValues public
-
Get all submission field values for a single, pre-defined submission
Returnarray|mixed
Method
- getId public
-
Return the submission Id
Returnint
Method
- getSeqNum public
- Return the Sequence Number of a predefined submission Id Method
- getSubmissionDate public
-
Return the submission date for predefined submission Id
Paramstring $format Optional date format
Method
- filterFieldValues public
-
Filter field values to return only provided keys
NOTE: filter is performed on array KEYS of incoming parameter. This
enables use of `field labels` array generated at the collection level,
which is keyed off the same field keys as the submission for perfect
matching of array columns.
Paramarray $fieldKeys Array keyed on field keys with optional valueReturnarray
Method
- setExportDatetime public
-
Set timestamp of export
Paramint $unixTimestamp
Method
- wasExported public
-
Return true if submission has been exported
Returnbool
Method
- isUnread public
-
Return bool `true` if submission is unread
Returnbool
NF_Exports_BulkSubmissionEmailParameters
-
Method
- getFormId public
-
Return the form Id
Returnint
Method
- getFormTitle public
-
Return the form title
Returnstring
Method
- getCounts public
- Return count of submissions, exported, and unread Method
- filterByParameters public
-
Set all parameters using NF_Database_Models_SubmissionCollectionInterfaceParameters
Using the object ensures all properties are set, with known defaults;
this enables the requesting class to set only values that concerns it
without needing to set any other value or default. The Submission
Collection class knows that all values have valid parameters and can
immediately run the filter.
ParamSubmissionCollectionFilterParameters $params
Method
- setDateParameters public
-
Set start and end dates to filter submissions
Paramint|null $startDate Starting dateParamint|null $endDate Ending date
Method
- setIsUnreadParameter public
-
Set parameter to filter submissions by `isUnread` = true or false
Parambool $isUnread
Method
- setPreviouslyExportedParameter public
-
Set parameter to filter submissions by `previouslyExported` = true or false
Parambool $previouslyExported
Method
- setMaxReturnCount public
-
Set max number of submissions to return in a request
Paramint $maxReturnCount
Method
- filterSubmissions public
-
Filter collection of submissions based on previously set parameters
Returnarray
Method
- getSubmissions public
-
Return submission collection array
ReturnSingleSubmissionInterface[]
Method
- getSubmissionIds public
- Return array of submission Ids in the collection Method
- getLabels public
-
Return array of field labels keyed on field keys
If hiddenFieldTypes array is set, labels filtered to hide those types
Parambool $useAdminLabels Optionally use admin_labelsReturnarray
Method
- getFieldTypes public
-
Return array of field types keyed on field keys
Returnarray
Method
- getFieldIds public
- Return array of field Ids keyed on field keys Method
- setHiddenFieldTypes public
-
Set field types to be removed before output
Provided as indexed array of NF field types
Paramarray $hidden
NF_Exports_BulkSubmissionEmailParameters
-
Method
- handle public
-
Generate CSV output and return
Returnstring
Method
- reverseSubmissionOrder public
-
Provide submissionCollection indices in reverse order
CSV output sorts earliest to current; submissionAggregate returns in reverse order
Returnvoid
Method
- constructRow public
-
Construct a CSV row for record at given submission aggregate's index
Parammixed $aggregatedKeyReturnarray
Method
- setSubmissionCollection public
-
Set submission collection used in generating the CSV
ParamSubmissionCollectionInterface $submissionCollection
Method
- setUseAdminLabels public
-
Set boolean useAdminLabels
Parambool $useAdminLabelsReturnNF_Exports_Interfaces_SubmissionCsvExportInterface
Method
- getLabels public
-
Return array of labels
Returnarray
Method
- setDateFormat public
-
Set date format
Paramstring $dateFormat
NF_Exports_SingleSubmissionCPT
-
Method
- __construct public
-
Paramstring|int $id
Method
- getId public
-
Get Submission ID
Returnint
Method
- getSeqNum public
-
@inheritDoc
Returnint
Method
- getSubmissionDate public
-
@inheritDoc
Paramstring $formatReturnstring
Method
- filterFieldValues public
-
Filter field values to return only provided keys
NOTE: filter is performed on array KEYS of incoming parameter. This
enables use of a previously generated `field labels` array, which is
keyed off the same field keys as the submission for perfect matching
of array columns.
Paramarray $fieldKeys Array keyed on field keys with optional valueReturnarray
Method
- getFieldValue public
-
Get Field Value
Returns a single submission value by field ID or field key.
Paramint|string $field_refReturnstring
Method
- getFieldValues public
-
Get Field Values - from existing NF_Database_Models_Submission
Returns all post meta
Returnarray|mixed
Method
- getExtraValue public
- Method
- getFieldIdByKey protected
-
Get Field ID By Key
Param$field_keyReturnmixed
Method
- setExportDatetime public
-
Set timestamp of export
Paramint $unixTimestampReturnNF_Database_Models_SingleSubmissionInterface
Method
- wasExported public
-
Return bool true if submission has exported datetime set
Returnbool
Method
- isUnread public
-
Return bool `is submission unread?`
If not set, default is false (submission has been read). Thus new
submissions must be explicitly set as unread. Without this, all
preexisting submissions will be marked as unread and can confuse
existing installations.
Returnboolean
Method
- markAsRead public
- Mark the submission as `unread` via post_meta Method
- markAsUnread public
- Mark the submission as `read` via post_meta
NF_Exports_SubmissionCollectionCPT
-
Method
- __construct public
-
Construct submission collection with provided form Id
Paramstring|int $form_id
Method
- getFormId public
-
Return form Id
Returnint
Method
- getFormTitle public
-
Return form title
Returnstring
Method
- setDateParameters public
-
Set start and end dates to filter submissions
Paramint|null $startDate Starting dateParamint|null $endDate Ending date
Method
- setIsUnreadParameter public
-
Set parameter to filter submissions by `isUnread` = true or false
Parambool $isUnread
Method
- setPreviouslyExportedParameter public
-
Set parameter to filter submissions by `previouslyExported` = true or false
Parambool $previouslyExported
Method
- setMaxReturnCount public
-
Set max number of submissions to return in a request
Paramint $maxReturnCount
Method
- filterByParameters public
-
Set all parameters using NF_Database_Models_SubmissionCollectionInterfaceParameters
Using the object ensures all properties are set, with known defaults;
this enables the requesting class to set only values that concerns it
without needing to set any other value or default. The Submission
Collection class knows that all values have valid paramters and can
immediately run the filter.
ParamNF_Database_Models_SubmissionCollectionInterfaceParameters $paramsReturnSubmissionCollectionInterface
Method
- filterSubmissions public
-
Filter collection of submissions based on previously set parameters
Returnarray
Method
- getCounts public
- Return count of submissions, exported, and unread Method
- addMetaFilters protected
-
Add meta query filters
Paramarray $filterReturnarray
Method
- constructDefaultFilter protected
-
Construct/return default filter args array for WP's get_post
Returnarray
Method
- constructIsUnreadQuery protected
-
Construct meta query for isUnread; empty array if null param
Returnarray
Method
- constructPreviouslyExportedQuery protected
-
Construct meta query for previously exported; empty array if null parameter
Parambool|null $previouslyExportedReturnarray
Method
- constructDateQuery protected
-
Construct meta query for start/end dates; empty array if null parameters
Returnarray
Method
- getSubmissions public
-
Return submission collection array
Return\NF_Database_Models_SingleSubmissionInterface[]
Method
- getSubmissionIds public
-
Return array of submission Ids in the collection
Generated at time of request to ensure it is up to date after last
query / construction
Returnarray
Method
- getLabels public
-
Return array of field labels keyed on field key
If hiddenFieldTypes array is set, labels filtered to hide those types
Parambool|null $useAdminLabelsReturnarray
Method
- getFieldTypes public
-
Return array of field types keyed on field key
Returnarray
Method
- getFieldIds public
- Return array of field Ids keyed on field keys Method
- getFields protected
- Get all fields for the instantiated form Id Stored as $this->fields for additional use w/o calling DB Method
- formatDate protected
-
Convert Unix date stamp to Wordpress post date format
Paramint|null $incomingReturnstring
Method
- setHiddenFieldTypes public
-
Set field types to be removed before output
Provided as indexed array of NF field types
Paramarray $hidden
NF_Exports_SubmissionCollectionFilterParameters
Entity of parameters to filter a submission collection Provides a guarantee that any requested or required parameters have a known default value and type. The default value for all unset parameters is `null` to differentiate an unset or purposefully null value from a boolean false or an empty array. This tells the caller that the value is not to be used in a filter, which is different than filtering on false, or empty array.
-
Method
- getStartDate public
-
Get start date
Returnint|null
Method
- getEndDate public
-
Get end date
Returnint|null
Method
- getIsUnread public
-
Get IsUnread? boolean
Returnbool|null
Method
- getPreviouslyExported public
-
Get IsPreviouslyExported? boolean
Returnbool|null
Method
- getMaxReturnCount public
-
Get MaxReturnCount
Returnint|null
Method
- getUseAdminLabels public
-
Get UseAdminLabels? boolean
Returnbool|null
Method
- getHiddenFieldTypes public
-
Get hidden field types array
Returnarray
Method
- setStartDate public
-
Set start date
Paramint|null $startDateReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setEndDate public
-
Set end date
Paramint|null $endDateReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setIsUnread public
-
Set IsUnread? boolean
Parambool $isUnreadReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setPreviouslyExported public
-
Set PreviouslyExported? boolean
Paramboolean $previouslyExportedReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setMaxReturnCount public
-
Set Maximum return count
Paramint $maxReturnCountReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setUseAdminLabels public
-
Set UseAdminLabels? boolean
Parambool $useAdminLabelsReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- setHiddenFieldTypes public
-
Set HiddenFieldTypes array
Paramarray $hiddenFieldTypesReturnNF_Exports_SubmissionCollectionFilterParameters
Method
- toArray public
-
Convert instance to associative array
Returnarray
Static Method
- fromArray public
- Method
- __get public
-
Magic method to return property
Paramstring $nameReturnmixed
Method
- __set public
-
Paramstring $nameParammixed $valueReturnNF_Exports_SubmissionCollectionFilterParameters
NF_Exports_SubmissionCsvExport
-
Method
- handle public
-
Generate CSV output and return
Returnstring
Method
- reverseSubmissionOrder public
- @inheritDoc Method
- constructRow public
- @inheritDoc Method
- prepareCsv protected
-
Construct string output from previously set params, mark submissions read
Returnstring
Method
- appendRows protected
- Append each submission from the collection as a row Method
- constructSeqNumLookup protected
-
For NF CPT, construct lookup from index for SeqNum
Paramstring $aggregatedKeyParamSingleSubmission $singleSubmissionReturnvoid
Method
- constructSubmissionRow protected
-
Construct a single row in the CSV from a submission
ToDoRefactor to remove DB call for NF()->form()->field() on each iterationParamSingleSubmission $submissionReturnarray
Method
- formatTimestamp protected
-
Format timestamp for output
Paramstring $timestampReturnstring
Method
- constructLabels protected
- Construct labels array Indexed array of labels, which serves as the column headers Method
- getLabels public
-
Return labels for the CSV, including SeqNum and Date
Returnarray
Method
- getFieldLabelsBeforeFields protected
-
Return filtered array of labels preceding fields
Returnarray
Method
- setSubmissionCollection public
-
Set submission collection used in generating the CSV
ToDoInvestigate reason for commented out type declarationsParamSubmissionCollectionInterface $submissionCollectionReturnSubmissionCsvExportInterface
Method
- setSubmissionAggregateCsvExportAdapter public
-
Set SubmissionAggregateCsvExport Adapter used in generating the CSV
ParamSubmissionAggregateCsvExportAdapter $submissionAggregateCsvExportAdapterReturnSubmissionCsvExportInterface
Method
- setUseAdminLabels public
-
Set boolean useAdminLabels
Parambool $useAdminLabelsReturnSubmissionCsvExportInterface
Method
- setDateFormat public
-
Set date format
Paramstring $dateFormatReturnSubmissionCsvExportInterface
NF_Exports_TempFileWriter
Writes temporary files for attachment and uploading
-
Method
- __construct public
-
Construct with the content to be written
Paramstring $content
Method
- writeFiles public
-
Write files to temporary location
ReturnNfScheduledSubmissionExports\Storage\TempFileWriter
Method
- getFileInfo public
-
Returns array of temp filenames, first file name if single
Parambool $single
Method
- getAttachmentNames public
- Method
- constructFileInfo protected
- Static Method
- generateFileInfo public
- Method
- writeTempFile protected
- Write contents to temporary file location Method
- renameFile protected
-
Rename temp file to permanent file name
Paramstring $filenameReturnstring
Method
- dropAttachmentFiles public
- Delete file from directory after email with attachment has been sent Static Method
- dropAttachmentFile public
SubmissionAggregateFactory
-
Method
- submissionAggregate public
-
Construct SubmissionAggregate class with data sources
ReturnSubmissionAggregate
Method
- SubmissionAggregateCsvExportAdapter public
-
Constructs SubmissionAggregateCsvExportAdapter with SubmissionAggregate
ReturnSubmissionAggregateCsvExportAdapter
Method
- makeCalderaDataSource public
-
Construct a Caldera submissions data source
ReturnCalderaSubmissionDataSource
Method
- makeCptSubmissionDataSource public
-
Construct a Ninja Forms CPT data source
ReturnCptSubmissionDataSource
Method
- cfTablesExist protected
-
Check that both CF entry and values tables exist
Returnboolean
SubmissionFilterFactory
Standardize the instantiation of a SubmissionFilter object
-
Method
- unfiltered public
-
Empty submission filter with default properties
ReturnSubmissionFilter
Method
- startEndDates public
-
SubmissionFilter with start and end dates
Paraminteger $startDate Epoch dateParaminteger $endDate Epoch dateReturnSubmissionFilter
Method
- loggedInUser public
-
Add logged in user to SubmissionFilter
If user is not logged in, value is set to -1 because all non-logged in user submissions are set to user ID = 0, which is not desired output
ReturnSubmissionFilter
Method
- maybeLimitByLoggedInUser public
-
Add userId to SubmissionFilter conditionally by WP filter
Override SubmissionFilter userId default value if an applied WP filter specifies it
ReturnSubmissionFilter
Method
- getUserId protected
-
Return logged in user's ID
Returninteger If user not logged in, return 0
Method
- provideLimitByLoggedInUserFilter protected
-
Provide WP filter to add logged in user to SubmissionFilter
Default is to retrieve all submissions, so return FALSE. This applies a filter that enables external code to change default behaviour.Returnboolean
NF_Fields_Address
Class NF_Fields_Address
-
Method
- __construct public
NF_Fields_Address2
Class NF_Fields_Address2
-
Method
- __construct public
NF_Fields_Button
Class NF_Field_Button
-
Method
- __construct public
NF_Fields_Checkbox
Class NF_Fields_Checkbox
-
Method
- __construct public
-
NF_Fields_Checkbox constructor.
Since3.0
Method
- admin_form_element public
-
Admin Form Element
Display the checkbox on the edit submissions area.
Since3.0
Param$id Field ID.Param$value Field value.Returnstring HTML used for display of checkbox.
Method
- custom_columns public
-
Custom Columns
Creates what is displayed in the columns on the submissions page.
Since3.0
nf_subs_export_pre_valueParam$value checkbox valueParam$field field model.Return$value string|void
Method
- filter_merge_tag_value public
-
Filter Merge Tag Value
This is what provides the merge tag with the fields value.
Since3.0
Param$value Field valueParam$field field modelReturnstring|void
Method
- filter_merge_tag_value_calc public
-
Filter Merge Tag Value Calc
Provides the calculation value when the merge tag is used.
Since3.0
Param$value checkbox valueParam$field field modelReturn$field
Method
- export_value public
-
Export Value
Determines the value to send to submission export.
Since3.0
Param$value checkbox field valueParam$field checkbox field modelReturnstring|void
NF_Fields_City
Class NF_Fields_City
-
Method
- __construct public
NF_Fields_Confirm
Class NF_Fields_Confirm
-
Method
- __construct public
- Method
- hide_field_type
- Method
- validate public
NF_Fields_CreditCard
Class NF_Fields_CreditCard
-
Method
- __construct public
NF_Fields_CreditCardCVC
Class NF_Fields_CreditCardCVC
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_CreditCardExpiration
Class NF_Fields_CreditCardExpiration
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_CreditCardFullName
Class NF_Fields_CreditCardFullName
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_CreditCardNumber
Class NF_Fields_CreditCardNumber
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_CreditCardZip
Class NF_Fields_CreditCardZip
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_Date
Class NF_Fields_Date
-
Method
- __construct public
- Method
- process public
- Method
- get_format private
- Method
- localizeField public
-
Since3.0Paramarray $field Array of field settingsReturnvoid
Method
- custom_columns public
- Method
- filter_csv_value public
- Method
- admin_form_element public
- Method
- stringify_value private
- Method
- get_hours_options private
- Method
- get_minutes_options private
- Method
- filter_merge_tag_value public
-
Filter Merge Tag Value
This is what provides the merge tag with the fields value.
Since3.0
Param$value Field valueParam$field field modelReturnstring|void
NF_Fields_Email
Class NF_Fields_Email
-
Method
- __construct public
- Method
- validate public
- Method
- filter_default_value public
NF_Fields_FirstName
Class NF_Fields_FirstName
-
Method
- __construct public
- Method
- filter_default_value public
NF_Fields_HTML
Class NF_Fields_HTML
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_Hidden
Class NF_Fields_Hidden
-
Method
- __construct public
NF_Fields_LastName
Class NF_Fields_FirstName
-
Method
- __construct public
- Method
- filter_default_value public
NF_Fields_ListCheckbox
Class NF_Fields_CheckboxList
-
Method
- __construct public
- Method
- admin_form_element public
- Method
- get_calc_value public
NF_Fields_ListCountry
Class NF_Fields_CountryList
-
Method
- __construct public
- Method
- custom_columns public
- Method
- filter_options public
- Method
- sort_options_by_label private
- Method
- filter_options_preview public
- Method
- admin_form_element public
- Method
- get_default_value_options private
- Method
- get_options private
- Method
- filter_csv_value public
NF_Fields_ListImage
Class NF_Fields_ListImage
-
Method
- __construct public
- Method
- admin_form_element public
- Method
- custom_columns public
- Method
- get_calc_value public
- Method
- localizeField public
NF_Fields_ListMultiselect
Class NF_Fields_MultiselectList
-
Method
- __construct public
- Method
- admin_form_element public
- Method
- get_calc_value public
NF_Fields_ListRadio
Class NF_Fields_RadioList
-
Method
- __construct public
- Method
- get_calc_value public
NF_Fields_ListSelect
Class NF_Fields_SelectList
-
Method
- __construct public
- Method
- get_calc_value public
NF_Fields_ListState
Class NF_Fields_ListState
-
Method
- __construct public
- Method
- get_options private
NF_Fields_Note
Class NF_Fields_Note
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_Number
Class NF_Fields_Number
-
Method
- __construct public
- Method
- get_parent_type public
NF_Fields_Password
Class NF_Fields_Password
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_PasswordConfirm
Class NF_Fields_PasswordConfirm
-
Method
- __construct public
- Method
- hide_field_type
- Method
- validate public
- Method
- get_password_fields private
- Method
- is_matching_values private
- Method
- get_error_message private
NF_Fields_Phone
Class NF_Fields_Phone
-
Method
- __construct public
NF_Fields_Product
Class NF_Fields_Product
-
Method
- __construct public
- Method
- process public
- Method
- validate public
-
Validate
Param$fieldParam$dataReturnarray $errors
Method
- filter_required_setting public
- Method
- merge_tag_value public
- Method
- custom_columns public
- Method
- admin_form_element public
NF_Fields_Quantity
Class NF_Fields_ProductQuantity
-
Method
- __construct public
NF_Fields_Recaptcha
Class NF_Fields_Recaptcha
-
Method
- __construct public
- Method
- localize_settings public
- Method
- validate public
- Method
- hide_field_type
NF_Fields_RecaptchaV3
Class NF_Fields_RecaptchaV3
This is a dynamically injected field based on if a form has the reCAPTCHA action.
It doesn't appear in the builder.
NF_Fields_Repeater
Class NF_Fields_Repeater
-
Method
- __construct public
- Method
- display_filter public
- Method
- admin_form_element public
- Method
- custom_columns public
-
Custom Columns
Creates what is displayed in the columns on the submissions page.
Since3.4.34 nf_subs_export_pre_valueParam$value checkbox valueParam$field field model.Return$value string|void
NF_Fields_Shipping
Class NF_Field_Shipping
-
Method
- __construct public
- Method
- add_setting_group public
- Method
- admin_form_element public
- Method
- merge_tag_value public
NF_Fields_Spam
Class NF_Fields_Spam
-
Method
- __construct public
- Method
- validate public
-
Validate
Param$fieldParam$dataReturnarray $errors
Method
- get_parent_type public
- Method
- hide_field_type
NF_Fields_StarRating
Class NF_Fields_StarRating
-
Method
- __construct public
NF_Fields_Submit
Class NF_Field_Button
-
Method
- __construct public
- Method
- hide_field_type
NF_Fields_Terms
Class NF_Fields_Terms
-
Method
- __construct public
- Method
- process public
- Method
- init_settings public
- Method
- active_taxonomy_field_check public
- Method
- add_term_options public
- Method
- merge_tag_value public
- Method
- get_parent_type public
NF_Fields_Textarea
Class NF_Field_Textarea
-
Method
- __construct public
- Method
- admin_form_element public
- Method
- filter_csv_value public
NF_Fields_Textbox
Class NF_Field_Textbox
-
Method
- __construct public
- Method
- filter_csv_value public
NF_Fields_Total
Class NF_Field_Total
-
Method
- __construct public
- Method
- process public
NF_Fields_Unknown
Class NF_Fields_Unknown
-
Method
- __construct public
- Method
- validate public
- Method
- hide_field_type
- Static Method
- create public
NF_Fields_Zip
Class NF_Fields_Zip
-
Method
- __construct public
NF_Fields_Hr
Class NF_Fields_Hr
-
Method
- __construct public
- Method
- hide_field_type
DateTimeConverter
Converts timestamps between formats, cognizant of WordPress settings
This class is aware of the WordPress timezone settings and can convert
stringed times into integer timestamps and vice-versa, relieving all other
classes of this responsibility.
-
Static Method
- localizeDateTimeStringIntoEpoch public
- Static Method
- localizeEpochIntoString public
- Static Method
- getWpTimezoneSetting public
Field
Honor Field contract providing NF Field object methods
Provides functionality normally handled by the field object created by
\Ninja_Forms()->form()->get_field( $fieldId )
-
Method
- get_id public
- @inheritDoc Method
- get_tmp_id public
- @inheritDoc Method
- get_type public
- @inheritDoc Method
- get_setting public
- @inheritDoc Method
- get_settings public
- @inheritDoc Method
- update_setting public
- @inheritDoc Method
- update_settings public
- @inheritDoc Method
- delete public
- @inheritDoc Method
- find public
- @inheritDoc Method
- get_object_settings public
- @inheritDoc Method
- save public
- @inheritDoc Method
- _insert_row public
- @inheritDoc Method
- cache public
- @inheritDoc Method
- add_parent public
- @inheritDoc Static Method
- import public
- Static Method
- fromArray public
- Method
- __get public
-
Magic method getter for properties
Paramstring $nameReturnvoid
Method
- __set public
-
Magic method setter for properties
Paramstring $nameParammixed $value
NF_Handlers_FieldsetRepeater
Handles data of a FieldsetRepeater Fieldset repeater field data are stored as part of the single fieldset repeater field. This includes both settings and submission data. Since these data are not managed by NF standard data handling, this class manages it. Requests for a field can be made by either an (int) field id or a (string) field reference, which prior to fieldset repeaters had been for the field key only. Fieldset fields are stored as {fieldsetRepeaterFieldId}{fieldsetDelimiter}{fieldsetFieldId}{submissionIndexDelimiter}{submissionIndex} FieldSettings are passed into this class so that this class is not dependent on NF core
-
Method
- getFieldsetLabels public
-
Returns labels for the fieldset's fields keyed on id of each fieldset field
Paramstring $fieldId ID of the Fieldset Repeater fieldParamarray $fieldSettings Provided by (obj)$field->get_settings()Parambool $useAdminLabelsReturnarray
Method
- getFieldsetTypes public
-
Returns fieldsetField types keyed on fieldsetField ids
Paramstring $fieldId ID of the Fieldset Repeater fieldParamarray $fieldSettings Provided by (obj)$field->get_settings()Returnarray
Method
- isRepeaterFieldByFieldReference public
-
Given a field reference (ID or Key), return boolean for 'is repeater field'
Determines if the given field reference is a fieldset repeater construct.
This is NOT the parent field; this is a request for a child field within
the fieldset repeater. The field settings and values for such a field
are stored differently than a standard field, so we need to know how
to make requests for its settings/data.
For disambiguation, a fieldset repeater field
request for a specific field within the fieldset is in the form of:
{fieldsetFieldId}{fieldsetDelimiter}{submissionIndexDelimiter}
Paramint|string $fieldReference ID or key for the fieldReturnbool
Method
- isFieldsetData public
-
Determine if data matches fieldset repeater construct
When given only a submission value without any meta data, check the construct of the value to asssert with some level of confidence that the value is from a fieldset repeater.
Logic: - is submission empty? then NO, we don't assert is is fieldset repeater data - can the array key be parsed as a fieldset repeater key? If not, then NO... - is each value an array with 'id' and 'value' keys, and the `id` matches the id of its parent? If not, then NO...
If all the above conditions are met for every entry in the submission, we assert that the submission value is that of a fieldset repeater.Paramarray $submissionReturnboolean
Method
- parseSubmissionReference public
-
Parse field id, fieldset id, and submission index
Returns array of fieldId, fieldsetFieldId, submissionId If failing, fieldsetFieldId = -1Paramstring $referenceReturnarray
Method
- parseFieldsetFieldReference public
-
Given field reference, return field Id and fieldset field id
Fieldset field is a field within the fieldset repeater. The child's field
settings and its submission data are not stored individually in the
field or submission tables, but rather as nested data inside the
parent's keyed location.
Caller should ensure field is fieldset type before calling.
Paramstring $fieldReference
Returnarray Keys: 'fieldId', 'fieldsetFieldId'
Method
- parseSubmissionIndex public
-
Parses fieldsetFieldId and submissionIndex keys
Given string of expect fieldsetField and submissionIndex as a key under which submission data is stored, returns the fieldsetFieldId and submissionIndex id If cannot be parsed as expected, default values of -1 are returned to notify of failureParamstring $submissionIndexReturnarray
Method
- getFieldtype public
-
Returns field type of a field within a fieldset, given the field reference
Field reference is the id of the field WITHIN the fieldset. The fieldset
has a numerical field id under which all settings and submission values
are stored for any field within the fieldset. Access to that setting
and submission data are not handled by the standard core functions and
are done through this class.
Paramstring $fieldsetFieldId Fieldset Field referenceParamarray $fieldSettings Field settings (from (obj)$field->get_settings())Returnstring
Method
- extractSubmissionsByFieldsetField public
-
Extract all repeater submission values for a given fieldset field
Fieldset data is all stored within the main fieldset field. To prevent
every caller from having to know the internal structure of the stored
data, this method enables callers to provide the requested Fieldset
Field's reference id with the full submission data and receive in
return all the submitted values for that given field.
Paramstring $fieldsetFieldId Fieldset Field referenceParamarray $fieldSubmissionValue Submission data for entire fieldset
Method
- extractSubmissions public
-
Extract fieldset repeater submissions by submission index and fieldset
field
Unknown values can be passed as empty string or arrays; the method will fill in what it can and set default values for those it can'tToDoRefactor this method after unit testing is in place. It is being used to share a common structure for output but refactoring should wait until unit testing can ensure the data structure of responses don't change during refactor.
Paramstring $fieldIdParamarray $fieldSubmissionValue Submission data array for entire fieldParamarray $fieldSettings Field settings (from (obj)$field->get_settings())Returnarray Array of submission values
{submissionIndex}=> {fieldsetFieldId}=>['value'=>{submitted value} 'type'=> {field type}, 'label'=> {label} ]
NF_Handlers_LocaleNumberFormatting
-
Method
- __construct public
- Static Method
- create public
- Method
- locale_decode_number public
- Method
- locale_encode_number public
- Method
- locale_decode_equation public
SubmissionAggregate
Aggregates submissions from all provided data sources
Data sources include NF submissions stored as posts; may include pre-existing
Caldera Forms submissions
-
Method
- filterSubmissions public
-
Filter submissions to return a collection of SingleSubmission meta data only
Paramstring $formIdReturnarray
Method
- requestSingleSubmission public
-
Retrieve a single submission populated with submission/extra values
Also populates the submissionAggregate such that the aggregate can be passed for handling elsewhereParamSingleSubmission $singleSubmissionReturnSingleSubmission
Method
- requestSubmissionsByIds public
-
Retrieve a submissions by precise list of submissions IDs
ParamSubmissionFilter $submissionFilterReturnSubmissionFilter
Method
- getSubmissionValuesByAggregatedKey public
-
Retrieve submissionValues from submission at a given aggregated key
Paramstring $keyReturnSingleSubmissionSeeconstructUniqueAgreggatedSubmissionKey()
Method
- deleteSingleSubmission public
-
Delete a single submission
ParamSingleSubmission $singleSubmissionReturnSubmissionAggregate
Method
- restoreSingleSubmission public
-
Restore a single submission
ParamSingleSubmission $singleSubmissionReturnSubmissionAggregate
Method
- updateSingleSubmission public
-
Update a single submission
ParamSingleSubmission $singleSubmissionReturnSubmissionAggregate
Method
- constructFieldDefinitionCollection protected
-
Construct field definition collection from formId
Paramstring $formIdReturnvoid
Method
- getFieldsCollection protected
-
Return the Ninja Forms field collection
Paramstring $formIdReturnarray
Method
- constructUniqueAgreggatedSubmissionKey protected
-
Construct a unique aggregated submission key for each submission
Uses the dataSource's id plus the submission record id. Each submission is is unique within its dataSource, and each dataSource is unique, thus the combined string is unique
ParamSingleSubmission $singleSubmissionReturnstring
Method
- addDataSource public
-
Set collection of submission data sources
ParamSubmissionDataSource $dataSource Submission data source
ReturnSubmissionAggregate
Method
- getFieldDefinitionCollection public
-
Get collection of SubmissionFields
ReturnSubmissionField[]
Method
- getSubmissionCount public
-
Get submission count
Returninteger
Method
- getAggregatedSubmissions public
-
Get indexed collection of submissions meeting the filtering parameters
ReturnSingleSubmission[]
Method
- getMasterFormId public
-
Get fields and the data within the aggregate.
Returnstring
Method
- setAggregatedSubmissions public
-
Set keyed collection of submissions
This method enables re-setting the aggregated submissions after performing array methods on it. This is useful to get a subset of the collection without needing to re-filter and run DB requests
ParamArray $aggregatedSubmissions Keyed collection of submissions meeting the filtering parameters
Returnself
SubmissionAggregateCsvExportAdapter
Adapts SubmissionAggregate to provide data required by CSV Export
CSV Export requires specific structuring of submission data, too specialized
to be included in the SubmissionAggregate. This class structures submission
data as needed for CSV export
-
Method
- __construct public
-
Construct with SubmissionAggregate
Lookup array properties are not populated until the first request for either fieldTypes, label/adminLable, or fieldIds.
ParamSubmissionAggregate $submissionAggregate
Method
- getLabels public
-
Return array of field labels keyed on field keys
If hiddenFieldTypes array is set, labels filtered to hide those types
Parambool $useAdminLabels Optionally use admin_labelsReturnarray
Method
- getFieldTypes public
-
Return array of field types keyed on field keys
Returnarray
Method
- getFieldIds public
- Return array of field Ids keyed on field keys Method
- getSubmissionIds public
-
Return array of submission Ids in the collection
Generated at time of request to ensure it is up to date after last
query / construction
Returnarray
Method
- getColumnValuesByAggregatedKey public
-
Get column values for a given submission aggregated key
Paramstring $aggregatedKeyReturnarray
Method
- constructFieldLookups protected
-
Construct labels/adminLabels from submission aggregate
Returnvoid
Method
- extractSubmissionFieldData protected
-
Given submission field, extract labels + meta, or submission values
ParamSubmissionField $submissionFieldParamboolean|null $labelsOnlyReturnvoid
Method
- convertSubmissionFieldToNfField protected
-
Construct NF Field from SubmissionField
NF Field is needed to apply existing NF filters
ParamSubmissionField $submissionFieldReturnField
Method
- extractRepeaterFieldColumns protected
-
Extract repeater field column headers
ToDoEnable external setting of in-CSV delimiterToDo~L258 - adjust deconstructed value to handle listmultiselect arrays (other fields may also have arrays)ParamSubmissionField $submissionFieldReturnvoid
Method
- extractRepeaterFieldsFromSubmisionField protected
-
Extracts collection of SubmissionFields within a fieldset repeater
ParamSubmissionField $submissionFieldReturnSubmissionField[]
Method
- constructRepeaterFieldSettingsLookup protected
-
Construct lookup of field settings for fields within fieldset repeater field
ParamSubmissionField $submissionFieldReturnarray
Method
- getStringedValue protected
-
Ensure each repeater field value is a string
ParamSubmissionField $submissionFieldParamarray $deconstructedValueParamstring $repeatedValueDelimiterReturnstring
Method
- deconstructRepeaterFieldValue protected
-
Deconstruct repeater field array by repeated fields
ToDoAdd exception handling for unexpected key structureParamarray $constructedValueReturnarray
Method
- setFieldLabels protected
-
Add key value lookups for labels and admin labels
Paramstring $slugParamstring $labelParamstring $adminLabelReturnvoid
Method
- setFieldMetaData protected
-
Add key value lookups for Id and type on all fields in collection
This includes hidden fields and parent fieldset repeater fields
ParamSubmissionField $submissionFieldReturnvoid
Method
- setColumnValue protected
-
Set column value for a given field
Paramstring $keyParamstring $valueReturnvoid
Method
- filterRawValue protected
- Method
- setHiddenFieldTypes public
-
Set indexed array of field types to be omitted in output
Paramarray $hiddenFieldTypes Indexed array of field types to be omitted in output
ReturnSubmissionAggregateCsvExportAdapter
WPN_Helper
-
Static Method
- addslashes public
- Static Method
- utf8_encode public
- Static Method
- utf8_decode public
- Static Method
- json_cleanup public
- Static Method
- str_replace public
- Static Method
- html_entity_decode public
- Static Method
- htmlspecialchars public
- Static Method
- stripslashes public
- Static Method
- esc_html public
- Static Method
- kses_post public
- Static Method
- strip_tags public
- Static Method
- string_to_bytes public
- Static Method
- str_putcsv public
- Static Method
- get_query_string public
- Static Method
- sanitize_text_field public
- Static Method
- get_plugin_version public
- Static Method
- is_func_disabled public
- Static Method
- maybe_unserialize public
- Static Method
- get_nf_cache public
- Static Method
- update_nf_cache public
- Static Method
- get_stage public
- Static Method
- build_nf_cache public
- Static Method
- delete_nf_cache public
- Static Method
- parse_utf8_serialized private
- Static Method
- get_zuul public
- Static Method
- gated_release public
- Static Method
- form_in_maintenance public
- Static Method
- set_forms_maintenance_mode public
- Static Method
- use_cache public
- Static Method
- sanitize_classes public
- Static Method
- sanitize_string_setting_value public
- Static Method
- maybe_disallow_unfiltered_html_for_sanitization public
- Static Method
- maybe_disallow_unfiltered_html_for_escaping public
EDD_SL_Plugin_Updater
Allows plugins to use their own update API.
-
Method
- __construct public
-
Class constructor.
@uses plugin_basename() @uses hook()
Paramstring $_api_url The URL pointing to the custom API endpoint.Paramstring $_plugin_file Path to the plugin file.Paramarray $_api_data Optional data to send with API calls.
Method
- init public
-
Set up WordPress filters to hook into WP's update process.
@uses add_filter()
Returnvoid
Method
- check_update public
-
Check for Updates at the defined API endpoint and modify the update array.
This function dives into the update API just when WordPress creates its update array, then adds a custom API call and injects the custom plugin data retrieved from the API. It is reassembled from parts of the native WordPress plugin update code. See wp-includes/update.php line 121 for the original wp_update_plugins() function.
@uses api_request()
Paramarray $_transient_data Update array build by WordPress.Returnarray Modified update array with custom plugin data.
Method
- show_update_notification public
-
show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
Paramstring $fileParamarray $plugin
Method
- plugins_api_filter public
-
Updates information on the "View version x.x details" page with custom data.
@uses api_request()
Parammixed $_dataParamstring $_actionParamobject $_argsReturnobject $_data
Method
- convert_object_to_array private
-
Convert some objects to arrays when injecting data into the update API
Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON decoding, they are objects. This method allows us to pass in the object and return an associative array.
Since3.6.5
ParamstdClass $data
Returnarray
Method
- http_request_args public
-
Disable SSL verification in order to prevent download update failures
Paramarray $argsParamstring $urlReturnobject $array
Method
- api_request private
-
Calls the API and, if successfull, returns the object delivered by the API.
@uses get_bloginfo() @uses wp_remote_post() @uses is_wp_error()
Paramstring $_action The requested action.Paramarray $_data Parameters for the API action.Returnfalse|object
Method
- show_changelog public
- Method
- get_cached_version_info public
- Method
- set_version_info_cache public
- Method
- verify_ssl private
-
Returns if the SSL of the store should be verified.
Since1.6.13Returnbool
NF_Extension_Updater
This class handles all the update-related stuff for extensions, including adding a license section to the license tab.
It accepts two args: Product Name and Version.
-
Method
- __construct public
-
Constructor function
Since2.2.47 @updated 3.0Returnvoid
Method
- register /** * Function that adds the license entry fields to the license tab. * * @updated 3.0 * @param array $licenses * @return array $licenses */
- Method
- activate_license /* * * Function that activates our license * * @since 2.2.47 * @return void */
- Method
- show_license_error_notice public
- Method
- deactivate_license /* * * Function that deactivates our license if the user clicks the "Deactivate License" button. * * @since 2.2.47 * @return void */
- Method
- auto_update /** * Function that runs all of our auto-update functionality * * @since 2.2.47 * @updates 3.0 * @return void */
- Method
- maybe_prevent_install public
-
Function that maybe prevents a plugin update from installing if the php version is not high enough.
Since3.4.24Parambool $default falseParamarray $extra array sent by the filter we're using.Returnbool/WP_ERROR $default if we bail early, WP_ERROR if we don't.
Method
- maybe_prevent_update_notice public
-
Check to see if this plugin update has a minimum PHP version.
If it does, make sure that we meet it.
If we don't meet it, then show the user an error message with a link to WordPress.org's minimum requirements page.
Since3.4.24Paramstring $plugin_file plugin file for the row we're looking atParamarray $plugin_data update data from the WordPress plugin update checkParamstring $plugin_status is this plugin active, inactive, etc.Returnvoid
Method
- is_valid public
-
Return whether or not this license is valid.
AccesspublicSince2.9Returnbool
Method
- get_error public
-
Get any error messages for this license field.
AccesspublicSince2.9Returnstring $error
Method
- maybe_debug private
NF_LoadLegacy
Conditionally install and activate NF Legacy plugin
-
Method
- handle public
- Conditionally install and activate NF Legacy plugin Method
- installLegacy protected
-
Request WP installation of NF Legacy plugin from public repository
Returnvoid
Method
- checkLegacyActive protected
- Check if NF Legacy plugin is active Method
- checkPreviousAttempt protected
- Check if previously attempt to load has been made Method
- registerAttemptedInstallation protected
- Register that an attempt to install Legacy has been made
NF_LoadLegacy
-
Method
- wp_ajax_ninja_forms_sendwp_remote_install_handler
WP_Async_Request
-
Method
- __construct public
- Initiate new async request Method
- data public
-
Set data used during the request
Paramarray $data Data.
Return$this
Method
- dispatch public
-
Dispatch the async request
Returnarray|WP_Error
Method
- get_query_args protected
-
Get query args
Returnarray
Method
- get_query_url protected
-
Get query URL
Returnstring
Method
- get_post_args protected
-
Get post args
Returnarray
Method
- maybe_handle public
-
Maybe handle
Check for correct nonce and pass to handler.
Method
- handle protected
WP_Background_Process
-
Method
- __construct public
- Initiate new background process Method
- dispatch public
-
Dispatch
AccesspublicReturnvoid
Method
- push_to_queue public
-
Push to queue
Parammixed $data Data.
Return$this
Method
- save public
-
Save queue
Return$this
Method
- update public
-
Update queue
Paramstring $key Key.Paramarray $data Data.
Return$this
Method
- delete public
-
Delete queue
Paramstring $key Key.
Return$this
Method
- generate_key protected
-
Generate key
Generates a unique key based on microtime. Queue items are given a unique key so that they can be merged upon save.
Paramint $length Length.
Returnstring
Method
- maybe_handle public
-
Maybe process queue
Checks whether data exists within the queue and that the process is not already running.
Method
- is_queue_empty protected
-
Is queue empty
Returnbool
Method
- is_process_running protected
-
Is process running
Check whether the current process is already running in a background process.
Method
- lock_process protected
-
Lock process
Lock the process so that multiple instances can't run simultaneously. Override if applicable, but the duration should be greater than that defined in the time_exceeded() method.
Method
- unlock_process protected
-
Unlock process
Unlock the process so that other instances can spawn.
Return$this
Method
- get_batch protected
-
Get batch
ReturnstdClass Return the first batch from the queue
Method
- handle protected
-
Handle
Pass each queue item to the task handler, while remaining within server memory and time limit constraints.
Method
- memory_exceeded protected
-
Memory exceeded
Ensures the batch process never exceeds 90% of the maximum WordPress memory.
Returnbool
Method
- get_memory_limit protected
-
Get memory limit
Returnint
Method
- time_exceeded protected
-
Time exceeded.
Ensures the batch never exceeds a sensible time limit. A timeout limit of 30s is common on shared hosting.
Returnbool
Method
- complete protected
-
Complete.
Override if applicable, but ensure that the below actions are performed, or, call parent::complete().
Method
- schedule_cron_healthcheck public
-
Schedule cron healthcheck
AccesspublicParammixed $schedules Schedules.Returnmixed
Method
- handle_cron_healthcheck public
-
Handle cron healthcheck
Restart the background process if not already running and data exists in the queue.
Method
- schedule_event protected
- Schedule event Method
- clear_scheduled_event protected
- Clear scheduled event Method
- cancel_process public
-
Cancel Process
Stop processing queue items, clear cronjob and delete batch.
Method
- task protected
NF_EOS_Parser
Equation Operating System (EOS) Parser
An EOS that can safely parse equations from unknown sources returning
the calculated value of it. Can also handle solving equations with
variables, if the variables are defined (useful for the Graph creation
that the second and extended class in this file provides. {
-
Method
- __construct public
-
Construct method
Will initiate the class. If variable given, will assign to internal variable to solve with this::solveIF() without needing additional input. Initializing with a variable is not suggested.
SeeParser::solveIF()ParamString $inFix Standard format equation
Method
- checkInfix private
-
Check Infix for opening closing pair matches.
This function is meant to solely check to make sure every opening statement has a matching closing one, and throws an exception if it doesn't.
ParamString $infix Equation to checkThrowsException if malformed.ReturnBool true if passes - throws an exception if not.
Method
- in2post public
-
Infix to Postfix
Converts an infix (standard) equation to postfix (RPN) notation. Sets the internal variable $this->postFix for the Parser::solvePF() function to use.
Linkhttp://en.wikipedia.org/wiki/Infix_notation Infix NotationLinkhttp://en.wikipedia.org/wiki/Reverse_Polish_notation Reverse Polish NotationParamString $infix A standard notation equationThrowsException When parenthesis are mismatched.ReturnArray Fully formed RPN Stack
Method
- solvePF public
-
Solve Postfix (RPN)
This function will solve a RPN array. Default action is to solve the RPN array stored in the class from Parser::in2post(), can take an array input to solve as well, though default action is preferred.
Linkhttp://en.wikipedia.org/wiki/Reverse_Polish_notation Postix NotationParamArray $pfArray RPN formatted array. Optional.ThrowsException On division by zero.ReturnFloat Result of the operation.
Method
- solve public
- Method
- solveIF /** * Solve Infix (Standard) Notation Equation * * Will take a standard equation with optional variables and solve it. Variables * must begin with '&' or '$' * The variable array must be in the format of 'variable' => value. If * variable array is scalar (ie 5), all variables will be replaced with it. * * @param String $infix Standard Equation to solve * @param String|Array $vArray Variable replacement * @throws Exception On division by zero and on NaN and lack of variable replacement. * @return Float Solved equation */
- Method
- factorial protected
-
Solve factorial (!)
Will take any real positive number and solve for it's factorial. Eg. `5!` will become `1
2
3
4
5` = `120` For integers and 5.2! will become gamma(6.2) for non-integers DONE: Solve for non-integer factorials 2015/07/02
ParamFloat $num Non-negative real number to get factorial ofThrowsException if number is at or less than 0ReturnFloat Solved factorial
Method
- gamma public
-
Gamma Function
Because we can. This function exists as a catch-all for different numerical approx. of gamma if I decide to add any past Lanczos'. This method is public because a function doesn't currently exist within this parser to use it. That will change in the future.
Param$z Number to compute gamma fromReturnFloat The gamma (hopefully, I'll test it after writing the code)
Method
- laGamma protected
-
Lanczos Approximation
The Lanczos Approximation method of finding gamma values
Linkhttp://www.rskey.org/CMS/index.php/the-library/11Linkhttp://algolist.manual.ru/maths/count_fast/gamma_function.phpLinkhttps://en.wikipedia.org/wiki/Lanczos_approximationParamfloat $z Number to obtain the gamma ofReturnfloat Gamma of inputted numberThrowsException if Number is less than or equal to 0
NF_EOS_Stack
Basic Stack Class.
Created for use with eqEOS. May eventually be replaced with native
PHP functions `array_pop()`, `array_push()`, and `end()`
-
Method
- __construct public
-
Constructor
Initializes the stack
Method
- peek public
-
Peek
Will view the last element of the stack without removing it
ReturnMixed An element of the array or false if none exist
Method
- poke public
-
Poke
Will add an element to the end of the stack
ParamMixed $data Element to add
Method
- push public
-
Push
Alias of {SeeStack::poke()} Adds element to the stack
ParamMixed $data Element to add
Method
- pop public
-
Pop
Retrives an element from the end of the stack, and removes it from the stack at the same time. If no elements, returns boolean false
ReturnMixed Element at end of stack or false if none exist
Method
- clear public
-
Clear
Clears the stack to be reused.
Method
- getStack public
-
Get Stack
Returns the array of stack elements, keeping all, indexed at 0
ReturnMixed Array of stack elements or false if none exist.
Recursive_ArrayAccess
Recursive array class to allow multidimensional array access.
-
Method
- __construct protected
-
Default object constructor.
Paramarray $data
Method
- __clone public
- Allow deep copies of objects Method
- toArray public
-
Output the data container as a multidimensional array.
Returnarray
Method
- offsetExists public
-
Whether a offset exists
Linkhttp://php.net/manual/en/arrayaccess.offsetexists.php
Parammixed $offset An offset to check for.
Returnboolean true on success or false on failure.
Method
- offsetGet public
-
Offset to retrieve
Linkhttp://php.net/manual/en/arrayaccess.offsetget.php
Parammixed $offset The offset to retrieve.
Returnmixed Can return all value types.
Method
- offsetSet public
-
Offset to set
Linkhttp://php.net/manual/en/arrayaccess.offsetset.php
Parammixed $offset The offset to assign the value to.Parammixed $value The value to set.
Returnvoid
Method
- offsetUnset public
-
Offset to unset
Linkhttp://php.net/manual/en/arrayaccess.offsetunset.php
Parammixed $offset The offset to unset.
Returnvoid
WP_Session
-
Static Method
- get_instance public
- Method
- __construct protected
-
Default constructor.
Will rebuild the session collection from the given session ID if it exists. Otherwise, will
create a new session with that ID.
Param$session_id @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
Method
- set_expiration protected
-
Set both the expiration time and the expiration variant.
If the current time is below the variant, we don't update the session's expiration time. If it's greater than the variant, then we update the expiration time in the database. This prevents writing to the database on every page load for active sessions and only updates the expiration time if we're nearing when the session actually expires.
By default, the expiration time is set to 30 minutes. By default, the expiration variant is set to 24 minutes.
As a result, the session expiration time - at a maximum - will only be written to the database once every 24 minutes. After 30 minutes, the session will have been expired. No cookie will be sent by the browser, and the old session will be queued for deletion by the garbage collector.
@uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data. @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
Method
- set_cookie public
- Method
- generate_id protected
-
Generate a cryptographically strong unique ID for the session token.
Returnstring
Method
- is_valid_md5 protected
-
Checks if is valid md5 string
Paramstring $md5Returnint
Method
- read_data protected
-
Read data from a transient for the current session.
Automatically resets the expiration time for the session transient to some time in the future.
Returnarray
Method
- write_data public
- Write the data from the current session to the data storage system. Method
- json_out public
-
Output the current container contents as a JSON-encoded string.
Returnstring
Method
- json_in public
-
Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
Paramstring $data
Returnbool
Method
- regenerate_id public
-
Regenerate the current session's ID.
Parambool $delete_old Flag whether or not to delete the old session data from the server.
Method
- session_started public
-
Check if a session has been initialized.
Returnbool
Method
- cache_expiration public
-
Return the read-only cache expiration value.
Returnint
Method
- reset public
- Flushes all session variables. Method
- current public
-
Current position of the array.
Linkhttp://php.net/manual/en/iterator.current.php
Returnmixed
Method
- key public
-
Key of the current element.
Linkhttp://php.net/manual/en/iterator.key.php
Returnmixed
Method
- next public
-
Move the internal point of the container array to the next item
Linkhttp://php.net/manual/en/iterator.next.php
Returnvoid
Method
- rewind public
-
Rewind the internal point of the container array.
Linkhttp://php.net/manual/en/iterator.rewind.php
Returnvoid
Method
- valid public
-
Is the current key valid?
Linkhttp://php.net/manual/en/iterator.rewind.php
Returnbool
Method
- count public
-
Get the count of elements in the container array.
Linkhttp://php.net/manual/en/countable.count.php
Returnint
WP_Session
-
Method
- wp_session_cache_expire /** * Return the current cache expire setting. * * @return int */
- Method
- wp_session_commit /** * Alias of wp_session_write_close() */
- Method
- wp_session_decode /** * Load a JSON-encoded string into the current session. * * @param string $data */
- Method
- wp_session_encode /** * Encode the current session's data as a JSON string. * * @return string */
- Method
- wp_session_regenerate_id /** * Regenerate the session ID. * * @param bool $delete_old_session * * @return bool */
- Method
- wp_session_start /** * Start new or resume existing session. * * Resumes an existing session based on a value sent by the _wp_session cookie. * * @return bool */
- Method
- wp_session_status /** * Return the current session status. * * @return int */
- Method
- wp_session_unset /** * Unset all session variables. */
- Method
- wp_session_write_close /** * Write session data and end session */
- Method
- wp_session_cleanup /** * Clean up expired sessions by removing data and their expiration entries from * the WordPress options table. * * This method should never be called directly and should instead be triggered as part * of a scheduled task or cron job. */
- Method
- wp_session_register_garbage_collection /** * Register the garbage collector as a twice daily event. */
NF_Php_Version_Whip
-
Method
- __construct public
- NF_Whip constructor. Hooks into the WordPress admin notice system and calls our whip_message. @Since 3.2.19 Method
- whipMessage public
- Whip Message Builds and outputs our message. @Since 3.2.19 Method
- set_dismiss public
- Set Dismiss Sets a transient for 4 weeks out that will remove the whip notice. @Since 3.2.19
NF_MergeTags_Calcs
-
Method
- __construct public
- Method
- __call public
- Method
- set_merge_tags public
- Method
- get_calc_value public
- Method
- get_formatted_calc_value public
NF_MergeTags_Deprecated
-
Method
- __construct public
- Method
- post_id protected
- Method
- post_title protected
- Method
- post_url protected
- Method
- post_author protected
- Method
- post_author_email protected
- Method
- user_id protected
- Method
- user_first_name protected
- Method
- user_last_name protected
- Method
- user_display_name protected
- Method
- user_email protected
- Method
- admin_email protected
- Method
- site_title protected
- Method
- site_url protected
- Method
- system_date protected
- Method
- system_ip protected
NF_MergeTags_Fields
-
Method
- __construct public
- Method
- __call public
- Method
- include_all_fields_merge_tags public
- Helps process {all_fields_table} and {fields_table} This still requires to run add_field() for all fields in a submission before and after calling his function Method
- all_fields public
- Method
- all_fields_table public
- Method
- fields_table public
- Method
- all_field_plain public
- Method
- add_field public
- Method
- addRepeaterCalcValue protected
-
Generate repeater fieldset calc value based on the number of fieldsets filled by the user
Paramarray $field Array of field informationReturnint of the number of fieldsets used
Method
- addFieldsetRepeaterCallbacks protected
-
Generate fieldset-specific outputs
Paramarray $field Array of field informationParambool $sanitizeReturnvoid
Method
- generateFieldsetTableRows protected
-
Generate merge tag output for fieldset repeater table values
Paramarray $field Array of field informationReturnvoid
Method
- get_list_labels public
-
Get List Labels
Accepts a field loops over options, compares field values and returns the labels.
Since3.2.22
Param$field arrayReturnarray - label of the option.
Method
- add public
-
Add a callback value to the merge tags array
Keyed on callback string, contains an array with tag, value, optional
calc_value, sanitize boolean
Param$callbackParam$idParam$tagParam$valueParambool $calc_valueParambool $sanitize
Method
- set_form_id public
- Method
- maybe_sanitize public
- Method
- stripShortcodesMaybeFieldset protected
-
Strip shortcodes in value
Paramint|string $idParammixed $incoming Incoming valueReturnmixed
Method
- stripTagsMaybeFieldset protected
-
Strip tags in value
Paramint|string $idParammixed $incomingReturnmixed
Method
- determineFieldType protected
-
Determine the field type given a field id or key
Paramstring $idReturnstring
Method
- get_fields_sorted private
- Static Method
- sort_fields public
- Method
- calc_replace public
- Method
- pre_parse_calc_settings public
- Method
- force_field_calc_tags private
NF_MergeTags_Form
-
Method
- __construct public
- Method
- getSubSeq public
-
Returnmixed
Method
- setSubSeq public
-
Parammixed $sub_seq
Method
- get_form_id public
-
Getter method for the form_id.
Returnvoid
Method
- get_form_title public
-
Getter method for the form title.
Returnvoid
Method
- set_form_id public
-
Setter method for the form_id and callback for the nf_get_form_id action.
Since3.2.2
Paramstring $form_id The ID of the current form.Returnvoid
Method
- set_form_title public
-
Setter method for the form_title
Paramstring $form_title The title of the current form.Returnvoid
Method
- get_sub_count public
-
Gets a count of the form submissions and callback for the sub_count merge tag setting.
Since3.2.2
Returnarray|int Count of the form submissions.
NF_MergeTags_Other
-
Method
- __construct public
- Method
- replace public
- Method
- init public
- Method
- __call public
- Method
- set_merge_tags public
-
Assign a merge tag construct array to a key
Paramstring $keyParammixed $valueReturnvoid
Method
- system_date protected
- Method
- system_time protected
- Method
- user_ip protected
NF_MergeTags_System
-
Method
- __construct public
- Method
- admin_email protected
- Method
- site_title protected
- Method
- site_url protected
NF_MergeTags_WP
-
Method
- __construct public
- Method
- replace public
-
Custom replace() method for custom post meta or user meta.
Paramstring|array $subjectReturnstring
Method
- post_id protected
- Method
- post_title protected
- Method
- post_url protected
- Method
- post_author protected
- Method
- post_author_email protected
- Method
- user_id protected
- Method
- user_first_name protected
- Method
- user_last_name protected
- Method
- user_display_name protected
- Method
- user_username protected
- Method
- user_email protected
- Method
- user_url protected
- Method
- admin_email protected
- Method
- site_title protected
- Method
- site_url protected
NF_PromotionManager
-
Method
- __construct public
- Accepts a string of location to tell let us know where in the app we are sending promotions to. Then will return an array of promotions to run in the location. Method
- get_promotions public
- Method
- set_promotions private
- Set our promtions array to our promotions property. Method
- is_layout_styles_active private
- Method
- is_conditional_logic_active private
- Method
- is_multi_part_active private
- Method
- is_file_uploads_active private
- Method
- is_personal_active private
- Utilizes the helper methods above to determine if a a Membership is active on a site. Method
- maybe_remove_sendwp private
- Method
- maybe_remove_personal private
- Method
- remove_promotion private
-
Pass in a promotion type to have it removed from
the list of active promotions.
Returnvoid
Method
- sort_active_promotions_by_locations private
-
Sorts our promotions by where they will appear in app.
Returnvoid
Method
- is_sendwp_active private
- Method
- is_ninja_mail_active private
NF_Routes_Submissions
-
Method
- register_routes /** * Register REST API routes related to submissions actions * * @since 3.4.33 * * @route "ninja-forms-submissions/export" * @route 'ninja-forms-submissions/email-action" */
- Method
- get_submissions_permission_callback public
-
Secure endpoint to allow users to read submissions
Since3.5.8 Already passed Nonce validation via wp_rest and x_wp_nonce header checked against rest_cookie_check_errors()
Method
- delete_submissions_permission_callback public
-
Secure endpoint to allow users to delete submissions
Since3.5.8 Already passed Nonce validation via wp_rest and x_wp_nonce header checked against rest_cookie_check_errors()
Method
- update_submission_permission_callback public
-
Secure endpoint to allow users to update a submission
Since3.5.8 Already passed Nonce validation via wp_rest and x_wp_nonce header checked against rest_cookie_check_errors()
Method
- handle_extra_submission_permission_callback public
-
Secure endpoint to allow users to perform extra handling
Since3.5.8 Already passed Nonce validation via wp_rest and x_wp_nonce header checked against rest_cookie_check_errors()
Method
- permission_callback public
-
Secure endpoint to allowed users
Security disclosure regarding <=3.5.7 showed that any logged in user could export form data, possibly exposing personally identifiable information. Permissions changed such that only admin can export submission data; a filter enables one to override that permission if desired.Since3.4.33
Already passed Nonce validation via wp_rest and x_wp_nonce header checked against rest_cookie_check_errors()
Method
- bulk_export_submissions public
-
Bulk_export_submissions
Since3.4.33Returnarray of CSVs by form
Method
- download_all_submissions public
-
Download all submissions
Returnarray
Method
- delete_download_file public
-
Delete a file when provided valid file path
ParamWP_REST_Request $request Object with `file_path` propertyReturnvoid
Method
- trigger_email_action public
-
Trigger Email Action endpoint callback
Since3.4.33Returnbool|int depending on the value returned by wp_mail
Method
- process_merge_tags public
-
Process Merge tags for a given Value
Since3.4.33Returnobject of Email Action Model with merge tags settingsprocessed
Method
- get_submissions public
-
Get Submissions
Since3.5.8Returnarray of submissions for a Form
Method
- set_submissions_settings public
-
Save submissions interface settings
Data passes a json string
ParamWP_REST_Request $requestReturnvoid
Method
- get_submissions_settings public
-
Get submissions interface settings
ParamWP_REST_Request $requestReturnarray of settings
Method
- delete_submissions public
-
Request deletion of a collection of submissions
Data passes as a collection of single submission entities keyed under submissions {"submissions": SingleSubmission[]}
ParamWP_REST_Request $requestReturnvoid
Method
- restore_submissions public
-
Request restoration of a collection of submissions
Data passes as a collection of single submission entities keyed under submissions {"submissions": SingleSubmission[]}
ParamWP_REST_Request $requestReturnvoid
Method
- update_submission public
-
Request update of a single submission
Data passes as a single submission entity keyed under submission {"submission": SingleSubmission}
ParamWP_REST_Request $requestReturnvoid
Method
- handle_extra_submission public
-
Handle extra request for submissions
This is a starting proof of concept that triggers a download for the PDF submissions add-on Data passes as a single submission entity keyed under submission and a Class to call the handler under handleExtra key { "submission": SingleSubmission, "handleExtra": HandleExtraClassName }ParamWP_REST_Request $requestReturnobject with string of responseType, blob of PDF download and string of blobType
NF_Session
NF_Session Class
-
Method
- __construct public
-
Get things started
Defines our WP_Session constants, includes the necessary libraries and retrieves the WP Session instance
Since2.9.18
Method
- init public
-
Setup the WP_Session instance
AccesspublicSince2.9.18Returnvoid
Method
- get_id public
-
Retrieve session ID
AccesspublicSince2.9.18Returnstring Session ID
Method
- get public
-
Retrieve a session variable
AccesspublicSince2.9.18Paramstring $key Session keyReturnstring Session variable
Method
- set public
-
Set a session variable
Since2.9.18Paramstring $key Session keyParaminteger $value Session variableReturnstring Session variable
Method
- delete public
-
Delete a session variable
Since2.9.28Paramstring $keyReturnvoid
Method
- set_expiration_variant_time public
-
Force the cookie expiration variant time to 23 minutes
AccesspublicSince2.9.18Paramint $exp Default expiration (1 hour)Returnint
Method
- set_expiration_time public
-
Force the cookie expiration time to 24 minutes
AccesspublicSince2.9.18Paramint $exp Default expiration (1 hour)Returnint
NF_Telemetry_CountMetric
-
Method
- increment public
NF_Telemetry_MaxMetric
-
Method
- update public
NF_Telemetry_Metric
-
Method
- __construct public
- Method
- get public
- Method
- save public
NF_Telemetry_MetricFactory
-
Static Method
- create public
NF_Telemetry_MetricRepository
-
Method
- __construct public
- Method
- get public
- Method
- save public
NF_Telemetry_MetricRepository
-
Method
- get public
- Method
- save public
NF_Updates_CacheCollateActions
Class NF_Updates_CacheCollateActions This class manages the step process of running through the CacheCollateActions required update. It will define an object to pull data from (if necessary) to pick back up if exited early. It will run an upgrade function to alter the nf3_actions and nf3_action_meta tables. Then, it will step over each form on the site, following this process: - Actions that exist in the data tables but not in the cache will be deleted. - Actions that exist in the cache but not in the data tables will be inserted. - Actions that exist in the data tables but have an incorrect form ID will be inserted as a new ID and referenced from the cache. - Actions that exist in both will be updated from the cache to ensure the data is correct. After completing the above for every form on the site, it will remove the data object that manages its location.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- setup_vars private
-
Setup our global variables used in other methods.
Since3.4.0Returnvoid
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- end_of_step private
-
Check to see if we've locked processing.
If we have, then we need to run this process again.
If we haven't locked processing, prepare to end this process.Since3.4.0Returnvoid
Method
- update_form_cache private
-
If we've made any changes to our form actions, update our form cache to match.
Since3.4.0Returnvoid
Method
- maybe_update_actions private
-
Loop over all of our actions and update our database if necessary.
Check each setting against $this->blacklist to make sure we want to insert that value.
Since3.4.0Returnvoid
NF_Updates_CacheCollateCleanup
Class NF_Updates_CacheCollateCleanup This class manages the step process of running through the CacheCollateCleanup required update. It will define an object to pull data from (if necessary) to pick back up if exited early. It will then step over each table in our structure and ensure that orphan records are removed from storage. It will then step over all submissions, removing any orphans. It will then step over all submissions (by form), updating or removing any orphan field records. After completing the above for every form on the site, it will remove the data object that manages its location.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- get_total public
-
Function to get the number of objects in a table.
Param$table (String) The name of the target table.Return(Int) The count of rows.Since3.4.0
Method
- do_easy_delete private
-
Function to perform a simple, single-step delete of orphan data.
Since3.4.0 @updated 3.4.11
Method
- do_step_delete private
-
Function to perform a multi-step delete of orphan data.
Since3.4.0 @updated 3.4.11
Method
- uniquify private
-
Function called by array_filter to remove ALL duplicate results.
Param$v (Int) The number of results.Return(Boolean)Since3.4.0
Method
- adopt_subs private
-
Function to remove orphan submissions from the posts and postmeta tables.
Since3.4.0
Method
- adopt_fields private
-
Function to remove orphan field data that's still attached
to valid submissions from the postmeta table.
Since3.4.0
Method
- array_squash private
-
Function to compress our db results into a more useful format.
Param$data (Array) The result to be compressed.Return(Array) Associative if our data was complex. Non-associative if our data was a single item.Since3.4.0
NF_Updates_CacheCollateFields
Class NF_Updates_CacheCollateFields This class manages the step process of running through the CacheCollateFields required update. It will define an object to pull data from (if necessary) to pick back up if exited early. It will run an upgrade function to alter the nf3_fields and nf3_field_meta tables. Then, it will step over each form on the site, following this process: - Fields that exist in the data tables but not in the cache will be deleted. - Fields that exist in the cache but not in the data tables will be inserted. - Fields that exist in the data tables but have an incorrect form ID will be inserted as a new ID and referenced from the cache. - Fields that exist in both will be updated from the cache to ensure the data is correct. After completing the above for every form on the site, it will remove the data object that manages its location.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- maybe_delete_fields public
-
Function to delete unncessary items from our existing tables.
Param$items (Array) The list of ids to be deleted.Since3.4.0
Method
- setup_vars private
-
Most of the methods in this class use class vars to access and store data.
This method sets the initial state of these class vars. Class vars include: $form <- reference to the form currently being processed. $field_ids <- non-associatve array of field ids from the cache. $insert <- array that tracks what we should we insert because it exists in our cache but not in the Fields table. $submission_updates <- array that tracks fields that have had their id changed. $fields_by_id <- associative array of field ids from the cache, using the field id as the key.
If we are not running a form for the first time, we set class vars based on what we have been passed. After setting those class vars, we bail early. If we are running for the first time, set have to hit the database to get the information for class vars.
We need to compare the fields in our form cache to those in the fields table. Ultimately, we're trying to make sure that our fields table matches our form cache. Since we're treating the cache as the truth, we want to remove fields that don't exist in the cache. We also want to insert any fields that exist in the cache, but not in the fields table.
This method doesn't perform those operations, but it sets the class vars that the appropriate methods use to figure out what to add and remove.
Since3.4.0Returnvoid
Method
- maybe_insert_fields private
-
Our setup_vars method adds fields to the insert class var.
Any fields that are in this array need to be inserted into our database.
This is the first insert/update method to run, so it doesn't check lock_process. If the insert class var is empty, then we bail early.Since3.4.0Returnvoid
Method
- maybe_update_submissions private
-
If we have any duplicate field ids, we need to update any existing submissions with the new field ID.
The $this->submission_updates array will look like:
$this->submission_updates[ original_id ] = new_id;
This method: Checks to see if we have any fields in our $this->submission_updates array (have a changed ID) Makes sure that processing isn't locked Loops over fields in our $this->submission_updates array Fetches submission post meta for the specific form ID and _field_OLDID Uses a SQL UPDATE statement to replace _field_OLDID with _field_NEWIDSince3.4.0Returnvoid
Method
- maybe_update_fields private
-
If we still have field_ids in our class var, then we need to update the field table.
If lock_process is true or we have no field_ids, we bail early.Since3.4.0Returnvoid
Method
- update_form_cache private
-
If we've inserted any fields that have changed ids, we want to update those ids in our cache.
This method grabs the cache, updates any field ids, then updates the cache.
Since3.4.0Returnvoid
Method
- end_of_step private
-
After we've done our processing, but before we get to step cleanup, we need to store process information.
This method updates our form class var so that it can be passed to the next step. If we've completed this step, it calls the cleanup method.Since3.4.0Returnvoid
NF_Updates_CacheCollateForms
Class NF_Updates_CacheCollateForms This class manages the step process of running through the CacheCollateForms required update. It will define an object to pull data from (if necessary) to pick back up if exited early. It will run an upgrade function to alter the nf3_forms and nf3_form_meta tables. Then, it will step over each form on the site, following this process: - New columns in the nf3_forms table will be populated with data from the cache. - New and existing columns in the nf3_form_meta tables will be populated from the cache. - A new record of the cache will be saved to the nf3_upgrades table (if it does not already exist). After completing the above for every form on the site, it will remove the data object that manages its location.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- end_of_step private
-
Since3.4.0Returnvoid
Method
- update_form private
-
Update our form table for the current form.
We have new table columns, so we want to make sure that those are populated properly.
Also checks meta values against our $this->blacklist.Since3.4.0 @updated 3.4.4Return[type] [description]
NF_Updates_CacheCollateObjects
Class NF_Updates_CacheCollateForms This class manages the step process of running through the CacheCollateObjects required update. It will define an object to pull data from (if necessary) to pick back up if exited early. It will run an upgrade function to alter the nf3_objects and nf3_object_meta tables. Then, it will step over each object in the db, following this process: - Append the object_title Then, it will step over each object_meta in the db, following this process: - Copy over the meta_key - Append the meta_value After completing the above for every form on the site, it will remove the data object that manages its location.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- maybe_update_objects private
-
Function to manage the updating of our objects table.
ReturnVoidSince3.4.0
Method
- maybe_update_object_meta private
-
Function to manage the updating of our object_meta table.
ReturnVoidSince3.4.0
NF_Updates_CacheFieldReconcilliation
Class NF_Updates_CacheFieldReconcilliation This allows us to make sure that the data being saved to the database is in the fields table.
-
Method
- __construct public
-
Constructor
Param$data (Array) The data object passed in by the AJAX call.Param$running (Array) The array of required updates being run.Since3.4.0
Method
- process public
-
Function to loop over the batch.
Since3.4.0
Method
- startup public
-
Function to run any setup steps necessary to begin processing.
Since3.4.0
Method
- get_fields_this_step public
- Method
- update_fields public
- Update field table records with data from field meta Method
- get_field_meta public
- Get meta data to use for updating Method
- get_field_meta_query public
- Construct the query to get meta data return String $meta_query Method
- format_field_meta public
-
Format the data into format that helps us construct the insert/update query
ParamArray $metadataReturnArray $meta_data
Method
- get_update_query public
- Construct field update query Method
- cleanup public
-
Function to cleanup any lingering temporary elements of a required update after completion.
Since3.4.0
Method
- end_of_step private
-
After we've done our processing, but before we get to step cleanup, we need to store process information.
This method updates our form class var so that it can be passed to the next step. If we've completed this step, it calls the cleanup method.Since3.4.0Returnvoid
Method
- array_squash private
-
Function to compress our db results into a more useful format.
Param$data (Array) The result to be compressed.Return(Array) Associative if our data was complex. Non-associative if our data was a single item.SinceUPDATE_VERSION_ON_MERGE
NF_WPCLI_NinjaFormsCommand
The Ninja Forms WP-CLI Command
-
Method
- info /** * Display Ninja Forms Information * * @subcommand info */
- Method
- create_form public
-
Creates a Form
## OPTIONS
: The form title.
## EXAMPLES
wp ninja-forms form "My New Form"
@synopsis@subcommand form @alias create-form
Method
- list_forms public
- @subcommand list @alias list-forms Method
- get_form public
-
@synopsis
@subcommand get @alias get-form
Method
- mock public
- Installs mock form data Method
- peeking_ninja private
NF_Widget
Adds Ninja Forms widget.
-
Method
- __construct public
- Register widget with WordPress. Method
- widget public
-
Front-end display of widget.
SeeWP_Widget::widget()
Paramarray $args Widget arguments.Paramarray $instance Saved values from database.
Method
- update public
-
Sanitize widget form values as they are saved.
SeeWP_Widget::update()
Paramarray $new_instance Values just sent to be saved.Paramarray $old_instance Previously saved values from database.
Returnarray Updated safe values to be saved.
Method
- form public
-
Back-end widget form.
SeeWP_Widget::form()
Paramarray $instance Previously saved values from database.
Method
- NF_register_widgets /** * Register NF widget * * @see 'widgets_init' */
NF_Widget
-
Method
- ninja_forms_display_form /* |-------------------------------------------------------------------------- | Deprecated Functions |-------------------------------------------------------------------------- */
- Method
- ninja_forms_get_fields_by_form_id
- Method
- ninja_forms_get_all_forms /** * Included for backwards compatibility with Visual Composer. */
- Method
- nf_is_func_disabled
- Method
- _nf_get_actions
- Method
- _nf_post_actions
- Method
- _nf_removed_hooks // add_action( 'shutdown', '_nf_removed_hooks' );
- Method
- ninja_forms_get_form_by_id
NF_Conversion_Calculations
-
Method
- __construct public
- Method
- run public
- Method
- reduce_operations private
- Method
- reduce_auto_total private
- Method
- merge_tag private
- Method
- set_tax private
-
Sets a float formatted tax rate.
Paramstring|int|float $tax
Returnfloat|int
Method
- ninja_forms_conversion_calculations
NF_AddonChecker
-
Method
- __construct public
- Method
- check_plugins public
- Method
- deactivation_notice public
NF_AddonChecker
-
Method
- run public
NF_ExceptionHandlerJS
-
Method
- __construct public
- Method
- wp_head public
NF_Tracking
-
Method
- __construct public
- NF_Tracking constructor. Method
- maybe_opt_in public
-
Check if an opt in/out action should be performed.
Accesspublic @hook admin_init
Method
- report_optin /** * Report that a user has opted-in. * * @param array $data Dispatch event data. */
- Method
- can_opt_in private
-
Check if the current user is allowed to opt in on behalf of a site
Returnbool
Method
- is_opted_in public
-
Check if a site is opted in
AccesspublicReturnbool
Method
- opt_in public
-
Opt In a site for tracking
AccessprivateReturnnull
Method
- is_opted_out public
-
Check if a site is opted out
AccesspublicReturnbool
Method
- opt_out private
-
Opt Out a site from tracking
AccessprivateReturnnull
Method
- check_setting public
- Method
- update_setting public
NF_Tracking
-
Method
- ninja_forms_ajax_migrate_database
- Method
- ninja_forms_ajax_import_form
- Method
- ninja_forms_ajax_import_fields
NF_VersionSwitcher
-
Method
- __construct public
- Method
- ajax_check public
- Method
- version_bypass_check public
- Method
- listener public
- Method
- admin_bar_menu public
- Method
- rollback_activation public
- Method
- upgrade_complete_notice public
NF_VersionSwitcher
-
Method
- nf_register_step_processing_page /** * Register our step processing admin page. * * @since 2.7.6 * @return void */
- Method
- nf_step_processing_css /** * Enqueue our step processing CSS. * * @since 2.7.6 * @return void */
- Method
- nf_step_processing_js /** * Enqueue our step processing JS. * * @since 2.7.6 * @return void */
- Method
- nf_output_step_processing_page /** * Output our step processing admin page. * * @since 2.7.6 * @return void */
NF_Step_Processing
Class for performing actions incrementally. Internally used for converting submissions, exporting submissions, etc.
Very useful when interacting with large amounts of data.
-
Method
- __construct /** * Get things rolling * * @since 2.7.4 * @return void */
- Method
- processing public
-
Process our request.
Call the appropriate loading or step functions.
Since2.7.6Returnvoid
Method
- loading public
-
Run our loading process.
This function should be overwritten in child classes.
Since2.7.4Returnarray $args
Method
- step public
-
This function is called for every step.
This function should be overwritten in child classes.
Since2.7.4Returnarray $args
Method
- complete public
-
This function is called for every step.
This function should be overwritten in child classes.
Since2.7.4Returnarray $args
NF_Step_Processing
-
Method
- ninja_forms_three_table_exists
Ninja_Forms
-
Static Method
- instance public
- Method
- init public
- Method
- flush_rewrite_rules public
- Method
- register_rewrite_rules public
- Method
- admin_init public
- Method
- maybe_load_public_form
- Method
- nf_plugin_add_suggested_privacy_content /** * Privacy policy suggested content for Ninja Forms */
- Method
- plugin_get_default_privacy_content /** * Return the default suggested privacy policy content. * * @return string The default policy content. */
- Method
- nf_php_version_whip_notice public
-
NF PHP Version Whip Notice
If the user is on a version below PHP 7.2 then we get an instance of the
NF PHP Version Whip class which will add a non-dismissible admin notice.
ReturnNF_Php_Version_Whip
Method
- nf_do_telemetry public
- Function to launch our various telemetry calls on admin_init. Method
- maybe_hide_dashboard_items public
- Method
- scrub_available_actions public
- Method
- nf_run_promotion_manager public
-
Call back function for the promo manager cron.
Grabs a fresh copy of the promotions and stores them in an option.
Returnvoid
Method
- nf_bust_promotion_cache_on_plugin_activation public
-
Listens for plugin activation and runs check to see if any
promotions need to be added or removed.
Returnvoid
Method
- get_promotion_addons_lookup_table public
-
Build a look up table for the add-ons that have promotions.
TODO: maybe come up with a better name for this class.
Returnarray of promotions.
Method
- nf_maybe_bust_promotion_cache public
-
Loops over our add-ons that have promotions and
runs the promotion manager class.
Returnvoid
Method
- admin_notices public
- Method
- plugins_loaded public
- Method
- autoloader public
-
Autoloader
Autoload Ninja Forms classes
Param$class_name
Method
- form public
-
Form Model Factory Wrapper
Param$idReturnNF_Abstracts_ModelFactory
Method
- logger public
-
Logger Class Wrapper
Example Use: Ninja_Forms()->logger()->log( 'debug', "Hello, {name}!", array( 'name' => 'world' ) ); Ninja_Forms()->logger()->debug( "Hello, {name}!", array( 'name' => 'world' ) );
Returnstring
Method
- dispatcher public
- Method
- eos public
- Method
- session public
- Method
- request public
- Method
- background_process public
- Method
- get_setting public
-
Get a setting
Paramstring $keyParambool|false $defaultReturnbool
Method
- get_settings public
-
Get all the settings
Returnarray
Method
- update_setting public
-
Update a setting
Paramstring $keyParammixed $valueParambool|false $defer_update Defer the database update of all settings
Method
- update_settings public
-
Save settings to database
Paramarray $settings
Method
- display public
-
Display Wrapper
Param$form_id
Method
- sort_actions private
- Static Method
- load_classes private
- Static Method
- template public
- Static Method
- config public
- Method
- activation public
- Activation Static Method
- deprecated_notice public
- Method
- remove_completed_updates public
-
Function to deregister already completed updates from the list of required updates.
Since3.3.14
Param$updates (Array) Our array of required updates.Return$updates (Array) Our array of required updates.
Method
- remove_bad_updates public
-
Function to deregister updates that have required updates that either
don't exist, or are malformed
SinceUPDATE_TO_LATEST version
Param$updates (Array) Our array of required updates.Return$updates (Array) Our array of required updates.
Method
- Ninja_Forms /** * The main function responsible for returning The Highlander Ninja_Forms * Instance to functions everywhere. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: <?php $nf = Ninja_Forms(); ?> * * @since 2.7 * @return Ninja_Forms Highlander Instance */
- Method
- ninja_forms_uninstall
- Method
- nf_optin_update_environment_vars // Scheduled Action Hook
- Method
- nf_custom_cron_job_recurrence /** * Function to register our Custom Cron Recurrences. * * @param $schedules (Array) The available cron recurrences. * @return (Array) The filtered cron recurrences. * * @since * @updated 3.3.17 */
- Method
- nf_optin_send_admin_email_cron_job // Schedule Cron Job Event
- Method
- nf_update_marketing_feed /** * Function called via weekly wp_cron to update our marketing feeds. * * @since 3.3.17 */
- Method
- nf_marketing_feed_cron_job /** * Function called by our marketing feed cron. * * @since 3.3.17 */
OAuth
-
Static Method
- getInstance public
- Static Method
- set_base_url public
- Method
- __construct protected
- Method
- setup public
- Static Method
- is_connected public
- Static Method
- get_client_id public
- Static Method
- get_client_secret public
- Static Method
- connect_url public
- Method
- connect public
- Method
- disconnect public
- Static Method
- generate_secret public
Remote_Installer_Skin
A blank plugin installer skin.
-
Method
- error public
- Method
- get_errors public
- Method
- feedback public
- Method
- before public
- Method
- after public
AcceptanceTester
Inherited Methods
@method void wantToTest($text)
@method void wantTo($text)
@method void execute($callable)
@method void expectTo($prediction)
@method void expect($prediction)
@method void amGoingTo($argumentation)
@method void am($role)
@method void lookForwardTo($achieveValue)
@method void comment($description)
@method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
@SuppressWarnings(PHPMD)
FunctionalTester
Inherited Methods
@method void wantToTest($text)
@method void wantTo($text)
@method void execute($callable)
@method void expectTo($prediction)
@method void expect($prediction)
@method void amGoingTo($argumentation)
@method void am($role)
@method void lookForwardTo($achieveValue)
@method void comment($description)
@method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
@SuppressWarnings(PHPMD)
Acceptance
-
Method
- nfHideUpdates public
Functional
Unit
UnitTester
Inherited Methods
@method void wantToTest($text)
@method void wantTo($text)
@method void execute($callable)
@method void expectTo($prediction)
@method void expect($prediction)
@method void amGoingTo($argumentation)
@method void am($role)
@method void lookForwardTo($achieveValue)
@method void comment($description)
@method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
@SuppressWarnings(PHPMD)
UnitTester
-
Method
- getScenario protected
- Method
- nfHideUpdates public
-
[!] Method is generated. Documentation taken from corresponding module.
See\Helper\Acceptance::nfHideUpdates()
Method
- getPluginsFolder public
-
[!] Method is generated. Documentation taken from corresponding module.
Returns the absolute path to the plugins directory.
The value will first look at the `WP_PLUGIN_DIR` constant, then the `pluginsFolder` configuration parameter and will, finally, look in the default path from the WordPress root directory.
@example ```php $plugins = $this->getPluginsFolder(); $hello = $this->getPluginsFolder('hello.php'); ```
Paramstring $path A relative path to append to te plugins directory absolute path.
Returnstring The absolute path to the `pluginsFolder` path or the same with a relative path appended if `$path` is provided.
ThrowsModuleConfigException If the path to the plugins folder does not exist.See\Codeception\Module\WPLoader::getPluginsFolder()
Method
- factory public
-
[!] Method is generated. Documentation taken from corresponding module.
Accessor method to get the object storing the factories for things. This methods gives access to the same factories provided by the [Core test suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/).
ReturnFactoryStore A factory store, proxy to get hold of the Core suite object factories.
@example ```php $postId = $I->factory()->post->create(); $userId = $I->factory()->user->create(['role' => 'administrator']); ```
Linkhttps://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/See\Codeception\Module\WPLoader::factory()
Method
- getContentFolder public
-
[!] Method is generated. Documentation taken from corresponding module.
Returns the absolute path to the WordPress content directory.
@example ```php $content = $this->getContentFolder(); $themes = $this->getContentFolder('themes'); $twentytwenty = $this->getContentFolder('themes/twentytwenty'); ```
Paramstring $path An optional path to append to the content directory absolute path.
Returnstring The content directory absolute path, or a path in it.
ThrowsModuleConfigException If the path to the content directory cannot be resolved.See\Codeception\Module\WPLoader::getContentFolder()
Method
- startWpFiltersDebug public
-
[!] Method is generated. Documentation taken from corresponding module.
Starts the debug of all WordPress filters and actions.
The method hook on `all` filters and actions to debug their value.
@example ```php // Start debugging all WordPress filters and action final and initial values. $this->startWpFiltersDebug();
// Run some code firing filters and debug them.
// Stop debugging all WordPress filters and action final and initial values. $this->stopWpFiltersDebug(); ```
Paramcallable|null $format A callback function to format the arguments debug output; the callback will receive the array of arguments as input.
ReturnvoidSee\Codeception\Module\WPLoader::startWpFiltersDebug()
Method
- stopWpFiltersDebug public
-
[!] Method is generated. Documentation taken from corresponding module.
Stops the debug of all WordPress filters and actions.
@example ```php // Start debugging all WordPress filters and action final and initial values. $this->startWpFiltersDebug();
// Run some code firing filters and debug them.
// Stop debugging all WordPress filters and action final and initial values. $this->stopWpFiltersDebug(); ```
ReturnvoidSee\Codeception\Module\WPLoader::stopWpFiltersDebug()
Method
- debugWpFilterInitial public
-
[!] Method is generated. Documentation taken from corresponding module.
Debugs a single WordPress filter initial call using Codeception debug functions.
The output will show following the selected output verbosity (`--debug` and `-vvv` CLI options).
@example ```php // Start debugging all WordPress filters initial value. add_filter('all', [$this,'debugWpFilterInitial']);
// Run some code firing filters and debug them.
// Stop debugging all WordPress filters initial value. remove_filter('all', [$this,'debugWpFilterInitial']); ```
Parammixed ...$args The filter call arguments.
Returnmixed The filter input value, unchanged.See\Codeception\Module\WPLoader::debugWpFilterInitial()
Method
- debugWpFilterFinal public
-
[!] Method is generated. Documentation taken from corresponding module.
Debugs a single WordPress filter final call using Codeception debug functions.
The output will show following the selected output verbosity (`--debug` and `-vvv` CLI options).
@example ```php // Start debugging all WordPress filters final value. add_filter('all', [$this,'debugWpFilterFinal']);
// Run some code firing filters and debug them.
// Stop debugging all WordPress filters final value. remove_filter('all', [$this,'debugWpFilterFinal']); ```
Parammixed ...$args The filter call arguments.
Returnmixed The filter input value, unchanged.See\Codeception\Module\WPLoader::debugWpFilterFinal()
Method
- debugWpActionInitial public
-
[!] Method is generated. Documentation taken from corresponding module.
Debugs a single WordPress action initial call using Codeception debug functions.
The output will show following the selected output verbosity (`--debug` and `-vvv` CLI options).
@example ```php // Start debugging all WordPress actions initial value. add_action('all', [$this,'debugWpActionInitial']);
// Run some code firing actions and debug them.
// Stop debugging all WordPress actions initial value. remove_action('all', [$this,'debugWpActionInitial']); ```
Parammixed ...$args The action call arguments.
ReturnvoidSee\Codeception\Module\WPLoader::debugWpActionInitial()
Method
- debugWpActionFinal public
-
[!] Method is generated. Documentation taken from corresponding module.
Debugs a single WordPress action final call using Codeception debug functions.
The output will show following the selected output verbosity (`--debug` and `-vvv` CLI options).
@example ```php // Start debugging all WordPress actions final value. add_action('all', [$this,'debugWpActionFinal']);
// Run some code firing actions and debug them.
// Stop debugging all WordPress actions final value. remove_action('all', [$this,'debugWpActionFinal']); ```
Parammixed ...$args The action call arguments.
ReturnvoidSee\Codeception\Module\WPLoader::debugWpActionFinal()
Method
- loginAsAdmin public
-
[!] Method is generated. Documentation taken from corresponding module.
Login as the administrator user using the credentials specified in the module configuration.
The method will
not
follow redirection, after the login, to any page.
@example ```php $I->loginAsAdmin(); $I->amOnAdminPage('/'); $I->see('Dashboard'); ```
Paramint $timeout The max time, in seconds, to try to login.Paramint $maxAttempts The max number of attempts to try to login.
Returnvoid
ThrowsModuleException If all the attempts of obtaining the cookie fail.See\Codeception\Module\WPWebDriver::loginAsAdmin()
Method
- loginAs public
-
[!] Method is generated. Documentation taken from corresponding module.
Login as the specified user.
The method will
not
follow redirection, after the login, to any page. Depending on the driven browser the login might be "too fast" and the server might have not replied with valid cookies yet; in that case the method will re-attempt the login to obtain the cookies.
@example ```php $I->loginAs('user', 'password'); $I->amOnAdminPage('/'); $I->see('Dashboard'); ```
Paramstring $username The user login name.Paramstring $password The user password in plain text.Paramint $timeout The max time, in seconds, to try to login.Paramint $maxAttempts The max number of attempts to try to login.
ThrowsModuleException If all the attempts of obtaining the cookie fail.
ReturnvoidSee\Codeception\Module\WPWebDriver::loginAs()
Method
- grabCookiesWithPattern public
-
[!] Method is generated. Documentation taken from corresponding module.
Returns all the cookies whose name matches a regex pattern.
@example ```php $I->loginAs('customer','password'); $I->amOnPage('/shop'); $cartCookies = $I->grabCookiesWithPattern("#^shop_cart\\.
#"); ```
Paramstring $cookiePattern The regular expression pattern to use for the matching.
Returnarray|null An array of cookies matching the pattern. See\Codeception\Module\WPWebDriver::grabCookiesWithPattern()
Method
- waitForJqueryAjax public
-
[!] Method is generated. Documentation taken from corresponding module.
Waits for any jQuery triggered AJAX request to be resolved.
@example ```php $I->amOnPage('/triggering-ajax-requests'); $I->waitForJqueryAjax(); $I->see('From AJAX'); ```
Paramint $time The max time to wait for AJAX requests to complete.
ReturnvoidSee\Codeception\Module\WPWebDriver::waitForJqueryAjax()
Method
- grabFullUrl public
-
[!] Method is generated. Documentation taken from corresponding module.
Grabs the current page full URL including the query vars.
@example ```php $today = date('Y-m-d'); $I->amOnPage('/concerts?date=' . $today); $I->assertRegExp('#\\/concerts$#', $I->grabFullUrl()); ```
Returnstring The full page URL.See\Codeception\Module\WPWebDriver::grabFullUrl()
Method
- deactivatePlugin public
-
[!] Method is generated. Documentation taken from corresponding module.
In the plugin administration screen deactivate a plugin clicking the "Deactivate" link.
The method will
not
handle authentication and navigation to the plugins administration page.
@example ```php // Deactivate one plugin. $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->deactivatePlugin('hello-dolly'); // Deactivate a list of plugins. $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->deactivatePlugin(['hello-dolly', 'my-plugin']); ```
Paramstring|array$pluginSlug The plugin slug, like "hello-dolly", or a list of plugin slugs.
ReturnvoidSee\Codeception\Module\WPWebDriver::deactivatePlugin()
Method
- activatePlugin public
-
[!] Method is generated. Documentation taken from corresponding module.
In the plugin administration screen activates one or more plugins clicking the "Activate" link.
The method will
not
handle authentication and navigation to the plugins administration page.
@example ```php // Activate a plugin. $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->activatePlugin('hello-dolly'); // Activate a list of plugins. $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->activatePlugin(['hello-dolly','another-plugin']); ```
Paramstring|array$pluginSlug The plugin slug, like "hello-dolly" or a list of plugin slugs.
ReturnvoidSee\Codeception\Module\WPWebDriver::activatePlugin()
Method
- debugWebDriverLogs public
-
[!] Method is generated. Documentation taken from corresponding module.
Print out latest Selenium Logs in debug mode
Param\Codeception\TestInterface $testSee\Codeception\Module\WebDriver::debugWebDriverLogs()
Method
- amOnSubdomain public
-
[!] Method is generated. Documentation taken from corresponding module.
Changes the subdomain for the 'url' configuration parameter. Does not open a page; use `amOnPage` for that.
``` php $I->amOnSubdomain('user'); $I->amOnPage('/'); // moves to http://user.mysite.com/ ?> ```
Param$subdomain
ReturnmixedSee\Codeception\Module\WebDriver::amOnSubdomain()
Method
- makeScreenshot public
-
[!] Method is generated. Documentation taken from corresponding module.
Takes a screenshot of the current window and saves it to `tests/_output/debug`.
``` php amOnPage('/user/edit'); $I->makeScreenshot('edit_page'); // saved to: tests/_output/debug/edit_page.png $I->makeScreenshot(); // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png ```
Param$nameSee\Codeception\Module\WebDriver::makeScreenshot()
Method
- makeElementScreenshot public
-
[!] Method is generated. Documentation taken from corresponding module.
Takes a screenshot of an element of the current window and saves it to `tests/_output/debug`.
``` php amOnPage('/user/edit'); $I->makeElementScreenshot('#dialog', 'edit_page'); // saved to: tests/_output/debug/edit_page.png $I->makeElementScreenshot('#dialog'); // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.png ```
Param$nameSee\Codeception\Module\WebDriver::makeElementScreenshot()
Method
- makeHtmlSnapshot public
-
[!] Method is generated. Documentation taken from corresponding module.
Use this method within an [interactive pause](https://codeception.com/docs/02-GettingStarted#Interactive-Pause) to save the HTML source code of the current page.
```php makeHtmlSnapshot('edit_page'); // saved to: tests/_output/debug/edit_page.html $I->makeHtmlSnapshot(); // saved to: tests/_output/debug/2017-05-26_14-24-11_4b3403665fea6.html ```
Paramnull $nameSee\Codeception\Module\WebDriver::makeHtmlSnapshot()
Method
- resizeWindow public
-
[!] Method is generated. Documentation taken from corresponding module.
Resize the current window.
``` php resizeWindow(800, 600);
```
Paramint $widthParamint $heightSee\Codeception\Module\WebDriver::resizeWindow()
Method
- seeCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that a cookie with the given name is set. You can set additional cookie params like `domain`, `path` as array passed in last argument.
``` php seeCookie('PHPSESSID'); ?> ```
Param$cookieParamarray $paramsReturnmixedSee\Codeception\Module\WebDriver::seeCookie()
Method
- canSeeCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
[!] Conditional Assertion: Test won't be stopped on fail Checks that a cookie with the given name is set. You can set additional cookie params like `domain`, `path` as array passed in last argument.
``` php seeCookie('PHPSESSID'); ?> ```
Param$cookieParamarray $paramsReturnmixedSee\Codeception\Module\WebDriver::seeCookie()
Method
- dontSeeCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that there isn't a cookie with the given name. You can set additional cookie params like `domain`, `path` as array passed in last argument.
Param$cookie
Paramarray $paramsReturnmixedSee\Codeception\Module\WebDriver::dontSeeCookie()
Method
- cantSeeCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
[!] Conditional Assertion: Test won't be stopped on fail Checks that there isn't a cookie with the given name. You can set additional cookie params like `domain`, `path` as array passed in last argument.
Param$cookie
Paramarray $paramsReturnmixedSee\Codeception\Module\WebDriver::dontSeeCookie()
Method
- setCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
Sets a cookie with the given name and value. You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
``` php setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3'); ?> ```
Param$nameParam$valParamarray $params
ReturnmixedSee\Codeception\Module\WebDriver::setCookie()
Method
- resetCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
Unsets cookie with the given name. You can set additional cookie params like `domain`, `path` in array passed as last argument.
Param$cookie
Paramarray $paramsReturnmixedSee\Codeception\Module\WebDriver::resetCookie()
Method
- grabCookie public
-
[!] Method is generated. Documentation taken from corresponding module.
Grabs a cookie value. You can set additional cookie params like `domain`, `path` in array passed as last argument. If the cookie is set by an ajax request (XMLHttpRequest), there might be some delay caused by the browser, so try `$I->wait(0.1)`.
Param$cookie
Paramarray $paramsReturnmixedSee\Codeception\Module\WebDriver::grabCookie()
Method
- grabPageSource public
-
[!] Method is generated. Documentation taken from corresponding module.
Grabs current page source code.
ThrowsModuleException if no page was opened.
Returnstring Current page source code.See\Codeception\Module\WebDriver::grabPageSource()
Method
- amOnUrl public
-
[!] Method is generated. Documentation taken from corresponding module.
Open web page at the given absolute URL and sets its hostname as the base host.
``` php amOnUrl('http://codeception.com'); $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart ?> ```See\Codeception\Module\WebDriver::amOnUrl()
Method
- amOnPage public
-
[!] Method is generated. Documentation taken from corresponding module.
Opens the page for the given relative URI.
``` php amOnPage('/'); // opens /register page $I->amOnPage('/register'); ```
Paramstring $pageSee\Codeception\Module\WebDriver::amOnPage()
Method
- see public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that the current page contains the given string (case insensitive).
You can specify a specific HTML element (via CSS or XPath) as the second parameter to only search within that element.
``` php see('Logout'); // I can suppose user is logged in $I->see('Sign Up', 'h1'); // I can suppose it's a signup page $I->see('Sign Up', '//body/h1'); // with XPath $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator ```
Note that the search is done after stripping all HTML tags from the body, so `$I->see('strong')` will return true for strings like:
- `I am Stronger than thou
` - ``
But will
not
be true for strings like:
- `Home` - `Home` - ``
For checking the raw source code, use `seeInSource()`.
Paramstring $textParamarray|string $selector optionalSee\Codeception\Module\WebDriver::see() Method- canSee public
- [!] Method is generated. Documentation taken from corresponding module.
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current page contains the given string (case insensitive).
You can specify a specific HTML element (via CSS or XPath) as the second parameter to only search within that element.
``` php see('Logout'); // I can suppose user is logged in $I->see('Sign Up', 'h1'); // I can suppose it's a signup page $I->see('Sign Up', '//body/h1'); // with XPath $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator ```
Note that the search is done after stripping all HTML tags from the body, so `$I->see('strong')` will return true for strings like:
- `I am Stronger than thou
` - ``
But will
not
be true for strings like:
- `Home` - `Home` - ``
For checking the raw source code, use `seeInSource()`.
Paramstring $textParamarray|string $selector optionalSee\Codeception\Module\WebDriver::see() Method- dontSee public
- [!] Method is generated. Documentation taken from corresponding module.
Checks that the current page doesn't contain the text specified (case insensitive). Give a locator as the second parameter to match a specific region.
```php dontSee('Login'); // I can suppose user is already logged in $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page $I->dontSee('Sign Up','//body/h1'); // with XPath $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator ```
Note that the search is done after stripping all HTML tags from the body, so `$I->dontSee('strong')` will fail on strings like:
- `I am Stronger than thou
` - ``
But will ignore strings like:
- `Home` - `Home` - ``
For checking the raw source code, use `seeInSource()`.
Paramstring $textParamarray|string $selector optionalSee\Codeception\Module\WebDriver::dontSee() Method- cantSee public
- [!] Method is generated. Documentation taken from corresponding module.
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current page doesn't contain the text specified (case insensitive). Give a locator as the second parameter to match a specific region.
```php dontSee('Login'); // I can suppose user is already logged in $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page $I->dontSee('Sign Up','//body/h1'); // with XPath $I->dontSee('Sign Up', ['css' => 'body h1']); // with strict CSS locator ```
Note that the search is done after stripping all HTML tags from the body, so `$I->dontSee('strong')` will fail on strings like:
- `I am Stronger than thou
` - ``
But will ignore strings like:
- `Home` - `Home` - ``
For checking the raw source code, use `seeInSource()`.
Paramstring $textParamarray|string $selector optionalSee\Codeception\Module\WebDriver::dontSee() Method- seeInSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current page contains the given string in its raw source code.
``` php seeInSource('Green eggs & ham
'); ```
Param$rawSee\Codeception\Module\WebDriver::seeInSource()- canSeeInSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current page contains the given string in its raw source code.
``` php seeInSource('Green eggs & ham
'); ```
Param$rawSee\Codeception\Module\WebDriver::seeInSource()- dontSeeInSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current page contains the given string in its raw source code.
```php dontSeeInSource('Green eggs & ham
'); ```
Param$rawSee\Codeception\Module\WebDriver::dontSeeInSource()- cantSeeInSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current page contains the given string in its raw source code.
```php dontSeeInSource('Green eggs & ham
'); ```
Param$rawSee\Codeception\Module\WebDriver::dontSeeInSource()- seeInPageSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the page source contains the given string.
```php seeInPageSource('Param$textSee\Codeception\Module\WebDriver::seeInPageSource()- canSeeInPageSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the page source contains the given string.
```php seeInPageSource('Param$textSee\Codeception\Module\WebDriver::seeInPageSource()- dontSeeInPageSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the page source doesn't contain the given string.
Param$textSee\Codeception\Module\WebDriver::dontSeeInPageSource()- cantSeeInPageSource public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the page source doesn't contain the given string.
Param$textSee\Codeception\Module\WebDriver::dontSeeInPageSource()- click public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Perform a click on a link or a button, given by a locator. If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string. For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched. For images, the "alt" attribute and inner text of any parent links are searched.
The second parameter is a context (CSS or XPath locator) to narrow the search.
Note that if the locator matches a button of type `submit`, the form will be submitted.
``` php click('Logout'); // button of form $I->click('Submit'); // CSS button $I->click('#form input[type=submit]'); // XPath $I->click('//form[@type="submit"]'); // link in context $I->click('Logout', '#nav'); // using strict locator $I->click(['link' => 'Login']); ?> ```
Param$linkParam$contextSee\Codeception\Module\WebDriver::click()- seeLink public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that there's a link with the specified text. Give a full URL as the second parameter to match links with that exact URL.
``` php seeLink('Logout'); // matches Logout $I->seeLink('Logout','/logout'); // matches Logout ?> ```
Paramstring $textParamstring $url optionalSee\Codeception\Module\WebDriver::seeLink()- canSeeLink public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that there's a link with the specified text. Give a full URL as the second parameter to match links with that exact URL.
``` php seeLink('Logout'); // matches Logout $I->seeLink('Logout','/logout'); // matches Logout ?> ```
Paramstring $textParamstring $url optionalSee\Codeception\Module\WebDriver::seeLink()- dontSeeLink public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the page doesn't contain a link with the given string. If the second parameter is given, only links with a matching "href" attribute will be checked.
``` php dontSeeLink('Logout'); // I suppose user is not logged in $I->dontSeeLink('Checkout now', '/store/cart.php'); ?> ```
Paramstring $textParamstring $url optionalSee\Codeception\Module\WebDriver::dontSeeLink()- cantSeeLink public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the page doesn't contain a link with the given string. If the second parameter is given, only links with a matching "href" attribute will be checked.
``` php dontSeeLink('Logout'); // I suppose user is not logged in $I->dontSeeLink('Checkout now', '/store/cart.php'); ?> ```
Paramstring $textParamstring $url optionalSee\Codeception\Module\WebDriver::dontSeeLink()- seeInCurrentUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that current URI contains the given string.
``` php seeInCurrentUrl('home'); // to match: /users/1 $I->seeInCurrentUrl('/users/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeInCurrentUrl()- canSeeInCurrentUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that current URI contains the given string.
``` php seeInCurrentUrl('home'); // to match: /users/1 $I->seeInCurrentUrl('/users/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeInCurrentUrl()- seeCurrentUrlEquals public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current URL is equal to the given string. Unlike `seeInCurrentUrl`, this only matches the full URL.
``` php seeCurrentUrlEquals('/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeCurrentUrlEquals()- canSeeCurrentUrlEquals public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current URL is equal to the given string. Unlike `seeInCurrentUrl`, this only matches the full URL.
``` php seeCurrentUrlEquals('/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeCurrentUrlEquals()- seeCurrentUrlMatches public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current URL matches the given regular expression.
``` php seeCurrentUrlMatches('~^/users/(\d+)~'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeCurrentUrlMatches()- canSeeCurrentUrlMatches public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current URL matches the given regular expression.
``` php seeCurrentUrlMatches('~^/users/(\d+)~'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::seeCurrentUrlMatches()- dontSeeInCurrentUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current URI doesn't contain the given string.
``` php dontSeeInCurrentUrl('/users/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeInCurrentUrl()- cantSeeInCurrentUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current URI doesn't contain the given string.
``` php dontSeeInCurrentUrl('/users/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeInCurrentUrl()- dontSeeCurrentUrlEquals public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current URL doesn't equal the given string. Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
``` php dontSeeCurrentUrlEquals('/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()- cantSeeCurrentUrlEquals public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current URL doesn't equal the given string. Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
``` php dontSeeCurrentUrlEquals('/'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()- dontSeeCurrentUrlMatches public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that current url doesn't match the given regular expression.
``` php dontSeeCurrentUrlMatches('~^/users/(\d+)~'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()- cantSeeCurrentUrlMatches public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that current url doesn't match the given regular expression.
``` php dontSeeCurrentUrlMatches('~^/users/(\d+)~'); ?> ```
Paramstring $uriSee\Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()- grabFromCurrentUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Executes the given regular expression against the current URI and returns the first capturing group. If no parameters are provided, the full URI is returned.
``` php grabFromCurrentUrl('~^/user/(\d+)/~'); $uri = $I->grabFromCurrentUrl(); ?> ```
Paramstring $uri optional
ReturnmixedSee\Codeception\Module\WebDriver::grabFromCurrentUrl()- seeCheckboxIsChecked public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the specified checkbox is checked.
``` php seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); ?> ```
Param$checkboxSee\Codeception\Module\WebDriver::seeCheckboxIsChecked()- canSeeCheckboxIsChecked public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the specified checkbox is checked.
``` php seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]'); ?> ```
Param$checkboxSee\Codeception\Module\WebDriver::seeCheckboxIsChecked()- dontSeeCheckboxIsChecked public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Check that the specified checkbox is unchecked.
``` php dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. ?> ```
Param$checkboxSee\Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()- cantSeeCheckboxIsChecked public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Check that the specified checkbox is unchecked.
``` php dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form. ?> ```
Param$checkboxSee\Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()- seeInField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given input field or textarea
equals
(i.e. not just contains) the given value. Fields are matched by label text, the "name" attribute, CSS, or XPath.
``` php seeInField('Body','Type your comment here'); $I->seeInField('form textarea[name=body]','Type your comment here'); $I->seeInField('form input[type=hidden]','hidden_value'); $I->seeInField('#searchform input','Search'); $I->seeInField('//form[@name=search]','Search'); $I->seeInField(['name' => 'search'], 'Search'); ?> ```
Param$fieldParam$valueSee\Codeception\Module\WebDriver::seeInField()- canSeeInField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given input field or textarea
equals
(i.e. not just contains) the given value. Fields are matched by label text, the "name" attribute, CSS, or XPath.
``` php seeInField('Body','Type your comment here'); $I->seeInField('form textarea[name=body]','Type your comment here'); $I->seeInField('form input[type=hidden]','hidden_value'); $I->seeInField('#searchform input','Search'); $I->seeInField('//form[@name=search]','Search'); $I->seeInField(['name' => 'search'], 'Search'); ?> ```
Param$fieldParam$valueSee\Codeception\Module\WebDriver::seeInField()- dontSeeInField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that an input field or textarea doesn't contain the given value. For fuzzy locators, the field is matched by label text, CSS and XPath.
``` php dontSeeInField('Body','Type your comment here'); $I->dontSeeInField('form textarea[name=body]','Type your comment here'); $I->dontSeeInField('form input[type=hidden]','hidden_value'); $I->dontSeeInField('#searchform input','Search'); $I->dontSeeInField('//form[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); ?> ```
Param$fieldParam$valueSee\Codeception\Module\WebDriver::dontSeeInField()- cantSeeInField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that an input field or textarea doesn't contain the given value. For fuzzy locators, the field is matched by label text, CSS and XPath.
``` php dontSeeInField('Body','Type your comment here'); $I->dontSeeInField('form textarea[name=body]','Type your comment here'); $I->dontSeeInField('form input[type=hidden]','hidden_value'); $I->dontSeeInField('#searchform input','Search'); $I->dontSeeInField('//form[@name=search]','Search'); $I->dontSeeInField(['name' => 'search'], 'Search'); ?> ```
Param$fieldParam$valueSee\Codeception\Module\WebDriver::dontSeeInField()- seeInFormFields public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks if the array of form parameters (name => value) are set on the form matched with the passed selector.
``` php seeInFormFields('form[name=myform]', [ 'input1' => 'value', 'input2' => 'other value', ]); ?> ```
For multi-select elements, or to check values of multiple elements with the same name, an array may be passed:
``` php seeInFormFields('.form-class', [ 'multiselect' => [ 'value1', 'value2', ], 'checkbox[]' => [ 'a checked value', 'another checked value', ], ]); ?> ```
Additionally, checkbox values can be checked with a boolean.
``` php seeInFormFields('#form-id', [ 'checkbox1' => true, // passes if checked 'checkbox2' => false, // passes if unchecked ]); ?> ```
Pair this with submitForm for quick testing magic.
``` php 'value', 'field2' => 'another value', 'checkbox1' => true, // ... ]; $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); // $I->amOnPage('/path/to/form-page') may be needed $I->seeInFormFields('//form[@id=my-form]', $form); ?> ```
Param$formSelectorParam$paramsSee\Codeception\Module\WebDriver::seeInFormFields()- canSeeInFormFields public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks if the array of form parameters (name => value) are set on the form matched with the passed selector.
``` php seeInFormFields('form[name=myform]', [ 'input1' => 'value', 'input2' => 'other value', ]); ?> ```
For multi-select elements, or to check values of multiple elements with the same name, an array may be passed:
``` php seeInFormFields('.form-class', [ 'multiselect' => [ 'value1', 'value2', ], 'checkbox[]' => [ 'a checked value', 'another checked value', ], ]); ?> ```
Additionally, checkbox values can be checked with a boolean.
``` php seeInFormFields('#form-id', [ 'checkbox1' => true, // passes if checked 'checkbox2' => false, // passes if unchecked ]); ?> ```
Pair this with submitForm for quick testing magic.
``` php 'value', 'field2' => 'another value', 'checkbox1' => true, // ... ]; $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); // $I->amOnPage('/path/to/form-page') may be needed $I->seeInFormFields('//form[@id=my-form]', $form); ?> ```
Param$formSelectorParam$paramsSee\Codeception\Module\WebDriver::seeInFormFields()- dontSeeInFormFields public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector.
``` php dontSeeInFormFields('form[name=myform]', [ 'input1' => 'non-existent value', 'input2' => 'other non-existent value', ]); ?> ```
To check that an element hasn't been assigned any one of many values, an array can be passed as the value:
``` php dontSeeInFormFields('.form-class', [ 'fieldName' => [ 'This value shouldn\'t be set', 'And this value shouldn\'t be set', ], ]); ?> ```
Additionally, checkbox values can be checked with a boolean.
``` php dontSeeInFormFields('#form-id', [ 'checkbox1' => true, // fails if checked 'checkbox2' => false, // fails if unchecked ]); ?> ```
Param$formSelectorParam$paramsSee\Codeception\Module\WebDriver::dontSeeInFormFields()- cantSeeInFormFields public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks if the array of form parameters (name => value) are not set on the form matched with the passed selector.
``` php dontSeeInFormFields('form[name=myform]', [ 'input1' => 'non-existent value', 'input2' => 'other non-existent value', ]); ?> ```
To check that an element hasn't been assigned any one of many values, an array can be passed as the value:
``` php dontSeeInFormFields('.form-class', [ 'fieldName' => [ 'This value shouldn\'t be set', 'And this value shouldn\'t be set', ], ]); ?> ```
Additionally, checkbox values can be checked with a boolean.
``` php dontSeeInFormFields('#form-id', [ 'checkbox1' => true, // fails if checked 'checkbox2' => false, // fails if unchecked ]); ?> ```
Param$formSelectorParam$paramsSee\Codeception\Module\WebDriver::dontSeeInFormFields()- selectOption public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Selects an option in a select tag or in radio button group.
``` php selectOption('form select[name=account]', 'Premium'); $I->selectOption('form input[name=payment]', 'Monthly'); $I->selectOption('//form/select[@name=account]', 'Monthly'); ?> ```
Provide an array for the second argument to select multiple options:
``` php selectOption('Which OS do you use?', array('Windows','Linux')); ?> ```
Or provide an associative array for the second argument to specifically define which selection method should be used:
``` php selectOption('Which OS do you use?', array('text' => 'Windows')); // Only search by text 'Windows' $I->selectOption('Which OS do you use?', array('value' => 'windows')); // Only search by value 'windows' ?> ```
Param$selectParam$optionSee\Codeception\Module\WebDriver::selectOption()- unselectOption public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Unselect an option in the given select box.
Param$selectParam$optionSee\Codeception\Module\WebDriver::unselectOption()- checkOption public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
``` php checkOption('#agree'); ?> ```
Param$optionSee\Codeception\Module\WebDriver::checkOption()- uncheckOption public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Unticks a checkbox.
``` php uncheckOption('#notify'); ?> ```
Param$optionSee\Codeception\Module\WebDriver::uncheckOption()- fillField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Fills a text field or textarea with the given string.
``` php fillField("//input[@type='text']", "Hello World!"); $I->fillField(['name' => 'email'], 'jon@example.com'); ?> ```
Param$fieldParam$valueSee\Codeception\Module\WebDriver::fillField()- clearField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Clears given field which isn't empty.
``` php clearField('#username'); ```
Param$fieldSee\Codeception\Module\WebDriver::clearField()- attachFile public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Attaches a file relative to the Codeception `_data` directory to the given file upload field.
``` php attachFile('input[@type="file"]', 'prices.xls'); ?> ```
Param$fieldParam$filenameSee\Codeception\Module\WebDriver::attachFile()- grabTextFrom public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Finds and returns the text contents of the given element. If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression.
``` php grabTextFrom('h1'); $heading = $I->grabTextFrom('descendant-or-self::h1'); $value = $I->grabTextFrom('~?)]~sgi'); // match with a regex ?> ```
Param$cssOrXPathOrRegex
ReturnmixedSee\Codeception\Module\WebDriver::grabTextFrom()- grabAttributeFrom public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Grabs the value of the given attribute value from the given element. Fails if element is not found.
``` php grabAttributeFrom('#tooltip', 'title'); ?> ```
Param$cssOrXpathParam$attribute
ReturnmixedSee\Codeception\Module\WebDriver::grabAttributeFrom()- grabValueFrom public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Finds the value for the given form field. If a fuzzy locator is used, the field is found by field name, CSS, and XPath.
``` php grabValueFrom('Name'); $name = $I->grabValueFrom('input[name=username]'); $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']'); $name = $I->grabValueFrom(['name' => 'username']); ?> ```
Param$field
ReturnmixedSee\Codeception\Module\WebDriver::grabValueFrom()- grabMultiple public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Grabs either the text content, or attribute values, of nodes matched by $cssOrXpath and returns them as an array.
```html First Second Third ```
```php grabMultiple('a');
// would return ['#first', '#second', '#third'] $aLinks = $I->grabMultiple('a', 'href'); ?> ```
Param$cssOrXpathParam$attributeReturnstring[]See\Codeception\Module\WebDriver::grabMultiple()- seeElement public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given element exists on the page and is visible. You can also specify expected attributes of this element.
``` php seeElement('.error'); $I->seeElement('//form/input[1]'); $I->seeElement('input', ['name' => 'login']); $I->seeElement('input', ['value' => '123456']);
// strict locator in first arg, attributes in second $I->seeElement(['css' => 'form input'], ['name' => 'login']); ?> ```
Param$selectorParamarray $attributesReturnSee\Codeception\Module\WebDriver::seeElement()- canSeeElement public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given element exists on the page and is visible. You can also specify expected attributes of this element.
``` php seeElement('.error'); $I->seeElement('//form/input[1]'); $I->seeElement('input', ['name' => 'login']); $I->seeElement('input', ['value' => '123456']);
// strict locator in first arg, attributes in second $I->seeElement(['css' => 'form input'], ['name' => 'login']); ?> ```
Param$selectorParamarray $attributesReturnSee\Codeception\Module\WebDriver::seeElement()- dontSeeElement public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given element is invisible or not present on the page. You can also specify expected attributes of this element.
``` php dontSeeElement('.error'); $I->dontSeeElement('//form/input[1]'); $I->dontSeeElement('input', ['name' => 'login']); $I->dontSeeElement('input', ['value' => '123456']); ?> ```
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::dontSeeElement()- cantSeeElement public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given element is invisible or not present on the page. You can also specify expected attributes of this element.
``` php dontSeeElement('.error'); $I->dontSeeElement('//form/input[1]'); $I->dontSeeElement('input', ['name' => 'login']); $I->dontSeeElement('input', ['value' => '123456']); ?> ```
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::dontSeeElement()- seeElementInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given element exists on the page, even it is invisible.
``` php seeElementInDOM('//form/input[type=hidden]'); ?> ```
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::seeElementInDOM()- canSeeElementInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given element exists on the page, even it is invisible.
``` php seeElementInDOM('//form/input[type=hidden]'); ?> ```
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::seeElementInDOM()- dontSeeElementInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Opposite of `seeElementInDOM`.
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::dontSeeElementInDOM()- cantSeeElementInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Opposite of `seeElementInDOM`.
Param$selectorParamarray $attributesSee\Codeception\Module\WebDriver::dontSeeElementInDOM()- seeNumberOfElements public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that there are a certain number of elements matched by the given locator on the page.
``` php seeNumberOfElements('tr', 10); $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements ?> ```Param$selectorParammixed $expected int or int[]See\Codeception\Module\WebDriver::seeNumberOfElements()- canSeeNumberOfElements public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that there are a certain number of elements matched by the given locator on the page.
``` php seeNumberOfElements('tr', 10); $I->seeNumberOfElements('tr', [0,10]); // between 0 and 10 elements ?> ```Param$selectorParammixed $expected int or int[]See\Codeception\Module\WebDriver::seeNumberOfElements()- seeNumberOfElementsInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
See\Codeception\Module\WebDriver::seeNumberOfElementsInDOM()- canSeeNumberOfElementsInDOM public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail
See\Codeception\Module\WebDriver::seeNumberOfElementsInDOM()- seeOptionIsSelected public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given option is selected.
``` php seeOptionIsSelected('#form input[name=payment]', 'Visa'); ?> ```
Param$selectorParam$optionText
ReturnmixedSee\Codeception\Module\WebDriver::seeOptionIsSelected()- canSeeOptionIsSelected public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given option is selected.
``` php seeOptionIsSelected('#form input[name=payment]', 'Visa'); ?> ```
Param$selectorParam$optionText
ReturnmixedSee\Codeception\Module\WebDriver::seeOptionIsSelected()- dontSeeOptionIsSelected public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the given option is not selected.
``` php dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); ?> ```
Param$selectorParam$optionText
ReturnmixedSee\Codeception\Module\WebDriver::dontSeeOptionIsSelected()- cantSeeOptionIsSelected public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the given option is not selected.
``` php dontSeeOptionIsSelected('#form input[name=payment]', 'Visa'); ?> ```
Param$selectorParam$optionText
ReturnmixedSee\Codeception\Module\WebDriver::dontSeeOptionIsSelected()- seeInTitle public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the page title contains the given string.
``` php seeInTitle('Blog - Post #1'); ?> ```
Param$title
ReturnmixedSee\Codeception\Module\WebDriver::seeInTitle()- canSeeInTitle public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the page title contains the given string.
``` php seeInTitle('Blog - Post #1'); ?> ```
Param$title
ReturnmixedSee\Codeception\Module\WebDriver::seeInTitle()- dontSeeInTitle public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the page title does not contain the given string.
Param$title
ReturnmixedSee\Codeception\Module\WebDriver::dontSeeInTitle()- cantSeeInTitle public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the page title does not contain the given string.
Param$title
ReturnmixedSee\Codeception\Module\WebDriver::dontSeeInTitle()- acceptPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`. Don't confuse popups with modal windows, as created by [various libraries](http://jster.net/category/windows-modals-popups).See\Codeception\Module\WebDriver::acceptPopup()- cancelPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Dismisses the active JavaScript popup, as created by `window.alert`, `window.confirm`, or `window.prompt`.See\Codeception\Module\WebDriver::cancelPopup()- seeInPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
Param$text
Throws\Codeception\Exception\ModuleExceptionSee\Codeception\Module\WebDriver::seeInPopup()- canSeeInPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
Param$text
Throws\Codeception\Exception\ModuleExceptionSee\Codeception\Module\WebDriver::seeInPopup()- dontSeeInPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string.
Param$text
Throws\Codeception\Exception\ModuleExceptionSee\Codeception\Module\WebDriver::dontSeeInPopup()- cantSeeInPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, does NOT contain the given string.
Param$text
Throws\Codeception\Exception\ModuleExceptionSee\Codeception\Module\WebDriver::dontSeeInPopup()- typeInPopup public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Enters text into a native JavaScript prompt popup, as created by `window.prompt`.
Param$keys
Throws\Codeception\Exception\ModuleExceptionSee\Codeception\Module\WebDriver::typeInPopup()- reloadPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Reloads the current page.See\Codeception\Module\WebDriver::reloadPage()- moveBack public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Moves back in history.See\Codeception\Module\WebDriver::moveBack()- moveForward public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Moves forward in history.See\Codeception\Module\WebDriver::moveForward()- submitForm public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Submits the given form on the page, optionally with the given form values. Give the form fields values as an array. Note that hidden fields can't be accessed.
Skipped fields will be filled by their values from the page. You don't need to click the 'Submit' button afterwards. This command itself triggers the request to form's action.
You can optionally specify what button's value to include in the request with the last parameter as an alternative to explicitly setting its value in the second parameter, as button values are not otherwise included in the request.
Examples:
``` php submitForm('#login', [ 'login' => 'davert', 'password' => '123456' ]); // or $I->submitForm('#login', [ 'login' => 'davert', 'password' => '123456' ], 'submitButtonName');
```
For example, given this sample "Sign Up" form:
``` html ```
You could write the following to submit it:
``` php submitForm( '#userForm', [ 'user[login]' => 'Davert', 'user[password]' => '123456', 'user[agree]' => true ], 'submitButton' ); ``` Note that "2" will be the submitted value for the "plan" field, as it is the selected option.
Also note that this differs from PhpBrowser, in that ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment. Named array keys
must
be included in the name as above.
Pair this with seeInFormFields for quick testing magic.
``` php 'value', 'field2' => 'another value', 'checkbox1' => true, // ... ]; $I->submitForm('//form[@id=my-form]', $form, 'submitButton'); // $I->amOnPage('/path/to/form-page') may be needed $I->seeInFormFields('//form[@id=my-form]', $form); ?> ```
Parameter values must be set to arrays for multiple input fields of the same name, or multi-select combo boxes. For checkboxes, either the string value can be used, or boolean values which will be replaced by the checkbox's value in the DOM.
``` php submitForm('#my-form', [ 'field1' => 'value', 'checkbox' => [ 'value of first checkbox', 'value of second checkbox', ], 'otherCheckboxes' => [ true, false, false, ], 'multiselect' => [ 'first option value', 'second option value', ] ]); ?> ```
Mixing string and boolean values for a checkbox's value is not supported and may produce unexpected results.
Field names ending in "[]" must be passed without the trailing square bracket characters, and must contain an array for its value. This allows submitting multiple values with the same name, consider:
```php $I->submitForm('#my-form', [ 'field[]' => 'value', 'field[]' => 'another value', // 'field[]' is already a defined key ]); ```
The solution is to pass an array value:
```php // this way both values are submitted $I->submitForm('#my-form', [ 'field' => [ 'value', 'another value', ] ]); ```
The `$button` parameter can be either a string, an array or an instance of Facebook\WebDriver\WebDriverBy. When it is a string, the button will be found by its "name" attribute. If $button is an array then it will be treated as a strict selector and a WebDriverBy will be used verbatim.
For example, given the following HTML:
``` html ```
`$button` could be any one of the following: - 'submitButton' - ['name' => 'submitButton'] - WebDriverBy::name('submitButton')
Param$selectorParam$paramsParam$buttonSee\Codeception\Module\WebDriver::submitForm()- waitForElementChange public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for the given element to change. Element "change" is determined by a callback function which is called repeatedly until the return value evaluates to true.
``` php waitForElementChange('#menu', function(WebDriverElement $el) { return $el->isDisplayed(); }, 100); ?> ```
Param$elementParam\Closure $callbackParamint $timeout secondsThrows\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::waitForElementChange()- waitForElement public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for an element to appear on the page. If the element doesn't appear, a timeout exception is thrown.
``` php waitForElement('#agree_button', 30); // secs $I->click('#agree_button'); ?> ```
Param$elementParamint $timeout secondsThrows\ExceptionSee\Codeception\Module\WebDriver::waitForElement()- waitForElementVisible public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for the given element to be visible on the page. If element doesn't appear, a timeout exception is thrown.
``` php waitForElementVisible('#agree_button', 30); // secs $I->click('#agree_button'); ?> ```
Param$elementParamint $timeout secondsThrows\ExceptionSee\Codeception\Module\WebDriver::waitForElementVisible()- waitForElementNotVisible public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for the given element to become invisible. If element stays visible, a timeout exception is thrown.
``` php waitForElementNotVisible('#agree_button', 30); // secs ?> ```
Param$elementParamint $timeout secondsThrows\ExceptionSee\Codeception\Module\WebDriver::waitForElementNotVisible()- waitForElementClickable public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for the given element to be clickable. If element doesn't become clickable, a timeout exception is thrown.
``` php waitForElementClickable('#agree_button', 30); // secs $I->click('#agree_button'); ?> ```
Param$elementParamint $timeout secondsThrows\ExceptionSee\Codeception\Module\WebDriver::waitForElementClickable()- waitForText public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits up to $timeout seconds for the given string to appear on the page.
Can also be passed a selector to search in, be as specific as possible when using selectors. waitForText() will only watch the first instance of the matching selector / text provided. If the given text doesn't appear, a timeout exception is thrown.
``` php waitForText('foo', 30); // secs $I->waitForText('foo', 30, '.title'); // secs ?> ```
Paramstring $textParamint $timeout secondsParamstring $selector optionalThrows\ExceptionSee\Codeception\Module\WebDriver::waitForText()- wait public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Wait for $timeout seconds.
Paramint|float $timeout secsThrows\Codeception\Exception\TestRuntimeExceptionSee\Codeception\Module\WebDriver::wait()- executeInSelenium public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Low-level API method. If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly:
``` php $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { $webdriver->get('http://google.com'); }); ```
This runs in the context of the [RemoteWebDriver class](https://github.com/php-webdriver/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php). Try not to use this command on a regular basis. If Codeception lacks a feature you need, please implement it and submit a patch.
Paramcallable $functionSee\Codeception\Module\WebDriver::executeInSelenium()- switchToWindow public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Switch to another window identified by name.
The window can only be identified by name. If the $name parameter is blank, the parent window will be used.
Example: ``` html ```
``` php click("Open window"); # switch to another window $I->switchToWindow("another_window"); # switch to parent window $I->switchToWindow(); ?> ```
If the window has no name, match it by switching to next active tab using `switchToNextTab` method.
Or use native Selenium functions to get access to all opened windows:
``` php executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { $handles=$webdriver->getWindowHandles(); $last_window = end($handles); $webdriver->switchTo()->window($last_window); }); ?> ```
Paramstring|null $nameSee\Codeception\Module\WebDriver::switchToWindow()- switchToIFrame public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Switch to another iframe on the page.
Example: ``` html- switchToFrame public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Switch to another frame on the page.
Example: ``` html
```
``` php switchToFrame("another_frame"); # switch to frame by CSS or XPath $I->switchToFrame("#fr1"); # switch to parent page $I->switchToFrame();
```
Paramstring|null $locator (name, CSS or XPath)See\Codeception\Module\WebDriver::switchToFrame()- waitForJS public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Executes JavaScript and waits up to $timeout seconds for it to return true.
In this example we will wait up to 60 seconds for all jQuery AJAX requests to finish.
``` php waitForJS("return $.active == 0;", 60); ?> ```
Paramstring $scriptParamint $timeout secondsSee\Codeception\Module\WebDriver::waitForJS()- executeJS public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Executes custom JavaScript.
This example uses jQuery to get a value and assigns that value to a PHP variable:
```php executeJS('return $("#myField").val()');
// additional arguments can be passed as array // Example shows `Hello World` alert: $I->executeJS("window.alert(arguments[0])", ['Hello world']); ```
Param$scriptParamarray $argumentsReturnmixedSee\Codeception\Module\WebDriver::executeJS()- executeAsyncJS public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Executes asynchronous JavaScript. A callback should be executed by JavaScript to exit from a script. Callback is passed as a last element in `arguments` array. Additional arguments can be passed as array in second parameter.
```js // wait for 1200 milliseconds my running `setTimeout`
$I->executeAsyncJS('setTimeout(arguments[0], 1200)');
$seconds = 1200; // or seconds are passed as argument $I->executeAsyncJS('setTimeout(arguments[1], arguments[0])', [$seconds]); ```
Param$scriptParamarray $argumentsReturnmixedSee\Codeception\Module\WebDriver::executeAsyncJS()- maximizeWindow public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Maximizes the current window.See\Codeception\Module\WebDriver::maximizeWindow()- dragAndDrop public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Performs a simple mouse drag-and-drop operation.
``` php dragAndDrop('#drag', '#drop'); ?> ```
Paramstring $source (CSS ID or XPath)Paramstring $target (CSS ID or XPath)See\Codeception\Module\WebDriver::dragAndDrop()- moveMouseOver public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Move mouse over the first element matched by the given locator. If the first parameter null then the page is used. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. Otherwise, the mouse is moved to the center of the element.
``` php moveMouseOver(['css' => '.checkout']); $I->moveMouseOver(null, 20, 50); $I->moveMouseOver(['css' => '.checkout'], 20, 50); ?> ```
Paramstring $cssOrXPath css or xpath of the web elementParamint $offsetXParamint $offsetY
Throws\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::moveMouseOver()- clickWithLeftButton public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Performs click with the left mouse button on an element. If the first parameter `null` then the offset is relative to the actual mouse position. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. Otherwise, the mouse is moved to the center of the element.
``` php clickWithLeftButton(['css' => '.checkout']); $I->clickWithLeftButton(null, 20, 50); $I->clickWithLeftButton(['css' => '.checkout'], 20, 50); ?> ```
Paramstring $cssOrXPath css or xpath of the web element (body by default).Paramint $offsetXParamint $offsetY
Throws\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::clickWithLeftButton()- clickWithRightButton public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Performs contextual click with the right mouse button on an element. If the first parameter `null` then the offset is relative to the actual mouse position. If the second and third parameters are given, then the mouse is moved to an offset of the element's top-left corner. Otherwise, the mouse is moved to the center of the element.
``` php clickWithRightButton(['css' => '.checkout']); $I->clickWithRightButton(null, 20, 50); $I->clickWithRightButton(['css' => '.checkout'], 20, 50); ?> ```
Paramstring $cssOrXPath css or xpath of the web element (body by default).Paramint $offsetXParamint $offsetY
Throws\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::clickWithRightButton()- doubleClick public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Performs a double-click on an element matched by CSS or XPath.
Param$cssOrXPathThrows\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::doubleClick()- pressKey public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Presses the given key on the given element. To specify a character and modifier (e.g. Ctrl, Alt, Shift, Meta), pass an array for `$char` with the modifier as the first element and the character as the second. For special keys, use the constants from [`Facebook\WebDriver\WebDriverKeys`](https://github.com/php-webdriver/php-webdriver/blob/main/lib/WebDriverKeys.php).
``` php $I->pressKey('#page','a'); // => olda $I->pressKey('#page',array('ctrl','a'),'new'); //=> new $I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x $I->pressKey('descendant-or-self::
[@id='page']','u'); //=> oldu $I->pressKey('#name', array('ctrl', 'a'), \Facebook\WebDriver\WebDriverKeys::DELETE); //=>'' ?> ```
Param$elementParam$char string|array Can be char or array with modifier. You can provide several chars.Throws\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::pressKey()- appendField public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Append the given text to the given element. Can also add a selection to a select box.
``` php appendField('#mySelectbox', 'SelectValue'); $I->appendField('#myTextField', 'appended'); ?> ```
Paramstring $fieldParamstring $valueThrows\Codeception\Exception\ElementNotFoundSee\Codeception\Module\WebDriver::appendField()- saveSessionSnapshot public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Saves current cookies into named snapshot in order to restore them in other tests This is useful to save session state between tests. For example, if user needs log in to site for each test this scenario can be executed once while other tests can just restore saved cookies.
``` php public function login() { // if snapshot exists - skipping login if ($I->loadSessionSnapshot('login')) return;
// logging in $I->amOnPage('/login'); $I->fillField('name', 'jon'); $I->fillField('password', '123345'); $I->click('Login');
// saving snapshot $I->saveSessionSnapshot('login'); } ?> ```
Param$nameReturnmixedSee\Codeception\Module\WebDriver::saveSessionSnapshot()- loadSessionSnapshot public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Loads cookies from a saved snapshot. Allows to reuse same session across tests without additional login.
See [saveSessionSnapshot](#saveSessionSnapshot)
Param$nameReturnmixedSee\Codeception\Module\WebDriver::loadSessionSnapshot()- deleteSessionSnapshot public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Deletes session snapshot.
See [saveSessionSnapshot](#saveSessionSnapshot)
Param$nameReturnmixedSee\Codeception\Module\WebDriver::deleteSessionSnapshot()- scrollTo public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Move to the middle of the given element matched by the given locator. Extra shift, calculated from the top-left corner of the element, can be set by passing $offsetX and $offsetY parameters.
``` php scrollTo(['css' => '.checkout'], 20, 50); ?> ```
Param$selectorParamint $offsetXParamint $offsetYSee\Codeception\Module\WebDriver::scrollTo()- openNewTab public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Opens a new browser tab and switches to it.
```php openNewTab(); ``` The tab is opened with JavaScript's `window.open()`, which means:
Some adblockers might restrict it.
The sessionStorage is copied to the new tab (contrary to a tab that was manually opened by the user)See\Codeception\Module\WebDriver::openNewTab()- closeTab public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Closes current browser tab and switches to previous active tab.
```php closeTab(); ```See\Codeception\Module\WebDriver::closeTab()- switchToNextTab public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Switches to next browser tab. An offset can be specified.
```php switchToNextTab(); // switch to 2nd next tab $I->switchToNextTab(2); ```Paramint $offset 1See\Codeception\Module\WebDriver::switchToNextTab()- switchToPreviousTab public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Switches to previous browser tab. An offset can be specified.
```php switchToPreviousTab(); // switch to 2nd previous tab $I->switchToPreviousTab(2); ```Paramint $offset 1See\Codeception\Module\WebDriver::switchToPreviousTab()- performOn public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Waits for element and runs a sequence of actions inside its context. Actions can be defined with array, callback, or `Codeception\Util\ActionSequence` instance.
Actions as array are recommended for simple to combine "waitForElement" with assertions; `waitForElement($el)` and `see('text', $el)` can be simplified to:
```php performOn($el, ['see' => 'text']); ```
List of actions can be pragmatically build using `Codeception\Util\ActionSequence`:
```php performOn('.model', ActionSequence::build() ->see('Warning') ->see('Are you sure you want to delete this?') ->click('Yes') ); ```
Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to exception on failure.
Whenever you need to define more actions a callback can be used. A WebDriver module is passed for argument:
```php performOn('.rememberMe', function (WebDriver $I) { $I->see('Remember me next time'); $I->seeElement('#LoginForm_rememberMe'); $I->dontSee('Login'); }); ```
In 3rd argument you can set number a seconds to wait for element to appear
Param$elementParam$actionsParamint $timeoutSee\Codeception\Module\WebDriver::performOn()- logOut public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Navigate to the default WordPress logout page and click the logout link.
@example ```php // Log out using the `wp-login.php` form and return to the current page. $I->logOut(true); // Log out using the `wp-login.php` form and remain there. $I->logOut(false); // Log out using the `wp-login.php` form and move to another page. $I->logOut('/some-other-page'); ```
Parambool|string $redirectTo Whether to redirect to another (optionally specified) page after the logout.
ReturnvoidSee\Codeception\Module\WPWebDriver::logOut()- amOnPluginsPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go to the plugins administration screen.
The method will
not
handle authentication.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->activatePlugin('hello-dolly'); ```
ReturnvoidSee\Codeception\Module\WPWebDriver::amOnPluginsPage()- amOnPagesPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go the "Pages" administration screen.
The method will
not
handle authentication.
@example ```php $I->loginAsAdmin(); $I->amOnPagesPage(); $I->see('Add New'); ```
ReturnvoidSee\Codeception\Module\WPWebDriver::amOnPagesPage()- seePluginDeactivated public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Assert a plugin is not activated in the plugins administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginDeactivated('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginDeactivated()- canSeePluginDeactivated public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Assert a plugin is not activated in the plugins administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginDeactivated('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginDeactivated()- seePluginInstalled public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Assert a plugin is installed, no matter its activation status, in the plugin adminstration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginInstalled('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginInstalled()- canSeePluginInstalled public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Assert a plugin is installed, no matter its activation status, in the plugin adminstration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginInstalled('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginInstalled()- seePluginActivated public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Assert a plugin is activated in the plugin administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginActivated('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginActivated()- canSeePluginActivated public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Assert a plugin is activated in the plugin administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->seePluginActivated('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::seePluginActivated()- dontSeePluginInstalled public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Assert a plugin is not installed in the plugins administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->dontSeePluginInstalled('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::dontSeePluginInstalled()- cantSeePluginInstalled public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Assert a plugin is not installed in the plugins administration screen.
The method will
not
handle authentication and navigation to the plugin administration screen.
@example ```php $I->loginAsAdmin(); $I->amOnPluginsPage(); $I->dontSeePluginInstalled('my-plugin'); ```
Paramstring $pluginSlug The plugin slug, like "hello-dolly".
ReturnvoidSee\Codeception\Module\WPWebDriver::dontSeePluginInstalled()- seeErrorMessage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
In an administration screen look for an error admin notice.
The check is class-based to decouple from internationalization. The method will
not
handle authentication and navigation the administration area.
Paramstring|array$classes A list of classes the notice should have other than the `.notice.notice-error` ones.
Returnvoid @example ```php $I->loginAsAdmin() $I->amOnAdminPage('/'); $I->seeErrorMessage('.my-plugin'); ```
See\Codeception\Module\WPWebDriver::seeErrorMessage()- canSeeErrorMessage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail In an administration screen look for an error admin notice.
The check is class-based to decouple from internationalization. The method will
not
handle authentication and navigation the administration area.
Paramstring|array$classes A list of classes the notice should have other than the `.notice.notice-error` ones.
Returnvoid @example ```php $I->loginAsAdmin() $I->amOnAdminPage('/'); $I->seeErrorMessage('.my-plugin'); ```
See\Codeception\Module\WPWebDriver::seeErrorMessage()- seeWpDiePage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that the current page is one generated by the `wp_die` function.
The method will try to identify the page based on the default WordPress die page HTML attributes.
@example ```php $I->loginAs('user', 'password'); $I->amOnAdminPage('/forbidden'); $I->seeWpDiePage(); ```
ReturnvoidSee\Codeception\Module\WPWebDriver::seeWpDiePage()- canSeeWpDiePage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that the current page is one generated by the `wp_die` function.
The method will try to identify the page based on the default WordPress die page HTML attributes.
@example ```php $I->loginAs('user', 'password'); $I->amOnAdminPage('/forbidden'); $I->seeWpDiePage(); ```
ReturnvoidSee\Codeception\Module\WPWebDriver::seeWpDiePage()- seeMessage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
In an administration screen look for an admin notice.
The check is class-based to decouple from internationalization. The method will
not
handle authentication and navigation the administration area.
@example ```php $I->loginAsAdmin() $I->amOnAdminPage('/'); $I->seeMessage('.missing-api-token.my-plugin'); ```
Paramarray|string $classes A list of classes the message should have in addition to the `.notice` one.
ReturnvoidSee\Codeception\Module\WPWebDriver::seeMessage()- canSeeMessage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail In an administration screen look for an admin notice.
The check is class-based to decouple from internationalization. The method will
not
handle authentication and navigation the administration area.
@example ```php $I->loginAsAdmin() $I->amOnAdminPage('/'); $I->seeMessage('.missing-api-token.my-plugin'); ```
Paramarray|string $classes A list of classes the message should have in addition to the `.notice` one.
ReturnvoidSee\Codeception\Module\WPWebDriver::seeMessage()- grabWordPressTestCookie public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns WordPress default test cookie object if present. @example ```php // Grab the default WordPress test cookie. $wpTestCookie = $I->grabWordPressTestCookie(); // Grab a customized version of the test cookie. $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie'); ```
Paramstring $name Optional, overrides the default cookie name.
Return\Symfony\Component\BrowserKit\Cookie|null Either a cookie object or `null`.See\Codeception\Module\WPWebDriver::grabWordPressTestCookie()- amOnAdminPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go to a page in the admininstration area of the site.
This method will
not
handle authentication to the administration area.
@example
```php $I->loginAs('user', 'password'); // Go to the plugins management screen. $I->amOnAdminPage('/plugins.php'); ```
Paramstring $page The path, relative to the admin area URL, to the page.
Returnstring The admin page path.See\Codeception\Module\WPWebDriver::amOnAdminPage()- amOnAdminAjaxPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go to the `admin-ajax.php` page to start a synchronous, and blocking, `GET` AJAX request.
The method will
not
handle authentication, nonces or authorization.
@example ```php $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]); ```
Paramstring|array$queryVars A string or array of query variables to append to the AJAX path.
Returnstring The admin page path.See\Codeception\Module\WPWebDriver::amOnAdminAjaxPage()- amOnCronPage public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go to the cron page to start a synchronous, and blocking, `GET` request to the cron script.
@example ```php // Triggers the cron job with an optional query argument. $I->amOnCronPage('/?some-query-var=some-value'); ```
Paramstring|array$queryVars A string or array of query variables to append to the AJAX path.
Returnstring The page path.See\Codeception\Module\WPWebDriver::amOnCronPage()- amEditingPostWithId public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Go to the admin page to edit the post with the specified ID.
The method will
not
handle authentication the admin area.
@example ```php $I->loginAsAdmin(); $postId = $I->havePostInDatabase(); $I->amEditingPostWithId($postId); $I->fillField('post_title', 'Post title'); ```
Paramint $id The post ID.
ReturnvoidSee\Codeception\Module\WPWebDriver::amEditingPostWithId()- importSqlDumpFile public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Import the SQL dump file if populate is enabled.
@example ```php // Import a dump file passing the absolute path. $I->importSqlDumpFile(codecept_data_dir('dumps/start.sql')); ```
Specifying a dump file that file will be imported.
Paramstring|null $dumpFile The dump file that should be imported in place of the default one.
Returnvoid
Throws\InvalidArgumentException If the specified file does not exist.See\Codeception\Module\WPDb::importSqlDumpFile()- dontSeeOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that an option is not in the database for the current blog.
If the value is an object or an array then the serialized option will be checked.
@example ```php $I->dontHaveOptionInDatabase('posts_per_page'); $I->dontSeeOptionInDatabase('posts_per_page'); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeOptionInDatabase()- cantSeeOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that an option is not in the database for the current blog.
If the value is an object or an array then the serialized option will be checked.
@example ```php $I->dontHaveOptionInDatabase('posts_per_page'); $I->dontSeeOptionInDatabase('posts_per_page'); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeOptionInDatabase()- grabPrefixedTableNameFor public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns a prefixed table name for the current blog.
If the table is not one to be prefixed (e.g. `users`) then the proper table name will be returned.
@example ```php // Will return wp_users. $usersTable = $I->grabPrefixedTableNameFor('users'); // Will return wp_options. $optionsTable = $I->grabPrefixedTableNameFor('options'); // Use a different blog and get its options table. $I->useBlog(2); $blogOptionsTable = $I->grabPrefixedTableNameFor('options'); ```
Paramstring $tableName The table name, e.g. `options`.
Returnstring The prefixed table name, e.g. `wp_options` or `wp_2_options`.See\Codeception\Module\WPDb::grabPrefixedTableNameFor()- seePostMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a post meta value in the database for the current blog.
If the `meta_value` is an object or an array then the check will be made for serialized values.
@example ```php $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]; $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePostMetaInDatabase()- canSeePostMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a post meta value in the database for the current blog.
If the `meta_value` is an object or an array then the check will be made for serialized values.
@example ```php $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]; $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePostMetaInDatabase()- seeLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a link in the `links` table of the database.
@example ```php // Asserts a link exists by name. $I->seeLinkInDatabase(['link_name' => 'my-link']); // Asserts at least one link exists for the user. $I->seeLinkInDatabase(['link_owner' => $userId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeLinkInDatabase()- canSeeLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a link in the `links` table of the database.
@example ```php // Asserts a link exists by name. $I->seeLinkInDatabase(['link_name' => 'my-link']); // Asserts at least one link exists for the user. $I->seeLinkInDatabase(['link_owner' => $userId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeLinkInDatabase()- dontSeeLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a link is not in the `links` database table.
@example ```php $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']); $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeLinkInDatabase()- cantSeeLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a link is not in the `links` database table.
@example ```php $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']); $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeLinkInDatabase()- dontSeePostMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a post meta value does not exist.
If the meta value is an object or an array then the check will be made on its serialized version.
@example ```php $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]); $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePostMetaInDatabase()- cantSeePostMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a post meta value does not exist.
If the meta value is an object or an array then the check will be made on its serialized version.
@example ```php $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]); $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePostMetaInDatabase()- seePostWithTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a post to term relation exists in the database.
The method will check the "term_relationships" table.
@example ```php $fiction = $I->haveTermInDatabase('fiction', 'genre'); $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]); $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']); ```
Paramint $post_id The post ID.Paramint $term_taxonomy_id The term `term_id` or `term_taxonomy_id`; if the `$taxonomy` argument is passed this parameter will be interpreted as a `term_id`, else as a `term_taxonomy_id`.Paramint|null $term_order The order the term applies to the post, defaults to `null` to not use the term order.Paramstring|null $taxonomy The taxonomy the `term_id` is for; if passed this parameter will be used to build a `taxonomy_term_id` from the `term_id`.
Returnvoid
ThrowsModuleException If a `term_id` is specified but it cannot be matched to the `taxonomy`.See\Codeception\Module\WPDb::seePostWithTermInDatabase()- canSeePostWithTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a post to term relation exists in the database.
The method will check the "term_relationships" table.
@example ```php $fiction = $I->haveTermInDatabase('fiction', 'genre'); $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]); $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']); ```
Paramint $post_id The post ID.Paramint $term_taxonomy_id The term `term_id` or `term_taxonomy_id`; if the `$taxonomy` argument is passed this parameter will be interpreted as a `term_id`, else as a `term_taxonomy_id`.Paramint|null $term_order The order the term applies to the post, defaults to `null` to not use the term order.Paramstring|null $taxonomy The taxonomy the `term_id` is for; if passed this parameter will be used to build a `taxonomy_term_id` from the `term_id`.
Returnvoid
ThrowsModuleException If a `term_id` is specified but it cannot be matched to the `taxonomy`.See\Codeception\Module\WPDb::seePostWithTermInDatabase()- seeUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a user is in the database.
The method will check the "users" table.
@example ```php $I->seeUserInDatabase([ "user_email" => "test@example.org", "user_login" => "login name" ]) ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeUserInDatabase()- canSeeUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a user is in the database.
The method will check the "users" table.
@example ```php $I->seeUserInDatabase([ "user_email" => "test@example.org", "user_login" => "login name" ]) ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeUserInDatabase()- dontSeeUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a user is not in the database.
@example ```php // Asserts a user does not exist in the database. $I->dontSeeUserInDatabase(['user_login' => 'luca']); // Asserts a user with email and login is not in the database. $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeUserInDatabase()- cantSeeUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a user is not in the database.
@example ```php // Asserts a user does not exist in the database. $I->dontSeeUserInDatabase(['user_login' => 'luca']); // Asserts a user with email and login is not in the database. $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeUserInDatabase()- havePageInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a page in the database.
@example ```php // Creates a test page in the database with random values. $randomPageId = $I->havePageInDatabase(); // Creates a test page in the database defining its title. $testPageId = $I->havePageInDatabase(['post_title' => 'Test page']); ```
Paramarray$overrides An array of values to override the default ones.
Returnint The inserted page post ID.
See\Codeception\Module\WPDb::havePostInDatabase()See\Codeception\Module\WPDb::havePageInDatabase()- havePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a post in the database.
Paramarray$data An associative array of post data to override default and random generated values.
Returnint post_id The inserted post ID.
Throws\Exception If there's an exception during the insertion.
@example ```php // Insert a post with random values in the database. $randomPostId = $I->havePostInDatabase(); // Insert a post with specific values in the database. $I->havePostInDatabase([ 'post_type' => 'book', 'post_title' => 'Alice in Wonderland', 'meta_input' => [ 'readers_count' => 23 ], 'tax_input' => [ ['genre' => 'fiction'] ] ]); ```
See\Codeception\Module\WPDb::havePostInDatabase()- grabPostsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the posts prefixed table name.
@example ```php // Given a `wp_` table prefix returns `wp_posts`. $postsTable = $I->grabPostsTableName(); // Given a `wp_` table prefix returns `wp_23_posts`. $I->useBlog(23); $postsTable = $I->grabPostsTableName(); ```
Returnstring The prefixed table name, e.g. `wp_posts`See\Codeception\Module\WPDb::grabPostsTableName()- grabLatestEntryByFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the id value of the last table entry.
@example ```php $I->haveManyPostsInDatabase(); $postsTable = $I->grabPostsTableName(); $last = $I->grabLatestEntryByFromDatabase($postsTable, 'ID'); ```
Paramstring $tableName The table to fetch the last insertion for.Paramstring $idColumn The column that is used, in the table, to uniquely identify items.
Returnint The last insertion id.See\Codeception\Module\WPDb::grabLatestEntryByFromDatabase()- havePostmetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Adds one or more meta key and value couples in the database for a post.
@example ```php // Set the post-meta for a post. $I->havePostmetaInDatabase($postId, 'karma', 23); // Set an array post-meta for a post, it will be serialized in the db. $I->havePostmetaInDatabase($postId, 'data', ['one', 'two']); // Use a loop to insert one meta per row. foreach( ['one', 'two'] as $value){ $I->havePostmetaInDatabase($postId, 'data', $value); } ```Paramint $postId The post ID.Paramstring $meta_key The meta key.Parammixed $meta_value The value to insert in the database, objects and arrays will be serialized.
Returnint The inserted meta `meta_id`.
See\Codeception\Module\WPDb::havePostmetaInDatabase()- grabPostmetaTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed post meta table name.
@example ```php // Returns 'wp_postmeta'. $I->grabPostmetaTableName(); // Returns 'wp_23_postmeta'. $I->useBlog(23); $I->grabPostmetaTableName(); ```
Returnstring The prefixed `postmeta` table name, e.g. `wp_postmeta`.See\Codeception\Module\WPDb::grabPostmetaTableName()- grabTermIdFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets a term ID from the database. Looks up the prefixed `terms` table, e.g. `wp_terms`.
@example ```php // Return the 'fiction' term 'term_id'. $termId = $I->grabTermIdFromDatabase(['name' => 'fiction']); // Get a term ID by more stringent criteria. $termId = $I->grabTermIdFromDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']); // Return the 'term_id' of the first term for a group. $termId = $I->grabTermIdFromDatabase(['term_group' => 23]); ```
Paramarray$criteria An array of search criteria.
Returnint The matching term `term_id`See\Codeception\Module\WPDb::grabTermIdFromDatabase()- grabTermsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed terms table name, e.g. `wp_terms`.
@example ```php // Returns 'wp_terms'. $I->grabTermsTableName(); // Returns 'wp_23_terms'. $I->useBlog(23); $I->grabTermsTableName(); ```
Returnstring The prefixed terms table name.See\Codeception\Module\WPDb::grabTermsTableName()- haveTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a term in the database.
@example ```php // Insert a random 'genre' term in the database. $I->haveTermInDatabase('non-fiction', 'genre'); // Insert a term in the database with term meta. $I->haveTermInDatabase('fiction', 'genre', [ 'slug' => 'genre--fiction', 'meta' => [ 'readers_count' => 23 ] ]); ```
Paramstring $name The term name, e.g. "Fuzzy".Paramstring $taxonomy The term taxonomyParamarray$overrides An array of values to override the default ones.
ReturnarrayAn array containing `term_id` and `term_taxonomy_id` of the inserted term. See\Codeception\Module\WPDb::haveTermInDatabase()- grabTermTaxonomyTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed term and taxonomy table name, e.g. `wp_term_taxonomy`.
@example ```php // Returns 'wp_term_taxonomy'. $I->grabTermTaxonomyTableName(); // Returns 'wp_23_term_taxonomy'. $I->useBlog(23); $I->grabTermTaxonomyTableName(); ```
Returnstring The prefixed term taxonomy table name.See\Codeception\Module\WPDb::grabTermTaxonomyTableName()- haveTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a term meta row in the database. Objects and array meta values will be serialized.
@example ```php $I->haveTermMetaInDatabase($fictionId, 'readers_count', 23); // Insert some meta that will be serialized. $I->haveTermMetaInDatabase($fictionId, 'flags', [3, 4, 89]); // Use a loop to insert one meta per row. foreach([3, 4, 89] as $value) { $I->haveTermMetaInDatabase($fictionId, 'flag', $value); } ```
Paramint $term_id The ID of the term to insert the meta for.Paramstring $meta_key The key of the meta to insert.Parammixed $meta_value The value of the meta to insert, if serializable it will be serialized.
Returnint The inserted term meta `meta_id`.See\Codeception\Module\WPDb::haveTermMetaInDatabase()- grabTermMetaTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the terms meta table prefixed name.
@example ```php // Returns 'wp_termmeta'. $I->grabTermMetaTableName(); // Returns 'wp_23_termmeta'. $I->useBlog(23); $I->grabTermMetaTableName(); ```
Returnstring The prefixed term meta table name.See\Codeception\Module\WPDb::grabTermMetaTableName()- grabTermTaxonomyIdFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets a `term_taxonomy_id` from the database.
Looks up the prefixed `terms_relationships` table, e.g. `wp_term_relationships`.
@example ```php // Get the `term_taxonomy_id` for a term and a taxonomy. $I->grabTermTaxonomyIdFromDatabase(['term_id' => $fictionId, 'taxonomy' => 'genre']); // Get the `term_taxonomy_id` for the first term with a count of 23. $I->grabTermTaxonomyIdFromDatabase(['count' => 23]); ```
Paramarray$criteria An array of search criteria.
Returnint The matching term `term_taxonomy_id`See\Codeception\Module\WPDb::grabTermTaxonomyIdFromDatabase()- haveTermRelationshipInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Creates a term relationship in the database.
No check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.
@example ```php // Assign the `fiction` term to a book. $I->haveTermRelationshipInDatabase($bookId, $fictionId); ```
Paramint $object_id A post ID, a user ID or anything that can be assigned a taxonomy term.Paramint $term_taxonomy_id The `term_taxonomy_id` of the term and taxonomy to create a relation with.Paramint $term_order Defaults to `0`.
ReturnvoidSee\Codeception\Module\WPDb::haveTermRelationshipInDatabase()- grabTermRelationshipsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed term relationships table name, e.g. `wp_term_relationships`.
@example ```php $I->grabTermRelationshipsTableName(); ```
Returnstring The `term_relationships` table complete name, including the table prefix.See\Codeception\Module\WPDb::grabTermRelationshipsTableName()- seePageInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a page in the database.
@example ```php // Asserts a page with an exists in the database. $I->seePageInDatabase(['ID' => 23]); // Asserts a page with a slug and ID exists in the database. $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePageInDatabase()- canSeePageInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a page in the database.
@example ```php // Asserts a page with an exists in the database. $I->seePageInDatabase(['ID' => 23]); // Asserts a page with a slug and ID exists in the database. $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePageInDatabase()- seePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a post in the database.
@example ```php // Assert a post exists in the database. $I->seePostInDatabase(['ID' => 23]); // Assert a post with a slug and ID exists in the database. $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePostInDatabase()- canSeePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a post in the database.
@example ```php // Assert a post exists in the database. $I->seePostInDatabase(['ID' => 23]); // Assert a post with a slug and ID exists in the database. $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seePostInDatabase()- dontSeePageInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a page is not in the database.
@example ```php // Assert a page with an ID does not exist. $I->dontSeePageInDatabase(['ID' => 23]); // Assert a page with a slug and ID. $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePageInDatabase()- cantSeePageInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a page is not in the database.
@example ```php // Assert a page with an ID does not exist. $I->dontSeePageInDatabase(['ID' => 23]); // Assert a page with a slug and ID. $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePageInDatabase()- dontSeePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a post is not in the database.
@example ```php // Asserts a post with title 'Test' is not in the database. $I->dontSeePostInDatabase(['post_title' => 'Test']); // Asserts a post with title 'Test' and content 'Test content' is not in the database. $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePostInDatabase()- cantSeePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a post is not in the database.
@example ```php // Asserts a post with title 'Test' is not in the database. $I->dontSeePostInDatabase(['post_title' => 'Test']); // Asserts a post with title 'Test' and content 'Test content' is not in the database. $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeePostInDatabase()- seeCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a comment in the database.
Will look up the "comments" table.
@example ```php $I->seeCommentInDatabase(['comment_ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeCommentInDatabase()- canSeeCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a comment in the database.
Will look up the "comments" table.
@example ```php $I->seeCommentInDatabase(['comment_ID' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeCommentInDatabase()- dontSeeCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a comment is not in the database.
Will look up the "comments" table.
@example ```php // Checks for one comment. $I->dontSeeCommentInDatabase(['comment_ID' => 23]); // Checks for comments from a user. $I->dontSeeCommentInDatabase(['user_id' => 89]); ```
Paramarray$criteria The search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeCommentInDatabase()- cantSeeCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a comment is not in the database.
Will look up the "comments" table.
@example ```php // Checks for one comment. $I->dontSeeCommentInDatabase(['comment_ID' => 23]); // Checks for comments from a user. $I->dontSeeCommentInDatabase(['user_id' => 89]); ```
Paramarray$criteria The search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeCommentInDatabase()- seeCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a comment meta value is in the database. Will look up the "commentmeta" table.
@example ```php // Assert a specifid meta for a comment exists. $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]); // Assert the comment has at least one meta set. $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeCommentMetaInDatabase()- canSeeCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a comment meta value is in the database. Will look up the "commentmeta" table.
@example ```php // Assert a specifid meta for a comment exists. $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]); // Assert the comment has at least one meta set. $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeCommentMetaInDatabase()- dontSeeCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a comment meta value is not in the database.
Will look up the "commentmeta" table.
@example ```php // Delete a comment `karma` meta. $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']); // Delete all meta for a comment. $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeCommentMetaInDatabase()- cantSeeCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a comment meta value is not in the database.
Will look up the "commentmeta" table.
@example ```php // Delete a comment `karma` meta. $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']); // Delete all meta for a comment. $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeCommentMetaInDatabase()- seeUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a user meta value in the database.
@example ```php $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeUserMetaInDatabase()- canSeeUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a user meta value in the database.
@example ```php $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeUserMetaInDatabase()- dontSeeUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Check that a user meta value is not in the database.
@example ```php // Asserts a user does not have a 'karma' meta assigned. $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']); // Asserts no user has any 'karma' meta assigned. $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeUserMetaInDatabase()- cantSeeUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Check that a user meta value is not in the database.
@example ```php // Asserts a user does not have a 'karma' meta assigned. $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']); // Asserts no user has any 'karma' meta assigned. $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeUserMetaInDatabase()- dontHaveLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a link from the database.
@example ```php $I->dontHaveLinkInDatabase(['link_url' => 'http://example.com']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveLinkInDatabase()- dontHaveInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Deletes a database entry.
Paramstring $table The table name.Paramarray$criteria An associative array of the column names and values to use as deletion criteria.
Returnvoid @example ```php $I->dontHaveInDatabase('custom_table', ['book_ID' => 23, 'book_genre' => 'fiction']); ```
See\Codeception\Module\WPDb::dontHaveInDatabase()- dontHaveTermRelationshipInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the term_relationships table.
@example ```php // Remove the relation between a post and a category. $I->dontHaveTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $ttaxId]); // Remove all terms for a post. $I->dontHaveTermMetaInDatabase(['object_id' => $postId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveTermRelationshipInDatabase()- dontHaveTermTaxonomyInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the `term_taxonomy` table.
@example ```php // Remove a specific term from the genre taxonomy. $I->dontHaveTermTaxonomyInDatabase(['term_id' => $postId, 'taxonomy' => 'genre']); // Remove all terms for a taxonomy. $I->dontHaveTermTaxonomyInDatabase(['taxonomy' => 'genre']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveTermTaxonomyInDatabase()- dontHaveUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the usermeta table.
@example ```php // Remove the `karma` user meta for a user. $I->dontHaveUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']); // Remove all the user meta for a user. $I->dontHaveUserMetaInDatabase(['user_id' => 23]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveUserMetaInDatabase()- grabUserMetaFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets a user meta from the database.
@example ```php // Returns a user 'karma' value. $I->grabUserMetaFromDatabase($userId, 'karma'); // Returns an array, the unserialized version of the value stored in the database. $I->grabUserMetaFromDatabase($userId, 'api_data'); ```
Paramint $userId The ID of th user to get the meta for.Paramstring $meta_key The meta key to fetch the value for.
ReturnarrayAn associative array of meta key/values.
Throws\Exception If the search criteria is incoherent.See\Codeception\Module\WPDb::grabUserMetaFromDatabase()- grabAllFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns all entries matching a criteria from the database.
@example ```php $books = $I->grabPrefixedTableNameFor('books'); $I->grabAllFromDatabase($books, 'title', ['genre' => 'fiction']); ```
Paramstring $table The table to grab the values from.Paramstring $column The column to fetch.Paramarray$criteria The search criteria.
ReturnarrayAn array of results.
Throws\Exception If the criteria is inconsistent.See\Codeception\Module\WPDb::grabAllFromDatabase()- haveTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a transient in the database.
If the value is an array or an object then the value will be serialized. Since the transients are set in the context of tests it's not possible to set an expiration directly.
@example ```php // Store an array in the `tweets` transient. $I->haveTransientInDatabase('tweets', $tweets); ```
Paramstring $transient The transient name.Parammixed $value The transient value.
Returnint The inserted option `option_id`.See\Codeception\Module\WPDb::haveTransientInDatabase()- haveOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts an option in the database.
@example ```php $I->haveOptionInDatabase('posts_per_page', 23); $I->haveOptionInDatabase('my_plugin_options', ['key_one' => 'value_one', 'key_two' => 89]); ```
If the option value is an object or an array then the value will be serialized.
Paramstring $option_name The option name.Parammixed $option_value The option value; if an array or object it will be serialized.Paramstring $autoload Wether the option should be autoloaded by WordPress or not.
Returnint The inserted option `option_id`See\Codeception\Module\WPDb::haveOptionInDatabase()- dontHaveTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a transient from the database.
@example ```php // Removes the `tweets` transient from the database, if set. $I->dontHaveTransientInDatabase('tweets'); ```
Paramstring $transient The name of the transient to delete.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveTransientInDatabase()- dontHaveOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the options table.
@example ```php // Remove the `foo` option. $I->dontHaveOptionInDatabase('foo'); // Remove the 'bar' option only if it has the `baz` value. $I->dontHaveOptionInDatabase('bar', 'baz'); ```
Paramstring $key The option name.Parammixed|null $value If set the option will only be removed if its value matches the passed one.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveOptionInDatabase()- haveSiteOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a site option in the database.
If the value is an array or an object then the value will be serialized.
@example ```php $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23'); ```
Paramstring $key The name of the option to insert.Parammixed $value The value ot insert for the option.
Returnint The inserted option `option_id`.See\Codeception\Module\WPDb::haveSiteOptionInDatabase()- useMainBlog public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets the current blog to the main one (`blog_id` 1).
@example ```php // Switch to the blog with ID 23. $I->useBlog(23); // Switch back to the main blog. $I->useMainBlog(); ```
ReturnvoidSee\Codeception\Module\WPDb::useMainBlog()- useBlog public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets the blog to be used.
This has nothing to do with WordPress `switch_to_blog` function, this code will affect the table prefixes used.
@example ```php // Switch to the blog with ID 23. $I->useBlog(23); // Switch back to the main blog. $I->useMainBlog(); ```
Paramint $blogId The ID of the blog to use.
ReturnvoidSee\Codeception\Module\WPDb::useBlog()- dontHaveSiteOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a site option from the database.
@example ```php // Remove the `foo_count` option. $I->dontHaveSiteOptionInDatabase('foo_count'); // Remove the `foo_count` option only if its value is `23`. $I->dontHaveSiteOptionInDatabase('foo_count', 23); ```
Paramstring $key The option name.Parammixed|null $value If set the option will only be removed it its value matches the specified one.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveSiteOptionInDatabase()- haveSiteTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a site transient in the database. If the value is an array or an object then the value will be serialized.
@example ```php $I->haveSiteTransientInDatabase('total_comments_count', 23); // This value will be serialized. $I->haveSiteTransientInDatabase('api_data', ['user' => 'luca', 'token' => '11ae3ijns-j83']); ```
Paramstring $key The key of the site transient to insert, w/o the `_site_transient_` prefix.Parammixed $value The value to insert; if serializable the value will be serialized.
Returnint The inserted transient `option_id`See\Codeception\Module\WPDb::haveSiteTransientInDatabase()- dontHaveSiteTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a site transient from the database.
@example ```php $I->dontHaveSiteTransientInDatabase(['my_plugin_site_buffer']); ```
Paramstring $key The name of the transient to delete.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveSiteTransientInDatabase()- grabSiteOptionFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets a site option from the database.
@example ```php $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23'); ```
Paramstring $key The name of the option to read from the database.
Returnstring|mixed The value of the option stored in the database, unserialized if serialized.See\Codeception\Module\WPDb::grabSiteOptionFromDatabase()- grabOptionFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets an option value from the database.
@example ```php $count = $I->grabOptionFromDatabase('foo_count'); ```
Paramstring $option_name The name of the option to grab from the database.
Returnmixed The option value. If the value is serialized it will be unserialized.See\Codeception\Module\WPDb::grabOptionFromDatabase()- grabSiteTransientFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets a site transient from the database.
@example ```php $I->grabSiteTransientFromDatabase('total_comments'); $I->grabSiteTransientFromDatabase('api_data'); ```
Paramstring $key The site transient to fetch the value for, w/o the `_site_transient_` prefix.
Returnmixed|string The value of the site transient. If the value is serialized it will be unserialized.See\Codeception\Module\WPDb::grabSiteTransientFromDatabase()- seeSiteSiteTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a site option is in the database.
@example ```php // Check a transient exists. $I->seeSiteSiteTransientInDatabase('total_counts'); // Check a transient exists and has a specific value. $I->seeSiteSiteTransientInDatabase('total_counts', 23); ```
Paramstring $key The name of the transient to check for, w/o the `_site_transient_` prefix.Parammixed|null $value If provided then the assertion will include the value.
ReturnvoidSee\Codeception\Module\WPDb::seeSiteSiteTransientInDatabase()- canSeeSiteSiteTransientInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a site option is in the database.
@example ```php // Check a transient exists. $I->seeSiteSiteTransientInDatabase('total_counts'); // Check a transient exists and has a specific value. $I->seeSiteSiteTransientInDatabase('total_counts', 23); ```
Paramstring $key The name of the transient to check for, w/o the `_site_transient_` prefix.Parammixed|null $value If provided then the assertion will include the value.
ReturnvoidSee\Codeception\Module\WPDb::seeSiteSiteTransientInDatabase()- seeOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks if an option is in the database for the current blog. If checking for an array or an object then the serialized version will be checked for.
@example ```php // Checks an option is in the database. $I->seeOptionInDatabase('tables_version'); // Checks an option is in the database and has a specific value. $I->seeOptionInDatabase('tables_version', '1.0'); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeOptionInDatabase()- canSeeOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks if an option is in the database for the current blog. If checking for an array or an object then the serialized version will be checked for.
@example ```php // Checks an option is in the database. $I->seeOptionInDatabase('tables_version'); // Checks an option is in the database and has a specific value. $I->seeOptionInDatabase('tables_version', '1.0'); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeOptionInDatabase()- seeSiteOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a site option is in the database.
@example ```php // Check that the option is set in the database. $I->seeSiteOptionInDatabase('foo_count'); // Check that the option is set and has a specific value. $I->seeSiteOptionInDatabase('foo_count', 23); ```
Paramstring $key The name of the otpion to check.Parammixed|null $value If set the assertion will also check the option value.
ReturnvoidSee\Codeception\Module\WPDb::seeSiteOptionInDatabase()- canSeeSiteOptionInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a site option is in the database.
@example ```php // Check that the option is set in the database. $I->seeSiteOptionInDatabase('foo_count'); // Check that the option is set and has a specific value. $I->seeSiteOptionInDatabase('foo_count', 23); ```
Paramstring $key The name of the otpion to check.Parammixed|null $value If set the assertion will also check the option value.
ReturnvoidSee\Codeception\Module\WPDb::seeSiteOptionInDatabase()- haveManyPostsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many posts in the database returning their IDs.
Paramint $count The number of posts to insert.Paramarray$overrides { An array of values to override the defaults. The `{{n}}` placeholder can be used to have the post count inserted in its place; e.g. `Post Title - {{n}}` will be set to `Post Title - 0` for the first post, `Post Title - 1` for the second one and so on. The same applies to meta values as well.
ReturnarrayAn array of the inserted post IDs.
@example ```php // Insert 3 random posts. $I->haveManyPostsInDatabase(3); // Insert 3 posts with generated titles. $I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']); ```
See\Codeception\Module\WPDb::haveManyPostsInDatabase()- seeTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a term in the database. Looks up the `terms` and `term_taxonomy` prefixed tables.
Paramarray$criteria An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.
Returnvoid @example ```php $I->seeTermInDatabase(['slug' => 'genre--fiction']); $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']); ```
See\Codeception\Module\WPDb::seeTermInDatabase()- canSeeTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a term in the database. Looks up the `terms` and `term_taxonomy` prefixed tables.
Paramarray$criteria An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.
Returnvoid @example ```php $I->seeTermInDatabase(['slug' => 'genre--fiction']); $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']); ```
See\Codeception\Module\WPDb::seeTermInDatabase()- dontHaveTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a term from the database.
@example ```php $I->dontHaveTermInDatabase(['name' => 'romance']); $I->dontHaveTermInDatabase(['slug' => 'genre--romance']); ```
Paramarray$criteria An array of search criteria. Parambool $purgeMeta Whether the terms meta should be purged along side with the meta or not.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveTermInDatabase()- dontHaveTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a term meta from the database.
@example ```php // Remove the "karma" key. $I->dontHaveTermMetaInDatabase(['term_id' => $termId, 'meta_key' => 'karma']); // Remove all meta for the term. $I->dontHaveTermMetaInDatabase(['term_id' => $termId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveTermMetaInDatabase()- dontSeeTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Makes sure a term is not in the database.
Looks up both the `terms` table and the `term_taxonomy` tables.
Paramarray$criteria An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.
Returnvoid
@example ```php // Asserts a 'fiction' term is not in the database. $I->dontSeeTermInDatabase(['name' => 'fiction']); // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database. $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']); ```See\Codeception\Module\WPDb::dontSeeTermInDatabase()- cantSeeTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Makes sure a term is not in the database.
Looks up both the `terms` table and the `term_taxonomy` tables.
Paramarray$criteria An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.
Returnvoid
@example ```php // Asserts a 'fiction' term is not in the database. $I->dontSeeTermInDatabase(['name' => 'fiction']); // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database. $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']); ```See\Codeception\Module\WPDb::dontSeeTermInDatabase()- haveManyCommentsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many comments in the database.
@example ```php // Insert 3 random comments for a post. $I->haveManyCommentsInDatabase(3, $postId); // Insert 3 random comments for a post. $I->haveManyCommentsInDatabase(3, $postId, ['comment_content' => 'Comment {{n}}']); ```
Paramint $count The number of comments to insert.Paramint $comment_post_ID The comment parent post ID.Paramarray$overrides An associative array to override the defaults.
ReturnarrayAn array containing the inserted comments IDs. See\Codeception\Module\WPDb::haveManyCommentsInDatabase()- haveCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a comment in the database.
@example ```php $I->haveCommentInDatabase($postId, ['comment_content' => 'Test Comment', 'comment_karma' => 23]); ```
Paramint $comment_post_ID The id of the post the comment refers to.Paramarray$data The comment data overriding default and random generated values.
Returnint The inserted comment `comment_id`.See\Codeception\Module\WPDb::haveCommentInDatabase()- haveCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a comment meta field in the database. Array and object meta values will be serialized.
@example ```php $I->haveCommentMetaInDatabase($commentId, 'api_ID', 23); // The value will be serialized. $apiData = ['ID' => 23, 'user' => 89, 'origin' => 'twitter']; $I->haveCommentMetaInDatabase($commentId, 'api_data', $apiData); ```
Paramint $comment_id The ID of the comment to insert the meta for.Paramstring $meta_key The key of the comment meta to insert.Parammixed $meta_value The value of the meta to insert, if serializable it will be serialized.
Returnint The inserted comment meta ID.See\Codeception\Module\WPDb::haveCommentMetaInDatabase()- grabCommentmetaTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed comment meta table name.
@example ```php // Get all the values of 'karma' for all comments. $commentMeta = $I->grabCommentmetaTableName(); $I->grabAllFromDatabase($commentMeta, 'meta_value', ['meta_key' => 'karma']); ```
Returnstring The complete name of the comment meta table name, including the table prefix.See\Codeception\Module\WPDb::grabCommentmetaTableName()- countRowsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the number of table rows matching a criteria.
@example ```php $I->haveManyPostsInDatabase(3, ['post_status' => 'draft' ]); $I->haveManyPostsInDatabase(3, ['post_status' => 'private' ]); // Make sure there are now the expected number of draft posts. $postsTable = $I->grabPostsTableName(); $draftsCount = $I->countRowsInDatabase($postsTable, ['post_status' => 'draft']); ```
Paramstring $table The table to count the rows in.Paramarray$criteria Search criteria, if empty all table rows will be counted.
Returnint The number of table rows matching the search criteria.See\Codeception\Module\WPDb::countRowsInDatabase()- dontHaveCommentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the comments table.
@example ```php $I->dontHaveCommentInDatabase(['comment_post_ID' => 23, 'comment_url' => 'http://example.copm']); ```
Paramarray$criteria An array of search criteria. Parambool $purgeMeta If set to `true` then the meta for the comment will be purged too.
Returnvoid
Throws\Exception In case of incoherent query criteria.See\Codeception\Module\WPDb::dontHaveCommentInDatabase()- grabCommentsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the comments table name.
@example ```php // Will be `wp_comments`. $comments = $I->grabCommentsTableName(); // Will be `wp_23_comments`. $I->useBlog(23); $comments = $I->grabCommentsTableName(); ```
Returnstring The prefixed table name, e.g. `wp_comments`.See\Codeception\Module\WPDb::grabCommentsTableName()- dontHaveCommentMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a post comment meta from the database
@example ```php // Remove all meta for the comment with an ID of 23. $I->dontHaveCommentMetaInDatabase(['comment_id' => 23]); // Remove the `count` comment meta for the comment with an ID of 23. $I->dontHaveCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'count']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveCommentMetaInDatabase()- haveManyLinksInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many links in the database `links` table.
@example ```php // Insert 3 randomly generated links in the database. $linkIds = $I->haveManyLinksInDatabase(3); // Inserts links in the database replacing the `n` placeholder. $linkIds = $I->haveManyLinksInDatabase(3, ['link_url' => 'http://example.org/test-{{n}}']); ```
Paramint $count The number of links to insert.Paramarray$overrides Overrides for the default arguments.
ReturnarrayAn array of inserted `link_id`s. See\Codeception\Module\WPDb::haveManyLinksInDatabase()- haveLinkInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a link in the database.
@example ```php $linkId = $I->haveLinkInDatabase(['link_url' => 'http://example.org']); ```
Paramarray$overrides The data to insert.
Returnint The inserted link `link_id`.See\Codeception\Module\WPDb::haveLinkInDatabase()- grabLinksTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed links table name.
@example ```php // Given a `wp_` table prefix returns `wp_links`. $linksTable = $I->grabLinksTableName(); // Given a `wp_` table prefix returns `wp_23_links`. $I->useBlog(23); $linksTable = $I->grabLinksTableName(); ```
Returnstring The links table including the blog-aware table prefix.See\Codeception\Module\WPDb::grabLinksTableName()- haveManyUsersInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many users in the database.
@example ```php $subscribers = $I->haveManyUsersInDatabase(5, 'user-{{n}}'); $editors = $I->haveManyUsersInDatabase( 5, 'user-{{n}}', 'editor', ['user_email' => 'user-{{n}}@example.org'] ); ```
Paramint $count The number of users to insert.Paramstring $user_login The user login name.Paramstring $role The user role.Paramarray$overrides An array of values to override the default ones.
ReturnarrayAn array of user IDs. See\Codeception\Module\WPDb::haveManyUsersInDatabase()- haveUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a user and its meta in the database.
Paramstring $user_login The user login name.Paramstring|array$role The user role slug(s), e.g. `administrator` or `['author', 'editor']`; defaults to `subscriber`. If more than one role is specified, then the first role in the list will be the user primary role and the `wp_user_level` will be set to that role. Paramarray$overrides An associative array of column names and values overriding defaults in the `users` and `usermeta` table.
Returnint The inserted user ID.
@example ```php // Create an editor user in blog 1 w/ specific email. $userId = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);
// Create a subscriber user in blog 1. $subscriberId = $I->haveUserInDatabase('subscriber');
// Create a user editor in blog 1, author in blog 2, administrator in blog 3. $userWithMeta = $I->haveUserInDatabase('luca', [ 1 => 'editor', 2 => 'author', 3 => 'administrator' ], [ 'user_email' => 'luca@example.org' 'meta' => ['a meta_key' => 'a_meta_value'] ] );
// Create editor in blog 1 w/ `edit_themes` cap, author in blog 2, admin in blog 3 w/o `manage_options` cap. $userWithMeta = $I->haveUserInDatabase('luca', [ 1 => ['editor', 'edit_themes'], 2 => 'author', 3 => ['administrator' => true, 'manage_options' => false] ] );
// Create a user w/o role. $userId = $I->haveUserInDatabase('luca', ''); ```
SeeWPDb::haveUserCapabilitiesInDatabase() for the roles and caps options.See\Codeception\Module\WPDb::haveUserInDatabase()- getUsersTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed users table name.
@example ```php // Given a `wp_` table prefix returns `wp_users`. $usersTable = $I->getUsersTableName(); // Given a `wp_` table prefix returns `wp_users`. $I->useBlog(23); $usersTable = $I->getUsersTableName(); ```
Returnstring The users table including the table prefix.DeprecatedUse `grabUsersTableName`.See\Codeception\Module\WPDb::getUsersTableName()- grabUsersTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed users table name.
@example ```php // Given a `wp_` table prefix returns `wp_users`. $usersTable = $I->grabUsersTableName(); // Given a `wp_` table prefix returns `wp_users`. $I->useBlog(23); $usersTable = $I->grabUsersTableName(); ```
Returnstring The users table including the table prefix.See\Codeception\Module\WPDb::grabUsersTableName()- haveUserCapabilitiesInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets a user capabilities in the database.
@example ```php // Assign one user a role in a blog. $blogId = $I->haveBlogInDatabase('test'); $editor = $I->haveUserInDatabase('luca', 'editor'); $capsIds = $I->haveUserCapabilitiesInDatabase($editor, [$blogId => 'editor']);
// Assign a user two roles in blog 1. $capsIds = $I->haveUserCapabilitiesInDatabase($userId, ['editor', 'subscriber']);
// Assign one user different roles in different blogs. $capsIds = $I->haveUserCapabilitiesInDatabase($userId, [$blogId1 => 'editor', $blogId2 => 'author']);
// Assign a user a role and an additional capability in blog 1. $I->haveUserCapabilitiesInDatabase($userId, ['editor' => true, 'edit_themes' => true]);
// Assign a user a mix of roles and capabilities in different blogs. $capsIds = $I->haveUserCapabilitiesInDatabase( $userId, [ $blogId1 => ['editor' => true, 'edit_themes' => true], $blogId2 => ['administrator' => true, 'edit_themes' => false] ] ); ```
Paramint $userId The ID of the user to set the capabilities of.Paramstring|array|array $role Either a role string (e.g. `administrator`),an associative array of blog IDs/roles for a multisite installation (e.g. `[1 => 'administrator`, 2 => 'subscriber']`).
Returnarray|int> An array of inserted `meta_id`. See\Codeception\Module\WPDb::haveUserCapabilitiesInDatabase()- haveUserMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets a user meta in the database.
@example ```php $userId = $I->haveUserInDatabase('luca', 'editor'); $I->haveUserMetaInDatabase($userId, 'karma', 23); ```
Paramint $userId The user ID.Paramstring $meta_key The meta key to set the value for.Parammixed $meta_value Either a single value or an array of values; objects will be serialized while array of values will trigger the insertion of multiple rows.
ReturnarrayAn array of inserted `umeta_id`s. See\Codeception\Module\WPDb::haveUserMetaInDatabase()- grabUsermetaTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the prefixed users meta table name.
@example ```php // Given a `wp_` table prefix returns `wp_usermeta`. $usermetaTable = $I->grabUsermetaTableName(); // Given a `wp_` table prefix returns `wp_usermeta`. $I->useBlog(23); $usermetaTable = $I->grabUsermetaTableName(); ```
Returnstring The user meta table name.See\Codeception\Module\WPDb::grabUsermetaTableName()- haveUserLevelsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets the user access level meta in the database for a user.
Paramint $userId The ID of the user to set the level for.Paramarray|string $role Either a role string (e.g. `administrator`) or an array of blog IDs/roles for a multisite installation (e.g. `[1 => 'administrator`, 2 => 'subscriber']`).
ReturnarrayAn array of inserted `meta_id`. @example ```php $userId = $I->haveUserInDatabase('luca', 'editor'); $moreThanAnEditorLessThanAnAdmin = 8; $I->haveUserLevelsInDatabase($userId, $moreThanAnEditorLessThanAnAdmin); ```
See\Codeception\Module\WPDb::haveUserLevelsInDatabase()- haveManyTermsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many terms in the database.
@example ```php $terms = $I->haveManyTermsInDatabase(3, 'genre-{{n}}', 'genre'); $termIds = array_column($terms, 0); $termTaxonomyIds = array_column($terms, 1); ```
Paramint $count The number of terms to insert.Paramstring $name The term name template, can include the `{{n}}` placeholder.Paramstring $taxonomy The taxonomy to insert the terms for.Paramarray$overrides An associative array of default overrides.
Returnarray> An array of arrays containing `term_id` and `term_taxonomy_id` of the inserted terms. See\Codeception\Module\WPDb::haveManyTermsInDatabase()- seeTermTaxonomyInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a taxonomy taxonomy in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermTaxonomyInDatabase()- canSeeTermTaxonomyInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a taxonomy taxonomy in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermTaxonomyInDatabase()- dontSeeTermTaxonomyInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a term taxonomy is not in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTermTaxonomyInDatabase()- cantSeeTermTaxonomyInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a term taxonomy is not in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTermTaxonomyInDatabase()- seeTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a term meta in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->haveTermMetaInDatabase($termId, 'rating', 4); $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermMetaInDatabase()- canSeeTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a term meta in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->haveTermMetaInDatabase($termId, 'rating', 4); $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermMetaInDatabase()- dontSeeTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a term meta is not in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->haveTermMetaInDatabase($termId, 'rating', 4); $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTermMetaInDatabase()- cantSeeTermMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a term meta is not in the database.
@example ```php list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->haveTermMetaInDatabase($termId, 'rating', 4); $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTermMetaInDatabase()- seeTableInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a table is in the database.
@example ```php $options = $I->grabPrefixedTableNameFor('options'); $I->seeTableInDatabase($options); ```
Paramstring $table The full table name, including the table prefix.
ReturnvoidSee\Codeception\Module\WPDb::seeTableInDatabase()- canSeeTableInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a table is in the database.
@example ```php $options = $I->grabPrefixedTableNameFor('options'); $I->seeTableInDatabase($options); ```
Paramstring $table The full table name, including the table prefix.
ReturnvoidSee\Codeception\Module\WPDb::seeTableInDatabase()- grabBlogVersionsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `blog_versions` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_blog_versions`. $blogVersionsTable = $I->grabBlogVersionsTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_blog_versions`. $blogVersionsTable = $I->grabBlogVersionsTableName(); ```
Returnstring The blogs versions table name including the table prefix.See\Codeception\Module\WPDb::grabBlogVersionsTableName()- grabSiteMetaTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `sitemeta` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_sitemeta`. $blogVersionsTable = $I->grabSiteMetaTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_sitemeta`. $blogVersionsTable = $I->grabSiteMetaTableName(); ```
Returnstring The site meta table name including the table prefix.See\Codeception\Module\WPDb::grabSiteMetaTableName()- grabSignupsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `signups` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_signups`. $blogVersionsTable = $I->grabSignupsTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_signups`. $blogVersionsTable = $I->grabSignupsTableName(); ```
Returnstring The signups table name including the table prefix.See\Codeception\Module\WPDb::grabSignupsTableName()- grabRegistrationLogTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `registration_log` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_registration_log`. $blogVersionsTable = $I->grabRegistrationLogTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_registration_log`. $blogVersionsTable = $I->grabRegistrationLogTableName(); ```
Returnstring The registration log table name including the table prefix.See\Codeception\Module\WPDb::grabRegistrationLogTableName()- grabSiteTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `site` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_site`. $blogVersionsTable = $I->grabSiteTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_site`. $blogVersionsTable = $I->grabSiteTableName(); ```
Returnstring The site table name including the table prefix.See\Codeception\Module\WPDb::grabSiteTableName()- seeBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a blog in the `blogs` table.
@example ```php // Search for a blog by `blog_id`. $I->seeBlogInDatabase(['blog_id' => 23]); // Search for all blogs on a path. $I->seeBlogInDatabase(['path' => '/sub-path/']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeBlogInDatabase()- canSeeBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a blog in the `blogs` table.
@example ```php // Search for a blog by `blog_id`. $I->seeBlogInDatabase(['blog_id' => 23]); // Search for all blogs on a path. $I->seeBlogInDatabase(['path' => '/sub-path/']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeBlogInDatabase()- grabBlogsTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the prefixed `blogs` table name.
@example ```php // Assuming a `wp_` table prefix it will return `wp_blogs`. $blogVersionsTable = $I->grabBlogsTableName(); $I->useBlog(23); // Assuming a `wp_` table prefix it will return `wp_blogs`. $blogVersionsTable = $I->grabBlogsTableName(); ```
Returnstring The blogs table name including the table prefix.See\Codeception\Module\WPDb::grabBlogsTableName()- haveManyBlogsInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts many blogs in the database.
Paramint $count The number of blogs to create.Paramarray$overrides An array of values to override the default ones; `{{n}}` will be replaced by the count. Parambool $subdomain Whether the new blogs should be created as a subdomain or subfolder.
ReturnarrayAn array of inserted blogs `blog_id`s. @example ```php $blogIds = $I->haveManyBlogsInDatabase(3, ['domain' =>'test-{{n}}']); foreach($blogIds as $blogId){ $I->useBlog($blogId); $I->haveManuPostsInDatabase(3); } ```
See\Codeception\Module\WPDb::haveManyBlogsInDatabase()- haveBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts a blog in the `blogs` table.
@example ```php // Create the `test` subdomain blog. $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId]); // Create the `/test` subfolder blog. $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId], false); ```
Paramstring $domainOrPath The subdomain or the path to the be used for the blog.Paramarray$overrides An array of values to override the defaults. Parambool $subdomain Whether the new blog should be created as a subdomain (`true`) or subfolder (`true`)
Returnint The inserted blog `blog_id`.See\Codeception\Module\WPDb::haveBlogInDatabase()- getSiteDomain public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the site domain inferred from the `url` set in the config.
@example ```php $domain = $I->getSiteDomain(); // We should be redirected to the HTTPS version when visiting the HTTP version. $I->amOnPage('http://' . $domain); $I->seeCurrentUrlEquals('https://' . $domain); ```
Returnstring The site domain, e.g. `worpdress.localhost` or `localhost:8080`.See\Codeception\Module\WPDb::getSiteDomain()- dontHaveBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes one ore more blogs frome the database.
@example ```php // Remove the blog, all its tables and files. $I->dontHaveBlogInDatabase(['path' => 'test/one']); // Remove the blog entry, not the tables though. $I->dontHaveBlogInDatabase(['blog_id' => $blogId]); // Remove multiple blogs. $I->dontHaveBlogInDatabase(['domain' => 'test']); ```
Paramarray$criteria An array of search criteria to find the blog rows in the blogs table. Parambool $removeTables Remove the blog tables.Parambool $removeUploads Remove the blog uploads; requires the `WPFilesystem` module.
Returnvoid
Throws\ExceptionSee\Codeception\Module\WPDb::dontHaveBlogInDatabase()- grabBlogTableNames public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns a list of tables for a blog ID.
Paramint $blogId The ID of the blog to fetch the tables for.
ReturnarrayAn array of tables for the blog, it does not include the tables common to all blogs; an empty array if the tables for the blog do not exist.
Throws\Exception If there is any error while preparing the query. @example ```php $blogId = $I->haveBlogInDatabase('test'); $tables = $I->grabBlogTableNames($blogId); $options = array_filter($tables, function($tableName){ return str_pos($tableName, 'options') !== false; }); ```
See\Codeception\Module\WPDb::grabBlogTableNames()- dontHaveTableInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a table from the database. The case where a table does not exist is handled without raising an error.
@example ```php $ordersTable = $I->grabPrefixedTableNameFor('orders'); $I->dontHaveTableInDatabase($ordersTable); ```
Paramstring $fullTableName The full table name, including the table prefix.
Returnvoid
Throws\Exception If there is an error while dropping the table.See\Codeception\Module\WPDb::dontHaveTableInDatabase()- dontSeeBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a row is not present in the `blogs` table.
@example ```php $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false) $I->dontSeeBlogInDatabase(['path' => '/test-3/']) ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeBlogInDatabase()- cantSeeBlogInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a row is not present in the `blogs` table.
@example ```php $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false) $I->dontSeeBlogInDatabase(['path' => '/test-3/']) ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeBlogInDatabase()- useTheme public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Sets the current theme options.
@example ```php $I->useTheme('twentyseventeen'); $I->useTheme('child-of-twentyseventeen', 'twentyseventeen'); $I->useTheme('acme', 'acme', 'Acme Theme'); ```
Paramstring $stylesheet The theme stylesheet slug, e.g. `twentysixteen`.Paramstring $template The theme template slug, e.g. `twentysixteen`, defaults to `$stylesheet`.
Paramstring $themeName The theme name, e.g. `Acme`, defaults to the "title" version of `$stylesheet`.
ReturnvoidSee\Codeception\Module\WPDb::useTheme()- haveMenuInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Creates and adds a menu to a theme location in the database.
@example ```php list($termId, $termTaxId) = $I->haveMenuInDatabase('test', 'sidebar'); ```
Paramstring $slug The menu slug.Paramstring $location The theme menu location the menu will be assigned to.Paramarray$overrides An array of values to override the defaults.
ReturnarrayAn array containing the created menu `term_id` and `term_taxonomy_id`. See\Codeception\Module\WPDb::haveMenuInDatabase()- haveMenuItemInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Adds a menu element to a menu for the current theme.
Paramstring $menuSlug The menu slug the item should be added to.Paramstring $title The menu item title.Paramint|null $menuOrder An optional menu order, `1` based.Paramarray$meta An associative array that will be prefixed with `_menu_item_` for the item post meta.
Returnint The menu item post `ID` @example ```php $I->haveMenuInDatabase('test', 'sidebar'); $I->haveMenuItemInDatabase('test', 'Test one', 0); $I->haveMenuItemInDatabase('test', 'Test two', 1); ```
See\Codeception\Module\WPDb::haveMenuItemInDatabase()- seeTermRelationshipInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for a term relationship in the database.
@example ```php $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]); $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermRelationshipInDatabase()- canSeeTermRelationshipInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for a term relationship in the database.
@example ```php $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]); $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeTermRelationshipInDatabase()- haveAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Creates the database entries representing an attachment and moves the attachment file to the right location.
Paramstring $file The absolute path to the attachment file.Paramstring|int $date Either a string supported by the `strtotime` function or a UNIX timestamp that should be used to build the "year/time" uploads sub-folder structure.Paramarray$overrides An associative array of values overriding the default ones. Paramarray> $imageSizes An associative array in the format [ => [ , ]] to override the image sizes created by default.
Returnint The post ID of the inserted attachment.
ThrowsModuleException If the WPFilesystem module is not loaded in the suite or the file to attach is not readable
Throws\Gumlet\ImageResizeException If the image resize operation fails while trying to create the image sizes.
ThrowsModuleRequireException If the `WPFileSystem` module is not loaded in the suite or if the 'gumlet/php-image-resize:^1.6' package is not installed. @example ```php $file = codecept_data_dir('images/test.png'); $attachmentId = $I->haveAttachmentInDatabase($file); $image = codecept_data_dir('images/test-2.png'); $lastWeekAttachment = $I->haveAttachmentInDatabase($image, '-1 week'); ```
Requires the WPFilesystem module.
See\Codeception\Module\WPDb::haveAttachmentInDatabase()- grabSiteUrl public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the current site URL as specified in the module configuration.
@example ```php $shopPath = $I->grabSiteUrl('/shop'); ```
Paramstring $path A path that should be appended to the site URL.
Returnstring The current site URLSee\Codeception\Module\WPDb::grabSiteUrl()- seeAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks for an attachment in the database.
@example ```php $url = 'https://example.org/images/foo.png'; $I->seeAttachmentInDatabase(['guid' => $url]); ```Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeAttachmentInDatabase()- canSeeAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks for an attachment in the database.
@example ```php $url = 'https://example.org/images/foo.png'; $I->seeAttachmentInDatabase(['guid' => $url]); ```Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::seeAttachmentInDatabase()- dontSeeAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that an attachment is not in the database.
@example ```php $url = 'https://example.org/images/foo.png'; $I->dontSeeAttachmentInDatabase(['guid' => $url]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeAttachmentInDatabase()- cantSeeAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that an attachment is not in the database.
@example ```php $url = 'https://example.org/images/foo.png'; $I->dontSeeAttachmentInDatabase(['guid' => $url]); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeAttachmentInDatabase()- dontHaveAttachmentInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an attachment from the posts table.
Paramarray$criteria An array of search criteria to find the attachment post in the posts table. Parambool $purgeMeta If set to `true` then the meta for the attachment will be purged too.Parambool $removeFiles Remove all files too, requires the `WPFilesystem` module to be loaded in the suite.
Returnvoid
ThrowsModuleException If the WPFilesystem module is not loaded in the suite and the `$removeFiles` argument is `true`. @example ``` $postmeta = $I->grabpostmetatablename(); $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [ 'post_id' => $id, 'meta_key'=>'thumbnail_id' ]); // Remove only the database entry (including postmeta) but not the files. $I->dontHaveAttachmentInDatabase($thumbnailId); // Remove the database entry (including postmeta) and the files. $I->dontHaveAttachmentInDatabase($thumbnailId, true, true); ```
See\Codeception\Module\WPDb::dontHaveAttachmentInDatabase()- dontHaveAttachmentFilesInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes all the files attached with an attachment post, it will not remove the database entries. Requires the `WPFilesystem` module to be loaded in the suite.
@example ```php $posts = $I->grabPostsTableName(); $attachmentIds = $I->grabColumnFromDatabase($posts, 'ID', ['post_type' => 'attachment']); // This will only remove the files, not the database entries. $I->dontHaveAttachmentFilesInDatabase($attachmentIds); ```
Paramarray|int $attachmentIds An attachment post ID or an array of attachment post IDs.
Returnvoid
ThrowsModuleRequireException If the `WPFilesystem` module is not loaded in the suite.See\Codeception\Module\WPDb::dontHaveAttachmentFilesInDatabase()- grabAttachmentAttachedFile public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the path, as stored in the database, of an attachment `_wp_attached_file` meta. The attached file is, usually, an attachment origal file.
@example ```php $file = $I->grabAttachmentAttachedFile($attachmentId); $fileInfo = new SplFileInfo($file); $I->assertEquals('jpg', $fileInfo->getExtension()); ```
Paramint $attachmentPostId The attachment post ID.
Returnstring The attachment attached file path or an empt string if not set.See\Codeception\Module\WPDb::grabAttachmentAttachedFile()- grabAttachmentMetadata public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the metadata array for an attachment post. This is the value of the `_wp_attachment_metadata` meta.
Paramint $attachmentPostId The attachment post ID.
ReturnarrayThe unserialized contents of the attachment `_wp_attachment_metadata` meta or an empty array. @example ```php $metadata = $I->grabAttachmentMetadata($attachmentId); $I->assertEquals(['thumbnail', 'medium', 'medium_large'], array_keys($metadata['sizes']); ```
See\Codeception\Module\WPDb::grabAttachmentMetadata()- dontHavePostInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the posts table.
@example ```php $posts = $I->haveManyPostsInDatabase(3, ['post_title' => 'Test {{n}}']); $I->dontHavePostInDatabase(['post_title' => 'Test 2']); ```
Paramarray$criteria An array of search criteria. Parambool $purgeMeta If set to `true` then the meta for the post will be purged too.
ReturnvoidSee\Codeception\Module\WPDb::dontHavePostInDatabase()- dontHavePostMetaInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes an entry from the postmeta table.
@example ```php $postId = $I->havePostInDatabase(['meta_input' => ['rating' => 23]]); $I->dontHavePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'rating']); ```
Paramarray$criteria An array of search criteria.
ReturnvoidSee\Codeception\Module\WPDb::dontHavePostMetaInDatabase()- dontHaveUserInDatabaseWithEmail public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a user(s) from the database using the user email address.
@example ```php $luca = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']); $I->dontHaveUserInDatabaseWithEmail('luca@exampl.org'); ```
Paramstring $userEmail The email of the user to remove.Parambool $purgeMeta Whether the user meta should be purged alongside the user or not.
ReturnarrayAn array of the deleted user(s) ID(s) See\Codeception\Module\WPDb::dontHaveUserInDatabaseWithEmail()- grabTablePrefix public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the table prefix, namespaced for secondary blogs if selected.
@example ```php // Assuming a table prefix of `wp_` it will return `wp_`; $tablePrefix = $I->grabTablePrefix(); $I->useBlog(23); // Assuming a table prefix of `wp_` it will return `wp_23_`; $tablePrefix = $I->grabTablePrefix(); ```
Returnstring The blog aware table prefix.See\Codeception\Module\WPDb::grabTablePrefix()- dontHaveUserInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Removes a user from the database.
@example ```php $bob = $I->haveUserInDatabase('bob'); $alice = $I->haveUserInDatabase('alice'); // Remove Bob's user and meta. $I->dontHaveUserInDatabase('bob'); // Remove Alice's user but not meta. $I->dontHaveUserInDatabase($alice); ```
Paramint|string $userIdOrLogin The user ID or login name.Parambool $purgeMeta Whether the user meta should be purged alongside the user or not.
ReturnvoidSee\Codeception\Module\WPDb::dontHaveUserInDatabase()- grabUserIdFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the a user ID from the database using the user login.
@example ```php $userId = $I->grabUserIdFromDatabase('luca'); ```
Paramstring $userLogin The user login name.
Returnint The user IDSee\Codeception\Module\WPDb::grabUserIdFromDatabase()- grabPostMetaFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Gets the value of one or more post meta values from the database.
@example ```php $thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true); ```
Paramint $postId The post ID.Paramstring $metaKey The key of the meta to retrieve.Parambool $single Whether to return a single meta value or an arrya of all available meta values.
Returnmixed|arrayEither a single meta value or an array of all the available meta values. See\Codeception\Module\WPDb::grabPostMetaFromDatabase()- grabBlogTableName public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the full name of a table for a blog from a multisite installation database.
@example ```php $blogOptionTable = $I->grabBlogTableName($blogId, 'option'); ```
Paramint $blogId The blog ID.Paramstring $table The table name, without table prefix.
Returnstring The full blog table name, including the table prefix or an empty string if the table does not exist.
ThrowsModuleException If no tables are found for the blog.See\Codeception\Module\WPDb::grabBlogTableName()- dontSeeTableInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a table is not in the database.
@example ```php $options = $I->grabPrefixedTableNameFor('options'); $I->dontHaveTableInDatabase($options) $I->dontSeeTableInDatabase($options); ```
Paramstring $table The full table name, including the table prefix.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTableInDatabase()- cantSeeTableInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a table is not in the database.
@example ```php $options = $I->grabPrefixedTableNameFor('options'); $I->dontHaveTableInDatabase($options) $I->dontSeeTableInDatabase($options); ```
Paramstring $table The full table name, including the table prefix.
ReturnvoidSee\Codeception\Module\WPDb::dontSeeTableInDatabase()- grabBlogTablePrefix public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the table prefix for a blog.
@example ```php $blogId = $I->haveBlogInDatabase('test'); $blogTablePrefix = $I->getBlogTablePrefix($blogId); $blogOrders = $I->blogTablePrefix . 'orders'; ```
Paramint $blogId The blog ID.
Returnstring The table prefix for the blog.See\Codeception\Module\WPDb::grabBlogTablePrefix()- grabBlogDomain public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns a blog domain given its ID.
@example ```php $blogIds = $I->haveManyBlogsInDatabase(3); $domains = array_map(function($blogId){ return $I->grabBlogDomain($blogId); }, $blogIds); ```
Paramint $blogId The blog ID.
Returnstring The blog domain.See\Codeception\Module\WPDb::grabBlogDomain()- grabBlogPath public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Grabs a blog domain from the blogs table.
@example ```php $blogId = $I->haveBlogInDatabase('test'); $path = $I->grabBlogDomain($blogId); $I->amOnSubdomain($path); $I->amOnPage('/'); ```
Paramint $blogId The blog ID.
Returnstring The blog domain, if set in the database.See\Codeception\Module\WPDb::grabBlogPath()- dontSeePostWithTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Checks that a post to term relation does not exist in the database.
The method will check the "term_relationships" table.
@example ```php $fiction = $I->haveTermInDatabase('fiction', 'genre'); $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre'); $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]); $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], ); ```
Paramint $post_id The post ID.Paramint $term_taxonomy_id The term `term_id` or `term_taxonomy_id`; if the `$taxonomy` argument is passed this parameter will be interpreted as a `term_id`, else as a `term_taxonomy_id`.Paramint|null $term_order The order the term applies to the post, defaults to `null` to not use the term order.Paramstring|null $taxonomy The taxonomy the `term_id` is for; if passed this parameter will be used to build a `taxonomy_term_id` from the `term_id`.
Returnvoid
ThrowsModuleException If a `term_id` is specified but it cannot be matched to the `taxonomy`.See\Codeception\Module\WPDb::dontSeePostWithTermInDatabase()- cantSeePostWithTermInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Checks that a post to term relation does not exist in the database.
The method will check the "term_relationships" table.
@example ```php $fiction = $I->haveTermInDatabase('fiction', 'genre'); $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre'); $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]); $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], ); ```
Paramint $post_id The post ID.Paramint $term_taxonomy_id The term `term_id` or `term_taxonomy_id`; if the `$taxonomy` argument is passed this parameter will be interpreted as a `term_id`, else as a `term_taxonomy_id`.Paramint|null $term_order The order the term applies to the post, defaults to `null` to not use the term order.Paramstring|null $taxonomy The taxonomy the `term_id` is for; if passed this parameter will be used to build a `taxonomy_term_id` from the `term_id`.
Returnvoid
ThrowsModuleException If a `term_id` is specified but it cannot be matched to the `taxonomy`.See\Codeception\Module\WPDb::dontSeePostWithTermInDatabase()- havePostThumbnailInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Assigns the specified attachment ID as thumbnail (featured image) to a post.
@example ```php $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png')); $postId = $I->havePostInDatabase(); $I->havePostThumbnailInDatabase($postId, $attachmentId); ```
Paramint $postId The post ID to assign the thumbnail (featured image) to.Paramint $thumbnailId The post ID of the attachment.
Returnint The inserted meta id.See\Codeception\Module\WPDb::havePostThumbnailInDatabase()- dontHavePostThumbnailInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Remove the thumbnail (featured image) from a post, if any.
Please note: the method will NOT remove the attachment post, post meta and file.
@example ```php $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png')); $postId = $I->havePostInDatabase(); // Attach the thumbnail to the post. $I->havePostThumbnailInDatabase($postId, $attachmentId); // Remove the thumbnail from the post. $I->dontHavePostThumbnailInDatabase($postId); ```
Paramint $postId The post ID to remove the thumbnail (featured image) from.
ReturnvoidSee\Codeception\Module\WPDb::dontHavePostThumbnailInDatabase()- importSql public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Loads a set SQL code lines in the current database.
@example ```php // Import a SQL string. $I->importSql([$sqlString]); // Import a set of SQL strings. $I->importSql($sqlStrings); // Import a prepared set of SQL strings. $preparedSqlStrings = array_map(function($line){ return str_replace('{{date}}', date('Y-m-d H:i:s'), $line); }, $sqlTemplate); $I->importSql($preparedSqlStrings); ```
Paramarray$sql The SQL strings to load.
ReturnvoidSee\Codeception\Module\WPDb::importSql()- amConnectedToDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Make sure you are connected to the right database.
```php seeNumRecords(2, 'users'); //executed on default database $I->amConnectedToDatabase('db_books'); $I->seeNumRecords(30, 'books'); //executed on db_books database //All the next queries will be on db_books ```Param$databaseKeyThrowsModuleConfigExceptionSee\Codeception\Module\Db::amConnectedToDatabase()- performInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Can be used with a callback if you don't want to change the current database in your test.
```php seeNumRecords(2, 'users'); //executed on default database $I->performInDatabase('db_books', function($I) { $I->seeNumRecords(30, 'books'); //executed on db_books database }); $I->seeNumRecords(2, 'users'); //executed on default database ``` List of actions can be pragmatically built using `Codeception\Util\ActionSequence`:
```php performInDatabase('db_books', ActionSequence::build() ->seeNumRecords(30, 'books') ); ``` Alternatively an array can be used:
```php $I->performInDatabase('db_books', ['seeNumRecords' => [30, 'books']]); ```
Choose the syntax you like the most and use it,
Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to exception on failure.
Param$databaseKeyParam\Codeception\Util\ActionSequence|array|callable $actionsThrowsModuleConfigExceptionSee\Codeception\Module\Db::performInDatabase()- haveInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Inserts an SQL record into a database. This record will be erased after the test.
```php haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com')); ?> ```
Paramstring $tableParamarray $data
Returninteger $idSee\Codeception\Module\Db::haveInDatabase()- seeInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Asserts that a row with the given column values exists. Provide table name and column values.
```php seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']); ``` Fails if no such user found.
Comparison expressions can be used as well:
```php seeInDatabase('posts', ['num_comments >=' => '0']); $I->seeInDatabase('users', ['email like' => 'miles@davis.com']); ```
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
Paramstring $tableParamarray $criteriaSee\Codeception\Module\Db::seeInDatabase()- canSeeInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Asserts that a row with the given column values exists. Provide table name and column values.
```php seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']); ``` Fails if no such user found.
Comparison expressions can be used as well:
```php seeInDatabase('posts', ['num_comments >=' => '0']); $I->seeInDatabase('users', ['email like' => 'miles@davis.com']); ```
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
Paramstring $tableParamarray $criteriaSee\Codeception\Module\Db::seeInDatabase()- seeNumRecords public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Asserts that the given number of records were found in the database.
```php seeNumRecords(1, 'users', ['name' => 'davert']) ?> ```
Paramint $expectedNumber Expected numberParamstring $table Table nameParamarray $criteria Search criteria [Optional]See\Codeception\Module\Db::seeNumRecords()- canSeeNumRecords public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Asserts that the given number of records were found in the database.
```php seeNumRecords(1, 'users', ['name' => 'davert']) ?> ```
Paramint $expectedNumber Expected numberParamstring $table Table nameParamarray $criteria Search criteria [Optional]See\Codeception\Module\Db::seeNumRecords()- dontSeeInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Effect is opposite to ->seeInDatabase
Asserts that there is no record with the given column values in a database. Provide table name and column values.
``` php dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']); ``` Fails if such user was found.
Comparison expressions can be used as well:
```php dontSeeInDatabase('posts', ['num_comments >=' => '0']); $I->dontSeeInDatabase('users', ['email like' => 'miles%']); ```
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
Paramstring $tableParamarray $criteriaSee\Codeception\Module\Db::dontSeeInDatabase()- cantSeeInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
[!] Conditional Assertion: Test won't be stopped on fail Effect is opposite to ->seeInDatabase
Asserts that there is no record with the given column values in a database. Provide table name and column values.
``` php dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']); ``` Fails if such user was found.
Comparison expressions can be used as well:
```php dontSeeInDatabase('posts', ['num_comments >=' => '0']); $I->dontSeeInDatabase('users', ['email like' => 'miles%']); ```
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
Paramstring $tableParamarray $criteriaSee\Codeception\Module\Db::dontSeeInDatabase()- grabColumnFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Fetches all values from the column in database. Provide table name, desired column and criteria.
``` php grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter')); ```
Paramstring $tableParamstring $columnParamarray $criteria
ReturnarraySee\Codeception\Module\Db::grabColumnFromDatabase()- grabFromDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Fetches a single column value from a database. Provide table name, desired column and criteria.
``` php grabFromDatabase('users', 'email', array('name' => 'Davert')); ``` Comparison expressions can be used as well:
```php grabFromDatabase('posts', ['num_comments >=' => 100]); $user = $I->grabFromDatabase('users', ['email like' => 'miles%']); ```
Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
Paramstring $tableParamstring $columnParamarray $criteria
Returnmixed Returns a single column value or falseSee\Codeception\Module\Db::grabFromDatabase()- grabNumRecords public
- [!] Method is generated. Documentation taken from corresponding module.
Method
Returns the number of rows in a database
Paramstring $table Table nameParamarray $criteria Search criteria [Optional]
ReturnintSee\Codeception\Module\Db::grabNumRecords()- updateInDatabase public
- [!] Method is generated. Documentation taken from corresponding module.
Update an SQL record into a database.
```php updateInDatabase('users', array('isAdmin' => true), array('email' => 'miles@davis.com')); ?> ```
Paramstring $tableParamarray $dataParamarray $criteriaSee\Codeception\Module\Db::updateInDatabase()ClassUnitTester
-
Method
- getScenario protected
ClassUnitTester
-
Method
- getScenario protected
- Method
- assertEquals public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that two variables are equal.
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertEquals()
Method
- assertNotEquals public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that two variables are not equal
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertNotEquals()
Method
- assertSame public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that two variables are same
Param$expectedParam$actualParamstring $messageReturnmixed|voidSee\Codeception\Module\Asserts::assertSame()
Method
- assertNotSame public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that two variables are not same
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertNotSame()
Method
- assertGreaterThan public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that actual is greater than expected
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertGreaterThan()
Method
- assertGreaterThen public
-
[!] Method is generated. Documentation taken from corresponding module.
DeprecatedSee\Codeception\Module\Asserts::assertGreaterThen()
Method
- assertGreaterThanOrEqual public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that actual is greater or equal than expected
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertGreaterThanOrEqual()
Method
- assertGreaterThenOrEqual public
-
[!] Method is generated. Documentation taken from corresponding module.
DeprecatedSee\Codeception\Module\Asserts::assertGreaterThenOrEqual()
Method
- assertLessThan public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that actual is less than expected
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertLessThan()
Method
- assertLessThanOrEqual public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that actual is less or equal than expected
Param$expectedParam$actualParamstring $messageSee\Codeception\Module\Asserts::assertLessThanOrEqual()
Method
- assertContains public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that haystack contains needle
Param$needleParam$haystackParamstring $messageSee\Codeception\Module\Asserts::assertContains()
Method
- assertNotContains public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that haystack doesn't contain needle.
Param$needleParam$haystackParamstring $messageSee\Codeception\Module\Asserts::assertNotContains()
Method
- assertRegExp public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that string match with pattern
Paramstring $patternParamstring $stringParamstring $messageSee\Codeception\Module\Asserts::assertRegExp()
Method
- assertNotRegExp public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that string not match with pattern
Paramstring $patternParamstring $stringParamstring $messageSee\Codeception\Module\Asserts::assertNotRegExp()
Method
- assertEmpty public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that variable is empty.
Param$actualParamstring $messageSee\Codeception\Module\Asserts::assertEmpty()
Method
- assertNotEmpty public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that variable is not empty.
Param$actualParamstring $messageSee\Codeception\Module\Asserts::assertNotEmpty()
Method
- assertNull public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that variable is NULL
Param$actualParamstring $messageSee\Codeception\Module\Asserts::assertNull()
Method
- assertNotNull public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that variable is not NULL
Param$actualParamstring $messageSee\Codeception\Module\Asserts::assertNotNull()
Method
- assertTrue public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that condition is positive.
Param$conditionParamstring $messageSee\Codeception\Module\Asserts::assertTrue()
Method
- assertFalse public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks that condition is negative.
Param$conditionParamstring $messageSee\Codeception\Module\Asserts::assertFalse()
Method
- assertFileExists public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks if file exists
Paramstring $filenameParamstring $messageSee\Codeception\Module\Asserts::assertFileExists()
Method
- assertFileNotExists public
-
[!] Method is generated. Documentation taken from corresponding module.
Checks if file doesn't exist
Paramstring $filenameParamstring $messageSee\Codeception\Module\Asserts::assertFileNotExists()
Method
- assertGreaterOrEquals public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$expectedParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertGreaterOrEquals()
Method
- assertLessOrEquals public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$expectedParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertLessOrEquals()
Method
- assertIsEmpty public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$actualParam$descriptionSee\Codeception\Module\Asserts::assertIsEmpty()
Method
- assertArrayHasKey public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$keyParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertArrayHasKey()
Method
- assertArrayNotHasKey public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$keyParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertArrayNotHasKey()
Method
- assertInstanceOf public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$classParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertInstanceOf()
Method
- assertNotInstanceOf public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$classParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertNotInstanceOf()
Method
- assertInternalType public
-
[!] Method is generated. Documentation taken from corresponding module.
Param$typeParam$actualParam$descriptionSee\Codeception\Module\Asserts::assertInternalType()
Method
- fail public
-
[!] Method is generated. Documentation taken from corresponding module.
Fails the test with message.
Param$messageSee\Codeception\Module\Asserts::fail()
Method
- expectException public
-
[!] Method is generated. Documentation taken from corresponding module.
Handles and checks exception called inside callback function. Either exception class name or exception instance should be provided.
```php expectException(MyException::class, function() { $this->doSomethingBad(); });
$I->expectException(new MyException(), function() { $this->doSomethingBad(); }); ``` If you want to check message or exception code, you can pass them with exception instance: ```php expectException(new MyException("Don't do bad things"), function() { $this->doSomethingBad(); }); ```
Param$exception string or \ExceptionParam$callbackSee\Codeception\Module\Asserts::expectException()
ClassImportExportTest
Test class for ImportExport class Note that class cannot be
-
Method
- ensureSanitizedUnserialization public
-
Ensure that unserialization doesn't unpack malicious objects
@test
Returnvoid
Method
- ensureIndexedArrayIsUnserialized public
-
Ensure valid serialized string is unserialized into array
@test
Returnvoid
Method
- ensureMaliciousObjectInArrayIsSanitized public
-
Ensure valid serialized string is unserialized into array
@test
Returnvoid
Method
- makeObjectToTest protected
-
Construct the object to test
ReturnImportExportObjectToTest
Method
- allowedSerializedString protected
-
Allowed serialized JSON field object
Returnstring
Method
- disallowedObject protected
-
Malicious serialized object with wakeup function
Returnstring
Method
- disallowedObjectInArray protected
-
Embed malicious object within an indexed array
Returnstring
ClassImportExportObjectToTest
Expose methods to be tested
-
Method
- exposeSanitizeUnserialize public
ClassEvilInjection
-
Method
- __wakeup public
ClassCalculationsReactTest
-
Method
- testBasicYesDebug public
-
Test basic, expected function, yes debug
@testReturnvoid
Method
- testBasicNoDebug public
-
Test basic, expected function, no debug
@testReturnvoid
Method
- getTestedClass protected
-
Mock the class when calcs_debug is false
ReturnCalculationsReact
Class$config
-
Method
- __construct public
- Method
- exposeExtractResponses public
-
Exposes the protected method
Paramarray $calculationsReturnarray
Static Method
- setUpBeforeClass /** @inheritDoc */
- @inheritDoc
ClassNF_Telemetry_Email_SendCountTest
-
Method
- testCountMetric public
- Method
- testMaxMetric public
ClassMetaboxOutputEntityTest
-
Method
- constructFromEmptyArray public
-
Empty array constructs entity and returns array
@test
/
Method
- constructFromFullyDefinedArray public
- Construct from a fully defined array @test Method
- constructFromPoorlyDefinedArray public
- Construct from a poorly defined array Construct when label value collection has unexpected values @test
ClassSingleSubmissionTest
-
Method
- constructFromEmptyArray public
-
Empty array constructs entity and returns array
@test
/
Method
- constructFromFullyDefinedArray public
- Construct from a fully defined array @test Method
- constructFromErrantData public
- Construct from a faulty date format @test Method
- constructFromAlternateDate public
- Construct from alternate date format @test
ClassSubmissionExtraHandlerResponseTest
-
Method
- constructFromEmptyArray public
-
Empty array constructs entity and returns array
@test
/
Method
- constructFromFullyDefinedArray public
- Construct from a fully defined array @test Method
- constructFromNullValues public
- Construct when values are null @test
ClassSubmissionFieldTest
Unit test SubmissionField @covers \NinjaForms\Includes\Entities\SubmissionField
-
Method
- constructFromEmptyArray public
-
Empty array constructs entity and returns array
@test
/
Method
- constructFromFullyDefinedArray public
- Construct from a fully defined array @test Method
- ensureUndefinedKeysPassed public
- Ensure undefined properties are not lost in toArray() @test Method
- constructFromFieldsetRepeater public
- Construct from a fully defined array including fieldset repeater @test
ClassSubmissionFilterTest
-
Method
- constructFromEmptyArray public
-
Empty array constructs entity and returns array
@test
/
Method
- constructFromFullyDefinedArray public
- Construct from a fully defined array @test Method
- constructFromNullDates public
- Construct when date values are null @test
ClassSubmissionFilterFactoryTest
Ensure factory constructs SubmissionFilter with correct properties
UserId is only set in certain cases. This test class tests four combinations of two factors - user logged in (t/f) and filter present (t/f)
The loggedInUser() method REQUIRES user logged in; the maybeLimitByLoggedInUser() only requires user logged in if an external WP filter changes the default functionality.
Each comibination of four factors has a separate test for the public methods to ensure the constructs are correct.-
Method
- userNotLoggedInAndNoFiltersUnfiltered public
-
Unfiltered method must not change default userId property in SubmissionFilter
In this test series, user is NOT logged in and no external filters present
@test
Returnvoid
Method
- userNotLoggedInAndNoFiltersStartEndDates public
-
Start and End dates set correctly with default loggedInUser and filter
In this test series, user is NOT logged in and no external filters present @test @depends userNotLoggedInAndNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userNotLoggedInAndNoFiltersLoggedInUser public
-
When requiring logged in user and NOT logged in, return -1
In this test series, user is NOT logged in and no external filters present @test @depends userNotLoggedInAndNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userNotLoggedInAndNoFiltersMaybeFilter public
-
When only requiring logged in user if external filter is applied, do not override userId default
In this test series, user is NOT logged in and no external filters present @test @depends userNotLoggedInAndNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInNoFiltersUnfiltered public
-
Unfiltered method must not change default userId property in SubmissionFilter
In this test series, user IS logged in and no external filters present
@test
Returnvoid
Method
- userLoggedInNoFiltersStartEndDates public
-
Start and End dates set correctly with default loggedInUser and filter
In this test series, user IS logged in and no external filters present @test @depends userLoggedInNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInNoFiltersLoggedInUser public
-
When requiring logged in user and logged in, return userId
In this test series, user IS logged in and no external filters present @test @depends userLoggedInNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInNoFilterssMaybeFilter public
-
When only requiring logged in user if external filter is applied, do not set user id by default
In this test series, user IS logged in and no external filters present @test @depends userLoggedInNoFiltersUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userNotLoggedInAndFiltersPresentUnfiltered public
-
Unfiltered method must not change default userId property in SubmissionFilter
In this test series, user NOT logged in and external filters ARE present
@test
Returnvoid
Method
- userNotLoggedInAndFiltersPresentStartEndDates public
-
Start and End dates set correctly with default loggedInUser and filter
In this test series, user NOT logged in and external filters ARE present @test @depends userNotLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userNotLoggedInAndFiltersPresentLoggedInUser public
-
When requiring logged in user and logged in, return userId
In this test series, user NOT logged in and external filters ARE present @test @depends userNotLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userNotLoggedInAndFiltersPresentMaybeLimitByLoggedInUser public
-
When only requiring logged in user if external filter is applied, do not set user id by default
In this test series, user NOT logged in and external filters ARE present @test @depends userNotLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInAndFiltersPresentUnfiltered public
-
Unfiltered method must not change default userId property in SubmissionFilter
In this test series, user IS logged in and external filters ARE present
@test
Returnvoid
Method
- userLoggedInAndFiltersPresentStartEndDates public
-
Start and End dates set correctly with default loggedInUser and filter
In this test series, user IS logged in and external filters ARE present @test @depends userLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInAndFiltersPresentLoggedInUser public
-
When requiring logged in user and logged in, return userId
In this test series, user IS logged in and external filters ARE present @test @depends userLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- userLoggedInAndFiltersPresentMaybeLimitByLoggedInUser public
-
When only requiring logged in user if external filter is applied, do not set user id by default
In this test series, user IS logged in and external filters ARE present @test @depends userLoggedInAndFiltersPresentUnfilteredParamSubmissionFilterFactory $objectToTestReturnSubmissionFilterFactory
Method
- mockSubmissionFilterFactory protected
-
Mock object by manually setting logged in user id and external filter
Paraminteger|null $userIdParamboolean|null $limitByUserIdReturnSubmissionFilterFactory
Class$userId
-
Method
- __construct
- Method
- getUserId protected
-
Override with test value
Returninteger
Method
- provideLimitByLoggedInUserFilter protected
-
Override with test value
Returnboolean
ClassNF_Handlers_LocaleNumberFormattingTest
-
Method
- setUp public
- Method
- testLocaleDecodeZero public
- Method
- testLocaleDecodeInteger public
- Method
- testLocaleDecodeNegativeInteger public
- Method
- testLocaleDecodeNegativeFloat public
- Method
- testBadLocaleDecode public
- Method
- testLocaleDecodeWithSpaceThousandsAndCommaDecimal public
- Method
- testLocaleDecodeWithNonBreakingSpaceThousandsAndCommaDecimal public
- Method
- testLocaleDecodeWithCommaThousandsAndPeriodDecimal public
- Method
- testLocaleDecodeWithNoThousandsAndPeriodDecimal public
- Method
- testLocaleDecodeWithPeriodThousandsAndCommaDecimal public
- Method
- testLocaleDecodeWithNoThousandsAndCommaDecimal public
- Method
- testLocaleDecodeWithSpaceThousandsAndPeriodDecimal public
- Method
- testLocaleDecodeWithNonBreakingSpaceThousandsAndPeriodDecimal public
- Method
- testLocaleDecodeWithIndianCommaThousandsAndPeriodDecimal public
- Method
- testLocaleDecodeOnlyCommaThousands public
- Method
- testLocaleDecodeOnlyPeriodThousands public
- Method
- testLocaleDecodeOnlySpaceThousands public
- Method
- testLocaleDecodeOnlyNonBreakingSpaceThousands public
- Method
- testLocaleEncodeZero public
- Method
- testLocaleEncodeInteger public
- Method
- testLocaleEncodeNegativeInteger public
- Method
- testLocaleEncodeNegativeFloat public
- Method
- testBadLocaleEncode public
- Method
- testLocaleEncodeWithPeriodThousandsAndCommaDecimal public
- Method
- testLocaleEncodeWithCommaThousandsAndPeriodDecimal public
- Method
- testLocaleEncodeWithNonBreakingSpaceThousandsAndCommaDecimal public
- Method
- testLocaleEncodeWithNonBreakingSpaceThousandsAndPeriodDecimal public
- Method
- testLocaleConvertWesternToFrench public
- Method
- testLocaleConvertWesternToGerman public
- Method
- testLocaleConvertFrenchToGerman public
- Method
- testLocaleConvertFrenchToWestern public
- Method
- testLocaleConvertGermanToWestern public
- Method
- testAdditionFromGerman public
- Method
- testSubtractionFromFrench public
- Method
- testFactorial public
- Method
- testSin public
- Method
- testAdditionAndMultiplicationFromGerman public
- Method
- testComplexFunction public
ClassSubmissionAggregateCsvExportAdapterTest
Unit test SubmissionAggregateCsvExportAdapter @covers \NinjaForms\Includes\Handlers\SubmissionAggregateCsvExportAdapter
-
Method
- constructionTest01 public
-
Ensure object construction with data series 01
This series of tests uses PopulatedSubmissions-01 @testReturnSubmissionAggregate
Method
- testLabelConstruct01 public
-
Ensure all label/columns constructed with Data Series 01
@test @depends constructionTest01Returnvoid
Method
- testColumnValuesBeforeAddingFields public
-
Ensure column values are correctly populated
Assume a form is built and has submissions; then, additional fields are added to the fieldset repeater. The original submisisons must display without errors from missing data @test @depends constructionTest01ParamSubmissionAggregateCsvExportAdapter $objectToTestReturnSubmissionAggregateCsvExportAdapter
Method
- testColumnValues public
-
Ensure column values are correctly populated
This submission has checkbox, listmultiselect, and radio list in a fieldset repeater @test @depends constructionTest01ParamSubmissionAggregateCsvExportAdapter $objectToTestReturnSubmissionAggregateCsvExportAdapter
Method
- constructObjectToTest protected
-
Construct Object to test with fields and submissions
Paramstring $nFFormGetFieldsConfigParamstring $populatedSubmissionValuesReturnSubmissionAggregateCsvExportAdapter
Class$submissionAggregate
-
Method
- getFieldDefinitionCollection protected
-
Mock submission field definition collection
Returnarray SubmissionField[]
Method
- exposeConstructRepeaterColumns public
- Expose constructRepeaterColumns Method
- mockFieldDefinitionWithFieldset protected
-
Mock FieldDefinition with fieldset data
Paramstring $configFilename Collection of SubmissionField entitiesReturnarray
Method
- constructDependency protected
-
Constructs the object's dependency
Exposes protected methods as needed for testing
ReturnSubmissionAggregate
Class$nfFieldObjectsCollection
-
Method
- __construct public
- Method
- getFieldsCollection protected
-
Return the Ninja Forms field collection
Paramstring $formIdReturnarray
ClassSubmissionAggregateTest
Unit test SubmissionAggregate class @covers \NinjaForms\Includes\Handlers\SubmissionAggregate
-
Method
- constructionTest01 public
-
Ensure object construction with data series 01
This series of tests uses PopulatedSubmissions-01 @testReturnSubmissionAggregate
Method
- testGetAggregatedSubmissions01 public
-
Test getAggregateSubmissions functionality with data series 01
@test
@depends constructionTest01
ParamSubmissionAggregate $objectToTestReturnSubmissionAggregate
Method
- testGetSubmissionCount public
-
Test getSubmissionCount functionality data series 01
@test
@depends constructionTest01
ParamSubmissionAggregate $objectToTestReturnSubmissionAggregate
Method
- testGetFieldDefinitionCollection public
-
Test getFieldDefinitionCollection functionality data series 01
NOTE: The data for this method is manually set during the mocking, so this test is currently a placeholder @test @depends constructionTest01ParamSubmissionAggregate $objectToTestReturnSubmissionAggregate
Method
- constructObjectToTest protected
-
Use configured NF->form()->get_fields() file to mock DB
Paramstring $nFFormGetFieldsConfigParamstring $populatedSubmissionValuesReturnSubmissionAggregate
Class$nfFieldObjectsCollection
-
Method
- __construct public
- Method
- getFieldsCollection protected
-
Return the Ninja Forms field collection
Paramstring $formIdReturnarray
ClassNF_Telemetry_MockRepository
-
Method
- __construct public
- Method
- get public
- Method
- save public
ClassNF_MockLocale
-
Method
- __construct public
ClassPluginTestCase
-
Method
- setUp protected
- Runs before each test. Method
- setUpUnitTestMockEnvironment public
-
Sets up a mock environment for unit tests
Adds just enough function shims to do unit testing in specific areas.
Unit tests must not rely upon any of the shimmed functions, which are
present only to prevent construction errors from missing function dependencies.
Returnvoid
Method
- defineAbspath protected
-
Set ABSPATH to the Wordpress directory
Returnvoid
Method
- UnitShims protected
-
Include WP shims not handled by Brain Monkey
Returnvoid
Method
- shimNinjaForms protected
-
Shim basic Ninja_Forms() functionality to enable unit testing
Returnvoid
Method
- configureGetOption public
-
Mock get_option and update_option with global array variable
Paramarray $incomingOptionsReturnvoid
Method
- configure public
-
Return a configuration array
Paramstring $configurationNameParamstring $extensionReturnarray
Method
- tearDown public
-
Teardown which calls \WP_Mock tearDown
Returnvoid
ClassPluginTestCase
-
Method
- esc_html__
- Method
- esc_html
ClassNfField
Mocks NF_Database_Models_Field using configured data Where the following calles are made, this class can substitute: \Ninja_Forms()->form()->get_field( $fieldId ) \Ninja_Forms()->form($formId)->get_fields() (produces collection of fields) Note that each instance must be populated with configured test data
-
Method
- get_type public
-
Get the Type
Returnstring
Method
- get_setting public
-
Get a single setting with a default fallback
Paramstring $settingParambool $default optionalReturnstring|int|bool
Method
- get_settings public
-
Get Settings
Returnarray
Method
- loadSampleData public
-
Load sample data into the data source from config file
Paramstring $configurationNameParamstring $extensionReturnSubmissionDataSource
Method
- populateSampleData public
-
Populate field settings from sample data
Paramarray $settingsReturnNfField
ClassSubmissionDataSource
A data source populated by a configuration file
Provides a substitute for a database source; the data is pre-populated with submission values since it does not have a data source outside of the configuration file-
Method
- loadSampleData public
-
Load sample data into the data source
Paramstring $configurationNameParamstring $extensionReturnSubmissionDataSource
Method
- retrieveSubmissionMeta public
-
Retrieve a collection of submissions meta given filtering args
Paramarray $argsReturnSingleSubmission[]
Method
- retrieveSubmissionValues public
-
Populate with submission values a single submission in a collection
Submission collection may initially only contain submission meta to save time/memory. When called, this method retrieves the complete submission values for the provided SingleSubmision
NOTE: in a test configuration, the data is already pre-populated, so return the incoming submission. A class in test would not be testing this method; it is here to honor the contract.
ParamSingleSubmission $singleSubmissionReturnSingleSubmission
Method
- retrieveSingleSubmission public
-
Retrieve a single submission with values
Absent a previously filtered collection of single submissions within the aggregate, request a single submission, fully populate it, and return.
NOTE: in a test configuration, the data is already pre-populated, so return the incoming submission. A class in test would not be testing this method; it is here to honor the contract.ParamSingleSubmission $singleSubmissionReturnSingleSubmission
Method
- deleteSubmission public
-
Delete a submission from the data source
Honoring the contract, nothing moreParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- restoreSubmission public
-
Restore a submission from the data source
Honoring the contract, nothing moreParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- updateSubmission public
-
Update a submission from the data source
Honoring the contract, nothing moreParamSingleSubmission $singleSubmissionReturnSubmissionDataSource
Method
- getDataSource public
-
Return the dataSource id
Identifies the implementing class, enabling retrieval of submission specifics by calling the implementing classReturnstring
ClassSubmissionDataSource
-
Method
- __
ClassVerifyTestStructureTest
-
Method
- ensureTestSuiteRuns public
- @test Method
- ensureTestSuiteFalse public
- @test
ClassNF_Telemetry_MockRepository
-
Method
- __construct public
- Method
- get public
- Method
- save public
ClassNF_MockLocale
-
Method
- __construct public