Skip to content

Commit

Permalink
Merge pull request #439 from katzwebservices/version/1.12
Browse files Browse the repository at this point in the history
Version 1.12
  • Loading branch information
zackkatz committed Aug 6, 2015
2 parents 5b2bd38 + ed5c42d commit 57bd801
Show file tree
Hide file tree
Showing 79 changed files with 16,387 additions and 3,972 deletions.
52 changes: 46 additions & 6 deletions assets/js/admin-edd-license.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,64 @@

},

/**
* Take a string that may be JSON or may be JSON
*
* @since 1.12
* @param {string} string JSON text to attempt to parse
* @returns {object} Either JSON-parsed object or object with a message key containing an error message
*/
parse_response_json: function( string ) {
var response_object;

// Parse valid JSON
try {

response_object = $.parseJSON( string );

} catch( exception ) {

// The JSON didn't parse most likely because PHP warnings.
// We attempt to strip out all content up to the expected JSON `{"`
var second_try = string.replace(/((.|\n)+?){"/gm, "{\"");

try {

response_object = $.parseJSON( second_try );

} catch( exception ) {

console.log( '*** \n*** \n*** Error-causing response:\n***\n***\n', string );

var error_message = 'JSON failed: another plugin caused a conflict with completing this request. Check your browser\'s Javascript console to view the invalid content.';

response_object = {
message: '<div id="gv-edd-status" class="gv-edd-message inline error"><p>' + error_message + '</p></div>'
};
}
}

return response_object;
},

post_data: function( theData ) {

$.post( ajaxurl, {
'action': 'gravityview_license',
'data': theData
}, function ( response ) {

response = $.parseJSON( response );
var response_object = GV_EDD.parse_response_json( response );

GV_EDD.message = response.message;
GV_EDD.message = response_object.message;

if( theData.edd_action !== 'check_license' ) {
$( '#license_key_status' ).val( response.license );
$( '#license_key_response' ).val( JSON.stringify( response ) );
$( document ).trigger( 'gv-edd-' + response.license, response );
$( '#license_key_status' ).val( response_object.license );
$( '#license_key_response' ).val( JSON.stringify( response_object ) );
$( document ).trigger( 'gv-edd-' + response_object.license, response_object );
}

GV_EDD.update_status( response.message );
GV_EDD.update_status( response_object.message );

$( '#gform-settings')
.css('cursor', 'default')
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin-edd-license.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 19 additions & 12 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Plugin Name: GravityView
* Plugin URI: http://gravityview.co
* Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output.
* Version: 1.11.2
* Version: 1.12
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* Text Domain: gravityview
Expand Down Expand Up @@ -52,13 +52,21 @@

/**
* GravityView requires at least this version of WordPress to function properly.
* @since 1.11.3
* @since 1.12
*/
define( 'GV_MIN_WP_VERSION', '3.3' );

/**
* GravityView requires at least this version of PHP to function properly.
* @since 1.12
*/
define( 'GV_MIN_PHP_VERSION', '5.2.4' );

/** Load common & connector functions */
require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' );
require_once( GRAVITYVIEW_DIR . 'includes/class-common.php');
require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php');
require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' );

/** Register Post Types and Rewrite Rules */
require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php');
Expand All @@ -77,9 +85,9 @@
*/
final class GravityView_Plugin {

const version = '1.11.2';
const version = '1.12';

public static $theInstance;
private static $instance;

/**
* Singleton instance
Expand All @@ -88,16 +96,16 @@ final class GravityView_Plugin {
*/
public static function getInstance() {

if( empty( self::$theInstance ) ) {
self::$theInstance = new GravityView_Plugin;
if( empty( self::$instance ) ) {
self::$instance = new self;
}

return self::$theInstance;
return self::$instance;
}

private function __construct() {

require_once( GRAVITYVIEW_DIR .'includes/class-gravityview-compatibility.php' );
require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' );

if( ! GravityView_Compatibility::is_valid() ) {
return;
Expand All @@ -111,7 +119,7 @@ private function __construct() {
/**
* Add hooks to set up the plugin
*
* @since 1.11.3
* @since 1.12
*/
function add_hooks() {
// Load plugin text domain
Expand All @@ -127,7 +135,7 @@ function add_hooks() {
/**
* Include global plugin files
*
* @since 1.11.3
* @since 1.12
*/
function include_files() {

Expand Down Expand Up @@ -161,7 +169,6 @@ function include_files() {
include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' );
include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php');
include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' );
include_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' );
include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' );
include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' );
Expand All @@ -187,7 +194,7 @@ public static function is_network_activated() {
* @param mixed $network_wide
* @return void
*/
public static function activate( $network_wide ) {
public static function activate( $network_wide = false ) {

// register post types
GravityView_Post_Types::init_post_types();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class GravityView_Admin_Metaboxes {
*/
function __construct() {

if( !GravityView_Compatibility::is_valid() ) { return; }

self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/';

include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php';
Expand Down
Loading

0 comments on commit 57bd801

Please sign in to comment.