Skip to content

Commit 5f2f67d

Browse files
committed
Merge pull request #343 from katzwebservices/dev/1.7.5
Dev/1.7.5 - Friday release, baby!
2 parents 85cbeee + 40bae5a commit 5f2f67d

39 files changed

+1357
-953
lines changed

assets/css/admin-views.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/scss/admin-views.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ $gv-overlay-index: 10000;
368368
font-size: 14px;
369369

370370
&:link, &:visited, &:hover, &:active, &:focus {
371-
outline: none;
371+
outline: none;
372+
-webkit-box-shadow: none;
372373
}
373374
}
374375

gravityview.php

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Plugin Name: GravityView
1515
* Plugin URI: http://gravityview.co
1616
* Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output.
17-
* Version: 1.7.4.1
17+
* Version: 1.7.5
1818
* Author: Katz Web Services, Inc.
1919
* Author URI: http://www.katzwebservices.com
2020
* Text Domain: gravityview
@@ -52,7 +52,6 @@
5252
require_once( GRAVITYVIEW_DIR . 'includes/class-common.php');
5353
require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php');
5454

55-
5655
/** Register Post Types and Rewrite Rules */
5756
require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php');
5857

@@ -70,7 +69,7 @@
7069
*/
7170
final class GravityView_Plugin {
7271

73-
const version = '1.7.4.1';
72+
const version = '1.7.5';
7473

7574
public static $theInstance;
7675

@@ -108,8 +107,11 @@ private function __construct() {
108107
include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' );
109108
include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' );
110109

111-
// Load Widgets
112-
include_once( GRAVITYVIEW_DIR .'includes/widgets.php' );
110+
// Load WordPress Widgets
111+
include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' );
112+
113+
// Load GravityView Widgets
114+
include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' );
113115

114116
// Add oEmbed
115117
include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' );
@@ -120,21 +122,21 @@ private function __construct() {
120122
require_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' );
121123
require_once( GRAVITYVIEW_DIR . 'includes/class-settings.php');
122124
include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' );
125+
include_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' );
123126
include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' );
124127
include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' );
128+
include_once( GRAVITYVIEW_DIR . 'includes/class-gvlogic-shortcode.php' );
125129

126130
// Load plugin text domain
127131
add_action( 'init', array( $this, 'load_plugin_textdomain' ), 1 );
128132

129-
if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
130-
add_action( 'init', array( $this, 'frontend_actions' ), 20 );
131-
}
133+
// Load frontend files
134+
add_action( 'init', array( $this, 'frontend_actions' ), 20 );
132135

133136
// Load default templates
134137
add_action( 'init', array( $this, 'register_default_templates' ), 11 );
135138

136-
// Load default widgets
137-
add_action( 'init', array( $this, 'register_widgets' ), 11 );
139+
138140

139141
}
140142

@@ -216,6 +218,18 @@ public function load_plugin_textdomain() {
216218

217219
}
218220

221+
/**
222+
* Check if is_admin(), and make sure not DOING_AJAX
223+
* @since 1.7.5
224+
* @return bool
225+
*/
226+
public static function is_admin() {
227+
228+
$doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false;
229+
230+
return is_admin() && ! $doing_ajax;
231+
}
232+
219233
/**
220234
* Function to launch frontend objects
221235
*
@@ -224,6 +238,8 @@ public function load_plugin_textdomain() {
224238
*/
225239
public function frontend_actions() {
226240

241+
if( self::is_admin() ) { return; }
242+
227243
include_once( GRAVITYVIEW_DIR .'includes/class-image.php' );
228244
include_once( GRAVITYVIEW_DIR .'includes/class-template.php' );
229245
include_once( GRAVITYVIEW_DIR .'includes/class-api.php' );
@@ -243,16 +259,6 @@ function register_default_templates() {
243259
include_once( GRAVITYVIEW_DIR .'includes/default-templates.php' );
244260
}
245261

246-
/**
247-
* Register the default widgets
248-
* @todo Move somehere logical
249-
* @return void
250-
*/
251-
function register_widgets() {
252-
include_once( GRAVITYVIEW_DIR .'includes/default-widgets.php' );
253-
include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' );
254-
}
255-
256262
/**
257263
* helper function to define the default widget areas
258264
* @todo Move somewhere logical

includes/class-admin.php

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ function __construct() {
99

1010
if( !is_admin() ) { return; }
1111

12+
$this->add_hooks();
13+
}
14+
15+
/**
16+
* @since 1.7.5
17+
*/
18+
function add_hooks() {
19+
1220
add_action( 'admin_notices', array( $this, 'dismiss_notice' ), 50 );
1321
add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 );
1422

@@ -44,13 +52,14 @@ function __construct() {
4452
add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
4553

4654
//Hooks for no-conflict functionality
47-
add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
48-
add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
55+
add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
56+
add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
57+
58+
add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
59+
add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
60+
add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
61+
add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
4962

50-
add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
51-
add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 1);
52-
add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
53-
add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
5463
}
5564

5665
/**
@@ -86,11 +95,11 @@ public function backend_actions() {
8695
* @access public
8796
* @static
8897
* @param mixed $links
89-
* @return void
98+
* @return array Action links with Support included
9099
*/
91100
public static function plugin_action_links( $links ) {
92101

93-
$action = array( '<a href="https://gravityview.co/support/documentation/">'. esc_html__( 'Support', 'gravityview' ) .'</a>' );
102+
$action = array( '<a href="http://docs.gravityview.co">'. esc_html__( 'Support', 'gravityview' ) .'</a>' );
94103

95104
return array_merge( $action, $links );
96105
}
@@ -192,14 +201,18 @@ function post_updated_messages( $messages, $bulk_counts = NULL ) {
192201
* @return void
193202
*/
194203
function no_conflict_scripts() {
204+
global $wp_scripts;
195205

196-
global $gravityview_settings;
206+
if( ! gravityview_is_admin_page() ) {
207+
return;
208+
}
197209

198-
if( ! gravityview_is_admin_page() || empty( $gravityview_settings['no-conflict-mode'] ) ) {
210+
$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
211+
212+
if( empty( $no_conflict_mode ) ) {
199213
return;
200214
}
201215

202-
global $wp_scripts;
203216

204217
$wp_required_scripts = array(
205218
'debug-bar-extender',
@@ -220,35 +233,31 @@ function no_conflict_scripts() {
220233
'media-editor',
221234
'media-upload',
222235
'thickbox',
223-
'jquery-ui-dialog',
224-
'jquery-ui-tabs',
225-
'jquery-ui-draggable',
226-
'jquery-ui-droppable',
236+
'wp-color-picker',
227237

228238
'gform_tooltip_init',
229239
'gform_field_filter',
230240
'gform_forms',
231241

232-
// Redux Framework
242+
// Settings
243+
'gv-admin-edd-license',
244+
245+
// Common
233246
'select2-js',
234247
'qtip-js',
235-
'nouislider-js',
236-
'serializeForm-js',
237-
'ace-editor-js',
238-
'redux-vendor',
239-
'redux-js',
240-
'jquery',
248+
249+
// jQuery
250+
'jquery',
241251
'jquery-ui-core',
242252
'jquery-ui-sortable',
243253
'jquery-ui-datepicker',
244254
'jquery-ui-dialog',
245255
'jquery-ui-slider',
246-
'wp-color-picker',
256+
'jquery-ui-dialog',
257+
'jquery-ui-tabs',
258+
'jquery-ui-draggable',
259+
'jquery-ui-droppable',
247260
'jquery-ui-accordion',
248-
'redux-edd_license',
249-
'redux-field-edd_license-js',
250-
'redux-field-switch-js',
251-
'redux-field-media-js',
252261

253262
// WP SEO
254263
'wp-seo-metabox',
@@ -265,13 +274,14 @@ function no_conflict_scripts() {
265274
* @return void
266275
*/
267276
function no_conflict_styles() {
268-
global $gravityview_settings, $wp_styles;
277+
global $wp_styles;
269278

270279
if( ! gravityview_is_admin_page() ) {
271280
return;
272281
}
273282

274-
// Something's not right; the styles aren't registered.
283+
// Dequeue other jQuery styles even if no-conflict is off.
284+
// Terrible-looking tabs help no one.
275285
if( !empty( $wp_styles->registered ) ) {
276286
foreach ($wp_styles->registered as $key => $style) {
277287
if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
@@ -280,8 +290,10 @@ function no_conflict_styles() {
280290
}
281291
}
282292

283-
// Making sure jQuery is unset will be enough
284-
if( empty( $gravityview_settings['no-conflict-mode'] ) ) {
293+
$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode');
294+
295+
// If no conflict is off, jQuery will suffice.
296+
if( empty( $no_conflict_mode ) ) {
285297
return;
286298
}
287299

@@ -305,21 +317,8 @@ function no_conflict_styles() {
305317
'gform_tooltip',
306318
'gform_font_awesome',
307319

308-
// Redux Framework
309-
'redux-css',
310-
'redux-elusive-icon',
311-
'redux-elusive-icon-ie7',
312-
'select2-css',
313-
'redux-fields-css',
314-
'redux-admin-css',
315-
'qtip-css',
316-
'nouislider-css',
317-
'jquery-ui-css',
318-
'redux-rtl-css',
319-
'wp-color-picker',
320-
'redux-field-edd-css',
321-
'redux-field-info-css',
322-
'redux-field-edd_license-css',
320+
// Settings
321+
'gravityview_settings',
323322

324323
// WP SEO
325324
'wp-seo-metabox',
@@ -354,7 +353,7 @@ private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scr
354353
//reset queue
355354
$queue = array();
356355
foreach( $wp_objects->queue as $object ) {
357-
if( in_array( $object, $required_objects ) || preg_match('/gravityview|redux/ism', $object ) ) {
356+
if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
358357
$queue[] = $object;
359358
}
360359
}
@@ -422,7 +421,7 @@ function dismiss_notice() {
422421

423422
$dismissed_notices = array_unique( $dismissed_notices );
424423

425-
// Remind users every 8 weeks
424+
// Remind users every 16 weeks
426425
set_transient( 'gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16 );
427426

428427
}

includes/class-common.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,50 @@ public static function get_entry( $entry_slug, $force_allow_ids = false ) {
531531
return false;
532532
}
533533

534+
/**
535+
* Wrapper for the GFFormsModel::matches_operation() method that adds additional comparisons, including:
536+
* 'equals', 'greater_than_or_is', 'greater_than_or_equals', 'less_than_or_is', 'less_than_or_equals',
537+
* and 'not_contains'
538+
*
539+
* @link http://docs.gravityview.co/article/252-gvlogic-shortcode
540+
* @uses GFFormsModel::matches_operation
541+
* @since 1.7.5
542+
*
543+
* @param string $val1 Left side of comparison
544+
* @param string $val2 Right side of comparison
545+
* @param string $operation Type of comparison
546+
*
547+
* @return bool True: matches, false: not matches
548+
*/
549+
public static function matches_operation( $val1, $val2, $operation ) {
550+
551+
switch( $operation ) {
552+
case 'equals':
553+
$value = GFFormsModel::matches_operation( $val1, $val2, 'is' );
554+
break;
555+
case 'greater_than_or_is':
556+
case 'greater_than_or_equals':
557+
$is = GFFormsModel::matches_operation( $val1, $val2, 'is' );
558+
$gt = GFFormsModel::matches_operation( $val1, $val2, 'greater_than' );
559+
$value = ( $is || $gt );
560+
break;
561+
case 'less_than_or_is':
562+
case 'less_than_or_equals':
563+
$is = GFFormsModel::matches_operation( $val1, $val2, 'is' );
564+
$gt = GFFormsModel::matches_operation( $val1, $val2, 'less_than' );
565+
$value = ( $is || $gt );
566+
break;
567+
case 'not_contains':
568+
$contains = GFFormsModel::matches_operation( $val1, $val2, 'contains' );
569+
$value = !$contains;
570+
break;
571+
default:
572+
$value = GFFormsModel::matches_operation( $val1, $val2, $operation );
573+
}
574+
575+
return $value;
576+
}
577+
534578
/**
535579
*
536580
* Checks if a certain entry is valid according to the View search filters (specially the Adv Filters)

0 commit comments

Comments
 (0)