GravityKit\GravityMigrate\Export
Gravity Forms export class.
Source: src/Export.php:20
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate
Methods
| Method | Description |
|---|---|
__construct() | Constructor. |
get_instance() | Returns class instance. |
filter_available_data_types() | Filters requested export data types down to those whose backing Gravity Forms |
get_gf_settings() | Returns Gravity Forms form settings allowed to be exported. |
get_gk_settings() | Returns GravityKit settings allowed to be exported. |
get_dates_filter_query() | Returns the WHERE statement for date filter. |
get_tables_where() | Returns the final WHERE statement to add to the export query. |
post_content_match_selection() | Checks if post content shortcodes' or blocks' attribute value matches user's selection of forms to export. |
get_table_structure() | Returns the table structure for the provided table. |
get_table_structure_keys() | Returns the keys of the provided table. |
get_keyset_pk_column() | Resolves the single column safe to page a table's export by (`> last |
get_nested_forms() | Returns Gravity Perks' Nested Forms. |
ajax_routes() | Exports the data & the dump file. |
generate_export_file_name() | Generate a filename for the export file. |
sanitize_file_name() | Sanitize filename by removing accents and applying other rules |
mysql_escape_mimic() | Mimics the mysql_real_escape_string function. Adapted from a post by 'feedr' on php.net. |
Method Reference
__construct()
public function __construct()
Constructor.
Since: 1.0.0
Source: src/Export.php:62
get_instance()
public static function get_instance(): Export
Returns class instance.
Returns
Export
Since: 1.0.0
Source: src/Export.php:74
filter_available_data_types()
public function filter_available_data_types( array $types )
Filters requested export data types down to those whose backing Gravity Forms
tables exist on this install: selecting a type whose table is absent otherwise
fatals in the export loop when SHOW CREATE TABLE returns nothing. Types with no
dedicated table (views, posts, gf_settings, gk_settings) always pass.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$types | array | Requested data types. |
Returns
array— Types whose tables exist.
Since: 1.2.0
Source: src/Export.php:166
get_gf_settings()
static public function get_gf_settings()
Returns Gravity Forms form settings allowed to be exported.
Returns
array
Since: 1.0.0
Source: src/Export.php:217
get_gk_settings()
static public function get_gk_settings()
Returns GravityKit settings allowed to be exported.
Returns
array
Since: 1.0.0
Source: src/Export.php:238
get_dates_filter_query()
public function get_dates_filter_query( $start_date='', $end_date='' )
Returns the WHERE statement for date filter.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$start_date | string | '' | DATE FORMAT: YYYY-MM-DD. |
$end_date | string | '' | DATE FORMAT: YYYY-MM-DD. |
Returns
string
Since: 1.0.0
Source: src/Export.php:252
get_tables_where()
public function get_tables_where( $forms='', $entries_date_filter_query='' )
Returns the final WHERE statement to add to the export query.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$forms | string | '' | Comma-separated list of form IDs. |
$entries_date_filter_query | string | '' | AND statement with start date AND/OR end date. |
Returns
array
Since: 1.0.0
Source: src/Export.php:274
post_content_match_selection()
public function post_content_match_selection( $content, $forms_arr )
Checks if post content shortcodes' or blocks' attribute value matches user's selection of forms to export.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$content | string | Post content. | |
$forms_arr | array | User's selection of forms to export. |
Returns
bool|array
Since: 1.1.0
Source: src/Export.php:552
get_table_structure()
public function get_table_structure( $table_name )
Returns the table structure for the provided table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$table_name | string | Table name. |
Returns
array|bool
Since: 1.0.0
Source: src/Export.php:710
get_table_structure_keys()
public function get_table_structure_keys( $table_name )
Returns the keys of the provided table.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$table_name | string | Table name. |
Returns
array
Since: 1.0.0
Source: src/Export.php:727
get_keyset_pk_column()
public function get_keyset_pk_column( array $table_structure )
Resolves the single column safe to page a table's export by (`> last
value ORDER BY column) instead of OFFSET, from a DESCRIBEresult. Returns null for any table without exactly onePRIcolumn -- a composite or missing primary key can't be paged this way without a risk of dropping or duplicating rows, so callers must fall back toOFFSET`.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$table_structure | array | \get_table_structure output. |
Returns
array{field:string,is_int:bool}|null
Since: 1.3.0
Source: src/Export.php:752
get_nested_forms()
public function get_nested_forms( $selected_forms )
Returns Gravity Perks' Nested Forms.
Merged with selected forms.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$selected_forms |
Returns
array
Since: 1.0.0
Source: src/Export.php:775
ajax_routes()
public function ajax_routes( $routes )
Exports the data & the dump file.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$routes | array | Foundation routes. |
Returns
array
Since: 1.0.0
Source: src/Export.php:852
generate_export_file_name()
public function generate_export_file_name()
Generate a filename for the export file.
gk-migrate-{domain}-{date generated in Y-m-d}-{timestamp}.zip
Returns
string
Since: 1.0.0
Source: src/Export.php:1293
sanitize_file_name()
public function sanitize_file_name( $filename )
Sanitize filename by removing accents and applying other rules
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$filename | string |
Returns
string
Source: src/Export.php:1331
mysql_escape_mimic()
static public function mysql_escape_mimic( $input )
Mimics the mysql_real_escape_string function. Adapted from a post by 'feedr' on php.net.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | string | array | The string to escape. |
Returns
string|array
Since: 1.0.0
Source: src/Export.php:1354