plugin install

This commit is contained in:
Tony Volpe
2024-06-18 17:29:05 -04:00
parent e1aaedd1ae
commit 41f50eacc4
5880 changed files with 1057631 additions and 39681 deletions

View File

@@ -0,0 +1,95 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for app registration, including helper methods.
*
* @since 2.7.1
*/
class GF_App_Config extends GF_Config {
/**
* The name of the app, in slug form.
*
* @var string $app_name
*/
private $app_name;
/**
* The condition for enqueuing the app data.
*
* @var bool|callable $display_condition
*/
private $display_condition;
/**
* The CSS assets to enqueue.
*
* @var array $css_asset
*/
private $css_asset;
/**
* The relative path to the chunk in JS.
*
* @var string $chunk
*/
private $chunk;
/**
* The root element to use to load the app.
*
* @var string $root_element
*/
private $root_element;
/**
* Set the data for this app config.
*
* @since 2.7.1
*
* @param $data
*/
public function set_data( $data ) {
$this->name = $data['object_name'];
$this->script_to_localize = $data['script_name'];
$this->app_name = $data['app_name'];
$this->display_condition = $data['enqueue'];
$this->chunk = $data['chunk'];
$this->root_element = $data['root_element'];
}
/**
* Whether we should enqueue this data.
*
* @since 2.6
*
* @return bool|mixed
*/
public function should_enqueue() {
return is_admin();
}
/**
* Config data.
*
* @return array[]
*/
public function data() {
return array(
'apps' => array(
$this->app_name => array(
'should_display' => is_callable( $this->display_condition ) ? call_user_func( $this->display_condition ) : $this->display_condition,
'chunk_path' => $this->chunk,
'root_element' => $this->root_element,
),
),
);
}
}

View File

