Skip to content

Commit

Permalink
Merge pull request #827 from gravityview/develop
Browse files Browse the repository at this point in the history
Version 1.19.4
  • Loading branch information
zackkatz authored Jan 20, 2017
2 parents 39734d5 + 9e1882c commit 9bfb60b
Show file tree
Hide file tree
Showing 111 changed files with 14,697 additions and 7,421 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ matrix:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1
exclude:
- php: 7.0
env: WP_VERSION=4.0 WP_MULTISITE=0
- php: hhvm
env: WP_VERSION=4.0 WP_MULTISITE=0

Expand Down
1 change: 1 addition & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ host = https://www.transifex.com

[gravityview.gravityview]
file_filter = languages/gravityview-<lang>.po
source_file = languages/gravityview.pot
source_lang = en
type = PO
lang_map = it: it_IT, bn: bn_BD, sv: sv_SE
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module.exports = function(grunt) {
addtextdomain: {
options: {
textdomain: 'gravityview', // Project text domain.
updateDomains: [ 'gravityview', 'gravity-view', 'gravityforms', 'edd_sl', 'edd' ] // List of text domains to replace.
updateDomains: [ 'gravityview', 'gravity-view', 'gravityforms', 'edd_sl', 'edd', 'easy-digital-downloads' ] // List of text domains to replace.
},
target: {
files: {
Expand Down
28 changes: 28 additions & 0 deletions future/gravityview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/** If this file is called directly, abort. */
if ( ! defined( 'GRAVITYVIEW_DIR' ) )
die();

/** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */
if ( version_compare( phpversion(), '5.3' , '<' ) )
return false;

/** @define "GRAVITYVIEW_DIR" "../" Require core */
require GRAVITYVIEW_DIR . 'future/includes/class-gv-core.php';

/**
* The main GravityView wrapper function.
*
* Exposes classes and functionality via the \GV\Core instance.
*
* @api
* @since 2.0
*
* @return \GV\Core A global Core instance.
*/
function gravityview() {
return \GV\Core::get();
}

/** Liftoff...*/
gravityview();
77 changes: 77 additions & 0 deletions future/includes/class-gv-core.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
namespace GV;

/** If this file is called directly, abort. */
if ( ! defined( 'GRAVITYVIEW_DIR' ) )
die();

/**
* The core GravityView API.
*
* Returned by the wrapper gravityview() global function, exposes
* all the required public functionality and classes, sets up global
* state depending on current request context, etc.
*/
final class Core {
/**
* @var \GV\Core The \GV\Core static instance.
*/
private static $__instance = null;

/**
* @var \GV\Plugin The WordPress plugin context.
*
* @api
* @since future
*/
public $plugin;

/**
* @var \GV\Request The current request.
*
* @api
* @since future
*/
public $request;

/**
* @var \GV\CoreSettings core GravityView settings
*/
public $settings;

/**
* Get the global instance of \GV\Core.
*
* @return \GV\Core The global instance of GravityView Core.
*/
public static function get() {
if ( ! self::$__instance instanceof self )
self::$__instance = new self;
return self::$__instance;
}

/**
* Bootstrap.
*
* @return void
*/
private function __construct() {
$this->init();
}

/**
* Early initialization.
*
* Loads dependencies, sets up the object, adds hooks, etc.
*
* @return void
*/
private function init() {
require_once dirname( __FILE__ ) . '/class-gv-plugin.php';
$this->plugin = \GV\Plugin::get();
}

private function __clone() { }

private function __wakeup() { }
}
238 changes: 238 additions & 0 deletions future/includes/class-gv-plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?php
namespace GV;

/** If this file is called directly, abort. */
if ( ! defined( 'GRAVITYVIEW_DIR' ) )
die();

/**
* The GravityView WordPress plugin class.
*
* Contains functionality related to GravityView being
* a WordPress plugin and doing WordPress pluginy things.
*
* Accessible via gravityview()->plugin
*/
final class Plugin {
/**
* @var string The plugin version.
*
* @api
* @since future
*/
public $version = 'future';

/**
* @var string Minimum WordPress version.
*
* GravityView requires at least this version of WordPress to function properly.
*/
private static $min_wp_version = '4.0';

/**
* @var string Minimum Gravity Forms version.
*
* GravityView requires at least this version of Gravity Forms to function properly.
*/
private static $min_gf_version = '1.9.14';

/**
* @var string Minimum PHP version.
*
* GravityView requires at least this version of PHP to function properly.
*/
private static $min_php_version = '5.3.0';

/**
* @var string|bool Minimum future PHP version.
*
* GravityView will require this version of PHP soon. False if no future PHP version changes are planned.
*/
private static $future_min_php_version = false;

/**
* @var string|bool Minimum future Gravity Forms version.
*
* GravityView will require this version of Gravity Forms soon. False if no future Gravity Forms version changes are planned.
*/
private static $future_min_gf_version = false;

/**
* @var \GV\Plugin The \GV\Plugin static instance.
*/
private static $__instance = null;

/**
* Get the global instance of \GV\Plugin.
*
* @return \GV\Plugin The global instance of GravityView Plugin.
*/
public static function get() {
if ( ! self::$__instance instanceof self )
self::$__instance = new self;
return self::$__instance;
}

/**
* Bootstrap.
*
* @return void
*/
private function __construct() {
$this->init();
}

/**
* Initialize all plugin hooks, constants, settings, etc.
*
* @return void
*/
private function init() {
/** Register hooks that are fired when the plugin is activated and deactivated. */
register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) );
register_deactivation_hook( $this->dir( 'gravityview.php' ), array( $this, 'deactivate' ) );
}

/**
* Plugin activation function.
*
* @internal
* @return void
*/
public function activate() {
}

/**
* Plugin deactivation function.
*
* @internal
* @return void
*/
public function deactivate() {
}

/**
* Retrieve an absolute path within the Gravity Forms plugin directory.
*
* @api
* @since future
*
* @param string $path Optional. Append this extra path component.
* @return string The absolute path to the plugin directory.
*/
public function dir( $path = '' ) {
return GRAVITYVIEW_DIR . ltrim( $path, '/' );
}

/**
* Retrieve a URL within the Gravity Forms plugin directory.
*
* @api
* @since future
*
* @param string $path Optional. Extra path appended to the URL.
* @return The URL to this plugin, with trailing slash.
*/
public function url( $path = '/' ) {
return plugins_url( $path, $this->dir( 'gravityview.php' ) );
}

/**
* Is everything compatible with this version of GravityView?
*
* @api
* @since future
*
* @return bool
*/
public function is_compatible() {
return
$this->is_compatible_php()
&& $this->is_compatible_wordpress()
&& $this->is_compatible_gravityforms();
}

/**
* Is this version of GravityView compatible with the current version of PHP?
*
* @api
* @since future
*
* @return bool true if compatible, false otherwise.
*/
public function is_compatible_php() {
return version_compare( $this->get_php_version(), self::$min_php_version, '>=' );
}

/**
* Is this version of GravityView compatible with the current version of WordPress?
*
* @api
* @since future
*
* @return bool true if compatible, false otherwise.
*/
public function is_compatible_wordpress() {
return version_compare( $this->get_wordpress_version(), self::$min_wp_version, '>=' );
}

/**
* Is this version of GravityView compatible with the current version of Gravity Forms?
*
* @api
* @since future
*
* @return bool true if compatible, false otherwise (or not active/installed).
*/
public function is_compatible_gravityforms() {
try {
return version_compare( $this->get_gravityforms_version(), self::$min_gf_version, '>=' );
} catch ( \ErrorException $e ) {
return false;
}
}

/**
* Retrieve the current PHP version.
*
* Overridable with GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE during testing.
*
* @return string The version of PHP.
*/
private function get_php_version() {
return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
}

/**
* Retrieve the current WordPress version.
*
* Overridable with GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE during testing.
*
* @return string The version of WordPress.
*/
private function get_wordpress_version() {
return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
}

/**
* Retrieve the current Gravity Forms version.
*
* Overridable with GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE during testing.
*
* @throws \ErrorException If the Gravity Forms plugin is not active or installed (E_ERROR severity)
* @return string The version of Gravity Forms.
*/
private function get_gravityforms_version() {
if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) )
throw new \ErrorException( __( 'Gravity Forms is inactive or not installed.', 'gravityview' ) );

return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
}

private function __clone() { }

private function __wakeup() { }
}
1 change: 1 addition & 0 deletions future/includes/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden
1 change: 1 addition & 0 deletions future/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden
Loading

0 comments on commit 9bfb60b

Please sign in to comment.