-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #827 from gravityview/develop
Version 1.19.4
- Loading branch information
Showing
111 changed files
with
14,697 additions
and
7,421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php // Silence is golden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php // Silence is golden |
Oops, something went wrong.