Skip to content

Commit

Permalink
Merge pull request #1044 from gravityview/develop
Browse files Browse the repository at this point in the history
2.0.6
  • Loading branch information
zackkatz authored May 18, 2018
2 parents 8a7f170 + 5248b05 commit ef3c16e
Show file tree
Hide file tree
Showing 26 changed files with 257 additions and 99 deletions.
2 changes: 1 addition & 1 deletion assets/css/admin-settings.css

Large diffs are not rendered by default.

34 changes: 21 additions & 13 deletions assets/css/scss/admin-settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,32 @@
}

// Add the stars to the top
#gform_tab_group {
#gform-settings #gaddon-setting-row-gv_header {
padding: 0;
background: url(../images/stars.jpg) left top repeat-x;

// Add Floaty
&:before {
content: '';
display: block;
position: relative;
margin-left: 0;
background-color: #fff;
td {

min-height: 110px;
background: url(../images/astronaut-200x263.png) -30px top no-repeat;
margin: 0;
padding: 10px 0 0 160px;
}
padding: 0!important;

height: 130px;
position: relative;
overflow: hidden;

// Add Floaty
&:before {
content: '';
display: block;
position: absolute;
left: 0;
bottom: -150px;

height: 263px;
background: transparent url(../images/astronaut-200x263.png) -30px 0 no-repeat;
margin: 0;
padding: 10px 0 0 160px;
}
}
}

