gravity forms update
This commit is contained in:
@@ -205,6 +205,7 @@ abstract class GFAddOn {
|
||||
->set_form_css_properties( array( $this, 'theme_layer_form_css_properties' ) )
|
||||
->set_styles( array( $this, 'theme_layer_styles' ) )
|
||||
->set_scripts( array( $this, 'theme_layer_scripts' ) )
|
||||
->set_capability( $this->get_form_settings_capabilities() )
|
||||
->register();
|
||||
add_action( 'gform_form_after_open', array( $this, 'output_third_party_styles' ), 998, 2 );
|
||||
}
|
||||
@@ -1644,8 +1645,8 @@ abstract class GFAddOn {
|
||||
$caps = array();
|
||||
|
||||
// Add capabilities.
|
||||
if ( ! empty( $this->_capabilities_form_settings ) && is_string( $this->_capabilities_form_settings ) ) {
|
||||
$caps[ $this->_capabilities_form_settings ] = esc_html__( 'Form Settings', 'gravityforms' );
|
||||
if ( ! empty( $this->get_form_settings_capabilities() ) && is_string( $this->get_form_settings_capabilities() ) ) {
|
||||
$caps[ $this->get_form_settings_capabilities() ] = esc_html__( 'Form Settings', 'gravityforms' );
|
||||
}
|
||||
if ( ! empty( $this->_capabilities_uninstall ) && is_string( $this->_capabilities_uninstall ) ) {
|
||||
$caps[ $this->_capabilities_uninstall ] = esc_html__( 'Uninstall', 'gravityforms' );
|
||||
@@ -4174,6 +4175,15 @@ abstract class GFAddOn {
|
||||
|
||||
//-------------- Form settings ---------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get the capabilities required to access the form settings page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_form_settings_capabilities() {
|
||||
return $this->_capabilities_form_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes form settings page
|
||||
* Hooks up the required scripts and actions for the Form Settings page
|
||||
@@ -4183,7 +4193,7 @@ abstract class GFAddOn {
|
||||
$subview = rgget( 'subview' );
|
||||
add_filter( 'gform_form_settings_menu', array( $this, 'add_form_settings_menu' ), 10, 2 );
|
||||
|
||||
if ( rgget( 'page' ) == 'gf_edit_forms' && $view == 'settings' && $subview == $this->get_slug() && $this->current_user_can_any( $this->_capabilities_form_settings ) ) {
|
||||
if ( rgget( 'page' ) == 'gf_edit_forms' && $view == 'settings' && $subview == $this->get_slug() && $this->current_user_can_any( $this->get_form_settings_capabilities() ) ) {
|
||||
require_once( GFCommon::get_base_path() . '/tooltips.php' );
|
||||
add_action( 'gform_form_settings_page_' . $this->get_slug(), array( $this, 'form_settings_page' ) );
|
||||
|
||||
@@ -4214,7 +4224,7 @@ abstract class GFAddOn {
|
||||
// Initialize new settings renderer.
|
||||
$renderer = new Settings(
|
||||
array(
|
||||
'capability' => $this->_capabilities_form_settings,
|
||||
'capability' => $this->get_form_settings_capabilities(),
|
||||
'fields' => $sections,
|
||||
'initial_values' => $this->get_form_settings( $form ),
|
||||
'save_callback' => function( $values ) use ( $form ) {
|
||||
@@ -4697,7 +4707,7 @@ abstract class GFAddOn {
|
||||
'name' => $this->get_slug(),
|
||||
'label' => $this->get_short_title(),
|
||||
'query' => array( 'fid' => null ),
|
||||
'capabilities' => $this->_capabilities_form_settings,
|
||||
'capabilities' => $this->get_form_settings_capabilities(),
|
||||
'icon' => $this->get_menu_icon(),
|
||||
'icon_namespace' => $this->get_icon_namespace(),
|
||||
);
|
||||
@@ -5446,7 +5456,6 @@ abstract class GFAddOn {
|
||||
|
||||
// remove entry meta
|
||||
$meta_table = version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ? GFFormsModel::get_lead_meta_table_name() : GFFormsModel::get_entry_meta_table_name();
|
||||
remove_filter( 'query', array( 'GFForms', 'filter_query' ) );
|
||||
foreach ( $forms as $form ) {
|
||||
$all_form_ids[] = $form->id;
|
||||
$entry_meta = $this->get_entry_meta( array(), $form->id );
|
||||
@@ -5457,7 +5466,6 @@ abstract class GFAddOn {
|
||||
}
|
||||
}
|
||||
}
|
||||
add_filter( 'query', array( 'GFForms', 'filter_query' ) );
|
||||
|
||||
//remove form settings
|
||||
if ( ! empty( $all_form_ids ) ) {
|
||||
|
||||
@@ -1262,7 +1262,7 @@ abstract class GFFeedAddOn extends GFAddOn {
|
||||
public function ajax_toggle_is_active() {
|
||||
check_ajax_referer( 'feed_list', 'nonce' );
|
||||
|
||||
if ( ! $this->current_user_can_any( $this->_capabilities_form_settings ) ) {
|
||||
if ( ! $this->current_user_can_any( $this->get_form_settings_capabilities() ) ) {
|
||||
wp_send_json_error( array( 'message' => esc_html__( 'Access denied.', 'gravityforms' ) ) );
|
||||
}
|
||||
|
||||
@@ -1279,7 +1279,7 @@ abstract class GFFeedAddOn extends GFAddOn {
|
||||
public function ajax_save_feed_order() {
|
||||
check_ajax_referer( 'gform_feed_order', 'nonce' );
|
||||
|
||||
if ( ! $this->current_user_can_any( $this->_capabilities_form_settings ) ) {
|
||||
if ( ! $this->current_user_can_any( $this->get_form_settings_capabilities() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1371,7 +1371,7 @@ abstract class GFFeedAddOn extends GFAddOn {
|
||||
// Initialize new settings renderer.
|
||||
$renderer = new Settings(
|
||||
array(
|
||||
'capability' => $this->_capabilities_form_settings,
|
||||
'capability' => $this->get_form_settings_capabilities(),
|
||||
'initial_values' => rgar( $current_feed, 'meta' ),
|
||||
'save_callback' => function( $values ) use ( $feed_id ) {
|
||||
|
||||
@@ -1584,7 +1584,7 @@ abstract class GFFeedAddOn extends GFAddOn {
|
||||
|
||||
check_admin_referer( $this->get_slug() . '_save_settings', '_' . $this->get_slug() . '_save_settings_nonce' );
|
||||
|
||||
if ( ! $this->current_user_can_any( $this->_capabilities_form_settings ) ) {
|
||||
if ( ! $this->current_user_can_any( $this->get_form_settings_capabilities() ) ) {
|
||||
GFCommon::add_error_message( esc_html__( "You don't have sufficient permissions to update the form settings.", 'gravityforms' ) );
|
||||
return $feed_id;
|
||||
}
|
||||
|
||||
1
wp/wp-content/plugins/gravityforms/includes/class-gf-background-upgrader.php
Normal file → Executable file
1
wp/wp-content/plugins/gravityforms/includes/class-gf-background-upgrader.php
Normal file → Executable file
@@ -76,7 +76,6 @@ class GF_Background_Upgrader extends GF_Background_Process {
|
||||
}
|
||||
|
||||
if ( is_callable( $callback ) ) {
|
||||
remove_filter( 'query', array( 'GFForms', 'filter_query' ) );
|
||||
GFCommon::log_debug( sprintf( '%s(): Running callback: %s', __METHOD__, print_r( $callback, 1 ) ) );
|
||||
$needs_more_time = call_user_func( $callback );
|
||||
if ( $needs_more_time ) {
|
||||
|
||||
@@ -1379,8 +1379,6 @@ WHERE ln.id NOT IN
|
||||
* Upgrade routine from gravity forms version 2.0.4.7 and below
|
||||
*/
|
||||
protected function post_upgrade_schema_2047() {
|
||||
remove_filter( 'query', array( 'GFForms', 'filter_query' ) );
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$versions = $this->get_versions();
|
||||
|
||||
0
wp/wp-content/plugins/gravityforms/includes/libraries/gf-background-process.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/libraries/gf-background-process.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/libraries/wp-async-request.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/libraries/wp-async-request.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/phpqrcode/LICENSE
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/phpqrcode/LICENSE
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/phpqrcode/phpqrcode.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/phpqrcode/phpqrcode.php
Normal file → Executable file
@@ -62,7 +62,7 @@ class Text extends Base {
|
||||
esc_attr( $this->input_type ),
|
||||
esc_attr( $this->settings->get_input_name_prefix() ),
|
||||
esc_attr( $this->name ),
|
||||
$value ? esc_attr( htmlspecialchars( $value, ENT_QUOTES ) ) : '',
|
||||
! rgblank( $value ) ? esc_attr( htmlspecialchars( $value, ENT_QUOTES ) ) : '',
|
||||
$this->get_describer() ? sprintf( 'aria-describedby="%s"', $this->get_describer() ) : '',
|
||||
implode( ' ', $this->get_attributes() ),
|
||||
isset( $this->append ) ? sprintf( '<span class="gform-settings-field__text-append">%s</span>', esc_html( $this->append ) ) : '',
|
||||
|
||||
0
wp/wp-content/plugins/gravityforms/includes/system-status/js/clipboard.min.js
vendored
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/system-status/js/clipboard.min.js
vendored
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/templates/edit-shortcode-form.tpl.php
Normal file → Executable file
0
wp/wp-content/plugins/gravityforms/includes/templates/edit-shortcode-form.tpl.php
Normal file → Executable file
@@ -188,4 +188,18 @@ class Theme_Layer_Builder {
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for capability.
|
||||
*
|
||||
* @param $capability
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function set_capability( $capability ) {
|
||||
$this->layer->set_capability( $capability );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,4 +100,8 @@ class Fluent_Theme_Layer extends GF_All_Access_Theme_Layer {
|
||||
$this->icon = $icon;
|
||||
}
|
||||
|
||||
public function set_capability( $capability ) {
|
||||
$this->form_settings_capability = $capability;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,13 +78,14 @@ class GF_Theme_Layers extends \GFAddOn {
|
||||
}
|
||||
|
||||
$tabs[] = array(
|
||||
'name' => $layer->name(),
|
||||
'label' => $layer->short_title(),
|
||||
'icon' => $layer->icon(),
|
||||
'query' => array(
|
||||
'name' => $layer->name(),
|
||||
'label' => $layer->short_title(),
|
||||
'icon' => $layer->icon(),
|
||||
'query' => array(
|
||||
'theme_layer' => $layer->name(),
|
||||
'subview' => $this->get_slug(),
|
||||
),
|
||||
'capabilities' => $layer->get_form_settings_capability(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,5 +104,25 @@ class GF_Theme_Layers extends \GFAddOn {
|
||||
public function form_settings_fields( $form ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the form settings capabilities.
|
||||
*/
|
||||
public function get_form_settings_capabilities() {
|
||||
static $caps;
|
||||
|
||||
if ( empty( $caps ) ) {
|
||||
$theme_layers = \GFForms::get_service_container()->get( GF_Theme_Layers_Provider::THEME_LAYERS );
|
||||
|
||||
foreach ( $theme_layers as $layer ) {
|
||||
/**
|
||||
* @var GF_Theme_Layer $layer
|
||||
*/
|
||||
$caps[ $layer->name() ] = $layer->get_form_settings_capability();
|
||||
}
|
||||
}
|
||||
|
||||
return rgar( $caps, rgget( 'theme_layer' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ abstract class GF_Theme_Layer {
|
||||
protected $short_title;
|
||||
protected $priority;
|
||||
|
||||
protected $form_settings_capability;
|
||||
|
||||
/**
|
||||
* @var Definition_Engine[]
|
||||
*/
|
||||
@@ -142,4 +144,13 @@ abstract class GF_Theme_Layer {
|
||||
return $this->icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for form_settings_capability
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_form_settings_capability() {
|
||||
return $this->form_settings_capability;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user