@@ -0,0 +1,165 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
/**
* Collection to hold GF_Config items and provide their structured data when needed.
*
* @since 2.6
*
* @package Gravity_Forms\Gravity_Forms\Config
*/
class GF_Config_Collection {
/**
* @var GF_Config[] $configs
*/
private $configs = array();
/**
* Add a config to the collection.
*
* @param GF_Config $config
*/
public function add_config( GF_Config $config ) {
$this->configs[] = $config;
}
/**
* Handle outputting the config data.
*
* If $localize is true, data is actually localized via `wp_localize_script`, otherwise
* data is simply returned as an array.
*
* @since 2.6
*
* @param bool $localize Whether to localize the data, or simply return it.
*
* @return array
*/
public function handle( $localize = true ) {
$scripts = $this->get_configs_by_script();
$data_to_localize = array();
foreach ( $scripts as $script => $items ) {
$item_data = $this->localize_data_for_script( $script, $items, $localize );
$data_to_localize = array_merge( $data_to_localize, $item_data );
}
return $data_to_localize;
}
/**
* Localize the data for the given script.
*
* @since 2.6
*
* @param string $script
* @param GF_Config[] $items
*/
private function localize_data_for_script( $script, $items, $localize = true ) {
$data = array();
foreach ( $items as $name => $configs ) {
$localized_data = $this->get_merged_data_for_object( $configs );
/**
* Allows users to filter the data localized for a given script/resource.
*
* @since 2.6
*
* @param array $localized_data The current localize data
* @param string $script The script being localized
* @param array $configs An array of $configs being applied to this script
*
* @return array
*/
$localized_data = apply_filters( 'gform_localized_script_data_' . $name, $localized_data, $script, $configs );
$data[ $name ] = $localized_data;
if ( $localize ) {
wp_localize_script( $script, $name, $localized_data );
}
}
return $data;
}
/**
* Get the merged data object for the applicable configs. Will process each config by its
* $priority property, overriding or merging values as needed.
*
* @since 2.6
*
* @param GF_Config[] $configs
*/
private function get_merged_data_for_object( $configs ) {
// Squash warnings for PHP < 7.0 when running tests.
@usort( $configs, array( $this, 'sort_by_priority' ) );
$data = array();
foreach ( $configs as $config ) {
// Config is set to overwrite data - simply return its value without attempting to merge.
if ( $config->should_overwrite() ) {
$data = $config->get_data();
continue;
}
// Config should be merged - loop through each key and attempt to recursively merge the values.
foreach ( $config->get_data() as $key => $value ) {
$existing = isset( $data[ $key ] ) ? $data[ $key ] : null;
if ( is_null( $existing ) || ! is_array( $existing ) || ! is_array( $value ) ) {
$data[ $key ] = $value;
continue;
}
$data[ $key ] = array_merge_recursive( $existing, $value );
}
}
return $data;
}
/**
* Get the appropriate configs, organized by the script they belong to.
*
* @since 2.6
*
* @return array
*/
private function get_configs_by_script() {
$data_to_localize = array();
foreach ( $this->configs as $config ) {
if ( ( ! defined( 'GFORMS_DOING_MOCK' ) || ! GFORMS_DOING_MOCK ) && ! $config->should_enqueue() ) {
continue;
}
$data_to_localize[ $config->script_to_localize() ][ $config->name() ][] = $config;
}
return $data_to_localize;
}
/**
* usort() callback to sort the configs by their $priority.
*
* @param GF_Config $a
* @param GF_Config $b
*
* @return int
*/
public function sort_by_priority( GF_Config $a, GF_Config $b ) {
if ( $a->priority() === $b->priority() ) {
return 0;
}
return $a->priority() < $b->priority() ? - 1 : 1;
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config;
/**
* Parses a given data array to return either Live or Mock values, depending on the
* environment and context.
*
* @since 2.6
*
* @package Gravity_Forms\Gravity_Forms\Config
*/
class GF_Config_Data_Parser {
/**
* Parse the given $data array and get the correct values for the context.
*
* @since 2.6
*
* @param $data
*
* @return array
*/
public function parse( $data ) {
$return = array();
foreach( $data as $key => $value ) {
$return[ $key ] = $this->get_correct_value( $value );
}
return $return;
}
/**
* Loop through each array key and get the correct value. Is called recursively for
* nested arrays.
*
* @since 2.6
*
* @param mixed $value
*
* @return array|mixed
*/
private function get_correct_value( $value ) {
// Value isn't array - we've reached the final level for this branch.
if ( ! is_array( $value ) ) {
return $value;
}
// Value is an array with our defined value and default keys. Return either live or mock data.
if ( array_key_exists( 'default', $value ) && array_key_exists( 'value', $value ) ) {
return $this->is_mock() ? $value['default'] : $value['value'];
}
$data = array();
// Value is an array - recursively call this method to dig into each level and return the correct value.
foreach( $value as $key => $value ) {
$data[ $key ] = $this->get_correct_value( $value );
}
return $data;
}
/**
* Determine whether the current environmental context is a Mock context.
*
* @since 2.6
*
* @return bool
*/
private function is_mock() {
return defined( 'GFORMS_DOING_MOCK' ) && GFORMS_DOING_MOCK;
}
}

View File

@@ -0,0 +1,209 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Admin_I18n;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Block_Editor;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Global;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_I18n;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Legacy_Check;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Legacy_Check_Multi;
use Gravity_Forms\Gravity_Forms\Config\Items\GF_Config_Multifile;
use Gravity_Forms\Gravity_Forms\GF_Service_Container;
use Gravity_Forms\Gravity_Forms\GF_Service_Provider;
/**
* Class GF_Config_Service_Provider
*
* Service provider for the Config Service.
*
* @package Gravity_Forms\Gravity_Forms\Config
*/
class GF_Config_Service_Provider extends GF_Service_Provider {
// Organizational services
const CONFIG_COLLECTION = 'config_collection';
const DATA_PARSER = 'data_parser';
// Config services
const I18N_CONFIG = 'i18n_config';
const I18N_ADMIN_CONFIG = 'i18n_admin_config';
const LEGACY_CONFIG = 'legacy_config';
const LEGACY_MULTI_CONFIG = 'legacy_multi_config';
const MULTIFILE_CONFIG = 'multifile_config';
const BLOCK_EDITOR_CONFIG = 'block_editor_config';
const GLOBAL_CONFIG = 'global_config';
/**
* Array mapping config class names to their container ID.
*
* @since 2.6
*
* @var string[]
*/
protected $configs = array(
self::I18N_CONFIG => GF_Config_I18n::class,
self::I18N_ADMIN_CONFIG => GF_Config_Admin_I18n::class,
self::LEGACY_CONFIG => GF_Config_Legacy_Check::class,
self::LEGACY_MULTI_CONFIG => GF_Config_Legacy_Check_Multi::class,
self::MULTIFILE_CONFIG => GF_Config_Multifile::class,
self::BLOCK_EDITOR_CONFIG => GF_Config_Block_Editor::class,
);
/**
* Register services to the container.
*
* @since 2.6
*
* @param GF_Service_Container $container
*/
public function register( GF_Service_Container $container ) {
// Include required files.
require_once( plugin_dir_path( __FILE__ ) . 'class-gf-config-collection.php' );
require_once( plugin_dir_path( __FILE__ ) . 'class-gf-config.php' );
require_once( plugin_dir_path( __FILE__ ) . 'class-gf-config-data-parser.php' );
require_once( plugin_dir_path( __FILE__ ) . 'class-gf-app-config.php' );
require_once( plugin_dir_path( __FILE__ ) . 'items/class-gf-config-global.php' );
// Add to container
$container->add( self::CONFIG_COLLECTION, function () {
return new GF_Config_Collection();
} );
$container->add( self::DATA_PARSER, function () {
return new GF_Config_Data_Parser();
} );
$container->add( self::GLOBAL_CONFIG, function () {
return new GF_Config_Global();
} );
// Add configs to container.
$this->register_config_items( $container );
$this->register_configs_to_collection( $container );
}
/**
* Initiailize any actions or hooks.
*
* @since 2.6
*
* @param GF_Service_Container $container
*
* @return void
*/
public function init( GF_Service_Container $container ) {
// Need to pass $this to callbacks; save as variable.
$self = $this;
add_action( 'wp_enqueue_scripts', function () use ( $container ) {
$container->get( self::CONFIG_COLLECTION )->handle();
}, 9999 );
add_action( 'admin_enqueue_scripts', function () use ( $container ) {
$container->get( self::CONFIG_COLLECTION )->handle();
}, 9999 );
add_action( 'gform_preview_init', function () use ( $container ) {
$container->get( self::CONFIG_COLLECTION )->handle();
}, 0 );
add_action( 'rest_api_init', function () use ( $container, $self ) {
register_rest_route( 'gravityforms/v2', '/tests/mock-data', array(
'methods' => 'GET',
'callback' => array( $self, 'config_mocks_endpoint' ),
'permission_callback' => function () {
return true;
},
) );
} );
// Add global config data to admin and theme.
add_filter( 'gform_localized_script_data_gform_admin_config', function ( $data ) use ( $self ) {
return $self->add_global_config_data( $data );
} );
add_filter( 'gform_localized_script_data_gform_theme_config', function ( $data ) use ( $self ) {
return $self->add_global_config_data( $data );
} );
}
/**
* For each config defined in $configs, instantiate and add to container.
*
* @since 2.6
*
* @param GF_Service_Container $container
*
* @return void
*/
private function register_config_items( GF_Service_Container $container ) {
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-i18n.php' );
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-admin-i18n.php' );
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-legacy-check.php' );
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-legacy-check-multi.php' );
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-multifile.php' );
require_once( plugin_dir_path( __FILE__ ) . '/items/class-gf-config-block-editor.php' );
$parser = $container->get( self::DATA_PARSER );
foreach ( $this->configs as $name => $class ) {
$container->add( $name, function () use ( $class, $parser ) {
return new $class( $parser );
} );
}
}
/**
* Register each config defined in $configs to the GF_Config_Collection.
*
* @since 2.6
*
* @param GF_Service_Container $container
*
* @return void
*/
public function register_configs_to_collection( GF_Service_Container $container ) {
$collection = $container->get( self::CONFIG_COLLECTION );
foreach ( $this->configs as $name => $config ) {
$config_class = $container->get( $name );
$collection->add_config( $config_class );
}
}
/**
* Callback for the Config Mocks REST endpoint.
*
* @since 2.6
*
* @return array
*/
public function config_mocks_endpoint() {
define( 'GFORMS_DOING_MOCK', true );
$container = \GFForms::get_service_container();
$data = $container->get( self::CONFIG_COLLECTION )->handle( false );
return $data;
}
/**
* Add global data to both admin and theme configs so that it is available everywhere
* within the system.
*
* @since 2.7
*
* @param $data
*
* @return array
*/
public function add_global_config_data( $data ) {
$container = \GFForms::get_service_container();
$global = $container->get( self::GLOBAL_CONFIG )->data();
return array_merge( $data, $global );
}
}

View File

@@ -0,0 +1,190 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config;
/**
* Base class for providing advanced functionality when localizing Config Data
* for usage in Javascript.
*
* @since 2.6
*
* @package Gravity_Forms\Gravity_Forms\Config
*/
abstract class GF_Config {
/**
* The Data Parser
*
* @since 2.6
*
* @var GF_Config_Data_Parser
*/
protected $parser;
/**
* The data for this config object.
*
* @since 2.6
*
* @var array
*/
protected $data;
/**
* The object name for this config.
*
* @since 2.6
*
* @var string
*/
protected $name;
/**
* The ID of the script to localize the data to.
*
* @since 2.6
*
* @var string
*/
protected $script_to_localize;
/**
* The priority of this config - can be used to control the order in
* which configs are processed in the Collection.
*
* @since 2.6
*
* @var int
*/
protected $priority = 0;
/**
* Whether the config should enqueue it's data. Can also be handled by overriding the
* ::should_enqueue() method.
*
* @since 2.6
*
* @var bool
*/
protected $should_enqueue = true;
/**
* Whether this config should overwrite previous values in the object.
*
* If set to "true", the object will be overwritten by the values provided here.
* If set to "false", the object will have its values merged with those defined here, recursively.
*
* @since 2.6
*
* @var bool
*/
protected $overwrite = false;
/**
* Constructor
*
* @param GF_Config_Data_Parser $parser
*/
public function __construct( GF_Config_Data_Parser $parser ) {
$this->parser = $parser;
}
/**
* Method to handle defining the data array for this config.
*
* @since 2.6
*
* @return array
*/
abstract protected function data();
/**
* Determine if the config should enqueue its data. If should_enqueue() is a method,
* call it and return the result. If not, simply return the (boolean) value of the property.
*
* @since 2.6
*
* @return bool
*/
public function should_enqueue() {
if ( is_callable( $this->should_enqueue ) ) {
return call_user_func( $this->should_enqueue );
}
return $this->should_enqueue;
}
/**
* Get the data for the config, passing it through a filter.
*
* @since 2.6
*
* @return array
*/
public function get_data() {
if ( ( ! defined( 'GFORMS_DOING_MOCK' ) || ! GFORMS_DOING_MOCK ) && ! $this->should_enqueue() ) {
return false;
}
/**
* Allows developers to modify the raw config data being sent to the Config Parser. Useful for
* adding in custom default/mock values for a given entry in the data, as well as modifying
* things like callbacks for dynamic data before it's parsed and localized.
*
* @since 2.6
*
* @param array $data
* @param string $script_to_localize
*
* @return array
*/
$data = apply_filters( 'gform_config_data_' . $this->name(), $this->data(), $this->script_to_localize() );
return $this->parser->parse( $data );
}
/**
* Get the name of the config's object.
*
* @since 2.6
*
* @return string
*/
public function name() {
return $this->name;
}
/**
* Get the $priority for the config.
*
* @since 2.6
*
* @return int
*/
public function priority() {
return $this->priority;
}
/**
* Get the script to localize.
*
* @since 2.6
*
* @return string
*/
public function script_to_localize() {
return $this->script_to_localize;
}
/**
* Get whether the config should override previous values.
*
* @since 2.6
*
* @return bool
*/
public function should_overwrite() {
return $this->overwrite;
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for Admin I18N
*
* @since 2.6
*/
class GF_Config_Admin_I18n extends GF_Config {
protected $name = 'gform_admin_i18n';
protected $script_to_localize = 'gform_gravityforms_admin_vendors';
/**
* Whether we should enqueue this data.
*
* @since 2.6
*
* @return bool|mixed
*/
public function should_enqueue() {
return is_admin();
}
/**
* Config data.
*
* @return array[]
*/
public function data() {
return array(
// named sub objects that match the admin js file name (camelCased) they are localizing
'formAdmin' => array(
'toggleFeedInactive' => esc_html__( 'Inactive', 'gravityforms' ),
'toggleFeedActive' => esc_html__( 'Active', 'gravityforms' ),
),
'shortcodeUi' => array(
'editForm' => esc_html__( 'Edit Form', 'gravityforms' ),
'insertForm' => esc_html__( 'Insert Form', 'gravityforms' ),
),
);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for the Block Editor.
*
* @since 2.6
*/
class GF_Config_Block_Editor extends GF_Config {
protected $name = 'gform_admin_config';
protected $script_to_localize = 'gform_gravityforms_admin_vendors';
/**
* Config data.
*
* @return array[]
*/
public function data() {
return array(
'block_editor' => array(
'data' => array(
'is_block_editor' => \GFCommon::is_block_editor_page(),
),
'i18n' => array(
'insert_gform_block_title' => __( 'Add Block To Page', 'gravityforms' ),
'insert_gform_block_content' => __( 'Click or drag the Gravity Forms Block into the page to insert the form you selected. %1$sLearn More.%2$s', 'gravityforms' ),
),
'urls' => array(
'block_docs' => 'https://docs.gravityforms.com/gravity-forms-gutenberg-block/',
),
)
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
/**
* Acts as a container for any Global Config data we need to send to both
* the admin and theme side of the ecosystem.
*
* @since 2.7
*/
class GF_Config_Global {
/**
* The data to send to both configs.
*
* @return array
*/
public function data() {
return array(
'hmr_dev' => defined( 'GF_ENABLE_HMR' ) && GF_ENABLE_HMR,
'public_path' => trailingslashit( \GFCommon::get_base_url() ) . 'assets/js/dist/',
);
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for Theme I18N
*
* @since 2.6
*/
class GF_Config_I18n extends GF_Config {
protected $name = 'gform_i18n';
protected $script_to_localize = 'gform_gravityforms';
/**
* Config data.
*
* @return array[]
*/
public function data() {
return array(
'datepicker' => array(
'days' => array(
'monday' => esc_html__( 'Mo', 'gravityforms' ),
'tuesday' => esc_html__( 'Tu', 'gravityforms' ),
'wednesday' => esc_html__( 'We', 'gravityforms' ),
'thursday' => esc_html__( 'Th', 'gravityforms' ),
'friday' => esc_html__( 'Fr', 'gravityforms' ),
'saturday' => esc_html__( 'Sa', 'gravityforms' ),
'sunday' => esc_html__( 'Su', 'gravityforms' ),
),
'months' => array(
'january' => esc_html__( 'January', 'gravityforms' ),
'february' => esc_html__( 'February', 'gravityforms' ),
'march' => esc_html__( 'March', 'gravityforms' ),
'april' => esc_html__( 'April', 'gravityforms' ),
'may' => esc_html__( 'May', 'gravityforms' ),
'june' => esc_html__( 'June', 'gravityforms' ),
'july' => esc_html__( 'July', 'gravityforms' ),
'august' => esc_html__( 'August', 'gravityforms' ),
'september' => esc_html__( 'September', 'gravityforms' ),
'october' => esc_html__( 'October', 'gravityforms' ),
'november' => esc_html__( 'November', 'gravityforms' ),
'december' => esc_html__( 'December', 'gravityforms' ),
),
'firstDay' => array(
'value' => absint( get_option( 'start_of_week' ) ),
'default' => 1,
),
'iconText' => esc_html__( 'Select date', 'gravityforms' ),
),
);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for Multi Legacy Check (mostly just data from a filter).
*
* @since 2.6
*/
class GF_Config_Legacy_Check_Multi extends GF_Config {
protected $name = 'gf_legacy_multi';
protected $script_to_localize = 'gform_gravityforms';
/**
* Config data.
*
* @return array[]
*/
public function data() {
/**
* Allows users to filter the legacy checks for any form on the page.
*
* @since 2.5
*
* @param array
*/
return apply_filters( 'gform_gf_legacy_multi', array() );
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Collection;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for Theme Legacy Checks.
*
* @since 2.6
*/
class GF_Config_Legacy_Check extends GF_Config {
protected $name = 'gf_legacy';
protected $script_to_localize = 'gform_layout_editor';
/**
* Determine if the config should enqueue its data.
*
* @since 2.7
*
* @return bool
*/
public function should_enqueue() {
return \GFCommon::is_form_editor();
}
/**
* Config data.
*
* @return array[]
*/
public function data() {
$form = \RGFormsModel::get_form_meta( rgget( 'id' ) );
return array(
'is_legacy' => array(
'value' => \GFCommon::is_legacy_markup_enabled( $form ),
'default' => 0,
),
);
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Config\Items;
use Gravity_Forms\Gravity_Forms\Config\GF_Config;
use Gravity_Forms\Gravity_Forms\Config\GF_Configurator;
/**
* Config items for Multifile Strings
*
* @since 2.6
*/
class GF_Config_Multifile extends GF_Config {
protected $script_to_localize = 'gform_gravityforms';
protected $name = 'gform_gravityforms';
/**
* Config data.
*
* @return array[]
*/
public function data() {
return array(
'strings' => array(
'invalid_file_extension' => wp_strip_all_tags( __( 'This type of file is not allowed. Must be one of the following: ', 'gravityforms' ) ),
'delete_file' => wp_strip_all_tags( __( 'Delete this file', 'gravityforms' ) ),
'in_progress' => wp_strip_all_tags( __( 'in progress', 'gravityforms' ) ),
'file_exceeds_limit' => wp_strip_all_tags( __( 'File exceeds size limit', 'gravityforms' ) ),
'illegal_extension' => wp_strip_all_tags( __( 'This type of file is not allowed.', 'gravityforms' ) ),
'max_reached' => wp_strip_all_tags( __( 'Maximum number of files reached', 'gravityforms' ) ),
'unknown_error' => wp_strip_all_tags( __( 'There was a problem while saving the file on the server', 'gravityforms' ) ),
'currently_uploading' => wp_strip_all_tags( __( 'Please wait for the uploading to complete', 'gravityforms' ) ),
'cancel' => wp_strip_all_tags( __( 'Cancel', 'gravityforms' ) ),
'cancel_upload' => wp_strip_all_tags( __( 'Cancel this upload', 'gravityforms' ) ),
'cancelled' => wp_strip_all_tags( __( 'Cancelled', 'gravityforms' ) )
),
'vars' => array(
'images_url' => \GFCommon::get_base_url() . '/images'
)
);
}
}