.gform_tab_group {
Expand Down
20 changes: 20 additions & 0 deletions future/_mocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ public static function thaw( $data ) {
case '\GravityView_View::fields':
\GravityView_View::getInstance()->setFields( $value );
break;
case '\GravityView_View::_current_field':
\GravityView_View::getInstance()->setCurrentField( $value );
break;
case 'wp_actions[loop_start]':
global $wp_actions;
$wp_actions['loop_start'] = $value;
Expand Down Expand Up @@ -597,6 +600,23 @@ public static function load( $configuration ) {
'\GravityView_View::fields' => $value->as_configuration(),
) );
break;
case 'field':
self::thaw( array(
'\GravityView_View::_current_field' => array(
'field_id' => $value->ID,
'field' => $value->field,
'field_settings' => $value->as_configuration(),
'form' => \GravityView_View::getInstance()->getForm(),
'field_type' => $value->type, /** {@since 1.6} */
'entry' => \GravityView_View::getInstance()->getCurrentEntry(),

// 'field_path' => $field_path, /** {@since 1.16} */
// 'value' => $value,
// 'display_value' => $display_value,
// 'format' => $format,
),
) );
break;
case 'request':
self::thaw( array(
'\GravityView_View::context' => (
Expand Down
47 changes: 47 additions & 0 deletions future/includes/class-gv-settings-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ public function app_settings_fields() {
$disabled_attribute = \GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';

$fields = array(
array(
'name' => 'gv_header',
'value' => '',
'type' => 'html',
),
array(
'name' => 'license_key',
'required' => true,
Expand Down Expand Up @@ -1008,6 +1013,48 @@ protected function settings_edd_license( $field, $echo = true ) {
return $return;
}

/**
* Allow pure HTML settings row
*
* @since 2.0.6
*
* @param array $field
* @param bool $echo Whether to echo the
*
* @return string
*/
protected function settings_html( $field, $echo = true ) {

$return = \GV\Utils::get( $field, 'value', '' );

if ( $echo ) {
echo $return;
}

return $return;
}

/**
* No <th> needed for pure HTML settings row
*
* @since 2.0.6
*
* @param array $field
*
* @return void
*/
public function single_setting_row_html( $field ) {
?>

<tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
<td colspan="2">
<?php $this->single_setting( $field ); ?>
</td>
</tr>

<?php
}

/**
* Allow customizing the Save field parameters
*
Expand Down
2 changes: 1 addition & 1 deletion future/includes/class-gv-template-entry-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function the_entry() {
/**
* @filter `gravityview_table_cells` Modify the fields displayed in a table
* @param array $fields
* @param GravityView_View $this
* @param \GravityView_View $this
* @deprecated Use `gravityview/template/table/fields`
*/
$fields = apply_filters( 'gravityview_table_cells', $fields->as_configuration(), \GravityView_View::getInstance() );
Expand Down
8 changes: 6 additions & 2 deletions future/includes/class-gv-template-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ public function render() {
$source = $this->source;
$source_backend = $source ? $source::$backend : null;

\GV\Mocks\Legacy_Context::load( array(
'field' => $this->field,
) );

/** Alter the display value according to Gravity Forms. */
if ( $source_backend == \GV\Source::BACKEND_GRAVITYFORMS ) {
/** Prevent any PHP warnings that may be generated. */
Expand All @@ -265,7 +269,7 @@ public function render() {

/** Replace merge tags for admin-only fields. */
if ( ! empty( $this->field->field->adminOnly ) ) {
$display_value = \GravityView_API::replace_variables( $display_value, $this->form->form, $this->entry->as_entry() );
$display_value = \GravityView_API::replace_variables( $display_value, $this->form->form, $this->entry->as_entry(), false, false );
}
}

Expand Down Expand Up @@ -349,7 +353,7 @@ public function render() {

$permalink = $context->entry->get_permalink( $context->view, $context->request );
$output = \gravityview_get_link( $permalink, $output, $link_atts );

/**
* @filter `gravityview_field_entry_link` Modify the link HTML
* @param string $link HTML output of the link
Expand Down
10 changes: 5 additions & 5 deletions future/includes/class-gv-template-view-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function entry_class( $class, $entry, $context ) {
* @filter `gravityview_entry_class` Modify the class applied to the entry row.
* @param string $class Existing class.
* @param array $entry Current entry being displayed
* @param GravityView_View $this Current GravityView_View object
* @param \GravityView_View $this Current GravityView_View object
* @deprecated Use `gravityview/template/list/entry/class`
* @return string The modified class.
*/
Expand Down Expand Up @@ -154,7 +154,7 @@ public static function body_before( $context ) {
* @action `gravityview_list_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows.
* @deprecated Use `gravityview/template/list/body/before`
* @since 1.0.7
* @param GravityView_View $gravityview_view Current GravityView_View object.
* @param \GravityView_View $gravityview_view Current GravityView_View object.
*/
do_action( 'gravityview_list_body_before', \GravityView_View::getInstance() /** ugh! */ );
}
Expand All @@ -180,7 +180,7 @@ public static function body_after( $context ) {
* @action `gravityview_list_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows.
* @deprecated Use `gravityview/template/list/body/after`
* @since 1.0.7
* @param GravityView_View $gravityview_view Current GravityView_View object.
* @param \GravityView_View $gravityview_view Current GravityView_View object.
*/
do_action( 'gravityview_list_body_after', \GravityView_View::getInstance() /** ugh! */ );
}
Expand Down Expand Up @@ -215,7 +215,7 @@ public static function entry_before( $entry, $context, $zone = '' ) {
* @action `gravityview_list_entry_$zone_before` Inside the `entry`, before any rows are rendered. Can be used to insert additional rows.
* @deprecated Use `gravityview/template/list/entry/$zone/before`
* @since 1.0.7
* @param GravityView_View $gravityview_view Current GravityView_View object.
* @param \GravityView_View $gravityview_view Current GravityView_View object.
*/
do_action( sprintf( 'gravityview_list_entry%sbefore', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ );
}
Expand Down Expand Up @@ -250,7 +250,7 @@ public static function entry_after( $entry, $context, $zone = '' ) {
* @action `gravityview_list_entry_$zone_after` Inside the `entry`, after any rows are rendered. Can be used to insert additional rows.
* @deprecated Use `gravityview/template/list/entry/after`
* @since 1.0.7
* @param GravityView_View $gravityview_view Current GravityView_View object.
* @param \GravityView_View $gravityview_view Current GravityView_View object.
*/
do_action( sprintf( 'gravityview_list_entry%safter', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ );
}
Expand Down
6 changes: 3 additions & 3 deletions future/includes/class-gv-template-view-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function the_entry( \GV\Entry $entry, $attributes ) {
/**
* @filter `gravityview_table_cells` Modify the fields displayed in a table
* @param array $fields
* @param GravityView_View $this
* @param \GravityView_View $this
* @deprecated Use `gravityview/template/table/fields`
*/
$fields = apply_filters( 'gravityview_table_cells', $fields->as_configuration(), \GravityView_View::getInstance() );
Expand Down Expand Up @@ -196,7 +196,7 @@ public function the_entry( \GV\Entry $entry, $attributes ) {
/**
* @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
* @since 1.0.7
* @param GravityView_View $this Current GravityView_View object
* @param \GravityView_View $this Current GravityView_View object
* @deprecated Use `gravityview/template/table/cells/before`
*/
do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
Expand All @@ -215,7 +215,7 @@ public function the_entry( \GV\Entry $entry, $attributes ) {
/**
* @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
* @since 1.0.7
* @param GravityView_View $this Current GravityView_View object
* @param \GravityView_View $this Current GravityView_View object
* @deprecated Use `gravityview/template/table/cells/after`
*/
do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() );
Expand Down
11 changes: 11 additions & 0 deletions future/includes/class-gv-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ public static function register_post_type() {
public static function content( $content ) {
$request = gravityview()->request;

// Plugins may run through the content in the header. WP SEO does this for its OpenGraph functionality.
if ( ! defined( 'DOING_GRAVITYVIEW_TESTS' ) ) {
if ( ! did_action( 'loop_start' ) ) {
gravityview()->log->debug( 'Not processing yet: loop_start hasn\'t run yet. Current action: {action}', array( 'action' => current_filter() ) );
return $content;
}

// We don't want this filter to run infinite loop on any post content fields
remove_filter( 'the_content', array( __CLASS__, __METHOD__ ) );
}

/**
* This is not a View. Bail.
*
Expand Down
4 changes: 2 additions & 2 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: GravityView
* Plugin URI: https://gravityview.co
* Description: The best, easiest way to display Gravity Forms entries on your website.
* Version: 2.0.5
* Version: 2.0.6
* Author: GravityView
* Author URI: https://gravityview.co
* Text Domain: gravityview
Expand All @@ -22,7 +22,7 @@
/**
* The plugin version.
*/
define( 'GV_PLUGIN_VERSION', '2.0.5' );
define( 'GV_PLUGIN_VERSION', '2.0.6' );

/**
* Full path to the GravityView file
Expand Down
5 changes: 5 additions & 0 deletions includes/class-admin-approve-entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,11 @@ private function get_bulk_actions( $form_id ) {

// Sanitize the values, just to be sure.
foreach ( $bulk_actions as $key => $group ) {

if( empty( $group ) ) {
continue;
}

foreach ( $group as $i => $action ) {
$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
Expand Down
4 changes: 2 additions & 2 deletions includes/class-admin-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
</div>
<div class="gv-droppable-area-action">
<?php
if ( $type == 'field' && count( $view->joins ) ) {
if ( 'field' === $type && $view && count( $view->joins ) ) {
?>
<?php
$known_joins = array();
Expand All @@ -968,7 +968,7 @@ function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
<?php
} else {
?>
<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo esc_attr( $view->form ? $view->form->ID : '' ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
<?php
}
?>
Expand Down
15 changes: 15 additions & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,21 @@ public function changelog_screen() {
</ul>
</div>

<h3>2.0.6 on May 17, 2018</h3>

<ul>
<li>Fixed: Conflicts with Yoast SEO &amp; Jetpack plugins that prevent widgets from displaying</li>
<li>Fixed: Some fields display as HTML (fixes Gravity Flow Discussion field, for example)</li>
<li>Fixed: Some Merge Tag modifiers not working, such as <code>:url</code> for List fields</li>
<li>Fixed: Give Floaty a place to hang out on the GravityView Settings screen with new Gravity Forms CSS</li>
</ul>

<p><strong>Developer Updates</strong></p>

<ul>
<li>Fixed: Backward-compatibility for using global <code>$gravityview_view-&gt;_current_field</code> (don't use in new code!)</li>
</ul>

<h3> 2.0.5 on May 16, 2018</h3>

<ul>
Expand Down
5 changes: 5 additions & 0 deletions includes/class-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ public function delete_expired_transients() {
*/
public function use_cache() {

// Exit early if debugging (unless running PHPUnit)
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) {
return apply_filters( 'gravityview_use_cache', false, $this );
}

$use_cache = true;

if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-frontend-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getGvOutputData() {
}

/**
* @param GravityView_View_Data $gv_output_data
* @param \GravityView_View_Data $gv_output_data
*/
public function setGvOutputData( $gv_output_data ) {
$this->gv_output_data = $gv_output_data;
Expand Down
14 changes: 14 additions & 0 deletions includes/class-gravityview-merge-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public static function process_modifiers( $value, $merge_tag, $modifier, $field,

$return = $raw_value;

$unserialized = maybe_unserialize( $raw_value );

if ( method_exists( $field, 'get_value_merge_tag' ) && is_array( $unserialized ) ) {

$non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) );

$return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false);
}

foreach ( $modifiers as $passed_modifier ) {

foreach( $gv_modifiers as $gv_modifier => $method ) {
Expand All @@ -89,6 +98,11 @@ public static function process_modifiers( $value, $merge_tag, $modifier, $field,
}
}

// No GravityView modifications were made; return the (default) original value
if ( $raw_value === $return ) {
return $value;
}

/**
* @filter `gravityview/merge_tags/modifiers/value` Modify the merge tag modifier output
* @since 2.0
Expand Down
2 changes: 1 addition & 1 deletion includes/class-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public function renderZone( $zone = '', $atts = array(), $echo = true ) {
/**
* @filter `gravityview_table_cells` Modify the fields displayed in a table
* @param array $fields
* @param GravityView_View $this
* @param \GravityView_View $this
* @deprecated Use `gravityview/template/table/fields`
*/
$fields = apply_filters("gravityview_table_cells", $fields, $this );
Expand Down
Loading

0 comments on commit ef3c16e

Please sign in to comment.